HtmlDataProcessor
The HTML data processor class. This data processor implementation uses HTML as input and output data.
Properties
-
module:engine/dataprocessor/htmldataprocessor~HtmlDataProcessor#domConverterA DOM converter used to convert DOM elements to view elements.
-
domParser : DOMParsermodule:engine/dataprocessor/htmldataprocessor~HtmlDataProcessor#domParserA DOM parser instance used to parse an HTML string to an HTML document.
-
module:engine/dataprocessor/htmldataprocessor~HtmlDataProcessor#htmlWriterA basic HTML writer instance used to convert DOM elements to an HTML string.
-
skipComments : booleanmodule:engine/dataprocessor/htmldataprocessor~HtmlDataProcessor#skipCommentsIf
false, comment nodes will be converted to$comment. Otherwise comment nodes are ignored.
Methods
-
constructor( document )module:engine/dataprocessor/htmldataprocessor~HtmlDataProcessor#constructorCreates a new instance of the HTML data processor class.
Parameters
document : ViewDocumentThe view document instance.
-
registerRawContentMatcher( pattern ) → voidmodule:engine/dataprocessor/htmldataprocessor~HtmlDataProcessor#registerRawContentMatcherRegisters a
MatcherPatternfor view elements whose content should be treated as raw data and not processed during the conversion from the DOM to the view elements.The raw data can be later accessed by a custom property of a view element called
"$rawContent".Parameters
pattern : MatcherPatternPattern matching all view elements whose content should be treated as raw data.
Returns
void
-
toData( viewFragment ) → stringmodule:engine/dataprocessor/htmldataprocessor~HtmlDataProcessor#toDataConverts a provided document fragment to data format – in this case to an HTML string.
Parameters
viewFragment : ViewDocumentFragment
Returns
stringHTML string.
-
toView( data ) → ViewDocumentFragmentmodule:engine/dataprocessor/htmldataprocessor~HtmlDataProcessor#toViewConverts the provided HTML string to a view tree.
Parameters
data : stringAn HTML string.
Returns
ViewDocumentFragmentA converted view element.
-
useFillerType( type ) → voidmodule:engine/dataprocessor/htmldataprocessor~HtmlDataProcessor#useFillerTypeIf the processor is set to use marked fillers, it will insert
fillers wrapped in<span>elements (<span data-cke-filler="true"> </span>) instead of regular characters.This mode allows for a more precise handling of the block fillers (so they do not leak into the editor content) but bloats the editor data with additional markup.
This mode may be required by some features and will be turned on by them automatically.
Parameters
type : 'default' | 'marked'Whether to use the default or the marked
block fillers.
Returns
void
-
_toDom( data ) → DocumentFragmentprotectedmodule:engine/dataprocessor/htmldataprocessor~HtmlDataProcessor#_toDomConverts an HTML string to its DOM representation. Returns a document fragment containing nodes parsed from the provided data.
Parameters
data : string
Returns
DocumentFragment