javascript - CKEditor and elFinder in modal dialog -
i need integrate elfinder ckeditor. followed this:
https://github.com/studio-42/elfinder/wiki/integration-with-ckeditor
it working opening pop-up window image selection not nice want open elfinder in modal dialog.
for "modal integration" followed thread: http://bxuulgygd9.tal.ki/20110728/integration-with-ckeditor-759177/
the last post there partially works. opens elfinder in modal. but: when want insert image url url field in ckfinder have know exact id. not fill image resolution , brings other problems. best solution run function called in "ordinary popup" integration, handles everything:
window.opener.ckeditor.tools.callfunction(funcnum, file); but in "popup integration", funcnum callback registered, in modal integration it not i'm unable call it. have tip run elfinder (or other image manager - same) in modal window? i'm desperate.
i have solved myself. code combination of several tutorials , allows integrate elfinder in modal window. maybe consider 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; (var = 0; < 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') } }) } } } });
Comments
Post a Comment