Skip to Content
Menu
This question has been flagged

In my odoo module, I want to add more font size options when I edit a text in the website editor.

I have tried the following template:

'''<?xml version="1.0" encoding="utf-8"?>

<templates id="template" xml:space="preserve">


    <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 li:nth-child(9)" t-operation="after">

            <li>

                <a class="dropdown-item" href="#" data-call="setFontSize" data-arg1="20px">20</a>

            </li>

            <li>

                <a class="dropdown-item" href="#" data-call="setFontSize" data-arg1="22px">22</a>

            </li>           

        </t>

    </t>

</templates>'''


And the following JS:
'''odoo.define('jt_webeditor_extras.toolbar_extras', function (require) {

    'use strict';


    const Toolbar = require('web_editor.toolbar');


    Toolbar.include({

        xmlDependencies: (Toolbar.prototype.xmlDependencies || []).concat(

            ['/jt_webeditor_extras/static/src/xml/editor.xml']),

    });


});'''


Any other ideas to implement more font sizes?

Avatar
Discard
Related Posts Replies Views Activity
0
May 25
287
2
Apr 25
267
0
Apr 25
268
1
Apr 25
666
0
Mar 25
491