@ckeditor/ckeditor5-engine 38.2.0-alpha.0 → 38.2.0-alpha.1
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/package.json +2 -2
- package/src/controller/datacontroller.d.ts +15 -15
- package/src/controller/datacontroller.js +11 -11
- package/src/controller/editingcontroller.d.ts +7 -7
- package/src/controller/editingcontroller.js +7 -7
- package/src/conversion/conversion.d.ts +6 -6
- package/src/conversion/conversion.js +2 -2
- package/src/conversion/downcastdispatcher.d.ts +13 -13
- package/src/conversion/downcastdispatcher.js +2 -2
- package/src/conversion/downcasthelpers.d.ts +19 -19
- package/src/conversion/downcasthelpers.js +9 -9
- package/src/conversion/mapper.d.ts +9 -9
- package/src/conversion/mapper.js +5 -5
- package/src/conversion/modelconsumable.d.ts +5 -5
- package/src/conversion/modelconsumable.js +1 -1
- package/src/conversion/upcastdispatcher.d.ts +12 -12
- package/src/conversion/upcastdispatcher.js +5 -5
- package/src/conversion/upcasthelpers.d.ts +9 -9
- package/src/conversion/upcasthelpers.js +3 -3
- package/src/conversion/viewconsumable.d.ts +5 -5
- package/src/dataprocessor/basichtmlwriter.d.ts +1 -1
- package/src/dataprocessor/dataprocessor.d.ts +2 -2
- package/src/dataprocessor/htmldataprocessor.d.ts +6 -6
- package/src/dataprocessor/htmldataprocessor.js +2 -2
- package/src/dataprocessor/xmldataprocessor.d.ts +6 -6
- package/src/dataprocessor/xmldataprocessor.js +2 -2
- package/src/dev-utils/model.d.ts +10 -10
- package/src/dev-utils/model.js +16 -16
- package/src/dev-utils/operationreplayer.d.ts +2 -2
- package/src/dev-utils/operationreplayer.js +1 -1
- package/src/dev-utils/view.d.ts +8 -8
- package/src/dev-utils/view.js +14 -14
- package/src/index.d.ts +106 -106
- package/src/index.js +64 -64
- package/src/model/batch.d.ts +1 -1
- package/src/model/differ.d.ts +5 -5
- package/src/model/differ.js +2 -2
- package/src/model/document.d.ts +11 -9
- package/src/model/document.js +4 -4
- package/src/model/documentfragment.d.ts +4 -4
- package/src/model/documentfragment.js +5 -5
- package/src/model/documentselection.d.ts +8 -8
- package/src/model/documentselection.js +10 -7
- package/src/model/element.d.ts +2 -2
- package/src/model/element.js +4 -4
- package/src/model/history.d.ts +1 -1
- package/src/model/item.d.ts +2 -2
- package/src/model/liveposition.d.ts +4 -4
- package/src/model/liveposition.js +1 -1
- package/src/model/liverange.d.ts +5 -5
- package/src/model/liverange.js +1 -1
- package/src/model/markercollection.d.ts +4 -4
- package/src/model/markercollection.js +2 -2
- package/src/model/model.d.ts +14 -14
- package/src/model/model.js +18 -18
- package/src/model/node.d.ts +5 -5
- package/src/model/node.js +2 -2
- package/src/model/nodelist.d.ts +1 -1
- package/src/model/nodelist.js +1 -1
- package/src/model/operation/attributeoperation.d.ts +4 -4
- package/src/model/operation/attributeoperation.js +3 -3
- package/src/model/operation/detachoperation.d.ts +3 -3
- package/src/model/operation/detachoperation.js +3 -3
- package/src/model/operation/insertoperation.d.ts +6 -6
- package/src/model/operation/insertoperation.js +7 -7
- package/src/model/operation/markeroperation.d.ts +5 -5
- package/src/model/operation/markeroperation.js +2 -2
- package/src/model/operation/mergeoperation.d.ts +5 -5
- package/src/model/operation/mergeoperation.js +5 -5
- package/src/model/operation/moveoperation.d.ts +4 -4
- package/src/model/operation/moveoperation.js +4 -4
- package/src/model/operation/nooperation.d.ts +2 -2
- package/src/model/operation/nooperation.js +1 -1
- package/src/model/operation/operation.d.ts +3 -3
- package/src/model/operation/operationfactory.d.ts +2 -2
- package/src/model/operation/operationfactory.js +11 -11
- package/src/model/operation/renameoperation.d.ts +4 -4
- package/src/model/operation/renameoperation.js +3 -3
- package/src/model/operation/rootattributeoperation.d.ts +4 -4
- package/src/model/operation/rootattributeoperation.js +1 -1
- package/src/model/operation/rootoperation.d.ts +3 -3
- package/src/model/operation/rootoperation.js +1 -1
- package/src/model/operation/splitoperation.d.ts +5 -5
- package/src/model/operation/splitoperation.js +5 -5
- package/src/model/operation/transform.d.ts +2 -2
- package/src/model/operation/transform.js +12 -12
- package/src/model/operation/utils.d.ts +6 -6
- package/src/model/operation/utils.js +4 -4
- package/src/model/position.d.ts +14 -14
- package/src/model/position.js +3 -3
- package/src/model/range.d.ts +12 -12
- package/src/model/range.js +3 -3
- package/src/model/rootelement.d.ts +2 -2
- package/src/model/rootelement.js +1 -1
- package/src/model/schema.d.ts +19 -9
- package/src/model/schema.js +5 -5
- package/src/model/selection.d.ts +7 -7
- package/src/model/selection.js +4 -4
- package/src/model/text.d.ts +1 -1
- package/src/model/text.js +1 -1
- package/src/model/textproxy.d.ts +5 -5
- package/src/model/textproxy.js +1 -1
- package/src/model/treewalker.d.ts +3 -3
- package/src/model/treewalker.js +4 -4
- package/src/model/typecheckable.d.ts +13 -13
- package/src/model/utils/autoparagraphing.d.ts +4 -4
- package/src/model/utils/deletecontent.d.ts +3 -3
- package/src/model/utils/deletecontent.js +3 -3
- package/src/model/utils/findoptimalinsertionrange.d.ts +4 -4
- package/src/model/utils/getselectedcontent.d.ts +4 -4
- package/src/model/utils/insertcontent.d.ts +6 -6
- package/src/model/utils/insertcontent.js +6 -6
- package/src/model/utils/insertobject.d.ts +5 -5
- package/src/model/utils/insertobject.js +1 -1
- package/src/model/utils/modifyselection.d.ts +3 -3
- package/src/model/utils/modifyselection.js +4 -4
- package/src/model/utils/selection-post-fixer.d.ts +3 -3
- package/src/model/utils/selection-post-fixer.js +2 -2
- package/src/model/writer.d.ts +12 -12
- package/src/model/writer.js +17 -17
- package/src/view/attributeelement.d.ts +3 -3
- package/src/view/attributeelement.js +1 -1
- package/src/view/containerelement.d.ts +3 -3
- package/src/view/containerelement.js +1 -1
- package/src/view/document.d.ts +4 -4
- package/src/view/document.js +2 -2
- package/src/view/documentfragment.d.ts +4 -4
- package/src/view/documentfragment.js +3 -3
- package/src/view/documentselection.d.ts +8 -8
- package/src/view/documentselection.js +2 -2
- package/src/view/domconverter.d.ts +50 -66
- package/src/view/domconverter.js +258 -224
- package/src/view/downcastwriter.d.ts +17 -17
- package/src/view/downcastwriter.js +11 -11
- package/src/view/editableelement.d.ts +4 -4
- package/src/view/editableelement.js +1 -1
- package/src/view/element.d.ts +5 -5
- package/src/view/element.js +5 -5
- package/src/view/emptyelement.d.ts +4 -4
- package/src/view/emptyelement.js +2 -2
- package/src/view/filler.d.ts +3 -3
- package/src/view/filler.js +6 -4
- package/src/view/item.d.ts +2 -2
- package/src/view/matcher.d.ts +1 -1
- package/src/view/node.d.ts +5 -5
- package/src/view/node.js +2 -2
- package/src/view/observer/arrowkeysobserver.d.ts +4 -4
- package/src/view/observer/arrowkeysobserver.js +2 -2
- package/src/view/observer/bubblingemittermixin.d.ts +2 -2
- package/src/view/observer/bubblingemittermixin.js +1 -1
- package/src/view/observer/bubblingeventinfo.d.ts +3 -3
- package/src/view/observer/clickobserver.d.ts +3 -3
- package/src/view/observer/clickobserver.js +1 -1
- package/src/view/observer/compositionobserver.d.ts +3 -3
- package/src/view/observer/compositionobserver.js +1 -1
- package/src/view/observer/domeventdata.d.ts +3 -3
- package/src/view/observer/domeventobserver.d.ts +1 -1
- package/src/view/observer/domeventobserver.js +2 -2
- package/src/view/observer/fakeselectionobserver.d.ts +2 -2
- package/src/view/observer/fakeselectionobserver.js +2 -2
- package/src/view/observer/focusobserver.d.ts +3 -3
- package/src/view/observer/focusobserver.js +1 -1
- package/src/view/observer/inputobserver.d.ts +4 -4
- package/src/view/observer/inputobserver.js +2 -2
- package/src/view/observer/keyobserver.d.ts +2 -2
- package/src/view/observer/keyobserver.js +1 -1
- package/src/view/observer/mouseobserver.d.ts +2 -2
- package/src/view/observer/mouseobserver.js +1 -1
- package/src/view/observer/mutationobserver.d.ts +4 -4
- package/src/view/observer/mutationobserver.js +2 -2
- package/src/view/observer/observer.d.ts +2 -2
- package/src/view/observer/selectionobserver.d.ts +7 -7
- package/src/view/observer/selectionobserver.js +3 -3
- package/src/view/observer/tabobserver.d.ts +4 -4
- package/src/view/observer/tabobserver.js +2 -2
- package/src/view/placeholder.d.ts +3 -3
- package/src/view/position.d.ts +7 -7
- package/src/view/position.js +4 -4
- package/src/view/range.d.ts +7 -7
- package/src/view/range.js +3 -3
- package/src/view/rawelement.d.ts +5 -5
- package/src/view/rawelement.js +2 -2
- package/src/view/renderer.d.ts +5 -5
- package/src/view/renderer.js +3 -3
- package/src/view/rooteditableelement.d.ts +2 -2
- package/src/view/rooteditableelement.js +1 -1
- package/src/view/selection.d.ts +8 -8
- package/src/view/selection.js +5 -5
- package/src/view/styles/background.d.ts +1 -1
- package/src/view/styles/background.js +1 -1
- package/src/view/styles/border.d.ts +1 -1
- package/src/view/styles/border.js +1 -1
- package/src/view/styles/margin.d.ts +1 -1
- package/src/view/styles/margin.js +1 -1
- package/src/view/styles/padding.d.ts +1 -1
- package/src/view/styles/padding.js +1 -1
- package/src/view/styles/utils.d.ts +1 -1
- package/src/view/text.d.ts +2 -2
- package/src/view/text.js +1 -1
- package/src/view/textproxy.d.ts +6 -6
- package/src/view/textproxy.js +1 -1
- package/src/view/treewalker.d.ts +3 -3
- package/src/view/treewalker.js +4 -4
- package/src/view/typecheckable.d.ts +16 -16
- package/src/view/uielement.d.ts +6 -6
- package/src/view/uielement.js +2 -2
- package/src/view/upcastwriter.d.ts +9 -9
- package/src/view/upcastwriter.js +6 -6
- package/src/view/view.d.ts +12 -12
- package/src/view/view.js +18 -18
package/src/view/domconverter.js
CHANGED
|
@@ -6,16 +6,16 @@
|
|
|
6
6
|
* @module engine/view/domconverter
|
|
7
7
|
*/
|
|
8
8
|
/* globals Node, NodeFilter, DOMParser, Text */
|
|
9
|
-
import ViewText from './text';
|
|
10
|
-
import ViewElement from './element';
|
|
11
|
-
import ViewUIElement from './uielement';
|
|
12
|
-
import ViewPosition from './position';
|
|
13
|
-
import ViewRange from './range';
|
|
14
|
-
import ViewSelection from './selection';
|
|
15
|
-
import ViewDocumentFragment from './documentfragment';
|
|
16
|
-
import ViewTreeWalker from './treewalker';
|
|
17
|
-
import { default as Matcher } from './matcher';
|
|
18
|
-
import { BR_FILLER, INLINE_FILLER_LENGTH, NBSP_FILLER, MARKED_NBSP_FILLER, getDataWithoutFiller, isInlineFiller, startsWithFiller } from './filler';
|
|
9
|
+
import ViewText from './text.js';
|
|
10
|
+
import ViewElement from './element.js';
|
|
11
|
+
import ViewUIElement from './uielement.js';
|
|
12
|
+
import ViewPosition from './position.js';
|
|
13
|
+
import ViewRange from './range.js';
|
|
14
|
+
import ViewSelection from './selection.js';
|
|
15
|
+
import ViewDocumentFragment from './documentfragment.js';
|
|
16
|
+
import ViewTreeWalker from './treewalker.js';
|
|
17
|
+
import { default as Matcher } from './matcher.js';
|
|
18
|
+
import { BR_FILLER, INLINE_FILLER_LENGTH, NBSP_FILLER, MARKED_NBSP_FILLER, getDataWithoutFiller, isInlineFiller, startsWithFiller } from './filler.js';
|
|
19
19
|
import { global, logWarning, indexOf, getAncestors, isText, isComment, isValidAttributeName, first } from '@ckeditor/ckeditor5-utils';
|
|
20
20
|
const BR_FILLER_REF = BR_FILLER(global.document); // eslint-disable-line new-cap
|
|
21
21
|
const NBSP_FILLER_REF = NBSP_FILLER(global.document); // eslint-disable-line new-cap
|
|
@@ -67,9 +67,9 @@ export default class DomConverter {
|
|
|
67
67
|
*/
|
|
68
68
|
this._rawContentElementMatcher = new Matcher();
|
|
69
69
|
/**
|
|
70
|
-
*
|
|
70
|
+
* Matcher for inline object view elements. This is an extension of a simple {@link #inlineObjectElements} array of element names.
|
|
71
71
|
*/
|
|
72
|
-
this.
|
|
72
|
+
this._inlineObjectElementMatcher = new Matcher();
|
|
73
73
|
this.document = document;
|
|
74
74
|
this.renderingMode = renderingMode;
|
|
75
75
|
this.blockFillerMode = blockFillerMode || (renderingMode === 'editing' ? 'br' : 'nbsp');
|
|
@@ -472,68 +472,22 @@ export default class DomConverter {
|
|
|
472
472
|
* or the given node is an empty text node.
|
|
473
473
|
*/
|
|
474
474
|
domToView(domNode, options = {}) {
|
|
475
|
-
|
|
475
|
+
const inlineNodes = [];
|
|
476
|
+
const generator = this._domToView(domNode, options, inlineNodes);
|
|
477
|
+
// Get the first yielded value or a returned value.
|
|
478
|
+
const node = generator.next().value;
|
|
479
|
+
if (!node) {
|
|
476
480
|
return null;
|
|
477
481
|
}
|
|
478
|
-
//
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
if (
|
|
482
|
+
// Trigger children handling.
|
|
483
|
+
generator.next();
|
|
484
|
+
// Whitespace cleaning.
|
|
485
|
+
this._processDomInlineNodes(null, inlineNodes, options);
|
|
486
|
+
// Text not got trimmed to an empty string so there is no result node.
|
|
487
|
+
if (node.is('$text') && node.data.length == 0) {
|
|
484
488
|
return null;
|
|
485
489
|
}
|
|
486
|
-
|
|
487
|
-
if (isInlineFiller(domNode)) {
|
|
488
|
-
return null;
|
|
489
|
-
}
|
|
490
|
-
else {
|
|
491
|
-
const textData = this._processDataFromDomText(domNode);
|
|
492
|
-
return textData === '' ? null : new ViewText(this.document, textData);
|
|
493
|
-
}
|
|
494
|
-
}
|
|
495
|
-
else {
|
|
496
|
-
if (this.mapDomToView(domNode)) {
|
|
497
|
-
return this.mapDomToView(domNode);
|
|
498
|
-
}
|
|
499
|
-
let viewElement;
|
|
500
|
-
if (this.isDocumentFragment(domNode)) {
|
|
501
|
-
// Create view document fragment.
|
|
502
|
-
viewElement = new ViewDocumentFragment(this.document);
|
|
503
|
-
if (options.bind) {
|
|
504
|
-
this.bindDocumentFragments(domNode, viewElement);
|
|
505
|
-
}
|
|
506
|
-
}
|
|
507
|
-
else {
|
|
508
|
-
// Create view element.
|
|
509
|
-
viewElement = this._createViewElement(domNode, options);
|
|
510
|
-
if (options.bind) {
|
|
511
|
-
this.bindElements(domNode, viewElement);
|
|
512
|
-
}
|
|
513
|
-
// Copy element's attributes.
|
|
514
|
-
const attrs = domNode.attributes;
|
|
515
|
-
if (attrs) {
|
|
516
|
-
for (let l = attrs.length, i = 0; i < l; i++) {
|
|
517
|
-
viewElement._setAttribute(attrs[i].name, attrs[i].value);
|
|
518
|
-
}
|
|
519
|
-
}
|
|
520
|
-
// Treat this element's content as a raw data if it was registered as such.
|
|
521
|
-
// Comment node is also treated as an element with raw data.
|
|
522
|
-
if (this._isViewElementWithRawContent(viewElement, options) || isComment(domNode)) {
|
|
523
|
-
const rawContent = isComment(domNode) ? domNode.data : domNode.innerHTML;
|
|
524
|
-
viewElement._setCustomProperty('$rawContent', rawContent);
|
|
525
|
-
// Store a DOM node to prevent left trimming of the following text node.
|
|
526
|
-
this._encounteredRawContentDomNodes.add(domNode);
|
|
527
|
-
return viewElement;
|
|
528
|
-
}
|
|
529
|
-
}
|
|
530
|
-
if (options.withChildren !== false) {
|
|
531
|
-
for (const child of this.domChildrenToView(domNode, options)) {
|
|
532
|
-
viewElement._appendChild(child);
|
|
533
|
-
}
|
|
534
|
-
}
|
|
535
|
-
return viewElement;
|
|
536
|
-
}
|
|
490
|
+
return node;
|
|
537
491
|
}
|
|
538
492
|
/**
|
|
539
493
|
* Converts children of the DOM element to view nodes using
|
|
@@ -542,16 +496,27 @@ export default class DomConverter {
|
|
|
542
496
|
*
|
|
543
497
|
* @param domElement Parent DOM element.
|
|
544
498
|
* @param options See {@link module:engine/view/domconverter~DomConverter#domToView} options parameter.
|
|
499
|
+
* @param inlineNodes An array that will be populated with inline nodes. It's used internally for whitespace processing.
|
|
545
500
|
* @returns View nodes.
|
|
546
501
|
*/
|
|
547
|
-
*domChildrenToView(domElement, options) {
|
|
502
|
+
*domChildrenToView(domElement, options = {}, inlineNodes = []) {
|
|
548
503
|
for (let i = 0; i < domElement.childNodes.length; i++) {
|
|
549
504
|
const domChild = domElement.childNodes[i];
|
|
550
|
-
const
|
|
505
|
+
const generator = this._domToView(domChild, options, inlineNodes);
|
|
506
|
+
// Get the first yielded value or a returned value.
|
|
507
|
+
const viewChild = generator.next().value;
|
|
551
508
|
if (viewChild !== null) {
|
|
509
|
+
// Whitespace cleaning before entering a block element (between block elements).
|
|
510
|
+
if (this._isBlockViewElement(viewChild)) {
|
|
511
|
+
this._processDomInlineNodes(domElement, inlineNodes, options);
|
|
512
|
+
}
|
|
552
513
|
yield viewChild;
|
|
514
|
+
// Trigger children handling.
|
|
515
|
+
generator.next();
|
|
553
516
|
}
|
|
554
517
|
}
|
|
518
|
+
// Whitespace cleaning before leaving a block element (content of block element).
|
|
519
|
+
this._processDomInlineNodes(domElement, inlineNodes, options);
|
|
555
520
|
}
|
|
556
521
|
/**
|
|
557
522
|
* Converts DOM selection to view {@link module:engine/view/selection~Selection}.
|
|
@@ -925,6 +890,19 @@ export default class DomConverter {
|
|
|
925
890
|
registerRawContentMatcher(pattern) {
|
|
926
891
|
this._rawContentElementMatcher.add(pattern);
|
|
927
892
|
}
|
|
893
|
+
/**
|
|
894
|
+
* Registers a {@link module:engine/view/matcher~MatcherPattern} for inline object view elements.
|
|
895
|
+
*
|
|
896
|
+
* This is affecting how {@link module:engine/view/domconverter~DomConverter#domToView} and
|
|
897
|
+
* {@link module:engine/view/domconverter~DomConverter#domChildrenToView} process DOM nodes.
|
|
898
|
+
*
|
|
899
|
+
* This is an extension of a simple {@link #inlineObjectElements} array of element names.
|
|
900
|
+
*
|
|
901
|
+
* @param pattern Pattern matching a view element which should be treated as an inline object.
|
|
902
|
+
*/
|
|
903
|
+
registerInlineObjectMatcher(pattern) {
|
|
904
|
+
this._inlineObjectElementMatcher.add(pattern);
|
|
905
|
+
}
|
|
928
906
|
/**
|
|
929
907
|
* Returns the block {@link module:engine/view/filler filler} node based on the current {@link #blockFillerMode} setting.
|
|
930
908
|
*/
|
|
@@ -964,6 +942,194 @@ export default class DomConverter {
|
|
|
964
942
|
}
|
|
965
943
|
return true;
|
|
966
944
|
}
|
|
945
|
+
/**
|
|
946
|
+
* Internal generator for {@link #domToView}. Also used by {@link #domChildrenToView}.
|
|
947
|
+
* Separates DOM nodes conversion from whitespaces processing.
|
|
948
|
+
*
|
|
949
|
+
* @param domNode DOM node or document fragment to transform.
|
|
950
|
+
* @param inlineNodes An array of recently encountered inline nodes truncated to the block element boundaries.
|
|
951
|
+
* Used later to process whitespaces.
|
|
952
|
+
*/
|
|
953
|
+
*_domToView(domNode, options, inlineNodes) {
|
|
954
|
+
if (this.isBlockFiller(domNode)) {
|
|
955
|
+
return null;
|
|
956
|
+
}
|
|
957
|
+
// When node is inside a UIElement or a RawElement return that parent as it's view representation.
|
|
958
|
+
const hostElement = this.getHostViewElement(domNode);
|
|
959
|
+
if (hostElement) {
|
|
960
|
+
return hostElement;
|
|
961
|
+
}
|
|
962
|
+
if (isComment(domNode) && options.skipComments) {
|
|
963
|
+
return null;
|
|
964
|
+
}
|
|
965
|
+
if (isText(domNode)) {
|
|
966
|
+
if (isInlineFiller(domNode)) {
|
|
967
|
+
return null;
|
|
968
|
+
}
|
|
969
|
+
else {
|
|
970
|
+
const textData = domNode.data;
|
|
971
|
+
if (textData === '') {
|
|
972
|
+
return null;
|
|
973
|
+
}
|
|
974
|
+
const textNode = new ViewText(this.document, textData);
|
|
975
|
+
inlineNodes.push(textNode);
|
|
976
|
+
return textNode;
|
|
977
|
+
}
|
|
978
|
+
}
|
|
979
|
+
else {
|
|
980
|
+
let viewElement = this.mapDomToView(domNode);
|
|
981
|
+
if (viewElement) {
|
|
982
|
+
if (this._isInlineObjectElement(viewElement)) {
|
|
983
|
+
inlineNodes.push(viewElement);
|
|
984
|
+
}
|
|
985
|
+
return viewElement;
|
|
986
|
+
}
|
|
987
|
+
if (this.isDocumentFragment(domNode)) {
|
|
988
|
+
// Create view document fragment.
|
|
989
|
+
viewElement = new ViewDocumentFragment(this.document);
|
|
990
|
+
if (options.bind) {
|
|
991
|
+
this.bindDocumentFragments(domNode, viewElement);
|
|
992
|
+
}
|
|
993
|
+
}
|
|
994
|
+
else {
|
|
995
|
+
// Create view element.
|
|
996
|
+
viewElement = this._createViewElement(domNode, options);
|
|
997
|
+
if (options.bind) {
|
|
998
|
+
this.bindElements(domNode, viewElement);
|
|
999
|
+
}
|
|
1000
|
+
// Copy element's attributes.
|
|
1001
|
+
const attrs = domNode.attributes;
|
|
1002
|
+
if (attrs) {
|
|
1003
|
+
for (let l = attrs.length, i = 0; i < l; i++) {
|
|
1004
|
+
viewElement._setAttribute(attrs[i].name, attrs[i].value);
|
|
1005
|
+
}
|
|
1006
|
+
}
|
|
1007
|
+
// Treat this element's content as a raw data if it was registered as such.
|
|
1008
|
+
if (this._isViewElementWithRawContent(viewElement, options)) {
|
|
1009
|
+
viewElement._setCustomProperty('$rawContent', domNode.innerHTML);
|
|
1010
|
+
if (!this._isBlockViewElement(viewElement)) {
|
|
1011
|
+
inlineNodes.push(viewElement);
|
|
1012
|
+
}
|
|
1013
|
+
return viewElement;
|
|
1014
|
+
}
|
|
1015
|
+
// Comment node is also treated as an element with raw data.
|
|
1016
|
+
if (isComment(domNode)) {
|
|
1017
|
+
viewElement._setCustomProperty('$rawContent', domNode.data);
|
|
1018
|
+
return viewElement;
|
|
1019
|
+
}
|
|
1020
|
+
}
|
|
1021
|
+
// Yield the element first so the flow of nested inline nodes is not reversed inside elements.
|
|
1022
|
+
yield viewElement;
|
|
1023
|
+
const nestedInlineNodes = [];
|
|
1024
|
+
if (options.withChildren !== false) {
|
|
1025
|
+
for (const child of this.domChildrenToView(domNode, options, nestedInlineNodes)) {
|
|
1026
|
+
viewElement._appendChild(child);
|
|
1027
|
+
}
|
|
1028
|
+
}
|
|
1029
|
+
// Check if this is an inline object after processing child nodes so matcher
|
|
1030
|
+
// for inline objects can verify if the element is empty.
|
|
1031
|
+
if (this._isInlineObjectElement(viewElement)) {
|
|
1032
|
+
inlineNodes.push(viewElement);
|
|
1033
|
+
}
|
|
1034
|
+
else {
|
|
1035
|
+
// It's an inline element that is not an object (like <b>, <i>) or a block element.
|
|
1036
|
+
for (const inlineNode of nestedInlineNodes) {
|
|
1037
|
+
inlineNodes.push(inlineNode);
|
|
1038
|
+
}
|
|
1039
|
+
}
|
|
1040
|
+
}
|
|
1041
|
+
}
|
|
1042
|
+
/**
|
|
1043
|
+
* Internal helper that walks the list of inline view nodes already generated from DOM nodes
|
|
1044
|
+
* and handles whitespaces and NBSPs.
|
|
1045
|
+
*
|
|
1046
|
+
* @param domParent The DOM parent of the given inline nodes. This should be a document fragment or
|
|
1047
|
+
* a block element to whitespace processing start cleaning.
|
|
1048
|
+
* @param inlineNodes An array of recently encountered inline nodes truncated to the block element boundaries.
|
|
1049
|
+
*/
|
|
1050
|
+
_processDomInlineNodes(domParent, inlineNodes, options) {
|
|
1051
|
+
if (!inlineNodes.length) {
|
|
1052
|
+
return;
|
|
1053
|
+
}
|
|
1054
|
+
// Process text nodes only after reaching a block or document fragment,
|
|
1055
|
+
// do not alter whitespaces while processing an inline element like <b> or <i>.
|
|
1056
|
+
if (domParent && !this.isDocumentFragment(domParent) && !this._isBlockDomElement(domParent)) {
|
|
1057
|
+
return;
|
|
1058
|
+
}
|
|
1059
|
+
let prevNodeEndsWithSpace = false;
|
|
1060
|
+
for (let i = 0; i < inlineNodes.length; i++) {
|
|
1061
|
+
const node = inlineNodes[i];
|
|
1062
|
+
if (!node.is('$text')) {
|
|
1063
|
+
prevNodeEndsWithSpace = false;
|
|
1064
|
+
continue;
|
|
1065
|
+
}
|
|
1066
|
+
let data;
|
|
1067
|
+
let nodeEndsWithSpace = false;
|
|
1068
|
+
if (_hasViewParentOfType(node, this.preElements)) {
|
|
1069
|
+
data = getDataWithoutFiller(node.data);
|
|
1070
|
+
}
|
|
1071
|
+
else {
|
|
1072
|
+
// Change all consecutive whitespace characters (from the [ \n\t\r] set –
|
|
1073
|
+
// see https://github.com/ckeditor/ckeditor5-engine/issues/822#issuecomment-311670249) to a single space character.
|
|
1074
|
+
// That's how multiple whitespaces are treated when rendered, so we normalize those whitespaces.
|
|
1075
|
+
// We're replacing 1+ (and not 2+) to also normalize singular \n\t\r characters (#822).
|
|
1076
|
+
data = node.data.replace(/[ \n\t\r]{1,}/g, ' ');
|
|
1077
|
+
nodeEndsWithSpace = /[^\S\u00A0]/.test(data.charAt(data.length - 1));
|
|
1078
|
+
const prevNode = i > 0 ? inlineNodes[i - 1] : null;
|
|
1079
|
+
const nextNode = i + 1 < inlineNodes.length ? inlineNodes[i + 1] : null;
|
|
1080
|
+
const shouldLeftTrim = !prevNode || prevNode.is('element') && prevNode.name == 'br' || prevNodeEndsWithSpace;
|
|
1081
|
+
const shouldRightTrim = nextNode ? false : !startsWithFiller(node.data);
|
|
1082
|
+
// Do not try to clear whitespaces if this is flat mapping for the purpose of mutation observer and differ in rendering.
|
|
1083
|
+
if (options.withChildren !== false) {
|
|
1084
|
+
// If the previous dom text node does not exist or it ends by whitespace character, remove space character from the
|
|
1085
|
+
// beginning of this text node. Such space character is treated as a whitespace.
|
|
1086
|
+
if (shouldLeftTrim) {
|
|
1087
|
+
data = data.replace(/^ /, '');
|
|
1088
|
+
}
|
|
1089
|
+
// If the next text node does not exist remove space character from the end of this text node.
|
|
1090
|
+
if (shouldRightTrim) {
|
|
1091
|
+
data = data.replace(/ $/, '');
|
|
1092
|
+
}
|
|
1093
|
+
}
|
|
1094
|
+
// At the beginning and end of a block element, Firefox inserts normal space + <br> instead of non-breaking space.
|
|
1095
|
+
// This means that the text node starts/end with normal space instead of non-breaking space.
|
|
1096
|
+
// This causes a problem because the normal space would be removed in `.replace` calls above. To prevent that,
|
|
1097
|
+
// the inline filler is removed only after the data is initially processed (by the `.replace` above). See ckeditor5#692.
|
|
1098
|
+
data = getDataWithoutFiller(data);
|
|
1099
|
+
// At this point we should have removed all whitespaces from DOM text data.
|
|
1100
|
+
//
|
|
1101
|
+
// Now, We will reverse the process that happens in `_processDataFromViewText`.
|
|
1102
|
+
//
|
|
1103
|
+
// We have to change chars, that were in DOM text data because of rendering reasons, to spaces.
|
|
1104
|
+
// First, change all ` \u00A0` pairs (space + ) to two spaces. DOM converter changes two spaces from model/view to
|
|
1105
|
+
// ` \u00A0` to ensure proper rendering. Since here we convert back, we recognize those pairs and change them back to ` `.
|
|
1106
|
+
data = data.replace(/ \u00A0/g, ' ');
|
|
1107
|
+
const isNextNodeInlineObjectElement = nextNode && nextNode.is('element') && nextNode.name != 'br';
|
|
1108
|
+
const isNextNodeStartingWithSpace = nextNode && nextNode.is('$text') && nextNode.data.charAt(0) == ' ';
|
|
1109
|
+
// Then, let's change the last nbsp to a space.
|
|
1110
|
+
if (/[ \u00A0]\u00A0$/.test(data) || !nextNode || isNextNodeInlineObjectElement || isNextNodeStartingWithSpace) {
|
|
1111
|
+
data = data.replace(/\u00A0$/, ' ');
|
|
1112
|
+
}
|
|
1113
|
+
// Then, change character that is at the beginning of the text node to space character.
|
|
1114
|
+
// We do that replacement only if this is the first node or the previous node ends on whitespace character.
|
|
1115
|
+
if (shouldLeftTrim || prevNode && prevNode.is('element') && prevNode.name != 'br') {
|
|
1116
|
+
data = data.replace(/^\u00A0/, ' ');
|
|
1117
|
+
}
|
|
1118
|
+
}
|
|
1119
|
+
// At this point, all whitespaces should be removed and all created for rendering reasons should be
|
|
1120
|
+
// changed to normal space. All left are inserted intentionally.
|
|
1121
|
+
if (data.length == 0 && node.parent) {
|
|
1122
|
+
node._remove();
|
|
1123
|
+
inlineNodes.splice(i, 1);
|
|
1124
|
+
i--;
|
|
1125
|
+
}
|
|
1126
|
+
else {
|
|
1127
|
+
node._data = data;
|
|
1128
|
+
prevNodeEndsWithSpace = nodeEndsWithSpace;
|
|
1129
|
+
}
|
|
1130
|
+
}
|
|
1131
|
+
inlineNodes.length = 0;
|
|
1132
|
+
}
|
|
967
1133
|
/**
|
|
968
1134
|
* Takes text data from a given {@link module:engine/view/text~Text#data} and processes it so
|
|
969
1135
|
* it is correctly displayed in the DOM.
|
|
@@ -1029,103 +1195,6 @@ export default class DomConverter {
|
|
|
1029
1195
|
const data = this._processDataFromViewText(node);
|
|
1030
1196
|
return data.charAt(data.length - 1) == ' ';
|
|
1031
1197
|
}
|
|
1032
|
-
/**
|
|
1033
|
-
* Takes text data from native `Text` node and processes it to a correct {@link module:engine/view/text~Text view text node} data.
|
|
1034
|
-
*
|
|
1035
|
-
* Following changes are done:
|
|
1036
|
-
*
|
|
1037
|
-
* * multiple whitespaces are replaced to a single space,
|
|
1038
|
-
* * space at the beginning of a text node is removed if it is the first text node in its container
|
|
1039
|
-
* element or if the previous text node ends with a space character,
|
|
1040
|
-
* * space at the end of the text node is removed if there are two spaces at the end of a node or if next node
|
|
1041
|
-
* starts with a space or if it is the last text node in its container
|
|
1042
|
-
* * nbsps are converted to spaces.
|
|
1043
|
-
*
|
|
1044
|
-
* @param node DOM text node to process.
|
|
1045
|
-
* @returns Processed data.
|
|
1046
|
-
*/
|
|
1047
|
-
_processDataFromDomText(node) {
|
|
1048
|
-
let data = node.data;
|
|
1049
|
-
if (_hasDomParentOfType(node, this.preElements)) {
|
|
1050
|
-
return getDataWithoutFiller(node);
|
|
1051
|
-
}
|
|
1052
|
-
// Change all consecutive whitespace characters (from the [ \n\t\r] set –
|
|
1053
|
-
// see https://github.com/ckeditor/ckeditor5-engine/issues/822#issuecomment-311670249) to a single space character.
|
|
1054
|
-
// That's how multiple whitespaces are treated when rendered, so we normalize those whitespaces.
|
|
1055
|
-
// We're replacing 1+ (and not 2+) to also normalize singular \n\t\r characters (#822).
|
|
1056
|
-
data = data.replace(/[ \n\t\r]{1,}/g, ' ');
|
|
1057
|
-
const prevNode = this._getTouchingInlineDomNode(node, false);
|
|
1058
|
-
const nextNode = this._getTouchingInlineDomNode(node, true);
|
|
1059
|
-
const shouldLeftTrim = this._checkShouldLeftTrimDomText(node, prevNode);
|
|
1060
|
-
const shouldRightTrim = this._checkShouldRightTrimDomText(node, nextNode);
|
|
1061
|
-
// If the previous dom text node does not exist or it ends by whitespace character, remove space character from the beginning
|
|
1062
|
-
// of this text node. Such space character is treated as a whitespace.
|
|
1063
|
-
if (shouldLeftTrim) {
|
|
1064
|
-
data = data.replace(/^ /, '');
|
|
1065
|
-
}
|
|
1066
|
-
// If the next text node does not exist remove space character from the end of this text node.
|
|
1067
|
-
if (shouldRightTrim) {
|
|
1068
|
-
data = data.replace(/ $/, '');
|
|
1069
|
-
}
|
|
1070
|
-
// At the beginning and end of a block element, Firefox inserts normal space + <br> instead of non-breaking space.
|
|
1071
|
-
// This means that the text node starts/end with normal space instead of non-breaking space.
|
|
1072
|
-
// This causes a problem because the normal space would be removed in `.replace` calls above. To prevent that,
|
|
1073
|
-
// the inline filler is removed only after the data is initially processed (by the `.replace` above). See ckeditor5#692.
|
|
1074
|
-
data = getDataWithoutFiller(new Text(data));
|
|
1075
|
-
// At this point we should have removed all whitespaces from DOM text data.
|
|
1076
|
-
//
|
|
1077
|
-
// Now, We will reverse the process that happens in `_processDataFromViewText`.
|
|
1078
|
-
//
|
|
1079
|
-
// We have to change chars, that were in DOM text data because of rendering reasons, to spaces.
|
|
1080
|
-
// First, change all ` \u00A0` pairs (space + ) to two spaces. DOM converter changes two spaces from model/view to
|
|
1081
|
-
// ` \u00A0` to ensure proper rendering. Since here we convert back, we recognize those pairs and change them back to ` `.
|
|
1082
|
-
data = data.replace(/ \u00A0/g, ' ');
|
|
1083
|
-
const isNextNodeInlineObjectElement = nextNode && this.isElement(nextNode) && nextNode.tagName != 'BR';
|
|
1084
|
-
const isNextNodeStartingWithSpace = nextNode && isText(nextNode) && nextNode.data.charAt(0) == ' ';
|
|
1085
|
-
// Then, let's change the last nbsp to a space.
|
|
1086
|
-
if (/( |\u00A0)\u00A0$/.test(data) || !nextNode || isNextNodeInlineObjectElement || isNextNodeStartingWithSpace) {
|
|
1087
|
-
data = data.replace(/\u00A0$/, ' ');
|
|
1088
|
-
}
|
|
1089
|
-
// Then, change character that is at the beginning of the text node to space character.
|
|
1090
|
-
// We do that replacement only if this is the first node or the previous node ends on whitespace character.
|
|
1091
|
-
if (shouldLeftTrim || prevNode && this.isElement(prevNode) && prevNode.tagName != 'BR') {
|
|
1092
|
-
data = data.replace(/^\u00A0/, ' ');
|
|
1093
|
-
}
|
|
1094
|
-
// At this point, all whitespaces should be removed and all created for rendering reasons should be
|
|
1095
|
-
// changed to normal space. All left are inserted intentionally.
|
|
1096
|
-
return data;
|
|
1097
|
-
}
|
|
1098
|
-
/**
|
|
1099
|
-
* Helper function which checks if a DOM text node, preceded by the given `prevNode` should
|
|
1100
|
-
* be trimmed from the left side.
|
|
1101
|
-
*
|
|
1102
|
-
* @param prevNode Either DOM text or `<br>` or one of `#inlineObjectElements`.
|
|
1103
|
-
*/
|
|
1104
|
-
_checkShouldLeftTrimDomText(node, prevNode) {
|
|
1105
|
-
if (!prevNode) {
|
|
1106
|
-
return true;
|
|
1107
|
-
}
|
|
1108
|
-
if (this.isElement(prevNode)) {
|
|
1109
|
-
return prevNode.tagName === 'BR';
|
|
1110
|
-
}
|
|
1111
|
-
// Shouldn't left trim if previous node is a node that was encountered as a raw content node.
|
|
1112
|
-
if (this._encounteredRawContentDomNodes.has(node.previousSibling)) {
|
|
1113
|
-
return false;
|
|
1114
|
-
}
|
|
1115
|
-
return /[^\S\u00A0]/.test(prevNode.data.charAt(prevNode.data.length - 1));
|
|
1116
|
-
}
|
|
1117
|
-
/**
|
|
1118
|
-
* Helper function which checks if a DOM text node, succeeded by the given `nextNode` should
|
|
1119
|
-
* be trimmed from the right side.
|
|
1120
|
-
*
|
|
1121
|
-
* @param nextNode Either DOM text or `<br>` or one of `#inlineObjectElements`.
|
|
1122
|
-
*/
|
|
1123
|
-
_checkShouldRightTrimDomText(node, nextNode) {
|
|
1124
|
-
if (nextNode) {
|
|
1125
|
-
return false;
|
|
1126
|
-
}
|
|
1127
|
-
return !startsWithFiller(node);
|
|
1128
|
-
}
|
|
1129
1198
|
/**
|
|
1130
1199
|
* Helper function. For given {@link module:engine/view/text~Text view text node}, it finds previous or next sibling
|
|
1131
1200
|
* that is contained in the same container element. If there is no such sibling, `null` is returned.
|
|
@@ -1140,8 +1209,12 @@ export default class DomConverter {
|
|
|
1140
1209
|
direction: getNext ? 'forward' : 'backward'
|
|
1141
1210
|
});
|
|
1142
1211
|
for (const value of treeWalker) {
|
|
1212
|
+
// <br> found – it works like a block boundary, so do not scan further.
|
|
1213
|
+
if (value.item.is('element', 'br')) {
|
|
1214
|
+
return null;
|
|
1215
|
+
}
|
|
1143
1216
|
// Found an inline object (for example an image).
|
|
1144
|
-
if (
|
|
1217
|
+
else if (this._isInlineObjectElement(value.item)) {
|
|
1145
1218
|
return value.item;
|
|
1146
1219
|
}
|
|
1147
1220
|
// ViewContainerElement is found on a way to next ViewText node, so given `node` was first/last
|
|
@@ -1149,10 +1222,6 @@ export default class DomConverter {
|
|
|
1149
1222
|
else if (value.item.is('containerElement')) {
|
|
1150
1223
|
return null;
|
|
1151
1224
|
}
|
|
1152
|
-
// <br> found – it works like a block boundary, so do not scan further.
|
|
1153
|
-
else if (value.item.is('element', 'br')) {
|
|
1154
|
-
return null;
|
|
1155
|
-
}
|
|
1156
1225
|
// Found a text node in the same container element.
|
|
1157
1226
|
else if (value.item.is('$textProxy')) {
|
|
1158
1227
|
return value.item;
|
|
@@ -1161,61 +1230,27 @@ export default class DomConverter {
|
|
|
1161
1230
|
return null;
|
|
1162
1231
|
}
|
|
1163
1232
|
/**
|
|
1164
|
-
*
|
|
1165
|
-
* a text, `<br>` or an {@link #inlineObjectElements inline object}.
|
|
1166
|
-
*
|
|
1167
|
-
* If no such node is found, `null` is returned.
|
|
1168
|
-
*
|
|
1169
|
-
* For instance, in the following DOM structure:
|
|
1170
|
-
*
|
|
1171
|
-
* ```html
|
|
1172
|
-
* <p>foo<b>bar</b><br>bom</p>
|
|
1173
|
-
* ```
|
|
1174
|
-
*
|
|
1175
|
-
* * `foo` doesn't have its previous touching inline node (`null` is returned),
|
|
1176
|
-
* * `foo`'s next touching inline node is `bar`
|
|
1177
|
-
* * `bar`'s next touching inline node is `<br>`
|
|
1178
|
-
*
|
|
1179
|
-
* This method returns text nodes and `<br>` elements because these types of nodes affect how
|
|
1180
|
-
* spaces in the given text node need to be converted.
|
|
1233
|
+
* Returns `true` if a DOM node belongs to {@link #blockElements}. `false` otherwise.
|
|
1181
1234
|
*/
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
return null;
|
|
1185
|
-
}
|
|
1186
|
-
const stepInto = getNext ? 'firstChild' : 'lastChild';
|
|
1187
|
-
const stepOver = getNext ? 'nextSibling' : 'previousSibling';
|
|
1188
|
-
let skipChildren = true;
|
|
1189
|
-
let returnNode = node;
|
|
1190
|
-
do {
|
|
1191
|
-
if (!skipChildren && returnNode[stepInto]) {
|
|
1192
|
-
returnNode = returnNode[stepInto];
|
|
1193
|
-
}
|
|
1194
|
-
else if (returnNode[stepOver]) {
|
|
1195
|
-
returnNode = returnNode[stepOver];
|
|
1196
|
-
skipChildren = false;
|
|
1197
|
-
}
|
|
1198
|
-
else {
|
|
1199
|
-
returnNode = returnNode.parentNode;
|
|
1200
|
-
skipChildren = true;
|
|
1201
|
-
}
|
|
1202
|
-
if (!returnNode || this._isBlockElement(returnNode)) {
|
|
1203
|
-
return null;
|
|
1204
|
-
}
|
|
1205
|
-
} while (!(isText(returnNode) || returnNode.tagName == 'BR' || this._isInlineObjectElement(returnNode)));
|
|
1206
|
-
return returnNode;
|
|
1235
|
+
_isBlockDomElement(node) {
|
|
1236
|
+
return this.isElement(node) && this.blockElements.includes(node.tagName.toLowerCase());
|
|
1207
1237
|
}
|
|
1208
1238
|
/**
|
|
1209
|
-
* Returns `true` if a
|
|
1239
|
+
* Returns `true` if a view node belongs to {@link #blockElements}. `false` otherwise.
|
|
1210
1240
|
*/
|
|
1211
|
-
|
|
1212
|
-
return
|
|
1241
|
+
_isBlockViewElement(node) {
|
|
1242
|
+
return node.is('element') && this.blockElements.includes(node.name);
|
|
1213
1243
|
}
|
|
1214
1244
|
/**
|
|
1215
1245
|
* Returns `true` if a DOM node belongs to {@link #inlineObjectElements}. `false` otherwise.
|
|
1216
1246
|
*/
|
|
1217
1247
|
_isInlineObjectElement(node) {
|
|
1218
|
-
|
|
1248
|
+
if (!node.is('element')) {
|
|
1249
|
+
return false;
|
|
1250
|
+
}
|
|
1251
|
+
return node.name == 'br' ||
|
|
1252
|
+
this.inlineObjectElements.includes(node.name) ||
|
|
1253
|
+
!!this._inlineObjectElementMatcher.match(node);
|
|
1219
1254
|
}
|
|
1220
1255
|
/**
|
|
1221
1256
|
* Creates view element basing on the node type.
|
|
@@ -1237,7 +1272,7 @@ export default class DomConverter {
|
|
|
1237
1272
|
* @param options Conversion options. See {@link module:engine/view/domconverter~DomConverter#domToView} options parameter.
|
|
1238
1273
|
*/
|
|
1239
1274
|
_isViewElementWithRawContent(viewElement, options) {
|
|
1240
|
-
return options.withChildren !== false && !!this._rawContentElementMatcher.match(viewElement);
|
|
1275
|
+
return options.withChildren !== false && viewElement.is('element') && !!this._rawContentElementMatcher.match(viewElement);
|
|
1241
1276
|
}
|
|
1242
1277
|
/**
|
|
1243
1278
|
* Checks whether a given element name should be renamed in a current rendering mode.
|
|
@@ -1276,9 +1311,8 @@ export default class DomConverter {
|
|
|
1276
1311
|
*
|
|
1277
1312
|
* @returns`true` if such parent exists or `false` if it does not.
|
|
1278
1313
|
*/
|
|
1279
|
-
function
|
|
1280
|
-
|
|
1281
|
-
return parents.some(parent => parent.tagName && types.includes(parent.tagName.toLowerCase()));
|
|
1314
|
+
function _hasViewParentOfType(node, types) {
|
|
1315
|
+
return node.getAncestors().some(parent => parent.is('element') && types.includes(parent.name));
|
|
1282
1316
|
}
|
|
1283
1317
|
/**
|
|
1284
1318
|
* A helper that executes given callback for each DOM node's ancestor, starting from the given node
|
|
@@ -5,23 +5,23 @@
|
|
|
5
5
|
/**
|
|
6
6
|
* @module engine/view/downcastwriter
|
|
7
7
|
*/
|
|
8
|
-
import Position, { type PositionOffset } from './position';
|
|
9
|
-
import Range from './range';
|
|
10
|
-
import Selection, { type PlaceOrOffset, type Selectable, type SelectionOptions } from './selection';
|
|
11
|
-
import ContainerElement from './containerelement';
|
|
12
|
-
import AttributeElement from './attributeelement';
|
|
13
|
-
import EmptyElement from './emptyelement';
|
|
14
|
-
import UIElement from './uielement';
|
|
15
|
-
import RawElement from './rawelement';
|
|
16
|
-
import DocumentFragment from './documentfragment';
|
|
17
|
-
import Text from './text';
|
|
18
|
-
import EditableElement from './editableelement';
|
|
19
|
-
import type Document from './document';
|
|
20
|
-
import type Node from './node';
|
|
21
|
-
import type { default as Element, ElementAttributes } from './element';
|
|
22
|
-
import type DomConverter from './domconverter';
|
|
23
|
-
import type Item from './item';
|
|
24
|
-
import type { SlotFilter } from '../conversion/downcasthelpers';
|
|
8
|
+
import Position, { type PositionOffset } from './position.js';
|
|
9
|
+
import Range from './range.js';
|
|
10
|
+
import Selection, { type PlaceOrOffset, type Selectable, type SelectionOptions } from './selection.js';
|
|
11
|
+
import ContainerElement from './containerelement.js';
|
|
12
|
+
import AttributeElement from './attributeelement.js';
|
|
13
|
+
import EmptyElement from './emptyelement.js';
|
|
14
|
+
import UIElement from './uielement.js';
|
|
15
|
+
import RawElement from './rawelement.js';
|
|
16
|
+
import DocumentFragment from './documentfragment.js';
|
|
17
|
+
import Text from './text.js';
|
|
18
|
+
import EditableElement from './editableelement.js';
|
|
19
|
+
import type Document from './document.js';
|
|
20
|
+
import type Node from './node.js';
|
|
21
|
+
import type { default as Element, ElementAttributes } from './element.js';
|
|
22
|
+
import type DomConverter from './domconverter.js';
|
|
23
|
+
import type Item from './item.js';
|
|
24
|
+
import type { SlotFilter } from '../conversion/downcasthelpers.js';
|
|
25
25
|
type DomDocument = globalThis.Document;
|
|
26
26
|
type DomElement = globalThis.HTMLElement;
|
|
27
27
|
/**
|
|
@@ -5,18 +5,18 @@
|
|
|
5
5
|
/**
|
|
6
6
|
* @module engine/view/downcastwriter
|
|
7
7
|
*/
|
|
8
|
-
import Position from './position';
|
|
9
|
-
import Range from './range';
|
|
10
|
-
import Selection from './selection';
|
|
11
|
-
import ContainerElement from './containerelement';
|
|
12
|
-
import AttributeElement from './attributeelement';
|
|
13
|
-
import EmptyElement from './emptyelement';
|
|
14
|
-
import UIElement from './uielement';
|
|
15
|
-
import RawElement from './rawelement';
|
|
8
|
+
import Position from './position.js';
|
|
9
|
+
import Range from './range.js';
|
|
10
|
+
import Selection from './selection.js';
|
|
11
|
+
import ContainerElement from './containerelement.js';
|
|
12
|
+
import AttributeElement from './attributeelement.js';
|
|
13
|
+
import EmptyElement from './emptyelement.js';
|
|
14
|
+
import UIElement from './uielement.js';
|
|
15
|
+
import RawElement from './rawelement.js';
|
|
16
16
|
import { CKEditorError, isIterable } from '@ckeditor/ckeditor5-utils';
|
|
17
|
-
import DocumentFragment from './documentfragment';
|
|
18
|
-
import Text from './text';
|
|
19
|
-
import EditableElement from './editableelement';
|
|
17
|
+
import DocumentFragment from './documentfragment.js';
|
|
18
|
+
import Text from './text.js';
|
|
19
|
+
import EditableElement from './editableelement.js';
|
|
20
20
|
import { isPlainObject } from 'lodash-es';
|
|
21
21
|
/**
|
|
22
22
|
* View downcast writer.
|