roosterjs 9.49.0 → 9.50.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.
package/dist/rooster.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- // Type definitions for roosterjs (Version 9.49.0)
1
+ // Type definitions for roosterjs (Version 9.50.1)
2
2
  // Generated by dts tool from roosterjs
3
3
  // Project: https://github.com/Microsoft/roosterjs
4
4
 
@@ -6260,6 +6260,12 @@ interface BeforeCutCopyEvent extends BasePluginDomEvent<'beforeCutCopy', Clipboa
6260
6260
  * Provides a chance for plugin to change the content before it is pasted into editor.
6261
6261
  */
6262
6262
  interface BeforeDisposeEvent extends BasePluginEvent<'beforeDispose'> {
6263
+ }
6264
+
6265
+ /**
6266
+ * Data of BeforeDropEvent
6267
+ */
6268
+ interface BeforeDropEvent extends BasePluginDomEvent<'beforeDrop', DragEvent> {
6263
6269
  }
6264
6270
 
6265
6271
  /**
@@ -6616,7 +6622,7 @@ interface DoubleClickEvent extends BasePluginDomEvent<'doubleClick', MouseEvent>
6616
6622
  /**
6617
6623
  * Editor plugin event interface
6618
6624
  */
6619
- type PluginEvent = BeforeAddUndoSnapshotEvent | BeforeCutCopyEvent | BeforeDisposeEvent | BeforeKeyboardEditingEvent | BeforeLogicalRootChangeEvent | BeforePasteEvent | BeforeSetContentEvent | CompositionEndEvent | ContentChangedEvent | ContextMenuEvent | RewriteFromModelEvent | EditImageEvent | EditorReadyEvent | EnterShadowEditEvent | EntityOperationEvent | ExtractContentWithDomEvent | EditorInputEvent | KeyDownEvent | KeyPressEvent | KeyUpEvent | LeaveShadowEditEvent | LogicalRootChangedEvent | MouseDownEvent | MouseUpEvent | ScrollEvent | SelectionChangedEvent | ZoomChangedEvent | PointerDownEvent | PointerUpEvent | DoubleClickEvent | FindResultChangedEvent;
6625
+ type PluginEvent = BeforeAddUndoSnapshotEvent | BeforeCutCopyEvent | BeforeDisposeEvent | BeforeDropEvent | BeforeKeyboardEditingEvent | BeforeLogicalRootChangeEvent | BeforePasteEvent | BeforeSetContentEvent | CompositionEndEvent | ContentChangedEvent | ContextMenuEvent | RewriteFromModelEvent | EditImageEvent | EditorReadyEvent | EnterShadowEditEvent | EntityOperationEvent | ExtractContentWithDomEvent | EditorInputEvent | KeyDownEvent | KeyPressEvent | KeyUpEvent | LeaveShadowEditEvent | LogicalRootChangedEvent | MouseDownEvent | MouseUpEvent | ScrollEvent | SelectionChangedEvent | ZoomChangedEvent | PointerDownEvent | PointerUpEvent | DoubleClickEvent | FindResultChangedEvent;
6620
6626
 
6621
6627
  /**
6622
6628
  * A type to extract data part of a plugin event type. Data part is the plugin event without eventType field.
@@ -6777,7 +6783,11 @@ type PluginEventType = /**
6777
6783
  /**
6778
6784
  * Find result changed event
6779
6785
  */
6780
- | 'findResultChanged';
6786
+ | 'findResultChanged'
6787
+ /**
6788
+ * Let plugin know when a content will be dropped
6789
+ */
6790
+ | 'beforeDrop';
6781
6791
 
6782
6792
  /**
6783
6793
  * This interface represents a PluginEvent wrapping native scroll event
@@ -7415,15 +7425,6 @@ function normalizeParagraph(paragraph: ReadonlyContentModelParagraph): void;
7415
7425
  */
7416
7426
  function normalizeContentModel(group: ReadonlyContentModelBlockGroup): void;
7417
7427
 
