From b6cac9e9bc12d381b1ec05d3ef225247eec39611 Mon Sep 17 00:00:00 2001 From: soufiane Date: Fri, 25 Jul 2025 16:01:33 +0200 Subject: [PATCH] wip #7634 --- resources/markdowneditor/js/markdowneditor.js | 13 ++++++++----- .../fluidbook_publication/markdown_editor.blade.php | 2 -- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/resources/markdowneditor/js/markdowneditor.js b/resources/markdowneditor/js/markdowneditor.js index a46c6147f..a5bcb5389 100644 --- a/resources/markdowneditor/js/markdowneditor.js +++ b/resources/markdowneditor/js/markdowneditor.js @@ -174,6 +174,8 @@ MarkdownEditor.prototype = { el: document.querySelector('#editor'), initialEditType: 'wysiwyg', previewStyle: 'vertical', + cursorToEnd: false, + autofocus: false, toolbarItems: [ ['heading', 'bold', 'italic'], ['hr', 'quote'], @@ -188,11 +190,12 @@ MarkdownEditor.prototype = { setCurrentState: function (state,scroll) { MARKDOWN_DATA[this.currentPage] = state - this.editor.reset() - this.editor.insertText(state) - this.editor.blur() - - this.editor.setScrollTop(20) + const editorElement = $(".toastui-editor-md-preview")[0]; + const scrollTop = editorElement.scrollTop; + this.editor.moveCursorToEnd(false); + this.editor.setMarkdown(state, false); + this.editor.moveCursorToEnd(false); + this.editor.getCurrentModeEditor().blur(); //this.editor.moveCursorToStart(true) }, diff --git a/resources/views/fluidbook_publication/markdown_editor.blade.php b/resources/views/fluidbook_publication/markdown_editor.blade.php index 284f03fc6..0091bdd39 100644 --- a/resources/views/fluidbook_publication/markdown_editor.blade.php +++ b/resources/views/fluidbook_publication/markdown_editor.blade.php @@ -74,7 +74,6 @@
@@ -132,7 +131,6 @@ var TRANSLATIONS = @json($translations); var FLUIDBOOK_DATA = @json($fbdata); var MARKDOWN_DATA = @json($contents); - console.log(MARKDOWN_DATA) -- 2.39.5