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