CKEditor , how to disable HTML indented format

2019-08-01 05:31发布

问题:

I'd like to ask if there is a way to disable indented format of HTML source code in CKEditor. I don't want the HTML to be formatted because I want to store it in a database and there is no need for extra characters (line breaks and spaces). I just want the raw html without spaces and lines.

for example the HTML output in CKEditor is

<p>
    test 1</p>
<p>
    test 2</p>
<p>
    test 3</p>

but what I need is

<p>test 1</p><p>test 2</p><p>test 3</p>

回答1:

This doc at the CKEditor howto shows how you can modify the formatting of the output, so you just have to specify the rules that you want: http://docs.cksource.com/CKEditor_3.x/Howto/FCKeditor_HTML_Output