1

Topic: To preserve line breaks in editor after converting to plain text

Below is the settings which I am trying to use in my editor.while converting rich text to plain text I am using tinymce.setContent(..) to convert it to raw format,but unable to preserve line breaks or add a additional space in between the text if a <br/> or a \r\n is found.

Any help appreciated!!!

tinymce.init({
                mode: "textarea",             
                plugins: [...],
                toolbar1: "...",                                                 
                force_br_newlines : true,
                force_p_newlines : true,
                forced_root_block : '',
                remove_linebreaks : false,
                convert_newlines_to_br: true,
               
                //setup: function (editor) {
                //    editor.on('BeforeSetContent', function (contentEvent){
                //        contentEvent.content = contentEvent.content.replace(/\r?\n/g, '  ');
                //    })
                //}
            });


tinymce.activeEditor.setContent($("#txtrichtextedior").val(), {format : 'raw'});

Last edited by DeepeshN (2016-08-01 08:04:54)