@ckeditor/ckeditor5-engine 29.2.0 → 32.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +2 -2
- package/package.json +25 -23
- package/src/controller/datacontroller.js +60 -12
- 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 +1 -1
- package/src/conversion/viewconsumable.js +1 -1
- package/src/dataprocessor/basichtmlwriter.js +1 -1
- package/src/dataprocessor/dataprocessor.jsdoc +1 -1
- package/src/dataprocessor/htmldataprocessor.js +18 -43
- package/src/dataprocessor/htmlwriter.js +1 -1
- package/src/dataprocessor/xmldataprocessor.js +13 -17
- package/src/dev-utils/model.js +3 -3
- package/src/dev-utils/operationreplayer.js +1 -1
- package/src/dev-utils/utils.js +1 -1
- package/src/dev-utils/view.js +22 -4
- package/src/index.js +1 -1
- package/src/model/batch.js +77 -10
- package/src/model/differ.js +1 -1
- package/src/model/document.js +1 -1
- package/src/model/documentfragment.js +1 -1
- package/src/model/documentselection.js +1 -1
- package/src/model/element.js +1 -1
- package/src/model/history.js +1 -1
- package/src/model/item.jsdoc +1 -1
- package/src/model/liveposition.js +1 -1
- package/src/model/liverange.js +1 -1
- package/src/model/markercollection.js +6 -5
- package/src/model/model.js +17 -9
- package/src/model/node.js +1 -1
- package/src/model/nodelist.js +1 -1
- package/src/model/operation/attributeoperation.js +1 -1
- package/src/model/operation/detachoperation.js +1 -1
- package/src/model/operation/insertoperation.js +1 -1
- package/src/model/operation/markeroperation.js +1 -1
- package/src/model/operation/mergeoperation.js +1 -1
- package/src/model/operation/moveoperation.js +1 -1
- package/src/model/operation/nooperation.js +1 -1
- package/src/model/operation/operation.js +1 -1
- package/src/model/operation/operationfactory.js +1 -1
- package/src/model/operation/renameoperation.js +1 -1
- package/src/model/operation/rootattributeoperation.js +1 -1
- package/src/model/operation/splitoperation.js +1 -1
- package/src/model/operation/transform.js +1 -1
- package/src/model/operation/utils.js +1 -1
- package/src/model/position.js +1 -1
- package/src/model/range.js +2 -2
- package/src/model/rootelement.js +1 -1
- package/src/model/schema.js +1 -1
- package/src/model/selection.js +1 -1
- package/src/model/text.js +1 -1
- package/src/model/textproxy.js +1 -1
- package/src/model/treewalker.js +1 -1
- package/src/model/utils/autoparagraphing.js +1 -1
- package/src/model/utils/deletecontent.js +1 -1
- package/src/model/utils/getselectedcontent.js +1 -1
- package/src/model/utils/insertcontent.js +1 -1
- package/src/model/utils/modifyselection.js +1 -1
- package/src/model/utils/selection-post-fixer.js +44 -29
- package/src/model/writer.js +1 -1
- package/src/view/attributeelement.js +1 -1
- package/src/view/containerelement.js +1 -1
- package/src/view/document.js +13 -1
- package/src/view/documentfragment.js +1 -1
- package/src/view/documentselection.js +1 -1
- package/src/view/domconverter.js +268 -24
- package/src/view/downcastwriter.js +33 -2
- package/src/view/editableelement.js +1 -1
- package/src/view/element.js +29 -1
- package/src/view/elementdefinition.jsdoc +1 -1
- package/src/view/emptyelement.js +1 -1
- package/src/view/filler.js +1 -1
- package/src/view/item.jsdoc +1 -1
- package/src/view/matcher.js +22 -17
- 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 +1 -1
- 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 +49 -2
- 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 +4 -3
- package/src/view/renderer.js +94 -40
- 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 +6 -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/uielement.js +6 -3
- package/src/view/upcastwriter.js +1 -1
- package/src/view/view.js +2 -2
- package/theme/placeholder.css +1 -1
- package/theme/renderer.css +9 -0
- package/CHANGELOG.md +0 -823
package/src/dev-utils/view.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Copyright (c) 2003-
|
|
2
|
+
* @license Copyright (c) 2003-2022, 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
|
|
|
@@ -39,6 +39,13 @@ const allowedTypes = {
|
|
|
39
39
|
'ui': UIElement,
|
|
40
40
|
'raw': RawElement
|
|
41
41
|
};
|
|
42
|
+
// Returns simplified implementation of {@link module:engine/view/domconverter~DomConverter#setContentOf DomConverter.setContentOf} method.
|
|
43
|
+
// Used to render UIElement and RawElement.
|
|
44
|
+
const domConverterStub = {
|
|
45
|
+
setContentOf: ( node, html ) => {
|
|
46
|
+
node.innerHTML = html;
|
|
47
|
+
}
|
|
48
|
+
};
|
|
42
49
|
|
|
43
50
|
/**
|
|
44
51
|
* Writes the content of the {@link module:engine/view/document~Document document} to an HTML-like string.
|
|
@@ -59,6 +66,9 @@ const allowedTypes = {
|
|
|
59
66
|
* {@link module:engine/view/uielement~UIElement} will be printed.
|
|
60
67
|
* @param {Boolean} [options.renderRawElements=false] When set to `true`, the inner content of each
|
|
61
68
|
* {@link module:engine/view/rawelement~RawElement} will be printed.
|
|
69
|
+
* @param {Object} [options.domConverter=null] When set to an actual {@link module:engine/view/domconverter~DomConverter DomConverter}
|
|
70
|
+
* instance, it lets the conversion go through exactly the same flow the editing view is going through,
|
|
71
|
+
* i.e. with view data filtering. Otherwise the simple stub is used.
|
|
62
72
|
* @returns {String} The stringified data.
|
|
63
73
|
*/
|
|
64
74
|
export function getData( view, options = {} ) {
|
|
@@ -75,7 +85,8 @@ export function getData( view, options = {} ) {
|
|
|
75
85
|
showPriority: options.showPriority,
|
|
76
86
|
renderUIElements: options.renderUIElements,
|
|
77
87
|
renderRawElements: options.renderRawElements,
|
|
78
|
-
ignoreRoot: true
|
|
88
|
+
ignoreRoot: true,
|
|
89
|
+
domConverter: options.domConverter
|
|
79
90
|
};
|
|
80
91
|
|
|
81
92
|
return withoutSelection ?
|
|
@@ -241,6 +252,9 @@ setData._parse = parse;
|
|
|
241
252
|
* {@link module:engine/view/uielement~UIElement} will be printed.
|
|
242
253
|
* @param {Boolean} [options.renderRawElements=false] When set to `true`, the inner content of each
|
|
243
254
|
* {@link module:engine/view/rawelement~RawElement} will be printed.
|
|
255
|
+
* @param {Object} [options.domConverter={}] When set to an actual {@link module:engine/view/domconverter~DomConverter DomConverter}
|
|
256
|
+
* instance, it lets the conversion go through exactly the same flow the editing view is going through,
|
|
257
|
+
* i.e. with view data filtering. Otherwise the simple stub is used.
|
|
244
258
|
* @returns {String} An HTML-like string representing the view.
|
|
245
259
|
*/
|
|
246
260
|
export function stringify( node, selectionOrPositionOrRange = null, options = {} ) {
|
|
@@ -630,6 +644,9 @@ class ViewStringify {
|
|
|
630
644
|
* @param {Boolean} [options.renderUIElements=false] When set to `true`, the inner content of each
|
|
631
645
|
* {@link module:engine/view/uielement~UIElement} will be printed.
|
|
632
646
|
* @param {Boolean} [options.renderRawElements=false] When set to `true`, the inner content of each
|
|
647
|
+
* @param {Object} [options.domConverter={}] When set to an actual {@link module:engine/view/domconverter~DomConverter DomConverter}
|
|
648
|
+
* instance, it lets the conversion go through exactly the same flow the editing view is going through,
|
|
649
|
+
* i.e. with view data filtering. Otherwise the simple stub is used.
|
|
633
650
|
* {@link module:engine/view/rawelement~RawElement} will be printed.
|
|
634
651
|
*/
|
|
635
652
|
constructor( root, selection, options ) {
|
|
@@ -648,6 +665,7 @@ class ViewStringify {
|
|
|
648
665
|
this.sameSelectionCharacters = !!options.sameSelectionCharacters;
|
|
649
666
|
this.renderUIElements = !!options.renderUIElements;
|
|
650
667
|
this.renderRawElements = !!options.renderRawElements;
|
|
668
|
+
this.domConverter = options.domConverter || domConverterStub;
|
|
651
669
|
}
|
|
652
670
|
|
|
653
671
|
/**
|
|
@@ -681,12 +699,12 @@ class ViewStringify {
|
|
|
681
699
|
}
|
|
682
700
|
|
|
683
701
|
if ( ( this.renderUIElements && root.is( 'uiElement' ) ) ) {
|
|
684
|
-
callback( root.render( document ).innerHTML );
|
|
702
|
+
callback( root.render( document, this.domConverter ).innerHTML );
|
|
685
703
|
} else if ( this.renderRawElements && root.is( 'rawElement' ) ) {
|
|
686
704
|
// There's no DOM element for "root" to pass to render(). Creating
|
|
687
705
|
// a surrogate container to render the children instead.
|
|
688
706
|
const rawContentContainer = document.createElement( 'div' );
|
|
689
|
-
root.render( rawContentContainer );
|
|
707
|
+
root.render( rawContentContainer, this.domConverter );
|
|
690
708
|
|
|
691
709
|
callback( rawContentContainer.innerHTML );
|
|
692
710
|
} else {
|
package/src/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Copyright (c) 2003-
|
|
2
|
+
* @license Copyright (c) 2003-2022, 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
|
|
package/src/model/batch.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Copyright (c) 2003-
|
|
2
|
+
* @license Copyright (c) 2003-2022, 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
|
|
|
@@ -7,6 +7,8 @@
|
|
|
7
7
|
* @module engine/model/batch
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
+
import { logWarning } from '@ckeditor/ckeditor5-utils/src/ckeditorerror';
|
|
11
|
+
|
|
10
12
|
/**
|
|
11
13
|
* A batch instance groups model changes ({@link module:engine/model/operation/operation~Operation operations}). All operations
|
|
12
14
|
* grouped in a single batch can be reverted together, so you can also think about a batch as of a single undo step. If you want
|
|
@@ -25,9 +27,30 @@ export default class Batch {
|
|
|
25
27
|
*
|
|
26
28
|
* @see module:engine/model/model~Model#enqueueChange
|
|
27
29
|
* @see module:engine/model/model~Model#change
|
|
28
|
-
* @param {
|
|
30
|
+
* @param {Object} [type] Set of flags that specifies the type of the batch. Batch type can alter how some of the features work when
|
|
31
|
+
* encountering given `Batch` instance (for example, when a feature listens to applied operations).
|
|
32
|
+
* @param {Boolean} [type.isUndoable=true] Whether batch can be undone through undo feature.
|
|
33
|
+
* @param {Boolean} [type.isLocal=true] Whether batch includes operations created locally (`true`) or operations created on
|
|
34
|
+
* other, remote editors (`false`).
|
|
35
|
+
* @param {Boolean} [type.isUndo=false] Whether batch was created by the undo feature and undoes other operations.
|
|
36
|
+
* @param {Boolean} [type.isTyping=false] Whether batch includes operations connected with typing action.
|
|
29
37
|
*/
|
|
30
|
-
constructor( type =
|
|
38
|
+
constructor( type = {} ) {
|
|
39
|
+
if ( typeof type === 'string' ) {
|
|
40
|
+
type = type === 'transparent' ? { isUndoable: false } : {};
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* The string value for `type` property of the `Batch` constructor has been deprecated and will be removed in the near future.
|
|
44
|
+
* Please refer to the {@link module:engine/model/batch~Batch#constructor `Batch` constructor API documentation} for more
|
|
45
|
+
* information.
|
|
46
|
+
*
|
|
47
|
+
* @error batch-constructor-deprecated-string-type
|
|
48
|
+
*/
|
|
49
|
+
logWarning( 'batch-constructor-deprecated-string-type' );
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
const { isUndoable = true, isLocal = true, isUndo = false, isTyping = false } = type;
|
|
53
|
+
|
|
31
54
|
/**
|
|
32
55
|
* An array of operations that compose this batch.
|
|
33
56
|
*
|
|
@@ -37,17 +60,61 @@ export default class Batch {
|
|
|
37
60
|
this.operations = [];
|
|
38
61
|
|
|
39
62
|
/**
|
|
40
|
-
*
|
|
63
|
+
* Whether batch can be undone through the undo feature.
|
|
64
|
+
*
|
|
65
|
+
* @readonly
|
|
66
|
+
* @type {Boolean}
|
|
67
|
+
*/
|
|
68
|
+
this.isUndoable = isUndoable;
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Whether batch includes operations created locally (`true`) or operations created on other, remote editors (`false`).
|
|
72
|
+
*
|
|
73
|
+
* @readonly
|
|
74
|
+
* @type {Boolean}
|
|
75
|
+
*/
|
|
76
|
+
this.isLocal = isLocal;
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Whether batch was created by the undo feature and undoes other operations.
|
|
41
80
|
*
|
|
42
|
-
*
|
|
43
|
-
*
|
|
44
|
-
|
|
45
|
-
|
|
81
|
+
* @readonly
|
|
82
|
+
* @type {Boolean}
|
|
83
|
+
*/
|
|
84
|
+
this.isUndo = isUndo;
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* Whether batch includes operations connected with typing.
|
|
46
88
|
*
|
|
47
89
|
* @readonly
|
|
48
|
-
* @type {
|
|
90
|
+
* @type {Boolean}
|
|
49
91
|
*/
|
|
50
|
-
this.
|
|
92
|
+
this.isTyping = isTyping;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* The type of the batch.
|
|
97
|
+
*
|
|
98
|
+
* **This property has been deprecated and is always set to `'default'` value.**
|
|
99
|
+
*
|
|
100
|
+
* It can be one of the following values:
|
|
101
|
+
* * `'default'` – All "normal" batches. This is the most commonly used type.
|
|
102
|
+
* * `'transparent'` – A batch that should be ignored by other features, i.e. an initial batch or collaborative editing
|
|
103
|
+
* changes.
|
|
104
|
+
*
|
|
105
|
+
* @deprecated
|
|
106
|
+
* @type {'default'}
|
|
107
|
+
*/
|
|
108
|
+
get type() {
|
|
109
|
+
/**
|
|
110
|
+
* The {@link module:engine/model/batch~Batch#type `Batch#type` } property has been deprecated and will be removed in the near
|
|
111
|
+
* future. Use `Batch#isLocal`, `Batch#isUndoable`, `Batch#isUndo` and `Batch#isTyping` instead.
|
|
112
|
+
*
|
|
113
|
+
* @error batch-type-deprecated
|
|
114
|
+
*/
|
|
115
|
+
logWarning( 'batch-type-deprecated' );
|
|
116
|
+
|
|
117
|
+
return 'default';
|
|
51
118
|
}
|
|
52
119
|
|
|
53
120
|
/**
|
package/src/model/differ.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Copyright (c) 2003-
|
|
2
|
+
* @license Copyright (c) 2003-2022, 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
|
|
package/src/model/document.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Copyright (c) 2003-
|
|
2
|
+
* @license Copyright (c) 2003-2022, 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
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Copyright (c) 2003-
|
|
2
|
+
* @license Copyright (c) 2003-2022, 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
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Copyright (c) 2003-
|
|
2
|
+
* @license Copyright (c) 2003-2022, 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
|
|
package/src/model/element.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Copyright (c) 2003-
|
|
2
|
+
* @license Copyright (c) 2003-2022, 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
|
|
package/src/model/history.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Copyright (c) 2003-
|
|
2
|
+
* @license Copyright (c) 2003-2022, 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
|
|
package/src/model/item.jsdoc
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Copyright (c) 2003-
|
|
2
|
+
* @license Copyright (c) 2003-2022, 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
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Copyright (c) 2003-
|
|
2
|
+
* @license Copyright (c) 2003-2022, 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
|
|
package/src/model/liverange.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Copyright (c) 2003-
|
|
2
|
+
* @license Copyright (c) 2003-2022, 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
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Copyright (c) 2003-
|
|
2
|
+
* @license Copyright (c) 2003-2022, 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
|
|
|
@@ -52,12 +52,13 @@ export default class MarkerCollection {
|
|
|
52
52
|
}
|
|
53
53
|
|
|
54
54
|
/**
|
|
55
|
-
* Checks if marker
|
|
55
|
+
* Checks if given {@link ~Marker marker} or marker name is in the collection.
|
|
56
56
|
*
|
|
57
|
-
* @param {String}
|
|
58
|
-
* @returns {Boolean} `true` if marker
|
|
57
|
+
* @param {String|module:engine/model/markercollection~Marker} markerOrName Name of marker or marker instance to check.
|
|
58
|
+
* @returns {Boolean} `true` if marker is in the collection, `false` otherwise.
|
|
59
59
|
*/
|
|
60
|
-
has(
|
|
60
|
+
has( markerOrName ) {
|
|
61
|
+
const markerName = markerOrName instanceof Marker ? markerOrName.name : markerOrName;
|
|
61
62
|
return this._markers.has( markerName );
|
|
62
63
|
}
|
|
63
64
|
|
package/src/model/model.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Copyright (c) 2003-
|
|
2
|
+
* @license Copyright (c) 2003-2022, 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
|
|
|
@@ -214,8 +214,13 @@ export default class Model {
|
|
|
214
214
|
* done in the outer `change()` block.
|
|
215
215
|
*
|
|
216
216
|
* Second, it lets you define the {@link module:engine/model/batch~Batch} into which you want to add your changes.
|
|
217
|
-
* By default, a new batch
|
|
218
|
-
*
|
|
217
|
+
* By default, a new batch with the default {@link module:engine/model/batch~Batch#constructor batch type} is created.
|
|
218
|
+
* In the sample above, `change` and `enqueueChange` blocks will use a different batch (and a different
|
|
219
|
+
* {@link module:engine/model/writer~Writer} instance since each of them operates on a separate batch).
|
|
220
|
+
*
|
|
221
|
+
* model.enqueueChange( { isUndoable: false }, writer => {
|
|
222
|
+
* writer.insertText( 'foo', paragraph, 'end' );
|
|
223
|
+
* } );
|
|
219
224
|
*
|
|
220
225
|
* When using the `enqueueChange()` block you can also add some changes to the batch you used before.
|
|
221
226
|
*
|
|
@@ -226,17 +231,20 @@ export default class Model {
|
|
|
226
231
|
* In order to make a nested `enqueueChange()` create a single undo step together with the changes done in the outer `change()`
|
|
227
232
|
* block, you can obtain the batch instance from the {@link module:engine/model/writer~Writer#batch writer} of the outer block.
|
|
228
233
|
*
|
|
229
|
-
* @param {module:engine/model/batch~Batch|
|
|
230
|
-
* If not defined, a new batch
|
|
234
|
+
* @param {module:engine/model/batch~Batch|Object} [batchOrType] A batch or a
|
|
235
|
+
* {@link module:engine/model/batch~Batch#constructor batch type} that should be used in the callback. If not defined, a new batch with
|
|
236
|
+
* the default type will be created.
|
|
231
237
|
* @param {Function} callback Callback function which may modify the model.
|
|
232
238
|
*/
|
|
233
239
|
enqueueChange( batchOrType, callback ) {
|
|
234
240
|
try {
|
|
235
|
-
if (
|
|
236
|
-
batchOrType = new Batch(
|
|
237
|
-
} else if ( typeof batchOrType
|
|
241
|
+
if ( !batchOrType ) {
|
|
242
|
+
batchOrType = new Batch();
|
|
243
|
+
} else if ( typeof batchOrType === 'function' ) {
|
|
238
244
|
callback = batchOrType;
|
|
239
245
|
batchOrType = new Batch();
|
|
246
|
+
} else if ( !( batchOrType instanceof Batch ) ) {
|
|
247
|
+
batchOrType = new Batch( batchOrType );
|
|
240
248
|
}
|
|
241
249
|
|
|
242
250
|
this._pendingChanges.push( { batch: batchOrType, callback } );
|
|
@@ -791,7 +799,7 @@ export default class Model {
|
|
|
791
799
|
* * {@link #change `change()`},
|
|
792
800
|
* * {@link #enqueueChange `enqueueChange()`}.
|
|
793
801
|
*
|
|
794
|
-
* @param {
|
|
802
|
+
* @param {Object} [type] {@link module:engine/model/batch~Batch#constructor The type} of the batch.
|
|
795
803
|
* @returns {module:engine/model/batch~Batch}
|
|
796
804
|
*/
|
|
797
805
|
createBatch( type ) {
|
package/src/model/node.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Copyright (c) 2003-
|
|
2
|
+
* @license Copyright (c) 2003-2022, 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
|
|
package/src/model/nodelist.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Copyright (c) 2003-
|
|
2
|
+
* @license Copyright (c) 2003-2022, 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
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Copyright (c) 2003-
|
|
2
|
+
* @license Copyright (c) 2003-2022, 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
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Copyright (c) 2003-
|
|
2
|
+
* @license Copyright (c) 2003-2022, 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
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Copyright (c) 2003-
|
|
2
|
+
* @license Copyright (c) 2003-2022, 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
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Copyright (c) 2003-
|
|
2
|
+
* @license Copyright (c) 2003-2022, 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
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Copyright (c) 2003-
|
|
2
|
+
* @license Copyright (c) 2003-2022, 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
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Copyright (c) 2003-
|
|
2
|
+
* @license Copyright (c) 2003-2022, 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
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Copyright (c) 2003-
|
|
2
|
+
* @license Copyright (c) 2003-2022, 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
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Copyright (c) 2003-
|
|
2
|
+
* @license Copyright (c) 2003-2022, 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
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Copyright (c) 2003-
|
|
2
|
+
* @license Copyright (c) 2003-2022, 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
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Copyright (c) 2003-
|
|
2
|
+
* @license Copyright (c) 2003-2022, 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
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Copyright (c) 2003-
|
|
2
|
+
* @license Copyright (c) 2003-2022, 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
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Copyright (c) 2003-
|
|
2
|
+
* @license Copyright (c) 2003-2022, 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
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Copyright (c) 2003-
|
|
2
|
+
* @license Copyright (c) 2003-2022, 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
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Copyright (c) 2003-
|
|
2
|
+
* @license Copyright (c) 2003-2022, 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
|
|
package/src/model/position.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Copyright (c) 2003-
|
|
2
|
+
* @license Copyright (c) 2003-2022, 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
|
|
package/src/model/range.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Copyright (c) 2003-
|
|
2
|
+
* @license Copyright (c) 2003-2022, 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
|
|
|
@@ -446,7 +446,7 @@ export default class Range {
|
|
|
446
446
|
* You may specify additional options for the tree walker. See {@link module:engine/model/treewalker~TreeWalker} for
|
|
447
447
|
* a full list of available options.
|
|
448
448
|
*
|
|
449
|
-
* @param {Object} options Object with configuration options. See {@link module:engine/model/treewalker~TreeWalker}.
|
|
449
|
+
* @param {Object} [options] Object with configuration options. See {@link module:engine/model/treewalker~TreeWalker}.
|
|
450
450
|
* @returns {Iterable.<module:engine/model/item~Item>}
|
|
451
451
|
*/
|
|
452
452
|
* getItems( options = {} ) {
|
package/src/model/rootelement.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Copyright (c) 2003-
|
|
2
|
+
* @license Copyright (c) 2003-2022, 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
|
|
package/src/model/schema.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Copyright (c) 2003-
|
|
2
|
+
* @license Copyright (c) 2003-2022, 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
|
|
package/src/model/selection.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Copyright (c) 2003-
|
|
2
|
+
* @license Copyright (c) 2003-2022, 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
|
|
package/src/model/text.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Copyright (c) 2003-
|
|
2
|
+
* @license Copyright (c) 2003-2022, 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
|
|
package/src/model/textproxy.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Copyright (c) 2003-
|
|
2
|
+
* @license Copyright (c) 2003-2022, 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
|
|
package/src/model/treewalker.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Copyright (c) 2003-
|
|
2
|
+
* @license Copyright (c) 2003-2022, 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
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Copyright (c) 2003-
|
|
2
|
+
* @license Copyright (c) 2003-2022, 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
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Copyright (c) 2003-
|
|
2
|
+
* @license Copyright (c) 2003-2022, 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
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Copyright (c) 2003-
|
|
2
|
+
* @license Copyright (c) 2003-2022, 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
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Copyright (c) 2003-
|
|
2
|
+
* @license Copyright (c) 2003-2022, 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
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Copyright (c) 2003-
|
|
2
|
+
* @license Copyright (c) 2003-2022, 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
|
|