@ckeditor/ckeditor5-engine 48.2.0 → 48.3.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/dist/controller/datacontroller.d.ts +329 -328
- package/dist/controller/editingcontroller.d.ts +95 -94
- package/dist/conversion/comparemarkers.d.ts +45 -45
- package/dist/conversion/conversion.d.ts +474 -474
- package/dist/conversion/conversionhelpers.d.ts +21 -21
- package/dist/conversion/downcastdispatcher.d.ts +539 -538
- package/dist/conversion/downcasthelpers.d.ts +1129 -1129
- package/dist/conversion/mapper.d.ts +692 -697
- package/dist/conversion/modelconsumable.d.ts +196 -196
- package/dist/conversion/upcastdispatcher.d.ts +483 -482
- package/dist/conversion/upcasthelpers.d.ts +491 -491
- package/dist/conversion/viewconsumable.d.ts +330 -330
- package/dist/dataprocessor/basichtmlwriter.d.ts +15 -15
- package/dist/dataprocessor/dataprocessor.d.ts +57 -57
- package/dist/dataprocessor/htmldataprocessor.d.ts +72 -72
- package/dist/dataprocessor/htmlwriter.d.ts +11 -11
- package/dist/dataprocessor/xmldataprocessor.d.ts +86 -86
- package/dist/dev-utils/model.d.ts +128 -123
- package/dist/dev-utils/operationreplayer.d.ts +49 -49
- package/dist/dev-utils/utils.d.ts +33 -33
- package/dist/dev-utils/view.d.ts +314 -309
- package/dist/engineconfig.d.ts +39 -39
- package/dist/index.css.map +1 -1
- package/dist/index.d.ts +150 -150
- package/dist/index.js +34026 -40107
- package/dist/index.js.map +1 -1
- package/dist/legacyerrors.d.ts +0 -4
- package/dist/model/batch.d.ts +86 -86
- package/dist/model/differ.d.ts +504 -504
- package/dist/model/document.d.ts +265 -268
- package/dist/model/documentfragment.d.ts +214 -214
- package/dist/model/documentselection.d.ts +406 -410
- package/dist/model/element.d.ts +182 -182
- package/dist/model/history.d.ts +109 -109
- package/dist/model/item.d.ts +9 -9
- package/dist/model/liveposition.d.ts +70 -69
- package/dist/model/liverange.d.ts +93 -92
- package/dist/model/markercollection.d.ts +317 -324
- package/dist/model/model.d.ts +889 -909
- package/dist/model/node.d.ts +254 -254
- package/dist/model/nodelist.d.ts +110 -110
- package/dist/model/operation/attributeoperation.d.ts +98 -98
- package/dist/model/operation/detachoperation.d.ts +57 -57
- package/dist/model/operation/insertoperation.d.ts +85 -85
- package/dist/model/operation/markeroperation.d.ts +87 -87
- package/dist/model/operation/mergeoperation.d.ts +95 -95
- package/dist/model/operation/moveoperation.d.ts +97 -97
- package/dist/model/operation/nooperation.d.ts +33 -33
- package/dist/model/operation/operation.d.ts +94 -94
- package/dist/model/operation/operationfactory.d.ts +14 -14
- package/dist/model/operation/renameoperation.d.ts +78 -78
- package/dist/model/operation/rootattributeoperation.d.ts +93 -93
- package/dist/model/operation/rootoperation.d.ts +71 -71
- package/dist/model/operation/splitoperation.d.ts +104 -104
- package/dist/model/operation/transform.d.ts +91 -91
- package/dist/model/operation/utils.d.ts +58 -58
- package/dist/model/position.d.ts +535 -535
- package/dist/model/range.d.ts +458 -453
- package/dist/model/rootelement.d.ts +55 -55
- package/dist/model/schema.d.ts +1325 -1327
- package/dist/model/selection.d.ts +452 -471
- package/dist/model/text.d.ts +62 -62
- package/dist/model/textproxy.d.ts +140 -140
- package/dist/model/treewalker.d.ts +190 -190
- package/dist/model/typecheckable.d.ts +281 -281
- package/dist/model/utils/autoparagraphing.d.ts +29 -29
- package/dist/model/utils/deletecontent.d.ts +68 -68
- package/dist/model/utils/getselectedcontent.d.ts +27 -27
- package/dist/model/utils/insertcontent.d.ts +42 -42
- package/dist/model/utils/insertobject.d.ts +41 -41
- package/dist/model/utils/modifyselection.d.ts +44 -44
- package/dist/model/utils/selection-post-fixer.d.ts +71 -71
- package/dist/model/writer.d.ts +854 -854
- package/dist/view/attributeelement.d.ts +123 -123
- package/dist/view/containerelement.d.ts +49 -49
- package/dist/view/datatransfer.d.ts +70 -70
- package/dist/view/document.d.ts +175 -177
- package/dist/view/documentfragment.d.ts +158 -157
- package/dist/view/documentselection.d.ts +308 -307
- package/dist/view/domconverter.d.ts +612 -657
- package/dist/view/downcastwriter.d.ts +1006 -1006
- package/dist/view/editableelement.d.ts +64 -63
- package/dist/view/element.d.ts +754 -754
- package/dist/view/elementdefinition.d.ts +79 -79
- package/dist/view/emptyelement.d.ts +42 -42
- package/dist/view/filler.d.ts +75 -75
- package/dist/view/item.d.ts +9 -9
- package/dist/view/matcher.d.ts +412 -487
- package/dist/view/node.d.ts +164 -163
- package/dist/view/observer/arrowkeysobserver.d.ts +37 -37
- package/dist/view/observer/bubblingemittermixin.d.ts +163 -153
- package/dist/view/observer/bubblingeventinfo.d.ts +45 -42
- package/dist/view/observer/clickobserver.d.ts +36 -36
- package/dist/view/observer/compositionobserver.d.ts +67 -67
- package/dist/view/observer/domeventdata.d.ts +46 -46
- package/dist/view/observer/domeventobserver.d.ts +77 -74
- package/dist/view/observer/fakeselectionobserver.d.ts +42 -42
- package/dist/view/observer/focusobserver.d.ts +84 -84
- package/dist/view/observer/inputobserver.d.ts +76 -76
- package/dist/view/observer/keyobserver.d.ts +53 -53
- package/dist/view/observer/mouseobserver.d.ts +73 -73
- package/dist/view/observer/mutationobserver.d.ts +101 -101
- package/dist/view/observer/observer.d.ts +84 -83
- package/dist/view/observer/pointerobserver.d.ts +63 -63
- package/dist/view/observer/selectionobserver.d.ts +136 -136
- package/dist/view/observer/tabobserver.d.ts +38 -38
- package/dist/view/observer/touchobserver.d.ts +60 -60
- package/dist/view/placeholder.d.ts +80 -80
- package/dist/view/position.d.ts +187 -187
- package/dist/view/range.d.ts +282 -282
- package/dist/view/rawelement.d.ts +72 -72
- package/dist/view/renderer.d.ts +270 -272
- package/dist/view/rooteditableelement.d.ts +43 -43
- package/dist/view/selection.d.ts +356 -369
- package/dist/view/styles/background.d.ts +15 -15
- package/dist/view/styles/border.d.ts +27 -27
- package/dist/view/styles/margin.d.ts +12 -12
- package/dist/view/styles/padding.d.ts +12 -12
- package/dist/view/styles/utils.d.ts +72 -72
- package/dist/view/stylesmap.d.ts +715 -715
- package/dist/view/text.d.ts +75 -75
- package/dist/view/textproxy.d.ts +92 -92
- package/dist/view/tokenlist.d.ts +104 -104
- package/dist/view/treewalker.d.ts +201 -201
- package/dist/view/typecheckable.d.ts +445 -445
- package/dist/view/uielement.d.ts +93 -93
- package/dist/view/upcastwriter.d.ts +412 -412
- package/dist/view/view.d.ts +466 -469
- package/package.json +2 -2
|
@@ -1,73 +1,73 @@
|
|
|
1
1
|
/**
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
|
4
|
+
*/
|
|
5
5
|
/**
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
import { ModelDocumentSelection } from
|
|
9
|
-
import { type Model } from
|
|
10
|
-
import { type ModelSelection } from
|
|
6
|
+
* @module engine/model/utils/deletecontent
|
|
7
|
+
*/
|
|
8
|
+
import { ModelDocumentSelection } from "../documentselection.js";
|
|
9
|
+
import { type Model } from "../model.js";
|
|
10
|
+
import { type ModelSelection } from "../selection.js";
|
|
11
11
|
/**
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
12
|
+
* Deletes content of the selection and merge siblings. The resulting selection is always collapsed.
|
|
13
|
+
*
|
|
14
|
+
* **Note:** Use {@link module:engine/model/model~Model#deleteContent} instead of this function.
|
|
15
|
+
* This function is only exposed to be reusable in algorithms
|
|
16
|
+
* which change the {@link module:engine/model/model~Model#deleteContent}
|
|
17
|
+
* method's behavior.
|
|
18
|
+
*
|
|
19
|
+
* @param model The model in context of which the insertion should be performed.
|
|
20
|
+
* @param selection Selection of which the content should be deleted.
|
|
21
|
+
* @param options.leaveUnmerged Whether to merge elements after removing the content of the selection.
|
|
22
|
+
*
|
|
23
|
+
* For example `<heading>x[x</heading><paragraph>y]y</paragraph>` will become:
|
|
24
|
+
*
|
|
25
|
+
* * `<heading>x^y</heading>` with the option disabled (`leaveUnmerged == false`)
|
|
26
|
+
* * `<heading>x^</heading><paragraph>y</paragraph>` with enabled (`leaveUnmerged == true`).
|
|
27
|
+
*
|
|
28
|
+
* Note: {@link module:engine/model/schema~ModelSchema#isObject object} and {@link module:engine/model/schema~ModelSchema#isLimit limit}
|
|
29
|
+
* elements will not be merged.
|
|
30
|
+
*
|
|
31
|
+
* @param options.doNotResetEntireContent Whether to skip replacing the entire content with a
|
|
32
|
+
* paragraph when the entire content was selected.
|
|
33
|
+
*
|
|
34
|
+
* For example `<heading>[x</heading><paragraph>y]</paragraph>` will become:
|
|
35
|
+
*
|
|
36
|
+
* * `<paragraph>^</paragraph>` with the option disabled (`doNotResetEntireContent == false`)
|
|
37
|
+
* * `<heading>^</heading>` with enabled (`doNotResetEntireContent == true`).
|
|
38
|
+
*
|
|
39
|
+
* @param options.doNotAutoparagraph Whether to create a paragraph if after content deletion selection is moved
|
|
40
|
+
* to a place where text cannot be inserted.
|
|
41
|
+
*
|
|
42
|
+
* For example `<paragraph>x</paragraph>[<imageBlock src="foo.jpg"></imageBlock>]` will become:
|
|
43
|
+
*
|
|
44
|
+
* * `<paragraph>x</paragraph><paragraph>[]</paragraph>` with the option disabled (`doNotAutoparagraph == false`)
|
|
45
|
+
* * `<paragraph>x</paragraph>[]` with the option enabled (`doNotAutoparagraph == true`).
|
|
46
|
+
*
|
|
47
|
+
* If you use this option you need to make sure to handle invalid selections yourself or leave
|
|
48
|
+
* them to the selection post-fixer (may not always work).
|
|
49
|
+
*
|
|
50
|
+
* **Note:** If there is no valid position for the selection, the paragraph will always be created:
|
|
51
|
+
*
|
|
52
|
+
* `[<imageBlock src="foo.jpg"></imageBlock>]` -> `<paragraph>[]</paragraph>`.
|
|
53
|
+
*
|
|
54
|
+
* @param options.doNotFixSelection Whether given selection-to-remove should be fixed if it ends at the beginning of an element.
|
|
55
|
+
*
|
|
56
|
+
* By default, `deleteContent()` will fix selection before performing a deletion, so that the selection does not end at the beginning of
|
|
57
|
+
* an element. For example, selection `<heading>[Heading</heading><paragraph>]Some text.</paragraph>` will be treated as it was
|
|
58
|
+
* `<heading>[Heading]</heading><paragraph>Some text.</paragraph>`. As a result, the elements will not get merged.
|
|
59
|
+
*
|
|
60
|
+
* If selection is as in example, visually, the next element (paragraph) is not selected and it may be confusing for the user that
|
|
61
|
+
* the elements got merged. Selection is set up like this by browsers when a user triple-clicks on some text.
|
|
62
|
+
*
|
|
63
|
+
* However, in some cases, it is expected to remove content exactly as selected in the selection, without any fixing. In these cases,
|
|
64
|
+
* this flag can be set to `true`, which will prevent fixing the selection.
|
|
65
|
+
*
|
|
66
|
+
* @internal
|
|
67
|
+
*/
|
|
68
68
|
export declare function deleteContent(model: Model, selection: ModelSelection | ModelDocumentSelection, options?: {
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
69
|
+
leaveUnmerged?: boolean;
|
|
70
|
+
doNotResetEntireContent?: boolean;
|
|
71
|
+
doNotAutoparagraph?: boolean;
|
|
72
|
+
doNotFixSelection?: boolean;
|
|
73
73
|
}): void;
|
|
@@ -1,31 +1,31 @@
|
|
|
1
1
|
/**
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
|
4
|
+
*/
|
|
5
5
|
/**
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
import { type ModelDocumentFragment } from
|
|
9
|
-
import { type ModelDocumentSelection } from
|
|
10
|
-
import { type Model } from
|
|
11
|
-
import { type ModelSelection } from
|
|
6
|
+
* @module engine/model/utils/getselectedcontent
|
|
7
|
+
*/
|
|
8
|
+
import { type ModelDocumentFragment } from "../documentfragment.js";
|
|
9
|
+
import { type ModelDocumentSelection } from "../documentselection.js";
|
|
10
|
+
import { type Model } from "../model.js";
|
|
11
|
+
import { type ModelSelection } from "../selection.js";
|
|
12
12
|
/**
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
13
|
+
* Gets a clone of the selected content.
|
|
14
|
+
*
|
|
15
|
+
* For example, for the following selection:
|
|
16
|
+
*
|
|
17
|
+
* ```html
|
|
18
|
+
* <p>x</p><quote><p>y</p><h>fir[st</h></quote><p>se]cond</p><p>z</p>
|
|
19
|
+
* ```
|
|
20
|
+
*
|
|
21
|
+
* It will return a document fragment with such a content:
|
|
22
|
+
*
|
|
23
|
+
* ```html
|
|
24
|
+
* <quote><h>st</h></quote><p>se</p>
|
|
25
|
+
* ```
|
|
26
|
+
*
|
|
27
|
+
* @param model The model in context of which the selection modification should be performed.
|
|
28
|
+
* @param selection The selection of which content will be returned.
|
|
29
|
+
* @internal
|
|
30
|
+
*/
|
|
31
31
|
export declare function getSelectedContent(model: Model, selection: ModelSelection | ModelDocumentSelection): ModelDocumentFragment;
|
|
@@ -1,46 +1,46 @@
|
|
|
1
1
|
/**
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
|
4
|
+
*/
|
|
5
5
|
/**
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
import { ModelDocumentSelection } from
|
|
9
|
-
import { ModelRange } from
|
|
10
|
-
import { type ModelDocumentFragment } from
|
|
11
|
-
import { type ModelItem } from
|
|
12
|
-
import { type Model } from
|
|
13
|
-
import { type ModelSelection } from
|
|
6
|
+
* @module engine/model/utils/insertcontent
|
|
7
|
+
*/
|
|
8
|
+
import { ModelDocumentSelection } from "../documentselection.js";
|
|
9
|
+
import { ModelRange } from "../range.js";
|
|
10
|
+
import { type ModelDocumentFragment } from "../documentfragment.js";
|
|
11
|
+
import { type ModelItem } from "../item.js";
|
|
12
|
+
import { type Model } from "../model.js";
|
|
13
|
+
import { type ModelSelection } from "../selection.js";
|
|
14
14
|
/**
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
15
|
+
* Inserts content into the editor (specified selection) as one would expect the paste functionality to work.
|
|
16
|
+
*
|
|
17
|
+
* It takes care of removing the selected content, splitting elements (if needed), inserting elements and merging elements appropriately.
|
|
18
|
+
*
|
|
19
|
+
* Some examples:
|
|
20
|
+
*
|
|
21
|
+
* ```html
|
|
22
|
+
* <p>x^</p> + <p>y</p> => <p>x</p><p>y</p> => <p>xy[]</p>
|
|
23
|
+
* <p>x^y</p> + <p>z</p> => <p>x</p>^<p>y</p> + <p>z</p> => <p>x</p><p>z</p><p>y</p> => <p>xz[]y</p>
|
|
24
|
+
* <p>x^y</p> + <img /> => <p>x</p>^<p>y</p> + <img /> => <p>x</p><img /><p>y</p>
|
|
25
|
+
* <p>x</p><p>^</p><p>z</p> + <p>y</p> => <p>x</p><p>y[]</p><p>z</p> (no merging)
|
|
26
|
+
* <p>x</p>[<img />]<p>z</p> + <p>y</p> => <p>x</p>^<p>z</p> + <p>y</p> => <p>x</p><p>y[]</p><p>z</p>
|
|
27
|
+
* ```
|
|
28
|
+
*
|
|
29
|
+
* If an instance of {@link module:engine/model/selection~ModelSelection} is passed as `selectable` it will be modified
|
|
30
|
+
* to the insertion selection (equal to a range to be selected after insertion).
|
|
31
|
+
*
|
|
32
|
+
* If `selectable` is not passed, the content will be inserted using the current selection of the model document.
|
|
33
|
+
*
|
|
34
|
+
* **Note:** Use {@link module:engine/model/model~Model#insertContent} instead of this function.
|
|
35
|
+
* This function is only exposed to be reusable in algorithms which change the {@link module:engine/model/model~Model#insertContent}
|
|
36
|
+
* method's behavior.
|
|
37
|
+
*
|
|
38
|
+
* @param model The model in context of which the insertion should be performed.
|
|
39
|
+
* @param content The content to insert.
|
|
40
|
+
* @param selectable Selection into which the content should be inserted.
|
|
41
|
+
* @returns Range which contains all the performed changes. This is a range that, if removed,
|
|
42
|
+
* would return the model to the state before the insertion. If no changes were preformed by `insertContent`, returns a range collapsed
|
|
43
|
+
* at the insertion position.
|
|
44
|
+
* @internal
|
|
45
|
+
*/
|
|
46
46
|
export declare function insertContent(model: Model, content: ModelItem | ModelDocumentFragment, selectable?: ModelSelection | ModelDocumentSelection): ModelRange;
|
|
@@ -1,46 +1,46 @@
|
|
|
1
1
|
/**
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
|
4
|
+
*/
|
|
5
5
|
/**
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
import { type ModelDocumentSelection } from
|
|
9
|
-
import { type ModelSelection } from
|
|
10
|
-
import { type ModelElement } from
|
|
11
|
-
import { type Model } from
|
|
12
|
-
import { type ModelRange } from
|
|
6
|
+
* @module engine/model/utils/insertobject
|
|
7
|
+
*/
|
|
8
|
+
import { type ModelDocumentSelection } from "../documentselection.js";
|
|
9
|
+
import { type ModelSelection } from "../selection.js";
|
|
10
|
+
import { type ModelElement } from "../element.js";
|
|
11
|
+
import { type Model } from "../model.js";
|
|
12
|
+
import { type ModelRange } from "../range.js";
|
|
13
13
|
/**
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
14
|
+
* Inserts an {@glink framework/deep-dive/schema#object-elements object element} at a specific position in the editor content.
|
|
15
|
+
*
|
|
16
|
+
* **Note:** Use {@link module:engine/model/model~Model#insertObject} instead of this function.
|
|
17
|
+
* This function is only exposed to be reusable in algorithms which change the {@link module:engine/model/model~Model#insertObject}
|
|
18
|
+
* method's behavior.
|
|
19
|
+
*
|
|
20
|
+
* **Note**: For more documentation and examples, see {@link module:engine/model/model~Model#insertObject}.
|
|
21
|
+
*
|
|
22
|
+
* @param model The model in context of which the insertion should be performed.
|
|
23
|
+
* @param object An object to be inserted into the model document.
|
|
24
|
+
* @param selectable A selectable where the content should be inserted. If not specified, the current
|
|
25
|
+
* {@link module:engine/model/document~ModelDocument#selection document selection} will be used instead.
|
|
26
|
+
* @param options Additional options.
|
|
27
|
+
* @param options.findOptimalPosition An option that, when set, adjusts the insertion position (relative to
|
|
28
|
+
* `selectable` and `placeOrOffset`) so that the content of `selectable` is not split upon insertion (a.k.a. non-destructive insertion).
|
|
29
|
+
* * When `'auto'`, the algorithm will decide whether to insert the object before or after `selectable` to avoid content splitting.
|
|
30
|
+
* * When `'before'`, the closest position before `selectable` will be used that will not result in content splitting.
|
|
31
|
+
* * When `'after'`, the closest position after `selectable` will be used that will not result in content splitting.
|
|
32
|
+
*
|
|
33
|
+
* Note that this option works only for block objects. Inline objects are inserted into text and do not split blocks.
|
|
34
|
+
* @param options.setSelection An option that, when set, moves the
|
|
35
|
+
* {@link module:engine/model/document~ModelDocument#selection document selection} after inserting the object.
|
|
36
|
+
* * When `'on'`, the document selection will be set on the inserted object.
|
|
37
|
+
* * When `'after'`, the document selection will move to the closest text node after the inserted object. If there is no
|
|
38
|
+
* such text node, a paragraph will be created and the document selection will be moved inside it.
|
|
39
|
+
* @returns A range which contains all the performed changes. This is a range that, if removed,
|
|
40
|
+
* would return the model to the state before the insertion. If no changes were preformed by `insertObject()`, returns a range collapsed
|
|
41
|
+
* at the insertion position.
|
|
42
|
+
*/
|
|
43
43
|
export declare function insertObject(model: Model, object: ModelElement, selectable?: ModelSelection | ModelDocumentSelection | null, options?: {
|
|
44
|
-
|
|
45
|
-
|
|
44
|
+
findOptimalPosition?: "auto" | "before" | "after";
|
|
45
|
+
setSelection?: "on" | "after";
|
|
46
46
|
}): ModelRange;
|
|
@@ -1,49 +1,49 @@
|
|
|
1
1
|
/**
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
|
4
|
+
*/
|
|
5
5
|
/**
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
import { ModelDocumentSelection } from
|
|
9
|
-
import { type Model } from
|
|
10
|
-
import { type ModelSelection } from
|
|
6
|
+
* @module engine/model/utils/modifyselection
|
|
7
|
+
*/
|
|
8
|
+
import { ModelDocumentSelection } from "../documentselection.js";
|
|
9
|
+
import { type Model } from "../model.js";
|
|
10
|
+
import { type ModelSelection } from "../selection.js";
|
|
11
11
|
/**
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
12
|
+
* Modifies the selection. Currently, the supported modifications are:
|
|
13
|
+
*
|
|
14
|
+
* * Extending. The selection focus is moved in the specified `options.direction` with a step specified in `options.unit`.
|
|
15
|
+
* Possible values for `unit` are:
|
|
16
|
+
* * `'character'` (default) - moves selection by one user-perceived character. In most cases this means moving by one
|
|
17
|
+
* character in `String` sense. However, unicode also defines "combing marks". These are special symbols, that combines
|
|
18
|
+
* with a symbol before it ("base character") to create one user-perceived character. For example, `q̣̇` is a normal
|
|
19
|
+
* letter `q` with two "combining marks": upper dot (`Ux0307`) and lower dot (`Ux0323`). For most actions, i.e. extending
|
|
20
|
+
* selection by one position, it is correct to include both "base character" and all of it's "combining marks". That is
|
|
21
|
+
* why `'character'` value is most natural and common method of modifying selection.
|
|
22
|
+
* * `'codePoint'` - moves selection by one unicode code point. In contrary to, `'character'` unit, this will insert
|
|
23
|
+
* selection between "base character" and "combining mark", because "combining marks" have their own unicode code points.
|
|
24
|
+
* However, for technical reasons, unicode code points with values above `UxFFFF` are represented in native `String` by
|
|
25
|
+
* two characters, called "surrogate pairs". Halves of "surrogate pairs" have a meaning only when placed next to each other.
|
|
26
|
+
* For example `𨭎` is represented in `String` by `\uD862\uDF4E`. Both `\uD862` and `\uDF4E` do not have any meaning
|
|
27
|
+
* outside the pair (are rendered as ? when alone). Position between them would be incorrect. In this case, selection
|
|
28
|
+
* extension will include whole "surrogate pair".
|
|
29
|
+
* * `'word'` - moves selection by a whole word.
|
|
30
|
+
*
|
|
31
|
+
* **Note:** if you extend a forward selection in a backward direction you will in fact shrink it.
|
|
32
|
+
*
|
|
33
|
+
* **Note:** Use {@link module:engine/model/model~Model#modifySelection} instead of this function.
|
|
34
|
+
* This function is only exposed to be reusable in algorithms
|
|
35
|
+
* which change the {@link module:engine/model/model~Model#modifySelection}
|
|
36
|
+
* method's behavior.
|
|
37
|
+
*
|
|
38
|
+
* @param model The model in context of which the selection modification should be performed.
|
|
39
|
+
* @param selection The selection to modify.
|
|
40
|
+
* @param options.direction The direction in which the selection should be modified. Default 'forward'.
|
|
41
|
+
* @param options.unit The unit by which selection should be modified. Default 'character'.
|
|
42
|
+
* @param options.treatEmojiAsSingleUnit Whether multi-characer emoji sequences should be handled as single unit.
|
|
43
|
+
* @internal
|
|
44
|
+
*/
|
|
45
45
|
export declare function modifySelection(model: Model, selection: ModelSelection | ModelDocumentSelection, options?: {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
46
|
+
direction?: "forward" | "backward";
|
|
47
|
+
unit?: "character" | "codePoint" | "word";
|
|
48
|
+
treatEmojiAsSingleUnit?: boolean;
|
|
49
49
|
}): void;
|