roosterjs 9.5.1 → 9.7.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.5.1)
1
+ // Type definitions for roosterjs (Version 9.7.0)
2
2
  // Generated by dts tool from roosterjs
3
3
  // Project: https://github.com/Microsoft/roosterjs
4
4
 
@@ -3067,6 +3067,16 @@ export interface DomIndexer {
3067
3067
  * @returns True if reconcile successfully, otherwise false
3068
3068
  */
3069
3069
  reconcileSelection: (model: ContentModelDocument, newSelection: DOMSelection, oldSelection?: CacheSelection) => boolean;
3070
+ /**
3071
+ * When child list of editor content is changed, we can use this method to do sync the change from editor into content model.
3072
+ * This is mostly used when user start to type in an empty line. In that case browser will remove the existing BR node in the empty line if any,
3073
+ * and create a new TEXT node for the typed text. Here we use these information to remove original Br segment and create a new Text segment
3074
+ * in content model. But if we find anything that cannot be handled, return false so caller will invalidate the cached model
3075
+ * @param addedNodes Nodes added by browser during mutation
3076
+ * @param removedNodes Nodes removed by browser during mutation
3077
+ * @returns True if the changed nodes are successfully reconciled, otherwise false
3078
+ */
3079
+ reconcileChildList: (addedNodes: ArrayLike<Node>, removedNodes: ArrayLike<Node>) => boolean;
3070
3080
  }
3071
3081
 
3072
3082
  /**
@@ -3082,9 +3092,11 @@ export interface TextMutationObserver {
3082
3092
  */
3083
3093
  stopObserving(): void;
3084
3094
  /**
3085
- * 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
3086
3098
  */
3087
- flushMutations(): void;
3099
+ flushMutations(ignoreMutations?: boolean): void;
3088
3100
  }
3089
3101
 
3090
3102
  /**
@@ -7492,6 +7504,11 @@ export const OrderedListStyleMap: Record<number, string>;
7492
7504
  */
7493
7505
  export const UnorderedListStyleMap: Record<number, string>;
7494
7506
 
7507
+ /**
7508
+ * Provide a default empty instance of segment format with all its properties
7509
+ */
7510
+ export const EmptySegmentFormat: Readonly<Required<ContentModelSegmentFormat>>;
7511
+
7495
7512
  /**
7496
7513
  * The main editor class based on Content Model
7497
7514
  */
