roosterjs 8.23.0 → 8.25.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.23.0)
1
+ // Type definitions for roosterjs (Version 8.25.0)
2
2
  // Generated by dts tool from roosterjs
3
3
  // Project: https://github.com/Microsoft/roosterjs
4
4
 
@@ -375,13 +375,6 @@ export function extractClipboardItems(items: DataTransferItem[], options?: Extra
375
375
  */
376
376
  export function extractClipboardItemsForIE(dataTransfer: DataTransfer, callback: (data: ClipboardData) => void, options?: ExtractClipboardItemsForIEOptions): void;
377
377
 
378
- /**
379
- * A type-safe wrapper for Array.prototype.push.apply()
380
- * @param mainArray The main array to push items into
381
- * @param itemsArray The items to push to main array
382
- */
383
- export function arrayPush<T>(mainArray: T[], itemsArray: T[]): void;
384
-
385
378
  /**
386
379
  * Browser object contains browser and operating system information of current environment
387
380
  */
@@ -528,7 +521,7 @@ export function isBlockElement(node: Node): node is HTMLElement;
528
521
  * Default value is false
529
522
  * @returns True if there isn't any visible element inside node, otherwise false
530
523
  */
531
- export function isNodeEmpty(node: Node, trimContent?: boolean): boolean;
524
+ export function isNodeEmpty(node: Node, trimContent?: boolean, shouldCountBrAsVisible?: boolean): boolean;
532
525
 
533
526
  /**
534
527
  * Check if the given node is html void element. Void element cannot have children
@@ -661,38 +654,6 @@ export function splitTextNode(textNode: Text, offset: number, returnFirstPart: b
661
654
  */
662
655
  export function normalizeRect(clientRect: DOMRect): Rect | null;
663
656
 
664
- /**
665
- * Convert a named node map to an array
666
- * @param collection The map to convert
667
- */
668
- export function toArray(collection: NamedNodeMap): Attr[];
669
-
670
- /**
671
- * Convert a named node map to an array
672
- * @param collection The map to convert
673
- */
674
- export function toArray(collection: DataTransferItemList): DataTransferItem[];
675
-
676
- /**
677
- * Convert a collection to an array
678
- * @param collection The collection to convert
679
- */
680
- export function toArray<T extends Node>(collection: NodeListOf<T>): T[];
681
-
682
- /**
683
- * Convert a collection to an array
684
- * @param collection The collection to convert
685
- */
686
- export function toArray<T extends Element>(collection: HTMLCollectionOf<T>): T[];
687
-
688
- /**
689
- * Convert an array to an array.
690
- * This is to satisfy typescript compiler. For some cases the object can be a collection at runtime,
691
- * but the declaration is an array. e.g. ClipboardData.types
692
- * @param array The array to convert
693
- */
694
- export function toArray<T>(array: readonly T[]): T[];
695
-
696
657
  /**
697
658
  * Check if the given object is instance of the target type
698
659
  * @param obj Object to check
@@ -989,9 +950,10 @@ export class VList {
989
950
  /**
990
951
  * Change list style of the given range of this list.
991
952
  * If some of the items are not real list item yet, this will make them to be list item with given style
992
- * @param targetStyle Target list style
953
+ * @param orderedStyle The style of ordered list
954
+ * @param unorderedStyle The style of unordered list
993
955
  */
994
- setListStyleType(targetStyle: NumberingListType | BulletListType | CompatibleBulletListType | CompatibleNumberingListType): void;
956
+ setListStyleType(orderedStyle?: NumberingListType | CompatibleNumberingListType, unorderedStyle?: BulletListType | CompatibleBulletListType): void;
995
957
  /**
996
958
  * Append a new item to this VList
997
959
  * @param node node of the item to append. If it is not wrapped with LI tag, it will be wrapped
@@ -1792,6 +1754,52 @@ export function setMetadata<T>(element: HTMLElement, metadata: T, def?: Definiti
1792
1754
  */
1793
1755
  export function removeMetadata(element: HTMLElement): void;
1794
1756
 
1757
+ /**
1758
+ * A type-safe wrapper for Array.prototype.push.apply()
1759
+ * @param mainArray The main array to push items into
1760
+ * @param itemsArray The items to push to main array
1761
+ */
1762
+ export function arrayPush<T>(mainArray: T[], itemsArray: T[]): void;
1763
+
1764
+ /**
1765
+ * Provide a strong-typed version of Object.keys()
1766
+ * @param obj The source object
1767
+ * @returns Array of keys
1768
+ */
1769
+ export function getObjectKeys<T extends string | number | symbol>(obj: Record<T, any> | Partial<Record<T, any>>): T[];
1770
+
1771
+ /**
1772
+ * Convert a named node map to an array
1773
+ * @param collection The map to convert
1774
+ */
1775
+ export function toArray(collection: NamedNodeMap): Attr[];
1776
+
1777
+ /**
1778
+ * Convert a named node map to an array
1779
+ * @param collection The map to convert
1780
+ */
1781
+ export function toArray(collection: DataTransferItemList): DataTransferItem[];
1782
+
1783
+ /**
1784
+ * Convert a collection to an array
1785
+ * @param collection The collection to convert
1786
+ */
1787
+ export function toArray<T extends Node>(collection: NodeListOf<T>): T[];
1788
+
1789
+ /**
1790
+ * Convert a collection to an array
1791
+ * @param collection The collection to convert
1792
+ */
1793
+ export function toArray<T extends Element>(collection: HTMLCollectionOf<T>): T[];
1794
+
1795
+ /**
1796
+ * Convert an array to an array.
1797
+ * This is to satisfy typescript compiler. For some cases the object can be a collection at runtime,
1798
+ * but the declaration is an array. e.g. ClipboardData.types
1799
+ * @param array The array to convert
1800
+ */
1801
+ export function toArray<T>(array: readonly T[]): T[];
1802
+
1795
1803
  /**
1796
1804
  * RoosterJs core editor class
1797
1805
  */
@@ -2544,9 +2552,10 @@ export function applyCellShading(editor: IEditor, color: string | ModeIndependen
2544
2552
  * @param listType The list type to toggle
2545
2553
  * @param startNumber (Optional) Start number of the list
2546
2554
  * @param includeSiblingLists Sets wether the operation should include Sibling Lists, by default true
2547
- * @param listStyle (Optional) the style of an ordered or unordered list. If If not defined, the style will be set to disc or decimal.
2555
+ * @param orderedStyle (Optional) the style of an ordered. If not defined, the style will be set to decimal.
2556
+ * @param unorderedStyle (Optional) the style of an unordered list. If not defined, the style will be set to disc.
2548
2557
  */
2549
- export function toggleListType(editor: IEditor, listType: ListType | CompatibleListType, startNumber?: number, includeSiblingLists?: boolean, listStyle?: BulletListType | NumberingListType | CompatibleBulletListType | CompatibleNumberingListType): void;
2558
+ export function toggleListType(editor: IEditor, listType: ListType | CompatibleListType, startNumber?: number, includeSiblingLists?: boolean, orderedStyle?: NumberingListType | CompatibleNumberingListType, unorderedStyle?: BulletListType | CompatibleBulletListType): void;
2550
2559
 
2551
2560
  /**
2552
2561
  * Split selection into regions, and perform a block-wise formatting action for each region.
@@ -3474,6 +3483,7 @@ export const enum ExperimentalFeatures {
3474
3483
  */
3475
3484
  AutoFormatList = "AutoFormatList",
3476
3485
  /**
3486
+ * @deprecated this feature is always disabled
3477
3487
  * Automatically transform -- into hyphen, if typed between two words.
3478
3488
  */
3479
3489
  AutoHyphen = "AutoHyphen"
@@ -4032,116 +4042,136 @@ export const enum SelectionRangeTypes {
4032
4042
  * Enum used to control the different types of numbering list
4033
4043
  */
4034
4044
  export const enum NumberingListType {
4045
+ /**
4046
+ * Minimum value of the enum
4047
+ */
4048
+ Min = 1,
4035
4049
  /**
4036
4050
  * Numbering triggered by 1.
4037
4051
  */
4038
- Decimal = 0,
4052
+ Decimal = 1,
4039
4053
  /**
4040
4054
  * Numbering triggered by 1-
4041
4055
  */
4042
- DecimalDash = 1,
4056
+ DecimalDash = 2,
4043
4057
  /**
4044
4058
  * Numbering triggered by 1)
4045
4059
  */
4046
- DecimalParenthesis = 2,
4060
+ DecimalParenthesis = 3,
4047
4061
  /**
4048
4062
  * Numbering triggered by (1)
4049
4063
  */
4050
- DecimalDoubleParenthesis = 3,
4064
+ DecimalDoubleParenthesis = 4,
4051
4065
  /**
4052
4066
  * Numbering triggered by a.
4053
4067
  */
4054
- LowerAlpha = 4,
4068
+ LowerAlpha = 5,
4055
4069
  /**
4056
4070
  * Numbering triggered by a)
4057
4071
  */
4058
- LowerAlphaParenthesis = 5,
4072
+ LowerAlphaParenthesis = 6,
4059
4073
  /**
4060
4074
  * Numbering triggered by (a)
4061
4075
  */
4062
- LowerAlphaDoubleParenthesis = 6,
4076
+ LowerAlphaDoubleParenthesis = 7,
4063
4077
  /**
4064
4078
  * Numbering triggered by a-
4065
4079
  */
4066
- LowerAlphaDash = 7,
4080
+ LowerAlphaDash = 8,
4067
4081
  /**
4068
4082
  * Numbering triggered by A.
4069
4083
  */
4070
- UpperAlpha = 8,
4084
+ UpperAlpha = 9,
4071
4085
  /**
4072
4086
  * Numbering triggered by A)
4073
4087
  */
4074
- UpperAlphaParenthesis = 9,
4088
+ UpperAlphaParenthesis = 10,
4075
4089
  /**
4076
4090
  * Numbering triggered by (A)
4077
4091
  */
4078
- UpperAlphaDoubleParenthesis = 10,
4092
+ UpperAlphaDoubleParenthesis = 11,
4079
4093
  /**
4080
4094
  * Numbering triggered by A-
4081
4095
  */
4082
- UpperAlphaDash = 11,
4096
+ UpperAlphaDash = 12,
4083
4097
  /**
4084
4098
  * Numbering triggered by i.
4085
4099
  */
4086
- LowerRoman = 12,
4100
+ LowerRoman = 13,
4087
4101
  /**
4088
4102
  * Numbering triggered by i)
4089
4103
  */
4090
- LowerRomanParenthesis = 13,
4104
+ LowerRomanParenthesis = 14,
4091
4105
  /**
4092
4106
  * Numbering triggered by (i)
4093
4107
  */
4094
- LowerRomanDoubleParenthesis = 14,
4108
+ LowerRomanDoubleParenthesis = 15,
4095
4109
  /**
4096
4110
  * Numbering triggered by i-
4097
4111
  */
4098
- LowerRomanDash = 15,
4112
+ LowerRomanDash = 16,
4099
4113
  /**
4100
4114
  * Numbering triggered by I.
4101
4115
  */
4102
- UpperRoman = 16,
4116
+ UpperRoman = 17,
4103
4117
  /**
4104
4118
  * Numbering triggered by I)
4105
4119
  */
4106
- UpperRomanParenthesis = 17,
4120
+ UpperRomanParenthesis = 18,
4107
4121
  /**
4108
4122
  * Numbering triggered by (I)
4109
4123
  */
4110
- UpperRomanDoubleParenthesis = 18,
4124
+ UpperRomanDoubleParenthesis = 19,
4111
4125
  /**
4112
4126
  * Numbering triggered by I-
4113
4127
  */
4114
- UpperRomanDash = 19
4128
+ UpperRomanDash = 20,
4129
+ /**
4130
+ * Maximum value of the enum
4131
+ */
4132
+ Max = 20
4115
4133
  }
4116
4134
 
4117
4135
  /**
4118
4136
  * Enum used to control the different types of bullet list
4119
4137
  */
4120
4138
  export const enum BulletListType {
4139
+ /**
4140
+ * Minimum value of the enum
4141
+ */
4142
+ Min = 1,
4121
4143
  /**
4122
4144
  * Bullet triggered by *
4123
4145
  */
4124
- Disc = 0,
4146
+ Disc = 1,
4125
4147
  /**
4126
4148
  * Bullet triggered by -
4127
4149
  */
4128
- Dash = 1,
4150
+ Dash = 2,
4129
4151
  /**
4130
4152
  * Bullet triggered by --
4131
4153
  */
4132
- Square = 2,
4154
+ Square = 3,
4133
4155
  /**
4134
4156
  * Bullet triggered by >
4135
4157
  */
4136
- ShortArrow = 3,
4158
+ ShortArrow = 4,
4137
4159
  /**
4138
4160
  * Bullet triggered by -> or -->
4139
4161
  */
4140
- LongArrow = 4,
4162
+ LongArrow = 5,
4141
4163
  /**
4142
4164
  * Bullet triggered by =>
4143
4165
  */
4144
- UnfilledArrow = 5
4166
+ UnfilledArrow = 6,
4167
+ /**
4168
+ * Bullet triggered by —
4169
+ */
4170
+ Hyphen = 7,
4171
+ /**
4172
+ * Maximum value of the enum
4173
+ */
4174
+ Max = 7
4145
4175
  }
4146
4176
 
4147
4177
  /**
@@ -6725,6 +6755,16 @@ export interface ListFeatureSettings {
6725
6755
  * When delete key is pressed before the first item, indent the correct list of numbers
6726
6756
  */
6727
6757
  maintainListChainWhenDelete: boolean;
6758
+ /**
6759
+ * When press space after *, -, --, ->, -->, >, => in an empty line, toggle bullet
6760
+ * @default true
6761
+ */
6762
+ autoBulletList: boolean;
6763
+ /**
6764
+ * When press space after an number, a letter or roman number followed by ), ., -, or between parenthesis in an empty line, toggle numbering
6765
+ * @default true
6766
+ */
6767
+ autoNumberingList: boolean;
6728
6768
  }
6729
6769
 
6730
6770
  /**
@@ -6832,6 +6872,7 @@ export interface TextFeatureSettings {
6832
6872
  */
6833
6873
  outdentWhenTabText: boolean;
6834
6874
  /**
6875
+ * @deprecated
6835
6876
  * Requires @see ExperimentalFeatures.AutoHyphen to be enabled
6836
6877
  * Automatically transform -- into hyphen, if typed between two words.
6837
6878
  */
@@ -7035,7 +7076,7 @@ export interface ImageEditOptions {
7035
7076
  * Color of resize/rotate border, handle and icon
7036
7077
  * @default #DB626C
7037
7078
  */
7038
- borderColor?: string;
7079
+ borderColor?: string | ModeIndependentColor;
7039
7080
  /**
7040
7081
  * Minimum resize/crop width
7041
7082
  * @default 10
@@ -7424,6 +7465,7 @@ export enum CompatibleExperimentalFeatures {
7424
7465
  */
7425
7466
  AutoFormatList = "AutoFormatList",
7426
7467
  /**
7468
+ * @deprecated this feature is always disabled
7427
7469
  * Automatically transform -- into hyphen, if typed between two words.
7428
7470
  */
7429
7471
  AutoHyphen = "AutoHyphen"
@@ -7889,30 +7931,42 @@ export enum CompatibleAlignment {
7889
7931
  * Enum used to control the different types of bullet list
7890
7932
  */
7891
7933
  export enum CompatibleBulletListType {
7934
+ /**
7935
+ * Minimum value of the enum
7936
+ */
7937
+ Min = 1,
7892
7938
  /**
7893
7939
  * Bullet triggered by *
7894
7940
  */
7895
- Disc = 0,
7941
+ Disc = 1,
7896
7942
  /**
7897
7943
  * Bullet triggered by -
7898
7944
  */
7899
- Dash = 1,
7945
+ Dash = 2,
7900
7946
  /**
7901
7947
  * Bullet triggered by --
7902
7948
  */
7903
- Square = 2,
7949
+ Square = 3,
7904
7950
  /**
7905
7951
  * Bullet triggered by >
7906
7952
  */
7907
- ShortArrow = 3,
7953
+ ShortArrow = 4,
7908
7954
  /**
7909
7955
  * Bullet triggered by -> or -->
7910
7956
  */
7911
- LongArrow = 4,
7957
+ LongArrow = 5,
7912
7958
  /**
7913
7959
  * Bullet triggered by =>
7914
7960
  */
7915
- UnfilledArrow = 5
7961
+ UnfilledArrow = 6,
7962
+ /**
7963
+ * Bullet triggered by —
7964
+ */
7965
+ Hyphen = 7,
7966
+ /**
7967
+ * Maximum value of the enum
7968
+ */
7969
+ Max = 7
7916
7970
  }
7917
7971
 
7918
7972
  /**
@@ -8523,86 +8577,94 @@ export enum CompatibleNodeType {
8523
8577
  * Enum used to control the different types of numbering list
8524
8578
  */
8525
8579
  export enum CompatibleNumberingListType {
8580
+ /**
8581
+ * Minimum value of the enum
8582
+ */
8583
+ Min = 1,
8526
8584
  /**
8527
8585
  * Numbering triggered by 1.
8528
8586
  */
8529
- Decimal = 0,
8587
+ Decimal = 1,
8530
8588
  /**
8531
8589
  * Numbering triggered by 1-
8532
8590
  */
8533
- DecimalDash = 1,
8591
+ DecimalDash = 2,
8534
8592
  /**
8535
8593
  * Numbering triggered by 1)
8536
8594
  */
8537
- DecimalParenthesis = 2,
8595
+ DecimalParenthesis = 3,
8538
8596
  /**
8539
8597
  * Numbering triggered by (1)
8540
8598
  */
8541
- DecimalDoubleParenthesis = 3,
8599
+ DecimalDoubleParenthesis = 4,
8542
8600
  /**
8543
8601
  * Numbering triggered by a.
8544
8602
  */
8545
- LowerAlpha = 4,
8603
+ LowerAlpha = 5,
8546
8604
  /**
8547
8605
  * Numbering triggered by a)
8548
8606
  */
8549
- LowerAlphaParenthesis = 5,
8607
+ LowerAlphaParenthesis = 6,
8550
8608
  /**
8551
8609
  * Numbering triggered by (a)
8552
8610
  */
8553
- LowerAlphaDoubleParenthesis = 6,
8611
+ LowerAlphaDoubleParenthesis = 7,
8554
8612
  /**
8555
8613
  * Numbering triggered by a-
8556
8614
  */
8557
- LowerAlphaDash = 7,
8615
+ LowerAlphaDash = 8,
8558
8616
  /**
8559
8617
  * Numbering triggered by A.
8560
8618
  */
8561
- UpperAlpha = 8,
8619
+ UpperAlpha = 9,
8562
8620
  /**
8563
8621
  * Numbering triggered by A)
8564
8622
  */
8565
- UpperAlphaParenthesis = 9,
8623
+ UpperAlphaParenthesis = 10,
8566
8624
  /**
8567
8625
  * Numbering triggered by (A)
8568
8626
  */
8569
- UpperAlphaDoubleParenthesis = 10,
8627
+ UpperAlphaDoubleParenthesis = 11,
8570
8628
  /**
8571
8629
  * Numbering triggered by A-
8572
8630
  */
8573
- UpperAlphaDash = 11,
8631
+ UpperAlphaDash = 12,
8574
8632
  /**
8575
8633
  * Numbering triggered by i.
8576
8634
  */
8577
- LowerRoman = 12,
8635
+ LowerRoman = 13,
8578
8636
  /**
8579
8637
  * Numbering triggered by i)
8580
8638
  */
8581
- LowerRomanParenthesis = 13,
8639
+ LowerRomanParenthesis = 14,
8582
8640
  /**
8583
8641
  * Numbering triggered by (i)
8584
8642
  */
8585
- LowerRomanDoubleParenthesis = 14,
8643
+ LowerRomanDoubleParenthesis = 15,
8586
8644
  /**
8587
8645
  * Numbering triggered by i-
8588
8646
  */
8589
- LowerRomanDash = 15,
8647
+ LowerRomanDash = 16,
8590
8648
  /**
8591
8649
  * Numbering triggered by I.
8592
8650
  */
8593
- UpperRoman = 16,
8651
+ UpperRoman = 17,
8594
8652
  /**
8595
8653
  * Numbering triggered by I)
8596
8654
  */
8597
- UpperRomanParenthesis = 17,
8655
+ UpperRomanParenthesis = 18,
8598
8656
  /**
8599
8657
  * Numbering triggered by (I)
8600
8658
  */
8601
- UpperRomanDoubleParenthesis = 18,
8659
+ UpperRomanDoubleParenthesis = 19,
8602
8660
  /**
8603
8661
  * Numbering triggered by I-
8604
8662
  */
8605
- UpperRomanDash = 19
8663
+ UpperRomanDash = 20,
8664
+ /**
8665
+ * Maximum value of the enum
8666
+ */
8667
+ Max = 20
8606
8668
  }
8607
8669
 
8608
8670
  /**
@@ -9387,3 +9449,29 @@ export class TableCellSelection implements EditorPlugin {
9387
9449
  selectTable(): void;
9388
9450
  }
9389
9451
 
9452
+ /**
9453
+ * Automatically transform -- into hyphen, if typed between two words.
9454
+ */
9455
+ export class AutoFormat implements EditorPlugin {
9456
+ private editor;
9457
+ private lastKeyTyped;
9458
+ /**
9459
+ * Get a friendly name of this plugin
9460
+ */
9461
+ getName(): string;
9462
+ /**
9463
+ * Initialize this plugin
9464
+ * @param editor The editor instance
9465
+ */
9466
+ initialize(editor: IEditor): void;
9467
+ /**
9468
+ * Dispose this plugin
9469
+ */
9470
+ dispose(): void;
9471
+ /**
9472
+ * Handle events triggered from editor
9473
+ * @param event PluginEvent object
9474
+ */
9475
+ onPluginEvent(event: PluginEvent): void;
9476
+ }
9477
+