@ckeditor/ckeditor5-engine 44.1.0 → 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/range.d.ts
DELETED
|
@@ -1,283 +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/range
|
|
11
|
-
*/
|
|
12
|
-
import TypeCheckable from './typecheckable.js';
|
|
13
|
-
import Position from './position.js';
|
|
14
|
-
import type DocumentFragment from './documentfragment.js';
|
|
15
|
-
import type Element from './element.js';
|
|
16
|
-
import type Item from './item.js';
|
|
17
|
-
import type Node from './node.js';
|
|
18
|
-
import { default as TreeWalker, type TreeWalkerValue, type TreeWalkerOptions } from './treewalker.js';
|
|
19
|
-
/**
|
|
20
|
-
* Range in the view tree. A range is represented by its start and end {@link module:engine/view/position~Position positions}.
|
|
21
|
-
*
|
|
22
|
-
* In order to create a new position instance use the `createPosition*()` factory methods available in:
|
|
23
|
-
*
|
|
24
|
-
* * {@link module:engine/view/view~View}
|
|
25
|
-
* * {@link module:engine/view/downcastwriter~DowncastWriter}
|
|
26
|
-
* * {@link module:engine/view/upcastwriter~UpcastWriter}
|
|
27
|
-
*/
|
|
28
|
-
export default class Range extends TypeCheckable implements Iterable<TreeWalkerValue> {
|
|
29
|
-
/**
|
|
30
|
-
* Start position.
|
|
31
|
-
*/
|
|
32
|
-
readonly start: Position;
|
|
33
|
-
/**
|
|
34
|
-
* End position.
|
|
35
|
-
*/
|
|
36
|
-
readonly end: Position;
|
|
37
|
-
/**
|
|
38
|
-
* Creates a range spanning from `start` position to `end` position.
|
|
39
|
-
*
|
|
40
|
-
* **Note:** Constructor creates it's own {@link module:engine/view/position~Position} instances basing on passed values.
|
|
41
|
-
*
|
|
42
|
-
* @param start Start position.
|
|
43
|
-
* @param end End position. If not set, range will be collapsed at the `start` position.
|
|
44
|
-
*/
|
|
45
|
-
constructor(start: Position, end?: Position | null);
|
|
46
|
-
/**
|
|
47
|
-
* Iterable interface.
|
|
48
|
-
*
|
|
49
|
-
* Iterates over all {@link module:engine/view/item~Item view items} that are in this range and returns
|
|
50
|
-
* them together with additional information like length or {@link module:engine/view/position~Position positions},
|
|
51
|
-
* grouped as {@link module:engine/view/treewalker~TreeWalkerValue}.
|
|
52
|
-
*
|
|
53
|
-
* This iterator uses {@link module:engine/view/treewalker~TreeWalker TreeWalker} with `boundaries` set to this range and
|
|
54
|
-
* `ignoreElementEnd` option
|
|
55
|
-
* set to `true`.
|
|
56
|
-
*/
|
|
57
|
-
[Symbol.iterator](): IterableIterator<TreeWalkerValue>;
|
|
58
|
-
/**
|
|
59
|
-
* Returns whether the range is collapsed, that is it start and end positions are equal.
|
|
60
|
-
*/
|
|
61
|
-
get isCollapsed(): boolean;
|
|
62
|
-
/**
|
|
63
|
-
* Returns whether this range is flat, that is if {@link module:engine/view/range~Range#start start} position and
|
|
64
|
-
* {@link module:engine/view/range~Range#end end} position are in the same {@link module:engine/view/position~Position#parent parent}.
|
|
65
|
-
*/
|
|
66
|
-
get isFlat(): boolean;
|
|
67
|
-
/**
|
|
68
|
-
* Range root element.
|
|
69
|
-
*/
|
|
70
|
-
get root(): Node | DocumentFragment;
|
|
71
|
-
/**
|
|
72
|
-
* Creates a maximal range that has the same content as this range but is expanded in both ways (at the beginning
|
|
73
|
-
* and at the end).
|
|
74
|
-
*
|
|
75
|
-
* For example:
|
|
76
|
-
*
|
|
77
|
-
* ```html
|
|
78
|
-
* <p>Foo</p><p><b>{Bar}</b></p> -> <p>Foo</p>[<p><b>Bar</b>]</p>
|
|
79
|
-
* <p><b>foo</b>{bar}<span></span></p> -> <p><b>foo[</b>bar<span></span>]</p>
|
|
80
|
-
* ```
|
|
81
|
-
*
|
|
82
|
-
* Note that in the sample above:
|
|
83
|
-
*
|
|
84
|
-
* - `<p>` have type of {@link module:engine/view/containerelement~ContainerElement},
|
|
85
|
-
* - `<b>` have type of {@link module:engine/view/attributeelement~AttributeElement},
|
|
86
|
-
* - `<span>` have type of {@link module:engine/view/uielement~UIElement}.
|
|
87
|
-
*
|
|
88
|
-
* @returns Enlarged range.
|
|
89
|
-
*/
|
|
90
|
-
getEnlarged(): Range;
|
|
91
|
-
/**
|
|
92
|
-
* Creates a minimum range that has the same content as this range but is trimmed in both ways (at the beginning
|
|
93
|
-
* and at the end).
|
|
94
|
-
*
|
|
95
|
-
* For example:
|
|
96
|
-
*
|
|
97
|
-
* ```html
|
|
98
|
-
* <p>Foo</p>[<p><b>Bar</b>]</p> -> <p>Foo</p><p><b>{Bar}</b></p>
|
|
99
|
-
* <p><b>foo[</b>bar<span></span>]</p> -> <p><b>foo</b>{bar}<span></span></p>
|
|
100
|
-
* ```
|
|
101
|
-
*
|
|
102
|
-
* Note that in the sample above:
|
|
103
|
-
*
|
|
104
|
-
* - `<p>` have type of {@link module:engine/view/containerelement~ContainerElement},
|
|
105
|
-
* - `<b>` have type of {@link module:engine/view/attributeelement~AttributeElement},
|
|
106
|
-
* - `<span>` have type of {@link module:engine/view/uielement~UIElement}.
|
|
107
|
-
*
|
|
108
|
-
* @returns Shrunk range.
|
|
109
|
-
*/
|
|
110
|
-
getTrimmed(): Range;
|
|
111
|
-
/**
|
|
112
|
-
* Two ranges are equal if their start and end positions are equal.
|
|
113
|
-
*
|
|
114
|
-
* @param otherRange Range to compare with.
|
|
115
|
-
* @returns `true` if ranges are equal, `false` otherwise
|
|
116
|
-
*/
|
|
117
|
-
isEqual(otherRange: Range): boolean;
|
|
118
|
-
/**
|
|
119
|
-
* Checks whether this range contains given {@link module:engine/view/position~Position position}.
|
|
120
|
-
*
|
|
121
|
-
* @param position Position to check.
|
|
122
|
-
* @returns `true` if given {@link module:engine/view/position~Position position} is contained in this range, `false` otherwise.
|
|
123
|
-
*/
|
|
124
|
-
containsPosition(position: Position): boolean;
|
|
125
|
-
/**
|
|
126
|
-
* Checks whether this range contains given {@link module:engine/view/range~Range range}.
|
|
127
|
-
*
|
|
128
|
-
* @param otherRange Range to check.
|
|
129
|
-
* @param loose Whether the check is loose or strict. If the check is strict (`false`), compared range cannot
|
|
130
|
-
* start or end at the same position as this range boundaries. If the check is loose (`true`), compared range can start, end or
|
|
131
|
-
* even be equal to this range. Note that collapsed ranges are always compared in strict mode.
|
|
132
|
-
* @returns `true` if given {@link module:engine/view/range~Range range} boundaries are contained by this range, `false`
|
|
133
|
-
* otherwise.
|
|
134
|
-
*/
|
|
135
|
-
containsRange(otherRange: Range, loose?: boolean): boolean;
|
|
136
|
-
/**
|
|
137
|
-
* Computes which part(s) of this {@link module:engine/view/range~Range range} is not a part of given
|
|
138
|
-
* {@link module:engine/view/range~Range range}.
|
|
139
|
-
* Returned array contains zero, one or two {@link module:engine/view/range~Range ranges}.
|
|
140
|
-
*
|
|
141
|
-
* Examples:
|
|
142
|
-
*
|
|
143
|
-
* ```ts
|
|
144
|
-
* let foo = downcastWriter.createText( 'foo' );
|
|
145
|
-
* let img = downcastWriter.createContainerElement( 'img' );
|
|
146
|
-
* let bar = downcastWriter.createText( 'bar' );
|
|
147
|
-
* let p = downcastWriter.createContainerElement( 'p', null, [ foo, img, bar ] );
|
|
148
|
-
*
|
|
149
|
-
* let range = view.createRange( view.createPositionAt( foo, 2 ), view.createPositionAt( bar, 1 ); // "o", img, "b" are in range.
|
|
150
|
-
* let otherRange = view.createRange( // "oo", img, "ba" are in range.
|
|
151
|
-
* view.createPositionAt( foo, 1 ),
|
|
152
|
-
* view.createPositionAt( bar, 2 )
|
|
153
|
-
* );
|
|
154
|
-
* let transformed = range.getDifference( otherRange );
|
|
155
|
-
* // transformed array has no ranges because `otherRange` contains `range`
|
|
156
|
-
*
|
|
157
|
-
* otherRange = view.createRange( view.createPositionAt( foo, 1 ), view.createPositionAt( p, 2 ); // "oo", img are in range.
|
|
158
|
-
* transformed = range.getDifference( otherRange );
|
|
159
|
-
* // transformed array has one range: from ( p, 2 ) to ( bar, 1 )
|
|
160
|
-
*
|
|
161
|
-
* otherRange = view.createRange( view.createPositionAt( p, 1 ), view.createPositionAt( p, 2 ) ); // img is in range.
|
|
162
|
-
* transformed = range.getDifference( otherRange );
|
|
163
|
-
* // transformed array has two ranges: from ( foo, 1 ) to ( p, 1 ) and from ( p, 2 ) to ( bar, 1 )
|
|
164
|
-
* ```
|
|
165
|
-
*
|
|
166
|
-
* @param otherRange Range to differentiate against.
|
|
167
|
-
* @returns The difference between ranges.
|
|
168
|
-
*/
|
|
169
|
-
getDifference(otherRange: Range): Array<Range>;
|
|
170
|
-
/**
|
|
171
|
-
* Returns an intersection of this {@link module:engine/view/range~Range range} and given {@link module:engine/view/range~Range range}.
|
|
172
|
-
* Intersection is a common part of both of those ranges. If ranges has no common part, returns `null`.
|
|
173
|
-
*
|
|
174
|
-
* Examples:
|
|
175
|
-
*
|
|
176
|
-
* ```ts
|
|
177
|
-
* let foo = downcastWriter.createText( 'foo' );
|
|
178
|
-
* let img = downcastWriter.createContainerElement( 'img' );
|
|
179
|
-
* let bar = downcastWriter.createText( 'bar' );
|
|
180
|
-
* let p = downcastWriter.createContainerElement( 'p', null, [ foo, img, bar ] );
|
|
181
|
-
*
|
|
182
|
-
* let range = view.createRange( view.createPositionAt( foo, 2 ), view.createPositionAt( bar, 1 ); // "o", img, "b" are in range.
|
|
183
|
-
* let otherRange = view.createRange( view.createPositionAt( foo, 1 ), view.createPositionAt( p, 2 ); // "oo", img are in range.
|
|
184
|
-
* let transformed = range.getIntersection( otherRange ); // range from ( foo, 1 ) to ( p, 2 ).
|
|
185
|
-
*
|
|
186
|
-
* otherRange = view.createRange( view.createPositionAt( bar, 1 ), view.createPositionAt( bar, 3 ); "ar" is in range.
|
|
187
|
-
* transformed = range.getIntersection( otherRange ); // null - no common part.
|
|
188
|
-
* ```
|
|
189
|
-
*
|
|
190
|
-
* @param otherRange Range to check for intersection.
|
|
191
|
-
* @returns A common part of given ranges or `null` if ranges have no common part.
|
|
192
|
-
*/
|
|
193
|
-
getIntersection(otherRange: Range): Range | null;
|
|
194
|
-
/**
|
|
195
|
-
* Creates a {@link module:engine/view/treewalker~TreeWalker TreeWalker} instance with this range as a boundary.
|
|
196
|
-
*
|
|
197
|
-
* @param options Object with configuration options. See {@link module:engine/view/treewalker~TreeWalker}.
|
|
198
|
-
*/
|
|
199
|
-
getWalker(options?: TreeWalkerOptions): TreeWalker;
|
|
200
|
-
/**
|
|
201
|
-
* Returns a {@link module:engine/view/node~Node} or {@link module:engine/view/documentfragment~DocumentFragment}
|
|
202
|
-
* which is a common ancestor of range's both ends (in which the entire range is contained).
|
|
203
|
-
*/
|
|
204
|
-
getCommonAncestor(): Node | DocumentFragment | null;
|
|
205
|
-
/**
|
|
206
|
-
* Returns an {@link module:engine/view/element~Element Element} contained by the range.
|
|
207
|
-
* The element will be returned when it is the **only** node within the range and **fully–contained**
|
|
208
|
-
* at the same time.
|
|
209
|
-
*/
|
|
210
|
-
getContainedElement(): Element | null;
|
|
211
|
-
/**
|
|
212
|
-
* Clones this range.
|
|
213
|
-
*/
|
|
214
|
-
clone(): Range;
|
|
215
|
-
/**
|
|
216
|
-
* Returns an iterator that iterates over all {@link module:engine/view/item~Item view items} that are in this range and returns
|
|
217
|
-
* them.
|
|
218
|
-
*
|
|
219
|
-
* This method uses {@link module:engine/view/treewalker~TreeWalker} with `boundaries` set to this range and `ignoreElementEnd` option
|
|
220
|
-
* set to `true`. However it returns only {@link module:engine/view/item~Item items},
|
|
221
|
-
* not {@link module:engine/view/treewalker~TreeWalkerValue}.
|
|
222
|
-
*
|
|
223
|
-
* You may specify additional options for the tree walker. See {@link module:engine/view/treewalker~TreeWalker} for
|
|
224
|
-
* a full list of available options.
|
|
225
|
-
*
|
|
226
|
-
* @param options Object with configuration options. See {@link module:engine/view/treewalker~TreeWalker}.
|
|
227
|
-
*/
|
|
228
|
-
getItems(options?: TreeWalkerOptions): IterableIterator<Item>;
|
|
229
|
-
/**
|
|
230
|
-
* Returns an iterator that iterates over all {@link module:engine/view/position~Position positions} that are boundaries or
|
|
231
|
-
* contained in this range.
|
|
232
|
-
*
|
|
233
|
-
* This method uses {@link module:engine/view/treewalker~TreeWalker} with `boundaries` set to this range. However it returns only
|
|
234
|
-
* {@link module:engine/view/position~Position positions}, not {@link module:engine/view/treewalker~TreeWalkerValue}.
|
|
235
|
-
*
|
|
236
|
-
* You may specify additional options for the tree walker. See {@link module:engine/view/treewalker~TreeWalker} for
|
|
237
|
-
* a full list of available options.
|
|
238
|
-
*
|
|
239
|
-
* @param options Object with configuration options. See {@link module:engine/view/treewalker~TreeWalker}.
|
|
240
|
-
*/
|
|
241
|
-
getPositions(options?: TreeWalkerOptions): IterableIterator<Position>;
|
|
242
|
-
/**
|
|
243
|
-
* Checks and returns whether this range intersects with the given range.
|
|
244
|
-
*
|
|
245
|
-
* @param otherRange Range to compare with.
|
|
246
|
-
* @returns True if ranges intersect.
|
|
247
|
-
*/
|
|
248
|
-
isIntersecting(otherRange: Range): boolean;
|
|
249
|
-
/**
|
|
250
|
-
* Creates a range from the given parents and offsets.
|
|
251
|
-
*
|
|
252
|
-
* @internal
|
|
253
|
-
* @param startElement Start position parent element.
|
|
254
|
-
* @param startOffset Start position offset.
|
|
255
|
-
* @param endElement End position parent element.
|
|
256
|
-
* @param endOffset End position offset.
|
|
257
|
-
* @returns Created range.
|
|
258
|
-
*/
|
|
259
|
-
static _createFromParentsAndOffsets(startElement: Element | DocumentFragment, startOffset: number, endElement: Element | DocumentFragment, endOffset: number): Range;
|
|
260
|
-
/**
|
|
261
|
-
* Creates a new range, spreading from specified {@link module:engine/view/position~Position position} to a position moved by
|
|
262
|
-
* given `shift`. If `shift` is a negative value, shifted position is treated as the beginning of the range.
|
|
263
|
-
*
|
|
264
|
-
* @internal
|
|
265
|
-
* @param position Beginning of the range.
|
|
266
|
-
* @param shift How long the range should be.
|
|
267
|
-
*/
|
|
268
|
-
static _createFromPositionAndShift(position: Position, shift: number): Range;
|
|
269
|
-
/**
|
|
270
|
-
* Creates a range inside an {@link module:engine/view/element~Element element} which starts before the first child of
|
|
271
|
-
* that element and ends after the last child of that element.
|
|
272
|
-
*
|
|
273
|
-
* @internal
|
|
274
|
-
* @param element Element which is a parent for the range.
|
|
275
|
-
*/
|
|
276
|
-
static _createIn(element: Element | DocumentFragment): Range;
|
|
277
|
-
/**
|
|
278
|
-
* Creates a range that starts before given {@link module:engine/view/item~Item view item} and ends after it.
|
|
279
|
-
*
|
|
280
|
-
* @internal
|
|
281
|
-
*/
|
|
282
|
-
static _createOn(item: Item): Range;
|
|
283
|
-
}
|
|
@@ -1,77 +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/rawelement
|
|
11
|
-
*/
|
|
12
|
-
import Element, { type ElementAttributes } from './element.js';
|
|
13
|
-
import Node from './node.js';
|
|
14
|
-
import type Document from './document.js';
|
|
15
|
-
import type DomConverter from './domconverter.js';
|
|
16
|
-
import type Item from './item.js';
|
|
17
|
-
type DomElement = globalThis.HTMLElement;
|
|
18
|
-
/**
|
|
19
|
-
* The raw element class.
|
|
20
|
-
*
|
|
21
|
-
* The raw elements work as data containers ("wrappers", "sandboxes") but their children are not managed or
|
|
22
|
-
* even recognized by the editor. This encapsulation allows integrations to maintain custom DOM structures
|
|
23
|
-
* in the editor content without, for instance, worrying about compatibility with other editor features.
|
|
24
|
-
* Raw elements are a perfect tool for integration with external frameworks and data sources.
|
|
25
|
-
*
|
|
26
|
-
* Unlike {@link module:engine/view/uielement~UIElement UI elements}, raw elements act like real editor
|
|
27
|
-
* content (similar to {@link module:engine/view/containerelement~ContainerElement} or
|
|
28
|
-
* {@link module:engine/view/emptyelement~EmptyElement}), they are considered by the editor selection and
|
|
29
|
-
* {@link module:widget/utils~toWidget they can work as widgets}.
|
|
30
|
-
*
|
|
31
|
-
* To create a new raw element, use the
|
|
32
|
-
* {@link module:engine/view/downcastwriter~DowncastWriter#createRawElement `downcastWriter#createRawElement()`} method.
|
|
33
|
-
*/
|
|
34
|
-
export default class RawElement extends Element {
|
|
35
|
-
/**
|
|
36
|
-
* Creates a new instance of a raw element.
|
|
37
|
-
*
|
|
38
|
-
* Throws the `view-rawelement-cannot-add` {@link module:utils/ckeditorerror~CKEditorError CKEditorError} when the `children`
|
|
39
|
-
* parameter is passed to inform that the usage of `RawElement` is incorrect (adding child nodes to `RawElement` is forbidden).
|
|
40
|
-
*
|
|
41
|
-
* @see module:engine/view/downcastwriter~DowncastWriter#createRawElement
|
|
42
|
-
* @internal
|
|
43
|
-
* @param document The document instance to which this element belongs.
|
|
44
|
-
* @param name Node name.
|
|
45
|
-
* @param attrs Collection of attributes.
|
|
46
|
-
* @param children A list of nodes to be inserted into created element.
|
|
47
|
-
*/
|
|
48
|
-
constructor(document: Document, name: string, attrs?: ElementAttributes, children?: Node | Iterable<Node>);
|
|
49
|
-
/**
|
|
50
|
-
* Overrides the {@link module:engine/view/element~Element#_insertChild} method.
|
|
51
|
-
* Throws the `view-rawelement-cannot-add` {@link module:utils/ckeditorerror~CKEditorError CKEditorError} to prevent
|
|
52
|
-
* adding any child nodes to a raw element.
|
|
53
|
-
*
|
|
54
|
-
* @internal
|
|
55
|
-
*/
|
|
56
|
-
_insertChild(index: number, items: Item | Iterable<Item>): number;
|
|
57
|
-
/**
|
|
58
|
-
* This allows rendering the children of a {@link module:engine/view/rawelement~RawElement} on the DOM level.
|
|
59
|
-
* This method is called by the {@link module:engine/view/domconverter~DomConverter} with the raw DOM element
|
|
60
|
-
* passed as an argument, leaving the number and shape of the children up to the integrator.
|
|
61
|
-
*
|
|
62
|
-
* This method **must be defined** for the raw element to work:
|
|
63
|
-
*
|
|
64
|
-
* ```ts
|
|
65
|
-
* const myRawElement = downcastWriter.createRawElement( 'div' );
|
|
66
|
-
*
|
|
67
|
-
* myRawElement.render = function( domElement, domConverter ) {
|
|
68
|
-
* domConverter.setContentOf( domElement, '<b>This is the raw content of myRawElement.</b>' );
|
|
69
|
-
* };
|
|
70
|
-
* ```
|
|
71
|
-
*
|
|
72
|
-
* @param domElement The native DOM element representing the raw view element.
|
|
73
|
-
* @param domConverter Instance of the DomConverter used to optimize the output.
|
|
74
|
-
*/
|
|
75
|
-
render(domElement: DomElement, domConverter: DomConverter): void;
|
|
76
|
-
}
|
|
77
|
-
export {};
|
package/dist/view/renderer.d.ts
DELETED
|
@@ -1,281 +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 { ChangeType } from './document.js';
|
|
10
|
-
import type DocumentSelection from './documentselection.js';
|
|
11
|
-
import type DomConverter from './domconverter.js';
|
|
12
|
-
import type ViewElement from './element.js';
|
|
13
|
-
import type ViewNode from './node.js';
|
|
14
|
-
import '../../theme/renderer.css';
|
|
15
|
-
type DomDocument = globalThis.Document;
|
|
16
|
-
declare const Renderer_base: {
|
|
17
|
-
new (): import("@ckeditor/ckeditor5-utils").Observable;
|
|
18
|
-
prototype: import("@ckeditor/ckeditor5-utils").Observable;
|
|
19
|
-
};
|
|
20
|
-
/**
|
|
21
|
-
* Renderer is responsible for updating the DOM structure and the DOM selection based on
|
|
22
|
-
* the {@link module:engine/view/renderer~Renderer#markToSync information about updated view nodes}.
|
|
23
|
-
* In other words, it renders the view to the DOM.
|
|
24
|
-
*
|
|
25
|
-
* Its main responsibility is to make only the necessary, minimal changes to the DOM. However, unlike in many
|
|
26
|
-
* virtual DOM implementations, the primary reason for doing minimal changes is not the performance but ensuring
|
|
27
|
-
* that native editing features such as text composition, autocompletion, spell checking, selection's x-index are
|
|
28
|
-
* affected as little as possible.
|
|
29
|
-
*
|
|
30
|
-
* Renderer uses {@link module:engine/view/domconverter~DomConverter} to transform view nodes and positions
|
|
31
|
-
* to and from the DOM.
|
|
32
|
-
*/
|
|
33
|
-
export default class Renderer extends /* #__PURE__ */ Renderer_base {
|
|
34
|
-
/**
|
|
35
|
-
* Set of DOM Documents instances.
|
|
36
|
-
*/
|
|
37
|
-
readonly domDocuments: Set<DomDocument>;
|
|
38
|
-
/**
|
|
39
|
-
* Converter instance.
|
|
40
|
-
*/
|
|
41
|
-
readonly domConverter: DomConverter;
|
|
42
|
-
/**
|
|
43
|
-
* Set of nodes which attributes changed and may need to be rendered.
|
|
44
|
-
*/
|
|
45
|
-
readonly markedAttributes: Set<ViewElement>;
|
|
46
|
-
/**
|
|
47
|
-
* Set of elements which child lists changed and may need to be rendered.
|
|
48
|
-
*/
|
|
49
|
-
readonly markedChildren: Set<ViewElement>;
|
|
50
|
-
/**
|
|
51
|
-
* Set of text nodes which text data changed and may need to be rendered.
|
|
52
|
-
*/
|
|
53
|
-
readonly markedTexts: Set<ViewNode>;
|
|
54
|
-
/**
|
|
55
|
-
* View selection. Renderer updates DOM selection based on the view selection.
|
|
56
|
-
*/
|
|
57
|
-
readonly selection: DocumentSelection;
|
|
58
|
-
/**
|
|
59
|
-
* Indicates if the view document is focused and selection can be rendered. Selection will not be rendered if
|
|
60
|
-
* this is set to `false`.
|
|
61
|
-
*
|
|
62
|
-
* @observable
|
|
63
|
-
*/
|
|
64
|
-
readonly isFocused: boolean;
|
|
65
|
-
/**
|
|
66
|
-
* Indicates whether the user is making a selection in the document (e.g. holding the mouse button and moving the cursor).
|
|
67
|
-
* When they stop selecting, the property goes back to `false`.
|
|
68
|
-
*
|
|
69
|
-
* Note: In some browsers, the renderer will stop rendering the selection and inline fillers while the user is making
|
|
70
|
-
* a selection to avoid glitches in DOM selection
|
|
71
|
-
* (https://github.com/ckeditor/ckeditor5/issues/10562, https://github.com/ckeditor/ckeditor5/issues/10723).
|
|
72
|
-
*
|
|
73
|
-
* @observable
|
|
74
|
-
*/
|
|
75
|
-
readonly isSelecting: boolean;
|
|
76
|
-
/**
|
|
77
|
-
* True if composition is in progress inside the document.
|
|
78
|
-
*
|
|
79
|
-
* This property is bound to the {@link module:engine/view/document~Document#isComposing `Document#isComposing`} property.
|
|
80
|
-
*
|
|
81
|
-
* @observable
|
|
82
|
-
*/
|
|
83
|
-
readonly isComposing: boolean;
|
|
84
|
-
/**
|
|
85
|
-
* The text node in which the inline filler was rendered.
|
|
86
|
-
*/
|
|
87
|
-
private _inlineFiller;
|
|
88
|
-
/**
|
|
89
|
-
* DOM element containing fake selection.
|
|
90
|
-
*/
|
|
91
|
-
private _fakeSelectionContainer;
|
|
92
|
-
/**
|
|
93
|
-
* Creates a renderer instance.
|
|
94
|
-
*
|
|
95
|
-
* @param domConverter Converter instance.
|
|
96
|
-
* @param selection View selection.
|
|
97
|
-
*/
|
|
98
|
-
constructor(domConverter: DomConverter, selection: DocumentSelection);
|
|
99
|
-
/**
|
|
100
|
-
* Marks a view node to be updated in the DOM by {@link #render `render()`}.
|
|
101
|
-
*
|
|
102
|
-
* Note that only view nodes whose parents have corresponding DOM elements need to be marked to be synchronized.
|
|
103
|
-
*
|
|
104
|
-
* @see #markedAttributes
|
|
105
|
-
* @see #markedChildren
|
|
106
|
-
* @see #markedTexts
|
|
107
|
-
*
|
|
108
|
-
* @param type Type of the change.
|
|
109
|
-
* @param node ViewNode to be marked.
|
|
110
|
-
*/
|
|
111
|
-
markToSync(type: ChangeType, node: ViewNode): void;
|
|
112
|
-
/**
|
|
113
|
-
* Renders all buffered changes ({@link #markedAttributes}, {@link #markedChildren} and {@link #markedTexts}) and
|
|
114
|
-
* the current view selection (if needed) to the DOM by applying a minimal set of changes to it.
|
|
115
|
-
*
|
|
116
|
-
* Renderer tries not to break the text composition (e.g. IME) and x-index of the selection,
|
|
117
|
-
* so it does as little as it is needed to update the DOM.
|
|
118
|
-
*
|
|
119
|
-
* Renderer also handles {@link module:engine/view/filler fillers}. Especially, it checks if the inline filler is needed
|
|
120
|
-
* at the selection position and adds or removes it. To prevent breaking text composition inline filler will not be
|
|
121
|
-
* removed as long as the selection is in the text node which needed it at first.
|
|
122
|
-
*/
|
|
123
|
-
render(): void;
|
|
124
|
-
/**
|
|
125
|
-
* Updates mappings of view element's children.
|
|
126
|
-
*
|
|
127
|
-
* Children that were replaced in the view structure by similar elements (same tag name) are treated as 'replaced'.
|
|
128
|
-
* This means that their mappings can be updated so the new view elements are mapped to the existing DOM elements.
|
|
129
|
-
* Thanks to that these elements do not need to be re-rendered completely.
|
|
130
|
-
*
|
|
131
|
-
* @param viewElement The view element whose children mappings will be updated.
|
|
132
|
-
*/
|
|
133
|
-
private _updateChildrenMappings;
|
|
134
|
-
/**
|
|
135
|
-
* Updates mappings of a given view element.
|
|
136
|
-
*
|
|
137
|
-
* @param viewElement The view element whose mappings will be updated.
|
|
138
|
-
* @param domElement The DOM element representing the given view element.
|
|
139
|
-
*/
|
|
140
|
-
private _updateElementMappings;
|
|
141
|
-
/**
|
|
142
|
-
* Gets the position of the inline filler based on the current selection.
|
|
143
|
-
* Here, we assume that we know that the filler is needed and
|
|
144
|
-
* {@link #_isSelectionInInlineFiller is at the selection position}, and, since it is needed,
|
|
145
|
-
* it is somewhere at the selection position.
|
|
146
|
-
*
|
|
147
|
-
* Note: The filler position cannot be restored based on the filler's DOM text node, because
|
|
148
|
-
* when this method is called (before rendering), the bindings will often be broken. View-to-DOM
|
|
149
|
-
* bindings are only dependable after rendering.
|
|
150
|
-
*/
|
|
151
|
-
private _getInlineFillerPosition;
|
|
152
|
-
/**
|
|
153
|
-
* Returns `true` if the selection has not left the inline filler's text node.
|
|
154
|
-
* If it is `true`, it means that the filler had been added for a reason and the selection did not
|
|
155
|
-
* leave the filler's text node. For example, the user can be in the middle of a composition so it should not be touched.
|
|
156
|
-
*
|
|
157
|
-
* @returns `true` if the inline filler and selection are in the same place.
|
|
158
|
-
*/
|
|
159
|
-
private _isSelectionInInlineFiller;
|
|
160
|
-
/**
|
|
161
|
-
* Removes the inline filler.
|
|
162
|
-
*/
|
|
163
|
-
private _removeInlineFiller;
|
|
164
|
-
/**
|
|
165
|
-
* Checks if the inline {@link module:engine/view/filler filler} should be added.
|
|
166
|
-
*
|
|
167
|
-
* @returns `true` if the inline filler should be added.
|
|
168
|
-
*/
|
|
169
|
-
private _needsInlineFillerAtSelection;
|
|
170
|
-
/**
|
|
171
|
-
* Checks if text needs to be updated and possibly updates it.
|
|
172
|
-
*
|
|
173
|
-
* @param viewText View text to update.
|
|
174
|
-
* @param options.inlineFillerPosition The position where the inline filler should be rendered.
|
|
175
|
-
*/
|
|
176
|
-
private _updateText;
|
|
177
|
-
/**
|
|
178
|
-
* Checks if attribute list needs to be updated and possibly updates it.
|
|
179
|
-
*
|
|
180
|
-
* @param viewElement The view element to update.
|
|
181
|
-
*/
|
|
182
|
-
private _updateAttrs;
|
|
183
|
-
/**
|
|
184
|
-
* Checks if elements child list needs to be updated and possibly updates it.
|
|
185
|
-
*
|
|
186
|
-
* Note that on Android, to reduce the risk of composition breaks, it tries to update data of an existing
|
|
187
|
-
* child text nodes instead of replacing them completely.
|
|
188
|
-
*
|
|
189
|
-
* @param viewElement View element to update.
|
|
190
|
-
* @param options.inlineFillerPosition The position where the inline filler should be rendered.
|
|
191
|
-
*/
|
|
192
|
-
private _updateChildren;
|
|
193
|
-
/**
|
|
194
|
-
* Shorthand for diffing two arrays or node lists of DOM nodes.
|
|
195
|
-
*
|
|
196
|
-
* @param actualDomChildren Actual DOM children
|
|
197
|
-
* @param expectedDomChildren Expected DOM children.
|
|
198
|
-
* @returns The list of actions based on the {@link module:utils/diff~diff} function.
|
|
199
|
-
*/
|
|
200
|
-
private _diffNodeLists;
|
|
201
|
-
/**
|
|
202
|
-
* Finds DOM nodes that were replaced with the similar nodes (same tag name) in the view. All nodes are compared
|
|
203
|
-
* within one `insert`/`delete` action group, for example:
|
|
204
|
-
*
|
|
205
|
-
* ```
|
|
206
|
-
* Actual DOM: <p><b>Foo</b>Bar<i>Baz</i><b>Bax</b></p>
|
|
207
|
-
* Expected DOM: <p>Bar<b>123</b><i>Baz</i><b>456</b></p>
|
|
208
|
-
* Input actions: [ insert, insert, delete, delete, equal, insert, delete ]
|
|
209
|
-
* Output actions: [ insert, replace, delete, equal, replace ]
|
|
210
|
-
* ```
|
|
211
|
-
*
|
|
212
|
-
* @param actions Actions array which is a result of the {@link module:utils/diff~diff} function.
|
|
213
|
-
* @param actualDom Actual DOM children
|
|
214
|
-
* @param expectedDom Expected DOM children.
|
|
215
|
-
* @param comparator A comparator function that should return `true` if the given node should be reused
|
|
216
|
-
* (either by the update of a text node data or an element children list for similar elements).
|
|
217
|
-
* @returns Actions array modified with the `update` actions.
|
|
218
|
-
*/
|
|
219
|
-
private _findUpdateActions;
|
|
220
|
-
/**
|
|
221
|
-
* Checks if text needs to be updated and possibly updates it by removing and inserting only parts
|
|
222
|
-
* of the data from the existing text node to reduce impact on the IME composition.
|
|
223
|
-
*
|
|
224
|
-
* @param domText DOM text node to update.
|
|
225
|
-
* @param expectedText The expected data of a text node.
|
|
226
|
-
*/
|
|
227
|
-
private _updateTextNode;
|
|
228
|
-
/**
|
|
229
|
-
* Part of the `_updateTextNode` method extracted for easier testing.
|
|
230
|
-
*/
|
|
231
|
-
private _updateTextNodeInternal;
|
|
232
|
-
/**
|
|
233
|
-
* Marks text nodes to be synchronized.
|
|
234
|
-
*
|
|
235
|
-
* If a text node is passed, it will be marked. If an element is passed, all descendant text nodes inside it will be marked.
|
|
236
|
-
*
|
|
237
|
-
* @param viewNode View node to sync.
|
|
238
|
-
*/
|
|
239
|
-
private _markDescendantTextToSync;
|
|
240
|
-
/**
|
|
241
|
-
* Checks if the selection needs to be updated and possibly updates it.
|
|
242
|
-
*/
|
|
243
|
-
private _updateSelection;
|
|
244
|
-
/**
|
|
245
|
-
* Updates the fake selection.
|
|
246
|
-
*
|
|
247
|
-
* @param domRoot A valid DOM root where the fake selection container should be added.
|
|
248
|
-
*/
|
|
249
|
-
private _updateFakeSelection;
|
|
250
|
-
/**
|
|
251
|
-
* Updates the DOM selection.
|
|
252
|
-
*
|
|
253
|
-
* @param domRoot A valid DOM root where the DOM selection should be rendered.
|
|
254
|
-
*/
|
|
255
|
-
private _updateDomSelection;
|
|
256
|
-
/**
|
|
257
|
-
* Checks whether a given DOM selection needs to be updated.
|
|
258
|
-
*
|
|
259
|
-
* @param domSelection The DOM selection to check.
|
|
260
|
-
*/
|
|
261
|
-
private _domSelectionNeedsUpdate;
|
|
262
|
-
/**
|
|
263
|
-
* Checks whether the fake selection needs to be updated.
|
|
264
|
-
*
|
|
265
|
-
* @param domRoot A valid DOM root where a new fake selection container should be added.
|
|
266
|
-
*/
|
|
267
|
-
private _fakeSelectionNeedsUpdate;
|
|
268
|
-
/**
|
|
269
|
-
* Removes the DOM selection.
|
|
270
|
-
*/
|
|
271
|
-
private _removeDomSelection;
|
|
272
|
-
/**
|
|
273
|
-
* Removes the fake selection.
|
|
274
|
-
*/
|
|
275
|
-
private _removeFakeSelection;
|
|
276
|
-
/**
|
|
277
|
-
* Checks if focus needs to be updated and possibly updates it.
|
|
278
|
-
*/
|
|
279
|
-
private _updateFocus;
|
|
280
|
-
}
|
|
281
|
-
export {};
|
|
@@ -1,45 +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/rooteditableelement
|
|
11
|
-
*/
|
|
12
|
-
import EditableElement from './editableelement.js';
|
|
13
|
-
import type Document from './document.js';
|
|
14
|
-
/**
|
|
15
|
-
* Class representing a single root in the data view. A root can be either {@link ~RootEditableElement#isReadOnly editable or read-only},
|
|
16
|
-
* but in both cases it is called "an editable". Roots can contain other {@link module:engine/view/editableelement~EditableElement
|
|
17
|
-
* editable elements} making them "nested editables".
|
|
18
|
-
*/
|
|
19
|
-
export default class RootEditableElement extends EditableElement {
|
|
20
|
-
/**
|
|
21
|
-
* Creates root editable element.
|
|
22
|
-
*
|
|
23
|
-
* @param document The document instance to which this element belongs.
|
|
24
|
-
* @param name Node name.
|
|
25
|
-
*/
|
|
26
|
-
constructor(document: Document, name: string);
|
|
27
|
-
/**
|
|
28
|
-
* Name of this root inside {@link module:engine/view/document~Document} that is an owner of this root. If no
|
|
29
|
-
* other name is set, `main` name is used.
|
|
30
|
-
*
|
|
31
|
-
* @readonly
|
|
32
|
-
*/
|
|
33
|
-
get rootName(): string;
|
|
34
|
-
set rootName(rootName: string);
|
|
35
|
-
/**
|
|
36
|
-
* Overrides old element name and sets new one.
|
|
37
|
-
* This is needed because view roots are created before they are attached to the DOM.
|
|
38
|
-
* The name of the root element is temporary at this stage. It has to be changed when the
|
|
39
|
-
* view root element is attached to the DOM element.
|
|
40
|
-
*
|
|
41
|
-
* @internal
|
|
42
|
-
* @param name The new name of element.
|
|
43
|
-
*/
|
|
44
|
-
set _name(name: string);
|
|
45
|
-
}
|