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