我正在尝试使用tinymce-image-upload gem 和tinymce-rails gem设置图片上传。我在 tinymce-image-upload 设置中的步骤之一遇到问题:
像往常一样设置 TinyMCE,但在调用 .tinymce() 时,添加
plugins: "uploadimage"
#toolbar option must include "uploadimage" somewhere to have the button appear
因为我使用的是 tinymce-rails 我有
<%= tinymce %>
在视图底部初始化tinymce。但是,我不确定如何添加:
plugins: "uploadimage"
在演示中,它被添加到 javascript 中,如下所示:
<script type="text/javascript">
$("document:ready", function() {
$("[rel=tinymce]").tinymce({
theme: "modern",
toolbar: "bold,italic,underline,|,bullist,numlist,outdent,indent,|,undo,redo,|,pastetext,pasteword,selectall,|,uploadimage",
pagebreak_separator: "<p class='page-separator'> </p>",
plugins: ["uploadimage"],
relative_urls: false,
remove_script_host: false,
document_base_url: (!window.location.origin ? window.location.protocol + "//" + window.location.host : window.location.origin) + "/",
})
});
</script>