roosterjs 9.57.0 → 9.59.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.57.0)
1
+ // Type definitions for roosterjs (Version 9.59.0)
2
2
  // Generated by dts tool from roosterjs
3
3
  // Project: https://github.com/Microsoft/roosterjs
4
4
 
@@ -3910,10 +3910,6 @@ export type ExperimentalFeature = GraduatedExperimentalFeature
3910
3910
  * the original formatting of the selection marker is kept to match the pending format.
3911
3911
  */
3912
3912
  | 'KeepSelectionMarkerWhenEnteringTextNode'
3913
- /**
3914
- * Transform the table border colors when switching from light to dark mode
3915
- */
3916
- | 'TransformTableBorderColors'
3917
3913
  /**
3918
3914
  * When the editor content div is inside a Shadow DOM, enable shadow root detection
3919
3915
  * in DOMHelper so that selection, focus, and element appending work correctly within
@@ -3970,7 +3966,12 @@ export type GraduatedExperimentalFeature = /**
3970
3966
  * @deprecated
3971
3967
  * Allow caching list item elements.
3972
3968
  */
3973
- | 'CacheList';
3969
+ | 'CacheList'
3970
+ /**
3971
+ * @deprecated
3972
+ * Transform the table border colors when switching from light to dark mode
3973
+ */
3974
+ | 'TransformTableBorderColors';
3974
3975
 
3975
3976
  /**
3976
3977
  * Options for editor
@@ -4935,6 +4936,10 @@ export interface EditorEnvironment {
4935
4936
  * Whether current browser is on mobile or a tablet
4936
4937
  */
4937
4938
  readonly isMobileOrTablet?: boolean;
4939
+ /**
4940
+ * Whether current browser supports touch input
4941
+ */
4942
+ readonly isTouchSupported?: boolean;
4938
4943
  /**
4939
4944
  * Settings used by DOM to Content Model conversion
4940
4945
  */
@@ -5747,7 +5752,14 @@ export type KnownAnnounceStrings = /**
5747
5752
  * @example
5748
5753
  * {0}, unselected
5749
5754
  */
5750
- | 'unselected';
5755
+ | 'unselected'
5756
+ /**
5757
+ * String announced when a new line is inserted in the editor.
5758
+ * Used when Enter is pressed and a new line is inserted in the editor.
5759
+ * @example
5760
+ * New line inserted
5761
+ */
5762
+ | 'newLineInserted';
5751
5763
 
5752
5764
  /**
5753
5765
  * Options for announcing format changes
@@ -6038,7 +6050,9 @@ export interface LinkData {
6038
6050
  */
