[FIX] website: edit mailto link
In function bind_data of website.editor.js, either href is a mailto link or an url link but not both. The function convert_links must not convert mailto links. opw:650443
This commit is contained in:
@@ -1657,29 +1657,22 @@ define(['summernote/summernote'], function () {
|
||||
});
|
||||
}
|
||||
|
||||
var match, $control;
|
||||
if (href && (match = /mailto:(.+)/.exec(href))) {
|
||||
this.$('input.email-address').val(match[1]).change();
|
||||
}
|
||||
if (href && !$control) {
|
||||
this.page_exists(href).then(function (exist) {
|
||||
if (exist) {
|
||||
self.$('#link-page').select2('data', {'id': href, 'text': href});
|
||||
} else {
|
||||
self.$('input.url').val(href).change();
|
||||
self.$('input.window-new').closest("div").show();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
this.page_exists(href).then(function (exist) {
|
||||
if (exist) {
|
||||
self.$('#link-page').select2('data', {'id': href, 'text': href});
|
||||
} else {
|
||||
self.$('input.url').val(href).change();
|
||||
self.$('input.window-new').closest("div").show();
|
||||
var match;
|
||||
if(href){
|
||||
if (match = /mailto:(.+)/.exec(href)) {
|
||||
this.$('input.email-address').val(match[1]).change();
|
||||
}
|
||||
});
|
||||
else {
|
||||
this.page_exists(href).then(function (exist) {
|
||||
if (exist) {
|
||||
self.$('#link-page').select2('data', {'id': href, 'text': href});
|
||||
} else {
|
||||
self.$('input.url').val(href).change();
|
||||
self.$('input.window-new').closest("div").show();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
this.preview();
|
||||
},
|
||||
|
||||
@@ -12,7 +12,7 @@ from urlparse import urlparse
|
||||
|
||||
from openerp import models, fields, api, _
|
||||
|
||||
URL_REGEX = r'(\bhref=[\'"]([^\'"]+)[\'"])'
|
||||
URL_REGEX = r'(\bhref=[\'"](?!mailto:)([^\'"]+)[\'"])'
|
||||
|
||||
def VALIDATE_URL(url):
|
||||
if urlparse(url).scheme not in ('http', 'https', 'ftp', 'ftps'):
|
||||
|
||||
Reference in New Issue
Block a user