Ivan
Ivan

Reputation: 15912

HTML source indentation for ckeditor

When you add some code to a ckeditor in HTML view and then change to WYSIWYG view and come back, almost all HTML tags have been modified and have loose the indentation. Is there any way to prevent this behaviour? (parameter, plugin, hard code...)

For example:

<div class="former input">
    <span class="big horizontal">
        <label for="test">Hi world</label>
        <input class="medium free" id="test" name="test" type="text" />
    </span>
</div>

Becomes:

<div class="former input">
    <span class="big horizontal"><label for="test">Hi world</label><input class="medium free" id="test" name="test" type="text" /></span></div>

Upvotes: 2

Views: 2214

Answers (1)

codewaggle
codewaggle

Reputation: 4943

Here's a link to a page in the developer's guide:
Output Formatting

It explains how to control the layout of the HTML code that is output by the editor and has an example that sets the formatting for the <p> tag.

Try using the <p> tag example as a template and set the formatting for the <span>, <label> and <input> tags using the same approach.

writer.setRules( 'span',
writer.setRules( 'label',
writer.setRules( 'input',

Be Well,
Joe

Upvotes: 4

Related Questions