roosterjs 8.35.2 → 8.37.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-amd-min.js +1 -1
- package/dist/rooster-amd-min.js.map +1 -1
- package/dist/rooster-amd.d.ts +99 -37
- package/dist/rooster-amd.js +623 -373
- package/dist/rooster-amd.js.map +1 -1
- package/dist/rooster-min.js +1 -1
- package/dist/rooster-min.js.map +1 -1
- package/dist/rooster.d.ts +99 -37
- package/dist/rooster.js +623 -373
- package/dist/rooster.js.map +1 -1
- package/package.json +8 -8
- package/tsconfig.child.tsbuildinfo +1 -1
package/dist/rooster.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Type definitions for roosterjs (Version 8.
|
|
1
|
+
// Type definitions for roosterjs (Version 8.37.0)
|
|
2
2
|
// Generated by dts tool from roosterjs
|
|
3
3
|
// Project: https://github.com/Microsoft/roosterjs
|
|
4
4
|
|
|
@@ -1237,8 +1237,9 @@ class VListChain {
|
|
|
1237
1237
|
* If the child inline elements have different styles, it will not modify the styles of the list item
|
|
1238
1238
|
* @param element the LI Element to set the styles
|
|
1239
1239
|
* @param styles The styles that should be applied to the element.
|
|
1240
|
+
* @param isCssStyle True means the given styles are CSS style names, false means they are HTML attributes @default true
|
|
1240
1241
|
*/
|
|
1241
|
-
function setListItemStyle(element: HTMLLIElement, styles: string[]): void;
|
|
1242
|
+
function setListItemStyle(element: HTMLLIElement, styles: string[], isCssStyle?: boolean): void;
|
|
1242
1243
|
|
|
1243
1244
|
/**
|
|
1244
1245
|
* Get the format info of a table
|
|
@@ -1657,6 +1658,35 @@ function getEntityFromElement(element: HTMLElement): Entity | null;
|
|
|
1657
1658
|
*/
|
|
1658
1659
|
function getEntitySelector(type?: string, id?: string): string;
|
|
1659
1660
|
|
|
1661
|
+
/**
|
|
1662
|
+
* Create a placeholder comment node for entity
|
|
1663
|
+
* @param entity The entity to create placeholder from
|
|
1664
|
+
* @returns A placeholder comment node as
|
|
1665
|
+
*/
|
|
1666
|
+
function createEntityPlaceholder(entity: Entity): HTMLElement;
|
|
1667
|
+
|
|
1668
|
+
/**
|
|
1669
|
+
* Move content from a container into a new Document fragment, and try keep entities to be reusable by creating placeholder
|
|
1670
|
+
* for them in the document fragment.
|
|
1671
|
+
* If an entity is directly under root container, the whole entity can be reused and no need to move it at all.
|
|
1672
|
+
* If an entity is not directly under root container, it is still reusable, but it may need some movement.
|
|
1673
|
+
* In any case, entities will be replaced with a placeholder in the target document fragment.
|
|
1674
|
+
* We will use an entity map (the "entities" parameter) to save the map from entity id to its wrapper element.
|
|
1675
|
+
* @param root The root element
|
|
1676
|
+
* @param entities A map from entity id to entity wrapper element
|
|
1677
|
+
* @returns A new document fragment contains all the content and entity placeholders
|
|
1678
|
+
*/
|
|
1679
|
+
function moveContentWithEntityPlaceholders(root: HTMLDivElement, entities: Record<string, HTMLElement>): DocumentFragment;
|
|
1680
|
+
|
|
1681
|
+
/**
|
|
1682
|
+
* Restore HTML content from a document fragment that may contain entity placeholders.
|
|
1683
|
+
* @param source Source document fragment that contains HTML content and entity placeholders
|
|
1684
|
+
* @param target Target container, usually to be editor root container
|
|
1685
|
+
* @param entities A map from entity id to entity wrapper, used for reusing existing DOM structure for entity
|
|
1686
|
+
* @param insertClonedNode When pass true, merge with a cloned copy of the nodes from source fragment rather than the nodes themselves @default false
|
|
1687
|
+
*/
|
|
1688
|
+
function restoreContentWithEntityPlaceholder(source: DocumentFragment, target: HTMLElement, entities: Record<string, HTMLElement> | null, insertClonedNode?: boolean): void;
|
|
1689
|
+
|
|
1660
1690
|
/**
|
|
1661
1691
|
* Gets the cached event data by cache key from event object if there is already one.
|
|
1662
1692
|
* Otherwise, call getter function to create one, and cache it.
|
|
@@ -1715,6 +1745,22 @@ function setStyles(element: HTMLElement, styles: Record<string, string>): void;
|
|
|
1715
1745
|
*/
|
|
1716
1746
|
function removeImportantStyleRule(element: HTMLElement, styleProperties: string[]): void;
|
|
1717
1747
|
|
|
1748
|
+
/**
|
|
1749
|
+
* Add global css styles
|
|
1750
|
+
* @param doc The document object
|
|
1751
|
+
* @param cssRule The css rule that must added to the selection
|
|
1752
|
+
* @param editorId Te id of the editor
|
|
1753
|
+
* @param styleId the ID of the style tag
|
|
1754
|
+
*/
|
|
1755
|
+
function setGlobalCssStyles(doc: Document, cssRule: string, styleId: string): void;
|
|
1756
|
+
|
|
1757
|
+
/**
|
|
1758
|
+
* Remove a css rule style from a style sheet
|
|
1759
|
+
* @param doc The document object
|
|
1760
|
+
* @param styleId the ID of the style tag
|
|
1761
|
+
*/
|
|
1762
|
+
function removeGlobalCssStyle(doc: Document, styleId: string): void;
|
|
1763
|
+
|
|
1718
1764
|
/**
|
|
1719
1765
|
*
|
|
1720
1766
|
* @param root the contentDiv of the ditor
|
|
@@ -2669,8 +2715,9 @@ const experimentCommitListChains: typeof commitListChains;
|
|
|
2669
2715
|
/**
|
|
2670
2716
|
* Get dark mode color for a given color
|
|
2671
2717
|
* @param color The color to calculate from
|
|
2718
|
+
* @param baseLValue The Light value for base dark color in LAB format. @default the Light value for #333333
|
|
2672
2719
|
*/
|
|
2673
|
-
function getDarkColor(color: string): string;
|
|
2720
|
+
function getDarkColor(color: string, baseLValue?: number): string;
|
|
2674
2721
|
|
|
2675
2722
|
/**
|
|
2676
2723
|
* Information of current OS and web browser
|
|
@@ -2852,6 +2899,10 @@ interface LifecyclePluginState {
|
|
|
2852
2899
|
* Cached document fragment for original content
|
|
2853
2900
|
*/
|
|
2854
2901
|
shadowEditFragment: DocumentFragment | null;
|
|
2902
|
+
/**
|
|
2903
|
+
* Cached entity pairs for original content
|
|
2904
|
+
*/
|
|
2905
|
+
shadowEditEntities: Record<string, HTMLElement> | null;
|
|
2855
2906
|
/**
|
|
2856
2907
|
* Cached selection path for original content
|
|
2857
2908
|
*/
|
|
@@ -3579,6 +3630,7 @@ const enum ExperimentalFeatures {
|
|
|
3579
3630
|
*/
|
|
3580
3631
|
ConvertSingleImageBody = "ConvertSingleImageBody",
|
|
3581
3632
|
/**
|
|
3633
|
+
* @deprecated This feature is always enabled
|
|
3582
3634
|
* Align table elements to left, center and right using setAlignment API
|
|
3583
3635
|
*/
|
|
3584
3636
|
TableAlignment = "TableAlignment",
|
|
@@ -3587,6 +3639,7 @@ const enum ExperimentalFeatures {
|
|
|
3587
3639
|
*/
|
|
3588
3640
|
TabKeyTextFeatures = "TabKeyTextFeatures",
|
|
3589
3641
|
/**
|
|
3642
|
+
* @deprecated this feature is always enabled
|
|
3590
3643
|
* Provide a circular resize handles that adaptive the number od handles to the size of the image
|
|
3591
3644
|
*/
|
|
3592
3645
|
AdaptiveHandlesResizer = "AdaptiveHandlesResizer",
|
|
@@ -3615,6 +3668,7 @@ const enum ExperimentalFeatures {
|
|
|
3615
3668
|
*/
|
|
3616
3669
|
NormalizeList = "NormalizeList",
|
|
3617
3670
|
/**
|
|
3671
|
+
* @deprecated this feature is always enabled
|
|
3618
3672
|
* When a html image is selected, the selected image data will be stored by editor core.
|
|
3619
3673
|
*/
|
|
3620
3674
|
ImageSelection = "ImageSelection",
|
|
@@ -3624,7 +3678,12 @@ const enum ExperimentalFeatures {
|
|
|
3624
3678
|
* listTypes array for that item. The only list that we will ensure is correct
|
|
3625
3679
|
* is the one closest to the item.
|
|
3626
3680
|
*/
|
|
3627
|
-
ReuseAllAncestorListElements = "ReuseAllAncestorListElements"
|
|
3681
|
+
ReuseAllAncestorListElements = "ReuseAllAncestorListElements",
|
|
3682
|
+
/**
|
|
3683
|
+
* When apply default format when initialize or user type, apply the format on a SPAN element rather than
|
|
3684
|
+
* the block element (In most case, the DIV element) so keep the block element clean.
|
|
3685
|
+
*/
|
|
3686
|
+
DefaultFormatInSpan = "DefaultFormatInSpan"
|
|
3628
3687
|
}
|
|
3629
3688
|
|
|
3630
3689
|
/**
|
|
@@ -6658,6 +6717,10 @@ interface CorePlugins {
|
|
|
6658
6717
|
* Entity Plugin handles all operations related to an entity and generate entity specified events
|
|
6659
6718
|
*/
|
|
6660
6719
|
readonly entity: PluginWithState<EntityPluginState>;
|
|
6720
|
+
/**
|
|
6721
|
+
* Image selection Plugin detects image selection and help highlight the image
|
|
6722
|
+
*/
|
|
6723
|
+
readonly imageSelection: EditorPlugin;
|
|
6661
6724
|
/**
|
|
6662
6725
|
* NormalizeTable plugin makes sure each table in editor has TBODY/THEAD/TFOOT tag around TR tags
|
|
6663
6726
|
*/
|
|
@@ -6798,6 +6861,8 @@ interface CoreApiMap {
|
|
|
6798
6861
|
* @param core The EditorCore object.
|
|
6799
6862
|
* @param position The position that user is about to type to
|
|
6800
6863
|
* @param keyboardEvent Optional keyboard event object
|
|
6864
|
+
* @param applyFormatToSpan Optional When set to true, default format (if any) will be applied to
|
|
6865
|
+
* a SPAN element inside the block element instead of the block element itself.
|
|
6801
6866
|
*/
|
|
6802
6867
|
ensureTypeInContainer: EnsureTypeInContainer;
|
|
6803
6868
|
/**
|
|
@@ -6934,8 +6999,10 @@ type CreatePasteFragment = (core: EditorCore, clipboardData: ClipboardData, posi
|
|
|
6934
6999
|
* @param core The EditorCore object.
|
|
6935
7000
|
* @param position The position that user is about to type to
|
|
6936
7001
|
* @param keyboardEvent Optional keyboard event object
|
|
7002
|
+
* @param applyFormatToSpan Optional When set to true, default format (if any) will be applied to
|
|
7003
|
+
* a SPAN element inside the block element instead of the block element itself.
|
|
6937
7004
|
*/
|
|
6938
|
-
type EnsureTypeInContainer = (core: EditorCore, position: NodePosition, keyboardEvent?: KeyboardEvent) => void;
|
|
7005
|
+
type EnsureTypeInContainer = (core: EditorCore, position: NodePosition, keyboardEvent?: KeyboardEvent, applyFormatToSpan?: boolean) => void;
|
|
6939
7006
|
|
|
6940
7007
|
/**
|
|
6941
7008
|
* Focus to editor. If there is a cached selection range, use it as current selection
|
|
@@ -7296,6 +7363,11 @@ interface ListFeatureSettings {
|
|
|
7296
7363
|
* @default true
|
|
7297
7364
|
*/
|
|
7298
7365
|
autoNumberingList: boolean;
|
|
7366
|
+
/**
|
|
7367
|
+
* MergeListOnBackspaceAfterList edit feature, provides the ability to merge list on backspace on block after a list.
|
|
7368
|
+
* @default true
|
|
7369
|
+
*/
|
|
7370
|
+
mergeListOnBackspaceAfterList: boolean;
|
|
7299
7371
|
}
|
|
7300
7372
|
|
|
7301
7373
|
/**
|
|
@@ -7999,6 +8071,7 @@ enum CompatibleExperimentalFeatures {
|
|
|
7999
8071
|
*/
|
|
8000
8072
|
ConvertSingleImageBody = "ConvertSingleImageBody",
|
|
8001
8073
|
/**
|
|
8074
|
+
* @deprecated This feature is always enabled
|
|
8002
8075
|
* Align table elements to left, center and right using setAlignment API
|
|
8003
8076
|
*/
|
|
8004
8077
|
TableAlignment = "TableAlignment",
|
|
@@ -8007,6 +8080,7 @@ enum CompatibleExperimentalFeatures {
|
|
|
8007
8080
|
*/
|
|
8008
8081
|
TabKeyTextFeatures = "TabKeyTextFeatures",
|
|
8009
8082
|
/**
|
|
8083
|
+
* @deprecated this feature is always enabled
|
|
8010
8084
|
* Provide a circular resize handles that adaptive the number od handles to the size of the image
|
|
8011
8085
|
*/
|
|
8012
8086
|
AdaptiveHandlesResizer = "AdaptiveHandlesResizer",
|
|
@@ -8035,6 +8109,7 @@ enum CompatibleExperimentalFeatures {
|
|
|
8035
8109
|
*/
|
|
8036
8110
|
NormalizeList = "NormalizeList",
|
|
8037
8111
|
/**
|
|
8112
|
+
* @deprecated this feature is always enabled
|
|
8038
8113
|
* When a html image is selected, the selected image data will be stored by editor core.
|
|
8039
8114
|
*/
|
|
8040
8115
|
ImageSelection = "ImageSelection",
|
|
@@ -8044,7 +8119,12 @@ enum CompatibleExperimentalFeatures {
|
|
|
8044
8119
|
* listTypes array for that item. The only list that we will ensure is correct
|
|
8045
8120
|
* is the one closest to the item.
|
|
8046
8121
|
*/
|
|
8047
|
-
ReuseAllAncestorListElements = "ReuseAllAncestorListElements"
|
|
8122
|
+
ReuseAllAncestorListElements = "ReuseAllAncestorListElements",
|
|
8123
|
+
/**
|
|
8124
|
+
* When apply default format when initialize or user type, apply the format on a SPAN element rather than
|
|
8125
|
+
* the block element (In most case, the DIV element) so keep the block element clean.
|
|
8126
|
+
*/
|
|
8127
|
+
DefaultFormatInSpan = "DefaultFormatInSpan"
|
|
8048
8128
|
}
|
|
8049
8129
|
|
|
8050
8130
|
/**
|
|
@@ -9640,6 +9720,8 @@ class ImageEdit implements EditorPlugin {
|
|
|
9640
9720
|
private disposer;
|
|
9641
9721
|
private allowedOperations;
|
|
9642
9722
|
private image;
|
|
9723
|
+
private clonedImage;
|
|
9724
|
+
private wrapper;
|
|
9643
9725
|
private editInfo;
|
|
9644
9726
|
private lastSrc;
|
|
9645
9727
|
private dndHelpers;
|
|
@@ -9647,6 +9729,10 @@ class ImageEdit implements EditorPlugin {
|
|
|
9647
9729
|
* Identify if the image was resized by the user.
|
|
9648
9730
|
*/
|
|
9649
9731
|
private wasResized;
|
|
9732
|
+
/**
|
|
9733
|
+
* Editor zoom scale
|
|
9734
|
+
*/
|
|
9735
|
+
private zoomWrapper;
|
|
9650
9736
|
/**
|
|
9651
9737
|
* Create a new instance of ImageEdit
|
|
9652
9738
|
* @param options Image editing options
|
|
@@ -9670,11 +9756,11 @@ class ImageEdit implements EditorPlugin {
|
|
|
9670
9756
|
dispose(): void;
|
|
9671
9757
|
/**
|
|
9672
9758
|
* Handle events triggered from editor
|
|
9673
|
-
* @param
|
|
9759
|
+
* @param e PluginEvent object
|
|
9674
9760
|
*/
|
|
9675
9761
|
onPluginEvent(e: PluginEvent): void;
|
|
9676
9762
|
/**
|
|
9677
|
-
* Check if the given image edit operation is allowed by this
|
|
9763
|
+
* Check if the given image edit operation is allowed by this plugin
|
|
9678
9764
|
* @param operation The image edit operation to check
|
|
9679
9765
|
* @returns True means it is allowed, otherwise false
|
|
9680
9766
|
*/
|
|
@@ -9701,14 +9787,13 @@ class ImageEdit implements EditorPlugin {
|
|
|
9701
9787
|
* Create editing wrapper for the image
|
|
9702
9788
|
*/
|
|
9703
9789
|
private createWrapper;
|
|
9704
|
-
|
|
9705
|
-
|
|
9706
|
-
|
|
9707
|
-
|
|
9708
|
-
private
|
|
9790
|
+
private toggleImageVisibility;
|
|
9791
|
+
private createZoomWrapper;
|
|
9792
|
+
private copyImageSize;
|
|
9793
|
+
private insertImageWrapper;
|
|
9794
|
+
private getStylePropertyValue;
|
|
9709
9795
|
/**
|
|
9710
9796
|
* Remove the temp wrapper of the image
|
|
9711
|
-
* @param wrapper The wrapper object to remove. If not specified, remove all existing wrappers.
|
|
9712
9797
|
*/
|
|
9713
9798
|
private removeWrapper;
|
|
9714
9799
|
/**
|
|
@@ -10077,27 +10162,4 @@ class AutoFormat implements EditorPlugin {
|
|
|
10077
10162
|
onPluginEvent(event: PluginEvent): void;
|
|
10078
10163
|
}
|
|
10079
10164
|
|
|
10080
|
-
/**
|
|
10081
|
-
* Requires @see ExperimentalFeatures.ImageSelection to be enabled.
|
|
10082
|
-
* Detect image selection and help highlight the image
|
|
10083
|
-
*/
|
|
10084
|
-
class ImageSelection implements EditorPlugin {
|
|
10085
|
-
private editor;
|
|
10086
|
-
constructor();
|
|
10087
|
-
/**
|
|
10088
|
-
* Get a friendly name of this plugin
|
|
10089
|
-
*/
|
|
10090
|
-
getName(): string;
|
|
10091
|
-
/**
|
|
10092
|
-
* Initialize this plugin. This should only be called from Editor
|
|
10093
|
-
* @param editor Editor instance
|
|
10094
|
-
*/
|
|
10095
|
-
initialize(editor: IEditor): void;
|
|
10096
|
-
/**
|
|
10097
|
-
* Dispose this plugin
|
|
10098
|
-
*/
|
|
10099
|
-
dispose(): void;
|
|
10100
|
-
onPluginEvent(event: PluginEvent): void;
|
|
10101
|
-
}
|
|
10102
|
-
|
|
10103
10165
|
}
|