prosemirror-history
Advanced tools
Comparing version 0.12.0 to 0.12.1
@@ -304,5 +304,6 @@ var RopeSequence = require("rope-sequence") | ||
// be shifted. | ||
function histAction(history, state, redo) { | ||
function histAction(history, state, onAction, redo) { | ||
var histOptions = historyKey.get(state).options.config | ||
var pop = (redo ? history.undone : history.done).popEvent(state, histOptions.preserveItems) | ||
if (!pop) { return } | ||
@@ -314,3 +315,3 @@ var selectionBefore = state.selection | ||
var newHist = new HistoryState(redo ? added : pop.remaining, redo ? pop.remaining : added, null, 0) | ||
return pop.transform.action({selection: selection, historyState: newHist, scrollIntoView: true}) | ||
onAction(pop.transform.action({selection: selection, historyState: newHist, scrollIntoView: true})) | ||
} | ||
@@ -369,4 +370,4 @@ | ||
var hist = historyKey.getState(state) | ||
if (!hist || hist.undoDepth == 0) { return false } | ||
if (onAction) { onAction(histAction(hist, state, false)) } | ||
if (!hist || hist.done.eventCount == 0) { return false } | ||
if (onAction) { histAction(hist, state, onAction, false) } | ||
return true | ||
@@ -380,4 +381,4 @@ } | ||
var hist = historyKey.getState(state) | ||
if (!hist || hist.redoDepth == 0) { return false } | ||
if (onAction) { onAction(histAction(hist, state, true)) } | ||
if (!hist || hist.undone.eventCount == 0) { return false } | ||
if (onAction) { histAction(hist, state, onAction, true) } | ||
return true | ||
@@ -384,0 +385,0 @@ } |
{ | ||
"name": "prosemirror-history", | ||
"version": "0.12.0", | ||
"version": "0.12.1", | ||
"description": "Undo history for ProseMirror", | ||
@@ -5,0 +5,0 @@ "main": "dist/history.js", |
@@ -302,5 +302,6 @@ const RopeSequence = require("rope-sequence") | ||
// be shifted. | ||
function histAction(history, state, redo) { | ||
function histAction(history, state, onAction, redo) { | ||
let histOptions = historyKey.get(state).options.config | ||
let pop = (redo ? history.undone : history.done).popEvent(state, histOptions.preserveItems) | ||
if (!pop) return | ||
@@ -312,3 +313,3 @@ let selectionBefore = state.selection | ||
let newHist = new HistoryState(redo ? added : pop.remaining, redo ? pop.remaining : added, null, 0) | ||
return pop.transform.action({selection, historyState: newHist, scrollIntoView: true}) | ||
onAction(pop.transform.action({selection, historyState: newHist, scrollIntoView: true})) | ||
} | ||
@@ -367,4 +368,4 @@ | ||
let hist = historyKey.getState(state) | ||
if (!hist || hist.undoDepth == 0) return false | ||
if (onAction) onAction(histAction(hist, state, false)) | ||
if (!hist || hist.done.eventCount == 0) return false | ||
if (onAction) histAction(hist, state, onAction, false) | ||
return true | ||
@@ -378,4 +379,4 @@ } | ||
let hist = historyKey.getState(state) | ||
if (!hist || hist.redoDepth == 0) return false | ||
if (onAction) onAction(histAction(hist, state, true)) | ||
if (!hist || hist.undone.eventCount == 0) return false | ||
if (onAction) histAction(hist, state, onAction, true) | ||
return true | ||
@@ -382,0 +383,0 @@ } |
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
35936
710