# list/legacytodolist/legacytodolistconverters

module

<a id="constants">

## Constants

<a id="constant-dataViewModelCheckmarkInsertion">

### `dataViewModelCheckmarkInsertion: GetCallback<UpcastElementEvent>`

A view-to-model converter for the checkbox element inside a view list item.

It changes the `listType` of the model `listItem` to a `todo` value. When a view checkbox element is marked as checked, an additional `todoListChecked="true"` attribute is added to the model item.

It is used by [`DataController`](module_engine_controller_datacontroller-DataController.md).

[See source](https://github.com/ckeditor/ckeditor5/blob/master/packages/ckeditor5-list/src/legacytodolist/legacytodolistconverters.ts#L156)

<a id="functions">

## Functions

<a id="function-dataModelViewInsertion">

### `dataModelViewInsertion( model ) → GetCallback<DowncastInsertEvent<ModelElement>>` _(internal)_

A model-to-view converter for the `listItem` model element insertion.

It is used by [`DataController`](module_engine_controller_datacontroller-DataController.md).

[See source](https://github.com/ckeditor/ckeditor5/blob/master/packages/ckeditor5-list/src/legacytodolist/legacytodolistconverters.ts#L93)

#### Parameters

* `model: Model`

  Model instance.

#### Returns

* `GetCallback<DowncastInsertEvent<ModelElement>>`

  Returns a conversion callback.

#### Related:

* [DowncastDispatcher#event:insert](module_engine_conversion_downcastdispatcher-DowncastDispatcher.md#event-insert)

<a id="function-mapModelToViewPosition">

### `mapModelToViewPosition( view ) → GetCallback<MapperModelToViewPositionEvent>` _(internal)_

A model-to-view position at zero offset mapper.

This helper ensures that position inside todo-list in the view is mapped after the checkbox.

It only handles the position at the beginning of a list item as other positions are properly mapped be the default mapper.

[See source](https://github.com/ckeditor/ckeditor5/blob/master/packages/ckeditor5-list/src/legacytodolist/legacytodolistconverters.ts#L290)

#### Parameters

* `view: EditingView`

#### Returns

* `GetCallback<MapperModelToViewPositionEvent>`

<a id="function-modelViewChangeChecked">

### `modelViewChangeChecked( onCheckedChange ) → GetCallback<DowncastAttributeEvent<ModelElement>>` _(internal)_

A model-to-view converter for the `todoListChecked` attribute change on the `listItem` model element.

It marks the [checkbox UI element](module_engine_view_uielement-ViewUIElement.md) as checked.

It is used by [`EditingController`](module_engine_controller_editingcontroller-EditingController.md).

[See source](https://github.com/ckeditor/ckeditor5/blob/master/packages/ckeditor5-list/src/legacytodolist/legacytodolistconverters.ts#L255)

#### Parameters

* `onCheckedChange: ( element: ModelElement ) => void`

  Callback fired after clicking the checkbox UI element.

#### Returns

* `GetCallback<DowncastAttributeEvent<ModelElement>>`

  Returns a conversion callback.

#### Related:

* [DowncastDispatcher#event:attribute](module_engine_conversion_downcastdispatcher-DowncastDispatcher.md#event-attribute)

<a id="function-modelViewChangeType">

### `modelViewChangeType( onCheckedChange, view ) → GetCallback<DowncastAttributeEvent<ModelElement>>` _(internal)_

A model-to-view converter for the `listType` attribute change on the `listItem` model element.

This change means that the `<li>` element parent changes to `<ul class="todo-list">` and a [checkbox UI element](module_engine_view_uielement-ViewUIElement.md) is added at the beginning of the list item element (or vice versa).

This converter is preceded by [`modelViewChangeType`](module_list_legacylist_legacyconverters.md#constant-modelViewChangeType) and followed by [`modelViewMergeAfterChangeType`](module_list_legacylist_legacyconverters.md#constant-modelViewMergeAfterChangeType) to handle splitting and merging surrounding lists of the same type.

It is used by [`EditingController`](module_engine_controller_editingcontroller-EditingController.md).

[See source](https://github.com/ckeditor/ckeditor5/blob/master/packages/ckeditor5-list/src/legacytodolist/legacytodolistconverters.ts#L199)

#### Parameters

* `onCheckedChange: ( element: ModelElement ) => void`

  Callback fired after clicking the checkbox UI element.

* `view: EditingView`

  Editing view controller.

#### Returns

* `GetCallback<DowncastAttributeEvent<ModelElement>>`

  Returns a conversion callback.

#### Related:

* [DowncastDispatcher#event:attribute](module_engine_conversion_downcastdispatcher-DowncastDispatcher.md#event-attribute)

<a id="function-modelViewInsertion">

### `modelViewInsertion( model, onCheckboxChecked ) → GetCallback<DowncastInsertEvent<ModelElement>>` _(internal)_

A model-to-view converter for the `listItem` model element insertion.

It converts the `listItem` model element to an unordered list with a [checkbox element](module_engine_view_uielement-ViewUIElement.md) at the beginning of each list item. It also merges the list with surrounding lists (if available).

It is used by [`EditingController`](module_engine_controller_editingcontroller-EditingController.md).

[See source](https://github.com/ckeditor/ckeditor5/blob/master/packages/ckeditor5-list/src/legacytodolist/legacytodolistconverters.ts#L40)

#### Parameters

* `model: Model`

  Model instance.

* `onCheckboxChecked: ( element: ModelElement ) => void`

  Callback function.

#### Returns

* `GetCallback<DowncastInsertEvent<ModelElement>>`

  Returns a conversion callback.

#### Related:

* [DowncastDispatcher#event:insert](module_engine_conversion_downcastdispatcher-DowncastDispatcher.md#event-insert)

---

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