summaryrefslogtreecommitdiff
path: root/addons/website/static/src/js
diff options
context:
space:
mode:
Diffstat (limited to 'addons/website/static/src/js')
-rw-r--r--addons/website/static/src/js/website.editor.js20
-rw-r--r--addons/website/static/src/js/website.seo.js2
-rw-r--r--addons/website/static/src/js/website.snippets.editor.js10
-rw-r--r--addons/website/static/src/js/website.translator.js2
4 files changed, 25 insertions, 9 deletions
diff --git a/addons/website/static/src/js/website.editor.js b/addons/website/static/src/js/website.editor.js
index 205d8dde076..5ef971f98b0 100644
--- a/addons/website/static/src/js/website.editor.js
+++ b/addons/website/static/src/js/website.editor.js
@@ -1151,6 +1151,7 @@
make_link: function (url, new_window, label, classes) {
},
bind_data: function () {
+ var self = this;
var href = this.element && (this.element.data( 'cke-saved-href')
|| this.element.getAttribute('href'));
var new_window = this.element
@@ -1158,8 +1159,13 @@
: false;
var text = this.element ? this.element.getText() : '';
if (!text.length) {
- var selection = this.editor.getSelection();
- text = selection.getSelectedText();
+ if (this.editor) {
+ text = this.editor.getSelection().getSelectedText();
+ } else {
+ text = this.data.name;
+ href = this.data.url;
+ new_window = this.data.new_window;
+ }
}
this.$('input#link-text').val(text);
@@ -1180,8 +1186,14 @@
this.$('input.email-address').val(match[1]).change();
}
if (href && !$control) {
- this.$('input.url').val(href).change();
- this.$('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();
+ }
+ });
}
this.preview();
},
diff --git a/addons/website/static/src/js/website.seo.js b/addons/website/static/src/js/website.seo.js
index 8d28237f924..7e32a780bf1 100644
--- a/addons/website/static/src/js/website.seo.js
+++ b/addons/website/static/src/js/website.seo.js
@@ -86,7 +86,7 @@
}
});
}
- $.getJSON("http://suggest.hp.af.cm/suggest/"+encodeURIComponent(this.root + " "), addSuggestions);
+ $.getJSON("/website/seo_suggest/" + encodeURIComponent(this.root + " "), addSuggestions);
},
});
diff --git a/addons/website/static/src/js/website.snippets.editor.js b/addons/website/static/src/js/website.snippets.editor.js
index e734d361da9..116f55713ec 100644
--- a/addons/website/static/src/js/website.snippets.editor.js
+++ b/addons/website/static/src/js/website.snippets.editor.js
@@ -247,13 +247,14 @@
var self = this;
var snipped_event_flag;
self.$wrapwrap.on('click', function (event) {
- if (snipped_event_flag || !event.srcElement) {
+ var srcElement = event.srcElement || (event.originalEvent && (event.originalEvent.originalTarget || event.originalEvent.target));
+ if (snipped_event_flag || !srcElement) {
return;
}
snipped_event_flag = true;
setTimeout(function () {snipped_event_flag = false;}, 0);
- var $target = $(event.srcElement);
+ var $target = $(srcElement);
if ($target.parents(".oe_overlay").length) {
return;
@@ -644,7 +645,7 @@
var styles = this.$target.data("snippet-option-ids") || {};
styles[option_id] = this;
this.$target.data("snippet-option-ids", styles);
- this.$overlay = this.$target.data('overlay');
+ this.$overlay = this.$target.data('overlay') || $('<div>');
this.option= option_id;
this.$el = option.$el.find(">li").clone();
this.data = option.$el.data();
@@ -1505,6 +1506,9 @@
new website.editor.MediaDialog(self, self.element).appendTo(document.body);
self.BuildingBlock.make_active(false);
}
+ setTimeout(function () {
+ self.$target.find(".css_editable_mode_display").removeAttr("_moz_abspos");
+ },0);
},
});
diff --git a/addons/website/static/src/js/website.translator.js b/addons/website/static/src/js/website.translator.js
index 674b2f727b9..a1800799c0c 100644
--- a/addons/website/static/src/js/website.translator.js
+++ b/addons/website/static/src/js/website.translator.js
@@ -130,7 +130,7 @@
node.setAttribute('data-oe-translation-view-id', view_id);
var content = node.childNodes[0].data.trim();
var trans = this.translations.filter(function (t) {
- return t.res_id === view_id && t.value === content;
+ return t.res_id === view_id && t.value.trim() === content;
});
if (trans.length) {
node.setAttribute('data-oe-translation-id', trans[0].id);