roosterjs 9.36.0 → 9.37.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 9.36.0)
1
+ // Type definitions for roosterjs (Version 9.37.0)
2
2
  // Generated by dts tool from roosterjs
3
3
  // Project: https://github.com/Microsoft/roosterjs
4
4
 
@@ -6336,10 +6336,16 @@ interface MouseUpEvent extends BasePluginDomEvent<'mouseUp', MouseEvent> {
6336
6336
  isClicking?: boolean;
6337
6337
  }
6338
6338
 
6339
+ /**
6340
+ * This interface represents a PluginEvent wrapping native dblClick event
6341
+ */
6342
+ interface DoubleClickEvent extends BasePluginDomEvent<'doubleClick', MouseEvent> {
6343
+ }
6344
+
6339
6345
  /**
6340
6346
  * Editor plugin event interface
6341
6347
  */
6342
- 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;
6348
+ 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;
6343
6349
 
6344
6350
  /**
6345
6351
  * A type to extract data part of a plugin event type. Data part is the plugin event without eventType field.
@@ -6484,7 +6490,19 @@ type PluginEventType = /**
6484
6490
  * Before an undo snapshot is added to the undo stack.
6485
6491
  * This event is used to give plugins a chance to add additional state to the snapshot.
6486
6492
  */
6487
- | 'beforeAddUndoSnapshot';
6493
+ | 'beforeAddUndoSnapshot'
6494
+ /**
6495
+ * HTML PointerDown event - for touch only
6496
+ */
6497
+ | 'pointerDown'
6498
+ /**
6499
+ * HTML PointerUp event - for touch only
6500
+ */
6501
+ | 'pointerUp'
6502
+ /**
6503
+ * HTML double click event
6504
+ */
6505
+ | 'doubleClick';
6488
6506
 
6489
6507
  /**
6490
6508
  * This interface represents a PluginEvent wrapping native scroll event
@@ -6530,6 +6548,20 @@ interface ZoomChangedEvent extends BasePluginEvent<'zoomChanged'> {
6530
6548
  newZoomScale: number;
6531
6549
  }
6532
6550
 
6551
+ /**
6552
+ * This interface represents a PluginEvent wrapping native PointerDown event
6553
+ */
6554
+ interface PointerDownEvent extends BasePluginDomEvent<'pointerDown', PointerEvent> {
6555
+ originalEvent: MouseEvent | TouchEvent;
6556
+ }
6557
+
6558
+ /**
6559
+ * This interface represents a PluginEvent wrapping native PointerUp event
6560
+ */
6561
+ interface PointerUpEvent extends BasePluginDomEvent<'pointerUp', PointerEvent> {
6562
+ originalEvent: MouseEvent | TouchEvent;
6563
+ }
6564
+
6533
6565
  /**
6534
6566
  * Create Content Model from DOM tree in this editor
6535
6567
  * @param root Root element of DOM tree to create Content Model from
@@ -9078,6 +9110,7 @@ class EditPlugin implements EditorPlugin {
9078
9110
  willHandleEventExclusively(event: PluginEvent): boolean;
9079
9111
  private handleKeyDownEvent;
9080
9112
  private handleBeforeInputEvent;
9113
+ private shouldBrowserHandleBackspace;
9081
9114
  }
9082
9115
 
9083
9116
  /**
@@ -9100,6 +9133,13 @@ type EditOptions = {
9100
9133
  * @returns A boolean
9101
9134
  */
9102
9135
  shouldHandleEnterKey?: ((editor: IEditor) => boolean) | boolean;
9136
+ /**
9137
+ * Callback or boolean to determine whether the browser (not Content Model) should handle the Backspace key press.
9138
+ * If the value/callback returns true, Rooster will NOT handle Backspace and will defer to the browser's native behavior.
9139
+ * @param editor - The editor instance (when using callback).
9140
+ * @returns A boolean
9141
+ */
9142
+ shouldHandleBackspaceKey?: ((editor: IEditor) => boolean) | boolean;
9103
9143
  };
9104
9144
 
9105
9145
  /**
@@ -9935,7 +9975,7 @@ class ImageEditPlugin implements ImageEditor, EditorPlugin {
9935
9975
  /**
9936
9976
  * EXPOSED FOR TESTING PURPOSE ONLY
9937
9977
  */
9938
- protected applyFormatWithContentModel(editor: IEditor, isCropMode: boolean, shouldSelectImage: boolean, isApiOperation?: boolean): void;
9978
+ protected applyFormatWithContentModel(editor: IEditor, isCropMode: boolean, shouldSelectImage?: boolean, isApiOperation?: boolean): void;
9939
9979
  private startEditing;
9940
9980
  private updateImageDimensionsIfZero;
9941
9981
  private startEditingInternal;
@@ -9978,7 +10018,7 @@ interface ImageEditOptions {
9978
10018
  /**
9979
10019
  * Whether preserve width/height ratio when resize
9980
10020
  * Pressing SHIFT key when resize will for preserve ratio even this value is set to false
9981
- * @default false
10021
+ * @default true
9982
10022
  */
9983
10023
  preserveRatio?: boolean;
9984
10024
  /**
@@ -10060,6 +10100,38 @@ interface HiddenPropertyOptions {
10060
10100
  undeletableLinkChecker?: (link: HTMLAnchorElement) => boolean;
10061
10101
  }
10062
10102
 
10103
+ /**
10104
+ * Touch plugin to manage touch behaviors
10105
+ */
10106
+ class TouchPlugin implements EditorPlugin {
10107
+ private editor;
10108
+ private timer;
10109
+ private isDblClicked;
10110
+ private isTouchPenPointerEvent;
10111
+ /**
10112
+ * Create an instance of Touch plugin
10113
+ */
10114
+ constructor();
10115
+ /**
10116
+ * Get a friendly name of this plugin
10117
+ */
10118
+ getName(): string;
10119
+ /**
10120
+ * Initialize this plugin. This should only be called from Editor
10121
+ * @param editor Editor instance
10122
+ */
10123
+ initialize(editor: IEditor): void;
10124
+ /**
10125
+ * Dispose this plugin
10126
+ */
10127
+ dispose(): void;
10128
+ /**
10129
+ * Handle events triggered from editor
10130
+ * @param event PluginEvent object
10131
+ */
10132
+ onPluginEvent(event: PluginEvent): void;
10133
+ }
10134
+
10063
10135
  /**
10064
10136
  * Get dark mode color for a given color
10065
10137
  * @param color The color to calculate from