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.
package/dist/rooster.d.ts CHANGED
@@ -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
 
@@ -3068,6 +3068,16 @@ interface DomIndexer {
3068
3068
  * @returns True if reconcile successfully, otherwise false
3069
3069
  */
3070
3070
  reconcileSelection: (model: ContentModelDocument, newSelection: DOMSelection, oldSelection?: CacheSelection) => boolean;
3071
+ /**
3072
+ * When child list of editor content is changed, we can use this method to do sync the change from editor into content model.
3073
+ * 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,
3074
+ * 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
3075
+ * in content model. But if we find anything that cannot be handled, return false so caller will invalidate the cached model
3076
+ * @param addedNodes Nodes added by browser during mutation
3077
+ * @param removedNodes Nodes removed by browser during mutation
3078
+ * @returns True if the changed nodes are successfully reconciled, otherwise false
3079
+ */
3080
+ reconcileChildList: (addedNodes: ArrayLike<Node>, removedNodes: ArrayLike<Node>) => boolean;
3071
3081
  }
3072
3082
 
3073
3083
  /**
@@ -3083,9 +3093,11 @@ interface TextMutationObserver {
3083
3093
  */
3084
3094
  stopObserving(): void;
3085
3095
  /**
3086
- * Flush all pending mutations that have not be handled in order to ignore them
3096
+ * Flush all pending mutations and update cached model if need
3097
+ * @param ignoreMutations When pass true, all mutations will be ignored and do not update content model.
3098
+ * This should only be used when we already have a up-to-date content model and will set it as latest cache
3087
3099
  */
3088
- flushMutations(): void;
3100
+ flushMutations(ignoreMutations?: boolean): void;
3089
3101
  }
3090
3102
 
3091
3103
  /**
@@ -7493,6 +7505,11 @@ const OrderedListStyleMap: Record<number, string>;
7493
7505
  */
7494
7506
  const UnorderedListStyleMap: Record<number, string>;
7495
7507
 
7508
+ /**
7509
+ * Provide a default empty instance of segment format with all its properties
7510
+ */
7511
+ const EmptySegmentFormat: Readonly<Required<ContentModelSegmentFormat>>;
7512
+
7496
7513
  /**
7497
7514
  * The main editor class based on Content Model
7498
7515
  */
@@ -7874,6 +7891,16 @@ function applySegmentFormat(editor: IEditor, newFormat: Readonly<ContentModelSeg
7874
7891
  */
7875
7892
  function changeCapitalization(editor: IEditor, capitalization: 'sentence' | 'lowerCase' | 'upperCase' | 'capitalize', language?: string): void;
7876
7893
 
7894
+ /**
7895
+ * Split given text segments from the given range
7896
+ * @param textSegment segment to split
7897
+ * @param parent parent paragraph the text segment exist in
7898
+ * @param start starting point of the split
7899
+ * @param end ending point of the split
7900
+ * @returns text segment from the indicated split.
7901
+ */
7902
+ function splitTextSegment(textSegment: ContentModelText, parent: ShallowMutableContentModelParagraph, start: number, end: number): ContentModelText;
7903
+
7877
7904
  /**
7878
7905
  * Insert an image into current selected position
7879
7906
  * @param editor The editor to operate on
@@ -8310,11 +8337,17 @@ class PastePlugin implements EditorPlugin {
8310
8337
  * 3. Tab Key
8311
8338
  */
8312
8339
  class EditPlugin implements EditorPlugin {
8340
+ private options;
8313
8341
  private editor;
8314
8342
  private disposer;
8315
8343
  private shouldHandleNextInputEvent;
8316
8344
  private selectionAfterDelete;
8317
8345
  private handleNormalEnter;
8346
+ /**
8347
+ * @param options An optional parameter that takes in an object of type EditOptions, which includes the following properties:
8348
+ * handleTabKey: A boolean that enables or disables Tab key handling. Defaults to true.
8349
+ */
8350
+ constructor(options?: EditOptions);
8318
8351
  /**
8319
8352
  * Get name of this plugin
8320
8353
  */
@@ -8352,6 +8385,16 @@ class EditPlugin implements EditorPlugin {
8352
8385
  private handleBeforeInputEvent;
8353
8386
  }
8354
8387
 
8388
+ /**
8389
+ * Options to customize the keyboard handling behavior of Edit plugin
8390
+ */
8391
+ type EditOptions = {
8392
+ /**
8393
+ * Whether to handle Tab key in keyboard. @default true
8394
+ */
8395
+ handleTabKey?: boolean;
8396
+ };
8397
+
8355
8398
  /**
8356
8399
  * Auto Format plugin handles auto formatting, such as transforming * characters into a bullet list.
8357
8400
  * It can be customized with options to enable or disable auto list features.
@@ -8701,6 +8744,7 @@ class WatermarkPlugin implements EditorPlugin {
8701
8744
  private editor;
8702
8745
  private format;
8703
8746
  private isShowing;
8747
+ private darkTextColor;
8704
8748
  /**
8705
8749
  * Create an instance of Watermark plugin
8706
8750
  * @param watermark The watermark string
@@ -8726,6 +8770,7 @@ class WatermarkPlugin implements EditorPlugin {
8726
8770
  onPluginEvent(event: PluginEvent): void;
8727
8771
  private showHide;
8728
8772
  protected show(editor: IEditor): void;
8773
+ private applyWatermarkStyle;
8729
8774
  protected hide(editor: IEditor): void;
8730
8775
  }
8731
8776
 
@@ -9114,7 +9159,7 @@ class ImageEditPlugin implements ImageEditor, EditorPlugin {
9114
9159
  protected editor: IEditor | null;
9115
9160
  private shadowSpan;
9116
9161
  private selectedImage;
9117
- wrapper: HTMLSpanElement | null;
9162
+ protected wrapper: HTMLSpanElement | null;
9118
9163
  private imageEditInfo;
9119
9164
  private imageHTMLOptions;
9120
9165
  private dndHelpers;
@@ -9127,6 +9172,7 @@ class ImageEditPlugin implements ImageEditor, EditorPlugin {
9127
9172
  private croppers;
9128
9173
  private zoomScale;
9129
9174
  private disposer;
9175
+ protected isEditing: boolean;
9130
9176
  constructor(options?: ImageEditOptions);
9131
9177
  /**
9132
9178
  * Get name of this plugin
@@ -9151,20 +9197,25 @@ class ImageEditPlugin implements ImageEditor, EditorPlugin {
9151
9197
  * exclusively by another plugin.
9152
9198
  * @param event The event to handle:
9153
9199
  */
9154
- onPluginEvent(_event: PluginEvent): void;
9200
+ onPluginEvent(event: PluginEvent): void;
9201
+ private isImageSelection;
9202
+ private mouseUpHandler;
9203
+ private selectBeforeEditingImage;
9204
+ private keyDownHandler;
9205
+ private applyFormatWithContentModel;
9155
9206
  private startEditing;
9156
- startRotateAndResize(editor: IEditor, image: HTMLImageElement, apiOperation?: 'resize' | 'rotate'): void;
9207
+ startRotateAndResize(editor: IEditor, image: HTMLImageElement): void;
9157
9208
  private updateRotateHandleState;
9158
9209
  isOperationAllowed(operation: ImageEditOperation): boolean;
9159
9210
  canRegenerateImage(image: HTMLImageElement): boolean;
9211
+ private startCropMode;
9160
9212
  cropImage(): void;
9161
9213
  private editImage;
9162
9214
  private cleanInfo;
9163
- private formatImageWithContentModel;
9164
9215
  private removeImageWrapper;
9165
9216
  flipImage(direction: 'horizontal' | 'vertical'): void;
9166
9217
  rotateImage(angleRad: number): void;
9167
- getWrapper(): HTMLSpanElement | null;
9218
+ get isEditingImage(): boolean;
9168
9219
  }
9169
9220
 
9170
9221
  /**
@@ -9219,7 +9270,7 @@ interface ImageEditOptions {
9219
9270
  * Which operations will be executed when image is selected
9220
9271
  * @default resizeAndRotate
9221
9272
  */
9222
- onSelectState?: ImageEditOperation;
9273
+ onSelectState?: ImageEditOperation[];
9223
9274
  }
9224
9275
 
9225
9276
  /**