I am using Odoo 17.
I have been in contact with Odoo support about this problem but apparently the "problem" is on purpose so i have to override the functionality with my own.
Last week I discovered that the URL on tel links depend on the format of the label which i think is very dumb since i want the freedom to write the phone number freely without thinking about the validity of the url.
I have found my way to the "deduceURLfromText" function which is written in this file:
\odoo\addons\web_editor\static\src\js\editor\odoo-editor\src\utils\sanitize.js
Function:
export function deduceURLfromText(text, link) {
const label = text.replace(ZERO_WIDTH_CHARS_REGEX, "").trim();
// Check first for e-mail.
let match = label.match(EMAIL_REGEX);
if (match) {
return match[1] ? match[0] : "mailto:" + match[0];
}
// Check for http link.
match = label.match(URL_REGEX);
if (match && match[0] === label) {
const currentHttpProtocol = (link?.href.match(/^http(s)?:\/\//gi) || [])[0];
if (match[2]) {
return match[0];
} else if (currentHttpProtocol) {
// Avoid converting a http link to https.
return currentHttpProtocol + match[0];
} else {
return "http://" + match[0];
}
}
// Check for telephone url.
match = label.match(PHONE_REGEX);
if (match) {
return match[1] ? match[0] : "tel://" + match[0];
}
return null;
}
How can i make my own module that overrides the functionality that makes the url depend on the label?
please give a clear step by step example