Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to get tinymce (in-browser "rich editor") to preserve indentation

PROBLEM: I use Drupal with a rich-editor, and the rich editor likes to clobber my text by stripping out the indentation and formatting. This would be unacceptable in a desktop editor, but people seem to tolerate this with in-browser wyswigs.

QUESTION: How do I turn this off. I've searched around and I have yet to discover the best practice way of telling the rich-editor to preserve my indentation and text formatting.

like image 673
dreftymac Avatar asked Jun 05 '09 21:06

dreftymac


2 Answers

add this configuration to the tinymce init script

tinymce.init({
    protect: [/[\n\f\r\t\v]/g]
});
like image 96
mohsinulhaq Avatar answered Oct 02 '22 00:10

mohsinulhaq


This may not be exactly what you are looking for, but the drupal htmlpurifier module can tidy up the HTML and make your HTML standard compliant. It may remove the indentation but it is very useful.

Another simpler module is htmltidy, not sure if it can preserve indentation.

like image 32
farooqsadiq Avatar answered Oct 02 '22 00:10

farooqsadiq