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