@ckeditor/ckeditor5-engine 45.2.1 → 46.0.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/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 +96 -91
- 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/stylesmap.d.ts
CHANGED
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
* @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
3
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
|
4
4
|
*/
|
|
5
|
-
import type {
|
|
5
|
+
import type { ViewElementAttributeValue } from './element.js';
|
|
6
6
|
import { type ArrayOrItem } from '@ckeditor/ckeditor5-utils';
|
|
7
7
|
/**
|
|
8
8
|
* Styles map. Allows handling (adding, removing, retrieving) a set of style rules (usually, of an element).
|
|
9
9
|
*/
|
|
10
|
-
export
|
|
10
|
+
export declare class StylesMap implements ViewElementAttributeValue {
|
|
11
11
|
/**
|
|
12
12
|
* Keeps an internal representation of styles map. Normalized styles are kept as object tree to allow unified modification and
|
|
13
13
|
* value access model using lodash's get, set, unset, etc methods.
|
|
@@ -61,7 +61,7 @@ export default class StylesMap implements ElementAttributeValue {
|
|
|
61
61
|
*
|
|
62
62
|
* ```ts
|
|
63
63
|
* // Enable 'margin' shorthand processing:
|
|
64
|
-
* editor.data.addStyleProcessorRules(
|
|
64
|
+
* editor.data.addStyleProcessorRules( addMarginStylesRules );
|
|
65
65
|
*
|
|
66
66
|
* styles.setTo( 'margin:2px;' );
|
|
67
67
|
*
|
|
@@ -94,7 +94,7 @@ export default class StylesMap implements ElementAttributeValue {
|
|
|
94
94
|
*
|
|
95
95
|
* ```ts
|
|
96
96
|
* // Enable 'margin' shorthand processing:
|
|
97
|
-
* editor.data.addStyleProcessorRules(
|
|
97
|
+
* editor.data.addStyleProcessorRules( addMarginStylesRules );
|
|
98
98
|
*
|
|
99
99
|
* styles.set( 'margin', '2px' );
|
|
100
100
|
* ```
|
|
@@ -173,7 +173,7 @@ export default class StylesMap implements ElementAttributeValue {
|
|
|
173
173
|
*
|
|
174
174
|
* ```ts
|
|
175
175
|
* // Enable 'margin' shorthand processing:
|
|
176
|
-
* editor.data.addStyleProcessorRules(
|
|
176
|
+
* editor.data.addStyleProcessorRules( addMarginStylesRules );
|
|
177
177
|
*
|
|
178
178
|
* styles.setTo( 'margin:1px' );
|
|
179
179
|
*
|
|
@@ -191,7 +191,7 @@ export default class StylesMap implements ElementAttributeValue {
|
|
|
191
191
|
*
|
|
192
192
|
* ```ts
|
|
193
193
|
* // Enable 'margin' shorthand processing:
|
|
194
|
-
* editor.data.addStyleProcessorRules(
|
|
194
|
+
* editor.data.addStyleProcessorRules( addMarginStylesRules );
|
|
195
195
|
*
|
|
196
196
|
* const styles = new Styles();
|
|
197
197
|
* styles.setTo( 'margin:1px 2px 3em;' );
|
|
@@ -227,7 +227,7 @@ export default class StylesMap implements ElementAttributeValue {
|
|
|
227
227
|
*
|
|
228
228
|
* ```ts
|
|
229
229
|
* // Enable 'margin' shorthand processing:
|
|
230
|
-
* editor.data.addStyleProcessorRules(
|
|
230
|
+
* editor.data.addStyleProcessorRules( addMarginStylesRules );
|
|
231
231
|
*
|
|
232
232
|
* styles.set( 'margin' , '1px' );
|
|
233
233
|
* styles.set( 'background', '#f00' );
|
|
@@ -243,7 +243,7 @@ export default class StylesMap implements ElementAttributeValue {
|
|
|
243
243
|
*
|
|
244
244
|
* ```ts
|
|
245
245
|
* // Enable 'margin' shorthand processing:
|
|
246
|
-
* editor.data.addStyleProcessorRules(
|
|
246
|
+
* editor.data.addStyleProcessorRules( addMarginStylesRules );
|
|
247
247
|
*
|
|
248
248
|
* const styles = new Styles();
|
|
249
249
|
* styles.setTo( 'margin:1px;' );
|
|
@@ -328,7 +328,7 @@ export default class StylesMap implements ElementAttributeValue {
|
|
|
328
328
|
/**
|
|
329
329
|
* Returns normalized styles entries for further processing.
|
|
330
330
|
*/
|
|
331
|
-
getStylesEntries(): Array<
|
|
331
|
+
getStylesEntries(): Array<StylePropertyDescriptor>;
|
|
332
332
|
/**
|
|
333
333
|
* Clones the attribute value.
|
|
334
334
|
*
|
|
@@ -353,38 +353,34 @@ export default class StylesMap implements ElementAttributeValue {
|
|
|
353
353
|
*/
|
|
354
354
|
_getConsumables(name?: string): Array<string>;
|
|
355
355
|
/**
|
|
356
|
-
* Used by {@link module:engine/view/element~
|
|
356
|
+
* Used by {@link module:engine/view/element~ViewElement#_canMergeAttributesFrom} to verify if the given attribute can be merged without
|
|
357
357
|
* conflicts into the attribute.
|
|
358
358
|
*
|
|
359
|
-
* This method is indirectly used by the {@link module:engine/view/downcastwriter~
|
|
360
|
-
* an {@link module:engine/view/attributeelement~
|
|
359
|
+
* This method is indirectly used by the {@link module:engine/view/downcastwriter~ViewDowncastWriter} while down-casting
|
|
360
|
+
* an {@link module:engine/view/attributeelement~ViewAttributeElement} to merge it with other ViewAttributeElement.
|
|
361
361
|
*
|
|
362
362
|
* @internal
|
|
363
363
|
*/
|
|
364
364
|
_canMergeFrom(other: StylesMap): boolean;
|
|
365
365
|
/**
|
|
366
|
-
* Used by {@link module:engine/view/element~
|
|
366
|
+
* Used by {@link module:engine/view/element~ViewElement#_mergeAttributesFrom} to merge a given attribute into the attribute.
|
|
367
367
|
*
|
|
368
|
-
* This method is indirectly used by the {@link module:engine/view/downcastwriter~
|
|
369
|
-
* an {@link module:engine/view/attributeelement~
|
|
368
|
+
* This method is indirectly used by the {@link module:engine/view/downcastwriter~ViewDowncastWriter} while down-casting
|
|
369
|
+
* an {@link module:engine/view/attributeelement~ViewAttributeElement} to merge it with other ViewAttributeElement.
|
|
370
370
|
*
|
|
371
371
|
* @internal
|
|
372
372
|
*/
|
|
373
373
|
_mergeFrom(other: StylesMap): void;
|
|
374
374
|
/**
|
|
375
|
-
* Used by {@link module:engine/view/element~
|
|
375
|
+
* Used by {@link module:engine/view/element~ViewElement#_canSubtractAttributesOf} to verify if the given attribute can be fully
|
|
376
376
|
* subtracted from the attribute.
|
|
377
377
|
*
|
|
378
|
-
* This method is indirectly used by the {@link module:engine/view/downcastwriter~
|
|
379
|
-
* an {@link module:engine/view/attributeelement~
|
|
378
|
+
* This method is indirectly used by the {@link module:engine/view/downcastwriter~ViewDowncastWriter} while down-casting
|
|
379
|
+
* an {@link module:engine/view/attributeelement~ViewAttributeElement} to unwrap the ViewAttributeElement.
|
|
380
380
|
*
|
|
381
381
|
* @internal
|
|
382
382
|
*/
|
|
383
383
|
_isMatching(other: StylesMap): boolean;
|
|
384
|
-
/**
|
|
385
|
-
* Removes empty objects upon removing an entry from internal object.
|
|
386
|
-
*/
|
|
387
|
-
private _cleanEmptyObjectsOnPath;
|
|
388
384
|
}
|
|
389
385
|
/**
|
|
390
386
|
* Style processor is responsible for writing and reading a normalized styles object.
|
|
@@ -474,7 +470,7 @@ export declare class StylesProcessor {
|
|
|
474
470
|
*
|
|
475
471
|
* @param name Name of style property.
|
|
476
472
|
*/
|
|
477
|
-
getReducedForm(name: string, styles: Styles): Array<
|
|
473
|
+
getReducedForm(name: string, styles: Styles): Array<StylePropertyDescriptor>;
|
|
478
474
|
/**
|
|
479
475
|
* Return all style properties. Also expand shorthand properties (e.g. `margin`, `background`) if respective extractor is available.
|
|
480
476
|
*
|
|
@@ -550,7 +546,7 @@ export declare class StylesProcessor {
|
|
|
550
546
|
* } );
|
|
551
547
|
* ```
|
|
552
548
|
*/
|
|
553
|
-
setNormalizer(name: string, callback:
|
|
549
|
+
setNormalizer(name: string, callback: StylesNormalizer): void;
|
|
554
550
|
/**
|
|
555
551
|
* Adds a extractor callback for a style property.
|
|
556
552
|
*
|
|
@@ -595,7 +591,7 @@ export declare class StylesProcessor {
|
|
|
595
591
|
*
|
|
596
592
|
* @param callbackOrPath Callback that return a requested value or path string for single values.
|
|
597
593
|
*/
|
|
598
|
-
setExtractor(name: string, callbackOrPath:
|
|
594
|
+
setExtractor(name: string, callbackOrPath: StylesExtractor): void;
|
|
599
595
|
/**
|
|
600
596
|
* Adds a reducer callback for a style property.
|
|
601
597
|
*
|
|
@@ -632,7 +628,7 @@ export declare class StylesProcessor {
|
|
|
632
628
|
* } );
|
|
633
629
|
* ```
|
|
634
630
|
*/
|
|
635
|
-
setReducer(name: string, callback:
|
|
631
|
+
setReducer(name: string, callback: StylesReducer): void;
|
|
636
632
|
/**
|
|
637
633
|
* Defines a style shorthand relation to other style notations.
|
|
638
634
|
*
|
|
@@ -671,7 +667,7 @@ export declare class StylesProcessor {
|
|
|
671
667
|
* const marginTopDescriptor = [ 'margin-top', '2px' ];
|
|
672
668
|
* ```
|
|
673
669
|
*/
|
|
674
|
-
export type
|
|
670
|
+
export type StylePropertyDescriptor = [name: string, value: string];
|
|
675
671
|
/**
|
|
676
672
|
* An object describing values associated with the sides of a box, for instance margins, paddings,
|
|
677
673
|
* border widths, border colors, etc.
|
|
@@ -692,7 +688,7 @@ export type PropertyDescriptor = [name: string, value: string];
|
|
|
692
688
|
* };
|
|
693
689
|
* ```
|
|
694
690
|
*/
|
|
695
|
-
export type
|
|
691
|
+
export type BoxStyleSides = {
|
|
696
692
|
/**
|
|
697
693
|
* Top side value.
|
|
698
694
|
*/
|
|
@@ -719,13 +715,13 @@ export interface Styles {
|
|
|
719
715
|
/**
|
|
720
716
|
* The value of style.
|
|
721
717
|
*/
|
|
722
|
-
export type StyleValue = string | Array<string> | Styles |
|
|
718
|
+
export type StyleValue = string | Array<string> | Styles | BoxStyleSides;
|
|
723
719
|
/**
|
|
724
720
|
* A normalizer method for a style property.
|
|
725
721
|
*
|
|
726
722
|
* @see ~StylesProcessor#setNormalizer
|
|
727
723
|
*/
|
|
728
|
-
export type
|
|
724
|
+
export type StylesNormalizer = (name: string) => {
|
|
729
725
|
path: string;
|
|
730
726
|
value: StyleValue;
|
|
731
727
|
};
|
|
@@ -734,10 +730,10 @@ export type Normalizer = (name: string) => {
|
|
|
734
730
|
*
|
|
735
731
|
* @see ~StylesProcessor#setExtractor
|
|
736
732
|
*/
|
|
737
|
-
export type
|
|
733
|
+
export type StylesExtractor = string | ((name: string, styles: Styles) => StyleValue | undefined);
|
|
738
734
|
/**
|
|
739
735
|
* A reducer callback for a style property.
|
|
740
736
|
*
|
|
741
737
|
* @see ~StylesProcessor#setReducer
|
|
742
738
|
*/
|
|
743
|
-
export type
|
|
739
|
+
export type StylesReducer = (value: StyleValue) => Array<StylePropertyDescriptor>;
|
package/src/view/stylesmap.js
CHANGED
|
@@ -5,13 +5,13 @@
|
|
|
5
5
|
/**
|
|
6
6
|
* @module engine/view/stylesmap
|
|
7
7
|
*/
|
|
8
|
-
import { get, isObject, merge, set
|
|
8
|
+
import { get, isObject, merge, set } from 'es-toolkit/compat';
|
|
9
9
|
import { toArray } from '@ckeditor/ckeditor5-utils';
|
|
10
10
|
import { isPatternMatched } from './matcher.js';
|
|
11
11
|
/**
|
|
12
12
|
* Styles map. Allows handling (adding, removing, retrieving) a set of style rules (usually, of an element).
|
|
13
13
|
*/
|
|
14
|
-
export
|
|
14
|
+
export class StylesMap {
|
|
15
15
|
/**
|
|
16
16
|
* Keeps an internal representation of styles map. Normalized styles are kept as object tree to allow unified modification and
|
|
17
17
|
* value access model using lodash's get, set, unset, etc methods.
|
|
@@ -83,7 +83,7 @@ export default class StylesMap {
|
|
|
83
83
|
*
|
|
84
84
|
* ```ts
|
|
85
85
|
* // Enable 'margin' shorthand processing:
|
|
86
|
-
* editor.data.addStyleProcessorRules(
|
|
86
|
+
* editor.data.addStyleProcessorRules( addMarginStylesRules );
|
|
87
87
|
*
|
|
88
88
|
* styles.setTo( 'margin:2px;' );
|
|
89
89
|
*
|
|
@@ -137,7 +137,7 @@ export default class StylesMap {
|
|
|
137
137
|
*
|
|
138
138
|
* ```ts
|
|
139
139
|
* // Enable 'margin' shorthand processing:
|
|
140
|
-
* editor.data.addStyleProcessorRules(
|
|
140
|
+
* editor.data.addStyleProcessorRules( addMarginStylesRules );
|
|
141
141
|
*
|
|
142
142
|
* styles.setTo( 'margin:1px' );
|
|
143
143
|
*
|
|
@@ -150,13 +150,26 @@ export default class StylesMap {
|
|
|
150
150
|
* @param names Style name or an array of names.
|
|
151
151
|
*/
|
|
152
152
|
remove(names) {
|
|
153
|
+
const normalizedStylesToRemove = {};
|
|
153
154
|
for (const name of toArray(names)) {
|
|
155
|
+
// First, try the easy path, when the path reflects normalized styles structure.
|
|
156
|
+
const path = toPath(name);
|
|
157
|
+
const pathValue = get(this._styles, path);
|
|
158
|
+
if (pathValue) {
|
|
159
|
+
appendStyleValue(normalizedStylesToRemove, path, pathValue);
|
|
160
|
+
}
|
|
161
|
+
else {
|
|
162
|
+
// Easy path did not work, so try to get the value from the styles map.
|
|
163
|
+
const value = this.getAsString(name);
|
|
164
|
+
if (value !== undefined) {
|
|
165
|
+
this._styleProcessor.toNormalizedForm(name, value, normalizedStylesToRemove);
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
if (Object.keys(normalizedStylesToRemove).length) {
|
|
170
|
+
removeStyles(this._styles, normalizedStylesToRemove);
|
|
154
171
|
this._cachedStyleNames = null;
|
|
155
172
|
this._cachedExpandedStyleNames = null;
|
|
156
|
-
const path = toPath(name);
|
|
157
|
-
unset(this._styles, path);
|
|
158
|
-
delete this._styles[name];
|
|
159
|
-
this._cleanEmptyObjectsOnPath(path);
|
|
160
173
|
}
|
|
161
174
|
}
|
|
162
175
|
/**
|
|
@@ -164,7 +177,7 @@ export default class StylesMap {
|
|
|
164
177
|
*
|
|
165
178
|
* ```ts
|
|
166
179
|
* // Enable 'margin' shorthand processing:
|
|
167
|
-
* editor.data.addStyleProcessorRules(
|
|
180
|
+
* editor.data.addStyleProcessorRules( addMarginStylesRules );
|
|
168
181
|
*
|
|
169
182
|
* const styles = new Styles();
|
|
170
183
|
* styles.setTo( 'margin:1px 2px 3em;' );
|
|
@@ -202,7 +215,7 @@ export default class StylesMap {
|
|
|
202
215
|
*
|
|
203
216
|
* ```ts
|
|
204
217
|
* // Enable 'margin' shorthand processing:
|
|
205
|
-
* editor.data.addStyleProcessorRules(
|
|
218
|
+
* editor.data.addStyleProcessorRules( addMarginStylesRules );
|
|
206
219
|
*
|
|
207
220
|
* styles.set( 'margin' , '1px' );
|
|
208
221
|
* styles.set( 'background', '#f00' );
|
|
@@ -226,7 +239,7 @@ export default class StylesMap {
|
|
|
226
239
|
*
|
|
227
240
|
* ```ts
|
|
228
241
|
* // Enable 'margin' shorthand processing:
|
|
229
|
-
* editor.data.addStyleProcessorRules(
|
|
242
|
+
* editor.data.addStyleProcessorRules( addMarginStylesRules );
|
|
230
243
|
*
|
|
231
244
|
* const styles = new Styles();
|
|
232
245
|
* styles.setTo( 'margin:1px;' );
|
|
@@ -422,11 +435,11 @@ export default class StylesMap {
|
|
|
422
435
|
return result;
|
|
423
436
|
}
|
|
424
437
|
/**
|
|
425
|
-
* Used by {@link module:engine/view/element~
|
|
438
|
+
* Used by {@link module:engine/view/element~ViewElement#_canMergeAttributesFrom} to verify if the given attribute can be merged without
|
|
426
439
|
* conflicts into the attribute.
|
|
427
440
|
*
|
|
428
|
-
* This method is indirectly used by the {@link module:engine/view/downcastwriter~
|
|
429
|
-
* an {@link module:engine/view/attributeelement~
|
|
441
|
+
* This method is indirectly used by the {@link module:engine/view/downcastwriter~ViewDowncastWriter} while down-casting
|
|
442
|
+
* an {@link module:engine/view/attributeelement~ViewAttributeElement} to merge it with other ViewAttributeElement.
|
|
430
443
|
*
|
|
431
444
|
* @internal
|
|
432
445
|
*/
|
|
@@ -439,10 +452,10 @@ export default class StylesMap {
|
|
|
439
452
|
return true;
|
|
440
453
|
}
|
|
441
454
|
/**
|
|
442
|
-
* Used by {@link module:engine/view/element~
|
|
455
|
+
* Used by {@link module:engine/view/element~ViewElement#_mergeAttributesFrom} to merge a given attribute into the attribute.
|
|
443
456
|
*
|
|
444
|
-
* This method is indirectly used by the {@link module:engine/view/downcastwriter~
|
|
445
|
-
* an {@link module:engine/view/attributeelement~
|
|
457
|
+
* This method is indirectly used by the {@link module:engine/view/downcastwriter~ViewDowncastWriter} while down-casting
|
|
458
|
+
* an {@link module:engine/view/attributeelement~ViewAttributeElement} to merge it with other ViewAttributeElement.
|
|
446
459
|
*
|
|
447
460
|
* @internal
|
|
448
461
|
*/
|
|
@@ -454,11 +467,11 @@ export default class StylesMap {
|
|
|
454
467
|
}
|
|
455
468
|
}
|
|
456
469
|
/**
|
|
457
|
-
* Used by {@link module:engine/view/element~
|
|
470
|
+
* Used by {@link module:engine/view/element~ViewElement#_canSubtractAttributesOf} to verify if the given attribute can be fully
|
|
458
471
|
* subtracted from the attribute.
|
|
459
472
|
*
|
|
460
|
-
* This method is indirectly used by the {@link module:engine/view/downcastwriter~
|
|
461
|
-
* an {@link module:engine/view/attributeelement~
|
|
473
|
+
* This method is indirectly used by the {@link module:engine/view/downcastwriter~ViewDowncastWriter} while down-casting
|
|
474
|
+
* an {@link module:engine/view/attributeelement~ViewAttributeElement} to unwrap the ViewAttributeElement.
|
|
462
475
|
*
|
|
463
476
|
* @internal
|
|
464
477
|
*/
|
|
@@ -470,25 +483,6 @@ export default class StylesMap {
|
|
|
470
483
|
}
|
|
471
484
|
return true;
|
|
472
485
|
}
|
|
473
|
-
/**
|
|
474
|
-
* Removes empty objects upon removing an entry from internal object.
|
|
475
|
-
*/
|
|
476
|
-
_cleanEmptyObjectsOnPath(path) {
|
|
477
|
-
const pathParts = path.split('.');
|
|
478
|
-
const isChildPath = pathParts.length > 1;
|
|
479
|
-
if (!isChildPath) {
|
|
480
|
-
return;
|
|
481
|
-
}
|
|
482
|
-
const parentPath = pathParts.splice(0, pathParts.length - 1).join('.');
|
|
483
|
-
const parentObject = get(this._styles, parentPath);
|
|
484
|
-
if (!parentObject) {
|
|
485
|
-
return;
|
|
486
|
-
}
|
|
487
|
-
const isParentEmpty = !Object.keys(parentObject).length;
|
|
488
|
-
if (isParentEmpty) {
|
|
489
|
-
this.remove(parentPath);
|
|
490
|
-
}
|
|
491
|
-
}
|
|
492
486
|
}
|
|
493
487
|
/**
|
|
494
488
|
* Style processor is responsible for writing and reading a normalized styles object.
|
|
@@ -926,3 +920,22 @@ function appendStyleValue(stylesObject, nameOrPath, valueOrObject) {
|
|
|
926
920
|
}
|
|
927
921
|
set(stylesObject, nameOrPath, valueToSet);
|
|
928
922
|
}
|
|
923
|
+
/**
|
|
924
|
+
* Modifies the `styles` deeply nested object by removing properties defined in `toRemove`.
|
|
925
|
+
*/
|
|
926
|
+
function removeStyles(styles, toRemove) {
|
|
927
|
+
for (const key of Object.keys(toRemove)) {
|
|
928
|
+
if (styles[key] !== null &&
|
|
929
|
+
!Array.isArray(styles[key]) &&
|
|
930
|
+
typeof styles[key] == 'object' &&
|
|
931
|
+
typeof toRemove[key] == 'object') {
|
|
932
|
+
removeStyles(styles[key], toRemove[key]);
|
|
933
|
+
if (!Object.keys(styles[key]).length) {
|
|
934
|
+
delete styles[key];
|
|
935
|
+
}
|
|
936
|
+
}
|
|
937
|
+
else {
|
|
938
|
+
delete styles[key];
|
|
939
|
+
}
|
|
940
|
+
}
|
|
941
|
+
}
|
package/src/view/text.d.ts
CHANGED
|
@@ -5,33 +5,33 @@
|
|
|
5
5
|
/**
|
|
6
6
|
* @module engine/view/text
|
|
7
7
|
*/
|
|
8
|
-
import
|
|
9
|
-
import type
|
|
8
|
+
import { ViewNode } from './node.js';
|
|
9
|
+
import { type ViewDocument } from './document.js';
|
|
10
10
|
/**
|
|
11
11
|
* Tree view text node.
|
|
12
12
|
*
|
|
13
13
|
* The constructor of this class should not be used directly. To create a new text node instance
|
|
14
|
-
* use the {@link module:engine/view/downcastwriter~
|
|
14
|
+
* use the {@link module:engine/view/downcastwriter~ViewDowncastWriter#createText `ViewDowncastWriter#createText()`}
|
|
15
15
|
* method when working on data downcasted from the model or the
|
|
16
|
-
* {@link module:engine/view/upcastwriter~
|
|
16
|
+
* {@link module:engine/view/upcastwriter~ViewUpcastWriter#createText `ViewUpcastWriter#createText()`}
|
|
17
17
|
* method when working on non-semantic views.
|
|
18
18
|
*/
|
|
19
|
-
export
|
|
19
|
+
export declare class ViewText extends ViewNode {
|
|
20
20
|
/**
|
|
21
21
|
* The text content.
|
|
22
22
|
*
|
|
23
|
-
* Setting the data fires the {@link module:engine/view/node~
|
|
23
|
+
* Setting the data fires the {@link module:engine/view/node~ViewNode#event:change:text change event}.
|
|
24
24
|
*/
|
|
25
25
|
private _textData;
|
|
26
26
|
/**
|
|
27
27
|
* Creates a tree view text node.
|
|
28
28
|
*
|
|
29
|
-
* @see module:engine/view/downcastwriter~
|
|
29
|
+
* @see module:engine/view/downcastwriter~ViewDowncastWriter#createText
|
|
30
30
|
* @internal
|
|
31
31
|
* @param document The document instance to which this text node belongs.
|
|
32
32
|
* @param data The text's data.
|
|
33
33
|
*/
|
|
34
|
-
constructor(document:
|
|
34
|
+
constructor(document: ViewDocument, data: string);
|
|
35
35
|
/**
|
|
36
36
|
* The text content.
|
|
37
37
|
*/
|
|
@@ -51,7 +51,7 @@ export default class Text extends Node {
|
|
|
51
51
|
*
|
|
52
52
|
* If the protected getter didn't exist, `foo._data` will return `undefined` and result of the merge will be invalid.
|
|
53
53
|
*
|
|
54
|
-
* The setter sets data and fires the {@link module:engine/view/node~
|
|
54
|
+
* The setter sets data and fires the {@link module:engine/view/node~ViewNode#event:change:text change event}.
|
|
55
55
|
*
|
|
56
56
|
* @internal
|
|
57
57
|
*/
|
|
@@ -63,12 +63,12 @@ export default class Text extends Node {
|
|
|
63
63
|
*
|
|
64
64
|
* @param otherNode Node to check if it is same as this node.
|
|
65
65
|
*/
|
|
66
|
-
isSimilar(otherNode:
|
|
66
|
+
isSimilar(otherNode: ViewNode): boolean;
|
|
67
67
|
/**
|
|
68
68
|
* Clones this node.
|
|
69
69
|
*
|
|
70
70
|
* @internal
|
|
71
71
|
* @returns Text node that is a clone of this node.
|
|
72
72
|
*/
|
|
73
|
-
_clone():
|
|
73
|
+
_clone(): ViewText;
|
|
74
74
|
}
|
package/src/view/text.js
CHANGED
|
@@ -5,27 +5,27 @@
|
|
|
5
5
|
/**
|
|
6
6
|
* @module engine/view/text
|
|
7
7
|
*/
|
|
8
|
-
import
|
|
8
|
+
import { ViewNode } from './node.js';
|
|
9
9
|
/**
|
|
10
10
|
* Tree view text node.
|
|
11
11
|
*
|
|
12
12
|
* The constructor of this class should not be used directly. To create a new text node instance
|
|
13
|
-
* use the {@link module:engine/view/downcastwriter~
|
|
13
|
+
* use the {@link module:engine/view/downcastwriter~ViewDowncastWriter#createText `ViewDowncastWriter#createText()`}
|
|
14
14
|
* method when working on data downcasted from the model or the
|
|
15
|
-
* {@link module:engine/view/upcastwriter~
|
|
15
|
+
* {@link module:engine/view/upcastwriter~ViewUpcastWriter#createText `ViewUpcastWriter#createText()`}
|
|
16
16
|
* method when working on non-semantic views.
|
|
17
17
|
*/
|
|
18
|
-
export
|
|
18
|
+
export class ViewText extends ViewNode {
|
|
19
19
|
/**
|
|
20
20
|
* The text content.
|
|
21
21
|
*
|
|
22
|
-
* Setting the data fires the {@link module:engine/view/node~
|
|
22
|
+
* Setting the data fires the {@link module:engine/view/node~ViewNode#event:change:text change event}.
|
|
23
23
|
*/
|
|
24
24
|
_textData;
|
|
25
25
|
/**
|
|
26
26
|
* Creates a tree view text node.
|
|
27
27
|
*
|
|
28
|
-
* @see module:engine/view/downcastwriter~
|
|
28
|
+
* @see module:engine/view/downcastwriter~ViewDowncastWriter#createText
|
|
29
29
|
* @internal
|
|
30
30
|
* @param document The document instance to which this text node belongs.
|
|
31
31
|
* @param data The text's data.
|
|
@@ -55,7 +55,7 @@ export default class Text extends Node {
|
|
|
55
55
|
*
|
|
56
56
|
* If the protected getter didn't exist, `foo._data` will return `undefined` and result of the merge will be invalid.
|
|
57
57
|
*
|
|
58
|
-
* The setter sets data and fires the {@link module:engine/view/node~
|
|
58
|
+
* The setter sets data and fires the {@link module:engine/view/node~ViewNode#event:change:text change event}.
|
|
59
59
|
*
|
|
60
60
|
* @internal
|
|
61
61
|
*/
|
|
@@ -73,7 +73,7 @@ export default class Text extends Node {
|
|
|
73
73
|
* @param otherNode Node to check if it is same as this node.
|
|
74
74
|
*/
|
|
75
75
|
isSimilar(otherNode) {
|
|
76
|
-
if (!(otherNode instanceof
|
|
76
|
+
if (!(otherNode instanceof ViewText)) {
|
|
77
77
|
return false;
|
|
78
78
|
}
|
|
79
79
|
return this === otherNode || this.data === otherNode.data;
|
|
@@ -85,12 +85,12 @@ export default class Text extends Node {
|
|
|
85
85
|
* @returns Text node that is a clone of this node.
|
|
86
86
|
*/
|
|
87
87
|
_clone() {
|
|
88
|
-
return new
|
|
88
|
+
return new ViewText(this.document, this.data);
|
|
89
89
|
}
|
|
90
90
|
}
|
|
91
91
|
// The magic of type inference using `is` method is centralized in `TypeCheckable` class.
|
|
92
92
|
// Proper overload would interfere with that.
|
|
93
|
-
|
|
93
|
+
ViewText.prototype.is = function (type) {
|
|
94
94
|
return type === '$text' || type === 'view:$text' ||
|
|
95
95
|
// This are legacy values kept for backward compatibility.
|
|
96
96
|
type === 'text' || type === 'view:text' ||
|
package/src/view/textproxy.d.ts
CHANGED
|
@@ -5,43 +5,44 @@
|
|
|
5
5
|
/**
|
|
6
6
|
* @module engine/view/textproxy
|
|
7
7
|
*/
|
|
8
|
-
import
|
|
9
|
-
import type
|
|
10
|
-
import type
|
|
11
|
-
import type
|
|
12
|
-
import type
|
|
13
|
-
import type
|
|
8
|
+
import { ViewTypeCheckable } from './typecheckable.js';
|
|
9
|
+
import { type ViewDocument } from './document.js';
|
|
10
|
+
import { type ViewDocumentFragment } from './documentfragment.js';
|
|
11
|
+
import { type ViewElement } from './element.js';
|
|
12
|
+
import { type ViewNode } from './node.js';
|
|
13
|
+
import { type ViewText } from './text.js';
|
|
14
14
|
/**
|
|
15
|
-
*
|
|
16
|
-
* {@link module:engine/view/treewalker~
|
|
15
|
+
* ViewTextProxy is a wrapper for substring of {@link module:engine/view/text~ViewText}. Instance of this class is created by
|
|
16
|
+
* {@link module:engine/view/treewalker~ViewTreeWalker} when only a part of {@link module:engine/view/text~ViewText} needs to be returned.
|
|
17
17
|
*
|
|
18
|
-
* `
|
|
18
|
+
* `ViewTextProxy` has an API similar to {@link module:engine/view/text~ViewText Text} and allows to do most of the common tasks performed
|
|
19
19
|
* on view nodes.
|
|
20
20
|
*
|
|
21
|
-
* **Note:** Some `
|
|
22
|
-
* See {@link module:engine/view/textproxy~
|
|
21
|
+
* **Note:** Some `ViewTextProxy` instances may represent whole text node, not just a part of it.
|
|
22
|
+
* See {@link module:engine/view/textproxy~ViewTextProxy#isPartial}.
|
|
23
23
|
*
|
|
24
|
-
* **Note:** `
|
|
24
|
+
* **Note:** `ViewTextProxy` is a readonly interface.
|
|
25
25
|
*
|
|
26
|
-
* **Note:** `
|
|
26
|
+
* **Note:** `ViewTextProxy` instances are created on the fly basing
|
|
27
|
+
* on the current state of parent {@link module:engine/view/text~ViewText}.
|
|
27
28
|
* Because of this it is highly unrecommended to store references to `TextProxy instances because they might get
|
|
28
|
-
* invalidated due to operations on Document. Also
|
|
29
|
-
* inserted as a child of {@link module:engine/view/element~
|
|
29
|
+
* invalidated due to operations on Document. Also ViewTextProxy is not a {@link module:engine/view/node~ViewNode} so it cannot be
|
|
30
|
+
* inserted as a child of {@link module:engine/view/element~ViewElement}.
|
|
30
31
|
*
|
|
31
|
-
* `
|
|
32
|
-
* an instance of this class by your own.
|
|
32
|
+
* `ViewTextProxy` instances are created by {@link module:engine/view/treewalker~ViewTreeWalker view tree walker}.
|
|
33
|
+
* You should not need to create an instance of this class by your own.
|
|
33
34
|
*/
|
|
34
|
-
export
|
|
35
|
+
export declare class ViewTextProxy extends ViewTypeCheckable {
|
|
35
36
|
/**
|
|
36
|
-
* Reference to the {@link module:engine/view/text~
|
|
37
|
+
* Reference to the {@link module:engine/view/text~ViewText} element which ViewTextProxy is a substring.
|
|
37
38
|
*/
|
|
38
|
-
readonly textNode:
|
|
39
|
+
readonly textNode: ViewText;
|
|
39
40
|
/**
|
|
40
41
|
* Text data represented by this text proxy.
|
|
41
42
|
*/
|
|
42
43
|
readonly data: string;
|
|
43
44
|
/**
|
|
44
|
-
* Offset in the `textNode` where this `
|
|
45
|
+
* Offset in the `textNode` where this `ViewTextProxy` instance starts.
|
|
45
46
|
*/
|
|
46
47
|
readonly offsetInText: number;
|
|
47
48
|
/**
|
|
@@ -49,37 +50,37 @@ export default class TextProxy extends TypeCheckable {
|
|
|
49
50
|
*
|
|
50
51
|
* @internal
|
|
51
52
|
* @param textNode Text node which part is represented by this text proxy.
|
|
52
|
-
* @param offsetInText Offset in {@link module:engine/view/textproxy~
|
|
53
|
+
* @param offsetInText Offset in {@link module:engine/view/textproxy~ViewTextProxy#textNode text node}
|
|
53
54
|
* from which the text proxy starts.
|
|
54
55
|
* @param length Text proxy length, that is how many text node's characters, starting from `offsetInText` it represents.
|
|
55
56
|
*/
|
|
56
|
-
constructor(textNode:
|
|
57
|
+
constructor(textNode: ViewText, offsetInText: number, length: number);
|
|
57
58
|
/**
|
|
58
59
|
* Offset size of this node.
|
|
59
60
|
*/
|
|
60
61
|
get offsetSize(): number;
|
|
61
62
|
/**
|
|
62
|
-
* Flag indicating whether `
|
|
63
|
+
* Flag indicating whether `ViewTextProxy` instance covers only part of the original {@link module:engine/view/text~ViewText text node}
|
|
63
64
|
* (`true`) or the whole text node (`false`).
|
|
64
65
|
*
|
|
65
|
-
* This is `false` when text proxy starts at the very beginning of {@link module:engine/view/textproxy~
|
|
66
|
-
* ({@link module:engine/view/textproxy~
|
|
66
|
+
* This is `false` when text proxy starts at the very beginning of {@link module:engine/view/textproxy~ViewTextProxy#textNode textNode}
|
|
67
|
+
* ({@link module:engine/view/textproxy~ViewTextProxy#offsetInText offsetInText} equals `0`) and text proxy sizes is equal to
|
|
67
68
|
* text node size.
|
|
68
69
|
*/
|
|
69
70
|
get isPartial(): boolean;
|
|
70
71
|
/**
|
|
71
72
|
* Parent of this text proxy, which is same as parent of text node represented by this text proxy.
|
|
72
73
|
*/
|
|
73
|
-
get parent():
|
|
74
|
+
get parent(): ViewElement | ViewDocumentFragment | null;
|
|
74
75
|
/**
|
|
75
76
|
* Root of this text proxy, which is same as root of text node represented by this text proxy.
|
|
76
77
|
*/
|
|
77
|
-
get root():
|
|
78
|
+
get root(): ViewNode | ViewDocumentFragment;
|
|
78
79
|
/**
|
|
79
|
-
* {@link module:engine/view/document~
|
|
80
|
-
* {@link module:engine/view/documentfragment~
|
|
80
|
+
* {@link module:engine/view/document~ViewDocument View document} that owns this text proxy, or `null` if the text proxy is inside
|
|
81
|
+
* {@link module:engine/view/documentfragment~ViewDocumentFragment document fragment}.
|
|
81
82
|
*/
|
|
82
|
-
get document():
|
|
83
|
+
get document(): ViewDocument | null;
|
|
83
84
|
/**
|
|
84
85
|
* Returns ancestors array of this text proxy.
|
|
85
86
|
*
|
|
@@ -92,5 +93,5 @@ export default class TextProxy extends TypeCheckable {
|
|
|
92
93
|
getAncestors(options?: {
|
|
93
94
|
includeSelf?: boolean;
|
|
94
95
|
parentFirst?: boolean;
|
|
95
|
-
}): Array<
|
|
96
|
+
}): Array<ViewText | ViewElement | ViewDocumentFragment>;
|
|
96
97
|
}
|