6039
6051
  export interface MergeModelOption {
6040
6052
  /**
6041
- * When there is only a table to merge, whether merge this table into current table (if any), or just directly insert (nested table).
6053
+ * When there is only a table to merge, whether to merge this table into the current table,
6054
+ * or into the table immediately before the insert position. Otherwise, insert it as a
6055
+ * separate or nested table.
6042
6056
  * This is usually used when paste table inside a table
6043
6057
  * @default false
6044
6058
  */
@@ -6064,6 +6078,11 @@ export interface MergeModelOption {
6064
6078
  * Whether to add a paragraph after the merged content.
6065
6079
  */
6066
6080
  addParagraphAfterMergedContent?: boolean;
6081
+ /**
6082
+ * Whether to merge into an empty paragraph immediately after a list as a new list item.
6083
+ * @default false
6084
+ */
6085
+ mergeParagraphAfterList?: boolean;
6067
6086
  }
6068
6087
 
6069
6088
  /**
@@ -7017,6 +7036,49 @@ export interface FindResultChangedEvent extends BasePluginEvent<'findResultChang
7017
7036
  readonly alternativeRange?: Range | null;
7018
7037
  }
7019
7038
 
7039
+ /**
7040
+ * An optional global hook for developer tools (such as the RoosterJS DevTools browser extension) to
7041
+ * discover and inspect editor instances on a page.
7042
+ *
7043
+ * A developer tool installs an object implementing this interface on
7044
+ * `window.__ROOSTERJS_DEVTOOLS_HOOK__`. When present, each editor will call its callbacks on
7045
+ * creation, disposal and for every plugin event. This mirrors the React DevTools global hook
7046
+ * pattern: the editor only detects and calls the hook, while all developer-tools logic lives in the
7047
+ * tool that installs it.
7048
+ *
7049
+ * For tools that attach after editors are created (for example, a script pasted into the console),
7050
+ * the library also maintains the array of live editors on `window.__ROOSTERJS_DEVTOOLS_EDITORS__`.
7051
+ *
7052
+ * All members are optional so the contract can grow without breaking older tools. The editor calls
7053
+ * each callback defensively and swallows any error, so a faulty tool can never break editing.
7054
+ */
7055
+ export interface RoosterJsDevToolsHook {
7056
+ /**
7057
+ * The contract version the editor was built against. The editor stamps this onto the hook when
7058
+ * it detects it, so a tool can read it to stay compatible across editor versions. The current
7059
+ * contract version is exported as `RoosterJsDevToolsHookVersion` from
7060
+ * `roosterjs-content-model-core`.
7061
+ */
7062
+ version?: number;
7063
+ /**
7064
+ * Called right after an editor finishes initialization.
7065
+ * @param editor The editor that was created
7066
+ */
7067
+ onEditorCreated?: (editor: IEditor) => void;
7068
+ /**
7069
+ * Called right before an editor is disposed.
7070
+ * @param editor The editor that is being disposed
7071
+ */
7072
+ onEditorDisposed?: (editor: IEditor) => void;
7073
+ /**
7074
+ * Called for every plugin event dispatched by an editor, so a tool can react to content and
7075
+ * selection changes. Tools are expected to filter and debounce as needed.
7076
+ * @param editor The editor that dispatched the event
7077
+ * @param event The plugin event being dispatched
7078
+ */
7079
+ onPluginEvent?: (editor: IEditor, event: PluginEvent) => void;
7080
+ }
7081
+
7020
7082
  /**
7021
7083
  * Create Content Model from DOM tree in this editor
7022
7084
  * @param root Root element of DOM tree to create Content Model from
@@ -7952,6 +8014,16 @@ export function normalizeFontFamily(fontFamily: string): string;
7952
8014
  */
7953
8015
  export function extractClipboardItems(items: DataTransferItem[], allowedCustomPasteType?: string[], isPasteNative?: boolean): Promise<ClipboardData>;
7954
8016
 
8017
+ /**
8018
+ * Create a document fragment from clipboard content using the specified paste type
8019
+ * @param document The document used to create the fragment
8020
+ * @param clipboardData The clipboard data to convert
8021
+ * @param pasteType The paste type that determines which clipboard content to use
8022
+ * @param root The optional root element containing the parsed HTML content
8023
+ * @returns A document fragment containing the content to paste
8024
+ */
8025
+ export function createPasteFragment(document: Document, clipboardData: ClipboardData, pasteType: PasteType, root: HTMLElement | undefined): DocumentFragment;
8026
+
7955
8027
  /**
7956
8028
  * Gets the cached event data by cache key from event object if there is already one.
7957
8029
  * Otherwise, call getter function to create one, and cache it.
@@ -8454,6 +8526,10 @@ export const ChangeSource: {
8454
8526
  * Content changed by replace
8455
8527
  */
8456
8528
  Replace: string;
8529
+ /**
8530
+ * Content changed by dragging content out the editor
8531
+ */
8532
+ DragOutOfEditor: string;
8457
8533
  };
8458
8534
 
8459
8535
  /**
@@ -8972,6 +9048,17 @@ export function paste(editor: IEditor, clipboardData: ClipboardData, pasteTypeOr
8972
9048
  */
8973
9049
  export function getContentForCopy(editor: IEditor, isCut: boolean, event: ClipboardEvent): TextAndHtmlContentForCopy | null;
8974
9050
 
9051
+ /**
9052
+ * The current version of the RoosterJS DevTools hook contract (see
9053
+ * {@link RoosterJsDevToolsHook}). The editor stamps this onto the installed hook so a developer
9054
+ * tool can adapt to the editor's capabilities. Bump this whenever the shape of the contract changes
9055
+ * in a way tools may need to detect.
9056
+ *
9057
+ * History:
9058
+ * - 1: onEditorCreated, onEditorDisposed, onPluginEvent
9059
+ */
9060
+ export const RoosterJsDevToolsHookVersion: number;
9061
+
8975
9062
  /**
8976
9063
  * Insert table into editor at current selection
8977
9064
  * @param editor The editor instance
@@ -9444,6 +9531,12 @@ export function findListItemsInSameThread(group: ReadonlyContentModelBlockGroup,
9444
9531
  */
