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