NOW MANAGED ON CODEBERG
Markdown Editor: Fixed scroll jump on image upload
Dan Brownff6c5aaecbd4
diff --git a/resources/js/markdown/actions.js b/resources/js/markdown/actions.jsindex 86e255328..e99bbf3e1 100644--- a/resources/js/markdown/actions.js+++ b/resources/js/markdown/actions.js@@ -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;+ });}/**