콘텐츠로 건너뛰기
메뉴
커뮤니티에 참여하려면 회원 가입을 하시기 바랍니다.
신고된 질문입니다

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


아바타
취소
관련 게시물 답글 화면 활동
0
7월 17
6542
1
10월 24
2821
5
2월 24
24197
5
1월 22
11781
0
7월 18
2678