9445
9532
  export function setModelIndentation(model: ReadonlyContentModelDocument, indentation: 'indent' | 'outdent', length?: number, context?: FormatContentModelContext): boolean;
9446
9533
 
9534
+ /**
9535
+ * Determine text direction from the first strong directional character
9536
+ * @param text Text to scan
9537
+ */
9538
+ export function getTextDirection(text: string): 'ltr' | 'rtl' | undefined;
9539
+
9447
9540
  /**
9448
9541
  * Try to match a given string with link match rules, return matched link
9449
9542
  * @param url Input url to match
@@ -9544,12 +9637,14 @@ export class TableEditPlugin implements EditorPlugin {
9544
9637
  */
9545
9638
  onPluginEvent(e: PluginEvent): void;
9546
9639
  private onMouseMove;
9640
+ private onTouchStart;
9641
+ private updateTableEditor;
9547
9642
  /**
9548
9643
  * @internal Public only for unit test
9549
9644
  * @param entry Table to use when setting the Editors
9550
9645
  * @param event (Optional) Mouse event
9551
9646
  */
9552
- setTableEditor(entry: TableWithRoot | null, event?: MouseEvent): void;
9647
+ setTableEditor(entry: TableWithRoot | null, event?: Event): void;
9553
9648
  private invalidateTableRects;
9554
9649
  private disposeTableEditor;
9555
9650
  private ensureTableRects;
@@ -9772,6 +9867,7 @@ export interface HandleTabOptions {
9772
9867
  export class AutoFormatPlugin implements EditorPlugin {
9773
9868
  private options;
9774
9869
  private editor;
9870
+ private blockDirections;
9775
9871
  /**
9776
9872
  * @param options An optional parameter that takes in an object of type AutoFormatOptions, which includes the following properties:
9777
9873
  * - autoBullet: A boolean that enables or disables automatic bullet list formatting. Defaults to false.
@@ -9785,6 +9881,7 @@ export class AutoFormatPlugin implements EditorPlugin {
9785
9881
  * - autoTel: A boolean that enables or disables automatic hyperlink telephone numbers transformation. Defaults to false.
9786
9882
  * - autoMailto: A boolean that enables or disables automatic hyperlink email address transformation. Defaults to false.
9787
9883
  * - autoHorizontalLine: A boolean that enables or disables automatic horizontal line creation. Defaults to false.
9884
+ * - autoDirection: A boolean that enables or disables automatic text direction. Defaults to false.
9788
9885
  */
9789
9886
  constructor(options?: AutoFormatOptions);
9790
9887
  /**
@@ -9819,6 +9916,8 @@ export class AutoFormatPlugin implements EditorPlugin {
9819
9916
  private enterFeatures;
9820
9917
  private handleKeyboardEvents;
9821
9918
  private handleEditorInputEvent;
9919
+ private handleCompositionEndEvent;
9920
+ private handleAutoDirection;
9822
9921
  private handleKeyDownEvent;
9823
9922
  private handleContentChangedEvent;
9824
9923
  }
@@ -9855,6 +9954,10 @@ export interface AutoFormatOptions extends AutoLinkOptions {
9855
9954
  * Auto Horizontal line
9856
9955
  */
9857
9956
  autoHorizontalLine?: boolean;
9957
+ /**
9958
+ * Automatically update block direction based on the first strong directional character
9959
+ */
9960
+ autoDirection?: boolean;
9858
9961
  }
9859
9962
 
9860
9963
  /**
@@ -10995,6 +11098,8 @@ export class DragAndDropPlugin implements EditorPlugin {
10995
11098
  * @param event The event to handle:
10996
11099
  */
10997
11100
  onPluginEvent(event: PluginEvent): void;
11101
+ private adjustDraggingCursor;
11102
+ private handleDragOutOfTheEditor;
10998
11103
  }
10999
11104
 
11000
11105
  /**