@ckeditor/ckeditor5-engine 47.2.0 → 47.3.0-alpha.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 +4 -4
- package/dist/index.js +57 -8
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/src/engineconfig.d.ts +56 -0
- package/src/engineconfig.js +5 -0
- package/src/index.d.ts +1 -0
- package/src/index.js +0 -3
- package/src/model/model.d.ts +9 -2
- package/src/model/model.js +8 -1
- package/src/model/utils/insertcontent.js +50 -7
package/LICENSE.md
CHANGED
|
@@ -11,12 +11,12 @@ Licensed under a dual-license model, this software is available under:
|
|
|
11
11
|
|
|
12
12
|
For more information, see: [https://ckeditor.com/legal/ckeditor-licensing-options](https://ckeditor.com/legal/ckeditor-licensing-options).
|
|
13
13
|
|
|
14
|
-
Sources of Intellectual Property Included in CKEditor
|
|
15
|
-
|
|
14
|
+
Sources of Intellectual Property Included in CKEditor 5
|
|
15
|
+
------------------------------------------------------------
|
|
16
16
|
|
|
17
|
-
Where not otherwise indicated, all CKEditor content is authored by CKSource engineers and consists of CKSource-owned intellectual property. In some specific instances, CKEditor will incorporate work done by developers outside of CKSource with their express permission.
|
|
17
|
+
Where not otherwise indicated, all CKEditor 5 content is authored by CKSource engineers and consists of CKSource-owned intellectual property. In some specific instances, CKEditor 5 will incorporate work done by developers outside of CKSource with their express permission.
|
|
18
18
|
|
|
19
|
-
The following libraries are included in CKEditor under the [MIT license](https://opensource.org/licenses/MIT):
|
|
19
|
+
The following libraries are included in CKEditor 5 under the [MIT license](https://opensource.org/licenses/MIT):
|
|
20
20
|
|
|
21
21
|
* es-toolkit - Copyright (c) 2024 Viva Republica, Inc.
|
|
22
22
|
|
package/dist/index.js
CHANGED
|
@@ -35471,8 +35471,8 @@ function removeRangeContent(range, writer) {
|
|
|
35471
35471
|
* The reference to the last auto paragraph node.
|
|
35472
35472
|
*/ _lastAutoParagraph = null;
|
|
35473
35473
|
/**
|
|
35474
|
-
* The array of nodes that should be cleaned of not allowed attributes.
|
|
35475
|
-
*/
|
|
35474
|
+
* The array of nodes that should be cleaned of not allowed attributes and sub-nodes.
|
|
35475
|
+
*/ _filterAttributesAndChildrenOf = [];
|
|
35476
35476
|
/**
|
|
35477
35477
|
* Beginning of the affected range. See {@link module:engine/model/utils/insertcontent~Insertion#getAffectedRange}.
|
|
35478
35478
|
*/ _affectedStart = null;
|
|
@@ -35512,8 +35512,51 @@ function removeRangeContent(range, writer) {
|
|
|
35512
35512
|
// Merging with the previous sibling was performed just after inserting the first node to the document.
|
|
35513
35513
|
this._mergeOnRight();
|
|
35514
35514
|
// TMP this will become a post-fixer.
|
|
35515
|
-
this.schema.removeDisallowedAttributes(this.
|
|
35516
|
-
this.
|
|
35515
|
+
this.schema.removeDisallowedAttributes(this._filterAttributesAndChildrenOf, this.writer);
|
|
35516
|
+
if (this.model._config?.get('experimentalFlags.modelInsertContentDeepSchemaVerification')) {
|
|
35517
|
+
this._removeDisallowedChildren(this._filterAttributesAndChildrenOf);
|
|
35518
|
+
}
|
|
35519
|
+
this._filterAttributesAndChildrenOf = [];
|
|
35520
|
+
}
|
|
35521
|
+
/**
|
|
35522
|
+
* Removes disallowed children from nodes that were inserted or modified during insertion.
|
|
35523
|
+
*/ _removeDisallowedChildren(nodes) {
|
|
35524
|
+
// Make sure we do not modify the original iterable.
|
|
35525
|
+
const nodesArray = Array.from(nodes);
|
|
35526
|
+
// Check all sub-nodes of top level inserted nodes.
|
|
35527
|
+
// We do it at this point so node is already in the model tree and schema checks will be correct.
|
|
35528
|
+
for (const node of nodesArray){
|
|
35529
|
+
if (!node.is('element')) {
|
|
35530
|
+
continue;
|
|
35531
|
+
}
|
|
35532
|
+
const remove = [];
|
|
35533
|
+
const unwrap = [];
|
|
35534
|
+
const walker = this.writer.createRangeIn(node).getWalker({
|
|
35535
|
+
ignoreElementEnd: true
|
|
35536
|
+
});
|
|
35537
|
+
for (const { item } of walker){
|
|
35538
|
+
const itemParent = item.parent;
|
|
35539
|
+
if (!this.schema.checkChild(itemParent, item)) {
|
|
35540
|
+
if (item.is('element') && !this.schema.isObject(item)) {
|
|
35541
|
+
// Unwrap non-object element.
|
|
35542
|
+
unwrap.push(item);
|
|
35543
|
+
// Store the parent for re-checking children after unwrap.
|
|
35544
|
+
nodesArray.push(itemParent);
|
|
35545
|
+
} else {
|
|
35546
|
+
// Remove object with children, or text.
|
|
35547
|
+
remove.push(item);
|
|
35548
|
+
}
|
|
35549
|
+
// Skip the whole subtree as it will be removed or processed later.
|
|
35550
|
+
walker.jumpTo(this.writer.createPositionAfter(item));
|
|
35551
|
+
}
|
|
35552
|
+
}
|
|
35553
|
+
for (const item of unwrap){
|
|
35554
|
+
this.writer.unwrap(item);
|
|
35555
|
+
}
|
|
35556
|
+
for (const item of remove){
|
|
35557
|
+
this.writer.remove(item);
|
|
35558
|
+
}
|
|
35559
|
+
}
|
|
35517
35560
|
}
|
|
35518
35561
|
/**
|
|
35519
35562
|
* Updates the last node after the auto paragraphing.
|
|
@@ -35649,7 +35692,7 @@ function removeRangeContent(range, writer) {
|
|
|
35649
35692
|
} else {
|
|
35650
35693
|
this._nodeToSelect = null;
|
|
35651
35694
|
}
|
|
35652
|
-
this.
|
|
35695
|
+
this._filterAttributesAndChildrenOf.push(node);
|
|
35653
35696
|
return node;
|
|
35654
35697
|
}
|
|
35655
35698
|
/**
|
|
@@ -35738,7 +35781,7 @@ function removeRangeContent(range, writer) {
|
|
|
35738
35781
|
livePosition.detach();
|
|
35739
35782
|
// After merge elements that were marked by _insert() to be filtered might be gone so
|
|
35740
35783
|
// we need to mark the new container.
|
|
35741
|
-
this.
|
|
35784
|
+
this._filterAttributesAndChildrenOf.push(this.position.parent);
|
|
35742
35785
|
mergePosLeft.detach();
|
|
35743
35786
|
}
|
|
35744
35787
|
/**
|
|
@@ -35805,7 +35848,7 @@ function removeRangeContent(range, writer) {
|
|
|
35805
35848
|
livePosition.detach();
|
|
35806
35849
|
// After merge elements that were marked by _insert() to be filtered might be gone so
|
|
35807
35850
|
// we need to mark the new container.
|
|
35808
|
-
this.
|
|
35851
|
+
this._filterAttributesAndChildrenOf.push(this.position.parent);
|
|
35809
35852
|
mergePosRight.detach();
|
|
35810
35853
|
}
|
|
35811
35854
|
/**
|
|
@@ -36225,6 +36268,11 @@ function getSearchRange(start, isForward) {
|
|
|
36225
36268
|
/**
|
|
36226
36269
|
* Model's schema.
|
|
36227
36270
|
*/ schema;
|
|
36271
|
+
/**
|
|
36272
|
+
* Stores all configurations specific to editor instance.
|
|
36273
|
+
*
|
|
36274
|
+
* @internal
|
|
36275
|
+
*/ _config;
|
|
36228
36276
|
/**
|
|
36229
36277
|
* All callbacks added by {@link module:engine/model/model~Model#change} or
|
|
36230
36278
|
* {@link module:engine/model/model~Model#enqueueChange} methods waiting to be executed.
|
|
@@ -36234,11 +36282,12 @@ function getSearchRange(start, isForward) {
|
|
|
36234
36282
|
*/ _currentWriter;
|
|
36235
36283
|
// @if CK_DEBUG_ENGINE // private _operationLogs: Array<string>;
|
|
36236
36284
|
// @if CK_DEBUG_ENGINE // private _appliedOperations: Array<Operation>;
|
|
36237
|
-
constructor(){
|
|
36285
|
+
constructor(config){
|
|
36238
36286
|
super();
|
|
36239
36287
|
this.markers = new MarkerCollection();
|
|
36240
36288
|
this.document = new ModelDocument(this);
|
|
36241
36289
|
this.schema = new ModelSchema();
|
|
36290
|
+
this._config = config;
|
|
36242
36291
|
this._pendingChanges = [];
|
|
36243
36292
|
this._currentWriter = null;
|
|
36244
36293
|
[
|