roosterjs 8.48.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 +134 -26
- package/dist/rooster-amd.js +1658 -2001
- 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 +134 -26
- package/dist/rooster.js +1658 -2002
- 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.49.0)
|
|
2
2
|
// Generated by dts tool from roosterjs
|
|
3
3
|
// Project: https://github.com/Microsoft/roosterjs
|
|
4
4
|
|
|
@@ -414,6 +414,45 @@ export function extractClipboardItemsForIE(dataTransfer: DataTransfer, callback:
|
|
|
414
414
|
*/
|
|
415
415
|
export function createFragmentFromClipboardData(core: EditorCore, clipboardData: ClipboardData, position: NodePosition | null, pasteAsText: boolean, applyCurrentStyle: boolean, pasteAsImage: boolean, event: BeforePasteEvent): DocumentFragment;
|
|
416
416
|
|
|
417
|
+
/**
|
|
418
|
+
* Handles the content when using the Image Paste Option
|
|
419
|
+
* @param imageDataUri the image uri to use for the image
|
|
420
|
+
* @param fragment fragment that will contain the content to paste.
|
|
421
|
+
*/
|
|
422
|
+
export function handleImagePaste(imageDataUri: string, fragment: DocumentFragment): void;
|
|
423
|
+
|
|
424
|
+
/**
|
|
425
|
+
* handle the content when using the text only option
|
|
426
|
+
* @param text Text from clipboard
|
|
427
|
+
* @param position current position of the clipboard
|
|
428
|
+
* @param fragment fragment that contains the paste content.
|
|
429
|
+
*/
|
|
430
|
+
export function handleTextPaste(text: string, position: NodePosition | null, fragment: DocumentFragment): void;
|
|
431
|
+
|
|
432
|
+
/**
|
|
433
|
+
* Retrieves the metadata from the content inside of the clipboard
|
|
434
|
+
* @param doc Document parsed from the clipboard
|
|
435
|
+
* @param event Before Paste event
|
|
436
|
+
* @param trustedHTMLHandler the trusted html handler to sanitize the content.
|
|
437
|
+
*/
|
|
438
|
+
export function retrieveMetadataFromClipboard(doc: Document | undefined, event: BeforePasteEvent, trustedHTMLHandler: TrustedHTMLHandler): void;
|
|
439
|
+
|
|
440
|
+
/**
|
|
441
|
+
* Sanitize the content from the pasted content
|
|
442
|
+
* @param event The before paste event
|
|
443
|
+
* @param position the position of the cursor
|
|
444
|
+
*/
|
|
445
|
+
export function sanitizePasteContent(event: BeforePasteEvent, position: NodePosition | null): void;
|
|
446
|
+
|
|
447
|
+
/**
|
|
448
|
+
* Get the paste type that will be used corresponding to the configuration
|
|
449
|
+
* @param pasteAsText Whether to paste as Text
|
|
450
|
+
* @param applyCurrentStyle Whether to apply the current format to the content
|
|
451
|
+
* @param pasteAsImage Whether to only paste the image
|
|
452
|
+
* @returns
|
|
453
|
+
*/
|
|
454
|
+
export function getPasteType(pasteAsText: boolean, applyCurrentStyle: boolean, pasteAsImage: boolean): PasteType;
|
|
455
|
+
|
|
417
456
|
/**
|
|
418
457
|
* Browser object contains browser and operating system information of current environment
|
|
419
458
|
*/
|
|
@@ -1508,6 +1547,13 @@ export function setHtmlWithSelectionPath(rootNode: HTMLElement, html: string, tr
|
|
|
1508
1547
|
*/
|
|
1509
1548
|
export function setHtmlWithMetadata(rootNode: HTMLElement, html: string, trustedHTMLHandler?: TrustedHTMLHandler): ContentMetadata | undefined;
|
|
1510
1549
|
|
|
1550
|
+
/**
|
|
1551
|
+
* Extract content metadata from DOM tree
|
|
1552
|
+
* @param rootNode Root of the DOM tree
|
|
1553
|
+
* @returns If there is a valid content metadata node in the give DOM tree, return this metadata object, otherwise undefined
|
|
1554
|
+
*/
|
|
1555
|
+
export function extractContentMetadata(rootNode: HTMLElement): ContentMetadata | undefined;
|
|
1556
|
+
|
|
1511
1557
|
/**
|
|
1512
1558
|
* Add the given range into selection of the given document
|
|
1513
1559
|
* @param range The range to select
|
|
@@ -1706,6 +1752,7 @@ export function getEntityFromElement(element: HTMLElement): Entity | null;
|
|
|
1706
1752
|
export function getEntitySelector(type?: string, id?: string): string;
|
|
1707
1753
|
|
|
1708
1754
|
/**
|
|
1755
|
+
* @deprecated
|
|
1709
1756
|
* Create a placeholder comment node for entity
|
|
1710
1757
|
* @param entity The entity to create placeholder from
|
|
1711
1758
|
* @returns A placeholder comment node as
|
|
@@ -1732,7 +1779,7 @@ export function moveContentWithEntityPlaceholders(root: HTMLDivElement, entities
|
|
|
1732
1779
|
* @param entities A map from entity id to entity wrapper, used for reusing existing DOM structure for entity
|
|
1733
1780
|
* @param insertClonedNode When pass true, merge with a cloned copy of the nodes from source fragment rather than the nodes themselves @default false
|
|
1734
1781
|
*/
|
|
1735
|
-
export function restoreContentWithEntityPlaceholder(source:
|
|
1782
|
+
export function restoreContentWithEntityPlaceholder(source: ParentNode, target: HTMLElement, entities: Record<string, HTMLElement | KnownEntityItem> | null, insertClonedNode?: boolean): void;
|
|
1736
1783
|
|
|
1737
1784
|
/**
|
|
1738
1785
|
* Gets the cached event data by cache key from event object if there is already one.
|
|
@@ -2935,15 +2982,18 @@ export interface EntityPluginState {
|
|
|
2935
2982
|
pageY: number;
|
|
2936
2983
|
};
|
|
2937
2984
|
/**
|
|
2985
|
+
* @deprecated
|
|
2938
2986
|
* All known entity elements
|
|
2939
2987
|
*/
|
|
2940
|
-
knownEntityElements
|
|
2988
|
+
knownEntityElements?: HTMLElement[];
|
|
2989
|
+
/**
|
|
2990
|
+
* @deprecated
|
|
2991
|
+
*/
|
|
2992
|
+
shadowEntityCache?: Record<string, HTMLElement>;
|
|
2941
2993
|
/**
|
|
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
|
|
2994
|
+
* Entities cached for undo snapshot
|
|
2945
2995
|
*/
|
|
2946
|
-
|
|
2996
|
+
entityMap: Record<string, KnownEntityItem>;
|
|
2947
2997
|
}
|
|
2948
2998
|
|
|
2949
2999
|
/**
|
|
@@ -3668,15 +3718,18 @@ export const enum EntityOperation {
|
|
|
3668
3718
|
*/
|
|
3669
3719
|
ReplaceTemporaryContent = 8,
|
|
3670
3720
|
/**
|
|
3671
|
-
*
|
|
3672
|
-
* Plugins can handle this event to do extra operations to the shadow root
|
|
3721
|
+
* @deprecated
|
|
3673
3722
|
*/
|
|
3674
3723
|
AddShadowRoot = 9,
|
|
3675
3724
|
/**
|
|
3676
|
-
*
|
|
3677
|
-
|
|
3725
|
+
* @deprecated
|
|
3726
|
+
*/
|
|
3727
|
+
RemoveShadowRoot = 10,
|
|
3728
|
+
/**
|
|
3729
|
+
* Notify plugins that a new entity state need to be updated to an entity.
|
|
3730
|
+
* This is normally happened when user undo/redo the content with an entity snapshot added by a plugin that handles entity
|
|
3678
3731
|
*/
|
|
3679
|
-
|
|
3732
|
+
UpdateEntityState = 11
|
|
3680
3733
|
}
|
|
3681
3734
|
|
|
3682
3735
|
/**
|
|
@@ -4836,15 +4889,18 @@ export interface EntityOperationEventData {
|
|
|
4836
4889
|
*/
|
|
4837
4890
|
rawEvent?: Event;
|
|
4838
4891
|
/**
|
|
4839
|
-
*
|
|
4840
|
-
*
|
|
4841
|
-
|
|
4842
|
-
|
|
4843
|
-
|
|
4844
|
-
*
|
|
4845
|
-
*
|
|
4846
|
-
*
|
|
4847
|
-
|
|
4892
|
+
* For EntityOperation.UpdateEntityState, we use this object to pass the new entity state to plugin.
|
|
4893
|
+
* For other operation types, it is not used.
|
|
4894
|
+
*/
|
|
4895
|
+
state?: string;
|
|
4896
|
+
/**
|
|
4897
|
+
* For EntityOperation.NewEntity, plugin can set this property to true then the entity will be persisted.
|
|
4898
|
+
* A persisted entity won't be touched during undo/redo, unless it does not exist after undo/redo.
|
|
4899
|
+
* For other operation types, this value will be ignored.
|
|
4900
|
+
*/
|
|
4901
|
+
shouldPersist?: boolean;
|
|
4902
|
+
/**
|
|
4903
|
+
* @deprecated
|
|
4848
4904
|
*/
|
|
4849
4905
|
contentForShadowEntity?: DocumentFragment;
|
|
4850
4906
|
}
|
|
@@ -5349,6 +5405,12 @@ export interface ContentChangedData {
|
|
|
5349
5405
|
* Optional property to store the format api name when using ChangeSource.Format
|
|
5350
5406
|
*/
|
|
5351
5407
|
formatApiName?: string;
|
|
5408
|
+
/**
|
|
5409
|
+
* @optional Get entity states related to the snapshot. If it returns entity states, each state will cause
|
|
5410
|
+
* an EntityOperation event with operation = EntityOperation.UpdateEntityState when undo/redo to this snapshot
|
|
5411
|
+
* @returns Related entity state array
|
|
5412
|
+
*/
|
|
5413
|
+
getEntityState?: () => EntityState[];
|
|
5352
5414
|
}
|
|
5353
5415
|
|
|
5354
5416
|
/**
|
|
@@ -6058,6 +6120,31 @@ export interface Snapshot {
|
|
|
6058
6120
|
* Known colors for dark mode
|
|
6059
6121
|
*/
|
|
6060
6122
|
knownColors: Readonly<ModeIndependentColor>[];
|
|
6123
|
+
/**
|
|
6124
|
+
* Entity states related to this undo snapshots. When undo/redo to this snapshot, each entity state will trigger
|
|
6125
|
+
* an EntityOperation event with operation = EntityOperation.UpdateEntityState
|
|
6126
|
+
*/
|
|
6127
|
+
entityStates?: EntityState[];
|
|
6128
|
+
}
|
|
6129
|
+
|
|
6130
|
+
/**
|
|
6131
|
+
* State for an entity. This is used for storing entity undo snapshot
|
|
6132
|
+
*/
|
|
6133
|
+
export interface EntityState {
|
|
6134
|
+
/**
|
|
6135
|
+
* Type of the entity
|
|
6136
|
+
*/
|
|
6137
|
+
type: string;
|
|
6138
|
+
/**
|
|
6139
|
+
* Id of the entity
|
|
6140
|
+
*/
|
|
6141
|
+
id: string;
|
|
6142
|
+
/**
|
|
6143
|
+
* The state of this entity to store into undo snapshot.
|
|
6144
|
+
* The state can be any string, or a serialized JSON object.
|
|
6145
|
+
* We are using string here instead of a JSON object to make sure the whole state is serializable.
|
|
6146
|
+
*/
|
|
6147
|
+
state: string;
|
|
6061
6148
|
}
|
|
6062
6149
|
|
|
6063
6150
|
/**
|
|
@@ -8184,6 +8271,24 @@ export interface ImageSelectionRange extends SelectionRangeExBase<SelectionRange
|
|
|
8184
8271
|
*/
|
|
8185
8272
|
export type SelectionRangeEx = NormalSelectionRange | TableSelectionRange | ImageSelectionRange;
|
|
8186
8273
|
|
|
8274
|
+
/**
|
|
8275
|
+
* Represents all info of a known entity, including its DOM element, whether it is deleted and if it can be persisted
|
|
8276
|
+
*/
|
|
8277
|
+
export interface KnownEntityItem {
|
|
8278
|
+
/**
|
|
8279
|
+
* The HTML element of entity wrapper
|
|
8280
|
+
*/
|
|
8281
|
+
element: HTMLElement;
|
|
8282
|
+
/**
|
|
8283
|
+
* Whether this entity is deleted.
|
|
8284
|
+
*/
|
|
8285
|
+
isDeleted?: boolean;
|
|
8286
|
+
/**
|
|
8287
|
+
* Whether we want to persist this entity element during undo/redo
|
|
8288
|
+
*/
|
|
8289
|
+
canPersist?: boolean;
|
|
8290
|
+
}
|
|
8291
|
+
|
|
8187
8292
|
/**
|
|
8188
8293
|
* Attribute callback, will be called when HtmlSanitizer process an attribute with given name
|
|
8189
8294
|
* @param value Value of the attribute
|
|
@@ -8779,15 +8884,18 @@ export enum CompatibleEntityOperation {
|
|
|
8779
8884
|
*/
|
|
8780
8885
|
ReplaceTemporaryContent = 8,
|
|
8781
8886
|
/**
|
|
8782
|
-
*
|
|
8783
|
-
* Plugins can handle this event to do extra operations to the shadow root
|
|
8887
|
+
* @deprecated
|
|
8784
8888
|
*/
|
|
8785
8889
|
AddShadowRoot = 9,
|
|
8786
8890
|
/**
|
|
8787
|
-
*
|
|
8788
|
-
|
|
8891
|
+
* @deprecated
|
|
8892
|
+
*/
|
|
8893
|
+
RemoveShadowRoot = 10,
|
|
8894
|
+
/**
|
|
8895
|
+
* Notify plugins that a new entity state need to be updated to an entity.
|
|
8896
|
+
* This is normally happened when user undo/redo the content with an entity snapshot added by a plugin that handles entity
|
|
8789
8897
|
*/
|
|
8790
|
-
|
|
8898
|
+
UpdateEntityState = 11
|
|
8791
8899
|
}
|
|
8792
8900
|
|
|
8793
8901
|
/**
|