@ckeditor/ckeditor5-engine 44.1.0 → 44.2.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +1 -1
- package/dist/index-content.css +2 -2
- package/dist/index-editor.css +2 -2
- package/dist/index.css +4 -4
- package/dist/index.css.map +1 -1
- package/dist/index.js +646 -77
- package/dist/index.js.map +1 -1
- package/package.json +23 -3
- package/src/controller/datacontroller.d.ts +1 -1
- package/src/controller/datacontroller.js +1 -1
- package/src/controller/editingcontroller.d.ts +1 -1
- package/src/controller/editingcontroller.js +1 -1
- package/src/conversion/conversion.d.ts +1 -1
- package/src/conversion/conversion.js +1 -1
- package/src/conversion/conversionhelpers.d.ts +1 -1
- package/src/conversion/conversionhelpers.js +1 -1
- package/src/conversion/downcastdispatcher.d.ts +1 -1
- package/src/conversion/downcastdispatcher.js +1 -1
- package/src/conversion/downcasthelpers.d.ts +1 -1
- package/src/conversion/downcasthelpers.js +1 -1
- package/src/conversion/mapper.d.ts +249 -20
- package/src/conversion/mapper.js +524 -38
- package/src/conversion/modelconsumable.d.ts +1 -1
- package/src/conversion/modelconsumable.js +1 -1
- package/src/conversion/upcastdispatcher.d.ts +1 -1
- package/src/conversion/upcastdispatcher.js +1 -1
- package/src/conversion/upcasthelpers.d.ts +1 -1
- package/src/conversion/upcasthelpers.js +1 -1
- package/src/conversion/viewconsumable.d.ts +1 -1
- package/src/conversion/viewconsumable.js +1 -1
- package/src/dataprocessor/basichtmlwriter.d.ts +1 -1
- package/src/dataprocessor/basichtmlwriter.js +1 -1
- package/src/dataprocessor/dataprocessor.d.ts +1 -1
- package/src/dataprocessor/dataprocessor.js +1 -1
- package/src/dataprocessor/htmldataprocessor.d.ts +1 -1
- package/src/dataprocessor/htmldataprocessor.js +1 -1
- package/src/dataprocessor/htmlwriter.d.ts +1 -1
- package/src/dataprocessor/htmlwriter.js +1 -1
- package/src/dataprocessor/xmldataprocessor.d.ts +1 -1
- package/src/dataprocessor/xmldataprocessor.js +1 -1
- package/src/dev-utils/model.d.ts +1 -1
- package/src/dev-utils/model.js +1 -1
- package/src/dev-utils/operationreplayer.d.ts +1 -1
- package/src/dev-utils/operationreplayer.js +1 -1
- package/src/dev-utils/utils.d.ts +1 -1
- package/src/dev-utils/utils.js +1 -1
- package/src/dev-utils/view.d.ts +1 -1
- package/src/dev-utils/view.js +1 -1
- package/src/index.d.ts +4 -2
- package/src/index.js +2 -1
- package/src/model/batch.d.ts +1 -1
- package/src/model/batch.js +7 -3
- package/src/model/differ.d.ts +1 -1
- package/src/model/differ.js +1 -1
- package/src/model/document.d.ts +1 -1
- package/src/model/document.js +1 -1
- package/src/model/documentfragment.d.ts +1 -1
- package/src/model/documentfragment.js +1 -1
- package/src/model/documentselection.d.ts +1 -1
- package/src/model/documentselection.js +1 -1
- package/src/model/element.d.ts +1 -1
- package/src/model/element.js +1 -1
- package/src/model/history.d.ts +1 -1
- package/src/model/history.js +1 -1
- package/src/model/item.d.ts +1 -1
- package/src/model/item.js +1 -1
- package/src/model/liveposition.d.ts +1 -1
- package/src/model/liveposition.js +1 -1
- package/src/model/liverange.d.ts +1 -1
- package/src/model/liverange.js +1 -1
- package/src/model/markercollection.d.ts +1 -1
- package/src/model/markercollection.js +1 -1
- package/src/model/model.d.ts +1 -1
- package/src/model/model.js +1 -1
- package/src/model/node.d.ts +1 -1
- package/src/model/node.js +1 -1
- package/src/model/nodelist.d.ts +1 -1
- package/src/model/nodelist.js +1 -1
- package/src/model/operation/attributeoperation.d.ts +1 -1
- package/src/model/operation/attributeoperation.js +1 -1
- package/src/model/operation/detachoperation.d.ts +1 -1
- package/src/model/operation/detachoperation.js +1 -1
- package/src/model/operation/insertoperation.d.ts +1 -1
- package/src/model/operation/insertoperation.js +1 -1
- package/src/model/operation/markeroperation.d.ts +1 -1
- package/src/model/operation/markeroperation.js +1 -1
- package/src/model/operation/mergeoperation.d.ts +1 -1
- package/src/model/operation/mergeoperation.js +1 -1
- package/src/model/operation/moveoperation.d.ts +1 -1
- package/src/model/operation/moveoperation.js +1 -1
- package/src/model/operation/nooperation.d.ts +1 -1
- package/src/model/operation/nooperation.js +1 -1
- package/src/model/operation/operation.d.ts +4 -1
- package/src/model/operation/operation.js +2 -2
- package/src/model/operation/operationfactory.d.ts +1 -1
- package/src/model/operation/operationfactory.js +1 -1
- package/src/model/operation/renameoperation.d.ts +1 -1
- package/src/model/operation/renameoperation.js +1 -1
- package/src/model/operation/rootattributeoperation.d.ts +1 -1
- package/src/model/operation/rootattributeoperation.js +1 -1
- package/src/model/operation/rootoperation.d.ts +1 -1
- package/src/model/operation/rootoperation.js +1 -1
- package/src/model/operation/splitoperation.d.ts +1 -1
- package/src/model/operation/splitoperation.js +1 -1
- package/src/model/operation/transform.d.ts +1 -1
- package/src/model/operation/transform.js +1 -1
- package/src/model/operation/utils.d.ts +1 -1
- package/src/model/operation/utils.js +1 -1
- package/src/model/position.d.ts +1 -1
- package/src/model/position.js +1 -1
- package/src/model/range.d.ts +1 -1
- package/src/model/range.js +1 -1
- package/src/model/rootelement.d.ts +1 -1
- package/src/model/rootelement.js +1 -1
- package/src/model/schema.d.ts +1 -1
- package/src/model/schema.js +1 -1
- package/src/model/selection.d.ts +1 -1
- package/src/model/selection.js +9 -2
- package/src/model/text.d.ts +1 -1
- package/src/model/text.js +1 -1
- package/src/model/textproxy.d.ts +1 -1
- package/src/model/textproxy.js +1 -1
- package/src/model/treewalker.d.ts +17 -1
- package/src/model/treewalker.js +26 -1
- package/src/model/typecheckable.d.ts +1 -1
- package/src/model/typecheckable.js +1 -1
- package/src/model/utils/autoparagraphing.d.ts +1 -1
- package/src/model/utils/autoparagraphing.js +1 -1
- package/src/model/utils/deletecontent.d.ts +1 -1
- package/src/model/utils/deletecontent.js +1 -1
- package/src/model/utils/getselectedcontent.d.ts +1 -1
- package/src/model/utils/getselectedcontent.js +1 -1
- package/src/model/utils/insertcontent.d.ts +1 -1
- package/src/model/utils/insertcontent.js +1 -1
- package/src/model/utils/insertobject.d.ts +1 -1
- package/src/model/utils/insertobject.js +1 -1
- package/src/model/utils/modifyselection.d.ts +1 -1
- package/src/model/utils/modifyselection.js +1 -1
- package/src/model/utils/selection-post-fixer.d.ts +1 -1
- package/src/model/utils/selection-post-fixer.js +1 -1
- package/src/model/writer.d.ts +1 -1
- package/src/model/writer.js +1 -1
- package/src/view/attributeelement.d.ts +1 -1
- package/src/view/attributeelement.js +1 -1
- package/src/view/containerelement.d.ts +1 -1
- package/src/view/containerelement.js +1 -1
- package/src/view/datatransfer.d.ts +1 -1
- package/src/view/datatransfer.js +1 -1
- package/src/view/document.d.ts +1 -1
- package/src/view/document.js +1 -1
- package/src/view/documentfragment.d.ts +6 -4
- package/src/view/documentfragment.js +7 -7
- package/src/view/documentselection.d.ts +1 -1
- package/src/view/documentselection.js +1 -1
- package/src/view/domconverter.d.ts +1 -1
- package/src/view/domconverter.js +1 -1
- package/src/view/downcastwriter.d.ts +1 -1
- package/src/view/downcastwriter.js +1 -1
- package/src/view/editableelement.d.ts +1 -1
- package/src/view/editableelement.js +1 -1
- package/src/view/element.d.ts +1 -1
- package/src/view/element.js +3 -3
- package/src/view/elementdefinition.d.ts +1 -1
- package/src/view/elementdefinition.js +1 -1
- package/src/view/emptyelement.d.ts +1 -1
- package/src/view/emptyelement.js +1 -1
- package/src/view/filler.d.ts +1 -1
- package/src/view/filler.js +1 -1
- package/src/view/item.d.ts +1 -1
- package/src/view/item.js +1 -1
- package/src/view/matcher.d.ts +1 -1
- package/src/view/matcher.js +1 -1
- package/src/view/node.d.ts +13 -4
- package/src/view/node.js +5 -4
- package/src/view/observer/arrowkeysobserver.d.ts +1 -1
- package/src/view/observer/arrowkeysobserver.js +1 -1
- package/src/view/observer/bubblingemittermixin.d.ts +1 -1
- package/src/view/observer/bubblingemittermixin.js +1 -1
- package/src/view/observer/bubblingeventinfo.d.ts +1 -1
- package/src/view/observer/bubblingeventinfo.js +1 -1
- package/src/view/observer/clickobserver.d.ts +1 -1
- package/src/view/observer/clickobserver.js +1 -1
- package/src/view/observer/compositionobserver.d.ts +1 -1
- package/src/view/observer/compositionobserver.js +1 -1
- package/src/view/observer/domeventdata.d.ts +1 -1
- package/src/view/observer/domeventdata.js +1 -1
- package/src/view/observer/domeventobserver.d.ts +1 -1
- package/src/view/observer/domeventobserver.js +1 -1
- package/src/view/observer/fakeselectionobserver.d.ts +1 -1
- package/src/view/observer/fakeselectionobserver.js +1 -1
- package/src/view/observer/focusobserver.d.ts +1 -1
- package/src/view/observer/focusobserver.js +1 -1
- package/src/view/observer/inputobserver.d.ts +1 -1
- package/src/view/observer/inputobserver.js +1 -1
- package/src/view/observer/keyobserver.d.ts +1 -1
- package/src/view/observer/keyobserver.js +1 -1
- package/src/view/observer/mouseobserver.d.ts +1 -1
- package/src/view/observer/mouseobserver.js +1 -1
- package/src/view/observer/mutationobserver.d.ts +1 -1
- package/src/view/observer/mutationobserver.js +1 -1
- package/src/view/observer/observer.d.ts +1 -1
- package/src/view/observer/observer.js +1 -1
- package/src/view/observer/selectionobserver.d.ts +1 -1
- package/src/view/observer/selectionobserver.js +1 -1
- package/src/view/observer/tabobserver.d.ts +1 -1
- package/src/view/observer/tabobserver.js +1 -1
- package/src/view/observer/touchobserver.d.ts +73 -0
- package/src/view/observer/touchobserver.js +29 -0
- package/src/view/placeholder.d.ts +1 -1
- package/src/view/placeholder.js +23 -17
- package/src/view/position.d.ts +1 -1
- package/src/view/position.js +1 -1
- package/src/view/range.d.ts +1 -1
- package/src/view/range.js +1 -1
- package/src/view/rawelement.d.ts +1 -1
- package/src/view/rawelement.js +1 -1
- package/src/view/renderer.d.ts +1 -1
- package/src/view/renderer.js +1 -1
- package/src/view/rooteditableelement.d.ts +1 -1
- package/src/view/rooteditableelement.js +1 -1
- package/src/view/selection.d.ts +1 -1
- package/src/view/selection.js +1 -1
- package/src/view/styles/background.d.ts +1 -1
- package/src/view/styles/background.js +1 -1
- package/src/view/styles/border.d.ts +1 -1
- package/src/view/styles/border.js +1 -1
- package/src/view/styles/margin.d.ts +1 -1
- package/src/view/styles/margin.js +1 -1
- package/src/view/styles/padding.d.ts +1 -1
- package/src/view/styles/padding.js +1 -1
- package/src/view/styles/utils.d.ts +1 -1
- package/src/view/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 +1 -1
- package/src/view/text.js +1 -1
- package/src/view/textproxy.d.ts +1 -1
- package/src/view/textproxy.js +1 -1
- package/src/view/treewalker.d.ts +17 -1
- package/src/view/treewalker.js +25 -1
- package/src/view/typecheckable.d.ts +1 -1
- package/src/view/typecheckable.js +1 -1
- package/src/view/uielement.d.ts +1 -1
- package/src/view/uielement.js +1 -1
- package/src/view/upcastwriter.d.ts +1 -1
- package/src/view/upcastwriter.js +1 -1
- package/src/view/view.d.ts +1 -1
- package/src/view/view.js +1 -1
- package/theme/placeholder.css +1 -1
- package/theme/renderer.css +1 -1
- package/dist/controller/datacontroller.d.ts +0 -339
- package/dist/controller/editingcontroller.d.ts +0 -102
- package/dist/conversion/conversion.d.ts +0 -482
- package/dist/conversion/conversionhelpers.d.ts +0 -30
- package/dist/conversion/downcastdispatcher.d.ts +0 -566
- package/dist/conversion/downcasthelpers.d.ts +0 -1194
- package/dist/conversion/mapper.d.ts +0 -507
- package/dist/conversion/modelconsumable.d.ts +0 -205
- package/dist/conversion/upcastdispatcher.d.ts +0 -496
- package/dist/conversion/upcasthelpers.d.ts +0 -503
- package/dist/conversion/viewconsumable.d.ts +0 -373
- package/dist/dataprocessor/basichtmlwriter.d.ts +0 -22
- package/dist/dataprocessor/dataprocessor.d.ts +0 -65
- package/dist/dataprocessor/htmldataprocessor.d.ts +0 -80
- package/dist/dataprocessor/htmlwriter.d.ts +0 -20
- package/dist/dataprocessor/xmldataprocessor.d.ts +0 -94
- package/dist/dev-utils/model.d.ts +0 -130
- package/dist/dev-utils/operationreplayer.d.ts +0 -55
- package/dist/dev-utils/utils.d.ts +0 -41
- package/dist/dev-utils/view.d.ts +0 -324
- package/dist/index.d.ts +0 -122
- package/dist/model/batch.d.ts +0 -110
- package/dist/model/differ.d.ts +0 -511
- package/dist/model/document.d.ts +0 -278
- package/dist/model/documentfragment.d.ts +0 -223
- package/dist/model/documentselection.d.ts +0 -424
- package/dist/model/element.d.ts +0 -191
- package/dist/model/history.d.ts +0 -118
- package/dist/model/item.d.ts +0 -18
- package/dist/model/liveposition.d.ts +0 -81
- package/dist/model/liverange.d.ts +0 -106
- package/dist/model/markercollection.d.ts +0 -339
- package/dist/model/model.d.ts +0 -923
- package/dist/model/node.d.ts +0 -262
- package/dist/model/nodelist.d.ts +0 -119
- package/dist/model/operation/attributeoperation.d.ts +0 -107
- package/dist/model/operation/detachoperation.d.ts +0 -64
- package/dist/model/operation/insertoperation.d.ts +0 -94
- package/dist/model/operation/markeroperation.d.ts +0 -95
- package/dist/model/operation/mergeoperation.d.ts +0 -104
- package/dist/model/operation/moveoperation.d.ts +0 -100
- package/dist/model/operation/nooperation.d.ts +0 -42
- package/dist/model/operation/operation.d.ts +0 -100
- package/dist/model/operation/operationfactory.d.ts +0 -22
- package/dist/model/operation/renameoperation.d.ts +0 -87
- package/dist/model/operation/rootattributeoperation.d.ts +0 -102
- package/dist/model/operation/rootoperation.d.ts +0 -80
- package/dist/model/operation/splitoperation.d.ts +0 -113
- package/dist/model/operation/transform.d.ts +0 -104
- package/dist/model/operation/utils.d.ts +0 -75
- package/dist/model/position.d.ts +0 -549
- package/dist/model/range.d.ts +0 -462
- package/dist/model/rootelement.d.ts +0 -64
- package/dist/model/schema.d.ts +0 -1334
- package/dist/model/selection.d.ts +0 -486
- package/dist/model/text.d.ts +0 -70
- package/dist/model/textproxy.d.ts +0 -148
- package/dist/model/treewalker.d.ts +0 -190
- package/dist/model/typecheckable.d.ts +0 -289
- package/dist/model/utils/autoparagraphing.d.ts +0 -41
- package/dist/model/utils/deletecontent.d.ts +0 -62
- package/dist/model/utils/getselectedcontent.d.ts +0 -34
- package/dist/model/utils/insertcontent.d.ts +0 -50
- package/dist/model/utils/insertobject.d.ts +0 -51
- package/dist/model/utils/modifyselection.d.ts +0 -52
- package/dist/model/utils/selection-post-fixer.d.ts +0 -78
- package/dist/model/writer.d.ts +0 -855
- package/dist/view/attributeelement.d.ts +0 -112
- package/dist/view/containerelement.d.ts +0 -53
- package/dist/view/datatransfer.d.ts +0 -83
- package/dist/view/document.d.ts +0 -188
- package/dist/view/documentfragment.d.ts +0 -157
- package/dist/view/documentselection.d.ts +0 -310
- package/dist/view/domconverter.d.ts +0 -665
- package/dist/view/downcastwriter.d.ts +0 -1000
- package/dist/view/editableelement.d.ts +0 -66
- package/dist/view/element.d.ts +0 -472
- package/dist/view/elementdefinition.d.ts +0 -91
- package/dist/view/emptyelement.d.ts +0 -45
- package/dist/view/filler.d.ts +0 -115
- package/dist/view/item.d.ts +0 -18
- package/dist/view/matcher.d.ts +0 -490
- package/dist/view/node.d.ts +0 -166
- package/dist/view/observer/arrowkeysobserver.d.ts +0 -49
- package/dist/view/observer/bubblingemittermixin.d.ts +0 -170
- package/dist/view/observer/bubblingeventinfo.d.ts +0 -51
- package/dist/view/observer/clickobserver.d.ts +0 -47
- package/dist/view/observer/compositionobserver.d.ts +0 -86
- package/dist/view/observer/domeventdata.d.ts +0 -54
- package/dist/view/observer/domeventobserver.d.ts +0 -82
- package/dist/view/observer/fakeselectionobserver.d.ts +0 -51
- package/dist/view/observer/focusobserver.d.ts +0 -98
- package/dist/view/observer/inputobserver.d.ts +0 -90
- package/dist/view/observer/keyobserver.d.ts +0 -70
- package/dist/view/observer/mouseobserver.d.ts +0 -93
- package/dist/view/observer/mutationobserver.d.ts +0 -119
- package/dist/view/observer/observer.d.ts +0 -93
- package/dist/view/observer/selectionobserver.d.ts +0 -151
- package/dist/view/observer/tabobserver.d.ts +0 -50
- package/dist/view/placeholder.d.ts +0 -100
- package/dist/view/position.d.ts +0 -192
- package/dist/view/range.d.ts +0 -283
- package/dist/view/rawelement.d.ts +0 -77
- package/dist/view/renderer.d.ts +0 -281
- package/dist/view/rooteditableelement.d.ts +0 -45
- package/dist/view/selection.d.ts +0 -379
- package/dist/view/styles/background.d.ts +0 -37
- package/dist/view/styles/border.d.ts +0 -47
- package/dist/view/styles/margin.d.ts +0 -33
- package/dist/view/styles/padding.d.ts +0 -33
- package/dist/view/styles/utils.d.ts +0 -97
- package/dist/view/stylesmap.d.ts +0 -685
- package/dist/view/text.d.ts +0 -78
- package/dist/view/textproxy.d.ts +0 -101
- package/dist/view/treewalker.d.ts +0 -199
- package/dist/view/typecheckable.d.ts +0 -452
- package/dist/view/uielement.d.ts +0 -100
- package/dist/view/upcastwriter.d.ts +0 -421
- package/dist/view/view.d.ts +0 -488
package/dist/view/selection.d.ts
DELETED
|
@@ -1,379 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
|
-
*/
|
|
5
|
-
/**
|
|
6
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
7
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
|
8
|
-
*/
|
|
9
|
-
/**
|
|
10
|
-
* @module engine/view/selection
|
|
11
|
-
*/
|
|
12
|
-
import TypeCheckable from './typecheckable.js';
|
|
13
|
-
import Range from './range.js';
|
|
14
|
-
import Position, { type PositionOffset } from './position.js';
|
|
15
|
-
import Node from './node.js';
|
|
16
|
-
import DocumentSelection from './documentselection.js';
|
|
17
|
-
import type Element from './element.js';
|
|
18
|
-
import type Item from './item.js';
|
|
19
|
-
import type EditableElement from './editableelement.js';
|
|
20
|
-
declare const Selection_base: import("@ckeditor/ckeditor5-utils").Mixed<typeof TypeCheckable, import("@ckeditor/ckeditor5-utils").Emitter>;
|
|
21
|
-
/**
|
|
22
|
-
* Class representing an arbirtary selection in the view.
|
|
23
|
-
* See also {@link module:engine/view/documentselection~DocumentSelection}.
|
|
24
|
-
*
|
|
25
|
-
* New selection instances can be created via the constructor or one these methods:
|
|
26
|
-
*
|
|
27
|
-
* * {@link module:engine/view/view~View#createSelection `View#createSelection()`},
|
|
28
|
-
* * {@link module:engine/view/upcastwriter~UpcastWriter#createSelection `UpcastWriter#createSelection()`}.
|
|
29
|
-
*
|
|
30
|
-
* A selection can consist of {@link module:engine/view/range~Range ranges} that can be set by using
|
|
31
|
-
* the {@link module:engine/view/selection~Selection#setTo `Selection#setTo()`} method.
|
|
32
|
-
*/
|
|
33
|
-
export default class Selection extends /* #__PURE__ */ Selection_base {
|
|
34
|
-
/**
|
|
35
|
-
* Stores all ranges that are selected.
|
|
36
|
-
*/
|
|
37
|
-
private _ranges;
|
|
38
|
-
/**
|
|
39
|
-
* Specifies whether the last added range was added as a backward or forward range.
|
|
40
|
-
*/
|
|
41
|
-
private _lastRangeBackward;
|
|
42
|
-
/**
|
|
43
|
-
* Specifies whether selection instance is fake.
|
|
44
|
-
*/
|
|
45
|
-
private _isFake;
|
|
46
|
-
/**
|
|
47
|
-
* Fake selection's label.
|
|
48
|
-
*/
|
|
49
|
-
private _fakeSelectionLabel;
|
|
50
|
-
/**
|
|
51
|
-
* Creates new selection instance.
|
|
52
|
-
*
|
|
53
|
-
* **Note**: The selection constructor is available as a factory method:
|
|
54
|
-
*
|
|
55
|
-
* * {@link module:engine/view/view~View#createSelection `View#createSelection()`},
|
|
56
|
-
* * {@link module:engine/view/upcastwriter~UpcastWriter#createSelection `UpcastWriter#createSelection()`}.
|
|
57
|
-
*
|
|
58
|
-
* ```ts
|
|
59
|
-
* // Creates empty selection without ranges.
|
|
60
|
-
* const selection = writer.createSelection();
|
|
61
|
-
*
|
|
62
|
-
* // Creates selection at the given range.
|
|
63
|
-
* const range = writer.createRange( start, end );
|
|
64
|
-
* const selection = writer.createSelection( range );
|
|
65
|
-
*
|
|
66
|
-
* // Creates selection at the given ranges
|
|
67
|
-
* const ranges = [ writer.createRange( start1, end2 ), writer.createRange( star2, end2 ) ];
|
|
68
|
-
* const selection = writer.createSelection( ranges );
|
|
69
|
-
*
|
|
70
|
-
* // Creates selection from the other selection.
|
|
71
|
-
* const otherSelection = writer.createSelection();
|
|
72
|
-
* const selection = writer.createSelection( otherSelection );
|
|
73
|
-
*
|
|
74
|
-
* // Creates selection from the document selection.
|
|
75
|
-
* const selection = writer.createSelection( editor.editing.view.document.selection );
|
|
76
|
-
*
|
|
77
|
-
* // Creates selection at the given position.
|
|
78
|
-
* const position = writer.createPositionFromPath( root, path );
|
|
79
|
-
* const selection = writer.createSelection( position );
|
|
80
|
-
*
|
|
81
|
-
* // Creates collapsed selection at the position of given item and offset.
|
|
82
|
-
* const paragraph = writer.createContainerElement( 'paragraph' );
|
|
83
|
-
* const selection = writer.createSelection( paragraph, offset );
|
|
84
|
-
*
|
|
85
|
-
* // Creates a range inside an {@link module:engine/view/element~Element element} which starts before the
|
|
86
|
-
* // first child of that element and ends after the last child of that element.
|
|
87
|
-
* const selection = writer.createSelection( paragraph, 'in' );
|
|
88
|
-
*
|
|
89
|
-
* // Creates a range on an {@link module:engine/view/item~Item item} which starts before the item and ends
|
|
90
|
-
* // just after the item.
|
|
91
|
-
* const selection = writer.createSelection( paragraph, 'on' );
|
|
92
|
-
* ```
|
|
93
|
-
*
|
|
94
|
-
* `Selection`'s constructor allow passing additional options (`backward`, `fake` and `label`) as the last argument.
|
|
95
|
-
*
|
|
96
|
-
* ```ts
|
|
97
|
-
* // Creates backward selection.
|
|
98
|
-
* const selection = writer.createSelection( range, { backward: true } );
|
|
99
|
-
* ```
|
|
100
|
-
*
|
|
101
|
-
* Fake selection does not render as browser native selection over selected elements and is hidden to the user.
|
|
102
|
-
* This way, no native selection UI artifacts are displayed to the user and selection over elements can be
|
|
103
|
-
* represented in other way, for example by applying proper CSS class.
|
|
104
|
-
*
|
|
105
|
-
* Additionally fake's selection label can be provided. It will be used to describe fake selection in DOM
|
|
106
|
-
* (and be properly handled by screen readers).
|
|
107
|
-
*
|
|
108
|
-
* ```ts
|
|
109
|
-
* // Creates fake selection with label.
|
|
110
|
-
* const selection = writer.createSelection( range, { fake: true, label: 'foo' } );
|
|
111
|
-
* ```
|
|
112
|
-
*
|
|
113
|
-
* @internal
|
|
114
|
-
*/
|
|
115
|
-
constructor(...args: [] | [
|
|
116
|
-
selectable: Node,
|
|
117
|
-
placeOrOffset: PlaceOrOffset,
|
|
118
|
-
options?: SelectionOptions
|
|
119
|
-
] | [
|
|
120
|
-
selectable?: Exclude<Selectable, Node>,
|
|
121
|
-
options?: SelectionOptions
|
|
122
|
-
]);
|
|
123
|
-
/**
|
|
124
|
-
* Returns true if selection instance is marked as `fake`.
|
|
125
|
-
*
|
|
126
|
-
* @see #setTo
|
|
127
|
-
*/
|
|
128
|
-
get isFake(): boolean;
|
|
129
|
-
/**
|
|
130
|
-
* Returns fake selection label.
|
|
131
|
-
*
|
|
132
|
-
* @see #setTo
|
|
133
|
-
*/
|
|
134
|
-
get fakeSelectionLabel(): string;
|
|
135
|
-
/**
|
|
136
|
-
* Selection anchor. Anchor may be described as a position where the selection starts. Together with
|
|
137
|
-
* {@link #focus focus} they define the direction of selection, which is important
|
|
138
|
-
* when expanding/shrinking selection. Anchor is always the start or end of the most recent added range.
|
|
139
|
-
* It may be a bit unintuitive when there are multiple ranges in selection.
|
|
140
|
-
*
|
|
141
|
-
* @see #focus
|
|
142
|
-
*/
|
|
143
|
-
get anchor(): Position | null;
|
|
144
|
-
/**
|
|
145
|
-
* Selection focus. Focus is a position where the selection ends.
|
|
146
|
-
*
|
|
147
|
-
* @see #anchor
|
|
148
|
-
*/
|
|
149
|
-
get focus(): Position | null;
|
|
150
|
-
/**
|
|
151
|
-
* Returns whether the selection is collapsed. Selection is collapsed when there is exactly one range which is
|
|
152
|
-
* collapsed.
|
|
153
|
-
*/
|
|
154
|
-
get isCollapsed(): boolean;
|
|
155
|
-
/**
|
|
156
|
-
* Returns number of ranges in selection.
|
|
157
|
-
*/
|
|
158
|
-
get rangeCount(): number;
|
|
159
|
-
/**
|
|
160
|
-
* Specifies whether the {@link #focus} precedes {@link #anchor}.
|
|
161
|
-
*/
|
|
162
|
-
get isBackward(): boolean;
|
|
163
|
-
/**
|
|
164
|
-
* {@link module:engine/view/editableelement~EditableElement EditableElement} instance that contains this selection, or `null`
|
|
165
|
-
* if the selection is not inside an editable element.
|
|
166
|
-
*/
|
|
167
|
-
get editableElement(): EditableElement | null;
|
|
168
|
-
/**
|
|
169
|
-
* Returns an iterable that contains copies of all ranges added to the selection.
|
|
170
|
-
*/
|
|
171
|
-
getRanges(): IterableIterator<Range>;
|
|
172
|
-
/**
|
|
173
|
-
* Returns copy of the first range in the selection. First range is the one which
|
|
174
|
-
* {@link module:engine/view/range~Range#start start} position {@link module:engine/view/position~Position#isBefore is before} start
|
|
175
|
-
* position of all other ranges (not to confuse with the first range added to the selection).
|
|
176
|
-
* Returns `null` if no ranges are added to selection.
|
|
177
|
-
*/
|
|
178
|
-
getFirstRange(): Range | null;
|
|
179
|
-
/**
|
|
180
|
-
* Returns copy of the last range in the selection. Last range is the one which {@link module:engine/view/range~Range#end end}
|
|
181
|
-
* position {@link module:engine/view/position~Position#isAfter is after} end position of all other ranges (not to confuse
|
|
182
|
-
* with the last range added to the selection). Returns `null` if no ranges are added to selection.
|
|
183
|
-
*/
|
|
184
|
-
getLastRange(): Range | null;
|
|
185
|
-
/**
|
|
186
|
-
* Returns copy of the first position in the selection. First position is the position that
|
|
187
|
-
* {@link module:engine/view/position~Position#isBefore is before} any other position in the selection ranges.
|
|
188
|
-
* Returns `null` if no ranges are added to selection.
|
|
189
|
-
*/
|
|
190
|
-
getFirstPosition(): Position | null;
|
|
191
|
-
/**
|
|
192
|
-
* Returns copy of the last position in the selection. Last position is the position that
|
|
193
|
-
* {@link module:engine/view/position~Position#isAfter is after} any other position in the selection ranges.
|
|
194
|
-
* Returns `null` if no ranges are added to selection.
|
|
195
|
-
*/
|
|
196
|
-
getLastPosition(): Position | null;
|
|
197
|
-
/**
|
|
198
|
-
* Checks whether, this selection is equal to given selection. Selections are equal if they have same directions,
|
|
199
|
-
* same number of ranges and all ranges from one selection equal to a range from other selection.
|
|
200
|
-
*
|
|
201
|
-
* @param otherSelection Selection to compare with.
|
|
202
|
-
* @returns `true` if selections are equal, `false` otherwise.
|
|
203
|
-
*/
|
|
204
|
-
isEqual(otherSelection: Selection | DocumentSelection): boolean;
|
|
205
|
-
/**
|
|
206
|
-
* Checks whether this selection is similar to given selection. Selections are similar if they have same directions, same
|
|
207
|
-
* number of ranges, and all {@link module:engine/view/range~Range#getTrimmed trimmed} ranges from one selection are
|
|
208
|
-
* equal to any trimmed range from other selection.
|
|
209
|
-
*
|
|
210
|
-
* @param otherSelection Selection to compare with.
|
|
211
|
-
* @returns `true` if selections are similar, `false` otherwise.
|
|
212
|
-
*/
|
|
213
|
-
isSimilar(otherSelection: Selection | DocumentSelection): boolean;
|
|
214
|
-
/**
|
|
215
|
-
* Returns the selected element. {@link module:engine/view/element~Element Element} is considered as selected if there is only
|
|
216
|
-
* one range in the selection, and that range contains exactly one element.
|
|
217
|
-
* Returns `null` if there is no selected element.
|
|
218
|
-
*/
|
|
219
|
-
getSelectedElement(): Element | null;
|
|
220
|
-
/**
|
|
221
|
-
* Sets this selection's ranges and direction to the specified location based on the given
|
|
222
|
-
* {@link module:engine/view/selection~Selectable selectable}.
|
|
223
|
-
*
|
|
224
|
-
* ```ts
|
|
225
|
-
* // Sets selection to the given range.
|
|
226
|
-
* const range = writer.createRange( start, end );
|
|
227
|
-
* selection.setTo( range );
|
|
228
|
-
*
|
|
229
|
-
* // Sets selection to given ranges.
|
|
230
|
-
* const ranges = [ writer.createRange( start1, end2 ), writer.createRange( star2, end2 ) ];
|
|
231
|
-
* selection.setTo( range );
|
|
232
|
-
*
|
|
233
|
-
* // Sets selection to the other selection.
|
|
234
|
-
* const otherSelection = writer.createSelection();
|
|
235
|
-
* selection.setTo( otherSelection );
|
|
236
|
-
*
|
|
237
|
-
* // Sets selection to contents of DocumentSelection.
|
|
238
|
-
* selection.setTo( editor.editing.view.document.selection );
|
|
239
|
-
*
|
|
240
|
-
* // Sets collapsed selection at the given position.
|
|
241
|
-
* const position = writer.createPositionAt( root, path );
|
|
242
|
-
* selection.setTo( position );
|
|
243
|
-
*
|
|
244
|
-
* // Sets collapsed selection at the position of given item and offset.
|
|
245
|
-
* selection.setTo( paragraph, offset );
|
|
246
|
-
* ```
|
|
247
|
-
*
|
|
248
|
-
* Creates a range inside an {@link module:engine/view/element~Element element} which starts before the first child of
|
|
249
|
-
* that element and ends after the last child of that element.
|
|
250
|
-
*
|
|
251
|
-
* ```ts
|
|
252
|
-
* selection.setTo( paragraph, 'in' );
|
|
253
|
-
* ```
|
|
254
|
-
*
|
|
255
|
-
* Creates a range on an {@link module:engine/view/item~Item item} which starts before the item and ends just after the item.
|
|
256
|
-
*
|
|
257
|
-
* ```ts
|
|
258
|
-
* selection.setTo( paragraph, 'on' );
|
|
259
|
-
*
|
|
260
|
-
* // Clears selection. Removes all ranges.
|
|
261
|
-
* selection.setTo( null );
|
|
262
|
-
* ```
|
|
263
|
-
*
|
|
264
|
-
* `Selection#setTo()` method allow passing additional options (`backward`, `fake` and `label`) as the last argument.
|
|
265
|
-
*
|
|
266
|
-
* ```ts
|
|
267
|
-
* // Sets selection as backward.
|
|
268
|
-
* selection.setTo( range, { backward: true } );
|
|
269
|
-
* ```
|
|
270
|
-
*
|
|
271
|
-
* Fake selection does not render as browser native selection over selected elements and is hidden to the user.
|
|
272
|
-
* This way, no native selection UI artifacts are displayed to the user and selection over elements can be
|
|
273
|
-
* represented in other way, for example by applying proper CSS class.
|
|
274
|
-
*
|
|
275
|
-
* Additionally fake's selection label can be provided. It will be used to describe fake selection in DOM
|
|
276
|
-
* (and be properly handled by screen readers).
|
|
277
|
-
*
|
|
278
|
-
* ```ts
|
|
279
|
-
* // Creates fake selection with label.
|
|
280
|
-
* selection.setTo( range, { fake: true, label: 'foo' } );
|
|
281
|
-
* ```
|
|
282
|
-
*
|
|
283
|
-
* @fires change
|
|
284
|
-
*/
|
|
285
|
-
setTo(...args: [
|
|
286
|
-
selectable: Node,
|
|
287
|
-
placeOrOffset: PlaceOrOffset,
|
|
288
|
-
options?: SelectionOptions
|
|
289
|
-
] | [
|
|
290
|
-
selectable?: Exclude<Selectable, Node>,
|
|
291
|
-
options?: SelectionOptions
|
|
292
|
-
]): void;
|
|
293
|
-
/**
|
|
294
|
-
* Moves {@link #focus} to the specified location.
|
|
295
|
-
*
|
|
296
|
-
* The location can be specified in the same form as {@link module:engine/view/view~View#createPositionAt view.createPositionAt()}
|
|
297
|
-
* parameters.
|
|
298
|
-
*
|
|
299
|
-
* @fires change
|
|
300
|
-
* @param offset Offset or one of the flags. Used only when first parameter is a {@link module:engine/view/item~Item view item}.
|
|
301
|
-
*/
|
|
302
|
-
setFocus(itemOrPosition: Item | Position, offset?: PositionOffset): void;
|
|
303
|
-
/**
|
|
304
|
-
* Replaces all ranges that were added to the selection with given array of ranges. Last range of the array
|
|
305
|
-
* is treated like the last added range and is used to set {@link #anchor anchor} and {@link #focus focus}.
|
|
306
|
-
* Accepts a flag describing in which way the selection is made.
|
|
307
|
-
*
|
|
308
|
-
* @param newRanges Iterable object of ranges to set.
|
|
309
|
-
* @param isLastBackward Flag describing if last added range was selected forward - from start to end
|
|
310
|
-
* (`false`) or backward - from end to start (`true`). Defaults to `false`.
|
|
311
|
-
*/
|
|
312
|
-
private _setRanges;
|
|
313
|
-
/**
|
|
314
|
-
* Sets this selection instance to be marked as `fake`. A fake selection does not render as browser native selection
|
|
315
|
-
* over selected elements and is hidden to the user. This way, no native selection UI artifacts are displayed to
|
|
316
|
-
* the user and selection over elements can be represented in other way, for example by applying proper CSS class.
|
|
317
|
-
*
|
|
318
|
-
* Additionally fake's selection label can be provided. It will be used to describe fake selection in DOM (and be
|
|
319
|
-
* properly handled by screen readers).
|
|
320
|
-
*/
|
|
321
|
-
private _setFakeOptions;
|
|
322
|
-
/**
|
|
323
|
-
* Adds a range to the selection. Added range is copied. This means that passed range is not saved in the
|
|
324
|
-
* selection instance and you can safely operate on it.
|
|
325
|
-
*
|
|
326
|
-
* Accepts a flag describing in which way the selection is made - passed range might be selected from
|
|
327
|
-
* {@link module:engine/view/range~Range#start start} to {@link module:engine/view/range~Range#end end}
|
|
328
|
-
* or from {@link module:engine/view/range~Range#end end} to {@link module:engine/view/range~Range#start start}.
|
|
329
|
-
* The flag is used to set {@link #anchor anchor} and {@link #focus focus} properties.
|
|
330
|
-
*
|
|
331
|
-
* Throws {@link module:utils/ckeditorerror~CKEditorError CKEditorError} `view-selection-range-intersects` if added range intersects
|
|
332
|
-
* with ranges already stored in Selection instance.
|
|
333
|
-
*/
|
|
334
|
-
private _addRange;
|
|
335
|
-
/**
|
|
336
|
-
* Adds range to selection - creates copy of given range so it can be safely used and modified.
|
|
337
|
-
*
|
|
338
|
-
* Throws {@link module:utils/ckeditorerror~CKEditorError CKEditorError} `view-selection-range-intersects` if added range intersects
|
|
339
|
-
* with ranges already stored in selection instance.
|
|
340
|
-
*/
|
|
341
|
-
private _pushRange;
|
|
342
|
-
}
|
|
343
|
-
/**
|
|
344
|
-
* Additional options for {@link ~Selection}.
|
|
345
|
-
*/
|
|
346
|
-
export interface SelectionOptions {
|
|
347
|
-
/**
|
|
348
|
-
* Sets this selection instance to be backward.
|
|
349
|
-
*/
|
|
350
|
-
backward?: boolean;
|
|
351
|
-
/**
|
|
352
|
-
* Sets this selection instance to be marked as `fake`.
|
|
353
|
-
*/
|
|
354
|
-
fake?: boolean;
|
|
355
|
-
/**
|
|
356
|
-
* Label for the fake selection.
|
|
357
|
-
*/
|
|
358
|
-
label?: string;
|
|
359
|
-
}
|
|
360
|
-
/**
|
|
361
|
-
* The place or offset of the selection.
|
|
362
|
-
*/
|
|
363
|
-
export type PlaceOrOffset = number | 'before' | 'end' | 'after' | 'on' | 'in';
|
|
364
|
-
/**
|
|
365
|
-
* Fired whenever selection ranges are changed through {@link ~Selection Selection API}.
|
|
366
|
-
*
|
|
367
|
-
* @eventName ~Selection#change
|
|
368
|
-
*/
|
|
369
|
-
export type ViewSelectionChangeEvent = {
|
|
370
|
-
name: 'change';
|
|
371
|
-
args: [];
|
|
372
|
-
};
|
|
373
|
-
/**
|
|
374
|
-
* An entity that is used to set selection.
|
|
375
|
-
*
|
|
376
|
-
* See also {@link module:engine/view/selection~Selection#setTo}
|
|
377
|
-
*/
|
|
378
|
-
export type Selectable = Selection | DocumentSelection | Position | Iterable<Range> | Range | Node | null;
|
|
379
|
-
export {};
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
|
-
*/
|
|
5
|
-
/**
|
|
6
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
7
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
|
8
|
-
*/
|
|
9
|
-
/**
|
|
10
|
-
* @module engine/view/styles/background
|
|
11
|
-
*/
|
|
12
|
-
import type { StylesProcessor } from '../stylesmap.js';
|
|
13
|
-
/**
|
|
14
|
-
* Adds a background CSS styles processing rules.
|
|
15
|
-
*
|
|
16
|
-
* ```ts
|
|
17
|
-
* editor.data.addStyleProcessorRules( addBackgroundRules );
|
|
18
|
-
* ```
|
|
19
|
-
*
|
|
20
|
-
* The normalized value is stored as:
|
|
21
|
-
*
|
|
22
|
-
* ```ts
|
|
23
|
-
* const styles = {
|
|
24
|
-
* background: {
|
|
25
|
-
* color,
|
|
26
|
-
* repeat,
|
|
27
|
-
* position,
|
|
28
|
-
* attachment,
|
|
29
|
-
* image
|
|
30
|
-
* }
|
|
31
|
-
* };
|
|
32
|
-
* ````
|
|
33
|
-
*
|
|
34
|
-
* **Note**: Currently only `'background-color'` longhand value is parsed besides `'background'` shorthand. The reducer also supports only
|
|
35
|
-
* `'background-color'` value.
|
|
36
|
-
*/
|
|
37
|
-
export declare function addBackgroundRules(stylesProcessor: StylesProcessor): void;
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
|
-
*/
|
|
5
|
-
/**
|
|
6
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
7
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
|
8
|
-
*/
|
|
9
|
-
/**
|
|
10
|
-
* @module engine/view/styles/border
|
|
11
|
-
*/
|
|
12
|
-
import type { StylesProcessor } from '../stylesmap.js';
|
|
13
|
-
/**
|
|
14
|
-
* Adds a border CSS styles processing rules.
|
|
15
|
-
*
|
|
16
|
-
* ```ts
|
|
17
|
-
* editor.data.addStyleProcessorRules( addBorderRules );
|
|
18
|
-
* ```
|
|
19
|
-
*
|
|
20
|
-
* This rules merges all [border](https://developer.mozilla.org/en-US/docs/Web/CSS/border) styles notation shorthands:
|
|
21
|
-
*
|
|
22
|
-
* - border
|
|
23
|
-
* - border-top
|
|
24
|
-
* - border-right
|
|
25
|
-
* - border-bottom
|
|
26
|
-
* - border-left
|
|
27
|
-
* - border-color
|
|
28
|
-
* - border-style
|
|
29
|
-
* - border-width
|
|
30
|
-
*
|
|
31
|
-
* and all corresponding longhand forms (like `border-top-color`, `border-top-style`, etc).
|
|
32
|
-
*
|
|
33
|
-
* It does not handle other shorthands (like `border-radius` or `border-image`).
|
|
34
|
-
*
|
|
35
|
-
* The normalized model stores border values as:
|
|
36
|
-
*
|
|
37
|
-
* ```ts
|
|
38
|
-
* const styles = {
|
|
39
|
-
* border: {
|
|
40
|
-
* color: { top, right, bottom, left },
|
|
41
|
-
* style: { top, right, bottom, left },
|
|
42
|
-
* width: { top, right, bottom, left },
|
|
43
|
-
* }
|
|
44
|
-
* };
|
|
45
|
-
* ```
|
|
46
|
-
*/
|
|
47
|
-
export declare function addBorderRules(stylesProcessor: StylesProcessor): void;
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
|
-
*/
|
|
5
|
-
/**
|
|
6
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
7
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
|
8
|
-
*/
|
|
9
|
-
/**
|
|
10
|
-
* @module engine/view/styles/margin
|
|
11
|
-
*/
|
|
12
|
-
import type { StylesProcessor } from '../stylesmap.js';
|
|
13
|
-
/**
|
|
14
|
-
* Adds a margin CSS styles processing rules.
|
|
15
|
-
*
|
|
16
|
-
* ```ts
|
|
17
|
-
* editor.data.addStyleProcessorRules( addMarginRules );
|
|
18
|
-
* ```
|
|
19
|
-
*
|
|
20
|
-
* The normalized value is stored as:
|
|
21
|
-
*
|
|
22
|
-
* ```ts
|
|
23
|
-
* const styles = {
|
|
24
|
-
* margin: {
|
|
25
|
-
* top,
|
|
26
|
-
* right,
|
|
27
|
-
* bottom,
|
|
28
|
-
* left
|
|
29
|
-
* }
|
|
30
|
-
* };
|
|
31
|
-
* ```
|
|
32
|
-
*/
|
|
33
|
-
export declare function addMarginRules(stylesProcessor: StylesProcessor): void;
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
|
-
*/
|
|
5
|
-
/**
|
|
6
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
7
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
|
8
|
-
*/
|
|
9
|
-
/**
|
|
10
|
-
* @module engine/view/styles/padding
|
|
11
|
-
*/
|
|
12
|
-
import type { StylesProcessor } from '../stylesmap.js';
|
|
13
|
-
/**
|
|
14
|
-
* Adds a padding CSS styles processing rules.
|
|
15
|
-
*
|
|
16
|
-
* ```ts
|
|
17
|
-
* editor.data.addStyleProcessorRules( addPaddingRules );
|
|
18
|
-
* ```
|
|
19
|
-
*
|
|
20
|
-
* The normalized value is stored as:
|
|
21
|
-
*
|
|
22
|
-
* ```ts
|
|
23
|
-
* const styles = {
|
|
24
|
-
* padding: {
|
|
25
|
-
* top,
|
|
26
|
-
* right,
|
|
27
|
-
* bottom,
|
|
28
|
-
* left
|
|
29
|
-
* }
|
|
30
|
-
* };
|
|
31
|
-
* ```
|
|
32
|
-
*/
|
|
33
|
-
export declare function addPaddingRules(stylesProcessor: StylesProcessor): void;
|
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
|
-
*/
|
|
5
|
-
/**
|
|
6
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
7
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
|
8
|
-
*/
|
|
9
|
-
/**
|
|
10
|
-
* @module engine/view/styles/utils
|
|
11
|
-
*/
|
|
12
|
-
import type { BoxSides, PropertyDescriptor, StyleValue } from '../stylesmap.js';
|
|
13
|
-
/**
|
|
14
|
-
* Checks if string contains [color](https://developer.mozilla.org/en-US/docs/Web/CSS/color) CSS value.
|
|
15
|
-
*
|
|
16
|
-
* ```ts
|
|
17
|
-
* isColor( '#f00' ); // true
|
|
18
|
-
* isColor( '#AA00BB33' ); // true
|
|
19
|
-
* isColor( 'rgb(0, 0, 250)' ); // true
|
|
20
|
-
* isColor( 'hsla(240, 100%, 50%, .7)' ); // true
|
|
21
|
-
* isColor( 'deepskyblue' ); // true
|
|
22
|
-
* ```
|
|
23
|
-
*
|
|
24
|
-
* **Note**: It does not support CSS Level 4 whitespace syntax, system colors and radius values for HSL colors.
|
|
25
|
-
*/
|
|
26
|
-
export declare function isColor(string: string): boolean;
|
|
27
|
-
/**
|
|
28
|
-
* Checks if string contains [line style](https://developer.mozilla.org/en-US/docs/Web/CSS/border-style) CSS value.
|
|
29
|
-
*/
|
|
30
|
-
export declare function isLineStyle(string: string): boolean;
|
|
31
|
-
/**
|
|
32
|
-
* Checks if string contains [length](https://developer.mozilla.org/en-US/docs/Web/CSS/length) CSS value.
|
|
33
|
-
*/
|
|
34
|
-
export declare function isLength(string: string): boolean;
|
|
35
|
-
/**
|
|
36
|
-
* Checks if string contains [percentage](https://developer.mozilla.org/en-US/docs/Web/CSS/percentage) CSS value.
|
|
37
|
-
*/
|
|
38
|
-
export declare function isPercentage(string: string): boolean;
|
|
39
|
-
/**
|
|
40
|
-
* Checks if string contains [background repeat](https://developer.mozilla.org/en-US/docs/Web/CSS/background-repeat) CSS value.
|
|
41
|
-
*/
|
|
42
|
-
export declare function isRepeat(string: string): boolean;
|
|
43
|
-
/**
|
|
44
|
-
* Checks if string contains [background position](https://developer.mozilla.org/en-US/docs/Web/CSS/background-position) CSS value.
|
|
45
|
-
*/
|
|
46
|
-
export declare function isPosition(string: string): boolean;
|
|
47
|
-
/**
|
|
48
|
-
* Checks if string contains [background attachment](https://developer.mozilla.org/en-US/docs/Web/CSS/background-attachment) CSS value.
|
|
49
|
-
*/
|
|
50
|
-
export declare function isAttachment(string: string): boolean;
|
|
51
|
-
/**
|
|
52
|
-
* Checks if string contains [URL](https://developer.mozilla.org/en-US/docs/Web/CSS/url) CSS value.
|
|
53
|
-
*/
|
|
54
|
-
export declare function isURL(string: string): boolean;
|
|
55
|
-
/**
|
|
56
|
-
* Parses box sides as individual values.
|
|
57
|
-
*/
|
|
58
|
-
export declare function getBoxSidesValues(value?: string): BoxSides;
|
|
59
|
-
/**
|
|
60
|
-
* Default reducer for CSS properties that concerns edges of a box
|
|
61
|
-
* [shorthand](https://developer.mozilla.org/en-US/docs/Web/CSS/Shorthand_properties) notations:
|
|
62
|
-
*
|
|
63
|
-
* ```ts
|
|
64
|
-
* stylesProcessor.setReducer( 'padding', getBoxSidesValueReducer( 'padding' ) );
|
|
65
|
-
* ```
|
|
66
|
-
*/
|
|
67
|
-
export declare function getBoxSidesValueReducer(styleShorthand: string): (value: StyleValue) => Array<PropertyDescriptor>;
|
|
68
|
-
/**
|
|
69
|
-
* Returns a [shorthand](https://developer.mozilla.org/en-US/docs/Web/CSS/Shorthand_properties) notation
|
|
70
|
-
* of a CSS property value.
|
|
71
|
-
*
|
|
72
|
-
* ```ts
|
|
73
|
-
* getBoxSidesShorthandValue( { top: '1px', right: '1px', bottom: '2px', left: '1px' } );
|
|
74
|
-
* // will return '1px 1px 2px'
|
|
75
|
-
* ```
|
|
76
|
-
*/
|
|
77
|
-
export declare function getBoxSidesShorthandValue({ top, right, bottom, left }: BoxSides): string;
|
|
78
|
-
/**
|
|
79
|
-
* Creates a normalizer for a [shorthand](https://developer.mozilla.org/en-US/docs/Web/CSS/Shorthand_properties) 1-to-4 value.
|
|
80
|
-
*
|
|
81
|
-
* ```ts
|
|
82
|
-
* stylesProcessor.setNormalizer( 'margin', getPositionShorthandNormalizer( 'margin' ) );
|
|
83
|
-
* ```
|
|
84
|
-
*/
|
|
85
|
-
export declare function getPositionShorthandNormalizer(shorthand: string): (value: string) => {
|
|
86
|
-
path: string;
|
|
87
|
-
value: BoxSides;
|
|
88
|
-
};
|
|
89
|
-
/**
|
|
90
|
-
* Parses parts of a 1-to-4 value notation - handles some CSS values with spaces (like RGB()).
|
|
91
|
-
*
|
|
92
|
-
* ```ts
|
|
93
|
-
* getShorthandValues( 'red blue RGB(0, 0, 0)');
|
|
94
|
-
* // will return [ 'red', 'blue', 'RGB(0, 0, 0)' ]
|
|
95
|
-
* ```
|
|
96
|
-
*/
|
|
97
|
-
export declare function getShorthandValues(string: string): Array<string>;
|