@ckeditor/ckeditor5-engine 45.2.1 → 46.0.0-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +2563 -2257
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
- package/src/controller/datacontroller.d.ts +33 -32
- package/src/controller/datacontroller.js +29 -28
- package/src/controller/editingcontroller.d.ts +8 -8
- package/src/controller/editingcontroller.js +10 -10
- package/src/conversion/conversion.d.ts +18 -19
- package/src/conversion/conversion.js +4 -4
- package/src/conversion/conversionhelpers.d.ts +1 -1
- package/src/conversion/conversionhelpers.js +1 -1
- package/src/conversion/downcastdispatcher.d.ts +63 -69
- package/src/conversion/downcastdispatcher.js +16 -16
- package/src/conversion/downcasthelpers.d.ts +94 -83
- package/src/conversion/downcasthelpers.js +63 -53
- package/src/conversion/mapper.d.ts +27 -27
- package/src/conversion/mapper.js +15 -15
- package/src/conversion/modelconsumable.d.ts +26 -26
- package/src/conversion/modelconsumable.js +23 -23
- package/src/conversion/upcastdispatcher.d.ts +33 -32
- package/src/conversion/upcastdispatcher.js +19 -19
- package/src/conversion/upcasthelpers.d.ts +46 -38
- package/src/conversion/upcasthelpers.js +33 -24
- package/src/conversion/viewconsumable.d.ts +50 -45
- package/src/conversion/viewconsumable.js +32 -27
- package/src/dataprocessor/basichtmlwriter.d.ts +4 -2
- package/src/dataprocessor/basichtmlwriter.js +3 -1
- package/src/dataprocessor/dataprocessor.d.ts +7 -6
- package/src/dataprocessor/htmldataprocessor.d.ts +10 -10
- package/src/dataprocessor/htmldataprocessor.js +6 -6
- package/src/dataprocessor/htmlwriter.d.ts +1 -1
- package/src/dataprocessor/xmldataprocessor.d.ts +10 -10
- package/src/dataprocessor/xmldataprocessor.js +6 -6
- package/src/dev-utils/model.d.ts +25 -26
- package/src/dev-utils/model.js +35 -36
- package/src/dev-utils/operationreplayer.d.ts +5 -3
- package/src/dev-utils/operationreplayer.js +4 -2
- package/src/dev-utils/utils.d.ts +8 -0
- package/src/dev-utils/utils.js +8 -0
- package/src/dev-utils/view.d.ts +66 -63
- package/src/dev-utils/view.js +144 -134
- package/src/index.d.ts +135 -106
- package/src/index.js +120 -71
- package/src/legacyerrors.d.ts +5 -0
- package/src/legacyerrors.js +17 -0
- package/src/model/batch.d.ts +2 -15
- package/src/model/batch.js +1 -23
- package/src/model/differ.d.ts +54 -31
- package/src/model/differ.js +15 -15
- package/src/model/document.d.ts +31 -31
- package/src/model/document.js +13 -13
- package/src/model/documentfragment.d.ts +45 -45
- package/src/model/documentfragment.js +40 -40
- package/src/model/documentselection.d.ts +92 -92
- package/src/model/documentselection.js +71 -70
- package/src/model/element.d.ts +31 -31
- package/src/model/element.js +29 -29
- package/src/model/history.d.ts +3 -3
- package/src/model/history.js +2 -2
- package/src/model/item.d.ts +4 -5
- package/src/model/liveposition.d.ts +31 -31
- package/src/model/liveposition.js +18 -18
- package/src/model/liverange.d.ts +42 -38
- package/src/model/liverange.js +17 -16
- package/src/model/markercollection.d.ts +41 -40
- package/src/model/markercollection.js +22 -20
- package/src/model/model.d.ts +82 -81
- package/src/model/model.js +54 -54
- package/src/model/node.d.ts +48 -48
- package/src/model/node.js +31 -31
- package/src/model/nodelist.d.ts +17 -17
- package/src/model/nodelist.js +11 -11
- package/src/model/operation/attributeoperation.d.ts +10 -10
- package/src/model/operation/attributeoperation.js +7 -7
- package/src/model/operation/detachoperation.d.ts +11 -9
- package/src/model/operation/detachoperation.js +8 -6
- package/src/model/operation/insertoperation.d.ts +13 -13
- package/src/model/operation/insertoperation.js +15 -15
- package/src/model/operation/markeroperation.d.ts +12 -12
- package/src/model/operation/markeroperation.js +5 -5
- package/src/model/operation/mergeoperation.d.ts +16 -16
- package/src/model/operation/mergeoperation.js +18 -18
- package/src/model/operation/moveoperation.d.ts +16 -16
- package/src/model/operation/moveoperation.js +18 -15
- package/src/model/operation/nooperation.d.ts +4 -4
- package/src/model/operation/nooperation.js +2 -2
- package/src/model/operation/operation.d.ts +10 -10
- package/src/model/operation/operation.js +5 -5
- package/src/model/operation/operationfactory.d.ts +4 -4
- package/src/model/operation/operationfactory.js +12 -12
- package/src/model/operation/renameoperation.d.ts +10 -10
- package/src/model/operation/renameoperation.js +7 -7
- package/src/model/operation/rootattributeoperation.d.ts +12 -12
- package/src/model/operation/rootattributeoperation.js +8 -8
- package/src/model/operation/rootoperation.d.ts +8 -8
- package/src/model/operation/rootoperation.js +3 -3
- package/src/model/operation/splitoperation.d.ts +17 -17
- package/src/model/operation/splitoperation.js +19 -19
- package/src/model/operation/transform.d.ts +11 -8
- package/src/model/operation/transform.js +66 -49
- package/src/model/operation/utils.d.ts +24 -23
- package/src/model/operation/utils.js +20 -20
- package/src/model/position.d.ts +101 -97
- package/src/model/position.js +69 -64
- package/src/model/range.d.ts +90 -90
- package/src/model/range.js +87 -87
- package/src/model/rootelement.d.ts +11 -11
- package/src/model/rootelement.js +9 -9
- package/src/model/schema.d.ts +158 -154
- package/src/model/schema.js +93 -90
- package/src/model/selection.d.ts +73 -73
- package/src/model/selection.js +62 -62
- package/src/model/text.d.ts +11 -10
- package/src/model/text.js +11 -10
- package/src/model/textproxy.d.ts +39 -38
- package/src/model/textproxy.js +31 -30
- package/src/model/treewalker.d.ts +37 -37
- package/src/model/treewalker.js +14 -14
- package/src/model/typecheckable.d.ts +45 -45
- package/src/model/typecheckable.js +1 -1
- package/src/model/utils/autoparagraphing.d.ts +7 -7
- package/src/model/utils/deletecontent.d.ts +7 -5
- package/src/model/utils/deletecontent.js +13 -11
- package/src/model/utils/getselectedcontent.d.ts +6 -5
- package/src/model/utils/getselectedcontent.js +2 -1
- package/src/model/utils/insertcontent.d.ts +9 -8
- package/src/model/utils/insertcontent.js +41 -40
- package/src/model/utils/insertobject.d.ts +9 -9
- package/src/model/utils/insertobject.js +4 -4
- package/src/model/utils/modifyselection.d.ts +5 -4
- package/src/model/utils/modifyselection.js +12 -11
- package/src/model/utils/selection-post-fixer.d.ts +12 -8
- package/src/model/utils/selection-post-fixer.js +15 -11
- package/src/model/writer.d.ts +102 -101
- package/src/model/writer.js +99 -98
- package/src/view/attributeelement.d.ts +29 -29
- package/src/view/attributeelement.js +25 -25
- package/src/view/containerelement.d.ts +16 -15
- package/src/view/containerelement.js +15 -14
- package/src/view/datatransfer.d.ts +7 -7
- package/src/view/datatransfer.js +1 -1
- package/src/view/document.d.ts +25 -25
- package/src/view/document.js +15 -15
- package/src/view/documentfragment.d.ts +21 -21
- package/src/view/documentfragment.js +14 -14
- package/src/view/documentselection.d.ts +65 -63
- package/src/view/documentselection.js +27 -25
- package/src/view/domconverter.d.ts +94 -89
- package/src/view/domconverter.js +78 -73
- package/src/view/downcastwriter.d.ts +185 -181
- package/src/view/downcastwriter.js +222 -210
- package/src/view/editableelement.d.ts +13 -13
- package/src/view/editableelement.js +8 -8
- package/src/view/element.d.ts +75 -74
- package/src/view/element.js +58 -58
- package/src/view/elementdefinition.d.ts +3 -4
- package/src/view/emptyelement.d.ts +13 -13
- package/src/view/emptyelement.js +13 -13
- package/src/view/filler.d.ts +14 -3
- package/src/view/filler.js +12 -1
- package/src/view/item.d.ts +4 -5
- package/src/view/matcher.d.ts +22 -19
- package/src/view/matcher.js +6 -6
- package/src/view/node.d.ts +33 -33
- package/src/view/node.js +9 -9
- package/src/view/observer/arrowkeysobserver.d.ts +10 -10
- package/src/view/observer/arrowkeysobserver.js +5 -5
- package/src/view/observer/bubblingemittermixin.d.ts +5 -5
- package/src/view/observer/bubblingemittermixin.js +2 -9
- package/src/view/observer/bubblingeventinfo.d.ts +9 -9
- package/src/view/observer/bubblingeventinfo.js +1 -1
- package/src/view/observer/clickobserver.d.ts +8 -8
- package/src/view/observer/clickobserver.js +4 -4
- package/src/view/observer/compositionobserver.d.ts +19 -19
- package/src/view/observer/compositionobserver.js +6 -6
- package/src/view/observer/domeventdata.d.ts +9 -9
- package/src/view/observer/domeventdata.js +2 -2
- package/src/view/observer/domeventobserver.d.ts +3 -3
- package/src/view/observer/domeventobserver.js +5 -5
- package/src/view/observer/fakeselectionobserver.d.ts +9 -9
- package/src/view/observer/fakeselectionobserver.js +8 -8
- package/src/view/observer/focusobserver.d.ts +16 -16
- package/src/view/observer/focusobserver.js +7 -7
- package/src/view/observer/inputobserver.d.ts +18 -18
- package/src/view/observer/inputobserver.js +5 -5
- package/src/view/observer/keyobserver.d.ts +11 -11
- package/src/view/observer/keyobserver.js +3 -3
- package/src/view/observer/mouseobserver.d.ts +16 -16
- package/src/view/observer/mouseobserver.js +3 -3
- package/src/view/observer/mutationobserver.d.ts +21 -21
- package/src/view/observer/mutationobserver.js +7 -7
- package/src/view/observer/observer.d.ts +12 -12
- package/src/view/observer/observer.js +6 -6
- package/src/view/observer/selectionobserver.d.ts +33 -33
- package/src/view/observer/selectionobserver.js +14 -14
- package/src/view/observer/tabobserver.d.ts +10 -10
- package/src/view/observer/tabobserver.js +5 -5
- package/src/view/observer/touchobserver.d.ts +13 -13
- package/src/view/observer/touchobserver.js +3 -3
- package/src/view/placeholder.d.ts +21 -21
- package/src/view/placeholder.js +23 -23
- package/src/view/position.d.ts +49 -49
- package/src/view/position.js +42 -42
- package/src/view/range.d.ts +76 -74
- package/src/view/range.js +67 -65
- package/src/view/rawelement.d.ts +19 -19
- package/src/view/rawelement.js +16 -16
- package/src/view/renderer.d.ts +14 -14
- package/src/view/renderer.js +7 -7
- package/src/view/rooteditableelement.d.ts +8 -7
- package/src/view/rooteditableelement.js +7 -6
- package/src/view/selection.d.ts +66 -64
- package/src/view/selection.js +50 -48
- package/src/view/styles/background.d.ts +2 -2
- package/src/view/styles/background.js +9 -9
- package/src/view/styles/border.d.ts +2 -2
- package/src/view/styles/border.js +13 -13
- package/src/view/styles/margin.d.ts +2 -2
- package/src/view/styles/margin.js +5 -5
- package/src/view/styles/padding.d.ts +2 -2
- package/src/view/styles/padding.js +5 -5
- package/src/view/styles/utils.d.ts +24 -24
- package/src/view/styles/utils.js +25 -25
- package/src/view/stylesmap.d.ts +28 -32
- package/src/view/stylesmap.js +52 -39
- package/src/view/text.d.ts +11 -11
- package/src/view/text.js +10 -10
- package/src/view/textproxy.d.ts +33 -32
- package/src/view/textproxy.js +23 -22
- package/src/view/tokenlist.d.ts +14 -14
- package/src/view/tokenlist.js +10 -10
- package/src/view/treewalker.d.ts +42 -40
- package/src/view/treewalker.js +36 -35
- package/src/view/typecheckable.d.ts +76 -75
- package/src/view/typecheckable.js +1 -1
- package/src/view/uielement.d.ts +22 -21
- package/src/view/uielement.js +17 -16
- package/src/view/upcastwriter.d.ts +70 -70
- package/src/view/upcastwriter.js +42 -42
- package/src/view/view.d.ts +70 -69
- package/src/view/view.js +56 -55
package/src/view/matcher.d.ts
CHANGED
|
@@ -5,13 +5,13 @@
|
|
|
5
5
|
/**
|
|
6
6
|
* @module engine/view/matcher
|
|
7
7
|
*/
|
|
8
|
-
import type
|
|
8
|
+
import { type ViewElement } from './element.js';
|
|
9
9
|
import { type Consumables } from '../conversion/viewconsumable.js';
|
|
10
10
|
/**
|
|
11
11
|
* View matcher class.
|
|
12
|
-
* Instance of this class can be used to find {@link module:engine/view/element~
|
|
12
|
+
* Instance of this class can be used to find {@link module:engine/view/element~ViewElement elements} that match given pattern.
|
|
13
13
|
*/
|
|
14
|
-
export
|
|
14
|
+
export declare class Matcher {
|
|
15
15
|
private readonly _patterns;
|
|
16
16
|
/**
|
|
17
17
|
* Creates new instance of Matcher.
|
|
@@ -45,14 +45,14 @@ export default class Matcher {
|
|
|
45
45
|
*
|
|
46
46
|
* @param pattern Object describing pattern details. If string or regular expression
|
|
47
47
|
* is provided it will be used to match element's name. Pattern can be also provided in a form
|
|
48
|
-
* of a function - then this function will be called with each {@link module:engine/view/element~
|
|
48
|
+
* of a function - then this function will be called with each {@link module:engine/view/element~ViewElement element} as a parameter.
|
|
49
49
|
* Function's return value will be stored under `match` key of the object returned from
|
|
50
50
|
* {@link module:engine/view/matcher~Matcher#match match} or {@link module:engine/view/matcher~Matcher#matchAll matchAll} methods.
|
|
51
51
|
*/
|
|
52
52
|
add(...pattern: Array<MatcherPattern>): void;
|
|
53
53
|
/**
|
|
54
54
|
* Matches elements for currently stored patterns. Returns match information about first found
|
|
55
|
-
* {@link module:engine/view/element~
|
|
55
|
+
* {@link module:engine/view/element~ViewElement element}, otherwise returns `null`.
|
|
56
56
|
*
|
|
57
57
|
* Example of returned object:
|
|
58
58
|
*
|
|
@@ -82,10 +82,10 @@ export default class Matcher {
|
|
|
82
82
|
* @param element View element to match against stored patterns.
|
|
83
83
|
* @returns The match information about found element or `null`.
|
|
84
84
|
*/
|
|
85
|
-
match(...element: Array<
|
|
85
|
+
match(...element: Array<ViewElement>): MatchResult | null;
|
|
86
86
|
/**
|
|
87
87
|
* Matches elements for currently stored patterns. Returns array of match information with all found
|
|
88
|
-
* {@link module:engine/view/element~
|
|
88
|
+
* {@link module:engine/view/element~ViewElement elements}. If no element is found - returns `null`.
|
|
89
89
|
*
|
|
90
90
|
* @see module:engine/view/matcher~Matcher#add
|
|
91
91
|
* @see module:engine/view/matcher~Matcher#match
|
|
@@ -93,7 +93,7 @@ export default class Matcher {
|
|
|
93
93
|
* @returns Array with match information about found elements or `null`. For more information
|
|
94
94
|
* see {@link module:engine/view/matcher~Matcher#match match method} description.
|
|
95
95
|
*/
|
|
96
|
-
matchAll(...element: Array<
|
|
96
|
+
matchAll(...element: Array<ViewElement>): Array<MatchResult> | null;
|
|
97
97
|
/**
|
|
98
98
|
* Returns the name of the element to match if there is exactly one pattern added to the matcher instance
|
|
99
99
|
* and it matches element name defined by `string` (not `RegExp`). Otherwise, returns `null`.
|
|
@@ -102,7 +102,7 @@ export default class Matcher {
|
|
|
102
102
|
*/
|
|
103
103
|
getElementName(): string | null;
|
|
104
104
|
/**
|
|
105
|
-
* Returns match information if {@link module:engine/view/element~
|
|
105
|
+
* Returns match information if {@link module:engine/view/element~ViewElement element} is matching provided pattern.
|
|
106
106
|
* If element cannot be matched to provided pattern - returns `null`.
|
|
107
107
|
*
|
|
108
108
|
* @returns Returns object with match information or null if element is not matching.
|
|
@@ -365,14 +365,14 @@ export declare function isPatternMatched(pattern: true | string | RegExp, item:
|
|
|
365
365
|
* };
|
|
366
366
|
* ```
|
|
367
367
|
*
|
|
368
|
-
* `MatcherPattern` is defined in a way that it is a superset of {@link module:engine/view/elementdefinition~
|
|
368
|
+
* `MatcherPattern` is defined in a way that it is a superset of {@link module:engine/view/elementdefinition~ViewElementDefinition},
|
|
369
369
|
* that is, every `ElementDefinition` also can be used as a `MatcherPattern`.
|
|
370
370
|
*/
|
|
371
371
|
export type MatcherPattern = string | RegExp | MatcherFunctionPattern | MatcherObjectPattern;
|
|
372
372
|
/**
|
|
373
373
|
* A function describing `MatcherPattern`. See {@link ~MatcherPattern} for examples and other options.
|
|
374
374
|
*/
|
|
375
|
-
export type MatcherFunctionPattern = (element:
|
|
375
|
+
export type MatcherFunctionPattern = (element: ViewElement) => Match | Consumables | null;
|
|
376
376
|
/**
|
|
377
377
|
* An object describing `MatcherPattern`. See {@link ~MatcherPattern} for examples and other options.
|
|
378
378
|
*/
|
|
@@ -384,15 +384,15 @@ export interface MatcherObjectPattern {
|
|
|
384
384
|
/**
|
|
385
385
|
* View element's classes to match.
|
|
386
386
|
*/
|
|
387
|
-
classes?:
|
|
387
|
+
classes?: MatchClassPatterns;
|
|
388
388
|
/**
|
|
389
389
|
* View element's styles to match.
|
|
390
390
|
*/
|
|
391
|
-
styles?:
|
|
391
|
+
styles?: MatchStylePatterns;
|
|
392
392
|
/**
|
|
393
393
|
* View element's attributes to match.
|
|
394
394
|
*/
|
|
395
|
-
attributes?:
|
|
395
|
+
attributes?: MatchAttributePatterns;
|
|
396
396
|
}
|
|
397
397
|
/**
|
|
398
398
|
* An object representing matched element parts.
|
|
@@ -415,7 +415,7 @@ export interface MatchResult {
|
|
|
415
415
|
/**
|
|
416
416
|
* Matched view element.
|
|
417
417
|
*/
|
|
418
|
-
element:
|
|
418
|
+
element: ViewElement;
|
|
419
419
|
/**
|
|
420
420
|
* Pattern that was used to find matched element.
|
|
421
421
|
*/
|
|
@@ -425,13 +425,16 @@ export interface MatchResult {
|
|
|
425
425
|
*/
|
|
426
426
|
match: Match;
|
|
427
427
|
}
|
|
428
|
-
export type
|
|
428
|
+
export type MatchPropertyPatterns<ValuePattern = string | RegExp> = true | string | RegExp | Record<string, true | ValuePattern> | Array<string | RegExp | {
|
|
429
429
|
key: string | RegExp;
|
|
430
430
|
value: true | ValuePattern;
|
|
431
431
|
}>;
|
|
432
|
-
export type
|
|
433
|
-
export type
|
|
434
|
-
export type
|
|
432
|
+
export type MatchAttributePatterns = MatchPropertyPatterns;
|
|
433
|
+
export type MatchStylePatterns = MatchPropertyPatterns;
|
|
434
|
+
export type MatchClassPatterns = MatchPropertyPatterns<never>;
|
|
435
|
+
/**
|
|
436
|
+
* @internal
|
|
437
|
+
*/
|
|
435
438
|
export type NormalizedPropertyPattern = [
|
|
436
439
|
true | string | RegExp,
|
|
437
440
|
true | string | RegExp,
|
package/src/view/matcher.js
CHANGED
|
@@ -6,9 +6,9 @@ import { logWarning } from '@ckeditor/ckeditor5-utils';
|
|
|
6
6
|
import { normalizeConsumables } from '../conversion/viewconsumable.js';
|
|
7
7
|
/**
|
|
8
8
|
* View matcher class.
|
|
9
|
-
* Instance of this class can be used to find {@link module:engine/view/element~
|
|
9
|
+
* Instance of this class can be used to find {@link module:engine/view/element~ViewElement elements} that match given pattern.
|
|
10
10
|
*/
|
|
11
|
-
export
|
|
11
|
+
export class Matcher {
|
|
12
12
|
_patterns = [];
|
|
13
13
|
/**
|
|
14
14
|
* Creates new instance of Matcher.
|
|
@@ -44,7 +44,7 @@ export default class Matcher {
|
|
|
44
44
|
*
|
|
45
45
|
* @param pattern Object describing pattern details. If string or regular expression
|
|
46
46
|
* is provided it will be used to match element's name. Pattern can be also provided in a form
|
|
47
|
-
* of a function - then this function will be called with each {@link module:engine/view/element~
|
|
47
|
+
* of a function - then this function will be called with each {@link module:engine/view/element~ViewElement element} as a parameter.
|
|
48
48
|
* Function's return value will be stored under `match` key of the object returned from
|
|
49
49
|
* {@link module:engine/view/matcher~Matcher#match match} or {@link module:engine/view/matcher~Matcher#matchAll matchAll} methods.
|
|
50
50
|
*/
|
|
@@ -59,7 +59,7 @@ export default class Matcher {
|
|
|
59
59
|
}
|
|
60
60
|
/**
|
|
61
61
|
* Matches elements for currently stored patterns. Returns match information about first found
|
|
62
|
-
* {@link module:engine/view/element~
|
|
62
|
+
* {@link module:engine/view/element~ViewElement element}, otherwise returns `null`.
|
|
63
63
|
*
|
|
64
64
|
* Example of returned object:
|
|
65
65
|
*
|
|
@@ -106,7 +106,7 @@ export default class Matcher {
|
|
|
106
106
|
}
|
|
107
107
|
/**
|
|
108
108
|
* Matches elements for currently stored patterns. Returns array of match information with all found
|
|
109
|
-
* {@link module:engine/view/element~
|
|
109
|
+
* {@link module:engine/view/element~ViewElement elements}. If no element is found - returns `null`.
|
|
110
110
|
*
|
|
111
111
|
* @see module:engine/view/matcher~Matcher#add
|
|
112
112
|
* @see module:engine/view/matcher~Matcher#match
|
|
@@ -145,7 +145,7 @@ export default class Matcher {
|
|
|
145
145
|
return (typeof pattern != 'function' && name && !(name instanceof RegExp)) ? name : null;
|
|
146
146
|
}
|
|
147
147
|
/**
|
|
148
|
-
* Returns match information if {@link module:engine/view/element~
|
|
148
|
+
* Returns match information if {@link module:engine/view/element~ViewElement element} is matching provided pattern.
|
|
149
149
|
* If element cannot be matched to provided pattern - returns `null`.
|
|
150
150
|
*
|
|
151
151
|
* @returns Returns object with match information or null if element is not matching.
|
package/src/view/node.d.ts
CHANGED
|
@@ -5,33 +5,33 @@
|
|
|
5
5
|
/**
|
|
6
6
|
* @module engine/view/node
|
|
7
7
|
*/
|
|
8
|
-
import
|
|
9
|
-
import type {
|
|
10
|
-
import type
|
|
11
|
-
import type
|
|
12
|
-
declare const
|
|
8
|
+
import { ViewTypeCheckable } from './typecheckable.js';
|
|
9
|
+
import type { ViewDocument, ViewDocumentChangeType } from './document.js';
|
|
10
|
+
import { type ViewDocumentFragment } from './documentfragment.js';
|
|
11
|
+
import { type ViewElement } from './element.js';
|
|
12
|
+
declare const ViewNode_base: import("@ckeditor/ckeditor5-utils").Mixed<typeof ViewTypeCheckable, import("@ckeditor/ckeditor5-utils").Emitter>;
|
|
13
13
|
/**
|
|
14
14
|
* Abstract view node class.
|
|
15
15
|
*
|
|
16
16
|
* This is an abstract class. Its constructor should not be used directly.
|
|
17
|
-
* Use the {@link module:engine/view/downcastwriter~
|
|
17
|
+
* Use the {@link module:engine/view/downcastwriter~ViewDowncastWriter} or {@link module:engine/view/upcastwriter~ViewUpcastWriter}
|
|
18
18
|
* to create new instances of view nodes.
|
|
19
19
|
*/
|
|
20
|
-
export
|
|
20
|
+
export declare abstract class ViewNode extends /* #__PURE__ */ ViewNode_base {
|
|
21
21
|
/**
|
|
22
22
|
* The document instance to which this node belongs.
|
|
23
23
|
*/
|
|
24
|
-
readonly document:
|
|
24
|
+
readonly document: ViewDocument;
|
|
25
25
|
/**
|
|
26
|
-
* Parent element. Null by default. Set by {@link module:engine/view/element~
|
|
26
|
+
* Parent element. Null by default. Set by {@link module:engine/view/element~ViewElement#_insertChild}.
|
|
27
27
|
*/
|
|
28
|
-
readonly parent:
|
|
28
|
+
readonly parent: ViewElement | ViewDocumentFragment | null;
|
|
29
29
|
/**
|
|
30
30
|
* Creates a tree view node.
|
|
31
31
|
*
|
|
32
32
|
* @param document The document instance to which this node belongs.
|
|
33
33
|
*/
|
|
34
|
-
protected constructor(document:
|
|
34
|
+
protected constructor(document: ViewDocument);
|
|
35
35
|
/**
|
|
36
36
|
* Index of the node in the parent element or null if the node has no parent.
|
|
37
37
|
*
|
|
@@ -42,22 +42,22 @@ export default abstract class Node extends /* #__PURE__ */ Node_base {
|
|
|
42
42
|
/**
|
|
43
43
|
* Node's next sibling, or `null` if it is the last child.
|
|
44
44
|
*/
|
|
45
|
-
get nextSibling():
|
|
45
|
+
get nextSibling(): ViewNode | null;
|
|
46
46
|
/**
|
|
47
47
|
* Node's previous sibling, or `null` if it is the first child.
|
|
48
48
|
*/
|
|
49
|
-
get previousSibling():
|
|
49
|
+
get previousSibling(): ViewNode | null;
|
|
50
50
|
/**
|
|
51
51
|
* Top-most ancestor of the node. If the node has no parent it is the root itself.
|
|
52
52
|
*/
|
|
53
|
-
get root():
|
|
53
|
+
get root(): ViewElement | ViewDocumentFragment;
|
|
54
54
|
/**
|
|
55
55
|
* Returns true if the node is in a tree rooted in the document (is a descendant of one of its roots).
|
|
56
56
|
*/
|
|
57
57
|
isAttached(): boolean;
|
|
58
58
|
/**
|
|
59
59
|
* Gets a path to the node. The path is an array containing indices of consecutive ancestors of this node,
|
|
60
|
-
* beginning from {@link module:engine/view/node~
|
|
60
|
+
* beginning from {@link module:engine/view/node~ViewNode#root root}, down to this node's index.
|
|
61
61
|
*
|
|
62
62
|
* ```ts
|
|
63
63
|
* const abc = downcastWriter.createText( 'abc' );
|
|
@@ -85,9 +85,9 @@ export default abstract class Node extends /* #__PURE__ */ Node_base {
|
|
|
85
85
|
getAncestors(options?: {
|
|
86
86
|
includeSelf?: boolean;
|
|
87
87
|
parentFirst?: boolean;
|
|
88
|
-
}): Array<
|
|
88
|
+
}): Array<ViewNode | ViewDocumentFragment>;
|
|
89
89
|
/**
|
|
90
|
-
* Returns a {@link module:engine/view/element~
|
|
90
|
+
* Returns a {@link module:engine/view/element~ViewElement} or {@link module:engine/view/documentfragment~ViewDocumentFragment}
|
|
91
91
|
* which is a common ancestor of both nodes.
|
|
92
92
|
*
|
|
93
93
|
* @param node The second node.
|
|
@@ -95,23 +95,23 @@ export default abstract class Node extends /* #__PURE__ */ Node_base {
|
|
|
95
95
|
* @param options.includeSelf When set to `true` both nodes will be considered "ancestors" too.
|
|
96
96
|
* Which means that if e.g. node A is inside B, then their common ancestor will be B.
|
|
97
97
|
*/
|
|
98
|
-
getCommonAncestor(node:
|
|
98
|
+
getCommonAncestor(node: ViewNode, options?: {
|
|
99
99
|
includeSelf?: boolean;
|
|
100
|
-
}):
|
|
100
|
+
}): ViewElement | ViewDocumentFragment | null;
|
|
101
101
|
/**
|
|
102
102
|
* Returns whether this node is before given node. `false` is returned if nodes are in different trees (for example,
|
|
103
|
-
* in different {@link module:engine/view/documentfragment~
|
|
103
|
+
* in different {@link module:engine/view/documentfragment~ViewDocumentFragment}s).
|
|
104
104
|
*
|
|
105
105
|
* @param node Node to compare with.
|
|
106
106
|
*/
|
|
107
|
-
isBefore(node:
|
|
107
|
+
isBefore(node: ViewNode): boolean;
|
|
108
108
|
/**
|
|
109
109
|
* Returns whether this node is after given node. `false` is returned if nodes are in different trees (for example,
|
|
110
|
-
* in different {@link module:engine/view/documentfragment~
|
|
110
|
+
* in different {@link module:engine/view/documentfragment~ViewDocumentFragment}s).
|
|
111
111
|
*
|
|
112
112
|
* @param node Node to compare with.
|
|
113
113
|
*/
|
|
114
|
-
isAfter(node:
|
|
114
|
+
isAfter(node: ViewNode): boolean;
|
|
115
115
|
/**
|
|
116
116
|
* Removes node from parent.
|
|
117
117
|
*
|
|
@@ -125,7 +125,7 @@ export default abstract class Node extends /* #__PURE__ */ Node_base {
|
|
|
125
125
|
* @param data Additional data.
|
|
126
126
|
* @fires change
|
|
127
127
|
*/
|
|
128
|
-
_fireChange(type:
|
|
128
|
+
_fireChange(type: ViewDocumentChangeType, node: ViewNode, data?: {
|
|
129
129
|
index: number;
|
|
130
130
|
}): void;
|
|
131
131
|
/**
|
|
@@ -140,16 +140,16 @@ export default abstract class Node extends /* #__PURE__ */ Node_base {
|
|
|
140
140
|
* @internal
|
|
141
141
|
* @returns Clone of this node.
|
|
142
142
|
*/
|
|
143
|
-
abstract _clone(deep?: boolean):
|
|
143
|
+
abstract _clone(deep?: boolean): ViewNode;
|
|
144
144
|
/**
|
|
145
145
|
* Checks if provided node is similar to this node.
|
|
146
146
|
*
|
|
147
147
|
* @returns True if nodes are similar.
|
|
148
148
|
*/
|
|
149
|
-
abstract isSimilar(other:
|
|
149
|
+
abstract isSimilar(other: ViewNode): boolean;
|
|
150
150
|
}
|
|
151
151
|
/**
|
|
152
|
-
* Fired when list of {@link module:engine/view/element~
|
|
152
|
+
* Fired when list of {@link module:engine/view/element~ViewElement elements} children, attributes or text changes.
|
|
153
153
|
*
|
|
154
154
|
* Change event is bubbled – it is fired on all ancestors.
|
|
155
155
|
*
|
|
@@ -157,14 +157,14 @@ export default abstract class Node extends /* #__PURE__ */ Node_base {
|
|
|
157
157
|
*
|
|
158
158
|
* If `change:children` event is fired, there is an additional second parameter, which is an object with additional data related to change.
|
|
159
159
|
*
|
|
160
|
-
* @eventName ~
|
|
161
|
-
* @eventName ~
|
|
162
|
-
* @eventName ~
|
|
163
|
-
* @eventName ~
|
|
160
|
+
* @eventName ~ViewNode#change
|
|
161
|
+
* @eventName ~ViewNode#change:children
|
|
162
|
+
* @eventName ~ViewNode#change:attributes
|
|
163
|
+
* @eventName ~ViewNode#change:text
|
|
164
164
|
*/
|
|
165
165
|
export type ViewNodeChangeEvent = {
|
|
166
|
-
name: 'change' | `change:${
|
|
167
|
-
args: [changedNode:
|
|
166
|
+
name: 'change' | `change:${ViewDocumentChangeType}`;
|
|
167
|
+
args: [changedNode: ViewNode, data?: {
|
|
168
168
|
index: number;
|
|
169
169
|
}];
|
|
170
170
|
};
|
package/src/view/node.js
CHANGED
|
@@ -5,23 +5,23 @@
|
|
|
5
5
|
/**
|
|
6
6
|
* @module engine/view/node
|
|
7
7
|
*/
|
|
8
|
-
import
|
|
8
|
+
import { ViewTypeCheckable } from './typecheckable.js';
|
|
9
9
|
import { CKEditorError, EmitterMixin, compareArrays } from '@ckeditor/ckeditor5-utils';
|
|
10
10
|
import { clone } from 'es-toolkit/compat';
|
|
11
11
|
/**
|
|
12
12
|
* Abstract view node class.
|
|
13
13
|
*
|
|
14
14
|
* This is an abstract class. Its constructor should not be used directly.
|
|
15
|
-
* Use the {@link module:engine/view/downcastwriter~
|
|
15
|
+
* Use the {@link module:engine/view/downcastwriter~ViewDowncastWriter} or {@link module:engine/view/upcastwriter~ViewUpcastWriter}
|
|
16
16
|
* to create new instances of view nodes.
|
|
17
17
|
*/
|
|
18
|
-
export
|
|
18
|
+
export class ViewNode extends /* #__PURE__ */ EmitterMixin(ViewTypeCheckable) {
|
|
19
19
|
/**
|
|
20
20
|
* The document instance to which this node belongs.
|
|
21
21
|
*/
|
|
22
22
|
document;
|
|
23
23
|
/**
|
|
24
|
-
* Parent element. Null by default. Set by {@link module:engine/view/element~
|
|
24
|
+
* Parent element. Null by default. Set by {@link module:engine/view/element~ViewElement#_insertChild}.
|
|
25
25
|
*/
|
|
26
26
|
parent;
|
|
27
27
|
/**
|
|
@@ -89,7 +89,7 @@ export default class Node extends /* #__PURE__ */ EmitterMixin(TypeCheckable) {
|
|
|
89
89
|
}
|
|
90
90
|
/**
|
|
91
91
|
* Gets a path to the node. The path is an array containing indices of consecutive ancestors of this node,
|
|
92
|
-
* beginning from {@link module:engine/view/node~
|
|
92
|
+
* beginning from {@link module:engine/view/node~ViewNode#root root}, down to this node's index.
|
|
93
93
|
*
|
|
94
94
|
* ```ts
|
|
95
95
|
* const abc = downcastWriter.createText( 'abc' );
|
|
@@ -133,7 +133,7 @@ export default class Node extends /* #__PURE__ */ EmitterMixin(TypeCheckable) {
|
|
|
133
133
|
return ancestors;
|
|
134
134
|
}
|
|
135
135
|
/**
|
|
136
|
-
* Returns a {@link module:engine/view/element~
|
|
136
|
+
* Returns a {@link module:engine/view/element~ViewElement} or {@link module:engine/view/documentfragment~ViewDocumentFragment}
|
|
137
137
|
* which is a common ancestor of both nodes.
|
|
138
138
|
*
|
|
139
139
|
* @param node The second node.
|
|
@@ -152,7 +152,7 @@ export default class Node extends /* #__PURE__ */ EmitterMixin(TypeCheckable) {
|
|
|
152
152
|
}
|
|
153
153
|
/**
|
|
154
154
|
* Returns whether this node is before given node. `false` is returned if nodes are in different trees (for example,
|
|
155
|
-
* in different {@link module:engine/view/documentfragment~
|
|
155
|
+
* in different {@link module:engine/view/documentfragment~ViewDocumentFragment}s).
|
|
156
156
|
*
|
|
157
157
|
* @param node Node to compare with.
|
|
158
158
|
*/
|
|
@@ -179,7 +179,7 @@ export default class Node extends /* #__PURE__ */ EmitterMixin(TypeCheckable) {
|
|
|
179
179
|
}
|
|
180
180
|
/**
|
|
181
181
|
* Returns whether this node is after given node. `false` is returned if nodes are in different trees (for example,
|
|
182
|
-
* in different {@link module:engine/view/documentfragment~
|
|
182
|
+
* in different {@link module:engine/view/documentfragment~ViewDocumentFragment}s).
|
|
183
183
|
*
|
|
184
184
|
* @param node Node to compare with.
|
|
185
185
|
*/
|
|
@@ -230,6 +230,6 @@ export default class Node extends /* #__PURE__ */ EmitterMixin(TypeCheckable) {
|
|
|
230
230
|
}
|
|
231
231
|
// The magic of type inference using `is` method is centralized in `TypeCheckable` class.
|
|
232
232
|
// Proper overload would interfere with that.
|
|
233
|
-
|
|
233
|
+
ViewNode.prototype.is = function (type) {
|
|
234
234
|
return type === 'node' || type === 'view:node';
|
|
235
235
|
};
|
|
@@ -5,20 +5,20 @@
|
|
|
5
5
|
/**
|
|
6
6
|
* @module engine/view/observer/arrowkeysobserver
|
|
7
7
|
*/
|
|
8
|
-
import Observer from './observer.js';
|
|
9
|
-
import type
|
|
10
|
-
import type {
|
|
8
|
+
import { Observer } from './observer.js';
|
|
9
|
+
import { type EditingView } from '../view.js';
|
|
10
|
+
import type { ViewDocumentKeyEventData } from './keyobserver.js';
|
|
11
11
|
import type { BubblingEvent } from './bubblingemittermixin.js';
|
|
12
12
|
/**
|
|
13
|
-
* Arrow keys observer introduces the {@link module:engine/view/document~
|
|
13
|
+
* Arrow keys observer introduces the {@link module:engine/view/document~ViewDocument#event:arrowKey `Document#arrowKey`} event.
|
|
14
14
|
*
|
|
15
|
-
* Note that this observer is attached by the {@link module:engine/view/view~
|
|
15
|
+
* Note that this observer is attached by the {@link module:engine/view/view~EditingView} and is available by default.
|
|
16
16
|
*/
|
|
17
|
-
export
|
|
17
|
+
export declare class ArrowKeysObserver extends Observer {
|
|
18
18
|
/**
|
|
19
19
|
* @inheritDoc
|
|
20
20
|
*/
|
|
21
|
-
constructor(view:
|
|
21
|
+
constructor(view: EditingView);
|
|
22
22
|
/**
|
|
23
23
|
* @inheritDoc
|
|
24
24
|
*/
|
|
@@ -34,12 +34,12 @@ export default class ArrowKeysObserver extends Observer {
|
|
|
34
34
|
* Introduced by {@link module:engine/view/observer/arrowkeysobserver~ArrowKeysObserver}.
|
|
35
35
|
*
|
|
36
36
|
* Note that because {@link module:engine/view/observer/arrowkeysobserver~ArrowKeysObserver} is attached by the
|
|
37
|
-
* {@link module:engine/view/view~
|
|
37
|
+
* {@link module:engine/view/view~EditingView} this event is available by default.
|
|
38
38
|
*
|
|
39
|
-
* @eventName module:engine/view/document~
|
|
39
|
+
* @eventName module:engine/view/document~ViewDocument#arrowKey
|
|
40
40
|
* @param data
|
|
41
41
|
*/
|
|
42
42
|
export type ViewDocumentArrowKeyEvent = BubblingEvent<{
|
|
43
43
|
name: 'arrowKey';
|
|
44
|
-
args: [data:
|
|
44
|
+
args: [data: ViewDocumentKeyEventData];
|
|
45
45
|
}>;
|
|
@@ -5,15 +5,15 @@
|
|
|
5
5
|
/**
|
|
6
6
|
* @module engine/view/observer/arrowkeysobserver
|
|
7
7
|
*/
|
|
8
|
-
import Observer from './observer.js';
|
|
9
|
-
import BubblingEventInfo from './bubblingeventinfo.js';
|
|
8
|
+
import { Observer } from './observer.js';
|
|
9
|
+
import { BubblingEventInfo } from './bubblingeventinfo.js';
|
|
10
10
|
import { isArrowKeyCode } from '@ckeditor/ckeditor5-utils';
|
|
11
11
|
/**
|
|
12
|
-
* Arrow keys observer introduces the {@link module:engine/view/document~
|
|
12
|
+
* Arrow keys observer introduces the {@link module:engine/view/document~ViewDocument#event:arrowKey `Document#arrowKey`} event.
|
|
13
13
|
*
|
|
14
|
-
* Note that this observer is attached by the {@link module:engine/view/view~
|
|
14
|
+
* Note that this observer is attached by the {@link module:engine/view/view~EditingView} and is available by default.
|
|
15
15
|
*/
|
|
16
|
-
export
|
|
16
|
+
export class ArrowKeysObserver extends Observer {
|
|
17
17
|
/**
|
|
18
18
|
* @inheritDoc
|
|
19
19
|
*/
|
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
* @module engine/view/observer/bubblingemittermixin
|
|
7
7
|
*/
|
|
8
8
|
import { type ArrayOrItem, type Emitter, type BaseEvent, type CallbackOptions, type Constructor, type Mixed } from '@ckeditor/ckeditor5-utils';
|
|
9
|
-
import BubblingEventInfo from './bubblingeventinfo.js';
|
|
10
|
-
import type
|
|
9
|
+
import { BubblingEventInfo } from './bubblingeventinfo.js';
|
|
10
|
+
import { type ViewNode } from '../node.js';
|
|
11
11
|
/**
|
|
12
12
|
* Bubbling emitter mixin for the view document as described in the {@link ~BubblingEmitter} interface.
|
|
13
13
|
*
|
|
@@ -24,11 +24,11 @@ import type Node from '../node.js';
|
|
|
24
24
|
* }
|
|
25
25
|
* ```
|
|
26
26
|
*/
|
|
27
|
-
export
|
|
27
|
+
export declare function BubblingEmitterMixin<Base extends Constructor<Emitter>>(base: Base): Mixed<Base, BubblingEmitter>;
|
|
28
28
|
/**
|
|
29
29
|
* Bubbling emitter for the view document.
|
|
30
30
|
*
|
|
31
|
-
* Bubbling emitter is triggering events in the context of specified {@link module:engine/view/element~
|
|
31
|
+
* Bubbling emitter is triggering events in the context of specified {@link module:engine/view/element~ViewElement view element} name,
|
|
32
32
|
* predefined `'$text'`, `'$root'`, `'$document'` and `'$capture'` contexts, and context matchers provided as a function.
|
|
33
33
|
*
|
|
34
34
|
* Before bubbling starts, listeners for `'$capture'` context are triggered. Then the bubbling starts from the deeper selection
|
|
@@ -137,7 +137,7 @@ export type BubblingEmitter = Emitter;
|
|
|
137
137
|
*
|
|
138
138
|
* Should return true for nodes that that match the custom context.
|
|
139
139
|
*/
|
|
140
|
-
export type BubblingEventContextFunction = (node:
|
|
140
|
+
export type BubblingEventContextFunction = (node: ViewNode) => boolean;
|
|
141
141
|
/**
|
|
142
142
|
* Helper type that allows describing bubbling event. Extends `TEvent` so that:
|
|
143
143
|
*
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* @module engine/view/observer/bubblingemittermixin
|
|
7
7
|
*/
|
|
8
8
|
import { CKEditorError, EmitterMixin, EventInfo, toArray } from '@ckeditor/ckeditor5-utils';
|
|
9
|
-
import BubblingEventInfo from './bubblingeventinfo.js';
|
|
9
|
+
import { BubblingEventInfo } from './bubblingeventinfo.js';
|
|
10
10
|
const contextsSymbol = Symbol('bubbling contexts');
|
|
11
11
|
/**
|
|
12
12
|
* Bubbling emitter mixin for the view document as described in the {@link ~BubblingEmitter} interface.
|
|
@@ -24,7 +24,7 @@ const contextsSymbol = Symbol('bubbling contexts');
|
|
|
24
24
|
* }
|
|
25
25
|
* ```
|
|
26
26
|
*/
|
|
27
|
-
export
|
|
27
|
+
export function BubblingEmitterMixin(base) {
|
|
28
28
|
class Mixin extends base {
|
|
29
29
|
fire(eventOrInfo, ...eventArgs) {
|
|
30
30
|
try {
|
|
@@ -102,13 +102,6 @@ export default function BubblingEmitterMixin(base) {
|
|
|
102
102
|
}
|
|
103
103
|
return Mixin;
|
|
104
104
|
}
|
|
105
|
-
// Backward compatibility with `mix`.
|
|
106
|
-
{
|
|
107
|
-
const mixin = BubblingEmitterMixin(Object);
|
|
108
|
-
['fire', '_addEventListener', '_removeEventListener'].forEach(key => {
|
|
109
|
-
BubblingEmitterMixin[key] = mixin.prototype[key];
|
|
110
|
-
});
|
|
111
|
-
}
|
|
112
105
|
/**
|
|
113
106
|
* Update the event info bubbling fields.
|
|
114
107
|
*
|
|
@@ -6,18 +6,18 @@
|
|
|
6
6
|
* @module engine/view/observer/bubblingeventinfo
|
|
7
7
|
*/
|
|
8
8
|
import { EventInfo } from '@ckeditor/ckeditor5-utils';
|
|
9
|
-
import type
|
|
10
|
-
import type
|
|
11
|
-
import type
|
|
9
|
+
import { type ViewDocument } from '../document.js';
|
|
10
|
+
import { type ViewNode } from '../node.js';
|
|
11
|
+
import { type ViewRange } from '../range.js';
|
|
12
12
|
/**
|
|
13
13
|
* The event object passed to bubbling event callbacks. It is used to provide information about the event as well as a tool to
|
|
14
14
|
* manipulate it.
|
|
15
15
|
*/
|
|
16
|
-
export
|
|
16
|
+
export declare class BubblingEventInfo<TName extends string = string, TReturn = unknown> extends EventInfo<TName, TReturn> {
|
|
17
17
|
/**
|
|
18
18
|
* The view range that the bubbling should start from.
|
|
19
19
|
*/
|
|
20
|
-
readonly startRange:
|
|
20
|
+
readonly startRange: ViewRange;
|
|
21
21
|
/**
|
|
22
22
|
* The current event phase.
|
|
23
23
|
*/
|
|
@@ -31,17 +31,17 @@ export default class BubblingEventInfo<TName extends string = string, TReturn =
|
|
|
31
31
|
* @param name The event name.
|
|
32
32
|
* @param startRange The view range that the bubbling should start from.
|
|
33
33
|
*/
|
|
34
|
-
constructor(source: object, name: TName, startRange:
|
|
34
|
+
constructor(source: object, name: TName, startRange: ViewRange);
|
|
35
35
|
/**
|
|
36
36
|
* The current event phase.
|
|
37
37
|
*/
|
|
38
|
-
get eventPhase():
|
|
38
|
+
get eventPhase(): BubblingEventPhase;
|
|
39
39
|
/**
|
|
40
40
|
* The current bubbling target.
|
|
41
41
|
*/
|
|
42
|
-
get currentTarget():
|
|
42
|
+
get currentTarget(): ViewDocument | ViewNode | null;
|
|
43
43
|
}
|
|
44
44
|
/**
|
|
45
45
|
* The phase the event is in.
|
|
46
46
|
*/
|
|
47
|
-
export type
|
|
47
|
+
export type BubblingEventPhase = 'none' | 'capturing' | 'atTarget' | 'bubbling';
|
|
@@ -10,7 +10,7 @@ import { EventInfo } from '@ckeditor/ckeditor5-utils';
|
|
|
10
10
|
* The event object passed to bubbling event callbacks. It is used to provide information about the event as well as a tool to
|
|
11
11
|
* manipulate it.
|
|
12
12
|
*/
|
|
13
|
-
export
|
|
13
|
+
export class BubblingEventInfo extends EventInfo {
|
|
14
14
|
/**
|
|
15
15
|
* The view range that the bubbling should start from.
|
|
16
16
|
*/
|
|
@@ -5,16 +5,16 @@
|
|
|
5
5
|
/**
|
|
6
6
|
* @module engine/view/observer/clickobserver
|
|
7
7
|
*/
|
|
8
|
-
import DomEventObserver from './domeventobserver.js';
|
|
9
|
-
import type
|
|
8
|
+
import { DomEventObserver } from './domeventobserver.js';
|
|
9
|
+
import { type ViewDocumentDomEventData } from './domeventdata.js';
|
|
10
10
|
import type { BubblingEvent } from './bubblingemittermixin.js';
|
|
11
11
|
/**
|
|
12
|
-
* {@link module:engine/view/document~
|
|
12
|
+
* {@link module:engine/view/document~ViewDocument#event:click Click} event observer.
|
|
13
13
|
*
|
|
14
14
|
* Note that this observer is not available by default. To make it available it needs to be added to
|
|
15
|
-
* {@link module:engine/view/view~
|
|
15
|
+
* {@link module:engine/view/view~EditingView view controller} by a {@link module:engine/view/view~EditingView#addObserver} method.
|
|
16
16
|
*/
|
|
17
|
-
export
|
|
17
|
+
export declare class ClickObserver extends DomEventObserver<'click'> {
|
|
18
18
|
/**
|
|
19
19
|
* @inheritDoc
|
|
20
20
|
*/
|
|
@@ -31,13 +31,13 @@ export default class ClickObserver extends DomEventObserver<'click'> {
|
|
|
31
31
|
*
|
|
32
32
|
* Note that this event is not available by default. To make it available
|
|
33
33
|
* {@link module:engine/view/observer/clickobserver~ClickObserver} needs to be added
|
|
34
|
-
* to {@link module:engine/view/view~
|
|
34
|
+
* to {@link module:engine/view/view~EditingView} by a {@link module:engine/view/view~EditingView#addObserver} method.
|
|
35
35
|
*
|
|
36
36
|
* @see module:engine/view/observer/clickobserver~ClickObserver
|
|
37
|
-
* @eventName module:engine/view/document~
|
|
37
|
+
* @eventName module:engine/view/document~ViewDocument#click
|
|
38
38
|
* @param data Event data.
|
|
39
39
|
*/
|
|
40
40
|
export type ViewDocumentClickEvent = BubblingEvent<{
|
|
41
41
|
name: 'click';
|
|
42
|
-
args: [data:
|
|
42
|
+
args: [data: ViewDocumentDomEventData<MouseEvent>];
|
|
43
43
|
}>;
|