@@ -7873,6 +7890,16 @@ export function applySegmentFormat(editor: IEditor, newFormat: Readonly<ContentM
7873
7890
  */
7874
7891
  export function changeCapitalization(editor: IEditor, capitalization: 'sentence' | 'lowerCase' | 'upperCase' | 'capitalize', language?: string): void;
7875
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
+
7876
7903
  /**
7877
7904
  * Insert an image into current selected position
7878
7905
  * @param editor The editor to operate on
@@ -8309,11 +8336,17 @@ export class PastePlugin implements EditorPlugin {
8309
8336
  * 3. Tab Key
8310
8337
  */
8311
8338
  export class EditPlugin implements EditorPlugin {
8339
+ private options;
8312
8340
  private editor;
8313
8341
  private disposer;
8314
8342
  private shouldHandleNextInputEvent;
8315
8343
  private selectionAfterDelete;
8316
8344
  private handleNormalEnter;
8345
+ /**
8346
+ * @param options An optional parameter that takes in an object of type EditOptions, which includes the following properties:
8347
+ * handleTabKey: A boolean that enables or disables Tab key handling. Defaults to true.
8348
+ */
8349
+ constructor(options?: EditOptions);
8317
8350
  /**
8318
8351
  * Get name of this plugin
8319
8352
  */
@@ -8351,6 +8384,16 @@ export class EditPlugin implements EditorPlugin {
8351
8384
  private handleBeforeInputEvent;
8352
8385
  }
8353
8386
 
8387
+ /**
8388
+ * Options to customize the keyboard handling behavior of Edit plugin
8389
+ */
8390
+ export type EditOptions = {
8391
+ /**
8392
+ * Whether to handle Tab key in keyboard. @default true
8393
+ */
8394
+ handleTabKey?: boolean;
8395
+ };
8396
+
8354
8397
  /**
8355
8398
  * Auto Format plugin handles auto formatting, such as transforming * characters into a bullet list.
8356
8399
  * It can be customized with options to enable or disable auto list features.
@@ -8700,6 +8743,7 @@ export class WatermarkPlugin implements EditorPlugin {
8700
8743
  private editor;
8701
8744
  private format;
8702
8745
  private isShowing;
8746
+ private darkTextColor;
8703
8747
  /**
8704
8748
  * Create an instance of Watermark plugin
8705
8749
  * @param watermark The watermark string
@@ -8725,6 +8769,7 @@ export class WatermarkPlugin implements EditorPlugin {
8725
8769
  onPluginEvent(event: PluginEvent): void;
8726
8770
  private showHide;
8727
8771
  protected show(editor: IEditor): void;
8772
+ private applyWatermarkStyle;
8728
8773
  protected hide(editor: IEditor): void;
8729
8774
  }
8730
8775
 
@@ -9113,7 +9158,7 @@ export class ImageEditPlugin implements ImageEditor, EditorPlugin {
9113
9158
  protected editor: IEditor | null;
9114
9159
  private shadowSpan;
9115
9160
  private selectedImage;
9116
- wrapper: HTMLSpanElement | null;
9161
+ protected wrapper: HTMLSpanElement | null;
9117
9162
  private imageEditInfo;
9118
9163
  private imageHTMLOptions;
9119
9164
  private dndHelpers;
@@ -9126,6 +9171,7 @@ export class ImageEditPlugin implements ImageEditor, EditorPlugin {
9126
9171
  private croppers;
9127
9172
  private zoomScale;
9128
9173
  private disposer;
9174
+ protected isEditing: boolean;
9129
9175
  constructor(options?: ImageEditOptions);
9130
9176
  /**
9131
9177
  * Get name of this plugin
@@ -9150,20 +9196,25 @@ export class ImageEditPlugin implements ImageEditor, EditorPlugin {
9150
9196
  * exclusively by another plugin.
9151
9197
  * @param event The event to handle:
9152
9198
  */
9153
- onPluginEvent(_event: PluginEvent): void;
9199
+ onPluginEvent(event: PluginEvent): void;
9200
+ private isImageSelection;
9201
+ private mouseUpHandler;
9202
+ private selectBeforeEditingImage;
9203
+ private keyDownHandler;
9204
+ private applyFormatWithContentModel;
9154
9205
  private startEditing;
9155
- startRotateAndResize(editor: IEditor, image: HTMLImageElement, apiOperation?: 'resize' | 'rotate'): void;
9206
+ startRotateAndResize(editor: IEditor, image: HTMLImageElement): void;
9156
9207
  private updateRotateHandleState;
9157
9208
  isOperationAllowed(operation: ImageEditOperation): boolean;
9158
9209
  canRegenerateImage(image: HTMLImageElement): boolean;
9210
+ private startCropMode;
9159
9211
  cropImage(): void;
9160
9212
  private editImage;
9161
9213
  private cleanInfo;
9162
- private formatImageWithContentModel;
9163
9214
  private removeImageWrapper;
9164
9215
  flipImage(direction: 'horizontal' | 'vertical'): void;
9165
9216
  rotateImage(angleRad: number): void;
9166
- getWrapper(): HTMLSpanElement | null;
9217
+ get isEditingImage(): boolean;
9167
9218
  }
9168
9219
 
9169
9220
  /**
@@ -9218,7 +9269,7 @@ export interface ImageEditOptions {
9218
9269
  * Which operations will be executed when image is selected
9219
9270
  * @default resizeAndRotate
9220
9271
  */
9221
- onSelectState?: ImageEditOperation;
9272
+ onSelectState?: ImageEditOperation[];
9222
9273
  }
9223
9274
 
9224
9275
  /**