콘텐츠로 건너뛰기
메뉴
커뮤니티에 참여하려면 회원 가입을 하시기 바랍니다.
신고된 질문입니다

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

아바타
취소
관련 게시물 답글 화면 활동
0
10월 24
1257
0
10월 24
1518
2
7월 25
4282
1
10월 23
3538
1
5월 24
4558