I am trying to tweak the odoo wysiwyg web_editor in Odoo 15, just adding a few font sizes as an example. But it does not seem to work.
What i have tried: I created a module to isolate the problem:
https://github.com/jwaes/jt_webeditor_extras
Manifest:
'assets' : {
'web.assets_qweb': [
'jt_webeditor_extras/static/src/xml/editor.xml',
],
'website.assets_wysiwyg': [
'jt_webeditor_extras/static/src/js/editor.js',
],
xml:
<!-- fiddling with https://github.com/odoo/odoo/blob/15.0/addons/web_editor/static/src/xml/editor.xml -->
<t t-extend="web_editor.toolbar">
<t t-jquery="#font-size ul li:nth-child(7)" t-operation="after">
<li>
<a class="dropdown-item" href="#" data-call="setFontSize" data-arg1="16px">16</a>
</li>
</t>
<t t-jquery="#font-size ul" t-operation="append">
<li>
<a class="dropdown-item" href="#" data-call="setFontSize" data-arg1="99px">99</a>
</li>
</t>
<!-- perhaps my jquery was wrong... so trying with a drastic one -->
<t t-jquery="#font" t-operation="replace" />
</t>
js:
odoo.define('jt_webeditor_extras.toolbar_extras', function (require) {
'use strict';
const weToolbar = require('web_editor.toolbar');
weToolbar.include({
xmlDependencies: (weToolbar.prototype.xmlDependencies || []).concat(
['/jt_webeditor_extras/static/src/xml/editor.xml']),
});
console.log(weToolbar.prototype.xmlDependencies);
});
The javascript console message was logged. so it was loaded. There is a http call to the template xml from the frontend. But the resulting UI is not altered.
Any idea what i am doing wrong ?
Remove the odoo tag and add web_editor
to module depends
entry.