[FIX] web_editor: don't prepend http to ${..} link

In mail template a link with reference such as:

  ${object.user_id.signup_url}

are often used.

These are template directives that are replaced when the mail is saved,
so when editing in the editor and they are prefixed by "http://" this
breaks the link which is not wanted.

Now link beginning with `${` are not prefixed anymore to prevent
shooting oneself in the foot.

opw-1906695
closes #28522
This commit is contained in:
Nicolas Lempereur
2018-11-09 10:45:17 +00:00
parent 055e1b8324
commit 726bc301cf
@@ -2286,7 +2286,8 @@ options.onCreateLink = function (sLinkUrl) {
// pass
} else if (sLinkUrl.indexOf('@') !== -1 && sLinkUrl.indexOf(':') === -1) {
sLinkUrl = 'mailto:' + sLinkUrl;
} else if (sLinkUrl.indexOf('://') === -1 && sLinkUrl.indexOf('/') !== 0 && sLinkUrl.indexOf('#') !== 0) {
} else if (sLinkUrl.indexOf('://') === -1 && sLinkUrl[0] !== '/'
&& sLinkUrl[0] !== '#' && sLinkUrl.slice(0, 2) !== '${') {
sLinkUrl = 'http://' + sLinkUrl;
}
return sLinkUrl;