tinymce 4:如何创建自己的文件管理器?

我正在尝试制作自己的文件浏览器,以便我可以从我的文件管理器中选择图像并将其发送到tinymce的图像链接字段,但是我无法在其他任何地方找到有关如何实现此目的的更多信息。

这是在插入/编辑图像上方打开新弹出窗口的代码,

file_browser_callback: function(field_name, url, type, win) {

    //tinymce.activeEditor.windowManager.close();
    //console.log(field_name);

    tinymce.activeEditor.windowManager.open({
        title: 'Browse Image',
        file: "yourbrowser.php?field=" + field_name + "&url=" + url,
        width: 450,
        height: 305,
        resizable : "no",
        inline : "yes",
        close_previous : "no",
        buttons: [{
            text: 'Insert',
            classes: 'widget btn primary first abs-layout-item',
            disabled: true,
            onclick: 'close'
        }, {
            text: 'Close',
            onclick: 'close',
            window : win,
            input : field_name
        }]
    });

    return false;
},

这是我坚持的地方 - 我如何从我的文件管理器中选择一个图像并将其发送到插入/编辑图像弹出窗口中的图像链接?

以下是我迄今为止的完整代码,

$(document).ready(function(){

        $('.button').click(function(){

            // @reference: http://www.tinymce.com/wiki.php/api4:method.tinymce.remove#
            if(tinyMCE.editors.length > 0) {

                // Remove all editors bound to textareas
                //tinymce.remove('textarea');

                // Remove all editors
                tinymce.remove();
            }

            $('.content').load('full.html', function() {

                if(tinyMCE.editors.length == 0) {

                    tinymce.init({
                        //selector: "textarea",
                        mode : "textareas",
                        editor_selector : "mce-customised",
                        editor_deselector : "not-editor",
                        theme: "modern",
                        plugins: [
                            "advlist autolink lists link image charmap print preview hr anchor pagebreak",
                            "searchreplace wordcount visualblocks visualchars code fullscreen",
                            "insertdatetime media nonbreaking save table contextmenu directionality",
                            "emoticons template paste textcolor"
                        ],
                        toolbar1: "insertfile undo redo | styleselect | bold italic underline strikethrough | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image",
                        toolbar2: "print preview media | forecolor backcolor emoticons",
                        image_advtab: true,

                        file_browser_callback: function(field_name, url, type, win) {

                            //tinymce.activeEditor.windowManager.close();
                            //console.log(field_name);

                            tinymce.activeEditor.windowManager.open({
                                title: 'Browse Image',
                                file: "yourbrowser.php?field=" + field_name + "&url=" + url,
                                width: 450,
                                height: 305,
                                resizable : "no",
                                inline : "yes",
                                close_previous : "no",
                                buttons: [{
                                    text: 'Insert',
                                    classes: 'widget btn primary first abs-layout-item',
                                    disabled: true,
                                    onclick: 'close'
                                }, {
                                    text: 'Close',
                                    onclick: 'close',
                                    window : win,
                                    input : field_name
                                }]
                            });

                            return false;
                        },


                        // Specifying an Absolute Image Path
                        document_base_url : "http://localhost/test/2013/js/tinymce/tinymce_4.0.2/",
                        relative_urls : false,
                        remove_script_host : false,


                        image_list: "image_list.php",
                        link_list: "link_list.php"
                    });

                    $('.button-submit').submit_form();
                }

            });

            return false;
        });

    });

测试网站。

或者,你知道任何与tinymce一起工作的好文件mananger插件吗?


也许你应该在这里找到有用的信息:配置:file_browser_callback

win.document.getElementById(field_name).value = 'my browser value';

在这里:tinymce论坛

链接地址: http://www.djcxy.com/p/73119.html

上一篇: tinymce 4: how to create your own file manager?

下一篇: Gridview click not working inside the Custom Listview