I have created a new module ("webeditor_custom") to customize Odoo v13 Web editor Top menu to add custom font-sizes in the existing menu items.
The files in my module "webeditor_custom" are :
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<template id="summernote_cust" name="My summernote assets" inherit_id="web_editor.summernote">
<xpath expr="//script[last()]" position="after">
<script type="text/javascript" src="/webeditor_custom/static/src/js/summernote_cust.js"></script>
</xpath>
</template>
</odoo>
odoo.define('web_editor.summernote_cust', 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;
options.fontSizes = [_t('Default'), 8, 9, 10, 11, 12, 13, 14, 16, 18, 21, 24, 28, 32, 36, 42, 49, 56, 63];
return $.summernote;
});
{
"name": "Web editor custom",
"summary": "Add font-sizes to the top-menu of the web editor",
"version": "13.0.2.0.1",
"installable": True,
"depends": ["web_editor"],
"data": ["templates/assets.xml"],
}
After installing my module, i get this error (popup) displayed on the first load of my homepage:
"Error: Service web_editor.summernote_cust already defined"
Thank you if you have a way to deal with it (summernote on odoo v13) or a workaround !
Try to add your script to the assets_wysiwyg
bundle, so it will be added after all the summernote scripts
Example:
<template id="summernote_cust" name="My summernote assets" inherit_id="web_editor.assets_wysiwyg">
<xpath expr="//script[last()]" position="after">
<script type="text/javascript" src="/webeditor_custom/static/src/js/summernote_cust.js"></script>
</xpath>
</template>