tinymce中缺少与上传相关的浏览选项

时间:2019-04-02 05:52:40

标签: javascript jquery tinymce

我正在研究tinymce富文本编辑器。 我曾在RTF菜单中使用过fileupload选项。 不幸的是,我不是无意获得文件上传弹出窗口的浏览选项。

Without browse option

预期结果: 取自https://codepen.io/nirajmchauhan/pen/EjQLpV Expected result

我的代码:

function loadTinyMCEEditor() {
        tinyMCE.init({
            selector: "textarea",
            theme: "modern",
            menu: { // this is the complete default configuration
                file: { title: 'File', items: 'newdocument' },
                edit: { title: 'Edit', items: 'undo redo | cut copy paste pastetext | selectall' },

                insert: { title: 'Insert', items: 'link media | template hr' },
                view: { title: 'View', items: 'visualaid' },
                format: { title: 'Format', items: 'bold italic underline strikethrough superscript subscript | formats | removeformat' },

                tools: { title: 'Tools', items: 'spellchecker code' }
            },
            plugins: [
  "advlist autolink lists link image charmap print preview hr anchor pagebreak",
  "searchreplace wordcount visualblocks visualchars code fullscreen",

            ],
            toolbar1: "insertfile undo redo | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image",

            toolbar_items_size: 'small',
            setup: function (ed) {
                ed.on('blur', function (x,e) {
                    debugger;
                    var x = $(x.target.editorContainer).find('iframe')[0];
                    var idis = $(x).attr('id');
                    var fields = idis.split('_');

                    var bp = fields[2];
                    var bplevel = fields[3];
                    tinyMCE.triggerSave();
                    var doc = document.getElementById(idis).contentDocument;
                    var g = doc.all[0]
                    var val = g.innerHTML
                    AutoSaveLevel(val, bp, bplevel);
                    console.log('blur event fired.');
                });
            }
        });
    }

1 个答案:

答案 0 :(得分:0)

file_picker_callback:配置对象中定义tiny.init()字段时,将创建文件夹图标。

来自docs

  

定义file_picker_callback后,小的浏览按钮将出现在受支持文件类型的字段中(请参见file_picker_types)。