@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,24 +5,24 @@
|
|
|
5
5
|
/**
|
|
6
6
|
* @module engine/view/downcastwriter
|
|
7
7
|
*/
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
import
|
|
14
|
-
import
|
|
15
|
-
import
|
|
8
|
+
import { ViewPosition, type ViewPositionOffset } from './position.js';
|
|
9
|
+
import { ViewRange } from './range.js';
|
|
10
|
+
import { ViewSelection, type ViewPlaceOrOffset, type ViewSelectable, type ViewSelectionOptions } from './selection.js';
|
|
11
|
+
import { ViewContainerElement } from './containerelement.js';
|
|
12
|
+
import { ViewAttributeElement } from './attributeelement.js';
|
|
13
|
+
import { ViewEmptyElement } from './emptyelement.js';
|
|
14
|
+
import { ViewUIElement } from './uielement.js';
|
|
15
|
+
import { ViewRawElement } from './rawelement.js';
|
|
16
16
|
import { type ArrayOrItem } from '@ckeditor/ckeditor5-utils';
|
|
17
|
-
import
|
|
18
|
-
import
|
|
19
|
-
import
|
|
20
|
-
import type
|
|
21
|
-
import type
|
|
22
|
-
import type {
|
|
23
|
-
import type
|
|
24
|
-
import type
|
|
25
|
-
import type {
|
|
17
|
+
import { ViewDocumentFragment } from './documentfragment.js';
|
|
18
|
+
import { ViewText } from './text.js';
|
|
19
|
+
import { ViewEditableElement } from './editableelement.js';
|
|
20
|
+
import { type ViewDocument } from './document.js';
|
|
21
|
+
import { type ViewNode } from './node.js';
|
|
22
|
+
import type { ViewElement, ViewElementAttributes } from './element.js';
|
|
23
|
+
import { type ViewDomConverter } from './domconverter.js';
|
|
24
|
+
import { type ViewItem } from './item.js';
|
|
25
|
+
import type { DowncastSlotFilter } from '../conversion/downcasthelpers.js';
|
|
26
26
|
type DomDocument = globalThis.Document;
|
|
27
27
|
type DomElement = globalThis.HTMLElement;
|
|
28
28
|
/**
|
|
@@ -31,23 +31,23 @@ type DomElement = globalThis.HTMLElement;
|
|
|
31
31
|
* It provides a set of methods used to manipulate view nodes.
|
|
32
32
|
*
|
|
33
33
|
* Do not create an instance of this writer manually. To modify a view structure, use
|
|
34
|
-
* the {@link module:engine/view/view~
|
|
34
|
+
* the {@link module:engine/view/view~EditingView#change `View#change()`} block.
|
|
35
35
|
*
|
|
36
|
-
* The `
|
|
36
|
+
* The `ViewDowncastWriter` is designed to work with semantic views which are the views that were/are being downcasted from the model.
|
|
37
37
|
* To work with ordinary views (e.g. parsed from a pasted content) use the
|
|
38
|
-
* {@link module:engine/view/upcastwriter~
|
|
38
|
+
* {@link module:engine/view/upcastwriter~ViewUpcastWriter upcast writer}.
|
|
39
39
|
*
|
|
40
40
|
* Read more about changing the view in the {@glink framework/architecture/editing-engine#changing-the-view Changing the view}
|
|
41
41
|
* section of the {@glink framework/architecture/editing-engine Editing engine architecture} guide.
|
|
42
42
|
*/
|
|
43
|
-
export
|
|
43
|
+
export declare class ViewDowncastWriter {
|
|
44
44
|
/**
|
|
45
45
|
* The view document instance in which this writer operates.
|
|
46
46
|
*/
|
|
47
|
-
readonly document:
|
|
47
|
+
readonly document: ViewDocument;
|
|
48
48
|
/**
|
|
49
|
-
* Holds references to the attribute groups that share the same {@link module:engine/view/attributeelement~
|
|
50
|
-
* The keys are `id`s, the values are `Set`s holding {@link module:engine/view/attributeelement~
|
|
49
|
+
* Holds references to the attribute groups that share the same {@link module:engine/view/attributeelement~ViewAttributeElement#id id}.
|
|
50
|
+
* The keys are `id`s, the values are `Set`s holding {@link module:engine/view/attributeelement~ViewAttributeElement}s.
|
|
51
51
|
*/
|
|
52
52
|
private readonly _cloneGroups;
|
|
53
53
|
/**
|
|
@@ -57,10 +57,10 @@ export default class DowncastWriter {
|
|
|
57
57
|
/**
|
|
58
58
|
* @param document The view document instance.
|
|
59
59
|
*/
|
|
60
|
-
constructor(document:
|
|
60
|
+
constructor(document: ViewDocument);
|
|
61
61
|
/**
|
|
62
|
-
* Sets {@link module:engine/view/documentselection~
|
|
63
|
-
* specified location based on the given {@link module:engine/view/selection~
|
|
62
|
+
* Sets {@link module:engine/view/documentselection~ViewDocumentSelection selection's} ranges and direction to the
|
|
63
|
+
* specified location based on the given {@link module:engine/view/selection~ViewSelectable selectable}.
|
|
64
64
|
*
|
|
65
65
|
* Usage:
|
|
66
66
|
*
|
|
@@ -70,20 +70,20 @@ export default class DowncastWriter {
|
|
|
70
70
|
* writer.setSelection( paragraph, offset );
|
|
71
71
|
* ```
|
|
72
72
|
*
|
|
73
|
-
* Creates a range inside an {@link module:engine/view/element~
|
|
73
|
+
* Creates a range inside an {@link module:engine/view/element~ViewElement element} which starts before the first child of
|
|
74
74
|
* that element and ends after the last child of that element.
|
|
75
75
|
*
|
|
76
76
|
* ```ts
|
|
77
77
|
* writer.setSelection( paragraph, 'in' );
|
|
78
78
|
* ```
|
|
79
79
|
*
|
|
80
|
-
* Creates a range on the {@link module:engine/view/item~
|
|
80
|
+
* Creates a range on the {@link module:engine/view/item~ViewItem item} which starts before the item and ends just after the item.
|
|
81
81
|
*
|
|
82
82
|
* ```ts
|
|
83
83
|
* writer.setSelection( paragraph, 'on' );
|
|
84
84
|
* ```
|
|
85
85
|
*
|
|
86
|
-
* `
|
|
86
|
+
* `ViewDowncastWriter#setSelection()` allow passing additional options (`backward`, `fake` and `label`) as the last argument.
|
|
87
87
|
*
|
|
88
88
|
* ```ts
|
|
89
89
|
* // Sets selection as backward.
|
|
@@ -104,10 +104,10 @@ export default class DowncastWriter {
|
|
|
104
104
|
*
|
|
105
105
|
* @label NODE_OFFSET
|
|
106
106
|
*/
|
|
107
|
-
setSelection(selectable:
|
|
107
|
+
setSelection(selectable: ViewNode, placeOrOffset: ViewPlaceOrOffset, options?: ViewSelectionOptions): void;
|
|
108
108
|
/**
|
|
109
|
-
* Sets {@link module:engine/view/documentselection~
|
|
110
|
-
* specified location based on the given {@link module:engine/view/selection~
|
|
109
|
+
* Sets {@link module:engine/view/documentselection~ViewDocumentSelection selection's} ranges and direction to the
|
|
110
|
+
* specified location based on the given {@link module:engine/view/selection~ViewSelectable selectable}.
|
|
111
111
|
*
|
|
112
112
|
* Usage:
|
|
113
113
|
*
|
|
@@ -136,7 +136,7 @@ export default class DowncastWriter {
|
|
|
136
136
|
* writer.setSelection( null );
|
|
137
137
|
* ```
|
|
138
138
|
*
|
|
139
|
-
* `
|
|
139
|
+
* `ViewDowncastWriter#setSelection()` allow passing additional options (`backward`, `fake` and `label`) as the last argument.
|
|
140
140
|
*
|
|
141
141
|
* ```ts
|
|
142
142
|
* // Sets selection as backward.
|
|
@@ -157,26 +157,27 @@ export default class DowncastWriter {
|
|
|
157
157
|
*
|
|
158
158
|
* @label SELECTABLE
|
|
159
159
|
*/
|
|
160
|
-
setSelection(selectable: Exclude<
|
|
160
|
+
setSelection(selectable: Exclude<ViewSelectable, ViewNode>, options?: ViewSelectionOptions): void;
|
|
161
161
|
/**
|
|
162
|
-
* Moves {@link module:engine/view/documentselection~
|
|
162
|
+
* Moves {@link module:engine/view/documentselection~ViewDocumentSelection#focus selection's focus} to the specified location.
|
|
163
163
|
*
|
|
164
|
-
* The location can be specified in the same form as
|
|
164
|
+
* The location can be specified in the same form as
|
|
165
|
+
* {@link module:engine/view/view~EditingView#createPositionAt view.createPositionAt()}
|
|
165
166
|
* parameters.
|
|
166
167
|
*
|
|
167
168
|
* @param itemOrPosition
|
|
168
|
-
* @param offset Offset or one of the flags. Used only when the first parameter is a {@link module:engine/view/item~
|
|
169
|
+
* @param offset Offset or one of the flags. Used only when the first parameter is a {@link module:engine/view/item~ViewItem view item}.
|
|
169
170
|
*/
|
|
170
|
-
setSelectionFocus(itemOrPosition:
|
|
171
|
+
setSelectionFocus(itemOrPosition: ViewItem | ViewPosition, offset?: ViewPositionOffset): void;
|
|
171
172
|
/**
|
|
172
|
-
* Creates a new {@link module:engine/view/documentfragment~
|
|
173
|
+
* Creates a new {@link module:engine/view/documentfragment~ViewDocumentFragment} instance.
|
|
173
174
|
*
|
|
174
175
|
* @param children A list of nodes to be inserted into the created document fragment.
|
|
175
176
|
* @returns The created document fragment.
|
|
176
177
|
*/
|
|
177
|
-
createDocumentFragment(children?:
|
|
178
|
+
createDocumentFragment(children?: ViewNode | Iterable<ViewNode>): ViewDocumentFragment;
|
|
178
179
|
/**
|
|
179
|
-
* Creates a new {@link module:engine/view/text~
|
|
180
|
+
* Creates a new {@link module:engine/view/text~ViewText text node}.
|
|
180
181
|
*
|
|
181
182
|
* ```ts
|
|
182
183
|
* writer.createText( 'foo' );
|
|
@@ -185,9 +186,9 @@ export default class DowncastWriter {
|
|
|
185
186
|
* @param data The text's data.
|
|
186
187
|
* @returns The created text node.
|
|
187
188
|
*/
|
|
188
|
-
createText(data: string):
|
|
189
|
+
createText(data: string): ViewText;
|
|
189
190
|
/**
|
|
190
|
-
* Creates a new {@link module:engine/view/attributeelement~
|
|
191
|
+
* Creates a new {@link module:engine/view/attributeelement~ViewAttributeElement}.
|
|
191
192
|
*
|
|
192
193
|
* ```ts
|
|
193
194
|
* writer.createAttributeElement( 'strong' );
|
|
@@ -203,19 +204,19 @@ export default class DowncastWriter {
|
|
|
203
204
|
* @param name Name of the element.
|
|
204
205
|
* @param attributes Element's attributes.
|
|
205
206
|
* @param options Element's options.
|
|
206
|
-
* @param options.priority Element's {@link module:engine/view/attributeelement~
|
|
207
|
-
* @param options.id Element's {@link module:engine/view/attributeelement~
|
|
207
|
+
* @param options.priority Element's {@link module:engine/view/attributeelement~ViewAttributeElement#priority priority}.
|
|
208
|
+
* @param options.id Element's {@link module:engine/view/attributeelement~ViewAttributeElement#id id}.
|
|
208
209
|
* @param options.renderUnsafeAttributes A list of attribute names that should be rendered in the editing
|
|
209
210
|
* pipeline even though they would normally be filtered out by unsafe attribute detection mechanisms.
|
|
210
211
|
* @returns Created element.
|
|
211
212
|
*/
|
|
212
|
-
createAttributeElement(name: string, attributes?:
|
|
213
|
+
createAttributeElement(name: string, attributes?: ViewElementAttributes, options?: {
|
|
213
214
|
priority?: number;
|
|
214
215
|
id?: number | string;
|
|
215
216
|
renderUnsafeAttributes?: Array<string>;
|
|
216
|
-
}):
|
|
217
|
+
}): ViewAttributeElement;
|
|
217
218
|
/**
|
|
218
|
-
* Creates a new {@link module:engine/view/containerelement~
|
|
219
|
+
* Creates a new {@link module:engine/view/containerelement~ViewContainerElement}.
|
|
219
220
|
*
|
|
220
221
|
* ```ts
|
|
221
222
|
* writer.createContainerElement( 'p' );
|
|
@@ -241,11 +242,11 @@ export default class DowncastWriter {
|
|
|
241
242
|
* pipeline even though they would normally be filtered out by unsafe attribute detection mechanisms.
|
|
242
243
|
* @returns Created element.
|
|
243
244
|
*/
|
|
244
|
-
createContainerElement(name: string, attributes?:
|
|
245
|
+
createContainerElement(name: string, attributes?: ViewElementAttributes, options?: {
|
|
245
246
|
renderUnsafeAttributes?: Array<string>;
|
|
246
|
-
}):
|
|
247
|
+
}): ViewContainerElement;
|
|
247
248
|
/**
|
|
248
|
-
* Creates a new {@link module:engine/view/containerelement~
|
|
249
|
+
* Creates a new {@link module:engine/view/containerelement~ViewContainerElement} with children.
|
|
249
250
|
*
|
|
250
251
|
* ```ts
|
|
251
252
|
* // Create element with children.
|
|
@@ -271,11 +272,11 @@ export default class DowncastWriter {
|
|
|
271
272
|
* pipeline even though they would normally be filtered out by unsafe attribute detection mechanisms.
|
|
272
273
|
* @returns Created element.
|
|
273
274
|
*/
|
|
274
|
-
createContainerElement(name: string, attributes:
|
|
275
|
+
createContainerElement(name: string, attributes: ViewElementAttributes, children: ViewNode | Iterable<ViewNode>, options?: {
|
|
275
276
|
renderUnsafeAttributes?: Array<string>;
|
|
276
|
-
}):
|
|
277
|
+
}): ViewContainerElement;
|
|
277
278
|
/**
|
|
278
|
-
* Creates a new {@link module:engine/view/editableelement~
|
|
279
|
+
* Creates a new {@link module:engine/view/editableelement~ViewEditableElement}.
|
|
279
280
|
*
|
|
280
281
|
* ```ts
|
|
281
282
|
* writer.createEditableElement( 'div' );
|
|
@@ -292,11 +293,11 @@ export default class DowncastWriter {
|
|
|
292
293
|
* pipeline even though they would normally be filtered out by unsafe attribute detection mechanisms.
|
|
293
294
|
* @returns Created element.
|
|
294
295
|
*/
|
|
295
|
-
createEditableElement(name: string, attributes?:
|
|
296
|
+
createEditableElement(name: string, attributes?: ViewElementAttributes, options?: {
|
|
296
297
|
renderUnsafeAttributes?: Array<string>;
|
|
297
|
-
}):
|
|
298
|
+
}): ViewEditableElement;
|
|
298
299
|
/**
|
|
299
|
-
* Creates a new {@link module:engine/view/emptyelement~
|
|
300
|
+
* Creates a new {@link module:engine/view/emptyelement~ViewEmptyElement}.
|
|
300
301
|
*
|
|
301
302
|
* ```ts
|
|
302
303
|
* writer.createEmptyElement( 'img' );
|
|
@@ -310,11 +311,11 @@ export default class DowncastWriter {
|
|
|
310
311
|
* pipeline even though they would normally be filtered out by unsafe attribute detection mechanisms.
|
|
311
312
|
* @returns Created element.
|
|
312
313
|
*/
|
|
313
|
-
createEmptyElement(name: string, attributes?:
|
|
314
|
+
createEmptyElement(name: string, attributes?: ViewElementAttributes, options?: {
|
|
314
315
|
renderUnsafeAttributes?: Array<string>;
|
|
315
|
-
}):
|
|
316
|
+
}): ViewEmptyElement;
|
|
316
317
|
/**
|
|
317
|
-
* Creates a new {@link module:engine/view/uielement~
|
|
318
|
+
* Creates a new {@link module:engine/view/uielement~ViewUIElement}.
|
|
318
319
|
*
|
|
319
320
|
* ```ts
|
|
320
321
|
* writer.createUIElement( 'span' );
|
|
@@ -342,9 +343,9 @@ export default class DowncastWriter {
|
|
|
342
343
|
* @param renderFunction A custom render function.
|
|
343
344
|
* @returns The created element.
|
|
344
345
|
*/
|
|
345
|
-
createUIElement(name: string, attributes?:
|
|
346
|
+
createUIElement(name: string, attributes?: ViewElementAttributes, renderFunction?: (this: ViewUIElement, domDocument: DomDocument, domConverter: ViewDomConverter) => DomElement): ViewUIElement;
|
|
346
347
|
/**
|
|
347
|
-
* Creates a new {@link module:engine/view/rawelement~
|
|
348
|
+
* Creates a new {@link module:engine/view/rawelement~ViewRawElement}.
|
|
348
349
|
*
|
|
349
350
|
* ```ts
|
|
350
351
|
* writer.createRawElement( 'span', { id: 'foo-1234' }, function( domElement ) {
|
|
@@ -358,7 +359,7 @@ export default class DowncastWriter {
|
|
|
358
359
|
* Raw elements are a perfect tool for integration with external frameworks and data sources.
|
|
359
360
|
*
|
|
360
361
|
* Unlike {@link #createUIElement UI elements}, raw elements act like "real" editor content (similar to
|
|
361
|
-
* {@link module:engine/view/containerelement~
|
|
362
|
+
* {@link module:engine/view/containerelement~ViewContainerElement} or {@link module:engine/view/emptyelement~ViewEmptyElement}),
|
|
362
363
|
* and they are considered by the editor selection.
|
|
363
364
|
*
|
|
364
365
|
* You should not use raw elements to render the UI in the editor content. Check out {@link #createUIElement `#createUIElement()`}
|
|
@@ -372,9 +373,9 @@ export default class DowncastWriter {
|
|
|
372
373
|
* pipeline even though they would normally be filtered out by unsafe attribute detection mechanisms.
|
|
373
374
|
* @returns The created element.
|
|
374
375
|
*/
|
|
375
|
-
createRawElement(name: string, attributes?:
|
|
376
|
+
createRawElement(name: string, attributes?: ViewElementAttributes, renderFunction?: (domElement: DomElement, domConverter: ViewDomConverter) => void, options?: {
|
|
376
377
|
renderUnsafeAttributes?: Array<string>;
|
|
377
|
-
}):
|
|
378
|
+
}): ViewRawElement;
|
|
378
379
|
/**
|
|
379
380
|
* Adds or overwrites the element's attribute with a specified key and value.
|
|
380
381
|
*
|
|
@@ -386,7 +387,7 @@ export default class DowncastWriter {
|
|
|
386
387
|
* @param value The attribute value.
|
|
387
388
|
* @param element The element to set an attribute on.
|
|
388
389
|
*/
|
|
389
|
-
setAttribute(key: string, value: unknown, element:
|
|
390
|
+
setAttribute(key: string, value: unknown, element: ViewElement): void;
|
|
390
391
|
/**
|
|
391
392
|
* Adds or overwrites the element's attribute with a specified key and value.
|
|
392
393
|
* Note that for tokenized attributes it allows the `reset` parameter to specify if the previous
|
|
@@ -402,7 +403,7 @@ export default class DowncastWriter {
|
|
|
402
403
|
* @param overwrite Whether tokenized attribute should overwrite the attribute value or just add a token.
|
|
403
404
|
* @param element The element to set an attribute on.
|
|
404
405
|
*/
|
|
405
|
-
setAttribute(key: string, value: unknown, overwrite: boolean, element:
|
|
406
|
+
setAttribute(key: string, value: unknown, overwrite: boolean, element: ViewElement): void;
|
|
406
407
|
/**
|
|
407
408
|
* Removes attribute from the element.
|
|
408
409
|
*
|
|
@@ -413,7 +414,7 @@ export default class DowncastWriter {
|
|
|
413
414
|
* @param key Attribute key.
|
|
414
415
|
* @param element The element to remove an attribute of.
|
|
415
416
|
*/
|
|
416
|
-
removeAttribute(key: string, element:
|
|
417
|
+
removeAttribute(key: string, element: ViewElement): void;
|
|
417
418
|
/**
|
|
418
419
|
* Removes specified tokens from an attribute value (for example class names, style properties).
|
|
419
420
|
* If resulting attribute become empty, the whole attribute is removed.
|
|
@@ -426,7 +427,7 @@ export default class DowncastWriter {
|
|
|
426
427
|
* @param tokens Tokens to partly remove from attribute value. For example class names or style property names.
|
|
427
428
|
* @param element The element to remove an attribute of.
|
|
428
429
|
*/
|
|
429
|
-
removeAttribute(key: string, tokens: ArrayOrItem<string>, element:
|
|
430
|
+
removeAttribute(key: string, tokens: ArrayOrItem<string>, element: ViewElement): void;
|
|
430
431
|
/**
|
|
431
432
|
* Adds specified class to the element.
|
|
432
433
|
*
|
|
@@ -435,7 +436,7 @@ export default class DowncastWriter {
|
|
|
435
436
|
* writer.addClass( [ 'foo', 'bar' ], linkElement );
|
|
436
437
|
* ```
|
|
437
438
|
*/
|
|
438
|
-
addClass(className: string | Array<string>, element:
|
|
439
|
+
addClass(className: string | Array<string>, element: ViewElement): void;
|
|
439
440
|
/**
|
|
440
441
|
* Removes specified class from the element.
|
|
441
442
|
*
|
|
@@ -444,7 +445,7 @@ export default class DowncastWriter {
|
|
|
444
445
|
* writer.removeClass( [ 'foo', 'bar' ], linkElement );
|
|
445
446
|
* ```
|
|
446
447
|
*/
|
|
447
|
-
removeClass(className: string | Array<string>, element:
|
|
448
|
+
removeClass(className: string | Array<string>, element: ViewElement): void;
|
|
448
449
|
/**
|
|
449
450
|
* Adds style to the element.
|
|
450
451
|
*
|
|
@@ -461,7 +462,7 @@ export default class DowncastWriter {
|
|
|
461
462
|
* @param value Value to set.
|
|
462
463
|
* @param element Element to set styles on.
|
|
463
464
|
*/
|
|
464
|
-
setStyle(property: string, value: string, element:
|
|
465
|
+
setStyle(property: string, value: string, element: ViewElement): void;
|
|
465
466
|
/**
|
|
466
467
|
* Adds many styles to the element.
|
|
467
468
|
*
|
|
@@ -480,7 +481,7 @@ export default class DowncastWriter {
|
|
|
480
481
|
* @param property Object with key - value pairs.
|
|
481
482
|
* @param element Element to set styles on.
|
|
482
483
|
*/
|
|
483
|
-
setStyle(property: Record<string, string>, element:
|
|
484
|
+
setStyle(property: Record<string, string>, element: ViewElement): void;
|
|
484
485
|
/**
|
|
485
486
|
* Removes specified style from the element.
|
|
486
487
|
*
|
|
@@ -493,18 +494,18 @@ export default class DowncastWriter {
|
|
|
493
494
|
* {@link module:engine/controller/datacontroller~DataController#addStyleProcessorRules a particular style processor rule is enabled}.
|
|
494
495
|
* See {@link module:engine/view/stylesmap~StylesMap#remove `StylesMap#remove()`} for details.
|
|
495
496
|
*/
|
|
496
|
-
removeStyle(property: string | Array<string>, element:
|
|
497
|
+
removeStyle(property: string | Array<string>, element: ViewElement): void;
|
|
497
498
|
/**
|
|
498
499
|
* Sets a custom property on element. Unlike attributes, custom properties are not rendered to the DOM,
|
|
499
500
|
* so they can be used to add special data to elements.
|
|
500
501
|
*/
|
|
501
|
-
setCustomProperty(key: string | symbol, value: unknown, element:
|
|
502
|
+
setCustomProperty(key: string | symbol, value: unknown, element: ViewElement | ViewDocumentFragment): void;
|
|
502
503
|
/**
|
|
503
504
|
* Removes a custom property stored under the given key.
|
|
504
505
|
*
|
|
505
506
|
* @returns Returns true if property was removed.
|
|
506
507
|
*/
|
|
507
|
-
removeCustomProperty(key: string | symbol, element:
|
|
508
|
+
removeCustomProperty(key: string | symbol, element: ViewElement | ViewDocumentFragment): boolean;
|
|
508
509
|
/**
|
|
509
510
|
* Breaks attribute elements at the provided position or at the boundaries of a provided range. It breaks attribute elements
|
|
510
511
|
* up to their first ancestor that is a container element.
|
|
@@ -518,33 +519,33 @@ export default class DowncastWriter {
|
|
|
518
519
|
* <p><b>fo{o</b><u>ba}r</u></p> -> <p><b>fo</b><b>o</b><u>ba</u><u>r</u></b></p>
|
|
519
520
|
* ```
|
|
520
521
|
*
|
|
521
|
-
* **Note:** {@link module:engine/view/documentfragment~
|
|
522
|
+
* **Note:** {@link module:engine/view/documentfragment~ViewDocumentFragment DocumentFragment} is treated like a container.
|
|
522
523
|
*
|
|
523
|
-
* **Note:** The difference between {@link module:engine/view/downcastwriter~
|
|
524
|
-
* {@link module:engine/view/downcastwriter~
|
|
525
|
-
* {@link module:engine/view/attributeelement~
|
|
526
|
-
* up to the first encountered {@link module:engine/view/containerelement~
|
|
524
|
+
* **Note:** The difference between {@link module:engine/view/downcastwriter~ViewDowncastWriter#breakAttributes breakAttributes()} and
|
|
525
|
+
* {@link module:engine/view/downcastwriter~ViewDowncastWriter#breakContainer breakContainer()} is that `breakAttributes()` breaks all
|
|
526
|
+
* {@link module:engine/view/attributeelement~ViewAttributeElement attribute elements} that are ancestors of a given `position`,
|
|
527
|
+
* up to the first encountered {@link module:engine/view/containerelement~ViewContainerElement container element}.
|
|
527
528
|
* `breakContainer()` assumes that a given `position` is directly in the container element and breaks that container element.
|
|
528
529
|
*
|
|
529
530
|
* Throws the `view-writer-invalid-range-container` {@link module:utils/ckeditorerror~CKEditorError CKEditorError}
|
|
530
|
-
* when the {@link module:engine/view/range~
|
|
531
|
-
* and {@link module:engine/view/range~
|
|
531
|
+
* when the {@link module:engine/view/range~ViewRange#start start}
|
|
532
|
+
* and {@link module:engine/view/range~ViewRange#end end} positions of a passed range are not placed inside same parent container.
|
|
532
533
|
*
|
|
533
534
|
* Throws the `view-writer-cannot-break-empty-element` {@link module:utils/ckeditorerror~CKEditorError CKEditorError}
|
|
534
|
-
* when trying to break attributes inside an {@link module:engine/view/emptyelement~
|
|
535
|
+
* when trying to break attributes inside an {@link module:engine/view/emptyelement~ViewEmptyElement ViewEmptyElement}.
|
|
535
536
|
*
|
|
536
537
|
* Throws the `view-writer-cannot-break-ui-element` {@link module:utils/ckeditorerror~CKEditorError CKEditorError}
|
|
537
|
-
* when trying to break attributes inside a {@link module:engine/view/uielement~
|
|
538
|
+
* when trying to break attributes inside a {@link module:engine/view/uielement~ViewUIElement UIElement}.
|
|
538
539
|
*
|
|
539
|
-
* @see module:engine/view/attributeelement~
|
|
540
|
-
* @see module:engine/view/containerelement~
|
|
541
|
-
* @see module:engine/view/downcastwriter~
|
|
540
|
+
* @see module:engine/view/attributeelement~ViewAttributeElement
|
|
541
|
+
* @see module:engine/view/containerelement~ViewContainerElement
|
|
542
|
+
* @see module:engine/view/downcastwriter~ViewDowncastWriter#breakContainer
|
|
542
543
|
* @param positionOrRange The position where to break attribute elements.
|
|
543
544
|
* @returns The new position or range, after breaking the attribute elements.
|
|
544
545
|
*/
|
|
545
|
-
breakAttributes(positionOrRange:
|
|
546
|
+
breakAttributes(positionOrRange: ViewPosition | ViewRange): ViewPosition | ViewRange;
|
|
546
547
|
/**
|
|
547
|
-
* Breaks a {@link module:engine/view/containerelement~
|
|
548
|
+
* Breaks a {@link module:engine/view/containerelement~ViewContainerElement container view element} into two, at the given position.
|
|
548
549
|
* The position has to be directly inside the container element and cannot be in the root. It does not break the conrainer view element
|
|
549
550
|
* if the position is at the beginning or at the end of its parent element.
|
|
550
551
|
*
|
|
@@ -555,23 +556,23 @@ export default class DowncastWriter {
|
|
|
555
556
|
* <p>foobar^</p> -> <p>foobar</p>^
|
|
556
557
|
* ```
|
|
557
558
|
*
|
|
558
|
-
* **Note:** The difference between {@link module:engine/view/downcastwriter~
|
|
559
|
-
* {@link module:engine/view/downcastwriter~
|
|
560
|
-
* {@link module:engine/view/attributeelement~
|
|
561
|
-
* up to the first encountered {@link module:engine/view/containerelement~
|
|
559
|
+
* **Note:** The difference between {@link module:engine/view/downcastwriter~ViewDowncastWriter#breakAttributes breakAttributes()} and
|
|
560
|
+
* {@link module:engine/view/downcastwriter~ViewDowncastWriter#breakContainer breakContainer()} is that `breakAttributes()` breaks all
|
|
561
|
+
* {@link module:engine/view/attributeelement~ViewAttributeElement attribute elements} that are ancestors of a given `position`,
|
|
562
|
+
* up to the first encountered {@link module:engine/view/containerelement~ViewContainerElement container element}.
|
|
562
563
|
* `breakContainer()` assumes that the given `position` is directly in the container element and breaks that container element.
|
|
563
564
|
*
|
|
564
|
-
* @see module:engine/view/attributeelement~
|
|
565
|
-
* @see module:engine/view/containerelement~
|
|
566
|
-
* @see module:engine/view/downcastwriter~
|
|
565
|
+
* @see module:engine/view/attributeelement~ViewAttributeElement
|
|
566
|
+
* @see module:engine/view/containerelement~ViewContainerElement
|
|
567
|
+
* @see module:engine/view/downcastwriter~ViewDowncastWriter#breakAttributes
|
|
567
568
|
* @param position The position where to break the element.
|
|
568
569
|
* @returns The position between broken elements. If an element has not been broken,
|
|
569
570
|
* the returned position is placed either before or after it.
|
|
570
571
|
*/
|
|
571
|
-
breakContainer(position:
|
|
572
|
+
breakContainer(position: ViewPosition): ViewPosition;
|
|
572
573
|
/**
|
|
573
|
-
* Merges {@link module:engine/view/attributeelement~
|
|
574
|
-
* Only {@link module:engine/view/attributeelement~
|
|
574
|
+
* Merges {@link module:engine/view/attributeelement~ViewAttributeElement attribute elements}. It also merges text nodes if needed.
|
|
575
|
+
* Only {@link module:engine/view/attributeelement~ViewAttributeElement#isSimilar similar} attribute elements can be merged.
|
|
575
576
|
*
|
|
576
577
|
* In following examples `<p>` is a container and `<b>` is an attribute element:
|
|
577
578
|
*
|
|
@@ -588,106 +589,109 @@ export default class DowncastWriter {
|
|
|
588
589
|
* <p><b>foo</b><i>[]</i><b>bar</b></p> -> <p><b>foo{}bar</b></p>
|
|
589
590
|
* ```
|
|
590
591
|
*
|
|
591
|
-
* **Note:** Difference between {@link module:engine/view/downcastwriter~
|
|
592
|
-
* {@link module:engine/view/downcastwriter~
|
|
593
|
-
* {@link module:engine/view/attributeelement~
|
|
594
|
-
*
|
|
592
|
+
* **Note:** Difference between {@link module:engine/view/downcastwriter~ViewDowncastWriter#mergeAttributes mergeAttributes} and
|
|
593
|
+
* {@link module:engine/view/downcastwriter~ViewDowncastWriter#mergeContainers mergeContainers} is that `mergeAttributes` merges two
|
|
594
|
+
* {@link module:engine/view/attributeelement~ViewAttributeElement attribute elements} or
|
|
595
|
+
* {@link module:engine/view/text~ViewText text nodes} while `mergeContainer` merges two
|
|
596
|
+
* {@link module:engine/view/containerelement~ViewContainerElement container elements}.
|
|
595
597
|
*
|
|
596
|
-
* @see module:engine/view/attributeelement~
|
|
597
|
-
* @see module:engine/view/containerelement~
|
|
598
|
-
* @see module:engine/view/downcastwriter~
|
|
598
|
+
* @see module:engine/view/attributeelement~ViewAttributeElement
|
|
599
|
+
* @see module:engine/view/containerelement~ViewContainerElement
|
|
600
|
+
* @see module:engine/view/downcastwriter~ViewDowncastWriter#mergeContainers
|
|
599
601
|
* @param position Merge position.
|
|
600
602
|
* @returns Position after merge.
|
|
601
603
|
*/
|
|
602
|
-
mergeAttributes(position:
|
|
604
|
+
mergeAttributes(position: ViewPosition): ViewPosition;
|
|
603
605
|
/**
|
|
604
|
-
* Merges two {@link module:engine/view/containerelement~
|
|
605
|
-
* Precisely, the element after the position is removed and it's contents are
|
|
606
|
+
* Merges two {@link module:engine/view/containerelement~ViewContainerElement container elements} that are
|
|
607
|
+
* before and after given position. Precisely, the element after the position is removed and it's contents are
|
|
608
|
+
* moved to element before the position.
|
|
606
609
|
*
|
|
607
610
|
* ```html
|
|
608
611
|
* <p>foo</p>^<p>bar</p> -> <p>foo^bar</p>
|
|
609
612
|
* <div>foo</div>^<p>bar</p> -> <div>foo^bar</div>
|
|
610
613
|
* ```
|
|
611
614
|
*
|
|
612
|
-
* **Note:** Difference between {@link module:engine/view/downcastwriter~
|
|
613
|
-
* {@link module:engine/view/downcastwriter~
|
|
614
|
-
* {@link module:engine/view/attributeelement~
|
|
615
|
-
*
|
|
615
|
+
* **Note:** Difference between {@link module:engine/view/downcastwriter~ViewDowncastWriter#mergeAttributes mergeAttributes} and
|
|
616
|
+
* {@link module:engine/view/downcastwriter~ViewDowncastWriter#mergeContainers mergeContainers} is that `mergeAttributes` merges two
|
|
617
|
+
* {@link module:engine/view/attributeelement~ViewAttributeElement attribute elements} or
|
|
618
|
+
* {@link module:engine/view/text~ViewText text nodes} while `mergeContainer` merges two
|
|
619
|
+
* {@link module:engine/view/containerelement~ViewContainerElement container elements}.
|
|
616
620
|
*
|
|
617
|
-
* @see module:engine/view/attributeelement~
|
|
618
|
-
* @see module:engine/view/containerelement~
|
|
619
|
-
* @see module:engine/view/downcastwriter~
|
|
621
|
+
* @see module:engine/view/attributeelement~ViewAttributeElement
|
|
622
|
+
* @see module:engine/view/containerelement~ViewContainerElement
|
|
623
|
+
* @see module:engine/view/downcastwriter~ViewDowncastWriter#mergeAttributes
|
|
620
624
|
* @param position Merge position.
|
|
621
625
|
* @returns Position after merge.
|
|
622
626
|
*/
|
|
623
|
-
mergeContainers(position:
|
|
627
|
+
mergeContainers(position: ViewPosition): ViewPosition;
|
|
624
628
|
/**
|
|
625
629
|
* Inserts a node or nodes at specified position. Takes care about breaking attributes before insertion
|
|
626
630
|
* and merging them afterwards.
|
|
627
631
|
*
|
|
628
632
|
* Throws {@link module:utils/ckeditorerror~CKEditorError CKEditorError} `view-writer-insert-invalid-node` when nodes to insert
|
|
629
|
-
* contains instances that are not {@link module:engine/view/text~
|
|
630
|
-
* {@link module:engine/view/attributeelement~
|
|
631
|
-
* {@link module:engine/view/containerelement~
|
|
632
|
-
* {@link module:engine/view/emptyelement~
|
|
633
|
-
* {@link module:engine/view/rawelement~
|
|
634
|
-
* {@link module:engine/view/uielement~
|
|
633
|
+
* contains instances that are not {@link module:engine/view/text~ViewText Texts},
|
|
634
|
+
* {@link module:engine/view/attributeelement~ViewAttributeElement ViewAttributeElements},
|
|
635
|
+
* {@link module:engine/view/containerelement~ViewContainerElement ViewContainerElements},
|
|
636
|
+
* {@link module:engine/view/emptyelement~ViewEmptyElement ViewEmptyElements},
|
|
637
|
+
* {@link module:engine/view/rawelement~ViewRawElement RawElements} or
|
|
638
|
+
* {@link module:engine/view/uielement~ViewUIElement UIElements}.
|
|
635
639
|
*
|
|
636
640
|
* @param position Insertion position.
|
|
637
641
|
* @param nodes Node or nodes to insert.
|
|
638
642
|
* @returns Range around inserted nodes.
|
|
639
643
|
*/
|
|
640
|
-
insert(position:
|
|
644
|
+
insert(position: ViewPosition, nodes: ViewNode | Iterable<ViewNode>): ViewRange;
|
|
641
645
|
/**
|
|
642
646
|
* Removes provided range from the container.
|
|
643
647
|
*
|
|
644
648
|
* Throws {@link module:utils/ckeditorerror~CKEditorError CKEditorError} `view-writer-invalid-range-container` when
|
|
645
|
-
* {@link module:engine/view/range~
|
|
646
|
-
* same parent container.
|
|
649
|
+
* {@link module:engine/view/range~ViewRange#start start} and {@link module:engine/view/range~ViewRange#end end}
|
|
650
|
+
* positions are not placed inside same parent container.
|
|
647
651
|
*
|
|
648
652
|
* @param rangeOrItem Range to remove from container
|
|
649
|
-
* or an {@link module:engine/view/item~
|
|
653
|
+
* or an {@link module:engine/view/item~ViewItem item} to remove. If range is provided, after removing, it will be updated
|
|
650
654
|
* to a collapsed range showing the new position.
|
|
651
655
|
* @returns Document fragment containing removed nodes.
|
|
652
656
|
*/
|
|
653
|
-
remove(rangeOrItem:
|
|
657
|
+
remove(rangeOrItem: ViewRange | ViewItem): ViewDocumentFragment;
|
|
654
658
|
/**
|
|
655
659
|
* Removes matching elements from given range.
|
|
656
660
|
*
|
|
657
661
|
* Throws {@link module:utils/ckeditorerror~CKEditorError CKEditorError} `view-writer-invalid-range-container` when
|
|
658
|
-
* {@link module:engine/view/range~
|
|
659
|
-
* same parent container.
|
|
662
|
+
* {@link module:engine/view/range~ViewRange#start start} and {@link module:engine/view/range~ViewRange#end end}
|
|
663
|
+
* positions are not placed inside same parent container.
|
|
660
664
|
*
|
|
661
665
|
* @param range Range to clear.
|
|
662
666
|
* @param element Element to remove.
|
|
663
667
|
*/
|
|
664
|
-
clear(range:
|
|
668
|
+
clear(range: ViewRange, element: ViewElement): void;
|
|
665
669
|
/**
|
|
666
670
|
* Moves nodes from provided range to target position.
|
|
667
671
|
*
|
|
668
672
|
* Throws {@link module:utils/ckeditorerror~CKEditorError CKEditorError} `view-writer-invalid-range-container` when
|
|
669
|
-
* {@link module:engine/view/range~
|
|
670
|
-
* same parent container.
|
|
673
|
+
* {@link module:engine/view/range~ViewRange#start start} and {@link module:engine/view/range~ViewRange#end end}
|
|
674
|
+
* positions are not placed inside same parent container.
|
|
671
675
|
*
|
|
672
676
|
* @param sourceRange Range containing nodes to move.
|
|
673
677
|
* @param targetPosition Position to insert.
|
|
674
678
|
* @returns Range in target container. Inserted nodes are placed between
|
|
675
|
-
* {@link module:engine/view/range~
|
|
679
|
+
* {@link module:engine/view/range~ViewRange#start start} and {@link module:engine/view/range~ViewRange#end end} positions.
|
|
676
680
|
*/
|
|
677
|
-
move(sourceRange:
|
|
681
|
+
move(sourceRange: ViewRange, targetPosition: ViewPosition): ViewRange;
|
|
678
682
|
/**
|
|
679
|
-
* Wraps elements within range with provided {@link module:engine/view/attributeelement~
|
|
683
|
+
* Wraps elements within range with provided {@link module:engine/view/attributeelement~ViewAttributeElement ViewAttributeElement}.
|
|
680
684
|
* If a collapsed range is provided, it will be wrapped only if it is equal to view selection.
|
|
681
685
|
*
|
|
682
686
|
* If a collapsed range was passed and is same as selection, the selection
|
|
683
687
|
* will be moved to the inside of the wrapped attribute element.
|
|
684
688
|
*
|
|
685
689
|
* Throws {@link module:utils/ckeditorerror~CKEditorError} `view-writer-invalid-range-container`
|
|
686
|
-
* when {@link module:engine/view/range~
|
|
687
|
-
* and {@link module:engine/view/range~
|
|
690
|
+
* when {@link module:engine/view/range~ViewRange#start}
|
|
691
|
+
* and {@link module:engine/view/range~ViewRange#end} positions are not placed inside same parent container.
|
|
688
692
|
*
|
|
689
693
|
* Throws {@link module:utils/ckeditorerror~CKEditorError} `view-writer-wrap-invalid-attribute` when passed attribute element is not
|
|
690
|
-
* an instance of {@link module:engine/view/attributeelement~
|
|
694
|
+
* an instance of {@link module:engine/view/attributeelement~ViewAttributeElement ViewAttributeElement}.
|
|
691
695
|
*
|
|
692
696
|
* Throws {@link module:utils/ckeditorerror~CKEditorError} `view-writer-wrap-nonselection-collapsed-range` when passed range
|
|
693
697
|
* is collapsed and different than view selection.
|
|
@@ -696,19 +700,19 @@ export default class DowncastWriter {
|
|
|
696
700
|
* @param attribute Attribute element to use as wrapper.
|
|
697
701
|
* @returns range Range after wrapping, spanning over wrapping attribute element.
|
|
698
702
|
*/
|
|
699
|
-
wrap(range:
|
|
703
|
+
wrap(range: ViewRange, attribute: ViewAttributeElement): ViewRange;
|
|
700
704
|
/**
|
|
701
705
|
* Unwraps nodes within provided range from attribute element.
|
|
702
706
|
*
|
|
703
707
|
* Throws {@link module:utils/ckeditorerror~CKEditorError CKEditorError} `view-writer-invalid-range-container` when
|
|
704
|
-
* {@link module:engine/view/range~
|
|
705
|
-
* same parent container.
|
|
708
|
+
* {@link module:engine/view/range~ViewRange#start start} and {@link module:engine/view/range~ViewRange#end end}
|
|
709
|
+
* positions are not placed inside same parent container.
|
|
706
710
|
*/
|
|
707
|
-
unwrap(range:
|
|
711
|
+
unwrap(range: ViewRange, attribute: ViewAttributeElement): ViewRange;
|
|
708
712
|
/**
|
|
709
713
|
* Renames element by creating a copy of renamed element but with changed name and then moving contents of the
|
|
710
|
-
* old element to the new one. Keep in mind that this will invalidate all {@link module:engine/view/position~
|
|
711
|
-
* has renamed element as {@link module:engine/view/position~
|
|
714
|
+
* old element to the new one. Keep in mind that this will invalidate all {@link module:engine/view/position~ViewPosition positions}
|
|
715
|
+
* which has renamed element as {@link module:engine/view/position~ViewPosition#parent a parent}.
|
|
712
716
|
*
|
|
713
717
|
* New element has to be created because `Element#tagName` property in DOM is readonly.
|
|
714
718
|
*
|
|
@@ -718,12 +722,12 @@ export default class DowncastWriter {
|
|
|
718
722
|
* @param viewElement Element to be renamed.
|
|
719
723
|
* @returns Element created due to rename.
|
|
720
724
|
*/
|
|
721
|
-
rename(newName: string, viewElement:
|
|
725
|
+
rename(newName: string, viewElement: ViewContainerElement): ViewContainerElement;
|
|
722
726
|
/**
|
|
723
727
|
* Cleans up memory by removing obsolete cloned elements group from the writer.
|
|
724
728
|
*
|
|
725
|
-
* Should be used whenever all {@link module:engine/view/attributeelement~
|
|
726
|
-
* with the same {@link module:engine/view/attributeelement~
|
|
729
|
+
* Should be used whenever all {@link module:engine/view/attributeelement~ViewAttributeElement attribute elements}
|
|
730
|
+
* with the same {@link module:engine/view/attributeelement~ViewAttributeElement#id id} are going to be removed from the view and
|
|
727
731
|
* the group will no longer be needed.
|
|
728
732
|
*
|
|
729
733
|
* Cloned elements group are not removed automatically in case if the group is still needed after all its elements
|
|
@@ -737,64 +741,64 @@ export default class DowncastWriter {
|
|
|
737
741
|
/**
|
|
738
742
|
* Creates position at the given location. The location can be specified as:
|
|
739
743
|
*
|
|
740
|
-
* * a {@link module:engine/view/position~
|
|
744
|
+
* * a {@link module:engine/view/position~ViewPosition position},
|
|
741
745
|
* * parent element and offset (offset defaults to `0`),
|
|
742
746
|
* * parent element and `'end'` (sets position at the end of that element),
|
|
743
|
-
* * {@link module:engine/view/item~
|
|
747
|
+
* * {@link module:engine/view/item~ViewItem view item} and `'before'` or `'after'` (sets position before or after given view item).
|
|
744
748
|
*
|
|
745
749
|
* This method is a shortcut to other constructors such as:
|
|
746
750
|
*
|
|
747
751
|
* * {@link #createPositionBefore},
|
|
748
752
|
* * {@link #createPositionAfter},
|
|
749
753
|
*
|
|
750
|
-
* @param offset Offset or one of the flags. Used only when the first parameter is a {@link module:engine/view/item~
|
|
754
|
+
* @param offset Offset or one of the flags. Used only when the first parameter is a {@link module:engine/view/item~ViewItem view item}.
|
|
751
755
|
*/
|
|
752
|
-
createPositionAt(itemOrPosition:
|
|
756
|
+
createPositionAt(itemOrPosition: ViewItem | ViewPosition, offset?: ViewPositionOffset): ViewPosition;
|
|
753
757
|
/**
|
|
754
758
|
* Creates a new position after given view item.
|
|
755
759
|
*
|
|
756
760
|
* @param item View item after which the position should be located.
|
|
757
761
|
*/
|
|
758
|
-
createPositionAfter(item:
|
|
762
|
+
createPositionAfter(item: ViewItem): ViewPosition;
|
|
759
763
|
/**
|
|
760
764
|
* Creates a new position before given view item.
|
|
761
765
|
*
|
|
762
766
|
* @param item View item before which the position should be located.
|
|
763
767
|
*/
|
|
764
|
-
createPositionBefore(item:
|
|
768
|
+
createPositionBefore(item: ViewItem): ViewPosition;
|
|
765
769
|
/**
|
|
766
770
|
* Creates a range spanning from `start` position to `end` position.
|
|
767
771
|
*
|
|
768
|
-
* **Note:** This factory method creates its own {@link module:engine/view/position~
|
|
772
|
+
* **Note:** This factory method creates its own {@link module:engine/view/position~ViewPosition} instances basing on passed values.
|
|
769
773
|
*
|
|
770
774
|
* @param start Start position.
|
|
771
775
|
* @param end End position. If not set, range will be collapsed at `start` position.
|
|
772
776
|
*/
|
|
773
|
-
createRange(start:
|
|
777
|
+
createRange(start: ViewPosition, end?: ViewPosition | null): ViewRange;
|
|
774
778
|
/**
|
|
775
|
-
* Creates a range that starts before given {@link module:engine/view/item~
|
|
779
|
+
* Creates a range that starts before given {@link module:engine/view/item~ViewItem view item} and ends after it.
|
|
776
780
|
*/
|
|
777
|
-
createRangeOn(item:
|
|
781
|
+
createRangeOn(item: ViewItem): ViewRange;
|
|
778
782
|
/**
|
|
779
|
-
* Creates a range inside an {@link module:engine/view/element~
|
|
783
|
+
* Creates a range inside an {@link module:engine/view/element~ViewElement element} which starts before the first child of
|
|
780
784
|
* that element and ends after the last child of that element.
|
|
781
785
|
*
|
|
782
786
|
* @param element Element which is a parent for the range.
|
|
783
787
|
*/
|
|
784
|
-
createRangeIn(element:
|
|
788
|
+
createRangeIn(element: ViewElement | ViewDocumentFragment): ViewRange;
|
|
785
789
|
/**
|
|
786
|
-
* Creates new {@link module:engine/view/selection~
|
|
790
|
+
* Creates new {@link module:engine/view/selection~ViewSelection} instance.
|
|
787
791
|
*
|
|
788
792
|
* ```ts
|
|
789
793
|
* // Creates collapsed selection at the position of given item and offset.
|
|
790
794
|
* const paragraph = writer.createContainerElement( 'p' );
|
|
791
795
|
* const selection = writer.createSelection( paragraph, offset );
|
|
792
796
|
*
|
|
793
|
-
* // Creates a range inside an {@link module:engine/view/element~
|
|
797
|
+
* // Creates a range inside an {@link module:engine/view/element~ViewElement element} which starts before the
|
|
794
798
|
* // first child of that element and ends after the last child of that element.
|
|
795
799
|
* const selection = writer.createSelection( paragraph, 'in' );
|
|
796
800
|
*
|
|
797
|
-
* // Creates a range on an {@link module:engine/view/item~
|
|
801
|
+
* // Creates a range on an {@link module:engine/view/item~ViewItem item} which starts before the item and ends
|
|
798
802
|
* // just after the item.
|
|
799
803
|
* const selection = writer.createSelection( paragraph, 'on' );
|
|
800
804
|
* ```
|
|
@@ -822,9 +826,9 @@ export default class DowncastWriter {
|
|
|
822
826
|
*
|
|
823
827
|
* @label NODE_OFFSET
|
|
824
828
|
*/
|
|
825
|
-
createSelection(selectable:
|
|
829
|
+
createSelection(selectable: ViewNode, placeOrOffset: ViewPlaceOrOffset, options?: ViewSelectionOptions): ViewSelection;
|
|
826
830
|
/**
|
|
827
|
-
* Creates new {@link module:engine/view/selection~
|
|
831
|
+
* Creates new {@link module:engine/view/selection~ViewSelection} instance.
|
|
828
832
|
*
|
|
829
833
|
* ```ts
|
|
830
834
|
* // Creates empty selection without ranges.
|
|
@@ -873,7 +877,7 @@ export default class DowncastWriter {
|
|
|
873
877
|
*
|
|
874
878
|
* @label SELECTABLE
|
|
875
879
|
*/
|
|
876
|
-
createSelection(selectable?: Exclude<
|
|
880
|
+
createSelection(selectable?: Exclude<ViewSelectable, ViewNode>, option?: ViewSelectionOptions): ViewSelection;
|
|
877
881
|
/**
|
|
878
882
|
* Creates placeholders for child elements of the {@link module:engine/conversion/downcasthelpers~DowncastHelpers#elementToStructure
|
|
879
883
|
* `elementToStructure()`} conversion helper.
|
|
@@ -903,14 +907,14 @@ export default class DowncastWriter {
|
|
|
903
907
|
* @returns The slot element to be placed in to the view structure while processing
|
|
904
908
|
* {@link module:engine/conversion/downcasthelpers~DowncastHelpers#elementToStructure `elementToStructure()`}.
|
|
905
909
|
*/
|
|
906
|
-
createSlot(modeOrFilter?: 'children' |
|
|
910
|
+
createSlot(modeOrFilter?: 'children' | DowncastSlotFilter): ViewElement;
|
|
907
911
|
/**
|
|
908
912
|
* Registers a slot factory.
|
|
909
913
|
*
|
|
910
914
|
* @internal
|
|
911
915
|
* @param slotFactory The slot factory.
|
|
912
916
|
*/
|
|
913
|
-
_registerSlotFactory(slotFactory: (writer:
|
|
917
|
+
_registerSlotFactory(slotFactory: (writer: ViewDowncastWriter, modeOrFilter: 'children' | DowncastSlotFilter) => ViewElement): void;
|
|
914
918
|
/**
|
|
915
919
|
* Clears the registered slot factory.
|
|
916
920
|
*
|
|
@@ -942,7 +946,7 @@ export default class DowncastWriter {
|
|
|
942
946
|
* This method will also merge newly added attribute element with its siblings whenever possible.
|
|
943
947
|
*
|
|
944
948
|
* Throws {@link module:utils/ckeditorerror~CKEditorError} `view-writer-wrap-invalid-attribute` when passed attribute element is not
|
|
945
|
-
* an instance of {@link module:engine/view/attributeelement~
|
|
949
|
+
* an instance of {@link module:engine/view/attributeelement~ViewAttributeElement ViewAttributeElement}.
|
|
946
950
|
*
|
|
947
951
|
* @returns New range after wrapping, spanning over wrapping attribute element.
|
|
948
952
|
*/
|
|
@@ -952,13 +956,13 @@ export default class DowncastWriter {
|
|
|
952
956
|
* This method will also merge newly added attribute element with its siblings whenever possible.
|
|
953
957
|
*
|
|
954
958
|
* Throws {@link module:utils/ckeditorerror~CKEditorError} `view-writer-wrap-invalid-attribute` when passed attribute element is not
|
|
955
|
-
* an instance of {@link module:engine/view/attributeelement~
|
|
959
|
+
* an instance of {@link module:engine/view/attributeelement~ViewAttributeElement ViewAttributeElement}.
|
|
956
960
|
*
|
|
957
961
|
* @returns New position after wrapping.
|
|
958
962
|
*/
|
|
959
963
|
private _wrapPosition;
|
|
960
964
|
/**
|
|
961
|
-
* Helper function used by other `
|
|
965
|
+
* Helper function used by other `ViewDowncastWriter` methods. Breaks attribute elements at the boundaries of given range.
|
|
962
966
|
*
|
|
963
967
|
* @param range Range which `start` and `end` positions will be used to break attributes.
|
|
964
968
|
* @param forceSplitText If set to `true`, will break text nodes even if they are directly in container element.
|
|
@@ -967,13 +971,13 @@ export default class DowncastWriter {
|
|
|
967
971
|
*/
|
|
968
972
|
private _breakAttributesRange;
|
|
969
973
|
/**
|
|
970
|
-
* Helper function used by other `
|
|
974
|
+
* Helper function used by other `ViewDowncastWriter` methods. Breaks attribute elements at given position.
|
|
971
975
|
*
|
|
972
976
|
* Throws {@link module:utils/ckeditorerror~CKEditorError CKEditorError} `view-writer-cannot-break-empty-element` when break position
|
|
973
|
-
* is placed inside {@link module:engine/view/emptyelement~
|
|
977
|
+
* is placed inside {@link module:engine/view/emptyelement~ViewEmptyElement ViewEmptyElement}.
|
|
974
978
|
*
|
|
975
979
|
* Throws {@link module:utils/ckeditorerror~CKEditorError CKEditorError} `view-writer-cannot-break-ui-element` when break position
|
|
976
|
-
* is placed inside {@link module:engine/view/uielement~
|
|
980
|
+
* is placed inside {@link module:engine/view/uielement~ViewUIElement UIElement}.
|
|
977
981
|
*
|
|
978
982
|
* @param position Position where to break attributes.
|
|
979
983
|
* @param forceSplitText If set to `true`, will break text nodes even if they are directly in container element.
|
|
@@ -982,25 +986,25 @@ export default class DowncastWriter {
|
|
|
982
986
|
*/
|
|
983
987
|
private _breakAttributes;
|
|
984
988
|
/**
|
|
985
|
-
* Stores the information that an {@link module:engine/view/attributeelement~
|
|
989
|
+
* Stores the information that an {@link module:engine/view/attributeelement~ViewAttributeElement attribute element} was
|
|
986
990
|
* added to the tree. Saves the reference to the group in the given element and updates the group, so other elements
|
|
987
991
|
* from the group now keep a reference to the given attribute element.
|
|
988
992
|
*
|
|
989
|
-
* The clones group can be obtained using {@link module:engine/view/attributeelement~
|
|
993
|
+
* The clones group can be obtained using {@link module:engine/view/attributeelement~ViewAttributeElement#getElementsWithSameId}.
|
|
990
994
|
*
|
|
991
|
-
* Does nothing if added element has no {@link module:engine/view/attributeelement~
|
|
995
|
+
* Does nothing if added element has no {@link module:engine/view/attributeelement~ViewAttributeElement#id id}.
|
|
992
996
|
*
|
|
993
997
|
* @param element Attribute element to save.
|
|
994
998
|
*/
|
|
995
999
|
private _addToClonedElementsGroup;
|
|
996
1000
|
/**
|
|
997
|
-
* Removes all the information about the given {@link module:engine/view/attributeelement~
|
|
1001
|
+
* Removes all the information about the given {@link module:engine/view/attributeelement~ViewAttributeElement attribute element}
|
|
998
1002
|
* from its clones group.
|
|
999
1003
|
*
|
|
1000
1004
|
* Keep in mind, that the element will still keep a reference to the group (but the group will not keep a reference to it).
|
|
1001
1005
|
* This allows to reference the whole group even if the element was already removed from the tree.
|
|
1002
1006
|
*
|
|
1003
|
-
* Does nothing if the element has no {@link module:engine/view/attributeelement~
|
|
1007
|
+
* Does nothing if the element has no {@link module:engine/view/attributeelement~ViewAttributeElement#id id}.
|
|
1004
1008
|
*
|
|
1005
1009
|
* @param element Attribute element to remove.
|
|
1006
1010
|
*/
|