mirror of
https://github.com/open-webui/computer.git
synced 2026-11-26 23:29:25 -05:00
refac
This commit is contained in:
1 parent
4181e685ff
commit
96bfd8e888
14 files changed
+61
-8
No files matched your search
@@ -33,11 +33,11 @@
|
||||
import { TAB_DRAG_MIME } from '$lib/constants';
|
||||
|
||||
interface Props {
|
||||
group: EditorGroup;
|
||||
canClose?: boolean;
|
||||
isPrimary?: boolean;
|
||||
onTabDragOver?: () => void;
|
||||
}
|
||||
group: EditorGroup;
|
||||
canClose?: boolean;
|
||||
isPrimary?: boolean;
|
||||
onTabDragOver?: () => void;
|
||||
}
|
||||
|
||||
let { group, canClose = false, isPrimary = false, onTabDragOver }: Props = $props();
|
||||
|
||||
@@ -199,6 +199,7 @@
|
||||
{
|
||||
label: $t('bar.newBrowser'),
|
||||
icon: 'browser',
|
||||
shortcut: formatChord($keybindings.newBrowser),
|
||||
onclick: () => openBrowserTab(group.id)
|
||||
},
|
||||
...($voiceMemosEnabled
|
||||
@@ -308,9 +309,7 @@
|
||||
<!-- svelte-ignore a11y_no_static_element_interactions -->
|
||||
<div
|
||||
class="flex items-center h-9 px-1.5 gap-1 shrink-0 select-none border-b transition-colors duration-100
|
||||
{dropHighlight
|
||||
? 'tab-reorder-drop-preview'
|
||||
: 'border-gray-200 dark:border-white/6'}
|
||||
{dropHighlight ? 'tab-reorder-drop-preview' : 'border-gray-200 dark:border-white/6'}
|
||||
{isActiveGroup ? '' : 'opacity-50'}"
|
||||
onclick={handlePaneClick}
|
||||
ondragover={handleBarDragOver}
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
newFile: $t('keyboard.newFile'),
|
||||
newTerminal: $t('keyboard.newTerminal'),
|
||||
newChat: $t('keyboard.newChat'),
|
||||
newBrowser: $t('keyboard.newBrowser'),
|
||||
closeTab: $t('keyboard.closeTab'),
|
||||
nextTab: $t('keyboard.nextTab'),
|
||||
prevTab: $t('keyboard.prevTab'),
|
||||
@@ -30,6 +31,7 @@
|
||||
newFile: $t('keyboard.action.newFile'),
|
||||
newTerminal: $t('keyboard.action.newTerminal'),
|
||||
newChat: $t('keyboard.action.newChat'),
|
||||
newBrowser: $t('keyboard.action.newBrowser'),
|
||||
closeTab: $t('keyboard.action.closeTab'),
|
||||
nextTab: $t('keyboard.action.nextTab'),
|
||||
prevTab: $t('keyboard.action.prevTab'),
|
||||
|
||||
@@ -452,6 +452,7 @@
|
||||
"keyboard.newFile": "Eine neue leere Datei öffnen",
|
||||
"keyboard.newTerminal": "Eine neue Terminalsitzung öffnen",
|
||||
"keyboard.newChat": "Einen neuen KI-Chat starten",
|
||||
"keyboard.newBrowser": "Einen neuen Browser-Tab öffnen",
|
||||
"keyboard.closeTab": "Den aktiven Tab schließen",
|
||||
"keyboard.nextTab": "Zum nächsten Tab wechseln",
|
||||
"keyboard.prevTab": "Zum vorherigen Tab wechseln",
|
||||
@@ -760,6 +761,7 @@
|
||||
"keyboard.action.newFile": "Neue Datei",
|
||||
"keyboard.action.newTerminal": "Neues Terminal",
|
||||
"keyboard.action.newChat": "Neuer Chat",
|
||||
"keyboard.action.newBrowser": "Neuer Browser",
|
||||
"keyboard.action.closeTab": "Tab schließen",
|
||||
"keyboard.action.nextTab": "Nächster Tab",
|
||||
"keyboard.action.prevTab": "Vorheriger Tab",
|
||||
|
||||
@@ -454,6 +454,7 @@
|
||||
"keyboard.newFile": "Open a new untitled file",
|
||||
"keyboard.newTerminal": "Open a new terminal session",
|
||||
"keyboard.newChat": "Start a new AI chat",
|
||||
"keyboard.newBrowser": "Open a new Browser tab",
|
||||
"keyboard.closeTab": "Close the active tab",
|
||||
"keyboard.nextTab": "Switch to the next tab",
|
||||
"keyboard.prevTab": "Switch to the previous tab",
|
||||
@@ -772,6 +773,7 @@
|
||||
"keyboard.action.newFile": "New File",
|
||||
"keyboard.action.newTerminal": "New Terminal",
|
||||
"keyboard.action.newChat": "New Chat",
|
||||
"keyboard.action.newBrowser": "New Browser",
|
||||
"keyboard.action.closeTab": "Close Tab",
|
||||
"keyboard.action.nextTab": "Next Tab",
|
||||
"keyboard.action.prevTab": "Previous Tab",
|
||||
|
||||
@@ -452,6 +452,7 @@
|
||||
"keyboard.newFile": "Abrir un archivo nuevo vacío",
|
||||
"keyboard.newTerminal": "Abrir una nueva sesión de terminal",
|
||||
"keyboard.newChat": "Iniciar un nuevo chat de IA",
|
||||
"keyboard.newBrowser": "Abrir una nueva pestaña del navegador",
|
||||
"keyboard.closeTab": "Cerrar la pestaña activa",
|
||||
"keyboard.nextTab": "Cambiar a la siguiente pestaña",
|
||||
"keyboard.prevTab": "Cambiar a la pestaña anterior",
|
||||
@@ -760,6 +761,7 @@
|
||||
"keyboard.action.newFile": "Nuevo archivo",
|
||||
"keyboard.action.newTerminal": "Nueva terminal",
|
||||
"keyboard.action.newChat": "Nuevo chat",
|
||||
"keyboard.action.newBrowser": "Nuevo navegador",
|
||||
"keyboard.action.closeTab": "Cerrar pestaña",
|
||||
"keyboard.action.nextTab": "Siguiente pestaña",
|
||||
"keyboard.action.prevTab": "Pestaña anterior",
|
||||
|
||||
@@ -452,6 +452,7 @@
|
||||
"keyboard.newFile": "Ouvrir un nouveau fichier vide",
|
||||
"keyboard.newTerminal": "Ouvrir une nouvelle session de terminal",
|
||||
"keyboard.newChat": "Démarrer un nouveau chat IA",
|
||||
"keyboard.newBrowser": "Ouvrir un nouvel onglet de navigateur",
|
||||
"keyboard.closeTab": "Fermer l'onglet actif",
|
||||
"keyboard.nextTab": "Passer à l'onglet suivant",
|
||||
"keyboard.prevTab": "Passer à l'onglet précédent",
|
||||
@@ -760,6 +761,7 @@
|
||||
"keyboard.action.newFile": "Nouveau fichier",
|
||||
"keyboard.action.newTerminal": "Nouveau terminal",
|
||||
"keyboard.action.newChat": "Nouveau chat",
|
||||
"keyboard.action.newBrowser": "Nouveau navigateur",
|
||||
"keyboard.action.closeTab": "Fermer l'onglet",
|
||||
"keyboard.action.nextTab": "Onglet suivant",
|
||||
"keyboard.action.prevTab": "Onglet précédent",
|
||||
|
||||
@@ -452,6 +452,7 @@
|
||||
"keyboard.newFile": "新しい空のファイルを開く",
|
||||
"keyboard.newTerminal": "新しいターミナルセッションを開く",
|
||||
"keyboard.newChat": "新しいAIチャットを開始",
|
||||
"keyboard.newBrowser": "新しいブラウザータブを開く",
|
||||
"keyboard.closeTab": "アクティブなタブを閉じる",
|
||||
"keyboard.nextTab": "次のタブに切り替える",
|
||||
"keyboard.prevTab": "前のタブに切り替える",
|
||||
@@ -760,6 +761,7 @@
|
||||
"keyboard.action.newFile": "新規ファイル",
|
||||
"keyboard.action.newTerminal": "新規ターミナル",
|
||||
"keyboard.action.newChat": "新規チャット",
|
||||
"keyboard.action.newBrowser": "新規ブラウザー",
|
||||
"keyboard.action.closeTab": "タブを閉じる",
|
||||
"keyboard.action.nextTab": "次のタブ",
|
||||
"keyboard.action.prevTab": "前のタブ",
|
||||
|
||||
@@ -452,6 +452,7 @@
|
||||
"keyboard.newFile": "새 빈 파일 열기",
|
||||
"keyboard.newTerminal": "새 터미널 세션 열기",
|
||||
"keyboard.newChat": "새 AI 채팅 시작",
|
||||
"keyboard.newBrowser": "새 브라우저 탭 열기",
|
||||
"keyboard.closeTab": "활성 탭 닫기",
|
||||
"keyboard.nextTab": "다음 탭으로 전환",
|
||||
"keyboard.prevTab": "이전 탭으로 전환",
|
||||
@@ -760,6 +761,7 @@
|
||||
"keyboard.action.newFile": "새 파일",
|
||||
"keyboard.action.newTerminal": "새 터미널",
|
||||
"keyboard.action.newChat": "새 채팅",
|
||||
"keyboard.action.newBrowser": "새 브라우저",
|
||||
"keyboard.action.closeTab": "탭 닫기",
|
||||
"keyboard.action.nextTab": "다음 탭",
|
||||
"keyboard.action.prevTab": "이전 탭",
|
||||
|
||||
@@ -452,6 +452,7 @@
|
||||
"keyboard.newFile": "Abrir um novo arquivo vazio",
|
||||
"keyboard.newTerminal": "Abrir uma nova sessão de terminal",
|
||||
"keyboard.newChat": "Iniciar um novo chat de IA",
|
||||
"keyboard.newBrowser": "Abrir uma nova aba do navegador",
|
||||
"keyboard.closeTab": "Fechar a aba ativa",
|
||||
"keyboard.nextTab": "Mudar para a próxima aba",
|
||||
"keyboard.prevTab": "Mudar para a aba anterior",
|
||||
@@ -760,6 +761,7 @@
|
||||
"keyboard.action.newFile": "Novo arquivo",
|
||||
"keyboard.action.newTerminal": "Novo terminal",
|
||||
"keyboard.action.newChat": "Novo chat",
|
||||
"keyboard.action.newBrowser": "Novo navegador",
|
||||
"keyboard.action.closeTab": "Fechar aba",
|
||||
"keyboard.action.nextTab": "Próxima aba",
|
||||
"keyboard.action.prevTab": "Aba anterior",
|
||||
|
||||
@@ -452,6 +452,7 @@
|
||||
"keyboard.newFile": "Открыть новый пустой файл",
|
||||
"keyboard.newTerminal": "Открыть новую сессию терминала",
|
||||
"keyboard.newChat": "Начать новый ИИ-чат",
|
||||
"keyboard.newBrowser": "Открыть новую вкладку браузера",
|
||||
"keyboard.closeTab": "Закрыть активную вкладку",
|
||||
"keyboard.nextTab": "Перейти к следующей вкладке",
|
||||
"keyboard.prevTab": "Перейти к предыдущей вкладке",
|
||||
@@ -760,6 +761,7 @@
|
||||
"keyboard.action.newFile": "Новый файл",
|
||||
"keyboard.action.newTerminal": "Новый терминал",
|
||||
"keyboard.action.newChat": "Новый чат",
|
||||
"keyboard.action.newBrowser": "Новый браузер",
|
||||
"keyboard.action.closeTab": "Закрыть вкладку",
|
||||
"keyboard.action.nextTab": "Следующая вкладка",
|
||||
"keyboard.action.prevTab": "Предыдущая вкладка",
|
||||
|
||||
@@ -452,6 +452,7 @@
|
||||
"keyboard.newFile": "打开新的空白文件",
|
||||
"keyboard.newTerminal": "打开新的终端会话",
|
||||
"keyboard.newChat": "开始新的 AI 聊天",
|
||||
"keyboard.newBrowser": "打开新的浏览器标签页",
|
||||
"keyboard.closeTab": "关闭活动标签页",
|
||||
"keyboard.nextTab": "切换到下一个标签页",
|
||||
"keyboard.prevTab": "切换到上一个标签页",
|
||||
@@ -760,6 +761,7 @@
|
||||
"keyboard.action.newFile": "新建文件",
|
||||
"keyboard.action.newTerminal": "新建终端",
|
||||
"keyboard.action.newChat": "新建聊天",
|
||||
"keyboard.action.newBrowser": "新建浏览器",
|
||||
"keyboard.action.closeTab": "关闭标签页",
|
||||
"keyboard.action.nextTab": "下一个标签页",
|
||||
"keyboard.action.prevTab": "上一个标签页",
|
||||
|
||||
@@ -452,6 +452,7 @@
|
||||
"keyboard.newFile": "開啟新的空白檔案",
|
||||
"keyboard.newTerminal": "開啟新的終端機工作階段",
|
||||
"keyboard.newChat": "開始新的 AI 聊天",
|
||||
"keyboard.newBrowser": "開啟新的瀏覽器分頁",
|
||||
"keyboard.closeTab": "關閉使用中的分頁",
|
||||
"keyboard.nextTab": "切換到下一個分頁",
|
||||
"keyboard.prevTab": "切換到上一個分頁",
|
||||
@@ -760,6 +761,7 @@
|
||||
"keyboard.action.newFile": "新增檔案",
|
||||
"keyboard.action.newTerminal": "新增終端機",
|
||||
"keyboard.action.newChat": "新增聊天",
|
||||
"keyboard.action.newBrowser": "新增瀏覽器",
|
||||
"keyboard.action.closeTab": "關閉分頁",
|
||||
"keyboard.action.nextTab": "下一個分頁",
|
||||
"keyboard.action.prevTab": "上一個分頁",
|
||||
|
||||
@@ -14,6 +14,7 @@ import { writable, get } from 'svelte/store';
|
||||
import {
|
||||
openUntitledFileTab,
|
||||
openTerminalTab,
|
||||
openBrowserTab,
|
||||
closeTab,
|
||||
setActiveTab,
|
||||
activeGroup,
|
||||
@@ -31,6 +32,7 @@ export const ACTION_IDS = [
|
||||
'newFile',
|
||||
'newTerminal',
|
||||
'newChat',
|
||||
'newBrowser',
|
||||
'closeTab',
|
||||
'nextTab',
|
||||
'prevTab',
|
||||
@@ -50,6 +52,7 @@ export const ACTION_LABELS: Record<ActionId, string> = {
|
||||
newFile: 'New File',
|
||||
newTerminal: 'New Terminal',
|
||||
newChat: 'New Chat',
|
||||
newBrowser: 'New Browser',
|
||||
closeTab: 'Close Tab',
|
||||
nextTab: 'Next Tab',
|
||||
prevTab: 'Previous Tab',
|
||||
@@ -67,6 +70,7 @@ export const DEFAULT_KEYBINDINGS: Record<ActionId, string> = {
|
||||
newFile: 'Cmd+N',
|
||||
newTerminal: 'Ctrl+`',
|
||||
newChat: 'Cmd+Shift+O',
|
||||
newBrowser: 'Cmd+Shift+B',
|
||||
closeTab: 'Cmd+W',
|
||||
nextTab: 'Cmd+Shift+]',
|
||||
prevTab: 'Cmd+Shift+[',
|
||||
@@ -254,6 +258,10 @@ export function executeAction(
|
||||
openChatTab();
|
||||
return true;
|
||||
|
||||
case 'newBrowser':
|
||||
void openBrowserTab();
|
||||
return true;
|
||||
|
||||
case 'closeTab': {
|
||||
const group = get(activeGroup);
|
||||
if (!group) return false;
|
||||
|
||||
@@ -45,6 +45,25 @@ def _target_key(
|
||||
return target, f"{target}{side}", virtual_key
|
||||
|
||||
|
||||
def _editing_commands(key: str, modifiers: int, primary: bool) -> list[str]:
|
||||
if not primary or modifiers & 1:
|
||||
return []
|
||||
key = key.lower()
|
||||
if key == "z":
|
||||
return ["Redo" if modifiers & 8 else "Undo"]
|
||||
if key == "y":
|
||||
return ["Redo"]
|
||||
command = {
|
||||
"a": "SelectAll",
|
||||
"b": "ToggleBold",
|
||||
"c": "Copy",
|
||||
"i": "ToggleItalic",
|
||||
"u": "ToggleUnderline",
|
||||
"x": "Cut",
|
||||
}.get(key)
|
||||
return [command] if command else []
|
||||
|
||||
|
||||
def browser_name(path: str) -> str:
|
||||
name = Path(path).name.lower()
|
||||
if "brave" in name:
|
||||
@@ -617,6 +636,11 @@ class ChromeViewerManager:
|
||||
"isKeypad": bool(data.get("is_keypad", False)),
|
||||
"windowsVirtualKeyCode": virtual_key,
|
||||
}
|
||||
commands = _editing_commands(
|
||||
key, int(data.get("modifiers", 0)), bool(data.get("primary_modifier", False))
|
||||
)
|
||||
if event == "keyDown" and commands:
|
||||
params["commands"] = commands
|
||||
await viewer.target_cdp.send(
|
||||
"Input.dispatchKeyEvent",
|
||||
params,
|
||||
|
||||
Reference in new issue
Block a user