繁体   English   中英

Tinymce 4 图片上传无法正常工作

[英]Tinymce 4 image upload is not working as it should be

我正在尝试使用 Tiny mce4,但它无法正常工作。

我阅读了文档,然后使用了 tinymce 网站上提供的示例。

该脚本已经在运行,但我的元素有点没有格式,如下图所示,例如在插入/编辑图像时,我没有选择图像的搜索按钮。

在此处输入图片说明

你知道为什么会发生这种情况吗? 因为我使用的是您可以在此处看到的 tinymce 示例,并且在 tinymce 网站上运行良好,但与我一起使用时效果不佳!

我使用的代码与那个例子相同,它是这样的:

在这里,我调用我的 tinymce.min.jse 并启动 tinymce:

<script type="text/javascript" src="tinymce/js/tinymce/tinymce.min.js"></script>
<script type="text/javascript">
tinymce.init({
        selector: "textarea",
        plugins: [
                "advlist autolink autosave link image lists charmap print preview hr anchor pagebreak spellchecker",
                "searchreplace wordcount visualblocks visualchars code fullscreen insertdatetime media nonbreaking",
                "table contextmenu directionality emoticons template textcolor paste fullpage textcolor"
        ],

        toolbar1: "newdocument fullpage | bold italic underline strikethrough | alignleft aligncenter alignright alignjustify | styleselect formatselect fontselect fontsizeselect",
        toolbar2: "cut copy paste | searchreplace | bullist numlist | outdent indent blockquote | undo redo | link unlink anchor image media code | inserttime preview | forecolor backcolor",
        toolbar3: "table | hr removeformat | subscript superscript | charmap emoticons | print fullscreen | ltr rtl | spellchecker | visualchars visualblocks nonbreaking template pagebreak restoredraft",

        menubar: false,
        toolbar_items_size: 'small',

        style_formats: [
                {title: 'Bold text', inline: 'b'},
                {title: 'Red text', inline: 'span', styles: {color: '#ff0000'}},
                {title: 'Red header', block: 'h1', styles: {color: '#ff0000'}},
                {title: 'Example 1', inline: 'span', classes: 'example1'},
                {title: 'Example 2', inline: 'span', classes: 'example2'},
                {title: 'Table styles'},
                {title: 'Table row 1', selector: 'tr', classes: 'tablerow1'}
        ],

        templates: [
                {title: 'Test template 1', content: 'Test 1'},
                {title: 'Test template 2', content: 'Test 2'}
        ]
});</script>

</head>

然后我有我的表格:

<form method="post" action="somepage">
    <textarea name="content" style="width:100%"></textarea>
</form>

您在该站点中看到的是用于上传图片的tinymce editor moxiemanager插件。 它不是免费提供的。

有很多用于图像上传的插件 - php + tinymce对您在实施过程中所做的研究很少。

对于图像上传 - rails + tinymce最好的一个是PerfectlyNormal ,有关我已实施的更多信息,请查看

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM