[FIX] website: editor: ignore spurious changes for editable content
authorOlivier Dony <odo@openerp.com>
Thu, 2 Oct 2014 08:13:29 +0000 (10:13 +0200)
committerOlivier Dony <odo@openerp.com>
Thu, 2 Oct 2014 08:27:30 +0000 (10:27 +0200)
Changes to contentEditable or attributeEditable attributes
should not cause the corresponding section to be marked
as dirty (oe_dirty). This would otherwise cause an extra
editor save() for those, wrongly marking untouched
templates as `noupdate`, and possibly triggering access
right errors.

addons/website/static/src/js/website.editor.js

index 82888c5..6d151dc 100644 (file)
                     return false;
                 }
                 switch(m.type) {
-                case 'attributes': // ignore .cke_focus being added or removed
-                    // ignore id modification
-                    if (m.attributeName === 'id') { return false; }
+                case 'attributes':
+                    // ignore special attributes and .cke_focus class being added or removed
+                    var ignored_attrs = ['id', 'contenteditable', 'attributeeditable']
+                    if (_.contains(ignored_attrs, m.attributeName)) { return false; }
                     // if attribute is not a class, can't be .cke_focus change
                     if (m.attributeName !== 'class') { return true; }