[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:
Goffin Simon
2015-09-30 21:25:17 +02:00
parent 99ccb7f384
commit e9f1ee4d4a
2 changed files with 16 additions and 23 deletions
+15 -22
View File
@@ -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();
},
+1 -1
View File
@@ -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'):