@ckeditor/ckeditor5-engine 35.4.0 → 36.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 +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 +1 -1
- 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/LICENSE.md
CHANGED
|
@@ -2,7 +2,7 @@ Software License Agreement
|
|
|
2
2
|
==========================
|
|
3
3
|
|
|
4
4
|
**CKEditor 5 editing engine** – https://github.com/ckeditor/ckeditor5-engine <br>
|
|
5
|
-
Copyright (c) 2003-
|
|
5
|
+
Copyright (c) 2003-2023, [CKSource Holding sp. z o.o.](https://cksource.com) All rights reserved.
|
|
6
6
|
|
|
7
7
|
Licensed under the terms of [GNU General Public License Version 2 or later](http://www.gnu.org/licenses/gpl.html).
|
|
8
8
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ckeditor/ckeditor5-engine",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "36.0.0",
|
|
4
4
|
"description": "The editing engine of CKEditor 5 – the best browser-based rich text editor.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"wysiwyg",
|
|
@@ -23,30 +23,30 @@
|
|
|
23
23
|
],
|
|
24
24
|
"main": "src/index.js",
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@ckeditor/ckeditor5-utils": "^
|
|
26
|
+
"@ckeditor/ckeditor5-utils": "^36.0.0",
|
|
27
27
|
"lodash-es": "^4.17.15"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
|
-
"@ckeditor/ckeditor5-basic-styles": "^
|
|
31
|
-
"@ckeditor/ckeditor5-block-quote": "^
|
|
32
|
-
"@ckeditor/ckeditor5-clipboard": "^
|
|
33
|
-
"@ckeditor/ckeditor5-cloud-services": "^
|
|
34
|
-
"@ckeditor/ckeditor5-core": "^
|
|
35
|
-
"@ckeditor/ckeditor5-editor-classic": "^
|
|
36
|
-
"@ckeditor/ckeditor5-enter": "^
|
|
37
|
-
"@ckeditor/ckeditor5-essentials": "^
|
|
38
|
-
"@ckeditor/ckeditor5-heading": "^
|
|
39
|
-
"@ckeditor/ckeditor5-image": "^
|
|
40
|
-
"@ckeditor/ckeditor5-link": "^
|
|
41
|
-
"@ckeditor/ckeditor5-list": "^
|
|
42
|
-
"@ckeditor/ckeditor5-mention": "^
|
|
43
|
-
"@ckeditor/ckeditor5-paragraph": "^
|
|
44
|
-
"@ckeditor/ckeditor5-table": "^
|
|
45
|
-
"@ckeditor/ckeditor5-theme-lark": "^
|
|
46
|
-
"@ckeditor/ckeditor5-typing": "^
|
|
47
|
-
"@ckeditor/ckeditor5-ui": "^
|
|
48
|
-
"@ckeditor/ckeditor5-undo": "^
|
|
49
|
-
"@ckeditor/ckeditor5-widget": "^
|
|
30
|
+
"@ckeditor/ckeditor5-basic-styles": "^36.0.0",
|
|
31
|
+
"@ckeditor/ckeditor5-block-quote": "^36.0.0",
|
|
32
|
+
"@ckeditor/ckeditor5-clipboard": "^36.0.0",
|
|
33
|
+
"@ckeditor/ckeditor5-cloud-services": "^36.0.0",
|
|
34
|
+
"@ckeditor/ckeditor5-core": "^36.0.0",
|
|
35
|
+
"@ckeditor/ckeditor5-editor-classic": "^36.0.0",
|
|
36
|
+
"@ckeditor/ckeditor5-enter": "^36.0.0",
|
|
37
|
+
"@ckeditor/ckeditor5-essentials": "^36.0.0",
|
|
38
|
+
"@ckeditor/ckeditor5-heading": "^36.0.0",
|
|
39
|
+
"@ckeditor/ckeditor5-image": "^36.0.0",
|
|
40
|
+
"@ckeditor/ckeditor5-link": "^36.0.0",
|
|
41
|
+
"@ckeditor/ckeditor5-list": "^36.0.0",
|
|
42
|
+
"@ckeditor/ckeditor5-mention": "^36.0.0",
|
|
43
|
+
"@ckeditor/ckeditor5-paragraph": "^36.0.0",
|
|
44
|
+
"@ckeditor/ckeditor5-table": "^36.0.0",
|
|
45
|
+
"@ckeditor/ckeditor5-theme-lark": "^36.0.0",
|
|
46
|
+
"@ckeditor/ckeditor5-typing": "^36.0.0",
|
|
47
|
+
"@ckeditor/ckeditor5-ui": "^36.0.0",
|
|
48
|
+
"@ckeditor/ckeditor5-undo": "^36.0.0",
|
|
49
|
+
"@ckeditor/ckeditor5-widget": "^36.0.0",
|
|
50
50
|
"typescript": "^4.8.4",
|
|
51
51
|
"webpack": "^5.58.1",
|
|
52
52
|
"webpack-cli": "^4.9.0"
|
|
@@ -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
|
/**
|
|
@@ -128,6 +128,8 @@ export default class DataController extends EmitterMixin() {
|
|
|
128
128
|
ObservableMixin().prototype.decorate.call(this, 'init');
|
|
129
129
|
ObservableMixin().prototype.decorate.call(this, 'set');
|
|
130
130
|
ObservableMixin().prototype.decorate.call(this, 'get');
|
|
131
|
+
ObservableMixin().prototype.decorate.call(this, 'toView');
|
|
132
|
+
ObservableMixin().prototype.decorate.call(this, 'toModel');
|
|
131
133
|
// Fire the `ready` event when the initialization has completed. Such low-level listener offers the possibility
|
|
132
134
|
// to plug into the initialization pipeline without interrupting the initialization flow.
|
|
133
135
|
this.on('init', () => {
|
|
@@ -196,6 +198,7 @@ export default class DataController extends EmitterMixin() {
|
|
|
196
198
|
* converters attached to {@link #downcastDispatcher} into a
|
|
197
199
|
* {@link module:engine/view/documentfragment~DocumentFragment view document fragment}.
|
|
198
200
|
*
|
|
201
|
+
* @fires toView
|
|
199
202
|
* @param {module:engine/model/element~Element|module:engine/model/documentfragment~DocumentFragment} modelElementOrFragment
|
|
200
203
|
* Element or document fragment whose content will be converted.
|
|
201
204
|
* @param {Object} [options={}] Additional configuration that will be available through the
|
|
@@ -370,6 +373,7 @@ export default class DataController extends EmitterMixin() {
|
|
|
370
373
|
* When marker elements were converted during the conversion process, it will be set as a document fragment's
|
|
371
374
|
* {@link module:engine/model/documentfragment~DocumentFragment#markers static markers map}.
|
|
372
375
|
*
|
|
376
|
+
* @fires toModel
|
|
373
377
|
* @param {module:engine/view/element~Element|module:engine/view/documentfragment~DocumentFragment} viewElementOrFragment
|
|
374
378
|
* The element or document fragment whose content will be converted.
|
|
375
379
|
* @param {module:engine/model/schema~SchemaContextDefinition} [context='$root'] Base context in which the view will
|
|
@@ -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
|
/**
|
|
@@ -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
|
/**
|
|
@@ -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
|
/**
|
|
@@ -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
|
/**
|
|
@@ -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
|
/**
|
package/src/conversion/mapper.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
|
/**
|
|
@@ -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
|
/**
|
|
@@ -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
|
/**
|
|
@@ -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
|
import Matcher from '../view/matcher';
|
|
@@ -454,7 +454,14 @@ export function convertText() {
|
|
|
454
454
|
if (data.viewItem.data.trim().length == 0) {
|
|
455
455
|
return;
|
|
456
456
|
}
|
|
457
|
+
// Wrap `$text` in paragraph and include any marker that is directly before `$text`. See #13053.
|
|
458
|
+
const nodeBefore = position.nodeBefore;
|
|
457
459
|
position = wrapInParagraph(position, writer);
|
|
460
|
+
if (nodeBefore && nodeBefore.is('element', '$marker')) {
|
|
461
|
+
// Move `$marker` to the paragraph.
|
|
462
|
+
writer.move(writer.createRangeOn(nodeBefore), position);
|
|
463
|
+
position = writer.createPositionAfter(nodeBefore);
|
|
464
|
+
}
|
|
458
465
|
}
|
|
459
466
|
consumable.consume(data.viewItem);
|
|
460
467
|
const text = writer.createText(data.viewItem.data);
|
|
@@ -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
|
/**
|
|
@@ -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
|
/**
|
|
@@ -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
|
export {};
|
|
@@ -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
|
/**
|
|
@@ -97,7 +97,6 @@ export default class HtmlDataProcessor {
|
|
|
97
97
|
* Converts an HTML string to its DOM representation. Returns a document fragment containing nodes parsed from
|
|
98
98
|
* the provided data.
|
|
99
99
|
*
|
|
100
|
-
* @private
|
|
101
100
|
* @param {String} data
|
|
102
101
|
* @returns {DocumentFragment}
|
|
103
102
|
*/
|
|
@@ -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
|
export {};
|
|
@@ -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
|
/**
|
package/src/dev-utils/model.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
|
/**
|
|
@@ -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
|
/**
|
package/src/dev-utils/utils.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
|
/**
|
package/src/dev-utils/view.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
|
/**
|
package/src/index.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
|
/**
|
|
@@ -11,7 +11,6 @@ export { default as EditingController } from './controller/editingcontroller';
|
|
|
11
11
|
export { default as DataController } from './controller/datacontroller';
|
|
12
12
|
// Conversion.
|
|
13
13
|
export { default as Conversion } from './conversion/conversion';
|
|
14
|
-
// DataProcessor.
|
|
15
14
|
export { default as HtmlDataProcessor } from './dataprocessor/htmldataprocessor';
|
|
16
15
|
export { default as InsertOperation } from './model/operation/insertoperation';
|
|
17
16
|
export { default as MarkerOperation } from './model/operation/markeroperation';
|
|
@@ -45,12 +44,14 @@ export { default as ViewEmptyElement } from './view/emptyelement';
|
|
|
45
44
|
export { default as ViewRawElement } from './view/rawelement';
|
|
46
45
|
export { default as ViewUIElement } from './view/uielement';
|
|
47
46
|
export { default as ViewDocumentFragment } from './view/documentfragment';
|
|
47
|
+
export { default as AttributeElement } from './view/attributeelement';
|
|
48
48
|
export { getFillerOffset } from './view/containerelement';
|
|
49
49
|
// View / Observer.
|
|
50
50
|
export { default as Observer } from './view/observer/observer';
|
|
51
51
|
export { default as ClickObserver } from './view/observer/clickobserver';
|
|
52
52
|
export { default as DomEventObserver } from './view/observer/domeventobserver';
|
|
53
53
|
export { default as MouseObserver } from './view/observer/mouseobserver';
|
|
54
|
+
export { default as TabObserver } from './view/observer/tabobserver';
|
|
54
55
|
export { default as DowncastWriter } from './view/downcastwriter';
|
|
55
56
|
export { default as UpcastWriter } from './view/upcastwriter';
|
|
56
57
|
export { default as Matcher } from './view/matcher';
|
package/src/model/batch.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
|
/**
|
|
@@ -11,9 +11,11 @@ import { logWarning } from '@ckeditor/ckeditor5-utils';
|
|
|
11
11
|
* 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
|
|
12
12
|
* to extend a given undo step, you can add more changes to the batch using {@link module:engine/model/model~Model#enqueueChange}:
|
|
13
13
|
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
14
|
+
* ```ts
|
|
15
|
+
* model.enqueueChange( batch, writer => {
|
|
16
|
+
* writer.insertText( 'foo', paragraph, 'end' );
|
|
17
|
+
* } );
|
|
18
|
+
* ```
|
|
17
19
|
*
|
|
18
20
|
* @see module:engine/model/model~Model#enqueueChange
|
|
19
21
|
* @see module:engine/model/model~Model#change
|
|
@@ -24,13 +26,8 @@ export default class Batch {
|
|
|
24
26
|
*
|
|
25
27
|
* @see module:engine/model/model~Model#enqueueChange
|
|
26
28
|
* @see module:engine/model/model~Model#change
|
|
27
|
-
* @param
|
|
29
|
+
* @param type A set of flags that specify the type of the batch. Batch type can alter how some of the features work
|
|
28
30
|
* when encountering a given `Batch` instance (for example, when a feature listens to applied operations).
|
|
29
|
-
* @param {Boolean} [type.isUndoable=true] Whether a batch can be undone through undo feature.
|
|
30
|
-
* @param {Boolean} [type.isLocal=true] Whether a batch includes operations created locally (`true`) or operations created on
|
|
31
|
-
* other, remote editors (`false`).
|
|
32
|
-
* @param {Boolean} [type.isUndo=false] Whether a batch was created by the undo feature and undoes other operations.
|
|
33
|
-
* @param {Boolean} [type.isTyping=false] Whether a batch includes operations connected with a typing action.
|
|
34
31
|
*/
|
|
35
32
|
constructor(type = {}) {
|
|
36
33
|
if (typeof type === 'string') {
|
|
@@ -45,40 +42,10 @@ export default class Batch {
|
|
|
45
42
|
logWarning('batch-constructor-deprecated-string-type');
|
|
46
43
|
}
|
|
47
44
|
const { isUndoable = true, isLocal = true, isUndo = false, isTyping = false } = type;
|
|
48
|
-
/**
|
|
49
|
-
* An array of operations that compose this batch.
|
|
50
|
-
*
|
|
51
|
-
* @readonly
|
|
52
|
-
* @type {Array.<module:engine/model/operation/operation~Operation>}
|
|
53
|
-
*/
|
|
54
45
|
this.operations = [];
|
|
55
|
-
/**
|
|
56
|
-
* Whether the batch can be undone through the undo feature.
|
|
57
|
-
*
|
|
58
|
-
* @readonly
|
|
59
|
-
* @type {Boolean}
|
|
60
|
-
*/
|
|
61
46
|
this.isUndoable = isUndoable;
|
|
62
|
-
/**
|
|
63
|
-
* Whether the batch includes operations created locally (`true`) or operations created on other, remote editors (`false`).
|
|
64
|
-
*
|
|
65
|
-
* @readonly
|
|
66
|
-
* @type {Boolean}
|
|
67
|
-
*/
|
|
68
47
|
this.isLocal = isLocal;
|
|
69
|
-
/**
|
|
70
|
-
* Whether the batch was created by the undo feature and undoes other operations.
|
|
71
|
-
*
|
|
72
|
-
* @readonly
|
|
73
|
-
* @type {Boolean}
|
|
74
|
-
*/
|
|
75
48
|
this.isUndo = isUndo;
|
|
76
|
-
/**
|
|
77
|
-
* Whether the batch includes operations connected with typing.
|
|
78
|
-
*
|
|
79
|
-
* @readonly
|
|
80
|
-
* @type {Boolean}
|
|
81
|
-
*/
|
|
82
49
|
this.isTyping = isTyping;
|
|
83
50
|
}
|
|
84
51
|
/**
|
|
@@ -92,7 +59,6 @@ export default class Batch {
|
|
|
92
59
|
* changes.
|
|
93
60
|
*
|
|
94
61
|
* @deprecated
|
|
95
|
-
* @type {'default'}
|
|
96
62
|
*/
|
|
97
63
|
get type() {
|
|
98
64
|
/**
|
|
@@ -107,9 +73,6 @@ export default class Batch {
|
|
|
107
73
|
/**
|
|
108
74
|
* Returns the base version of this batch, which is equal to the base version of the first operation in the batch.
|
|
109
75
|
* If there are no operations in the batch or neither operation has the base version set, it returns `null`.
|
|
110
|
-
*
|
|
111
|
-
* @readonly
|
|
112
|
-
* @type {Number|null}
|
|
113
76
|
*/
|
|
114
77
|
get baseVersion() {
|
|
115
78
|
for (const op of this.operations) {
|
|
@@ -122,8 +85,8 @@ export default class Batch {
|
|
|
122
85
|
/**
|
|
123
86
|
* Adds an operation to the batch instance.
|
|
124
87
|
*
|
|
125
|
-
* @param
|
|
126
|
-
* @returns
|
|
88
|
+
* @param operation An operation to add.
|
|
89
|
+
* @returns The added operation.
|
|
127
90
|
*/
|
|
128
91
|
addOperation(operation) {
|
|
129
92
|
operation.batch = this;
|