roosterjs 9.0.0 → 9.1.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.0.0)
1
+ // Type definitions for roosterjs (Version 9.1.0)
2
2
  // Generated by dts tool from roosterjs
3
3
  // Project: https://github.com/Microsoft/roosterjs
4
4
 
@@ -7016,6 +7016,13 @@ function insertTableRow(table: ContentModelTable, operation: TableVerticalInsert
7016
7016
  */
7017
7017
  function insertTableColumn(table: ContentModelTable, operation: TableHorizontalInsertOperation): void;
7018
7018
 
7019
+ /**
7020
+ * Clear selection of a table.
7021
+ * @param table The table model where the selection is to be cleared
7022
+ * @param sel The selection coordinates to be cleared
7023
+ */
7024
+ function clearSelectedCells(table: ContentModelTable, sel: TableSelectionCoordinates): void;
7025
+
7019
7026
  /**
7020
7027
  * Invoke a callback to format the selected table using Content Model
7021
7028
  * @param editor The editor object
@@ -7052,6 +7059,13 @@ function formatParagraphWithContentModel(editor: IEditor, apiName: string, setSt
7052
7059
  */
7053
7060
  function formatSegmentWithContentModel(editor: IEditor, apiName: string, toggleStyleCallback: (format: ContentModelSegmentFormat, isTuringOn: boolean, segment: ContentModelSegment | null, paragraph: ContentModelParagraph | null) => void, segmentHasStyleCallback?: (format: ContentModelSegmentFormat, segment: ContentModelSegment | null, paragraph: ContentModelParagraph | null) => boolean, includingFormatHolder?: boolean, afterFormatCallback?: (model: ContentModelDocument) => void): void;
7054
7061
 
7062
+ /**
7063
+ * Invoke a callback to format the text segment before the selection marker using Content Model
7064
+ * @param editor The editor object
7065
+ * @param callback The callback to format the text segment.
7066
+ */
7067
+ function formatTextSegmentBeforeSelectionMarker(editor: IEditor, callback: (model: ContentModelDocument, previousSegment: ContentModelText, paragraph: ContentModelParagraph, markerFormat: ContentModelSegmentFormat, context: FormatContentModelContext) => boolean): void;
7068
+
7055
7069
  /**
7056
7070
  * Set a list type to content model
7057
7071
  * @param model the model document
@@ -7242,6 +7256,7 @@ class AutoFormatPlugin implements EditorPlugin {
7242
7256
  * - autoNumbering: A boolean that enables or disables automatic numbering formatting. Defaults to false.
7243
7257
  * - autoLink: A boolean that enables or disables automatic hyperlink creation when pasting or typing content. Defaults to false.
7244
7258
  * - autoUnlink: A boolean that enables or disables automatic hyperlink removal when pressing backspace. Defaults to false.
7259
+ * - autoHyphen: A boolean that enables or disables automatic hyphen transformation. Defaults to false.
7245
7260
  */
7246
7261
  constructor(options?: AutoFormatOptions);
7247
7262
  /**
@@ -7293,6 +7308,10 @@ type AutoFormatOptions = {
7293
7308
  * When paste content, create hyperlink for the pasted link
7294
7309
  */
7295
7310
  autoLink: boolean;
7311
+ /**
7312
+ * Transform -- into hyphen, if typed between two words
7313
+ */
7314
+ autoHyphen: boolean;
7296
7315
  };
7297
7316
 
7298
7317
  /**
@@ -7319,7 +7338,7 @@ const ShortcutUnderline: ShortcutCommand;
7319
7338
  /**
7320
7339
  * Shortcut command for Clear Format
7321
7340
  * Windows: Ctrl + Space
7322
- * MacOS: Meta + Space
7341
+ * MacOS: N/A
7323
7342
  */
7324
7343
  const ShortcutClearFormat: ShortcutCommand;
7325
7344
 
@@ -7382,14 +7401,14 @@ const ShortcutDecreaseFont: ShortcutCommand;
7382
7401
  /**
7383
7402
  * Shortcut command for Intent list
7384
7403
  * Windows: Alt + Shift + Arrow Right
7385
- * MacOS: Option + Shift+ Arrow Right
7404
+ * MacOS: N/A
7386
7405
  */
7387
7406
  const ShortcutIndentList: ShortcutCommand;
7388
7407
 
7389
7408
  /**
7390
7409
  * Shortcut command for Outdent list
7391
7410
  * Windows: Alt + Shift + Arrow Left
7392
- * MacOS: Option + Shift+ Arrow Left
7411
+ * MacOS: N/A
7393
7412
  */
7394
7413
  const ShortcutOutdentList: ShortcutCommand;
7395
7414
 
