@ckeditor/ckeditor5-engine 35.3.2 → 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 +10 -8
- package/src/controller/editingcontroller.js +3 -4
- package/src/conversion/conversion.js +2 -3
- package/src/conversion/conversionhelpers.js +1 -1
- package/src/conversion/downcastdispatcher.js +3 -3
- package/src/conversion/downcasthelpers.js +2 -3
- package/src/conversion/mapper.js +3 -4
- package/src/conversion/modelconsumable.js +2 -2
- package/src/conversion/upcastdispatcher.js +3 -4
- package/src/conversion/upcasthelpers.js +10 -3
- package/src/conversion/viewconsumable.js +2 -2
- package/src/dataprocessor/basichtmlwriter.js +1 -1
- package/src/dataprocessor/dataprocessor.js +1 -1
- package/src/dataprocessor/htmldataprocessor.js +3 -3
- package/src/dataprocessor/htmlwriter.js +1 -1
- package/src/dataprocessor/xmldataprocessor.js +6 -2
- 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 +1 -1
- package/src/index.js +13 -3
- package/src/model/batch.js +10 -47
- package/src/model/differ.js +81 -174
- package/src/model/document.js +38 -97
- package/src/model/documentfragment.js +44 -97
- package/src/model/documentselection.js +152 -251
- package/src/model/element.js +48 -101
- package/src/model/history.js +15 -46
- package/src/model/item.js +1 -1
- package/src/model/liveposition.js +11 -39
- package/src/model/liverange.js +14 -38
- package/src/model/markercollection.js +42 -115
- package/src/model/model.js +214 -292
- package/src/model/node.js +36 -128
- package/src/model/nodelist.js +12 -41
- package/src/model/operation/attributeoperation.js +14 -45
- package/src/model/operation/detachoperation.js +4 -17
- package/src/model/operation/insertoperation.js +7 -35
- package/src/model/operation/markeroperation.js +9 -48
- package/src/model/operation/mergeoperation.js +9 -42
- package/src/model/operation/moveoperation.js +15 -39
- 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 +9 -29
- package/src/model/operation/rootattributeoperation.js +19 -48
- package/src/model/operation/splitoperation.js +10 -48
- package/src/model/operation/transform.js +110 -151
- package/src/model/operation/utils.js +37 -52
- package/src/model/position.js +118 -230
- package/src/model/range.js +146 -202
- package/src/model/rootelement.js +8 -47
- package/src/model/schema.js +245 -282
- package/src/model/selection.js +135 -196
- package/src/model/text.js +10 -37
- package/src/model/textproxy.js +16 -70
- package/src/model/treewalker.js +11 -102
- 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 +25 -25
- package/src/model/utils/getselectedcontent.js +3 -6
- package/src/model/utils/insertcontent.js +37 -130
- package/src/model/utils/insertobject.js +40 -40
- package/src/model/utils/modifyselection.js +24 -34
- package/src/model/utils/selection-post-fixer.js +53 -59
- package/src/model/writer.js +209 -316
- package/src/view/attributeelement.js +2 -2
- package/src/view/containerelement.js +1 -1
- package/src/view/datatransfer.js +1 -1
- package/src/view/document.js +3 -5
- package/src/view/documentfragment.js +50 -4
- package/src/view/documentselection.js +2 -3
- package/src/view/domconverter.js +4 -8
- package/src/view/downcastwriter.js +2 -3
- package/src/view/editableelement.js +2 -3
- package/src/view/element.js +6 -8
- package/src/view/elementdefinition.js +1 -1
- package/src/view/emptyelement.js +2 -2
- package/src/view/filler.js +2 -3
- package/src/view/item.js +1 -1
- package/src/view/matcher.js +2 -2
- package/src/view/node.js +2 -5
- package/src/view/observer/arrowkeysobserver.js +1 -1
- package/src/view/observer/bubblingemittermixin.js +3 -6
- package/src/view/observer/bubblingeventinfo.js +2 -2
- 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 +2 -2
- package/src/view/observer/focusobserver.js +25 -3
- package/src/view/observer/inputobserver.js +2 -2
- package/src/view/observer/keyobserver.js +2 -2
- package/src/view/observer/mouseobserver.js +1 -1
- package/src/view/observer/mutationobserver.js +1 -1
- package/src/view/observer/observer.js +3 -3
- package/src/view/observer/selectionobserver.js +21 -3
- package/src/view/observer/tabobserver.js +2 -2
- package/src/view/placeholder.js +1 -1
- package/src/view/position.js +2 -3
- package/src/view/range.js +1 -1
- package/src/view/rawelement.js +2 -2
- package/src/view/renderer.js +3 -12
- package/src/view/rooteditableelement.js +1 -1
- package/src/view/selection.js +2 -6
- 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 +2 -2
- package/src/view/treewalker.js +2 -2
- package/src/view/typecheckable.js +1 -1
- package/src/view/uielement.js +2 -3
- package/src/view/upcastwriter.js +1 -1
- package/src/view/view.js +7 -7
- 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,13 +1,11 @@
|
|
|
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
|
/**
|
|
6
6
|
* @module engine/controller/datacontroller
|
|
7
7
|
*/
|
|
8
|
-
import {
|
|
9
|
-
import CKEditorError from '@ckeditor/ckeditor5-utils/src/ckeditorerror';
|
|
10
|
-
import { Emitter } from '@ckeditor/ckeditor5-utils/src/emittermixin';
|
|
8
|
+
import { CKEditorError, EmitterMixin, ObservableMixin } from '@ckeditor/ckeditor5-utils';
|
|
11
9
|
import Mapper from '../conversion/mapper';
|
|
12
10
|
import DowncastDispatcher from '../conversion/downcastdispatcher';
|
|
13
11
|
import { insertAttributesAndChildren, insertText } from '../conversion/downcasthelpers';
|
|
@@ -36,7 +34,7 @@ import HtmlDataProcessor from '../dataprocessor/htmldataprocessor';
|
|
|
36
34
|
*
|
|
37
35
|
* @mixes module:utils/emittermixin~EmitterMixin
|
|
38
36
|
*/
|
|
39
|
-
export default class DataController extends
|
|
37
|
+
export default class DataController extends EmitterMixin() {
|
|
40
38
|
/**
|
|
41
39
|
* Creates a data controller instance.
|
|
42
40
|
*
|
|
@@ -127,9 +125,11 @@ export default class DataController extends Emitter {
|
|
|
127
125
|
this.upcastDispatcher.on('text', convertText(), { priority: 'lowest' });
|
|
128
126
|
this.upcastDispatcher.on('element', convertToModelFragment(), { priority: 'lowest' });
|
|
129
127
|
this.upcastDispatcher.on('documentFragment', convertToModelFragment(), { priority: 'lowest' });
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
128
|
+
ObservableMixin().prototype.decorate.call(this, 'init');
|
|
129
|
+
ObservableMixin().prototype.decorate.call(this, 'set');
|
|
130
|
+
ObservableMixin().prototype.decorate.call(this, 'get');
|
|
131
|
+
ObservableMixin().prototype.decorate.call(this, 'toView');
|
|
132
|
+
ObservableMixin().prototype.decorate.call(this, 'toModel');
|
|
133
133
|
// Fire the `ready` event when the initialization has completed. Such low-level listener offers the possibility
|
|
134
134
|
// to plug into the initialization pipeline without interrupting the initialization flow.
|
|
135
135
|
this.on('init', () => {
|
|
@@ -198,6 +198,7 @@ export default class DataController extends Emitter {
|
|
|
198
198
|
* converters attached to {@link #downcastDispatcher} into a
|
|
199
199
|
* {@link module:engine/view/documentfragment~DocumentFragment view document fragment}.
|
|
200
200
|
*
|
|
201
|
+
* @fires toView
|
|
201
202
|
* @param {module:engine/model/element~Element|module:engine/model/documentfragment~DocumentFragment} modelElementOrFragment
|
|
202
203
|
* Element or document fragment whose content will be converted.
|
|
203
204
|
* @param {Object} [options={}] Additional configuration that will be available through the
|
|
@@ -372,6 +373,7 @@ export default class DataController extends Emitter {
|
|
|
372
373
|
* When marker elements were converted during the conversion process, it will be set as a document fragment's
|
|
373
374
|
* {@link module:engine/model/documentfragment~DocumentFragment#markers static markers map}.
|
|
374
375
|
*
|
|
376
|
+
* @fires toModel
|
|
375
377
|
* @param {module:engine/view/element~Element|module:engine/view/documentfragment~DocumentFragment} viewElementOrFragment
|
|
376
378
|
* The element or document fragment whose content will be converted.
|
|
377
379
|
* @param {module:engine/model/schema~SchemaContextDefinition} [context='$root'] Base context in which the view will
|
|
@@ -1,17 +1,16 @@
|
|
|
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
|
/**
|
|
6
6
|
* @module engine/controller/editingcontroller
|
|
7
7
|
*/
|
|
8
|
+
import { CKEditorError, ObservableMixin } from '@ckeditor/ckeditor5-utils';
|
|
8
9
|
import RootEditableElement from '../view/rooteditableelement';
|
|
9
10
|
import View from '../view/view';
|
|
10
11
|
import Mapper from '../conversion/mapper';
|
|
11
12
|
import DowncastDispatcher from '../conversion/downcastdispatcher';
|
|
12
13
|
import { clearAttributes, convertCollapsedSelection, convertRangeSelection, insertAttributesAndChildren, insertText, remove } from '../conversion/downcasthelpers';
|
|
13
|
-
import { Observable } from '@ckeditor/ckeditor5-utils/src/observablemixin';
|
|
14
|
-
import CKEditorError from '@ckeditor/ckeditor5-utils/src/ckeditorerror';
|
|
15
14
|
import { convertSelectionChange } from '../conversion/upcasthelpers';
|
|
16
15
|
// @if CK_DEBUG_ENGINE // const { dumpTrees, initDocumentDumping } = require( '../dev-utils/utils' );
|
|
17
16
|
/**
|
|
@@ -21,7 +20,7 @@ import { convertSelectionChange } from '../conversion/upcasthelpers';
|
|
|
21
20
|
*
|
|
22
21
|
* @mixes module:utils/observablemixin~ObservableMixin
|
|
23
22
|
*/
|
|
24
|
-
export default class EditingController extends
|
|
23
|
+
export default class EditingController extends ObservableMixin() {
|
|
25
24
|
/**
|
|
26
25
|
* Creates an editing controller instance.
|
|
27
26
|
*
|
|
@@ -1,14 +1,13 @@
|
|
|
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
|
/**
|
|
6
6
|
* @module engine/conversion/conversion
|
|
7
7
|
*/
|
|
8
|
-
import CKEditorError from '@ckeditor/ckeditor5-utils
|
|
8
|
+
import { CKEditorError, toArray } from '@ckeditor/ckeditor5-utils';
|
|
9
9
|
import UpcastHelpers from './upcasthelpers';
|
|
10
10
|
import DowncastHelpers from './downcasthelpers';
|
|
11
|
-
import toArray from '@ckeditor/ckeditor5-utils/src/toarray';
|
|
12
11
|
/**
|
|
13
12
|
* A utility class that helps add converters to upcast and downcast dispatchers.
|
|
14
13
|
*
|
|
@@ -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
|
/**
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
*/
|
|
8
8
|
import Consumable from './modelconsumable';
|
|
9
9
|
import Range from '../model/range';
|
|
10
|
-
import {
|
|
10
|
+
import { EmitterMixin } from '@ckeditor/ckeditor5-utils';
|
|
11
11
|
/**
|
|
12
12
|
* The downcast dispatcher is a central point of downcasting (conversion from the model to the view), which is a process of reacting
|
|
13
13
|
* to changes in the model and firing a set of events. The callbacks listening to these events are called converters. The
|
|
@@ -97,7 +97,7 @@ import { Emitter } from '@ckeditor/ckeditor5-utils/src/emittermixin';
|
|
|
97
97
|
* conversionApi.writer.insert( viewPosition, viewElement );
|
|
98
98
|
* } );
|
|
99
99
|
*/
|
|
100
|
-
export default class DowncastDispatcher extends
|
|
100
|
+
export default class DowncastDispatcher extends EmitterMixin() {
|
|
101
101
|
/**
|
|
102
102
|
* Creates a downcast dispatcher instance.
|
|
103
103
|
*
|
|
@@ -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
|
/**
|
|
@@ -15,8 +15,7 @@ import ModelPosition from '../model/position';
|
|
|
15
15
|
import ViewAttributeElement from '../view/attributeelement';
|
|
16
16
|
import ConversionHelpers from './conversionhelpers';
|
|
17
17
|
import { cloneDeep } from 'lodash-es';
|
|
18
|
-
import CKEditorError from '@ckeditor/ckeditor5-utils
|
|
19
|
-
import toArray from '@ckeditor/ckeditor5-utils/src/toarray';
|
|
18
|
+
import { CKEditorError, toArray } from '@ckeditor/ckeditor5-utils';
|
|
20
19
|
/**
|
|
21
20
|
* Downcast conversion helper functions.
|
|
22
21
|
*
|
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
|
/**
|
|
@@ -10,8 +10,7 @@ import ModelRange from '../model/range';
|
|
|
10
10
|
import ViewPosition from '../view/position';
|
|
11
11
|
import ViewRange from '../view/range';
|
|
12
12
|
import ViewText from '../view/text';
|
|
13
|
-
import {
|
|
14
|
-
import CKEditorError from '@ckeditor/ckeditor5-utils/src/ckeditorerror';
|
|
13
|
+
import { CKEditorError, EmitterMixin } from '@ckeditor/ckeditor5-utils';
|
|
15
14
|
/**
|
|
16
15
|
* Maps elements, positions and markers between the {@link module:engine/view/document~Document view} and
|
|
17
16
|
* the {@link module:engine/model/model model}.
|
|
@@ -32,7 +31,7 @@ import CKEditorError from '@ckeditor/ckeditor5-utils/src/ckeditorerror';
|
|
|
32
31
|
* stop the event.
|
|
33
32
|
* @mixes module:utils/emittermixin~EmitterMixin
|
|
34
33
|
*/
|
|
35
|
-
export default class Mapper extends
|
|
34
|
+
export default class Mapper extends EmitterMixin() {
|
|
36
35
|
/**
|
|
37
36
|
* Creates an instance of the mapper.
|
|
38
37
|
*/
|
|
@@ -1,12 +1,12 @@
|
|
|
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
|
/**
|
|
6
6
|
* @module engine/conversion/modelconsumable
|
|
7
7
|
*/
|
|
8
8
|
import TextProxy from '../model/textproxy';
|
|
9
|
-
import CKEditorError from '@ckeditor/ckeditor5-utils
|
|
9
|
+
import { CKEditorError } from '@ckeditor/ckeditor5-utils';
|
|
10
10
|
/**
|
|
11
11
|
* Manages a list of consumable values for the {@link module:engine/model/item~Item model items}.
|
|
12
12
|
*
|
|
@@ -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
|
/**
|
|
@@ -10,8 +10,7 @@ import ModelRange from '../model/range';
|
|
|
10
10
|
import ModelPosition from '../model/position';
|
|
11
11
|
import { SchemaContext } from '../model/schema'; // eslint-disable-line no-duplicate-imports
|
|
12
12
|
import { isParagraphable, wrapInParagraph } from '../model/utils/autoparagraphing';
|
|
13
|
-
import CKEditorError from '@ckeditor/ckeditor5-utils
|
|
14
|
-
import { Emitter } from '@ckeditor/ckeditor5-utils/src/emittermixin';
|
|
13
|
+
import { CKEditorError, EmitterMixin } from '@ckeditor/ckeditor5-utils';
|
|
15
14
|
/**
|
|
16
15
|
* Upcast dispatcher is a central point of the view-to-model conversion, which is a process of
|
|
17
16
|
* converting a given {@link module:engine/view/documentfragment~DocumentFragment view document fragment} or
|
|
@@ -107,7 +106,7 @@ import { Emitter } from '@ckeditor/ckeditor5-utils/src/emittermixin';
|
|
|
107
106
|
* @fires text
|
|
108
107
|
* @fires documentFragment
|
|
109
108
|
*/
|
|
110
|
-
export default class UpcastDispatcher extends
|
|
109
|
+
export default class UpcastDispatcher extends EmitterMixin() {
|
|
111
110
|
/**
|
|
112
111
|
* Creates an upcast dispatcher that operates using the passed API.
|
|
113
112
|
*
|
|
@@ -1,12 +1,12 @@
|
|
|
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';
|
|
6
6
|
import ConversionHelpers from './conversionhelpers';
|
|
7
|
-
import { cloneDeep } from 'lodash-es';
|
|
8
|
-
import priorities from '@ckeditor/ckeditor5-utils/src/priorities';
|
|
9
7
|
import { isParagraphable, wrapInParagraph } from '../model/utils/autoparagraphing';
|
|
8
|
+
import { priorities } from '@ckeditor/ckeditor5-utils';
|
|
9
|
+
import { cloneDeep } from 'lodash-es';
|
|
10
10
|
/**
|
|
11
11
|
* Contains the {@link module:engine/view/view view} to {@link module:engine/model/model model} converters for
|
|
12
12
|
* {@link module:engine/conversion/upcastdispatcher~UpcastDispatcher}.
|
|
@@ -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,12 +1,12 @@
|
|
|
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
|
/**
|
|
6
6
|
* @module engine/conversion/viewconsumable
|
|
7
7
|
*/
|
|
8
|
+
import { CKEditorError } from '@ckeditor/ckeditor5-utils';
|
|
8
9
|
import { isArray } from 'lodash-es';
|
|
9
|
-
import CKEditorError from '@ckeditor/ckeditor5-utils/src/ckeditorerror';
|
|
10
10
|
/**
|
|
11
11
|
* Class used for handling consumption of view {@link module:engine/view/element~Element elements},
|
|
12
12
|
* {@link module:engine/view/text~Text text nodes} and {@link module:engine/view/documentfragment~DocumentFragment document fragments}.
|
|
@@ -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
|
/**
|
|
@@ -21,6 +21,7 @@ export default class HtmlDataProcessor {
|
|
|
21
21
|
* @param {module:engine/view/document~Document} document The view document instance.
|
|
22
22
|
*/
|
|
23
23
|
constructor(document) {
|
|
24
|
+
this.skipComments = true;
|
|
24
25
|
/**
|
|
25
26
|
* A DOM parser instance used to parse an HTML string to an HTML document.
|
|
26
27
|
*
|
|
@@ -63,7 +64,7 @@ export default class HtmlDataProcessor {
|
|
|
63
64
|
// Convert input HTML data to DOM DocumentFragment.
|
|
64
65
|
const domFragment = this._toDom(data);
|
|
65
66
|
// Convert DOM DocumentFragment to view DocumentFragment.
|
|
66
|
-
return this.domConverter.domToView(domFragment);
|
|
67
|
+
return this.domConverter.domToView(domFragment, { skipComments: this.skipComments });
|
|
67
68
|
}
|
|
68
69
|
/**
|
|
69
70
|
* Registers a {@link module:engine/view/matcher~MatcherPattern} for view elements whose content should be treated as raw data
|
|
@@ -96,7 +97,6 @@ export default class HtmlDataProcessor {
|
|
|
96
97
|
* Converts an HTML string to its DOM representation. Returns a document fragment containing nodes parsed from
|
|
97
98
|
* the provided data.
|
|
98
99
|
*
|
|
99
|
-
* @private
|
|
100
100
|
* @param {String} data
|
|
101
101
|
* @returns {DocumentFragment}
|
|
102
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
|
/**
|
|
@@ -25,6 +25,7 @@ export default class XmlDataProcessor {
|
|
|
25
25
|
* @param {Array.<String>} [options.namespaces=[]] A list of namespaces allowed to use in the XML input.
|
|
26
26
|
*/
|
|
27
27
|
constructor(document, options = {}) {
|
|
28
|
+
this.skipComments = true;
|
|
28
29
|
/**
|
|
29
30
|
* A list of namespaces allowed to use in the XML input.
|
|
30
31
|
*
|
|
@@ -78,7 +79,10 @@ export default class XmlDataProcessor {
|
|
|
78
79
|
// Convert input XML data to DOM DocumentFragment.
|
|
79
80
|
const domFragment = this._toDom(data);
|
|
80
81
|
// Convert DOM DocumentFragment to view DocumentFragment.
|
|
81
|
-
return this.domConverter.domToView(domFragment, {
|
|
82
|
+
return this.domConverter.domToView(domFragment, {
|
|
83
|
+
keepOriginalCase: true,
|
|
84
|
+
skipComments: this.skipComments
|
|
85
|
+
});
|
|
82
86
|
}
|
|
83
87
|
/**
|
|
84
88
|
* Registers a {@link module:engine/view/matcher~MatcherPattern} for view elements whose content should be treated as raw data
|
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
|
/**
|
|
@@ -21,11 +21,11 @@ import ViewRootEditableElement from '../view/rooteditableelement';
|
|
|
21
21
|
import { parse as viewParse, stringify as viewStringify } from '../../src/dev-utils/view';
|
|
22
22
|
import Mapper from '../conversion/mapper';
|
|
23
23
|
import { convertCollapsedSelection, convertRangeSelection, insertAttributesAndChildren, insertElement, insertText, insertUIElement, wrap } from '../conversion/downcasthelpers';
|
|
24
|
-
import { isPlainObject } from 'lodash-es';
|
|
25
|
-
import toMap from '@ckeditor/ckeditor5-utils/src/tomap';
|
|
26
24
|
import { StylesProcessor } from '../view/stylesmap';
|
|
27
25
|
import DowncastDispatcher from '../conversion/downcastdispatcher';
|
|
28
26
|
import UpcastDispatcher from '../conversion/upcastdispatcher';
|
|
27
|
+
import { toMap } from '@ckeditor/ckeditor5-utils';
|
|
28
|
+
import { isPlainObject } from 'lodash-es';
|
|
29
29
|
/**
|
|
30
30
|
* Writes the content of a model {@link module:engine/model/document~Document document} to an HTML-like string.
|
|
31
31
|
*
|
|
@@ -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,20 +1,22 @@
|
|
|
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
|
/**
|
|
6
6
|
* @module engine
|
|
7
7
|
*/
|
|
8
8
|
export * from './view/placeholder';
|
|
9
|
+
// Controller.
|
|
9
10
|
export { default as EditingController } from './controller/editingcontroller';
|
|
10
11
|
export { default as DataController } from './controller/datacontroller';
|
|
12
|
+
// Conversion.
|
|
11
13
|
export { default as Conversion } from './conversion/conversion';
|
|
12
14
|
export { default as HtmlDataProcessor } from './dataprocessor/htmldataprocessor';
|
|
13
15
|
export { default as InsertOperation } from './model/operation/insertoperation';
|
|
14
16
|
export { default as MarkerOperation } from './model/operation/markeroperation';
|
|
15
17
|
export { default as OperationFactory } from './model/operation/operationfactory';
|
|
16
18
|
export { transformSets } from './model/operation/transform';
|
|
17
|
-
|
|
19
|
+
// Model.
|
|
18
20
|
export { default as DocumentSelection } from './model/documentselection';
|
|
19
21
|
export { default as Range } from './model/range';
|
|
20
22
|
export { default as LiveRange } from './model/liverange';
|
|
@@ -26,7 +28,9 @@ export { default as Position } from './model/position';
|
|
|
26
28
|
export { default as DocumentFragment } from './model/documentfragment';
|
|
27
29
|
export { default as History } from './model/history';
|
|
28
30
|
export { default as Text } from './model/text';
|
|
29
|
-
export {
|
|
31
|
+
export { findOptimalInsertionRange } from './model/utils/findoptimalinsertionrange';
|
|
32
|
+
// View.
|
|
33
|
+
export { default as DataTransfer } from './view/datatransfer';
|
|
30
34
|
export { default as DomConverter } from './view/domconverter';
|
|
31
35
|
export { default as Renderer } from './view/renderer';
|
|
32
36
|
export { default as View } from './view/view';
|
|
@@ -34,20 +38,26 @@ export { default as ViewDocument } from './view/document';
|
|
|
34
38
|
export { default as ViewText } from './view/text';
|
|
35
39
|
export { default as ViewElement } from './view/element';
|
|
36
40
|
export { default as ViewContainerElement } from './view/containerelement';
|
|
41
|
+
export { default as ViewEditableElement } from './view/editableelement';
|
|
37
42
|
export { default as ViewAttributeElement } from './view/attributeelement';
|
|
38
43
|
export { default as ViewEmptyElement } from './view/emptyelement';
|
|
39
44
|
export { default as ViewRawElement } from './view/rawelement';
|
|
40
45
|
export { default as ViewUIElement } from './view/uielement';
|
|
41
46
|
export { default as ViewDocumentFragment } from './view/documentfragment';
|
|
47
|
+
export { default as AttributeElement } from './view/attributeelement';
|
|
42
48
|
export { getFillerOffset } from './view/containerelement';
|
|
49
|
+
// View / Observer.
|
|
43
50
|
export { default as Observer } from './view/observer/observer';
|
|
44
51
|
export { default as ClickObserver } from './view/observer/clickobserver';
|
|
45
52
|
export { default as DomEventObserver } from './view/observer/domeventobserver';
|
|
46
53
|
export { default as MouseObserver } from './view/observer/mouseobserver';
|
|
54
|
+
export { default as TabObserver } from './view/observer/tabobserver';
|
|
47
55
|
export { default as DowncastWriter } from './view/downcastwriter';
|
|
48
56
|
export { default as UpcastWriter } from './view/upcastwriter';
|
|
49
57
|
export { default as Matcher } from './view/matcher';
|
|
58
|
+
export { default as BubblingEventInfo } from './view/observer/bubblingeventinfo';
|
|
50
59
|
export { default as DomEventData } from './view/observer/domeventdata';
|
|
60
|
+
// View / Styles.
|
|
51
61
|
export { StylesProcessor } from './view/stylesmap';
|
|
52
62
|
export * from './view/styles/background';
|
|
53
63
|
export * from './view/styles/border';
|