Hello,
I have a modal dialog that opens fine, it is a php page, but I don't know how to return the 2 variables back to the plugin command function.
The alert(media); shows null.
I simply need the javascript code chunk that sits in the php modal window.
I tried this:
but it does not work.
I have a modal dialog that opens fine, it is a php page, but I don't know how to return the 2 variables back to the plugin command function.
The alert(media); shows null.
(function() {
CKEDITOR.plugins.lexicon = {
};
var plugin = CKEDITOR.plugins.lexicon;
var commandFunction = {
exec : function(editor) {
var media = window.showModalDialog(editor.config.lexiconSelectUrl, null, "dialogWidth:750px;dialogHeight:500px;center:yes;resizable:yes;help:no;");
alert(media);
if (media != false && media != null) {
/* if (media.mediaUrl.substr(media.mediaUrl.length-4) == ".wmv") {
var x = '<div title="click to play video" onclick="showMediaClip(this,'' + media.mediaUrl + '',' + media.width + ',' + media.height + ')" style="cursor: pointer"><img alt="" src="' + media.mediaImage + '" /></div>';
editor.insertHtml(x);
} else {
editor.insertHtml("<img src='" + media.mediaUrl + "' />");
}*/
}
}
}
CKEDITOR.plugins.add('lexicon', {
lang : [CKEDITOR.config.currentLanguage],
requires : ['iframedialog'],
init: function(editor) {
var pluginName = 'lexicon';
var commandName = 'insertLexiconEntry';
var dialogName = 'lexiconLinkDialog';
CKEDITOR.dialog.add(dialogName, this.path + 'dialogs/lexicon.js');
editor.addCommand(commandName, commandFunction);
editor.ui.addButton('Lexicon', {
label : editor.lang.lexicon.toolbar_button,
command : commandName,
icon: CKEDITOR.plugins.getPath(pluginName) + 'images/lexicon.png'
});
}
});
})();
I simply need the javascript code chunk that sits in the php modal window.
I tried this:
<script type='text/javascript'>
window.opener.CKEDITOR.tools.callFunction('$CKEditorFuncNum', '$tooltipDomId', '$tooltipClassName');
</script>
but it does not work.

Re: How to return values from a modal dialog ?
Here is the javascript code chunk that sits in the modal popup window.
<script type='text/javascript'> var getSelectedText = function(editor) { var selectedText = ''; var selection = editor.getSelection(); if (selection.getType() == window.opener.CKEDITOR.SELECTION_TEXT) { if (window.opener.CKEDITOR.env.ie) { selection.unlock(true); selectedText = selection.getNative().createRange().text; } else { selectedText = selection.getNative(); } } return(selectedText); } var selectedText = getSelectedText(window.opener.CKEDITOR.instances.content); window.opener.CKEDITOR.instances.content.insertHtml('<span id="$tooltipDomId" class="$tooltipClassName">' + selectedText + '</span>'); </script>