Skip to content

Commit

Permalink
Fix rebase issues, lint, add missing option
Browse files Browse the repository at this point in the history
  • Loading branch information
krassowski committed Aug 3, 2022
1 parent 9345a61 commit c4e1513
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 20 deletions.
26 changes: 8 additions & 18 deletions packages/widgets/src/tabbar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ export class TabBar<T> extends Widget {
this._document = options.document || document;
this.tabsMovable = options.tabsMovable || false;
this.titlesEditable = options.titlesEditable || false;
this._scrollingEnabled = options.scrollingEnabled || false;
this.allowDeselect = options.allowDeselect || false;
this.addButtonEnabled = options.addButtonEnabled || false;
this.insertBehavior = options.insertBehavior || 'select-tab-if-needed';
Expand Down Expand Up @@ -1070,24 +1071,6 @@ export class TabBar<T> extends Widget {
detachRequested: false
};

// Add the document pointer up listener.
this.document.addEventListener('pointerup', this, true);

// Do nothing else if the middle button or add button is clicked.
if (event.button === 1 || addButtonClicked) {
return;
}
if (scrollBeforeButtonClicked || scrollAfterButtonClicked) {
this.beginScrolling(scrollBeforeButtonClicked ? '-' : '+');
return;
}

// Do nothing else if the close icon is clicked.
let icon = tabs[index].querySelector(this.renderer.closeIconSelector);
if (icon && icon.contains(event.target as HTMLElement)) {
return;
}

// Add the extra listeners if the tabs are movable.
if (this.tabsMovable) {
this.document.addEventListener('pointermove', this, true);
Expand Down Expand Up @@ -1683,6 +1666,13 @@ export namespace TabBar {
*/
addButtonEnabled?: boolean;

/**
* Whether scrolling is enabled.
*
* The default is `false`.
*/
scrollingEnabled?: boolean;

/**
* The selection behavior when inserting a tab.
*
Expand Down
8 changes: 6 additions & 2 deletions packages/widgets/style/tabbar.css
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,15 @@
list-style-type: none;
}

.lm-TabBar[data-orientation='horizontal'] > .lm-TabBar-wrapper > .lm-TabBar-content {
.lm-TabBar[data-orientation='horizontal']
> .lm-TabBar-wrapper
> .lm-TabBar-content {
flex-direction: row;
}

.lm-TabBar[data-orientation='vertical'] > .lm-TabBar-wrapper > .lm-TabBar-content {
.lm-TabBar[data-orientation='vertical']
> .lm-TabBar-wrapper
> .lm-TabBar-content {
flex-direction: column;
}

Expand Down

0 comments on commit c4e1513

Please sign in to comment.