diff options
| author | Christophe Matthieu <chm@odoo.com> | 2014-12-10 15:59:48 +0100 |
|---|---|---|
| committer | Christophe Matthieu <chm@odoo.com> | 2015-01-05 10:17:10 +0100 |
| commit | 1596e45e8174cd736d4f7c78f85ec76a8e34888d (patch) | |
| tree | 4ff318ee78bccc6c0bb6253670e85977f8f5a643 /addons/website/static/lib/summernote/src/js/module/Toolbar.js | |
| parent | f9a7ed6b9406d657fda33ec55c4e237576b77a42 (diff) | |
[IMP] website: add summernote lib
Diffstat (limited to 'addons/website/static/lib/summernote/src/js/module/Toolbar.js')
| -rw-r--r-- | addons/website/static/lib/summernote/src/js/module/Toolbar.js | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/addons/website/static/lib/summernote/src/js/module/Toolbar.js b/addons/website/static/lib/summernote/src/js/module/Toolbar.js new file mode 100644 index 00000000000..5ff172012ca --- /dev/null +++ b/addons/website/static/lib/summernote/src/js/module/Toolbar.js @@ -0,0 +1,56 @@ +define([ + 'summernote/core/list', + 'summernote/module/Button' +], function (list, Button) { + /** + * Toolbar + */ + var Toolbar = function () { + var button = new Button(); + + this.update = function ($toolbar, styleInfo) { + button.update($toolbar, styleInfo); + }; + + /** + * @param {Node} button + * @param {String} eventName + * @param {String} value + */ + this.updateRecentColor = function (buttonNode, eventName, value) { + button.updateRecentColor(buttonNode, eventName, value); + }; + + /** + * activate buttons exclude codeview + * @param {jQuery} $toolbar + */ + this.activate = function ($toolbar) { + $toolbar.find('button') + .not('button[data-event="codeview"]') + .removeClass('disabled'); + }; + + /** + * deactivate buttons exclude codeview + * @param {jQuery} $toolbar + */ + this.deactivate = function ($toolbar) { + $toolbar.find('button') + .not('button[data-event="codeview"]') + .addClass('disabled'); + }; + + this.updateFullscreen = function ($container, bFullscreen) { + var $btn = $container.find('button[data-event="fullscreen"]'); + $btn.toggleClass('active', bFullscreen); + }; + + this.updateCodeview = function ($container, isCodeview) { + var $btn = $container.find('button[data-event="codeview"]'); + $btn.toggleClass('active', isCodeview); + }; + }; + + return Toolbar; +}); |
