roosterjs 8.9.0 → 8.10.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.9.0)
1
+ // Type definitions for roosterjs (Version 8.10.0)
2
2
  // Generated by dts tool from roosterjs
3
3
  // Project: https://github.com/Microsoft/roosterjs
4
4
 
@@ -656,7 +656,17 @@ export const enum EntityOperation {
656
656
  * This event will provide a cloned DOM tree for each entity, do NOT compare the DOM nodes with cached nodes
657
657
  * because it will always return false.
658
658
  */
659
- ReplaceTemporaryContent = 8
659
+ ReplaceTemporaryContent = 8,
660
+ /**
661
+ * Notify plugins that editor has attached shadow root for an entity.
662
+ * Plugins can handle this event to do extra operations to the shadow root
663
+ */
664
+ AddShadowRoot = 9,
665
+ /**
666
+ * Notify plugins that editor has removed the shadow root of an entity
667
+ * Plugins can handle this event to do any necessary clean up for shadow root
668
+ */
669
+ RemoveShadowRoot = 10
660
670
  }
661
671
 
662
672
  /**
@@ -1202,6 +1212,18 @@ export interface EntityOperationEvent extends BasePluginEvent<PluginEventType.En
1202
1212
  * Optional raw event. Need to do null check before use its value
1203
1213
  */
1204
1214
  rawEvent?: Event;
1215
+ /**
1216
+ * A document fragment for entity based on Shadow DOM. This property is only available for NewEntity operation.
1217
+ * Putting DOM nodes under this fragment will cause a shadow root to be attached to the entity wrapper
1218
+ * with these DOM nodes under it.
1219
+ *
1220
+ * If there is already cached DOM nodes, they will also be put under this fragment.
1221
+ * Plugin need to decide:
1222
+ * 1. Apply the cache: do nothing and the DOM nodes will be appended as shadow DOM entity content
1223
+ * 2. Discard the cache and use new content instead: clear the fragment and append new DOM nodes, then new DOM nodes will be used
1224
+ * 3. Dehydrate this entity: clear the fragment, and leave it empty
1225
+ */
1226
+ contentForShadowEntity?: DocumentFragment;
1205
1227
  }
1206
1228
 
1207
1229
  /**
@@ -2750,8 +2772,9 @@ export interface IEditor {
2750
2772
  /**
2751
2773
  * Run a callback function asynchronously
2752
2774
  * @param callback The callback function to run
2775
+ * @returns a function to cancel this async run
2753
2776
  */
2754
- runAsync(callback: (editor: IEditor) => void): void;
2777
+ runAsync(callback: (editor: IEditor) => void): () => void;
2755
2778
  /**
2756
2779
  * Set DOM attribute of editor content DIV
2757
2780
  * @param name Name of the attribute
@@ -3887,9 +3910,10 @@ export interface EditPluginState {
3887
3910
  */
3888
3911
  export interface EntityPluginState {
3889
3912
  /**
3913
+ * @deprecated
3890
3914
  * Last clicking point when mouse down event happens
3891
3915
  */
3892
- clickingPoint: {
3916
+ clickingPoint?: {
3893
3917
  pageX: number;
3894
3918
  pageY: number;
3895
3919
  };
@@ -3897,6 +3921,12 @@ export interface EntityPluginState {
3897
3921
  * All known entity elements
3898
3922
  */
3899
3923
  knownEntityElements: HTMLElement[];
3924
+ /**
3925
+ * Cache for the hydrated content of shadow DOM entity.
3926
+ * When set content to replace the whole editor, we will cache the hydrated content
3927
+ * before it is gone, then after that we can use the cached content to rehydrate entity
3928
+ */
3929
+ shadowEntityCache: Record<string, HTMLElement>;
3900
3930
  }
3901
3931
 
3902
3932
  /**
@@ -4825,6 +4855,14 @@ export const KnownCreateElementData: Record<KnownCreateElementDataIndex, CreateE
4825
4855
  */
4826
4856
  export function moveChildNodes(target: Node, source?: Node, keepExistingChildren?: boolean): void;
4827
4857
 
4858
+ /**
4859
+ * Set the Style of a List Item provided, with the styles that the inline child elements have
4860
+ * If the child inline elements have different styles, it will not modify the styles of the list item
4861
+ * @param element the LI Element to set the styles
4862
+ * @param styles The styles that should be applied to the element.
4863
+ */
4864
+ export function setListItemStyle(element: HTMLLIElement, styles: string[]): void;
4865
+
4828
4866
  /**
4829
4867
  * A virtual table class, represent an HTML table, by expand all merged cells to each separated cells
4830
4868
  */
@@ -5856,8 +5894,9 @@ export class Editor implements IEditor {
5856
5894
  /**
5857
5895
  * Run a callback function asynchronously
5858
5896
  * @param callback The callback function to run
5897
+ * @returns a function to cancel this async run
5859
5898
  */
5860
- runAsync(callback: (editor: IEditor) => void): void;
5899
+ runAsync(callback: (editor: IEditor) => void): () => void;
5861
5900
  /**
5862
5901
  * Set DOM attribute of editor content DIV
5863
5902
  * @param name Name of the attribute
@@ -6586,6 +6625,10 @@ export class ImageEdit implements EditorPlugin {
6586
6625
  private editInfo;
6587
6626
  private lastSrc;
6588
6627
  private dndHelpers;
6628
+ /**
6629
+ * Identify if the image was resized by the user.
6630
+ */
6631
+ private wasResized;
6589
6632
  /**
6590
6633
  * Create a new instance of ImageEdit
6591
6634
  * @param options Image editing options