@ckeditor/ckeditor5-engine 49.0.0 → 49.1.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.
|
@@ -59,4 +59,9 @@ export interface DataProcessor {
|
|
|
59
59
|
* If `false`, comment nodes will be converted to `$comment`. Otherwise comment nodes are ignored.
|
|
60
60
|
*/
|
|
61
61
|
skipComments?: boolean;
|
|
62
|
+
/**
|
|
63
|
+
* If `false`, processing instruction nodes (for example `<?target data?>`) will be converted.
|
|
64
|
+
* Otherwise, processing instruction nodes are ignored.
|
|
65
|
+
*/
|
|
66
|
+
skipProcessingInstructions?: boolean;
|
|
62
67
|
}
|
|
@@ -25,8 +25,20 @@ export declare class HtmlDataProcessor implements DataProcessor {
|
|
|
25
25
|
* A basic HTML writer instance used to convert DOM elements to an HTML string.
|
|
26
26
|
*/
|
|
27
27
|
htmlWriter: DataProcessorHtmlWriter;
|
|
28
|
+
/**
|
|
29
|
+
* If `false`, comment nodes will be converted. Otherwise, comment nodes are ignored.
|
|
30
|
+
*
|
|
31
|
+
* @default true
|
|
32
|
+
*/
|
|
28
33
|
skipComments: boolean;
|
|
29
34
|
/**
|
|
35
|
+
* If `false`, processing instruction nodes (for example `<?target data?>`) will be converted.
|
|
36
|
+
* Otherwise, processing instruction nodes are ignored.
|
|
37
|
+
*
|
|
38
|
+
* @default true
|
|
39
|
+
*/
|
|
40
|
+
skipProcessingInstructions: boolean;
|
|
41
|
+
/**
|
|
30
42
|
* Creates a new instance of the HTML data processor class.
|
|
31
43
|
*
|
|
32
44
|
* @param document The view document instance.
|
|
@@ -35,8 +35,20 @@ export declare class XmlDataProcessor implements DataProcessor {
|
|
|
35
35
|
* There is no need to use a dedicated XML writer because the basic HTML writer works well in this case.
|
|
36
36
|
*/
|
|
37
37
|
htmlWriter: DataProcessorHtmlWriter;
|
|
38
|
+
/**
|
|
39
|
+
* If `false`, comment nodes will be converted. Otherwise, comment nodes are ignored.
|
|
40
|
+
*
|
|
41
|
+
* @default true
|
|
42
|
+
*/
|
|
38
43
|
skipComments: boolean;
|
|
39
44
|
/**
|
|
45
|
+
* If `false`, processing instruction nodes (for example `<?target data?>`) will be converted.
|
|
46
|
+
* Otherwise, processing instruction nodes are ignored.
|
|
47
|
+
*
|
|
48
|
+
* @default true
|
|
49
|
+
*/
|
|
50
|
+
skipProcessingInstructions: boolean;
|
|
51
|
+
/**
|
|
40
52
|
* Creates a new instance of the XML data processor class.
|
|
41
53
|
*
|
|
42
54
|
* @param document The view document instance.
|
package/dist/index.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
3
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
|
4
4
|
*/
|
|
5
|
-
import { CKEditorError, Collection, DomEmitterMixin, EmitterMixin, EventInfo, ObservableMixin, _trustedAttributeValue, compareArrays, count, diff, env, fastDiff, first, getActiveElement, getAncestors, getCode, getParentElement, getParentNode, getSelection, global, indexOf, insertAt, isArrowKeyCode, isComment, isDomSelectionBackward, isInsideCombinedSymbol, isInsideEmojiSequence, isInsideSurrogatePair, isIterable, isNode, isText, isValidAttributeName, keyCodes, logWarning, priorities, remove as remove$1, scrollViewportToShowTarget, spliceArray, toArray, toMap, trustedHtml, uid } from "@ckeditor/ckeditor5-utils";
|
|
5
|
+
import { CKEditorError, Collection, DomEmitterMixin, EmitterMixin, EventInfo, ObservableMixin, _trustedAttributeValue, compareArrays, count, diff, env, fastDiff, first, getActiveElement, getAncestors, getCode, getParentElement, getParentNode, getSelection, global, indexOf, insertAt, isArrowKeyCode, isComment, isDomSelectionBackward, isInsideCombinedSymbol, isInsideEmojiSequence, isInsideSurrogatePair, isIterable, isNode, isProcessingInstruction, isText, isValidAttributeName, keyCodes, logWarning, priorities, remove as remove$1, scrollViewportToShowTarget, spliceArray, toArray, toMap, trustedHtml, uid } from "@ckeditor/ckeditor5-utils";
|
|
6
6
|
import { clone, cloneDeep, debounce, extend, get, isEmpty, isEqual, isEqualWith, isObject, isPlainObject, merge, set } from "es-toolkit/compat";
|
|
7
7
|
|
|
8
8
|
/**
|
|
@@ -8352,7 +8352,7 @@ function addInlineFiller(domDocument, domParentOrArray, offset) {
|
|
|
8352
8352
|
* Nodes are considered similar if they have the same tag name.
|
|
8353
8353
|
*/
|
|
8354
8354
|
function areSimilarElements(node1, node2) {
|
|
8355
|
-
return isNode(node1) && isNode(node2) && !isText(node1) && !isText(node2) && !isComment(node1) && !isComment(node2) && node1.tagName.toLowerCase() === node2.tagName.toLowerCase();
|
|
8355
|
+
return isNode(node1) && isNode(node2) && !isText(node1) && !isText(node2) && !isComment(node1) && !isComment(node2) && !isProcessingInstruction(node1) && !isProcessingInstruction(node2) && node1.tagName.toLowerCase() === node2.tagName.toLowerCase();
|
|
8356
8356
|
}
|
|
8357
8357
|
/**
|
|
8358
8358
|
* Whether two DOM nodes are text nodes.
|
|
@@ -8729,7 +8729,8 @@ var ViewDomConverter = class {
|
|
|
8729
8729
|
domElement = this._domDocument.createDocumentFragment();
|
|
8730
8730
|
if (options.bind) this.bindDocumentFragments(domElement, viewElementOrFragment);
|
|
8731
8731
|
} else if (viewElementOrFragment.is("uiElement")) {
|
|
8732
|
-
if (viewElementOrFragment.name === "$
|
|
8732
|
+
if (viewElementOrFragment.name === "$processingInstruction") domElement = this._domDocument.createProcessingInstruction(viewElementOrFragment.getCustomProperty("$processingTarget"), viewElementOrFragment.getCustomProperty("$processingData"));
|
|
8733
|
+
else if (viewElementOrFragment.name === "$comment") domElement = this._domDocument.createComment(viewElementOrFragment.getCustomProperty("$rawContent"));
|
|
8733
8734
|
else domElement = viewElementOrFragment.render(this._domDocument, this);
|
|
8734
8735
|
if (options.bind) this.bindElements(domElement, viewElementOrFragment);
|
|
8735
8736
|
return domElement;
|
|
@@ -8910,6 +8911,7 @@ var ViewDomConverter = class {
|
|
|
8910
8911
|
* @param options.keepOriginalCase If `false`, node's tag name will be converted to lower case. False by default.
|
|
8911
8912
|
* @param options.skipComments If `false`, comment nodes will be converted to `$comment`
|
|
8912
8913
|
* {@link module:engine/view/uielement~ViewUIElement view UI elements}. False by default.
|
|
8914
|
+
* @param options.skipProcessingInstructions If `false`, processing instruction nodes will be converted to `$processingInstruction`
|
|
8913
8915
|
* @returns Converted node or document fragment or `null` if DOM node is a {@link module:engine/view/filler filler}
|
|
8914
8916
|
* or the given node is an empty text node.
|
|
8915
8917
|
*/
|
|
@@ -9296,6 +9298,7 @@ var ViewDomConverter = class {
|
|
|
9296
9298
|
const hostElement = this.getHostViewElement(domNode);
|
|
9297
9299
|
if (hostElement) return hostElement;
|
|
9298
9300
|
if (isComment(domNode) && options.skipComments) return null;
|
|
9301
|
+
if (isProcessingInstruction(domNode) && options.skipProcessingInstructions) return null;
|
|
9299
9302
|
if (isText(domNode)) {
|
|
9300
9303
|
if (isInlineFiller(domNode)) return null;
|
|
9301
9304
|
else {
|
|
@@ -9328,6 +9331,11 @@ var ViewDomConverter = class {
|
|
|
9328
9331
|
viewElement._setCustomProperty("$rawContent", domNode.data);
|
|
9329
9332
|
return viewElement;
|
|
9330
9333
|
}
|
|
9334
|
+
if (isProcessingInstruction(domNode)) {
|
|
9335
|
+
viewElement._setCustomProperty("$processingTarget", domNode.target);
|
|
9336
|
+
viewElement._setCustomProperty("$processingData", domNode.data);
|
|
9337
|
+
return viewElement;
|
|
9338
|
+
}
|
|
9331
9339
|
}
|
|
9332
9340
|
yield viewElement;
|
|
9333
9341
|
const nestedInlineNodes = [];
|
|
@@ -9509,6 +9517,7 @@ var ViewDomConverter = class {
|
|
|
9509
9517
|
*/
|
|
9510
9518
|
_createViewElement(node, options) {
|
|
9511
9519
|
if (isComment(node)) return new ViewUIElement(this.document, "$comment");
|
|
9520
|
+
if (isProcessingInstruction(node)) return new ViewUIElement(this.document, "$processingInstruction");
|
|
9512
9521
|
const viewName = options.keepOriginalCase ? node.tagName : node.tagName.toLowerCase();
|
|
9513
9522
|
return new ViewElement(this.document, viewName);
|
|
9514
9523
|
}
|
|
@@ -22197,8 +22206,20 @@ var HtmlDataProcessor = class {
|
|
|
22197
22206
|
* A basic HTML writer instance used to convert DOM elements to an HTML string.
|
|
22198
22207
|
*/
|
|
22199
22208
|
htmlWriter;
|
|
22209
|
+
/**
|
|
22210
|
+
* If `false`, comment nodes will be converted. Otherwise, comment nodes are ignored.
|
|
22211
|
+
*
|
|
22212
|
+
* @default true
|
|
22213
|
+
*/
|
|
22200
22214
|
skipComments = true;
|
|
22201
22215
|
/**
|
|
22216
|
+
* If `false`, processing instruction nodes (for example `<?target data?>`) will be converted.
|
|
22217
|
+
* Otherwise, processing instruction nodes are ignored.
|
|
22218
|
+
*
|
|
22219
|
+
* @default true
|
|
22220
|
+
*/
|
|
22221
|
+
skipProcessingInstructions = true;
|
|
22222
|
+
/**
|
|
22202
22223
|
* Creates a new instance of the HTML data processor class.
|
|
22203
22224
|
*
|
|
22204
22225
|
* @param document The view document instance.
|
|
@@ -22226,7 +22247,10 @@ var HtmlDataProcessor = class {
|
|
|
22226
22247
|
*/
|
|
22227
22248
|
toView(data) {
|
|
22228
22249
|
const domFragment = this._toDom(data);
|
|
22229
|
-
return this.domConverter.domToView(domFragment, {
|
|
22250
|
+
return this.domConverter.domToView(domFragment, {
|
|
22251
|
+
skipComments: this.skipComments,
|
|
22252
|
+
skipProcessingInstructions: this.skipProcessingInstructions
|
|
22253
|
+
});
|
|
22230
22254
|
}
|
|
22231
22255
|
/**
|
|
22232
22256
|
* Registers a {@link module:engine/view/matcher~MatcherPattern} for view elements whose content should be treated as raw data
|
|
@@ -23328,8 +23352,20 @@ var XmlDataProcessor = class {
|
|
|
23328
23352
|
* There is no need to use a dedicated XML writer because the basic HTML writer works well in this case.
|
|
23329
23353
|
*/
|
|
23330
23354
|
htmlWriter;
|
|
23355
|
+
/**
|
|
23356
|
+
* If `false`, comment nodes will be converted. Otherwise, comment nodes are ignored.
|
|
23357
|
+
*
|
|
23358
|
+
* @default true
|
|
23359
|
+
*/
|
|
23331
23360
|
skipComments = true;
|
|
23332
23361
|
/**
|
|
23362
|
+
* If `false`, processing instruction nodes (for example `<?target data?>`) will be converted.
|
|
23363
|
+
* Otherwise, processing instruction nodes are ignored.
|
|
23364
|
+
*
|
|
23365
|
+
* @default true
|
|
23366
|
+
*/
|
|
23367
|
+
skipProcessingInstructions = true;
|
|
23368
|
+
/**
|
|
23333
23369
|
* Creates a new instance of the XML data processor class.
|
|
23334
23370
|
*
|
|
23335
23371
|
* @param document The view document instance.
|
|
@@ -23362,7 +23398,8 @@ var XmlDataProcessor = class {
|
|
|
23362
23398
|
const domFragment = this._toDom(data);
|
|
23363
23399
|
return this.domConverter.domToView(domFragment, {
|
|
23364
23400
|
keepOriginalCase: true,
|
|
23365
|
-
skipComments: this.skipComments
|
|
23401
|
+
skipComments: this.skipComments,
|
|
23402
|
+
skipProcessingInstructions: this.skipProcessingInstructions
|
|
23366
23403
|
});
|
|
23367
23404
|
}
|
|
23368
23405
|
/**
|