diff options
| author | Goffin Simon <sig@odoo.com> | 2015-09-30 12:35:34 +0200 |
|---|---|---|
| committer | Goffin Simon <sig@odoo.com> | 2015-09-30 21:25:17 +0200 |
| commit | e9f1ee4d4a49c383040007ce42e8a6bc2bed9c41 (patch) | |
| tree | df97286d4e7fb5d738a63e539300dfd7ad8f5d71 /addons | |
| parent | 99ccb7f384c4a542ca29962046787f22112a8a25 (diff) | |
[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
Diffstat (limited to 'addons')
| -rw-r--r-- | addons/website/static/src/js/website.editor.js | 37 | ||||
| -rw-r--r-- | addons/website_links/models/website_links.py | 2 |
2 files changed, 16 insertions, 23 deletions
diff --git a/addons/website/static/src/js/website.editor.js b/addons/website/static/src/js/website.editor.js index e89266d6cf3..409ec0b3850 100644 --- a/addons/website/static/src/js/website.editor.js +++ b/addons/website/static/src/js/website.editor.js @@ -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(); }, diff --git a/addons/website_links/models/website_links.py b/addons/website_links/models/website_links.py index 99148d1ae71..b691970d907 100644 --- a/addons/website_links/models/website_links.py +++ b/addons/website_links/models/website_links.py @@ -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'): |
