summaryrefslogtreecommitdiff
path: root/addons/website/static/src/js/website.editor.js
diff options
context:
space:
mode:
authorXavier Morel <xmo@openerp.com>2014-03-12 15:19:10 +0100
committerXavier Morel <xmo@openerp.com>2014-03-12 15:19:10 +0100
commit8ad325614de9b600e73ad40a680b3fb56d1aa298 (patch)
tree2df7609664d693a67fd87a9a3231aceb5b501e06 /addons/website/static/src/js/website.editor.js
parent44523f4679bc8598faaf74d40b4be4924c0e3532 (diff)
[FIX] sprurious widgetification and editability of icon elements
* tighten widget match: don't match elements with .fa which are also "view section" roots (~ editing hosts) as the classes themselves out not be editable and the result will thus be odd * correspondingly, only associate the icon "change" button to instances of the ``icons`` widget, other elements bearing ``.fa`` are not editable and should be excluded. bzr revid: xmo@openerp.com-20140312141910-a2apy22qj4wwxsne
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, 18 insertions, 3 deletions
diff --git a/addons/website/static/src/js/website.editor.js b/addons/website/static/src/js/website.editor.js
index a5cf89b3a4e..3965e1c3d1a 100644
--- a/addons/website/static/src/js/website.editor.js
+++ b/addons/website/static/src/js/website.editor.js
@@ -383,7 +383,11 @@
});
},
upcast: function (el) {
- return el.hasClass('fa');
+ return el.hasClass('fa')
+ // ignore ir.ui.view (other data-oe-model should
+ // already have been matched by oeref and
+ // monetary?
+ && !el.attributes['data-oe-model'];
}
});
}
@@ -645,6 +649,11 @@
previous = null;
}, 'btn-sm');
+ function is_icons_widget(element) {
+ var w = editor.widgets.getByElement(element);
+ return w && w.name === 'icons';
+ }
+
// previous is the state of the button-trigger: it's the
// currently-ish hovered element which can trigger a button showing.
// -ish, because when moving to the button itself ``previous`` is
@@ -654,9 +663,15 @@
// Back from edit button -> ignore
if (previous && previous === this) { return; }
+ // hover button should appear for "editable" links and images
+ // (img and a nodes whose *attributes* are editable, they
+ // can not be "editing hosts") *or* for non-editing-host
+ // elements bearing an ``fa`` class. These should have been
+ // made into CKE widgets which are editing hosts by
+ // definition, so instead check if the element has been
+ // converted/upcasted to an fa widget
var selected = new CKEDITOR.dom.element(this);
- // FIXME: fa nodes may not be editable widgets (?)
- if (!is_editable_node(selected) && !selected.hasClass('fa')) {
+ if (!(is_editable_node(selected) || is_icons_widget(selected))) {
return;
}