roosterjs 8.24.0 → 8.26.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.
@@ -1,4 +1,4 @@
1
- // Type definitions for roosterjs (Version 8.24.0)
1
+ // Type definitions for roosterjs (Version 8.26.1)
2
2
  // Generated by dts tool from roosterjs
3
3
  // Project: https://github.com/Microsoft/roosterjs
4
4
 
@@ -337,6 +337,7 @@ export function applyTextStyle(container: Node, styler: (node: HTMLElement, isIn
337
337
  * @param event The paste event
338
338
  * @param callback Callback function when data is ready
339
339
  * @param options Options to retrieve more items from the event, including HTML string and other customized items
340
+ * @param rangeBeforePaste Optional range to be removed when pasting in Android
340
341
  * @returns An object with the following properties:
341
342
  * types: Available types from the clipboard event
342
343
  * text: Plain text from the clipboard event
@@ -345,7 +346,7 @@ export function applyTextStyle(container: Node, styler: (node: HTMLElement, isIn
345
346
  * When set to undefined, it means can't retrieve HTML string, there may be HTML string but direct retrieving is
346
347
  * not supported by browser.
347
348
  */
348
- export function extractClipboardEvent(event: ClipboardEvent, callback: (clipboardData: ClipboardData) => void, options?: ExtractClipboardEventOption): void;
349
+ export function extractClipboardEvent(event: ClipboardEvent, callback: (clipboardData: ClipboardData) => void, options?: ExtractClipboardEventOption, rangeBeforePaste?: Range): void;
349
350
 
350
351
  /**
351
352
  * Extract clipboard items to be a ClipboardData object for IE
@@ -375,13 +376,6 @@ export function extractClipboardItems(items: DataTransferItem[], options?: Extra
375
376
  */
376
377
  export function extractClipboardItemsForIE(dataTransfer: DataTransfer, callback: (data: ClipboardData) => void, options?: ExtractClipboardItemsForIEOptions): void;
377
378
 
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
379
  /**
386
380
  * Browser object contains browser and operating system information of current environment
387
381
  */
@@ -528,7 +522,7 @@ export function isBlockElement(node: Node): node is HTMLElement;
528
522
  * Default value is false
529
523
  * @returns True if there isn't any visible element inside node, otherwise false
530
524
  */
531
- export function isNodeEmpty(node: Node, trimContent?: boolean): boolean;
525
+ export function isNodeEmpty(node: Node, trimContent?: boolean, shouldCountBrAsVisible?: boolean): boolean;
532
526
 
533
527
  /**
534
528
  * Check if the given node is html void element. Void element cannot have children
@@ -661,38 +655,6 @@ export function splitTextNode(textNode: Text, offset: number, returnFirstPart: b
661
655
  */
662
656
  export function normalizeRect(clientRect: DOMRect): Rect | null;
663
657
 
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
658
  /**
697
659
  * Check if the given object is instance of the target type
698
660
  * @param obj Object to check
@@ -989,9 +951,10 @@ export class VList {
989
951
  /**
990
952
  * Change list style of the given range of this list.
991
953
  * 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
954
+ * @param orderedStyle The style of ordered list
955
+ * @param unorderedStyle The style of unordered list
993
956
  */
994
- setListStyleType(targetStyle: NumberingListType | BulletListType | CompatibleBulletListType | CompatibleNumberingListType): void;
957
+ setListStyleType(orderedStyle?: NumberingListType | CompatibleNumberingListType, unorderedStyle?: BulletListType | CompatibleBulletListType): void;
995
958
  /**
996
959
  * Append a new item to this VList
997
960
  * @param node node of the item to append. If it is not wrapped with LI tag, it will be wrapped
@@ -1792,6 +1755,52 @@ export function setMetadata<T>(element: HTMLElement, metadata: T, def?: Definiti
1792
1755
  */
1793
1756
  export function removeMetadata(element: HTMLElement): void;
1794
1757
 
1758
+ /**
1759
+ * A type-safe wrapper for Array.prototype.push.apply()
1760
+ * @param mainArray The main array to push items into
1761
+ * @param itemsArray The items to push to main array
1762
+ */
1763
+ export function arrayPush<T>(mainArray: T[], itemsArray: T[]): void;
1764
+
1765
+ /**
1766
+ * Provide a strong-typed version of Object.keys()
1767
+ * @param obj The source object
1768
+ * @returns Array of keys
1769
+ */
1770
+ export function getObjectKeys<T extends string | number | symbol>(obj: Record<T, any> | Partial<Record<T, any>>): T[];
1771
+
1772
+ /**
1773
+ * Convert a named node map to an array
1774
+ * @param collection The map to convert
1775
+ */
1776
+ export function toArray(collection: NamedNodeMap): Attr[];
1777
+
1778
+ /**
1779
+ * Convert a named node map to an array
1780
+ * @param collection The map to convert
1781
+ */
1782
+ export function toArray(collection: DataTransferItemList): DataTransferItem[];
1783
+
1784
+ /**
1785
+ * Convert a collection to an array
1786
+ * @param collection The collection to convert
1787
+ */
1788
+ export function toArray<T extends Node>(collection: NodeListOf<T>): T[];
1789
+
1790
+ /**
1791
+ * Convert a collection to an array
1792
+ * @param collection The collection to convert
1793
+ */
1794
+ export function toArray<T extends Element>(collection: HTMLCollectionOf<T>): T[];
1795
+
1796
+ /**
1797
+ * Convert an array to an array.
1798
+ * This is to satisfy typescript compiler. For some cases the object can be a collection at runtime,
1799
+ * but the declaration is an array. e.g. ClipboardData.types
1800
+ * @param array The array to convert
1801
+ */
1802
+ export function toArray<T>(array: readonly T[]): T[];
1803
+
1795
1804
  /**
1796
1805
  * RoosterJs core editor class
1797
1806
  */
@@ -2544,14 +2553,15 @@ export function applyCellShading(editor: IEditor, color: string | ModeIndependen
2544
2553
  * @param listType The list type to toggle
2545
2554
  * @param startNumber (Optional) Start number of the list
2546
2555
  * @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.
2556
+ * @param orderedStyle (Optional) the style of an ordered. If not defined, the style will be set to decimal.
2557
+ * @param unorderedStyle (Optional) the style of an unordered list. If not defined, the style will be set to disc.
2548
2558
  */
2549
- export function toggleListType(editor: IEditor, listType: ListType | CompatibleListType, startNumber?: number, includeSiblingLists?: boolean, listStyle?: BulletListType | NumberingListType | CompatibleBulletListType | CompatibleNumberingListType): void;
2559
+ export function toggleListType(editor: IEditor, listType: ListType | CompatibleListType, startNumber?: number, includeSiblingLists?: boolean, orderedStyle?: NumberingListType | CompatibleNumberingListType, unorderedStyle?: BulletListType | CompatibleBulletListType): void;
2550
2560
 
2551
2561
  /**
2552
2562
  * Split selection into regions, and perform a block-wise formatting action for each region.
2553
2563
  */
2554
- export function blockFormat(editor: IEditor, callback: (region: Region, start: NodePosition, end: NodePosition, chains: VListChain[]) => void, beforeRunCallback?: () => boolean): void;
2564
+ export function blockFormat(editor: IEditor, callback: (region: Region, start: NodePosition, end: NodePosition, chains: VListChain[]) => void, beforeRunCallback?: () => boolean, apiName?: string): void;
2555
2565
 
2556
2566
  /**
2557
2567
  * Commit changes of all list changes when experiment features are allowed
@@ -4033,116 +4043,136 @@ export const enum SelectionRangeTypes {
4033
4043
  * Enum used to control the different types of numbering list
4034
4044
  */
4035
4045
  export const enum NumberingListType {
4046
+ /**
4047
+ * Minimum value of the enum
4048
+ */
4049
+ Min = 1,
4036
4050
  /**
4037
4051
  * Numbering triggered by 1.
4038
4052
  */
4039
- Decimal = 0,
4053
+ Decimal = 1,
4040
4054
  /**
4041
4055
  * Numbering triggered by 1-
4042
4056
  */
4043
- DecimalDash = 1,
4057
+ DecimalDash = 2,
4044
4058
  /**
4045
4059
  * Numbering triggered by 1)
4046
4060
  */
4047
- DecimalParenthesis = 2,
4061
+ DecimalParenthesis = 3,
4048
4062
  /**
4049
4063
  * Numbering triggered by (1)
4050
4064
  */
4051
- DecimalDoubleParenthesis = 3,
4065
+ DecimalDoubleParenthesis = 4,
4052
4066
  /**
4053
4067
  * Numbering triggered by a.
4054
4068
  */
4055
- LowerAlpha = 4,
4069
+ LowerAlpha = 5,
4056
4070
  /**
4057
4071
  * Numbering triggered by a)
4058
4072
  */
4059
- LowerAlphaParenthesis = 5,
4073
+ LowerAlphaParenthesis = 6,
4060
4074
  /**
4061
4075
  * Numbering triggered by (a)
4062
4076
  */
4063
- LowerAlphaDoubleParenthesis = 6,
4077
+ LowerAlphaDoubleParenthesis = 7,
4064
4078
  /**
4065
4079
  * Numbering triggered by a-
4066
4080
  */
4067
- LowerAlphaDash = 7,
4081
+ LowerAlphaDash = 8,
4068
4082
  /**
4069
4083
  * Numbering triggered by A.
4070
4084
  */
4071
- UpperAlpha = 8,
4085
+ UpperAlpha = 9,
4072
4086
  /**
4073
4087
  * Numbering triggered by A)
4074
4088
  */
4075
- UpperAlphaParenthesis = 9,
4089
+ UpperAlphaParenthesis = 10,
4076
4090
  /**
4077
4091
  * Numbering triggered by (A)
4078
4092
  */
4079
- UpperAlphaDoubleParenthesis = 10,
4093
+ UpperAlphaDoubleParenthesis = 11,
4080
4094
  /**
4081
4095
  * Numbering triggered by A-
4082
4096
  */
4083
- UpperAlphaDash = 11,
4097
+ UpperAlphaDash = 12,
4084
4098
  /**
4085
4099
  * Numbering triggered by i.
4086
4100
  */
4087
- LowerRoman = 12,
4101
+ LowerRoman = 13,
4088
4102
  /**
4089
4103
  * Numbering triggered by i)
4090
4104
  */
4091
- LowerRomanParenthesis = 13,
4105
+ LowerRomanParenthesis = 14,
4092
4106
  /**
4093
4107
  * Numbering triggered by (i)
4094
4108
  */
4095
- LowerRomanDoubleParenthesis = 14,
4109
+ LowerRomanDoubleParenthesis = 15,
4096
4110
  /**
4097
4111
  * Numbering triggered by i-
4098
4112
  */
4099
- LowerRomanDash = 15,
4113
+ LowerRomanDash = 16,
4100
4114
  /**
4101
4115
  * Numbering triggered by I.
4102
4116
  */
4103
- UpperRoman = 16,
4117
+ UpperRoman = 17,
4104
4118
  /**
4105
4119
  * Numbering triggered by I)
4106
4120
  */
4107
- UpperRomanParenthesis = 17,
4121
+ UpperRomanParenthesis = 18,
4108
4122
  /**
4109
4123
  * Numbering triggered by (I)
4110
4124
  */
4111
- UpperRomanDoubleParenthesis = 18,
4125
+ UpperRomanDoubleParenthesis = 19,
4112
4126
  /**
4113
4127
  * Numbering triggered by I-
4114
4128
  */
4115
- UpperRomanDash = 19
4129
+ UpperRomanDash = 20,
4130
+ /**
4131
+ * Maximum value of the enum
4132
+ */
4133
+ Max = 20
4116
4134
  }
4117
4135
 
4118
4136
  /**
4119
4137
  * Enum used to control the different types of bullet list
4120
4138
  */
4121
4139
  export const enum BulletListType {
4140
+ /**
4141
+ * Minimum value of the enum
4142
+ */
4143
+ Min = 1,
4122
4144
  /**
4123
4145
  * Bullet triggered by *
4124
4146
  */
4125
- Disc = 0,
4147
+ Disc = 1,
4126
4148
  /**
4127
4149
  * Bullet triggered by -
4128
4150
  */
4129
- Dash = 1,
4151
+ Dash = 2,
4130
4152
  /**
4131
4153
  * Bullet triggered by --
4132
4154
  */
4133
- Square = 2,
4155
+ Square = 3,
4134
4156
  /**
4135
4157
  * Bullet triggered by >
4136
4158
  */
4137
- ShortArrow = 3,
4159
+ ShortArrow = 4,
4138
4160
  /**
4139
4161
  * Bullet triggered by -> or -->
4140
4162
  */
4141
- LongArrow = 4,
4163
+ LongArrow = 5,
4142
4164
  /**
4143
4165
  * Bullet triggered by =>
4144
4166
  */
4145
- UnfilledArrow = 5
4167
+ UnfilledArrow = 6,
4168
+ /**
4169
+ * Bullet triggered by —
4170
+ */
4171
+ Hyphen = 7,
4172
+ /**
4173
+ * Maximum value of the enum
4174
+ */
4175
+ Max = 7
4146
4176
  }
4147
4177
 
4148
4178
  /**
@@ -4178,7 +4208,13 @@ export const enum DefinitionType {
4178
4208
  /**
4179
4209
  * Provides a chance for plugin to change the content before it is copied from editor.
4180
4210
  */
4181
- export interface BeforeCutCopyEvent extends BasePluginEvent<PluginEventType.BeforeCutCopy> {
4211
+ export interface BeforeCutCopyEvent extends BeforeCutCopyEventData, BasePluginEvent<PluginEventType.BeforeCutCopy> {
4212
+ }
4213
+
4214
+ /**
4215
+ * Data of BeforeCutCopyEvent
4216
+ */
4217
+ export interface BeforeCutCopyEventData {
4182
4218
  /**
4183
4219
  * Raw DOM event
4184
4220
  */
@@ -4197,6 +4233,12 @@ export interface BeforeCutCopyEvent extends BasePluginEvent<PluginEventType.Befo
4197
4233
  isCut: boolean;
4198
4234
  }
4199
4235
 
4236
+ /**
4237
+ * Provides a chance for plugin to change the content before it is copied from editor.
4238
+ */
4239
+ export interface CompatibleBeforeCutCopyEvent extends BeforeCutCopyEventData, BasePluginEvent<CompatiblePluginEventType.BeforeCutCopy> {
4240
+ }
4241
+
4200
4242
  /**
4201
4243
  * Editor plugin event interface
4202
4244
  */
@@ -4224,7 +4266,19 @@ export interface BeforeDisposeEvent extends BasePluginEvent<PluginEventType.Befo
4224
4266
  /**
4225
4267
  * Provides a chance for plugin to change the content before it is pasted into editor.
4226
4268
  */
4227
- export interface BeforePasteEvent extends BasePluginEvent<PluginEventType.BeforePaste> {
4269
+ export interface CompatibleBeforeDisposeEvent extends BasePluginEvent<CompatiblePluginEventType.BeforeDispose> {
4270
+ }
4271
+
4272
+ /**
4273
+ * Provides a chance for plugin to change the content before it is pasted into editor.
4274
+ */
4275
+ export interface BeforePasteEvent extends BeforePasteEventData, BasePluginEvent<PluginEventType.BeforePaste> {
4276
+ }
4277
+
4278
+ /**
4279
+ * Data of BeforePasteEvent
4280
+ */
4281
+ export interface BeforePasteEventData {
4228
4282
  /**
4229
4283
  * An object contains all related data for pasting
4230
4284
  */
@@ -4251,21 +4305,46 @@ export interface BeforePasteEvent extends BasePluginEvent<PluginEventType.Before
4251
4305
  htmlAttributes: Record<string, string>;
4252
4306
  }
4253
4307
 
4308
+ /**
4309
+ * Provides a chance for plugin to change the content before it is pasted into editor.
4310
+ */
4311
+ export interface CompatibleBeforePasteEvent extends BeforePasteEventData, BasePluginEvent<CompatiblePluginEventType.BeforePaste> {
4312
+ }
4313
+
4254
4314
  /**
4255
4315
  * The event to be triggered before SetContent API is called.
4256
4316
  * Handle this event to cache anything you need from editor before it is gone.
4257
4317
  */
4258
- export interface BeforeSetContentEvent extends BasePluginEvent<PluginEventType.BeforeSetContent> {
4318
+ export interface BeforeSetContentEvent extends BeforeSetContentEventData, BasePluginEvent<PluginEventType.BeforeSetContent> {
4319
+ }
4320
+
4321
+ /**
4322
+ * Data of BeforeSetContentEvent
4323
+ */
4324
+ export interface BeforeSetContentEventData {
4259
4325
  /**
4260
4326
  * New content HTML that is about to set to editor
4261
4327
  */
4262
4328
  newContent: string;
4263
4329
  }
4264
4330
 
4331
+ /**
4332
+ * The event to be triggered before SetContent API is called.
4333
+ * Handle this event to cache anything you need from editor before it is gone.
4334
+ */
4335
+ export interface CompatibleBeforeSetContentEvent extends BeforeSetContentEventData, BasePluginEvent<CompatiblePluginEventType.BeforeSetContent> {
4336
+ }
4337
+
4265
4338
  /**
4266
4339
  * Represents a change to the editor made by another plugin
4267
4340
  */
4268
- export interface ContentChangedEvent extends BasePluginEvent<PluginEventType.ContentChanged> {
4341
+ export interface ContentChangedEvent extends ContentChangedEventData, BasePluginEvent<PluginEventType.ContentChanged> {
4342
+ }
4343
+
4344
+ /**
4345
+ * Data of ContentChangedEvent
4346
+ */
4347
+ export interface ContentChangedEventData {
4269
4348
  /**
4270
4349
  * Source of the change
4271
4350
  */
@@ -4274,13 +4353,26 @@ export interface ContentChangedEvent extends BasePluginEvent<PluginEventType.Con
4274
4353
  * Optional related data
4275
4354
  */
4276
4355
  data?: any;
4356
+ additionalData?: ContentChangedData;
4357
+ }
4358
+
4359
+ /**
4360
+ * Represents a change to the editor made by another plugin
4361
+ */
4362
+ export interface CompatibleContentChangedEvent extends ContentChangedEventData, BasePluginEvent<CompatiblePluginEventType.ContentChanged> {
4277
4363
  }
4278
4364
 
4279
4365
  /**
4280
4366
  * Represents an event that will be fired when an inline image is edited by user, and the src
4281
4367
  * attribute of the image is about to be changed
4282
4368
  */
4283
- export interface EditImageEvent extends BasePluginEvent<PluginEventType.EditImage> {
4369
+ export interface EditImageEvent extends EditImageEventData, BasePluginEvent<PluginEventType.EditImage> {
4370
+ }
4371
+
4372
+ /**
4373
+ * Data of EditImageEvent
4374
+ */
4375
+ export interface EditImageEventData {
4284
4376
  /**
4285
4377
  * The image element that is being changed
4286
4378
  */
@@ -4301,17 +4393,36 @@ export interface EditImageEvent extends BasePluginEvent<PluginEventType.EditImag
4301
4393
  newSrc: string;
4302
4394
  }
4303
4395
 
4396
+ /**
4397
+ * Represents an event that will be fired when an inline image is edited by user, and the src
4398
+ * attribute of the image is about to be changed
4399
+ */
4400
+ export interface CompatibleEditImageEvent extends EditImageEventData, BasePluginEvent<CompatiblePluginEventType.EditImage> {
4401
+ }
4402
+
4304
4403
  /**
4305
4404
  * Provides a chance for plugin to change the content before it is pasted into editor.
4306
4405
  */
4307
4406
  export interface EditorReadyEvent extends BasePluginEvent<PluginEventType.EditorReady> {
4308
4407
  }
4309
4408
 
4409
+ /**
4410
+ * Provides a chance for plugin to change the content before it is pasted into editor.
4411
+ */
4412
+ export interface CompatibleEditorReadyEvent extends BasePluginEvent<CompatiblePluginEventType.EditorReady> {
4413
+ }
4414
+
4310
4415
  /**
4311
4416
  * Provide a chance for plugins to handle entity related events.
4312
4417
  * See enum EntityOperation for more details about each operation
4313
4418
  */
4314
- export interface EntityOperationEvent extends BasePluginEvent<PluginEventType.EntityOperation> {
4419
+ export interface EntityOperationEvent extends EntityOperationEventData, BasePluginEvent<PluginEventType.EntityOperation> {
4420
+ }
4421
+
4422
+ /**
4423
+ * Data of EntityOperationEvent
4424
+ */
4425
+ export interface EntityOperationEventData {
4315
4426
  /**
4316
4427
  * Operation to this entity
4317
4428
  */
@@ -4338,13 +4449,26 @@ export interface EntityOperationEvent extends BasePluginEvent<PluginEventType.En
4338
4449
  contentForShadowEntity?: DocumentFragment;
4339
4450
  }
4340
4451
 
4452
+ /**
4453
+ * Provide a chance for plugins to handle entity related events.
4454
+ * See enum EntityOperation for more details about each operation
4455
+ */
4456
+ export interface CompatibleEntityOperationEvent extends EntityOperationEventData, BasePluginEvent<CompatiblePluginEventType.EntityOperation> {
4457
+ }
4458
+
4341
4459
  /**
4342
4460
  * Extract Content with a DOM tree event
4343
4461
  * This event is triggered when getContent() is called with triggerExtractContentEvent = true
4344
4462
  * Plugin can handle this event to remove the UI only markups to return clean HTML
4345
4463
  * by operating on a cloned DOM tree
4346
4464
  */
4347
- export interface ExtractContentWithDomEvent extends BasePluginEvent<PluginEventType.ExtractContentWithDom> {
4465
+ export interface ExtractContentWithDomEvent extends ExtractContentWithDomEventData, BasePluginEvent<PluginEventType.ExtractContentWithDom> {
4466
+ }
4467
+
4468
+ /**
4469
+ * Data of ExtractContentWithDomEvent
4470
+ */
4471
+ export interface ExtractContentWithDomEventData {
4348
4472
  /**
4349
4473
  * Cloned root element of editor
4350
4474
  * Plugin can change this DOM tree to clean up the markups it added before
@@ -4352,6 +4476,15 @@ export interface ExtractContentWithDomEvent extends BasePluginEvent<PluginEventT
4352
4476
  clonedRoot: HTMLElement;
4353
4477
  }
4354
4478
 
4479
+ /**
4480
+ * Extract Content with a DOM tree event
4481
+ * This event is triggered when getContent() is called with triggerExtractContentEvent = true
4482
+ * Plugin can handle this event to remove the UI only markups to return clean HTML
4483
+ * by operating on a cloned DOM tree
4484
+ */
4485
+ export interface CompatibleExtractContentWithDomEvent extends ExtractContentWithDomEventData, BasePluginEvent<CompatiblePluginEventType.ExtractContentWithDom> {
4486
+ }
4487
+
4355
4488
  /**
4356
4489
  * An event fired when pending format state (bold, italic, underline, ... with collapsed selection) is changed
4357
4490
  */
@@ -4359,6 +4492,13 @@ export interface PendingFormatStateChangedEvent extends BasePluginEvent<PluginEv
4359
4492
  formatState: PendableFormatState;
4360
4493
  }
4361
4494
 
4495
+ /**
4496
+ * An event fired when pending format state (bold, italic, underline, ... with collapsed selection) is changed
4497
+ */
4498
+ export interface CompatiblePendingFormatStateChangedEvent extends BasePluginEvent<CompatiblePluginEventType.PendingFormatStateChanged> {
4499
+ formatState: PendableFormatState;
4500
+ }
4501
+
4362
4502
  /**
4363
4503
  * This represents a PluginEvent wrapping native browser event
4364
4504
  */
@@ -4380,13 +4520,7 @@ export interface PluginCompositionEvent extends PluginDomEventBase<PluginEventTy
4380
4520
  /**
4381
4521
  * This interface represents a PluginEvent wrapping native ContextMenu event
4382
4522
  */
4383
- export interface PluginContextMenuEvent extends PluginDomEventBase<PluginEventType.ContextMenu, MouseEvent> {
4384
- /**
4385
- * A callback array to let editor retrieve context menu item related to this event.
4386
- * Plugins can add their own getter callback to this array,
4387
- * items from each getter will be separated by a splitter item represented by null
4388
- */
4389
- items: any[];
4523
+ export interface PluginContextMenuEvent extends PluginContextMenuEventData, PluginDomEventBase<PluginEventType.ContextMenu, MouseEvent> {
4390
4524
  }
4391
4525
 
4392
4526
  /**
@@ -4426,11 +4560,7 @@ export interface PluginMouseDownEvent extends PluginDomEventBase<PluginEventType
4426
4560
  /**
4427
4561
  * This interface represents a PluginEvent wrapping native MouseUp event
4428
4562
  */
4429
- export interface PluginMouseUpEvent extends PluginDomEventBase<PluginEventType.MouseUp, MouseEvent> {
4430
- /**
4431
- * Whether this is a mouse click event (mouse up and down on the same position)
4432
- */
4433
- isClicking?: boolean;
4563
+ export interface PluginMouseUpEvent extends PluginMouseUpEventData, PluginDomEventBase<PluginEventType.MouseUp, MouseEvent> {
4434
4564
  }
4435
4565
 
4436
4566
  /**
@@ -4442,14 +4572,114 @@ export interface PluginInputEvent extends PluginDomEventBase<PluginEventType.Inp
4442
4572
  /**
4443
4573
  * This interface represents a PluginEvent wrapping native scroll event
4444
4574
  */
4445
- export interface PluginScrollEvent extends PluginDomEventBase<PluginEventType.Scroll, UIEvent> {
4575
+ export interface PluginScrollEvent extends PluginScrollEventData, PluginDomEventBase<PluginEventType.Scroll, UIEvent> {
4576
+ }
4577
+
4578
+ /**
4579
+ * This represents a PluginEvent wrapping native browser event
4580
+ */
4581
+ export type CompatiblePluginDomEvent = CompatiblePluginCompositionEvent | CompatiblePluginMouseEvent | CompatiblePluginKeyboardEvent | CompatiblePluginInputEvent | CompatiblePluginScrollEvent;
4582
+
4583
+ /**
4584
+ * This interface represents a PluginEvent wrapping native CompositionEnd event
4585
+ */
4586
+ export interface CompatiblePluginCompositionEvent extends PluginDomEventBase<CompatiblePluginEventType.CompositionEnd, CompositionEvent> {
4587
+ }
4588
+
4589
+ /**
4590
+ * This interface represents a PluginEvent wrapping native ContextMenu event
4591
+ */
4592
+ export interface CompatiblePluginContextMenuEvent extends PluginContextMenuEventData, PluginDomEventBase<CompatiblePluginEventType.ContextMenu, MouseEvent> {
4593
+ }
4594
+
4595
+ /**
4596
+ * The interface represents a PluginEvent wrapping native Keyboard event
4597
+ */
4598
+ export type CompatiblePluginKeyboardEvent = CompatiblePluginKeyDownEvent | CompatiblePluginKeyPressEvent | CompatiblePluginKeyUpEvent;
4599
+
4600
+ /**
4601
+ * This interface represents a PluginEvent wrapping native KeyDown event
4602
+ */
4603
+ export interface CompatiblePluginKeyDownEvent extends PluginDomEventBase<CompatiblePluginEventType.KeyDown, KeyboardEvent> {
4604
+ }
4605
+
4606
+ /**
4607
+ * This interface represents a PluginEvent wrapping native KeyPress event
4608
+ */
4609
+ export interface CompatiblePluginKeyPressEvent extends PluginDomEventBase<CompatiblePluginEventType.KeyPress, KeyboardEvent> {
4610
+ }
4611
+
4612
+ /**
4613
+ * This interface represents a PluginEvent wrapping native KeyUp event
4614
+ */
4615
+ export interface CompatiblePluginKeyUpEvent extends PluginDomEventBase<CompatiblePluginEventType.KeyUp, KeyboardEvent> {
4616
+ }
4617
+
4618
+ /**
4619
+ * This interface represents a PluginEvent wrapping native Mouse event
4620
+ */
4621
+ export type CompatiblePluginMouseEvent = CompatiblePluginMouseDownEvent | CompatiblePluginMouseUpEvent | CompatiblePluginContextMenuEvent;
4622
+
4623
+ /**
4624
+ * This interface represents a PluginEvent wrapping native MouseDown event
4625
+ */
4626
+ export interface CompatiblePluginMouseDownEvent extends PluginDomEventBase<CompatiblePluginEventType.MouseDown, MouseEvent> {
4627
+ }
4628
+
4629
+ /**
4630
+ * This interface represents a PluginEvent wrapping native MouseUp event
4631
+ */
4632
+ export interface CompatiblePluginMouseUpEvent extends PluginMouseUpEventData, PluginDomEventBase<CompatiblePluginEventType.MouseUp, MouseEvent> {
4633
+ }
4634
+
4635
+ /**
4636
+ * This interface represents a PluginEvent wrapping native input / textinput event
4637
+ */
4638
+ export interface CompatiblePluginInputEvent extends PluginDomEventBase<CompatiblePluginEventType.Input, InputEvent> {
4639
+ }
4640
+
4641
+ /**
4642
+ * This interface represents a PluginEvent wrapping native scroll event
4643
+ */
4644
+ export interface CompatiblePluginScrollEvent extends PluginScrollEventData, PluginDomEventBase<CompatiblePluginEventType.Scroll, UIEvent> {
4645
+ }
4646
+
4647
+ /**
4648
+ * Data of PluginScrollEvent
4649
+ */
4650
+ export interface PluginScrollEventData {
4651
+ /**
4652
+ * Current scroll container that triggers this scroll event
4653
+ */
4446
4654
  scrollContainer: HTMLElement;
4447
4655
  }
4448
4656
 
4657
+ /**
4658
+ * Data of PluginMouseUpEvent
4659
+ */
4660
+ export interface PluginMouseUpEventData {
4661
+ /**
4662
+ * Whether this is a mouse click event (mouse up and down on the same position)
4663
+ */
4664
+ isClicking?: boolean;
4665
+ }
4666
+
4667
+ /**
4668
+ * Data of PluginContextMenuEvent
4669
+ */
4670
+ export interface PluginContextMenuEventData {
4671
+ /**
4672
+ * A callback array to let editor retrieve context menu item related to this event.
4673
+ * Plugins can add their own getter callback to this array,
4674
+ * items from each getter will be separated by a splitter item represented by null
4675
+ */
4676
+ items: any[];
4677
+ }
4678
+
4449
4679
  /**
4450
4680
  * Editor plugin event interface
4451
4681
  */
4452
- export type PluginEvent = BeforeCutCopyEvent | BeforePasteEvent | ContentChangedEvent | EntityOperationEvent | ExtractContentWithDomEvent | PluginDomEvent | EditorReadyEvent | BeforeDisposeEvent | PendingFormatStateChangedEvent | EnterShadowEditEvent | LeaveShadowEditEvent | EditImageEvent | BeforeSetContentEvent | ZoomChangedEvent;
4682
+ export type PluginEvent = BeforeCutCopyEvent | BeforePasteEvent | ContentChangedEvent | EntityOperationEvent | ExtractContentWithDomEvent | PluginDomEvent | EditorReadyEvent | BeforeDisposeEvent | PendingFormatStateChangedEvent | EnterShadowEditEvent | LeaveShadowEditEvent | EditImageEvent | BeforeSetContentEvent | ZoomChangedEvent | CompatibleBeforeCutCopyEvent | CompatibleBeforeDisposeEvent | CompatibleBeforePasteEvent | CompatibleBeforeSetContentEvent | CompatibleContentChangedEvent | CompatibleEditImageEvent | CompatibleEditorReadyEvent | CompatibleEntityOperationEvent | CompatibleExtractContentWithDomEvent | CompatiblePendingFormatStateChangedEvent | CompatiblePluginDomEvent | CompatibleEnterShadowEditEvent | CompatibleLeaveShadowEditEvent | CompatibleZoomChangedEvent;
4453
4683
 
4454
4684
  /**
4455
4685
  * A type to extract data part of a plugin event type. Data part is the plugin event without eventType field.
@@ -4476,7 +4706,19 @@ export type PluginEventFromTypeGeneric<E extends PluginEvent, T extends PluginEv
4476
4706
  /**
4477
4707
  * A plugin triggered right after editor has entered Shadow Edit mode
4478
4708
  */
4479
- export interface EnterShadowEditEvent extends BasePluginEvent<PluginEventType.EnteredShadowEdit> {
4709
+ export interface EnterShadowEditEvent extends EnterShadowEditEventData, BasePluginEvent<PluginEventType.EnteredShadowEdit> {
4710
+ }
4711
+
4712
+ /**
4713
+ * A plugin triggered right before editor leave Shadow Edit mode
4714
+ */
4715
+ export interface LeaveShadowEditEvent extends BasePluginEvent<PluginEventType.LeavingShadowEdit> {
4716
+ }
4717
+
4718
+ /**
4719
+ * Data of EnterShadowEditEvent
4720
+ */
4721
+ export interface EnterShadowEditEventData {
4480
4722
  /**
4481
4723
  * The document fragment of original editor content
4482
4724
  */
@@ -4487,10 +4729,16 @@ export interface EnterShadowEditEvent extends BasePluginEvent<PluginEventType.En
4487
4729
  selectionPath: SelectionPath;
4488
4730
  }
4489
4731
 
4732
+ /**
4733
+ * A plugin triggered right after editor has entered Shadow Edit mode
4734
+ */
4735
+ export interface CompatibleEnterShadowEditEvent extends EnterShadowEditEventData, BasePluginEvent<CompatiblePluginEventType.EnteredShadowEdit> {
4736
+ }
4737
+
4490
4738
  /**
4491
4739
  * A plugin triggered right before editor leave Shadow Edit mode
4492
4740
  */
4493
- export interface LeaveShadowEditEvent extends BasePluginEvent<PluginEventType.LeavingShadowEdit> {
4741
+ export interface CompatibleLeaveShadowEditEvent extends BasePluginEvent<CompatiblePluginEventType.LeavingShadowEdit> {
4494
4742
  }
4495
4743
 
4496
4744
  /**
@@ -4498,7 +4746,13 @@ export interface LeaveShadowEditEvent extends BasePluginEvent<PluginEventType.Le
4498
4746
  * Plugins can handle this event when they need to do something for zoom changing.
4499
4747
  *
4500
4748
  */
4501
- export interface ZoomChangedEvent extends BasePluginEvent<PluginEventType.ZoomChanged> {
4749
+ export interface ZoomChangedEvent extends ZoomChangedEventData, BasePluginEvent<PluginEventType.ZoomChanged> {
4750
+ }
4751
+
4752
+ /**
4753
+ * Data of ZoomChangedEvent
4754
+ */
4755
+ export interface ZoomChangedEventData {
4502
4756
  /**
4503
4757
  * Zoom scale value before this change
4504
4758
  */
@@ -4509,6 +4763,14 @@ export interface ZoomChangedEvent extends BasePluginEvent<PluginEventType.ZoomCh
4509
4763
  newZoomScale: number;
4510
4764
  }
4511
4765
 
4766
+ /**
4767
+ * Represents an event object triggered from Editor.setZoomScale() API.
4768
+ * Plugins can handle this event when they need to do something for zoom changing.
4769
+ *
4770
+ */
4771
+ export interface CompatibleZoomChangedEvent extends ZoomChangedEventData, BasePluginEvent<CompatiblePluginEventType.ZoomChanged> {
4772
+ }
4773
+
4512
4774
  /**
4513
4775
  * This refers to a "content block" in editor that serves as a content parsing boundary
4514
4776
  * It is most those html block like tags, i.e. &lt;p&gt;, &lt;div&gt;, &lt;li&gt;, &lt;td&gt; etc.
@@ -4621,6 +4883,16 @@ export interface CustomData {
4621
4883
  disposer?: (value: any) => void;
4622
4884
  }
4623
4885
 
4886
+ /**
4887
+ * Property that is going to store additional data related to the Content Changed Event
4888
+ */
4889
+ export interface ContentChangedData {
4890
+ /**
4891
+ * Optional property to store the format api name when using ChangeSource.Format
4892
+ */
4893
+ formatApiName?: string;
4894
+ }
4895
+
4624
4896
  /**
4625
4897
  * Default format settings
4626
4898
  */
@@ -5832,8 +6104,9 @@ export interface IEditor {
5832
6104
  * @param changeSource The change source to use when fire ContentChangedEvent. When the value is not null,
5833
6105
  * a ContentChangedEvent will be fired with change source equal to this value
5834
6106
  * @param canUndoByBackspace True if this action can be undone when user presses Backspace key (aka Auto Complete).
6107
+ * @param additionalData Optional parameter to provide additional data related to the ContentChanged Event.
5835
6108
  */
5836
- addUndoSnapshot(callback?: (start: NodePosition, end: NodePosition) => any, changeSource?: ChangeSource | CompatibleChangeSource | string, canUndoByBackspace?: boolean): void;
6109
+ addUndoSnapshot(callback?: (start: NodePosition, end: NodePosition) => any, changeSource?: ChangeSource | CompatibleChangeSource | string, canUndoByBackspace?: boolean, additionalData?: ContentChangedData): void;
5837
6110
  /**
5838
6111
  * Whether there is an available undo/redo snapshot
5839
6112
  */
@@ -6215,8 +6488,9 @@ export interface EditorCore extends PluginState {
6215
6488
  * @param callback The editing callback, accepting current selection start and end position, returns an optional object used as the data field of ContentChangedEvent.
6216
6489
  * @param changeSource The ChangeSource string of ContentChangedEvent. @default ChangeSource.Format. Set to null to avoid triggering ContentChangedEvent
6217
6490
  * @param canUndoByBackspace True if this action can be undone when user press Backspace key (aka Auto Complete).
6491
+ * @param additionalData Optional parameter to provide additional data related to the ContentChanged Event.
6218
6492
  */
6219
- export type AddUndoSnapshot = (core: EditorCore, callback: (start: NodePosition, end: NodePosition) => any, changeSource: ChangeSource | CompatibleChangeSource | string, canUndoByBackspace: boolean) => void;
6493
+ export type AddUndoSnapshot = (core: EditorCore, callback: (start: NodePosition, end: NodePosition) => any, changeSource: ChangeSource | CompatibleChangeSource | string, canUndoByBackspace: boolean, additionalData?: ContentChangedData) => void;
6220
6494
 
6221
6495
  /**
6222
6496
  * Attach a DOM event to the editor content DIV
@@ -6726,6 +7000,16 @@ export interface ListFeatureSettings {
6726
7000
  * When delete key is pressed before the first item, indent the correct list of numbers
6727
7001
  */
6728
7002
  maintainListChainWhenDelete: boolean;
7003
+ /**
7004
+ * When press space after *, -, --, ->, -->, >, => in an empty line, toggle bullet
7005
+ * @default true
7006
+ */
7007
+ autoBulletList: boolean;
7008
+ /**
7009
+ * When press space after an number, a letter or roman number followed by ), ., -, or between parenthesis in an empty line, toggle numbering
7010
+ * @default true
7011
+ */
7012
+ autoNumberingList: boolean;
6729
7013
  }
6730
7014
 
6731
7015
  /**
@@ -7037,7 +7321,7 @@ export interface ImageEditOptions {
7037
7321
  * Color of resize/rotate border, handle and icon
7038
7322
  * @default #DB626C
7039
7323
  */
7040
- borderColor?: string;
7324
+ borderColor?: string | ModeIndependentColor;
7041
7325
  /**
7042
7326
  * Minimum resize/crop width
7043
7327
  * @default 10
@@ -7892,30 +8176,42 @@ export enum CompatibleAlignment {
7892
8176
  * Enum used to control the different types of bullet list
7893
8177
  */
7894
8178
  export enum CompatibleBulletListType {
8179
+ /**
8180
+ * Minimum value of the enum
8181
+ */
8182
+ Min = 1,
7895
8183
  /**
7896
8184
  * Bullet triggered by *
7897
8185
  */
7898
- Disc = 0,
8186
+ Disc = 1,
7899
8187
  /**
7900
8188
  * Bullet triggered by -
7901
8189
  */
7902
- Dash = 1,
8190
+ Dash = 2,
7903
8191
  /**
7904
8192
  * Bullet triggered by --
7905
8193
  */
7906
- Square = 2,
8194
+ Square = 3,
7907
8195
  /**
7908
8196
  * Bullet triggered by >
7909
8197
  */
7910
- ShortArrow = 3,
8198
+ ShortArrow = 4,
7911
8199
  /**
7912
8200
  * Bullet triggered by -> or -->
7913
8201
  */
7914
- LongArrow = 4,
8202
+ LongArrow = 5,
7915
8203
  /**
7916
8204
  * Bullet triggered by =>
7917
8205
  */
7918
- UnfilledArrow = 5
8206
+ UnfilledArrow = 6,
8207
+ /**
8208
+ * Bullet triggered by —
8209
+ */
8210
+ Hyphen = 7,
8211
+ /**
8212
+ * Maximum value of the enum
8213
+ */
8214
+ Max = 7
7919
8215
  }
7920
8216
 
7921
8217
  /**
@@ -8526,86 +8822,94 @@ export enum CompatibleNodeType {
8526
8822
  * Enum used to control the different types of numbering list
8527
8823
  */
8528
8824
  export enum CompatibleNumberingListType {
8825
+ /**
8826
+ * Minimum value of the enum
8827
+ */
8828
+ Min = 1,
8529
8829
  /**
8530
8830
  * Numbering triggered by 1.
8531
8831
  */
8532
- Decimal = 0,
8832
+ Decimal = 1,
8533
8833
  /**
8534
8834
  * Numbering triggered by 1-
8535
8835
  */
8536
- DecimalDash = 1,
8836
+ DecimalDash = 2,
8537
8837
  /**
8538
8838
  * Numbering triggered by 1)
8539
8839
  */
8540
- DecimalParenthesis = 2,
8840
+ DecimalParenthesis = 3,
8541
8841
  /**
8542
8842
  * Numbering triggered by (1)
8543
8843
  */
8544
- DecimalDoubleParenthesis = 3,
8844
+ DecimalDoubleParenthesis = 4,
8545
8845
  /**
8546
8846
  * Numbering triggered by a.
8547
8847
  */
8548
- LowerAlpha = 4,
8848
+ LowerAlpha = 5,
8549
8849
  /**
8550
8850
  * Numbering triggered by a)
8551
8851
  */
8552
- LowerAlphaParenthesis = 5,
8852
+ LowerAlphaParenthesis = 6,
8553
8853
  /**
8554
8854
  * Numbering triggered by (a)
8555
8855
  */
8556
- LowerAlphaDoubleParenthesis = 6,
8856
+ LowerAlphaDoubleParenthesis = 7,
8557
8857
  /**
8558
8858
  * Numbering triggered by a-
8559
8859
  */
8560
- LowerAlphaDash = 7,
8860
+ LowerAlphaDash = 8,
8561
8861
  /**
8562
8862
  * Numbering triggered by A.
8563
8863
  */
8564
- UpperAlpha = 8,
8864
+ UpperAlpha = 9,
8565
8865
  /**
8566
8866
  * Numbering triggered by A)
8567
8867
  */
8568
- UpperAlphaParenthesis = 9,
8868
+ UpperAlphaParenthesis = 10,
8569
8869
  /**
8570
8870
  * Numbering triggered by (A)
8571
8871
  */
8572
- UpperAlphaDoubleParenthesis = 10,
8872
+ UpperAlphaDoubleParenthesis = 11,
8573
8873
  /**
8574
8874
  * Numbering triggered by A-
8575
8875
  */
8576
- UpperAlphaDash = 11,
8876
+ UpperAlphaDash = 12,
8577
8877
  /**
8578
8878
  * Numbering triggered by i.
8579
8879
  */
8580
- LowerRoman = 12,
8880
+ LowerRoman = 13,
8581
8881
  /**
8582
8882
  * Numbering triggered by i)
8583
8883
  */
8584
- LowerRomanParenthesis = 13,
8884
+ LowerRomanParenthesis = 14,
8585
8885
  /**
8586
8886
  * Numbering triggered by (i)
8587
8887
  */
8588
- LowerRomanDoubleParenthesis = 14,
8888
+ LowerRomanDoubleParenthesis = 15,
8589
8889
  /**
8590
8890
  * Numbering triggered by i-
8591
8891
  */
8592
- LowerRomanDash = 15,
8892
+ LowerRomanDash = 16,
8593
8893
  /**
8594
8894
  * Numbering triggered by I.
8595
8895
  */
8596
- UpperRoman = 16,
8896
+ UpperRoman = 17,
8597
8897
  /**
8598
8898
  * Numbering triggered by I)
8599
8899
  */
8600
- UpperRomanParenthesis = 17,
8900
+ UpperRomanParenthesis = 18,
8601
8901
  /**
8602
8902
  * Numbering triggered by (I)
8603
8903
  */
8604
- UpperRomanDoubleParenthesis = 18,
8904
+ UpperRomanDoubleParenthesis = 19,
8605
8905
  /**
8606
8906
  * Numbering triggered by I-
8607
8907
  */
8608
- UpperRomanDash = 19
8908
+ UpperRomanDash = 20,
8909
+ /**
8910
+ * Maximum value of the enum
8911
+ */
8912
+ Max = 20
8609
8913
  }
8610
8914
 
8611
8915
  /**
@@ -9176,8 +9480,6 @@ export class Paste implements EditorPlugin {
9176
9480
  * - Apply selected item in picker
9177
9481
  *
9178
9482
  * PickerPlugin doesn't provide any UI, it just wraps related DOM events and invoke callback functions.
9179
- * To show a picker UI, you need to build your own UI component. Please reference to
9180
- * https://github.com/microsoft/roosterjs/tree/master/demo/scripts/controls/samplepicker
9181
9483
  */
9182
9484
  export class PickerPlugin<T extends PickerDataProvider = PickerDataProvider> implements EditorPlugin {
9183
9485
  readonly dataProvider: T;