@codemirror/history
Advanced tools
Comparing version 0.17.1 to 0.17.2
@@ -0,1 +1,7 @@ | ||
## 0.17.2 (2021-01-19) | ||
### Bug fixes | ||
Fix a bug where the history could get corrupted when the document length was reduced to zero. Fix another bad use of changes.length | ||
## 0.17.1 (2021-01-06) | ||
@@ -2,0 +8,0 @@ |
@@ -45,3 +45,3 @@ import { Annotation, Facet, combineConfig, StateField, Transaction, StateEffect } from '@codemirror/state'; | ||
if (tr.annotation(Transaction.addToHistory) === false) | ||
return tr.changes.length ? state.addMapping(tr.changes.desc) : state; | ||
return !tr.changes.empty ? state.addMapping(tr.changes.desc) : state; | ||
let event = HistEvent.fromTransaction(tr); | ||
@@ -246,3 +246,3 @@ let time = tr.annotation(Transaction.time), userEvent = tr.annotation(Transaction.userEvent); | ||
!lastEvent.selectionsAfter.length && | ||
lastEvent.changes.length && event.changes && | ||
!lastEvent.changes.empty && event.changes && | ||
isAdjacent(lastEvent.changes, event.changes)) { | ||
@@ -249,0 +249,0 @@ done = updateBranch(done, done.length - 1, maxLen, new HistEvent(event.changes.compose(lastEvent.changes), conc(event.effects, lastEvent.effects), lastEvent.mapped, lastEvent.startSelection, none)); |
{ | ||
"name": "@codemirror/history", | ||
"version": "0.17.1", | ||
"version": "0.17.2", | ||
"description": "Undo/redo history for the CodeMirror code editor", | ||
@@ -5,0 +5,0 @@ "scripts": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
58633