Skip to content

Commit

Permalink
Inherit ToolBarSpacerView from ToolBarItem
Browse files Browse the repository at this point in the history
  • Loading branch information
aminya committed Apr 13, 2020
1 parent fa9c337 commit 9361600
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion lib/tool-bar-manager.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const { ToolBarItem } = require('./tool-bar-item');
const { ToolBarButtonView } = require('./tool-bar-button-view');
const ToolBarSpacerView = require('./tool-bar-spacer-view');
const { ToolBarSpacerView } = require('./tool-bar-spacer-view');

module.exports = class ToolBarManager {
constructor (group, toolBarView, touchBarManager) {
Expand Down
22 changes: 11 additions & 11 deletions lib/tool-bar-spacer-view.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
module.exports = class ToolBarSpacerView {
const { ToolBarItem } = require('./tool-bar-item');

class ToolBarSpacerView extends ToolBarItem {
constructor (options, group) {
this.element = document.createElement('hr');
this.priority = options && options.priority;
this.group = group;
// first calling the super (ToolBarItem) constructor
super({
element: document.createElement('hr'),
priority: options && options.priority
}, group);

const classNames = ['tool-bar-spacer'];
if (this.priority < 0) {
classNames.push('tool-bar-item-align-end');
}
this.element.classList.add(...classNames);
}

destroy () {
if (this.element.parentNode) {
this.element.parentNode.removeChild(this.element);
}
this.element = null;
}
};

module.exports.ToolBarSpacerView = ToolBarSpacerView;

0 comments on commit 9361600

Please sign in to comment.