javascript - CKEditor and elFinder in modal dialog - Stack Overflow

I need to integrate elFinder to CKEditor. I followed this:It is working but opening pop-up window for i

I need to integrate elFinder to CKEditor. I followed this:

It is working but opening pop-up window for image selection is not very nice so I want to open elFinder in modal dialog.

For "modal integration" i followed this thread: /

The last post there partially works. It really opens elfinder in modal. BUT: When I want to insert image URL to URL field in CKFinder I have to know its exact ID. Is also does not fill image resolution and brings some other problems. The best solution would be to run function called in "ordinary popup" integration, which handles everything:

window.opener.CKEDITOR.tools.callFunction(funcNum, file);

But in "popup integration", funcNum callback is registered, in modal integration it is not so I'm unable call it. Do you have any tip to run elfinder (or any other image manager - it would be the same) in modal window? I'm desperate.

I need to integrate elFinder to CKEditor. I followed this:

https://github./Studio-42/elFinder/wiki/Integration-with-CKEditor

It is working but opening pop-up window for image selection is not very nice so I want to open elFinder in modal dialog.

For "modal integration" i followed this thread: http://bxuulgygd9.tal.ki/20110728/integration-with-ckeditor-759177/

The last post there partially works. It really opens elfinder in modal. BUT: When I want to insert image URL to URL field in CKFinder I have to know its exact ID. Is also does not fill image resolution and brings some other problems. The best solution would be to run function called in "ordinary popup" integration, which handles everything:

window.opener.CKEDITOR.tools.callFunction(funcNum, file);

But in "popup integration", funcNum callback is registered, in modal integration it is not so I'm unable call it. Do you have any tip to run elfinder (or any other image manager - it would be the same) in modal window? I'm desperate.

Share Improve this question asked May 9, 2013 at 16:36 Martin StrouhalMartin Strouhal 1,2241 gold badge13 silver badges23 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 5

I have solved it myself. This code is bination of several tutorials and allows to fully integrate elFinder in modal window. Maybe somebody will consider it useful.

    CKEDITOR.on('dialogDefinition', function(event) {
    var editor = event.editor;
    var dialogDefinition = event.data.definition;
    console.log(event.editor);
    var dialogName = event.data.name;

    var tabCount = dialogDefinition.contents.length;
    for (var i = 0; i < tabCount; i++) {
        var browseButton = dialogDefinition.contents[i].get('browse');

        if (browseButton !== null) {
            browseButton.hidden = false;
            browseButton.onClick = function(dialog, i) {
                editor._.filebrowserSe = this;
                jQuery('<div \>').dialog({modal: true, width: "80%", title: "Insert image", zIndex: 99999,
                    create: function(event, ui) {
                        jQuery(this).elfinder({
                            resizable: false,
                            url: "/path/to/connector.php",
                            getFileCallback: function(url) {
                                CKEDITOR.tools.callFunction(editor._.filebrowserFn, url);
                                jQuery('a.ui-dialog-titlebar-close[role="button"]').click()
                            }
                        }).elfinder('instance')
                    }
                })
            }
        }
    }
});

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745107234a4611633.html

相关推荐

  • javascript - CKEditor and elFinder in modal dialog - Stack Overflow

    I need to integrate elFinder to CKEditor. I followed this:It is working but opening pop-up window for i

    13小时前
    20

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信