roosterjs 9.44.0 → 9.45.1

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.44.0)
1
+ // Type definitions for roosterjs (Version 9.45.1)
2
2
  // Generated by dts tool from roosterjs
3
3
  // Project: https://github.com/Microsoft/roosterjs
4
4
 
@@ -41,7 +41,7 @@ interface ReadonlyContentModelWithFormat<T extends ContentModelFormatBase> {
41
41
  /**
42
42
  * Format of Table
43
43
  */
44
- type ContentModelTableFormat = ContentModelBlockFormat & IdFormat & AriaFormat & BorderFormat & BorderBoxFormat & DirectionFormat & SpacingFormat & MarginFormat & DisplayFormat & TableLayoutFormat & SizeFormat & RoleFormat;
44
+ type ContentModelTableFormat = ContentModelBlockFormat & IdFormat & AriaFormat & BorderFormat & BorderBoxFormat & DirectionFormat & SpacingFormat & MarginFormat & DisplayFormat & TableLayoutFormat & SizeFormat & RoleFormat & LegacyTableBorderFormat;
45
45
 
46
46
  /**
47
47
  * Represents base format of an element that supports dataset and/or metadata
@@ -267,6 +267,10 @@ interface FormatHandlerTypeMap {
267
267
  * Format for BorderBoxFormat
268
268
  */
269
269
  borderBox: BorderBoxFormat;
270
+ /**
271
+ * Format for the Border Colors
272
+ */
273
+ borderColor: BorderFormat;
270
274
  /**
271
275
  * Format for BoxShadowFormat
272
276
  */
@@ -315,6 +319,10 @@ interface FormatHandlerTypeMap {
315
319
  * Format for ItalicFormat
316
320
  */
317
321
  italic: ItalicFormat;
322
+ /**
323
+ * Format for LegacyTableBorderFormat
324
+ */
325
+ legacyTableBorder: LegacyTableBorderFormat;
318
326
  /**
319
327
  * Format for LetterSpacingFormat
320
328
  */
@@ -327,6 +335,10 @@ interface FormatHandlerTypeMap {
327
335
  * Format for LinkFormat
328
336
  */
329
337
  link: LinkFormat;
338
+ /**
339
+ * Format for TextAlignFormat under list item
340
+ */
341
+ listItemAlign: TextAlignFormat;
330
342
  /**
331
343
  * Format for ListThreadFormat (used by list item)
332
344
  */
@@ -919,6 +931,31 @@ type RoleFormat = {
919
931
  role?: string;
920
932
  };
921
933
 
934
+ /**
935
+ * Format for legacy table border.
936
+ * This is used for supporting legacy table border rendering in some scenarios.
937
+ */
938
+ type LegacyTableBorderFormat = {
939
+ /**
940
+ * The value of border attribute on table element.
941
+ * Although this attribute is deprecated in HTML5, some email clients still rely on it.
942
+ * https://developer.mozilla.org/en-US/docs/Web/API/HTMLTableElement/border
943
+ */
944
+ legacyTableBorder?: string;
945
+ /**
946
+ * The value of cellspacing attribute on table element.
947
+ * This attribute is deprecated in HTML5, but still used in some legacy scenarios.
948
+ * https://developer.mozilla.org/en-US/docs/Web/API/HTMLTableElement/cellSpacing
949
+ */
950
+ cellSpacing?: string;
951
+ /**
952
+ * The value of cellpadding attribute on table element.
953
+ * This attribute is deprecated in HTML5, but still used in some legacy scenarios.
954
+ * https://developer.mozilla.org/en-US/docs/Web/API/HTMLTableElement/cellPadding
955
+ */
956
+ cellPadding?: string;
957
+ };
958
+
922
959
  /**
923
960
  * Represents dataset format of Content Model
924
961
  */
@@ -3714,7 +3751,11 @@ type ExperimentalFeature = GraduatedExperimentalFeature
3714
3751
  /**
3715
3752
  * Allow caching list item elements.
3716
3753
  */
3717
- | 'CacheList';
3754
+ | 'CacheList'
3755
+ /**
3756
+ * Transform the table border colors when switching from light to dark mode
3757
+ */
3758
+ | 'TransformTableBorderColors';
3718
3759
 
3719
3760
  /**
3720
3761
  * Predefined experiment features (Graduated, only keep them for backward compatibility)
@@ -4675,6 +4716,10 @@ interface AutoLinkOptions {
4675
4716
  * Current running environment
4676
4717
  */
4677
4718
  interface EditorEnvironment {
4719
+ /**
4720
+ * Document object of the editor
4721
+ */
4722
+ readonly document: Document;
4678
4723
  /**
4679
4724
  * Whether editor is running on Mac
4680
4725
  */
@@ -6063,6 +6108,11 @@ interface PromotedLink {
6063
6108
  href: string;
6064
6109
  }
6065
6110
 
6111
+ /**
6112
+ * The keyfor BorderFormat
6113
+ */
6114
+ type BorderKey = 'borderTop' | 'borderRight' | 'borderBottom' | 'borderLeft';
6115
+
6066
6116
  /**
6067
6117
  * Editor plugin event interface
6068
6118
  */
@@ -6802,6 +6852,16 @@ const entityProcessor: ElementProcessor<HTMLElement>;
6802
6852
  */
6803
6853
  const tableProcessor: ElementProcessor<HTMLTableElement>;
6804
6854
 
6855
+ /**
6856
+ * Content Model Element Processor for format container elements (e.g., blockquote, div)
6857
+ * Processes elements that create FormatContainer blocks in the content model.
6858
+ * This processor can be used in processorOverride to customize how specific elements are processed.
6859
+ * @param group The parent block group
6860
+ * @param element The DOM element to process
6861
+ * @param context DOM to Content Model context
6862
+ */
6863
+ const formatContainerProcessor: ElementProcessor<HTMLElement>;
6864
+
6805
6865
  /**
6806
6866
  * Get offset numbers of a regular (range based) selection.
6807
6867
  * If the selection start/end position is not in the given node, it will return -1 for the related value
@@ -7409,7 +7469,7 @@ function parseValueWithUnit(value?: string, currentSizePxOrElement?: number | HT
7409
7469
  /**
7410
7470
  * Keys of border items
7411
7471
  */
7412
- const BorderKeys: (keyof BorderFormat & keyof CSSStyleDeclaration)[];
7472
+ const BorderKeys: (BorderKey & keyof BorderFormat & keyof CSSStyleDeclaration)[];
7413
7473
 
7414
7474
  /**
7415
7475
  * List of deprecated colors
@@ -7594,12 +7654,22 @@ function retrieveDocumentMetadata(doc: Document): Record<string, string>;
7594
7654
 
7595
7655
  /**
7596
7656
  * Edit and transform color of elements between light mode and dark mode
7657
+ * By default, text and background colors are transformed for all elements.
7597
7658
  * @param rootNode The root DOM node to transform
7598
7659
  * @param includeSelf True to transform the root node as well, otherwise false
7599
7660
  * @param direction To specify the transform direction, light to dark, or dark to light
7600
7661
  * @param darkColorHandler The dark color handler object to help do color transformation
7662
+ * @param transformColorOptions Configuration options for controlling which elements and styles undergo color transformation.
7601
7663
  */
7602
- function transformColor(rootNode: Node, includeSelf: boolean, direction: 'lightToDark' | 'darkToLight', darkColorHandler?: DarkColorHandler): void;
7664
+ function transformColor(rootNode: Node, includeSelf: boolean, direction: 'lightToDark' | 'darkToLight', darkColorHandler?: DarkColorHandler, transformColorOptions?: TransformColorOptions): void;
7665
+
7666
+ /**
7667
+ * Configuration options for controlling which elements and styles undergo color transformation.
7668
+ * By default, text and background colors are transformed for all elements.
7669
+ */
7670
+ interface TransformColorOptions {
7671
+ tableBorders: boolean;
7672
+ }
7603
7673
 
7604
7674
  /**
7605
7675
  * Normalize font family string to a standard format
@@ -7904,7 +7974,7 @@ function setFirstColumnFormatBorders(rows: ShallowMutableContentModelTableRow[],
7904
7974
  * Normalize a Content Model table, make sure:
7905
7975
  * 1. Fist cells are not spanned
7906
7976
  * 2. Only first column and row can have headers
7907
- * 3. All cells have content and width
7977
+ * 3. All cells have content
7908
7978
  * 4. Table and table row have correct width/height
7909
7979
  * 5. Spanned cell has no child blocks
7910
7980
  * 6. default format is correctly applied
@@ -8621,8 +8691,9 @@ function getContentForCopy(editor: IEditor, isCut: boolean, event: ClipboardEven
8621
8691
  * @param rows Number of rows in table
8622
8692
  * @param tableMetadataFormat (Optional) The table format that are stored as metadata. If not passed, the default format will be applied: background color: #FFF; border color: #ABABAB
8623
8693
  * @param format (Optional) The table format used for style attributes
8694
+ * @param cellFormat (Optional) custom format for table cells, except for borders styles, for borders use tableMetadataFormat
8624
8695
  */
8625
- function insertTable(editor: IEditor, columns: number, rows: number, tableMetadataFormat?: Partial<TableMetadataFormat>, format?: ContentModelTableFormat): void;
8696
+ function insertTable(editor: IEditor, columns: number, rows: number, tableMetadataFormat?: Partial<TableMetadataFormat>, format?: ContentModelTableFormat, customCellFormat?: ContentModelTableCellFormat): void;
8626
8697
 
8627
8698
  /**
8628
8699
  * Format current focused table with the given format
@@ -9203,7 +9274,7 @@ type OnTableEditorCreatedCallback = (featureType: TableEditFeatureName, element:
9203
9274
  /**
9204
9275
  * Names of table edit features
9205
9276
  */
9206
- type TableEditFeatureName = 'HorizontalTableInserter' | 'VerticalTableInserter' | 'TableMover' | 'TableResizer' | 'TableSelector' | 'CellResizer';
9277
+ type TableEditFeatureName = 'HorizontalTableInserter' | 'VerticalTableInserter' | 'TableMover' | 'TableResizer' | 'TableSelector' | 'CellResizer' | 'TableRowSelector' | 'TableColumnSelector';
9207
9278
 
9208
9279
  /**
9209
9280
  * Represents a table and its container (logical root)