roosterjs 9.45.2 → 9.47.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.45.2)
1
+ // Type definitions for roosterjs (Version 9.47.0)
2
2
  // Generated by dts tool from roosterjs
3
3
  // Project: https://github.com/Microsoft/roosterjs
4
4
 
@@ -1294,7 +1294,7 @@ type EntityFormatOperation = /**
1294
1294
  /**
1295
1295
  * Operations used by editTable() API
1296
1296
  */
1297
- type TableOperation = TableVerticalInsertOperation | TableHorizontalInsertOperation | TableDeleteOperation | TableVerticalMergeOperation | TableHorizontalMergeOperation | TableCellMergeOperation | TableSplitOperation | TableAlignOperation | TableCellHorizontalAlignOperation | TableCellVerticalAlignOperation;
1297
+ type TableOperation = TableVerticalInsertOperation | TableHorizontalInsertOperation | TableDeleteOperation | TableVerticalMergeOperation | TableHorizontalMergeOperation | TableCellMergeOperation | TableSplitOperation | TableAlignOperation | TableCellHorizontalAlignOperation | TableCellVerticalAlignOperation | TableCellShiftOperation;
1298
1298
 
1299
1299
  /**
1300
1300
  * Operations used by editTable() API for insert table cell vertically
@@ -1428,6 +1428,18 @@ type TableCellVerticalAlignOperation = /**
1428
1428
  */
1429
1429
  | 'alignCellBottom';
1430
1430
 
1431
+ /**
1432
+ * Operations used by editTable() API to shift table cell content up or left
1433
+ */
1434
+ type TableCellShiftOperation = /**
1435
+ * Move the table cell content to the cell on the left
1436
+ */
1437
+ 'shiftCellsLeft'
1438
+ /**
1439
+ * Move the table cell content to the cell above
1440
+ */
1441
+ | 'shiftCellsUp';
1442
+
1431
1443
  /**
1432
1444
  * Specify what type of content to paste
1433
1445
  */
