@ckeditor/ckeditor5-engine 41.1.0 → 41.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/dist/content-index.css +4 -0
- package/dist/editor-index.css +23 -0
- package/dist/index.css +49 -0
- package/dist/index.css.map +1 -0
- package/dist/index.js +36728 -0
- package/dist/index.js.map +1 -0
- package/dist/types/controller/datacontroller.d.ts +335 -0
- package/dist/types/controller/editingcontroller.d.ts +98 -0
- package/dist/types/conversion/conversion.d.ts +478 -0
- package/dist/types/conversion/conversionhelpers.d.ts +26 -0
- package/dist/types/conversion/downcastdispatcher.d.ts +562 -0
- package/dist/types/conversion/downcasthelpers.d.ts +1190 -0
- package/dist/types/conversion/mapper.d.ts +503 -0
- package/dist/types/conversion/modelconsumable.d.ts +201 -0
- package/dist/types/conversion/upcastdispatcher.d.ts +492 -0
- package/dist/types/conversion/upcasthelpers.d.ts +499 -0
- package/dist/types/conversion/viewconsumable.d.ts +369 -0
- package/dist/types/dataprocessor/basichtmlwriter.d.ts +18 -0
- package/dist/types/dataprocessor/dataprocessor.d.ts +61 -0
- package/dist/types/dataprocessor/htmldataprocessor.d.ts +76 -0
- package/dist/types/dataprocessor/htmlwriter.d.ts +16 -0
- package/dist/types/dataprocessor/xmldataprocessor.d.ts +90 -0
- package/dist/types/dev-utils/model.d.ts +124 -0
- package/dist/types/dev-utils/operationreplayer.d.ts +51 -0
- package/dist/types/dev-utils/utils.d.ts +37 -0
- package/dist/types/dev-utils/view.d.ts +319 -0
- package/dist/types/index.d.ts +113 -0
- package/dist/types/model/batch.d.ts +106 -0
- package/dist/types/model/differ.d.ts +415 -0
- package/dist/types/model/document.d.ts +274 -0
- package/dist/types/model/documentfragment.d.ts +200 -0
- package/dist/types/model/documentselection.d.ts +420 -0
- package/dist/types/model/element.d.ts +165 -0
- package/dist/types/model/history.d.ts +114 -0
- package/dist/types/model/item.d.ts +14 -0
- package/dist/types/model/liveposition.d.ts +77 -0
- package/dist/types/model/liverange.d.ts +102 -0
- package/dist/types/model/markercollection.d.ts +335 -0
- package/dist/types/model/model.d.ts +919 -0
- package/dist/types/model/node.d.ts +255 -0
- package/dist/types/model/nodelist.d.ts +91 -0
- package/dist/types/model/operation/attributeoperation.d.ts +103 -0
- package/dist/types/model/operation/detachoperation.d.ts +60 -0
- package/dist/types/model/operation/insertoperation.d.ts +90 -0
- package/dist/types/model/operation/markeroperation.d.ts +91 -0
- package/dist/types/model/operation/mergeoperation.d.ts +100 -0
- package/dist/types/model/operation/moveoperation.d.ts +96 -0
- package/dist/types/model/operation/nooperation.d.ts +38 -0
- package/dist/types/model/operation/operation.d.ts +96 -0
- package/dist/types/model/operation/operationfactory.d.ts +18 -0
- package/dist/types/model/operation/renameoperation.d.ts +83 -0
- package/dist/types/model/operation/rootattributeoperation.d.ts +98 -0
- package/dist/types/model/operation/rootoperation.d.ts +76 -0
- package/dist/types/model/operation/splitoperation.d.ts +109 -0
- package/dist/types/model/operation/transform.d.ts +100 -0
- package/dist/types/model/operation/utils.d.ts +71 -0
- package/dist/types/model/position.d.ts +538 -0
- package/dist/types/model/range.d.ts +458 -0
- package/dist/types/model/rootelement.d.ts +60 -0
- package/dist/types/model/schema.d.ts +1206 -0
- package/dist/types/model/selection.d.ts +482 -0
- package/dist/types/model/text.d.ts +66 -0
- package/dist/types/model/textproxy.d.ts +144 -0
- package/dist/types/model/treewalker.d.ts +186 -0
- package/dist/types/model/typecheckable.d.ts +285 -0
- package/dist/types/model/utils/autoparagraphing.d.ts +37 -0
- package/dist/types/model/utils/deletecontent.d.ts +58 -0
- package/dist/types/model/utils/getselectedcontent.d.ts +30 -0
- package/dist/types/model/utils/insertcontent.d.ts +46 -0
- package/dist/types/model/utils/insertobject.d.ts +47 -0
- package/dist/types/model/utils/modifyselection.d.ts +48 -0
- package/dist/types/model/utils/selection-post-fixer.d.ts +74 -0
- package/dist/types/model/writer.d.ts +851 -0
- package/dist/types/view/attributeelement.d.ts +108 -0
- package/dist/types/view/containerelement.d.ts +49 -0
- package/dist/types/view/datatransfer.d.ts +79 -0
- package/dist/types/view/document.d.ts +184 -0
- package/dist/types/view/documentfragment.d.ts +153 -0
- package/dist/types/view/documentselection.d.ts +306 -0
- package/dist/types/view/domconverter.d.ts +652 -0
- package/dist/types/view/downcastwriter.d.ts +996 -0
- package/dist/types/view/editableelement.d.ts +62 -0
- package/dist/types/view/element.d.ts +468 -0
- package/dist/types/view/elementdefinition.d.ts +87 -0
- package/dist/types/view/emptyelement.d.ts +41 -0
- package/dist/types/view/filler.d.ts +111 -0
- package/dist/types/view/item.d.ts +14 -0
- package/dist/types/view/matcher.d.ts +486 -0
- package/dist/types/view/node.d.ts +162 -0
- package/dist/types/view/observer/arrowkeysobserver.d.ts +45 -0
- package/dist/types/view/observer/bubblingemittermixin.d.ts +166 -0
- package/dist/types/view/observer/bubblingeventinfo.d.ts +47 -0
- package/dist/types/view/observer/clickobserver.d.ts +43 -0
- package/dist/types/view/observer/compositionobserver.d.ts +82 -0
- package/dist/types/view/observer/domeventdata.d.ts +50 -0
- package/dist/types/view/observer/domeventobserver.d.ts +73 -0
- package/dist/types/view/observer/fakeselectionobserver.d.ts +47 -0
- package/dist/types/view/observer/focusobserver.d.ts +82 -0
- package/dist/types/view/observer/inputobserver.d.ts +86 -0
- package/dist/types/view/observer/keyobserver.d.ts +66 -0
- package/dist/types/view/observer/mouseobserver.d.ts +89 -0
- package/dist/types/view/observer/mutationobserver.d.ts +86 -0
- package/dist/types/view/observer/observer.d.ts +89 -0
- package/dist/types/view/observer/selectionobserver.d.ts +148 -0
- package/dist/types/view/observer/tabobserver.d.ts +46 -0
- package/dist/types/view/placeholder.d.ts +96 -0
- package/dist/types/view/position.d.ts +188 -0
- package/dist/types/view/range.d.ts +279 -0
- package/dist/types/view/rawelement.d.ts +73 -0
- package/dist/types/view/renderer.d.ts +265 -0
- package/dist/types/view/rooteditableelement.d.ts +41 -0
- package/dist/types/view/selection.d.ts +375 -0
- package/dist/types/view/styles/background.d.ts +33 -0
- package/dist/types/view/styles/border.d.ts +43 -0
- package/dist/types/view/styles/margin.d.ts +29 -0
- package/dist/types/view/styles/padding.d.ts +29 -0
- package/dist/types/view/styles/utils.d.ts +93 -0
- package/dist/types/view/stylesmap.d.ts +673 -0
- package/dist/types/view/text.d.ts +74 -0
- package/dist/types/view/textproxy.d.ts +97 -0
- package/dist/types/view/treewalker.d.ts +195 -0
- package/dist/types/view/typecheckable.d.ts +448 -0
- package/dist/types/view/uielement.d.ts +96 -0
- package/dist/types/view/upcastwriter.d.ts +417 -0
- package/dist/types/view/view.d.ts +487 -0
- package/package.json +3 -2
- package/src/conversion/viewconsumable.js +5 -6
- package/src/index.d.ts +1 -1
- package/src/index.js +1 -1
- package/src/model/node.d.ts +0 -1
- package/src/model/node.js +0 -2
- package/src/model/operation/transform.js +64 -4
- package/src/model/position.d.ts +0 -1
- package/src/model/position.js +0 -2
- package/src/model/utils/insertcontent.js +1 -1
- package/src/model/writer.d.ts +2 -2
- package/src/model/writer.js +2 -2
- package/src/view/node.d.ts +0 -1
- package/src/view/node.js +0 -2
- package/src/view/position.d.ts +0 -1
- package/src/view/position.js +0 -2
- package/src/view/styles/padding.d.ts +1 -1
- package/src/view/styles/padding.js +1 -1
- package/src/view/stylesmap.d.ts +0 -2
- package/src/view/stylesmap.js +0 -2
|
@@ -460,6 +460,14 @@ class ContextFactory {
|
|
|
460
460
|
this._setRelation(opA, opB, 'splitAtSource');
|
|
461
461
|
}
|
|
462
462
|
}
|
|
463
|
+
else if (opB instanceof MoveOperation && opB.howMany > 0) {
|
|
464
|
+
if (opA.sourcePosition.isEqual(opB.sourcePosition.getShiftedBy(opB.howMany))) {
|
|
465
|
+
this._setRelation(opA, opB, 'mergeSourceAffected');
|
|
466
|
+
}
|
|
467
|
+
if (opA.targetPosition.isEqual(opB.sourcePosition)) {
|
|
468
|
+
this._setRelation(opA, opB, 'mergeTargetWasBefore');
|
|
469
|
+
}
|
|
470
|
+
}
|
|
463
471
|
}
|
|
464
472
|
else if (opA instanceof MarkerOperation) {
|
|
465
473
|
const markerRange = opA.newRange;
|
|
@@ -1103,16 +1111,68 @@ setTransformation(MergeOperation, MoveOperation, (a, b, context) => {
|
|
|
1103
1111
|
return [new NoOperation(0)];
|
|
1104
1112
|
}
|
|
1105
1113
|
}
|
|
1106
|
-
//
|
|
1114
|
+
// In most cases we want `sourcePosition` to stick to previous and `targetPosition` to stick to next.
|
|
1115
|
+
// Usually, `sourcePosition` is at the beginning of the merged element and `targetPosition` is at the end of the merge-target element.
|
|
1107
1116
|
//
|
|
1108
|
-
|
|
1109
|
-
|
|
1117
|
+
// However, `sourcePosition` and `targetPosition` may end up in the middle of an element due to some OT magic that happens during undo.
|
|
1118
|
+
// It is expected and used in `MergeOperation` x `SplitOperation` transformation.
|
|
1119
|
+
//
|
|
1120
|
+
// But when these positions are in the middle, it messes up the regular `MergeOperation` x `MoveOperation` transformation because
|
|
1121
|
+
// these positions may "follow" some moved elements. And we want them stick in the original elements.
|
|
1122
|
+
//
|
|
1123
|
+
// This is why we add two extra cases: (1) and (2).
|
|
1124
|
+
//
|
|
1125
|
+
// But after this `MergeOperation` is transformed by "this" move (which is undone), we also need to define extra cases for
|
|
1126
|
+
// the operation undoing previous move. These are (3) and (4).
|
|
1127
|
+
//
|
|
1128
|
+
// (1). Note that this case is also added to `updateRelations()` and sets `mergeSourceAffected` relation.
|
|
1129
|
+
//
|
|
1130
|
+
// [] is move operation, } is merge source position (sticks to previous by default):
|
|
1131
|
+
// <p>A[b]}c</p> -> <p>A}c</p>
|
|
1132
|
+
//
|
|
1133
|
+
if (b.sourcePosition.getShiftedBy(b.howMany).isEqual(a.sourcePosition)) {
|
|
1134
|
+
a.sourcePosition.stickiness = 'toNone';
|
|
1135
|
+
}
|
|
1136
|
+
// (3). This is the transformation for undoing operation of the above case.
|
|
1137
|
+
//
|
|
1138
|
+
// [] is move operation, } is merge source position (sticks to previous by default):
|
|
1139
|
+
// <p>A}c</p> -> <p>A[b]}c</p> (instead of <p>A}[b]c</p>)
|
|
1140
|
+
//
|
|
1141
|
+
else if (b.targetPosition.isEqual(a.sourcePosition) && context.abRelation == 'mergeSourceAffected') {
|
|
1142
|
+
a.sourcePosition.stickiness = 'toNext';
|
|
1110
1143
|
}
|
|
1111
|
-
|
|
1144
|
+
// (2). Note that this case is also added to `updateRelations()` and sets `mergeTargetWasBefore` relation.
|
|
1145
|
+
//
|
|
1146
|
+
// [] is move operation, { is merge target position (sticks to next by default):
|
|
1147
|
+
// <p>A{[b]c</p> -> <p>A{c</p>
|
|
1148
|
+
//
|
|
1149
|
+
else if (b.sourcePosition.isEqual(a.targetPosition)) {
|
|
1150
|
+
a.targetPosition.stickiness = 'toNone';
|
|
1112
1151
|
a.howMany -= b.howMany;
|
|
1113
1152
|
}
|
|
1153
|
+
// (4). This is the transformation for undoing operation of the above case.
|
|
1154
|
+
//
|
|
1155
|
+
// [] is move operation, { is merge target position (sticks to next by default):
|
|
1156
|
+
// <p>A{c</p> -> <p>A{[b]c</p> (instead of <p>A[b]{c</p>)
|
|
1157
|
+
//
|
|
1158
|
+
else if (b.targetPosition.isEqual(a.targetPosition) && context.abRelation == 'mergeTargetWasBefore') {
|
|
1159
|
+
a.targetPosition.stickiness = 'toPrevious';
|
|
1160
|
+
a.howMany += b.howMany;
|
|
1161
|
+
}
|
|
1162
|
+
// The default case.
|
|
1163
|
+
else {
|
|
1164
|
+
if (a.sourcePosition.hasSameParentAs(b.targetPosition)) {
|
|
1165
|
+
a.howMany += b.howMany;
|
|
1166
|
+
}
|
|
1167
|
+
if (a.sourcePosition.hasSameParentAs(b.sourcePosition)) {
|
|
1168
|
+
a.howMany -= b.howMany;
|
|
1169
|
+
}
|
|
1170
|
+
}
|
|
1114
1171
|
a.sourcePosition = a.sourcePosition._getTransformedByMoveOperation(b);
|
|
1115
1172
|
a.targetPosition = a.targetPosition._getTransformedByMoveOperation(b);
|
|
1173
|
+
// After transformations are done, make sure to revert stickiness in case if (1) - (4) scenario happened.
|
|
1174
|
+
a.sourcePosition.stickiness = 'toPrevious';
|
|
1175
|
+
a.targetPosition.stickiness = 'toNext';
|
|
1116
1176
|
// `MergeOperation` graveyard position is like `MoveOperation` target position. It is a position where element(s) will
|
|
1117
1177
|
// be moved. Like in other similar cases, we need to consider the scenario when those positions are same.
|
|
1118
1178
|
// Here, we will treat `MergeOperation` like it is always strong (see `InsertOperation` x `InsertOperation` for comparison).
|
package/src/model/position.d.ts
CHANGED
|
@@ -18,7 +18,6 @@ import type Node from './node.js';
|
|
|
18
18
|
import type Operation from './operation/operation.js';
|
|
19
19
|
import type SplitOperation from './operation/splitoperation.js';
|
|
20
20
|
import type Text from './text.js';
|
|
21
|
-
import '@ckeditor/ckeditor5-utils/src/version.js';
|
|
22
21
|
/**
|
|
23
22
|
* Represents a position in the model tree.
|
|
24
23
|
*
|
package/src/model/position.js
CHANGED
|
@@ -8,8 +8,6 @@
|
|
|
8
8
|
import TypeCheckable from './typecheckable.js';
|
|
9
9
|
import TreeWalker from './treewalker.js';
|
|
10
10
|
import { CKEditorError, compareArrays } from '@ckeditor/ckeditor5-utils';
|
|
11
|
-
// To check if component is loaded more than once.
|
|
12
|
-
import '@ckeditor/ckeditor5-utils/src/version.js';
|
|
13
11
|
/**
|
|
14
12
|
* Represents a position in the model tree.
|
|
15
13
|
*
|
|
@@ -149,7 +149,7 @@ export default function insertContent(model, content, selectable) {
|
|
|
149
149
|
for (const [name, [start, end]] of Object.entries(markersData)) {
|
|
150
150
|
// For now, we ignore markers if they are included in the filtered-out content.
|
|
151
151
|
// In the future implementation we will improve that case to create markers that are not filtered out completely.
|
|
152
|
-
if (start && end && start.root === end.root) {
|
|
152
|
+
if (start && end && start.root === end.root && start.root.document) {
|
|
153
153
|
writer.addMarker(name, {
|
|
154
154
|
usingOperation: true,
|
|
155
155
|
affectsData: true,
|
package/src/model/writer.d.ts
CHANGED
|
@@ -519,7 +519,7 @@ export default class Writer {
|
|
|
519
519
|
*
|
|
520
520
|
* The `options.affectsData` parameter, which defaults to `false`, allows you to define if a marker affects the data. It should be
|
|
521
521
|
* `true` when the marker change changes the data returned by the
|
|
522
|
-
* {@link module:core/editor/
|
|
522
|
+
* {@link module:core/editor/editor~Editor#getData `editor.getData()`} method.
|
|
523
523
|
* When set to `true` it fires the {@link module:engine/model/document~Document#event:change:data `change:data`} event.
|
|
524
524
|
* When set to `false` it fires the {@link module:engine/model/document~Document#event:change `change`} event.
|
|
525
525
|
*
|
|
@@ -573,7 +573,7 @@ export default class Writer {
|
|
|
573
573
|
*
|
|
574
574
|
* The `options.affectsData` parameter, which defaults to `false`, allows you to define if a marker affects the data. It should be
|
|
575
575
|
* `true` when the marker change changes the data returned by
|
|
576
|
-
* the {@link module:core/editor/
|
|
576
|
+
* the {@link module:core/editor/editor~Editor#getData `editor.getData()`} method.
|
|
577
577
|
* When set to `true` it fires the {@link module:engine/model/document~Document#event:change:data `change:data`} event.
|
|
578
578
|
* When set to `false` it fires the {@link module:engine/model/document~Document#event:change `change`} event.
|
|
579
579
|
*
|
package/src/model/writer.js
CHANGED
|
@@ -705,7 +705,7 @@ export default class Writer {
|
|
|
705
705
|
*
|
|
706
706
|
* The `options.affectsData` parameter, which defaults to `false`, allows you to define if a marker affects the data. It should be
|
|
707
707
|
* `true` when the marker change changes the data returned by the
|
|
708
|
-
* {@link module:core/editor/
|
|
708
|
+
* {@link module:core/editor/editor~Editor#getData `editor.getData()`} method.
|
|
709
709
|
* When set to `true` it fires the {@link module:engine/model/document~Document#event:change:data `change:data`} event.
|
|
710
710
|
* When set to `false` it fires the {@link module:engine/model/document~Document#event:change `change`} event.
|
|
711
711
|
*
|
|
@@ -789,7 +789,7 @@ export default class Writer {
|
|
|
789
789
|
*
|
|
790
790
|
* The `options.affectsData` parameter, which defaults to `false`, allows you to define if a marker affects the data. It should be
|
|
791
791
|
* `true` when the marker change changes the data returned by
|
|
792
|
-
* the {@link module:core/editor/
|
|
792
|
+
* the {@link module:core/editor/editor~Editor#getData `editor.getData()`} method.
|
|
793
793
|
* When set to `true` it fires the {@link module:engine/model/document~Document#event:change:data `change:data`} event.
|
|
794
794
|
* When set to `false` it fires the {@link module:engine/model/document~Document#event:change `change`} event.
|
|
795
795
|
*
|
package/src/view/node.d.ts
CHANGED
|
@@ -6,7 +6,6 @@
|
|
|
6
6
|
* @module engine/view/node
|
|
7
7
|
*/
|
|
8
8
|
import TypeCheckable from './typecheckable.js';
|
|
9
|
-
import '@ckeditor/ckeditor5-utils/src/version.js';
|
|
10
9
|
import type { default as Document, ChangeType } from './document.js';
|
|
11
10
|
import type DocumentFragment from './documentfragment.js';
|
|
12
11
|
import type Element from './element.js';
|
package/src/view/node.js
CHANGED
|
@@ -8,8 +8,6 @@
|
|
|
8
8
|
import TypeCheckable from './typecheckable.js';
|
|
9
9
|
import { CKEditorError, EmitterMixin, compareArrays } from '@ckeditor/ckeditor5-utils';
|
|
10
10
|
import { clone } from 'lodash-es';
|
|
11
|
-
// To check if component is loaded more than once.
|
|
12
|
-
import '@ckeditor/ckeditor5-utils/src/version.js';
|
|
13
11
|
/**
|
|
14
12
|
* Abstract view node class.
|
|
15
13
|
*
|
package/src/view/position.d.ts
CHANGED
|
@@ -7,7 +7,6 @@
|
|
|
7
7
|
*/
|
|
8
8
|
import TypeCheckable from './typecheckable.js';
|
|
9
9
|
import EditableElement from './editableelement.js';
|
|
10
|
-
import '@ckeditor/ckeditor5-utils/src/version.js';
|
|
11
10
|
import type DocumentFragment from './documentfragment.js';
|
|
12
11
|
import type Item from './item.js';
|
|
13
12
|
import type Node from './node.js';
|
package/src/view/position.js
CHANGED
|
@@ -8,8 +8,6 @@
|
|
|
8
8
|
import TypeCheckable from './typecheckable.js';
|
|
9
9
|
import { CKEditorError, compareArrays } from '@ckeditor/ckeditor5-utils';
|
|
10
10
|
import EditableElement from './editableelement.js';
|
|
11
|
-
// To check if component is loaded more than once.
|
|
12
|
-
import '@ckeditor/ckeditor5-utils/src/version.js';
|
|
13
11
|
import { default as TreeWalker } from './treewalker.js';
|
|
14
12
|
/**
|
|
15
13
|
* Position in the view tree. Position is represented by its parent node and an offset in this parent.
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
import { getPositionShorthandNormalizer, getBoxSidesValueReducer } from './utils.js';
|
|
6
6
|
/**
|
|
7
|
-
* Adds a
|
|
7
|
+
* Adds a padding CSS styles processing rules.
|
|
8
8
|
*
|
|
9
9
|
* ```ts
|
|
10
10
|
* editor.data.addStyleProcessorRules( addPaddingRules );
|
package/src/view/stylesmap.d.ts
CHANGED
|
@@ -4,8 +4,6 @@
|
|
|
4
4
|
*/
|
|
5
5
|
/**
|
|
6
6
|
* Styles map. Allows handling (adding, removing, retrieving) a set of style rules (usually, of an element).
|
|
7
|
-
*
|
|
8
|
-
* The styles map is capable of normalizing style names so e.g. the following operations are possible:
|
|
9
7
|
*/
|
|
10
8
|
export default class StylesMap {
|
|
11
9
|
/**
|
package/src/view/stylesmap.js
CHANGED
|
@@ -8,8 +8,6 @@
|
|
|
8
8
|
import { get, isObject, merge, set, unset } from 'lodash-es';
|
|
9
9
|
/**
|
|
10
10
|
* Styles map. Allows handling (adding, removing, retrieving) a set of style rules (usually, of an element).
|
|
11
|
-
*
|
|
12
|
-
* The styles map is capable of normalizing style names so e.g. the following operations are possible:
|
|
13
11
|
*/
|
|
14
12
|
export default class StylesMap {
|
|
15
13
|
/**
|