@ckeditor/ckeditor5-engine 44.1.0-alpha.5 → 44.2.0-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/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
|
@@ -1,93 +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
|
-
import type Document from '../document.js';
|
|
10
|
-
import type View from '../view.js';
|
|
11
|
-
declare const Observer_base: {
|
|
12
|
-
new (): import("@ckeditor/ckeditor5-utils").DomEmitter;
|
|
13
|
-
prototype: import("@ckeditor/ckeditor5-utils").DomEmitter;
|
|
14
|
-
};
|
|
15
|
-
/**
|
|
16
|
-
* Abstract base observer class. Observers are classes which listen to DOM events, do the preliminary
|
|
17
|
-
* processing and fire events on the {@link module:engine/view/document~Document} objects.
|
|
18
|
-
* Observers can also add features to the view, for instance by updating its status or marking elements
|
|
19
|
-
* which need a refresh on DOM events.
|
|
20
|
-
*/
|
|
21
|
-
export default abstract class Observer extends /* #__PURE__ */ Observer_base {
|
|
22
|
-
/**
|
|
23
|
-
* An instance of the view controller.
|
|
24
|
-
*/
|
|
25
|
-
readonly view: View;
|
|
26
|
-
/**
|
|
27
|
-
* A reference to the {@link module:engine/view/document~Document} object.
|
|
28
|
-
*/
|
|
29
|
-
readonly document: Document;
|
|
30
|
-
/**
|
|
31
|
-
* The state of the observer. If it is disabled, no events will be fired.
|
|
32
|
-
*/
|
|
33
|
-
private _isEnabled;
|
|
34
|
-
/**
|
|
35
|
-
* Creates an instance of the observer.
|
|
36
|
-
*/
|
|
37
|
-
constructor(view: View);
|
|
38
|
-
/**
|
|
39
|
-
* The state of the observer. If it is disabled, no events will be fired.
|
|
40
|
-
*/
|
|
41
|
-
get isEnabled(): boolean;
|
|
42
|
-
/**
|
|
43
|
-
* Enables the observer. This method is called when the observer is registered to the
|
|
44
|
-
* {@link module:engine/view/view~View} and after {@link module:engine/view/view~View#forceRender rendering}
|
|
45
|
-
* (all observers are {@link #disable disabled} before rendering).
|
|
46
|
-
*
|
|
47
|
-
* A typical use case for disabling observers is that mutation observers need to be disabled for the rendering.
|
|
48
|
-
* However, a child class may not need to be disabled, so it can implement an empty method.
|
|
49
|
-
*
|
|
50
|
-
* @see module:engine/view/observer/observer~Observer#disable
|
|
51
|
-
*/
|
|
52
|
-
enable(): void;
|
|
53
|
-
/**
|
|
54
|
-
* Disables the observer. This method is called before
|
|
55
|
-
* {@link module:engine/view/view~View#forceRender rendering} to prevent firing events during rendering.
|
|
56
|
-
*
|
|
57
|
-
* @see module:engine/view/observer/observer~Observer#enable
|
|
58
|
-
*/
|
|
59
|
-
disable(): void;
|
|
60
|
-
/**
|
|
61
|
-
* Disables and destroys the observer, among others removes event listeners created by the observer.
|
|
62
|
-
*/
|
|
63
|
-
destroy(): void;
|
|
64
|
-
/**
|
|
65
|
-
* Checks whether a given DOM event should be ignored (should not be turned into a synthetic view document event).
|
|
66
|
-
*
|
|
67
|
-
* Currently, an event will be ignored only if its target or any of its ancestors has the `data-cke-ignore-events` attribute.
|
|
68
|
-
* This attribute can be used inside the structures generated by
|
|
69
|
-
* {@link module:engine/view/downcastwriter~DowncastWriter#createUIElement `DowncastWriter#createUIElement()`} to ignore events
|
|
70
|
-
* fired within a UI that should be excluded from CKEditor 5's realms.
|
|
71
|
-
*
|
|
72
|
-
* @param domTarget The DOM event target to check (usually an element, sometimes a text node and
|
|
73
|
-
* potentially sometimes a document, too).
|
|
74
|
-
* @returns Whether this event should be ignored by the observer.
|
|
75
|
-
*/
|
|
76
|
-
checkShouldIgnoreEventFromTarget(domTarget: Node | null): boolean;
|
|
77
|
-
/**
|
|
78
|
-
* Starts observing given DOM element.
|
|
79
|
-
*
|
|
80
|
-
* @param domElement DOM element to observe.
|
|
81
|
-
* @param name The name of the related root element.
|
|
82
|
-
*/
|
|
83
|
-
abstract observe(domElement: HTMLElement, name: string): void;
|
|
84
|
-
/**
|
|
85
|
-
* Stops observing given DOM element.
|
|
86
|
-
*/
|
|
87
|
-
abstract stopObserving(domElement: HTMLElement): void;
|
|
88
|
-
}
|
|
89
|
-
/**
|
|
90
|
-
* The constructor of {@link ~Observer} subclass.
|
|
91
|
-
*/
|
|
92
|
-
export type ObserverConstructor = new (view: View) => Observer;
|
|
93
|
-
export {};
|
|
@@ -1,151 +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/observer/selectionobserver
|
|
11
|
-
*/
|
|
12
|
-
import Observer from './observer.js';
|
|
13
|
-
import MutationObserver from './mutationobserver.js';
|
|
14
|
-
import FocusObserver from './focusobserver.js';
|
|
15
|
-
import type View from '../view.js';
|
|
16
|
-
import type DocumentSelection from '../documentselection.js';
|
|
17
|
-
import type DomConverter from '../domconverter.js';
|
|
18
|
-
import type Selection from '../selection.js';
|
|
19
|
-
type DomSelection = globalThis.Selection;
|
|
20
|
-
/**
|
|
21
|
-
* Selection observer class observes selection changes in the document. If a selection changes on the document this
|
|
22
|
-
* observer checks if the DOM selection is different from the {@link module:engine/view/document~Document#selection view selection}.
|
|
23
|
-
* The selection observer fires {@link module:engine/view/document~Document#event:selectionChange} event only if
|
|
24
|
-
* a selection change was the only change in the document and the DOM selection is different from the view selection.
|
|
25
|
-
*
|
|
26
|
-
* This observer also manages the {@link module:engine/view/document~Document#isSelecting} property of the view document.
|
|
27
|
-
*
|
|
28
|
-
* Note that this observer is attached by the {@link module:engine/view/view~View} and is available by default.
|
|
29
|
-
*/
|
|
30
|
-
export default class SelectionObserver extends Observer {
|
|
31
|
-
/**
|
|
32
|
-
* Instance of the mutation observer. Selection observer calls
|
|
33
|
-
* {@link module:engine/view/observer/mutationobserver~MutationObserver#flush} to ensure that the mutations will be handled
|
|
34
|
-
* before the {@link module:engine/view/document~Document#event:selectionChange} event is fired.
|
|
35
|
-
*/
|
|
36
|
-
readonly mutationObserver: MutationObserver;
|
|
37
|
-
/**
|
|
38
|
-
* Instance of the focus observer. Focus observer calls
|
|
39
|
-
* {@link module:engine/view/observer/focusobserver~FocusObserver#flush} to mark the latest focus change as complete.
|
|
40
|
-
*/
|
|
41
|
-
readonly focusObserver: FocusObserver;
|
|
42
|
-
/**
|
|
43
|
-
* Reference to the view {@link module:engine/view/documentselection~DocumentSelection} object used to compare
|
|
44
|
-
* new selection with it.
|
|
45
|
-
*/
|
|
46
|
-
readonly selection: DocumentSelection;
|
|
47
|
-
/**
|
|
48
|
-
* Reference to the {@link module:engine/view/view~View#domConverter}.
|
|
49
|
-
*/
|
|
50
|
-
readonly domConverter: DomConverter;
|
|
51
|
-
/**
|
|
52
|
-
* A set of documents which have added `selectionchange` listener to avoid adding a listener twice to the same
|
|
53
|
-
* document.
|
|
54
|
-
*/
|
|
55
|
-
private readonly _documents;
|
|
56
|
-
/**
|
|
57
|
-
* Fires debounced event `selectionChangeDone`. It uses `lodash#debounce` method to delay function call.
|
|
58
|
-
*/
|
|
59
|
-
private readonly _fireSelectionChangeDoneDebounced;
|
|
60
|
-
/**
|
|
61
|
-
* When called, starts clearing the {@link #_loopbackCounter} counter in time intervals. When the number of selection
|
|
62
|
-
* changes exceeds a certain limit within the interval of time, the observer will not fire `selectionChange` but warn about
|
|
63
|
-
* possible infinite selection loop.
|
|
64
|
-
*/
|
|
65
|
-
private readonly _clearInfiniteLoopInterval;
|
|
66
|
-
/**
|
|
67
|
-
* Unlocks the `isSelecting` state of the view document in case the selection observer did not record this fact
|
|
68
|
-
* correctly (for whatever reason). It is a safeguard (paranoid check), that returns document to the normal state
|
|
69
|
-
* after a certain period of time (debounced, postponed by each selectionchange event).
|
|
70
|
-
*/
|
|
71
|
-
private readonly _documentIsSelectingInactivityTimeoutDebounced;
|
|
72
|
-
/**
|
|
73
|
-
* Private property to check if the code does not enter infinite loop.
|
|
74
|
-
*/
|
|
75
|
-
private _loopbackCounter;
|
|
76
|
-
constructor(view: View);
|
|
77
|
-
/**
|
|
78
|
-
* @inheritDoc
|
|
79
|
-
*/
|
|
80
|
-
observe(domElement: HTMLElement): void;
|
|
81
|
-
/**
|
|
82
|
-
* @inheritDoc
|
|
83
|
-
*/
|
|
84
|
-
stopObserving(domElement: HTMLElement): void;
|
|
85
|
-
/**
|
|
86
|
-
* @inheritDoc
|
|
87
|
-
*/
|
|
88
|
-
destroy(): void;
|
|
89
|
-
private _reportInfiniteLoop;
|
|
90
|
-
/**
|
|
91
|
-
* Selection change listener. {@link module:engine/view/observer/mutationobserver~MutationObserver#flush Flush} mutations, check if
|
|
92
|
-
* a selection changes and fires {@link module:engine/view/document~Document#event:selectionChange} event on every change
|
|
93
|
-
* and {@link module:engine/view/document~Document#event:selectionChangeDone} when a selection stop changing.
|
|
94
|
-
*
|
|
95
|
-
* @param domDocument DOM document.
|
|
96
|
-
*/
|
|
97
|
-
private _handleSelectionChange;
|
|
98
|
-
/**
|
|
99
|
-
* Clears `SelectionObserver` internal properties connected with preventing infinite loop.
|
|
100
|
-
*/
|
|
101
|
-
private _clearInfiniteLoop;
|
|
102
|
-
}
|
|
103
|
-
/**
|
|
104
|
-
* The value of {@link ~ViewDocumentSelectionChangeEvent} and {@link ~ViewDocumentSelectionChangeDoneEvent} events.
|
|
105
|
-
*/
|
|
106
|
-
export type ViewDocumentSelectionEventData = {
|
|
107
|
-
/**
|
|
108
|
-
* Old View selection which is {@link module:engine/view/document~Document#selection}.
|
|
109
|
-
*/
|
|
110
|
-
oldSelection: DocumentSelection;
|
|
111
|
-
/**
|
|
112
|
-
* New View selection which is converted DOM selection.
|
|
113
|
-
*/
|
|
114
|
-
newSelection: Selection;
|
|
115
|
-
/**
|
|
116
|
-
* Native DOM selection.
|
|
117
|
-
*/
|
|
118
|
-
domSelection: DomSelection | null;
|
|
119
|
-
};
|
|
120
|
-
/**
|
|
121
|
-
* Fired when a selection has changed. This event is fired only when the selection change was the only change that happened
|
|
122
|
-
* in the document, and the old selection is different then the new selection.
|
|
123
|
-
*
|
|
124
|
-
* Introduced by {@link module:engine/view/observer/selectionobserver~SelectionObserver}.
|
|
125
|
-
*
|
|
126
|
-
* Note that because {@link module:engine/view/observer/selectionobserver~SelectionObserver} is attached by the
|
|
127
|
-
* {@link module:engine/view/view~View} this event is available by default.
|
|
128
|
-
*
|
|
129
|
-
* @see module:engine/view/observer/selectionobserver~SelectionObserver
|
|
130
|
-
* @eventName module:engine/view/document~Document#selectionChange
|
|
131
|
-
*/
|
|
132
|
-
export type ViewDocumentSelectionChangeEvent = {
|
|
133
|
-
name: 'selectionChange';
|
|
134
|
-
args: [ViewDocumentSelectionEventData];
|
|
135
|
-
};
|
|
136
|
-
/**
|
|
137
|
-
* Fired when selection stops changing.
|
|
138
|
-
*
|
|
139
|
-
* Introduced by {@link module:engine/view/observer/selectionobserver~SelectionObserver}.
|
|
140
|
-
*
|
|
141
|
-
* Note that because {@link module:engine/view/observer/selectionobserver~SelectionObserver} is attached by the
|
|
142
|
-
* {@link module:engine/view/view~View} this event is available by default.
|
|
143
|
-
*
|
|
144
|
-
* @see module:engine/view/observer/selectionobserver~SelectionObserver
|
|
145
|
-
* @eventName module:engine/view/document~Document#selectionChangeDone
|
|
146
|
-
*/
|
|
147
|
-
export type ViewDocumentSelectionChangeDoneEvent = {
|
|
148
|
-
name: 'selectionChangeDone';
|
|
149
|
-
args: [ViewDocumentSelectionEventData];
|
|
150
|
-
};
|
|
151
|
-
export {};
|
|
@@ -1,50 +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/observer/tabobserver
|
|
11
|
-
*/
|
|
12
|
-
import type View from '../view.js';
|
|
13
|
-
import Observer from './observer.js';
|
|
14
|
-
import type { KeyEventData } from './keyobserver.js';
|
|
15
|
-
import type { BubblingEvent } from './bubblingemittermixin.js';
|
|
16
|
-
/**
|
|
17
|
-
* Tab observer introduces the {@link module:engine/view/document~Document#event:tab `Document#tab`} event.
|
|
18
|
-
*
|
|
19
|
-
* Note that because {@link module:engine/view/observer/tabobserver~TabObserver} is attached by the
|
|
20
|
-
* {@link module:engine/view/view~View}, this event is available by default.
|
|
21
|
-
*/
|
|
22
|
-
export default class TabObserver extends Observer {
|
|
23
|
-
/**
|
|
24
|
-
* @inheritDoc
|
|
25
|
-
*/
|
|
26
|
-
constructor(view: View);
|
|
27
|
-
/**
|
|
28
|
-
* @inheritDoc
|
|
29
|
-
*/
|
|
30
|
-
observe(): void;
|
|
31
|
-
/**
|
|
32
|
-
* @inheritDoc
|
|
33
|
-
*/
|
|
34
|
-
stopObserving(): void;
|
|
35
|
-
}
|
|
36
|
-
/**
|
|
37
|
-
* Event fired when the user presses a tab key.
|
|
38
|
-
*
|
|
39
|
-
* Introduced by {@link module:engine/view/observer/tabobserver~TabObserver}.
|
|
40
|
-
*
|
|
41
|
-
* Note that because {@link module:engine/view/observer/tabobserver~TabObserver} is attached by the
|
|
42
|
-
* {@link module:engine/view/view~View}, this event is available by default.
|
|
43
|
-
*
|
|
44
|
-
* @eventName module:engine/view/document~Document#tab
|
|
45
|
-
* @param data
|
|
46
|
-
*/
|
|
47
|
-
export type ViewDocumentTabEvent = BubblingEvent<{
|
|
48
|
-
name: 'tab';
|
|
49
|
-
args: [data: KeyEventData];
|
|
50
|
-
}>;
|
|
@@ -1,100 +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/placeholder
|
|
11
|
-
*/
|
|
12
|
-
import '../../theme/placeholder.css';
|
|
13
|
-
import type DowncastWriter from './downcastwriter.js';
|
|
14
|
-
import type EditableElement from './editableelement.js';
|
|
15
|
-
import type Element from './element.js';
|
|
16
|
-
import type View from './view.js';
|
|
17
|
-
/**
|
|
18
|
-
* A helper that enables a placeholder on the provided view element (also updates its visibility).
|
|
19
|
-
* The placeholder is a CSS pseudo–element (with a text content) attached to the element.
|
|
20
|
-
*
|
|
21
|
-
* To change the placeholder text, change value of the `placeholder` property in the provided `element`.
|
|
22
|
-
*
|
|
23
|
-
* To disable the placeholder, use {@link module:engine/view/placeholder~disablePlaceholder `disablePlaceholder()`} helper.
|
|
24
|
-
*
|
|
25
|
-
* @param options Configuration options of the placeholder.
|
|
26
|
-
* @param options.view Editing view instance.
|
|
27
|
-
* @param options.element Element that will gain a placeholder. See `options.isDirectHost` to learn more.
|
|
28
|
-
* @param options.isDirectHost If set `false`, the placeholder will not be enabled directly
|
|
29
|
-
* in the passed `element` but in one of its children (selected automatically, i.e. a first empty child element).
|
|
30
|
-
* Useful when attaching placeholders to elements that can host other elements (not just text), for instance,
|
|
31
|
-
* editable root elements.
|
|
32
|
-
* @param options.text Placeholder text. It's **deprecated** and will be removed soon. Use
|
|
33
|
-
* {@link module:engine/view/placeholder~PlaceholderableElement#placeholder `options.element.placeholder`} instead.
|
|
34
|
-
* @param options.keepOnFocus If set `true`, the placeholder stay visible when the host element is focused.
|
|
35
|
-
*/
|
|
36
|
-
export declare function enablePlaceholder({ view, element, text, isDirectHost, keepOnFocus }: {
|
|
37
|
-
view: View;
|
|
38
|
-
element: PlaceholderableElement | EditableElement;
|
|
39
|
-
isDirectHost?: boolean;
|
|
40
|
-
text?: string;
|
|
41
|
-
keepOnFocus?: boolean;
|
|
42
|
-
}): void;
|
|
43
|
-
/**
|
|
44
|
-
* Disables the placeholder functionality from a given element.
|
|
45
|
-
*
|
|
46
|
-
* See {@link module:engine/view/placeholder~enablePlaceholder `enablePlaceholder()`} to learn more.
|
|
47
|
-
*/
|
|
48
|
-
export declare function disablePlaceholder(view: View, element: Element): void;
|
|
49
|
-
/**
|
|
50
|
-
* Shows a placeholder in the provided element by changing related attributes and CSS classes.
|
|
51
|
-
*
|
|
52
|
-
* **Note**: This helper will not update the placeholder visibility nor manage the
|
|
53
|
-
* it in any way in the future. What it does is a one–time state change of an element. Use
|
|
54
|
-
* {@link module:engine/view/placeholder~enablePlaceholder `enablePlaceholder()`} and
|
|
55
|
-
* {@link module:engine/view/placeholder~disablePlaceholder `disablePlaceholder()`} for full
|
|
56
|
-
* placeholder functionality.
|
|
57
|
-
*
|
|
58
|
-
* **Note**: This helper will blindly show the placeholder directly in the root editable element if
|
|
59
|
-
* one is passed, which could result in a visual clash if the editable element has some children
|
|
60
|
-
* (for instance, an empty paragraph). Use {@link module:engine/view/placeholder~enablePlaceholder `enablePlaceholder()`}
|
|
61
|
-
* in that case or make sure the correct element is passed to the helper.
|
|
62
|
-
*
|
|
63
|
-
* @returns `true`, if any changes were made to the `element`.
|
|
64
|
-
*/
|
|
65
|
-
export declare function showPlaceholder(writer: DowncastWriter, element: Element): boolean;
|
|
66
|
-
/**
|
|
67
|
-
* Hides a placeholder in the element by changing related attributes and CSS classes.
|
|
68
|
-
*
|
|
69
|
-
* **Note**: This helper will not update the placeholder visibility nor manage the
|
|
70
|
-
* it in any way in the future. What it does is a one–time state change of an element. Use
|
|
71
|
-
* {@link module:engine/view/placeholder~enablePlaceholder `enablePlaceholder()`} and
|
|
72
|
-
* {@link module:engine/view/placeholder~disablePlaceholder `disablePlaceholder()`} for full
|
|
73
|
-
* placeholder functionality.
|
|
74
|
-
*
|
|
75
|
-
* @returns `true`, if any changes were made to the `element`.
|
|
76
|
-
*/
|
|
77
|
-
export declare function hidePlaceholder(writer: DowncastWriter, element: Element): boolean;
|
|
78
|
-
/**
|
|
79
|
-
* Checks if a placeholder should be displayed in the element.
|
|
80
|
-
*
|
|
81
|
-
* **Note**: This helper will blindly check the possibility of showing a placeholder directly in the
|
|
82
|
-
* root editable element if one is passed, which may not be the expected result. If an element can
|
|
83
|
-
* host other elements (not just text), most likely one of its children should be checked instead
|
|
84
|
-
* because it will be the final host for the placeholder. Use
|
|
85
|
-
* {@link module:engine/view/placeholder~enablePlaceholder `enablePlaceholder()`} in that case or make
|
|
86
|
-
* sure the correct element is passed to the helper.
|
|
87
|
-
*
|
|
88
|
-
* @param element Element that holds the placeholder.
|
|
89
|
-
* @param keepOnFocus Focusing the element will keep the placeholder visible.
|
|
90
|
-
*/
|
|
91
|
-
export declare function needsPlaceholder(element: Element, keepOnFocus: boolean): boolean;
|
|
92
|
-
/**
|
|
93
|
-
* Element that could have a placeholder.
|
|
94
|
-
*/
|
|
95
|
-
export interface PlaceholderableElement extends Element {
|
|
96
|
-
/**
|
|
97
|
-
* The text of element's placeholder.
|
|
98
|
-
*/
|
|
99
|
-
placeholder?: string;
|
|
100
|
-
}
|
package/dist/view/position.d.ts
DELETED
|
@@ -1,192 +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/position
|
|
11
|
-
*/
|
|
12
|
-
import TypeCheckable from './typecheckable.js';
|
|
13
|
-
import EditableElement from './editableelement.js';
|
|
14
|
-
import type DocumentFragment from './documentfragment.js';
|
|
15
|
-
import type Item from './item.js';
|
|
16
|
-
import type Node from './node.js';
|
|
17
|
-
import { default as TreeWalker, type TreeWalkerValue, type TreeWalkerOptions } from './treewalker.js';
|
|
18
|
-
/**
|
|
19
|
-
* Position in the view tree. Position is represented by its parent node and an offset in this parent.
|
|
20
|
-
*
|
|
21
|
-
* In order to create a new position instance use the `createPosition*()` factory methods available in:
|
|
22
|
-
*
|
|
23
|
-
* * {@link module:engine/view/view~View}
|
|
24
|
-
* * {@link module:engine/view/downcastwriter~DowncastWriter}
|
|
25
|
-
* * {@link module:engine/view/upcastwriter~UpcastWriter}
|
|
26
|
-
*/
|
|
27
|
-
export default class Position extends TypeCheckable {
|
|
28
|
-
/**
|
|
29
|
-
* Position parent.
|
|
30
|
-
*/
|
|
31
|
-
readonly parent: Node | DocumentFragment;
|
|
32
|
-
/**
|
|
33
|
-
* Position offset.
|
|
34
|
-
*/
|
|
35
|
-
offset: number;
|
|
36
|
-
/**
|
|
37
|
-
* Creates a position.
|
|
38
|
-
*
|
|
39
|
-
* @param parent Position parent.
|
|
40
|
-
* @param offset Position offset.
|
|
41
|
-
*/
|
|
42
|
-
constructor(parent: Node | DocumentFragment, offset: number);
|
|
43
|
-
/**
|
|
44
|
-
* Node directly after the position. Equals `null` when there is no node after position or position is located
|
|
45
|
-
* inside text node.
|
|
46
|
-
*/
|
|
47
|
-
get nodeAfter(): Node | null;
|
|
48
|
-
/**
|
|
49
|
-
* Node directly before the position. Equals `null` when there is no node before position or position is located
|
|
50
|
-
* inside text node.
|
|
51
|
-
*/
|
|
52
|
-
get nodeBefore(): Node | null;
|
|
53
|
-
/**
|
|
54
|
-
* Is `true` if position is at the beginning of its {@link module:engine/view/position~Position#parent parent}, `false` otherwise.
|
|
55
|
-
*/
|
|
56
|
-
get isAtStart(): boolean;
|
|
57
|
-
/**
|
|
58
|
-
* Is `true` if position is at the end of its {@link module:engine/view/position~Position#parent parent}, `false` otherwise.
|
|
59
|
-
*/
|
|
60
|
-
get isAtEnd(): boolean;
|
|
61
|
-
/**
|
|
62
|
-
* Position's root, that is the root of the position's parent element.
|
|
63
|
-
*/
|
|
64
|
-
get root(): Node | DocumentFragment;
|
|
65
|
-
/**
|
|
66
|
-
* {@link module:engine/view/editableelement~EditableElement EditableElement} instance that contains this position, or `null` if
|
|
67
|
-
* position is not inside an editable element.
|
|
68
|
-
*/
|
|
69
|
-
get editableElement(): EditableElement | null;
|
|
70
|
-
/**
|
|
71
|
-
* Returns a new instance of Position with offset incremented by `shift` value.
|
|
72
|
-
*
|
|
73
|
-
* @param shift How position offset should get changed. Accepts negative values.
|
|
74
|
-
* @returns Shifted position.
|
|
75
|
-
*/
|
|
76
|
-
getShiftedBy(shift: number): Position;
|
|
77
|
-
/**
|
|
78
|
-
* Gets the farthest position which matches the callback using
|
|
79
|
-
* {@link module:engine/view/treewalker~TreeWalker TreeWalker}.
|
|
80
|
-
*
|
|
81
|
-
* For example:
|
|
82
|
-
*
|
|
83
|
-
* ```ts
|
|
84
|
-
* getLastMatchingPosition( value => value.type == 'text' ); // <p>{}foo</p> -> <p>foo[]</p>
|
|
85
|
-
* getLastMatchingPosition( value => value.type == 'text', { direction: 'backward' } ); // <p>foo[]</p> -> <p>{}foo</p>
|
|
86
|
-
* getLastMatchingPosition( value => false ); // Do not move the position.
|
|
87
|
-
* ```
|
|
88
|
-
*
|
|
89
|
-
* @param skip Callback function. Gets {@link module:engine/view/treewalker~TreeWalkerValue} and should
|
|
90
|
-
* return `true` if the value should be skipped or `false` if not.
|
|
91
|
-
* @param options Object with configuration options. See {@link module:engine/view/treewalker~TreeWalker}.
|
|
92
|
-
* @returns The position after the last item which matches the `skip` callback test.
|
|
93
|
-
*/
|
|
94
|
-
getLastMatchingPosition(skip: (value: TreeWalkerValue) => boolean, options?: TreeWalkerOptions): Position;
|
|
95
|
-
/**
|
|
96
|
-
* Returns ancestors array of this position, that is this position's parent and it's ancestors.
|
|
97
|
-
*
|
|
98
|
-
* @returns Array with ancestors.
|
|
99
|
-
*/
|
|
100
|
-
getAncestors(): Array<Node | DocumentFragment>;
|
|
101
|
-
/**
|
|
102
|
-
* Returns a {@link module:engine/view/node~Node} or {@link module:engine/view/documentfragment~DocumentFragment}
|
|
103
|
-
* which is a common ancestor of both positions.
|
|
104
|
-
*/
|
|
105
|
-
getCommonAncestor(position: Position): Node | DocumentFragment | null;
|
|
106
|
-
/**
|
|
107
|
-
* Checks whether this position equals given position.
|
|
108
|
-
*
|
|
109
|
-
* @param otherPosition Position to compare with.
|
|
110
|
-
* @returns True if positions are same.
|
|
111
|
-
*/
|
|
112
|
-
isEqual(otherPosition: Position): boolean;
|
|
113
|
-
/**
|
|
114
|
-
* Checks whether this position is located before given position. When method returns `false` it does not mean that
|
|
115
|
-
* this position is after give one. Two positions may be located inside separate roots and in that situation this
|
|
116
|
-
* method will still return `false`.
|
|
117
|
-
*
|
|
118
|
-
* @see module:engine/view/position~Position#isAfter
|
|
119
|
-
* @see module:engine/view/position~Position#compareWith
|
|
120
|
-
* @param otherPosition Position to compare with.
|
|
121
|
-
* @returns Returns `true` if this position is before given position.
|
|
122
|
-
*/
|
|
123
|
-
isBefore(otherPosition: Position): boolean;
|
|
124
|
-
/**
|
|
125
|
-
* Checks whether this position is located after given position. When method returns `false` it does not mean that
|
|
126
|
-
* this position is before give one. Two positions may be located inside separate roots and in that situation this
|
|
127
|
-
* method will still return `false`.
|
|
128
|
-
*
|
|
129
|
-
* @see module:engine/view/position~Position#isBefore
|
|
130
|
-
* @see module:engine/view/position~Position#compareWith
|
|
131
|
-
* @param otherPosition Position to compare with.
|
|
132
|
-
* @returns Returns `true` if this position is after given position.
|
|
133
|
-
*/
|
|
134
|
-
isAfter(otherPosition: Position): boolean;
|
|
135
|
-
/**
|
|
136
|
-
* Checks whether this position is before, after or in same position that other position. Two positions may be also
|
|
137
|
-
* different when they are located in separate roots.
|
|
138
|
-
*
|
|
139
|
-
* @param otherPosition Position to compare with.
|
|
140
|
-
*/
|
|
141
|
-
compareWith(otherPosition: Position): PositionRelation;
|
|
142
|
-
/**
|
|
143
|
-
* Creates a {@link module:engine/view/treewalker~TreeWalker TreeWalker} instance with this positions as a start position.
|
|
144
|
-
*
|
|
145
|
-
* @param options Object with configuration options. See {@link module:engine/view/treewalker~TreeWalker}
|
|
146
|
-
*/
|
|
147
|
-
getWalker(options?: TreeWalkerOptions): TreeWalker;
|
|
148
|
-
/**
|
|
149
|
-
* Clones this position.
|
|
150
|
-
*/
|
|
151
|
-
clone(): Position;
|
|
152
|
-
/**
|
|
153
|
-
* Creates position at the given location. The location can be specified as:
|
|
154
|
-
*
|
|
155
|
-
* * a {@link module:engine/view/position~Position position},
|
|
156
|
-
* * parent element and offset (offset defaults to `0`),
|
|
157
|
-
* * parent element and `'end'` (sets position at the end of that element),
|
|
158
|
-
* * {@link module:engine/view/item~Item view item} and `'before'` or `'after'` (sets position before or after given view item).
|
|
159
|
-
*
|
|
160
|
-
* This method is a shortcut to other constructors such as:
|
|
161
|
-
*
|
|
162
|
-
* * {@link module:engine/view/position~Position._createBefore},
|
|
163
|
-
* * {@link module:engine/view/position~Position._createAfter}.
|
|
164
|
-
*
|
|
165
|
-
* @internal
|
|
166
|
-
* @param offset Offset or one of the flags. Used only when first parameter is a {@link module:engine/view/item~Item view item}.
|
|
167
|
-
*/
|
|
168
|
-
static _createAt(itemOrPosition: Item | Position, offset?: PositionOffset): Position;
|
|
169
|
-
/**
|
|
170
|
-
* Creates a new position after given view item.
|
|
171
|
-
*
|
|
172
|
-
* @internal
|
|
173
|
-
* @param item View item after which the position should be located.
|
|
174
|
-
*/
|
|
175
|
-
static _createAfter(item: Item): Position;
|
|
176
|
-
/**
|
|
177
|
-
* Creates a new position before given view item.
|
|
178
|
-
*
|
|
179
|
-
* @internal
|
|
180
|
-
* @param item View item before which the position should be located.
|
|
181
|
-
*/
|
|
182
|
-
static _createBefore(item: Item): Position;
|
|
183
|
-
}
|
|
184
|
-
/**
|
|
185
|
-
* A flag indicating whether this position is `'before'` or `'after'` or `'same'` as given position.
|
|
186
|
-
* If positions are in different roots `'different'` flag is returned.
|
|
187
|
-
*/
|
|
188
|
-
export type PositionRelation = 'before' | 'after' | 'same' | 'different';
|
|
189
|
-
/**
|
|
190
|
-
* Offset or one of the flags.
|
|
191
|
-
*/
|
|
192
|
-
export type PositionOffset = number | 'before' | 'after' | 'end';
|