Search code examples
tinymcedjango-tinymce

TinyMCE - Pass value from Popup


I am using TinyMCE . On a Click I am opening an inline popup successfully.But I have no idea how I can pass a value from popup to tinyMCE.Any help highly appreciated.

tinyMCE.activeEditor.windowManager.open({
    file : "options.jsp",
    title : 'Image Manager',
    width : 800, 
    height : 600,
    resizable : "yes",
    inline : "yes", 
    close_previous : "no",
    win : window
    });

Solution

  • Took me some time to find it out myself. It is not that difficult. To insert HTML to your editor from the popup you may use something like

    var my_html_code = 'New phrase!';
    tinyMCEPopup.execCommand('mceInsertContent', false, my_html_code);
    

    Using tinyMCEPopup.editor you may address the editor from where you opened the popup. You could for example set a variable in the editor using

    tinyMCEPopup.editor.new_variable = 'blah blah';