[IMP] web_editor: omit protocol in URL input field
Before this commit, when an existing link was edited with the LinkTools or LinkDialog, the URL input field omitted the "mailto:" part of the URL for email links, but displayed the protocol/scheme for http(s) links and phone numbers (tel: or tel://). This commit standardizes the behaviour of the referred input field such that the protocol/scheme for http(s), mailto and tel URLs are omitted, in order to have a cleaner UI. task-3516854 Part-of: odoo/odoo#136487
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user