roosterjs 9.42.0 → 9.44.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.42.0)
1
+ // Type definitions for roosterjs (Version 9.44.0)
2
2
  // Generated by dts tool from roosterjs
3
3
  // Project: https://github.com/Microsoft/roosterjs
4
4
 
@@ -2872,6 +2872,10 @@ interface EditorContext {
2872
2872
  * When pass true, this cached element will be used to create DOM tree back when convert Content Model to DOM
2873
2873
  */
2874
2874
  allowCacheElement?: boolean;
2875
+ /**
2876
+ * Whether to allow caching list item elements separately.
2877
+ */
2878
+ allowCacheListItem?: boolean;
2875
2879
  /**
2876
2880
  * @optional Indexer for content model, to help build backward relationship from DOM node to Content Model
2877
2881
  */
@@ -3022,6 +3026,10 @@ interface ModelToDomListStackItem extends Partial<ContentModelListLevel> {
3022
3026
  * DOM node of this list stack
3023
3027
  */
3024
3028
  node: Node;
3029
+ /**
3030
+ * Reference node to insert next list item under this list
3031
+ */
3032
+ refNode: Node | null;
3025
3033
  }
3026
3034
 
3027
3035
  /**
@@ -3702,7 +3710,11 @@ type ExperimentalFeature = GraduatedExperimentalFeature
3702
3710
  * Get cloned root element from an independent HTML document instead of current document.
3703
3711
  * So any operation to the cloned root won't trigger network request for resources like images
3704
3712
  */
3705
- | 'CloneIndependentRoot';
3713
+ | 'CloneIndependentRoot'
3714
+ /**
3715
+ * Allow caching list item elements.
3716
+ */
3717
+ | 'CacheList';
3706
3718
 
3707
3719
  /**
3708
3720
  * Predefined experiment features (Graduated, only keep them for backward compatibility)
@@ -6037,6 +6049,20 @@ interface TextAndHtmlContentForCopy {
6037
6049
  textContent: string;
6038
6050
  }
6039
6051
 
6052
+ /**
6053
+ * The link label and href for promoted link
6054
+ */
6055
+ interface PromotedLink {
6056
+ /**
6057
+ * The label for the promoted link
6058
+ */
6059
+ label: string;
6060
+ /**
6061
+ * The href for the promoted link
6062
+ */
6063
+ href: string;
6064
+ }
6065
+
6040
6066
  /**
6041
6067
  * Editor plugin event interface
6042
6068
  */
@@ -7559,6 +7585,13 @@ function parseTableCells(table: HTMLTableElement): ParsedTable;
7559
7585
  */
7560
7586
  function readFile(file: File, callback: (dataUrl: string | null) => void): void;
7561
7587
 
7588
+ /**
7589
+ * Retrieves metadata from the given document, including HTML attributes and meta tags.
7590
+ * @param doc The document from which to retrieve metadata.
7591
+ * @returns A record containing metadata key-value pairs.
7592
+ */
7593
+ function retrieveDocumentMetadata(doc: Document): Record<string, string>;
7594
+
7562
7595
  /**
7563
7596
  * Edit and transform color of elements between light mode and dark mode
7564
7597
  * @param rootNode The root DOM node to transform
@@ -9076,6 +9109,14 @@ function matchLink(url: string): LinkData | null;
9076
9109
  */
9077
9110
  function promoteLink(segment: ContentModelText, paragraph: ShallowMutableContentModelParagraph, autoLinkOptions: AutoLinkOptions): ContentModelText | null;
9078
9111
 
9112
+ /**
9113
+ * Verify if the link can be promoted
9114
+ * @param segment The text segment to search link text from
9115
+ * @param options Options of auto link
9116
+ * @returns if a link can be promoted
9117
+ */
9118
+ function getPromoteLink(segment: ContentModelText, autoLinkOptions: AutoLinkOptions): PromotedLink | undefined;
9119
+
9079
9120
  /**
9080
9121
  * Get announce data for list item
9081
9122
  * @param path Content model path that include the list item
@@ -9237,15 +9278,15 @@ const DefaultSanitizers: Record<string, ValueSanitizer>;
9237
9278
  * 3. Tab Key
9238
9279
  */
9239
9280
  class EditPlugin implements EditorPlugin {
9240
- private options;
9241
9281
  private editor;
9242
9282
  private disposer;
9243
9283
  private shouldHandleNextInputEvent;
9244
9284
  private selectionAfterDelete;
9245
9285
  private handleNormalEnter;
9286
+ private options;
9246
9287
  /**
9247
9288
  * @param options An optional parameter that takes in an object of type EditOptions, which includes the following properties:
9248
- * handleTabKey: A boolean that enables or disables Tab key handling. Defaults to true.
9289
+ * handleTabKey: A boolean or HandleTabOptions object that controls Tab key handling. When a boolean, true enables all features and false disables all. When an object, individual features can be controlled. Defaults to all enabled.
9249
9290
  */
9250
9291
  constructor(options?: EditOptions);
9251
9292
  private createNormalEnterChecker;
@@ -9293,9 +9334,12 @@ class EditPlugin implements EditorPlugin {
9293
9334
  */
9294
9335
  type EditOptions = {
9295
9336
  /**
9296
- * Whether to handle Tab key in keyboard. @default true
9337
+ * Whether to handle Tab key in keyboard, or an object to control specific Tab key behaviors.
9338
+ * When true, all Tab features are enabled. When false, all are disabled.
9339
+ * When an object, individual features can be controlled via HandleTabOptions.
9340
+ * @default true
9297
9341
  */
9298
- handleTabKey?: boolean;
9342
+ handleTabKey?: HandleTabOptions | boolean;
9299
9343
  /**
9300
9344
  * Whether expanded selection within a text node should be handled by CM when pressing Backspace/Delete key.
9301
9345
  * @default true
@@ -9333,6 +9377,37 @@ type EditOptions = {
9333
9377
  formatsToPreserveOnMerge?: string[];
9334
9378
  };
9335
9379
 
9380
+ /**
9381
+ * Options for handling Tab key in Edit plugin
9382
+ */
9383
+ interface HandleTabOptions {
9384
+ /**
9385
+ * Whether to indent/outdent multiple selected blocks when Tab/Shift+Tab is pressed and multiple blocks are selected.
9386
+ * @default true
9387
+ */
9388
+ indentMultipleBlocks?: boolean;
9389
+ /**
9390
+ * Whether to indent/outdent table cells when Tab key is pressed and a table is selected
9391
+ * @default true
9392
+ */
9393
+ indentTable?: boolean;
9394
+ /**
9395
+ * Whether to append a new row when Tab key is pressed in the last cell of a table
9396
+ * @default true
9397
+ */
9398
+ appendTableRow?: boolean;
9399
+ /**
9400
+ * Whether to indent/outdent list items when Tab key is pressed
9401
+ * @default true
9402
+ */
9403
+ indentList?: boolean;
9404
+ /**
9405
+ * Whether to indent/outdent paragraph when Tab key is pressed
9406
+ * @default true
9407
+ */
9408
+ indentParagraph?: boolean;
9409
+ }
9410
+
9336
9411
  /**
9337
9412
  * Auto Format plugin handles auto formatting, such as transforming * characters into a bullet list.
9338
9413
  * It can be customized with options to enable or disable auto list features.