Skip to content

Commit

Permalink
Fix bug with toolbar option
Browse files Browse the repository at this point in the history
  • Loading branch information
xdan committed Feb 9, 2018
1 parent 2a87304 commit a1032fa
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/Jodit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'));

Expand Down
4 changes: 4 additions & 0 deletions src/plugins/mobile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
8 changes: 8 additions & 0 deletions test/tests/interfaceTest.js
Original file line number Diff line number Diff line change
@@ -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 () {
Expand Down

0 comments on commit a1032fa

Please sign in to comment.