From bd0d00b80db2a5f5e6767c43795d0dd9c906e76e Mon Sep 17 00:00:00 2001 From: Nicolas Bayet Date: Wed, 25 Jan 2023 12:05:29 +0000 Subject: [PATCH] [FIX] web_editor: make only one step when creating a link Before this commit, creating a link through the link tool made two steps instead of one. task-3147819 closes odoo/odoo#113135 X-original-commit: d967c21b6abdccd45f3c767925de29e874497dd4 Signed-off-by: David Monjoie (dmo) --- addons/web_editor/static/src/js/wysiwyg/wysiwyg.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/addons/web_editor/static/src/js/wysiwyg/wysiwyg.js b/addons/web_editor/static/src/js/wysiwyg/wysiwyg.js index c57ad350e34..95b28aee882 100644 --- a/addons/web_editor/static/src/js/wysiwyg/wysiwyg.js +++ b/addons/web_editor/static/src/js/wysiwyg/wysiwyg.js @@ -1217,6 +1217,7 @@ const Wysiwyg = Widget.extend({ } } else { const historyStepIndex = this.odooEditor.historySize() - 1; + this.odooEditor.historyPauseSteps(); let { link } = Link.getOrCreateLink({ containerNode: this.odooEditor.editable, startNode: options.link, @@ -1241,6 +1242,7 @@ const Wysiwyg = Widget.extend({ data.rel = 'ugc'; } linkWidget.applyLinkToDom(data); + this.odooEditor.historyUnpauseSteps(); this.odooEditor.historyStep(); link = linkWidget.$link[0]; this.odooEditor.setContenteditableLink(linkWidget.$link[0]); @@ -1255,6 +1257,7 @@ const Wysiwyg = Widget.extend({ Promise.resolve().then(() => link.focus()); }); linkDialog.on('closed', this, function () { + this.odooEditor.historyUnpauseSteps(); // If the linkDialog content has been saved // the previous selection in not relevant anymore. if (linkDialog.destroyAction !== 'save') {