diff --git a/addons/web_editor/static/src/js/wysiwyg/widgets/link.js b/addons/web_editor/static/src/js/wysiwyg/widgets/link.js index 32a9d850d12..2d2d196d876 100644 --- a/addons/web_editor/static/src/js/wysiwyg/widgets/link.js +++ b/addons/web_editor/static/src/js/wysiwyg/widgets/link.js @@ -196,8 +196,8 @@ export class Link extends Component { */ _setUrl({ shouldFocus } = {}) { if (this.state.url) { - var match = /mailto:(.+)/.exec(this.state.url); - this.$el.find('input[name="url"]').val(match ? match[1] : this.state.url); + const protocolLessUrl = this.state.url.replace(/^(https?|mailto|tel):(\/\/)?/i, ''); + this.$el.find('input[name="url"]').val(protocolLessUrl); this._onURLInput(); this._savedURLInputOnDestroy = false; } diff --git a/addons/website/static/tests/tours/link_tools.js b/addons/website/static/tests/tours/link_tools.js index 8083f2f163a..151563f03ae 100644 --- a/addons/website/static/tests/tours/link_tools.js +++ b/addons/website/static/tests/tours/link_tools.js @@ -285,7 +285,7 @@ wTourUtils.registerWebsitePreviewTour('link_tools', { content: "Check Link tools URL input content is up-to-date", trigger: "#o_link_dialog_url_input", run() { - if (this.$anchor[0].value !== 'http://callmemaybe.com/shop') { + if (this.$anchor[0].value !== 'callmemaybe.com/shop') { throw new Error("Tour step failed"); } }