DataProcessor (engine/dataprocessor)
@ckeditor/ckeditor5-engine/src/dataprocessor/dataprocessor
The data processor interface. It should be implemented by actual data processors.
Each data processor implements a certain format of the data. For example, Markdown data processor will convert the data (a Markdown string) to a document fragment and back.
Note: While the CKEditor 5 architecture supports changing the data format, in most scenarios we do recommend sticking to
the default format which is HTML (supported by the HtmlDataProcessor
).
HTML remains the best standard for rich-text data.
And please do remember – using Markdown does not automatically make your application/website secure.
Filtering
Properties
-
skipComments : boolean | undefined
module:engine/dataprocessor/dataprocessor~DataProcessor#skipComments
If
false
, comment nodes will be converted to$comment
. Otherwise comment nodes are ignored.
Methods
-
registerRawContentMatcher( pattern ) → void
module:engine/dataprocessor/dataprocessor~DataProcessor#registerRawContentMatcher
Registers a
MatcherPattern
for view elements whose content should be treated as raw data and its content should be converted to a custom property of a view element called"$rawContent"
while converting to view.Parameters
pattern : MatcherPattern
Pattern matching all view elements whose content should be treated as plain text.
Returns
void
-
toData( viewFragment ) → string
module:engine/dataprocessor/dataprocessor~DataProcessor#toData
Converts a document fragment to data.
Parameters
viewFragment : DocumentFragment
The document fragment to be processed.
Returns
string
-
toView( data ) → DocumentFragment
module:engine/dataprocessor/dataprocessor~DataProcessor#toView
Converts the data to a document fragment.
Parameters
data : string
The data to be processed.
Returns
-
useFillerType( type ) → void
module:engine/dataprocessor/dataprocessor~DataProcessor#useFillerType
If 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 more precise handling of 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 marked
block fillers.
Returns
void
Every day, we work hard to keep our documentation complete. Have you spotted outdated information? Is something missing? Please report it via our issue tracker.
With the release of version 42.0.0, we have rewritten much of our documentation to reflect the new import paths and features. We appreciate your feedback to help us ensure its accuracy and completeness.