Skip to content
Snippets Groups Projects
Commit 08c0fe21 authored by chris's avatar chris
Browse files

keep selection when changing format

parent e43d48ce
No related branches found
No related tags found
1 merge request!144enable insertions, deletions on codeblock
...@@ -102,10 +102,13 @@ const trackedTransaction = (tr, state, user) => { ...@@ -102,10 +102,13 @@ const trackedTransaction = (tr, state, user) => {
const caretPos = map.map(tr.selection.from - 2, -1); const caretPos = map.map(tr.selection.from - 2, -1);
newTr.setSelection(new TextSelection(newTr.doc.resolve(caretPos))); newTr.setSelection(new TextSelection(newTr.doc.resolve(caretPos)));
} else { } else {
const caretPos = map.map(tr.selection.from, -1); if (state.selection.from === state.selection.to) {
newTr.setSelection(new TextSelection(newTr.doc.resolve(caretPos))); const caretPos = map.map(tr.selection.from, -1);
// const slice = map.slice(newTr.selection.from, newTr.selection.to); newTr.setSelection(new TextSelection(newTr.doc.resolve(caretPos)));
// map.appendMap(slice); } else {
const slice = map.slice(newTr.selection.from, newTr.selection.to);
map.appendMap(slice);
}
} }
if (tr.storedMarksSet) { if (tr.storedMarksSet) {
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment