roosterjs 8.31.0 → 8.32.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 +183 -12
- package/dist/rooster-amd.js +654 -170
- 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 +183 -12
- package/dist/rooster.js +654 -170
- package/dist/rooster.js.map +1 -1
- package/package.json +7 -7
- package/tsconfig.child.tsbuildinfo +1 -1
package/dist/rooster-amd.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Type definitions for roosterjs (Version 8.
|
|
1
|
+
// Type definitions for roosterjs (Version 8.32.0)
|
|
2
2
|
// Generated by dts tool from roosterjs
|
|
3
3
|
// Project: https://github.com/Microsoft/roosterjs
|
|
4
4
|
|
|
@@ -715,6 +715,33 @@ export const KnownCreateElementData: Record<KnownCreateElementDataIndex, CreateE
|
|
|
715
715
|
*/
|
|
716
716
|
export function moveChildNodes(target: Node, source?: Node, keepExistingChildren?: boolean): void;
|
|
717
717
|
|
|
718
|
+
/**
|
|
719
|
+
* Get the intersected Rect of elements provided
|
|
720
|
+
*
|
|
721
|
+
* @example
|
|
722
|
+
* The result of the following Elements Rects would be:
|
|
723
|
+
{
|
|
724
|
+
top: Element2.top,
|
|
725
|
+
bottom: Element1.bottom,
|
|
726
|
+
left: Element2.left,
|
|
727
|
+
right: Element2.right
|
|
728
|
+
}
|
|
729
|
+
+-------------------------+
|
|
730
|
+
| Element 1 |
|
|
731
|
+
| +-----------------+ |
|
|
732
|
+
| | Element2 | |
|
|
733
|
+
| | | |
|
|
734
|
+
| | | |
|
|
735
|
+
+-------------------------+
|
|
736
|
+
| |
|
|
737
|
+
+-----------------+
|
|
738
|
+
|
|
739
|
+
* @param elements Elements to use.
|
|
740
|
+
* @param additionalRects additional rects to use
|
|
741
|
+
* @returns If the Rect is valid return the rect, if not, return null.
|
|
742
|
+
*/
|
|
743
|
+
export function getIntersectedRect(elements: HTMLElement[], additionalRects?: Rect[]): Rect | null;
|
|
744
|
+
|
|
718
745
|
/**
|
|
719
746
|
* A virtual table class, represent an HTML table, by expand all merged cells to each separated cells
|
|
720
747
|
*/
|
|
@@ -911,8 +938,10 @@ export class VList {
|
|
|
911
938
|
/**
|
|
912
939
|
* Write the result back into DOM tree
|
|
913
940
|
* After that, this VList becomes unavailable because we set this.rootList to null
|
|
941
|
+
*
|
|
942
|
+
* @param shouldReuseAllAncestorListElements Optional - defaults to false.
|
|
914
943
|
*/
|
|
915
|
-
writeBack(): void;
|
|
944
|
+
writeBack(shouldReuseAllAncestorListElements?: boolean): void;
|
|
916
945
|
/**
|
|
917
946
|
* Sets the New List Start Property, that is going to be used to create a new List in the WriteBack function
|
|
918
947
|
* @param separator The HTML element that indicates when to split the VList
|
|
@@ -1108,8 +1137,10 @@ export class VListItem {
|
|
|
1108
1137
|
* Write the change result back into DOM
|
|
1109
1138
|
* @param listStack current stack of list elements
|
|
1110
1139
|
* @param originalRoot Original list root element. It will be reused when write back if possible
|
|
1140
|
+
* @param shouldReuseAllAncestorListElements Optional - defaults to false. If true, only make
|
|
1141
|
+
* sure the direct parent of this list matches the list types when writing back.
|
|
1111
1142
|
*/
|
|
1112
|
-
writeBack(listStack: Node[], originalRoot?: HTMLOListElement | HTMLUListElement): void;
|
|
1143
|
+
writeBack(listStack: Node[], originalRoot?: HTMLOListElement | HTMLUListElement, shouldReuseAllAncestorListElements?: boolean): void;
|
|
1113
1144
|
/**
|
|
1114
1145
|
* Get the index of how deep is the current node parent list inside of the original root list.
|
|
1115
1146
|
* @example In the following structure this function would return 2
|
|
@@ -1171,7 +1202,7 @@ export class VListChain {
|
|
|
1171
1202
|
* After change the lists, commit the change to all lists in this chain to update the list number,
|
|
1172
1203
|
* and clear the temporary dataset values added to list node
|
|
1173
1204
|
*/
|
|
1174
|
-
commit(): void;
|
|
1205
|
+
commit(shouldReuseAllAncestorListElements?: boolean): void;
|
|
1175
1206
|
/**
|
|
1176
1207
|
* Construct a new instance of VListChain class
|
|
1177
1208
|
* @param editor Editor object
|
|
@@ -1207,6 +1238,13 @@ export function setListItemStyle(element: HTMLLIElement, styles: string[]): void
|
|
|
1207
1238
|
*/
|
|
1208
1239
|
export function getTableFormatInfo(table: HTMLTableElement): Required<TableFormat> | null;
|
|
1209
1240
|
|
|
1241
|
+
/**
|
|
1242
|
+
* Add metadata to a cell
|
|
1243
|
+
* @param cell The table cell to add the metadata
|
|
1244
|
+
* @param format The format of the table
|
|
1245
|
+
*/
|
|
1246
|
+
export function saveTableCellMetadata(cell: HTMLTableCellElement, format: TableCellMetadataFormat): void;
|
|
1247
|
+
|
|
1210
1248
|
/**
|
|
1211
1249
|
* Get regions impacted by the given range under the root node
|
|
1212
1250
|
* @param root Root node to get regions from
|
|
@@ -1949,7 +1987,7 @@ export class Editor implements IEditor {
|
|
|
1949
1987
|
* Focus to this editor, the selection was restored to where it was before, no unexpected scroll.
|
|
1950
1988
|
*/
|
|
1951
1989
|
focus(): void;
|
|
1952
|
-
select(arg1: Range | NodePosition | Node | SelectionPath | HTMLTableElement | null, arg2?: NodePosition | number | PositionType | TableSelection, arg3?: Node, arg4?: number | PositionType): boolean;
|
|
1990
|
+
select(arg1: Range | NodePosition | Node | SelectionPath | HTMLTableElement | HTMLImageElement | null, arg2?: NodePosition | number | PositionType | TableSelection, arg3?: Node, arg4?: number | PositionType): boolean;
|
|
1953
1991
|
/**
|
|
1954
1992
|
* Get current focused position. Return null if editor doesn't have focus at this time.
|
|
1955
1993
|
*/
|
|
@@ -2087,6 +2125,8 @@ export class Editor implements IEditor {
|
|
|
2087
2125
|
*/
|
|
2088
2126
|
getEditorDomAttribute(name: string): string | null;
|
|
2089
2127
|
/**
|
|
2128
|
+
* @deprecated Use getVisibleViewport() instead.
|
|
2129
|
+
*
|
|
2090
2130
|
* Get current relative distance from top-left corner of the given element to top-left corner of editor content DIV.
|
|
2091
2131
|
* @param element The element to calculate from. If the given element is not in editor, return value will be null
|
|
2092
2132
|
* @param addScroll When pass true, The return value will also add scrollLeft and scrollTop if any. So the value
|
|
@@ -2177,6 +2217,10 @@ export class Editor implements IEditor {
|
|
|
2177
2217
|
* @param scale The new scale number to set. It should be positive number and no greater than 10, otherwise it will be ignored.
|
|
2178
2218
|
*/
|
|
2179
2219
|
setZoomScale(scale: number): void;
|
|
2220
|
+
/**
|
|
2221
|
+
* Retrieves the rect of the visible viewport of the editor.
|
|
2222
|
+
*/
|
|
2223
|
+
getVisibleViewport(): Rect | null;
|
|
2180
2224
|
/**
|
|
2181
2225
|
* @returns the current EditorCore object
|
|
2182
2226
|
* @throws a standard Error if there's no core object
|
|
@@ -2713,6 +2757,10 @@ export interface DOMEventPluginState {
|
|
|
2713
2757
|
* Context menu providers, that can provide context menu items
|
|
2714
2758
|
*/
|
|
2715
2759
|
contextMenuProviders: ContextMenuProvider<any>[];
|
|
2760
|
+
/**
|
|
2761
|
+
* Image selection range
|
|
2762
|
+
*/
|
|
2763
|
+
imageSelectionRange: ImageSelectionRange | null;
|
|
2716
2764
|
}
|
|
2717
2765
|
|
|
2718
2766
|
/**
|
|
@@ -2789,6 +2837,10 @@ export interface LifecyclePluginState {
|
|
|
2789
2837
|
* Cached table selection path for original content
|
|
2790
2838
|
*/
|
|
2791
2839
|
shadowEditTableSelectionPath: SelectionPath[] | null;
|
|
2840
|
+
/**
|
|
2841
|
+
* Cached image selection path for original content
|
|
2842
|
+
*/
|
|
2843
|
+
shadowEditImageSelectionPath: SelectionPath[] | null;
|
|
2792
2844
|
}
|
|
2793
2845
|
|
|
2794
2846
|
/**
|
|
@@ -3536,7 +3588,18 @@ export const enum ExperimentalFeatures {
|
|
|
3536
3588
|
* Normalize list to make sure it can be displayed correctly in other client
|
|
3537
3589
|
* e.g. We will move list items with "display: block" into previous list item and change tag to be DIV
|
|
3538
3590
|
*/
|
|
3539
|
-
NormalizeList = "NormalizeList"
|
|
3591
|
+
NormalizeList = "NormalizeList",
|
|
3592
|
+
/**
|
|
3593
|
+
* When a html image is selected, the selected image data will be stored by editor core.
|
|
3594
|
+
*/
|
|
3595
|
+
ImageSelection = "ImageSelection",
|
|
3596
|
+
/**
|
|
3597
|
+
* With this feature enabled, when writing back a list item we will re-use all
|
|
3598
|
+
* ancestor list elements, even if they don't match the types currently in the
|
|
3599
|
+
* listTypes array for that item. The only list that we will ensure is correct
|
|
3600
|
+
* is the one closest to the item.
|
|
3601
|
+
*/
|
|
3602
|
+
ReuseAllAncestorListElements = "ReuseAllAncestorListElements"
|
|
3540
3603
|
}
|
|
3541
3604
|
|
|
3542
3605
|
/**
|
|
@@ -4089,7 +4152,11 @@ export const enum SelectionRangeTypes {
|
|
|
4089
4152
|
/**
|
|
4090
4153
|
* Selection made inside of a single table.
|
|
4091
4154
|
*/
|
|
4092
|
-
TableSelection = 1
|
|
4155
|
+
TableSelection = 1,
|
|
4156
|
+
/**
|
|
4157
|
+
* Selection made in a image.
|
|
4158
|
+
*/
|
|
4159
|
+
ImageSelection = 2
|
|
4093
4160
|
}
|
|
4094
4161
|
|
|
4095
4162
|
/**
|
|
@@ -4226,10 +4293,14 @@ export const enum BulletListType {
|
|
|
4226
4293
|
* Bullet triggered by -->
|
|
4227
4294
|
*/
|
|
4228
4295
|
DoubleLongArrow = 8,
|
|
4296
|
+
/**
|
|
4297
|
+
* Bullet type circle
|
|
4298
|
+
*/
|
|
4299
|
+
Circle = 9,
|
|
4229
4300
|
/**
|
|
4230
4301
|
* Maximum value of the enum
|
|
4231
4302
|
*/
|
|
4232
|
-
Max =
|
|
4303
|
+
Max = 9
|
|
4233
4304
|
}
|
|
4234
4305
|
|
|
4235
4306
|
/**
|
|
@@ -5672,6 +5743,16 @@ export interface TableFormat {
|
|
|
5672
5743
|
keepCellShade?: boolean;
|
|
5673
5744
|
}
|
|
5674
5745
|
|
|
5746
|
+
/**
|
|
5747
|
+
* Format of table cell that stored as metadata
|
|
5748
|
+
*/
|
|
5749
|
+
export interface TableCellMetadataFormat {
|
|
5750
|
+
/**
|
|
5751
|
+
* Override default background color
|
|
5752
|
+
*/
|
|
5753
|
+
bgColorOverride?: boolean;
|
|
5754
|
+
}
|
|
5755
|
+
|
|
5675
5756
|
/**
|
|
5676
5757
|
* Represents a selection made inside of a table
|
|
5677
5758
|
*/
|
|
@@ -6263,6 +6344,8 @@ export interface IEditor {
|
|
|
6263
6344
|
*/
|
|
6264
6345
|
getEditorDomAttribute(name: string): string | null;
|
|
6265
6346
|
/**
|
|
6347
|
+
* @deprecated Use getVisibleViewport() instead
|
|
6348
|
+
*
|
|
6266
6349
|
* Get current relative distance from top-left corner of the given element to top-left corner of editor content DIV.
|
|
6267
6350
|
* @param element The element to calculate from. If the given element is not in editor, return value will be null
|
|
6268
6351
|
* @param addScroll When pass true, The return value will also add scrollLeft and scrollTop if any. So the value
|
|
@@ -6352,6 +6435,10 @@ export interface IEditor {
|
|
|
6352
6435
|
* @deprecated Use getZoomScale() instead
|
|
6353
6436
|
*/
|
|
6354
6437
|
getSizeTransformer(): SizeTransformer;
|
|
6438
|
+
/**
|
|
6439
|
+
* Retrieves the rect of the visible viewport of the editor.
|
|
6440
|
+
*/
|
|
6441
|
+
getVisibleViewport(): Rect | null;
|
|
6355
6442
|
}
|
|
6356
6443
|
|
|
6357
6444
|
/**
|
|
@@ -6565,6 +6652,14 @@ export interface EditorCore extends PluginState {
|
|
|
6565
6652
|
* @deprecated Use zoomScale instead
|
|
6566
6653
|
*/
|
|
6567
6654
|
sizeTransformer: SizeTransformer;
|
|
6655
|
+
/**
|
|
6656
|
+
* Retrieves the Visible Viewport of the editor.
|
|
6657
|
+
*/
|
|
6658
|
+
getVisibleViewport: () => Rect | null;
|
|
6659
|
+
/**
|
|
6660
|
+
* Color of the border of a selectedImage. Default color: '#DB626C'
|
|
6661
|
+
*/
|
|
6662
|
+
imageSelectionBorderColor?: string;
|
|
6568
6663
|
}
|
|
6569
6664
|
|
|
6570
6665
|
/**
|
|
@@ -6732,6 +6827,14 @@ export interface CoreApiMap {
|
|
|
6732
6827
|
* @returns true if successful
|
|
6733
6828
|
*/
|
|
6734
6829
|
selectTable: SelectTable;
|
|
6830
|
+
/**
|
|
6831
|
+
* Select a image and save data of the selected range
|
|
6832
|
+
* @param core The EditorCore object
|
|
6833
|
+
* @param image image to select
|
|
6834
|
+
* @param imageId the id of the image element
|
|
6835
|
+
* @returns true if successful
|
|
6836
|
+
*/
|
|
6837
|
+
selectImage: SelectImage;
|
|
6735
6838
|
}
|
|
6736
6839
|
|
|
6737
6840
|
/**
|
|
@@ -6874,6 +6977,14 @@ export type TriggerEvent = (core: EditorCore, pluginEvent: PluginEvent, broadcas
|
|
|
6874
6977
|
*/
|
|
6875
6978
|
export type SelectTable = (core: EditorCore, table: HTMLTableElement | null, coordinates?: TableSelection) => TableSelectionRange | null;
|
|
6876
6979
|
|
|
6980
|
+
/**
|
|
6981
|
+
* Select a table and save data of the selected range
|
|
6982
|
+
* @param core The EditorCore object
|
|
6983
|
+
* @param image image to select
|
|
6984
|
+
* @returns true if successful
|
|
6985
|
+
*/
|
|
6986
|
+
export type SelectImage = (core: EditorCore, image: HTMLImageElement | null) => ImageSelectionRange | null;
|
|
6987
|
+
|
|
6877
6988
|
/**
|
|
6878
6989
|
* The options to specify parameters customizing an editor, used by ctor of Editor class
|
|
6879
6990
|
*/
|
|
@@ -6975,6 +7086,14 @@ export interface EditorOptions {
|
|
|
6975
7086
|
* @deprecated Use zoomScale instead
|
|
6976
7087
|
*/
|
|
6977
7088
|
sizeTransformer?: SizeTransformer;
|
|
7089
|
+
/**
|
|
7090
|
+
* Retrieves the visible viewport of the Editor. The default viewport is the Rect of the scrollContainer.
|
|
7091
|
+
*/
|
|
7092
|
+
getVisibleViewport?: () => Rect | null;
|
|
7093
|
+
/**
|
|
7094
|
+
* Color of the border of a selectedImage. Default color: '#DB626C'
|
|
7095
|
+
*/
|
|
7096
|
+
imageSelectionBorderColor?: string;
|
|
6978
7097
|
}
|
|
6979
7098
|
|
|
6980
7099
|
/**
|
|
@@ -7529,10 +7648,20 @@ export interface TableSelectionRange extends SelectionRangeExBase<SelectionRange
|
|
|
7529
7648
|
coordinates: TableSelection | undefined;
|
|
7530
7649
|
}
|
|
7531
7650
|
|
|
7651
|
+
/**
|
|
7652
|
+
* Represents a selected image.
|
|
7653
|
+
*/
|
|
7654
|
+
export interface ImageSelectionRange extends SelectionRangeExBase<SelectionRangeTypes.ImageSelection | CompatibleSelectionRangeTypes.ImageSelection> {
|
|
7655
|
+
/**
|
|
7656
|
+
* Selected Image
|
|
7657
|
+
*/
|
|
7658
|
+
image: HTMLImageElement;
|
|
7659
|
+
}
|
|
7660
|
+
|
|
7532
7661
|
/**
|
|
7533
7662
|
* Types of ranges used in editor api getSelectionRangeEx
|
|
7534
7663
|
*/
|
|
7535
|
-
export type SelectionRangeEx = NormalSelectionRange | TableSelectionRange;
|
|
7664
|
+
export type SelectionRangeEx = NormalSelectionRange | TableSelectionRange | ImageSelectionRange;
|
|
7536
7665
|
|
|
7537
7666
|
/**
|
|
7538
7667
|
* Attribute callback, will be called when HtmlSanitizer process an attribute with given name
|
|
@@ -7823,7 +7952,18 @@ export enum CompatibleExperimentalFeatures {
|
|
|
7823
7952
|
* Normalize list to make sure it can be displayed correctly in other client
|
|
7824
7953
|
* e.g. We will move list items with "display: block" into previous list item and change tag to be DIV
|
|
7825
7954
|
*/
|
|
7826
|
-
NormalizeList = "NormalizeList"
|
|
7955
|
+
NormalizeList = "NormalizeList",
|
|
7956
|
+
/**
|
|
7957
|
+
* When a html image is selected, the selected image data will be stored by editor core.
|
|
7958
|
+
*/
|
|
7959
|
+
ImageSelection = "ImageSelection",
|
|
7960
|
+
/**
|
|
7961
|
+
* With this feature enabled, when writing back a list item we will re-use all
|
|
7962
|
+
* ancestor list elements, even if they don't match the types currently in the
|
|
7963
|
+
* listTypes array for that item. The only list that we will ensure is correct
|
|
7964
|
+
* is the one closest to the item.
|
|
7965
|
+
*/
|
|
7966
|
+
ReuseAllAncestorListElements = "ReuseAllAncestorListElements"
|
|
7827
7967
|
}
|
|
7828
7968
|
|
|
7829
7969
|
/**
|
|
@@ -8235,7 +8375,11 @@ export enum CompatibleSelectionRangeTypes {
|
|
|
8235
8375
|
/**
|
|
8236
8376
|
* Selection made inside of a single table.
|
|
8237
8377
|
*/
|
|
8238
|
-
TableSelection = 1
|
|
8378
|
+
TableSelection = 1,
|
|
8379
|
+
/**
|
|
8380
|
+
* Selection made in a image.
|
|
8381
|
+
*/
|
|
8382
|
+
ImageSelection = 2
|
|
8239
8383
|
}
|
|
8240
8384
|
|
|
8241
8385
|
/**
|
|
@@ -8326,10 +8470,14 @@ export enum CompatibleBulletListType {
|
|
|
8326
8470
|
* Bullet triggered by -->
|
|
8327
8471
|
*/
|
|
8328
8472
|
DoubleLongArrow = 8,
|
|
8473
|
+
/**
|
|
8474
|
+
* Bullet type circle
|
|
8475
|
+
*/
|
|
8476
|
+
Circle = 9,
|
|
8329
8477
|
/**
|
|
8330
8478
|
* Maximum value of the enum
|
|
8331
8479
|
*/
|
|
8332
|
-
Max =
|
|
8480
|
+
Max = 9
|
|
8333
8481
|
}
|
|
8334
8482
|
|
|
8335
8483
|
/**
|
|
@@ -9838,3 +9986,26 @@ export class AutoFormat implements EditorPlugin {
|
|
|
9838
9986
|
onPluginEvent(event: PluginEvent): void;
|
|
9839
9987
|
}
|
|
9840
9988
|
|
|
9989
|
+
/**
|
|
9990
|
+
* Detect image selection and help highlight the image
|
|
9991
|
+
*/
|
|
9992
|
+
export class ImageSelection implements EditorPlugin {
|
|
9993
|
+
private editor;
|
|
9994
|
+
private imageId;
|
|
9995
|
+
constructor();
|
|
9996
|
+
/**
|
|
9997
|
+
* Get a friendly name of this plugin
|
|
9998
|
+
*/
|
|
9999
|
+
getName(): string;
|
|
10000
|
+
/**
|
|
10001
|
+
* Initialize this plugin. This should only be called from Editor
|
|
10002
|
+
* @param editor Editor instance
|
|
10003
|
+
*/
|
|
10004
|
+
initialize(editor: IEditor): void;
|
|
10005
|
+
/**
|
|
10006
|
+
* Dispose this plugin
|
|
10007
|
+
*/
|
|
10008
|
+
dispose(): void;
|
|
10009
|
+
onPluginEvent(event: PluginEvent): void;
|
|
10010
|
+
}
|
|
10011
|
+
|