roosterjs 8.25.0 → 8.26.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/rooster.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- // Type definitions for roosterjs (Version 8.25.0)
1
+ // Type definitions for roosterjs (Version 8.26.0)
2
2
  // Generated by dts tool from roosterjs
3
3
  // Project: https://github.com/Microsoft/roosterjs
4
4
 
@@ -338,6 +338,7 @@ function applyTextStyle(container: Node, styler: (node: HTMLElement, isInnerNode
338
338
  * @param event The paste event
339
339
  * @param callback Callback function when data is ready
340
340
  * @param options Options to retrieve more items from the event, including HTML string and other customized items
341
+ * @param rangeBeforePaste Optional range to be removed when pasting in Android
341
342
  * @returns An object with the following properties:
342
343
  * types: Available types from the clipboard event
343
344
  * text: Plain text from the clipboard event
@@ -346,7 +347,7 @@ function applyTextStyle(container: Node, styler: (node: HTMLElement, isInnerNode
346
347
  * When set to undefined, it means can't retrieve HTML string, there may be HTML string but direct retrieving is
347
348
  * not supported by browser.
348
349
  */
349
- function extractClipboardEvent(event: ClipboardEvent, callback: (clipboardData: ClipboardData) => void, options?: ExtractClipboardEventOption): void;
350
+ function extractClipboardEvent(event: ClipboardEvent, callback: (clipboardData: ClipboardData) => void, options?: ExtractClipboardEventOption, rangeBeforePaste?: Range): void;
350
351
 
351
352
  /**
352
353
  * Extract clipboard items to be a ClipboardData object for IE
@@ -2561,7 +2562,7 @@ function toggleListType(editor: IEditor, listType: ListType | CompatibleListType
2561
2562
  /**
2562
2563
  * Split selection into regions, and perform a block-wise formatting action for each region.
2563
2564
  */
2564
- function blockFormat(editor: IEditor, callback: (region: Region, start: NodePosition, end: NodePosition, chains: VListChain[]) => void, beforeRunCallback?: () => boolean): void;
2565
+ function blockFormat(editor: IEditor, callback: (region: Region, start: NodePosition, end: NodePosition, chains: VListChain[]) => void, beforeRunCallback?: () => boolean, apiName?: string): void;
2565
2566
 
2566
2567
  /**
2567
2568
  * Commit changes of all list changes when experiment features are allowed
@@ -4208,7 +4209,13 @@ const enum DefinitionType {
4208
4209
  /**
4209
4210
  * Provides a chance for plugin to change the content before it is copied from editor.
4210
4211
  */
4211
- interface BeforeCutCopyEvent extends BasePluginEvent<PluginEventType.BeforeCutCopy> {
4212
+ interface BeforeCutCopyEvent extends BeforeCutCopyEventData, BasePluginEvent<PluginEventType.BeforeCutCopy> {
4213
+ }
4214
+
4215
+ /**
4216
+ * Data of BeforeCutCopyEvent
4217
+ */
4218
+ interface BeforeCutCopyEventData {
4212
4219
  /**
4213
4220
  * Raw DOM event
4214
4221
  */
@@ -4227,6 +4234,12 @@ interface BeforeCutCopyEvent extends BasePluginEvent<PluginEventType.BeforeCutCo
4227
4234
  isCut: boolean;
4228
4235
  }
4229
4236
 
4237
+ /**
4238
+ * Provides a chance for plugin to change the content before it is copied from editor.
4239
+ */
4240
+ interface CompatibleBeforeCutCopyEvent extends BeforeCutCopyEventData, BasePluginEvent<CompatiblePluginEventType.BeforeCutCopy> {
4241
+ }
4242
+
4230
4243
  /**
4231
4244
  * Editor plugin event interface
4232
4245
  */
@@ -4254,7 +4267,19 @@ interface BeforeDisposeEvent extends BasePluginEvent<PluginEventType.BeforeDispo
4254
4267
  /**
4255
4268
  * Provides a chance for plugin to change the content before it is pasted into editor.
4256
4269
  */
4257
- interface BeforePasteEvent extends BasePluginEvent<PluginEventType.BeforePaste> {
4270
+ interface CompatibleBeforeDisposeEvent extends BasePluginEvent<CompatiblePluginEventType.BeforeDispose> {
4271
+ }
4272
+
4273
+ /**
4274
+ * Provides a chance for plugin to change the content before it is pasted into editor.
4275
+ */
4276
+ interface BeforePasteEvent extends BeforePasteEventData, BasePluginEvent<PluginEventType.BeforePaste> {
4277
+ }
4278
+
4279
+ /**
4280
+ * Data of BeforePasteEvent
4281
+ */
4282
+ interface BeforePasteEventData {
4258
4283
  /**
4259
4284
  * An object contains all related data for pasting
4260
4285
  */
@@ -4281,21 +4306,46 @@ interface BeforePasteEvent extends BasePluginEvent<PluginEventType.BeforePaste>
4281
4306
  htmlAttributes: Record<string, string>;
4282
4307
  }
4283
4308
 
4309
+ /**
4310
+ * Provides a chance for plugin to change the content before it is pasted into editor.
4311
+ */
4312
+ interface CompatibleBeforePasteEvent extends BeforePasteEventData, BasePluginEvent<CompatiblePluginEventType.BeforePaste> {
4313
+ }
4314
+
4284
4315
  /**
4285
4316
  * The event to be triggered before SetContent API is called.
4286
4317
  * Handle this event to cache anything you need from editor before it is gone.
4287
4318
  */
4288
- interface BeforeSetContentEvent extends BasePluginEvent<PluginEventType.BeforeSetContent> {
4319
+ interface BeforeSetContentEvent extends BeforeSetContentEventData, BasePluginEvent<PluginEventType.BeforeSetContent> {
4320
+ }
4321
+
4322
+ /**
4323
+ * Data of BeforeSetContentEvent
4324
+ */
4325
+ interface BeforeSetContentEventData {
4289
4326
  /**
4290
4327
  * New content HTML that is about to set to editor
4291
4328
  */
4292
4329
  newContent: string;
4293
4330
  }
4294
4331
 
4332
+ /**
4333
+ * The event to be triggered before SetContent API is called.
4334
+ * Handle this event to cache anything you need from editor before it is gone.
4335
+ */
4336
+ interface CompatibleBeforeSetContentEvent extends BeforeSetContentEventData, BasePluginEvent<CompatiblePluginEventType.BeforeSetContent> {
4337
+ }
4338
+
4295
4339
  /**
4296
4340
  * Represents a change to the editor made by another plugin
4297
4341
  */
4298
- interface ContentChangedEvent extends BasePluginEvent<PluginEventType.ContentChanged> {
4342
+ interface ContentChangedEvent extends ContentChangedEventData, BasePluginEvent<PluginEventType.ContentChanged> {
4343
+ }
4344
+
4345
+ /**
4346
+ * Data of ContentChangedEvent
4347
+ */
4348
+ interface ContentChangedEventData {
4299
4349
  /**
4300
4350
  * Source of the change
4301
4351
  */
@@ -4304,13 +4354,26 @@ interface ContentChangedEvent extends BasePluginEvent<PluginEventType.ContentCha
4304
4354
  * Optional related data
4305
4355
  */
4306
4356
  data?: any;
4357
+ additionalData?: ContentChangedData;
4358
+ }
4359
+
4360
+ /**
4361
+ * Represents a change to the editor made by another plugin
4362
+ */
4363
+ interface CompatibleContentChangedEvent extends ContentChangedEventData, BasePluginEvent<CompatiblePluginEventType.ContentChanged> {
4307
4364
  }
4308
4365
 
4309
4366
  /**
4310
4367
  * Represents an event that will be fired when an inline image is edited by user, and the src
4311
4368
  * attribute of the image is about to be changed
4312
4369
  */
4313
- interface EditImageEvent extends BasePluginEvent<PluginEventType.EditImage> {
4370
+ interface EditImageEvent extends EditImageEventData, BasePluginEvent<PluginEventType.EditImage> {
4371
+ }
4372
+
4373
+ /**
4374
+ * Data of EditImageEvent
4375
+ */
4376
+ interface EditImageEventData {
4314
4377
  /**
4315
4378
  * The image element that is being changed
4316
4379
  */
@@ -4331,17 +4394,36 @@ interface EditImageEvent extends BasePluginEvent<PluginEventType.EditImage> {
4331
4394
  newSrc: string;
4332
4395
  }
4333
4396
 
4397
+ /**
4398
+ * Represents an event that will be fired when an inline image is edited by user, and the src
4399
+ * attribute of the image is about to be changed
4400
+ */
4401
+ interface CompatibleEditImageEvent extends EditImageEventData, BasePluginEvent<CompatiblePluginEventType.EditImage> {
4402
+ }
4403
+
4334
4404
  /**
4335
4405
  * Provides a chance for plugin to change the content before it is pasted into editor.
4336
4406
  */
4337
4407
  interface EditorReadyEvent extends BasePluginEvent<PluginEventType.EditorReady> {
4408
+ }
4409
+
4410
+ /**
4411
+ * Provides a chance for plugin to change the content before it is pasted into editor.
4412
+ */
4413
+ interface CompatibleEditorReadyEvent extends BasePluginEvent<CompatiblePluginEventType.EditorReady> {
4338
4414
  }
4339
4415
 
4340
4416
  /**
4341
4417
  * Provide a chance for plugins to handle entity related events.
4342
4418
  * See enum EntityOperation for more details about each operation
4343
4419
  */
4344
- interface EntityOperationEvent extends BasePluginEvent<PluginEventType.EntityOperation> {
4420
+ interface EntityOperationEvent extends EntityOperationEventData, BasePluginEvent<PluginEventType.EntityOperation> {
4421
+ }
4422
+
4423
+ /**
4424
+ * Data of EntityOperationEvent
4425
+ */
4426
+ interface EntityOperationEventData {
4345
4427
  /**
4346
4428
  * Operation to this entity
4347
4429
  */
@@ -4368,13 +4450,26 @@ interface EntityOperationEvent extends BasePluginEvent<PluginEventType.EntityOpe
4368
4450
  contentForShadowEntity?: DocumentFragment;
4369
4451
  }
4370
4452
 
4453
+ /**
4454
+ * Provide a chance for plugins to handle entity related events.
4455
+ * See enum EntityOperation for more details about each operation
4456
+ */
4457
+ interface CompatibleEntityOperationEvent extends EntityOperationEventData, BasePluginEvent<CompatiblePluginEventType.EntityOperation> {
4458
+ }
4459
+
4371
4460
  /**
4372
4461
  * Extract Content with a DOM tree event
4373
4462
  * This event is triggered when getContent() is called with triggerExtractContentEvent = true
4374
4463
  * Plugin can handle this event to remove the UI only markups to return clean HTML
4375
4464
  * by operating on a cloned DOM tree
4376
4465
  */
4377
- interface ExtractContentWithDomEvent extends BasePluginEvent<PluginEventType.ExtractContentWithDom> {
4466
+ interface ExtractContentWithDomEvent extends ExtractContentWithDomEventData, BasePluginEvent<PluginEventType.ExtractContentWithDom> {
4467
+ }
4468
+
4469
+ /**
4470
+ * Data of ExtractContentWithDomEvent
4471
+ */
4472
+ interface ExtractContentWithDomEventData {
4378
4473
  /**
4379
4474
  * Cloned root element of editor
4380
4475
  * Plugin can change this DOM tree to clean up the markups it added before
@@ -4382,6 +4477,15 @@ interface ExtractContentWithDomEvent extends BasePluginEvent<PluginEventType.Ext
4382
4477
  clonedRoot: HTMLElement;
4383
4478
  }
4384
4479
 
4480
+ /**
4481
+ * Extract Content with a DOM tree event
4482
+ * This event is triggered when getContent() is called with triggerExtractContentEvent = true
4483
+ * Plugin can handle this event to remove the UI only markups to return clean HTML
4484
+ * by operating on a cloned DOM tree
4485
+ */
4486
+ interface CompatibleExtractContentWithDomEvent extends ExtractContentWithDomEventData, BasePluginEvent<CompatiblePluginEventType.ExtractContentWithDom> {
4487
+ }
4488
+
4385
4489
  /**
4386
4490
  * An event fired when pending format state (bold, italic, underline, ... with collapsed selection) is changed
4387
4491
  */
@@ -4389,6 +4493,13 @@ interface PendingFormatStateChangedEvent extends BasePluginEvent<PluginEventType
4389
4493
  formatState: PendableFormatState;
4390
4494
  }
4391
4495
 
4496
+ /**
4497
+ * An event fired when pending format state (bold, italic, underline, ... with collapsed selection) is changed
4498
+ */
4499
+ interface CompatiblePendingFormatStateChangedEvent extends BasePluginEvent<CompatiblePluginEventType.PendingFormatStateChanged> {
4500
+ formatState: PendableFormatState;
4501
+ }
4502
+
4392
4503
  /**
4393
4504
  * This represents a PluginEvent wrapping native browser event
4394
4505
  */
@@ -4410,13 +4521,7 @@ interface PluginCompositionEvent extends PluginDomEventBase<PluginEventType.Comp
4410
4521
  /**
4411
4522
  * This interface represents a PluginEvent wrapping native ContextMenu event
4412
4523
  */
4413
- interface PluginContextMenuEvent extends PluginDomEventBase<PluginEventType.ContextMenu, MouseEvent> {
4414
- /**
4415
- * A callback array to let editor retrieve context menu item related to this event.
4416
- * Plugins can add their own getter callback to this array,
4417
- * items from each getter will be separated by a splitter item represented by null
4418
- */
4419
- items: any[];
4524
+ interface PluginContextMenuEvent extends PluginContextMenuEventData, PluginDomEventBase<PluginEventType.ContextMenu, MouseEvent> {
4420
4525
  }
4421
4526
 
4422
4527
  /**
@@ -4456,11 +4561,7 @@ interface PluginMouseDownEvent extends PluginDomEventBase<PluginEventType.MouseD
4456
4561
  /**
4457
4562
  * This interface represents a PluginEvent wrapping native MouseUp event
4458
4563
  */
4459
- interface PluginMouseUpEvent extends PluginDomEventBase<PluginEventType.MouseUp, MouseEvent> {
4460
- /**
4461
- * Whether this is a mouse click event (mouse up and down on the same position)
4462
- */
4463
- isClicking?: boolean;
4564
+ interface PluginMouseUpEvent extends PluginMouseUpEventData, PluginDomEventBase<PluginEventType.MouseUp, MouseEvent> {
4464
4565
  }
4465
4566
 
4466
4567
  /**
@@ -4472,14 +4573,114 @@ interface PluginInputEvent extends PluginDomEventBase<PluginEventType.Input, Inp
4472
4573
  /**
4473
4574
  * This interface represents a PluginEvent wrapping native scroll event
4474
4575
  */
4475
- interface PluginScrollEvent extends PluginDomEventBase<PluginEventType.Scroll, UIEvent> {
4576
+ interface PluginScrollEvent extends PluginScrollEventData, PluginDomEventBase<PluginEventType.Scroll, UIEvent> {
4577
+ }
4578
+
4579
+ /**
4580
+ * This represents a PluginEvent wrapping native browser event
4581
+ */
4582
+ type CompatiblePluginDomEvent = CompatiblePluginCompositionEvent | CompatiblePluginMouseEvent | CompatiblePluginKeyboardEvent | CompatiblePluginInputEvent | CompatiblePluginScrollEvent;
4583
+
4584
+ /**
4585
+ * This interface represents a PluginEvent wrapping native CompositionEnd event
4586
+ */
4587
+ interface CompatiblePluginCompositionEvent extends PluginDomEventBase<CompatiblePluginEventType.CompositionEnd, CompositionEvent> {
4588
+ }
4589
+
4590
+ /**
4591
+ * This interface represents a PluginEvent wrapping native ContextMenu event
4592
+ */
4593
+ interface CompatiblePluginContextMenuEvent extends PluginContextMenuEventData, PluginDomEventBase<CompatiblePluginEventType.ContextMenu, MouseEvent> {
4594
+ }
4595
+
4596
+ /**
4597
+ * The interface represents a PluginEvent wrapping native Keyboard event
4598
+ */
4599
+ type CompatiblePluginKeyboardEvent = CompatiblePluginKeyDownEvent | CompatiblePluginKeyPressEvent | CompatiblePluginKeyUpEvent;
4600
+
4601
+ /**
4602
+ * This interface represents a PluginEvent wrapping native KeyDown event
4603
+ */
4604
+ interface CompatiblePluginKeyDownEvent extends PluginDomEventBase<CompatiblePluginEventType.KeyDown, KeyboardEvent> {
4605
+ }
4606
+
4607
+ /**
4608
+ * This interface represents a PluginEvent wrapping native KeyPress event
4609
+ */
4610
+ interface CompatiblePluginKeyPressEvent extends PluginDomEventBase<CompatiblePluginEventType.KeyPress, KeyboardEvent> {
4611
+ }
4612
+
4613
+ /**
4614
+ * This interface represents a PluginEvent wrapping native KeyUp event
4615
+ */
4616
+ interface CompatiblePluginKeyUpEvent extends PluginDomEventBase<CompatiblePluginEventType.KeyUp, KeyboardEvent> {
4617
+ }
4618
+
4619
+ /**
4620
+ * This interface represents a PluginEvent wrapping native Mouse event
4621
+ */
4622
+ type CompatiblePluginMouseEvent = CompatiblePluginMouseDownEvent | CompatiblePluginMouseUpEvent | CompatiblePluginContextMenuEvent;
4623
+
4624
+ /**
4625
+ * This interface represents a PluginEvent wrapping native MouseDown event
4626
+ */
4627
+ interface CompatiblePluginMouseDownEvent extends PluginDomEventBase<CompatiblePluginEventType.MouseDown, MouseEvent> {
4628
+ }
4629
+
4630
+ /**
4631
+ * This interface represents a PluginEvent wrapping native MouseUp event
4632
+ */
4633
+ interface CompatiblePluginMouseUpEvent extends PluginMouseUpEventData, PluginDomEventBase<CompatiblePluginEventType.MouseUp, MouseEvent> {
4634
+ }
4635
+
4636
+ /**
4637
+ * This interface represents a PluginEvent wrapping native input / textinput event
4638
+ */
4639
+ interface CompatiblePluginInputEvent extends PluginDomEventBase<CompatiblePluginEventType.Input, InputEvent> {
4640
+ }
4641
+
4642
+ /**
4643
+ * This interface represents a PluginEvent wrapping native scroll event
4644
+ */
4645
+ interface CompatiblePluginScrollEvent extends PluginScrollEventData, PluginDomEventBase<CompatiblePluginEventType.Scroll, UIEvent> {
4646
+ }
4647
+
4648
+ /**
4649
+ * Data of PluginScrollEvent
4650
+ */
4651
+ interface PluginScrollEventData {
4652
+ /**
4653
+ * Current scroll container that triggers this scroll event
4654
+ */
4476
4655
  scrollContainer: HTMLElement;
4477
4656
  }
4478
4657
 
4658
+ /**
4659
+ * Data of PluginMouseUpEvent
4660
+ */
4661
+ interface PluginMouseUpEventData {
4662
+ /**
4663
+ * Whether this is a mouse click event (mouse up and down on the same position)
4664
+ */
4665
+ isClicking?: boolean;
4666
+ }
4667
+
4668
+ /**
4669
+ * Data of PluginContextMenuEvent
4670
+ */
4671
+ interface PluginContextMenuEventData {
4672
+ /**
4673
+ * A callback array to let editor retrieve context menu item related to this event.
4674
+ * Plugins can add their own getter callback to this array,
4675
+ * items from each getter will be separated by a splitter item represented by null
4676
+ */
4677
+ items: any[];
4678
+ }
4679
+
4479
4680
  /**
4480
4681
  * Editor plugin event interface
4481
4682
  */
4482
- type PluginEvent = BeforeCutCopyEvent | BeforePasteEvent | ContentChangedEvent | EntityOperationEvent | ExtractContentWithDomEvent | PluginDomEvent | EditorReadyEvent | BeforeDisposeEvent | PendingFormatStateChangedEvent | EnterShadowEditEvent | LeaveShadowEditEvent | EditImageEvent | BeforeSetContentEvent | ZoomChangedEvent;
4683
+ 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;
4483
4684
 
4484
4685
  /**
4485
4686
  * A type to extract data part of a plugin event type. Data part is the plugin event without eventType field.
@@ -4506,7 +4707,19 @@ type PluginEventFromTypeGeneric<E extends PluginEvent, T extends PluginEventType
4506
4707
  /**
4507
4708
  * A plugin triggered right after editor has entered Shadow Edit mode
4508
4709
  */
4509
- interface EnterShadowEditEvent extends BasePluginEvent<PluginEventType.EnteredShadowEdit> {
4710
+ interface EnterShadowEditEvent extends EnterShadowEditEventData, BasePluginEvent<PluginEventType.EnteredShadowEdit> {
4711
+ }
4712
+
4713
+ /**
4714
+ * A plugin triggered right before editor leave Shadow Edit mode
4715
+ */
4716
+ interface LeaveShadowEditEvent extends BasePluginEvent<PluginEventType.LeavingShadowEdit> {
4717
+ }
4718
+
4719
+ /**
4720
+ * Data of EnterShadowEditEvent
4721
+ */
4722
+ interface EnterShadowEditEventData {
4510
4723
  /**
4511
4724
  * The document fragment of original editor content
4512
4725
  */
@@ -4517,10 +4730,16 @@ interface EnterShadowEditEvent extends BasePluginEvent<PluginEventType.EnteredSh
4517
4730
  selectionPath: SelectionPath;
4518
4731
  }
4519
4732
 
4733
+ /**
4734
+ * A plugin triggered right after editor has entered Shadow Edit mode
4735
+ */
4736
+ interface CompatibleEnterShadowEditEvent extends EnterShadowEditEventData, BasePluginEvent<CompatiblePluginEventType.EnteredShadowEdit> {
4737
+ }
4738
+
4520
4739
  /**
4521
4740
  * A plugin triggered right before editor leave Shadow Edit mode
4522
4741
  */
4523
- interface LeaveShadowEditEvent extends BasePluginEvent<PluginEventType.LeavingShadowEdit> {
4742
+ interface CompatibleLeaveShadowEditEvent extends BasePluginEvent<CompatiblePluginEventType.LeavingShadowEdit> {
4524
4743
  }
4525
4744
 
4526
4745
  /**
@@ -4528,7 +4747,13 @@ interface LeaveShadowEditEvent extends BasePluginEvent<PluginEventType.LeavingSh
4528
4747
  * Plugins can handle this event when they need to do something for zoom changing.
4529
4748
  *
4530
4749
  */
4531
- interface ZoomChangedEvent extends BasePluginEvent<PluginEventType.ZoomChanged> {
4750
+ interface ZoomChangedEvent extends ZoomChangedEventData, BasePluginEvent<PluginEventType.ZoomChanged> {
4751
+ }
4752
+
4753
+ /**
4754
+ * Data of ZoomChangedEvent
4755
+ */
4756
+ interface ZoomChangedEventData {
4532
4757
  /**
4533
4758
  * Zoom scale value before this change
4534
4759
  */
@@ -4539,6 +4764,14 @@ interface ZoomChangedEvent extends BasePluginEvent<PluginEventType.ZoomChanged>
4539
4764
  newZoomScale: number;
4540
4765
  }
4541
4766
 
4767
+ /**
4768
+ * Represents an event object triggered from Editor.setZoomScale() API.
4769
+ * Plugins can handle this event when they need to do something for zoom changing.
4770
+ *
4771
+ */
4772
+ interface CompatibleZoomChangedEvent extends ZoomChangedEventData, BasePluginEvent<CompatiblePluginEventType.ZoomChanged> {
4773
+ }
4774
+
4542
4775
  /**
4543
4776
  * This refers to a "content block" in editor that serves as a content parsing boundary
4544
4777
  * It is most those html block like tags, i.e. &lt;p&gt;, &lt;div&gt;, &lt;li&gt;, &lt;td&gt; etc.
@@ -4651,6 +4884,16 @@ interface CustomData {
4651
4884
  disposer?: (value: any) => void;
4652
4885
  }
4653
4886
 
4887
+ /**
4888
+ * Property that is going to store additional data related to the Content Changed Event
4889
+ */
4890
+ interface ContentChangedData {
4891
+ /**
4892
+ * Optional property to store the format api name when using ChangeSource.Format
4893
+ */
4894
+ formatApiName?: string;
4895
+ }
4896
+
4654
4897
  /**
4655
4898
  * Default format settings
4656
4899
  */
@@ -5862,8 +6105,9 @@ interface IEditor {
5862
6105
  * @param changeSource The change source to use when fire ContentChangedEvent. When the value is not null,
5863
6106
  * a ContentChangedEvent will be fired with change source equal to this value
5864
6107
  * @param canUndoByBackspace True if this action can be undone when user presses Backspace key (aka Auto Complete).
6108
+ * @param additionalData Optional parameter to provide additional data related to the ContentChanged Event.
5865
6109
  */
5866
- addUndoSnapshot(callback?: (start: NodePosition, end: NodePosition) => any, changeSource?: ChangeSource | CompatibleChangeSource | string, canUndoByBackspace?: boolean): void;
6110
+ addUndoSnapshot(callback?: (start: NodePosition, end: NodePosition) => any, changeSource?: ChangeSource | CompatibleChangeSource | string, canUndoByBackspace?: boolean, additionalData?: ContentChangedData): void;
5867
6111
  /**
5868
6112
  * Whether there is an available undo/redo snapshot
5869
6113
  */
@@ -6245,8 +6489,9 @@ interface EditorCore extends PluginState {
6245
6489
  * @param callback The editing callback, accepting current selection start and end position, returns an optional object used as the data field of ContentChangedEvent.
6246
6490
  * @param changeSource The ChangeSource string of ContentChangedEvent. @default ChangeSource.Format. Set to null to avoid triggering ContentChangedEvent
6247
6491
  * @param canUndoByBackspace True if this action can be undone when user press Backspace key (aka Auto Complete).
6492
+ * @param additionalData Optional parameter to provide additional data related to the ContentChanged Event.
6248
6493
  */
6249
- type AddUndoSnapshot = (core: EditorCore, callback: (start: NodePosition, end: NodePosition) => any, changeSource: ChangeSource | CompatibleChangeSource | string, canUndoByBackspace: boolean) => void;
6494
+ type AddUndoSnapshot = (core: EditorCore, callback: (start: NodePosition, end: NodePosition) => any, changeSource: ChangeSource | CompatibleChangeSource | string, canUndoByBackspace: boolean, additionalData?: ContentChangedData) => void;
6250
6495
 
6251
6496
  /**
6252
6497
  * Attach a DOM event to the editor content DIV
@@ -9236,8 +9481,6 @@ class Paste implements EditorPlugin {
9236
9481
  * - Apply selected item in picker
9237
9482
  *
9238
9483
  * PickerPlugin doesn't provide any UI, it just wraps related DOM events and invoke callback functions.
9239
- * To show a picker UI, you need to build your own UI component. Please reference to
9240
- * https://github.com/microsoft/roosterjs/tree/master/demo/scripts/controls/samplepicker
9241
9484
  */
9242
9485
  class PickerPlugin<T extends PickerDataProvider = PickerDataProvider> implements EditorPlugin {
9243
9486
  readonly dataProvider: T;