@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,148 +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/model/textproxy
|
|
11
|
-
*/
|
|
12
|
-
import TypeCheckable from './typecheckable.js';
|
|
13
|
-
import type DocumentFragment from './documentfragment.js';
|
|
14
|
-
import type Element from './element.js';
|
|
15
|
-
import type Node from './node.js';
|
|
16
|
-
import type Text from './text.js';
|
|
17
|
-
/**
|
|
18
|
-
* `TextProxy` represents a part of {@link module:engine/model/text~Text text node}.
|
|
19
|
-
*
|
|
20
|
-
* Since {@link module:engine/model/position~Position positions} can be placed between characters of a text node,
|
|
21
|
-
* {@link module:engine/model/range~Range ranges} may contain only parts of text nodes. When {@link module:engine/model/range~Range#getItems
|
|
22
|
-
* getting items}
|
|
23
|
-
* contained in such range, we need to represent a part of that text node, since returning the whole text node would be incorrect.
|
|
24
|
-
* `TextProxy` solves this issue.
|
|
25
|
-
*
|
|
26
|
-
* `TextProxy` has an API similar to {@link module:engine/model/text~Text Text} and allows to do most of the common tasks performed
|
|
27
|
-
* on model nodes.
|
|
28
|
-
*
|
|
29
|
-
* **Note:** Some `TextProxy` instances may represent whole text node, not just a part of it.
|
|
30
|
-
* See {@link module:engine/model/textproxy~TextProxy#isPartial}.
|
|
31
|
-
*
|
|
32
|
-
* **Note:** `TextProxy` is not an instance of {@link module:engine/model/node~Node node}. Keep this in mind when using it as a
|
|
33
|
-
* parameter of methods.
|
|
34
|
-
*
|
|
35
|
-
* **Note:** `TextProxy` is a readonly interface. If you want to perform changes on model data represented by a `TextProxy`
|
|
36
|
-
* use {@link module:engine/model/writer~Writer model writer API}.
|
|
37
|
-
*
|
|
38
|
-
* **Note:** `TextProxy` instances are created on the fly, basing on the current state of model. Because of this, it is
|
|
39
|
-
* highly unrecommended to store references to `TextProxy` instances. `TextProxy` instances are not refreshed when
|
|
40
|
-
* model changes, so they might get invalidated. Instead, consider creating {@link module:engine/model/liveposition~LivePosition live
|
|
41
|
-
* position}.
|
|
42
|
-
*
|
|
43
|
-
* `TextProxy` instances are created by {@link module:engine/model/treewalker~TreeWalker model tree walker}. You should not need to create
|
|
44
|
-
* an instance of this class by your own.
|
|
45
|
-
*/
|
|
46
|
-
export default class TextProxy extends TypeCheckable {
|
|
47
|
-
/**
|
|
48
|
-
* Text node which part is represented by this text proxy.
|
|
49
|
-
*/
|
|
50
|
-
readonly textNode: Text;
|
|
51
|
-
/**
|
|
52
|
-
* Text data represented by this text proxy.
|
|
53
|
-
*/
|
|
54
|
-
readonly data: string;
|
|
55
|
-
/**
|
|
56
|
-
* Offset in {@link module:engine/model/textproxy~TextProxy#textNode text node} from which the text proxy starts.
|
|
57
|
-
*/
|
|
58
|
-
readonly offsetInText: number;
|
|
59
|
-
/**
|
|
60
|
-
* Creates a text proxy.
|
|
61
|
-
*
|
|
62
|
-
* @internal
|
|
63
|
-
* @param textNode Text node which part is represented by this text proxy.
|
|
64
|
-
* @param offsetInText Offset in {@link module:engine/model/textproxy~TextProxy#textNode text node} from which the text proxy
|
|
65
|
-
* starts.
|
|
66
|
-
* @param length Text proxy length, that is how many text node's characters, starting from `offsetInText` it represents.
|
|
67
|
-
*/
|
|
68
|
-
constructor(textNode: Text, offsetInText: number, length: number);
|
|
69
|
-
/**
|
|
70
|
-
* Offset at which this text proxy starts in it's parent.
|
|
71
|
-
*
|
|
72
|
-
* @see module:engine/model/node~Node#startOffset
|
|
73
|
-
*/
|
|
74
|
-
get startOffset(): number | null;
|
|
75
|
-
/**
|
|
76
|
-
* Offset size of this text proxy. Equal to the number of characters represented by the text proxy.
|
|
77
|
-
*
|
|
78
|
-
* @see module:engine/model/node~Node#offsetSize
|
|
79
|
-
*/
|
|
80
|
-
get offsetSize(): number;
|
|
81
|
-
/**
|
|
82
|
-
* Offset at which this text proxy ends in it's parent.
|
|
83
|
-
*
|
|
84
|
-
* @see module:engine/model/node~Node#endOffset
|
|
85
|
-
*/
|
|
86
|
-
get endOffset(): number | null;
|
|
87
|
-
/**
|
|
88
|
-
* Flag indicating whether `TextProxy` instance covers only part of the original {@link module:engine/model/text~Text text node}
|
|
89
|
-
* (`true`) or the whole text node (`false`).
|
|
90
|
-
*
|
|
91
|
-
* This is `false` when text proxy starts at the very beginning of {@link module:engine/model/textproxy~TextProxy#textNode textNode}
|
|
92
|
-
* ({@link module:engine/model/textproxy~TextProxy#offsetInText offsetInText} equals `0`) and text proxy sizes is equal to
|
|
93
|
-
* text node size.
|
|
94
|
-
*/
|
|
95
|
-
get isPartial(): boolean;
|
|
96
|
-
/**
|
|
97
|
-
* Parent of this text proxy, which is same as parent of text node represented by this text proxy.
|
|
98
|
-
*/
|
|
99
|
-
get parent(): Element | DocumentFragment | null;
|
|
100
|
-
/**
|
|
101
|
-
* Root of this text proxy, which is same as root of text node represented by this text proxy.
|
|
102
|
-
*/
|
|
103
|
-
get root(): Node | DocumentFragment;
|
|
104
|
-
/**
|
|
105
|
-
* Gets path to this text proxy.
|
|
106
|
-
*
|
|
107
|
-
* @see module:engine/model/node~Node#getPath
|
|
108
|
-
*/
|
|
109
|
-
getPath(): Array<number>;
|
|
110
|
-
/**
|
|
111
|
-
* Returns ancestors array of this text proxy.
|
|
112
|
-
*
|
|
113
|
-
* @param options Options object.
|
|
114
|
-
* @param options.includeSelf When set to `true` this text proxy will be also included in parent's array.
|
|
115
|
-
* @param options.parentFirst When set to `true`, array will be sorted from text proxy parent to root element,
|
|
116
|
-
* otherwise root element will be the first item in the array.
|
|
117
|
-
* @returns Array with ancestors.
|
|
118
|
-
*/
|
|
119
|
-
getAncestors(options?: {
|
|
120
|
-
includeSelf?: boolean;
|
|
121
|
-
parentFirst?: boolean;
|
|
122
|
-
}): Array<TextProxy | Element | DocumentFragment>;
|
|
123
|
-
/**
|
|
124
|
-
* Checks if this text proxy has an attribute for given key.
|
|
125
|
-
*
|
|
126
|
-
* @param key Key of attribute to check.
|
|
127
|
-
* @returns `true` if attribute with given key is set on text proxy, `false` otherwise.
|
|
128
|
-
*/
|
|
129
|
-
hasAttribute(key: string): boolean;
|
|
130
|
-
/**
|
|
131
|
-
* Gets an attribute value for given key or `undefined` if that attribute is not set on text proxy.
|
|
132
|
-
*
|
|
133
|
-
* @param key Key of attribute to look for.
|
|
134
|
-
* @returns Attribute value or `undefined`.
|
|
135
|
-
*/
|
|
136
|
-
getAttribute(key: string): unknown;
|
|
137
|
-
/**
|
|
138
|
-
* Returns iterator that iterates over this node's attributes. Attributes are returned as arrays containing two
|
|
139
|
-
* items. First one is attribute key and second is attribute value.
|
|
140
|
-
*
|
|
141
|
-
* This format is accepted by native `Map` object and also can be passed in `Node` constructor.
|
|
142
|
-
*/
|
|
143
|
-
getAttributes(): IterableIterator<[string, unknown]>;
|
|
144
|
-
/**
|
|
145
|
-
* Returns iterator that iterates over this node's attribute keys.
|
|
146
|
-
*/
|
|
147
|
-
getAttributeKeys(): IterableIterator<string>;
|
|
148
|
-
}
|
|
@@ -1,190 +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
|
-
import { default as Position } from './position.js';
|
|
10
|
-
import type Item from './item.js';
|
|
11
|
-
import type Range from './range.js';
|
|
12
|
-
/**
|
|
13
|
-
* Position iterator class. It allows to iterate forward and backward over the document.
|
|
14
|
-
*/
|
|
15
|
-
export default class TreeWalker implements Iterable<TreeWalkerValue> {
|
|
16
|
-
/**
|
|
17
|
-
* Walking direction. Defaults `'forward'`.
|
|
18
|
-
*/
|
|
19
|
-
readonly direction: TreeWalkerDirection;
|
|
20
|
-
/**
|
|
21
|
-
* Iterator boundaries.
|
|
22
|
-
*
|
|
23
|
-
* When the iterator is walking `'forward'` on the end of boundary or is walking `'backward'`
|
|
24
|
-
* on the start of boundary, then `{ done: true }` is returned.
|
|
25
|
-
*
|
|
26
|
-
* If boundaries are not defined they are set before first and after last child of the root node.
|
|
27
|
-
*/
|
|
28
|
-
readonly boundaries: Range | null;
|
|
29
|
-
/**
|
|
30
|
-
* Flag indicating whether all consecutive characters with the same attributes should be
|
|
31
|
-
* returned as one {@link module:engine/model/textproxy~TextProxy} (`true`) or one by one (`false`).
|
|
32
|
-
*/
|
|
33
|
-
readonly singleCharacters: boolean;
|
|
34
|
-
/**
|
|
35
|
-
* Flag indicating whether iterator should enter elements or not. If the iterator is shallow child nodes of any
|
|
36
|
-
* iterated node will not be returned along with `elementEnd` tag.
|
|
37
|
-
*/
|
|
38
|
-
readonly shallow: boolean;
|
|
39
|
-
/**
|
|
40
|
-
* Flag indicating whether iterator should ignore `elementEnd` tags. If the option is true walker will not
|
|
41
|
-
* return a parent node of the start position. If this option is `true` each {@link module:engine/model/element~Element} will
|
|
42
|
-
* be returned once, while if the option is `false` they might be returned twice:
|
|
43
|
-
* for `'elementStart'` and `'elementEnd'`.
|
|
44
|
-
*/
|
|
45
|
-
readonly ignoreElementEnd: boolean;
|
|
46
|
-
/**
|
|
47
|
-
* Iterator position. This is always static position, even if the initial position was a
|
|
48
|
-
* {@link module:engine/model/liveposition~LivePosition live position}. If start position is not defined then position depends
|
|
49
|
-
* on {@link #direction}. If direction is `'forward'` position starts form the beginning, when direction
|
|
50
|
-
* is `'backward'` position starts from the end.
|
|
51
|
-
*/
|
|
52
|
-
private _position;
|
|
53
|
-
/**
|
|
54
|
-
* Start boundary cached for optimization purposes.
|
|
55
|
-
*/
|
|
56
|
-
private _boundaryStartParent;
|
|
57
|
-
/**
|
|
58
|
-
* End boundary cached for optimization purposes.
|
|
59
|
-
*/
|
|
60
|
-
private _boundaryEndParent;
|
|
61
|
-
/**
|
|
62
|
-
* Parent of the most recently visited node. Cached for optimization purposes.
|
|
63
|
-
*/
|
|
64
|
-
private _visitedParent;
|
|
65
|
-
/**
|
|
66
|
-
* Creates a range iterator. All parameters are optional, but you have to specify either `boundaries` or `startPosition`.
|
|
67
|
-
*
|
|
68
|
-
* @param options Object with configuration.
|
|
69
|
-
*/
|
|
70
|
-
constructor(options: TreeWalkerOptions);
|
|
71
|
-
/**
|
|
72
|
-
* Iterable interface.
|
|
73
|
-
*
|
|
74
|
-
* @returns {Iterable.<module:engine/model/treewalker~TreeWalkerValue>}
|
|
75
|
-
*/
|
|
76
|
-
[Symbol.iterator](): IterableIterator<TreeWalkerValue>;
|
|
77
|
-
/**
|
|
78
|
-
* Iterator position. This is always static position, even if the initial position was a
|
|
79
|
-
* {@link module:engine/model/liveposition~LivePosition live position}. If start position is not defined then position depends
|
|
80
|
-
* on {@link #direction}. If direction is `'forward'` position starts form the beginning, when direction
|
|
81
|
-
* is `'backward'` position starts from the end.
|
|
82
|
-
*/
|
|
83
|
-
get position(): Position;
|
|
84
|
-
/**
|
|
85
|
-
* Moves {@link #position} in the {@link #direction} skipping values as long as the callback function returns `true`.
|
|
86
|
-
*
|
|
87
|
-
* For example:
|
|
88
|
-
*
|
|
89
|
-
* ```ts
|
|
90
|
-
* walker.skip( value => value.type == 'text' ); // <paragraph>[]foo</paragraph> -> <paragraph>foo[]</paragraph>
|
|
91
|
-
* walker.skip( () => true ); // Move the position to the end: <paragraph>[]foo</paragraph> -> <paragraph>foo</paragraph>[]
|
|
92
|
-
* walker.skip( () => false ); // Do not move the position.
|
|
93
|
-
* ```
|
|
94
|
-
*
|
|
95
|
-
* @param skip Callback function. Gets {@link module:engine/model/treewalker~TreeWalkerValue} and should
|
|
96
|
-
* return `true` if the value should be skipped or `false` if not.
|
|
97
|
-
*/
|
|
98
|
-
skip(skip: (value: TreeWalkerValue) => boolean): void;
|
|
99
|
-
/**
|
|
100
|
-
* Gets the next tree walker's value.
|
|
101
|
-
*/
|
|
102
|
-
next(): IteratorResult<TreeWalkerValue>;
|
|
103
|
-
/**
|
|
104
|
-
* Makes a step forward in model. Moves the {@link #position} to the next position and returns the encountered value.
|
|
105
|
-
*/
|
|
106
|
-
private _next;
|
|
107
|
-
/**
|
|
108
|
-
* Makes a step backward in model. Moves the {@link #position} to the previous position and returns the encountered value.
|
|
109
|
-
*/
|
|
110
|
-
private _previous;
|
|
111
|
-
}
|
|
112
|
-
/**
|
|
113
|
-
* Type of the step made by {@link module:engine/model/treewalker~TreeWalker}.
|
|
114
|
-
* Possible values: `'elementStart'` if walker is at the beginning of a node, `'elementEnd'` if walker is at the end of node,
|
|
115
|
-
* or `'text'` if walker traversed over text.
|
|
116
|
-
*/
|
|
117
|
-
export type TreeWalkerValueType = 'elementStart' | 'elementEnd' | 'text';
|
|
118
|
-
/**
|
|
119
|
-
* Object returned by {@link module:engine/model/treewalker~TreeWalker} when traversing tree model.
|
|
120
|
-
*/
|
|
121
|
-
export interface TreeWalkerValue {
|
|
122
|
-
type: TreeWalkerValueType;
|
|
123
|
-
/**
|
|
124
|
-
* Item between old and new positions of {@link module:engine/model/treewalker~TreeWalker}.
|
|
125
|
-
*/
|
|
126
|
-
item: Item;
|
|
127
|
-
/**
|
|
128
|
-
* Previous position of the iterator.
|
|
129
|
-
* * Forward iteration: For `'elementEnd'` it is the last position inside the element. For all other types it is the
|
|
130
|
-
* position before the item.
|
|
131
|
-
* * Backward iteration: For `'elementStart'` it is the first position inside the element. For all other types it is
|
|
132
|
-
* the position after item.
|
|
133
|
-
*/
|
|
134
|
-
previousPosition: Position;
|
|
135
|
-
/**
|
|
136
|
-
* Next position of the iterator.
|
|
137
|
-
* * Forward iteration: For `'elementStart'` it is the first position inside the element. For all other types it is
|
|
138
|
-
* the position after the item.
|
|
139
|
-
* * Backward iteration: For `'elementEnd'` it is last position inside element. For all other types it is the position
|
|
140
|
-
* before the item.
|
|
141
|
-
*/
|
|
142
|
-
nextPosition: Position;
|
|
143
|
-
/**
|
|
144
|
-
* Length of the item. For `'elementStart'` it is 1. For `'text'` it is the length of the text. For `'elementEnd'` it is `undefined`.
|
|
145
|
-
*/
|
|
146
|
-
length?: number;
|
|
147
|
-
}
|
|
148
|
-
/**
|
|
149
|
-
* Tree walking direction.
|
|
150
|
-
*/
|
|
151
|
-
export type TreeWalkerDirection = 'forward' | 'backward';
|
|
152
|
-
/**
|
|
153
|
-
* The configuration of TreeWalker.
|
|
154
|
-
*
|
|
155
|
-
* All parameters are optional, but you have to specify either `boundaries` or `startPosition`.
|
|
156
|
-
*/
|
|
157
|
-
export interface TreeWalkerOptions {
|
|
158
|
-
/**
|
|
159
|
-
* Walking direction.
|
|
160
|
-
*
|
|
161
|
-
* @default 'forward'
|
|
162
|
-
*/
|
|
163
|
-
direction?: TreeWalkerDirection;
|
|
164
|
-
/**
|
|
165
|
-
* Range to define boundaries of the iterator.
|
|
166
|
-
*/
|
|
167
|
-
boundaries?: Range | null;
|
|
168
|
-
/**
|
|
169
|
-
* Starting position.
|
|
170
|
-
*/
|
|
171
|
-
startPosition?: Position;
|
|
172
|
-
/**
|
|
173
|
-
* Flag indicating whether all consecutive characters with the same attributes
|
|
174
|
-
* should be returned one by one as multiple {@link module:engine/model/textproxy~TextProxy} (`true`) objects or as one
|
|
175
|
-
* {@link module:engine/model/textproxy~TextProxy} (`false`).
|
|
176
|
-
*/
|
|
177
|
-
singleCharacters?: boolean;
|
|
178
|
-
/**
|
|
179
|
-
* Flag indicating whether iterator should enter elements or not. If the
|
|
180
|
-
* iterator is shallow child nodes of any iterated node will not be returned along with `elementEnd` tag.
|
|
181
|
-
*/
|
|
182
|
-
shallow?: boolean;
|
|
183
|
-
/**
|
|
184
|
-
* Flag indicating whether iterator should ignore `elementEnd` tags.
|
|
185
|
-
* If the option is true walker will not return a parent node of start position. If this option is `true`
|
|
186
|
-
* each {@link module:engine/model/element~Element} will be returned once, while if the option is `false` they might be returned
|
|
187
|
-
* twice: for `'elementStart'` and `'elementEnd'`.
|
|
188
|
-
*/
|
|
189
|
-
ignoreElementEnd?: boolean;
|
|
190
|
-
}
|
|
@@ -1,289 +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/model/typecheckable
|
|
11
|
-
*/
|
|
12
|
-
import type { Marker } from './markercollection.js';
|
|
13
|
-
import type DocumentFragment from './documentfragment.js';
|
|
14
|
-
import type DocumentSelection from './documentselection.js';
|
|
15
|
-
import type Element from './element.js';
|
|
16
|
-
import type LivePosition from './liveposition.js';
|
|
17
|
-
import type LiveRange from './liverange.js';
|
|
18
|
-
import type Node from './node.js';
|
|
19
|
-
import type Position from './position.js';
|
|
20
|
-
import type Range from './range.js';
|
|
21
|
-
import type RootElement from './rootelement.js';
|
|
22
|
-
import type Selection from './selection.js';
|
|
23
|
-
import type Text from './text.js';
|
|
24
|
-
import type TextProxy from './textproxy.js';
|
|
25
|
-
export default abstract class TypeCheckable {
|
|
26
|
-
/**
|
|
27
|
-
* Checks whether the object is of type {@link module:engine/model/node~Node} or its subclass.
|
|
28
|
-
*
|
|
29
|
-
* This method is useful when processing model objects that are of unknown type. For example, a function
|
|
30
|
-
* may return a {@link module:engine/model/documentfragment~DocumentFragment} or a {@link module:engine/model/node~Node}
|
|
31
|
-
* that can be either a text node or an element. This method can be used to check what kind of object is returned.
|
|
32
|
-
*
|
|
33
|
-
* ```ts
|
|
34
|
-
* someObject.is( 'element' ); // -> true if this is an element
|
|
35
|
-
* someObject.is( 'node' ); // -> true if this is a node (a text node or an element)
|
|
36
|
-
* someObject.is( 'documentFragment' ); // -> true if this is a document fragment
|
|
37
|
-
* ```
|
|
38
|
-
*
|
|
39
|
-
* Since this method is also available on a range of view objects, you can prefix the type of the object with
|
|
40
|
-
* `model:` or `view:` to check, for example, if this is the model's or view's element:
|
|
41
|
-
*
|
|
42
|
-
* ```ts
|
|
43
|
-
* modelElement.is( 'model:element' ); // -> true
|
|
44
|
-
* modelElement.is( 'view:element' ); // -> false
|
|
45
|
-
* ```
|
|
46
|
-
*
|
|
47
|
-
* By using this method it is also possible to check a name of an element:
|
|
48
|
-
*
|
|
49
|
-
* ```ts
|
|
50
|
-
* imageElement.is( 'element', 'imageBlock' ); // -> true
|
|
51
|
-
* imageElement.is( 'element', 'imageBlock' ); // -> same as above
|
|
52
|
-
* imageElement.is( 'model:element', 'imageBlock' ); // -> same as above, but more precise
|
|
53
|
-
* ```
|
|
54
|
-
*
|
|
55
|
-
* @label NODE
|
|
56
|
-
*/
|
|
57
|
-
is(type: 'node' | 'model:node'): this is Node | Element | Text | RootElement;
|
|
58
|
-
/**
|
|
59
|
-
* Checks whether the object is of type {@link module:engine/model/element~Element} or its subclass.
|
|
60
|
-
*
|
|
61
|
-
* ```ts
|
|
62
|
-
* element.is( 'element' ); // -> true
|
|
63
|
-
* element.is( 'node' ); // -> true
|
|
64
|
-
* element.is( 'model:element' ); // -> true
|
|
65
|
-
* element.is( 'model:node' ); // -> true
|
|
66
|
-
*
|
|
67
|
-
* element.is( 'view:element' ); // -> false
|
|
68
|
-
* element.is( 'documentSelection' ); // -> false
|
|
69
|
-
* ```
|
|
70
|
-
*
|
|
71
|
-
* Assuming that the object being checked is an element, you can also check its
|
|
72
|
-
* {@link module:engine/model/element~Element#name name}:
|
|
73
|
-
*
|
|
74
|
-
* ```ts
|
|
75
|
-
* element.is( 'element', 'imageBlock' ); // -> true if this is an <imageBlock> element
|
|
76
|
-
* text.is( 'element', 'imageBlock' ); -> false
|
|
77
|
-
* ```
|
|
78
|
-
*
|
|
79
|
-
* @label ELEMENT
|
|
80
|
-
*/
|
|
81
|
-
is(type: 'element' | 'model:element'): this is Element | RootElement;
|
|
82
|
-
/**
|
|
83
|
-
* Checks whether the object is of type {@link module:engine/model/rootelement~RootElement}.
|
|
84
|
-
*
|
|
85
|
-
* ```ts
|
|
86
|
-
* rootElement.is( 'rootElement' ); // -> true
|
|
87
|
-
* rootElement.is( 'element' ); // -> true
|
|
88
|
-
* rootElement.is( 'node' ); // -> true
|
|
89
|
-
* rootElement.is( 'model:rootElement' ); // -> true
|
|
90
|
-
* rootElement.is( 'model:element' ); // -> true
|
|
91
|
-
* rootElement.is( 'model:node' ); // -> true
|
|
92
|
-
*
|
|
93
|
-
* rootElement.is( 'view:element' ); // -> false
|
|
94
|
-
* rootElement.is( 'documentFragment' ); // -> false
|
|
95
|
-
* ```
|
|
96
|
-
*
|
|
97
|
-
* Assuming that the object being checked is an element, you can also check its
|
|
98
|
-
* {@link module:engine/model/element~Element#name name}:
|
|
99
|
-
*
|
|
100
|
-
* ```ts
|
|
101
|
-
* rootElement.is( 'rootElement', '$root' ); // -> same as above
|
|
102
|
-
* ```
|
|
103
|
-
*
|
|
104
|
-
* @label ROOT_ELEMENT
|
|
105
|
-
*/
|
|
106
|
-
is(type: 'rootElement' | 'model:rootElement'): this is RootElement;
|
|
107
|
-
/**
|
|
108
|
-
* Checks whether the object is of type {@link module:engine/model/text~Text}.
|
|
109
|
-
*
|
|
110
|
-
* ```ts
|
|
111
|
-
* text.is( '$text' ); // -> true
|
|
112
|
-
* text.is( 'node' ); // -> true
|
|
113
|
-
* text.is( 'model:$text' ); // -> true
|
|
114
|
-
* text.is( 'model:node' ); // -> true
|
|
115
|
-
*
|
|
116
|
-
* text.is( 'view:$text' ); // -> false
|
|
117
|
-
* text.is( 'documentSelection' ); // -> false
|
|
118
|
-
* ```
|
|
119
|
-
*
|
|
120
|
-
* **Note:** Until version 20.0.0 this method wasn't accepting `'$text'` type. The legacy `'text'` type is still
|
|
121
|
-
* accepted for backward compatibility.
|
|
122
|
-
*
|
|
123
|
-
* @label TEXT
|
|
124
|
-
*/
|
|
125
|
-
is(type: '$text' | 'model:$text'): this is Text;
|
|
126
|
-
/**
|
|
127
|
-
* Checks whether the object is of type {@link module:engine/model/position~Position} or its subclass.
|
|
128
|
-
*
|
|
129
|
-
* ```ts
|
|
130
|
-
* position.is( 'position' ); // -> true
|
|
131
|
-
* position.is( 'model:position' ); // -> true
|
|
132
|
-
*
|
|
133
|
-
* position.is( 'view:position' ); // -> false
|
|
134
|
-
* position.is( 'documentSelection' ); // -> false
|
|
135
|
-
* ```
|
|
136
|
-
*
|
|
137
|
-
* @label POSITION
|
|
138
|
-
*/
|
|
139
|
-
is(type: 'position' | 'model:position'): this is Position | LivePosition;
|
|
140
|
-
/**
|
|
141
|
-
* Checks whether the object is of type {@link module:engine/model/liveposition~LivePosition}.
|
|
142
|
-
*
|
|
143
|
-
* ```ts
|
|
144
|
-
* livePosition.is( 'position' ); // -> true
|
|
145
|
-
* livePosition.is( 'model:position' ); // -> true
|
|
146
|
-
* livePosition.is( 'liveposition' ); // -> true
|
|
147
|
-
* livePosition.is( 'model:livePosition' ); // -> true
|
|
148
|
-
*
|
|
149
|
-
* livePosition.is( 'view:position' ); // -> false
|
|
150
|
-
* livePosition.is( 'documentSelection' ); // -> false
|
|
151
|
-
* ```
|
|
152
|
-
*
|
|
153
|
-
* @label LIVE_POSITION
|
|
154
|
-
*/
|
|
155
|
-
is(type: 'livePosition' | 'model:livePosition'): this is LivePosition;
|
|
156
|
-
/**
|
|
157
|
-
* Checks whether the object is of type {@link module:engine/model/range~Range} or its subclass.
|
|
158
|
-
*
|
|
159
|
-
* ```ts
|
|
160
|
-
* range.is( 'range' ); // -> true
|
|
161
|
-
* range.is( 'model:range' ); // -> true
|
|
162
|
-
*
|
|
163
|
-
* range.is( 'view:range' ); // -> false
|
|
164
|
-
* range.is( 'documentSelection' ); // -> false
|
|
165
|
-
* ```
|
|
166
|
-
*
|
|
167
|
-
* @label RANGE
|
|
168
|
-
*/
|
|
169
|
-
is(type: 'range' | 'model:range'): this is Range | LiveRange;
|
|
170
|
-
/**
|
|
171
|
-
* Checks whether the object is of type {@link module:engine/model/liverange~LiveRange}.
|
|
172
|
-
*
|
|
173
|
-
* ```ts
|
|
174
|
-
* liveRange.is( 'range' ); // -> true
|
|
175
|
-
* liveRange.is( 'model:range' ); // -> true
|
|
176
|
-
* liveRange.is( 'liveRange' ); // -> true
|
|
177
|
-
* liveRange.is( 'model:liveRange' ); // -> true
|
|
178
|
-
*
|
|
179
|
-
* liveRange.is( 'view:range' ); // -> false
|
|
180
|
-
* liveRange.is( 'documentSelection' ); // -> false
|
|
181
|
-
* ```
|
|
182
|
-
*
|
|
183
|
-
* @label LIVE_RANGE
|
|
184
|
-
*/
|
|
185
|
-
is(type: 'liveRange' | 'model:liveRange'): this is LiveRange;
|
|
186
|
-
/**
|
|
187
|
-
* Checks whether the object is of type {@link module:engine/model/documentfragment~DocumentFragment}.
|
|
188
|
-
*
|
|
189
|
-
* ```ts
|
|
190
|
-
* docFrag.is( 'documentFragment' ); // -> true
|
|
191
|
-
* docFrag.is( 'model:documentFragment' ); // -> true
|
|
192
|
-
*
|
|
193
|
-
* docFrag.is( 'view:documentFragment' ); // -> false
|
|
194
|
-
* docFrag.is( 'element' ); // -> false
|
|
195
|
-
* docFrag.is( 'node' ); // -> false
|
|
196
|
-
* ```
|
|
197
|
-
*
|
|
198
|
-
* @label DOCUMENT_FRAGMENT
|
|
199
|
-
*/
|
|
200
|
-
is(type: 'documentFragment' | 'model:documentFragment'): this is DocumentFragment;
|
|
201
|
-
/**
|
|
202
|
-
* Checks whether the object is of type {@link module:engine/model/selection~Selection}
|
|
203
|
-
* or {@link module:engine/model/documentselection~DocumentSelection}.
|
|
204
|
-
*
|
|
205
|
-
* ```ts
|
|
206
|
-
* selection.is( 'selection' ); // -> true
|
|
207
|
-
* selection.is( 'model:selection' ); // -> true
|
|
208
|
-
*
|
|
209
|
-
* selection.is( 'view:selection' ); // -> false
|
|
210
|
-
* selection.is( 'range' ); // -> false
|
|
211
|
-
* ```
|
|
212
|
-
*
|
|
213
|
-
* @label SELECTION
|
|
214
|
-
*/
|
|
215
|
-
is(type: 'selection' | 'model:selection'): this is Selection | DocumentSelection;
|
|
216
|
-
/**
|
|
217
|
-
* Checks whether the object is of type {@link module:engine/model/documentselection~DocumentSelection}.
|
|
218
|
-
*
|
|
219
|
-
* ```ts
|
|
220
|
-
* selection.is( 'selection' ); // -> true
|
|
221
|
-
* selection.is( 'documentSelection' ); // -> true
|
|
222
|
-
* selection.is( 'model:selection' ); // -> true
|
|
223
|
-
* selection.is( 'model:documentSelection' ); // -> true
|
|
224
|
-
*
|
|
225
|
-
* selection.is( 'view:selection' ); // -> false
|
|
226
|
-
* selection.is( 'element' ); // -> false
|
|
227
|
-
* selection.is( 'node' ); // -> false
|
|
228
|
-
* ```
|
|
229
|
-
*
|
|
230
|
-
* @label DOCUMENT_SELECTION
|
|
231
|
-
*/
|
|
232
|
-
is(type: 'documentSelection' | 'model:documentSelection'): this is DocumentSelection;
|
|
233
|
-
/**
|
|
234
|
-
* Checks whether the object is of type {@link module:engine/model/markercollection~Marker}.
|
|
235
|
-
*
|
|
236
|
-
* ```ts
|
|
237
|
-
* marker.is( 'marker' ); // -> true
|
|
238
|
-
* marker.is( 'model:marker' ); // -> true
|
|
239
|
-
*
|
|
240
|
-
* marker.is( 'view:element' ); // -> false
|
|
241
|
-
* marker.is( 'documentSelection' ); // -> false
|
|
242
|
-
* ```
|
|
243
|
-
*
|
|
244
|
-
* @label MARKER
|
|
245
|
-
*/
|
|
246
|
-
is(type: 'marker' | 'model:marker'): this is Marker;
|
|
247
|
-
/**
|
|
248
|
-
* Checks whether the object is of type {@link module:engine/model/textproxy~TextProxy}.
|
|
249
|
-
*
|
|
250
|
-
* ```ts
|
|
251
|
-
* textProxy.is( '$textProxy' ); // -> true
|
|
252
|
-
* textProxy.is( 'model:$textProxy' ); // -> true
|
|
253
|
-
*
|
|
254
|
-
* textProxy.is( 'view:$textProxy' ); // -> false
|
|
255
|
-
* textProxy.is( 'range' ); // -> false
|
|
256
|
-
* ```
|
|
257
|
-
*
|
|
258
|
-
* **Note:** Until version 20.0.0 this method wasn't accepting `'$textProxy'` type. The legacy `'textProxt'` type is still
|
|
259
|
-
* accepted for backward compatibility.
|
|
260
|
-
*
|
|
261
|
-
* @label TEXT_PROXY
|
|
262
|
-
*/
|
|
263
|
-
is(type: '$textProxy' | 'model:$textProxy'): this is TextProxy;
|
|
264
|
-
/**
|
|
265
|
-
* Checks whether the object is of type {@link module:engine/model/element~Element} or its subclass and has the specified `name`.
|
|
266
|
-
*
|
|
267
|
-
* ```ts
|
|
268
|
-
* element.is( 'element', 'imageBlock' ); // -> true if this is an <imageBlock> element
|
|
269
|
-
* text.is( 'element', 'imageBlock' ); -> false
|
|
270
|
-
* ```
|
|
271
|
-
*
|
|
272
|
-
* @label ELEMENT_NAME
|
|
273
|
-
*/
|
|
274
|
-
is<N extends string>(type: 'element' | 'model:element', name: N): this is (Element | RootElement) & {
|
|
275
|
-
name: N;
|
|
276
|
-
};
|
|
277
|
-
/**
|
|
278
|
-
* Checks whether the object is of type {@link module:engine/model/rootelement~RootElement} and has the specified `name`.
|
|
279
|
-
*
|
|
280
|
-
* ```ts
|
|
281
|
-
* rootElement.is( 'rootElement', '$root' );
|
|
282
|
-
* ```
|
|
283
|
-
*
|
|
284
|
-
* @label ROOT_ELEMENT_NAME
|
|
285
|
-
*/
|
|
286
|
-
is<N extends string>(type: 'rootElement' | 'model:rootElement', name: N): this is RootElement & {
|
|
287
|
-
name: N;
|
|
288
|
-
};
|
|
289
|
-
}
|
|
@@ -1,41 +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
|
-
import type Node from '../node.js';
|
|
10
|
-
import type Position from '../position.js';
|
|
11
|
-
import type Schema from '../schema.js';
|
|
12
|
-
import type Writer from '../writer.js';
|
|
13
|
-
/**
|
|
14
|
-
* @module engine/model/utils/autoparagraphing
|
|
15
|
-
*/
|
|
16
|
-
/**
|
|
17
|
-
* Fixes all empty roots.
|
|
18
|
-
*
|
|
19
|
-
* @internal
|
|
20
|
-
* @param writer The model writer.
|
|
21
|
-
* @returns `true` if any change has been applied, `false` otherwise.
|
|
22
|
-
*/
|
|
23
|
-
export declare function autoParagraphEmptyRoots(writer: Writer): boolean;
|
|
24
|
-
/**
|
|
25
|
-
* Checks if the given node wrapped with a paragraph would be accepted by the schema in the given position.
|
|
26
|
-
*
|
|
27
|
-
* @internal
|
|
28
|
-
* @param position The position at which to check.
|
|
29
|
-
* @param nodeOrType The child node or child type to check.
|
|
30
|
-
* @param schema A schema instance used for element validation.
|
|
31
|
-
*/
|
|
32
|
-
export declare function isParagraphable(position: Position, nodeOrType: Node | string, schema: Schema): boolean;
|
|
33
|
-
/**
|
|
34
|
-
* Inserts a new paragraph at the given position and returns a position inside that paragraph.
|
|
35
|
-
*
|
|
36
|
-
* @internal
|
|
37
|
-
* @param position The position where a paragraph should be inserted.
|
|
38
|
-
* @param writer The model writer.
|
|
39
|
-
* @returns Position inside the created paragraph.
|
|
40
|
-
*/
|
|
41
|
-
export declare function wrapInParagraph(position: Position, writer: Writer): Position;
|