roosterjs 9.30.0 → 9.31.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 +33 -3
- package/dist/rooster-amd.js +15 -0
- 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-react-amd.js +55 -55
- package/dist/rooster-react-amd.js.map +1 -1
- package/dist/rooster.d.ts +33 -3
- package/dist/rooster.js +15 -0
- package/dist/rooster.js.map +1 -1
- package/package.json +7 -7
package/dist/rooster-amd.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Type definitions for roosterjs (Version 9.
|
|
1
|
+
// Type definitions for roosterjs (Version 9.31.0)
|
|
2
2
|
// Generated by dts tool from roosterjs
|
|
3
3
|
// Project: https://github.com/Microsoft/roosterjs
|
|
4
4
|
|
|
@@ -5100,6 +5100,13 @@ export interface Snapshot {
|
|
|
5100
5100
|
* HTML content string
|
|
5101
5101
|
*/
|
|
5102
5102
|
html: string;
|
|
5103
|
+
/**
|
|
5104
|
+
* Additional state supplied by plugins. When doing an undo/redo to this snapshot, this state will be added to the
|
|
5105
|
+
* content model context as additional state.
|
|
5106
|
+
*/
|
|
5107
|
+
additionalState?: {
|
|
5108
|
+
[key: string]: string;
|
|
5109
|
+
};
|
|
5103
5110
|
/**
|
|
5104
5111
|
* Entity states related to this undo snapshots. When undo/redo to this snapshot, each entity state will trigger
|
|
5105
5112
|
* an EntityOperation event with operation = EntityOperation.UpdateEntityState
|
|
@@ -5873,6 +5880,18 @@ export interface BasePluginDomEvent<TPluginEventType extends PluginEventType, TR
|
|
|
5873
5880
|
rawEvent: TRawEvent;
|
|
5874
5881
|
}
|
|
5875
5882
|
|
|
5883
|
+
/**
|
|
5884
|
+
* Fired when an undo snapshot is about to be added
|
|
5885
|
+
*/
|
|
5886
|
+
export interface BeforeAddUndoSnapshotEvent extends BasePluginEvent<'beforeAddUndoSnapshot'> {
|
|
5887
|
+
/**
|
|
5888
|
+
* Additional state to be added to the snapshot
|
|
5889
|
+
*/
|
|
5890
|
+
additionalState: {
|
|
5891
|
+
[key: string]: string;
|
|
5892
|
+
};
|
|
5893
|
+
}
|
|
5894
|
+
|
|
5876
5895
|
/**
|
|
5877
5896
|
* Provides a chance for plugin to change the content before it is copied from editor.
|
|
5878
5897
|
*/
|
|
@@ -5980,6 +5999,12 @@ export interface ContentChangedEvent extends BasePluginEvent<'contentChanged'> {
|
|
|
5980
5999
|
* Entities got changed (added or removed) during the content change process
|
|
5981
6000
|
*/
|
|
5982
6001
|
readonly changedEntities?: ChangedEntity[];
|
|
6002
|
+
/**
|
|
6003
|
+
* Additional state added to the snapshot by plugins
|
|
6004
|
+
*/
|
|
6005
|
+
readonly additionalState?: {
|
|
6006
|
+
[key: string]: string;
|
|
6007
|
+
};
|
|
5983
6008
|
/**
|
|
5984
6009
|
* Entity states related to this event
|
|
5985
6010
|
*/
|
|
@@ -6235,7 +6260,7 @@ export interface MouseUpEvent extends BasePluginDomEvent<'mouseUp', MouseEvent>
|
|
|
6235
6260
|
/**
|
|
6236
6261
|
* Editor plugin event interface
|
|
6237
6262
|
*/
|
|
6238
|
-
export type PluginEvent = BeforeCutCopyEvent | BeforeDisposeEvent | BeforeKeyboardEditingEvent | BeforeLogicalRootChangeEvent | BeforePasteEvent | BeforeSetContentEvent | CompositionEndEvent | ContentChangedEvent | ContextMenuEvent | RewriteFromModelEvent | EditImageEvent | EditorReadyEvent | EnterShadowEditEvent | EntityOperationEvent | ExtractContentWithDomEvent | EditorInputEvent | KeyDownEvent | KeyPressEvent | KeyUpEvent | LeaveShadowEditEvent | LogicalRootChangedEvent | MouseDownEvent | MouseUpEvent | ScrollEvent | SelectionChangedEvent | ZoomChangedEvent;
|
|
6263
|
+
export type PluginEvent = BeforeAddUndoSnapshotEvent | BeforeCutCopyEvent | BeforeDisposeEvent | BeforeKeyboardEditingEvent | BeforeLogicalRootChangeEvent | BeforePasteEvent | BeforeSetContentEvent | CompositionEndEvent | ContentChangedEvent | ContextMenuEvent | RewriteFromModelEvent | EditImageEvent | EditorReadyEvent | EnterShadowEditEvent | EntityOperationEvent | ExtractContentWithDomEvent | EditorInputEvent | KeyDownEvent | KeyPressEvent | KeyUpEvent | LeaveShadowEditEvent | LogicalRootChangedEvent | MouseDownEvent | MouseUpEvent | ScrollEvent | SelectionChangedEvent | ZoomChangedEvent;
|
|
6239
6264
|
|
|
6240
6265
|
/**
|
|
6241
6266
|
* A type to extract data part of a plugin event type. Data part is the plugin event without eventType field.
|
|
@@ -6375,7 +6400,12 @@ export type PluginEventType = /**
|
|
|
6375
6400
|
* This event is used to clean up any features from the old logical root
|
|
6376
6401
|
* before the new logical root is set.
|
|
6377
6402
|
*/
|
|
6378
|
-
| 'beforeLogicalRootChange'
|
|
6403
|
+
| 'beforeLogicalRootChange'
|
|
6404
|
+
/**
|
|
6405
|
+
* Before an undo snapshot is added to the undo stack.
|
|
6406
|
+
* This event is used to give plugins a chance to add additional state to the snapshot.
|
|
6407
|
+
*/
|
|
6408
|
+
| 'beforeAddUndoSnapshot';
|
|
6379
6409
|
|
|
6380
6410
|
/**
|
|
6381
6411
|
* This interface represents a PluginEvent wrapping native scroll event
|
package/dist/rooster-amd.js
CHANGED
|
@@ -8560,6 +8560,12 @@ var addUndoSnapshot = function (core, canUndoByBackspace, entityStates) {
|
|
|
8560
8560
|
var lifecycle = core.lifecycle, physicalRoot = core.physicalRoot, logicalRoot = core.logicalRoot, undo = core.undo;
|
|
8561
8561
|
var snapshot = null;
|
|
8562
8562
|
if (!lifecycle.shadowEditFragment) {
|
|
8563
|
+
// Give plugins the chance to add additional state to the snapshot
|
|
8564
|
+
var beforeAddUndoSnapshotEvent = {
|
|
8565
|
+
eventType: 'beforeAddUndoSnapshot',
|
|
8566
|
+
additionalState: {},
|
|
8567
|
+
};
|
|
8568
|
+
core.api.triggerEvent(core, beforeAddUndoSnapshotEvent, false);
|
|
8563
8569
|
// Need to create snapshot selection before retrieve innerHTML since HTML can be changed during creating selection when normalize table
|
|
8564
8570
|
var selection = (0, createSnapshotSelection_1.createSnapshotSelection)(core);
|
|
8565
8571
|
var html = physicalRoot.innerHTML;
|
|
@@ -8596,6 +8602,7 @@ var addUndoSnapshot = function (core, canUndoByBackspace, entityStates) {
|
|
|
8596
8602
|
}
|
|
8597
8603
|
snapshot = {
|
|
8598
8604
|
html: html,
|
|
8605
|
+
additionalState: beforeAddUndoSnapshotEvent.additionalState,
|
|
8599
8606
|
entityStates: entityStates,
|
|
8600
8607
|
isDarkMode: !!lifecycle.isDarkMode,
|
|
8601
8608
|
selection: selection,
|
|
@@ -9708,6 +9715,7 @@ var restoreUndoSnapshot = function (core, snapshot) {
|
|
|
9708
9715
|
(0, restoreSnapshotColors_1.restoreSnapshotColors)(core, snapshot);
|
|
9709
9716
|
var event_1 = {
|
|
9710
9717
|
eventType: 'contentChanged',
|
|
9718
|
+
additionalState: snapshot.additionalState,
|
|
9711
9719
|
entityStates: snapshot.entityStates,
|
|
9712
9720
|
source: roosterjs_content_model_dom_1.ChangeSource.SetContent,
|
|
9713
9721
|
};
|
|
@@ -14366,6 +14374,8 @@ var SnapshotsManagerImpl = /** @class */ (function () {
|
|
|
14366
14374
|
var currentSnapshot = this.snapshots.snapshots[this.snapshots.currentIndex];
|
|
14367
14375
|
var isSameSnapshot = currentSnapshot &&
|
|
14368
14376
|
currentSnapshot.html == snapshot.html &&
|
|
14377
|
+
!currentSnapshot.additionalState &&
|
|
14378
|
+
!snapshot.additionalState &&
|
|
14369
14379
|
!currentSnapshot.entityStates &&
|
|
14370
14380
|
!snapshot.entityStates;
|
|
14371
14381
|
var addSnapshot = !currentSnapshot || shouldAddSnapshot(currentSnapshot, snapshot);
|
|
@@ -14431,6 +14441,11 @@ function createSnapshotsManager(snapshots) {
|
|
|
14431
14441
|
exports.createSnapshotsManager = createSnapshotsManager;
|
|
14432
14442
|
function shouldAddSnapshot(currentSnapshot, snapshot) {
|
|
14433
14443
|
return (currentSnapshot.html !== snapshot.html ||
|
|
14444
|
+
(currentSnapshot.additionalState &&
|
|
14445
|
+
snapshot.additionalState &&
|
|
14446
|
+
JSON.stringify(currentSnapshot.additionalState) !==
|
|
14447
|
+
JSON.stringify(snapshot.additionalState)) ||
|
|
14448
|
+
(!currentSnapshot.additionalState && snapshot.additionalState) ||
|
|
14434
14449
|
(currentSnapshot.entityStates &&
|
|
14435
14450
|
snapshot.entityStates &&
|
|
14436
14451
|
currentSnapshot.entityStates !== snapshot.entityStates) ||
|