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