@ckeditor/ckeditor5-engine 31.1.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 -25
- package/src/controller/datacontroller.js +10 -11
- 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 +9 -31
- package/src/dataprocessor/htmlwriter.js +1 -1
- package/src/dataprocessor/xmldataprocessor.js +1 -1
- 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 +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 +1 -1
- 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 +1 -1
- 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 +1 -1
- 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 +1 -1
- package/src/view/documentfragment.js +1 -1
- package/src/view/documentselection.js +1 -1
- package/src/view/domconverter.js +8 -17
- package/src/view/downcastwriter.js +1 -1
- package/src/view/editableelement.js +1 -1
- package/src/view/element.js +1 -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 +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 +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 +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 +3 -2
- 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/uielement.js +1 -1
- package/src/view/upcastwriter.js +1 -1
- package/src/view/view.js +1 -1
- 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-2022, [CKSource](http://cksource.com) Holding sp. z o.o. 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
|
|
|
@@ -14,4 +14,4 @@ Where not otherwise indicated, all CKEditor content is authored by CKSource engi
|
|
|
14
14
|
Trademarks
|
|
15
15
|
----------
|
|
16
16
|
|
|
17
|
-
**CKEditor** is a trademark of [CKSource](http://cksource.com)
|
|
17
|
+
**CKEditor** is a trademark of [CKSource](http://cksource.com) Holding sp. z o.o. All other brand and product names are trademarks, registered trademarks or service marks of their respective holders.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ckeditor/ckeditor5-engine",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "32.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,35 +23,35 @@
|
|
|
23
23
|
],
|
|
24
24
|
"main": "src/index.js",
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@ckeditor/ckeditor5-utils": "^
|
|
26
|
+
"@ckeditor/ckeditor5-utils": "^32.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": "^
|
|
50
|
-
"webpack": "^
|
|
51
|
-
"webpack-cli": "^
|
|
30
|
+
"@ckeditor/ckeditor5-basic-styles": "^32.0.0",
|
|
31
|
+
"@ckeditor/ckeditor5-block-quote": "^32.0.0",
|
|
32
|
+
"@ckeditor/ckeditor5-clipboard": "^32.0.0",
|
|
33
|
+
"@ckeditor/ckeditor5-cloud-services": "^32.0.0",
|
|
34
|
+
"@ckeditor/ckeditor5-core": "^32.0.0",
|
|
35
|
+
"@ckeditor/ckeditor5-editor-classic": "^32.0.0",
|
|
36
|
+
"@ckeditor/ckeditor5-enter": "^32.0.0",
|
|
37
|
+
"@ckeditor/ckeditor5-essentials": "^32.0.0",
|
|
38
|
+
"@ckeditor/ckeditor5-heading": "^32.0.0",
|
|
39
|
+
"@ckeditor/ckeditor5-image": "^32.0.0",
|
|
40
|
+
"@ckeditor/ckeditor5-link": "^32.0.0",
|
|
41
|
+
"@ckeditor/ckeditor5-list": "^32.0.0",
|
|
42
|
+
"@ckeditor/ckeditor5-mention": "^32.0.0",
|
|
43
|
+
"@ckeditor/ckeditor5-paragraph": "^32.0.0",
|
|
44
|
+
"@ckeditor/ckeditor5-table": "^32.0.0",
|
|
45
|
+
"@ckeditor/ckeditor5-theme-lark": "^32.0.0",
|
|
46
|
+
"@ckeditor/ckeditor5-typing": "^32.0.0",
|
|
47
|
+
"@ckeditor/ckeditor5-ui": "^32.0.0",
|
|
48
|
+
"@ckeditor/ckeditor5-undo": "^32.0.0",
|
|
49
|
+
"@ckeditor/ckeditor5-widget": "^32.0.0",
|
|
50
|
+
"webpack": "^5.58.1",
|
|
51
|
+
"webpack-cli": "^4.9.0"
|
|
52
52
|
},
|
|
53
53
|
"engines": {
|
|
54
|
-
"node": ">=
|
|
54
|
+
"node": ">=14.0.0",
|
|
55
55
|
"npm": ">=5.7.1"
|
|
56
56
|
},
|
|
57
57
|
"author": "CKSource (http://cksource.com/)",
|
|
@@ -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
|
|
|
@@ -156,7 +156,7 @@ export default class DataController {
|
|
|
156
156
|
// Fix empty roots after DataController is 'ready' (note that init method could be decorated and stopped).
|
|
157
157
|
// We need to handle this event because initial data could be empty and post-fixer would not get triggered.
|
|
158
158
|
this.on( 'ready', () => {
|
|
159
|
-
this.model.enqueueChange(
|
|
159
|
+
this.model.enqueueChange( { isUndoable: false }, autoParagraphEmptyRoots );
|
|
160
160
|
}, { priority: 'lowest' } );
|
|
161
161
|
}
|
|
162
162
|
|
|
@@ -323,7 +323,7 @@ export default class DataController {
|
|
|
323
323
|
throw new CKEditorError( 'datacontroller-init-non-existent-root', this );
|
|
324
324
|
}
|
|
325
325
|
|
|
326
|
-
this.model.enqueueChange(
|
|
326
|
+
this.model.enqueueChange( { isUndoable: false }, writer => {
|
|
327
327
|
for ( const rootName of Object.keys( initialData ) ) {
|
|
328
328
|
const modelRoot = this.model.document.getRoot( rootName );
|
|
329
329
|
writer.insert( this.parse( initialData[ rootName ], modelRoot ), modelRoot, 0 );
|
|
@@ -350,17 +350,18 @@ export default class DataController {
|
|
|
350
350
|
*
|
|
351
351
|
* dataController.set( { main: '<p>Foo</p>', title: '<h1>Bar</h1>' } ); // Sets data on the `main` and `title` roots.
|
|
352
352
|
*
|
|
353
|
-
* To set the data with preserved undo
|
|
353
|
+
* To set the data with preserved undo stack and add the change to the undo stack, set `{ isUndoable: true }` as `batchType` option.
|
|
354
354
|
*
|
|
355
|
-
* dataController.set( '<p>Foo</p>', { batchType:
|
|
355
|
+
* dataController.set( '<p>Foo</p>', { batchType: { isUndoable: true } } );
|
|
356
356
|
*
|
|
357
357
|
* @fires set
|
|
358
358
|
* @param {String|Object.<String,String>} data Input data as a string or an object containing `rootName` - `data`
|
|
359
359
|
* pairs to set data on multiple roots at once.
|
|
360
360
|
* @param {Object} [options={}] Options for setting data.
|
|
361
|
-
* @param {
|
|
362
|
-
*
|
|
363
|
-
*
|
|
361
|
+
* @param {Object} [options.batchType] The batch type that will be used to create a batch for the changes applied by this method.
|
|
362
|
+
* By default, the batch will be set as {@link module:engine/model/batch~Batch#isUndoable not undoable} and the undo stack will be
|
|
363
|
+
* cleared after the new data is applied (all undo steps will be removed). If batch type `isUndoable` flag will be set to `true`,
|
|
364
|
+
* the undo stack will be preserved.
|
|
364
365
|
*/
|
|
365
366
|
set( data, options = {} ) {
|
|
366
367
|
let newData = {};
|
|
@@ -386,9 +387,7 @@ export default class DataController {
|
|
|
386
387
|
throw new CKEditorError( 'datacontroller-set-non-existent-root', this );
|
|
387
388
|
}
|
|
388
389
|
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
this.model.enqueueChange( batchType, writer => {
|
|
390
|
+
this.model.enqueueChange( options.batchType || {}, writer => {
|
|
392
391
|
writer.setSelection( null );
|
|
393
392
|
writer.removeSelectionAttribute( this.model.document.selection.getAttributeKeys() );
|
|
394
393
|
|
|
@@ -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/conversion/mapper.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
|
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* @module engine/dataprocessor/htmldataprocessor
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
/* globals document, DOMParser
|
|
10
|
+
/* globals document, DOMParser */
|
|
11
11
|
|
|
12
12
|
import BasicHtmlWriter from './basichtmlwriter';
|
|
13
13
|
import DomConverter from '../view/domconverter';
|
|
@@ -114,37 +114,15 @@ export default class HtmlDataProcessor {
|
|
|
114
114
|
* @returns {DocumentFragment}
|
|
115
115
|
*/
|
|
116
116
|
_toDom( data ) {
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
// In short, parsing tokens in an HTML string starts with the so-called "initial" insertion mode. When a DOM parser is in this
|
|
123
|
-
// state and encounters a comment node, it inserts this comment node as the last child of the newly-created `HTMLDocument` object.
|
|
124
|
-
// The parser then proceeds to successive insertion modes during parsing subsequent tokens and appends in the `HTMLDocument` object
|
|
125
|
-
// other nodes (like <html>, <head>, <body>). This causes that the first leading comments from HTML string become the first nodes
|
|
126
|
-
// in the `HTMLDocument` object, but not in the <body> collection, because they are ultimately located before the <html> element.
|
|
127
|
-
//
|
|
128
|
-
// Therefore, so that such leading comments do not disappear, they all are moved from the `HTMLDocument` object to the document
|
|
129
|
-
// fragment, until the <html> element is encountered.
|
|
130
|
-
//
|
|
131
|
-
// See: https://github.com/ckeditor/ckeditor5/issues/9861.
|
|
132
|
-
let documentChildNode = document.firstChild;
|
|
133
|
-
|
|
134
|
-
while ( !documentChildNode.isSameNode( document.documentElement ) ) {
|
|
135
|
-
const node = documentChildNode;
|
|
136
|
-
|
|
137
|
-
documentChildNode = documentChildNode.nextSibling;
|
|
138
|
-
|
|
139
|
-
// It seems that `DOMParser#parseFromString()` adds only comment nodes directly to the `HTMLDocument` object, before the <html>
|
|
140
|
-
// node. The condition below is just to be sure we are moving only comment nodes.
|
|
141
|
-
|
|
142
|
-
/* istanbul ignore else */
|
|
143
|
-
if ( node.nodeType == Node.COMMENT_NODE ) {
|
|
144
|
-
fragment.appendChild( node );
|
|
145
|
-
}
|
|
117
|
+
// Wrap data with a <body> so leading non-layout nodes (like <script>, <style>, HTML comment)
|
|
118
|
+
// will be preserved in the body collection.
|
|
119
|
+
// Do it only for data that is not a full HTML document.
|
|
120
|
+
if ( !data.match( /<(?:html|body|head|meta)(?:\s[^>]*)?>/i ) ) {
|
|
121
|
+
data = `<body>${ data }</body>`;
|
|
146
122
|
}
|
|
147
123
|
|
|
124
|
+
const document = this.domParser.parseFromString( data, 'text/html' );
|
|
125
|
+
const fragment = document.createDocumentFragment();
|
|
148
126
|
const bodyChildNodes = document.body.childNodes;
|
|
149
127
|
|
|
150
128
|
while ( bodyChildNodes.length > 0 ) {
|
|
@@ -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/dev-utils/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
|
|
|
@@ -102,7 +102,7 @@ getData._stringify = stringify;
|
|
|
102
102
|
* name will be used.
|
|
103
103
|
* @param {Array<Object>} [options.selectionAttributes] A list of attributes which will be passed to the selection.
|
|
104
104
|
* @param {Boolean} [options.lastRangeBackward=false] If set to `true`, the last range will be added as backward.
|
|
105
|
-
* @param {
|
|
105
|
+
* @param {Object} [options.batchType] Batch type used for inserting elements. See {@link module:engine/model/batch~Batch#constructor}.
|
|
106
106
|
* See {@link module:engine/model/batch~Batch#type}.
|
|
107
107
|
*/
|
|
108
108
|
export function setData( model, data, options = {} ) {
|
|
@@ -128,7 +128,7 @@ export function setData( model, data, options = {} ) {
|
|
|
128
128
|
modelDocumentFragment = parsedResult;
|
|
129
129
|
}
|
|
130
130
|
|
|
131
|
-
if (
|
|
131
|
+
if ( options.batchType !== undefined ) {
|
|
132
132
|
model.enqueueChange( options.batchType, writeToModel );
|
|
133
133
|
} else {
|
|
134
134
|
model.change( writeToModel );
|
|
@@ -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/dev-utils/utils.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/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
|
|
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
|
|