summaryrefslogtreecommitdiff
path: root/addons/website/static/src/js/website.editor.js
diff options
context:
space:
mode:
authorFabien Meghazi <fme@openerp.com>2013-12-18 18:39:15 +0100
committerFabien Meghazi <fme@openerp.com>2013-12-18 18:39:15 +0100
commit9abcc28884688bd251c5a9de77b3afda11dcec90 (patch)
tree7c36a5a4d2f35b8115956505173e73d6109a0a87 /addons/website/static/src/js/website.editor.js
parent2381c444413593de969900b41a6e4be56e8c17b3 (diff)
[IMP] Set EditorBar height programmatically
bzr revid: fme@openerp.com-20131218173915-ds5jeyfypbaefrqf
Diffstat (limited to 'addons/website/static/src/js/website.editor.js')
-rw-r--r--addons/website/static/src/js/website.editor.js21
1 files changed, 17 insertions, 4 deletions
diff --git a/addons/website/static/src/js/website.editor.js b/addons/website/static/src/js/website.editor.js
index c7c5620c9a4..661c6d80a5f 100644
--- a/addons/website/static/src/js/website.editor.js
+++ b/addons/website/static/src/js/website.editor.js
@@ -374,7 +374,6 @@
editor.edit();
}
});
- $body.css('padding-top', '50px'); // Not working properly: editor.$el.outerHeight());
};
/* ----- TOP EDITOR BAR FOR ADMIN ---- */
@@ -423,7 +422,7 @@
},
start: function() {
var self = this;
-
+ this.height = null;
this.saving_mutex = new openerp.Mutex();
this.$('#website-top-edit').hide();
@@ -443,12 +442,26 @@
this.rte.on('rte:ready', this, function () {
self.setup_hover_buttons();
self.trigger('rte:ready');
+ self.check_height();
});
+ $(window).on('resize', _.debounce(this.check_height.bind(this), 50));
+ this.check_height();
+
return $.when(
this._super.apply(this, arguments),
this.rte.appendTo(this.$('#website-top-edit .nav.pull-right'))
- );
+ ).then(function () {
+ self.check_height();
+ });
+ },
+ check_height: function () {
+ var editor_height = this.$el.outerHeight();
+ if (this.height != editor_height) {
+ this.height = editor_height;
+ $(document.body).css('padding-top', this.height);
+ this.trigger('resize', this.height);
+ }
},
edit: function () {
this.$buttons.edit.prop('disabled', true);
@@ -456,7 +469,7 @@
this.$('#website-top-edit').show();
$('.css_non_editable_mode_hidden').removeClass("css_non_editable_mode_hidden");
- this.rte.start_edition();
+ this.rte.start_edition().then(this.check_height.bind(this));
},
rte_changed: function () {
this.$buttons.save.prop('disabled', false);