@lexical/history
Advanced tools
Comparing version 0.2.5 to 0.2.6
@@ -8,2 +8,3 @@ /** | ||
*/ | ||
import type { | ||
@@ -10,0 +11,0 @@ EditorState, |
@@ -18,3 +18,2 @@ /** | ||
* | ||
* | ||
*/ | ||
@@ -206,6 +205,9 @@ const HISTORY_MERGE = 0; | ||
historyState.current = historyStateEntry; | ||
historyStateEntry.editor.setEditorState(historyStateEntry.editorState, { | ||
tag: 'historic' | ||
}); | ||
historyState.current = historyStateEntry || null; | ||
if (historyStateEntry) { | ||
historyStateEntry.editor.setEditorState(historyStateEntry.editorState, { | ||
tag: 'historic' | ||
}); | ||
} | ||
} | ||
@@ -232,6 +234,9 @@ } | ||
historyState.current = historyStateEntry; | ||
historyStateEntry.editor.setEditorState(historyStateEntry.editorState.clone(historyStateEntry.undoSelection), { | ||
tag: 'historic' | ||
}); | ||
historyState.current = historyStateEntry || null; | ||
if (historyStateEntry) { | ||
historyStateEntry.editor.setEditorState(historyStateEntry.editorState.clone(historyStateEntry.undoSelection), { | ||
tag: 'historic' | ||
}); | ||
} | ||
} | ||
@@ -238,0 +243,0 @@ } |
@@ -13,4 +13,4 @@ /** | ||
exports.registerHistory=function(b,a,k){const h=w(b,k);k=({editorState:c,prevEditorState:d,dirtyLeaves:g,dirtyElements:l,tags:p})=>{const n=a.current,t=a.redoStack,r=a.undoStack,q=null===n?null:n.editorState;if(null===n||c!==q){g=h(d,c,n,g,l,p);if(1===g)0!==t.length&&(a.redoStack=[]),null!==n&&(r.push({...n,undoSelection:d.read(u.$getSelection)}),b.dispatchCommand(u.CAN_UNDO_COMMAND,!0));else if(2===g)return;a.current={editor:b,editorState:c}}};const m=e.mergeRegister(b.registerCommand(u.UNDO_COMMAND, | ||
()=>{const c=a.redoStack,d=a.undoStack;if(0!==d.length){const g=a.current,l=d.pop();null!==g&&(c.push(g),b.dispatchCommand(u.CAN_REDO_COMMAND,!0));0===d.length&&b.dispatchCommand(u.CAN_UNDO_COMMAND,!1);a.current=l;l.editor.setEditorState(l.editorState.clone(l.undoSelection),{tag:"historic"})}return!0},u.COMMAND_PRIORITY_EDITOR),b.registerCommand(u.REDO_COMMAND,()=>{const c=a.redoStack;var d=a.undoStack;if(0!==c.length){const g=a.current;null!==g&&(d.push(g),b.dispatchCommand(u.CAN_UNDO_COMMAND,!0)); | ||
d=c.pop();0===c.length&&b.dispatchCommand(u.CAN_REDO_COMMAND,!1);a.current=d;d.editor.setEditorState(d.editorState,{tag:"historic"})}return!0},u.COMMAND_PRIORITY_EDITOR),b.registerCommand(u.CLEAR_EDITOR_COMMAND,()=>{a.undoStack=[];a.redoStack=[];a.current=null;return!1},u.COMMAND_PRIORITY_EDITOR),b.registerCommand(u.CLEAR_HISTORY_COMMAND,()=>{a.undoStack=[];a.redoStack=[];a.current=null;return!0},u.COMMAND_PRIORITY_EDITOR),b.registerUpdateListener(k)),f=b.registerUpdateListener(k);return()=>{m(); | ||
f()}}; | ||
()=>{const c=a.redoStack,d=a.undoStack;if(0!==d.length){const g=a.current,l=d.pop();null!==g&&(c.push(g),b.dispatchCommand(u.CAN_REDO_COMMAND,!0));0===d.length&&b.dispatchCommand(u.CAN_UNDO_COMMAND,!1);a.current=l||null;l&&l.editor.setEditorState(l.editorState.clone(l.undoSelection),{tag:"historic"})}return!0},u.COMMAND_PRIORITY_EDITOR),b.registerCommand(u.REDO_COMMAND,()=>{const c=a.redoStack;var d=a.undoStack;if(0!==c.length){const g=a.current;null!==g&&(d.push(g),b.dispatchCommand(u.CAN_UNDO_COMMAND, | ||
!0));d=c.pop();0===c.length&&b.dispatchCommand(u.CAN_REDO_COMMAND,!1);a.current=d||null;d&&d.editor.setEditorState(d.editorState,{tag:"historic"})}return!0},u.COMMAND_PRIORITY_EDITOR),b.registerCommand(u.CLEAR_EDITOR_COMMAND,()=>{a.undoStack=[];a.redoStack=[];a.current=null;return!1},u.COMMAND_PRIORITY_EDITOR),b.registerCommand(u.CLEAR_HISTORY_COMMAND,()=>{a.undoStack=[];a.redoStack=[];a.current=null;return!0},u.COMMAND_PRIORITY_EDITOR),b.registerUpdateListener(k)),f=b.registerUpdateListener(k);return()=> | ||
{m();f()}}; |
@@ -11,9 +11,9 @@ { | ||
"license": "MIT", | ||
"version": "0.2.5", | ||
"version": "0.2.6", | ||
"main": "LexicalHistory.js", | ||
"peerDependencies": { | ||
"lexical": "0.2.5" | ||
"lexical": "0.2.6" | ||
}, | ||
"dependencies": { | ||
"@lexical/utils": "0.2.5" | ||
"@lexical/utils": "0.2.6" | ||
}, | ||
@@ -20,0 +20,0 @@ "repository": { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
17169
310
+ Added@lexical/list@0.2.6(transitive)
+ Added@lexical/table@0.2.6(transitive)
+ Added@lexical/utils@0.2.6(transitive)
+ Addedlexical@0.2.6(transitive)
- Removed@lexical/list@0.2.5(transitive)
- Removed@lexical/table@0.2.5(transitive)
- Removed@lexical/utils@0.2.5(transitive)
- Removedlexical@0.2.5(transitive)
Updated@lexical/utils@0.2.6