elfinder 与 tinymce4 集成 - 设置菜单工具栏

elfinder with tinymce4 Integration - Setup menu toolbar

我想集成 elFinder Plugin into TinyMCE4, I did it following the wiki 页面并且我已经安装了 elFinder V: 2.1.35 : Integration with TinyMCE 4.X .它工作正常,但我想像这样设置 工具栏选项

uiOptions : {
            // toolbar configuration
            toolbar : [
                ['back', 'forward'],
                ['reload'],
                ['mkdir', 'upload'],
                ['search'],
                ['view']
            ],

            // directories tree options
            tree : {
                // expand current root on init
                openRootOnLoad : true,
                // auto load current dir parents
                syncTree : true
            },

            // navbar options
            navbar : {
                minWidth : 150,
                maxWidth : 500
            },

            // current working directory options
            cwd : {
                // display parent directory in listing as ".."
                oldSchool : false
            }
        }

但我仍然得到完整的选项栏: Full options bar

这是我在表单页面中 file_picker_callback 的代码:

function elFinderBrowser (callback, value, meta) {
        tinymce.activeEditor.windowManager.open({
            file: '/js/lib/tinymce/plugins/elfinder/elfinder.html',
            title: 'elFinder 2.1',
            width: 900,
            height: 450,
            resizable: 'no',
            uiOptions : {
                // toolbar configuration
                toolbar : [
                    ['back', 'forward'],
                    ['reload'],
                    ['mkdir', 'upload']
                    ['search'],
                    ['view']
                ],

                tree : {
                    openRootOnLoad : true,
                    syncTree : true
                },

                navbar : {
                    minWidth : 150,
                    maxWidth : 500
                },

                cwd : {
                    oldSchool : false
                }
            }
        }, {
            oninsert: function (file, fm) {
                var url, reg, info;

                url = fm.convAbsUrl(file.url);

                info = file.name + ' (' + fm.formatSize(file.size) + ')';

                // Provide file and text for the link dialog
                if (meta.filetype == 'file') {
                    callback(url, {text: info, title: info});
                }

                if (meta.filetype == 'image') {
                    callback(url, {alt: info});
                }

                if (meta.filetype == 'media') {
                    callback(url);
                }
            }
        });
        return false;
    }

有人知道如何传递该选项并使其正常工作吗?

如果您遵循 integration with TinyMCE 4.X and downloaded the main.mce.js 或创建了它,并且想使用以下命令设置 工具栏 选项:'back', 'forward','reload','mkdir','upload','search','view' 或其他命令。

您可以编辑 main.mce.js 文件并在 opts 中使用以下代码段:

opts = {
   //...Your settings (getFieCallback,url,lang,etc.)
   uiOptions: {
       // toolbar configuration
       toolbar: [ //Here you set up the options on toolbar
           ['back', 'forward', 'up'], ['reload', 'home'],
           ['undo','redo'],
           ['mkdir', 'upload'], ['getfile','|','quicklook'],
           ['search'],
           ['view', 'sort']
       ],    
       // directories tree options
       tree: {
           // expand current root on init
           openRootOnLoad: true,
           // auto load current dir parents
           syncTree: true
        },    
       // navbar options
       navbar: {
           minWidth: 150,
           maxWidth: 500
       },    
       // current working directory options
       cwd: {
       // display parent directory in listing as ".."
          oldSchool: false
       }
   }
}