this.save = new MarkdowneditorSave(this);
this.versions = new MarkdowneditorVersions(this);
this.open = false
+ this.savedScroll = null;
const $this = this
this.initIcons();
this.markdown();
this.changePage();
+ this.editor.addHook('afterPreviewRender', () => {
+ if (this.savedScroll !== undefined) {
+ $(".toastui-editor-md-preview").scrollTop(this.savedScroll);
+ this.savedScroll = undefined;
+ }
+ });
$(window).on('hashchange', function () {
/*if ($this.maskHashEvent) {
if(this.undo.states[this.getCurrentPage()] !== undefined) {
const state = this.undo.states[this.getCurrentPage()]
const lastKey = state.length - 1;
- this.editor.setMarkdown(state[lastKey])
+ this.editor.setMarkdown(state[lastKey],false)
this.editor.moveCursorToStart(true)
}else {
this.contentMarkdown = MARKDOWN_DATA[this.currentPage] ?? ''
- this.editor.setMarkdown(this.contentMarkdown)
+ this.editor.setMarkdown(this.contentMarkdown, false)
this.editor.moveCursorToStart(true)
}
},
this.editor.getMarkdown();
},
- setCurrentState: function (state,scroll) {
- MARKDOWN_DATA[this.currentPage] = state
- const editorElement = $(".toastui-editor-md-preview")[0];
- const scrollTop = editorElement.scrollTop;
- this.editor.moveCursorToEnd(false);
+ setCurrentState: function (state) {
+ MARKDOWN_DATA[this.currentPage] = state;
+ let scroll = this.editor.getScrollTop();
this.editor.setMarkdown(state, false);
- this.editor.moveCursorToEnd(false);
- this.editor.getCurrentModeEditor().blur();
+ this.savedScroll = $(".toastui-editor-md-preview").scrollTop();
+ this.editor.setScrollTop(scroll);
//this.editor.moveCursorToStart(true)
},