roosterjs 9.61.0 → 9.63.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.61.0)
1
+ // Type definitions for roosterjs (Version 9.63.0)
2
2
  // Generated by dts tool from roosterjs
3
3
  // Project: https://github.com/Microsoft/roosterjs
4
4
 
@@ -557,6 +557,11 @@ export type SuperOrSubScriptFormat = {
557
557
  * e.g. sub super sub
558
558
  */
559
559
  superOrSubScriptSequence?: string;
560
+ /**
561
+ * Inherit the segment's font size instead of shrinking superscript/subscript wrappers.
562
+ * An empty value restores the default wrapper size.
563
+ */
564
+ superOrSubScriptFontSize?: 'inherit' | '';
560
565
  };
561
566
 
562
567
  /**
@@ -3917,7 +3922,7 @@ export type ExperimentalFeature = GraduatedExperimentalFeature
3917
3922
  */
3918
3923
  | 'ShadowDom'
3919
3924
  /**
3920
- * Strip invisible unicode characters (U+E0000 to U+EFFFF) from text segments during DOM to Model conversion.
3925
+ * Strip invisible unicode characters (U+E0000 to U+E007F) from text segments during DOM to Model conversion.
3921
3926
  * These characters can be used to hide text in HTML and may cause unexpected behavior.
3922
3927
  * @see https://embracethered.com/blog/posts/2024/hiding-and-finding-text-with-unicode-tags/
3923
3928
  */
@@ -3925,7 +3930,12 @@ export type ExperimentalFeature = GraduatedExperimentalFeature
3925
3930
  /**
3926
3931
  * Handle the drop event for content that is dropped from the same editor instance.
3927
3932
  */
3928
- | 'HandleDropInternalContent';
3933
+ | 'HandleDropInternalContent'
3934
+ /**
3935
+ * Apply Word-like spacing to list items and their direct element children,
3936
+ * and default images without an explicit vertical alignment to middle.
3937
+ */
3938
+ | 'WordLikeStyles';
3929
3939
 
3930
3940
  /**
3931
3941
  * Predefined experiment features (Graduated, only keep them for backward compatibility)
@@ -4045,6 +4055,11 @@ export interface ContentModelOptions {
4045
4055
  * Options for selection
4046
4056
  */
