@ckeditor/ckeditor5-engine 35.4.0 → 36.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +1 -1
- package/package.json +22 -22
- package/src/controller/datacontroller.js +5 -1
- package/src/controller/editingcontroller.js +1 -1
- package/src/conversion/conversion.js +1 -1
- package/src/conversion/conversionhelpers.js +1 -1
- package/src/conversion/downcastdispatcher.js +1 -1
- package/src/conversion/downcasthelpers.js +1 -1
- package/src/conversion/mapper.js +1 -1
- package/src/conversion/modelconsumable.js +1 -1
- package/src/conversion/upcastdispatcher.js +1 -1
- package/src/conversion/upcasthelpers.js +8 -1
- package/src/conversion/viewconsumable.js +1 -1
- package/src/dataprocessor/basichtmlwriter.js +1 -1
- package/src/dataprocessor/dataprocessor.js +1 -1
- package/src/dataprocessor/htmldataprocessor.js +1 -2
- package/src/dataprocessor/htmlwriter.js +1 -1
- package/src/dataprocessor/xmldataprocessor.js +1 -1
- package/src/dev-utils/model.js +1 -1
- package/src/dev-utils/operationreplayer.js +1 -1
- package/src/dev-utils/utils.js +1 -1
- package/src/dev-utils/view.js +1 -1
- package/src/index.js +3 -2
- package/src/model/batch.js +9 -46
- package/src/model/differ.js +81 -174
- package/src/model/document.js +36 -92
- package/src/model/documentfragment.js +43 -96
- package/src/model/documentselection.js +151 -245
- package/src/model/element.js +47 -100
- package/src/model/history.js +15 -46
- package/src/model/item.js +1 -1
- package/src/model/liveposition.js +10 -36
- package/src/model/liverange.js +13 -36
- package/src/model/markercollection.js +40 -111
- package/src/model/model.js +212 -289
- package/src/model/node.js +35 -125
- package/src/model/nodelist.js +11 -39
- package/src/model/operation/attributeoperation.js +13 -44
- package/src/model/operation/detachoperation.js +3 -16
- package/src/model/operation/insertoperation.js +6 -34
- package/src/model/operation/markeroperation.js +9 -48
- package/src/model/operation/mergeoperation.js +8 -41
- package/src/model/operation/moveoperation.js +14 -37
- package/src/model/operation/nooperation.js +1 -7
- package/src/model/operation/operation.js +5 -63
- package/src/model/operation/operationfactory.js +3 -6
- package/src/model/operation/renameoperation.js +8 -28
- package/src/model/operation/rootattributeoperation.js +18 -47
- package/src/model/operation/splitoperation.js +9 -47
- package/src/model/operation/transform.js +109 -150
- package/src/model/operation/utils.js +36 -50
- package/src/model/position.js +117 -228
- package/src/model/range.js +145 -200
- package/src/model/rootelement.js +8 -47
- package/src/model/schema.js +236 -272
- package/src/model/selection.js +134 -192
- package/src/model/text.js +10 -37
- package/src/model/textproxy.js +15 -69
- package/src/model/treewalker.js +10 -101
- package/src/model/typecheckable.js +1 -1
- package/src/model/utils/autoparagraphing.js +11 -12
- package/src/model/utils/deletecontent.js +93 -62
- package/src/model/utils/findoptimalinsertionrange.js +24 -24
- package/src/model/utils/getselectedcontent.js +3 -6
- package/src/model/utils/insertcontent.js +36 -129
- package/src/model/utils/insertobject.js +19 -21
- package/src/model/utils/modifyselection.js +23 -33
- package/src/model/utils/selection-post-fixer.js +53 -59
- package/src/model/writer.js +208 -314
- package/src/view/attributeelement.js +1 -1
- package/src/view/containerelement.js +1 -1
- package/src/view/datatransfer.js +25 -28
- package/src/view/document.js +1 -17
- package/src/view/documentfragment.js +49 -1
- package/src/view/documentselection.js +1 -1
- package/src/view/domconverter.js +4 -3
- package/src/view/downcastwriter.js +1 -1
- package/src/view/editableelement.js +1 -1
- package/src/view/element.js +5 -5
- package/src/view/elementdefinition.js +1 -1
- package/src/view/emptyelement.js +1 -1
- package/src/view/filler.js +1 -1
- package/src/view/item.js +1 -1
- package/src/view/matcher.js +1 -1
- package/src/view/node.js +1 -1
- package/src/view/observer/arrowkeysobserver.js +1 -1
- package/src/view/observer/bubblingemittermixin.js +1 -1
- package/src/view/observer/bubblingeventinfo.js +1 -1
- package/src/view/observer/clickobserver.js +1 -1
- package/src/view/observer/compositionobserver.js +1 -1
- package/src/view/observer/domeventdata.js +1 -1
- package/src/view/observer/domeventobserver.js +1 -1
- package/src/view/observer/fakeselectionobserver.js +1 -1
- package/src/view/observer/focusobserver.js +22 -4
- package/src/view/observer/inputobserver.js +1 -1
- package/src/view/observer/keyobserver.js +1 -1
- package/src/view/observer/mouseobserver.js +1 -1
- package/src/view/observer/mutationobserver.js +1 -1
- package/src/view/observer/observer.js +1 -1
- package/src/view/observer/selectionobserver.js +13 -2
- package/src/view/observer/tabobserver.js +1 -1
- package/src/view/placeholder.js +1 -1
- package/src/view/position.js +1 -1
- package/src/view/range.js +1 -1
- package/src/view/rawelement.js +1 -1
- package/src/view/renderer.js +1 -14
- package/src/view/rooteditableelement.js +1 -1
- package/src/view/selection.js +1 -1
- package/src/view/styles/background.js +1 -1
- package/src/view/styles/border.js +1 -1
- package/src/view/styles/margin.js +1 -1
- package/src/view/styles/padding.js +1 -1
- package/src/view/styles/utils.js +1 -1
- package/src/view/stylesmap.js +1 -1
- package/src/view/text.js +1 -1
- package/src/view/textproxy.js +1 -1
- package/src/view/treewalker.js +1 -1
- package/src/view/typecheckable.js +1 -1
- package/src/view/uielement.js +1 -1
- package/src/view/upcastwriter.js +1 -1
- package/src/view/view.js +5 -5
- package/theme/placeholder.css +1 -1
- package/theme/renderer.css +1 -1
package/src/model/rootelement.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Copyright (c) 2003-
|
|
2
|
+
* @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
3
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
4
|
*/
|
|
5
5
|
/**
|
|
@@ -8,76 +8,37 @@
|
|
|
8
8
|
import Element from './element';
|
|
9
9
|
/**
|
|
10
10
|
* Type of {@link module:engine/model/element~Element} that is a root of a model tree.
|
|
11
|
-
* @extends module:engine/model/element~Element
|
|
12
11
|
*/
|
|
13
12
|
export default class RootElement extends Element {
|
|
14
13
|
/**
|
|
15
14
|
* Creates root element.
|
|
16
15
|
*
|
|
17
|
-
* @param
|
|
18
|
-
* @param
|
|
19
|
-
* @param
|
|
20
|
-
* element by {@link module:engine/model/document~Document}.
|
|
16
|
+
* @param document Document that is an owner of this root.
|
|
17
|
+
* @param name Node name.
|
|
18
|
+
* @param rootName Unique root name used to identify this root element by {@link module:engine/model/document~Document}.
|
|
21
19
|
*/
|
|
22
20
|
constructor(document, name, rootName = 'main') {
|
|
23
21
|
super(name);
|
|
24
|
-
/**
|
|
25
|
-
* Document that is an owner of this root.
|
|
26
|
-
*
|
|
27
|
-
* @private
|
|
28
|
-
* @member {module:engine/model/document~Document}
|
|
29
|
-
*/
|
|
30
22
|
this._document = document;
|
|
31
|
-
/**
|
|
32
|
-
* Unique root name used to identify this root element by {@link module:engine/model/document~Document}.
|
|
33
|
-
*
|
|
34
|
-
* @readonly
|
|
35
|
-
* @member {String}
|
|
36
|
-
*/
|
|
37
23
|
this.rootName = rootName;
|
|
38
24
|
}
|
|
39
25
|
/**
|
|
40
26
|
* {@link module:engine/model/document~Document Document} that owns this root element.
|
|
41
|
-
*
|
|
42
|
-
* @readonly
|
|
43
|
-
* @type {module:engine/model/document~Document|null}
|
|
44
27
|
*/
|
|
45
28
|
get document() {
|
|
46
29
|
return this._document;
|
|
47
30
|
}
|
|
48
31
|
/**
|
|
49
|
-
* Converts `RootElement` instance to `
|
|
32
|
+
* Converts `RootElement` instance to `string` containing it's name.
|
|
50
33
|
*
|
|
51
|
-
* @returns
|
|
34
|
+
* @returns `RootElement` instance converted to `string`.
|
|
52
35
|
*/
|
|
53
36
|
toJSON() {
|
|
54
37
|
return this.rootName;
|
|
55
38
|
}
|
|
56
39
|
}
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
*
|
|
60
|
-
* rootElement.is( 'rootElement' ); // -> true
|
|
61
|
-
* rootElement.is( 'element' ); // -> true
|
|
62
|
-
* rootElement.is( 'node' ); // -> true
|
|
63
|
-
* rootElement.is( 'model:rootElement' ); // -> true
|
|
64
|
-
* rootElement.is( 'model:element' ); // -> true
|
|
65
|
-
* rootElement.is( 'model:node' ); // -> true
|
|
66
|
-
*
|
|
67
|
-
* rootElement.is( 'view:element' ); // -> false
|
|
68
|
-
* rootElement.is( 'documentFragment' ); // -> false
|
|
69
|
-
*
|
|
70
|
-
* Assuming that the object being checked is an element, you can also check its
|
|
71
|
-
* {@link module:engine/model/element~Element#name name}:
|
|
72
|
-
*
|
|
73
|
-
* rootElement.is( 'rootElement', '$root' ); // -> same as above
|
|
74
|
-
*
|
|
75
|
-
* {@link module:engine/model/node~Node#is Check the entire list of model objects} which implement the `is()` method.
|
|
76
|
-
*
|
|
77
|
-
* @param {String} type Type to check.
|
|
78
|
-
* @param {String} [name] Element name.
|
|
79
|
-
* @returns {Boolean}
|
|
80
|
-
*/
|
|
40
|
+
// The magic of type inference using `is` method is centralized in `TypeCheckable` class.
|
|
41
|
+
// Proper overload would interfere with that.
|
|
81
42
|
RootElement.prototype.is = function (type, name) {
|
|
82
43
|
if (!name) {
|
|
83
44
|
return type === 'rootElement' || type === 'model:rootElement' ||
|