I have some html-encoded text in TinyMCE v3.5.10
, say This is a <br/>market
.
I am trying to extract the html as well as the plain text equivalent of the above line. On IE, Firefox and Chrome, the above line is rendered as:
This is a
market
and this is the same as the plain text content extracted using: tinyMCE.get('inputText').getContent({format: 'text'});
On Firefox though, the line breaks are stripped out and what I get is: This is a market.
, not all what I was expecting.
My init for tinyMCE:
tinymce.init({
selector: "textarea",
plugins : "contextmenu", //,mainMenuBar",//,goToPage",
mode : "textareas",
theme : "advanced",
editor_deselector: "mceNoEditor",
theme_advanced_layout_manager : "SimpleLayout",
//toolbar : false,
//menubar : false, //removes the top menu bar.
//layout items.
theme_advanced_buttons1 : "",
theme_advanced_buttons2 : "",
theme_advanced_buttons3 : "",
//theme_advanced_toolbar : false,
theme_advanced_toolbar_location : "external",
theme_advanced_toolbar_align : "left",
statusbar : false,
theme_advanced_statusbar_location : "external",
theme_advanced_resizing : true,
theme_advanced_path : false,
//theme_advanced_buttons1 : "openFile,|,chooseVoice,setReadingMode,setReadingSpeed,|,lookupDictionary,translate,pictureDictionary,|,settings,|,logout",
//theme_advanced_buttons1 : "backToLibrary,|,play,setReadingSpeed,|,lookupDictionary,translate,pictureDictionary,|,pronounce,|,settings,|,moreOptions",
//paste_text_sticky: false,
//paste_text_sticky_default: false,
nowrap : false,
button_tile_map : true,
entity_encoding : "raw",
force_br_newlines : true,
forced_root_block : "", // Needed for 3.x
//valid_elements : "h1,h2,h3,h4,h5,h6,p,br,span[class|title|onmouseover|onmouseout|onclick|style],div[style],img[src|width|height|alt],hr,i",
event_elements : "span",
/*
paste_text_sticky : true,
pasteAsPlainText : true,
paste_auto_cleanup_on_paste : true,
paste_remove_styles: true,
paste_remove_styles_if_webkit: true,
paste_strip_class_attributes: true,
*/
setup: function(editor) {
editor.onInit.add(function(editor) {
editor.pasteAsPlainText = true;
//call function to create custom context (right-click) menu.
console.log("creating custom context menu.");
editor.plugins.contextmenu.onContextMenu.add(createCustomContextMenu);
//create bottom status bar for going to page number.
//goToPagePlugin();
});
}
});
As you can see, I thought this might be because of the paste_as_plain_text
being set to true, but even commenting it out does not seem to have had any effect.
Any help is most welcome.