@ckeditor/ckeditor5-engine 44.1.0-alpha.5 → 44.2.0-alpha.0
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
package/dist/view/text.d.ts
DELETED
|
@@ -1,78 +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/view/text
|
|
11
|
-
*/
|
|
12
|
-
import Node from './node.js';
|
|
13
|
-
import type Document from './document.js';
|
|
14
|
-
/**
|
|
15
|
-
* Tree view text node.
|
|
16
|
-
*
|
|
17
|
-
* The constructor of this class should not be used directly. To create a new text node instance
|
|
18
|
-
* use the {@link module:engine/view/downcastwriter~DowncastWriter#createText `DowncastWriter#createText()`}
|
|
19
|
-
* method when working on data downcasted from the model or the
|
|
20
|
-
* {@link module:engine/view/upcastwriter~UpcastWriter#createText `UpcastWriter#createText()`}
|
|
21
|
-
* method when working on non-semantic views.
|
|
22
|
-
*/
|
|
23
|
-
export default class Text extends Node {
|
|
24
|
-
/**
|
|
25
|
-
* The text content.
|
|
26
|
-
*
|
|
27
|
-
* Setting the data fires the {@link module:engine/view/node~Node#event:change:text change event}.
|
|
28
|
-
*/
|
|
29
|
-
private _textData;
|
|
30
|
-
/**
|
|
31
|
-
* Creates a tree view text node.
|
|
32
|
-
*
|
|
33
|
-
* @see module:engine/view/downcastwriter~DowncastWriter#createText
|
|
34
|
-
* @internal
|
|
35
|
-
* @param document The document instance to which this text node belongs.
|
|
36
|
-
* @param data The text's data.
|
|
37
|
-
*/
|
|
38
|
-
constructor(document: Document, data: string);
|
|
39
|
-
/**
|
|
40
|
-
* The text content.
|
|
41
|
-
*/
|
|
42
|
-
get data(): string;
|
|
43
|
-
/**
|
|
44
|
-
* The `_data` property is controlled by a getter and a setter.
|
|
45
|
-
*
|
|
46
|
-
* The getter is required when using the addition assignment operator on protected property:
|
|
47
|
-
*
|
|
48
|
-
* ```ts
|
|
49
|
-
* const foo = downcastWriter.createText( 'foo' );
|
|
50
|
-
* const bar = downcastWriter.createText( 'bar' );
|
|
51
|
-
*
|
|
52
|
-
* foo._data += bar.data; // executes: `foo._data = foo._data + bar.data`
|
|
53
|
-
* console.log( foo.data ); // prints: 'foobar'
|
|
54
|
-
* ```
|
|
55
|
-
*
|
|
56
|
-
* If the protected getter didn't exist, `foo._data` will return `undefined` and result of the merge will be invalid.
|
|
57
|
-
*
|
|
58
|
-
* The setter sets data and fires the {@link module:engine/view/node~Node#event:change:text change event}.
|
|
59
|
-
*
|
|
60
|
-
* @internal
|
|
61
|
-
*/
|
|
62
|
-
get _data(): string;
|
|
63
|
-
set _data(data: string);
|
|
64
|
-
/**
|
|
65
|
-
* Checks if this text node is similar to other text node.
|
|
66
|
-
* Both nodes should have the same data to be considered as similar.
|
|
67
|
-
*
|
|
68
|
-
* @param otherNode Node to check if it is same as this node.
|
|
69
|
-
*/
|
|
70
|
-
isSimilar(otherNode: Node): boolean;
|
|
71
|
-
/**
|
|
72
|
-
* Clones this node.
|
|
73
|
-
*
|
|
74
|
-
* @internal
|
|
75
|
-
* @returns Text node that is a clone of this node.
|
|
76
|
-
*/
|
|
77
|
-
_clone(): Text;
|
|
78
|
-
}
|
package/dist/view/textproxy.d.ts
DELETED
|
@@ -1,101 +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/view/textproxy
|
|
11
|
-
*/
|
|
12
|
-
import TypeCheckable from './typecheckable.js';
|
|
13
|
-
import type Document from './document.js';
|
|
14
|
-
import type DocumentFragment from './documentfragment.js';
|
|
15
|
-
import type Element from './element.js';
|
|
16
|
-
import type Node from './node.js';
|
|
17
|
-
import type Text from './text.js';
|
|
18
|
-
/**
|
|
19
|
-
* TextProxy is a wrapper for substring of {@link module:engine/view/text~Text}. Instance of this class is created by
|
|
20
|
-
* {@link module:engine/view/treewalker~TreeWalker} when only a part of {@link module:engine/view/text~Text} needs to be returned.
|
|
21
|
-
*
|
|
22
|
-
* `TextProxy` has an API similar to {@link module:engine/view/text~Text Text} and allows to do most of the common tasks performed
|
|
23
|
-
* on view nodes.
|
|
24
|
-
*
|
|
25
|
-
* **Note:** Some `TextProxy` instances may represent whole text node, not just a part of it.
|
|
26
|
-
* See {@link module:engine/view/textproxy~TextProxy#isPartial}.
|
|
27
|
-
*
|
|
28
|
-
* **Note:** `TextProxy` is a readonly interface.
|
|
29
|
-
*
|
|
30
|
-
* **Note:** `TextProxy` instances are created on the fly basing on the current state of parent {@link module:engine/view/text~Text}.
|
|
31
|
-
* Because of this it is highly unrecommended to store references to `TextProxy instances because they might get
|
|
32
|
-
* invalidated due to operations on Document. Also TextProxy is not a {@link module:engine/view/node~Node} so it can not be
|
|
33
|
-
* inserted as a child of {@link module:engine/view/element~Element}.
|
|
34
|
-
*
|
|
35
|
-
* `TextProxy` instances are created by {@link module:engine/view/treewalker~TreeWalker view tree walker}. You should not need to create
|
|
36
|
-
* an instance of this class by your own.
|
|
37
|
-
*/
|
|
38
|
-
export default class TextProxy extends TypeCheckable {
|
|
39
|
-
/**
|
|
40
|
-
* Reference to the {@link module:engine/view/text~Text} element which TextProxy is a substring.
|
|
41
|
-
*/
|
|
42
|
-
readonly textNode: Text;
|
|
43
|
-
/**
|
|
44
|
-
* Text data represented by this text proxy.
|
|
45
|
-
*/
|
|
46
|
-
readonly data: string;
|
|
47
|
-
/**
|
|
48
|
-
* Offset in the `textNode` where this `TextProxy` instance starts.
|
|
49
|
-
*/
|
|
50
|
-
readonly offsetInText: number;
|
|
51
|
-
/**
|
|
52
|
-
* Creates a text proxy.
|
|
53
|
-
*
|
|
54
|
-
* @internal
|
|
55
|
-
* @param textNode Text node which part is represented by this text proxy.
|
|
56
|
-
* @param offsetInText Offset in {@link module:engine/view/textproxy~TextProxy#textNode text node}
|
|
57
|
-
* from which the text proxy starts.
|
|
58
|
-
* @param length Text proxy length, that is how many text node's characters, starting from `offsetInText` it represents.
|
|
59
|
-
* @constructor
|
|
60
|
-
*/
|
|
61
|
-
constructor(textNode: Text, offsetInText: number, length: number);
|
|
62
|
-
/**
|
|
63
|
-
* Offset size of this node.
|
|
64
|
-
*/
|
|
65
|
-
get offsetSize(): number;
|
|
66
|
-
/**
|
|
67
|
-
* Flag indicating whether `TextProxy` instance covers only part of the original {@link module:engine/view/text~Text text node}
|
|
68
|
-
* (`true`) or the whole text node (`false`).
|
|
69
|
-
*
|
|
70
|
-
* This is `false` when text proxy starts at the very beginning of {@link module:engine/view/textproxy~TextProxy#textNode textNode}
|
|
71
|
-
* ({@link module:engine/view/textproxy~TextProxy#offsetInText offsetInText} equals `0`) and text proxy sizes is equal to
|
|
72
|
-
* text node size.
|
|
73
|
-
*/
|
|
74
|
-
get isPartial(): boolean;
|
|
75
|
-
/**
|
|
76
|
-
* Parent of this text proxy, which is same as parent of text node represented by this text proxy.
|
|
77
|
-
*/
|
|
78
|
-
get parent(): Element | DocumentFragment | null;
|
|
79
|
-
/**
|
|
80
|
-
* Root of this text proxy, which is same as root of text node represented by this text proxy.
|
|
81
|
-
*/
|
|
82
|
-
get root(): Node | DocumentFragment;
|
|
83
|
-
/**
|
|
84
|
-
* {@link module:engine/view/document~Document View document} that owns this text proxy, or `null` if the text proxy is inside
|
|
85
|
-
* {@link module:engine/view/documentfragment~DocumentFragment document fragment}.
|
|
86
|
-
*/
|
|
87
|
-
get document(): Document | null;
|
|
88
|
-
/**
|
|
89
|
-
* Returns ancestors array of this text proxy.
|
|
90
|
-
*
|
|
91
|
-
* @param options Options object.
|
|
92
|
-
* @param options.includeSelf When set to `true`, textNode will be also included in parent's array.
|
|
93
|
-
* @param options.parentFirst When set to `true`, array will be sorted from text proxy parent to
|
|
94
|
-
* root element, otherwise root element will be the first item in the array.
|
|
95
|
-
* @returns Array with ancestors.
|
|
96
|
-
*/
|
|
97
|
-
getAncestors(options?: {
|
|
98
|
-
includeSelf?: boolean;
|
|
99
|
-
parentFirst?: boolean;
|
|
100
|
-
}): Array<Text | Element | DocumentFragment>;
|
|
101
|
-
}
|
|
@@ -1,199 +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 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 IterableIterator<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 characters from {@link module:engine/view/text~Text} should be returned as one
|
|
31
|
-
* {@link module:engine/view/text~Text} or one by one as {@link module:engine/view/textproxy~TextProxy}.
|
|
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 set to `true`, walker will not
|
|
41
|
-
* return a parent node of the start position. Each {@link module:engine/view/element~Element} will be returned once.
|
|
42
|
-
* When set to `false` each element might be returned twice: for `'elementStart'` and `'elementEnd'`.
|
|
43
|
-
*/
|
|
44
|
-
readonly ignoreElementEnd: boolean;
|
|
45
|
-
/**
|
|
46
|
-
* Iterator position. If start position is not defined then position depends on {@link #direction}. If direction is
|
|
47
|
-
* `'forward'` position starts form the beginning, when direction is `'backward'` position starts from the end.
|
|
48
|
-
*/
|
|
49
|
-
private _position;
|
|
50
|
-
/**
|
|
51
|
-
* Start boundary parent.
|
|
52
|
-
*/
|
|
53
|
-
private readonly _boundaryStartParent;
|
|
54
|
-
/**
|
|
55
|
-
* End boundary parent.
|
|
56
|
-
*/
|
|
57
|
-
private readonly _boundaryEndParent;
|
|
58
|
-
/**
|
|
59
|
-
* Creates a range iterator. All parameters are optional, but you have to specify either `boundaries` or `startPosition`.
|
|
60
|
-
*
|
|
61
|
-
* @param options Object with configuration.
|
|
62
|
-
*/
|
|
63
|
-
constructor(options?: TreeWalkerOptions);
|
|
64
|
-
/**
|
|
65
|
-
* Iterable interface.
|
|
66
|
-
*/
|
|
67
|
-
[Symbol.iterator](): IterableIterator<TreeWalkerValue>;
|
|
68
|
-
/**
|
|
69
|
-
* Iterator position. If start position is not defined then position depends on {@link #direction}. If direction is
|
|
70
|
-
* `'forward'` position starts form the beginning, when direction is `'backward'` position starts from the end.
|
|
71
|
-
*/
|
|
72
|
-
get position(): Position;
|
|
73
|
-
/**
|
|
74
|
-
* Moves {@link #position} in the {@link #direction} skipping values as long as the callback function returns `true`.
|
|
75
|
-
*
|
|
76
|
-
* For example:
|
|
77
|
-
*
|
|
78
|
-
* ```ts
|
|
79
|
-
* walker.skip( value => value.type == 'text' ); // <p>{}foo</p> -> <p>foo[]</p>
|
|
80
|
-
* walker.skip( value => true ); // Move the position to the end: <p>{}foo</p> -> <p>foo</p>[]
|
|
81
|
-
* walker.skip( value => false ); // Do not move the position.
|
|
82
|
-
* ```
|
|
83
|
-
*
|
|
84
|
-
* @param skip Callback function. Gets {@link module:engine/view/treewalker~TreeWalkerValue} and should
|
|
85
|
-
* return `true` if the value should be skipped or `false` if not.
|
|
86
|
-
*/
|
|
87
|
-
skip(skip: (value: TreeWalkerValue) => boolean): void;
|
|
88
|
-
/**
|
|
89
|
-
* Gets the next tree walker's value.
|
|
90
|
-
*
|
|
91
|
-
* @returns Object implementing iterator interface, returning
|
|
92
|
-
* information about taken step.
|
|
93
|
-
*/
|
|
94
|
-
next(): IteratorResult<TreeWalkerValue, undefined>;
|
|
95
|
-
/**
|
|
96
|
-
* Makes a step forward in view. Moves the {@link #position} to the next position and returns the encountered value.
|
|
97
|
-
*/
|
|
98
|
-
private _next;
|
|
99
|
-
/**
|
|
100
|
-
* Makes a step backward in view. Moves the {@link #position} to the previous position and returns the encountered value.
|
|
101
|
-
*/
|
|
102
|
-
private _previous;
|
|
103
|
-
/**
|
|
104
|
-
* Format returned data and adjust `previousPosition` and `nextPosition` if reach the bound of the {@link module:engine/view/text~Text}.
|
|
105
|
-
*
|
|
106
|
-
* @param type Type of step.
|
|
107
|
-
* @param item Item between old and new position.
|
|
108
|
-
* @param previousPosition Previous position of iterator.
|
|
109
|
-
* @param nextPosition Next position of iterator.
|
|
110
|
-
* @param length Length of the item.
|
|
111
|
-
*/
|
|
112
|
-
private _formatReturnValue;
|
|
113
|
-
}
|
|
114
|
-
/**
|
|
115
|
-
* Type of the step made by {@link module:engine/view/treewalker~TreeWalker}.
|
|
116
|
-
* Possible values: `'elementStart'` if walker is at the beginning of a node, `'elementEnd'` if walker is at the end
|
|
117
|
-
* of node, or `'text'` if walker traversed over single and multiple characters.
|
|
118
|
-
* For {@link module:engine/view/text~Text} `elementStart` and `elementEnd` is not returned.
|
|
119
|
-
*/
|
|
120
|
-
export type TreeWalkerValueType = 'elementStart' | 'elementEnd' | 'text';
|
|
121
|
-
/**
|
|
122
|
-
* Object returned by {@link module:engine/view/treewalker~TreeWalker} when traversing tree view.
|
|
123
|
-
*/
|
|
124
|
-
export interface TreeWalkerValue {
|
|
125
|
-
/**
|
|
126
|
-
* Type of the step made by {@link module:engine/view/treewalker~TreeWalker}.
|
|
127
|
-
*/
|
|
128
|
-
type: TreeWalkerValueType;
|
|
129
|
-
/**
|
|
130
|
-
* Item between the old and the new positions of the tree walker.
|
|
131
|
-
*/
|
|
132
|
-
item: Item;
|
|
133
|
-
/**
|
|
134
|
-
* Previous position of the iterator.
|
|
135
|
-
* * Forward iteration: For `'elementEnd'` it is the last position inside the element. For all other types it is the
|
|
136
|
-
* position before the item.
|
|
137
|
-
* * Backward iteration: For `'elementStart'` it is the first position inside the element. For all other types it is
|
|
138
|
-
* the position after item.
|
|
139
|
-
* * If the position is at the beginning or at the end of the {@link module:engine/view/text~Text} it is always moved from the
|
|
140
|
-
* inside of the text to its parent just before or just after that text.
|
|
141
|
-
*/
|
|
142
|
-
previousPosition: Position;
|
|
143
|
-
/**
|
|
144
|
-
* Next position of the iterator.
|
|
145
|
-
* * Forward iteration: For `'elementStart'` it is the first position inside the element. For all other types it is
|
|
146
|
-
* the position after the item.
|
|
147
|
-
* * Backward iteration: For `'elementEnd'` it is last position inside element. For all other types it is the position
|
|
148
|
-
* before the item.
|
|
149
|
-
* * If the position is at the beginning or at the end of the {@link module:engine/view/text~Text} it is always moved from the
|
|
150
|
-
* inside of the text to its parent just before or just after that text.
|
|
151
|
-
*/
|
|
152
|
-
nextPosition: Position;
|
|
153
|
-
/**
|
|
154
|
-
* Length of the item. For `'elementStart'` it is `1`. For `'text'` it is
|
|
155
|
-
* the length of that text. For `'elementEnd'` it is `undefined`.
|
|
156
|
-
*/
|
|
157
|
-
length?: number;
|
|
158
|
-
}
|
|
159
|
-
/**
|
|
160
|
-
* Tree walking direction.
|
|
161
|
-
*/
|
|
162
|
-
export type TreeWalkerDirection = 'forward' | 'backward';
|
|
163
|
-
/**
|
|
164
|
-
* The configuration of {@link ~TreeWalker}.
|
|
165
|
-
*/
|
|
166
|
-
export interface TreeWalkerOptions {
|
|
167
|
-
/**
|
|
168
|
-
* Walking direction.
|
|
169
|
-
*
|
|
170
|
-
* @default 'forward'
|
|
171
|
-
*/
|
|
172
|
-
direction?: TreeWalkerDirection;
|
|
173
|
-
/**
|
|
174
|
-
* Range to define boundaries of the iterator.
|
|
175
|
-
*/
|
|
176
|
-
boundaries?: Range | null;
|
|
177
|
-
/**
|
|
178
|
-
* Starting position.
|
|
179
|
-
*/
|
|
180
|
-
startPosition?: Position;
|
|
181
|
-
/**
|
|
182
|
-
* Flag indicating whether all characters from
|
|
183
|
-
* {@link module:engine/view/text~Text} should be returned as one {@link module:engine/view/text~Text} (`false`) or one by one as
|
|
184
|
-
* {@link module:engine/view/textproxy~TextProxy} (`true`).
|
|
185
|
-
*/
|
|
186
|
-
singleCharacters?: boolean;
|
|
187
|
-
/**
|
|
188
|
-
* Flag indicating whether iterator should enter elements or not. If the
|
|
189
|
-
* iterator is shallow child nodes of any iterated node will not be returned along with `elementEnd` tag.
|
|
190
|
-
*/
|
|
191
|
-
shallow?: boolean;
|
|
192
|
-
/**
|
|
193
|
-
* Flag indicating whether iterator should ignore `elementEnd`
|
|
194
|
-
* tags. If the option is true walker will not return a parent node of start position. If this option is `true`
|
|
195
|
-
* each {@link module:engine/view/element~Element} will be returned once, while if the option is `false` they might be returned
|
|
196
|
-
* twice: for `'elementStart'` and `'elementEnd'`.
|
|
197
|
-
*/
|
|
198
|
-
ignoreElementEnd?: boolean;
|
|
199
|
-
}
|