prosemirror-history
Advanced tools
Comparing version 1.1.3 to 1.2.0
@@ -0,1 +1,11 @@ | ||
## 1.2.0 (2021-08-18) | ||
### Bug fixes | ||
Fix a bug that caused the `beforeInput` handler to not actually invoke the history commands properly. | ||
### New features | ||
The history plugin now listens for `beforeInput` events with `historyUndo` or `historyRedo` type, and applies the undo/redo commands when they occur. | ||
## 1.1.3 (2019-12-10) | ||
@@ -2,0 +12,0 @@ |
@@ -408,3 +408,14 @@ import RopeSequence from 'rope-sequence'; | ||
config: config | ||
config: config, | ||
props: { | ||
handleDOMEvents: { | ||
beforeinput: function beforeinput(view, e) { | ||
var handled = e.inputType == "historyUndo" ? undo(view.state, view.dispatch) : | ||
e.inputType == "historyRedo" ? redo(view.state, view.dispatch) : false; | ||
if (handled) { e.preventDefault(); } | ||
return handled | ||
} | ||
} | ||
} | ||
}) | ||
@@ -411,0 +422,0 @@ } |
@@ -5,8 +5,10 @@ 'use strict'; | ||
function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; } | ||
var RopeSequence = _interopDefault(require('rope-sequence')); | ||
var RopeSequence = require('rope-sequence'); | ||
var prosemirrorTransform = require('prosemirror-transform'); | ||
var prosemirrorState = require('prosemirror-state'); | ||
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; } | ||
var RopeSequence__default = /*#__PURE__*/_interopDefaultLegacy(RopeSequence); | ||
// ProseMirror's history isn't simply a way to roll back to a previous | ||
@@ -218,6 +220,6 @@ // state, because ProseMirror supports applying changes without adding | ||
}, this.items.length, 0); | ||
return new Branch(RopeSequence.from(items.reverse()), events) | ||
return new Branch(RopeSequence__default['default'].from(items.reverse()), events) | ||
}; | ||
Branch.empty = new Branch(RopeSequence.empty, 0); | ||
Branch.empty = new Branch(RopeSequence__default['default'].empty, 0); | ||
@@ -416,3 +418,14 @@ function cutOffEvents(items, n) { | ||
config: config | ||
config: config, | ||
props: { | ||
handleDOMEvents: { | ||
beforeinput: function beforeinput(view, e) { | ||
var handled = e.inputType == "historyUndo" ? undo(view.state, view.dispatch) : | ||
e.inputType == "historyRedo" ? redo(view.state, view.dispatch) : false; | ||
if (handled) { e.preventDefault(); } | ||
return handled | ||
} | ||
} | ||
} | ||
}) | ||
@@ -419,0 +432,0 @@ } |
{ | ||
"name": "prosemirror-history", | ||
"version": "1.1.3", | ||
"version": "1.2.0", | ||
"description": "Undo history for ProseMirror", | ||
@@ -29,4 +29,4 @@ "main": "dist/index.js", | ||
"prosemirror-test-builder": "^1.0.0", | ||
"rollup": "^1.26.3", | ||
"@rollup/plugin-buble": "^0.20.0" | ||
"rollup": "^2.26.3", | ||
"@rollup/plugin-buble": "^0.21.3" | ||
}, | ||
@@ -33,0 +33,0 @@ "scripts": { |
@@ -13,3 +13,3 @@ module.exports = { | ||
plugins: [require('@rollup/plugin-buble')()], | ||
external(id) { return !/^[\.\/]/.test(id) } | ||
external(id) { return id[0] != "." && !require("path").isAbsolute(id) } | ||
} |
@@ -410,3 +410,14 @@ import RopeSequence from "rope-sequence" | ||
config | ||
config, | ||
props: { | ||
handleDOMEvents: { | ||
beforeinput(view, e) { | ||
let handled = e.inputType == "historyUndo" ? undo(view.state, view.dispatch) : | ||
e.inputType == "historyRedo" ? redo(view.state, view.dispatch) : false | ||
if (handled) e.preventDefault() | ||
return handled | ||
} | ||
} | ||
} | ||
}) | ||
@@ -413,0 +424,0 @@ } |
Sorry, the diff of this file is not supported yet
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
130814
1235