roosterjs 9.58.0 → 9.60.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.60.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
@@ -8217,6 +8267,16 @@ function cloneModel(model: ReadonlyContentModelDocument, options?: CloneModelOpt
8217
8267
  */
8218
8268
  function cloneModelForPaste(model: ReadonlyContentModelDocument): ContentModelDocument;
8219
8269
 
8270
+ /**
8271
+ * Check whether the given range of table cells can be merged without splitting existing spans.
8272
+ * @param rows The table rows to check
8273
+ * @param firstRow The first row index of the range
8274
+ * @param firstCol The first column index of the range
8275
+ * @param lastRow The last row index of the range
8276
+ * @param lastCol The last column index of the range
8277
+ */
8278
+ function canMergeCells(rows: readonly ReadonlyContentModelTableRow[], firstRow: number, firstCol: number, lastRow: number, lastCol: number): boolean;
8279
+
8220
8280
  /**
8221
8281
  * Merge source model into target mode
8222
8282
  * @param target Target Content Model that will merge content into
@@ -8999,6 +9059,17 @@ function paste(editor: IEditor, clipboardData: ClipboardData, pasteTypeOrGetter?
8999
9059
  */
9000
9060
  function getContentForCopy(editor: IEditor, isCut: boolean, event: ClipboardEvent): TextAndHtmlContentForCopy | null;
9001
9061
 
9062
+ /**
9063
+ * The current version of the RoosterJS DevTools hook contract (see
9064
+ * {@link RoosterJsDevToolsHook}). The editor stamps this onto the installed hook so a developer
9065
+ * tool can adapt to the editor's capabilities. Bump this whenever the shape of the contract changes
9066
+ * in a way tools may need to detect.
9067
+ *
9068
+ * History:
9069
+ * - 1: onEditorCreated, onEditorDisposed, onPluginEvent
9070
+ */
9071
+ const RoosterJsDevToolsHookVersion: number;
9072
+
9002
9073
  /**
9003
9074
  * Insert table into editor at current selection
9004
9075
  * @param editor The editor instance
@@ -9035,6 +9106,7 @@ function editTable(editor: IEditor, operation: TableOperation): void;
9035
9106
 
9036
9107
  /**
9037
9108
  * Operations to apply border
9109
+ * Remove the targeted borders instead if they all already match the requested format.
9038
9110
  * @param editor The editor instance
9039
9111
  * @param border The border to apply
9040
9112
  * @param operation The operation to apply
@@ -9471,6 +9543,12 @@ function findListItemsInSameThread(group: ReadonlyContentModelBlockGroup, curren
9471
9543
  */
9472
9544
  function setModelIndentation(model: ReadonlyContentModelDocument, indentation: 'indent' | 'outdent', length?: number, context?: FormatContentModelContext): boolean;
9473
9545
 
9546
+ /**
9547
+ * Determine text direction from the first strong directional character
9548
+ * @param text Text to scan
9549
+ */
9550
+ function getTextDirection(text: string): 'ltr' | 'rtl' | undefined;
9551
+
9474
9552
  /**
9475
9553
  * Try to match a given string with link match rules, return matched link
9476
9554
  * @param url Input url to match
@@ -9571,12 +9649,14 @@ class TableEditPlugin implements EditorPlugin {
9571
9649
  */
9572
9650
  onPluginEvent(e: PluginEvent): void;
9573
9651
  private onMouseMove;
9652
+ private onTouchStart;
9653
+ private updateTableEditor;
9574
9654
  /**
9575
9655
  * @internal Public only for unit test
9576
9656
  * @param entry Table to use when setting the Editors
9577
9657
  * @param event (Optional) Mouse event
9578
9658
  */
9579
- setTableEditor(entry: TableWithRoot | null, event?: MouseEvent): void;
9659
+ setTableEditor(entry: TableWithRoot | null, event?: Event): void;
9580
9660
  private invalidateTableRects;
9581
9661
  private disposeTableEditor;
9582
9662
  private ensureTableRects;
@@ -9799,6 +9879,7 @@ interface HandleTabOptions {
9799
9879
  class AutoFormatPlugin implements EditorPlugin {
9800
9880
  private options;
9801
9881
  private editor;
9882
+ private blockDirections;
9802
9883
  /**
9803
9884
  * @param options An optional parameter that takes in an object of type AutoFormatOptions, which includes the following properties:
9804
9885
  * - autoBullet: A boolean that enables or disables automatic bullet list formatting. Defaults to false.
@@ -9812,6 +9893,7 @@ class AutoFormatPlugin implements EditorPlugin {
9812
9893
  * - autoTel: A boolean that enables or disables automatic hyperlink telephone numbers transformation. Defaults to false.
9813
9894
  * - autoMailto: A boolean that enables or disables automatic hyperlink email address transformation. Defaults to false.
9814
9895
  * - autoHorizontalLine: A boolean that enables or disables automatic horizontal line creation. Defaults to false.
9896
+ * - autoDirection: A boolean that enables or disables automatic text direction. Defaults to false.
9815
9897
  */
9816
9898
  constructor(options?: AutoFormatOptions);
9817
9899
  /**
@@ -9846,6 +9928,8 @@ class AutoFormatPlugin implements EditorPlugin {
9846
9928
  private enterFeatures;
9847
9929
  private handleKeyboardEvents;
9848
9930
  private handleEditorInputEvent;
9931
+ private handleCompositionEndEvent;
9932
+ private handleAutoDirection;
9849
9933
  private handleKeyDownEvent;
9850
9934
  private handleContentChangedEvent;
9851
9935
  }
@@ -9882,6 +9966,10 @@ interface AutoFormatOptions extends AutoLinkOptions {
9882
9966
  * Auto Horizontal line
9883
9967
  */
9884
9968
  autoHorizontalLine?: boolean;
9969
+ /**
9970
+ * Automatically update block direction based on the first strong directional character
9971
+ */
9972
+ autoDirection?: boolean;
9885
9973
  }
9886
9974
 
9887
9975
  /**