roosterjs 8.35.2 → 8.36.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.35.2)
1
+ // Type definitions for roosterjs (Version 8.36.0)
2
2
  // Generated by dts tool from roosterjs
3
3
  // Project: https://github.com/Microsoft/roosterjs
4
4
 
@@ -1714,6 +1714,22 @@ export function setStyles(element: HTMLElement, styles: Record<string, string>):
1714
1714
  */
1715
1715
  export function removeImportantStyleRule(element: HTMLElement, styleProperties: string[]): void;
1716
1716
 
1717
+ /**
1718
+ * Add global css styles
1719
+ * @param doc The document object
1720
+ * @param cssRule The css rule that must added to the selection
1721
+ * @param editorId Te id of the editor
1722
+ * @param styleId the ID of the style tag
1723
+ */
1724
+ export function setGlobalCssStyles(doc: Document, cssRule: string, styleId: string): void;
1725
+
1726
+ /**
1727
+ * Remove a css rule style from a style sheet
1728
+ * @param doc The document object
1729
+ * @param styleId the ID of the style tag
1730
+ */
1731
+ export function removeGlobalCssStyle(doc: Document, styleId: string): void;
1732
+
1717
1733
  /**
1718
1734
  *
1719
1735
  * @param root the contentDiv of the ditor
@@ -2668,8 +2684,9 @@ export const experimentCommitListChains: typeof commitListChains;
2668
2684
  /**
2669
2685
  * Get dark mode color for a given color
2670
2686
  * @param color The color to calculate from
2687
+ * @param baseLValue The Light value for base dark color in LAB format. @default the Light value for #333333
2671
2688
  */
2672
- export function getDarkColor(color: string): string;
2689
+ export function getDarkColor(color: string, baseLValue?: number): string;
2673
2690
 
2674
2691
  /**
2675
2692
  * Information of current OS and web browser
@@ -3578,6 +3595,7 @@ export const enum ExperimentalFeatures {
3578
3595
  */
3579
3596
  ConvertSingleImageBody = "ConvertSingleImageBody",
3580
3597
  /**
3598
+ * @deprecated This feature is always enabled
3581
3599
  * Align table elements to left, center and right using setAlignment API
3582
3600
  */
3583
3601
  TableAlignment = "TableAlignment",
