roosterjs 9.58.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.58.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
  */
@@ -6046,7 +6051,9 @@ interface LinkData {
6046
6051
  */
6047
6052
  interface MergeModelOption {
6048
6053
  /**
6049
- * 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.
6050
6057
  * This is usually used when paste table inside a table
6051
6058
  * @default false
6052
6059
  */
@@ -7030,6 +7037,49 @@ interface FindResultChangedEvent extends BasePluginEvent<'findResultChanged'> {
7030
7037
  readonly alternativeRange?: Range | null;
7031
7038
  }
7032
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
+
7033
7083
  /**
7034
7084
  * Create Content Model from DOM tree in this editor
7035
7085
  * @param root Root element of DOM tree to create Content Model from
@@ -8999,6 +9049,17 @@ function paste(editor: IEditor, clipboardData: ClipboardData, pasteTypeOrGetter?
8999
9049
  */
9000
9050
  function getContentForCopy(editor: IEditor, isCut: boolean, event: ClipboardEvent): TextAndHtmlContentForCopy | null;
9001
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
+
9002
9063
  /**
9003
9064
  * Insert table into editor at current selection
9004
9065
  * @param editor The editor instance
@@ -9471,6 +9532,12 @@ function findListItemsInSameThread(group: ReadonlyContentModelBlockGroup, curren
9471
9532
  */
9472
9533
  function setModelIndentation(model: ReadonlyContentModelDocument, indentation: 'indent' | 'outdent', length?: number, context?: FormatContentModelContext): boolean;
9473
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
+
9474
9541
  /**
9475
9542
  * Try to match a given string with link match rules, return matched link
9476
9543
  * @param url Input url to match
@@ -9571,12 +9638,14 @@ class TableEditPlugin implements EditorPlugin {
9571
9638
  */
9572
9639
  onPluginEvent(e: PluginEvent): void;
9573
9640
  private onMouseMove;
9641
+ private onTouchStart;
9642
+ private updateTableEditor;
9574
9643
  /**
9575
9644
  * @internal Public only for unit test
9576
9645
  * @param entry Table to use when setting the Editors
9577
9646
  * @param event (Optional) Mouse event
9578
9647
  */
9579
- setTableEditor(entry: TableWithRoot | null, event?: MouseEvent): void;
9648
+ setTableEditor(entry: TableWithRoot | null, event?: Event): void;
9580
9649
  private invalidateTableRects;
9581
9650
  private disposeTableEditor;
9582
9651
  private ensureTableRects;
@@ -9799,6 +9868,7 @@ interface HandleTabOptions {
9799
9868
  class AutoFormatPlugin implements EditorPlugin {
9800
9869
  private options;
9801
9870
  private editor;
9871
+ private blockDirections;
9802
9872
  /**
9803
9873
  * @param options An optional parameter that takes in an object of type AutoFormatOptions, which includes the following properties:
9804
9874
  * - autoBullet: A boolean that enables or disables automatic bullet list formatting. Defaults to false.
@@ -9812,6 +9882,7 @@ class AutoFormatPlugin implements EditorPlugin {
9812
9882
  * - autoTel: A boolean that enables or disables automatic hyperlink telephone numbers transformation. Defaults to false.
9813
9883
  * - autoMailto: A boolean that enables or disables automatic hyperlink email address transformation. Defaults to false.
9814
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.
9815
9886
  */
9816
9887
  constructor(options?: AutoFormatOptions);
9817
9888
  /**
@@ -9846,6 +9917,8 @@ class AutoFormatPlugin implements EditorPlugin {
9846
9917
  private enterFeatures;
9847
9918
  private handleKeyboardEvents;
9848
9919
  private handleEditorInputEvent;
9920
+ private handleCompositionEndEvent;
9921
+ private handleAutoDirection;
9849
9922
  private handleKeyDownEvent;
9850
9923
  private handleContentChangedEvent;
9851
9924
  }
@@ -9882,6 +9955,10 @@ interface AutoFormatOptions extends AutoLinkOptions {
9882
9955
  * Auto Horizontal line
9883
9956
  */
9884
9957
  autoHorizontalLine?: boolean;
9958
+ /**
9959
+ * Automatically update block direction based on the first strong directional character
9960
+ */
9961
+ autoDirection?: boolean;
9885
9962
  }
9886
9963
 
9887
9964
  /**