From 84f05fac6d1b1c309e6c4f734bb4828ef900cca4 Mon Sep 17 00:00:00 2001 From: soufiane Date: Tue, 22 Jul 2025 11:11:14 +0200 Subject: [PATCH] wip #7634 --- resources/markdowneditor/js/markdowneditor.js | 6 +++++- resources/markdowneditor/js/markdowneditor.undo.js | 5 +---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/resources/markdowneditor/js/markdowneditor.js b/resources/markdowneditor/js/markdowneditor.js index b9cc82f3b..a078c92b9 100644 --- a/resources/markdowneditor/js/markdowneditor.js +++ b/resources/markdowneditor/js/markdowneditor.js @@ -31,7 +31,6 @@ MarkdownEditor.prototype = { this.initIcons(); this.markdown(); this.changePage(); - this.undo.initState(); $(window).on('hashchange', function () { /*if ($this.maskHashEvent) { @@ -191,6 +190,11 @@ MarkdownEditor.prototype = { window.location.hash = '#' + this.currentPage; $("#markdowneditor-page-field input").val(this.currentPage); + + this.undo.initState(); + this.undo.updateIconsStates(); + + console.log(this.undo.states) }, firstPage: function () { diff --git a/resources/markdowneditor/js/markdowneditor.undo.js b/resources/markdowneditor/js/markdowneditor.undo.js index 0d0767461..4e0e70f0c 100644 --- a/resources/markdowneditor/js/markdowneditor.undo.js +++ b/resources/markdowneditor/js/markdowneditor.undo.js @@ -56,7 +56,6 @@ MarkdowneditorUndo.prototype = { return this._states().undo; }, - pushState: function () { if (this.ignoreStatesChanges) { console.log('ignore states changes'); @@ -65,9 +64,7 @@ MarkdowneditorUndo.prototype = { let index = this.indexes[this.markdowneditor.getCurrentPage()]; if (index === 0) { - this.states[this.markdowneditor.getCurrentPage()] = [ - this.markdowneditor.contentMarkdown - ]; + this.states[this.markdowneditor.getCurrentPage()] = []; } let cs = this.markdowneditor.editor.getMarkdown(); -- 2.39.5