@ckeditor/ckeditor5-engine 45.2.1-alpha.9 → 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,31 +5,31 @@
|
|
|
5
5
|
/**
|
|
6
6
|
* @module engine/view/attributeelement
|
|
7
7
|
*/
|
|
8
|
-
import
|
|
9
|
-
import type
|
|
10
|
-
import type
|
|
8
|
+
import { ViewElement, type ViewElementAttributes } from './element.js';
|
|
9
|
+
import { type ViewDocument } from './document.js';
|
|
10
|
+
import { type ViewNode } from './node.js';
|
|
11
11
|
/**
|
|
12
12
|
* Attribute elements are used to represent formatting elements in the view (think – `<b>`, `<span style="font-size: 2em">`, etc.).
|
|
13
13
|
* Most often they are created when downcasting model text attributes.
|
|
14
14
|
*
|
|
15
15
|
* Editing engine does not define a fixed HTML DTD. This is why a feature developer needs to choose between various
|
|
16
|
-
* types (container element, {@link module:engine/view/attributeelement~
|
|
17
|
-
* {@link module:engine/view/emptyelement~
|
|
16
|
+
* types (container element, {@link module:engine/view/attributeelement~ViewAttributeElement attribute element},
|
|
17
|
+
* {@link module:engine/view/emptyelement~ViewEmptyElement empty element}, etc) when developing a feature.
|
|
18
18
|
*
|
|
19
19
|
* To create a new attribute element instance use the
|
|
20
|
-
* {@link module:engine/view/downcastwriter~
|
|
20
|
+
* {@link module:engine/view/downcastwriter~ViewDowncastWriter#createAttributeElement `ViewDowncastWriter#createAttributeElement()`} method.
|
|
21
21
|
*/
|
|
22
|
-
export
|
|
22
|
+
export declare class ViewAttributeElement extends ViewElement {
|
|
23
23
|
static readonly DEFAULT_PRIORITY: number;
|
|
24
24
|
/**
|
|
25
|
-
* Element priority. Decides in what order elements are wrapped by {@link module:engine/view/downcastwriter~
|
|
25
|
+
* Element priority. Decides in what order elements are wrapped by {@link module:engine/view/downcastwriter~ViewDowncastWriter}.
|
|
26
26
|
*
|
|
27
27
|
* @internal
|
|
28
28
|
* @readonly
|
|
29
29
|
*/
|
|
30
30
|
_priority: number;
|
|
31
31
|
/**
|
|
32
|
-
* Element identifier. If set, it is used by {@link module:engine/view/element~
|
|
32
|
+
* Element identifier. If set, it is used by {@link module:engine/view/element~ViewElement#isSimilar},
|
|
33
33
|
* and then two elements are considered similar if, and only if they have the same `_id`.
|
|
34
34
|
*
|
|
35
35
|
* @internal
|
|
@@ -37,36 +37,36 @@ export default class AttributeElement extends Element {
|
|
|
37
37
|
*/
|
|
38
38
|
_id: string | number | null;
|
|
39
39
|
/**
|
|
40
|
-
* Keeps all the attribute elements that have the same {@link module:engine/view/attributeelement~
|
|
40
|
+
* Keeps all the attribute elements that have the same {@link module:engine/view/attributeelement~ViewAttributeElement#id ids}
|
|
41
41
|
* and still exist in the view tree.
|
|
42
42
|
*
|
|
43
|
-
* This property is managed by {@link module:engine/view/downcastwriter~
|
|
43
|
+
* This property is managed by {@link module:engine/view/downcastwriter~ViewDowncastWriter}.
|
|
44
44
|
*/
|
|
45
45
|
private readonly _clonesGroup;
|
|
46
46
|
/**
|
|
47
47
|
* Creates an attribute element.
|
|
48
48
|
*
|
|
49
|
-
* @see module:engine/view/downcastwriter~
|
|
50
|
-
* @see module:engine/view/element~
|
|
49
|
+
* @see module:engine/view/downcastwriter~ViewDowncastWriter#createAttributeElement
|
|
50
|
+
* @see module:engine/view/element~ViewElement
|
|
51
51
|
* @protected
|
|
52
52
|
* @param document The document instance to which this element belongs.
|
|
53
53
|
* @param name Node name.
|
|
54
54
|
* @param attrs Collection of attributes.
|
|
55
55
|
* @param children A list of nodes to be inserted into created element.
|
|
56
56
|
*/
|
|
57
|
-
constructor(document:
|
|
57
|
+
constructor(document: ViewDocument, name: string, attrs?: ViewElementAttributes, children?: ViewNode | Iterable<ViewNode>);
|
|
58
58
|
/**
|
|
59
|
-
* Element priority. Decides in what order elements are wrapped by {@link module:engine/view/downcastwriter~
|
|
59
|
+
* Element priority. Decides in what order elements are wrapped by {@link module:engine/view/downcastwriter~ViewDowncastWriter}.
|
|
60
60
|
*/
|
|
61
61
|
get priority(): number;
|
|
62
62
|
/**
|
|
63
|
-
* Element identifier. If set, it is used by {@link module:engine/view/element~
|
|
63
|
+
* Element identifier. If set, it is used by {@link module:engine/view/element~ViewElement#isSimilar},
|
|
64
64
|
* and then two elements are considered similar if, and only if they have the same `id`.
|
|
65
65
|
*/
|
|
66
66
|
get id(): string | number | null;
|
|
67
67
|
/**
|
|
68
|
-
* Returns all {@link module:engine/view/attributeelement~
|
|
69
|
-
* same {@link module:engine/view/attributeelement~
|
|
68
|
+
* Returns all {@link module:engine/view/attributeelement~ViewAttributeElement attribute elements} that has the
|
|
69
|
+
* same {@link module:engine/view/attributeelement~ViewAttributeElement#id id} and are in the view tree (were not removed).
|
|
70
70
|
*
|
|
71
71
|
* Note: If this element has been removed from the tree, returned set will not include it.
|
|
72
72
|
*
|
|
@@ -76,26 +76,26 @@ export default class AttributeElement extends Element {
|
|
|
76
76
|
* @returns Set containing all the attribute elements
|
|
77
77
|
* with the same `id` that were added and not removed from the view tree.
|
|
78
78
|
*/
|
|
79
|
-
getElementsWithSameId(): Set<
|
|
79
|
+
getElementsWithSameId(): Set<ViewAttributeElement>;
|
|
80
80
|
/**
|
|
81
81
|
* Checks if this element is similar to other element.
|
|
82
82
|
*
|
|
83
|
-
* If none of elements has set {@link module:engine/view/attributeelement~
|
|
83
|
+
* If none of elements has set {@link module:engine/view/attributeelement~ViewAttributeElement#id}, then both elements
|
|
84
84
|
* should have the same name, attributes and priority to be considered as similar. Two similar elements can contain
|
|
85
85
|
* different set of children nodes.
|
|
86
86
|
*
|
|
87
|
-
* If at least one element has {@link module:engine/view/attributeelement~
|
|
88
|
-
* elements have to have the same {@link module:engine/view/attributeelement~
|
|
87
|
+
* If at least one element has {@link module:engine/view/attributeelement~ViewAttributeElement#id} set, then both
|
|
88
|
+
* elements have to have the same {@link module:engine/view/attributeelement~ViewAttributeElement#id} value to be
|
|
89
89
|
* considered similar.
|
|
90
90
|
*
|
|
91
|
-
* Similarity is important for {@link module:engine/view/downcastwriter~
|
|
91
|
+
* Similarity is important for {@link module:engine/view/downcastwriter~ViewDowncastWriter}. For example:
|
|
92
92
|
*
|
|
93
93
|
* * two following similar elements can be merged together into one, longer element,
|
|
94
|
-
* * {@link module:engine/view/downcastwriter~
|
|
94
|
+
* * {@link module:engine/view/downcastwriter~ViewDowncastWriter#unwrap} checks similarity of passed element and processed element to
|
|
95
95
|
* decide whether processed element should be unwrapped,
|
|
96
96
|
* * etc.
|
|
97
97
|
*/
|
|
98
|
-
isSimilar(otherElement:
|
|
98
|
+
isSimilar(otherElement: ViewElement): boolean;
|
|
99
99
|
/**
|
|
100
100
|
* Clones provided element with priority.
|
|
101
101
|
*
|
|
@@ -106,17 +106,17 @@ export default class AttributeElement extends Element {
|
|
|
106
106
|
*/
|
|
107
107
|
_clone(deep?: boolean): this;
|
|
108
108
|
/**
|
|
109
|
-
* Used by {@link module:engine/view/element~
|
|
109
|
+
* Used by {@link module:engine/view/element~ViewElement#_mergeAttributesFrom} to verify if the given element can be merged without
|
|
110
110
|
* conflicts into this element.
|
|
111
111
|
*
|
|
112
112
|
* @internal
|
|
113
113
|
*/
|
|
114
|
-
_canMergeAttributesFrom(otherElement:
|
|
114
|
+
_canMergeAttributesFrom(otherElement: ViewAttributeElement): boolean;
|
|
115
115
|
/**
|
|
116
|
-
* Used by {@link module:engine/view/element~
|
|
116
|
+
* Used by {@link module:engine/view/element~ViewElement#_subtractAttributesOf} to verify if the given element attributes
|
|
117
117
|
* can be fully subtracted from this element.
|
|
118
118
|
*
|
|
119
119
|
* @internal
|
|
120
120
|
*/
|
|
121
|
-
_canSubtractAttributesOf(otherElement:
|
|
121
|
+
_canSubtractAttributesOf(otherElement: ViewAttributeElement): boolean;
|
|
122
122
|
}
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
/**
|
|
6
6
|
* @module engine/view/attributeelement
|
|
7
7
|
*/
|
|
8
|
-
import
|
|
8
|
+
import { ViewElement } from './element.js';
|
|
9
9
|
import { CKEditorError } from '@ckeditor/ckeditor5-utils';
|
|
10
10
|
// Default attribute priority.
|
|
11
11
|
const DEFAULT_PRIORITY = 10;
|
|
@@ -14,23 +14,23 @@ const DEFAULT_PRIORITY = 10;
|
|
|
14
14
|
* Most often they are created when downcasting model text attributes.
|
|
15
15
|
*
|
|
16
16
|
* Editing engine does not define a fixed HTML DTD. This is why a feature developer needs to choose between various
|
|
17
|
-
* types (container element, {@link module:engine/view/attributeelement~
|
|
18
|
-
* {@link module:engine/view/emptyelement~
|
|
17
|
+
* types (container element, {@link module:engine/view/attributeelement~ViewAttributeElement attribute element},
|
|
18
|
+
* {@link module:engine/view/emptyelement~ViewEmptyElement empty element}, etc) when developing a feature.
|
|
19
19
|
*
|
|
20
20
|
* To create a new attribute element instance use the
|
|
21
|
-
* {@link module:engine/view/downcastwriter~
|
|
21
|
+
* {@link module:engine/view/downcastwriter~ViewDowncastWriter#createAttributeElement `ViewDowncastWriter#createAttributeElement()`} method.
|
|
22
22
|
*/
|
|
23
|
-
class
|
|
23
|
+
class ViewAttributeElement extends ViewElement {
|
|
24
24
|
static DEFAULT_PRIORITY = DEFAULT_PRIORITY;
|
|
25
25
|
/**
|
|
26
|
-
* Element priority. Decides in what order elements are wrapped by {@link module:engine/view/downcastwriter~
|
|
26
|
+
* Element priority. Decides in what order elements are wrapped by {@link module:engine/view/downcastwriter~ViewDowncastWriter}.
|
|
27
27
|
*
|
|
28
28
|
* @internal
|
|
29
29
|
* @readonly
|
|
30
30
|
*/
|
|
31
31
|
_priority = DEFAULT_PRIORITY;
|
|
32
32
|
/**
|
|
33
|
-
* Element identifier. If set, it is used by {@link module:engine/view/element~
|
|
33
|
+
* Element identifier. If set, it is used by {@link module:engine/view/element~ViewElement#isSimilar},
|
|
34
34
|
* and then two elements are considered similar if, and only if they have the same `_id`.
|
|
35
35
|
*
|
|
36
36
|
* @internal
|
|
@@ -38,17 +38,17 @@ class AttributeElement extends Element {
|
|
|
38
38
|
*/
|
|
39
39
|
_id = null;
|
|
40
40
|
/**
|
|
41
|
-
* Keeps all the attribute elements that have the same {@link module:engine/view/attributeelement~
|
|
41
|
+
* Keeps all the attribute elements that have the same {@link module:engine/view/attributeelement~ViewAttributeElement#id ids}
|
|
42
42
|
* and still exist in the view tree.
|
|
43
43
|
*
|
|
44
|
-
* This property is managed by {@link module:engine/view/downcastwriter~
|
|
44
|
+
* This property is managed by {@link module:engine/view/downcastwriter~ViewDowncastWriter}.
|
|
45
45
|
*/
|
|
46
46
|
_clonesGroup = null;
|
|
47
47
|
/**
|
|
48
48
|
* Creates an attribute element.
|
|
49
49
|
*
|
|
50
|
-
* @see module:engine/view/downcastwriter~
|
|
51
|
-
* @see module:engine/view/element~
|
|
50
|
+
* @see module:engine/view/downcastwriter~ViewDowncastWriter#createAttributeElement
|
|
51
|
+
* @see module:engine/view/element~ViewElement
|
|
52
52
|
* @protected
|
|
53
53
|
* @param document The document instance to which this element belongs.
|
|
54
54
|
* @param name Node name.
|
|
@@ -60,21 +60,21 @@ class AttributeElement extends Element {
|
|
|
60
60
|
this.getFillerOffset = getFillerOffset;
|
|
61
61
|
}
|
|
62
62
|
/**
|
|
63
|
-
* Element priority. Decides in what order elements are wrapped by {@link module:engine/view/downcastwriter~
|
|
63
|
+
* Element priority. Decides in what order elements are wrapped by {@link module:engine/view/downcastwriter~ViewDowncastWriter}.
|
|
64
64
|
*/
|
|
65
65
|
get priority() {
|
|
66
66
|
return this._priority;
|
|
67
67
|
}
|
|
68
68
|
/**
|
|
69
|
-
* Element identifier. If set, it is used by {@link module:engine/view/element~
|
|
69
|
+
* Element identifier. If set, it is used by {@link module:engine/view/element~ViewElement#isSimilar},
|
|
70
70
|
* and then two elements are considered similar if, and only if they have the same `id`.
|
|
71
71
|
*/
|
|
72
72
|
get id() {
|
|
73
73
|
return this._id;
|
|
74
74
|
}
|
|
75
75
|
/**
|
|
76
|
-
* Returns all {@link module:engine/view/attributeelement~
|
|
77
|
-
* same {@link module:engine/view/attributeelement~
|
|
76
|
+
* Returns all {@link module:engine/view/attributeelement~ViewAttributeElement attribute elements} that has the
|
|
77
|
+
* same {@link module:engine/view/attributeelement~ViewAttributeElement#id id} and are in the view tree (were not removed).
|
|
78
78
|
*
|
|
79
79
|
* Note: If this element has been removed from the tree, returned set will not include it.
|
|
80
80
|
*
|
|
@@ -98,18 +98,18 @@ class AttributeElement extends Element {
|
|
|
98
98
|
/**
|
|
99
99
|
* Checks if this element is similar to other element.
|
|
100
100
|
*
|
|
101
|
-
* If none of elements has set {@link module:engine/view/attributeelement~
|
|
101
|
+
* If none of elements has set {@link module:engine/view/attributeelement~ViewAttributeElement#id}, then both elements
|
|
102
102
|
* should have the same name, attributes and priority to be considered as similar. Two similar elements can contain
|
|
103
103
|
* different set of children nodes.
|
|
104
104
|
*
|
|
105
|
-
* If at least one element has {@link module:engine/view/attributeelement~
|
|
106
|
-
* elements have to have the same {@link module:engine/view/attributeelement~
|
|
105
|
+
* If at least one element has {@link module:engine/view/attributeelement~ViewAttributeElement#id} set, then both
|
|
106
|
+
* elements have to have the same {@link module:engine/view/attributeelement~ViewAttributeElement#id} value to be
|
|
107
107
|
* considered similar.
|
|
108
108
|
*
|
|
109
|
-
* Similarity is important for {@link module:engine/view/downcastwriter~
|
|
109
|
+
* Similarity is important for {@link module:engine/view/downcastwriter~ViewDowncastWriter}. For example:
|
|
110
110
|
*
|
|
111
111
|
* * two following similar elements can be merged together into one, longer element,
|
|
112
|
-
* * {@link module:engine/view/downcastwriter~
|
|
112
|
+
* * {@link module:engine/view/downcastwriter~ViewDowncastWriter#unwrap} checks similarity of passed element and processed element to
|
|
113
113
|
* decide whether processed element should be unwrapped,
|
|
114
114
|
* * etc.
|
|
115
115
|
*/
|
|
@@ -137,7 +137,7 @@ class AttributeElement extends Element {
|
|
|
137
137
|
return cloned;
|
|
138
138
|
}
|
|
139
139
|
/**
|
|
140
|
-
* Used by {@link module:engine/view/element~
|
|
140
|
+
* Used by {@link module:engine/view/element~ViewElement#_mergeAttributesFrom} to verify if the given element can be merged without
|
|
141
141
|
* conflicts into this element.
|
|
142
142
|
*
|
|
143
143
|
* @internal
|
|
@@ -150,7 +150,7 @@ class AttributeElement extends Element {
|
|
|
150
150
|
return super._canMergeAttributesFrom(otherElement);
|
|
151
151
|
}
|
|
152
152
|
/**
|
|
153
|
-
* Used by {@link module:engine/view/element~
|
|
153
|
+
* Used by {@link module:engine/view/element~ViewElement#_subtractAttributesOf} to verify if the given element attributes
|
|
154
154
|
* can be fully subtracted from this element.
|
|
155
155
|
*
|
|
156
156
|
* @internal
|
|
@@ -163,10 +163,10 @@ class AttributeElement extends Element {
|
|
|
163
163
|
return super._canSubtractAttributesOf(otherElement);
|
|
164
164
|
}
|
|
165
165
|
}
|
|
166
|
-
export
|
|
166
|
+
export { ViewAttributeElement };
|
|
167
167
|
// The magic of type inference using `is` method is centralized in `TypeCheckable` class.
|
|
168
168
|
// Proper overload would interfere with that.
|
|
169
|
-
|
|
169
|
+
ViewAttributeElement.prototype.is = function (type, name) {
|
|
170
170
|
if (!name) {
|
|
171
171
|
return type === 'attributeElement' || type === 'view:attributeElement' ||
|
|
172
172
|
// From super.is(). This is highly utilised method and cannot call super. See ckeditor/ckeditor5#6529.
|
|
@@ -204,7 +204,7 @@ function getFillerOffset() {
|
|
|
204
204
|
return this.childCount;
|
|
205
205
|
}
|
|
206
206
|
/**
|
|
207
|
-
* Returns total count of children that are not {@link module:engine/view/uielement~
|
|
207
|
+
* Returns total count of children that are not {@link module:engine/view/uielement~ViewUIElement UIElements}.
|
|
208
208
|
*/
|
|
209
209
|
function nonUiChildrenCount(element) {
|
|
210
210
|
return Array.from(element.getChildren()).filter(element => !element.is('uiElement')).length;
|
|
@@ -5,45 +5,46 @@
|
|
|
5
5
|
/**
|
|
6
6
|
* @module engine/view/containerelement
|
|
7
7
|
*/
|
|
8
|
-
import
|
|
9
|
-
import type
|
|
10
|
-
import type
|
|
8
|
+
import { ViewElement, type ViewElementAttributes } from './element.js';
|
|
9
|
+
import { type ViewDocument } from './document.js';
|
|
10
|
+
import { type ViewNode } from './node.js';
|
|
11
11
|
/**
|
|
12
12
|
* Containers are elements which define document structure. They define boundaries for
|
|
13
|
-
* {@link module:engine/view/attributeelement~
|
|
13
|
+
* {@link module:engine/view/attributeelement~ViewAttributeElement attributes}.
|
|
14
|
+
* They are mostly used for block elements like `<p>` or `<div>`.
|
|
14
15
|
*
|
|
15
16
|
* Editing engine does not define a fixed HTML DTD. This is why a feature developer needs to choose between various
|
|
16
|
-
* types (container element, {@link module:engine/view/attributeelement~
|
|
17
|
-
* {@link module:engine/view/emptyelement~
|
|
17
|
+
* types (container element, {@link module:engine/view/attributeelement~ViewAttributeElement attribute element},
|
|
18
|
+
* {@link module:engine/view/emptyelement~ViewEmptyElement empty element}, etc) when developing a feature.
|
|
18
19
|
*
|
|
19
20
|
* The container element should be your default choice when writing a converter, unless:
|
|
20
21
|
*
|
|
21
|
-
* * this element represents a model text attribute (then use {@link module:engine/view/attributeelement~
|
|
22
|
-
* * this is an empty element like `<img>` (then use {@link module:engine/view/emptyelement~
|
|
22
|
+
* * this element represents a model text attribute (then use {@link module:engine/view/attributeelement~ViewAttributeElement}),
|
|
23
|
+
* * this is an empty element like `<img>` (then use {@link module:engine/view/emptyelement~ViewEmptyElement}),
|
|
23
24
|
* * this is a root element,
|
|
24
|
-
* * this is a nested editable element (then use {@link module:engine/view/editableelement~
|
|
25
|
+
* * this is a nested editable element (then use {@link module:engine/view/editableelement~ViewEditableElement}).
|
|
25
26
|
*
|
|
26
27
|
* To create a new container element instance use the
|
|
27
|
-
* {@link module:engine/view/downcastwriter~
|
|
28
|
+
* {@link module:engine/view/downcastwriter~ViewDowncastWriter#createContainerElement `ViewDowncastWriter#createContainerElement()`}
|
|
28
29
|
* method.
|
|
29
30
|
*/
|
|
30
|
-
export
|
|
31
|
+
export declare class ViewContainerElement extends ViewElement {
|
|
31
32
|
/**
|
|
32
33
|
* Creates a container element.
|
|
33
34
|
*
|
|
34
|
-
* @see module:engine/view/downcastwriter~
|
|
35
|
-
* @see module:engine/view/element~
|
|
35
|
+
* @see module:engine/view/downcastwriter~ViewDowncastWriter#createContainerElement
|
|
36
|
+
* @see module:engine/view/element~ViewElement
|
|
36
37
|
* @internal
|
|
37
38
|
* @param document The document instance to which this element belongs.
|
|
38
39
|
* @param name Node name.
|
|
39
40
|
* @param attrs Collection of attributes.
|
|
40
41
|
* @param children A list of nodes to be inserted into created element.
|
|
41
42
|
*/
|
|
42
|
-
constructor(document:
|
|
43
|
+
constructor(document: ViewDocument, name: string, attrs?: ViewElementAttributes, children?: ViewNode | Iterable<ViewNode>);
|
|
43
44
|
}
|
|
44
45
|
/**
|
|
45
46
|
* Returns block {@link module:engine/view/filler filler} offset or `null` if block filler is not needed.
|
|
46
47
|
*
|
|
47
48
|
* @returns Block filler offset or `null` if block filler is not needed.
|
|
48
49
|
*/
|
|
49
|
-
export declare function
|
|
50
|
+
export declare function getViewFillerOffset(this: ViewContainerElement): number | null;
|
|
@@ -5,32 +5,33 @@
|
|
|
5
5
|
/**
|
|
6
6
|
* @module engine/view/containerelement
|
|
7
7
|
*/
|
|
8
|
-
import
|
|
8
|
+
import { ViewElement } from './element.js';
|
|
9
9
|
/**
|
|
10
10
|
* Containers are elements which define document structure. They define boundaries for
|
|
11
|
-
* {@link module:engine/view/attributeelement~
|
|
11
|
+
* {@link module:engine/view/attributeelement~ViewAttributeElement attributes}.
|
|
12
|
+
* They are mostly used for block elements like `<p>` or `<div>`.
|
|
12
13
|
*
|
|
13
14
|
* Editing engine does not define a fixed HTML DTD. This is why a feature developer needs to choose between various
|
|
14
|
-
* types (container element, {@link module:engine/view/attributeelement~
|
|
15
|
-
* {@link module:engine/view/emptyelement~
|
|
15
|
+
* types (container element, {@link module:engine/view/attributeelement~ViewAttributeElement attribute element},
|
|
16
|
+
* {@link module:engine/view/emptyelement~ViewEmptyElement empty element}, etc) when developing a feature.
|
|
16
17
|
*
|
|
17
18
|
* The container element should be your default choice when writing a converter, unless:
|
|
18
19
|
*
|
|
19
|
-
* * this element represents a model text attribute (then use {@link module:engine/view/attributeelement~
|
|
20
|
-
* * this is an empty element like `<img>` (then use {@link module:engine/view/emptyelement~
|
|
20
|
+
* * this element represents a model text attribute (then use {@link module:engine/view/attributeelement~ViewAttributeElement}),
|
|
21
|
+
* * this is an empty element like `<img>` (then use {@link module:engine/view/emptyelement~ViewEmptyElement}),
|
|
21
22
|
* * this is a root element,
|
|
22
|
-
* * this is a nested editable element (then use {@link module:engine/view/editableelement~
|
|
23
|
+
* * this is a nested editable element (then use {@link module:engine/view/editableelement~ViewEditableElement}).
|
|
23
24
|
*
|
|
24
25
|
* To create a new container element instance use the
|
|
25
|
-
* {@link module:engine/view/downcastwriter~
|
|
26
|
+
* {@link module:engine/view/downcastwriter~ViewDowncastWriter#createContainerElement `ViewDowncastWriter#createContainerElement()`}
|
|
26
27
|
* method.
|
|
27
28
|
*/
|
|
28
|
-
export
|
|
29
|
+
export class ViewContainerElement extends ViewElement {
|
|
29
30
|
/**
|
|
30
31
|
* Creates a container element.
|
|
31
32
|
*
|
|
32
|
-
* @see module:engine/view/downcastwriter~
|
|
33
|
-
* @see module:engine/view/element~
|
|
33
|
+
* @see module:engine/view/downcastwriter~ViewDowncastWriter#createContainerElement
|
|
34
|
+
* @see module:engine/view/element~ViewElement
|
|
34
35
|
* @internal
|
|
35
36
|
* @param document The document instance to which this element belongs.
|
|
36
37
|
* @param name Node name.
|
|
@@ -39,12 +40,12 @@ export default class ContainerElement extends Element {
|
|
|
39
40
|
*/
|
|
40
41
|
constructor(document, name, attrs, children) {
|
|
41
42
|
super(document, name, attrs, children);
|
|
42
|
-
this.getFillerOffset =
|
|
43
|
+
this.getFillerOffset = getViewFillerOffset;
|
|
43
44
|
}
|
|
44
45
|
}
|
|
45
46
|
// The magic of type inference using `is` method is centralized in `TypeCheckable` class.
|
|
46
47
|
// Proper overload would interfere with that.
|
|
47
|
-
|
|
48
|
+
ViewContainerElement.prototype.is = function (type, name) {
|
|
48
49
|
if (!name) {
|
|
49
50
|
return type === 'containerElement' || type === 'view:containerElement' ||
|
|
50
51
|
// From super.is(). This is highly utilised method and cannot call super. See ckeditor/ckeditor5#6529.
|
|
@@ -62,7 +63,7 @@ ContainerElement.prototype.is = function (type, name) {
|
|
|
62
63
|
*
|
|
63
64
|
* @returns Block filler offset or `null` if block filler is not needed.
|
|
64
65
|
*/
|
|
65
|
-
export function
|
|
66
|
+
export function getViewFillerOffset() {
|
|
66
67
|
const children = [...this.getChildren()];
|
|
67
68
|
const lastChild = children[this.childCount - 1];
|
|
68
69
|
// Block filler is required after a `<br>` if it's the last element in its container. See #1422.
|
|
@@ -9,7 +9,7 @@ type DomDataTransfer = globalThis.DataTransfer;
|
|
|
9
9
|
/**
|
|
10
10
|
* A facade over the native [`DataTransfer`](https://developer.mozilla.org/en-US/docs/Web/API/DataTransfer) object.
|
|
11
11
|
*/
|
|
12
|
-
export
|
|
12
|
+
export declare class ViewDataTransfer {
|
|
13
13
|
/**
|
|
14
14
|
* The array of files created from the native `DataTransfer#files` or `DataTransfer#items`.
|
|
15
15
|
*/
|
|
@@ -52,13 +52,13 @@ export default class DataTransfer {
|
|
|
52
52
|
/**
|
|
53
53
|
* The effect that is allowed for a drag operation.
|
|
54
54
|
*/
|
|
55
|
-
set effectAllowed(value:
|
|
56
|
-
get effectAllowed():
|
|
55
|
+
set effectAllowed(value: ViewEffectAllowed);
|
|
56
|
+
get effectAllowed(): ViewEffectAllowed;
|
|
57
57
|
/**
|
|
58
58
|
* The actual drop effect.
|
|
59
59
|
*/
|
|
60
|
-
set dropEffect(value:
|
|
61
|
-
get dropEffect():
|
|
60
|
+
set dropEffect(value: ViewDropEffect);
|
|
61
|
+
get dropEffect(): ViewDropEffect;
|
|
62
62
|
/**
|
|
63
63
|
* Set a preview image of the dragged content.
|
|
64
64
|
*/
|
|
@@ -71,9 +71,9 @@ export default class DataTransfer {
|
|
|
71
71
|
/**
|
|
72
72
|
* The effect that is allowed for a drag operation.
|
|
73
73
|
*/
|
|
74
|
-
export type
|
|
74
|
+
export type ViewEffectAllowed = DomDataTransfer['effectAllowed'];
|
|
75
75
|
/**
|
|
76
76
|
* The actual drop effect.
|
|
77
77
|
*/
|
|
78
|
-
export type
|
|
78
|
+
export type ViewDropEffect = DomDataTransfer['dropEffect'];
|
|
79
79
|
export {};
|
package/src/view/datatransfer.js
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
/**
|
|
6
6
|
* A facade over the native [`DataTransfer`](https://developer.mozilla.org/en-US/docs/Web/API/DataTransfer) object.
|
|
7
7
|
*/
|
|
8
|
-
export
|
|
8
|
+
export class ViewDataTransfer {
|
|
9
9
|
/**
|
|
10
10
|
* The array of files created from the native `DataTransfer#files` or `DataTransfer#items`.
|
|
11
11
|
*/
|
package/src/view/document.d.ts
CHANGED
|
@@ -5,33 +5,33 @@
|
|
|
5
5
|
/**
|
|
6
6
|
* @module engine/view/document
|
|
7
7
|
*/
|
|
8
|
-
import
|
|
8
|
+
import { ViewDocumentSelection } from './documentselection.js';
|
|
9
9
|
import { Collection } from '@ckeditor/ckeditor5-utils';
|
|
10
10
|
import type { StylesProcessor } from './stylesmap.js';
|
|
11
|
-
import type
|
|
12
|
-
import type
|
|
13
|
-
declare const
|
|
11
|
+
import { type ViewRootEditableElement } from './rooteditableelement.js';
|
|
12
|
+
import { type ViewDowncastWriter } from './downcastwriter.js';
|
|
13
|
+
declare const ViewDocument_base: import("@ckeditor/ckeditor5-utils").Mixed<{
|
|
14
14
|
new (): import("@ckeditor/ckeditor5-utils").Observable;
|
|
15
15
|
prototype: import("@ckeditor/ckeditor5-utils").Observable;
|
|
16
16
|
}, import("@ckeditor/ckeditor5-utils").Emitter>;
|
|
17
17
|
/**
|
|
18
18
|
* Document class creates an abstract layer over the content editable area, contains a tree of view elements and
|
|
19
|
-
* {@link module:engine/view/documentselection~
|
|
19
|
+
* {@link module:engine/view/documentselection~ViewDocumentSelection view selection} associated with this document.
|
|
20
20
|
*/
|
|
21
|
-
export
|
|
21
|
+
export declare class ViewDocument extends /* #__PURE__ */ ViewDocument_base {
|
|
22
22
|
/**
|
|
23
23
|
* Selection done on this document.
|
|
24
24
|
*/
|
|
25
|
-
readonly selection:
|
|
25
|
+
readonly selection: ViewDocumentSelection;
|
|
26
26
|
/**
|
|
27
|
-
* Roots of the view tree. Collection of the {@link module:engine/view/element~
|
|
27
|
+
* Roots of the view tree. Collection of the {@link module:engine/view/element~ViewElement view elements}.
|
|
28
28
|
*
|
|
29
|
-
* View roots are created as a result of binding between {@link module:engine/view/document~
|
|
30
|
-
* {@link module:engine/model/document~
|
|
29
|
+
* View roots are created as a result of binding between {@link module:engine/view/document~ViewDocument#roots} and
|
|
30
|
+
* {@link module:engine/model/document~ModelDocument#roots} and this is handled by
|
|
31
31
|
* {@link module:engine/controller/editingcontroller~EditingController}, so to create view root we need to create
|
|
32
|
-
* model root using {@link module:engine/model/document~
|
|
32
|
+
* model root using {@link module:engine/model/document~ModelDocument#createRoot}.
|
|
33
33
|
*/
|
|
34
|
-
readonly roots: Collection<
|
|
34
|
+
readonly roots: Collection<ViewRootEditableElement>;
|
|
35
35
|
/**
|
|
36
36
|
* The styles processor instance used by this document when normalizing styles.
|
|
37
37
|
*/
|
|
@@ -85,19 +85,19 @@ export default class Document extends /* #__PURE__ */ Document_base {
|
|
|
85
85
|
*/
|
|
86
86
|
constructor(stylesProcessor: StylesProcessor);
|
|
87
87
|
/**
|
|
88
|
-
* Gets a {@link module:engine/view/document~
|
|
88
|
+
* Gets a {@link module:engine/view/document~ViewDocument#roots view root element} with the specified name. If the name is not
|
|
89
89
|
* specific "main" root is returned.
|
|
90
90
|
*
|
|
91
91
|
* @param name Name of the root.
|
|
92
92
|
* @returns The view root element with the specified name or null when there is no root of given name.
|
|
93
93
|
*/
|
|
94
|
-
getRoot(name?: string):
|
|
94
|
+
getRoot(name?: string): ViewRootEditableElement | null;
|
|
95
95
|
/**
|
|
96
96
|
* Allows registering post-fixer callbacks. A post-fixers mechanism allows to update the view tree just before it is rendered
|
|
97
97
|
* to the DOM.
|
|
98
98
|
*
|
|
99
99
|
* Post-fixers are executed right after all changes from the outermost change block were applied but
|
|
100
|
-
* before the {@link module:engine/view/view~
|
|
100
|
+
* before the {@link module:engine/view/view~EditingView#event:render render event} is fired. If a post-fixer callback made
|
|
101
101
|
* a change, it should return `true`. When this happens, all post-fixers are fired again to check if something else should
|
|
102
102
|
* not be fixed in the new document tree state.
|
|
103
103
|
*
|
|
@@ -107,7 +107,7 @@ export default class Document extends /* #__PURE__ */ Document_base {
|
|
|
107
107
|
* The types of changes which should be safe:
|
|
108
108
|
*
|
|
109
109
|
* * adding or removing attribute from elements,
|
|
110
|
-
* * changes inside of {@link module:engine/view/uielement~
|
|
110
|
+
* * changes inside of {@link module:engine/view/uielement~ViewUIElement UI elements},
|
|
111
111
|
* * {@link module:engine/controller/editingcontroller~EditingController#reconvertItem marking some of the model elements to be
|
|
112
112
|
* re-converted}.
|
|
113
113
|
*
|
|
@@ -116,7 +116,7 @@ export default class Document extends /* #__PURE__ */ Document_base {
|
|
|
116
116
|
* * you should not add or remove nor wrap or unwrap any view elements,
|
|
117
117
|
* * you should not change the editor data model in a view post-fixer.
|
|
118
118
|
*
|
|
119
|
-
* As a parameter, a post-fixer callback receives a {@link module:engine/view/downcastwriter~
|
|
119
|
+
* As a parameter, a post-fixer callback receives a {@link module:engine/view/downcastwriter~ViewDowncastWriter downcast writer}.
|
|
120
120
|
*
|
|
121
121
|
* Typically, a post-fixer will look like this:
|
|
122
122
|
*
|
|
@@ -137,10 +137,10 @@ export default class Document extends /* #__PURE__ */ Document_base {
|
|
|
137
137
|
* That is because adding a post-fixer does not execute it.
|
|
138
138
|
* The post-fixer will be executed as soon as any change in the document needs to cause its rendering.
|
|
139
139
|
* If you want to re-render the editor's view after registering the post-fixer then you should do it manually by calling
|
|
140
|
-
* {@link module:engine/view/view~
|
|
140
|
+
* {@link module:engine/view/view~EditingView#forceRender `view.forceRender()`}.
|
|
141
141
|
*
|
|
142
142
|
* If you need to register a callback which is executed when DOM elements are already updated,
|
|
143
|
-
* use {@link module:engine/view/view~
|
|
143
|
+
* use {@link module:engine/view/view~EditingView#event:render render event}.
|
|
144
144
|
*/
|
|
145
145
|
registerPostFixer(postFixer: ViewDocumentPostFixer): void;
|
|
146
146
|
/**
|
|
@@ -152,14 +152,14 @@ export default class Document extends /* #__PURE__ */ Document_base {
|
|
|
152
152
|
*
|
|
153
153
|
* @internal
|
|
154
154
|
*/
|
|
155
|
-
_callPostFixers(writer:
|
|
155
|
+
_callPostFixers(writer: ViewDowncastWriter): void;
|
|
156
156
|
}
|
|
157
157
|
/**
|
|
158
158
|
* Document PostFixer.
|
|
159
159
|
*
|
|
160
|
-
* @see module:engine/view/document~
|
|
160
|
+
* @see module:engine/view/document~ViewDocument#registerPostFixer
|
|
161
161
|
*/
|
|
162
|
-
export type ViewDocumentPostFixer = (writer:
|
|
162
|
+
export type ViewDocumentPostFixer = (writer: ViewDowncastWriter) => boolean;
|
|
163
163
|
/**
|
|
164
164
|
* Enum representing type of the change.
|
|
165
165
|
*
|
|
@@ -169,13 +169,13 @@ export type ViewDocumentPostFixer = (writer: DowncastWriter) => boolean;
|
|
|
169
169
|
* * `attributes` - for element attributes changes,
|
|
170
170
|
* * `text` - for text nodes changes.
|
|
171
171
|
*/
|
|
172
|
-
export type
|
|
172
|
+
export type ViewDocumentChangeType = 'children' | 'attributes' | 'text';
|
|
173
173
|
/**
|
|
174
174
|
* Event fired whenever document content layout changes. It is fired whenever content is
|
|
175
|
-
* {@link module:engine/view/view~
|
|
175
|
+
* {@link module:engine/view/view~EditingView#event:render rendered}, but should be also fired by observers in case of
|
|
176
176
|
* other actions which may change layout, for instance when image loads.
|
|
177
177
|
*
|
|
178
|
-
* @eventName ~
|
|
178
|
+
* @eventName ~ViewDocument#layoutChanged
|
|
179
179
|
*/
|
|
180
180
|
export type ViewDocumentLayoutChangedEvent = {
|
|
181
181
|
name: 'layoutChanged';
|