From d26ce6c316f5a4aa677bbc09f7e2b7f4b99455c6 Mon Sep 17 00:00:00 2001 From: Eugene Pankov Date: Thu, 17 Nov 2022 10:56:22 +0100 Subject: [PATCH] fixed #7481 - broadcast not available on SSH tabs --- tabby-local/src/tabContextMenu.ts | 21 +------------------ tabby-terminal/src/tabContextMenu.ts | 31 ++++++++++++++++++++++------ 2 files changed, 26 insertions(+), 26 deletions(-) diff --git a/tabby-local/src/tabContextMenu.ts b/tabby-local/src/tabContextMenu.ts index e7e98dde1c..1ef27519c7 100644 --- a/tabby-local/src/tabContextMenu.ts +++ b/tabby-local/src/tabContextMenu.ts @@ -1,7 +1,6 @@ import { Injectable } from '@angular/core' import { NgbModal } from '@ng-bootstrap/ng-bootstrap' -import { ConfigService, BaseTabComponent, TabContextMenuItemProvider, SplitTabComponent, NotificationsService, MenuItemOptions, ProfilesService, PromptModalComponent, TranslateService } from 'tabby-core' -import { MultifocusService } from 'tabby-terminal' +import { ConfigService, BaseTabComponent, TabContextMenuItemProvider, NotificationsService, MenuItemOptions, ProfilesService, PromptModalComponent, TranslateService } from 'tabby-core' import { TerminalTabComponent } from './components/terminalTab.component' import { UACService } from './services/uac.service' import { TerminalService } from './services/terminal.service' @@ -66,7 +65,6 @@ export class NewTabContextMenu extends TabContextMenuItemProvider { private terminalService: TerminalService, private uac: UACService, private translate: TranslateService, - private multifocus: MultifocusService, ) { super() } @@ -133,23 +131,6 @@ export class NewTabContextMenu extends TabContextMenuItemProvider { }) } - if (tab instanceof TerminalTabComponent && tab.parent instanceof SplitTabComponent) { - items.push({ - label: this.translate.instant('Focus all tabs'), - click: () => { - this.multifocus.focusAllTabs() - }, - }) - if (tab.parent.getAllTabs().length > 1) { - items.push({ - label: this.translate.instant('Focus all panes'), - click: () => { - this.multifocus.focusAllPanes() - }, - }) - } - } - return items } } diff --git a/tabby-terminal/src/tabContextMenu.ts b/tabby-terminal/src/tabContextMenu.ts index 6b78751a02..26b783fcdd 100644 --- a/tabby-terminal/src/tabContextMenu.ts +++ b/tabby-terminal/src/tabContextMenu.ts @@ -2,6 +2,7 @@ import { Injectable, Optional, Inject } from '@angular/core' import { BaseTabComponent, TabContextMenuItemProvider, NotificationsService, MenuItemOptions, TranslateService } from 'tabby-core' import { BaseTerminalTabComponent } from './api/baseTerminalTab.component' import { TerminalContextMenuItemProvider } from './api/contextMenuProvider' +import { MultifocusService } from './services/multifocus.service' /** @hidden */ @Injectable() @@ -45,24 +46,42 @@ export class CopyPasteContextMenu extends TabContextMenuItemProvider { export class MiscContextMenu extends TabContextMenuItemProvider { weight = 1 - constructor (private translate: TranslateService) { super() } + constructor ( + private translate: TranslateService, + private multifocus: MultifocusService, + ) { super() } async getItems (tab: BaseTabComponent): Promise { + const items: MenuItemOptions[] = [] if (tab instanceof BaseTerminalTabComponent && tab.enableToolbar && !tab.pinToolbar) { - return [{ + items.push({ label: this.translate.instant('Show toolbar'), click: () => { tab.pinToolbar = true }, - }] + }) } if (tab instanceof BaseTerminalTabComponent && tab.session?.supportsWorkingDirectory()) { - return [{ + items.push({ label: this.translate.instant('Copy current path'), click: () => tab.copyCurrentPath(), - }] + }) } - return [] + items.push({ + label: this.translate.instant('Focus all tabs'), + click: () => { + this.multifocus.focusAllTabs() + }, + }) + if (tab.parent.getAllTabs().length > 1) { + items.push({ + label: this.translate.instant('Focus all panes'), + click: () => { + this.multifocus.focusAllPanes() + }, + }) + } + return items } }