roosterjs 8.41.0 → 8.43.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 8.41.0)
1
+ // Type definitions for roosterjs (Version 8.43.0)
2
2
  // Generated by dts tool from roosterjs
3
3
  // Project: https://github.com/Microsoft/roosterjs
4
4
 
@@ -187,6 +187,19 @@ export class PositionContentSearcher implements IPositionContentSearcher {
187
187
  private traverse;
188
188
  }
189
189
 
190
+ /**
191
+ * Adds delimiters to the element provided.
192
+ * @param element element to be between delimiters
193
+ */
194
+ export function addDelimiters(element: HTMLElement): void;
195
+
196
+ /**
197
+ * Retrieves Delimiter information from a provided element.
198
+ * @param element element to try to retrieve a delimiter
199
+ * @returns delimiter info if it is a Delimiter, else null
200
+ */
201
+ export function getDelimiterFromElement(element: HTMLElement | Element | null | undefined): Element | null;
202
+
190
203
  /**
191
204
  * Get the inline element at a node
192
205
  * @param rootNode The root node of current scope
@@ -752,6 +765,12 @@ export function getIntersectedRect(elements: HTMLElement[], additionalRects?: Re
752
765
  */
753
766
  export function isNodeAfter(node1: Node, node2: Node): boolean;
754
767
 
768
+ /**
769
+ * Parse color string to r/g/b value.
770
+ * If the given color is not in a recognized format, return null
771
+ */
772
+ export function parseColor(color: string): [number, number, number] | null;
773
+
755
774
  /**
756
775
  * A virtual table class, represent an HTML table, by expand all merged cells to each separated cells
757
776
  */
@@ -2297,7 +2316,7 @@ export class Editor implements IEditor {
2297
2316
  * @returns the current EditorCore object
2298
2317
  * @throws a standard Error if there's no core object
2299
2318
  */
2300
- private getCore;
2319
+ protected getCore(): EditorCore;
2301
2320
  }
2302
2321
 
2303
2322
  /**
@@ -2383,19 +2402,10 @@ export function insertEntity(editor: IEditor, type: string, contentNode: Node, i
2383
2402
  /**
2384
2403
  * Insert an image to editor at current selection
2385
2404
  * @param editor The editor instance
2386
- * @param imageFile The image file. There are at least 3 ways to obtain the file object:
2387
- * From local file, from clipboard data, from drag-and-drop
2388
- * @param attributes Optional image element attributes
2389
- */
2390
- export function insertImage(editor: IEditor, imageFile: File, attributes?: Record<string, string>): void;
2391
-
2392
- /**
2393
- * Insert an image to editor at current selection
2394
- * @param editor The editor instance
2395
- * @param url The image link
2405
+ * @param imageFileOrSrc Either the image file blob or source string of the image.
2396
2406
  * @param attributes Optional image element attributes
2397
2407
  */
2398
- export function insertImage(editor: IEditor, url: string, attributes?: Record<string, string>): void;
2408
+ export function insertImage(editor: IEditor, imageFileOrSrc: File | string, attributes?: Record<string, string>): void;
2399
2409
 
2400
2410
  /**
2401
2411
  * Insert table into editor at current selection
@@ -3486,6 +3496,20 @@ export const enum DarkModeDatasetNames {
3486
3496
  OriginalAttributeBackgroundColor = "ogab"
3487
3497
  }
3488
3498
 
3499
+ /**
3500
+ * Class names for Delimiter
3501
+ */
3502
+ export const enum DelimiterClasses {
3503
+ /**
3504
+ * Class name to specify this delimiter is before an entity
3505
+ */
3506
+ DELIMITER_BEFORE = "entityDelimiterBefore",
3507
+ /**
3508
+ * Class name to specify this delimiter is after an entity
3509
+ */
3510
+ DELIMITER_AFTER = "entityDelimiterAfter"
3511
+ }
3512
+
3489
3513
  /**
3490
3514
  * enum for setting block direction, used by setDirection API
3491
3515
  */
@@ -3697,7 +3721,15 @@ export const enum ExperimentalFeatures {
3697
3721
  * When enable this feature, need to pass in a DarkModelHandler object to each call of setColor and applyFormat
3698
3722
  * if you need them work for dark mode
3699
3723
  */
3700
- VariableBasedDarkColor = "VariableBasedDarkColor"
3724
+ VariableBasedDarkColor = "VariableBasedDarkColor",
3725
+ /**
3726
+ * Delete table with Backspace key with the whole was selected with table selector
3727
+ */
3728
+ DeleteTableWithBackspace = "DeleteTableWithBackspace",
3729
+ /**
3730
+ * Add entities around a Read Only Inline entity to prevent cursor to be hidden when cursor is next of it.
3731
+ */
3732
+ InlineEntityReadOnlyDelimiters = "InlineEntityReadOnlyDelimiters"
3701
3733
  }
3702
3734
 
3703
3735
  /**
@@ -5363,6 +5395,26 @@ export interface StyleBasedFormatState {
5363
5395
  * Mode independent background color for dark mode
5364
5396
  */
5365
5397
  textColors?: ModeIndependentColor;