@@ -3586,6 +3604,7 @@ export const enum ExperimentalFeatures {
3586
3604
  */
3587
3605
  TabKeyTextFeatures = "TabKeyTextFeatures",
3588
3606
  /**
3607
+ * @deprecated this feature is always enabled
3589
3608
  * Provide a circular resize handles that adaptive the number od handles to the size of the image
3590
3609
  */
3591
3610
  AdaptiveHandlesResizer = "AdaptiveHandlesResizer",
@@ -3614,6 +3633,7 @@ export const enum ExperimentalFeatures {
3614
3633
  */
3615
3634
  NormalizeList = "NormalizeList",
3616
3635
  /**
3636
+ * @deprecated this feature is always enabled
3617
3637
  * When a html image is selected, the selected image data will be stored by editor core.
3618
3638
  */
3619
3639
  ImageSelection = "ImageSelection",
@@ -3623,7 +3643,12 @@ export const enum ExperimentalFeatures {
3623
3643
  * listTypes array for that item. The only list that we will ensure is correct
3624
3644
  * is the one closest to the item.
3625
3645
  */
3626
- ReuseAllAncestorListElements = "ReuseAllAncestorListElements"
3646
+ ReuseAllAncestorListElements = "ReuseAllAncestorListElements",
3647
+ /**
3648
+ * When apply default format when initialize or user type, apply the format on a SPAN element rather than
3649
+ * the block element (In most case, the DIV element) so keep the block element clean.
3650
+ */
3651
+ DefaultFormatInSpan = "DefaultFormatInSpan"
3627
3652
  }
3628
3653
 
3629
3654
  /**
@@ -6657,6 +6682,10 @@ export interface CorePlugins {
6657
6682
  * Entity Plugin handles all operations related to an entity and generate entity specified events
6658
6683
  */
6659
6684
  readonly entity: PluginWithState<EntityPluginState>;
6685
+ /**
6686
+ * Image selection Plugin detects image selection and help highlight the image
6687
+ */
6688
+ readonly imageSelection: EditorPlugin;
6660
6689
  /**
6661
6690
  * NormalizeTable plugin makes sure each table in editor has TBODY/THEAD/TFOOT tag around TR tags
6662
6691
  */
@@ -6797,6 +6826,8 @@ export interface CoreApiMap {
6797
6826
  * @param core The EditorCore object.
6798
6827
  * @param position The position that user is about to type to
6799
6828
  * @param keyboardEvent Optional keyboard event object
6829
+ * @param applyFormatToSpan Optional When set to true, default format (if any) will be applied to
6830
+ * a SPAN element inside the block element instead of the block element itself.
6800
6831
  */
6801
6832
  ensureTypeInContainer: EnsureTypeInContainer;
6802
6833
  /**
@@ -6933,8 +6964,10 @@ export type CreatePasteFragment = (core: EditorCore, clipboardData: ClipboardDat
6933
6964
  * @param core The EditorCore object.
6934
6965
  * @param position The position that user is about to type to
6935
6966
  * @param keyboardEvent Optional keyboard event object
6967
+ * @param applyFormatToSpan Optional When set to true, default format (if any) will be applied to
6968
+ * a SPAN element inside the block element instead of the block element itself.
6936
6969
  */
6937
- export type EnsureTypeInContainer = (core: EditorCore, position: NodePosition, keyboardEvent?: KeyboardEvent) => void;
6970
+ export type EnsureTypeInContainer = (core: EditorCore, position: NodePosition, keyboardEvent?: KeyboardEvent, applyFormatToSpan?: boolean) => void;
6938
6971
 
6939
6972
  /**
6940
6973
  * Focus to editor. If there is a cached selection range, use it as current selection
@@ -7295,6 +7328,11 @@ export interface ListFeatureSettings {
7295
7328
  * @default true
7296
7329
  */
7297
7330
  autoNumberingList: boolean;
7331
+ /**
7332
+ * MergeListOnBackspaceAfterList edit feature, provides the ability to merge list on backspace on block after a list.
7333
+ * @default true
7334
+ */
7335
+ mergeListOnBackspaceAfterList: boolean;
7298
7336
  }
7299
7337
 
7300
7338
  /**
@@ -7998,6 +8036,7 @@ export enum CompatibleExperimentalFeatures {
7998
8036
  */
7999
8037
  ConvertSingleImageBody = "ConvertSingleImageBody",
8000
8038
  /**
8039
+ * @deprecated This feature is always enabled
8001
8040
  * Align table elements to left, center and right using setAlignment API
8002
8041
  */
8003
8042
  TableAlignment = "TableAlignment",
@@ -8006,6 +8045,7 @@ export enum CompatibleExperimentalFeatures {
8006
8045
  */
8007
8046
  TabKeyTextFeatures = "TabKeyTextFeatures",
8008
8047
  /**
8048
+ * @deprecated this feature is always enabled
8009
8049
  * Provide a circular resize handles that adaptive the number od handles to the size of the image
8010
8050
  */
8011
8051
  AdaptiveHandlesResizer = "AdaptiveHandlesResizer",
@@ -8034,6 +8074,7 @@ export enum CompatibleExperimentalFeatures {
8034
8074
  */
8035
8075
  NormalizeList = "NormalizeList",
8036
8076
  /**
8077
+ * @deprecated this feature is always enabled
8037
8078
  * When a html image is selected, the selected image data will be stored by editor core.
8038
8079
  */
8039
8080
  ImageSelection = "ImageSelection",
@@ -8043,7 +8084,12 @@ export enum CompatibleExperimentalFeatures {
8043
8084
  * listTypes array for that item. The only list that we will ensure is correct
8044
8085
  * is the one closest to the item.
8045
8086
  */
8046
- ReuseAllAncestorListElements = "ReuseAllAncestorListElements"
8087
+ ReuseAllAncestorListElements = "ReuseAllAncestorListElements",
8088
+ /**
8089
+ * When apply default format when initialize or user type, apply the format on a SPAN element rather than
8090
+ * the block element (In most case, the DIV element) so keep the block element clean.
8091
+ */
8092
+ DefaultFormatInSpan = "DefaultFormatInSpan"
8047
8093
  }
8048
8094
 
8049
8095
  /**
@@ -9639,6 +9685,8 @@ export class ImageEdit implements EditorPlugin {
9639
9685
  private disposer;
9640
9686
  private allowedOperations;
9641
9687
  private image;
9688
+ private clonedImage;
9689
+ private wrapper;
9642
9690
  private editInfo;
9643
9691
  private lastSrc;
9644
9692
  private dndHelpers;
@@ -9646,6 +9694,10 @@ export class ImageEdit implements EditorPlugin {
9646
9694
  * Identify if the image was resized by the user.
9647
9695
  */
9648
9696
  private wasResized;
9697
+ /**
9698
+ * Editor zoom scale
9699
+ */
9700
+ private zoomWrapper;
9649
9701
  /**
9650
9702
  * Create a new instance of ImageEdit
9651
9703
  * @param options Image editing options
@@ -9669,11 +9721,11 @@ export class ImageEdit implements EditorPlugin {
9669
9721
  dispose(): void;
9670
9722
  /**
9671
9723
  * Handle events triggered from editor
9672
- * @param event PluginEvent object
9724
+ * @param e PluginEvent object
9673
9725
  */
9674
9726
  onPluginEvent(e: PluginEvent): void;
9675
9727
  /**
9676
- * Check if the given image edit operation is allowed by this pluign
9728
+ * Check if the given image edit operation is allowed by this plugin
9677
9729
  * @param operation The image edit operation to check
9678
9730
  * @returns True means it is allowed, otherwise false
9679
9731
  */
@@ -9700,14 +9752,13 @@ export class ImageEdit implements EditorPlugin {
9700
9752
  * Create editing wrapper for the image
9701
9753
  */
9702
9754
  private createWrapper;
9703
- /**
9704
- * Get image wrapper from image
9705
- * @param image The image to get wrapper from
9706
- */
9707
- private getImageWrapper;
9755
+ private toggleImageVisibility;
9756
+ private createZoomWrapper;
9757
+ private copyImageSize;
9758
+ private insertImageWrapper;
9759
+ private getStylePropertyValue;
9708
9760
  /**
9709
9761
  * Remove the temp wrapper of the image
9710
- * @param wrapper The wrapper object to remove. If not specified, remove all existing wrappers.
9711
9762
  */
9712
9763
  private removeWrapper;
9713
9764
  /**
@@ -10076,26 +10127,3 @@ export class AutoFormat implements EditorPlugin {
10076
10127
  onPluginEvent(event: PluginEvent): void;
10077
10128
  }
10078
10129
 
10079
- /**
10080
- * Requires @see ExperimentalFeatures.ImageSelection to be enabled.
10081
- * Detect image selection and help highlight the image
10082
- */
10083
- export class ImageSelection implements EditorPlugin {
10084
- private editor;
10085
- constructor();
10086
- /**
10087
- * Get a friendly name of this plugin
10088
- */
10089
- getName(): string;
10090
- /**
10091
- * Initialize this plugin. This should only be called from Editor
10092
- * @param editor Editor instance
10093
- */
10094
- initialize(editor: IEditor): void;
10095
- /**
10096
- * Dispose this plugin
10097
- */
10098
- dispose(): void;
10099
- onPluginEvent(event: PluginEvent): void;
10100
- }
10101
-