@ckeditor/ckeditor5-engine 40.2.0 → 41.0.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/CHANGELOG.md +34 -34
- package/LICENSE.md +1 -1
- package/package.json +3 -2
- package/src/controller/datacontroller.d.ts +16 -16
- package/src/controller/datacontroller.js +12 -12
- package/src/controller/editingcontroller.d.ts +8 -8
- package/src/controller/editingcontroller.js +8 -8
- package/src/conversion/conversion.d.ts +7 -7
- package/src/conversion/conversion.js +3 -3
- package/src/conversion/conversionhelpers.d.ts +1 -1
- package/src/conversion/conversionhelpers.js +1 -1
- package/src/conversion/downcastdispatcher.d.ts +14 -14
- package/src/conversion/downcastdispatcher.js +3 -3
- package/src/conversion/downcasthelpers.d.ts +18 -54
- package/src/conversion/downcasthelpers.js +8 -44
- package/src/conversion/mapper.d.ts +10 -10
- package/src/conversion/mapper.js +6 -6
- package/src/conversion/modelconsumable.d.ts +6 -6
- package/src/conversion/modelconsumable.js +2 -2
- package/src/conversion/upcastdispatcher.d.ts +13 -13
- package/src/conversion/upcastdispatcher.js +6 -6
- package/src/conversion/upcasthelpers.d.ts +10 -10
- package/src/conversion/upcasthelpers.js +4 -4
- package/src/conversion/viewconsumable.d.ts +6 -6
- package/src/conversion/viewconsumable.js +1 -1
- package/src/dataprocessor/basichtmlwriter.d.ts +2 -2
- package/src/dataprocessor/basichtmlwriter.js +1 -1
- package/src/dataprocessor/dataprocessor.d.ts +3 -3
- package/src/dataprocessor/dataprocessor.js +1 -1
- package/src/dataprocessor/htmldataprocessor.d.ts +7 -7
- package/src/dataprocessor/htmldataprocessor.js +3 -3
- package/src/dataprocessor/htmlwriter.d.ts +1 -1
- package/src/dataprocessor/htmlwriter.js +1 -1
- package/src/dataprocessor/xmldataprocessor.d.ts +7 -7
- package/src/dataprocessor/xmldataprocessor.js +3 -3
- package/src/dev-utils/model.d.ts +11 -11
- package/src/dev-utils/model.js +17 -17
- package/src/dev-utils/operationreplayer.d.ts +3 -3
- package/src/dev-utils/operationreplayer.js +2 -2
- package/src/dev-utils/utils.d.ts +1 -1
- package/src/dev-utils/utils.js +1 -1
- package/src/dev-utils/view.d.ts +9 -9
- package/src/dev-utils/view.js +15 -15
- package/src/index.d.ts +107 -108
- package/src/index.js +65 -66
- package/src/model/batch.d.ts +2 -2
- package/src/model/batch.js +1 -1
- package/src/model/differ.d.ts +35 -7
- package/src/model/differ.js +9 -6
- package/src/model/document.d.ts +12 -10
- package/src/model/document.js +5 -5
- package/src/model/documentfragment.d.ts +5 -5
- package/src/model/documentfragment.js +6 -6
- package/src/model/documentselection.d.ts +9 -9
- package/src/model/documentselection.js +6 -6
- package/src/model/element.d.ts +3 -3
- package/src/model/element.js +5 -5
- package/src/model/history.d.ts +2 -2
- package/src/model/history.js +1 -1
- package/src/model/item.d.ts +3 -3
- package/src/model/item.js +1 -1
- package/src/model/liveposition.d.ts +5 -5
- package/src/model/liveposition.js +2 -2
- package/src/model/liverange.d.ts +6 -6
- package/src/model/liverange.js +2 -2
- package/src/model/markercollection.d.ts +5 -5
- package/src/model/markercollection.js +3 -3
- package/src/model/model.d.ts +15 -15
- package/src/model/model.js +19 -19
- package/src/model/node.d.ts +6 -6
- package/src/model/node.js +3 -3
- package/src/model/nodelist.d.ts +2 -2
- package/src/model/nodelist.js +2 -2
- package/src/model/operation/attributeoperation.d.ts +5 -5
- package/src/model/operation/attributeoperation.js +4 -4
- package/src/model/operation/detachoperation.d.ts +4 -4
- package/src/model/operation/detachoperation.js +4 -4
- package/src/model/operation/insertoperation.d.ts +7 -7
- package/src/model/operation/insertoperation.js +8 -8
- package/src/model/operation/markeroperation.d.ts +6 -6
- package/src/model/operation/markeroperation.js +3 -3
- package/src/model/operation/mergeoperation.d.ts +6 -6
- package/src/model/operation/mergeoperation.js +6 -6
- package/src/model/operation/moveoperation.d.ts +5 -5
- package/src/model/operation/moveoperation.js +5 -5
- package/src/model/operation/nooperation.d.ts +3 -3
- package/src/model/operation/nooperation.js +2 -2
- package/src/model/operation/operation.d.ts +4 -4
- package/src/model/operation/operation.js +1 -1
- package/src/model/operation/operationfactory.d.ts +3 -3
- package/src/model/operation/operationfactory.js +12 -12
- package/src/model/operation/renameoperation.d.ts +5 -5
- package/src/model/operation/renameoperation.js +4 -4
- package/src/model/operation/rootattributeoperation.d.ts +5 -5
- package/src/model/operation/rootattributeoperation.js +2 -2
- package/src/model/operation/rootoperation.d.ts +4 -4
- package/src/model/operation/rootoperation.js +2 -2
- package/src/model/operation/splitoperation.d.ts +6 -6
- package/src/model/operation/splitoperation.js +6 -6
- package/src/model/operation/transform.d.ts +3 -3
- package/src/model/operation/transform.js +13 -13
- package/src/model/operation/utils.d.ts +7 -7
- package/src/model/operation/utils.js +5 -5
- package/src/model/position.d.ts +15 -15
- package/src/model/position.js +4 -4
- package/src/model/range.d.ts +13 -13
- package/src/model/range.js +4 -4
- package/src/model/rootelement.d.ts +3 -3
- package/src/model/rootelement.js +2 -2
- package/src/model/schema.d.ts +32 -12
- package/src/model/schema.js +52 -7
- package/src/model/selection.d.ts +8 -8
- package/src/model/selection.js +5 -5
- package/src/model/text.d.ts +2 -2
- package/src/model/text.js +2 -2
- package/src/model/textproxy.d.ts +6 -6
- package/src/model/textproxy.js +2 -2
- package/src/model/treewalker.d.ts +4 -4
- package/src/model/treewalker.js +5 -5
- package/src/model/typecheckable.d.ts +14 -14
- package/src/model/typecheckable.js +1 -1
- package/src/model/utils/autoparagraphing.d.ts +5 -5
- package/src/model/utils/autoparagraphing.js +1 -1
- package/src/model/utils/deletecontent.d.ts +4 -4
- package/src/model/utils/deletecontent.js +4 -4
- package/src/model/utils/getselectedcontent.d.ts +5 -5
- package/src/model/utils/getselectedcontent.js +1 -1
- package/src/model/utils/insertcontent.d.ts +7 -7
- package/src/model/utils/insertcontent.js +7 -7
- package/src/model/utils/insertobject.d.ts +9 -6
- package/src/model/utils/insertobject.js +2 -6
- package/src/model/utils/modifyselection.d.ts +4 -4
- package/src/model/utils/modifyselection.js +5 -5
- package/src/model/utils/selection-post-fixer.d.ts +4 -4
- package/src/model/utils/selection-post-fixer.js +3 -3
- package/src/model/writer.d.ts +13 -13
- package/src/model/writer.js +18 -18
- package/src/view/attributeelement.d.ts +4 -4
- package/src/view/attributeelement.js +4 -3
- package/src/view/containerelement.d.ts +4 -4
- package/src/view/containerelement.js +2 -2
- package/src/view/datatransfer.d.ts +1 -1
- package/src/view/datatransfer.js +1 -1
- package/src/view/document.d.ts +5 -5
- package/src/view/document.js +3 -3
- package/src/view/documentfragment.d.ts +5 -5
- package/src/view/documentfragment.js +4 -4
- package/src/view/documentselection.d.ts +9 -9
- package/src/view/documentselection.js +3 -3
- package/src/view/domconverter.d.ts +14 -14
- package/src/view/domconverter.js +11 -11
- package/src/view/downcastwriter.d.ts +18 -18
- package/src/view/downcastwriter.js +12 -12
- package/src/view/editableelement.d.ts +5 -5
- package/src/view/editableelement.js +2 -2
- package/src/view/element.d.ts +6 -6
- package/src/view/element.js +6 -6
- package/src/view/elementdefinition.d.ts +1 -1
- package/src/view/elementdefinition.js +1 -1
- package/src/view/emptyelement.d.ts +5 -5
- package/src/view/emptyelement.js +3 -3
- package/src/view/filler.d.ts +2 -2
- package/src/view/filler.js +1 -1
- package/src/view/item.d.ts +3 -3
- package/src/view/item.js +1 -1
- package/src/view/matcher.d.ts +2 -2
- package/src/view/matcher.js +1 -1
- package/src/view/node.d.ts +6 -6
- package/src/view/node.js +3 -3
- package/src/view/observer/arrowkeysobserver.d.ts +5 -5
- package/src/view/observer/arrowkeysobserver.js +3 -3
- package/src/view/observer/bubblingemittermixin.d.ts +3 -3
- package/src/view/observer/bubblingemittermixin.js +2 -2
- package/src/view/observer/bubblingeventinfo.d.ts +4 -4
- package/src/view/observer/bubblingeventinfo.js +1 -1
- package/src/view/observer/clickobserver.d.ts +4 -4
- package/src/view/observer/clickobserver.js +2 -2
- package/src/view/observer/compositionobserver.d.ts +4 -4
- package/src/view/observer/compositionobserver.js +2 -2
- package/src/view/observer/domeventdata.d.ts +4 -4
- package/src/view/observer/domeventdata.js +1 -1
- package/src/view/observer/domeventobserver.d.ts +2 -2
- package/src/view/observer/domeventobserver.js +3 -3
- package/src/view/observer/fakeselectionobserver.d.ts +3 -3
- package/src/view/observer/fakeselectionobserver.js +3 -3
- package/src/view/observer/focusobserver.d.ts +4 -4
- package/src/view/observer/focusobserver.js +2 -2
- package/src/view/observer/inputobserver.d.ts +5 -5
- package/src/view/observer/inputobserver.js +3 -3
- package/src/view/observer/keyobserver.d.ts +3 -3
- package/src/view/observer/keyobserver.js +2 -2
- package/src/view/observer/mouseobserver.d.ts +3 -3
- package/src/view/observer/mouseobserver.js +2 -2
- package/src/view/observer/mutationobserver.d.ts +5 -5
- package/src/view/observer/mutationobserver.js +3 -3
- package/src/view/observer/observer.d.ts +3 -3
- package/src/view/observer/observer.js +1 -1
- package/src/view/observer/selectionobserver.d.ts +8 -8
- package/src/view/observer/selectionobserver.js +4 -4
- package/src/view/observer/tabobserver.d.ts +5 -5
- package/src/view/observer/tabobserver.js +3 -3
- package/src/view/placeholder.d.ts +5 -5
- package/src/view/placeholder.js +1 -1
- package/src/view/position.d.ts +8 -8
- package/src/view/position.js +5 -5
- package/src/view/range.d.ts +8 -8
- package/src/view/range.js +4 -4
- package/src/view/rawelement.d.ts +6 -6
- package/src/view/rawelement.js +3 -3
- package/src/view/renderer.d.ts +6 -6
- package/src/view/renderer.js +4 -4
- package/src/view/rooteditableelement.d.ts +3 -3
- package/src/view/rooteditableelement.js +2 -2
- package/src/view/selection.d.ts +9 -9
- package/src/view/selection.js +6 -6
- package/src/view/styles/background.d.ts +2 -2
- package/src/view/styles/background.js +2 -2
- package/src/view/styles/border.d.ts +2 -2
- package/src/view/styles/border.js +2 -2
- package/src/view/styles/margin.d.ts +2 -2
- package/src/view/styles/margin.js +2 -2
- package/src/view/styles/padding.d.ts +2 -2
- package/src/view/styles/padding.js +2 -2
- package/src/view/styles/utils.d.ts +2 -2
- package/src/view/styles/utils.js +1 -1
- package/src/view/stylesmap.d.ts +1 -1
- package/src/view/stylesmap.js +1 -1
- package/src/view/text.d.ts +3 -3
- package/src/view/text.js +2 -2
- package/src/view/textproxy.d.ts +7 -7
- package/src/view/textproxy.js +2 -2
- package/src/view/treewalker.d.ts +4 -4
- package/src/view/treewalker.js +5 -5
- package/src/view/typecheckable.d.ts +17 -17
- package/src/view/typecheckable.js +1 -1
- package/src/view/uielement.d.ts +7 -7
- package/src/view/uielement.js +3 -3
- package/src/view/upcastwriter.d.ts +10 -10
- package/src/view/upcastwriter.js +7 -7
- package/src/view/view.d.ts +22 -22
- package/src/view/view.js +19 -19
- package/theme/placeholder.css +1 -1
- package/theme/renderer.css +1 -1
- package/src/model/utils/findoptimalinsertionrange.d.ts +0 -32
- package/src/model/utils/findoptimalinsertionrange.js +0 -57
package/src/model/range.d.ts
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Copyright (c) 2003-
|
|
2
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
3
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
4
|
*/
|
|
5
5
|
/**
|
|
6
6
|
* @module engine/model/range
|
|
7
7
|
*/
|
|
8
|
-
import TypeCheckable from './typecheckable';
|
|
9
|
-
import Position from './position';
|
|
10
|
-
import TreeWalker, { type TreeWalkerOptions, type TreeWalkerValue } from './treewalker';
|
|
11
|
-
import type Document from './document';
|
|
12
|
-
import type DocumentFragment from './documentfragment';
|
|
13
|
-
import type Element from './element';
|
|
14
|
-
import type InsertOperation from './operation/insertoperation';
|
|
15
|
-
import type Item from './item';
|
|
16
|
-
import type MergeOperation from './operation/mergeoperation';
|
|
17
|
-
import type MoveOperation from './operation/moveoperation';
|
|
18
|
-
import type Operation from './operation/operation';
|
|
19
|
-
import type SplitOperation from './operation/splitoperation';
|
|
8
|
+
import TypeCheckable from './typecheckable.js';
|
|
9
|
+
import Position from './position.js';
|
|
10
|
+
import TreeWalker, { type TreeWalkerOptions, type TreeWalkerValue } from './treewalker.js';
|
|
11
|
+
import type Document from './document.js';
|
|
12
|
+
import type DocumentFragment from './documentfragment.js';
|
|
13
|
+
import type Element from './element.js';
|
|
14
|
+
import type InsertOperation from './operation/insertoperation.js';
|
|
15
|
+
import type Item from './item.js';
|
|
16
|
+
import type MergeOperation from './operation/mergeoperation.js';
|
|
17
|
+
import type MoveOperation from './operation/moveoperation.js';
|
|
18
|
+
import type Operation from './operation/operation.js';
|
|
19
|
+
import type SplitOperation from './operation/splitoperation.js';
|
|
20
20
|
/**
|
|
21
21
|
* Represents a range in the model tree.
|
|
22
22
|
*
|
package/src/model/range.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Copyright (c) 2003-
|
|
2
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
3
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
4
|
*/
|
|
5
5
|
/**
|
|
6
6
|
* @module engine/model/range
|
|
7
7
|
*/
|
|
8
|
-
import TypeCheckable from './typecheckable';
|
|
9
|
-
import Position from './position';
|
|
10
|
-
import TreeWalker from './treewalker';
|
|
8
|
+
import TypeCheckable from './typecheckable.js';
|
|
9
|
+
import Position from './position.js';
|
|
10
|
+
import TreeWalker from './treewalker.js';
|
|
11
11
|
import { CKEditorError, compareArrays } from '@ckeditor/ckeditor5-utils';
|
|
12
12
|
/**
|
|
13
13
|
* Represents a range in the model tree.
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Copyright (c) 2003-
|
|
2
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
3
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
4
|
*/
|
|
5
5
|
/**
|
|
6
6
|
* @module engine/model/rootelement
|
|
7
7
|
*/
|
|
8
|
-
import Element from './element';
|
|
9
|
-
import type Document from './document';
|
|
8
|
+
import Element from './element.js';
|
|
9
|
+
import type Document from './document.js';
|
|
10
10
|
/**
|
|
11
11
|
* Type of {@link module:engine/model/element~Element} that is a root of a model tree.
|
|
12
12
|
*/
|
package/src/model/rootelement.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Copyright (c) 2003-
|
|
2
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
3
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
4
|
*/
|
|
5
5
|
/**
|
|
6
6
|
* @module engine/model/rootelement
|
|
7
7
|
*/
|
|
8
|
-
import Element from './element';
|
|
8
|
+
import Element from './element.js';
|
|
9
9
|
/**
|
|
10
10
|
* Type of {@link module:engine/model/element~Element} that is a root of a model tree.
|
|
11
11
|
*/
|
package/src/model/schema.d.ts
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Copyright (c) 2003-
|
|
2
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
3
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
4
|
*/
|
|
5
5
|
/**
|
|
6
6
|
* @module engine/model/schema
|
|
7
7
|
*/
|
|
8
|
-
import Element from './element';
|
|
9
|
-
import Position from './position';
|
|
10
|
-
import Range from './range';
|
|
11
|
-
import type DocumentFragment from './documentfragment';
|
|
12
|
-
import type DocumentSelection from './documentselection';
|
|
13
|
-
import type Item from './item';
|
|
14
|
-
import type Node from './node';
|
|
15
|
-
import type Selection from './selection';
|
|
16
|
-
import type Writer from './writer';
|
|
8
|
+
import Element from './element.js';
|
|
9
|
+
import Position from './position.js';
|
|
10
|
+
import Range from './range.js';
|
|
11
|
+
import type DocumentFragment from './documentfragment.js';
|
|
12
|
+
import type DocumentSelection from './documentselection.js';
|
|
13
|
+
import type Item from './item.js';
|
|
14
|
+
import type Node from './node.js';
|
|
15
|
+
import type Selection from './selection.js';
|
|
16
|
+
import type Writer from './writer.js';
|
|
17
17
|
declare const Schema_base: {
|
|
18
18
|
new (): import("@ckeditor/ckeditor5-utils").Observable;
|
|
19
19
|
prototype: import("@ckeditor/ckeditor5-utils").Observable;
|
|
@@ -507,6 +507,26 @@ export default class Schema extends Schema_base {
|
|
|
507
507
|
* @returns Ranges in which the attribute is allowed.
|
|
508
508
|
*/
|
|
509
509
|
private _getValidRangesForRange;
|
|
510
|
+
/**
|
|
511
|
+
* Returns a model range which is optimal (in terms of UX) for inserting a widget block.
|
|
512
|
+
*
|
|
513
|
+
* For instance, if a selection is in the middle of a paragraph, the collapsed range before this paragraph
|
|
514
|
+
* will be returned so that it is not split. If the selection is at the end of a paragraph,
|
|
515
|
+
* the collapsed range after this paragraph will be returned.
|
|
516
|
+
*
|
|
517
|
+
* Note: If the selection is placed in an empty block, the range in that block will be returned. If that range
|
|
518
|
+
* is then passed to {@link module:engine/model/model~Model#insertContent}, the block will be fully replaced
|
|
519
|
+
* by the inserted widget block.
|
|
520
|
+
*
|
|
521
|
+
* @internal
|
|
522
|
+
* @param selection The selection based on which the insertion position should be calculated.
|
|
523
|
+
* @param place The place where to look for optimal insertion range.
|
|
524
|
+
* The `auto` value will determine itself the best position for insertion.
|
|
525
|
+
* The `before` value will try to find a position before selection.
|
|
526
|
+
* The `after` value will try to find a position after selection.
|
|
527
|
+
* @returns The optimal range.
|
|
528
|
+
*/
|
|
529
|
+
findOptimalInsertionRange(selection: Selection | DocumentSelection, place?: 'auto' | 'before' | 'after'): Range;
|
|
510
530
|
}
|
|
511
531
|
/**
|
|
512
532
|
* Event fired when the {@link ~Schema#checkChild} method is called. It allows plugging in
|
|
@@ -1181,6 +1201,6 @@ export interface AttributeProperties {
|
|
|
1181
1201
|
copyFromObject?: boolean;
|
|
1182
1202
|
[name: string]: unknown;
|
|
1183
1203
|
}
|
|
1184
|
-
export type SchemaAttributeCheckCallback = (context: SchemaContext, attributeName: string) =>
|
|
1185
|
-
export type SchemaChildCheckCallback = (
|
|
1204
|
+
export type SchemaAttributeCheckCallback = (context: SchemaContext, attributeName: string) => boolean | undefined;
|
|
1205
|
+
export type SchemaChildCheckCallback = (context: SchemaContext, definition: SchemaCompiledItemDefinition) => boolean | undefined;
|
|
1186
1206
|
export {};
|
package/src/model/schema.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Copyright (c) 2003-
|
|
2
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
3
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
4
|
*/
|
|
5
5
|
/**
|
|
6
6
|
* @module engine/model/schema
|
|
7
7
|
*/
|
|
8
|
-
import Element from './element';
|
|
9
|
-
import Position from './position';
|
|
10
|
-
import Range from './range';
|
|
11
|
-
import Text from './text';
|
|
12
|
-
import TreeWalker from './treewalker';
|
|
13
|
-
import { CKEditorError, ObservableMixin } from '@ckeditor/ckeditor5-utils';
|
|
8
|
+
import Element from './element.js';
|
|
9
|
+
import Position from './position.js';
|
|
10
|
+
import Range from './range.js';
|
|
11
|
+
import Text from './text.js';
|
|
12
|
+
import TreeWalker from './treewalker.js';
|
|
13
|
+
import { CKEditorError, first, ObservableMixin } from '@ckeditor/ckeditor5-utils';
|
|
14
14
|
/**
|
|
15
15
|
* The model's schema. It defines the allowed and disallowed structures of nodes as well as nodes' attributes.
|
|
16
16
|
* The schema is usually defined by the features and based on them, the editing framework and features
|
|
@@ -882,6 +882,51 @@ export default class Schema extends ObservableMixin() {
|
|
|
882
882
|
yield new Range(start, end);
|
|
883
883
|
}
|
|
884
884
|
}
|
|
885
|
+
/**
|
|
886
|
+
* Returns a model range which is optimal (in terms of UX) for inserting a widget block.
|
|
887
|
+
*
|
|
888
|
+
* For instance, if a selection is in the middle of a paragraph, the collapsed range before this paragraph
|
|
889
|
+
* will be returned so that it is not split. If the selection is at the end of a paragraph,
|
|
890
|
+
* the collapsed range after this paragraph will be returned.
|
|
891
|
+
*
|
|
892
|
+
* Note: If the selection is placed in an empty block, the range in that block will be returned. If that range
|
|
893
|
+
* is then passed to {@link module:engine/model/model~Model#insertContent}, the block will be fully replaced
|
|
894
|
+
* by the inserted widget block.
|
|
895
|
+
*
|
|
896
|
+
* @internal
|
|
897
|
+
* @param selection The selection based on which the insertion position should be calculated.
|
|
898
|
+
* @param place The place where to look for optimal insertion range.
|
|
899
|
+
* The `auto` value will determine itself the best position for insertion.
|
|
900
|
+
* The `before` value will try to find a position before selection.
|
|
901
|
+
* The `after` value will try to find a position after selection.
|
|
902
|
+
* @returns The optimal range.
|
|
903
|
+
*/
|
|
904
|
+
findOptimalInsertionRange(selection, place) {
|
|
905
|
+
const selectedElement = selection.getSelectedElement();
|
|
906
|
+
if (selectedElement && this.isObject(selectedElement) && !this.isInline(selectedElement)) {
|
|
907
|
+
if (place == 'before' || place == 'after') {
|
|
908
|
+
return new Range(Position._createAt(selectedElement, place));
|
|
909
|
+
}
|
|
910
|
+
return Range._createOn(selectedElement);
|
|
911
|
+
}
|
|
912
|
+
const firstBlock = first(selection.getSelectedBlocks());
|
|
913
|
+
// There are no block elements within ancestors (in the current limit element).
|
|
914
|
+
if (!firstBlock) {
|
|
915
|
+
return new Range(selection.focus);
|
|
916
|
+
}
|
|
917
|
+
// If inserting into an empty block – return position in that block. It will get
|
|
918
|
+
// replaced with the image by insertContent(). #42.
|
|
919
|
+
if (firstBlock.isEmpty) {
|
|
920
|
+
return new Range(Position._createAt(firstBlock, 0));
|
|
921
|
+
}
|
|
922
|
+
const positionAfter = Position._createAfter(firstBlock);
|
|
923
|
+
// If selection is at the end of the block - return position after the block.
|
|
924
|
+
if (selection.focus.isTouching(positionAfter)) {
|
|
925
|
+
return new Range(positionAfter);
|
|
926
|
+
}
|
|
927
|
+
// Otherwise, return position before the block.
|
|
928
|
+
return new Range(Position._createBefore(firstBlock));
|
|
929
|
+
}
|
|
885
930
|
}
|
|
886
931
|
/**
|
|
887
932
|
* A schema context – a list of ancestors of a given position in the document.
|
package/src/model/selection.d.ts
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Copyright (c) 2003-
|
|
2
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
3
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
4
|
*/
|
|
5
5
|
/**
|
|
6
6
|
* @module engine/model/selection
|
|
7
7
|
*/
|
|
8
|
-
import TypeCheckable from './typecheckable';
|
|
9
|
-
import Node from './node';
|
|
10
|
-
import Position, { type PositionOffset } from './position';
|
|
11
|
-
import Range from './range';
|
|
12
|
-
import type DocumentSelection from './documentselection';
|
|
13
|
-
import type Element from './element';
|
|
14
|
-
import type Item from './item';
|
|
8
|
+
import TypeCheckable from './typecheckable.js';
|
|
9
|
+
import Node from './node.js';
|
|
10
|
+
import Position, { type PositionOffset } from './position.js';
|
|
11
|
+
import Range from './range.js';
|
|
12
|
+
import type DocumentSelection from './documentselection.js';
|
|
13
|
+
import type Element from './element.js';
|
|
14
|
+
import type Item from './item.js';
|
|
15
15
|
declare const Selection_base: import("@ckeditor/ckeditor5-utils").Mixed<typeof TypeCheckable, import("@ckeditor/ckeditor5-utils").Emitter>;
|
|
16
16
|
/**
|
|
17
17
|
* Selection is a set of {@link module:engine/model/range~Range ranges}. It has a direction specified by its
|
package/src/model/selection.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Copyright (c) 2003-
|
|
2
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
3
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
4
|
*/
|
|
5
5
|
/**
|
|
6
6
|
* @module engine/model/selection
|
|
7
7
|
*/
|
|
8
|
-
import TypeCheckable from './typecheckable';
|
|
9
|
-
import Node from './node';
|
|
10
|
-
import Position from './position';
|
|
11
|
-
import Range from './range';
|
|
8
|
+
import TypeCheckable from './typecheckable.js';
|
|
9
|
+
import Node from './node.js';
|
|
10
|
+
import Position from './position.js';
|
|
11
|
+
import Range from './range.js';
|
|
12
12
|
import { CKEditorError, EmitterMixin, isIterable } from '@ckeditor/ckeditor5-utils';
|
|
13
13
|
/**
|
|
14
14
|
* Selection is a set of {@link module:engine/model/range~Range ranges}. It has a direction specified by its
|
package/src/model/text.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Copyright (c) 2003-
|
|
2
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
3
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
4
|
*/
|
|
5
5
|
/**
|
|
6
6
|
* @module engine/model/text
|
|
7
7
|
*/
|
|
8
|
-
import Node, { type NodeAttributes } from './node';
|
|
8
|
+
import Node, { type NodeAttributes } from './node.js';
|
|
9
9
|
/**
|
|
10
10
|
* Model text node. Type of {@link module:engine/model/node~Node node} that contains {@link module:engine/model/text~Text#data text data}.
|
|
11
11
|
*
|
package/src/model/text.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Copyright (c) 2003-
|
|
2
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
3
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
4
|
*/
|
|
5
5
|
/**
|
|
6
6
|
* @module engine/model/text
|
|
7
7
|
*/
|
|
8
|
-
import Node from './node';
|
|
8
|
+
import Node from './node.js';
|
|
9
9
|
// @if CK_DEBUG_ENGINE // const { convertMapToStringifiedObject } = require( '../dev-utils/utils' );
|
|
10
10
|
/**
|
|
11
11
|
* Model text node. Type of {@link module:engine/model/node~Node node} that contains {@link module:engine/model/text~Text#data text data}.
|
package/src/model/textproxy.d.ts
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Copyright (c) 2003-
|
|
2
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
3
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
4
|
*/
|
|
5
5
|
/**
|
|
6
6
|
* @module engine/model/textproxy
|
|
7
7
|
*/
|
|
8
|
-
import TypeCheckable from './typecheckable';
|
|
9
|
-
import type DocumentFragment from './documentfragment';
|
|
10
|
-
import type Element from './element';
|
|
11
|
-
import type Node from './node';
|
|
12
|
-
import type Text from './text';
|
|
8
|
+
import TypeCheckable from './typecheckable.js';
|
|
9
|
+
import type DocumentFragment from './documentfragment.js';
|
|
10
|
+
import type Element from './element.js';
|
|
11
|
+
import type Node from './node.js';
|
|
12
|
+
import type Text from './text.js';
|
|
13
13
|
/**
|
|
14
14
|
* `TextProxy` represents a part of {@link module:engine/model/text~Text text node}.
|
|
15
15
|
*
|
package/src/model/textproxy.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Copyright (c) 2003-
|
|
2
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
3
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
4
|
*/
|
|
5
5
|
/**
|
|
6
6
|
* @module engine/model/textproxy
|
|
7
7
|
*/
|
|
8
|
-
import TypeCheckable from './typecheckable';
|
|
8
|
+
import TypeCheckable from './typecheckable.js';
|
|
9
9
|
import { CKEditorError } from '@ckeditor/ckeditor5-utils';
|
|
10
10
|
// @if CK_DEBUG_ENGINE // const { convertMapToStringifiedObject } = require( '../dev-utils/utils' );
|
|
11
11
|
/**
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Copyright (c) 2003-
|
|
2
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
3
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
4
|
*/
|
|
5
|
-
import { default as Position } from './position';
|
|
6
|
-
import type Item from './item';
|
|
7
|
-
import type Range from './range';
|
|
5
|
+
import { default as Position } from './position.js';
|
|
6
|
+
import type Item from './item.js';
|
|
7
|
+
import type Range from './range.js';
|
|
8
8
|
/**
|
|
9
9
|
* Position iterator class. It allows to iterate forward and backward over the document.
|
|
10
10
|
*/
|
package/src/model/treewalker.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Copyright (c) 2003-
|
|
2
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
3
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
4
|
*/
|
|
5
5
|
/**
|
|
6
6
|
* @module engine/model/treewalker
|
|
7
7
|
*/
|
|
8
|
-
import Element from './element';
|
|
9
|
-
import { default as Position, getTextNodeAtPosition, getNodeAfterPosition, getNodeBeforePosition } from './position';
|
|
10
|
-
import Text from './text';
|
|
11
|
-
import TextProxy from './textproxy';
|
|
8
|
+
import Element from './element.js';
|
|
9
|
+
import { default as Position, getTextNodeAtPosition, getNodeAfterPosition, getNodeBeforePosition } from './position.js';
|
|
10
|
+
import Text from './text.js';
|
|
11
|
+
import TextProxy from './textproxy.js';
|
|
12
12
|
import { CKEditorError } from '@ckeditor/ckeditor5-utils';
|
|
13
13
|
/**
|
|
14
14
|
* Position iterator class. It allows to iterate forward and backward over the document.
|
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Copyright (c) 2003-
|
|
2
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
3
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
4
|
*/
|
|
5
5
|
/**
|
|
6
6
|
* @module engine/model/typecheckable
|
|
7
7
|
*/
|
|
8
|
-
import type { Marker } from './markercollection';
|
|
9
|
-
import type DocumentFragment from './documentfragment';
|
|
10
|
-
import type DocumentSelection from './documentselection';
|
|
11
|
-
import type Element from './element';
|
|
12
|
-
import type LivePosition from './liveposition';
|
|
13
|
-
import type LiveRange from './liverange';
|
|
14
|
-
import type Node from './node';
|
|
15
|
-
import type Position from './position';
|
|
16
|
-
import type Range from './range';
|
|
17
|
-
import type RootElement from './rootelement';
|
|
18
|
-
import type Selection from './selection';
|
|
19
|
-
import type Text from './text';
|
|
20
|
-
import type TextProxy from './textproxy';
|
|
8
|
+
import type { Marker } from './markercollection.js';
|
|
9
|
+
import type DocumentFragment from './documentfragment.js';
|
|
10
|
+
import type DocumentSelection from './documentselection.js';
|
|
11
|
+
import type Element from './element.js';
|
|
12
|
+
import type LivePosition from './liveposition.js';
|
|
13
|
+
import type LiveRange from './liverange.js';
|
|
14
|
+
import type Node from './node.js';
|
|
15
|
+
import type Position from './position.js';
|
|
16
|
+
import type Range from './range.js';
|
|
17
|
+
import type RootElement from './rootelement.js';
|
|
18
|
+
import type Selection from './selection.js';
|
|
19
|
+
import type Text from './text.js';
|
|
20
|
+
import type TextProxy from './textproxy.js';
|
|
21
21
|
export default abstract class TypeCheckable {
|
|
22
22
|
/**
|
|
23
23
|
* Checks whether the object is of type {@link module:engine/model/node~Node} or its subclass.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Copyright (c) 2003-
|
|
2
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
3
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
4
|
*/
|
|
5
5
|
export default class TypeCheckable {
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Copyright (c) 2003-
|
|
2
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
3
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
4
|
*/
|
|
5
|
-
import type Node from '../node';
|
|
6
|
-
import type Position from '../position';
|
|
7
|
-
import type Schema from '../schema';
|
|
8
|
-
import type Writer from '../writer';
|
|
5
|
+
import type Node from '../node.js';
|
|
6
|
+
import type Position from '../position.js';
|
|
7
|
+
import type Schema from '../schema.js';
|
|
8
|
+
import type Writer from '../writer.js';
|
|
9
9
|
/**
|
|
10
10
|
* @module engine/model/utils/autoparagraphing
|
|
11
11
|
*/
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Copyright (c) 2003-
|
|
2
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
3
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
4
|
*/
|
|
5
5
|
/**
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Copyright (c) 2003-
|
|
2
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
3
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
4
|
*/
|
|
5
5
|
/**
|
|
6
6
|
* @module engine/model/utils/deletecontent
|
|
7
7
|
*/
|
|
8
|
-
import DocumentSelection from '../documentselection';
|
|
9
|
-
import type Model from '../model';
|
|
10
|
-
import type Selection from '../selection';
|
|
8
|
+
import DocumentSelection from '../documentselection.js';
|
|
9
|
+
import type Model from '../model.js';
|
|
10
|
+
import type Selection from '../selection.js';
|
|
11
11
|
/**
|
|
12
12
|
* Deletes content of the selection and merge siblings. The resulting selection is always collapsed.
|
|
13
13
|
*
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Copyright (c) 2003-
|
|
2
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
3
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
4
|
*/
|
|
5
5
|
/**
|
|
6
6
|
* @module engine/model/utils/deletecontent
|
|
7
7
|
*/
|
|
8
|
-
import DocumentSelection from '../documentselection';
|
|
9
|
-
import LivePosition from '../liveposition';
|
|
10
|
-
import Range from '../range';
|
|
8
|
+
import DocumentSelection from '../documentselection.js';
|
|
9
|
+
import LivePosition from '../liveposition.js';
|
|
10
|
+
import Range from '../range.js';
|
|
11
11
|
/**
|
|
12
12
|
* Deletes content of the selection and merge siblings. The resulting selection is always collapsed.
|
|
13
13
|
*
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Copyright (c) 2003-
|
|
2
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
3
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
4
|
*/
|
|
5
|
-
import type DocumentFragment from '../documentfragment';
|
|
6
|
-
import type DocumentSelection from '../documentselection';
|
|
7
|
-
import type Model from '../model';
|
|
8
|
-
import type Selection from '../selection';
|
|
5
|
+
import type DocumentFragment from '../documentfragment.js';
|
|
6
|
+
import type DocumentSelection from '../documentselection.js';
|
|
7
|
+
import type Model from '../model.js';
|
|
8
|
+
import type Selection from '../selection.js';
|
|
9
9
|
/**
|
|
10
10
|
* @module engine/model/utils/getselectedcontent
|
|
11
11
|
*/
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Copyright (c) 2003-
|
|
2
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
3
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
4
|
*/
|
|
5
5
|
/**
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Copyright (c) 2003-
|
|
2
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
3
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
4
|
*/
|
|
5
5
|
/**
|
|
6
6
|
* @module engine/model/utils/insertcontent
|
|
7
7
|
*/
|
|
8
|
-
import DocumentSelection from '../documentselection';
|
|
9
|
-
import Range from '../range';
|
|
10
|
-
import type DocumentFragment from '../documentfragment';
|
|
11
|
-
import type Item from '../item';
|
|
12
|
-
import type Model from '../model';
|
|
13
|
-
import type Selection from '../selection';
|
|
8
|
+
import DocumentSelection from '../documentselection.js';
|
|
9
|
+
import Range from '../range.js';
|
|
10
|
+
import type DocumentFragment from '../documentfragment.js';
|
|
11
|
+
import type Item from '../item.js';
|
|
12
|
+
import type Model from '../model.js';
|
|
13
|
+
import type Selection from '../selection.js';
|
|
14
14
|
/**
|
|
15
15
|
* Inserts content into the editor (specified selection) as one would expect the paste functionality to work.
|
|
16
16
|
*
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Copyright (c) 2003-
|
|
2
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
3
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
4
|
*/
|
|
5
5
|
/**
|
|
6
6
|
* @module engine/model/utils/insertcontent
|
|
7
7
|
*/
|
|
8
|
-
import DocumentSelection from '../documentselection';
|
|
9
|
-
import Element from '../element';
|
|
10
|
-
import LivePosition from '../liveposition';
|
|
11
|
-
import LiveRange from '../liverange';
|
|
12
|
-
import Position from '../position';
|
|
13
|
-
import Range from '../range';
|
|
8
|
+
import DocumentSelection from '../documentselection.js';
|
|
9
|
+
import Element from '../element.js';
|
|
10
|
+
import LivePosition from '../liveposition.js';
|
|
11
|
+
import LiveRange from '../liverange.js';
|
|
12
|
+
import Position from '../position.js';
|
|
13
|
+
import Range from '../range.js';
|
|
14
14
|
import { CKEditorError } from '@ckeditor/ckeditor5-utils';
|
|
15
15
|
/**
|
|
16
16
|
* Inserts content into the editor (specified selection) as one would expect the paste functionality to work.
|
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Copyright (c) 2003-
|
|
2
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
3
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
4
|
*/
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
import type
|
|
9
|
-
import type
|
|
5
|
+
/**
|
|
6
|
+
* @module engine/model/utils/insertobject
|
|
7
|
+
*/
|
|
8
|
+
import type DocumentSelection from '../documentselection.js';
|
|
9
|
+
import type Selection from '../selection.js';
|
|
10
|
+
import type Element from '../element.js';
|
|
11
|
+
import type Model from '../model.js';
|
|
12
|
+
import type Range from '../range.js';
|
|
10
13
|
/**
|
|
11
14
|
* Inserts an {@glink framework/deep-dive/schema#object-elements object element} at a specific position in the editor content.
|
|
12
15
|
*
|
|
@@ -1,11 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Copyright (c) 2003-
|
|
2
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
3
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
4
|
*/
|
|
5
|
-
/**
|
|
6
|
-
* @module engine/model/utils/insertobject
|
|
7
|
-
*/
|
|
8
|
-
import { findOptimalInsertionRange } from './findoptimalinsertionrange';
|
|
9
5
|
import { CKEditorError, first } from '@ckeditor/ckeditor5-utils';
|
|
10
6
|
/**
|
|
11
7
|
* Inserts an {@glink framework/deep-dive/schema#object-elements object element} at a specific position in the editor content.
|
|
@@ -55,7 +51,7 @@ export default function insertObject(model, object, selectable, options = {}) {
|
|
|
55
51
|
// Adjust the insertion selection.
|
|
56
52
|
let insertionSelection = originalSelection;
|
|
57
53
|
if (options.findOptimalPosition && model.schema.isBlock(object)) {
|
|
58
|
-
insertionSelection = model.createSelection(findOptimalInsertionRange(originalSelection,
|
|
54
|
+
insertionSelection = model.createSelection(model.schema.findOptimalInsertionRange(originalSelection, options.findOptimalPosition));
|
|
59
55
|
}
|
|
60
56
|
// Collect attributes to be copied on the inserted object.
|
|
61
57
|
const firstSelectedBlock = first(originalSelection.getSelectedBlocks());
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Copyright (c) 2003-
|
|
2
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
3
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
4
|
*/
|
|
5
5
|
/**
|
|
6
6
|
* @module engine/model/utils/modifyselection
|
|
7
7
|
*/
|
|
8
|
-
import DocumentSelection from '../documentselection';
|
|
9
|
-
import type Model from '../model';
|
|
10
|
-
import type Selection from '../selection';
|
|
8
|
+
import DocumentSelection from '../documentselection.js';
|
|
9
|
+
import type Model from '../model.js';
|
|
10
|
+
import type Selection from '../selection.js';
|
|
11
11
|
/**
|
|
12
12
|
* Modifies the selection. Currently, the supported modifications are:
|
|
13
13
|
*
|