How to get tinymce (rich editor in browser) to keep indentation

PROBLEM: I use Drupal with a rich editor, and a rich editor likes to compress text, removing indentation and formatting. This would not be acceptable in a desktop editor, but people seem to be porting this using wyswigs in a browser.

QUESTION: How to disable this. I searched, and I have yet to find a better way to tell the rich editor to keep the indentation and formatting of the text.

+5
source share
5 answers

add this configuration to tinymce script initialization

tinymce.init({
    protect: [/[\n\f\r\t\v]/g]
});
+3
source

, , drupal htmlpurifier HTML HTML . , .

htmltidy, , .

+2

, , - , xhtml. xhtml ( PRE) .

tinyMCE, , :

* {white-space: pre;}

content_css . , , WYSIWYG , - HTML .

, PRE, tinyMCE (, ).

EDIT:

mikl, tinyMCE

+1

TinyMCE , 2015 TinyMCE , . , , preformatted , <pre>. - , , .

http://community.tinymce.com/forum/viewtopic.php?id=26021

The thread repeatedly suggests that WYSIWYG code be an honest game for complete reformatting, and it is best to reformat on the server side. Never think that the goal is to have minimal reformatting, so the server tool also destroys the structure of the document. This is WONTFIX according to the developers of TinyMCE, so I doubt it will change in the foreseeable future.

0
source

All Articles