@@ -7597,12 +7616,14 @@ class MarkdownPlugin implements EditorPlugin {
7597
7616
  private shouldBold;
7598
7617
  private shouldItalic;
7599
7618
  private shouldStrikethrough;
7619
+ private shouldCode;
7600
7620
  private lastKeyTyped;
7601
7621
  /**
7602
7622
  * @param options An optional parameter that takes in an object of type MarkdownOptions, which includes the following properties:
7603
- * - strikethrough: If true text between ~ will receive strikethrough format. Defaults to true.
7604
- * - bold: If true text between * will receive bold format. Defaults to true.
7605
- * - italic: If true text between _ will receive italic format. Defaults to true.
7623
+ * - strikethrough: If true text between ~ will receive strikethrough format. Defaults to false.
7624
+ * - bold: If true text between * will receive bold format. Defaults to false.
7625
+ * - italic: If true text between _ will receive italic format. Defaults to false.
7626
+ * - codeFormat: If provided, text between ` will receive code format. Defaults to undefined.
7606
7627
  */
7607
7628
  constructor(options?: MarkdownOptions);
7608
7629
  /**
@@ -7633,17 +7654,79 @@ class MarkdownPlugin implements EditorPlugin {
7633
7654
  private handleKeyDownEvent;
7634
7655
  private handleBackspaceEvent;
7635
7656
  private handleContentChangedEvent;
7657
+ private disableAllFeatures;
7636
7658
  }
7637
7659
 
7638
7660
  /**
7661
+ *
7639
7662
  * Options for Markdown plugin
7663
+ * - strikethrough: If true text between ~ will receive strikethrough format.
7664
+ * - bold: If true text between * will receive bold format.
7665
+ * - italic: If true text between _ will receive italic format.
7666
+ * - codeFormat: If provided, text between ` will receive code format. If equal to {}, it will set the default code format.
7640
7667
  */
7641
7668
  interface MarkdownOptions {
7642
7669
  strikethrough?: boolean;
7643
7670
  bold?: boolean;
7644
7671
  italic?: boolean;
7672
+ codeFormat?: ContentModelCodeFormat;
7645
7673
  }
7646
7674
 
7675
+ /**
7676
+ * Hyperlink plugin does the following jobs for a hyperlink in editor:
7677
+ * 1. When hover on a link, show a tool tip
7678
+ * 2. When Ctrl+Click on a link, open a new window with the link
7679
+ * 3. When type directly on a link whose text matches its link url, update the link url with the link text
7680
+ */
7681
+ class HyperlinkPlugin implements EditorPlugin {
7682
+ private tooltip;
7683
+ private target?;
7684
+ private onLinkClick?;
7685
+ private editor;
7686
+ private domHelper;
7687
+ private isMac;
7688
+ private disposer;
7689
+ private currentNode;
7690
+ private currentLink;
7691
+ /**
7692
+ * Create a new instance of HyperLink class
7693
+ * @param tooltip Tooltip to show when mouse hover over a link
7694
+ * Default value is to return the href itself. If null, there will be no tooltip text.
7695
+ * @param target (Optional) Target window name for hyperlink. If null, will use "_blank"
7696
+ * @param onLinkClick (Optional) Open link callback (return false to use default behavior)
7697
+ */
7698
+ constructor(tooltip?: HyperlinkToolTip, target?: string | undefined, onLinkClick?: ((anchor: HTMLAnchorElement, mouseEvent: MouseEvent) => boolean | void) | undefined);
7699
+ /**
7700
+ * Get a friendly name of this plugin
7701
+ */
7702
+ getName(): string;
7703
+ /**
7704
+ * Initialize this plugin
7705
+ * @param editor The editor instance
7706
+ */
7707
+ initialize(editor: IEditor): void;
7708
+ /**
7709
+ * Dispose this plugin
7710
+ */
7711
+ dispose(): void;
7712
+ /**
7713
+ * Handle events triggered from editor
7714
+ * @param event PluginEvent object
7715
+ */
7716
+ onPluginEvent(event: PluginEvent): void;
7717
+ protected onMouse: (e: Event) => void;
7718
+ private runWithHyperlink;
7719
+ private isCtrlOrMetaPressed;
7720
+ }
7721
+
7722
+ /**
7723
+ * A type to specify how to get a tool tip of hyperlink in editor
7724
+ * string: Use this string as tooltip
7725
+ * null: No tooltip
7726
+ * function: Call this function to get a tooltip
7727
+ */
7728
+ type HyperlinkToolTip = string | null | ((url: string, anchor: HTMLAnchorElement) => string);
7729
+
7647
7730
  /**
7648
7731
  * Get dark mode color for a given color
7649
7732
  * @param color The color to calculate from