Report an issue
Class

CKEDITOR.htmlDataProcessor

class

Represents an HTML data processor, which is responsible for translating and transforming the editor data on input and output.

Filtering

Properties

Methods

  • constructor( editor ) → htmlDataProcessor

    Creates an htmlDataProcessor class instance.

    Parameters

    editor : editor

    Returns

    htmlDataProcessor
  • toDataFormat( html, fixForBody )

    inherited

    Transforms HTML into data to be output by the editor, in the format expected by the data processor.

    While the editor is able to handle non-HTML data (like BBCode), it can only handle HTML data at runtime. The role of the data processor is to transform the HTML data contained by the editor into a specific data format through this function.

    // Tranforming into BBCode data, with a custom BBCode data processor available.
    var html = '<p>This is <b>an example</b>.</p>';
    var data = editor.dataProcessor.toDataFormat( html ); // 'This is [b]an example[/b].'
    

    Parameters

    html : String

    The HTML to be transformed.

    fixForBody : String

    The tag name to be used if the output data is coming from the <body> element and may be eventually fixed for it. This is generally not used by non-HTML data processors.

  • toHtml( data, [ fixForBody ] )

    inherited

    Transforms input data into HTML to be loaded into the editor. While the editor is able to handle non-HTML data (like BBCode), it can only handle HTML data at runtime. The role of the data processor is to transform the input data into HTML through this function.

    // Tranforming BBCode data, with a custom BBCode data processor available.
    var data = 'This is [b]an example[/b].';
    var html = editor.dataProcessor.toHtml( data ); // '<p>This is <b>an example</b>.</p>'
    

    Parameters

    data : String

    The input data to be transformed.

    [ fixForBody ] : String

    The tag name to be used if the data must be fixed because it is supposed to be loaded direcly into the <body> tag. This is generally not used by non-HTML data processors. fixForBody type - compare to htmlDataProcessor.

  • protectSource( data )

    since 4.16.1 private

    Parameters

    data : String
  • unprotectRealComments( html )

    since 4.16.2 private

    Parameters

    html : String
  • unprotectSource( html )

    since 4.16.1 private

    Parameters

    html : String