From a1032fad1884f33ca0029250eb7562abb6492d1e Mon Sep 17 00:00:00 2001 From: Chupurnov Valeriy Date: Fri, 9 Feb 2018 12:00:39 +0500 Subject: [PATCH] Fix bug with toolbar option --- src/Jodit.ts | 5 ++++- src/plugins/mobile.ts | 4 ++++ test/tests/interfaceTest.js | 8 ++++++++ 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/src/Jodit.ts b/src/Jodit.ts index 81beb0734..dbe0d7f87 100644 --- a/src/Jodit.ts +++ b/src/Jodit.ts @@ -214,7 +214,10 @@ export class Jodit extends Component { this.toolbar = new ToolbarCollection(this); - this.toolbar.build(this.options.buttons.concat(this.options.extraButtons), this.container); + + if (this.options.toolbar) { + this.toolbar.build(this.options.buttons.concat(this.options.extraButtons), this.container); + } this.container.classList.add('jodit_toolbar_size-' + (['middle', 'large', 'small'].indexOf(this.options.toolbarButtonSize.toLowerCase()) !== -1 ? this.options.toolbarButtonSize.toLowerCase() : 'middle')); diff --git a/src/plugins/mobile.ts b/src/plugins/mobile.ts index 4450d7b0c..0c418b0f9 100644 --- a/src/plugins/mobile.ts +++ b/src/plugins/mobile.ts @@ -80,6 +80,10 @@ export function mobile(editor: Jodit) { }); }) .on('resize afterInit', () => { + if (!editor.options.toolbar) { + return; + } + let width: number = editor.container.offsetWidth; if (width >= editor.options.sizeLG) { diff --git a/test/tests/interfaceTest.js b/test/tests/interfaceTest.js index 500bd2be2..0dc14f205 100644 --- a/test/tests/interfaceTest.js +++ b/test/tests/interfaceTest.js @@ -1,6 +1,14 @@ describe('Test interface', function() { appendTestArea('table_editor_interface', true); describe('Toolbar', function () { + describe('Set toolbar options to false', function () { + it('Should hide toolbar', function () { + var editor = new Jodit(appendTestArea(), { + toolbar: false + }); + expect(null).to.be.equal(editor.container.querySelector('jodit_toolbar')); + }); + }); describe('Popups', function () { describe('Click on some link', function () { describe('in the left side of editor', function () {