[FIX] add event handlers on non-rte contenteditables to trigger enabling of save button, fixup filters

bzr revid: xmo@openerp.com-20130730150955-ttqovqamexqtd8r9
This commit is contained in:
Xavier Morel
2013-07-30 17:09:55 +02:00
parent 2a0dc6af7a
commit 4d41a7f389
+16 -5
View File
@@ -42,11 +42,22 @@ instance.website.EditorBar = instance.web.Widget.extend({
.add(this.$buttons.save)
.parent().show();
// TODO: span edition changing edition state (save button)
this.rte.start_edition(
$('[data-oe-model]')
.not('link, script')
.prop('contentEditable', true)
.addClass('oe_editable'));
var $editables = $('[data-oe-model]')
.not('link, script').prop('contentEditable', true)
.addClass('oe_editable');
var $rte_ables = $editables.filter('div, p, :not([data-oe-type])');
var $raw_editables = $editables.not($rte_ables);
this.rte.start_edition($rte_ables);
$raw_editables.on('keydown keypress cut paste', function (e) {
var $target = $(e.target);
if ($target.hasClass('oe_dirty')) {
return;
}
$target.addClass('oe_dirty');
this.$buttons.save.prop('disabled', false);
}.bind(this));
},
rte_changed: function () {
this.$buttons.save.prop('disabled', false);