@ckeditor/ckeditor5-engine 45.2.1 → 46.0.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/dist/index.js +2563 -2257
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
- package/src/controller/datacontroller.d.ts +33 -32
- package/src/controller/datacontroller.js +29 -28
- package/src/controller/editingcontroller.d.ts +8 -8
- package/src/controller/editingcontroller.js +10 -10
- package/src/conversion/conversion.d.ts +18 -19
- package/src/conversion/conversion.js +4 -4
- package/src/conversion/conversionhelpers.d.ts +1 -1
- package/src/conversion/conversionhelpers.js +1 -1
- package/src/conversion/downcastdispatcher.d.ts +63 -69
- package/src/conversion/downcastdispatcher.js +16 -16
- package/src/conversion/downcasthelpers.d.ts +94 -83
- package/src/conversion/downcasthelpers.js +63 -53
- package/src/conversion/mapper.d.ts +27 -27
- package/src/conversion/mapper.js +15 -15
- package/src/conversion/modelconsumable.d.ts +26 -26
- package/src/conversion/modelconsumable.js +23 -23
- package/src/conversion/upcastdispatcher.d.ts +33 -32
- package/src/conversion/upcastdispatcher.js +19 -19
- package/src/conversion/upcasthelpers.d.ts +46 -38
- package/src/conversion/upcasthelpers.js +33 -24
- package/src/conversion/viewconsumable.d.ts +50 -45
- package/src/conversion/viewconsumable.js +32 -27
- package/src/dataprocessor/basichtmlwriter.d.ts +4 -2
- package/src/dataprocessor/basichtmlwriter.js +3 -1
- package/src/dataprocessor/dataprocessor.d.ts +7 -6
- package/src/dataprocessor/htmldataprocessor.d.ts +10 -10
- package/src/dataprocessor/htmldataprocessor.js +6 -6
- package/src/dataprocessor/htmlwriter.d.ts +1 -1
- package/src/dataprocessor/xmldataprocessor.d.ts +10 -10
- package/src/dataprocessor/xmldataprocessor.js +6 -6
- package/src/dev-utils/model.d.ts +25 -26
- package/src/dev-utils/model.js +35 -36
- package/src/dev-utils/operationreplayer.d.ts +5 -3
- package/src/dev-utils/operationreplayer.js +4 -2
- package/src/dev-utils/utils.d.ts +8 -0
- package/src/dev-utils/utils.js +8 -0
- package/src/dev-utils/view.d.ts +66 -63
- package/src/dev-utils/view.js +144 -134
- package/src/index.d.ts +135 -106
- package/src/index.js +120 -71
- package/src/legacyerrors.d.ts +5 -0
- package/src/legacyerrors.js +17 -0
- package/src/model/batch.d.ts +2 -15
- package/src/model/batch.js +1 -23
- package/src/model/differ.d.ts +54 -31
- package/src/model/differ.js +15 -15
- package/src/model/document.d.ts +31 -31
- package/src/model/document.js +13 -13
- package/src/model/documentfragment.d.ts +45 -45
- package/src/model/documentfragment.js +40 -40
- package/src/model/documentselection.d.ts +92 -92
- package/src/model/documentselection.js +71 -70
- package/src/model/element.d.ts +31 -31
- package/src/model/element.js +29 -29
- package/src/model/history.d.ts +3 -3
- package/src/model/history.js +2 -2
- package/src/model/item.d.ts +4 -5
- package/src/model/liveposition.d.ts +31 -31
- package/src/model/liveposition.js +18 -18
- package/src/model/liverange.d.ts +42 -38
- package/src/model/liverange.js +17 -16
- package/src/model/markercollection.d.ts +41 -40
- package/src/model/markercollection.js +22 -20
- package/src/model/model.d.ts +82 -81
- package/src/model/model.js +54 -54
- package/src/model/node.d.ts +48 -48
- package/src/model/node.js +31 -31
- package/src/model/nodelist.d.ts +17 -17
- package/src/model/nodelist.js +11 -11
- package/src/model/operation/attributeoperation.d.ts +10 -10
- package/src/model/operation/attributeoperation.js +7 -7
- package/src/model/operation/detachoperation.d.ts +11 -9
- package/src/model/operation/detachoperation.js +8 -6
- package/src/model/operation/insertoperation.d.ts +13 -13
- package/src/model/operation/insertoperation.js +15 -15
- package/src/model/operation/markeroperation.d.ts +12 -12
- package/src/model/operation/markeroperation.js +5 -5
- package/src/model/operation/mergeoperation.d.ts +16 -16
- package/src/model/operation/mergeoperation.js +18 -18
- package/src/model/operation/moveoperation.d.ts +16 -16
- package/src/model/operation/moveoperation.js +18 -15
- package/src/model/operation/nooperation.d.ts +4 -4
- package/src/model/operation/nooperation.js +2 -2
- package/src/model/operation/operation.d.ts +10 -10
- package/src/model/operation/operation.js +5 -5
- package/src/model/operation/operationfactory.d.ts +4 -4
- package/src/model/operation/operationfactory.js +12 -12
- package/src/model/operation/renameoperation.d.ts +10 -10
- package/src/model/operation/renameoperation.js +7 -7
- package/src/model/operation/rootattributeoperation.d.ts +12 -12
- package/src/model/operation/rootattributeoperation.js +8 -8
- package/src/model/operation/rootoperation.d.ts +8 -8
- package/src/model/operation/rootoperation.js +3 -3
- package/src/model/operation/splitoperation.d.ts +17 -17
- package/src/model/operation/splitoperation.js +19 -19
- package/src/model/operation/transform.d.ts +11 -8
- package/src/model/operation/transform.js +66 -49
- package/src/model/operation/utils.d.ts +24 -23
- package/src/model/operation/utils.js +20 -20
- package/src/model/position.d.ts +101 -97
- package/src/model/position.js +69 -64
- package/src/model/range.d.ts +90 -90
- package/src/model/range.js +87 -87
- package/src/model/rootelement.d.ts +11 -11
- package/src/model/rootelement.js +9 -9
- package/src/model/schema.d.ts +158 -154
- package/src/model/schema.js +93 -90
- package/src/model/selection.d.ts +73 -73
- package/src/model/selection.js +62 -62
- package/src/model/text.d.ts +11 -10
- package/src/model/text.js +11 -10
- package/src/model/textproxy.d.ts +39 -38
- package/src/model/textproxy.js +31 -30
- package/src/model/treewalker.d.ts +37 -37
- package/src/model/treewalker.js +14 -14
- package/src/model/typecheckable.d.ts +45 -45
- package/src/model/typecheckable.js +1 -1
- package/src/model/utils/autoparagraphing.d.ts +7 -7
- package/src/model/utils/deletecontent.d.ts +7 -5
- package/src/model/utils/deletecontent.js +13 -11
- package/src/model/utils/getselectedcontent.d.ts +6 -5
- package/src/model/utils/getselectedcontent.js +2 -1
- package/src/model/utils/insertcontent.d.ts +9 -8
- package/src/model/utils/insertcontent.js +41 -40
- package/src/model/utils/insertobject.d.ts +9 -9
- package/src/model/utils/insertobject.js +4 -4
- package/src/model/utils/modifyselection.d.ts +5 -4
- package/src/model/utils/modifyselection.js +12 -11
- package/src/model/utils/selection-post-fixer.d.ts +12 -8
- package/src/model/utils/selection-post-fixer.js +15 -11
- package/src/model/writer.d.ts +102 -101
- package/src/model/writer.js +99 -98
- package/src/view/attributeelement.d.ts +29 -29
- package/src/view/attributeelement.js +25 -25
- package/src/view/containerelement.d.ts +16 -15
- package/src/view/containerelement.js +15 -14
- package/src/view/datatransfer.d.ts +7 -7
- package/src/view/datatransfer.js +1 -1
- package/src/view/document.d.ts +25 -25
- package/src/view/document.js +15 -15
- package/src/view/documentfragment.d.ts +21 -21
- package/src/view/documentfragment.js +14 -14
- package/src/view/documentselection.d.ts +65 -63
- package/src/view/documentselection.js +27 -25
- package/src/view/domconverter.d.ts +94 -89
- package/src/view/domconverter.js +78 -73
- package/src/view/downcastwriter.d.ts +185 -181
- package/src/view/downcastwriter.js +222 -210
- package/src/view/editableelement.d.ts +13 -13
- package/src/view/editableelement.js +8 -8
- package/src/view/element.d.ts +75 -74
- package/src/view/element.js +58 -58
- package/src/view/elementdefinition.d.ts +3 -4
- package/src/view/emptyelement.d.ts +13 -13
- package/src/view/emptyelement.js +13 -13
- package/src/view/filler.d.ts +14 -3
- package/src/view/filler.js +12 -1
- package/src/view/item.d.ts +4 -5
- package/src/view/matcher.d.ts +22 -19
- package/src/view/matcher.js +6 -6
- package/src/view/node.d.ts +33 -33
- package/src/view/node.js +9 -9
- package/src/view/observer/arrowkeysobserver.d.ts +10 -10
- package/src/view/observer/arrowkeysobserver.js +5 -5
- package/src/view/observer/bubblingemittermixin.d.ts +5 -5
- package/src/view/observer/bubblingemittermixin.js +2 -9
- package/src/view/observer/bubblingeventinfo.d.ts +9 -9
- package/src/view/observer/bubblingeventinfo.js +1 -1
- package/src/view/observer/clickobserver.d.ts +8 -8
- package/src/view/observer/clickobserver.js +4 -4
- package/src/view/observer/compositionobserver.d.ts +19 -19
- package/src/view/observer/compositionobserver.js +6 -6
- package/src/view/observer/domeventdata.d.ts +9 -9
- package/src/view/observer/domeventdata.js +2 -2
- package/src/view/observer/domeventobserver.d.ts +3 -3
- package/src/view/observer/domeventobserver.js +5 -5
- package/src/view/observer/fakeselectionobserver.d.ts +9 -9
- package/src/view/observer/fakeselectionobserver.js +8 -8
- package/src/view/observer/focusobserver.d.ts +16 -16
- package/src/view/observer/focusobserver.js +7 -7
- package/src/view/observer/inputobserver.d.ts +18 -18
- package/src/view/observer/inputobserver.js +5 -5
- package/src/view/observer/keyobserver.d.ts +11 -11
- package/src/view/observer/keyobserver.js +3 -3
- package/src/view/observer/mouseobserver.d.ts +16 -16
- package/src/view/observer/mouseobserver.js +3 -3
- package/src/view/observer/mutationobserver.d.ts +21 -21
- package/src/view/observer/mutationobserver.js +7 -7
- package/src/view/observer/observer.d.ts +12 -12
- package/src/view/observer/observer.js +6 -6
- package/src/view/observer/selectionobserver.d.ts +33 -33
- package/src/view/observer/selectionobserver.js +14 -14
- package/src/view/observer/tabobserver.d.ts +10 -10
- package/src/view/observer/tabobserver.js +5 -5
- package/src/view/observer/touchobserver.d.ts +13 -13
- package/src/view/observer/touchobserver.js +3 -3
- package/src/view/placeholder.d.ts +21 -21
- package/src/view/placeholder.js +23 -23
- package/src/view/position.d.ts +49 -49
- package/src/view/position.js +42 -42
- package/src/view/range.d.ts +76 -74
- package/src/view/range.js +67 -65
- package/src/view/rawelement.d.ts +19 -19
- package/src/view/rawelement.js +16 -16
- package/src/view/renderer.d.ts +14 -14
- package/src/view/renderer.js +7 -7
- package/src/view/rooteditableelement.d.ts +8 -7
- package/src/view/rooteditableelement.js +7 -6
- package/src/view/selection.d.ts +66 -64
- package/src/view/selection.js +50 -48
- package/src/view/styles/background.d.ts +2 -2
- package/src/view/styles/background.js +9 -9
- package/src/view/styles/border.d.ts +2 -2
- package/src/view/styles/border.js +13 -13
- package/src/view/styles/margin.d.ts +2 -2
- package/src/view/styles/margin.js +5 -5
- package/src/view/styles/padding.d.ts +2 -2
- package/src/view/styles/padding.js +5 -5
- package/src/view/styles/utils.d.ts +24 -24
- package/src/view/styles/utils.js +25 -25
- package/src/view/stylesmap.d.ts +28 -32
- package/src/view/stylesmap.js +52 -39
- package/src/view/text.d.ts +11 -11
- package/src/view/text.js +10 -10
- package/src/view/textproxy.d.ts +33 -32
- package/src/view/textproxy.js +23 -22
- package/src/view/tokenlist.d.ts +14 -14
- package/src/view/tokenlist.js +10 -10
- package/src/view/treewalker.d.ts +42 -40
- package/src/view/treewalker.js +36 -35
- package/src/view/typecheckable.d.ts +76 -75
- package/src/view/typecheckable.js +1 -1
- package/src/view/uielement.d.ts +22 -21
- package/src/view/uielement.js +17 -16
- package/src/view/upcastwriter.d.ts +70 -70
- package/src/view/upcastwriter.js +42 -42
- package/src/view/view.d.ts +70 -69
- package/src/view/view.js +56 -55
|
@@ -5,28 +5,28 @@
|
|
|
5
5
|
/**
|
|
6
6
|
* @module engine/view/documentselection
|
|
7
7
|
*/
|
|
8
|
-
import
|
|
9
|
-
import
|
|
8
|
+
import { ViewTypeCheckable } from './typecheckable.js';
|
|
9
|
+
import { ViewSelection } from './selection.js';
|
|
10
10
|
import { EmitterMixin } from '@ckeditor/ckeditor5-utils';
|
|
11
11
|
/**
|
|
12
12
|
* Class representing the document selection in the view.
|
|
13
13
|
*
|
|
14
|
-
* Its instance is available in {@link module:engine/view/document~
|
|
14
|
+
* Its instance is available in {@link module:engine/view/document~ViewDocument#selection `Document#selection`}.
|
|
15
15
|
*
|
|
16
|
-
* It is similar to {@link module:engine/view/selection~
|
|
16
|
+
* It is similar to {@link module:engine/view/selection~ViewSelection} but
|
|
17
17
|
* it has a read-only API and can be modified only by the writer available in
|
|
18
|
-
* the {@link module:engine/view/view~
|
|
19
|
-
* (so via {@link module:engine/view/downcastwriter~
|
|
18
|
+
* the {@link module:engine/view/view~EditingView#change `View#change()`} block
|
|
19
|
+
* (so via {@link module:engine/view/downcastwriter~ViewDowncastWriter#setSelection `ViewDowncastWriter#setSelection()`}).
|
|
20
20
|
*/
|
|
21
|
-
export
|
|
21
|
+
export class ViewDocumentSelection extends /* #__PURE__ */ EmitterMixin(ViewTypeCheckable) {
|
|
22
22
|
/**
|
|
23
|
-
* Selection is used internally (`
|
|
23
|
+
* Selection is used internally (`ViewDocumentSelection` is a proxy to that selection).
|
|
24
24
|
*/
|
|
25
25
|
_selection;
|
|
26
26
|
constructor(...args) {
|
|
27
27
|
super();
|
|
28
|
-
this._selection = new
|
|
29
|
-
// Delegate change event to be fired on
|
|
28
|
+
this._selection = new ViewSelection();
|
|
29
|
+
// Delegate change event to be fired on ViewDocumentSelection instance.
|
|
30
30
|
this._selection.delegate('change').to(this);
|
|
31
31
|
// Set selection data.
|
|
32
32
|
if (args.length) {
|
|
@@ -88,14 +88,14 @@ export default class DocumentSelection extends /* #__PURE__ */ EmitterMixin(Type
|
|
|
88
88
|
return this._selection.isBackward;
|
|
89
89
|
}
|
|
90
90
|
/**
|
|
91
|
-
* {@link module:engine/view/editableelement~
|
|
91
|
+
* {@link module:engine/view/editableelement~ViewEditableElement ViewEditableElement} instance that contains this selection, or `null`
|
|
92
92
|
* if the selection is not inside an editable element.
|
|
93
93
|
*/
|
|
94
94
|
get editableElement() {
|
|
95
95
|
return this._selection.editableElement;
|
|
96
96
|
}
|
|
97
97
|
/**
|
|
98
|
-
* Used for the compatibility with the {@link module:engine/view/selection~
|
|
98
|
+
* Used for the compatibility with the {@link module:engine/view/selection~ViewSelection#isEqual} method.
|
|
99
99
|
*
|
|
100
100
|
* @internal
|
|
101
101
|
*/
|
|
@@ -110,7 +110,8 @@ export default class DocumentSelection extends /* #__PURE__ */ EmitterMixin(Type
|
|
|
110
110
|
}
|
|
111
111
|
/**
|
|
112
112
|
* Returns copy of the first range in the selection. First range is the one which
|
|
113
|
-
* {@link module:engine/view/range~
|
|
113
|
+
* {@link module:engine/view/range~ViewRange#start start} position
|
|
114
|
+
* {@link module:engine/view/position~ViewPosition#isBefore is before} start
|
|
114
115
|
* position of all other ranges (not to confuse with the first range added to the selection).
|
|
115
116
|
* Returns `null` if no ranges are added to selection.
|
|
116
117
|
*/
|
|
@@ -118,8 +119,8 @@ export default class DocumentSelection extends /* #__PURE__ */ EmitterMixin(Type
|
|
|
118
119
|
return this._selection.getFirstRange();
|
|
119
120
|
}
|
|
120
121
|
/**
|
|
121
|
-
* Returns copy of the last range in the selection. Last range is the one which {@link module:engine/view/range~
|
|
122
|
-
* position {@link module:engine/view/position~
|
|
122
|
+
* Returns copy of the last range in the selection. Last range is the one which {@link module:engine/view/range~ViewRange#end end}
|
|
123
|
+
* position {@link module:engine/view/position~ViewPosition#isAfter is after} end position of all other ranges (not to confuse
|
|
123
124
|
* with the last range added to the selection). Returns `null` if no ranges are added to selection.
|
|
124
125
|
*/
|
|
125
126
|
getLastRange() {
|
|
@@ -127,7 +128,7 @@ export default class DocumentSelection extends /* #__PURE__ */ EmitterMixin(Type
|
|
|
127
128
|
}
|
|
128
129
|
/**
|
|
129
130
|
* Returns copy of the first position in the selection. First position is the position that
|
|
130
|
-
* {@link module:engine/view/position~
|
|
131
|
+
* {@link module:engine/view/position~ViewPosition#isBefore is before} any other position in the selection ranges.
|
|
131
132
|
* Returns `null` if no ranges are added to selection.
|
|
132
133
|
*/
|
|
133
134
|
getFirstPosition() {
|
|
@@ -135,14 +136,14 @@ export default class DocumentSelection extends /* #__PURE__ */ EmitterMixin(Type
|
|
|
135
136
|
}
|
|
136
137
|
/**
|
|
137
138
|
* Returns copy of the last position in the selection. Last position is the position that
|
|
138
|
-
* {@link module:engine/view/position~
|
|
139
|
+
* {@link module:engine/view/position~ViewPosition#isAfter is after} any other position in the selection ranges.
|
|
139
140
|
* Returns `null` if no ranges are added to selection.
|
|
140
141
|
*/
|
|
141
142
|
getLastPosition() {
|
|
142
143
|
return this._selection.getLastPosition();
|
|
143
144
|
}
|
|
144
145
|
/**
|
|
145
|
-
* Returns the selected element. {@link module:engine/view/element~
|
|
146
|
+
* Returns the selected element. {@link module:engine/view/element~ViewElement Element} is considered as selected if there is only
|
|
146
147
|
* one range in the selection, and that range contains exactly one element.
|
|
147
148
|
* Returns `null` if there is no selected element.
|
|
148
149
|
*/
|
|
@@ -161,7 +162,7 @@ export default class DocumentSelection extends /* #__PURE__ */ EmitterMixin(Type
|
|
|
161
162
|
}
|
|
162
163
|
/**
|
|
163
164
|
* Checks whether this selection is similar to given selection. Selections are similar if they have same directions, same
|
|
164
|
-
* number of ranges, and all {@link module:engine/view/range~
|
|
165
|
+
* number of ranges, and all {@link module:engine/view/range~ViewRange#getTrimmed trimmed} ranges from one selection are
|
|
165
166
|
* equal to any trimmed range from other selection.
|
|
166
167
|
*
|
|
167
168
|
* @param otherSelection Selection to compare with.
|
|
@@ -172,7 +173,7 @@ export default class DocumentSelection extends /* #__PURE__ */ EmitterMixin(Type
|
|
|
172
173
|
}
|
|
173
174
|
/**
|
|
174
175
|
* Sets this selection's ranges and direction to the specified location based on the given
|
|
175
|
-
* {@link module:engine/view/selection~
|
|
176
|
+
* {@link module:engine/view/selection~ViewSelectable selectable}.
|
|
176
177
|
*
|
|
177
178
|
* ```ts
|
|
178
179
|
* // Sets selection to the given range.
|
|
@@ -195,14 +196,14 @@ export default class DocumentSelection extends /* #__PURE__ */ EmitterMixin(Type
|
|
|
195
196
|
* documentSelection._setTo( paragraph, offset );
|
|
196
197
|
* ```
|
|
197
198
|
*
|
|
198
|
-
* Creates a range inside an {@link module:engine/view/element~
|
|
199
|
+
* Creates a range inside an {@link module:engine/view/element~ViewElement element} which starts before the first child of
|
|
199
200
|
* that element and ends after the last child of that element.
|
|
200
201
|
*
|
|
201
202
|
* ```ts
|
|
202
203
|
* documentSelection._setTo( paragraph, 'in' );
|
|
203
204
|
* ```
|
|
204
205
|
*
|
|
205
|
-
* Creates a range on an {@link module:engine/view/item~
|
|
206
|
+
* Creates a range on an {@link module:engine/view/item~ViewItem item} which starts before the item and ends just after the item.
|
|
206
207
|
*
|
|
207
208
|
* ```ts
|
|
208
209
|
* documentSelection._setTo( paragraph, 'on' );
|
|
@@ -239,12 +240,13 @@ export default class DocumentSelection extends /* #__PURE__ */ EmitterMixin(Type
|
|
|
239
240
|
/**
|
|
240
241
|
* Moves {@link #focus} to the specified location.
|
|
241
242
|
*
|
|
242
|
-
* The location can be specified in the same form as
|
|
243
|
+
* The location can be specified in the same form as
|
|
244
|
+
* {@link module:engine/view/view~EditingView#createPositionAt view.createPositionAt()}
|
|
243
245
|
* parameters.
|
|
244
246
|
*
|
|
245
247
|
* @internal
|
|
246
248
|
* @fires change
|
|
247
|
-
* @param offset Offset or one of the flags. Used only when first parameter is a {@link module:engine/view/item~
|
|
249
|
+
* @param offset Offset or one of the flags. Used only when first parameter is a {@link module:engine/view/item~ViewItem view item}.
|
|
248
250
|
*/
|
|
249
251
|
_setFocus(itemOrPosition, offset) {
|
|
250
252
|
this._selection.setFocus(itemOrPosition, offset);
|
|
@@ -252,7 +254,7 @@ export default class DocumentSelection extends /* #__PURE__ */ EmitterMixin(Type
|
|
|
252
254
|
}
|
|
253
255
|
// The magic of type inference using `is` method is centralized in `TypeCheckable` class.
|
|
254
256
|
// Proper overload would interfere with that.
|
|
255
|
-
|
|
257
|
+
ViewDocumentSelection.prototype.is = function (type) {
|
|
256
258
|
return type === 'selection' ||
|
|
257
259
|
type == 'documentSelection' ||
|
|
258
260
|
type == 'view:selection' ||
|
|
@@ -5,19 +5,19 @@
|
|
|
5
5
|
/**
|
|
6
6
|
* @module engine/view/domconverter
|
|
7
7
|
*/
|
|
8
|
-
import ViewText from './text.js';
|
|
9
|
-
import ViewElement from './element.js';
|
|
10
|
-
import ViewUIElement from './uielement.js';
|
|
11
|
-
import ViewPosition from './position.js';
|
|
12
|
-
import ViewRange from './range.js';
|
|
13
|
-
import ViewSelection from './selection.js';
|
|
14
|
-
import ViewDocumentFragment from './documentfragment.js';
|
|
8
|
+
import { ViewText } from './text.js';
|
|
9
|
+
import { ViewElement } from './element.js';
|
|
10
|
+
import { ViewUIElement } from './uielement.js';
|
|
11
|
+
import { ViewPosition } from './position.js';
|
|
12
|
+
import { ViewRange } from './range.js';
|
|
13
|
+
import { ViewSelection } from './selection.js';
|
|
14
|
+
import { ViewDocumentFragment } from './documentfragment.js';
|
|
15
15
|
import { type MatcherPattern } from './matcher.js';
|
|
16
|
-
import type ViewNode from './node.js';
|
|
17
|
-
import type
|
|
18
|
-
import type
|
|
19
|
-
import type
|
|
20
|
-
import type ViewRawElement from './rawelement.js';
|
|
16
|
+
import { type ViewNode } from './node.js';
|
|
17
|
+
import { type ViewDocument } from './document.js';
|
|
18
|
+
import { type ViewDocumentSelection } from './documentselection.js';
|
|
19
|
+
import { type ViewEditableElement } from './editableelement.js';
|
|
20
|
+
import { type ViewRawElement } from './rawelement.js';
|
|
21
21
|
type DomNode = globalThis.Node;
|
|
22
22
|
type DomElement = globalThis.HTMLElement;
|
|
23
23
|
type DomDocument = globalThis.Document;
|
|
@@ -26,20 +26,21 @@ type DomRange = globalThis.Range;
|
|
|
26
26
|
type DomText = globalThis.Text;
|
|
27
27
|
type DomSelection = globalThis.Selection;
|
|
28
28
|
/**
|
|
29
|
-
* `
|
|
30
|
-
* {@link module:engine/view/domconverter~
|
|
29
|
+
* `ViewDomConverter` is a set of tools to do transformations between DOM nodes and view nodes. It also handles
|
|
30
|
+
* {@link module:engine/view/domconverter~ViewDomConverter#bindElements bindings} between these nodes.
|
|
31
31
|
*
|
|
32
32
|
* An instance of the DOM converter is available under
|
|
33
|
-
* {@link module:engine/view/view~
|
|
33
|
+
* {@link module:engine/view/view~EditingView#domConverter `editor.editing.view.domConverter`}.
|
|
34
34
|
*
|
|
35
|
-
* The DOM converter does not check which nodes should be rendered (use {@link module:engine/view/renderer~
|
|
36
|
-
* state of a tree nor keeps the synchronization between the tree view and
|
|
35
|
+
* The DOM converter does not check which nodes should be rendered (use {@link module:engine/view/renderer~ViewRenderer}), does not keep the
|
|
36
|
+
* state of a tree nor keeps the synchronization between the tree view and
|
|
37
|
+
* the DOM tree (use {@link module:engine/view/document~ViewDocument}).
|
|
37
38
|
*
|
|
38
39
|
* The DOM converter keeps DOM elements to view element bindings, so when the converter gets destroyed, the bindings are lost.
|
|
39
40
|
* Two converters will keep separate binding maps, so one tree view can be bound with two DOM trees.
|
|
40
41
|
*/
|
|
41
|
-
export
|
|
42
|
-
readonly document:
|
|
42
|
+
export declare class ViewDomConverter {
|
|
43
|
+
readonly document: ViewDocument;
|
|
43
44
|
/**
|
|
44
45
|
* Whether to leave the View-to-DOM conversion result unchanged or improve editing experience by filtering out interactive data.
|
|
45
46
|
*/
|
|
@@ -78,7 +79,7 @@ export default class DomConverter {
|
|
|
78
79
|
*/
|
|
79
80
|
readonly unsafeElements: Array<string>;
|
|
80
81
|
/**
|
|
81
|
-
* The DOM Document used by `
|
|
82
|
+
* The DOM Document used by `ViewDomConverter` to create DOM nodes.
|
|
82
83
|
*/
|
|
83
84
|
private readonly _domDocument;
|
|
84
85
|
/**
|
|
@@ -118,30 +119,30 @@ export default class DomConverter {
|
|
|
118
119
|
* @param options.renderingMode Whether to leave the View-to-DOM conversion result unchanged
|
|
119
120
|
* or improve editing experience by filtering out interactive data.
|
|
120
121
|
*/
|
|
121
|
-
constructor(document:
|
|
122
|
+
constructor(document: ViewDocument, { blockFillerMode, renderingMode }?: {
|
|
122
123
|
blockFillerMode?: BlockFillerMode;
|
|
123
124
|
renderingMode?: 'data' | 'editing';
|
|
124
125
|
});
|
|
125
126
|
/**
|
|
126
|
-
* The DOM Document used by `
|
|
127
|
+
* The DOM Document used by `ViewDomConverter` to create DOM nodes.
|
|
127
128
|
*/
|
|
128
129
|
get domDocument(): DomDocument;
|
|
129
130
|
/**
|
|
130
131
|
* Binds a given DOM element that represents fake selection to a **position** of a
|
|
131
|
-
* {@link module:engine/view/documentselection~
|
|
132
|
+
* {@link module:engine/view/documentselection~ViewDocumentSelection document selection}.
|
|
132
133
|
* Document selection copy is stored and can be retrieved by the
|
|
133
|
-
* {@link module:engine/view/domconverter~
|
|
134
|
+
* {@link module:engine/view/domconverter~ViewDomConverter#fakeSelectionToView} method.
|
|
134
135
|
*/
|
|
135
|
-
bindFakeSelection(domElement: DomElement, viewDocumentSelection:
|
|
136
|
+
bindFakeSelection(domElement: DomElement, viewDocumentSelection: ViewDocumentSelection): void;
|
|
136
137
|
/**
|
|
137
|
-
* Returns a {@link module:engine/view/selection~
|
|
138
|
+
* Returns a {@link module:engine/view/selection~ViewSelection view selection} instance corresponding to a given
|
|
138
139
|
* DOM element that represents fake selection. Returns `undefined` if binding to the given DOM element does not exist.
|
|
139
140
|
*/
|
|
140
141
|
fakeSelectionToView(domElement: DomElement): ViewSelection | undefined;
|
|
141
142
|
/**
|
|
142
143
|
* Binds DOM and view elements, so it will be possible to get corresponding elements using
|
|
143
|
-
* {@link module:engine/view/domconverter~
|
|
144
|
-
* {@link module:engine/view/domconverter~
|
|
144
|
+
* {@link module:engine/view/domconverter~ViewDomConverter#mapDomToView} and
|
|
145
|
+
* {@link module:engine/view/domconverter~ViewDomConverter#mapViewToDom}.
|
|
145
146
|
*
|
|
146
147
|
* @param domElement The DOM element to bind.
|
|
147
148
|
* @param viewElement The view element to bind.
|
|
@@ -156,8 +157,8 @@ export default class DomConverter {
|
|
|
156
157
|
unbindDomElement(domElement: DomElement): void;
|
|
157
158
|
/**
|
|
158
159
|
* Binds DOM and view document fragments, so it will be possible to get corresponding document fragments using
|
|
159
|
-
* {@link module:engine/view/domconverter~
|
|
160
|
-
* {@link module:engine/view/domconverter~
|
|
160
|
+
* {@link module:engine/view/domconverter~ViewDomConverter#mapDomToView} and
|
|
161
|
+
* {@link module:engine/view/domconverter~ViewDomConverter#mapViewToDom}.
|
|
161
162
|
*
|
|
162
163
|
* @param domFragment The DOM document fragment to bind.
|
|
163
164
|
* @param viewFragment The view document fragment to bind.
|
|
@@ -202,7 +203,8 @@ export default class DomConverter {
|
|
|
202
203
|
* @param value The value of the attribute.
|
|
203
204
|
* @param relatedViewElement The view element related to the `domElement` (if there is any).
|
|
204
205
|
* It helps decide whether the attribute set is unsafe. For instance, view elements created via the
|
|
205
|
-
* {@link module:engine/view/downcastwriter~
|
|
206
|
+
* {@link module:engine/view/downcastwriter~ViewDowncastWriter} methods can allow certain attributes
|
|
207
|
+
* that would normally be filtered out.
|
|
206
208
|
*/
|
|
207
209
|
setDomElementAttribute(domElement: DomElement, key: string, value: string, relatedViewElement?: ViewElement): void;
|
|
208
210
|
/**
|
|
@@ -216,11 +218,11 @@ export default class DomConverter {
|
|
|
216
218
|
removeDomElementAttribute(domElement: DomElement, key: string): void;
|
|
217
219
|
/**
|
|
218
220
|
* Converts children of the view element to DOM using the
|
|
219
|
-
* {@link module:engine/view/domconverter~
|
|
221
|
+
* {@link module:engine/view/domconverter~ViewDomConverter#viewToDom} method.
|
|
220
222
|
* Additionally, this method adds block {@link module:engine/view/filler filler} to the list of children, if needed.
|
|
221
223
|
*
|
|
222
224
|
* @param viewElement Parent view element.
|
|
223
|
-
* @param options See {@link module:engine/view/domconverter~
|
|
225
|
+
* @param options See {@link module:engine/view/domconverter~ViewDomConverter#viewToDom} options parameter.
|
|
224
226
|
* @returns DOM nodes.
|
|
225
227
|
*/
|
|
226
228
|
viewChildrenToDom(viewElement: ViewElement | ViewDocumentFragment, options?: {
|
|
@@ -228,7 +230,7 @@ export default class DomConverter {
|
|
|
228
230
|
withChildren?: boolean;
|
|
229
231
|
}): IterableIterator<Node>;
|
|
230
232
|
/**
|
|
231
|
-
* Converts view {@link module:engine/view/range~
|
|
233
|
+
* Converts view {@link module:engine/view/range~ViewRange} to DOM range.
|
|
232
234
|
* Inline and block {@link module:engine/view/filler fillers} are handled during the conversion.
|
|
233
235
|
*
|
|
234
236
|
* @param viewRange View range.
|
|
@@ -236,7 +238,7 @@ export default class DomConverter {
|
|
|
236
238
|
*/
|
|
237
239
|
viewRangeToDom(viewRange: ViewRange): DomRange;
|
|
238
240
|
/**
|
|
239
|
-
* Converts view {@link module:engine/view/position~
|
|
241
|
+
* Converts view {@link module:engine/view/position~ViewPosition} to DOM parent and offset.
|
|
240
242
|
*
|
|
241
243
|
* Inline and block {@link module:engine/view/filler fillers} are handled during the conversion.
|
|
242
244
|
* If the converted position is directly before inline filler it is moved inside the filler.
|
|
@@ -255,7 +257,7 @@ export default class DomConverter {
|
|
|
255
257
|
* Converts DOM to view. For all text nodes, not bound elements and document fragments new items will
|
|
256
258
|
* be created. For bound elements and document fragments function will return corresponding items. For
|
|
257
259
|
* {@link module:engine/view/filler fillers} `null` will be returned.
|
|
258
|
-
* For all DOM elements rendered by {@link module:engine/view/uielement~
|
|
260
|
+
* For all DOM elements rendered by {@link module:engine/view/uielement~ViewUIElement} that UIElement will be returned.
|
|
259
261
|
*
|
|
260
262
|
* @param domNode DOM node or document fragment to transform.
|
|
261
263
|
* @param options Conversion options.
|
|
@@ -263,7 +265,7 @@ export default class DomConverter {
|
|
|
263
265
|
* @param options.withChildren If `true`, node's and document fragment's children will be converted too. True by default.
|
|
264
266
|
* @param options.keepOriginalCase If `false`, node's tag name will be converted to lower case. False by default.
|
|
265
267
|
* @param options.skipComments If `false`, comment nodes will be converted to `$comment`
|
|
266
|
-
* {@link module:engine/view/uielement~
|
|
268
|
+
* {@link module:engine/view/uielement~ViewUIElement view UI elements}. False by default.
|
|
267
269
|
* @returns Converted node or document fragment or `null` if DOM node is a {@link module:engine/view/filler filler}
|
|
268
270
|
* or the given node is an empty text node.
|
|
269
271
|
*/
|
|
@@ -275,17 +277,17 @@ export default class DomConverter {
|
|
|
275
277
|
}): ViewNode | ViewDocumentFragment | null;
|
|
276
278
|
/**
|
|
277
279
|
* Converts children of the DOM element to view nodes using
|
|
278
|
-
* the {@link module:engine/view/domconverter~
|
|
280
|
+
* the {@link module:engine/view/domconverter~ViewDomConverter#domToView} method.
|
|
279
281
|
* Additionally this method omits block {@link module:engine/view/filler filler}, if it exists in the DOM parent.
|
|
280
282
|
*
|
|
281
283
|
* @param domElement Parent DOM element.
|
|
282
|
-
* @param options See {@link module:engine/view/domconverter~
|
|
284
|
+
* @param options See {@link module:engine/view/domconverter~ViewDomConverter#domToView} options parameter.
|
|
283
285
|
* @param inlineNodes An array that will be populated with inline nodes. It's used internally for whitespace processing.
|
|
284
286
|
* @returns View nodes.
|
|
285
287
|
*/
|
|
286
|
-
domChildrenToView(domElement: DomElement, options?: Parameters<
|
|
288
|
+
domChildrenToView(domElement: DomElement, options?: Parameters<ViewDomConverter['domToView']>[1], inlineNodes?: Array<ViewNode>): IterableIterator<ViewNode>;
|
|
287
289
|
/**
|
|
288
|
-
* Converts DOM selection to view {@link module:engine/view/selection~
|
|
290
|
+
* Converts DOM selection to view {@link module:engine/view/selection~ViewSelection}.
|
|
289
291
|
* Ranges which cannot be converted will be omitted.
|
|
290
292
|
*
|
|
291
293
|
* @param domSelection DOM selection.
|
|
@@ -293,7 +295,7 @@ export default class DomConverter {
|
|
|
293
295
|
*/
|
|
294
296
|
domSelectionToView(domSelection: DomSelection): ViewSelection;
|
|
295
297
|
/**
|
|
296
|
-
* Converts DOM Range to view {@link module:engine/view/range~
|
|
298
|
+
* Converts DOM Range to view {@link module:engine/view/range~ViewRange}.
|
|
297
299
|
* If the start or end position cannot be converted `null` is returned.
|
|
298
300
|
*
|
|
299
301
|
* @param domRange DOM range.
|
|
@@ -301,12 +303,12 @@ export default class DomConverter {
|
|
|
301
303
|
*/
|
|
302
304
|
domRangeToView(domRange: DomRange | StaticRange): ViewRange | null;
|
|
303
305
|
/**
|
|
304
|
-
* Converts DOM parent and offset to view {@link module:engine/view/position~
|
|
306
|
+
* Converts DOM parent and offset to view {@link module:engine/view/position~ViewPosition}.
|
|
305
307
|
*
|
|
306
308
|
* If the position is inside a {@link module:engine/view/filler filler} which has no corresponding view node,
|
|
307
309
|
* position of the filler will be converted and returned.
|
|
308
310
|
*
|
|
309
|
-
* If the position is inside DOM element rendered by {@link module:engine/view/uielement~
|
|
311
|
+
* If the position is inside DOM element rendered by {@link module:engine/view/uielement~ViewUIElement}
|
|
310
312
|
* that position will be converted to view position before that UIElement.
|
|
311
313
|
*
|
|
312
314
|
* If structures are too different and it is not possible to find corresponding position then `null` will be returned.
|
|
@@ -317,30 +319,31 @@ export default class DomConverter {
|
|
|
317
319
|
*/
|
|
318
320
|
domPositionToView(domParent: DomNode, domOffset?: number): ViewPosition | null;
|
|
319
321
|
/**
|
|
320
|
-
* Returns corresponding view {@link module:engine/view/element~
|
|
321
|
-
* {@link module:engine/view/documentfragment~
|
|
322
|
-
* document fragment. If there is no view item {@link module:engine/view/domconverter~
|
|
322
|
+
* Returns corresponding view {@link module:engine/view/element~ViewElement Element} or
|
|
323
|
+
* {@link module:engine/view/documentfragment~ViewDocumentFragment} for provided DOM element or
|
|
324
|
+
* document fragment. If there is no view item {@link module:engine/view/domconverter~ViewDomConverter#bindElements bound}
|
|
323
325
|
* to the given DOM - `undefined` is returned.
|
|
324
326
|
*
|
|
325
|
-
* For all DOM elements rendered by a {@link module:engine/view/uielement~
|
|
326
|
-
* a {@link module:engine/view/rawelement~
|
|
327
|
+
* For all DOM elements rendered by a {@link module:engine/view/uielement~ViewUIElement} or
|
|
328
|
+
* a {@link module:engine/view/rawelement~ViewRawElement}, the parent `UIElement` or `RawElement` will be returned.
|
|
327
329
|
*
|
|
328
330
|
* @param domElementOrDocumentFragment DOM element or document fragment.
|
|
329
331
|
* @returns Corresponding view element, document fragment or `undefined` if no element was bound.
|
|
330
332
|
*/
|
|
331
333
|
mapDomToView(domElementOrDocumentFragment: DomElement | DomDocumentFragment): ViewElement | ViewDocumentFragment | undefined;
|
|
332
334
|
/**
|
|
333
|
-
* Finds corresponding text node. Text nodes are not {@link module:engine/view/domconverter~
|
|
335
|
+
* Finds corresponding text node. Text nodes are not {@link module:engine/view/domconverter~ViewDomConverter#bindElements bound},
|
|
334
336
|
* corresponding text node is returned based on the sibling or parent.
|
|
335
337
|
*
|
|
336
|
-
* If the directly previous sibling is a {@link module:engine/view/domconverter~
|
|
338
|
+
* If the directly previous sibling is a {@link module:engine/view/domconverter~ViewDomConverter#bindElements bound} element, it is used
|
|
337
339
|
* to find the corresponding text node.
|
|
338
340
|
*
|
|
339
|
-
* If this is a first child in the parent and the parent is a
|
|
341
|
+
* If this is a first child in the parent and the parent is a
|
|
342
|
+
* {@link module:engine/view/domconverter~ViewDomConverter#bindElements bound}
|
|
340
343
|
* element, it is used to find the corresponding text node.
|
|
341
344
|
*
|
|
342
|
-
* For all text nodes rendered by a {@link module:engine/view/uielement~
|
|
343
|
-
* a {@link module:engine/view/rawelement~
|
|
345
|
+
* For all text nodes rendered by a {@link module:engine/view/uielement~ViewUIElement} or
|
|
346
|
+
* a {@link module:engine/view/rawelement~ViewRawElement}, the parent `UIElement` or `RawElement` will be returned.
|
|
344
347
|
*
|
|
345
348
|
* Otherwise `null` is returned.
|
|
346
349
|
*
|
|
@@ -351,9 +354,9 @@ export default class DomConverter {
|
|
|
351
354
|
*/
|
|
352
355
|
findCorrespondingViewText(domText: DomText): ViewText | ViewUIElement | ViewRawElement | null;
|
|
353
356
|
/**
|
|
354
|
-
* Returns corresponding DOM item for provided {@link module:engine/view/element~
|
|
355
|
-
* {@link module:engine/view/documentfragment~
|
|
356
|
-
* To find a corresponding text for {@link module:engine/view/text~
|
|
357
|
+
* Returns corresponding DOM item for provided {@link module:engine/view/element~ViewElement Element} or
|
|
358
|
+
* {@link module:engine/view/documentfragment~ViewDocumentFragment DocumentFragment}.
|
|
359
|
+
* To find a corresponding text for {@link module:engine/view/text~ViewText view Text instance}
|
|
357
360
|
* use {@link #findCorrespondingDomText}.
|
|
358
361
|
*
|
|
359
362
|
* @label ELEMENT
|
|
@@ -362,9 +365,9 @@ export default class DomConverter {
|
|
|
362
365
|
*/
|
|
363
366
|
mapViewToDom(element: ViewElement): DomElement | undefined;
|
|
364
367
|
/**
|
|
365
|
-
* Returns corresponding DOM item for provided {@link module:engine/view/element~
|
|
366
|
-
* {@link module:engine/view/documentfragment~
|
|
367
|
-
* To find a corresponding text for {@link module:engine/view/text~
|
|
368
|
+
* Returns corresponding DOM item for provided {@link module:engine/view/element~ViewElement Element} or
|
|
369
|
+
* {@link module:engine/view/documentfragment~ViewDocumentFragment DocumentFragment}.
|
|
370
|
+
* To find a corresponding text for {@link module:engine/view/text~ViewText view Text instance}
|
|
368
371
|
* use {@link #findCorrespondingDomText}.
|
|
369
372
|
*
|
|
370
373
|
* @label DOCUMENT_FRAGMENT
|
|
@@ -373,9 +376,9 @@ export default class DomConverter {
|
|
|
373
376
|
*/
|
|
374
377
|
mapViewToDom(documentFragment: ViewDocumentFragment): DomDocumentFragment | undefined;
|
|
375
378
|
/**
|
|
376
|
-
* Returns corresponding DOM item for provided {@link module:engine/view/element~
|
|
377
|
-
* {@link module:engine/view/documentfragment~
|
|
378
|
-
* To find a corresponding text for {@link module:engine/view/text~
|
|
379
|
+
* Returns corresponding DOM item for provided {@link module:engine/view/element~ViewElement Element} or
|
|
380
|
+
* {@link module:engine/view/documentfragment~ViewDocumentFragment DocumentFragment}.
|
|
381
|
+
* To find a corresponding text for {@link module:engine/view/text~ViewText view Text instance}
|
|
379
382
|
* use {@link #findCorrespondingDomText}.
|
|
380
383
|
*
|
|
381
384
|
* @label DOCUMENT_FRAGMENT_OR_ELEMENT
|
|
@@ -384,13 +387,14 @@ export default class DomConverter {
|
|
|
384
387
|
*/
|
|
385
388
|
mapViewToDom(documentFragmentOrElement: ViewElement | ViewDocumentFragment): DomElement | DomDocumentFragment | undefined;
|
|
386
389
|
/**
|
|
387
|
-
* Finds corresponding text node. Text nodes are not {@link module:engine/view/domconverter~
|
|
390
|
+
* Finds corresponding text node. Text nodes are not {@link module:engine/view/domconverter~ViewDomConverter#bindElements bound},
|
|
388
391
|
* corresponding text node is returned based on the sibling or parent.
|
|
389
392
|
*
|
|
390
|
-
* If the directly previous sibling is a {@link module:engine/view/domconverter~
|
|
393
|
+
* If the directly previous sibling is a {@link module:engine/view/domconverter~ViewDomConverter#bindElements bound} element, it is used
|
|
391
394
|
* to find the corresponding text node.
|
|
392
395
|
*
|
|
393
|
-
* If this is a first child in the parent and the parent is a
|
|
396
|
+
* If this is a first child in the parent and the parent is a
|
|
397
|
+
* {@link module:engine/view/domconverter~ViewDomConverter#bindElements bound}
|
|
394
398
|
* element, it is used to find the corresponding text node.
|
|
395
399
|
*
|
|
396
400
|
* Otherwise `null` is returned.
|
|
@@ -400,9 +404,9 @@ export default class DomConverter {
|
|
|
400
404
|
*/
|
|
401
405
|
findCorrespondingDomText(viewText: ViewText): DomText | null;
|
|
402
406
|
/**
|
|
403
|
-
* Focuses DOM editable that is corresponding to provided {@link module:engine/view/editableelement~
|
|
407
|
+
* Focuses DOM editable that is corresponding to provided {@link module:engine/view/editableelement~ViewEditableElement}.
|
|
404
408
|
*/
|
|
405
|
-
focus(viewEditable:
|
|
409
|
+
focus(viewEditable: ViewEditableElement): void;
|
|
406
410
|
/**
|
|
407
411
|
* Remove DOM selection from blurred editable, so it won't interfere with clicking on dropdowns (especially on iOS).
|
|
408
412
|
*
|
|
@@ -425,7 +429,7 @@ export default class DomConverter {
|
|
|
425
429
|
* Checks if the node is an instance of the block filler for this DOM converter.
|
|
426
430
|
*
|
|
427
431
|
* ```ts
|
|
428
|
-
* const converter = new
|
|
432
|
+
* const converter = new ViewDomConverter( viewDocument, { blockFillerMode: 'br' } );
|
|
429
433
|
*
|
|
430
434
|
* converter.isBlockFiller( BR_FILLER( document ) ); // true
|
|
431
435
|
* converter.isBlockFiller( NBSP_FILLER( document ) ); // false
|
|
@@ -446,7 +450,7 @@ export default class DomConverter {
|
|
|
446
450
|
*/
|
|
447
451
|
isDomSelectionBackward(selection: DomSelection): boolean;
|
|
448
452
|
/**
|
|
449
|
-
* Returns a parent {@link module:engine/view/uielement~
|
|
453
|
+
* Returns a parent {@link module:engine/view/uielement~ViewUIElement} or {@link module:engine/view/rawelement~ViewRawElement}
|
|
450
454
|
* that hosts the provided DOM node. Returns `null` if there is no such parent.
|
|
451
455
|
*/
|
|
452
456
|
getHostViewElement(domNode: DomNode): ViewUIElement | ViewRawElement | null;
|
|
@@ -456,8 +460,8 @@ export default class DomConverter {
|
|
|
456
460
|
* The following places are considered as incorrect for selection boundaries:
|
|
457
461
|
*
|
|
458
462
|
* * before or in the middle of an inline filler sequence,
|
|
459
|
-
* * inside a DOM element which represents {@link module:engine/view/uielement~
|
|
460
|
-
* * inside a DOM element which represents {@link module:engine/view/rawelement~
|
|
463
|
+
* * inside a DOM element which represents {@link module:engine/view/uielement~ViewUIElement a view UI element},
|
|
464
|
+
* * inside a DOM element which represents {@link module:engine/view/rawelement~ViewRawElement a view raw element}.
|
|
461
465
|
*
|
|
462
466
|
* @param domSelection The DOM selection object to be checked.
|
|
463
467
|
* @returns `true` if the given selection is at a correct place, `false` otherwise.
|
|
@@ -467,11 +471,11 @@ export default class DomConverter {
|
|
|
467
471
|
* Registers a {@link module:engine/view/matcher~MatcherPattern} for view elements whose content should be treated as raw data
|
|
468
472
|
* and not processed during the conversion from DOM nodes to view elements.
|
|
469
473
|
*
|
|
470
|
-
* This is affecting how {@link module:engine/view/domconverter~
|
|
471
|
-
* {@link module:engine/view/domconverter~
|
|
474
|
+
* This is affecting how {@link module:engine/view/domconverter~ViewDomConverter#domToView} and
|
|
475
|
+
* {@link module:engine/view/domconverter~ViewDomConverter#domChildrenToView} process DOM nodes.
|
|
472
476
|
*
|
|
473
477
|
* The raw data can be later accessed by a
|
|
474
|
-
* {@link module:engine/view/element~
|
|
478
|
+
* {@link module:engine/view/element~ViewElement#getCustomProperty custom property of a view element} called `"$rawContent"`.
|
|
475
479
|
*
|
|
476
480
|
* @param pattern Pattern matching a view element whose content should
|
|
477
481
|
* be treated as raw data.
|
|
@@ -480,8 +484,8 @@ export default class DomConverter {
|
|
|
480
484
|
/**
|
|
481
485
|
* Registers a {@link module:engine/view/matcher~MatcherPattern} for inline object view elements.
|
|
482
486
|
*
|
|
483
|
-
* This is affecting how {@link module:engine/view/domconverter~
|
|
484
|
-
* {@link module:engine/view/domconverter~
|
|
487
|
+
* This is affecting how {@link module:engine/view/domconverter~ViewDomConverter#domToView} and
|
|
488
|
+
* {@link module:engine/view/domconverter~ViewDomConverter#domChildrenToView} process DOM nodes.
|
|
485
489
|
*
|
|
486
490
|
* This is an extension of a simple {@link #inlineObjectElements} array of element names.
|
|
487
491
|
*
|
|
@@ -525,7 +529,7 @@ export default class DomConverter {
|
|
|
525
529
|
*/
|
|
526
530
|
private _processDomInlineNodes;
|
|
527
531
|
/**
|
|
528
|
-
* Takes text data from a given {@link module:engine/view/text~
|
|
532
|
+
* Takes text data from a given {@link module:engine/view/text~ViewText#data} and processes it so
|
|
529
533
|
* it is correctly displayed in the DOM.
|
|
530
534
|
*
|
|
531
535
|
* Following changes are done:
|
|
@@ -559,7 +563,7 @@ export default class DomConverter {
|
|
|
559
563
|
*/
|
|
560
564
|
private _isPreFormatted;
|
|
561
565
|
/**
|
|
562
|
-
* Helper function. For given {@link module:engine/view/text~
|
|
566
|
+
* Helper function. For given {@link module:engine/view/text~ViewText view text node}, it finds previous or next sibling
|
|
563
567
|
* that is contained in the same container element. If there is no such sibling, `null` is returned.
|
|
564
568
|
*
|
|
565
569
|
* @param node Reference node.
|
|
@@ -583,14 +587,14 @@ export default class DomConverter {
|
|
|
583
587
|
* Creates view element basing on the node type.
|
|
584
588
|
*
|
|
585
589
|
* @param node DOM node to check.
|
|
586
|
-
* @param options Conversion options. See {@link module:engine/view/domconverter~
|
|
590
|
+
* @param options Conversion options. See {@link module:engine/view/domconverter~ViewDomConverter#domToView} options parameter.
|
|
587
591
|
*/
|
|
588
592
|
private _createViewElement;
|
|
589
593
|
/**
|
|
590
594
|
* Checks if view element's content should be treated as a raw data.
|
|
591
595
|
*
|
|
592
596
|
* @param viewElement View element to check.
|
|
593
|
-
* @param options Conversion options. See {@link module:engine/view/domconverter~
|
|
597
|
+
* @param options Conversion options. See {@link module:engine/view/domconverter~ViewDomConverter#domToView} options parameter.
|
|
594
598
|
*/
|
|
595
599
|
private _isViewElementWithRawContent;
|
|
596
600
|
/**
|
|
@@ -618,32 +622,33 @@ export default class DomConverter {
|
|
|
618
622
|
* * `markedNbsp` – For the ` ` block fillers wrapped in `<span>` elements: `<span data-cke-filler="true"> </span>`
|
|
619
623
|
* used in the data.
|
|
620
624
|
*/
|
|
621
|
-
type BlockFillerMode = 'br' | 'nbsp' | 'markedNbsp';
|
|
625
|
+
export type BlockFillerMode = 'br' | 'nbsp' | 'markedNbsp';
|
|
622
626
|
export {};
|
|
623
627
|
/**
|
|
624
|
-
* While rendering the editor content, the {@link module:engine/view/domconverter~
|
|
628
|
+
* While rendering the editor content, the {@link module:engine/view/domconverter~ViewDomConverter} detected a `<script>` element that may
|
|
625
629
|
* disrupt the editing experience. To avoid this, the `<script>` element was replaced with `<span data-ck-unsafe-element="script"></span>`.
|
|
626
630
|
*
|
|
627
631
|
* @error domconverter-unsafe-script-element-detected
|
|
628
632
|
*/
|
|
629
633
|
/**
|
|
630
|
-
* While rendering the editor content, the
|
|
634
|
+
* While rendering the editor content, the
|
|
635
|
+
* {@link module:engine/view/domconverter~ViewDomConverter} detected a `<style>` element that may affect
|
|
631
636
|
* the editing experience. To avoid this, the `<style>` element was replaced with `<span data-ck-unsafe-element="style"></span>`.
|
|
632
637
|
*
|
|
633
638
|
* @error domconverter-unsafe-style-element-detected
|
|
634
639
|
*/
|
|
635
640
|
/**
|
|
636
|
-
* The {@link module:engine/view/domconverter~
|
|
641
|
+
* The {@link module:engine/view/domconverter~ViewDomConverter} detected an interactive attribute in the
|
|
637
642
|
* {@glink framework/architecture/editing-engine#editing-pipeline editing pipeline}. For the best
|
|
638
643
|
* editing experience, the attribute was renamed to `data-ck-unsafe-attribute-[original attribute name]`.
|
|
639
644
|
*
|
|
640
645
|
* If you are the author of the plugin that generated this attribute and you want it to be preserved
|
|
641
646
|
* in the editing pipeline, you can configure this when creating the element
|
|
642
|
-
* using {@link module:engine/view/downcastwriter~
|
|
647
|
+
* using {@link module:engine/view/downcastwriter~ViewDowncastWriter} during the
|
|
643
648
|
* {@glink framework/architecture/editing-engine#conversion model–view conversion}. Methods such as
|
|
644
|
-
* {@link module:engine/view/downcastwriter~
|
|
645
|
-
* {@link module:engine/view/downcastwriter~
|
|
646
|
-
* {@link module:engine/view/downcastwriter~
|
|
649
|
+
* {@link module:engine/view/downcastwriter~ViewDowncastWriter#createContainerElement},
|
|
650
|
+
* {@link module:engine/view/downcastwriter~ViewDowncastWriter#createAttributeElement}, or
|
|
651
|
+
* {@link module:engine/view/downcastwriter~ViewDowncastWriter#createEmptyElement}
|
|
647
652
|
* accept an option that will disable filtering of specific attributes:
|
|
648
653
|
*
|
|
649
654
|
* ```ts
|