Report an issue
Class

CKEDITOR.htmlWriter

class

The class used to write HTML data.

var writer = new CKEDITOR.htmlWriter();
writer.openTag( 'p' );
writer.attribute( 'class', 'MyClass' );
writer.openTagClose( 'p' );
writer.text( 'Hello' );
writer.closeTag( 'p' );
alert( writer.getHtml() ); // '<p class="MyClass">Hello</p>'

Filtering

Properties

  • indentationChars : String

    The characters to be used for each indentation step.

    // Use tab for indentation.
    editorInstance.dataProcessor.writer.indentationChars = '\t';
    

    Defaults to '\t'

  • lineBreakChars : String

    The characters to be used for line breaks.

    // Use CRLF for line breaks.
    editorInstance.dataProcessor.writer.lineBreakChars = '\r\n';
    

    Defaults to '\n'

  • selfClosingEnd : String

    The characters to be used to close "self-closing" elements, like <br> or <img>.

    // Use HTML4 notation for self-closing elements.
    editorInstance.dataProcessor.writer.selfClosingEnd = '>';
    

    Defaults to ' />'

Methods