]> BookStack Code Mirror - bookstack/blobdiff - resources/js/markdown/actions.js
Tests: Updated comment test to account for new editor usage
[bookstack] / resources / js / markdown / actions.js
index 73040a57b1eb016e51abe2e80176561815befa89..e99bbf3e14fe5cb668e2e7c22782c0cf0ce44508 100644 (file)
@@ -1,4 +1,4 @@
-import * as DrawIO from '../services/drawio';
+import * as DrawIO from '../services/drawio.ts';
 
 export class Actions {
 
@@ -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;
+        });
     }
 
     /**