Class

HtmlDataProcessor (engine/dataprocessor)

@ckeditor/ckeditor5-engine/src/dataprocessor/htmldataprocessor

class

The HTML data processor class. This data processor implementation uses HTML as input and output data.

Filtering

Properties

  • _domConverter : DomConverter

    private

    A DOM converter used to convert DOM elements to view elements.

  • _domParser : DOMParser

    private

    A DOM parser instance used to parse an HTML string to an HTML document.

  • _htmlWriter : BasicHtmlWriter

    private

    A basic HTML writer instance used to convert DOM elements to an HTML string.

Methods

  • constructor( document )

    Creates a new instance of the HTML data processor class.

    Parameters

    document : Document

    The view document instance.

  • toData( viewFragment ) → String

    Converts a provided document fragment to data format — in this case to an HTML string.

    Parameters

    viewFragment : DocumentFragment

    Returns

    String

    HTML string.

  • toView( data ) → Node | DocumentFragment | null

    Converts the provided HTML string to a view tree.

    Parameters

    data : String

    An HTML string.

    Returns

    Node | DocumentFragment | null

    A converted view element.

  • _toDom( data ) → DocumentFragment

    private

    Converts an HTML string to its DOM representation. Returns a document fragment containing nodes parsed from the provided data.

    Parameters

    data : String

    Returns

    DocumentFragment