summaryrefslogtreecommitdiff
path: root/addons/website/static/src/js/website.editor.js
diff options
context:
space:
mode:
authorXavier Morel <xmo@openerp.com>2014-01-21 16:13:10 +0100
committerXavier Morel <xmo@openerp.com>2014-01-21 16:13:10 +0100
commitc35ac33cf1c1ed5b119b4de6c03b9d3c41b54278 (patch)
tree942fc2ffc85790ce26fc07586dc13b37003c356e /addons/website/static/src/js/website.editor.js
parentbf262a338e12d1905f42cfd013116d5d1cedd0ef (diff)
[IMP] don't lose link label/text if crap element with no href
bzr revid: xmo@openerp.com-20140121151310-va8e20avgvzy0anz
Diffstat (limited to 'addons/website/static/src/js/website.editor.js')
-rw-r--r--addons/website/static/src/js/website.editor.js14
1 files changed, 8 insertions, 6 deletions
diff --git a/addons/website/static/src/js/website.editor.js b/addons/website/static/src/js/website.editor.js
index d00cdd30f25..f5a1c845f28 100644
--- a/addons/website/static/src/js/website.editor.js
+++ b/addons/website/static/src/js/website.editor.js
@@ -1087,15 +1087,20 @@
bind_data: function (text, href, new_window) {
href = href || this.element && (this.element.data( 'cke-saved-href')
|| this.element.getAttribute('href'));
- if (!href) { return; }
if (new_window === undefined) {
- new_window = this.element.getAttribute('target') === '_blank';
+ new_window = this.element
+ ? this.element.getAttribute('target') === '_blank'
+ : false;
}
if (text === undefined) {
- text = this.element.getText();
+ text = this.element ? this.element.getText() : '';
}
+ this.$('input#link-text').val(text);
+ this.$('input.window-new').prop('checked', new_window);
+
+ if (!href) { return; }
var match, $control;
if ((match = /mailto:(.+)/.exec(href))) {
$control = this.$('input.email-address').val(match[1]);
@@ -1105,9 +1110,6 @@
}
this.changed($control);
-
- this.$('input#link-text').val(text);
- this.$('input.window-new').prop('checked', new_window);
},
changed: function ($e) {
this.$('.url-source').filter(':input').not($e).val('')