Hello,
I don't find this one anywhere, must be some mean to add a custom font size to the HTML widget web editor. Default sizes are 'Default, 8, 9, 10, 11, 12, 14, 18', what if I want size 16 ?.
I believe the answer to this question would give me the answer to the next which is how to customize styles of the web editor.
Thanks for your help
Regards
V.
To do so, you'll have to build a module which inherits the Odoo web editor which is Summernote.
1- In your module Views folder, add a resources.xml file :
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<template id="summernote" name="My summernote assets" inherit_id="web_editor.assets_editor">
<xpath expr="//script[last()]" position="after">
<script type="text/javascript" src="/ModuleName/static/src/js/summernote_overrides.js"></script>
</xpath>
</template>
</odoo>
2- In your module /static/src/js/ directory, add a summernote_overrides.js file :
odoo.define('web_editor.summernote_override', function (require) {
'use strict';
var core = require('web.core');
var editor = require('web_editor.summernote');
require('summernote/summernote'); // wait that summernote is loaded
var _t = core._t;
var options = $.summernote.options;
// disable some editor features
// XXX: this is not working, unfortunately but `options.styleTags` below is. weird :S
options.toolbar = [
['font', ['bold', 'italic', 'underline', 'superscript', 'clear']],
['para', ['ul', 'ol', 'paragraph']],
['height', ['height']],
['insert', ['link', 'picture', 'hr']],
['view', ['fullscreen', 'codeview']],
['help', ['help']],
['height', ['height']]
];
// limit style tags
options.styleTags = ['p', 'blockquote'];
options.fontSizes = [_t('Default'), 8, 9, 10, 11, 12, 13, 14, 16, 18, 24, 36, 48, 62];
return $.summernote;
});
3 - reference you first file in your __manifest__.py file so that it gets loaded.
'data': [
'views/blabla_view.xml',
'views/another_view.xml',
'views/resources.xml',
],
4 - Update your module in the Applications section.
Unfortunately the toolbar section doesn't work, only Styles et Font size are ok.
If anyone knows the solution that would be greatly appreciated.
V.