roosterjs 9.6.0 → 9.8.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 9.6.0)
1
+ // Type definitions for roosterjs (Version 9.8.0)
2
2
  // Generated by dts tool from roosterjs
3
3
  // Project: https://github.com/Microsoft/roosterjs
4
4
 
@@ -3092,9 +3092,11 @@ export interface TextMutationObserver {
3092
3092
  */
3093
3093
  stopObserving(): void;
3094
3094
  /**
3095
- * Flush all pending mutations that have not be handled in order to ignore them
3095
+ * Flush all pending mutations and update cached model if need
3096
+ * @param ignoreMutations When pass true, all mutations will be ignored and do not update content model.
3097
+ * This should only be used when we already have a up-to-date content model and will set it as latest cache
3096
3098
  */
3097
- flushMutations(newModel?: ContentModelDocument): void;
3099
+ flushMutations(ignoreMutations?: boolean): void;
3098
3100
  }
3099
3101
 
3100
3102
  /**
@@ -7888,6 +7890,16 @@ export function applySegmentFormat(editor: IEditor, newFormat: Readonly<ContentM
7888
7890
  */
7889
7891
  export function changeCapitalization(editor: IEditor, capitalization: 'sentence' | 'lowerCase' | 'upperCase' | 'capitalize', language?: string): void;
7890
7892
 
7893
+ /**
7894
+ * Split given text segments from the given range
7895
+ * @param textSegment segment to split
7896
+ * @param parent parent paragraph the text segment exist in
7897
+ * @param start starting point of the split
7898
+ * @param end ending point of the split
7899
+ * @returns text segment from the indicated split.
7900
+ */
7901
+ export function splitTextSegment(textSegment: ContentModelText, parent: ShallowMutableContentModelParagraph, start: number, end: number): ContentModelText;
7902
+
7891
7903
  /**
7892
7904
  * Insert an image into current selected position
7893
7905
  * @param editor The editor to operate on
@@ -8316,6 +8328,11 @@ export class PastePlugin implements EditorPlugin {
8316
8328
  private setEventSanitizers;
8317
8329
  }
8318
8330
 
8331
+ /**
8332
+ * Default style sanitizers for PastePlugin.
8333
+ */
8334
+ export const DefaultSanitizers: Record<string, ValueSanitizer>;
8335
+
8319
8336
  /**
8320
8337
  * Edit plugins helps editor to do editing operation on top of content model.
8321
8338
  * This includes:
@@ -8324,11 +8341,17 @@ export class PastePlugin implements EditorPlugin {
8324
8341
  * 3. Tab Key
8325
8342
  */
8326
8343
  export class EditPlugin implements EditorPlugin {
8344
+ private options;
8327
8345
  private editor;
8328
8346
  private disposer;
8329
8347
  private shouldHandleNextInputEvent;
8330
8348
  private selectionAfterDelete;
8331
8349
  private handleNormalEnter;
8350
+ /**
8351
+ * @param options An optional parameter that takes in an object of type EditOptions, which includes the following properties:
8352
+ * handleTabKey: A boolean that enables or disables Tab key handling. Defaults to true.
8353
+ */
8354
+ constructor(options?: EditOptions);
8332
8355
  /**
8333
8356
  * Get name of this plugin
8334
8357
  */
@@ -8366,6 +8389,16 @@ export class EditPlugin implements EditorPlugin {
8366
8389
  private handleBeforeInputEvent;
8367
8390
  }
8368
8391
 
8392
+ /**
8393
+ * Options to customize the keyboard handling behavior of Edit plugin
8394
+ */
8395
+ export type EditOptions = {
8396
+ /**
8397
+ * Whether to handle Tab key in keyboard. @default true
8398
+ */
8399
+ handleTabKey?: boolean;
8400
+ };
8401
+
8369
8402
  /**
8370
8403
  * Auto Format plugin handles auto formatting, such as transforming * characters into a bullet list.
8371
8404
  * It can be customized with options to enable or disable auto list features.
@@ -8715,6 +8748,7 @@ export class WatermarkPlugin implements EditorPlugin {
8715
8748
  private editor;
8716
8749
  private format;
8717
8750
  private isShowing;
8751
+ private darkTextColor;
8718
8752
  /**
8719
8753
  * Create an instance of Watermark plugin
8720
8754
  * @param watermark The watermark string
@@ -8740,6 +8774,7 @@ export class WatermarkPlugin implements EditorPlugin {
8740
8774
  onPluginEvent(event: PluginEvent): void;
8741
8775
  private showHide;
8742
8776
  protected show(editor: IEditor): void;
8777
+ private applyWatermarkStyle;
8743
8778
  protected hide(editor: IEditor): void;
8744
8779
  }
8745
8780
 
@@ -9128,7 +9163,7 @@ export class ImageEditPlugin implements ImageEditor, EditorPlugin {
9128
9163
  protected editor: IEditor | null;
9129
9164
  private shadowSpan;
9130
9165
  private selectedImage;
9131
- wrapper: HTMLSpanElement | null;
9166
+ protected wrapper: HTMLSpanElement | null;
9132
9167
  private imageEditInfo;
9133
9168
  private imageHTMLOptions;
9134
9169
  private dndHelpers;
@@ -9141,6 +9176,7 @@ export class ImageEditPlugin implements ImageEditor, EditorPlugin {
9141
9176
  private croppers;
9142
9177
  private zoomScale;
9143
9178
  private disposer;
9179
+ protected isEditing: boolean;
9144
9180
  constructor(options?: ImageEditOptions);
9145
9181
  /**
9146
9182
  * Get name of this plugin
@@ -9165,20 +9201,25 @@ export class ImageEditPlugin implements ImageEditor, EditorPlugin {
9165
9201
  * exclusively by another plugin.
9166
9202
  * @param event The event to handle:
9167
9203
  */
9168
- onPluginEvent(_event: PluginEvent): void;
9204
+ onPluginEvent(event: PluginEvent): void;
9205
+ private isImageSelection;
9206
+ private mouseUpHandler;
9207
+ private selectBeforeEditingImage;
9208
+ private keyDownHandler;
9209
+ private applyFormatWithContentModel;
9169
9210
  private startEditing;
9170
- startRotateAndResize(editor: IEditor, image: HTMLImageElement, apiOperation?: 'resize' | 'rotate'): void;
9211
+ startRotateAndResize(editor: IEditor, image: HTMLImageElement): void;
9171
9212
  private updateRotateHandleState;
9172
9213
  isOperationAllowed(operation: ImageEditOperation): boolean;
9173
9214
  canRegenerateImage(image: HTMLImageElement): boolean;
9215
+ private startCropMode;
9174
9216
  cropImage(): void;
9175
9217
  private editImage;
9176
9218
  private cleanInfo;
9177
- private formatImageWithContentModel;
9178
9219
  private removeImageWrapper;
9179
9220
  flipImage(direction: 'horizontal' | 'vertical'): void;
9180
9221
  rotateImage(angleRad: number): void;
9181
- getWrapper(): HTMLSpanElement | null;
9222
+ get isEditingImage(): boolean;
9182
9223
  }
9183
9224
 
9184
9225
  /**
@@ -9233,7 +9274,7 @@ export interface ImageEditOptions {
9233
9274
  * Which operations will be executed when image is selected
9234
9275
  * @default resizeAndRotate
9235
9276
  */
9236
- onSelectState?: ImageEditOperation;
9277
+ onSelectState?: ImageEditOperation[];
9237
9278
  }
9238
9279
 
9239
9280
  /**