summaryrefslogtreecommitdiff
path: root/addons/web_editor/static/src
diff options
context:
space:
mode:
authorJason Van Malder <jvm@odoo.com>2019-12-18 07:35:55 +0000
committerJason Van Malder <jvm@odoo.com>2019-12-19 15:26:15 +0000
commitfb926fe883b0fa3a509799b173d4d9abbc7910ab (patch)
tree20f04a39418a96d29da62d88c3d90e42db8ec319 /addons/web_editor/static/src
parentc44d84600643839cea5c3528f92968942cbd3402 (diff)
[FIX] web_editor: fix mail template toolbar in debug mode
Issue - Install Mail template - Enable debug mode (normal or assets) - Create or edit a mail template - Click in the text editor The toolbar is not showing up (it does when we're not in debug mode) Cause We are doing `splice(-1, 0, ['view', ['codeview']])` on toolbar which is undefined, the method crashes and the toolbar doesn't render. Solution Checking if the toolbar is defined before doing all that logic. OPW-2151675 X-original-commit: 0e5ca50d5a8401bb3495e83691eab5c86a97a616
Diffstat (limited to 'addons/web_editor/static/src')
-rw-r--r--addons/web_editor/static/src/js/backend/field_html.js7
1 files changed, 4 insertions, 3 deletions
diff --git a/addons/web_editor/static/src/js/backend/field_html.js b/addons/web_editor/static/src/js/backend/field_html.js
index 5b98ef8e7c3..0fe35887a7b 100644
--- a/addons/web_editor/static/src/js/backend/field_html.js
+++ b/addons/web_editor/static/src/js/backend/field_html.js
@@ -200,7 +200,8 @@ var FieldHtml = basic_fields.DebouncedField.extend(TranslatableFieldMixin, {
tabsize: 0,
height: 180,
generateOptions: function (options) {
- var para = _.find(options.toolbar, function (item) {
+ var toolbar = options.toolbar || options.airPopover || {};
+ var para = _.find(toolbar, function (item) {
return item[0] === 'para';
});
if (para && para[1] && para[1].indexOf('checklist') === -1) {
@@ -208,7 +209,7 @@ var FieldHtml = basic_fields.DebouncedField.extend(TranslatableFieldMixin, {
}
if (config.isDebug()) {
options.codeview = true;
- var view = _.find(options.toolbar, function (item) {
+ var view = _.find(toolbar, function (item) {
return item[0] === 'view';
});
if (view) {
@@ -216,7 +217,7 @@ var FieldHtml = basic_fields.DebouncedField.extend(TranslatableFieldMixin, {
view[1].splice(-1, 0, 'codeview');
}
} else {
- options.toolbar.splice(-1, 0, ['view', ['codeview']]);
+ toolbar.splice(-1, 0, ['view', ['codeview']]);
}
}
options.prettifyHtml = false;