jquery, tinyMCE 2.1.3 - get content from the second instance

跟風遠走 提交于 2020-01-05 07:25:23

问题


This is how I initialized the tinyMCE plugin for two textareas in my webpage in php.

tinyMCE.init({
        mode : "textareas",
        theme : "advanced",
        //to add any new plugin add in this line
        plugins : "banglafkb,banglavkb,table,save,advhr,advimage,advlink,emotions,iespell,insertdatetime,preview,zoom,media,searchreplace,print,contextmenu,paste,directionality,fullscreen",
        theme_advanced_buttons1_add_before : "banglafkb,banglavkb",
        //theme_advanced_buttons1_add : "banglafkb,banglavkb",
        theme_advanced_buttons2_add : "fontselect, fontsizeselect ",
        //theme_advanced_buttons2_add_before: "cut,copy,paste,pastetext,pasteword,separator,search,replace,separator",
        //theme_advanced_buttons3_add_before : "tablecontrols,separator",
        //theme_advanced_buttons3_add : "emotions,iespell,media,advhr,separator,print,separator,ltr,rtl,separator,fullscreen",      
        theme_advanced_toolbar_location : "top",
        theme_advanced_toolbar_align : "left",
        theme_advanced_statusbar_location : "bottom",       
        content_css : "example_word.css",
            plugi2n_insertdate_dateFormat : "%Y-%m-%d",
            plugi2n_insertdate_timeFormat : "%H:%M:%S",
        external_link_list_url : "example_link_list.js",
        external_image_list_url : "example_image_list.js",
        media_external_list_url : "example_media_list.js",
        file_browser_callback : "fileBrowserCallBack",
        paste_use_dialog : false,
        theme_advanced_resizing : true,
        theme_advanced_resize_horizontal : false,
        theme_advanced_link_targets : "_something=My somthing;_something2=My somthing2;_something3=My somthing3;",
        paste_auto_cleanup_on_paste : true,
        paste_convert_headers_to_strong : false,
        paste_strip_class_attributes : "all",
        paste_remove_spans : false,
        paste_remove_styles : false,    
        force_p_newlines:false,
        width:'700'
    });

By using tinyMCE.getContent() I get the content for the first editor instance but I need to get the content of the second editor instance too, how can I get that ?

Please NOTE that I am using the 2.1.3 version to use plugins which were developed for that version only.

For further clarification:

The mentioned version is available here. and this is the example of that version with plugins that were developed for that version and which I need to use. The 'select keyboard' dropdown shows the plugin in action.


回答1:


Oh my ...! This tinymce version is so old. Newer versions will work and handle issues with newer browsers, something this old version is not capable of. Well, what you want is possible:

Buy calling tinyMCE.instances.mce_editor_0.getHTML() you get the Content of the first editor instace. To get the content of the second editor instance you may use

tinyMCE.instances.mce_editor_1.getHTML()

Update: Looks like i got a working solution withoutthe use of jQuery:

var instance = tinyMCE.get('mce_editor_1'); // get the editor instance
instance.select(); // select your editor instance
tinyMCE.getContent() // get the content


来源:https://stackoverflow.com/questions/15386834/jquery-tinymce-2-1-3-get-content-from-the-second-instance

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!