roosterjs 8.14.0 → 8.16.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 +124 -65
- package/dist/rooster-amd.js +1051 -902
- 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 +124 -65
- package/dist/rooster.js +1051 -902
- package/dist/rooster.js.map +1 -1
- package/lib/createEditor.js.map +1 -1
- package/lib/index.js.map +1 -1
- package/package.json +6 -6
- 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.16.0)
|
|
2
2
|
// Generated by dts tool from roosterjs
|
|
3
3
|
// Project: https://github.com/Microsoft/roosterjs
|
|
4
4
|
|
|
@@ -1131,20 +1131,20 @@ export const enum TableBorderFormat {
|
|
|
1131
1131
|
FIRST_COLUMN_HEADER_EXTERNAL = 4,
|
|
1132
1132
|
/**
|
|
1133
1133
|
* The header row has no vertical border, except for the first one
|
|
1134
|
-
* The
|
|
1134
|
+
* The first column has no horizontal border, except for the first one
|
|
1135
1135
|
* __ __ __
|
|
1136
1136
|
* |__ __ __
|
|
1137
|
-
* | |
|
|
1138
|
-
* | |
|
|
1137
|
+
* | |__|__|
|
|
1138
|
+
* | |__|__|
|
|
1139
1139
|
*/
|
|
1140
1140
|
ESPECIAL_TYPE_1 = 5,
|
|
1141
1141
|
/**
|
|
1142
1142
|
* The header row has no vertical border, except for the first one
|
|
1143
|
-
* The
|
|
1143
|
+
* The only horizontal border of the table is the top and bottom of header row
|
|
1144
1144
|
* __ __ __
|
|
1145
1145
|
* |__ __ __
|
|
1146
|
-
* | |
|
|
1147
|
-
* | |
|
|
1146
|
+
* | | |
|
|
1147
|
+
* | | |
|
|
1148
1148
|
*/
|
|
1149
1149
|
ESPECIAL_TYPE_2 = 6,
|
|
1150
1150
|
/**
|
|
@@ -1430,7 +1430,7 @@ export interface PluginScrollEvent extends PluginDomEventBase<PluginEventType.Sc
|
|
|
1430
1430
|
/**
|
|
1431
1431
|
* Editor plugin event interface
|
|
1432
1432
|
*/
|
|
1433
|
-
export type PluginEvent = BeforeCutCopyEvent | BeforePasteEvent | ContentChangedEvent | EntityOperationEvent | ExtractContentWithDomEvent | PluginDomEvent | EditorReadyEvent | BeforeDisposeEvent | PendingFormatStateChangedEvent | EnterShadowEditEvent | LeaveShadowEditEvent | EditImageEvent | BeforeSetContentEvent;
|
|
1433
|
+
export type PluginEvent = BeforeCutCopyEvent | BeforePasteEvent | ContentChangedEvent | EntityOperationEvent | ExtractContentWithDomEvent | PluginDomEvent | EditorReadyEvent | BeforeDisposeEvent | PendingFormatStateChangedEvent | EnterShadowEditEvent | LeaveShadowEditEvent | EditImageEvent | BeforeSetContentEvent | ZoomChangedEvent;
|
|
1434
1434
|
|
|
1435
1435
|
/**
|
|
1436
1436
|
* Editor plugin event type
|
|
@@ -1523,7 +1523,11 @@ export const enum PluginEventType {
|
|
|
1523
1523
|
* Content of editor is about to be cleared by SetContent API, handle this event to cache anything you need
|
|
1524
1524
|
* before it is gone
|
|
1525
1525
|
*/
|
|
1526
|
-
BeforeSetContent = 20
|
|
1526
|
+
BeforeSetContent = 20,
|
|
1527
|
+
/**
|
|
1528
|
+
* Zoom scale value is changed, triggered by Editor.setZoomScale() when set a different scale number
|
|
1529
|
+
*/
|
|
1530
|
+
ZoomChanged = 21
|
|
1527
1531
|
}
|
|
1528
1532
|
|
|
1529
1533
|
/**
|
|
@@ -1568,6 +1572,22 @@ export interface EnterShadowEditEvent extends BasePluginEvent<PluginEventType.En
|
|
|
1568
1572
|
export interface LeaveShadowEditEvent extends BasePluginEvent<PluginEventType.LeavingShadowEdit> {
|
|
1569
1573
|
}
|
|
1570
1574
|
|
|
1575
|
+
/**
|
|
1576
|
+
* Represents an event object triggered from Editor.setZoomScale() API.
|
|
1577
|
+
* Plugins can handle this event when they need to do something for zoom changing.
|
|
1578
|
+
*
|
|
1579
|
+
*/
|
|
1580
|
+
export interface ZoomChangedEvent extends BasePluginEvent<PluginEventType.ZoomChanged> {
|
|
1581
|
+
/**
|
|
1582
|
+
* Zoom scale value before this change
|
|
1583
|
+
*/
|
|
1584
|
+
oldZoomScale: number;
|
|
1585
|
+
/**
|
|
1586
|
+
* Zoom scale value after this change
|
|
1587
|
+
*/
|
|
1588
|
+
newZoomScale: number;
|
|
1589
|
+
}
|
|
1590
|
+
|
|
1571
1591
|
/**
|
|
1572
1592
|
* This refers to a "content block" in editor that serves as a content parsing boundary
|
|
1573
1593
|
* It is most those html block like tags, i.e. <p>, <div>, <li>, <td> etc.
|
|
@@ -1622,7 +1642,7 @@ export interface ClipboardData {
|
|
|
1622
1642
|
* When set to null, it means there's no HTML from clipboard event.
|
|
1623
1643
|
* When set to undefined, it means there may be HTML in clipboard event, but fail to retrieve
|
|
1624
1644
|
*/
|
|
1625
|
-
rawHtml: string;
|
|
1645
|
+
rawHtml: string | null | undefined;
|
|
1626
1646
|
/**
|
|
1627
1647
|
* Link Preview information provided by Edge
|
|
1628
1648
|
*/
|
|
@@ -1630,7 +1650,7 @@ export interface ClipboardData {
|
|
|
1630
1650
|
/**
|
|
1631
1651
|
* Image file from clipboard event
|
|
1632
1652
|
*/
|
|
1633
|
-
image: File;
|
|
1653
|
+
image: File | null;
|
|
1634
1654
|
/**
|
|
1635
1655
|
* Html extracted from raw html string and remove content before and after fragment tag
|
|
1636
1656
|
*/
|
|
@@ -1642,7 +1662,7 @@ export interface ClipboardData {
|
|
|
1642
1662
|
/**
|
|
1643
1663
|
* BASE64 encoded data uri of the image if any
|
|
1644
1664
|
*/
|
|
1645
|
-
imageDataUri?: string;
|
|
1665
|
+
imageDataUri?: string | null;
|
|
1646
1666
|
/**
|
|
1647
1667
|
* Array of tag names of the first level child nodes
|
|
1648
1668
|
*/
|
|
@@ -2386,10 +2406,10 @@ export interface HtmlSanitizerOptions {
|
|
|
2386
2406
|
* Define a replacement tag name of unknown tags.
|
|
2387
2407
|
* A star "*" means keep as it is, no replacement
|
|
2388
2408
|
* Other valid string means replace the tag name with this string.
|
|
2389
|
-
* Empty string, undefined
|
|
2409
|
+
* Empty string, undefined means drop such elements and all its children
|
|
2390
2410
|
* @default undefined
|
|
2391
2411
|
*/
|
|
2392
|
-
unknownTagReplacement?: string;
|
|
2412
|
+
unknownTagReplacement?: string | null;
|
|
2393
2413
|
}
|
|
2394
2414
|
|
|
2395
2415
|
/**
|
|
@@ -2736,6 +2756,12 @@ export interface IEditor {
|
|
|
2736
2756
|
* @returns True if content is selected, otherwise false
|
|
2737
2757
|
*/
|
|
2738
2758
|
select(path: SelectionPath): boolean;
|
|
2759
|
+
/**
|
|
2760
|
+
* Select content using the Table Selection
|
|
2761
|
+
* @param table to select
|
|
2762
|
+
* @param coordinates first and last cell of the range
|
|
2763
|
+
*/
|
|
2764
|
+
select(table: HTMLTableElement, coordinates: TableSelection): boolean;
|
|
2739
2765
|
/**
|
|
2740
2766
|
* Get current focused position. Return null if editor doesn't have focus at this time.
|
|
2741
2767
|
*/
|
|
@@ -2952,7 +2978,20 @@ export interface IEditor {
|
|
|
2952
2978
|
*/
|
|
2953
2979
|
getTrustedHTMLHandler(): TrustedHTMLHandler;
|
|
2954
2980
|
/**
|
|
2955
|
-
* Get
|
|
2981
|
+
* Get current zoom scale, default value is 1
|
|
2982
|
+
* When editor is put under a zoomed container, need to pass the zoom scale number using EditorOptions.zoomScale
|
|
2983
|
+
* to let editor behave correctly especially for those mouse drag/drop behaviors
|
|
2984
|
+
* @returns current zoom scale number
|
|
2985
|
+
*/
|
|
2986
|
+
getZoomScale(): number;
|
|
2987
|
+
/**
|
|
2988
|
+
* Set current zoom scale, default value is 1
|
|
2989
|
+
* When editor is put under a zoomed container, need to pass the zoom scale number using EditorOptions.zoomScale
|
|
2990
|
+
* to let editor behave correctly especially for those mouse drag/drop behaviors
|
|
2991
|
+
*/
|
|
2992
|
+
setZoomScale(scale: number): void;
|
|
2993
|
+
/**
|
|
2994
|
+
* @deprecated Use getZoomScale() instead
|
|
2956
2995
|
*/
|
|
2957
2996
|
getSizeTransformer(): SizeTransformer;
|
|
2958
2997
|
}
|
|
@@ -3155,10 +3194,9 @@ export interface EditorCore extends PluginState {
|
|
|
3155
3194
|
* To override, pass your own trusted HTML handler to EditorOptions.trustedHTMLHandler
|
|
3156
3195
|
*/
|
|
3157
3196
|
readonly trustedHTMLHandler: TrustedHTMLHandler;
|
|
3197
|
+
zoomScale: number;
|
|
3158
3198
|
/**
|
|
3159
|
-
*
|
|
3160
|
-
* A typical scenario to use this function is when editor is located under a scaled container, so we need to
|
|
3161
|
-
* calculate the scaled size change according to current zoom rate.
|
|
3199
|
+
* @deprecated Use zoomScale instead
|
|
3162
3200
|
*/
|
|
3163
3201
|
sizeTransformer: SizeTransformer;
|
|
3164
3202
|
}
|
|
@@ -3315,6 +3353,16 @@ export interface CoreApiMap {
|
|
|
3315
3353
|
* @param broadcast Set to true to skip the shouldHandleEventExclusively check
|
|
3316
3354
|
*/
|
|
3317
3355
|
triggerEvent: TriggerEvent;
|
|
3356
|
+
/**
|
|
3357
|
+
* Select a table and save data of the selected range
|
|
3358
|
+
* @param core The EditorCore object
|
|
3359
|
+
* @param table table to select
|
|
3360
|
+
* @param coordinates first and last cell of the selection, if this parameter is null, instead of
|
|
3361
|
+
* selecting, will unselect the table.
|
|
3362
|
+
* @param shouldAddStyles Whether need to update the style elements
|
|
3363
|
+
* @returns true if successful
|
|
3364
|
+
*/
|
|
3365
|
+
selectTable: SelectTable;
|
|
3318
3366
|
}
|
|
3319
3367
|
|
|
3320
3368
|
/**
|
|
@@ -3445,6 +3493,16 @@ export type TransformColor = (core: EditorCore, rootNode: Node, includeSelf: boo
|
|
|
3445
3493
|
*/
|
|
3446
3494
|
export type TriggerEvent = (core: EditorCore, pluginEvent: PluginEvent, broadcast: boolean) => void;
|
|
3447
3495
|
|
|
3496
|
+
/**
|
|
3497
|
+
* Select a table and save data of the selected range
|
|
3498
|
+
* @param core The EditorCore object
|
|
3499
|
+
* @param table table to select
|
|
3500
|
+
* @param coordinates first and last cell of the selection, if this parameter is null, instead of
|
|
3501
|
+
* selecting, will unselect the table.
|
|
3502
|
+
* @returns true if successful
|
|
3503
|
+
*/
|
|
3504
|
+
export type SelectTable = (core: EditorCore, table: HTMLTableElement, coordinates?: TableSelection) => TableSelectionRange;
|
|
3505
|
+
|
|
3448
3506
|
/**
|
|
3449
3507
|
* The options to specify parameters customizing an editor, used by ctor of Editor class
|
|
3450
3508
|
*/
|
|
@@ -3531,9 +3589,13 @@ export interface EditorOptions {
|
|
|
3531
3589
|
*/
|
|
3532
3590
|
trustedHTMLHandler?: TrustedHTMLHandler;
|
|
3533
3591
|
/**
|
|
3534
|
-
*
|
|
3535
|
-
*
|
|
3536
|
-
*
|
|
3592
|
+
* Current zoom scale, @default value is 1
|
|
3593
|
+
* When editor is put under a zoomed container, need to pass the zoom scale number using this property
|
|
3594
|
+
* to let editor behave correctly especially for those mouse drag/drop behaviors
|
|
3595
|
+
*/
|
|
3596
|
+
zoomScale?: number;
|
|
3597
|
+
/**
|
|
3598
|
+
* @deprecated Use zoomScale instead
|
|
3537
3599
|
*/
|
|
3538
3600
|
sizeTransformer?: SizeTransformer;
|
|
3539
3601
|
}
|
|
@@ -4030,6 +4092,10 @@ export interface TableSelectionRange extends SelectionRangeExBase<SelectionRange
|
|
|
4030
4092
|
* Table that has cells selected
|
|
4031
4093
|
*/
|
|
4032
4094
|
table: HTMLTableElement;
|
|
4095
|
+
/**
|
|
4096
|
+
* Coordinates of first and last Cell
|
|
4097
|
+
*/
|
|
4098
|
+
coordinates: TableSelection;
|
|
4033
4099
|
}
|
|
4034
4100
|
|
|
4035
4101
|
/**
|
|
@@ -4067,6 +4133,10 @@ export interface DOMEventPluginState {
|
|
|
4067
4133
|
* Cached selection range
|
|
4068
4134
|
*/
|
|
4069
4135
|
selectionRange: Range;
|
|
4136
|
+
/**
|
|
4137
|
+
* Table selection range
|
|
4138
|
+
*/
|
|
4139
|
+
tableSelectionRange: TableSelectionRange;
|
|
4070
4140
|
/**
|
|
4071
4141
|
* stop propagation of a printable keyboard event
|
|
4072
4142
|
*/
|
|
@@ -4147,6 +4217,10 @@ export interface LifecyclePluginState {
|
|
|
4147
4217
|
* Cached selection path for original content
|
|
4148
4218
|
*/
|
|
4149
4219
|
shadowEditSelectionPath: SelectionPath;
|
|
4220
|
+
/**
|
|
4221
|
+
* Cached table selection path for original content
|
|
4222
|
+
*/
|
|
4223
|
+
shadowEditTableSelectionPath: SelectionPath[];
|
|
4150
4224
|
}
|
|
4151
4225
|
|
|
4152
4226
|
/**
|
|
@@ -4652,7 +4726,7 @@ export function extractClipboardItems(items: DataTransferItem[], options?: Extra
|
|
|
4652
4726
|
* When set to undefined, it means can't retrieve HTML string, there may be HTML string but direct retrieving is
|
|
4653
4727
|
* not supported by browser.
|
|
4654
4728
|
*/
|
|
4655
|
-
export function extractClipboardItemsForIE(dataTransfer: DataTransfer, callback: (data: ClipboardData) => void, options
|
|
4729
|
+
export function extractClipboardItemsForIE(dataTransfer: DataTransfer, callback: (data: ClipboardData) => void, options?: ExtractClipboardItemsForIEOptions): void;
|
|
4656
4730
|
|
|
4657
4731
|
/**
|
|
4658
4732
|
* A type-safe wrapper for Array.prototype.push.apply()
|
|
@@ -5049,22 +5123,22 @@ export class VTable {
|
|
|
5049
5123
|
* Current column index
|
|
5050
5124
|
*/
|
|
5051
5125
|
col: number;
|
|
5052
|
-
/**
|
|
5053
|
-
* Current format of the table
|
|
5054
|
-
*/
|
|
5055
|
-
formatInfo: TableFormat;
|
|
5056
5126
|
/**
|
|
5057
5127
|
* Selected range of cells with the coordinates of the first and last cell selected.
|
|
5058
5128
|
*/
|
|
5059
5129
|
selection: TableSelection;
|
|
5130
|
+
/**
|
|
5131
|
+
* Current format of the table
|
|
5132
|
+
*/
|
|
5133
|
+
formatInfo: TableFormat;
|
|
5060
5134
|
private trs;
|
|
5061
5135
|
/**
|
|
5062
5136
|
* Create a new instance of VTable object using HTML TABLE or TD node
|
|
5063
5137
|
* @param node The HTML Table or TD node
|
|
5064
5138
|
* @param normalizeSize Whether table size needs to be normalized
|
|
5065
|
-
* @param
|
|
5139
|
+
* @param zoomScale When the table is under a zoomed container, pass in the zoom scale here
|
|
5066
5140
|
*/
|
|
5067
|
-
constructor(node: HTMLTableElement | HTMLTableCellElement, normalizeSize?: boolean,
|
|
5141
|
+
constructor(node: HTMLTableElement | HTMLTableCellElement, normalizeSize?: boolean, zoomScale?: number | SizeTransformer);
|
|
5068
5142
|
/**
|
|
5069
5143
|
* Write the virtual table back to DOM tree to represent the change of VTable
|
|
5070
5144
|
*/
|
|
@@ -5075,39 +5149,10 @@ export class VTable {
|
|
|
5075
5149
|
*/
|
|
5076
5150
|
applyFormat(format: Partial<TableFormat>): void;
|
|
5077
5151
|
/**
|
|
5078
|
-
*
|
|
5079
|
-
* @param
|
|
5080
|
-
*/
|
|
5081
|
-
private setColor;
|
|
5082
|
-
/**
|
|
5083
|
-
* Set color to borders of an table
|
|
5084
|
-
* @param format
|
|
5085
|
-
* @returns
|
|
5086
|
-
*/
|
|
5087
|
-
private setBorderColors;
|
|
5088
|
-
/**
|
|
5089
|
-
* Format the border type
|
|
5090
|
-
* @returns
|
|
5091
|
-
*/
|
|
5092
|
-
private formatBorders;
|
|
5093
|
-
/**
|
|
5094
|
-
* Organize the borders of table according to a border type
|
|
5095
|
-
* @param format
|
|
5096
|
-
* @returns
|
|
5152
|
+
* Remove the cellshade dataset to apply a new style format at the cell.
|
|
5153
|
+
* @param cells
|
|
5097
5154
|
*/
|
|
5098
|
-
private
|
|
5099
|
-
/**
|
|
5100
|
-
* Apply custom design to the first table column
|
|
5101
|
-
* @param format
|
|
5102
|
-
* @returns
|
|
5103
|
-
*/
|
|
5104
|
-
private setFirstColumnFormat;
|
|
5105
|
-
/**
|
|
5106
|
-
* Apply custom design to the Header Row
|
|
5107
|
-
* @param format
|
|
5108
|
-
* @returns
|
|
5109
|
-
*/
|
|
5110
|
-
private setHeaderRowFormat;
|
|
5155
|
+
private deleteCellShadeDataset;
|
|
5111
5156
|
/**
|
|
5112
5157
|
* Edit table with given operation.
|
|
5113
5158
|
* @param operation Table operation
|
|
@@ -5171,7 +5216,7 @@ export class VTable {
|
|
|
5171
5216
|
private countSpanLeft;
|
|
5172
5217
|
private countSpanAbove;
|
|
5173
5218
|
private normalizeEmptyTableCells;
|
|
5174
|
-
normalizeTableCellSize(
|
|
5219
|
+
normalizeTableCellSize(zoomScale?: number | SizeTransformer): void;
|
|
5175
5220
|
private normalizeSize;
|
|
5176
5221
|
}
|
|
5177
5222
|
|
|
@@ -5757,7 +5802,7 @@ export class HtmlSanitizer {
|
|
|
5757
5802
|
* @param currentStyles Current CSS styles. Inheritable styles in the given node which has
|
|
5758
5803
|
* the same value with current styles will be ignored.
|
|
5759
5804
|
*/
|
|
5760
|
-
sanitize(rootNode: Node, currentStyles?: StringMap):
|
|
5805
|
+
sanitize(rootNode: Node, currentStyles?: StringMap): "" | undefined;
|
|
5761
5806
|
/**
|
|
5762
5807
|
* Convert global CSS into inline CSS
|
|
5763
5808
|
* @param rootNode The HTML Document
|
|
@@ -5774,7 +5819,7 @@ export class HtmlSanitizer {
|
|
|
5774
5819
|
* Get inheritable CSS style values from the given element
|
|
5775
5820
|
* @param element The element to get style from
|
|
5776
5821
|
*/
|
|
5777
|
-
export function getInheritableStyles(element: HTMLElement): StringMap;
|
|
5822
|
+
export function getInheritableStyles(element: HTMLElement | null): StringMap;
|
|
5778
5823
|
|
|
5779
5824
|
/**
|
|
5780
5825
|
* Create default value of HtmlSanitizerOptions with every property set
|
|
@@ -6228,9 +6273,23 @@ export class Editor implements IEditor {
|
|
|
6228
6273
|
*/
|
|
6229
6274
|
getTrustedHTMLHandler(): TrustedHTMLHandler;
|
|
6230
6275
|
/**
|
|
6231
|
-
*
|
|
6276
|
+
* @deprecated Use getZoomScale() instead
|
|
6232
6277
|
*/
|
|
6233
6278
|
getSizeTransformer(): SizeTransformer;
|
|
6279
|
+
/**
|
|
6280
|
+
* Get current zoom scale, default value is 1
|
|
6281
|
+
* When editor is put under a zoomed container, need to pass the zoom scale number using EditorOptions.zoomScale
|
|
6282
|
+
* to let editor behave correctly especially for those mouse drag/drop behaviors
|
|
6283
|
+
* @returns current zoom scale number
|
|
6284
|
+
*/
|
|
6285
|
+
getZoomScale(): number;
|
|
6286
|
+
/**
|
|
6287
|
+
* Set current zoom scale, default value is 1
|
|
6288
|
+
* When editor is put under a zoomed container, need to pass the zoom scale number using EditorOptions.zoomScale
|
|
6289
|
+
* to let editor behave correctly especially for those mouse drag/drop behaviors
|
|
6290
|
+
* @param scale The new scale number to set. It should be positive number and no greater than 10, otherwise it will be ignored.
|
|
6291
|
+
*/
|
|
6292
|
+
setZoomScale(scale: number): void;
|
|
6234
6293
|
}
|
|
6235
6294
|
|
|
6236
6295
|
/**
|
|
@@ -7259,12 +7318,12 @@ export class TableCellSelection implements EditorPlugin {
|
|
|
7259
7318
|
* When press Backspace, delete the contents inside of the selection, if it is Table Selection
|
|
7260
7319
|
*/
|
|
7261
7320
|
DeleteTableContents: BuildInEditFeature<PluginKeyboardEvent>;
|
|
7262
|
-
private clearTableCellSelection;
|
|
7263
7321
|
private clearState;
|
|
7264
7322
|
private getNextTD;
|
|
7265
7323
|
private prepareSelection;
|
|
7266
7324
|
private setData;
|
|
7267
7325
|
private isAfter;
|
|
7268
7326
|
private shouldConvertToTableSelection;
|
|
7327
|
+
selectTable(): void;
|
|
7269
7328
|
}
|
|
7270
7329
|
|