diff options
Diffstat (limited to 'addons/web_editor')
| -rw-r--r-- | addons/web_editor/static/src/js/editor/summernote.js | 7 | ||||
| -rw-r--r-- | addons/web_editor/static/src/js/wysiwyg/root.js | 22 |
2 files changed, 26 insertions, 3 deletions
diff --git a/addons/web_editor/static/src/js/editor/summernote.js b/addons/web_editor/static/src/js/editor/summernote.js index 3d2c4c205d4..4228d353d1a 100644 --- a/addons/web_editor/static/src/js/editor/summernote.js +++ b/addons/web_editor/static/src/js/editor/summernote.js @@ -3,6 +3,7 @@ odoo.define('web_editor.summernote', function (require) { var core = require('web.core'); require('summernote/summernote'); // wait that summernote is loaded +var weDefaultOptions = require('web_editor.wysiwyg.default_options'); var _t = core._t; @@ -1044,7 +1045,7 @@ options.keyMap.mac['ESCAPE'] = 'cancel'; options.keyMap.mac['UP'] = 'up'; options.keyMap.mac['DOWN'] = 'down'; -options.styleTags = ['p', 'pre', 'small', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'blockquote']; +options.styleTags = weDefaultOptions.styleTags; $.summernote.pluginEvents.insertTable = function (event, editor, layoutInfo, sDim) { var $editable = layoutInfo.editable(); @@ -2083,7 +2084,7 @@ eventHandler.modules.editor.currentStyle = function (target) { return styleInfo; }; -options.fontSizes = [_t('Default'), 8, 9, 10, 11, 12, 14, 18, 24, 36, 48, 62]; +options.fontSizes = weDefaultOptions.fontSizes; $.summernote.pluginEvents.applyFont = function (event, editor, layoutInfo, color, bgcolor, size) { var r = range.create(); if (!r) return; @@ -2486,7 +2487,7 @@ function mouseDownChecklist (e) { $lis.addClass('o_checked'); } while ($lis.length); } -}; +} var fn_attach = eventHandler.attach; eventHandler.attach = function (oLayoutInfo, options) { diff --git a/addons/web_editor/static/src/js/wysiwyg/root.js b/addons/web_editor/static/src/js/wysiwyg/root.js index c2b3d703733..e5c225e646d 100644 --- a/addons/web_editor/static/src/js/wysiwyg/root.js +++ b/addons/web_editor/static/src/js/wysiwyg/root.js @@ -60,3 +60,25 @@ var WysiwygRoot = Widget.extend({ return WysiwygRoot; }); + +odoo.define('web_editor.wysiwyg.default_options', function (require) { +'use strict'; + +/** + * TODO this should be refactored to be done another way, same as the 'root' + * module that should be done another way. + * + * This allows to have access to default options that are used in the summernote + * editor so that they can be tweaked (instead of entirely replaced) when using + * the editor on an editable content. + */ + +var core = require('web.core'); + +var _lt = core._lt; + +return { + styleTags: ['p', 'pre', 'small', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'blockquote'], + fontSizes: [_lt('Default'), 8, 9, 10, 11, 12, 14, 18, 24, 36, 48, 62], +}; +}); |