4047
4057
  export interface SelectionOptions {
4058
+ /**
4059
+ * Background color of selected text. When unset, use the browser's default selection style.
4060
+ * The dark mode color is derived using getDarkColor.
4061
+ */
4062
+ textSelectionColor?: string;
4048
4063
  /**
4049
4064
  * Color of the border of a selectedImage. Default color: '#DB626C'
4050
4065
  */
@@ -4758,6 +4773,14 @@ export interface SelectionPluginState {
4758
4773
  * When set to true, onFocus event will not trigger reselect cached range
4759
4774
  */
4760
4775
  skipReselectOnFocus?: boolean;
4776
+ /**
4777
+ * Background color of selected text. When unset, use the browser's default selection style.
4778
+ */
4779
+ textSelectionColor?: string;
4780
+ /**
4781
+ * Background color of selected text in dark mode. When unset, use the browser's default selection style.
4782
+ */
4783
+ textSelectionColorDark?: string;
4761
4784
  /**
4762
4785
  * Color of the border of a selectedImage. Default color: '#DB626C'
4763
4786
  */
@@ -6074,6 +6097,14 @@ export interface MergeModelOption {
6074
6097
  * @default undefined
6075
6098
  */
6076
6099
  mergeFormat?: 'mergeAll' | 'keepSourceEmphasisFormat' | 'none' | 'preferSource' | 'preferTarget';
6100
+ /**
6101
+ * Preserve source paragraph decorators, including heading tags and sizes, when
6102
+ * using 'keepSourceEmphasisFormat'. Decorator formatting takes precedence over
6103
+ * target formatting on source segments.
6104
+ * Also include target paragraph decorator and segment formatting in the inherited format.
6105
+ * @default false
6106
+ */
6107
+ preserveParagraphDecorator?: boolean;
6077
6108
  /**
6078
6109
  * Whether to add a paragraph after the merged content.
6079
6110
  */
@@ -9269,6 +9300,13 @@ export function setListStartNumber(editor: IEditor, value: number): void;
9269
9300
  */
9270
9301
  export function setIndentation(editor: IEditor, indentation: 'indent' | 'outdent', length?: number): void;
9271
9302
 
9303
+ /**
9304
+ * Insert a horizontal line into editor at current selection, replacing selected content
9305
+ * @param editor The editor instance
9306
+ * @param format Optional divider format. Defaults to a thin solid line with 98% width
9307
+ */
9308
+ export function insertHorizontalLine(editor: IEditor, format?: ContentModelDividerFormat): void;
9309
+
9272
9310
  /**
9273
9311
  * Set text alignment of selected paragraphs
9274
9312
  * @param editor The editor to set alignment
@@ -9323,6 +9361,14 @@ export function setImageBorder(editor: IEditor, border: Border | null, borderRad
9323
9361
  */
9324
9362
  export function setImageBoxShadow(editor: IEditor, boxShadow: string, margin?: string | null): void;
9325
9363
 
9364
+ /**
9365
+ * Set the width and height of all selected images.
9366
+ * @param editor The editor instance
9367
+ * @param width The image width as a CSS value (e.g. "200px" or "50%"). An empty string clears the explicit width.
9368
+ * @param height The image height as a CSS value (e.g. "100px" or "auto"). An empty string clears the explicit height.
9369
+ */
9370
+ export function setImageSize(editor: IEditor, width: string, height: string): void;
9371
+
9326
9372
  /**
9327
9373
  * Change the selected image src
9328
9374
  * @param editor The editor instance
@@ -9553,6 +9599,11 @@ export function findListItemsInSameThread(group: ReadonlyContentModelBlockGroup,
9553
9599
  */
9554
9600
  export function setModelIndentation(model: ReadonlyContentModelDocument, indentation: 'indent' | 'outdent', length?: number, context?: FormatContentModelContext): boolean;
9555
9601
 
9602
+ /**
9603
+ * Insert a horizontal line into the model at current selection
9604
+ */
9605
+ export function insertHorizontalLineIntoModel(model: ReadonlyContentModelDocument, context: FormatContentModelContext, format?: ContentModelDividerFormat): boolean;
9606
+
9556
9607
  /**
9557
9608
  * Determine text direction from the first strong directional character
9558
9609
  * @param text Text to scan
@@ -10667,6 +10718,10 @@ export interface CustomReplace {
10667
10718
  * - Crop image
10668
10719
  * - Rotate image
10669
10720
  * - Flip image
10721
+ *
10722
+ * In crop mode, Tab focuses the top-left corner, bottom-right corner, then the
10723
+ * whole image. Arrow keys crop at corners or move the fixed-size crop viewport
10724
+ * by one pixel. Enter applies the crop; Escape cancels it.
10670
10725
  */
10671
10726
  export class ImageEditPlugin implements ImageEditor, EditorPlugin {
10672
10727
  protected editor: IEditor | null;
@@ -10685,6 +10740,7 @@ export class ImageEditPlugin implements ImageEditor, EditorPlugin {
10685
10740
  private croppers;
10686
10741
  private zoomScale;
10687
10742
  private disposer;
10743
+ private cropKeyboardHelper;
10688
10744
  protected isEditing: boolean;
10689
10745
  protected options: ImageEditOptions;
10690
10746
  constructor(options?: ImageEditOptions);
@@ -10719,6 +10775,7 @@ export class ImageEditPlugin implements ImageEditor, EditorPlugin {
10719
10775
  private mouseDownHandler;
10720
10776
  private onDropHandler;
10721
10777
  private keyDownHandler;
10778
+ private focusCropHandle;
10722
10779
  private setContentHandler;
10723
10780
  private formatEventHandler;
10724
10781
  private contentChangedHandler;
@@ -10735,6 +10792,8 @@ export class ImageEditPlugin implements ImageEditor, EditorPlugin {
10735
10792
  isOperationAllowed(operation: ImageEditOperation): boolean;
10736
10793
  canRegenerateImage(image: HTMLImageElement): boolean;
10737
10794
  private startCropMode;
10795
+ private startCropWithKeyboard;
10796
+ private finishKeyboardCrop;
10738
10797
  cropImage(): void;
10739
10798
  private editImage;
10740
10799
  /**
@@ -10794,6 +10853,11 @@ export interface ImageEditOptions {
10794
10853
  * Whether image crop is disabled. @default false
10795
10854
  */
10796
10855
  disableCrop?: boolean;
10856
+ /**
10857
+ * Optional localized crop accessibility text.
10858
+ * Omitted or empty values are not added to the crop controls.
10859
+ */
10860
+ cropLabels?: CropAccessibilityLabels;
10797
10861
  /**
10798
10862
  * Which operations will be executed when image is selected
10799
10863
  * @default resizeAndRotate
@@ -10819,6 +10883,29 @@ export interface ImageEditOptions {
10819
10883
  resolveImageSource?: (src: string) => string | undefined;
10820
10884
  }
10821
10885
 
10886
+ /**
10887
+ * Localized accessibility text for image crop controls.
10888
+ */
10889
+ export interface CropAccessibilityLabels {
10890
+ /**
10891
+ * Optional accessible crop corner label. Direction is top left (nw) or bottom right (se).
10892
+ * Falls back to "Top left" or "Bottom right" when omitted or empty.
10893
+ */
10894
+ handleLabel?: (direction: 'nw' | 'se') => string;
10895
+ /**
10896
+ * Optional accessible label for the whole-image focus target that moves the crop viewport.
10897
+ * Falls back to "Move Crop" when omitted or empty.
10898
+ */
10899
+ moveCropLabel?: string;
10900
+ /**
10901
+ * Optional localized keyboard cropping instructions. No instructions are added when
10902
+ * omitted or empty. Arrow keys move one pixel in screen
10903
+ * directions; Tab visits top left, bottom right, then the whole image.
10904
+ * Enter applies the crop and Escape cancels it.
10905
+ */
10906
+ instructions?: string;
10907
+ }
10908
+
10822
10909
  /**
10823
10910
  * HiddenPropertyPlugin helps editor to maintain hidden properties in DOM after editor content is reset using HTML
10824
10911
  */
@@ -11212,6 +11299,12 @@ export interface MarkdownToModelOptions {
11212
11299
  * @default 'ltr'
11213
11300
  */
11214
11301
  direction?: 'ltr' | 'rtl' | undefined;
11302
+ /**
11303
+ * Specify the table styles to apply to tables converted from markdown.
11304
+ * When omitted, use plain markdown table styles with black borders and no header styling.
11305
+ * When specified, use the provided table metadata instead of the default markdown styles.
11306
+ */
11307
+ tableStyles?: TableMetadataFormat;
11215
11308
  }
11216
11309
 
11217
11310
  /**
@@ -11269,5 +11362,10 @@ export interface MarkdownPasteOptions {
11269
11362
  * @default false
11270
11363
  */
11271
11364
  undoConversion: boolean;
11365
+ /**
11366
+ * Options for converting pasted markdown text into a content model.
11367
+ * An omitted or undefined emptyLine option defaults to 'merge'.
11368
+ */
11369
+ markdownToModelOptions?: MarkdownToModelOptions;
11272
11370
  }
11273
11371