roosterjs 8.18.0 → 8.19.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/rooster.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- // Type definitions for roosterjs (Version 8.18.0)
1
+ // Type definitions for roosterjs (Version 8.19.0)
2
2
  // Generated by dts tool from roosterjs
3
3
  // Project: https://github.com/Microsoft/roosterjs
4
4
 
@@ -1660,6 +1660,10 @@ interface ClipboardData {
1660
1660
  * Image file from clipboard event
1661
1661
  */
1662
1662
  image: File | null;
1663
+ /**
1664
+ * General file from clipboard event
1665
+ */
1666
+ files?: File[];
1663
1667
  /**
1664
1668
  * Html extracted from raw html string and remove content before and after fragment tag
1665
1669
  */
@@ -1943,27 +1947,27 @@ interface IContentTraverser {
1943
1947
  /**
1944
1948
  * Get current block
1945
1949
  */
1946
- currentBlockElement: BlockElement;
1950
+ currentBlockElement: BlockElement | null;
1947
1951
  /**
1948
1952
  * Get next block element
1949
1953
  */
1950
- getNextBlockElement(): BlockElement;
1954
+ getNextBlockElement(): BlockElement | null;
1951
1955
  /**
1952
1956
  * Get previous block element
1953
1957
  */
1954
- getPreviousBlockElement(): BlockElement;
1958
+ getPreviousBlockElement(): BlockElement | null;
1955
1959
  /**
1956
1960
  * Current inline element getter
1957
1961
  */
1958
- currentInlineElement: InlineElement;
1962
+ currentInlineElement: InlineElement | null;
1959
1963
  /**
1960
1964
  * Get next inline element
1961
1965
  */
1962
- getNextInlineElement(): InlineElement;
1966
+ getNextInlineElement(): InlineElement | null;
1963
1967
  /**
1964
1968
  * Get previous inline element
1965
1969
  */
1966
- getPreviousInlineElement(): InlineElement;
1970
+ getPreviousInlineElement(): InlineElement | null;
1967
1971
  }
1968
1972
 
1969
1973
  /**
@@ -2076,12 +2080,12 @@ interface IPositionContentSearcher {
2076
2080
  * Get the inline element before position
2077
2081
  * @returns The inlineElement before position
2078
2082
  */
2079
- getInlineElementBefore(): InlineElement;
2083
+ getInlineElementBefore(): InlineElement | null;
2080
2084
  /**
2081
2085
  * Get the inline element after position
2082
2086
  * @returns The inline element after position
2083
2087
  */
2084
- getInlineElementAfter(): InlineElement;
2088
+ getInlineElementAfter(): InlineElement | null;
2085
2089
  /**
2086
2090
  * Get X number of chars before position
2087
2091
  * The actual returned chars may be less than what is requested.
@@ -2097,7 +2101,7 @@ interface IPositionContentSearcher {
2097
2101
  * @param exactMatch Whether it is an exact match
2098
2102
  * @returns The range for the matched text, null if unable to find a match
2099
2103
  */
2100
- getRangeFromText(text: string, exactMatch: boolean): Range;
2104
+ getRangeFromText(text: string, exactMatch: boolean): Range | null;
2101
2105
  /**
2102
2106
  * Get text section before position till stop condition is met.
2103
2107
  * This offers consumers to retrieve text section by section
@@ -2111,7 +2115,7 @@ interface IPositionContentSearcher {
2111
2115
  * Get first non textual inline element before position
2112
2116
  * @returns First non textual inline element before position or null if no such element exists
2113
2117
  */
2114
- getNearestNonTextInlineElement(): InlineElement;
2118
+ getNearestNonTextInlineElement(): InlineElement | null;
2115
2119
  }
2116
2120
 
2117
2121
  /**
@@ -2271,11 +2275,11 @@ interface SelectionPath {
2271
2275
  /**
2272
2276
  * Represents a data structure of snapshots, this is usually used for undo snapshots
2273
2277
  */
