# engine/conversion/upcasthelpers

module

<a id="classes">

## Classes

<a id="class-UpcastHelpers">

### [UpcastHelpers](module_engine_conversion_upcasthelpers-UpcastHelpers.md)

<a id="type-definitions">

## Type Definitions

<a id="typedef-UpcastAttributeCreatorFunction">

### `UpcastAttributeCreatorFunction`

<a id="typedef-UpcastElementCreatorFunction">

### `UpcastElementCreatorFunction`

<a id="typedef-UpcastMarkerFromAttributeCreatorFunction">

### `UpcastMarkerFromAttributeCreatorFunction`

<a id="typedef-UpcastMarkerFromElementCreatorFunction">

### `UpcastMarkerFromElementCreatorFunction`

<a id="functions">

## Functions

<a id="function-convertSelectionChange">

### `convertSelectionChange( model, mapper ) → ( evt: EventInfo, data: object ) => void` _(internal)_

Function factory, creates a callback function which converts a [view selection](module_engine_view_selection-ViewSelection.md) taken from the [event-selectionChange](module_engine_view_document-ViewDocument.md#event-selectionChange) event and sets in on the [model](module_engine_model_document-ModelDocument.md#member-selection).

**Note**: because there is no view selection change dispatcher nor any other advanced view selection to model conversion mechanism, the callback should be set directly on view document.

```typescript
view.document.on( 'selectionChange', convertSelectionChange( modelDocument, mapper ) );
```

[See source](https://github.com/ckeditor/ckeditor5/blob/master/packages/ckeditor5-engine/src/conversion/upcasthelpers.ts#L581)

#### Parameters

* `model: Model`

  Data model.

* `mapper: Mapper`

  Conversion mapper.

#### Returns

* `( evt: EventInfo, data: object ) => void`

  [event-selectionChange](module_engine_view_document-ViewDocument.md#event-selectionChange) callback function.

<a id="function-convertText">

### `convertText() → ( evt: EventInfo, data: UpcastConversionData<ViewText>, __namedParameters: UpcastConversionApi ) => void` _(internal)_

Function factory, creates a converter that converts [`ViewText`](module_engine_view_text-ViewText.md) to [`ModelText`](module_engine_model_text-ModelText.md).

[See source](https://github.com/ckeditor/ckeditor5/blob/master/packages/ckeditor5-engine/src/conversion/upcasthelpers.ts#L524)

#### Returns

* `( evt: EventInfo, data: UpcastConversionData<ViewText>, __namedParameters: UpcastConversionApi ) => void`

  [View text](module_engine_view_text-ViewText.md) converter.

<a id="function-convertToModelFragment">

### `convertToModelFragment() → ( evt: EventInfo, data: UpcastConversionData<ViewElement | ViewDocumentFragment>, conversionApi: UpcastConversionApi ) => void` _(internal)_

Function factory, creates a converter that converts [view document fragment](module_engine_view_documentfragment-ViewDocumentFragment.md) or all children of [`ViewElement`](module_engine_view_element-ViewElement.md) into [model document fragment](module_engine_model_documentfragment-ModelDocumentFragment.md). This is the "entry-point" converter for upcast (view to model conversion). This converter starts the conversion of all children of passed view document fragment. Those children [view nodes](module_engine_view_node-ViewNode.md) are then handled by other converters.

This also a "default", last resort converter for all view elements that has not been converted by other converters. When a view element is being converted to the model but it does not have converter specified, that view element will be converted to [model document fragment](module_engine_model_documentfragment-ModelDocumentFragment.md) and returned.

[See source](https://github.com/ckeditor/ckeditor5/blob/master/packages/ckeditor5-engine/src/conversion/upcasthelpers.ts#L501)

#### Returns

* `( evt: EventInfo, data: UpcastConversionData<ViewElement | ViewDocumentFragment>, conversionApi: UpcastConversionApi ) => void`

  Universal converter for view [fragments](module_engine_view_documentfragment-ViewDocumentFragment.md) and [elements](module_engine_view_element-ViewElement.md) that returns [model fragment](module_engine_model_documentfragment-ModelDocumentFragment.md) with children of converted view item.

---

Full index of the CKEditor 5 API reference: [llms.txt](llms.txt)
