Skip to content

Instantly share code, notes, and snippets.

@simahawk
Last active May 13, 2022 10:50
Show Gist options
  • Select an option

  • Save simahawk/b65d0e0911ab79194a07 to your computer and use it in GitHub Desktop.

Select an option

Save simahawk/b65d0e0911ab79194a07 to your computer and use it in GitHub Desktop.
Override Odoo website builder text editor options
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<template id="summernote" name="My summernote assets" inherit_id="web_editor.assets_editor">
<xpath expr="//script[last()]" position="after">
<script type="text/javascript" src="/my_mod/static/js/summernote_overrides.js"></script>
</xpath>
</template>
</odoo>
odoo.define('web_editor.summernote_override', 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;
// limit style tags
options.styleTags = ['p', 'blockquote'];
// disable some editor features
// XXX: this is not working, unfortunately but `options.styleTags` above is. weird :S
options.toolbar = [
['font', ['bold', 'italic', 'underline', 'clear']],
['para', ['ul', 'ol', 'paragraph']],
['height', ['height']],
['insert', ['link', 'picture', 'hr']],
['view', ['fullscreen', 'codeview']],
['help', ['help']]
];
return $.summernote;
});
@Ascaldera
Copy link

how do you edit:
options.toolbar = [
['font', ['bold', 'italic', 'underline', 'clear']],
['para', ['ul', 'ol', 'paragraph']],
['height', ['height']],
['insert', ['link', 'picture', 'hr']],
['view', ['fullscreen', 'codeview']],
['help', ['help']]
];

@jwaes
Copy link

jwaes commented May 13, 2022

Hmm i guess this is no longer valid in v15 ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment