mirror of
https://github.com/Eugeny/tabby.git
synced 2025-10-05 22:44:55 +00:00
fixed #6164 - added command palette
This commit is contained in:
@@ -5,7 +5,6 @@ import { TranslateService } from '@ngx-translate/core'
|
||||
import { Subscription } from 'rxjs'
|
||||
import { AppService } from './services/app.service'
|
||||
import { BaseTabComponent } from './components/baseTab.component'
|
||||
import { TabHeaderComponent } from './components/tabHeader.component'
|
||||
import { SplitTabComponent, SplitDirection } from './components/splitTab.component'
|
||||
import { TabContextMenuItemProvider } from './api/tabContextMenuProvider'
|
||||
import { MenuItemOptions } from './api/menu'
|
||||
@@ -32,6 +31,7 @@ export class TabManagementContextMenu extends TabContextMenuItemProvider {
|
||||
let items: MenuItemOptions[] = [
|
||||
{
|
||||
label: this.translate.instant('Close'),
|
||||
commandLabel: this.translate.instant('Close tab'),
|
||||
click: () => {
|
||||
if (this.app.tabs.includes(tab)) {
|
||||
this.app.closeTab(tab, true)
|
||||
@@ -80,6 +80,12 @@ export class TabManagementContextMenu extends TabContextMenuItemProvider {
|
||||
l: this.translate.instant('Left'),
|
||||
t: this.translate.instant('Up'),
|
||||
}[dir],
|
||||
commandLabel: {
|
||||
r: this.translate.instant('Split to the right'),
|
||||
b: this.translate.instant('Split to the down'),
|
||||
l: this.translate.instant('Split to the left'),
|
||||
t: this.translate.instant('Split to the up'),
|
||||
}[dir],
|
||||
click: () => {
|
||||
(tab.parent as SplitTabComponent).splitTab(tab, dir)
|
||||
},
|
||||
@@ -104,7 +110,7 @@ export class CommonOptionsContextMenu extends TabContextMenuItemProvider {
|
||||
super()
|
||||
}
|
||||
|
||||
async getItems (tab: BaseTabComponent, tabHeader?: TabHeaderComponent): Promise<MenuItemOptions[]> {
|
||||
async getItems (tab: BaseTabComponent, tabHeader?: boolean): Promise<MenuItemOptions[]> {
|
||||
let items: MenuItemOptions[] = []
|
||||
if (tabHeader) {
|
||||
const currentColor = TAB_COLORS.find(x => x.value === tab.color)?.name
|
||||
@@ -112,14 +118,19 @@ export class CommonOptionsContextMenu extends TabContextMenuItemProvider {
|
||||
...items,
|
||||
{
|
||||
label: this.translate.instant('Rename'),
|
||||
click: () => tabHeader.showRenameTabModal(),
|
||||
commandLabel: this.translate.instant('Rename tab'),
|
||||
click: () => {
|
||||
this.app.renameTab(tab)
|
||||
},
|
||||
},
|
||||
{
|
||||
label: this.translate.instant('Duplicate'),
|
||||
commandLabel: this.translate.instant('Duplicate tab'),
|
||||
click: () => this.app.duplicateTab(tab),
|
||||
},
|
||||
{
|
||||
label: this.translate.instant('Color'),
|
||||
commandLabel: this.translate.instant('Change tab color'),
|
||||
sublabel: currentColor ? this.translate.instant(currentColor) : undefined,
|
||||
submenu: TAB_COLORS.map(color => ({
|
||||
label: this.translate.instant(color.name) ?? color.name,
|
||||
|
Reference in New Issue
Block a user