# CKEDITOR.htmlDataProcessor

class

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

## Properties

• ### dataFilter : filterCKEDITOR.htmlDataProcessor#dataFilter

Data filter used when processing input by toHtml.

• ### htmlFilter : filterCKEDITOR.htmlDataProcessor#htmlFilter

HTML filter used when processing output by toDataFormat.

• ### writer : basicWriterCKEDITOR.htmlDataProcessor#writer

The HTML writer used by this data processor to format the output.

## Methods

• ### constructor( editor ) → htmlDataProcessorCKEDITOR.htmlDataProcessor#constructor

Creates an htmlDataProcessor class instance.

#### Parameters

editor : editor

#### Returns

htmlDataProcessor
• ### toDataFormat( html, [ options ] ) → StringCKEDITOR.htmlDataProcessor#toDataFormat

This method fires the CKEDITOR.editor.toDataFormat event which makes it possible to hook into the process at various stages.

#### Parameters

html : String
[ options ] : Object

The options object.

Properties
[ context ] : String

The tag name of the context element within which the input is to be processed, defaults to the editable element.

[ filter ] : filter

When specified, instead of using the main filter, the passed instance will be used to apply content transformations to the content.

[ enterMode ] : Number

When specified, it will be used instead of the main enterMode.

#### Returns

String
• ### toHtml( data, [ options ] ) → StringCKEDITOR.htmlDataProcessor#toHtml

Processes the (potentially malformed) input HTML to a purified form which is suitable for using in the WYSIWYG editable.

This method fires the CKEDITOR.editor.toHtml event which makes it possible to hook into the process at various stages.

Note: Since CKEditor 4.3.0 the signature of this method changed and all options are now grouped in one options object. Previously context, fixForBody and dontFilter were passed separately.

#### Parameters

data : String

The raw data.

[ options ] : Object

The options object.

Properties
[ context ] : String

The tag name of a context element within which the input is to be processed, defaults to the editable element. If null is passed, then data will be parsed without context (as children of CKEDITOR.htmlParser.fragment). See CKEDITOR.htmlParser.fragment.fromHtml for more details.

[ fixForBody ] : Boolean

Whether to trigger the auto paragraph for non-block content.

Defaults to true

[ filter ] : filter

When specified, instead of using the main filter, the passed instance will be used to filter the content.

[ dontFilter ] : Boolean

Do not filter data with CKEDITOR.filter (note: transformations will still be applied).

[ enterMode ] : Number

When specified, it will be used instead of the main enterMode.

[ protectedWhitespaces ] : Boolean

Indicates that content was wrapped with <span> elements to preserve leading and trailing whitespaces. Option used by the CKEDITOR.editor.insertHtml method.

#### Returns

String