2274
- interface Snapshots {
2278
+ interface Snapshots<T = string> {
2275
2279
  /**
2276
2280
  * The snapshot array
2277
2281
  */
2278
- snapshots: string[];
2282
+ snapshots: T[];
2279
2283
  /**
2280
2284
  * Size of all snapshots
2281
2285
  */
@@ -2294,6 +2298,59 @@ interface Snapshots {
2294
2298
  readonly maxSize: number;
2295
2299
  }
2296
2300
 
2301
+ /**
2302
+ * Common part of NormalContentMetadata and TableContentMetadata
2303
+ */
2304
+ interface ContentMetadataBase<T extends SelectionRangeTypes> {
2305
+ isDarkMode: boolean;
2306
+ type: T;
2307
+ }
2308
+
2309
+ /**
2310
+ * A content metadata is a data structure storing information other than HTML content,
2311
+ * such as dark mode info, selection info, ...
2312
+ *
2313
+ * NormalContentMetadata is content metadata for normal selection with a start and end selection path.
2314
+ *
2315
+ * When do any change to this type, also need to fix function isUndoMetadata to make sure
2316
+ * the check is correct
2317
+ */
2318
+ interface NormalContentMetadata extends SelectionPath, ContentMetadataBase<SelectionRangeTypes.Normal> {
2319
+ }
2320
+
2321
+ /**
2322
+ * A content metadata is a data structure storing information other than HTML content,
2323
+ * such as dark mode info, selection info, ...
2324
+ *
2325
+ * TableContentMetadata is content metadata for table selection with table id and start and end coordinates
2326
+ *
2327
+ * When do any change to this type, also need to fix function isUndoMetadata to make sure
2328
+ * the check is correct
2329
+ */
2330
+ interface TableContentMetadata extends TableSelection, ContentMetadataBase<SelectionRangeTypes.TableSelection> {
2331
+ tableId: string;
2332
+ }
2333
+
2334
+ /**
2335
+ * A content metadata is a data structure storing information other than HTML content,
2336
+ * such as dark mode info, selection info, ...
2337
+ */
2338
+ type ContentMetadata = NormalContentMetadata | TableContentMetadata;
2339
+
2340
+ /**
2341
+ * A serializable snapshot of editor content, including the html content and metadata
2342
+ */
2343
+ interface Snapshot {
2344
+ /**
2345
+ * HTML content string
2346
+ */
2347
+ html: string;
2348
+ /**
2349
+ * Metadata of the editor content state
2350
+ */
2351
+ metadata: ContentMetadata | null;
2352
+ }
2353
+
2297
2354
  /**
2298
2355
  * Table format
2299
2356
  */
@@ -2973,6 +3030,11 @@ interface IEditor {
2973
3030
  * @returns True if the editor is in dark mode, otherwise false
2974
3031
  */
2975
3032
  isDarkMode(): boolean;
3033
+ /**
3034
+ * Transform the given node and all its child nodes to dark mode color if editor is in dark mode
3035
+ * @param node The node to transform
3036
+ */
3037
+ transformToDarkColor(node: Node): void;
2976
3038
  /**
2977
3039
  * Make the editor in "Shadow Edit" mode.
2978
3040
  * In Shadow Edit mode, all format change will finally be ignored.
@@ -3157,6 +3219,10 @@ interface CorePlugins {
3157
3219
  * Entity Plugin handles all operations related to an entity and generate entity specified events
3158
3220
  */
3159
3221
  readonly entity: PluginWithState<EntityPluginState>;
3222
+ /**
3223
+ * NormalizeTable plugin makes sure each table in editor has TBODY/THEAD/TFOOT tag around TR tags
3224
+ */
3225
+ readonly normalizeTable: EditorPlugin;
3160
3226
  /**
3161
3227
  * Lifecycle plugin handles editor initialization and disposing
3162
3228
  */
@@ -3369,6 +3435,8 @@ interface CoreApiMap {
3369
3435
  * @param includeSelf True to transform the root node as well, otherwise false
3370
3436
  * @param callback The callback function to invoke before do color transformation
3371
3437
  * @param direction To specify the transform direction, light to dark, or dark to light
3438
+ * @param forceTransform By default this function will only work when editor core is in dark mode.
3439
+ * Pass true to this value to force do color transformation even editor core is in light mode
3372
3440
  */
3373
3441
  transformColor: TransformColor;
3374
3442
  /**
@@ -3491,7 +3559,7 @@ type SelectRange = (core: EditorCore, range: Range, skipSameRange?: boolean) =>
3491
3559
  * @param content HTML content to set in
3492
3560
  * @param triggerContentChangedEvent True to trigger a ContentChanged event. Default value is true
3493
3561
  */
3494
- type SetContent = (core: EditorCore, content: string, triggerContentChangedEvent: boolean) => void;
3562
+ type SetContent = (core: EditorCore, content: string, triggerContentChangedEvent: boolean, metadata?: ContentMetadata) => void;
3495
3563
 
3496
3564
  /**
3497
3565
  * Switch the Shadow Edit mode of editor On/Off
@@ -3507,8 +3575,10 @@ type SwitchShadowEdit = (core: EditorCore, isOn: boolean) => void;
3507
3575
  * @param includeSelf True to transform the root node as well, otherwise false
3508
3576
  * @param callback The callback function to invoke before do color transformation
3509
3577
  * @param direction To specify the transform direction, light to dark, or dark to light
3578
+ * @param forceTransform By default this function will only work when editor core is in dark mode.
3579
+ * Pass true to this value to force do color transformation even editor core is in light mode
3510
3580
  */
3511
- type TransformColor = (core: EditorCore, rootNode: Node, includeSelf: boolean, callback: () => void, direction: ColorTransformDirection) => void;
3581
+ type TransformColor = (core: EditorCore, rootNode: Node, includeSelf: boolean, callback: () => void, direction: ColorTransformDirection, forceTransform?: boolean) => void;
3512
3582
 
3513
3583
  /**
3514
3584
  * Trigger a plugin event
@@ -3546,9 +3616,15 @@ interface EditorOptions {
3546
3616
  */
3547
3617
  defaultFormat?: DefaultFormat;
3548
3618
  /**
3619
+ * @deprecated Use undoMetadataSnapshotService instead
3549
3620
  * Undo snapshot service. Use this parameter to customize the undo snapshot service.
3550
3621
  */
3551
- undoSnapshotService?: UndoSnapshotsService;
3622
+ undoSnapshotService?: UndoSnapshotsService<string>;
3623
+ /**
3624
+ * Undo snapshot service based on content metadata. Use this parameter to customize the undo snapshot service.
3625
+ * When this property is set, value of undoSnapshotService will be ignored.
3626
+ */
3627
+ undoMetadataSnapshotService?: UndoSnapshotsService<Snapshot>;
3552
3628
  /**
3553
3629
  * Initial HTML content
3554
3630
  * Default value is whatever already inside the editor content DIV
@@ -3815,6 +3891,10 @@ interface TableFeatureSettings {
3815
3891
  * @default true for Chrome and safari, false for other browsers since they already have correct behavior
3816
3892
  */
3817
3893
  upDownInTable: boolean;
3894
+ /**
3895
+ * IndentTableOnTab edit feature, provides the ability to indent the table if it is all cells are selected.
3896
+ */
3897
+ indentTableOnTab: boolean;
3818
3898
  }
3819
3899
 
3820
3900
  /**
@@ -3866,7 +3946,7 @@ interface CustomReplacement {
3866
3946
  /**
3867
3947
  * Represent an interface to provide functionalities for Undo Snapshots
3868
3948
  */
3869
- interface UndoSnapshotsService {
3949
+ interface UndoSnapshotsService<T = string> {
3870
3950
  /**
3871
3951
  * Check whether can move current undo snapshot with the given step
3872
3952
  * @param step The step to check, can be positive, negative or 0
@@ -3878,12 +3958,12 @@ interface UndoSnapshotsService {
3878
3958
  * @param step The step to move
3879
3959
  * @returns If can move with the given step, returns the snapshot after move, otherwise null
3880
3960
  */
3881
- move(step: number): string;
3961
+ move(step: number): T;
3882
3962
  /**
3883
3963
  * Add a new undo snapshot
3884
3964
  * @param snapshot The snapshot to add
3885
3965
  */
3886
- addSnapshot(snapshot: string, isAutoCompleteSnapshot: boolean): void;
3966
+ addSnapshot(snapshot: T, isAutoCompleteSnapshot: boolean): void;
3887
3967
  /**
3888
3968
  * Clear all undo snapshots after the current one
3889
3969
  */
@@ -4006,7 +4086,7 @@ interface VCell {
4006
4086
  /**
4007
4087
  * The table cell object. The value will be null if this is an expanded virtual cell
4008
4088
  */
4009
- td?: HTMLTableCellElement;
4089
+ td?: HTMLTableCellElement | null;
4010
4090
  /**
4011
4091
  * Whether this cell is spanned from left
4012
4092
  */
@@ -4290,7 +4370,7 @@ interface UndoPluginState {
4290
4370
  /**
4291
4371
  * Snapshot service for undo, it helps handle snapshot add, remove and retrieve
4292
4372
  */
4293
- snapshotsService: UndoSnapshotsService;
4373
+ snapshotsService: UndoSnapshotsService<Snapshot>;
4294
4374
  /**
4295
4375
  * Whether restoring of undo snapshot is in progress.
4296
4376
  */
@@ -4436,7 +4516,7 @@ type SizeTransformer = (size: number) => number;
4436
4516
  * @param rootNode Root node of the scope, the block element will be inside of this node
4437
4517
  * @param node The node to get BlockElement start from
4438
4518
  */
4439
- function getBlockElementAtNode(rootNode: Node, node: Node): BlockElement;
4519
+ function getBlockElementAtNode(rootNode: Node, node: Node | null): BlockElement | null;
4440
4520
 
4441
4521
  /**
4442
4522
  * Get the first/last BlockElement of under the root node.
@@ -4444,7 +4524,7 @@ function getBlockElementAtNode(rootNode: Node, node: Node): BlockElement;
4444
4524
  * @param rootNode The root node to get BlockElement from
4445
4525
  * @param isFirst True to get first BlockElement, false to get last BlockElement
4446
4526
  */
4447
- function getFirstLastBlockElement(rootNode: Node, isFirst: boolean): BlockElement;
4527
+ function getFirstLastBlockElement(rootNode: Node, isFirst: boolean): BlockElement | null;
4448
4528
 
4449
4529
  /**
4450
4530
  * The provides traversing of content inside editor.
@@ -4489,28 +4569,28 @@ class ContentTraverser implements IContentTraverser {
4489
4569
  /**
4490
4570
  * Get current block
4491
4571
  */
4492
- get currentBlockElement(): BlockElement;
4572
+ get currentBlockElement(): BlockElement | null;
4493
4573
  /**
4494
4574
  * Get next block element
4495
4575
  */
4496
- getNextBlockElement(): BlockElement;
4576
+ getNextBlockElement(): BlockElement | null;
4497
4577
  /**
4498
4578
  * Get previous block element
4499
4579
  */
4500
- getPreviousBlockElement(): BlockElement;
4580
+ getPreviousBlockElement(): BlockElement | null;
4501
4581
  private getPreviousNextBlockElement;
4502
4582
  /**
4503
4583
  * Current inline element getter
4504
4584
  */
4505
- get currentInlineElement(): InlineElement;
4585
+ get currentInlineElement(): InlineElement | null;
4506
4586
  /**
4507
4587
  * Get next inline element
4508
4588
  */
4509
- getNextInlineElement(): InlineElement;
4589
+ getNextInlineElement(): InlineElement | null;
4510
4590
  /**
4511
4591
  * Get previous inline element
4512
4592
  */
4513
- getPreviousInlineElement(): InlineElement;
4593
+ getPreviousInlineElement(): InlineElement | null;
4514
4594
  private getPreviousNextInlineElement;
4515
4595
  }
4516
4596
 
@@ -4544,12 +4624,12 @@ class PositionContentSearcher implements IPositionContentSearcher {
4544
4624
  * Get the inline element before position
4545
4625
  * @returns The inlineElement before position
4546
4626
  */
4547
- getInlineElementBefore(): InlineElement;
4627
+ getInlineElementBefore(): InlineElement | null;
4548
4628
  /**
4549
4629
  * Get the inline element after position
4550
4630
  * @returns The inline element after position
4551
4631
  */
4552
- getInlineElementAfter(): InlineElement;
4632
+ getInlineElementAfter(): InlineElement | null;
4553
4633
  /**
4554
4634
  * Get X number of chars before position
4555
4635
  * The actual returned chars may be less than what is requested.
@@ -4565,7 +4645,7 @@ class PositionContentSearcher implements IPositionContentSearcher {
4565
4645
  * @param exactMatch Whether it is an exact match
4566
4646
  * @returns The range for the matched text, null if unable to find a match
4567
4647
  */
4568
- getRangeFromText(text: string, exactMatch: boolean): Range;
4648
+ getRangeFromText(text: string, exactMatch: boolean): Range | null;
4569
4649
  /**
4570
4650
  * Get text section before position till stop condition is met.
4571
4651
  * This offers consumers to retrieve text section by section
@@ -4579,7 +4659,7 @@ class PositionContentSearcher implements IPositionContentSearcher {
4579
4659
  * Get first non textual inline element before position
4580
4660
  * @returns First non textual inline element before position or null if no such element exists
4581
4661
  */
4582
- getNearestNonTextInlineElement(): InlineElement;
4662
+ getNearestNonTextInlineElement(): InlineElement | null;
4583
4663
  /**
4584
4664
  * Continue traversing backward till stop condition is met or begin of block is reached
4585
4665
  */
@@ -4591,14 +4671,14 @@ class PositionContentSearcher implements IPositionContentSearcher {
4591
4671
  * @param rootNode The root node of current scope
4592
4672
  * @param node The node to get InlineElement from
4593
4673
  */
4594
- function getInlineElementAtNode(rootNode: Node, node: Node): InlineElement;
4674
+ function getInlineElementAtNode(rootNode: Node, node: Node | null): InlineElement;
4595
4675
 
4596
4676
  /**
4597
4677
  * Get the inline element at a node
4598
4678
  * @param parentBlock Parent BlockElement of this node
4599
4679
  * @param node The node to get InlineElement from
4600
4680
  */
4601
- function getInlineElementAtNode(parentBlock: BlockElement, node: Node): InlineElement;
4681
+ function getInlineElementAtNode(parentBlock: BlockElement, node: Node | null): InlineElement;
4602
4682
 
4603
4683
  /**
4604
4684
  * This is an inline element representing an Html image
@@ -4668,9 +4748,9 @@ class NodeInlineElement implements InlineElement {
4668
4748
  */
4669
4749
  class PartialInlineElement implements InlineElement {
4670
4750
  private inlineElement;
4671
- private start?;
4672
- private end?;
4673
- constructor(inlineElement: InlineElement, start?: NodePosition, end?: NodePosition);
4751
+ private start;
4752
+ private end;
4753
+ constructor(inlineElement: InlineElement, start?: NodePosition | null, end?: NodePosition | null);
4674
4754
  /**
4675
4755
  * Get the full inline element that this partial inline decorates
4676
4756
  */
@@ -4698,11 +4778,11 @@ class PartialInlineElement implements InlineElement {
4698
4778
  /**
4699
4779
  * Get next partial inline element if it is not at the end boundary yet
4700
4780
  */
4701
- get nextInlineElement(): PartialInlineElement;
4781
+ get nextInlineElement(): PartialInlineElement | null;
4702
4782
  /**
4703
4783
  * Get previous partial inline element if it is not at the begin boundary yet
4704
4784
  */
4705
- get previousInlineElement(): PartialInlineElement;
4785
+ get previousInlineElement(): PartialInlineElement | null;
4706
4786
  /**
4707
4787
  * Checks if it contains a position
4708
4788
  */
@@ -4725,8 +4805,8 @@ class PartialInlineElement implements InlineElement {
4725
4805
  * Apply style using a styler function to the given container node in the given range
4726
4806
  * @param container The container node to apply style to
4727
4807
  * @param styler The styler function
4728
- * @param from From position
4729
- * @param to To position
4808
+ * @param fromPosition From position
4809
+ * @param toPosition To position
4730
4810
  */
4731
4811
  function applyTextStyle(container: Node, styler: (node: HTMLElement, isInnerNode?: boolean) => any, from?: NodePosition, to?: NodePosition): void;
4732
4812
 
@@ -4840,7 +4920,7 @@ function collapseNodes(root: Node, start: Node, end: Node, canSplitParent: boole
4840
4920
  * @returns True if contained is inside container, or they are the same node when treatSameNodeAsContain is true.
4841
4921
  * Otherwise false.
4842
4922
  */
4843
- function contains(container: Node | null, contained: Node | null, treatSameNodeAsContain?: boolean): boolean;
4923
+ function contains(container: Node | null | undefined, contained: Node | null | undefined, treatSameNodeAsContain?: boolean): boolean;
4844
4924
 
4845
4925
  /**
4846
4926
  * Test if a node contains a given range
@@ -4848,7 +4928,7 @@ function contains(container: Node | null, contained: Node | null, treatSameNodeA
4848
4928
  * @param contained The range to check if it is inside container
4849
4929
  * @returns True if contained is inside container, otherwise false
4850
4930
  */
4851
- function contains(container: Node | null, contained: Range | null): boolean;
4931
+ function contains(container: Node | null | undefined, contained: Range | null | undefined): boolean;
4852
4932
 
4853
4933
  /**
4854
4934
  * Find closest element ancestor start from the given node which matches the given selector
@@ -4910,7 +4990,7 @@ type PendableFormatNames = keyof PendableFormatState;
4910
4990
  * @param node The node to get tag of
4911
4991
  * @returns Tag name in upper case if the given node is an Element, or empty string otherwise
4912
4992
  */
4913
- function getTagOfNode(node: Node): string;
4993
+ function getTagOfNode(node: Node | null): string;
4914
4994
 
4915
4995
  /**
4916
4996
  * Checks if the node is a block like element. Block like element are usually those P, DIV, LI, TD etc.
@@ -4955,7 +5035,7 @@ function matchLink(url: string): LinkData | null;
4955
5035
  * @param range The selection range to query with. This is required when scope is not Body
4956
5036
  * @returns HTML Element array of the query result
4957
5037
  */
4958
- function queryElements(container: ParentNode, selector: string, forEachCallback?: (node: HTMLElement) => any, scope?: QueryScope, range?: Range): HTMLElement[];
5038
+ function queryElements(container: ParentNode, selector: string, forEachCallback?: ((node: HTMLElement) => any) | null, scope?: QueryScope, range?: Range): HTMLElement[];
4959
5039
 
4960
5040
  /**
4961
5041
  * Split parent node of the given node before/after the given node.
@@ -5162,23 +5242,23 @@ class VTable {
5162
5242
  /**
5163
5243
  * Virtual cells
5164
5244
  */
5165
- cells: VCell[][];
5245
+ cells: VCell[][] | null;
5166
5246
  /**
5167
5247
  * Current row index
5168
5248
  */
5169
- row: number;
5249
+ row: number | undefined;
5170
5250
  /**
5171
5251
  * Current column index
5172
5252
  */
5173
- col: number;
5253
+ col: number | undefined;
5174
5254
  /**
5175
5255
  * Selected range of cells with the coordinates of the first and last cell selected.
5176
5256
  */
5177
- selection: TableSelection;
5257
+ selection: TableSelection | null;
5178
5258
  /**
5179
5259
  * Current format of the table
5180
5260
  */
5181
- formatInfo: Required<TableFormat>;
5261
+ formatInfo: Required<TableFormat> | null;
5182
5262
  private trs;
5183
5263
  /**
5184
5264
  * Create a new instance of VTable object using HTML TABLE or TD node
@@ -5208,6 +5288,7 @@ class VTable {
5208
5288
  * @param operation Table operation
5209
5289
  */
5210
5290
  edit(operation: TableOperation): void;
5291
+ setAlignmentToSelectedCells(firstRow: number, lastRow: number, firstColumn: number, lastColumn: number, alignmentType: string, isVertical?: boolean): void;
5211
5292
  /**
5212
5293
  * Loop each cell of current column and invoke a callback function
5213
5294
  * @param callback The callback function to invoke
@@ -5253,13 +5334,13 @@ class VTable {
5253
5334
  /**
5254
5335
  * Get current HTML table cell object. If the current table cell is a virtual expanded cell, return its root cell
5255
5336
  */
5256
- getCurrentTd(): HTMLTableCellElement;
5337
+ getCurrentTd(): HTMLTableCellElement | null;
5257
5338
  /**
5258
5339
  * Get the Table Cell in a provided coordinate
5259
5340
  * @param row row of the cell
5260
5341
  * @param col column of the cell
5261
5342
  */
5262
- getTd(row: number, col: number): HTMLTableCellElement;
5343
+ getTd(row: number | undefined, col: number | undefined): HTMLTableCellElement | null;
5263
5344
  private forEachCellOfColumn;
5264
5345
  private forEachCellOfRow;
5265
5346
  private recalculateSpans;
@@ -5270,6 +5351,14 @@ class VTable {
5270
5351
  private normalizeSize;
5271
5352
  }
5272
5353
 
5354
+ /**
5355
+ * Check if the whole table is selected
5356
+ * @param vTable VTable to check whether all cells are selected
5357
+ * @param selection Table selection with first cell selected and last cell selected coordinates.
5358
+ * @returns
5359
+ */
5360
+ function isWholeTableSelected(vTable: VTable, selection: TableSelection): boolean;
5361
+
5273
5362
  /**
5274
5363
  * Represent a bullet or a numbering list
5275
5364
  *
@@ -5354,8 +5443,10 @@ class VList {
5354
5443
  * @param indentation Specify to outdent
5355
5444
  * @param softOutdent (Optional) True to make the item to by dummy (no bullet or number) if the item is not dummy,
5356
5445
  * otherwise outdent the item
5446
+ * @param preventItemRemoval (Optional) True to prevent the indentation to remove the bullet when outdenting a first
5447
+ * level list item, by default is false
5357
5448
  */
5358
- setIndentation(start: NodePosition, end: NodePosition, indentation: Indentation.Decrease, softOutdent?: boolean): void;
5449
+ setIndentation(start: NodePosition, end: NodePosition, indentation: Indentation.Decrease, softOutdent?: boolean, preventItemRemoval?: boolean): void;
5359
5450
  /**
5360
5451
  * Change list type of the given range of this list.
5361
5452
  * If some of the items are not real list item yet, this will make them to be list item with given type
@@ -5382,6 +5473,25 @@ class VList {
5382
5473
  mergeVList(list: VList): void;
5383
5474
  /**
5384
5475
  * Get the index of the List Item in the current List
5476
+ * If the root list is:
5477
+ * Ordered list, the listIndex start count is going to be the start property of the OL - 1,
5478
+ * @example For example if we want to find the index of Item 2 in the list below, the returned index is going to be 6
5479
+ * * ```html
5480
+ * <ol start="5">
5481
+ * <li>item 1</li>
5482
+ * <li>item 2</li> <!-- Node to find -->
5483
+ * <li>item 3</li>
5484
+ * </ol>
5485
+ * ```
5486
+ * Unordered list, the listIndex start count starts from 0
5487
+ * @example For example if we want to find the index of Item 2 in the list below, the returned index is going to be 2
5488
+ * ```html
5489
+ * <ul>
5490
+ * <li>item 1</li>
5491
+ * <li>item 2</li> <!-- Node to find -->
5492
+ * <li>item 3</li>
5493
+ * </ul>
5494
+ * ```
5385
5495
  * @param input List item to find in the root list
5386
5496
  */
5387
5497
  getListItemIndex(input: Node): number;
@@ -5462,8 +5572,13 @@ class VListItem {
5462
5572
  /**
5463
5573
  * Outdent this item
5464
5574
  * If this item is already not an list item, it will be no op
5575
+ * @param preventItemRemoval Whether prevent the list item to be removed for the listItem by default false
5576
+ */
5577
+ outdent(preventItemRemoval?: boolean): void;
5578
+ /**
5579
+ * Add negative margin to the List item
5465
5580
  */
5466
- outdent(): void;
5581
+ addNegativeMargins(): void;
5467
5582
  /**
5468
5583
  * Change list type of this item
5469
5584
  * @param targetType The target list type to change to
@@ -5744,14 +5859,26 @@ function getSelectionPath(rootNode: Node, range: Range | null): SelectionPath |
5744
5859
  function getHtmlWithSelectionPath(rootNode: HTMLElement | DocumentFragment, range: Range): string;
5745
5860
 
5746
5861
  /**
5747
- * Restore inner Html of a root element from given html string. If the string contains selection path,
5862
+ * @deprecated Use setHtmlWithMetadata instead
5863
+ * Restore inner HTML of a root element from given html string. If the string contains selection path,
5748
5864
  * remove the selection path and return a range represented by the path
5749
5865
  * @param root The root element
5750
- * @param html The html to restore
5866
+ * @param html The HTML to restore
5867
+ * @param trustedHTMLHandler An optional trusted HTML handler to convert HTML string to security string
5751
5868
  * @returns A selection range if the html contains a valid selection path, otherwise null
5752
5869
  */
5753
5870
  function setHtmlWithSelectionPath(rootNode: HTMLElement, html: string, trustedHTMLHandler?: TrustedHTMLHandler): Range | null;
5754
5871
 
5872
+ /**
5873
+ * Restore inner HTML of a root element from given html string. If the string contains metadata,
5874
+ * remove it from DOM tree and return the metadata
5875
+ * @param root The root element
5876
+ * @param html The HTML to restore
5877
+ * @param trustedHTMLHandler An optional trusted HTML handler to convert HTML string to security string
5878
+ * @returns Content metadata if any, or undefined
5879
+ */
5880
+ function setHtmlWithMetadata(rootNode: HTMLElement, html: string, trustedHTMLHandler?: TrustedHTMLHandler): ContentMetadata | undefined;
5881
+
5755
5882
  /**
5756
5883
  * Add the given range into selection of the given document
5757
5884
  * @param range The range to select
@@ -5764,10 +5891,28 @@ function addRangeToSelection(range: Range, skipSameRange?: boolean): void;
5764
5891
  /**
5765
5892
  * Add a new snapshot to the given snapshots data structure
5766
5893
  * @param snapshots The snapshots data structure to add new snapshot into
5767
- * @param snapshot The snapshot to add
5894
+ * @param html The snapshot HTML to add
5895
+ * @param isAutoCompleteSnapshot Whether this is a snapshot before auto complete action
5896
+ */
5897
+ function addSnapshot(snapshots: Snapshots<string>, html: string, isAutoCompleteSnapshot: boolean): void;
5898
+
5899
+ /**
5900
+ * Add a new snapshot to the given snapshots data structure
5901
+ * @param snapshots The snapshots data structure to add new snapshot into
5902
+ * @param snapshot The generic snapshot object to add
5768
5903
  * @param isAutoCompleteSnapshot Whether this is a snapshot before auto complete action
5904
+ * @param getLength A callback function to calculate length of the snapshot
5905
+ * @param isSame A callback function to check if the given snapshots are the same
5769
5906
  */
5770
- function addSnapshot(snapshots: Snapshots, snapshot: string, isAutoCompleteSnapshot: boolean): void;
5907
+ function addSnapshot<T>(snapshots: Snapshots<T>, snapshot: T, isAutoCompleteSnapshot: boolean, getLength: (snapshot: T) => number, isSame: (snapshot1: T, snapshot2: T) => boolean): void;
5908
+
5909
+ /**
5910
+ * Add a new snapshot to the given snapshots data structure
5911
+ * @param snapshots The snapshots data structure to add new snapshot into
5912
+ * @param snapshot The snapshot object to add
5913
+ * @param isAutoCompleteSnapshot Whether this is a snapshot before auto complete action
5914
+ */
5915
+ function addSnapshotV2(snapshots: Snapshots<Snapshot>, snapshot: Snapshot, isAutoCompleteSnapshot: boolean): void;
5771
5916
 
5772
5917
  /**
5773
5918
  * Check whether can move current snapshot with the given step
@@ -5775,13 +5920,25 @@ function addSnapshot(snapshots: Snapshots, snapshot: string, isAutoCompleteSnaps
5775
5920
  * @param step The step to check, can be positive, negative or 0
5776
5921
  * @returns True if can move current snapshot with the given step, otherwise false
5777
5922
  */
5778
- function canMoveCurrentSnapshot(snapshots: Snapshots, step: number): boolean;
5923
+ function canMoveCurrentSnapshot<T = string>(snapshots: Snapshots<T>, step: number): boolean;
5924
+
5925
+ /**
5926
+ * Clear all snapshots after the current one
5927
+ * @param snapshots The snapshots data structure to clear
5928
+ */
5929
+ function clearProceedingSnapshots(snapshots: Snapshots<string>): void;
5779
5930
 
5780
5931
  /**
5781
5932
  * Clear all snapshots after the current one
5782
5933
  * @param snapshots The snapshots data structure to clear
5783
5934
  */
5784
- function clearProceedingSnapshots(snapshots: Snapshots): void;
5935
+ function clearProceedingSnapshots<T>(snapshots: Snapshots<T>, getLength: (snapshot: T) => number): void;
5936
+
5937
+ /**
5938
+ * Clear all snapshots after the current one
5939
+ * @param snapshots The snapshots data structure to clear
5940
+ */
5941
+ function clearProceedingSnapshotsV2(snapshots: Snapshots<Snapshot>): void;
5785
5942
 
5786
5943
  /**
5787
5944
  * Move current snapshot with the given step if can move this step. Otherwise no action and return null
@@ -5789,7 +5946,7 @@ function clearProceedingSnapshots(snapshots: Snapshots): void;
5789
5946
  * @param step The step to move
5790
5947
  * @returns If can move with the given step, returns the snapshot after move, otherwise null
5791
5948
  */
5792
- function moveCurrentSnapshot(snapshots: Snapshots, step: number): string | null;
5949
+ function moveCurrentSnapshot<T = string>(snapshots: Snapshots<T>, step: number): T | null;
5793
5950
 
5794
5951
  /**
5795
5952
  * @deprecated
@@ -5801,12 +5958,12 @@ const moveCurrentSnapsnot: typeof moveCurrentSnapshot;
5801
5958
  * Create initial snapshots
5802
5959
  * @param maxSize max size of all snapshots
5803
5960
  */
5804
- function createSnapshots(maxSize: number): Snapshots;
5961
+ function createSnapshots<T = string>(maxSize: number): Snapshots<T>;
5805
5962
 
5806
5963
  /**
5807
5964
  * Whether there is a snapshot added before auto complete and it can be undone now
5808
5965
  */
5809
- function canUndoAutoComplete(snapshots: Snapshots): boolean;
5966
+ function canUndoAutoComplete<T = string>(snapshots: Snapshots<T>): boolean;
5810
5967
 
5811
5968
  /**
5812
5969
  * HTML sanitizer class provides two features:
@@ -6303,6 +6460,11 @@ class Editor implements IEditor {
6303
6460
  * @returns True if the editor is in dark mode, otherwise false
6304
6461
  */
6305
6462
  isDarkMode(): boolean;
6463
+ /**
6464
+ * Transform the given node and all its child nodes to dark mode color if editor is in dark mode
6465
+ * @param node The node to transform
6466
+ */
6467
+ transformToDarkColor(node: Node): void;
6306
6468
  /**
6307
6469
  * Make the editor in "Shadow Edit" mode.
6308
6470
  * In Shadow Edit mode, all format change will finally be ignored.
@@ -7325,6 +7487,7 @@ class TableCellSelection implements EditorPlugin {
7325
7487
  private vTable;
7326
7488
  private firstTable;
7327
7489
  private targetTable;
7490
+ private preventKeyUp;
7328
7491
  constructor();
7329
7492
  /**
7330
7493
  * Get a friendly name of this plugin