prosemirror-history
Advanced tools
Comparing version 1.0.4 to 1.1.0
@@ -0,1 +1,11 @@ | ||
## 1.1.0 (2019-11-08) | ||
### Bug fixes | ||
Prevents appended transactions from starting a new event group, even if they were created a while after the previous transaction. | ||
### New features | ||
Add a `module` field to package json file. | ||
## 1.0.4 (2019-02-19) | ||
@@ -2,0 +12,0 @@ |
@@ -45,3 +45,3 @@ 'use strict'; | ||
for (;; end--) { | ||
var next = this$1.items.get(end - 1); | ||
var next = this.items.get(end - 1); | ||
if (next.selection) { --end; break } | ||
@@ -235,5 +235,12 @@ } | ||
var Item = function Item(map, step, selection, mirrorOffset) { | ||
// The (forward) step map for this item. | ||
this.map = map; | ||
// The inverted step | ||
this.step = step; | ||
// If this is non-null, this item is the start of a group, and | ||
// this selection is the starting selection for the group (the one | ||
// that was active before the first step was applied) | ||
this.selection = selection; | ||
// If this item is the inverse of a previous mapping on the stack, | ||
// this points at the inverse's offset | ||
this.mirrorOffset = mirrorOffset; | ||
@@ -282,4 +289,4 @@ }; | ||
// Group transforms that occur in quick succession into one event. | ||
var newGroup = history.prevTime < (tr.time || 0) - options.newGroupDelay || | ||
!appended && !isAdjacentTo(tr, history.prevRanges); | ||
var newGroup = !appended && (history.prevTime < (tr.time || 0) - options.newGroupDelay || | ||
!isAdjacentTo(tr, history.prevRanges)); | ||
var prevRanges = appended ? mapRanges(history.prevRanges, tr.mapping) : rangesFor(tr.mapping.maps[tr.steps.length - 1]); | ||
@@ -346,4 +353,3 @@ return new HistoryState(history.done.addTransform(tr, newGroup ? state.selection.getBookmark() : null, | ||
var cachedPreserveItems = false; | ||
var cachedPreserveItemsPlugins = null; | ||
var cachedPreserveItems = false, cachedPreserveItemsPlugins = null; | ||
// Check whether any plugin in the given state has a | ||
@@ -451,6 +457,6 @@ // `historyPreserveItems` property in its spec, in which case we must | ||
exports.history = history; | ||
exports.redo = redo; | ||
exports.redoDepth = redoDepth; | ||
exports.undo = undo; | ||
exports.redo = redo; | ||
exports.undoDepth = undoDepth; | ||
exports.redoDepth = redoDepth; | ||
//# sourceMappingURL=history.js.map |
{ | ||
"name": "prosemirror-history", | ||
"version": "1.0.4", | ||
"version": "1.1.0", | ||
"description": "Undo history for ProseMirror", | ||
"main": "dist/history.js", | ||
"module": "src/history.js", | ||
"license": "MIT", | ||
@@ -21,3 +22,3 @@ "maintainers": [ | ||
"prosemirror-transform": "^1.0.0", | ||
"rope-sequence": "^1.2.0" | ||
"rope-sequence": "^1.3.0" | ||
}, | ||
@@ -29,4 +30,4 @@ "devDependencies": { | ||
"prosemirror-test-builder": "^1.0.0", | ||
"rollup": "^0.49.0", | ||
"rollup-plugin-buble": "^0.15.0" | ||
"rollup": "^1.26.3", | ||
"@rollup/plugin-buble": "^0.20.0" | ||
}, | ||
@@ -33,0 +34,0 @@ "scripts": { |
@@ -1,7 +0,12 @@ | ||
module.exports = { | ||
input: "./src/history.js", | ||
output: {format: "cjs", file: "dist/history.js"}, | ||
sourcemap: true, | ||
plugins: [require("rollup-plugin-buble")()], | ||
import buble from '@rollup/plugin-buble' | ||
export default { | ||
input: './src/history.js', | ||
output: { | ||
dir: 'dist', | ||
format: 'cjs', | ||
sourcemap: true | ||
}, | ||
plugins: [buble()], | ||
external(id) { return !/^[\.\/]/.test(id) } | ||
} |
@@ -227,5 +227,12 @@ import RopeSequence from "rope-sequence" | ||
constructor(map, step, selection, mirrorOffset) { | ||
// The (forward) step map for this item. | ||
this.map = map | ||
// The inverted step | ||
this.step = step | ||
// If this is non-null, this item is the start of a group, and | ||
// this selection is the starting selection for the group (the one | ||
// that was active before the first step was applied) | ||
this.selection = selection | ||
// If this item is the inverse of a previous mapping on the stack, | ||
// this points at the inverse's offset | ||
this.mirrorOffset = mirrorOffset | ||
@@ -277,4 +284,4 @@ } | ||
// Group transforms that occur in quick succession into one event. | ||
let newGroup = history.prevTime < (tr.time || 0) - options.newGroupDelay || | ||
!appended && !isAdjacentTo(tr, history.prevRanges) | ||
let newGroup = !appended && (history.prevTime < (tr.time || 0) - options.newGroupDelay || | ||
!isAdjacentTo(tr, history.prevRanges)) | ||
let prevRanges = appended ? mapRanges(history.prevRanges, tr.mapping) : rangesFor(tr.mapping.maps[tr.steps.length - 1]) | ||
@@ -281,0 +288,0 @@ return new HistoryState(history.done.addTransform(tr, newGroup ? state.selection.getBookmark() : null, |
Sorry, the diff of this file is not supported yet
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
75526
808
11
Updatedrope-sequence@^1.3.0