[FIX] web_editor: adapt link on input url in link tools

The link tools were made so that one needed to validate the URL they
input before it was applied to the DOM. But this was awkward, especially
when the selection was collapsed and we counted on the URL input to fill
the link's label.

We need to pause history steps however, otherwise each change will be
its own step in the history and the user will have to undo as many times
as the number of characters that were entered.

task-2921844

X-original-commit: 226c4c4032c26d3d8f622b29fb151fa8e78ba70a
Part-of: odoo/odoo#97973
Co-authored-by: Nicolas Bayet <nby@odoo.com>
Co-authored-by: Antoine Guenet <age@odoo.com>
This commit is contained in:
Antoine Guenet
2022-08-11 17:57:33 +02:00
committed by David Monjoie
co-authored by Nicolas Bayet
parent a98d10a75d
commit 720d46db4c
@@ -482,6 +482,9 @@ const Link = Widget.extend({
let isLink = value.indexOf('@') < 0;
this.$('input[name="is_new_window"]').closest('.form-group').toggleClass('d-none', !isLink);
this.$('.o_strip_domain').toggleClass('d-none', value.indexOf(window.location.origin) !== 0);
this.options.wysiwyg && this.options.wysiwyg.odooEditor.historyPauseSteps('_onURLInput');
this._adaptPreview();
this.options.wysiwyg && this.options.wysiwyg.odooEditor.historyUnpauseSteps('_onURLInput');
},
_onURLInputChange: function () {
this._adaptPreview();