5398
+ /**
5399
+ * Line height
5400
+ */
5401
+ lineHeight?: string;
5402
+ /**
5403
+ * Margin Top
5404
+ */
5405
+ marginTop?: string;
5406
+ /**
5407
+ * Margin Bottom
5408
+ */
5409
+ marginBottom?: string;
5410
+ /**
5411
+ * Text Align
5412
+ */
5413
+ textAlign?: string;
5414
+ /**
5415
+ * Direction of the element ('ltr' or 'rtl')
5416
+ */
5417
+ direction?: string;
5366
5418
  }
5367
5419
 
5368
5420
  /**
@@ -5843,6 +5895,10 @@ export interface Snapshot {
5843
5895
  * Metadata of the editor content state
5844
5896
  */
5845
5897
  metadata: ContentMetadata | null;
5898
+ /**
5899
+ * Known colors for dark mode
5900
+ */
5901
+ knownColors: Readonly<ModeIndependentColor>[];
5846
5902
  }
5847
5903
 
5848
5904
  /**
@@ -6633,6 +6689,15 @@ export interface DarkColorHandler {
6633
6689
  * @param color The color string to parse
6634
6690
  */
6635
6691
  parseColorValue(color: string | null | undefined): ColorKeyAndValue;
6692
+ /**
6693
+ * Get a copy of known colors
6694
+ */
6695
+ getKnownColorsCopy(): Readonly<ModeIndependentColor>[];
6696
+ /**
6697
+ * Find related light mode color from dark mode color.
6698
+ * @param darkColor The existing dark color
6699
+ */
6700
+ findLightColorFromDarkColor(darkColor: string): string | null;
6636
6701
  }
6637
6702
 
6638
6703
  /**
@@ -7530,6 +7595,11 @@ export interface TableFeatureSettings {
7530
7595
  * IndentTableOnTab edit feature, provides the ability to indent the table if it is all cells are selected.
7531
7596
  */
7532
7597
  indentTableOnTab: boolean;
7598
+ /**
7599
+ * Requires @see ExperimentalFeatures.DeleteTableWithBackspace
7600
+ * Delete a table selected with the table selector pressing Backspace key
7601
+ */
7602
+ deleteTableWithBackspace: boolean;
7533
7603
  }
7534
7604
 
7535
7605
  /**
@@ -8215,7 +8285,15 @@ export enum CompatibleExperimentalFeatures {
8215
8285
  * When enable this feature, need to pass in a DarkModelHandler object to each call of setColor and applyFormat
8216
8286
  * if you need them work for dark mode
8217
8287
  */
8218
- VariableBasedDarkColor = "VariableBasedDarkColor"
8288
+ VariableBasedDarkColor = "VariableBasedDarkColor",
8289
+ /**
8290
+ * Delete table with Backspace key with the whole was selected with table selector
8291
+ */
8292
+ DeleteTableWithBackspace = "DeleteTableWithBackspace",
8293
+ /**
8294
+ * Add entities around a Read Only Inline entity to prevent cursor to be hidden when cursor is next of it.
8295
+ */
8296
+ InlineEntityReadOnlyDelimiters = "InlineEntityReadOnlyDelimiters"
8219
8297
  }
8220
8298
 
8221
8299
  /**
@@ -8867,6 +8945,20 @@ export enum CompatibleDarkModeDatasetNames {
8867
8945
  OriginalAttributeBackgroundColor = "ogab"
8868
8946
  }
8869
8947
 
8948
+ /**
8949
+ * Class names for Delimiter
8950
+ */
8951
+ export enum CompatibleDelimiterClasses {
8952
+ /**
8953
+ * Class name to specify this delimiter is before an entity
8954
+ */
8955
+ DELIMITER_BEFORE = "entityDelimiterBefore",
8956
+ /**
8957
+ * Class name to specify this delimiter is after an entity
8958
+ */
8959
+ DELIMITER_AFTER = "entityDelimiterAfter"
8960
+ }
8961
+
8870
8962
  /**
8871
8963
  * enum for setting block direction, used by setDirection API
8872
8964
  */
@@ -9810,7 +9902,7 @@ export class HyperLink implements EditorPlugin {
9810
9902
  */
9811
9903
  export class ImageEdit implements EditorPlugin {
9812
9904
  private onShowResizeHandle?;
9813
- protected editor: IEditor;
9905
+ protected editor: IEditor | null;
9814
9906
  protected options: ImageEditOptions;
9815
9907
  private disposer;
9816
9908
  private allowedOperations;
@@ -9839,7 +9931,7 @@ export class ImageEdit implements EditorPlugin {
9839
9931
  * To customize the resize handle element, add this callback and change the attributes of elementData then it
9840
9932
  * will be picked up by ImageEdit code
9841
9933
  */
9842
- constructor(options?: ImageEditOptions, onShowResizeHandle?: OnShowResizeHandle);
9934
+ constructor(options?: ImageEditOptions, onShowResizeHandle?: OnShowResizeHandle | undefined);
9843
9935
  /**
9844
9936
  * Get a friendly name of this plugin
9845
9937
  */