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