@@ -3000,6 +3012,18 @@ interface DomToModelListFormat {
3000
3012
  interface ModelToDomContext extends EditorContext, ModelToDomSelectionContext, ModelToDomFormatContext, ModelToDomSettings, RewriteFromModelContext {
3001
3013
  }
3002
3014
 
3015
+ /**
3016
+ * Extended context used by segment and text handlers to carry per-paragraph segment state
3017
+ */
3018
+ interface ModelToDomSegmentContext extends ModelToDomContext {
3019
+ /**
3020
+ * Whether the current segment is the last segment in the paragraph,
3021
+ * or there are no more Text segments after it (excluding SelectionMarkers).
3022
+ * When true, trailing spaces should be converted to  .
3023
+ */
3024
+ noFollowingTextSegmentOrLast?: boolean;
3025
+ }
3026
+
3003
3027
  /**
3004
3028
  * Represents internal data structure for a selection position, combined by block and segment node
3005
3029
  */
@@ -3140,7 +3164,7 @@ type ContentModelHandler<T extends ContentModelSegment | ContentModelBlockGroup
3140
3164
  * - For segments with decorators: decorator elements will also be included
3141
3165
  * - For inline entity segment, the delimiter SPANs will also be included
3142
3166
  */
3143
- type ContentModelSegmentHandler<T extends ContentModelSegment> = (doc: Document, parent: Node, model: T, context: ModelToDomContext, segmentNodes: Node[]) => void;
3167
+ type ContentModelSegmentHandler<T extends ContentModelSegment> = (doc: Document, parent: Node, model: T, context: ModelToDomSegmentContext, segmentNodes: Node[]) => void;
3144
3168
 
3145
3169
  /**
3146
3170
  * Type of Content Model to DOM handler for block
@@ -3536,8 +3560,9 @@ interface Colors {
3536
3560
  * @param baseLValue Base value of light used for dark value calculation
3537
3561
  * @param colorType @optional Type of color, can be text, background, or border
3538
3562
  * @param element @optional Source HTML element of the color
3563
+ * @param comparingColor @optional When generating dark color for background color, we can provide text color as comparingColor to make sure the generated dark border color has enough contrast with text color in dark mode
3539
3564
  */
3540
- type ColorTransformFunction = (lightColor: string, baseLValue?: number, colorType?: 'text' | 'background' | 'border', element?: HTMLElement) => string;
3565
+ type ColorTransformFunction = (lightColor: string, baseLValue?: number, colorType?: 'text' | 'background' | 'border', element?: HTMLElement, comparingColor?: string) => string;
3541
3566
 
3542
3567
  /**
3543
3568
  * An interface of Editor, built on top of Content Model
@@ -7493,8 +7518,9 @@ function getColor(element: HTMLElement, isBackground: boolean, isDarkMode: boole
7493
7518
  * @param isBackground True to set background color, false to set text color
7494
7519
  * @param isDarkMode Whether element is in dark mode now
7495
7520
  * @param darkColorHandler @optional The dark color handler object to help manager dark mode color
7521
+ * @param comparingColor @optional When generating dark color for background color, we can provide text color as comparingColor to make sure the generated dark border color has enough contrast with text color in dark mode
7496
7522
  */
7497
- function setColor(element: HTMLElement, color: string | null | undefined, isBackground: boolean, isDarkMode: boolean, darkColorHandler?: DarkColorHandler): void;
7523
+ function setColor(element: HTMLElement, color: string | null | undefined, isBackground: boolean, isDarkMode: boolean, darkColorHandler?: DarkColorHandler, comparingColor?: string): void;
7498
7524
 
7499
7525
  /**
7500
7526
  * Parse color string to r/g/b value.
@@ -7573,6 +7599,13 @@ function getSelectionRootNode(selection: DOMSelection | undefined): Node | undef
7573
7599
  */
7574
7600
  function getDOMInsertPointRect(doc: Document, pos: DOMInsertPoint): Rect | null;
7575
7601
 
7602
+ /**
7603
+ * Remove the unselected content from the model
7604
+ * @param model the model document
7605
+ * @param selection The editor selection
7606
+ * */
7607
+ function trimModelForSelection(model: ContentModelDocument, selection: DOMSelection): void;
7608
+
7576
7609
  /**
7577
7610
  * Returns true when the event was fired from a key that produces a character value, otherwise false
7578
7611
  * This detection is not 100% accurate. event.key is not fully supported by all browsers, and in some browsers (e.g. IE),
@@ -7595,6 +7628,15 @@ function isModifierKey(event: KeyboardEvent): boolean;
7595
7628
  */
7596
7629
  function isCursorMovingKey(event: KeyboardEvent): boolean;
7597
7630
 
7631
+ /**
7632
+ * Get insertion point from coordinate.
7633
+ * @param doc Parent document object
7634
+ * @param domHelper The DOM helper of the editor
7635
+ * @param x The cursor coordinate for the x-axis
7636
+ * @param y The cursor coordinate for the y-axis
7637
+ */
7638
+ function getNodePositionFromEvent(doc: Document, domHelper: DOMHelper, x: number, y: number): DOMInsertPoint | null;
7639
+
7598
7640
  /**
7599
7641
  * Combine border value array back to string
7600
7642
  * @param values Input string values
@@ -7661,7 +7703,7 @@ function retrieveDocumentMetadata(doc: Document): Record<string, string>;
7661
7703
  * @param darkColorHandler The dark color handler object to help do color transformation
7662
7704
  * @param transformColorOptions Configuration options for controlling which elements and styles undergo color transformation.
7663
7705
  */
7664
- function transformColor(rootNode: Node, includeSelf: boolean, direction: 'lightToDark' | 'darkToLight', darkColorHandler?: DarkColorHandler, transformColorOptions?: TransformColorOptions): void;
7706
+ function transformColor(rootNode: Node, includeSelf: boolean, direction: 'lightToDark' | 'darkToLight', darkColorHandler?: DarkColorHandler, transformColorOptions?: TransformColorOptions, defaultTextColor?: string): void;
7665
7707
 
7666
7708
  /**
7667
7709
  * Configuration options for controlling which elements and styles undergo color transformation.