Skip to Content
Menu
You need to be registered to interact with the community.
This question has been flagged
6641 Prikazi

Hi Everyone,

How one can inherit the editor template to apply some css or modify existing css class?
 
I want to inherit "web_editor.editorbar" template of web_editor module.

- This is main/base template.

<templates id="template" xml:space="preserve">
    <!--=================-->
    <!-- Base components -->
    <!--=================-->

    <!-- Here is the sample example  -->
    <t t-name="web_editor.editorbar">
        <div id="web_editor-top-edit" class="o_css_editor">
            <div id="web_editor-toolbars"/>
            <form class="navbar-form text-muted">
                <button type="button" class="btn btn-sm btn-default" data-action="cancel"><i class="fa fa-times"/> Discard</button>
                <button type="button" class="btn btn-sm btn-primary" data-action="save"><i class="fa fa-floppy-o"/> Save</button>
            </form>
        </div>
    </t>
    
     <t>............</t>
     <t> ..........</t>
</templates>

<!-- This is what i did, replaced the italic element with span by inheriting the template. -->

<templates>
        <t t-extend="web_editor.editorbar">
            <t t-jquery=".navbar-form text-muted" t-operation="replace">
                <form class=".navbar-form text-muted">
                    <button type="button" class="btn btn-sm btn-default" data-action="cancel"><span class="fa fa-times"/> Discard </button>
                    <button type="button" class="btn btn-sm btn-primary" data-action="save"><span class="fa fa-floppy-o"/> Save</button>
                </form>
            </t>
        </t>
</templates>

- Loaded this xml in .js file, the reason to load using javascript is because through normal qweb paramenter of manifest file was not functioning to load this xml. here is below javascript code which i've used to load xml file.

odoo.define('module_name.editor_extension', function (require) {
'use strict';
var core = require('web.core');
var ajax = require('web.ajax');
var qweb = core.qweb;
ajax.loadXML('/module_name/static/src/xml/editor.xml', qweb);
});
- Call of javascript file in asset xml file
<template id="assets_editor" inherit_id="web_editor.assets_editor">
    <xpath expr="."><!-- External library bootstrap-colorpicker -->
       <script type="text/javascript" src="/module_name/static/src/js/web_editor.js"/>
    </xpath>
</template>


If any one has idea about the following template inheritance, would be really apprciated

Thanks in advance.

Best Regards,

Anil Kesariya


Avatar
Opusti
Related Posts Odgovori Prikazi Aktivnost
0
jul. 17
6464
1
okt. 24
2752
5
feb. 24
24081
5
jan. 22
11679
0
jul. 18
2617