Markdown Editor: Fixed scroll jump on image upload

For 
This commit is contained in:
Dan Brown 2025-01-04 21:01:28 +00:00
parent 980a684b14
commit ff6c5aaecb
No known key found for this signature in database
GPG Key ID: 46D9F943C24A2EF9

@ -445,8 +445,12 @@ export class Actions {
selectionRange = selectionRange || this.#getSelectionRange();
const newDoc = this.editor.cm.state.toText(text);
const newSelectFrom = Math.min(selectionRange.from, newDoc.length);
const scrollTop = this.editor.cm.scrollDOM.scrollTop;
this.#dispatchChange(0, this.editor.cm.state.doc.length, text, newSelectFrom);
this.focus();
window.requestAnimationFrame(() => {
this.editor.cm.scrollDOM.scrollTop = scrollTop;
});
}
/**