@ckeditor/ckeditor5-engine 44.1.0 → 44.2.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +1 -1
- package/dist/index-content.css +2 -2
- package/dist/index-editor.css +2 -2
- package/dist/index.css +4 -4
- package/dist/index.css.map +1 -1
- package/dist/index.js +646 -77
- package/dist/index.js.map +1 -1
- package/package.json +23 -3
- package/src/controller/datacontroller.d.ts +1 -1
- package/src/controller/datacontroller.js +1 -1
- package/src/controller/editingcontroller.d.ts +1 -1
- package/src/controller/editingcontroller.js +1 -1
- package/src/conversion/conversion.d.ts +1 -1
- package/src/conversion/conversion.js +1 -1
- package/src/conversion/conversionhelpers.d.ts +1 -1
- package/src/conversion/conversionhelpers.js +1 -1
- package/src/conversion/downcastdispatcher.d.ts +1 -1
- package/src/conversion/downcastdispatcher.js +1 -1
- package/src/conversion/downcasthelpers.d.ts +1 -1
- package/src/conversion/downcasthelpers.js +1 -1
- package/src/conversion/mapper.d.ts +249 -20
- package/src/conversion/mapper.js +524 -38
- package/src/conversion/modelconsumable.d.ts +1 -1
- package/src/conversion/modelconsumable.js +1 -1
- package/src/conversion/upcastdispatcher.d.ts +1 -1
- package/src/conversion/upcastdispatcher.js +1 -1
- package/src/conversion/upcasthelpers.d.ts +1 -1
- package/src/conversion/upcasthelpers.js +1 -1
- package/src/conversion/viewconsumable.d.ts +1 -1
- package/src/conversion/viewconsumable.js +1 -1
- package/src/dataprocessor/basichtmlwriter.d.ts +1 -1
- package/src/dataprocessor/basichtmlwriter.js +1 -1
- package/src/dataprocessor/dataprocessor.d.ts +1 -1
- package/src/dataprocessor/dataprocessor.js +1 -1
- package/src/dataprocessor/htmldataprocessor.d.ts +1 -1
- package/src/dataprocessor/htmldataprocessor.js +1 -1
- package/src/dataprocessor/htmlwriter.d.ts +1 -1
- package/src/dataprocessor/htmlwriter.js +1 -1
- package/src/dataprocessor/xmldataprocessor.d.ts +1 -1
- package/src/dataprocessor/xmldataprocessor.js +1 -1
- package/src/dev-utils/model.d.ts +1 -1
- package/src/dev-utils/model.js +1 -1
- package/src/dev-utils/operationreplayer.d.ts +1 -1
- package/src/dev-utils/operationreplayer.js +1 -1
- package/src/dev-utils/utils.d.ts +1 -1
- package/src/dev-utils/utils.js +1 -1
- package/src/dev-utils/view.d.ts +1 -1
- package/src/dev-utils/view.js +1 -1
- package/src/index.d.ts +4 -2
- package/src/index.js +2 -1
- package/src/model/batch.d.ts +1 -1
- package/src/model/batch.js +7 -3
- package/src/model/differ.d.ts +1 -1
- package/src/model/differ.js +1 -1
- package/src/model/document.d.ts +1 -1
- package/src/model/document.js +1 -1
- package/src/model/documentfragment.d.ts +1 -1
- package/src/model/documentfragment.js +1 -1
- package/src/model/documentselection.d.ts +1 -1
- package/src/model/documentselection.js +1 -1
- package/src/model/element.d.ts +1 -1
- package/src/model/element.js +1 -1
- package/src/model/history.d.ts +1 -1
- package/src/model/history.js +1 -1
- package/src/model/item.d.ts +1 -1
- package/src/model/item.js +1 -1
- package/src/model/liveposition.d.ts +1 -1
- package/src/model/liveposition.js +1 -1
- package/src/model/liverange.d.ts +1 -1
- package/src/model/liverange.js +1 -1
- package/src/model/markercollection.d.ts +1 -1
- package/src/model/markercollection.js +1 -1
- package/src/model/model.d.ts +1 -1
- package/src/model/model.js +1 -1
- package/src/model/node.d.ts +1 -1
- package/src/model/node.js +1 -1
- package/src/model/nodelist.d.ts +1 -1
- package/src/model/nodelist.js +1 -1
- package/src/model/operation/attributeoperation.d.ts +1 -1
- package/src/model/operation/attributeoperation.js +1 -1
- package/src/model/operation/detachoperation.d.ts +1 -1
- package/src/model/operation/detachoperation.js +1 -1
- package/src/model/operation/insertoperation.d.ts +1 -1
- package/src/model/operation/insertoperation.js +1 -1
- package/src/model/operation/markeroperation.d.ts +1 -1
- package/src/model/operation/markeroperation.js +1 -1
- package/src/model/operation/mergeoperation.d.ts +1 -1
- package/src/model/operation/mergeoperation.js +1 -1
- package/src/model/operation/moveoperation.d.ts +1 -1
- package/src/model/operation/moveoperation.js +1 -1
- package/src/model/operation/nooperation.d.ts +1 -1
- package/src/model/operation/nooperation.js +1 -1
- package/src/model/operation/operation.d.ts +4 -1
- package/src/model/operation/operation.js +2 -2
- package/src/model/operation/operationfactory.d.ts +1 -1
- package/src/model/operation/operationfactory.js +1 -1
- package/src/model/operation/renameoperation.d.ts +1 -1
- package/src/model/operation/renameoperation.js +1 -1
- package/src/model/operation/rootattributeoperation.d.ts +1 -1
- package/src/model/operation/rootattributeoperation.js +1 -1
- package/src/model/operation/rootoperation.d.ts +1 -1
- package/src/model/operation/rootoperation.js +1 -1
- package/src/model/operation/splitoperation.d.ts +1 -1
- package/src/model/operation/splitoperation.js +1 -1
- package/src/model/operation/transform.d.ts +1 -1
- package/src/model/operation/transform.js +1 -1
- package/src/model/operation/utils.d.ts +1 -1
- package/src/model/operation/utils.js +1 -1
- package/src/model/position.d.ts +1 -1
- package/src/model/position.js +1 -1
- package/src/model/range.d.ts +1 -1
- package/src/model/range.js +1 -1
- package/src/model/rootelement.d.ts +1 -1
- package/src/model/rootelement.js +1 -1
- package/src/model/schema.d.ts +1 -1
- package/src/model/schema.js +1 -1
- package/src/model/selection.d.ts +1 -1
- package/src/model/selection.js +9 -2
- package/src/model/text.d.ts +1 -1
- package/src/model/text.js +1 -1
- package/src/model/textproxy.d.ts +1 -1
- package/src/model/textproxy.js +1 -1
- package/src/model/treewalker.d.ts +17 -1
- package/src/model/treewalker.js +26 -1
- package/src/model/typecheckable.d.ts +1 -1
- package/src/model/typecheckable.js +1 -1
- package/src/model/utils/autoparagraphing.d.ts +1 -1
- package/src/model/utils/autoparagraphing.js +1 -1
- package/src/model/utils/deletecontent.d.ts +1 -1
- package/src/model/utils/deletecontent.js +1 -1
- package/src/model/utils/getselectedcontent.d.ts +1 -1
- package/src/model/utils/getselectedcontent.js +1 -1
- package/src/model/utils/insertcontent.d.ts +1 -1
- package/src/model/utils/insertcontent.js +1 -1
- package/src/model/utils/insertobject.d.ts +1 -1
- package/src/model/utils/insertobject.js +1 -1
- package/src/model/utils/modifyselection.d.ts +1 -1
- package/src/model/utils/modifyselection.js +1 -1
- package/src/model/utils/selection-post-fixer.d.ts +1 -1
- package/src/model/utils/selection-post-fixer.js +1 -1
- package/src/model/writer.d.ts +1 -1
- package/src/model/writer.js +1 -1
- package/src/view/attributeelement.d.ts +1 -1
- package/src/view/attributeelement.js +1 -1
- package/src/view/containerelement.d.ts +1 -1
- package/src/view/containerelement.js +1 -1
- package/src/view/datatransfer.d.ts +1 -1
- package/src/view/datatransfer.js +1 -1
- package/src/view/document.d.ts +1 -1
- package/src/view/document.js +1 -1
- package/src/view/documentfragment.d.ts +6 -4
- package/src/view/documentfragment.js +7 -7
- package/src/view/documentselection.d.ts +1 -1
- package/src/view/documentselection.js +1 -1
- package/src/view/domconverter.d.ts +1 -1
- package/src/view/domconverter.js +1 -1
- package/src/view/downcastwriter.d.ts +1 -1
- package/src/view/downcastwriter.js +1 -1
- package/src/view/editableelement.d.ts +1 -1
- package/src/view/editableelement.js +1 -1
- package/src/view/element.d.ts +1 -1
- package/src/view/element.js +3 -3
- package/src/view/elementdefinition.d.ts +1 -1
- package/src/view/elementdefinition.js +1 -1
- package/src/view/emptyelement.d.ts +1 -1
- package/src/view/emptyelement.js +1 -1
- package/src/view/filler.d.ts +1 -1
- package/src/view/filler.js +1 -1
- package/src/view/item.d.ts +1 -1
- package/src/view/item.js +1 -1
- package/src/view/matcher.d.ts +1 -1
- package/src/view/matcher.js +1 -1
- package/src/view/node.d.ts +13 -4
- package/src/view/node.js +5 -4
- package/src/view/observer/arrowkeysobserver.d.ts +1 -1
- package/src/view/observer/arrowkeysobserver.js +1 -1
- package/src/view/observer/bubblingemittermixin.d.ts +1 -1
- package/src/view/observer/bubblingemittermixin.js +1 -1
- package/src/view/observer/bubblingeventinfo.d.ts +1 -1
- package/src/view/observer/bubblingeventinfo.js +1 -1
- package/src/view/observer/clickobserver.d.ts +1 -1
- package/src/view/observer/clickobserver.js +1 -1
- package/src/view/observer/compositionobserver.d.ts +1 -1
- package/src/view/observer/compositionobserver.js +1 -1
- package/src/view/observer/domeventdata.d.ts +1 -1
- package/src/view/observer/domeventdata.js +1 -1
- package/src/view/observer/domeventobserver.d.ts +1 -1
- package/src/view/observer/domeventobserver.js +1 -1
- package/src/view/observer/fakeselectionobserver.d.ts +1 -1
- package/src/view/observer/fakeselectionobserver.js +1 -1
- package/src/view/observer/focusobserver.d.ts +1 -1
- package/src/view/observer/focusobserver.js +1 -1
- package/src/view/observer/inputobserver.d.ts +1 -1
- package/src/view/observer/inputobserver.js +1 -1
- package/src/view/observer/keyobserver.d.ts +1 -1
- package/src/view/observer/keyobserver.js +1 -1
- package/src/view/observer/mouseobserver.d.ts +1 -1
- package/src/view/observer/mouseobserver.js +1 -1
- package/src/view/observer/mutationobserver.d.ts +1 -1
- package/src/view/observer/mutationobserver.js +1 -1
- package/src/view/observer/observer.d.ts +1 -1
- package/src/view/observer/observer.js +1 -1
- package/src/view/observer/selectionobserver.d.ts +1 -1
- package/src/view/observer/selectionobserver.js +1 -1
- package/src/view/observer/tabobserver.d.ts +1 -1
- package/src/view/observer/tabobserver.js +1 -1
- package/src/view/observer/touchobserver.d.ts +73 -0
- package/src/view/observer/touchobserver.js +29 -0
- package/src/view/placeholder.d.ts +1 -1
- package/src/view/placeholder.js +23 -17
- package/src/view/position.d.ts +1 -1
- package/src/view/position.js +1 -1
- package/src/view/range.d.ts +1 -1
- package/src/view/range.js +1 -1
- package/src/view/rawelement.d.ts +1 -1
- package/src/view/rawelement.js +1 -1
- package/src/view/renderer.d.ts +1 -1
- package/src/view/renderer.js +1 -1
- package/src/view/rooteditableelement.d.ts +1 -1
- package/src/view/rooteditableelement.js +1 -1
- package/src/view/selection.d.ts +1 -1
- package/src/view/selection.js +1 -1
- package/src/view/styles/background.d.ts +1 -1
- package/src/view/styles/background.js +1 -1
- package/src/view/styles/border.d.ts +1 -1
- package/src/view/styles/border.js +1 -1
- package/src/view/styles/margin.d.ts +1 -1
- package/src/view/styles/margin.js +1 -1
- package/src/view/styles/padding.d.ts +1 -1
- package/src/view/styles/padding.js +1 -1
- package/src/view/styles/utils.d.ts +1 -1
- package/src/view/styles/utils.js +1 -1
- package/src/view/stylesmap.d.ts +1 -1
- package/src/view/stylesmap.js +1 -1
- package/src/view/text.d.ts +1 -1
- package/src/view/text.js +1 -1
- package/src/view/textproxy.d.ts +1 -1
- package/src/view/textproxy.js +1 -1
- package/src/view/treewalker.d.ts +17 -1
- package/src/view/treewalker.js +25 -1
- package/src/view/typecheckable.d.ts +1 -1
- package/src/view/typecheckable.js +1 -1
- package/src/view/uielement.d.ts +1 -1
- package/src/view/uielement.js +1 -1
- package/src/view/upcastwriter.d.ts +1 -1
- package/src/view/upcastwriter.js +1 -1
- package/src/view/view.d.ts +1 -1
- package/src/view/view.js +1 -1
- package/theme/placeholder.css +1 -1
- package/theme/renderer.css +1 -1
- package/dist/controller/datacontroller.d.ts +0 -339
- package/dist/controller/editingcontroller.d.ts +0 -102
- package/dist/conversion/conversion.d.ts +0 -482
- package/dist/conversion/conversionhelpers.d.ts +0 -30
- package/dist/conversion/downcastdispatcher.d.ts +0 -566
- package/dist/conversion/downcasthelpers.d.ts +0 -1194
- package/dist/conversion/mapper.d.ts +0 -507
- package/dist/conversion/modelconsumable.d.ts +0 -205
- package/dist/conversion/upcastdispatcher.d.ts +0 -496
- package/dist/conversion/upcasthelpers.d.ts +0 -503
- package/dist/conversion/viewconsumable.d.ts +0 -373
- package/dist/dataprocessor/basichtmlwriter.d.ts +0 -22
- package/dist/dataprocessor/dataprocessor.d.ts +0 -65
- package/dist/dataprocessor/htmldataprocessor.d.ts +0 -80
- package/dist/dataprocessor/htmlwriter.d.ts +0 -20
- package/dist/dataprocessor/xmldataprocessor.d.ts +0 -94
- package/dist/dev-utils/model.d.ts +0 -130
- package/dist/dev-utils/operationreplayer.d.ts +0 -55
- package/dist/dev-utils/utils.d.ts +0 -41
- package/dist/dev-utils/view.d.ts +0 -324
- package/dist/index.d.ts +0 -122
- package/dist/model/batch.d.ts +0 -110
- package/dist/model/differ.d.ts +0 -511
- package/dist/model/document.d.ts +0 -278
- package/dist/model/documentfragment.d.ts +0 -223
- package/dist/model/documentselection.d.ts +0 -424
- package/dist/model/element.d.ts +0 -191
- package/dist/model/history.d.ts +0 -118
- package/dist/model/item.d.ts +0 -18
- package/dist/model/liveposition.d.ts +0 -81
- package/dist/model/liverange.d.ts +0 -106
- package/dist/model/markercollection.d.ts +0 -339
- package/dist/model/model.d.ts +0 -923
- package/dist/model/node.d.ts +0 -262
- package/dist/model/nodelist.d.ts +0 -119
- package/dist/model/operation/attributeoperation.d.ts +0 -107
- package/dist/model/operation/detachoperation.d.ts +0 -64
- package/dist/model/operation/insertoperation.d.ts +0 -94
- package/dist/model/operation/markeroperation.d.ts +0 -95
- package/dist/model/operation/mergeoperation.d.ts +0 -104
- package/dist/model/operation/moveoperation.d.ts +0 -100
- package/dist/model/operation/nooperation.d.ts +0 -42
- package/dist/model/operation/operation.d.ts +0 -100
- package/dist/model/operation/operationfactory.d.ts +0 -22
- package/dist/model/operation/renameoperation.d.ts +0 -87
- package/dist/model/operation/rootattributeoperation.d.ts +0 -102
- package/dist/model/operation/rootoperation.d.ts +0 -80
- package/dist/model/operation/splitoperation.d.ts +0 -113
- package/dist/model/operation/transform.d.ts +0 -104
- package/dist/model/operation/utils.d.ts +0 -75
- package/dist/model/position.d.ts +0 -549
- package/dist/model/range.d.ts +0 -462
- package/dist/model/rootelement.d.ts +0 -64
- package/dist/model/schema.d.ts +0 -1334
- package/dist/model/selection.d.ts +0 -486
- package/dist/model/text.d.ts +0 -70
- package/dist/model/textproxy.d.ts +0 -148
- package/dist/model/treewalker.d.ts +0 -190
- package/dist/model/typecheckable.d.ts +0 -289
- package/dist/model/utils/autoparagraphing.d.ts +0 -41
- package/dist/model/utils/deletecontent.d.ts +0 -62
- package/dist/model/utils/getselectedcontent.d.ts +0 -34
- package/dist/model/utils/insertcontent.d.ts +0 -50
- package/dist/model/utils/insertobject.d.ts +0 -51
- package/dist/model/utils/modifyselection.d.ts +0 -52
- package/dist/model/utils/selection-post-fixer.d.ts +0 -78
- package/dist/model/writer.d.ts +0 -855
- package/dist/view/attributeelement.d.ts +0 -112
- package/dist/view/containerelement.d.ts +0 -53
- package/dist/view/datatransfer.d.ts +0 -83
- package/dist/view/document.d.ts +0 -188
- package/dist/view/documentfragment.d.ts +0 -157
- package/dist/view/documentselection.d.ts +0 -310
- package/dist/view/domconverter.d.ts +0 -665
- package/dist/view/downcastwriter.d.ts +0 -1000
- package/dist/view/editableelement.d.ts +0 -66
- package/dist/view/element.d.ts +0 -472
- package/dist/view/elementdefinition.d.ts +0 -91
- package/dist/view/emptyelement.d.ts +0 -45
- package/dist/view/filler.d.ts +0 -115
- package/dist/view/item.d.ts +0 -18
- package/dist/view/matcher.d.ts +0 -490
- package/dist/view/node.d.ts +0 -166
- package/dist/view/observer/arrowkeysobserver.d.ts +0 -49
- package/dist/view/observer/bubblingemittermixin.d.ts +0 -170
- package/dist/view/observer/bubblingeventinfo.d.ts +0 -51
- package/dist/view/observer/clickobserver.d.ts +0 -47
- package/dist/view/observer/compositionobserver.d.ts +0 -86
- package/dist/view/observer/domeventdata.d.ts +0 -54
- package/dist/view/observer/domeventobserver.d.ts +0 -82
- package/dist/view/observer/fakeselectionobserver.d.ts +0 -51
- package/dist/view/observer/focusobserver.d.ts +0 -98
- package/dist/view/observer/inputobserver.d.ts +0 -90
- package/dist/view/observer/keyobserver.d.ts +0 -70
- package/dist/view/observer/mouseobserver.d.ts +0 -93
- package/dist/view/observer/mutationobserver.d.ts +0 -119
- package/dist/view/observer/observer.d.ts +0 -93
- package/dist/view/observer/selectionobserver.d.ts +0 -151
- package/dist/view/observer/tabobserver.d.ts +0 -50
- package/dist/view/placeholder.d.ts +0 -100
- package/dist/view/position.d.ts +0 -192
- package/dist/view/range.d.ts +0 -283
- package/dist/view/rawelement.d.ts +0 -77
- package/dist/view/renderer.d.ts +0 -281
- package/dist/view/rooteditableelement.d.ts +0 -45
- package/dist/view/selection.d.ts +0 -379
- package/dist/view/styles/background.d.ts +0 -37
- package/dist/view/styles/border.d.ts +0 -47
- package/dist/view/styles/margin.d.ts +0 -33
- package/dist/view/styles/padding.d.ts +0 -33
- package/dist/view/styles/utils.d.ts +0 -97
- package/dist/view/stylesmap.d.ts +0 -685
- package/dist/view/text.d.ts +0 -78
- package/dist/view/textproxy.d.ts +0 -101
- package/dist/view/treewalker.d.ts +0 -199
- package/dist/view/typecheckable.d.ts +0 -452
- package/dist/view/uielement.d.ts +0 -100
- package/dist/view/upcastwriter.d.ts +0 -421
- package/dist/view/view.d.ts +0 -488
|
@@ -1,566 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
|
-
*/
|
|
5
|
-
/**
|
|
6
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
7
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
|
8
|
-
*/
|
|
9
|
-
/**
|
|
10
|
-
* @module engine/conversion/downcastdispatcher
|
|
11
|
-
*/
|
|
12
|
-
import Consumable from './modelconsumable.js';
|
|
13
|
-
import Range from '../model/range.js';
|
|
14
|
-
import type { default as Differ, DiffItem } from '../model/differ.js';
|
|
15
|
-
import type { default as MarkerCollection } from '../model/markercollection.js';
|
|
16
|
-
import type DocumentSelection from '../model/documentselection.js';
|
|
17
|
-
import type DowncastWriter from '../view/downcastwriter.js';
|
|
18
|
-
import type Element from '../model/element.js';
|
|
19
|
-
import type Item from '../model/item.js';
|
|
20
|
-
import type Mapper from './mapper.js';
|
|
21
|
-
import type Position from '../model/position.js';
|
|
22
|
-
import type Schema from '../model/schema.js';
|
|
23
|
-
import type Selection from '../model/selection.js';
|
|
24
|
-
import type ViewElement from '../view/element.js';
|
|
25
|
-
declare const DowncastDispatcher_base: {
|
|
26
|
-
new (): import("@ckeditor/ckeditor5-utils").Emitter;
|
|
27
|
-
prototype: import("@ckeditor/ckeditor5-utils").Emitter;
|
|
28
|
-
};
|
|
29
|
-
/**
|
|
30
|
-
* The downcast dispatcher is a central point of downcasting (conversion from the model to the view), which is a process of reacting
|
|
31
|
-
* to changes in the model and firing a set of events. The callbacks listening to these events are called converters. The
|
|
32
|
-
* converters' role is to convert the model changes to changes in view (for example, adding view nodes or
|
|
33
|
-
* changing attributes on view elements).
|
|
34
|
-
*
|
|
35
|
-
* During the conversion process, downcast dispatcher fires events basing on the state of the model and prepares
|
|
36
|
-
* data for these events. It is important to understand that the events are connected with the changes done on the model,
|
|
37
|
-
* for example: "a node has been inserted" or "an attribute has changed". This is in contrary to upcasting (a view-to-model conversion)
|
|
38
|
-
* where you convert the view state (view nodes) to a model tree.
|
|
39
|
-
*
|
|
40
|
-
* The events are prepared basing on a diff created by the {@link module:engine/model/differ~Differ Differ}, which buffers them
|
|
41
|
-
* and then passes to the downcast dispatcher as a diff between the old model state and the new model state.
|
|
42
|
-
*
|
|
43
|
-
* Note that because the changes are converted, there is a need to have a mapping between the model structure and the view structure.
|
|
44
|
-
* To map positions and elements during the downcast (a model-to-view conversion), use {@link module:engine/conversion/mapper~Mapper}.
|
|
45
|
-
*
|
|
46
|
-
* Downcast dispatcher fires the following events for model tree changes:
|
|
47
|
-
*
|
|
48
|
-
* * {@link module:engine/conversion/downcastdispatcher~DowncastDispatcher#event:insert `insert`} –
|
|
49
|
-
* If a range of nodes was inserted to the model tree.
|
|
50
|
-
* * {@link module:engine/conversion/downcastdispatcher~DowncastDispatcher#event:remove `remove`} –
|
|
51
|
-
* If a range of nodes was removed from the model tree.
|
|
52
|
-
* * {@link module:engine/conversion/downcastdispatcher~DowncastDispatcher#event:attribute `attribute`} –
|
|
53
|
-
* If an attribute was added, changed or removed from a model node.
|
|
54
|
-
*
|
|
55
|
-
* For {@link module:engine/conversion/downcastdispatcher~DowncastDispatcher#event:insert `insert`}
|
|
56
|
-
* and {@link module:engine/conversion/downcastdispatcher~DowncastDispatcher#event:attribute `attribute`},
|
|
57
|
-
* the downcast dispatcher generates {@link module:engine/conversion/modelconsumable~ModelConsumable consumables}.
|
|
58
|
-
* These are used to have control over which changes have already been consumed. It is useful when some converters
|
|
59
|
-
* overwrite others or convert multiple changes (for example, it converts an insertion of an element and also converts that
|
|
60
|
-
* element's attributes during the insertion).
|
|
61
|
-
*
|
|
62
|
-
* Additionally, downcast dispatcher fires events for {@link module:engine/model/markercollection~Marker marker} changes:
|
|
63
|
-
*
|
|
64
|
-
* * {@link module:engine/conversion/downcastdispatcher~DowncastDispatcher#event:addMarker `addMarker`} – If a marker was added.
|
|
65
|
-
* * {@link module:engine/conversion/downcastdispatcher~DowncastDispatcher#event:removeMarker `removeMarker`} – If a marker was
|
|
66
|
-
* removed.
|
|
67
|
-
*
|
|
68
|
-
* Note that changing a marker is done through removing the marker from the old range and adding it to the new range,
|
|
69
|
-
* so both of these events are fired.
|
|
70
|
-
*
|
|
71
|
-
* Finally, a downcast dispatcher also handles firing events for the {@link module:engine/model/selection model selection}
|
|
72
|
-
* conversion:
|
|
73
|
-
*
|
|
74
|
-
* * {@link module:engine/conversion/downcastdispatcher~DowncastDispatcher#event:selection `selection`}
|
|
75
|
-
* – Converts the selection from the model to the view.
|
|
76
|
-
* * {@link module:engine/conversion/downcastdispatcher~DowncastDispatcher#event:attribute `attribute`}
|
|
77
|
-
* – Fired for every selection attribute.
|
|
78
|
-
* * {@link module:engine/conversion/downcastdispatcher~DowncastDispatcher#event:addMarker `addMarker`}
|
|
79
|
-
* – Fired for every marker that contains a selection.
|
|
80
|
-
*
|
|
81
|
-
* Unlike the model tree and the markers, the events for selection are not fired for changes but for a selection state.
|
|
82
|
-
*
|
|
83
|
-
* When providing custom listeners for a downcast dispatcher, remember to check whether a given change has not been
|
|
84
|
-
* {@link module:engine/conversion/modelconsumable~ModelConsumable#consume consumed} yet.
|
|
85
|
-
*
|
|
86
|
-
* When providing custom listeners for a downcast dispatcher, keep in mind that you **should not** stop the event. If you stop it,
|
|
87
|
-
* then the default converter at the `lowest` priority will not trigger the conversion of this node's attributes and child nodes.
|
|
88
|
-
*
|
|
89
|
-
* When providing custom listeners for a downcast dispatcher, remember to use the provided
|
|
90
|
-
* {@link module:engine/view/downcastwriter~DowncastWriter view downcast writer} to apply changes to the view document.
|
|
91
|
-
*
|
|
92
|
-
* You can read more about conversion in the following guide:
|
|
93
|
-
*
|
|
94
|
-
* * {@glink framework/deep-dive/conversion/downcast Downcast conversion}
|
|
95
|
-
*
|
|
96
|
-
* An example of a custom converter for the downcast dispatcher:
|
|
97
|
-
*
|
|
98
|
-
* ```ts
|
|
99
|
-
* // You will convert inserting a "paragraph" model element into the model.
|
|
100
|
-
* downcastDispatcher.on( 'insert:paragraph', ( evt, data, conversionApi ) => {
|
|
101
|
-
* // Remember to check whether the change has not been consumed yet and consume it.
|
|
102
|
-
* if ( !conversionApi.consumable.consume( data.item, 'insert' ) ) {
|
|
103
|
-
* return;
|
|
104
|
-
* }
|
|
105
|
-
*
|
|
106
|
-
* // Translate the position in the model to a position in the view.
|
|
107
|
-
* const viewPosition = conversionApi.mapper.toViewPosition( data.range.start );
|
|
108
|
-
*
|
|
109
|
-
* // Create a <p> element that will be inserted into the view at the `viewPosition`.
|
|
110
|
-
* const viewElement = conversionApi.writer.createContainerElement( 'p' );
|
|
111
|
-
*
|
|
112
|
-
* // Bind the newly created view element to the model element so positions will map accordingly in the future.
|
|
113
|
-
* conversionApi.mapper.bindElements( data.item, viewElement );
|
|
114
|
-
*
|
|
115
|
-
* // Add the newly created view element to the view.
|
|
116
|
-
* conversionApi.writer.insert( viewPosition, viewElement );
|
|
117
|
-
* } );
|
|
118
|
-
* ```
|
|
119
|
-
*/
|
|
120
|
-
export default class DowncastDispatcher extends /* #__PURE__ */ DowncastDispatcher_base {
|
|
121
|
-
/**
|
|
122
|
-
* A template for an interface passed by the dispatcher to the event callbacks.
|
|
123
|
-
*
|
|
124
|
-
* @internal
|
|
125
|
-
*/
|
|
126
|
-
readonly _conversionApi: Pick<DowncastConversionApi, 'dispatcher' | 'mapper' | 'schema'>;
|
|
127
|
-
/**
|
|
128
|
-
* A map of already fired events for a given `ModelConsumable`.
|
|
129
|
-
*/
|
|
130
|
-
private readonly _firedEventsMap;
|
|
131
|
-
/**
|
|
132
|
-
* Creates a downcast dispatcher instance.
|
|
133
|
-
*
|
|
134
|
-
* @see module:engine/conversion/downcastdispatcher~DowncastConversionApi
|
|
135
|
-
*
|
|
136
|
-
* @param conversionApi Additional properties for an interface that will be passed to events fired
|
|
137
|
-
* by the downcast dispatcher.
|
|
138
|
-
*/
|
|
139
|
-
constructor(conversionApi: Pick<DowncastConversionApi, 'mapper' | 'schema'>);
|
|
140
|
-
/**
|
|
141
|
-
* Converts changes buffered in the given {@link module:engine/model/differ~Differ model differ}
|
|
142
|
-
* and fires conversion events based on it.
|
|
143
|
-
*
|
|
144
|
-
* @fires insert
|
|
145
|
-
* @fires remove
|
|
146
|
-
* @fires attribute
|
|
147
|
-
* @fires addMarker
|
|
148
|
-
* @fires removeMarker
|
|
149
|
-
* @fires reduceChanges
|
|
150
|
-
* @param differ The differ object with buffered changes.
|
|
151
|
-
* @param markers Markers related to the model fragment to convert.
|
|
152
|
-
* @param writer The view writer that should be used to modify the view document.
|
|
153
|
-
*/
|
|
154
|
-
convertChanges(differ: Differ, markers: MarkerCollection, writer: DowncastWriter): void;
|
|
155
|
-
/**
|
|
156
|
-
* Starts a conversion of a model range and the provided markers.
|
|
157
|
-
*
|
|
158
|
-
* @fires insert
|
|
159
|
-
* @fires attribute
|
|
160
|
-
* @fires addMarker
|
|
161
|
-
* @param range The inserted range.
|
|
162
|
-
* @param markers The map of markers that should be down-casted.
|
|
163
|
-
* @param writer The view writer that should be used to modify the view document.
|
|
164
|
-
* @param options Optional options object passed to `convertionApi.options`.
|
|
165
|
-
*/
|
|
166
|
-
convert(range: Range, markers: Map<string, Range>, writer: DowncastWriter, options?: DowncastConversionApi['options']): void;
|
|
167
|
-
/**
|
|
168
|
-
* Starts the model selection conversion.
|
|
169
|
-
*
|
|
170
|
-
* Fires events for a given {@link module:engine/model/selection~Selection selection} to start the selection conversion.
|
|
171
|
-
*
|
|
172
|
-
* @fires selection
|
|
173
|
-
* @fires addMarker
|
|
174
|
-
* @fires attribute
|
|
175
|
-
* @param selection The selection to convert.
|
|
176
|
-
* @param markers Markers connected with the converted model.
|
|
177
|
-
* @param writer View writer that should be used to modify the view document.
|
|
178
|
-
*/
|
|
179
|
-
convertSelection(selection: Selection | DocumentSelection, markers: MarkerCollection, writer: DowncastWriter): void;
|
|
180
|
-
/**
|
|
181
|
-
* Fires insertion conversion of a range of nodes.
|
|
182
|
-
*
|
|
183
|
-
* For each node in the range, {@link #event:insert `insert` event is fired}. For each attribute on each node,
|
|
184
|
-
* {@link #event:attribute `attribute` event is fired}.
|
|
185
|
-
*
|
|
186
|
-
* @fires insert
|
|
187
|
-
* @fires attribute
|
|
188
|
-
* @param range The inserted range.
|
|
189
|
-
* @param conversionApi The conversion API object.
|
|
190
|
-
* @param options.doNotAddConsumables Whether the ModelConsumable should not get populated
|
|
191
|
-
* for items in the provided range.
|
|
192
|
-
*/
|
|
193
|
-
private _convertInsert;
|
|
194
|
-
/**
|
|
195
|
-
* Fires conversion of a single node removal. Fires {@link #event:remove remove event} with provided data.
|
|
196
|
-
*
|
|
197
|
-
* @param position Position from which node was removed.
|
|
198
|
-
* @param length Offset size of removed node.
|
|
199
|
-
* @param name Name of removed node.
|
|
200
|
-
* @param conversionApi The conversion API object.
|
|
201
|
-
*/
|
|
202
|
-
private _convertRemove;
|
|
203
|
-
/**
|
|
204
|
-
* Starts a conversion of an attribute change on a given `range`.
|
|
205
|
-
*
|
|
206
|
-
* For each node in the given `range`, {@link #event:attribute attribute event} is fired with the passed data.
|
|
207
|
-
*
|
|
208
|
-
* @fires attribute
|
|
209
|
-
* @param range Changed range.
|
|
210
|
-
* @param key Key of the attribute that has changed.
|
|
211
|
-
* @param oldValue Attribute value before the change or `null` if the attribute has not been set before.
|
|
212
|
-
* @param newValue New attribute value or `null` if the attribute has been removed.
|
|
213
|
-
* @param conversionApi The conversion API object.
|
|
214
|
-
*/
|
|
215
|
-
private _convertAttribute;
|
|
216
|
-
/**
|
|
217
|
-
* Fires re-insertion conversion (with a `reconversion` flag passed to `insert` events)
|
|
218
|
-
* of a range of elements (only elements on the range depth, without children).
|
|
219
|
-
*
|
|
220
|
-
* For each node in the range on its depth (without children), {@link #event:insert `insert` event} is fired.
|
|
221
|
-
* For each attribute on each node, {@link #event:attribute `attribute` event} is fired.
|
|
222
|
-
*
|
|
223
|
-
* @fires insert
|
|
224
|
-
* @fires attribute
|
|
225
|
-
* @param range The range to reinsert.
|
|
226
|
-
* @param conversionApi The conversion API object.
|
|
227
|
-
*/
|
|
228
|
-
private _convertReinsert;
|
|
229
|
-
/**
|
|
230
|
-
* Converts the added marker. Fires the {@link #event:addMarker `addMarker`} event for each item
|
|
231
|
-
* in the marker's range. If the range is collapsed, a single event is dispatched. See the event description for more details.
|
|
232
|
-
*
|
|
233
|
-
* @fires addMarker
|
|
234
|
-
* @param markerName Marker name.
|
|
235
|
-
* @param markerRange The marker range.
|
|
236
|
-
* @param conversionApi The conversion API object.
|
|
237
|
-
*/
|
|
238
|
-
private _convertMarkerAdd;
|
|
239
|
-
/**
|
|
240
|
-
* Fires the conversion of the marker removal. Fires the {@link #event:removeMarker `removeMarker`} event with the provided data.
|
|
241
|
-
*
|
|
242
|
-
* @fires removeMarker
|
|
243
|
-
* @param markerName Marker name.
|
|
244
|
-
* @param markerRange The marker range.
|
|
245
|
-
* @param conversionApi The conversion API object.
|
|
246
|
-
*/
|
|
247
|
-
private _convertMarkerRemove;
|
|
248
|
-
/**
|
|
249
|
-
* Fires the reduction of changes buffered in the {@link module:engine/model/differ~Differ `Differ`}.
|
|
250
|
-
*
|
|
251
|
-
* Features can replace selected {@link module:engine/model/differ~DiffItem `DiffItem`}s with `reinsert` entries to trigger
|
|
252
|
-
* reconversion. The {@link module:engine/conversion/downcasthelpers~DowncastHelpers#elementToStructure
|
|
253
|
-
* `DowncastHelpers.elementToStructure()`} is using this event to trigger reconversion.
|
|
254
|
-
*
|
|
255
|
-
* @fires reduceChanges
|
|
256
|
-
*/
|
|
257
|
-
private _reduceChanges;
|
|
258
|
-
/**
|
|
259
|
-
* Populates provided {@link module:engine/conversion/modelconsumable~ModelConsumable} with values to consume from a given range,
|
|
260
|
-
* assuming that the range has just been inserted to the model.
|
|
261
|
-
*
|
|
262
|
-
* @param consumable The consumable.
|
|
263
|
-
* @param walkerValues The walker values for the inserted range.
|
|
264
|
-
* @returns The values to consume.
|
|
265
|
-
*/
|
|
266
|
-
private _addConsumablesForInsert;
|
|
267
|
-
/**
|
|
268
|
-
* Populates provided {@link module:engine/conversion/modelconsumable~ModelConsumable} with values to consume for a given range.
|
|
269
|
-
*
|
|
270
|
-
* @param consumable The consumable.
|
|
271
|
-
* @param range The affected range.
|
|
272
|
-
* @param type Consumable type.
|
|
273
|
-
* @returns The values to consume.
|
|
274
|
-
*/
|
|
275
|
-
private _addConsumablesForRange;
|
|
276
|
-
/**
|
|
277
|
-
* Populates provided {@link module:engine/conversion/modelconsumable~ModelConsumable} with selection consumable values.
|
|
278
|
-
*
|
|
279
|
-
* @param consumable The consumable.
|
|
280
|
-
* @param selection The selection to create the consumable from.
|
|
281
|
-
* @param markers Markers that contain the selection.
|
|
282
|
-
* @returns The values to consume.
|
|
283
|
-
*/
|
|
284
|
-
private _addConsumablesForSelection;
|
|
285
|
-
/**
|
|
286
|
-
* Tests whether given event wasn't already fired and if so, fires it.
|
|
287
|
-
*
|
|
288
|
-
* @fires insert
|
|
289
|
-
* @fires attribute
|
|
290
|
-
* @param type Event type.
|
|
291
|
-
* @param data Event data.
|
|
292
|
-
* @param conversionApi The conversion API object.
|
|
293
|
-
*/
|
|
294
|
-
private _testAndFire;
|
|
295
|
-
/**
|
|
296
|
-
* Fires not already fired events for setting attributes on just inserted item.
|
|
297
|
-
*
|
|
298
|
-
* @param item The model item to convert attributes for.
|
|
299
|
-
* @param conversionApi The conversion API object.
|
|
300
|
-
*/
|
|
301
|
-
private _testAndFireAddAttributes;
|
|
302
|
-
/**
|
|
303
|
-
* Builds an instance of the {@link module:engine/conversion/downcastdispatcher~DowncastConversionApi} from a template and a given
|
|
304
|
-
* {@link module:engine/view/downcastwriter~DowncastWriter `DowncastWriter`} and options object.
|
|
305
|
-
*
|
|
306
|
-
* @param writer View writer that should be used to modify the view document.
|
|
307
|
-
* @param refreshedItems A set of model elements that should not reuse their
|
|
308
|
-
* previous view representations.
|
|
309
|
-
* @param options Optional options passed to `convertionApi.options`.
|
|
310
|
-
* @return The conversion API object.
|
|
311
|
-
*/
|
|
312
|
-
private _createConversionApi;
|
|
313
|
-
}
|
|
314
|
-
/**
|
|
315
|
-
* Fired to enable reducing (transforming) changes buffered in the {@link module:engine/model/differ~Differ `Differ`} before
|
|
316
|
-
* {@link ~DowncastDispatcher#convertChanges `convertChanges()`} will fire any conversion events.
|
|
317
|
-
*
|
|
318
|
-
* For instance, a feature can replace selected {@link module:engine/model/differ~DiffItem `DiffItem`}s with a `reinsert` entry
|
|
319
|
-
* to trigger reconversion of an element when e.g. its attribute has changes.
|
|
320
|
-
* The {@link module:engine/conversion/downcasthelpers~DowncastHelpers#elementToStructure
|
|
321
|
-
* `DowncastHelpers.elementToStructure()`} helper is using this event to trigger reconversion of an element when the element,
|
|
322
|
-
* its attributes or direct children changed.
|
|
323
|
-
*
|
|
324
|
-
* @eventName ~DowncastDispatcher#reduceChanges
|
|
325
|
-
*/
|
|
326
|
-
export type DowncastReduceChangesEvent = {
|
|
327
|
-
name: 'reduceChanges';
|
|
328
|
-
args: [data: DowncastReduceChangesEventData];
|
|
329
|
-
};
|
|
330
|
-
export type DowncastReduceChangesEventData = {
|
|
331
|
-
/**
|
|
332
|
-
* A buffered changes to get reduced.
|
|
333
|
-
*/
|
|
334
|
-
changes: Iterable<DiffItem | DiffItemReinsert>;
|
|
335
|
-
};
|
|
336
|
-
type EventMap<TItem = Item> = {
|
|
337
|
-
insert: {
|
|
338
|
-
item: TItem;
|
|
339
|
-
range: Range;
|
|
340
|
-
reconversion?: boolean;
|
|
341
|
-
};
|
|
342
|
-
remove: {
|
|
343
|
-
position: Position;
|
|
344
|
-
length: number;
|
|
345
|
-
};
|
|
346
|
-
attribute: {
|
|
347
|
-
item: TItem;
|
|
348
|
-
range: Range;
|
|
349
|
-
attributeKey: string;
|
|
350
|
-
attributeOldValue: unknown;
|
|
351
|
-
attributeNewValue: unknown;
|
|
352
|
-
};
|
|
353
|
-
cleanSelection: {
|
|
354
|
-
selection: Selection | DocumentSelection;
|
|
355
|
-
};
|
|
356
|
-
selection: {
|
|
357
|
-
selection: Selection | DocumentSelection;
|
|
358
|
-
};
|
|
359
|
-
addMarker: {
|
|
360
|
-
item?: Item | Selection | DocumentSelection;
|
|
361
|
-
range?: Range;
|
|
362
|
-
markerRange: Range;
|
|
363
|
-
markerName: string;
|
|
364
|
-
};
|
|
365
|
-
removeMarker: {
|
|
366
|
-
markerRange: Range;
|
|
367
|
-
markerName: string;
|
|
368
|
-
};
|
|
369
|
-
};
|
|
370
|
-
export type DowncastEvent<TName extends keyof EventMap<TItem>, TItem = Item> = {
|
|
371
|
-
name: TName | `${TName}:${string}`;
|
|
372
|
-
args: [data: EventMap<TItem>[TName], conversionApi: DowncastConversionApi];
|
|
373
|
-
};
|
|
374
|
-
/**
|
|
375
|
-
* Fired for inserted nodes.
|
|
376
|
-
*
|
|
377
|
-
* `insert` is a namespace for a class of events. Names of actually called events follow this pattern:
|
|
378
|
-
* `insert:name`. `name` is either `'$text'`, when {@link module:engine/model/text~Text a text node} has been inserted,
|
|
379
|
-
* or {@link module:engine/model/element~Element#name name} of inserted element.
|
|
380
|
-
*
|
|
381
|
-
* This way, the listeners can either listen to a general `insert` event or specific event (for example `insert:paragraph`).
|
|
382
|
-
*
|
|
383
|
-
* @eventName ~DowncastDispatcher#insert
|
|
384
|
-
* @param {Object} data Additional information about the change.
|
|
385
|
-
* @param {module:engine/model/item~Item} data.item The inserted item.
|
|
386
|
-
* @param {module:engine/model/range~Range} data.range Range spanning over inserted item.
|
|
387
|
-
* @param {module:engine/conversion/downcastdispatcher~DowncastConversionApi} conversionApi Conversion interface
|
|
388
|
-
* to be used by callback, passed in the `DowncastDispatcher` constructor.
|
|
389
|
-
*/
|
|
390
|
-
export type DowncastInsertEvent<TItem extends Item = Item> = DowncastEvent<'insert', TItem>;
|
|
391
|
-
/**
|
|
392
|
-
* Fired for removed nodes.
|
|
393
|
-
*
|
|
394
|
-
* `remove` is a namespace for a class of events. Names of actually called events follow this pattern:
|
|
395
|
-
* `remove:name`. `name` is either `'$text'`, when a {@link module:engine/model/text~Text a text node} has been removed,
|
|
396
|
-
* or the {@link module:engine/model/element~Element#name name} of removed element.
|
|
397
|
-
*
|
|
398
|
-
* This way, listeners can either listen to a general `remove` event or specific event (for example `remove:paragraph`).
|
|
399
|
-
*
|
|
400
|
-
* @eventName ~DowncastDispatcher#remove
|
|
401
|
-
* @param {Object} data Additional information about the change.
|
|
402
|
-
* @param {module:engine/model/position~Position} data.position Position from which the node has been removed.
|
|
403
|
-
* @param {Number} data.length Offset size of the removed node.
|
|
404
|
-
* @param {module:engine/conversion/downcastdispatcher~DowncastConversionApi} conversionApi Conversion interface
|
|
405
|
-
* to be used by callback, passed in `DowncastDispatcher` constructor.
|
|
406
|
-
*/
|
|
407
|
-
export type DowncastRemoveEvent = DowncastEvent<'remove'>;
|
|
408
|
-
/**
|
|
409
|
-
* Fired in the following cases:
|
|
410
|
-
*
|
|
411
|
-
* * when an attribute has been added, changed, or removed from a node,
|
|
412
|
-
* * when a node with an attribute is inserted,
|
|
413
|
-
* * when a collapsed model selection attribute is converted.
|
|
414
|
-
*
|
|
415
|
-
* `attribute` is a namespace for a class of events. Names of actually called events follow this pattern:
|
|
416
|
-
* `attribute:attributeKey:name`. `attributeKey` is the key of added/changed/removed attribute.
|
|
417
|
-
* `name` is either `'$text'` if change was on {@link module:engine/model/text~Text a text node},
|
|
418
|
-
* or the {@link module:engine/model/element~Element#name name} of element which attribute has changed.
|
|
419
|
-
*
|
|
420
|
-
* This way listeners can either listen to a general `attribute:bold` event or specific event (for example `attribute:src:imageBlock`).
|
|
421
|
-
*
|
|
422
|
-
* @eventName ~DowncastDispatcher#attribute
|
|
423
|
-
* @param {Object} data Additional information about the change.
|
|
424
|
-
* @param {module:engine/model/item~Item|module:engine/model/documentselection~DocumentSelection} data.item Changed item
|
|
425
|
-
* or converted selection.
|
|
426
|
-
* @param {module:engine/model/range~Range} data.range Range spanning over changed item or selection range.
|
|
427
|
-
* @param {String} data.attributeKey Attribute key.
|
|
428
|
-
* @param {*} data.attributeOldValue Attribute value before the change. This is `null` when selection attribute is converted.
|
|
429
|
-
* @param {*} data.attributeNewValue New attribute value.
|
|
430
|
-
* @param {module:engine/conversion/downcastdispatcher~DowncastConversionApi} conversionApi Conversion interface
|
|
431
|
-
* to be used by callback, passed in `DowncastDispatcher` constructor.
|
|
432
|
-
*/
|
|
433
|
-
export type DowncastAttributeEvent<TItem = Item | Selection | DocumentSelection> = DowncastEvent<'attribute', TItem>;
|
|
434
|
-
/**
|
|
435
|
-
* Fired for {@link module:engine/model/selection~Selection selection} changes.
|
|
436
|
-
*
|
|
437
|
-
* @eventName ~DowncastDispatcher#selection
|
|
438
|
-
* @param {module:engine/model/selection~Selection} selection Selection that is converted.
|
|
439
|
-
* @param {module:engine/conversion/downcastdispatcher~DowncastConversionApi} conversionApi Conversion interface
|
|
440
|
-
* to be used by callback, passed in `DowncastDispatcher` constructor.
|
|
441
|
-
*/
|
|
442
|
-
export type DowncastSelectionEvent = DowncastEvent<'selection'>;
|
|
443
|
-
/**
|
|
444
|
-
* Fired at the beginning of selection conversion, before
|
|
445
|
-
* {@link module:engine/conversion/downcastdispatcher~DowncastDispatcher#event:selection selection} events.
|
|
446
|
-
*
|
|
447
|
-
* Should be used to clean up the view state at the current selection position, before the selection is moved to another place.
|
|
448
|
-
*
|
|
449
|
-
* @eventName ~DowncastDispatcher#cleanSelection
|
|
450
|
-
* @param {module:engine/model/selection~Selection} selection Selection that is converted.
|
|
451
|
-
* @param {module:engine/conversion/downcastdispatcher~DowncastConversionApi} conversionApi Conversion interface
|
|
452
|
-
* to be used by callback, passed in `DowncastDispatcher` constructor.
|
|
453
|
-
*/
|
|
454
|
-
export type DowncastCleanSelectionEvent = DowncastEvent<'cleanSelection'>;
|
|
455
|
-
/**
|
|
456
|
-
* Fired when a new marker is added to the model. Also fired when a collapsed model selection that is inside a marker is converted.
|
|
457
|
-
*
|
|
458
|
-
* `addMarker` is a namespace for a class of events. Names of actually called events follow this pattern:
|
|
459
|
-
* `addMarker:markerName`. By specifying certain marker names, you can make the events even more gradual. For example,
|
|
460
|
-
* if markers are named `foo:abc`, `foo:bar`, then it is possible to listen to `addMarker:foo` or `addMarker:foo:abc` and
|
|
461
|
-
* `addMarker:foo:bar` events.
|
|
462
|
-
*
|
|
463
|
-
* If the marker range is not collapsed:
|
|
464
|
-
*
|
|
465
|
-
* * the event is fired for each item in the marker range one by one,
|
|
466
|
-
* * `conversionApi.consumable` includes each item of the marker range and the consumable value is same as the event name.
|
|
467
|
-
*
|
|
468
|
-
* If the marker range is collapsed:
|
|
469
|
-
*
|
|
470
|
-
* * there is only one event,
|
|
471
|
-
* * `conversionApi.consumable` includes marker range with the event name.
|
|
472
|
-
*
|
|
473
|
-
* If the selection inside a marker is converted:
|
|
474
|
-
*
|
|
475
|
-
* * there is only one event,
|
|
476
|
-
* * `conversionApi.consumable` includes the selection instance with the event name.
|
|
477
|
-
*
|
|
478
|
-
* @eventName ~DowncastDispatcher#addMarker
|
|
479
|
-
* @param {Object} data Additional information about the change.
|
|
480
|
-
* @param {module:engine/model/item~Item|module:engine/model/selection~Selection} data.item Item inside the new marker or
|
|
481
|
-
* the selection that is being converted.
|
|
482
|
-
* @param {module:engine/model/range~Range} [data.range] Range spanning over converted item. Available only in marker conversion, if
|
|
483
|
-
* the marker range was not collapsed.
|
|
484
|
-
* @param {module:engine/model/range~Range} data.markerRange Marker range.
|
|
485
|
-
* @param {String} data.markerName Marker name.
|
|
486
|
-
* @param {module:engine/conversion/downcastdispatcher~DowncastConversionApi} conversionApi Conversion interface
|
|
487
|
-
* to be used by callback, passed in `DowncastDispatcher` constructor.
|
|
488
|
-
*/
|
|
489
|
-
export type DowncastAddMarkerEvent = DowncastEvent<'addMarker'>;
|
|
490
|
-
/**
|
|
491
|
-
* Fired when a marker is removed from the model.
|
|
492
|
-
*
|
|
493
|
-
* `removeMarker` is a namespace for a class of events. Names of actually called events follow this pattern:
|
|
494
|
-
* `removeMarker:markerName`. By specifying certain marker names, you can make the events even more gradual. For example,
|
|
495
|
-
* if markers are named `foo:abc`, `foo:bar`, then it is possible to listen to `removeMarker:foo` or `removeMarker:foo:abc` and
|
|
496
|
-
* `removeMarker:foo:bar` events.
|
|
497
|
-
*
|
|
498
|
-
* @eventName ~DowncastDispatcher#removeMarker
|
|
499
|
-
* @param {Object} data Additional information about the change.
|
|
500
|
-
* @param {module:engine/model/range~Range} data.markerRange Marker range.
|
|
501
|
-
* @param {String} data.markerName Marker name.
|
|
502
|
-
* @param {module:engine/conversion/downcastdispatcher~DowncastConversionApi} conversionApi Conversion interface
|
|
503
|
-
* to be used by callback, passed in `DowncastDispatcher` constructor.
|
|
504
|
-
*/
|
|
505
|
-
export type DowncastRemoveMarkerEvent = DowncastEvent<'removeMarker'>;
|
|
506
|
-
export interface DiffItemReinsert {
|
|
507
|
-
type: 'reinsert';
|
|
508
|
-
name: string;
|
|
509
|
-
position: Position;
|
|
510
|
-
length: number;
|
|
511
|
-
}
|
|
512
|
-
/**
|
|
513
|
-
* Conversion interface that is registered for given {@link module:engine/conversion/downcastdispatcher~DowncastDispatcher}
|
|
514
|
-
* and is passed as one of parameters when {@link module:engine/conversion/downcastdispatcher~DowncastDispatcher dispatcher}
|
|
515
|
-
* fires its events.
|
|
516
|
-
*/
|
|
517
|
-
export interface DowncastConversionApi {
|
|
518
|
-
/**
|
|
519
|
-
* The {@link module:engine/conversion/downcastdispatcher~DowncastDispatcher} instance.
|
|
520
|
-
*/
|
|
521
|
-
dispatcher: DowncastDispatcher;
|
|
522
|
-
/**
|
|
523
|
-
* Stores the information about what parts of a processed model item are still waiting to be handled. After a piece of a model item was
|
|
524
|
-
* converted, an appropriate consumable value should be {@link module:engine/conversion/modelconsumable~ModelConsumable#consume
|
|
525
|
-
* consumed}.
|
|
526
|
-
*/
|
|
527
|
-
consumable: Consumable;
|
|
528
|
-
/**
|
|
529
|
-
* The {@link module:engine/conversion/mapper~Mapper} instance.
|
|
530
|
-
*/
|
|
531
|
-
mapper: Mapper;
|
|
532
|
-
/**
|
|
533
|
-
* The {@link module:engine/model/schema~Schema} instance set for the model that is downcast.
|
|
534
|
-
*/
|
|
535
|
-
schema: Schema;
|
|
536
|
-
/**
|
|
537
|
-
* The {@link module:engine/view/downcastwriter~DowncastWriter} instance used to manipulate the data during conversion.
|
|
538
|
-
*/
|
|
539
|
-
writer: DowncastWriter;
|
|
540
|
-
/**
|
|
541
|
-
* An object with an additional configuration which can be used during the conversion process.
|
|
542
|
-
* Available only for data downcast conversion.
|
|
543
|
-
*/
|
|
544
|
-
options: Record<string, unknown>;
|
|
545
|
-
/**
|
|
546
|
-
* Triggers conversion of a specified item.
|
|
547
|
-
* This conversion is triggered within (as a separate process of) the parent conversion.
|
|
548
|
-
*
|
|
549
|
-
* @param item The model item to trigger nested insert conversion on.
|
|
550
|
-
*/
|
|
551
|
-
convertItem(item: Item): void;
|
|
552
|
-
/**
|
|
553
|
-
* Triggers conversion of children of a specified element.
|
|
554
|
-
*
|
|
555
|
-
* @param element The model element to trigger children insert conversion on.
|
|
556
|
-
*/
|
|
557
|
-
convertChildren(element: Element): void;
|
|
558
|
-
/**
|
|
559
|
-
* Triggers conversion of attributes of a specified item.
|
|
560
|
-
*
|
|
561
|
-
* @param item The model item to trigger attribute conversion on.
|
|
562
|
-
*/
|
|
563
|
-
convertAttributes(item: Item): void;
|
|
564
|
-
canReuseView(element: ViewElement): boolean;
|
|
565
|
-
}
|
|
566
|
-
export {};
|