@codemirror/view 6.28.5 → 6.28.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/dist/index.cjs +6 -3
- package/dist/index.js +6 -3
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
package/dist/index.cjs
CHANGED
|
@@ -7126,8 +7126,10 @@ class EditContextManager {
|
|
|
7126
7126
|
applyDOMChangeInner(view, change, state.EditorSelection.single(this.toEditorPos(e.selectionStart), this.toEditorPos(e.selectionEnd)));
|
|
7127
7127
|
// If the transaction didn't flush our change, revert it so
|
|
7128
7128
|
// that the context is in sync with the editor state again.
|
|
7129
|
-
if (this.pendingContextChange)
|
|
7129
|
+
if (this.pendingContextChange) {
|
|
7130
7130
|
this.revertPending(view.state);
|
|
7131
|
+
this.setSelection(view.state);
|
|
7132
|
+
}
|
|
7131
7133
|
};
|
|
7132
7134
|
this.handlers.characterboundsupdate = e => {
|
|
7133
7135
|
let rects = [], prev = null;
|
|
@@ -7209,13 +7211,14 @@ class EditContextManager {
|
|
|
7209
7211
|
return !abort;
|
|
7210
7212
|
}
|
|
7211
7213
|
update(update) {
|
|
7214
|
+
let reverted = this.pendingContextChange;
|
|
7212
7215
|
if (!this.applyEdits(update) || !this.rangeIsValid(update.state)) {
|
|
7213
7216
|
this.pendingContextChange = null;
|
|
7214
7217
|
this.resetRange(update.state);
|
|
7215
7218
|
this.editContext.updateText(0, this.editContext.text.length, update.state.doc.sliceString(this.from, this.to));
|
|
7216
7219
|
this.setSelection(update.state);
|
|
7217
7220
|
}
|
|
7218
|
-
else if (update.docChanged || update.selectionSet) {
|
|
7221
|
+
else if (update.docChanged || update.selectionSet || reverted) {
|
|
7219
7222
|
this.setSelection(update.state);
|
|
7220
7223
|
}
|
|
7221
7224
|
if (update.geometryChanged || update.docChanged || update.selectionSet)
|
|
@@ -7229,7 +7232,7 @@ class EditContextManager {
|
|
|
7229
7232
|
revertPending(state) {
|
|
7230
7233
|
let pending = this.pendingContextChange;
|
|
7231
7234
|
this.pendingContextChange = null;
|
|
7232
|
-
this.editContext.updateText(this.toContextPos(pending.from), this.toContextPos(pending.
|
|
7235
|
+
this.editContext.updateText(this.toContextPos(pending.from), this.toContextPos(pending.from + pending.insert.length), state.doc.sliceString(pending.from, pending.to));
|
|
7233
7236
|
}
|
|
7234
7237
|
setSelection(state) {
|
|
7235
7238
|
let { main } = state.selection;
|
package/dist/index.js
CHANGED
|
@@ -7121,8 +7121,10 @@ class EditContextManager {
|
|
|
7121
7121
|
applyDOMChangeInner(view, change, EditorSelection.single(this.toEditorPos(e.selectionStart), this.toEditorPos(e.selectionEnd)));
|
|
7122
7122
|
// If the transaction didn't flush our change, revert it so
|
|
7123
7123
|
// that the context is in sync with the editor state again.
|
|
7124
|
-
if (this.pendingContextChange)
|
|
7124
|
+
if (this.pendingContextChange) {
|
|
7125
7125
|
this.revertPending(view.state);
|
|
7126
|
+
this.setSelection(view.state);
|
|
7127
|
+
}
|
|
7126
7128
|
};
|
|
7127
7129
|
this.handlers.characterboundsupdate = e => {
|
|
7128
7130
|
let rects = [], prev = null;
|
|
@@ -7204,13 +7206,14 @@ class EditContextManager {
|
|
|
7204
7206
|
return !abort;
|
|
7205
7207
|
}
|
|
7206
7208
|
update(update) {
|
|
7209
|
+
let reverted = this.pendingContextChange;
|
|
7207
7210
|
if (!this.applyEdits(update) || !this.rangeIsValid(update.state)) {
|
|
7208
7211
|
this.pendingContextChange = null;
|
|
7209
7212
|
this.resetRange(update.state);
|
|
7210
7213
|
this.editContext.updateText(0, this.editContext.text.length, update.state.doc.sliceString(this.from, this.to));
|
|
7211
7214
|
this.setSelection(update.state);
|
|
7212
7215
|
}
|
|
7213
|
-
else if (update.docChanged || update.selectionSet) {
|
|
7216
|
+
else if (update.docChanged || update.selectionSet || reverted) {
|
|
7214
7217
|
this.setSelection(update.state);
|
|
7215
7218
|
}
|
|
7216
7219
|
if (update.geometryChanged || update.docChanged || update.selectionSet)
|
|
@@ -7224,7 +7227,7 @@ class EditContextManager {
|
|
|
7224
7227
|
revertPending(state) {
|
|
7225
7228
|
let pending = this.pendingContextChange;
|
|
7226
7229
|
this.pendingContextChange = null;
|
|
7227
|
-
this.editContext.updateText(this.toContextPos(pending.from), this.toContextPos(pending.
|
|
7230
|
+
this.editContext.updateText(this.toContextPos(pending.from), this.toContextPos(pending.from + pending.insert.length), state.doc.sliceString(pending.from, pending.to));
|
|
7228
7231
|
}
|
|
7229
7232
|
setSelection(state) {
|
|
7230
7233
|
let { main } = state.selection;
|