diff options
| author | Xavier Morel <xmo@openerp.com> | 2014-03-13 10:32:02 +0100 |
|---|---|---|
| committer | Xavier Morel <xmo@openerp.com> | 2014-03-13 10:32:02 +0100 |
| commit | 0308b7968c85798c382553925ea92e683c7ad86d (patch) | |
| tree | c2ec94c3bd33cfbfcff7e401bd71bc643131976c /addons/website/static/src/js/website.editor.js | |
| parent | 584a88294ff5d4752c40aede755650ac825c24f1 (diff) | |
[IMP] don't allow HTML formatting in non-HTML fields
bzr revid: xmo@openerp.com-20140313093202-02s734ucabvkckli
Diffstat (limited to 'addons/website/static/src/js/website.editor.js')
| -rw-r--r-- | addons/website/static/src/js/website.editor.js | 45 |
1 files changed, 32 insertions, 13 deletions
diff --git a/addons/website/static/src/js/website.editor.js b/addons/website/static/src/js/website.editor.js index 3965e1c3d1a..06dd48fa68c 100644 --- a/addons/website/static/src/js/website.editor.js +++ b/addons/website/static/src/js/website.editor.js @@ -346,14 +346,40 @@ requires: 'widget', init: function (editor) { + var specials = { + // Can't find the correct ACL rule to only allow img tags + image: { content: '*' }, + html: { text: '*' }, + monetary: { + text: { + selector: 'span.oe_currency_value', + allowedContent: { } + } + } + }; + _(specials).each(function (editable, type) { + editor.widgets.add(type, { + draggable: false, + editables: editable, + upcast: function (el) { + return el.attributes['data-oe-type'] === type; + + } + }); + }); editor.widgets.add('oeref', { - editables: { text: '*' }, draggable: false, - + editables: { + text: { + selector: '*', + allowedContent: { } + }, + }, upcast: function (el) { - var matches = el.attributes['data-oe-type'] && el.attributes['data-oe-type'] !== 'monetary'; - if (!matches) { return false; } - + var type = el.attributes['data-oe-type']; + if (!type || (type in specials)) { + return false; + } if (el.attributes['data-oe-original']) { while (el.children.length) { el.children[0].remove(); @@ -363,16 +389,9 @@ )); } return true; - }, - }); - editor.widgets.add('monetary', { - editables: { text: 'span.oe_currency_value' }, - draggable: false, - - upcast: function (el) { - return el.attributes['data-oe-type'] === 'monetary'; } }); + editor.widgets.add('icons', { draggable: false, |
