roosterjs 8.47.0 → 8.49.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 +158 -53
- package/dist/rooster-amd.js +2462 -2296
- 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 +158 -53
- package/dist/rooster.js +2462 -2297
- package/dist/rooster.js.map +1 -1
- package/package.json +7 -7
- 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.49.0)
|
|
2
2
|
// Generated by dts tool from roosterjs
|
|
3
3
|
// Project: https://github.com/Microsoft/roosterjs
|
|
4
4
|
|
|
@@ -415,6 +415,45 @@ function extractClipboardItemsForIE(dataTransfer: DataTransfer, callback: (data:
|
|
|
415
415
|
*/
|
|
416
416
|
function createFragmentFromClipboardData(core: EditorCore, clipboardData: ClipboardData, position: NodePosition | null, pasteAsText: boolean, applyCurrentStyle: boolean, pasteAsImage: boolean, event: BeforePasteEvent): DocumentFragment;
|
|
417
417
|
|
|
418
|
+
/**
|
|
419
|
+
* Handles the content when using the Image Paste Option
|
|
420
|
+
* @param imageDataUri the image uri to use for the image
|
|
421
|
+
* @param fragment fragment that will contain the content to paste.
|
|
422
|
+
*/
|
|
423
|
+
function handleImagePaste(imageDataUri: string, fragment: DocumentFragment): void;
|
|
424
|
+
|
|
425
|
+
/**
|
|
426
|
+
* handle the content when using the text only option
|
|
427
|
+
* @param text Text from clipboard
|
|
428
|
+
* @param position current position of the clipboard
|
|
429
|
+
* @param fragment fragment that contains the paste content.
|
|
430
|
+
*/
|
|
431
|
+
function handleTextPaste(text: string, position: NodePosition | null, fragment: DocumentFragment): void;
|
|
432
|
+
|
|
433
|
+
/**
|
|
434
|
+
* Retrieves the metadata from the content inside of the clipboard
|
|
435
|
+
* @param doc Document parsed from the clipboard
|
|
436
|
+
* @param event Before Paste event
|
|
437
|
+
* @param trustedHTMLHandler the trusted html handler to sanitize the content.
|
|
438
|
+
*/
|
|
439
|
+
function retrieveMetadataFromClipboard(doc: Document | undefined, event: BeforePasteEvent, trustedHTMLHandler: TrustedHTMLHandler): void;
|
|
440
|
+
|
|
441
|
+
/**
|
|
442
|
+
* Sanitize the content from the pasted content
|
|
443
|
+
* @param event The before paste event
|
|
444
|
+
* @param position the position of the cursor
|
|
445
|
+
*/
|
|
446
|
+
function sanitizePasteContent(event: BeforePasteEvent, position: NodePosition | null): void;
|
|
447
|
+
|
|
448
|
+
/**
|
|
449
|
+
* Get the paste type that will be used corresponding to the configuration
|
|
450
|
+
* @param pasteAsText Whether to paste as Text
|
|
451
|
+
* @param applyCurrentStyle Whether to apply the current format to the content
|
|
452
|
+
* @param pasteAsImage Whether to only paste the image
|
|
453
|
+
* @returns
|
|
454
|
+
*/
|
|
455
|
+
function getPasteType(pasteAsText: boolean, applyCurrentStyle: boolean, pasteAsImage: boolean): PasteType;
|
|
456
|
+
|
|
418
457
|
/**
|
|
419
458
|
* Browser object contains browser and operating system information of current environment
|
|
420
459
|
*/
|
|
@@ -1316,8 +1355,9 @@ function getRegionsFromRange(root: HTMLElement, range: Range, type: RegionType |
|
|
|
1316
1355
|
* @param regionBase The region to get block elements from
|
|
1317
1356
|
* @param createBlockIfEmpty When set to true, a new empty block element will be created if there is not
|
|
1318
1357
|
* any blocks in the region. Default value is false
|
|
1358
|
+
* @param deprecated Deprecated parameter, not used
|
|
1319
1359
|
*/
|
|
1320
|
-
function getSelectedBlockElementsInRegion(regionBase: RegionBase, createBlockIfEmpty?: boolean,
|
|
1360
|
+
function getSelectedBlockElementsInRegion(regionBase: RegionBase, createBlockIfEmpty?: boolean, deprecated?: boolean): BlockElement[];
|
|
1321
1361
|
|
|
1322
1362
|
/**
|
|
1323
1363
|
* Collapse nodes within this region to their common ancestor node under this region
|
|
@@ -1508,6 +1548,13 @@ function setHtmlWithSelectionPath(rootNode: HTMLElement, html: string, trustedHT
|
|
|
1508
1548
|
*/
|
|
1509
1549
|
function setHtmlWithMetadata(rootNode: HTMLElement, html: string, trustedHTMLHandler?: TrustedHTMLHandler): ContentMetadata | undefined;
|
|
1510
1550
|
|
|
1551
|
+
/**
|
|
1552
|
+
* Extract content metadata from DOM tree
|
|
1553
|
+
* @param rootNode Root of the DOM tree
|
|
1554
|
+
* @returns If there is a valid content metadata node in the give DOM tree, return this metadata object, otherwise undefined
|
|
1555
|
+
*/
|
|
1556
|
+
function extractContentMetadata(rootNode: HTMLElement): ContentMetadata | undefined;
|
|
1557
|
+
|
|
1511
1558
|
/**
|
|
1512
1559
|
* Add the given range into selection of the given document
|
|
1513
1560
|
* @param range The range to select
|
|
@@ -1706,6 +1753,7 @@ function getEntityFromElement(element: HTMLElement): Entity | null;
|
|
|
1706
1753
|
function getEntitySelector(type?: string, id?: string): string;
|
|
1707
1754
|
|
|
1708
1755
|
/**
|
|
1756
|
+
* @deprecated
|
|
1709
1757
|
* Create a placeholder comment node for entity
|
|
1710
1758
|
* @param entity The entity to create placeholder from
|
|
1711
1759
|
* @returns A placeholder comment node as
|
|
@@ -1732,7 +1780,7 @@ function moveContentWithEntityPlaceholders(root: HTMLDivElement, entities: Recor
|
|
|
1732
1780
|
* @param entities A map from entity id to entity wrapper, used for reusing existing DOM structure for entity
|
|
1733
1781
|
* @param insertClonedNode When pass true, merge with a cloned copy of the nodes from source fragment rather than the nodes themselves @default false
|
|
1734
1782
|
*/
|
|
1735
|
-
function restoreContentWithEntityPlaceholder(source:
|
|
1783
|
+
function restoreContentWithEntityPlaceholder(source: ParentNode, target: HTMLElement, entities: Record<string, HTMLElement | KnownEntityItem> | null, insertClonedNode?: boolean): void;
|
|
1736
1784
|
|
|
1737
1785
|
/**
|
|
1738
1786
|
* Gets the cached event data by cache key from event object if there is already one.
|
|
@@ -2935,15 +2983,18 @@ interface EntityPluginState {
|
|
|
2935
2983
|
pageY: number;
|
|
2936
2984
|
};
|
|
2937
2985
|
/**
|
|
2986
|
+
* @deprecated
|
|
2938
2987
|
* All known entity elements
|
|
2939
2988
|
*/
|
|
2940
|
-
knownEntityElements
|
|
2989
|
+
knownEntityElements?: HTMLElement[];
|
|
2990
|
+
/**
|
|
2991
|
+
* @deprecated
|
|
2992
|
+
*/
|
|
2993
|
+
shadowEntityCache?: Record<string, HTMLElement>;
|
|
2941
2994
|
/**
|
|
2942
|
-
*
|
|
2943
|
-
* When set content to replace the whole editor, we will cache the hydrated content
|
|
2944
|
-
* before it is gone, then after that we can use the cached content to rehydrate entity
|
|
2995
|
+
* Entities cached for undo snapshot
|
|
2945
2996
|
*/
|
|
2946
|
-
|
|
2997
|
+
entityMap: Record<string, KnownEntityItem>;
|
|
2947
2998
|
}
|
|
2948
2999
|
|
|
2949
3000
|
/**
|
|
@@ -3668,15 +3719,18 @@ const enum EntityOperation {
|
|
|
3668
3719
|
*/
|
|
3669
3720
|
ReplaceTemporaryContent = 8,
|
|
3670
3721
|
/**
|
|
3671
|
-
*
|
|
3672
|
-
* Plugins can handle this event to do extra operations to the shadow root
|
|
3722
|
+
* @deprecated
|
|
3673
3723
|
*/
|
|
3674
3724
|
AddShadowRoot = 9,
|
|
3675
3725
|
/**
|
|
3676
|
-
*
|
|
3677
|
-
|
|
3726
|
+
* @deprecated
|
|
3727
|
+
*/
|
|
3728
|
+
RemoveShadowRoot = 10,
|
|
3729
|
+
/**
|
|
3730
|
+
* Notify plugins that a new entity state need to be updated to an entity.
|
|
3731
|
+
* This is normally happened when user undo/redo the content with an entity snapshot added by a plugin that handles entity
|
|
3678
3732
|
*/
|
|
3679
|
-
|
|
3733
|
+
UpdateEntityState = 11
|
|
3680
3734
|
}
|
|
3681
3735
|
|
|
3682
3736
|
/**
|
|
@@ -3774,6 +3828,14 @@ const enum ExperimentalFeatures {
|
|
|
3774
3828
|
* Align list elements elements to left, center and right using setAlignment API
|
|
3775
3829
|
*/
|
|
3776
3830
|
ListItemAlignment = "ListItemAlignment",
|
|
3831
|
+
/**
|
|
3832
|
+
* @deprecated
|
|
3833
|
+
*/
|
|
3834
|
+
DefaultFormatInSpan = "DefaultFormatInSpan",
|
|
3835
|
+
/**
|
|
3836
|
+
* @deprecated
|
|
3837
|
+
*/
|
|
3838
|
+
DefaultFormatOnContainer = "DefaultFormatOnContainer",
|
|
3777
3839
|
/**
|
|
3778
3840
|
* Provide additional Tab Key Features. Requires Text Features Content Editable Features
|
|
3779
3841
|
*/
|
|
@@ -3789,11 +3851,6 @@ const enum ExperimentalFeatures {
|
|
|
3789
3851
|
* is the one closest to the item.
|
|
3790
3852
|
*/
|
|
3791
3853
|
ReuseAllAncestorListElements = "ReuseAllAncestorListElements",
|
|
3792
|
-
/**
|
|
3793
|
-
* When apply default format when initialize or user type, apply the format on a SPAN element rather than
|
|
3794
|
-
* the block element (In most case, the DIV element) so keep the block element clean.
|
|
3795
|
-
*/
|
|
3796
|
-
DefaultFormatInSpan = "DefaultFormatInSpan",
|
|
3797
3854
|
/**
|
|
3798
3855
|
* Reuse existing DOM structure if possible when convert Content Model back to DOM tree
|
|
3799
3856
|
*/
|
|
@@ -3802,10 +3859,6 @@ const enum ExperimentalFeatures {
|
|
|
3802
3859
|
* Handle keyboard editing event with Content Model
|
|
3803
3860
|
*/
|
|
3804
3861
|
EditWithContentModel = "EditWithContentModel",
|
|
3805
|
-
/**
|
|
3806
|
-
* Apply default format on editor container
|
|
3807
|
-
*/
|
|
3808
|
-
DefaultFormatOnContainer = "DefaultFormatOnContainer",
|
|
3809
3862
|
/**
|
|
3810
3863
|
* Delete table with Backspace key with the whole was selected with table selector
|
|
3811
3864
|
*/
|
|
@@ -4186,7 +4239,7 @@ const enum KnownCreateElementDataIndex {
|
|
|
4186
4239
|
*/
|
|
4187
4240
|
TableSelector = 11,
|
|
4188
4241
|
/**
|
|
4189
|
-
*
|
|
4242
|
+
* @deprecated
|
|
4190
4243
|
*/
|
|
4191
4244
|
EmptyLineFormatInSpan = 12
|
|
4192
4245
|
}
|
|
@@ -4837,15 +4890,18 @@ interface EntityOperationEventData {
|
|
|
4837
4890
|
*/
|
|
4838
4891
|
rawEvent?: Event;
|
|
4839
4892
|
/**
|
|
4840
|
-
*
|
|
4841
|
-
*
|
|
4842
|
-
|
|
4843
|
-
|
|
4844
|
-
|
|
4845
|
-
*
|
|
4846
|
-
*
|
|
4847
|
-
*
|
|
4848
|
-
|
|
4893
|
+
* For EntityOperation.UpdateEntityState, we use this object to pass the new entity state to plugin.
|
|
4894
|
+
* For other operation types, it is not used.
|
|
4895
|
+
*/
|
|
4896
|
+
state?: string;
|
|
4897
|
+
/**
|
|
4898
|
+
* For EntityOperation.NewEntity, plugin can set this property to true then the entity will be persisted.
|
|
4899
|
+
* A persisted entity won't be touched during undo/redo, unless it does not exist after undo/redo.
|
|
4900
|
+
* For other operation types, this value will be ignored.
|
|
4901
|
+
*/
|
|
4902
|
+
shouldPersist?: boolean;
|
|
4903
|
+
/**
|
|
4904
|
+
* @deprecated
|
|
4849
4905
|
*/
|
|
4850
4906
|
contentForShadowEntity?: DocumentFragment;
|
|
4851
4907
|
}
|
|
@@ -5350,6 +5406,12 @@ interface ContentChangedData {
|
|
|
5350
5406
|
* Optional property to store the format api name when using ChangeSource.Format
|
|
5351
5407
|
*/
|
|
5352
5408
|
formatApiName?: string;
|
|
5409
|
+
/**
|
|
5410
|
+
* @optional Get entity states related to the snapshot. If it returns entity states, each state will cause
|
|
5411
|
+
* an EntityOperation event with operation = EntityOperation.UpdateEntityState when undo/redo to this snapshot
|
|
5412
|
+
* @returns Related entity state array
|
|
5413
|
+
*/
|
|
5414
|
+
getEntityState?: () => EntityState[];
|
|
5353
5415
|
}
|
|
5354
5416
|
|
|
5355
5417
|
/**
|
|
@@ -6059,6 +6121,31 @@ interface Snapshot {
|
|
|
6059
6121
|
* Known colors for dark mode
|
|
6060
6122
|
*/
|
|
6061
6123
|
knownColors: Readonly<ModeIndependentColor>[];
|
|
6124
|
+
/**
|
|
6125
|
+
* Entity states related to this undo snapshots. When undo/redo to this snapshot, each entity state will trigger
|
|
6126
|
+
* an EntityOperation event with operation = EntityOperation.UpdateEntityState
|
|
6127
|
+
*/
|
|
6128
|
+
entityStates?: EntityState[];
|
|
6129
|
+
}
|
|
6130
|
+
|
|
6131
|
+
/**
|
|
6132
|
+
* State for an entity. This is used for storing entity undo snapshot
|
|
6133
|
+
*/
|
|
6134
|
+
interface EntityState {
|
|
6135
|
+
/**
|
|
6136
|
+
* Type of the entity
|
|
6137
|
+
*/
|
|
6138
|
+
type: string;
|
|
6139
|
+
/**
|
|
6140
|
+
* Id of the entity
|
|
6141
|
+
*/
|
|
6142
|
+
id: string;
|
|
6143
|
+
/**
|
|
6144
|
+
* The state of this entity to store into undo snapshot.
|
|
6145
|
+
* The state can be any string, or a serialized JSON object.
|
|
6146
|
+
* We are using string here instead of a JSON object to make sure the whole state is serializable.
|
|
6147
|
+
*/
|
|
6148
|
+
state: string;
|
|
6062
6149
|
}
|
|
6063
6150
|
|
|
6064
6151
|
/**
|
|
@@ -6702,7 +6789,7 @@ interface IEditor {
|
|
|
6702
6789
|
* If it is not cached before, query from DOM and cache the result into the event object
|
|
6703
6790
|
* @returns A content traverser, or null if editor never got focus before
|
|
6704
6791
|
*/
|
|
6705
|
-
getContentSearcherOfCursor(event?: PluginEvent): IPositionContentSearcher | null;
|
|
6792
|
+
getContentSearcherOfCursor(event?: PluginEvent | null): IPositionContentSearcher | null;
|
|
6706
6793
|
/**
|
|
6707
6794
|
* Run a callback function asynchronously
|
|
6708
6795
|
* @param callback The callback function to run
|
|
@@ -7165,8 +7252,7 @@ interface CoreApiMap {
|
|
|
7165
7252
|
* @param core The EditorCore object.
|
|
7166
7253
|
* @param position The position that user is about to type to
|
|
7167
7254
|
* @param keyboardEvent Optional keyboard event object
|
|
7168
|
-
* @param
|
|
7169
|
-
* a SPAN element inside the block element instead of the block element itself.
|
|
7255
|
+
* @param deprecated Deprecated parameter, not used
|
|
7170
7256
|
*/
|
|
7171
7257
|
ensureTypeInContainer: EnsureTypeInContainer;
|
|
7172
7258
|
/**
|
|
@@ -7314,10 +7400,9 @@ type CreatePasteFragment = (core: EditorCore, clipboardData: ClipboardData, posi
|
|
|
7314
7400
|
* @param core The EditorCore object.
|
|
7315
7401
|
* @param position The position that user is about to type to
|
|
7316
7402
|
* @param keyboardEvent Optional keyboard event object
|
|
7317
|
-
* @param
|
|
7318
|
-
* a SPAN element inside the block element instead of the block element itself.
|
|
7403
|
+
* @param deprecated Deprecated parameter, not used
|
|
7319
7404
|
*/
|
|
7320
|
-
type EnsureTypeInContainer = (core: EditorCore, position: NodePosition, keyboardEvent?: KeyboardEvent,
|
|
7405
|
+
type EnsureTypeInContainer = (core: EditorCore, position: NodePosition, keyboardEvent?: KeyboardEvent, deprecated?: boolean) => void;
|
|
7321
7406
|
|
|
7322
7407
|
/**
|
|
7323
7408
|
* Focus to editor. If there is a cached selection range, use it as current selection
|
|
@@ -8187,6 +8272,24 @@ interface ImageSelectionRange extends SelectionRangeExBase<SelectionRangeTypes.I
|
|
|
8187
8272
|
*/
|
|
8188
8273
|
type SelectionRangeEx = NormalSelectionRange | TableSelectionRange | ImageSelectionRange;
|
|
8189
8274
|
|
|
8275
|
+
/**
|
|
8276
|
+
* Represents all info of a known entity, including its DOM element, whether it is deleted and if it can be persisted
|
|
8277
|
+
*/
|
|
8278
|
+
interface KnownEntityItem {
|
|
8279
|
+
/**
|
|
8280
|
+
* The HTML element of entity wrapper
|
|
8281
|
+
*/
|
|
8282
|
+
element: HTMLElement;
|
|
8283
|
+
/**
|
|
8284
|
+
* Whether this entity is deleted.
|
|
8285
|
+
*/
|
|
8286
|
+
isDeleted?: boolean;
|
|
8287
|
+
/**
|
|
8288
|
+
* Whether we want to persist this entity element during undo/redo
|
|
8289
|
+
*/
|
|
8290
|
+
canPersist?: boolean;
|
|
8291
|
+
}
|
|
8292
|
+
|
|
8190
8293
|
/**
|
|
8191
8294
|
* Attribute callback, will be called when HtmlSanitizer process an attribute with given name
|
|
8192
8295
|
* @param value Value of the attribute
|
|
@@ -8494,6 +8597,14 @@ enum CompatibleExperimentalFeatures {
|
|
|
8494
8597
|
* Align list elements elements to left, center and right using setAlignment API
|
|
8495
8598
|
*/
|
|
8496
8599
|
ListItemAlignment = "ListItemAlignment",
|
|
8600
|
+
/**
|
|
8601
|
+
* @deprecated
|
|
8602
|
+
*/
|
|
8603
|
+
DefaultFormatInSpan = "DefaultFormatInSpan",
|
|
8604
|
+
/**
|
|
8605
|
+
* @deprecated
|
|
8606
|
+
*/
|
|
8607
|
+
DefaultFormatOnContainer = "DefaultFormatOnContainer",
|
|
8497
8608
|
/**
|
|
8498
8609
|
* Provide additional Tab Key Features. Requires Text Features Content Editable Features
|
|
8499
8610
|
*/
|
|
@@ -8509,11 +8620,6 @@ enum CompatibleExperimentalFeatures {
|
|
|
8509
8620
|
* is the one closest to the item.
|
|
8510
8621
|
*/
|
|
8511
8622
|
ReuseAllAncestorListElements = "ReuseAllAncestorListElements",
|
|
8512
|
-
/**
|
|
8513
|
-
* When apply default format when initialize or user type, apply the format on a SPAN element rather than
|
|
8514
|
-
* the block element (In most case, the DIV element) so keep the block element clean.
|
|
8515
|
-
*/
|
|
8516
|
-
DefaultFormatInSpan = "DefaultFormatInSpan",
|
|
8517
8623
|
/**
|
|
8518
8624
|
* Reuse existing DOM structure if possible when convert Content Model back to DOM tree
|
|
8519
8625
|
*/
|
|
@@ -8522,10 +8628,6 @@ enum CompatibleExperimentalFeatures {
|
|
|
8522
8628
|
* Handle keyboard editing event with Content Model
|
|
8523
8629
|
*/
|
|
8524
8630
|
EditWithContentModel = "EditWithContentModel",
|
|
8525
|
-
/**
|
|
8526
|
-
* Apply default format on editor container
|
|
8527
|
-
*/
|
|
8528
|
-
DefaultFormatOnContainer = "DefaultFormatOnContainer",
|
|
8529
8631
|
/**
|
|
8530
8632
|
* Delete table with Backspace key with the whole was selected with table selector
|
|
8531
8633
|
*/
|
|
@@ -8783,15 +8885,18 @@ enum CompatibleEntityOperation {
|
|
|
8783
8885
|
*/
|
|
8784
8886
|
ReplaceTemporaryContent = 8,
|
|
8785
8887
|
/**
|
|
8786
|
-
*
|
|
8787
|
-
* Plugins can handle this event to do extra operations to the shadow root
|
|
8888
|
+
* @deprecated
|
|
8788
8889
|
*/
|
|
8789
8890
|
AddShadowRoot = 9,
|
|
8790
8891
|
/**
|
|
8791
|
-
*
|
|
8792
|
-
* Plugins can handle this event to do any necessary clean up for shadow root
|
|
8892
|
+
* @deprecated
|
|
8793
8893
|
*/
|
|
8794
|
-
RemoveShadowRoot = 10
|
|
8894
|
+
RemoveShadowRoot = 10,
|
|
8895
|
+
/**
|
|
8896
|
+
* Notify plugins that a new entity state need to be updated to an entity.
|
|
8897
|
+
* This is normally happened when user undo/redo the content with an entity snapshot added by a plugin that handles entity
|
|
8898
|
+
*/
|
|
8899
|
+
UpdateEntityState = 11
|
|
8795
8900
|
}
|
|
8796
8901
|
|
|
8797
8902
|
/**
|
|
@@ -9655,7 +9760,7 @@ enum CompatibleKnownCreateElementDataIndex {
|
|
|
9655
9760
|
*/
|
|
9656
9761
|
TableSelector = 11,
|
|
9657
9762
|
/**
|
|
9658
|
-
*
|
|
9763
|
+
* @deprecated
|
|
9659
9764
|
*/
|
|
9660
9765
|
EmptyLineFormatInSpan = 12
|
|
9661
9766
|
}
|