@ckeditor/ckeditor5-engine 48.3.1 → 48.4.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/index-content.css +3 -0
- package/dist/index-content.css.map +1 -0
- package/dist/index-editor.css +36 -34
- package/dist/index-editor.css.map +1 -0
- package/dist/index.d.ts +3 -1
- package/dist/index.js +121 -39
- package/dist/index.js.map +1 -1
- package/dist/model/documentselection.d.ts +6 -0
- package/dist/model/liveposition.d.ts +12 -1
- package/dist/model/liverange.d.ts +26 -1
- package/dist/model/position.d.ts +7 -0
- package/dist/model/range.d.ts +9 -0
- package/dist/view/placeholder.d.ts +0 -4
- package/dist/view/renderer.d.ts +0 -1
- package/package.json +2 -2
package/dist/index-content.css
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["index-content.css"],"names":[],"mappings":";;;;;;AAEA,CAAC,CAAC,CAAC,CAAC,gBAAgB,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC","file":"index-content.css.map","sourcesContent":["\n\n/*# sourceMappingURL=index-content.css.map */"]}
|
package/dist/index-editor.css
CHANGED
|
@@ -2,52 +2,54 @@
|
|
|
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
|
-
.ck.ck-placeholder, .ck .ck-placeholder{
|
|
6
|
-
position:relative;
|
|
5
|
+
.ck.ck-placeholder, .ck .ck-placeholder {
|
|
6
|
+
position: relative;
|
|
7
7
|
}
|
|
8
8
|
|
|
9
|
-
@media (forced-colors: active){
|
|
10
|
-
.ck.ck-placeholder, .ck .ck-placeholder{
|
|
11
|
-
forced-color-adjust:preserve-parent-color;
|
|
9
|
+
@media (forced-colors: active) {
|
|
10
|
+
.ck.ck-placeholder, .ck .ck-placeholder {
|
|
11
|
+
forced-color-adjust: preserve-parent-color;
|
|
12
12
|
}
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
-
:is(.ck.ck-placeholder, .ck .ck-placeholder):before{
|
|
16
|
-
content:attr(data-placeholder);
|
|
17
|
-
cursor:text;
|
|
18
|
-
pointer-events:none;
|
|
19
|
-
padding-left:inherit;
|
|
20
|
-
padding-right:inherit;
|
|
21
|
-
box-sizing:border-box;
|
|
22
|
-
white-space:nowrap;
|
|
23
|
-
text-overflow:ellipsis;
|
|
24
|
-
position:absolute;
|
|
25
|
-
left:0;
|
|
26
|
-
right:0;
|
|
27
|
-
overflow:hidden;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
@media (forced-colors: none){
|
|
31
|
-
:is(.ck.ck-placeholder, .ck .ck-placeholder):before{
|
|
32
|
-
color:var(--ck-color-engine-placeholder-text);
|
|
15
|
+
:is(.ck.ck-placeholder, .ck .ck-placeholder):before {
|
|
16
|
+
content: attr(data-placeholder);
|
|
17
|
+
cursor: text;
|
|
18
|
+
pointer-events: none;
|
|
19
|
+
padding-left: inherit;
|
|
20
|
+
padding-right: inherit;
|
|
21
|
+
box-sizing: border-box;
|
|
22
|
+
white-space: nowrap;
|
|
23
|
+
text-overflow: ellipsis;
|
|
24
|
+
position: absolute;
|
|
25
|
+
left: 0;
|
|
26
|
+
right: 0;
|
|
27
|
+
overflow: hidden;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
@media (forced-colors: none) {
|
|
31
|
+
:is(.ck.ck-placeholder, .ck .ck-placeholder):before {
|
|
32
|
+
color: var(--ck-color-engine-placeholder-text);
|
|
33
33
|
}
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
-
@media (forced-colors: active){
|
|
37
|
-
:is(.ck.ck-placeholder, .ck .ck-placeholder):before{
|
|
38
|
-
margin-left:1px;
|
|
39
|
-
font-style:italic;
|
|
36
|
+
@media (forced-colors: active) {
|
|
37
|
+
:is(.ck.ck-placeholder, .ck .ck-placeholder):before {
|
|
38
|
+
margin-left: 1px;
|
|
39
|
+
font-style: italic;
|
|
40
40
|
}
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
-
.ck.ck-read-only .ck-placeholder:before{
|
|
44
|
-
display:none;
|
|
43
|
+
.ck.ck-read-only .ck-placeholder:before {
|
|
44
|
+
display: none;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
.ck.ck-reset_all .ck-placeholder {
|
|
48
|
+
position: relative;
|
|
45
49
|
}
|
|
46
50
|
|
|
47
|
-
.ck.ck-
|
|
48
|
-
|
|
51
|
+
.ck.ck-editor__editable span[data-ck-unsafe-element] {
|
|
52
|
+
display: none;
|
|
49
53
|
}
|
|
50
54
|
|
|
51
|
-
.
|
|
52
|
-
display:none;
|
|
53
|
-
}
|
|
55
|
+
/*# sourceMappingURL=index-editor.css.map */
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../theme/placeholder.css","index-editor.css","../theme/renderer.css"],"names":[],"mappings":"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","file":"index-editor.css.map","sourcesContent":["/*\n * @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n\n\n.ck.ck-placeholder, .ck .ck-placeholder {\n\tposition: relative;\n\n\t@media (forced-colors: active) {\n\t\t/*\n\t\t * This is needed for Edge on Windows to use the right color for the placeholder content (::before).\n\t\t * See https://github.com/ckeditor/ckeditor5/issues/14907.\n\t\t */\n\t\tforced-color-adjust: preserve-parent-color;\n\t}\n\n\t&::before {\n\t\tposition: absolute;\n\t\tleft: 0;\n\t\tright: 0;\n\t\tcontent: attr(data-placeholder);\n\n\t\tcursor: text;\n\n\t\t/* See https://github.com/ckeditor/ckeditor5/issues/469. */\n\t\tpointer-events: none;\n\n\t\t/*\n\t\t * Inherit the content styles padding of the placeholder host.\n\t\t * This ensures the placeholder stays at the padding just like the native caret does, and not at the edge of editable.\n\t\t */\n\t\tpadding-left: inherit;\n\t\tpadding-right: inherit;\n\n\t\t/*\n\t\t * The padding should not expand element width when some other style set width to 100%.\n\t\t */\n\t\tbox-sizing: border-box;\n\n\t\twhite-space: nowrap;\n\t\toverflow: hidden;\n\t\ttext-overflow: ellipsis;\n\n\t\t@media (forced-colors: none) {\n\t\t\tcolor: var(--ck-color-engine-placeholder-text);\n\t\t}\n\n\t\t@media (forced-colors: active) {\n\t\t\t/*\n\t\t\t * In the high contrast mode there is no telling between regular and placeholder text. Using\n\t\t\t * italic text to address that issue. See https://github.com/ckeditor/ckeditor5/issues/14907.\n\t\t\t */\n\t\t\tfont-style: italic;\n\n\t\t\t/*\n\t\t\t * Without this margin, the caret will not show up and blink when the user puts the selection\n\t\t\t * in the placeholder (Edge on Windows). See https://github.com/ckeditor/ckeditor5/issues/14907.\n\t\t\t */\n\t\t\tmargin-left: 1px;\n\t\t}\n\t}\n}\n\n/* See https://github.com/ckeditor/ckeditor5/issues/1987. */\n.ck.ck-read-only .ck-placeholder {\n\t&::before {\n\t\tdisplay: none;\n\t}\n}\n/*\n * Rules for the `ck-placeholder` are loaded before the rules for `ck-reset_all` in the base CKEditor 5 DLL build.\n * This fix overwrites the incorrectly set `position: static` from `ck-reset_all`.\n * See https://github.com/ckeditor/ckeditor5/issues/11418.\n */\n.ck.ck-reset_all .ck-placeholder {\n\tposition: relative;\n}\n",".ck.ck-placeholder, .ck .ck-placeholder {\n position: relative;\n}\n\n@media (forced-colors: active) {\n .ck.ck-placeholder, .ck .ck-placeholder {\n forced-color-adjust: preserve-parent-color;\n }\n}\n\n:is(.ck.ck-placeholder, .ck .ck-placeholder):before {\n content: attr(data-placeholder);\n cursor: text;\n pointer-events: none;\n padding-left: inherit;\n padding-right: inherit;\n box-sizing: border-box;\n white-space: nowrap;\n text-overflow: ellipsis;\n position: absolute;\n left: 0;\n right: 0;\n overflow: hidden;\n}\n\n@media (forced-colors: none) {\n :is(.ck.ck-placeholder, .ck .ck-placeholder):before {\n color: var(--ck-color-engine-placeholder-text);\n }\n}\n\n@media (forced-colors: active) {\n :is(.ck.ck-placeholder, .ck .ck-placeholder):before {\n margin-left: 1px;\n font-style: italic;\n }\n}\n\n.ck.ck-read-only .ck-placeholder:before {\n display: none;\n}\n\n.ck.ck-reset_all .ck-placeholder {\n position: relative;\n}\n\n.ck.ck-editor__editable span[data-ck-unsafe-element] {\n display: none;\n}\n\n/*# sourceMappingURL=index-editor.css.map */","/*\n * @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n\n/* Elements marked by the Renderer as hidden should be invisible in the editor. */\n.ck.ck-editor__editable span[data-ck-unsafe-element] {\n\tdisplay: none;\n}\n"]}
|
package/dist/index.d.ts
CHANGED
|
@@ -38,7 +38,7 @@ export { NoOperation } from "./model/operation/nooperation.js";
|
|
|
38
38
|
export { transformOperationSets, type TransformOperationSetsResult } from "./model/operation/transform.js";
|
|
39
39
|
export { ModelDocumentSelection, type ModelDocumentSelectionChangeRangeEvent, type ModelDocumentSelectionChangeMarkerEvent, type ModelDocumentSelectionChangeAttributeEvent } from "./model/documentselection.js";
|
|
40
40
|
export { ModelRange } from "./model/range.js";
|
|
41
|
-
export { ModelLiveRange, type ModelLiveRangeChangeRangeEvent, type ModelLiveRangeChangeContentEvent, type ModelLiveRangeChangeEvent } from "./model/liverange.js";
|
|
41
|
+
export { ModelLiveRange, type ModelLiveRangeChangeRangeEvent, type ModelLiveRangeChangeContentEvent, type ModelLiveRangeChangeEvent, type ModelLiveRangeChangeDropEvent } from "./model/liverange.js";
|
|
42
42
|
export { ModelLivePosition, type ModelLivePositionChangeEvent } from "./model/liveposition.js";
|
|
43
43
|
export { Model } from "./model/model.js";
|
|
44
44
|
export { ModelTreeWalker, type ModelTreeWalkerValue, type ModelTreeWalkerValueType, type ModelTreeWalkerDirection, type ModelTreeWalkerOptions } from "./model/treewalker.js";
|
|
@@ -150,3 +150,5 @@ export { injectSelectionPostFixer as _injectModelSelectionPostFixer, tryFixingRa
|
|
|
150
150
|
export { NBSP_FILLER as _VIEW_NBSP_FILLER, MARKED_NBSP_FILLER as _VIEW_MARKED_NBSP_FILLER, BR_FILLER as _VIEW_BR_FILLER, INLINE_FILLER_LENGTH as _VIEW_INLINE_FILLER_LENGTH, INLINE_FILLER as _VIEW_INLINE_FILLER, startsWithFiller as _startsWithViewFiller, isInlineFiller as _isInlineViewFiller, getDataWithoutFiller as _getDataWithoutViewFiller, injectQuirksHandling as _injectViewQuirksHandling } from "./view/filler.js";
|
|
151
151
|
export { isPatternMatched as _isViewPatternMatched, type NormalizedPropertyPattern as _NormalizedViewPropertyPattern } from "./view/matcher.js";
|
|
152
152
|
export { injectUiElementHandling as _injectViewUIElementHandling } from "./view/uielement.js";
|
|
153
|
+
import "../theme/index-editor.css";
|
|
154
|
+
import "../theme/index-content.css";
|
package/dist/index.js
CHANGED
|
@@ -222,7 +222,7 @@ function showViewPlaceholderTextDeprecationWarning() {
|
|
|
222
222
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
|
223
223
|
*/
|
|
224
224
|
var ViewTypeCheckable = class {
|
|
225
|
-
/*
|
|
225
|
+
/* v8 ignore next -- @preserve */
|
|
226
226
|
is() {
|
|
227
227
|
throw new Error("is() method is abstract");
|
|
228
228
|
}
|
|
@@ -8883,7 +8883,7 @@ var ViewDomConverter = class {
|
|
|
8883
8883
|
* @returns View nodes.
|
|
8884
8884
|
*/
|
|
8885
8885
|
*domChildrenToView(domElement, options = {}, inlineNodes = []) {
|
|
8886
|
-
let childNodes
|
|
8886
|
+
let childNodes;
|
|
8887
8887
|
if (domElement instanceof HTMLTemplateElement) childNodes = [...domElement.content.childNodes];
|
|
8888
8888
|
else childNodes = [...domElement.childNodes];
|
|
8889
8889
|
for (let i = 0; i < childNodes.length; i++) {
|
|
@@ -10631,7 +10631,6 @@ var InputObserver = class extends DomEventObserver {
|
|
|
10631
10631
|
if (isFollowedByInlineFiller(domRange.endContainer, domRange.endOffset)) domEvent.preventDefault();
|
|
10632
10632
|
if (viewStart) return view.createRange(viewStart, viewEnd);
|
|
10633
10633
|
else if (viewEnd) return view.createRange(viewEnd);
|
|
10634
|
-
/* v8 ignore stop */
|
|
10635
10634
|
}).filter((range) => !!range);
|
|
10636
10635
|
else if (env.isAndroid) {
|
|
10637
10636
|
const domSelection = domEvent.target.ownerDocument.defaultView.getSelection();
|
|
@@ -11245,7 +11244,7 @@ var EditingView = class extends EditingViewBase {
|
|
|
11245
11244
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
|
11246
11245
|
*/
|
|
11247
11246
|
var ModelTypeCheckable = class {
|
|
11248
|
-
/*
|
|
11247
|
+
/* v8 ignore next -- @preserve */
|
|
11249
11248
|
is() {
|
|
11250
11249
|
throw new Error("is() method is abstract");
|
|
11251
11250
|
}
|
|
@@ -12173,6 +12172,9 @@ var ModelPosition = class ModelPosition extends ModelTypeCheckable {
|
|
|
12173
12172
|
case "merge":
|
|
12174
12173
|
result = this._getTransformedByMergeOperation(operation);
|
|
12175
12174
|
break;
|
|
12175
|
+
case "detach":
|
|
12176
|
+
result = this._getTransformedByDetachOperation(operation);
|
|
12177
|
+
break;
|
|
12176
12178
|
default:
|
|
12177
12179
|
result = ModelPosition._createAt(this);
|
|
12178
12180
|
break;
|
|
@@ -12180,6 +12182,14 @@ var ModelPosition = class ModelPosition extends ModelTypeCheckable {
|
|
|
12180
12182
|
return result;
|
|
12181
12183
|
}
|
|
12182
12184
|
/**
|
|
12185
|
+
* Returns a copy of this position transformed by a detach operation.
|
|
12186
|
+
*
|
|
12187
|
+
* @internal
|
|
12188
|
+
*/
|
|
12189
|
+
_getTransformedByDetachOperation(operation) {
|
|
12190
|
+
return this._getTransformedByDeletion(operation.sourcePosition, operation.howMany) || ModelPosition._createAt(operation.sourcePosition);
|
|
12191
|
+
}
|
|
12192
|
+
/**
|
|
12183
12193
|
* Returns a copy of this position transformed by an insert operation.
|
|
12184
12194
|
*
|
|
12185
12195
|
* @internal
|
|
@@ -12939,6 +12949,7 @@ var ModelRange = class ModelRange extends ModelTypeCheckable {
|
|
|
12939
12949
|
case "reinsert": return this._getTransformedByMoveOperation(operation);
|
|
12940
12950
|
case "split": return [this._getTransformedBySplitOperation(operation)];
|
|
12941
12951
|
case "merge": return [this._getTransformedByMergeOperation(operation)];
|
|
12952
|
+
case "detach": return this._getTransformedByDetachOperation(operation);
|
|
12942
12953
|
}
|
|
12943
12954
|
return [new ModelRange(this.start, this.end)];
|
|
12944
12955
|
}
|
|
@@ -13063,6 +13074,17 @@ var ModelRange = class ModelRange extends ModelTypeCheckable {
|
|
|
13063
13074
|
return new ModelRange(start, end);
|
|
13064
13075
|
}
|
|
13065
13076
|
/**
|
|
13077
|
+
* Returns a result of transforming a copy of this range by detach operation.
|
|
13078
|
+
*
|
|
13079
|
+
* If the range is completely removed, an empty array is returned.
|
|
13080
|
+
*
|
|
13081
|
+
* @internal
|
|
13082
|
+
*/
|
|
13083
|
+
_getTransformedByDetachOperation(operation) {
|
|
13084
|
+
const result = this._getTransformedByDeletion(operation.sourcePosition, operation.howMany);
|
|
13085
|
+
return result ? [result] : [];
|
|
13086
|
+
}
|
|
13087
|
+
/**
|
|
13066
13088
|
* Returns an array containing one or two {@link module:engine/model/range~ModelRange ranges} that are a result of transforming this
|
|
13067
13089
|
* {@link module:engine/model/range~ModelRange range} by inserting `howMany` nodes at `insertPosition`. Two
|
|
13068
13090
|
* {@link module:engine/model/range~ModelRange ranges} are returned if the insertion was inside this
|
|
@@ -13116,11 +13138,18 @@ var ModelRange = class ModelRange extends ModelTypeCheckable {
|
|
|
13116
13138
|
* @returns Result of the transformation.
|
|
13117
13139
|
*/
|
|
13118
13140
|
_getTransformedByMove(sourcePosition, targetPosition, howMany, spread = false) {
|
|
13119
|
-
if (this.isCollapsed)
|
|
13141
|
+
if (this.isCollapsed) {
|
|
13142
|
+
const newPos = this.start._getTransformedByMove(sourcePosition, targetPosition, howMany);
|
|
13143
|
+
return [new ModelRange(newPos)];
|
|
13144
|
+
}
|
|
13120
13145
|
const moveRange = ModelRange._createFromPositionAndShift(sourcePosition, howMany);
|
|
13121
13146
|
const insertPosition = targetPosition._getTransformedByDeletion(sourcePosition, howMany);
|
|
13122
13147
|
if (this.containsPosition(targetPosition) && !spread) {
|
|
13123
|
-
if (moveRange.containsPosition(this.start) || moveRange.containsPosition(this.end))
|
|
13148
|
+
if (moveRange.containsPosition(this.start) || moveRange.containsPosition(this.end)) {
|
|
13149
|
+
const start = this.start._getTransformedByMove(sourcePosition, targetPosition, howMany);
|
|
13150
|
+
const end = this.end._getTransformedByMove(sourcePosition, targetPosition, howMany);
|
|
13151
|
+
return [new ModelRange(start, end)];
|
|
13152
|
+
}
|
|
13124
13153
|
}
|
|
13125
13154
|
let result;
|
|
13126
13155
|
const differenceSet = this.getDifference(moveRange);
|
|
@@ -13712,7 +13741,6 @@ var Mapper = class extends MapperBase {
|
|
|
13712
13741
|
else {
|
|
13713
13742
|
viewOffset = viewParent.parent.getChildIndex(viewParent) + 1;
|
|
13714
13743
|
viewParent = viewParent.parent;
|
|
13715
|
-
/* v8 ignore next 3 -- @preserve */
|
|
13716
13744
|
if (useCache) this._cache.save(viewParent, viewOffset, viewContainer, traversedModelOffset);
|
|
13717
13745
|
continue;
|
|
13718
13746
|
}
|
|
@@ -13944,7 +13972,7 @@ var MapperCache = class extends MapperCacheBase {
|
|
|
13944
13972
|
const initialCache = {
|
|
13945
13973
|
maxModelOffset: 0,
|
|
13946
13974
|
cacheList: [initialCacheItem],
|
|
13947
|
-
cacheMap: new Map([[0, initialCacheItem]])
|
|
13975
|
+
cacheMap: /* @__PURE__ */ new Map([[0, initialCacheItem]])
|
|
13948
13976
|
};
|
|
13949
13977
|
this._cachedMapping.set(viewContainer, initialCache);
|
|
13950
13978
|
viewContainer.on("change:children", this._invalidateOnChildrenChangeCallback);
|
|
@@ -14816,7 +14844,7 @@ var DowncastDispatcher = class extends DowncastDispatcherBase {
|
|
|
14816
14844
|
const itemKey = data.item.is("$textProxy") ? conversionApi.consumable._getSymbolForTextProxy(data.item) : data.item;
|
|
14817
14845
|
const eventsFiredForConversion = this._firedEventsMap.get(conversionApi);
|
|
14818
14846
|
const eventsFiredForItem = eventsFiredForConversion.get(itemKey);
|
|
14819
|
-
if (!eventsFiredForItem) eventsFiredForConversion.set(itemKey, new Set([eventName]));
|
|
14847
|
+
if (!eventsFiredForItem) eventsFiredForConversion.set(itemKey, /* @__PURE__ */ new Set([eventName]));
|
|
14820
14848
|
else if (!eventsFiredForItem.has(eventName)) eventsFiredForItem.add(eventName);
|
|
14821
14849
|
else return;
|
|
14822
14850
|
this.fire(eventName, data, conversionApi);
|
|
@@ -15950,9 +15978,18 @@ var ModelLiveRange = class ModelLiveRange extends ModelLiveRangeBase {
|
|
|
15950
15978
|
*
|
|
15951
15979
|
* @see module:engine/model/range~ModelRange
|
|
15952
15980
|
*/
|
|
15953
|
-
constructor(start, end) {
|
|
15981
|
+
constructor(start, end, model) {
|
|
15954
15982
|
super(start, end);
|
|
15955
|
-
|
|
15983
|
+
const root = this.root;
|
|
15984
|
+
const boundModel = model || (root.is("rootElement") ? root.document.model : null);
|
|
15985
|
+
if (!boundModel)
|
|
15986
|
+
/**
|
|
15987
|
+
* LiveRange's root has to be an instance of ModelRootElement or have a reference to a model instance.
|
|
15988
|
+
*
|
|
15989
|
+
* @error model-liverange-no-model-reference
|
|
15990
|
+
*/
|
|
15991
|
+
throw new CKEditorError("model-liverange-no-model-reference", root);
|
|
15992
|
+
bindWithModel$1.call(this, boundModel);
|
|
15956
15993
|
}
|
|
15957
15994
|
/**
|
|
15958
15995
|
* Unbinds all events previously bound by `ModelLiveRange`. Use it whenever you don't need `ModelLiveRange` instance
|
|
@@ -15974,18 +16011,30 @@ var ModelLiveRange = class ModelLiveRange extends ModelLiveRangeBase {
|
|
|
15974
16011
|
static fromRange(range) {
|
|
15975
16012
|
return new ModelLiveRange(range.start, range.end);
|
|
15976
16013
|
}
|
|
16014
|
+
/**
|
|
16015
|
+
* Creates a `ModelLiveRange` for a range rooted in
|
|
16016
|
+
* a {@link module:engine/model/documentfragment~ModelDocumentFragment document fragment}.
|
|
16017
|
+
*
|
|
16018
|
+
* Document fragment does not belong to a document, so the live range is bound to the provided `model` and keeps
|
|
16019
|
+
* itself in sync with every operation applied to that fragment (e.g. while editing clipboard content).
|
|
16020
|
+
*
|
|
16021
|
+
* @internal
|
|
16022
|
+
*/
|
|
16023
|
+
static _fromRangeInDocumentFragment(range, model) {
|
|
16024
|
+
return new this(range.start, range.end, model);
|
|
16025
|
+
}
|
|
15977
16026
|
};
|
|
15978
16027
|
ModelLiveRange.prototype.is = function(type) {
|
|
15979
16028
|
return type === "liveRange" || type === "model:liveRange" || type == "range" || type === "model:range";
|
|
15980
16029
|
};
|
|
15981
16030
|
/**
|
|
15982
|
-
* Binds this `ModelLiveRange` to the
|
|
15983
|
-
* that owns this range's {@link module:engine/model/range~ModelRange#root root}.
|
|
16031
|
+
* Binds this `ModelLiveRange` to the given model, so the range updates itself on every operation applied to it.
|
|
15984
16032
|
*/
|
|
15985
|
-
function
|
|
15986
|
-
this.
|
|
16033
|
+
function bindWithModel$1(model) {
|
|
16034
|
+
const isDetached = !this.root.is("rootElement");
|
|
16035
|
+
this.listenTo(model, "applyOperation", (event, args) => {
|
|
15987
16036
|
const operation = args[0];
|
|
15988
|
-
if (!operation.isDocumentOperation) return;
|
|
16037
|
+
if (!isDetached && !operation.isDocumentOperation) return;
|
|
15989
16038
|
transform$2.call(this, operation);
|
|
15990
16039
|
}, { priority: "low" });
|
|
15991
16040
|
}
|
|
@@ -15994,6 +16043,13 @@ function bindWithDocument$1() {
|
|
|
15994
16043
|
*/
|
|
15995
16044
|
function transform$2(operation) {
|
|
15996
16045
|
const ranges = this.getTransformedByOperation(operation);
|
|
16046
|
+
if (ranges.length === 0) {
|
|
16047
|
+
const deletionPosition = operation.sourcePosition;
|
|
16048
|
+
this.start = deletionPosition;
|
|
16049
|
+
this.end = deletionPosition;
|
|
16050
|
+
this.fire("change:drop", this.toRange(), { deletionPosition });
|
|
16051
|
+
return;
|
|
16052
|
+
}
|
|
15997
16053
|
const result = ModelRange._createFromRanges(ranges);
|
|
15998
16054
|
const boundariesChanged = !result.isEqual(this);
|
|
15999
16055
|
const contentChanged = doesOperationChangeRangeContent(this, operation);
|
|
@@ -16531,6 +16587,15 @@ var ModelDocumentSelection = class extends ModelDocumentSelectionBase {
|
|
|
16531
16587
|
static _isStoreAttributeKey(key) {
|
|
16532
16588
|
return key.startsWith(storePrefix);
|
|
16533
16589
|
}
|
|
16590
|
+
/**
|
|
16591
|
+
* Drop selection attribute key prefix.
|
|
16592
|
+
*
|
|
16593
|
+
* @internal
|
|
16594
|
+
*/
|
|
16595
|
+
static _dropStoreAttributeKeyPrefix(key) {
|
|
16596
|
+
if (key.startsWith(storePrefix)) return key.substring(10);
|
|
16597
|
+
return key;
|
|
16598
|
+
}
|
|
16534
16599
|
};
|
|
16535
16600
|
ModelDocumentSelection.prototype.is = function(type) {
|
|
16536
16601
|
return type === "selection" || type == "model:selection" || type == "documentSelection" || type == "model:documentSelection";
|
|
@@ -19271,7 +19336,7 @@ function createConsumer(model) {
|
|
|
19271
19336
|
function createSlotFactory(element, slotsMap, conversionApi) {
|
|
19272
19337
|
return (writer, modeOrFilter) => {
|
|
19273
19338
|
const slot = writer.createContainerElement("$slot");
|
|
19274
|
-
let children
|
|
19339
|
+
let children;
|
|
19275
19340
|
if (modeOrFilter === "children") children = Array.from(element.getChildren());
|
|
19276
19341
|
else if (typeof modeOrFilter == "function") children = Array.from(element.getChildren()).filter((element) => modeOrFilter(element));
|
|
19277
19342
|
else
|
|
@@ -25872,16 +25937,17 @@ var ModelLivePosition = class extends ModelLivePositionBase {
|
|
|
25872
25937
|
*
|
|
25873
25938
|
* @see module:engine/model/position~ModelPosition
|
|
25874
25939
|
*/
|
|
25875
|
-
constructor(root, path, stickiness = "toNone") {
|
|
25940
|
+
constructor(root, path, stickiness = "toNone", model) {
|
|
25876
25941
|
super(root, path, stickiness);
|
|
25877
|
-
|
|
25942
|
+
const boundModel = model || (this.root.is("rootElement") ? this.root.document.model : null);
|
|
25943
|
+
if (!boundModel)
|
|
25878
25944
|
/**
|
|
25879
|
-
* LivePosition's root has to be an instance of ModelRootElement.
|
|
25945
|
+
* LivePosition's root has to be an instance of ModelRootElement or have a reference to a model instance.
|
|
25880
25946
|
*
|
|
25881
|
-
* @error model-liveposition-
|
|
25947
|
+
* @error model-liveposition-no-model-reference
|
|
25882
25948
|
*/
|
|
25883
|
-
throw new CKEditorError("model-liveposition-
|
|
25884
|
-
|
|
25949
|
+
throw new CKEditorError("model-liveposition-no-model-reference", root);
|
|
25950
|
+
bindWithModel.call(this, boundModel);
|
|
25885
25951
|
}
|
|
25886
25952
|
/**
|
|
25887
25953
|
* Unbinds all events previously bound by `ModelLivePosition`. Use it whenever you don't need `ModelLivePosition` instance
|
|
@@ -25903,18 +25969,30 @@ var ModelLivePosition = class extends ModelLivePositionBase {
|
|
|
25903
25969
|
static fromPosition(position, stickiness) {
|
|
25904
25970
|
return new this(position.root, position.path.slice(), stickiness ? stickiness : position.stickiness);
|
|
25905
25971
|
}
|
|
25972
|
+
/**
|
|
25973
|
+
* Creates a `ModelLivePosition` for a position rooted in
|
|
25974
|
+
* a {@link module:engine/model/documentfragment~ModelDocumentFragment document fragment}.
|
|
25975
|
+
*
|
|
25976
|
+
* Document fragment does not belong to a document, so the live position is bound to the provided `model` and keeps
|
|
25977
|
+
* itself in sync with every operation applied to that fragment (e.g. while editing clipboard content).
|
|
25978
|
+
*
|
|
25979
|
+
* @internal
|
|
25980
|
+
*/
|
|
25981
|
+
static _fromPositionInDocumentFragment(position, model, stickiness) {
|
|
25982
|
+
return new this(position.root, position.path.slice(), stickiness ? stickiness : position.stickiness, model);
|
|
25983
|
+
}
|
|
25906
25984
|
};
|
|
25907
25985
|
ModelLivePosition.prototype.is = function(type) {
|
|
25908
25986
|
return type === "livePosition" || type === "model:livePosition" || type == "position" || type === "model:position";
|
|
25909
25987
|
};
|
|
25910
25988
|
/**
|
|
25911
|
-
* Binds this `ModelLivePosition` to the
|
|
25912
|
-
* this position's {@link module:engine/model/position~ModelPosition#root root}.
|
|
25989
|
+
* Binds this `ModelLivePosition` to the given model, so the position updates itself on every operation applied to it.
|
|
25913
25990
|
*/
|
|
25914
|
-
function
|
|
25915
|
-
this.
|
|
25991
|
+
function bindWithModel(model) {
|
|
25992
|
+
const isDetached = !this.root.is("rootElement");
|
|
25993
|
+
this.listenTo(model, "applyOperation", (event, args) => {
|
|
25916
25994
|
const operation = args[0];
|
|
25917
|
-
if (!operation.isDocumentOperation) return;
|
|
25995
|
+
if (!isDetached && !operation.isDocumentOperation) return;
|
|
25918
25996
|
transform$1.call(this, operation);
|
|
25919
25997
|
}, { priority: "low" });
|
|
25920
25998
|
}
|
|
@@ -27677,7 +27755,8 @@ var MarkerCollection = class extends MarkerCollectionBase {
|
|
|
27677
27755
|
if (hasChanged) this.fire(`update:${markerName}`, oldMarker, oldRange, range, oldMarkerData);
|
|
27678
27756
|
return oldMarker;
|
|
27679
27757
|
}
|
|
27680
|
-
const
|
|
27758
|
+
const liveRange = ModelLiveRange.fromRange(range);
|
|
27759
|
+
const marker = new Marker(markerName, liveRange, managedUsingOperations, affectsData);
|
|
27681
27760
|
this._markers.set(markerName, marker);
|
|
27682
27761
|
this.fire(`update:${markerName}`, marker, null, range, {
|
|
27683
27762
|
...marker.getData(),
|
|
@@ -27744,7 +27823,7 @@ var MarkerCollection = class extends MarkerCollectionBase {
|
|
|
27744
27823
|
*/
|
|
27745
27824
|
destroy() {
|
|
27746
27825
|
for (const marker of this._markers.values()) this._destroyMarker(marker);
|
|
27747
|
-
this._markers
|
|
27826
|
+
this._markers.clear();
|
|
27748
27827
|
this.stopListening();
|
|
27749
27828
|
}
|
|
27750
27829
|
/**
|
|
@@ -29343,7 +29422,7 @@ var ModelWriter = class {
|
|
|
29343
29422
|
for (const marker of this.model.markers) {
|
|
29344
29423
|
if (!marker.managedUsingOperations) continue;
|
|
29345
29424
|
const markerRange = marker.getRange();
|
|
29346
|
-
let isAffected
|
|
29425
|
+
let isAffected;
|
|
29347
29426
|
if (type === "move") {
|
|
29348
29427
|
const range = positionOrRange;
|
|
29349
29428
|
isAffected = range.containsPosition(markerRange.start) || range.start.isEqual(markerRange.start) || range.containsPosition(markerRange.end) || range.end.isEqual(markerRange.end);
|
|
@@ -29743,7 +29822,10 @@ function deleteContent(model, selection, options = {}) {
|
|
|
29743
29822
|
if (selectedElement) Object.assign(attributesForAutoparagraph, schema.getAttributesWithProperty(selectedElement, "copyOnReplace", true));
|
|
29744
29823
|
}
|
|
29745
29824
|
let startPosition, endPosition;
|
|
29746
|
-
if (
|
|
29825
|
+
if (selRange.root instanceof ModelDocumentFragment) {
|
|
29826
|
+
startPosition = ModelLivePosition._fromPositionInDocumentFragment(selRange.start, model, "toPrevious");
|
|
29827
|
+
endPosition = ModelLivePosition._fromPositionInDocumentFragment(selRange.end, model, "toNext");
|
|
29828
|
+
} else if (!options.doNotFixSelection) [startPosition, endPosition] = getLivePositionsForSelectedBlocks(selRange);
|
|
29747
29829
|
else {
|
|
29748
29830
|
startPosition = ModelLivePosition.fromPosition(selRange.start, "toPrevious");
|
|
29749
29831
|
endPosition = ModelLivePosition.fromPosition(selRange.end, "toNext");
|
|
@@ -30182,7 +30264,6 @@ function insertContent(model, content, selectable) {
|
|
|
30182
30264
|
selectionLiveRange.detach();
|
|
30183
30265
|
}
|
|
30184
30266
|
}
|
|
30185
|
-
/* istanbul ignore else -- @preserve */
|
|
30186
30267
|
if (newRange) if (selection instanceof ModelDocumentSelection) writer.setSelection(newRange);
|
|
30187
30268
|
else selection.setTo(newRange);
|
|
30188
30269
|
const affectedRange = insertion.getAffectedRange() || model.createRange(selection.anchor);
|
|
@@ -30258,7 +30339,7 @@ var Insertion = class {
|
|
|
30258
30339
|
this.model = model;
|
|
30259
30340
|
this.writer = writer;
|
|
30260
30341
|
this.position = position;
|
|
30261
|
-
this.canMergeWith = new Set([this.position.parent]);
|
|
30342
|
+
this.canMergeWith = /* @__PURE__ */ new Set([this.position.parent]);
|
|
30262
30343
|
this.schema = model.schema;
|
|
30263
30344
|
this._documentFragment = writer.createDocumentFragment();
|
|
30264
30345
|
this._documentFragmentPosition = writer.createPositionAt(this._documentFragment, 0);
|
|
@@ -30311,7 +30392,7 @@ var Insertion = class {
|
|
|
30311
30392
|
const positionAfterNode = this.writer.createPositionAfter(node);
|
|
30312
30393
|
if (positionAfterNode.isAfter(positionAfterLastNode)) {
|
|
30313
30394
|
this._lastNode = node;
|
|
30314
|
-
/*
|
|
30395
|
+
/* v8 ignore if -- @preserve */
|
|
30315
30396
|
if (this.position.parent != node || !this.position.isAtEnd) throw new CKEditorError("insertcontent-invalid-insertion-position", this);
|
|
30316
30397
|
this.position = positionAfterNode;
|
|
30317
30398
|
this._setAffectedBoundaries(this.position);
|
|
@@ -30381,7 +30462,7 @@ var Insertion = class {
|
|
|
30381
30462
|
* @param node The node to insert.
|
|
30382
30463
|
*/
|
|
30383
30464
|
_appendToFragment(node) {
|
|
30384
|
-
/*
|
|
30465
|
+
/* v8 ignore if -- @preserve */
|
|
30385
30466
|
if (!this.schema.checkChild(this.position, node))
|
|
30386
30467
|
/**
|
|
30387
30468
|
* Given node cannot be inserted on the given position.
|
|
@@ -30459,7 +30540,7 @@ var Insertion = class {
|
|
|
30459
30540
|
if (!this._canMergeRight(node)) return;
|
|
30460
30541
|
const mergePosRight = ModelLivePosition._createAfter(node);
|
|
30461
30542
|
mergePosRight.stickiness = "toNext";
|
|
30462
|
-
/*
|
|
30543
|
+
/* v8 ignore if -- @preserve */
|
|
30463
30544
|
if (!this.position.isEqual(mergePosRight))
|
|
30464
30545
|
/**
|
|
30465
30546
|
* An internal error occurred when merging inserted content with its siblings.
|
|
@@ -31564,6 +31645,7 @@ var Model = class extends ModelBase {
|
|
|
31564
31645
|
*/
|
|
31565
31646
|
destroy() {
|
|
31566
31647
|
this.document.destroy();
|
|
31648
|
+
this.markers.destroy();
|
|
31567
31649
|
this.stopListening();
|
|
31568
31650
|
}
|
|
31569
31651
|
/**
|
|
@@ -32081,7 +32163,7 @@ const RGBA_COLOR_REGEXP = /^rgba\([ ]?([0-9]{1,3}[ %]?,[ ]?){3}(1|[0-9]+%|[0]?\.
|
|
|
32081
32163
|
const HSL_COLOR_REGEXP = /^hsl\([ ]?([0-9]{1,3}[ %]?[,]?[ ]*){3}(1|[0-9]+%|[0]?\.?[0-9]+)?\)$/i;
|
|
32082
32164
|
const HSLA_COLOR_REGEXP = /^hsla\([ ]?([0-9]{1,3}[ %]?,[ ]?){2,3}(1|[0-9]+%|[0]?\.?[0-9]+)\)$/i;
|
|
32083
32165
|
const CSS_SHORTHAND_VALUE_REGEXP = /\w+\((?:[^()]|\([^()]*\))*\)|\S+/gi;
|
|
32084
|
-
const COLOR_NAMES = new Set([
|
|
32166
|
+
const COLOR_NAMES = /* @__PURE__ */ new Set([
|
|
32085
32167
|
"black",
|
|
32086
32168
|
"silver",
|
|
32087
32169
|
"gray",
|
|
@@ -34348,7 +34430,7 @@ function convertToModelFragment$1(mapper) {
|
|
|
34348
34430
|
return (evt, data, conversionApi) => {
|
|
34349
34431
|
const childrenResult = conversionApi.convertChildren(data.viewItem, data.modelCursor);
|
|
34350
34432
|
mapper.bindElements(data.modelCursor.parent, data.viewItem);
|
|
34351
|
-
|
|
34433
|
+
Object.assign(data, childrenResult);
|
|
34352
34434
|
evt.stop();
|
|
34353
34435
|
};
|
|
34354
34436
|
}
|