diff options
| author | Christophe Simonis <chs@odoo.com> | 2017-03-17 17:06:32 +0100 |
|---|---|---|
| committer | Christophe Simonis <chs@odoo.com> | 2017-03-17 17:06:32 +0100 |
| commit | aefdf96c25973778f3a00c06b107c30e440b0d94 (patch) | |
| tree | ab2d44581d9e61dd51801167e6ff17f9e276580c /addons/web_editor | |
| parent | 22e7b6befb77005d1b1945977191ca11739f38fa (diff) | |
| parent | af64780a2d8df2ec5ec91bab4bc0cc0a7f2c050a (diff) | |
[MERGE] forward port branch 9.0 up to af64780a2d8
Diffstat (limited to 'addons/web_editor')
| -rw-r--r-- | addons/web_editor/static/src/js/transcoder.js | 36 | ||||
| -rw-r--r-- | addons/web_editor/static/src/xml/backend.xml | 8 |
2 files changed, 26 insertions, 18 deletions
diff --git a/addons/web_editor/static/src/js/transcoder.js b/addons/web_editor/static/src/js/transcoder.js index 89831d35d50..e91c365a011 100644 --- a/addons/web_editor/static/src/js/transcoder.js +++ b/addons/web_editor/static/src/js/transcoder.js @@ -99,20 +99,28 @@ var getMatchedCSSRules = function (a) { if (style.display === 'block') { delete style.display; } - if (style['margin-top']) { - style.margin = (style['margin-top'] || 0) + ' ' + (style['margin-right'] || 0) + ' ' + (style['margin-bottom'] || 0) + ' ' + (style['margin-left'] || 0); - delete style['margin-top']; - delete style['margin-right']; - delete style['margin-bottom']; - delete style['margin-left']; - } - if (style['padding-top']) { - style.padding = (style['padding-top'] || 0) + ' ' + (style['padding-right'] || 0) + ' ' + (style['padding-bottom'] || 0) + ' ' + (style['padding-left'] || 0); - delete style['padding-top']; - delete style['padding-right']; - delete style['padding-bottom']; - delete style['padding-left']; - } + + _.each(['margin', 'padding'], function(p) { + if (style[p+'-top'] || style[p+'-right'] || style[p+'-bottom'] || style[p+'-left']) { + if (style[p+'-top'] === style[p+'-right'] && style[p+'-top'] === style[p+'-bottom'] && style[p+'-top'] === style[p+'-left']) { + // keep => property: [top/right/bottom/left value]; + style[p] = style[p+'-top']; + } + else { + // keep => property: [top value] [right value] [bottom value] [left value]; + style[p] = (style[p+'-top'] || 0) + ' ' + (style[p+'-right'] || 0) + ' ' + (style[p+'-bottom'] || 0) + ' ' + (style[p+'-left'] || 0); + if (style[p].indexOf('inherit') !== -1 || style[p].indexOf('initial') !== -1) { + // keep => property-top: [top value]; property-right: [right value]; property-bottom: [bottom value]; property-left: [left value]; + delete style[p]; + return; + } + } + delete style[p+'-top']; + delete style[p+'-right']; + delete style[p+'-bottom']; + delete style[p+'-left']; + } + }); return a.className ? cache[a.tagName + "." +a.className] = style : style; }; diff --git a/addons/web_editor/static/src/xml/backend.xml b/addons/web_editor/static/src/xml/backend.xml index 957f38dac3c..c5b668cc01a 100644 --- a/addons/web_editor/static/src/xml/backend.xml +++ b/addons/web_editor/static/src/xml/backend.xml @@ -38,11 +38,11 @@ -webkit-border-radius: 3px; border-radius: 3px; background: white;"> + <option value="en_US" t-att-selected="'en_US' == widget.lang ? 'selected' : null"> + <t t-if="!widget.get('effective_readonly')">English (edit mode)</t> + <t t-if="widget.get('effective_readonly')">English</t> + </option> <t t-foreach="widget.languages" t-as="lang"> - <option value="en_US" t-att-selected="'en_US' == widget.lang ? 'selected' : null"> - <t t-if="!widget.get('effective_readonly')">English (edit mode)</t> - <t t-if="widget.get('effective_readonly')">English</t> - </option> <option t-att-value="lang.code" t-att-selected="lang.code == widget.lang ? 'selected' : null"><t t-esc="lang.name"/></option> </t> </select> |