7418
- /**
7419
- * Strip invisible Unicode characters from all text and link hrefs in a content model.
7420
- * This sanitizes the model at initialization time to prevent hidden content in links
7421
- * or text (e.g. zero-width chars, bidirectional marks, Unicode Tags).
7422
- * For General segments, all Text nodes under the element are also sanitized.
7423
- * @param model The content model document to sanitize in-place
7424
- */
7425
- function sanitizeInvisibleUnicode(model: ContentModelDocument): void;
7426
-
7427
7428
  /**
7428
7429
  * Check if the given block group is a general segment
7429
7430
  * @param group The group to check
@@ -7741,19 +7742,6 @@ function isSpace(char: string): boolean;
7741
7742
  */
7742
7743
  function normalizeText(txt: string, isForward: boolean): string;
7743
7744
 
7744
- /**
7745
- * Strip invisible Unicode characters from a string.
7746
- * This removes zero-width characters, bidirectional marks, Unicode Tags (U+E0001-U+E00FF),
7747
- * interlinear annotation anchors, Mongolian free variation selectors,
7748
- * and other invisible formatting characters that can be used to hide content in links.
7749
- *
7750
- * @remarks This function strips ZWJ (U+200D) which may affect emoji sequences.
7751
- * It should only be applied to href attributes, not to visible text content.
7752
- * @param value The string to strip invisible characters from
7753
- * @returns The string with invisible characters removed
7754
- */
7755
- function stripInvisibleUnicode(value: string): string;
7756
-
7757
7745
  /**
7758
7746
  * Parse a table into a two dimensions array of TD elements. For those merged cells, the value will be null.
7759
7747
  * @param table Input HTML Table element
@@ -10804,6 +10792,56 @@ class AnnouncePlugin implements EditorPlugin {
10804
10792
  onPluginEvent(event: PluginEvent): void;
10805
10793
  }
10806
10794
 
10795
+ /**
10796
+ * DragAndDrop plugin, handles ContentChanged event when change source is "Drop"
10797
+ * to sanitize dropped content, similar to how PastePlugin sanitizes pasted content.
10798
+ */
10799
+ class DragAndDropPlugin implements EditorPlugin {
10800
+ private editor;
10801
+ private forbiddenElements;
10802
+ private isInternalDragging;
10803
+ private disposer;
10804
+ /**
10805
+ * Construct a new instance of DragAndDropPlugin
10806
+ */
10807
+ constructor(options?: DragAndDropOptions);
10808
+ /**
10809
+ * Get name of this plugin
10810
+ */
10811
+ getName(): string;
10812
+ /**
10813
+ * The first method that editor will call to a plugin when editor is initializing.
10814
+ * It will pass in the editor instance, plugin should take this chance to save the
10815
+ * editor reference so that it can call to any editor method or format API later.
10816
+ * @param editor The editor object
10817
+ */
10818
+ initialize(editor: IEditor): void;
10819
+ /**
10820
+ * The last method that editor will call to a plugin before it is disposed.
10821
+ * Plugin can take this chance to clear the reference to editor. After this method is
10822
+ * called, plugin should not call to any editor method since it will result in error.
10823
+ */
10824
+ dispose(): void;
10825
+ /**
10826
+ * Core method for a plugin. Once an event happens in editor, editor will call this
10827
+ * method of each plugin to handle the event as long as the event is not handled
10828
+ * exclusively by another plugin.
10829
+ * @param event The event to handle:
10830
+ */
10831
+ onPluginEvent(event: PluginEvent): void;
10832
+ }
10833
+
10834
+ /**
10835
+ * Options for DragAndDrop plugin
10836
+ */
10837
+ interface DragAndDropOptions {
10838
+ /**
10839
+ * Forbidden elements that cannot be dropped in the editor
10840
+ * @default ['iframe']
10841
+ */
10842
+ forbiddenElements?: string[];
10843
+ }
10844
+
10807
10845
  /**
10808
10846
  * Get dark mode color for a given color
10809
10847
  * @param color The color to calculate from