Beautiful, AI-native markdown IDE and LLM wiki
TypeScript 2nd-brainagent-skillsclaudecodexcompany-braindocsknowledge-knowledge-baseknowledge-managementllmllm-wikillm-wiki-karpathymarkdownmarkdown-editormdmdxnotespkmsecond-brainskills
feat(open-knowledge): add tab keyboard shortcuts (#2337)
Dimitri POSTOLOVb94896630f98
diff --git a/.changeset/tidy-ads-film.md b/.changeset/tidy-ads-film.mdnew file mode 100644index 000000000..ae636f87e--- /dev/null+++ b/.changeset/tidy-ads-film.md@@ -0,0 +1,5 @@+---+"@inkeep/open-knowledge": patch+---++Add browser-style keyboard shortcuts for editor tabs, including new/reopen tab, tab cycling, and numeric tab jumps.diff --git a/docs/content/features/editor.mdx b/docs/content/features/editor.mdxindex 61cb9cb30..a5fb5878d 100644--- a/docs/content/features/editor.mdx+++ b/docs/content/features/editor.mdx@@ -149,10 +149,16 @@ The editor has two sidebars: the file sidebar on the left and the document panelThe defaults only apply until you toggle. OpenKnowledge remembers your most recent Show / Hide for each sidebar in your browser and survives reloads. When you come back to the same layout context (narrow window, comfortable window, or embedded view) you used last, your toggle is what you'll see. Toggling in a different context replaces that memory; only your most recent choice sticks, so a stale preference from a wide-monitor session can't quietly override what you just chose on a narrow screen.-Keyboard shortcuts (use `Ctrl` on Windows / Linux in place of `Cmd`):+Keyboard shortcuts (use `Ctrl` on Windows / Linux in place of `Cmd`, unless the shortcut already uses `Ctrl`):| Shortcut | Action || --- | --- |+| `Cmd+T` | Open a new editor tab. |+| `Ctrl+Tab` | Move to the next editor tab. |+| `Ctrl+Shift+Tab` | Move to the previous editor tab. |+| `Cmd+1` ... `Cmd+8` | Jump to one of the first eight editor tabs. |+| `Cmd+9` | Jump to the last editor tab. |+| `Cmd+Shift+T` | Reopen the most recently closed editor tab. || `Cmd+Option+S` | Show / Hide the file sidebar (left). Matches Apple's standard sidebar accelerator. || `Cmd+Option+B` | Show / Hide the document panel (right). Matches VS Code's Secondary Side Bar accelerator. |diff --git a/packages/app/package.json b/packages/app/package.jsonindex 20eceed72..0dc7eb915 100644--- a/packages/app/package.json+++ b/packages/app/package.json@@ -44,7 +44,7 @@{"name": "main app bundle (gzipped)","path": "dist/assets/index-*.js",- "limit": "454 kB",+ "limit": "460 kB","gzip": true,"running": false},diff --git a/packages/app/src/components/EditorTabs.dom.test.tsx b/packages/app/src/components/EditorTabs.dom.test.tsxindex 33929039c..2b3c4e1b1 100644--- a/packages/app/src/components/EditorTabs.dom.test.tsx+++ b/packages/app/src/components/EditorTabs.dom.test.tsx@@ -1,5 +1,6 @@-import { afterEach, beforeEach, describe, expect, mock, test } from 'bun:test';+import { afterEach, beforeEach, describe, expect, jest, mock, test } from 'bun:test';import { act, cleanup, fireEvent, render, screen, waitFor, within } from '@testing-library/react';+import { isMacOS } from '@tiptap/core';import type { ReactNode } from 'react';import { assetTabId, folderTabId } from '@/editor/editor-tabs';import { renderLinguiTemplate } from '@/test-utils/lingui-mock';@@ -30,10 +31,15 @@ const closeTabs = mock(() => {});const getPoolActiveDocName = mock(() => null as string | null);const openNewTab = mock(() => {});const pinTab = mock(() => {});+const reopenClosedTab = mock(() => {});const remapTabsForRename = mock(() => {});const reorderTabs = mock(() => {});const unpinTab = mock(() => {});+function primaryShortcutModifier(): Pick<KeyboardEventInit, 'ctrlKey' | 'metaKey'> {+ return isMacOS() ? { metaKey: true } : { ctrlKey: true };+}+type DndContextProps = {accessibility?: { container?: HTMLElement };children?: ReactNode;@@ -188,6 +194,7 @@ mock.module('@/editor/DocumentContext', () => ({openTabs,pinTab,pinnedTabIds,+ reopenClosedTab,remapTabsForRename,reorderTabs,unpinTab,@@ -258,6 +265,7 @@ function resetState() {getPoolActiveDocName,openNewTab,pinTab,+ reopenClosedTab,remapTabsForRename,reorderTabs,unpinTab,@@ -309,6 +317,9 @@ describe('EditorTabs runtime behavior', () => {const markdownTab = tabButton('docs/team/notes.md');expect(markdownTab.textContent).toBe('notes');expect(markdownTab.getAttribute('title')).toBe('docs/team/notes.md');+ expect(markdownTab.closest('[data-sortable-id]')?.getAttribute('aria-keyshortcuts')).toBe(+ 'Meta+1 Control+1',+ );const mdxTab = tabButton('docs/team/spec.mdx');expect(mdxTab.textContent).toBe('spec');@@ -420,6 +431,117 @@ describe('EditorTabs runtime behavior', () => {);});+ test('handles tab keyboard shortcuts for create, navigation, jump, and reopen', async () => {+ const { newId } = defaultTabs();+ await renderEditorTabs();++ const primaryMod = primaryShortcutModifier();++ fireEvent.keyDown(window, { key: 't', ...primaryMod });+ expect(openNewTab).toHaveBeenCalledTimes(1);++ fireEvent.keyDown(window, { key: 'Tab', ctrlKey: true });+ expect(activateTab).toHaveBeenLastCalledWith('docs/team/readme');++ fireEvent.keyDown(window, { key: 'Tab', ctrlKey: true, shiftKey: true });+ expect(activateTab).toHaveBeenLastCalledWith('docs/team/notes');++ fireEvent.keyDown(window, { key: '1', ...primaryMod });+ expect(activateTab).toHaveBeenLastCalledWith('docs/team/notes');++ fireEvent.keyDown(window, { key: '9', ...primaryMod });+ expect(activateNewTab).toHaveBeenLastCalledWith(newId);++ fireEvent.keyDown(window, { key: 'T', ...primaryMod, shiftKey: true });+ expect(reopenClosedTab).toHaveBeenCalledTimes(1);++ activateNewTab.mockClear();+ activateTab.mockClear();+ fireEvent.keyDown(window, { key: '7', ...primaryMod });+ expect(activateNewTab).not.toHaveBeenCalled();+ expect(activateTab).not.toHaveBeenCalled();+ });++ test('tab cycling shortcuts wrap from last to first and first to last', async () => {+ const { newId } = defaultTabs();+ activeDocName = null;+ activeTabId = null;+ activeNewTabId = newId;+ isNewTabActive = true;+ await renderEditorTabs();++ fireEvent.keyDown(window, { key: 'Tab', ctrlKey: true });+ expect(activateTab).toHaveBeenLastCalledWith('docs/team/notes');++ cleanup();+ resetState();+ activeDocName = 'docs/team/notes';+ activeTabId = 'docs/team/notes';+ await renderEditorTabs();++ fireEvent.keyDown(window, { key: 'Tab', ctrlKey: true, shiftKey: true });+ expect(activateNewTab).toHaveBeenLastCalledWith(newId);+ });++ test('modifier hold delays per-tab shortcut hints and non-active close affordances', async () => {+ jest.useFakeTimers();+ try {+ await renderEditorTabs();++ expect(screen.queryAllByTestId('editor-tab-shortcut-hint')).toHaveLength(0);++ fireEvent.keyDown(window, { key: 'Meta', metaKey: true });++ expect(screen.queryAllByTestId('editor-tab-shortcut-hint')).toHaveLength(0);+ expectVisualClassTokens(+ screen.getByRole('button', { name: 'Close docs/team/notes.md' }).getAttribute('class'),+ ['pointer-events-none', 'opacity-0'],+ );+ expectVisualClassTokens(+ screen.getByRole('button', { name: 'Close new tab' }).getAttribute('class'),+ ['pointer-events-none', 'opacity-0'],+ );++ act(() => {+ jest.advanceTimersByTime(999);+ });++ expect(screen.queryAllByTestId('editor-tab-shortcut-hint')).toHaveLength(0);+ expectVisualClassTokens(+ screen.getByRole('button', { name: 'Close docs/team/notes.md' }).getAttribute('class'),+ ['pointer-events-none', 'opacity-0'],+ );++ act(() => {+ jest.advanceTimersByTime(1);+ });++ expect(+ screen.getAllByTestId('editor-tab-shortcut-hint').map((node) => node.textContent),+ ).toEqual(['⌘1', '⌘2', '⌘3', '⌘4', '⌘5', '⌘6']);+ expect(screen.queryByRole('button', { name: 'Close docs/team/notes.md' })).toBeNull();+ expect(screen.queryByRole('button', { name: 'Close new tab' })).toBeNull();++ fireEvent.blur(window);++ expect(screen.queryAllByTestId('editor-tab-shortcut-hint')).toHaveLength(0);+ expect(screen.getByRole('button', { name: 'Close docs/team/notes.md' })).toBeTruthy();++ fireEvent.keyDown(window, { key: 'Meta', metaKey: true });+ act(() => {+ jest.advanceTimersByTime(1000);+ });+ expect(screen.getAllByTestId('editor-tab-shortcut-hint')).toHaveLength(6);++ fireEvent.keyUp(window, { key: 'Meta' });++ expect(screen.queryAllByTestId('editor-tab-shortcut-hint')).toHaveLength(0);+ expect(screen.getByRole('button', { name: 'Close docs/team/notes.md' })).toBeTruthy();+ } finally {+ jest.useRealTimers();+ }+ });+test('context actions close visible document tabs in bulk while routing empty tabs through closeNewTab', async () => {const { newId } = defaultTabs();pinnedTabIds = ['docs/team/readme'];@@ -535,8 +657,13 @@ describe('EditorTabs runtime behavior', () => {lifecycleStatuses.set('docs/team/notes', 'conflict');await renderEditorTabs();- expect(screen.getByTestId('editor-tab-conflict-badge').getAttribute('aria-label')).toBe(- 'Conflict',+ const conflictedTabButton = screen.getByRole('button', {+ name: 'docs/team/notes.md (conflict)',+ });+ expect(conflictedTabButton).toBeTruthy();+ expect(conflictedTabButton.getAttribute('title')).toBe('docs/team/notes.md (conflict)');+ expect(screen.getByTestId('editor-tab-conflict-badge').getAttribute('aria-hidden')).toBe(+ 'true',);expect(screen.getAllByRole('menuitem', { name: 'Close' }).length).toBeGreaterThan(0);expect(screen.getAllByRole('menuitem', { name: 'Close others' }).length).toBeGreaterThan(0);@@ -557,7 +684,7 @@ describe('EditorTabs runtime behavior', () => {]);const inactiveClose = within(- tabButton('docs/team/notes.md').closest('[data-sortable-id]') as HTMLElement,+ conflictedTabButton.closest('[data-sortable-id]') as HTMLElement,).getByRole('button', { name: 'Close docs/team/notes.md' });expectVisualClassTokens(inactiveClose.className, ['mr-1.5']);diff --git a/packages/app/src/components/EditorTabs.tsx b/packages/app/src/components/EditorTabs.tsxindex b8479eda1..c515074ac 100644--- a/packages/app/src/components/EditorTabs.tsx+++ b/packages/app/src/components/EditorTabs.tsx@@ -50,6 +50,7 @@ import {InputGroupInput,InputGroupText,} from '@/components/ui/input-group';+import { Kbd } from '@/components/ui/kbd';import { useDocumentContext } from '@/editor/DocumentContext';import { captureRenameSnapshots } from '@/editor/editor-cache';import {@@ -62,6 +63,7 @@ import {import { useLifecycleStatus } from '@/hooks/use-lifecycle-status';import { hashFromDocName } from '@/lib/doc-hash';import { emitDocumentsChanged } from '@/lib/documents-events';+import { matchesKeyboardShortcut } from '@/lib/keyboard-shortcuts';import { parseServerResponse, parseSuccessOrWarn } from '@/lib/parse-server-response';import { cn } from '@/lib/utils';import {@@ -121,6 +123,55 @@ function stripRenameExtensionSuffix(value: string, docExt: string): string {return extension ? value.slice(0, -extension.length) : value;}+function hasTabShortcutModifier(event: globalThis.KeyboardEvent): boolean {+ return event.metaKey || event.ctrlKey;+}++const TAB_SHORTCUT_HINT_DELAY_MS = 1000;++function shortcutDigitForIndex(index: number, tabCount: number): string | null {+ if (index < 0 || index >= tabCount) return null;+ if (index < 8) return String(index + 1);+ return index === tabCount - 1 ? '9' : null;+}++function tabShortcutHintForIndex(index: number, tabCount: number): string | null {+ return shortcutDigitForIndex(index, tabCount);+}++function tabAriaKeyShortcutsForIndex(index: number, tabCount: number): string | undefined {+ const shortcutDigit = shortcutDigitForIndex(index, tabCount);+ if (!shortcutDigit) return undefined;+ return [`Meta+${shortcutDigit}`, `Control+${shortcutDigit}`].join(' ');+}++function jumpTabIndexFromShortcut(+ event: globalThis.KeyboardEvent,+ tabCount: number,+): number | null {+ if (!hasTabShortcutModifier(event) || event.altKey || event.shiftKey) return null;+ if (!/^[1-9]$/.test(event.key)) return null;+ const digit = Number(event.key);+ if (digit === 9) return tabCount > 0 ? tabCount - 1 : null;+ const index = digit - 1;+ return index < Math.min(8, tabCount) ? index : null;+}++function TabShortcutHint({ value }: { value: string }) {+ return (+ <span+ aria-hidden="true"+ data-testid="editor-tab-shortcut-hint"+ className={cn(+ getTabCloseButtonClass(true),+ 'font-mono tabular-nums hover:bg-transparent animate-in fade-in-0 zoom-in-95 duration-150 motion-reduce:animate-none motion-reduce:duration-0',+ )}+ >+ <Kbd className="text-[10px]">{`⌘${value}`}</Kbd>+ </span>+ );+}+/*** Sortable wrapper for one tab div, bound to `@dnd-kit/sortable`'s* `useSortable` so the whole tab (not a separate drag handle) is draggable.@@ -279,19 +330,27 @@ function EditorTabContextMenu({function TabPinOrCloseButton({accessibleLabel,closeTab,+ forceCloseVisible = false,isActive,isPinned,+ shortcutHint = null,tabId,unpinTab,}: {accessibleLabel: string;closeTab: (tabId: string) => void;+ forceCloseVisible?: boolean;isActive: boolean;isPinned: boolean;+ shortcutHint?: string | null;tabId: string;unpinTab: (tabId: string) => void;}) {const { t } = useLingui();+ if (shortcutHint) {+ return <TabShortcutHint value={shortcutHint} />;+ }+if (isPinned) {return (<Button@@ -318,7 +377,7 @@ function TabPinOrCloseButton({size="icon-xs"aria-label={t`Close ${accessibleLabel}`}data-testid="editor-tab-close-button"- className={getTabCloseButtonClass(isActive)}+ className={getTabCloseButtonClass(forceCloseVisible || isActive)}tabIndex={getTabCloseButtonTabIndex(isActive)}onClick={(event) => {event.stopPropagation();@@ -330,29 +389,67 @@ function TabPinOrCloseButton({);}-/**- * Per-tab lifecycle-status reader for the conflict badge. Renders an inline- * `⚠` icon adjacent to the tab name when the doc's `lifecycle.status` is- * `'conflict'`. Informational only — clicking the tab still goes through the- * existing tab-click activation; the editor-area swap to DiffViewBoundary- * fires from the lifecycle observer on the active tab, not from this badge.- *- * Returns `null` when the doc is clean or has no pool entry (closed tab) so- * the badge auto-clears as soon as the lifecycle Y.Map drops the conflict- * status.- */-function TabConflictBadge({ docName }: { docName: string }) {- const status = useLifecycleStatus(docName);- if (status !== 'conflict') return null;+// The parent tab button owns the accessible conflict label; this icon is visual.+function TabConflictBadge({ hasConflict }: { hasConflict: boolean }) {+ if (!hasConflict) return null;return (<AlertTriangle- aria-label="Conflict"+ aria-hidden="true"data-testid="editor-tab-conflict-badge"className="mr-1 size-3.5 shrink-0 text-amber-500"/>);}+function DocumentTabButton({+ accessibleLabel,+ activateTab,+ baseName,+ docName,+ enterRenameMode,+ extension,+ hideDocExtension,+ tabId,+}: {+ accessibleLabel: string;+ activateTab: (tabId: string) => void;+ baseName: string;+ docName: string;+ enterRenameMode: (tabId: string, docName: string) => void;+ extension: string;+ hideDocExtension: boolean;+ tabId: string;+}) {+ const { t } = useLingui();+ const lifecycleStatus = useLifecycleStatus(docName);+ const hasConflict = lifecycleStatus === 'conflict';+ const buttonAccessibleLabel = hasConflict ? t`${accessibleLabel} (conflict)` : accessibleLabel;++ return (+ <button+ type="button"+ aria-label={buttonAccessibleLabel}+ title={buttonAccessibleLabel}+ className={TAB_BUTTON_CLASS}+ onClick={() => {+ activateTab(tabId);+ }}+ onDoubleClick={(event) => {+ event.preventDefault();+ event.stopPropagation();+ enterRenameMode(tabId, docName);+ }}+ tabIndex={-1}+ >+ <TabConflictBadge hasConflict={hasConflict} />+ <span className="flex min-w-0 flex-1 items-center">+ <span className="min-w-0 truncate">{baseName}</span>+ {!hideDocExtension && <span className="shrink-0">{extension}</span>}+ </span>+ </button>+ );+}+export function EditorTabs() {const {activeDocName,@@ -373,6 +470,7 @@ export function EditorTabs() {openTabs,pinTab,pinnedTabIds,+ reopenClosedTab,remapTabsForRename,reorderTabs,unpinTab,@@ -386,11 +484,15 @@ export function EditorTabs() {const [renameValue, setRenameValue] = useState('');const [renameError, setRenameError] = useState<string | null>(null);const [isRenameLoading, setIsRenameLoading] = useState(false);+ const [showTabShortcutHints, setShowTabShortcutHints] = useState(false);const renameInputRef = useRef<HTMLInputElement>(null);const commitInProgressRef = useRef(false);const cancelRequestedRef = useRef(false);const lastFailedValueRef = useRef<string | null>(null);const activeDocNameRef = useRef(activeDocName);+ const tabShortcutHintTimerRef = useRef<number | null>(null);+ const isTabShortcutModifierHeldRef = useRef(false);+ const showTabShortcutHintsRef = useRef(false);const activeTabId =activeContextTabId ??(activeTarget@@ -408,6 +510,14 @@ export function EditorTabs() {activeDocNameRef.current = activeDocName;}, [activeDocName]);+ useEffect(() => {+ return () => {+ if (tabShortcutHintTimerRef.current === null) return;+ window.clearTimeout(tabShortcutHintTimerRef.current);+ tabShortcutHintTimerRef.current = null;+ };+ }, []);+useEffect(() => {if (!activeTabScrollKey) return;const activeTab = tabListRef.current?.querySelector<HTMLElement>('[data-active-tab="true"]');@@ -615,6 +725,115 @@ export function EditorTabs() {for (const tabId of emptyTabIds) closeNewTab(tabId);}+ useEffect(() => {+ const currentNewTabIds = new Set(newTabIds);++ function clearTabShortcutHintTimer() {+ if (tabShortcutHintTimerRef.current === null) return;+ window.clearTimeout(tabShortcutHintTimerRef.current);+ tabShortcutHintTimerRef.current = null;+ }++ function setTabShortcutModifierHeld(nextValue: boolean) {+ if (isTabShortcutModifierHeldRef.current === nextValue) return;+ isTabShortcutModifierHeldRef.current = nextValue;+ }++ function setTabShortcutHintsVisible(nextValue: boolean) {+ if (showTabShortcutHintsRef.current === nextValue) return;+ showTabShortcutHintsRef.current = nextValue;+ setShowTabShortcutHints(nextValue);+ }++ function scheduleTabShortcutHintReveal() {+ setTabShortcutModifierHeld(true);+ if (showTabShortcutHintsRef.current || tabShortcutHintTimerRef.current !== null) return;+ tabShortcutHintTimerRef.current = window.setTimeout(() => {+ tabShortcutHintTimerRef.current = null;+ if (!isTabShortcutModifierHeldRef.current) return;+ setTabShortcutHintsVisible(true);+ }, TAB_SHORTCUT_HINT_DELAY_MS);+ }++ function clearShortcutHints() {+ clearTabShortcutHintTimer();+ setTabShortcutModifierHeld(false);+ setTabShortcutHintsVisible(false);+ }++ function activateVisibleTab(tabId: string) {+ if (currentNewTabIds.has(tabId)) {+ activateNewTab(tabId);+ } else {+ activateTab(tabId);+ }+ }++ function activateTabByOffset(offset: number) {+ if (visibleTabIds.length === 0) return;+ const activeVisibleTabId = isNewTabActive ? activeNewTabId : activeTabId;+ const activeIndex = activeVisibleTabId ? visibleTabIds.indexOf(activeVisibleTabId) : -1;+ const baseIndex = activeIndex >= 0 ? activeIndex : 0;+ const nextIndex = (baseIndex + offset + visibleTabIds.length) % visibleTabIds.length;+ activateVisibleTab(visibleTabIds[nextIndex]);+ }++ function onKeyDown(event: globalThis.KeyboardEvent) {+ if (hasTabShortcutModifier(event)) scheduleTabShortcutHintReveal();++ if (matchesKeyboardShortcut(event, 'tab-new')) {+ event.preventDefault();+ openNewTab();+ return;+ }+ if (matchesKeyboardShortcut(event, 'tab-reopen-closed')) {+ event.preventDefault();+ reopenClosedTab();+ return;+ }+ if (matchesKeyboardShortcut(event, 'tab-next')) {+ event.preventDefault();+ activateTabByOffset(1);+ return;+ }+ if (matchesKeyboardShortcut(event, 'tab-previous')) {+ event.preventDefault();+ activateTabByOffset(-1);+ return;+ }++ const jumpIndex = jumpTabIndexFromShortcut(event, visibleTabIds.length);+ if (jumpIndex === null) return;+ event.preventDefault();+ activateVisibleTab(visibleTabIds[jumpIndex]);+ }++ function onKeyUp(event: globalThis.KeyboardEvent) {+ if (!event.metaKey && !event.ctrlKey) clearShortcutHints();+ }++ window.addEventListener('keydown', onKeyDown, { capture: true });+ window.addEventListener('keyup', onKeyUp, { capture: true });+ window.addEventListener('blur', clearShortcutHints);+ document.addEventListener('visibilitychange', clearShortcutHints);+ return () => {+ window.removeEventListener('keydown', onKeyDown, { capture: true });+ window.removeEventListener('keyup', onKeyUp, { capture: true });+ window.removeEventListener('blur', clearShortcutHints);+ document.removeEventListener('visibilitychange', clearShortcutHints);+ };+ }, [+ activeNewTabId,+ activeTabId,+ activateNewTab,+ activateTab,+ isNewTabActive,+ newTabIds,+ openNewTab,+ reopenClosedTab,+ visibleTabIds,+ ]);+// Tab drag-reorder. PointerSensor `distance: 8` keeps plain clicks from// initiating a drag (tabs differ from the PropertyPanel drag-handle pattern,// where the handle is a dedicated child — here the entire tab is the drag@@ -629,6 +848,7 @@ export function EditorTabs() {keyboardCodes: TAB_KEYBOARD_DRAG_CODES,}),);+ const forceTabCloseVisible = showTabShortcutHints;function handleDragStart() {setTabReorderBounds(measureTabReorderBounds(tabListRef.current));@@ -689,7 +909,11 @@ export function EditorTabs() {}}><SortableContext items={[...visibleTabIds]} strategy={horizontalListSortingStrategy}>- {visibleTabIds.map((tabId) => {+ {visibleTabIds.map((tabId, tabIndex) => {+ const shortcutHint = showTabShortcutHints+ ? tabShortcutHintForIndex(tabIndex, visibleTabIds.length)+ : null;+ const ariaKeyShortcuts = tabAriaKeyShortcutsForIndex(tabIndex, visibleTabIds.length);if (newTabIdSet.has(tabId)) {const isActive = tabId === activeNewTabId;return (@@ -708,6 +932,7 @@ export function EditorTabs() {tabId={tabId}activateFromKeyboard={() => activateNewTab(tabId)}aria-current={isActive ? 'page' : undefined}+ aria-keyshortcuts={ariaKeyShortcuts}data-active-tab={isActive ? 'true' : undefined}className={cn(TAB_BASE_CLASS,@@ -735,19 +960,23 @@ export function EditorTabs() {<Trans>New tab</Trans></span></button>- <button- type="button"- aria-label={t`Close new tab`}- data-testid="editor-new-tab-placeholder-close"- className={getTabCloseButtonClass(isActive)}- tabIndex={getTabCloseButtonTabIndex(isActive)}- onClick={(event) => {- event.stopPropagation();- closeNewTab(tabId);- }}- >- <XIcon aria-hidden="true" className="size-3.5" />- </button>+ {shortcutHint ? (+ <TabShortcutHint value={shortcutHint} />+ ) : (+ <button+ type="button"+ aria-label={t`Close new tab`}+ data-testid="editor-new-tab-placeholder-close"+ className={getTabCloseButtonClass(forceTabCloseVisible || isActive)}+ tabIndex={getTabCloseButtonTabIndex(isActive)}+ onClick={(event) => {+ event.stopPropagation();+ closeNewTab(tabId);+ }}+ >+ <XIcon aria-hidden="true" className="size-3.5" />+ </button>+ )}</SortableTab></EditorTabContextMenu>);@@ -774,6 +1003,7 @@ export function EditorTabs() {tabId={tabId}activateFromKeyboard={() => activateTab(tabId)}aria-current={isActive ? 'page' : undefined}+ aria-keyshortcuts={ariaKeyShortcuts}data-active-tab={isActive ? 'true' : undefined}className={cn(TAB_BASE_CLASS,@@ -823,8 +1053,10 @@ export function EditorTabs() {<TabPinOrCloseButtonaccessibleLabel={accessibleLabel}closeTab={closeTab}+ forceCloseVisible={forceTabCloseVisible}isActive={isActive}isPinned={isPinned}+ shortcutHint={shortcutHint}tabId={tabId}unpinTab={unpinTab}/>@@ -855,6 +1087,7 @@ export function EditorTabs() {tabId={tabId}activateFromKeyboard={() => activateTab(tabId)}aria-current={isActive ? 'page' : undefined}+ aria-keyshortcuts={ariaKeyShortcuts}data-active-tab={isActive ? 'true' : undefined}className={cn(TAB_BASE_CLASS,@@ -902,8 +1135,10 @@ export function EditorTabs() {<TabPinOrCloseButtonaccessibleLabel={accessibleLabel}closeTab={closeTab}+ forceCloseVisible={forceTabCloseVisible}isActive={isActive}isPinned={isPinned}+ shortcutHint={shortcutHint}tabId={tabId}unpinTab={unpinTab}/>@@ -936,6 +1171,7 @@ export function EditorTabs() {activateFromKeyboard={() => activateTab(tabId)}disabled={isRenaming}aria-current={isActive ? 'page' : undefined}+ aria-keyshortcuts={ariaKeyShortcuts}data-active-tab={isActive ? 'true' : undefined}className={cn(TAB_BASE_CLASS,@@ -1003,32 +1239,23 @@ export function EditorTabs() {</>) : (<>- <button- type="button"- aria-label={accessibleLabel}- title={accessibleLabel}- className={TAB_BUTTON_CLASS}- onClick={() => {- activateTab(tabId);- }}- onDoubleClick={(event) => {- event.preventDefault();- event.stopPropagation();- enterRenameMode(tabId, docName);- }}- tabIndex={-1}- >- <TabConflictBadge docName={docName} />- <span className="flex min-w-0 flex-1 items-center">- <span className="min-w-0 truncate">{baseName}</span>- {!hideDocExtension && <span className="shrink-0">{extension}</span>}- </span>- </button>+ <DocumentTabButton+ accessibleLabel={accessibleLabel}+ activateTab={activateTab}+ baseName={baseName}+ docName={docName}+ enterRenameMode={enterRenameMode}+ extension={extension}+ hideDocExtension={hideDocExtension}+ tabId={tabId}+ /><TabPinOrCloseButtonaccessibleLabel={accessibleLabel}closeTab={closeTab}+ forceCloseVisible={forceTabCloseVisible}isActive={isActive}isPinned={isPinned}+ shortcutHint={shortcutHint}tabId={tabId}unpinTab={unpinTab}/>diff --git a/packages/app/src/editor/DocumentContext.dom.test.tsx b/packages/app/src/editor/DocumentContext.dom.test.tsxindex 6a03892a9..89e09ec25 100644--- a/packages/app/src/editor/DocumentContext.dom.test.tsx+++ b/packages/app/src/editor/DocumentContext.dom.test.tsx@@ -5,9 +5,11 @@ import { type ReactNode, useLayoutEffect, useState } from 'react';import type { OkDesktopBridge } from '@/lib/desktop-bridge-types';import { docTabId, localTabSessionStorageKey } from './editor-tabs';+let mockCollabUrl: string | null = null;+mock.module('@/lib/use-collab-url', () => ({useCollabUrl: () => ({- collabUrl: null,+ collabUrl: mockCollabUrl,attempts: 0,terminal: false,lastError: null,@@ -19,6 +21,8 @@ const { DocumentProvider, useDocumentContext } = await import('./DocumentContextconst PINNED_TAB_ID = docTabId('Pinned.md');const OTHER_TAB_ID = docTabId('Other.md');+const THIRD_TAB_ID = docTabId('Third.md');+const originalFetch = globalThis.fetch;function seedTabSession() {window.localStorage.setItem(@@ -46,6 +50,19 @@ function seedActiveOtherTabSession() {);}+function seedThreeTabSession() {+ window.localStorage.setItem(+ localTabSessionStorageKey(window.location.origin),+ JSON.stringify({+ openTabs: [PINNED_TAB_ID, OTHER_TAB_ID, THIRD_TAB_ID],+ pinnedTabIds: [],+ activeDocName: 'Pinned.md',+ activeTabId: PINNED_TAB_ID,+ updatedAt: new Date('2026-05-13T00:00:00.000Z').toISOString(),+ }),+ );+}+function seedOnlyPinnedTabSession() {window.localStorage.setItem(localTabSessionStorageKey(window.location.origin),@@ -131,9 +148,21 @@ function CloseActiveHarness() {<button type="button" onClick={() => ctx.openNewTab()}>Open new</button>+ <button type="button" onClick={() => ctx.openDocument('Other.md')}>+ Open other+ </button>+ <button type="button" onClick={() => ctx.closeTab(OTHER_TAB_ID)}>+ Close other+ </button>+ <button type="button" onClick={() => ctx.closeTab(THIRD_TAB_ID)}>+ Close third+ </button><button type="button" onClick={() => setHandled(String(ctx.closeActiveTabOrWindow()))}>Close active</button>+ <button type="button" onClick={() => ctx.reopenClosedTab()}>+ Reopen closed+ </button></>);}@@ -156,6 +185,8 @@ describe('DocumentContext tab close force contract', () => {afterEach(() => {cleanup();delete window.okDesktop;+ mockCollabUrl = null;+ globalThis.fetch = originalFetch;window.localStorage.clear();window.location.hash = '';});@@ -194,6 +225,63 @@ describe('DocumentContext tab close force contract', () => {expect(screen.getByTestId('active-tab').textContent).toBe(PINNED_TAB_ID);});+ test('reopenClosedTab restores the most recently closed tab and activates it', async () => {+ seedActiveOtherTabSession();+ render(<CloseActiveHarness />, { wrapper: ProviderHarness });++ const user = userEvent.setup();+ await user.click(screen.getByRole('button', { name: 'Close active' }));++ expect(screen.getByTestId('open-tabs').textContent).toBe(PINNED_TAB_ID);+ expect(screen.getByTestId('active-tab').textContent).toBe(PINNED_TAB_ID);++ await user.click(screen.getByRole('button', { name: 'Reopen closed' }));++ expect(screen.getByTestId('open-tabs').textContent).toBe(`${PINNED_TAB_ID}|${OTHER_TAB_ID}`);+ expect(screen.getByTestId('active-tab').textContent).toBe(OTHER_TAB_ID);+ });++ test('reopenClosedTab skips already-open entries and continues to the next closed tab', async () => {+ mockCollabUrl = 'ws://localhost:1/collab';+ globalThis.fetch = mock(() => Promise.reject(new Error('unexpected fetch'))) as never;+ seedThreeTabSession();+ render(<CloseActiveHarness />, { wrapper: ProviderHarness });++ const user = userEvent.setup();+ await user.click(screen.getByRole('button', { name: 'Close third' }));+ await user.click(screen.getByRole('button', { name: 'Close other' }));++ expect(screen.getByTestId('open-tabs').textContent).toBe(PINNED_TAB_ID);++ await user.click(screen.getByRole('button', { name: 'Open other' }));++ expect(screen.getByTestId('open-tabs').textContent).toBe(`${PINNED_TAB_ID}|${OTHER_TAB_ID}`);+ expect(screen.getByTestId('active-tab').textContent).toBe(OTHER_TAB_ID);++ await user.click(screen.getByRole('button', { name: 'Reopen closed' }));++ expect(screen.getByTestId('open-tabs').textContent).toBe(+ `${PINNED_TAB_ID}|${OTHER_TAB_ID}|${THIRD_TAB_ID}`,+ );+ expect(screen.getByTestId('active-tab').textContent).toBe(THIRD_TAB_ID);+ });++ test('reopenClosedTab ignores closed new-tab placeholders', async () => {+ render(<CloseActiveHarness />, { wrapper: ProviderHarness });++ const user = userEvent.setup();+ await user.click(screen.getByRole('button', { name: 'Open new' }));+ await user.click(screen.getByRole('button', { name: 'Close active' }));++ expect(screen.getByTestId('new-tabs').textContent).toBe('');+ expect(screen.getByTestId('active-new-tab').textContent).toBe('');++ await user.click(screen.getByRole('button', { name: 'Reopen closed' }));++ expect(screen.getByTestId('new-tabs').textContent).toBe('');+ expect(screen.getByTestId('active-new-tab').textContent).toBe('');+ });+test('closeActiveTabOrWindow skips active pinned tab and closes the next visible unpinned tab', async () => {seedTabSession();render(<CloseActiveHarness />, { wrapper: ProviderHarness });diff --git a/packages/app/src/editor/DocumentContext.tsx b/packages/app/src/editor/DocumentContext.tsxindex 1da587ff5..220ca3821 100644--- a/packages/app/src/editor/DocumentContext.tsx+++ b/packages/app/src/editor/DocumentContext.tsx@@ -181,6 +181,8 @@ interface DocumentContextValue {activateNewTab: (tabId: string) => void;/** Close the empty tab placeholder and return to the nearest document tab. */closeNewTab: (tabId: string) => void;+ /** Reopen the most recently closed editor tab, if any. */+ reopenClosedTab: () => void;/*** Close multiple visible tabs with a single active-tab/navigation decision.* Pinned tabs are skipped unless `force` is set for backing file/folder removal.@@ -613,6 +615,7 @@ export function DocumentProvider({ children }: { children: ReactNode }) {const newTabIdsRef = useRef<string[]>(newTabIds);const visibleTabIdsRef = useRef<string[]>(visibleTabIds);const nextNewTabOrdinalRef = useRef(1);+ const recentlyClosedTabsRef = useRef<string[]>([]);// Set true when the user explicitly CLOSES (or unpins/replaces) a tab during// the async session-restore window. Bails the restore merge so a freshly-// closed tab cannot resurrect from the about-to-arrive restored snapshot.@@ -1232,11 +1235,78 @@ export function DocumentProvider({ children }: { children: ReactNode }) {openTargetWithOptions(target, options);};+ function pushRecentlyClosedTabs(tabIds: readonly string[]) {+ if (tabIds.length === 0) return;+ recentlyClosedTabsRef.current = [...recentlyClosedTabsRef.current, ...tabIds].slice(-50);+ }++ const activateTabById = (tabId: string) => {+ const tab = parseEditorTabId(tabId);+ commitActiveNewTabId(null);+ commitActiveTabId(tabId);+ if (tab.kind === 'doc') {+ if (collabUrl !== null) {+ const p = getPool(collabUrl);+ const entry = p.open(tab.docName);+ if (!entry) return;+ p.setActive(tab.docName);+ }+ setActiveTarget({ kind: 'doc', target: tab.docName, docName: tab.docName });+ const nextHash = hashFromDocName(tab.docName);+ if (window.location.hash !== nextHash) window.location.hash = nextHash;+ return;+ }+ if (collabUrl !== null) {+ const p = getPool(collabUrl);+ p.clearActive();+ }+ if (tab.kind === 'asset') {+ setActiveTarget(assetTargetForPath(tab.assetPath));+ const nextHash = hashFromAssetPath(tab.assetPath);+ if (window.location.hash !== nextHash) window.location.hash = nextHash;+ return;+ }+ if (tab.kind === 'skill-file') {+ setActiveTarget({+ kind: 'skill-file',+ target: `${tab.scope}/${tab.name}/${tab.path}`,+ scope: tab.scope,+ name: tab.name,+ path: tab.path,+ });+ const nextHash = hashFromSkillFile({ scope: tab.scope, name: tab.name, path: tab.path });+ if (window.location.hash !== nextHash) window.location.hash = nextHash;+ return;+ }+ setActiveTarget({ kind: 'folder', target: tab.folderPath, folderPath: tab.folderPath });+ const nextHash = hashFromFolderPath(tab.folderPath);+ if (window.location.hash !== nextHash) window.location.hash = nextHash;+ };++ const openNewTabById = () => {+ // Open a blank tab — additive, no close-during-restore mark.+ const nextNewTabId = `new-tab:${nextNewTabOrdinalRef.current}`;+ nextNewTabOrdinalRef.current += 1;+ commitNewTabIds([...newTabIdsRef.current, nextNewTabId]);+ commitActiveNewTabId(nextNewTabId);+ if (collabUrl !== null) {+ const p = getPool(collabUrl);+ p.clearActive();+ }+ setActiveTarget(null);+ commitActiveTabId(null);+ if (window.location.hash !== '') {+ window.location.hash = '';+ }+ };+const closeTabById = (tabId: string) => {if (pinnedTabIdsRef.current.includes(tabId)) return;+ if (!openTabsRef.current.includes(tabId)) return;markTabSessionClosedDuringRestore();let nextActiveTabId: string | null = null;const closingDocName = docNameForTabId(tabId);+ pushRecentlyClosedTabs([tabId]);if (collabUrl !== null) {const p = getPool(collabUrl);if (closingDocName && !hasOpenDocTab(openTabsRef.current, closingDocName, new Set([tabId]))) {@@ -1410,46 +1480,7 @@ export function DocumentProvider({ children }: { children: ReactNode }) {activateTab: (tabId: string) => {// Activate doesn't open/close tabs — only changes the active tab. The// restore's shouldRestoreActive gate respects the current hash, so no mark.- const tab = parseEditorTabId(tabId);- commitActiveNewTabId(null);- commitActiveTabId(tabId);- if (tab.kind === 'doc') {- if (collabUrl !== null) {- const p = getPool(collabUrl);- const entry = p.open(tab.docName);- if (!entry) return;- p.setActive(tab.docName);- }- setActiveTarget({ kind: 'doc', target: tab.docName, docName: tab.docName });- const nextHash = hashFromDocName(tab.docName);- if (window.location.hash !== nextHash) window.location.hash = nextHash;- return;- }- if (collabUrl !== null) {- const p = getPool(collabUrl);- p.clearActive();- }- if (tab.kind === 'asset') {- setActiveTarget(assetTargetForPath(tab.assetPath));- const nextHash = hashFromAssetPath(tab.assetPath);- if (window.location.hash !== nextHash) window.location.hash = nextHash;- return;- }- if (tab.kind === 'skill-file') {- setActiveTarget({- kind: 'skill-file',- target: `${tab.scope}/${tab.name}/${tab.path}`,- scope: tab.scope,- name: tab.name,- path: tab.path,- });- const nextHash = hashFromSkillFile({ scope: tab.scope, name: tab.name, path: tab.path });- if (window.location.hash !== nextHash) window.location.hash = nextHash;- return;- }- setActiveTarget({ kind: 'folder', target: tab.folderPath, folderPath: tab.folderPath });- const nextHash = hashFromFolderPath(tab.folderPath);- if (window.location.hash !== nextHash) window.location.hash = nextHash;+ activateTabById(tabId);},reorderTabs: (newOrder: readonly string[], draggedTabId: string) => {// Tab drag-reorder. newOrder is the desired visibleTabIds order after@@ -1520,22 +1551,7 @@ export function DocumentProvider({ children }: { children: ReactNode }) {newTabIds,activeNewTabId,isNewTabActive,- openNewTab: () => {- // Open a blank tab — additive, no close-during-restore mark.- const nextNewTabId = `new-tab:${nextNewTabOrdinalRef.current}`;- nextNewTabOrdinalRef.current += 1;- commitNewTabIds([...newTabIdsRef.current, nextNewTabId]);- commitActiveNewTabId(nextNewTabId);- if (collabUrl !== null) {- const p = getPool(collabUrl);- p.clearActive();- }- setActiveTarget(null);- commitActiveTabId(null);- if (window.location.hash !== '') {- window.location.hash = '';- }- },+ openNewTab: openNewTabById,activateNewTab: (tabId: string) => {// Activate only — no open/close. No close-during-restore mark.if (!newTabIdsRef.current.includes(tabId)) return;@@ -1551,6 +1567,29 @@ export function DocumentProvider({ children }: { children: ReactNode }) {}},closeNewTab: closeNewTabById,+ reopenClosedTab: () => {+ const stack = [...recentlyClosedTabsRef.current];+ while (stack.length > 0) {+ const tabId = stack.pop();+ if (!tabId) continue;+ if (openTabsRef.current.includes(tabId)) {+ recentlyClosedTabsRef.current = stack;+ continue;+ }+ const nextOpenTabs = addOpenTab(+ openTabsRef.current,+ tabId,+ MAX_POOL,+ pinnedTabIdsRef.current,+ );+ if (!nextOpenTabs.includes(tabId)) return;+ recentlyClosedTabsRef.current = stack;+ commitOpenTabs(nextOpenTabs);+ activateTabById(tabId);+ return;+ }+ recentlyClosedTabsRef.current = [];+ },closeTabs: (tabIds: readonly string[], options: CloseTabsOptions = {}) => {const requestedTabIds = tabIds.filter((tabId) => tabId.length > 0);const closingTabIds = new Set(@@ -1560,6 +1599,9 @@ export function DocumentProvider({ children }: { children: ReactNode }) {);if (closingTabIds.size === 0) return;markTabSessionClosedDuringRestore();+ if (!options.force) {+ pushRecentlyClosedTabs(openTabsRef.current.filter((tabId) => closingTabIds.has(tabId)));+ }if (collabUrl !== null) {const p = getPool(collabUrl);const closingByDocName = new Map<string, Set<string>>();diff --git a/packages/app/src/lib/keyboard-shortcuts.test.ts b/packages/app/src/lib/keyboard-shortcuts.test.tsindex 637a105bd..a20cd128f 100644--- a/packages/app/src/lib/keyboard-shortcuts.test.ts+++ b/packages/app/src/lib/keyboard-shortcuts.test.ts@@ -22,6 +22,10 @@ describe('keyboard shortcut registry', () => {expect(formatShortcut('new-folder', 'mac')).toBe('⇧⌘ N');expect(formatShortcut('new-folder', 'windowsLinux')).toBe('Ctrl Shift N');expect(formatShortcut('edit-with-ai', 'mac')).toBe('⇧⌘ I');+ expect(formatShortcut('tab-new', 'mac')).toBe('⌘ T');+ expect(formatShortcut('tab-next', 'mac')).toBe('⌃ Tab');+ expect(formatShortcut('tab-previous', 'mac')).toBe('⌃⇧ Tab');+ expect(formatShortcut('tab-reopen-closed', 'mac')).toBe('⇧⌘ T');});test('formats spoken shortcut labels for accessible names', () => {@@ -39,6 +43,7 @@ describe('keyboard shortcut registry', () => {expect(formatShortcutLabel('source-folding', 'windowsLinux')).toBe('Control Shift Left Bracket or Control Shift Right Bracket',);+ expect(formatShortcutLabel('tab-next', 'mac')).toBe('Control Tab');});test('matches settings shortcut exactly and excludes Alt combinations', () => {@@ -248,6 +253,58 @@ describe('keyboard shortcut registry', () => {).toBe(false);});+ test('matches tab shortcuts with strict modifiers', () => {+ expect(+ matchesKeyboardShortcut(+ { metaKey: true, ctrlKey: false, altKey: false, key: 't' },+ 'tab-new',+ 'mac',+ ),+ ).toBe(true);+ expect(+ matchesKeyboardShortcut(+ { metaKey: false, ctrlKey: true, altKey: false, key: 't' },+ 'tab-new',+ 'windowsLinux',+ ),+ ).toBe(true);+ expect(+ matchesKeyboardShortcut(+ { metaKey: false, ctrlKey: true, altKey: false, key: 't' },+ 'tab-new',+ 'mac',+ ),+ ).toBe(false);+ expect(+ matchesKeyboardShortcut(+ { metaKey: false, ctrlKey: true, altKey: false, key: 'Tab' },+ 'tab-next',+ 'mac',+ ),+ ).toBe(true);+ expect(+ matchesKeyboardShortcut(+ { metaKey: false, ctrlKey: true, altKey: false, shiftKey: true, key: 'Tab' },+ 'tab-next',+ 'mac',+ ),+ ).toBe(false);+ expect(+ matchesKeyboardShortcut(+ { metaKey: false, ctrlKey: true, altKey: false, shiftKey: true, key: 'Tab' },+ 'tab-previous',+ 'mac',+ ),+ ).toBe(true);+ expect(+ matchesKeyboardShortcut(+ { metaKey: true, ctrlKey: false, altKey: false, shiftKey: true, key: 'T' },+ 'tab-reopen-closed',+ 'mac',+ ),+ ).toBe(true);+ });+test('matches command palette with allowed extra modifiers and rejects missing mod', () => {expect(matchesKeyboardShortcut(diff --git a/packages/app/src/lib/keyboard-shortcuts.ts b/packages/app/src/lib/keyboard-shortcuts.tsindex fac472d5d..b881d305d 100644--- a/packages/app/src/lib/keyboard-shortcuts.ts+++ b/packages/app/src/lib/keyboard-shortcuts.ts@@ -15,6 +15,8 @@ export type ShortcutCategory =interface ShortcutMatchOptions {mod?: boolean;anyMod?: boolean;+ metaKey?: boolean;+ ctrlKey?: boolean;altKey?: boolean;shiftKey?: boolean;allowShiftKey?: boolean;@@ -188,6 +190,78 @@ const KEYBOARD_SHORTCUT_DEFINITIONS = [},],},+ {+ id: 'tab-new',+ category: 'navigation',+ title: msg`New tab`,+ description: msg`Open a blank editor tab.`,+ scope: msg`Global`,+ bindings: [+ {+ mac: '⌘ T',+ windowsLinux: 'Ctrl T',+ match: { key: 't', mod: true },+ },+ ],+ },+ {+ id: 'tab-next',+ category: 'navigation',+ title: msg`Next tab`,+ description: msg`Activate the next editor tab.`,+ scope: msg`Global`,+ bindings: [+ {+ mac: '⌃ Tab',+ windowsLinux: 'Ctrl Tab',+ match: { key: 'Tab', ctrlKey: true },+ },+ ],+ },+ {+ id: 'tab-previous',+ category: 'navigation',+ title: msg`Previous tab`,+ description: msg`Activate the previous editor tab.`,+ scope: msg`Global`,+ bindings: [+ {+ mac: '⌃⇧ Tab',+ windowsLinux: 'Ctrl Shift Tab',+ match: { key: 'Tab', ctrlKey: true, shiftKey: true },+ },+ ],+ },+ {+ id: 'tab-jump',+ category: 'navigation',+ title: msg`Jump to tab 1-8`,+ description: msg`Activate one of the first eight editor tabs.`,+ scope: msg`Global`,+ bindings: [{ mac: '⌘ 1-8', windowsLinux: 'Ctrl 1-8' }],+ },+ {+ id: 'tab-jump-last',+ category: 'navigation',+ title: msg`Jump to last tab`,+ description: msg`Activate the last editor tab.`,+ scope: msg`Global`,+ bindings: [{ mac: '⌘ 9', windowsLinux: 'Ctrl 9' }],+ },+ {+ id: 'tab-reopen-closed',+ category: 'navigation',+ title: msg`Reopen closed tab`,+ description: msg`Reopen the most recently closed editor tab.`,+ scope: msg`Global`,+ bindings: [+ {+ mac: '⇧⌘ T',+ windowsLinux: 'Ctrl Shift T',+ match: { key: 't', mod: true, shiftKey: true },+ },+ ],+ },{id: 'open-folder',category: 'workspace',@@ -793,8 +867,8 @@ function matchesBinding(if (match.key && event.key.toLowerCase() !== match.key.toLowerCase()) return false;if (match.code && event.code !== match.code) return false;- const expectedMeta = match.mod ? platform === 'mac' : false;- const expectedCtrl = match.mod ? platform === 'windowsLinux' : false;+ const expectedMeta = match.metaKey ?? (match.mod ? platform === 'mac' : false);+ const expectedCtrl = match.ctrlKey ?? (match.mod ? platform === 'windowsLinux' : false);const expectedAlt = match.altKey ?? false;const expectedShift = match.shiftKey ?? false;diff --git a/packages/app/src/locales/en/messages.json b/packages/app/src/locales/en/messages.jsonindex 95b75ffc1..a76f9ece4 100644--- a/packages/app/src/locales/en/messages.json+++ b/packages/app/src/locales/en/messages.json@@ -525,6 +525,7 @@"DF1MtZ": ["Loading conflict for ", ["filePath"]],"DFfRbX": ["Sync status: ", ["syncStateLabel"], " — git identity unset"],"DId6MT": ["Project-level pages with no outgoing graph edges."],+ "DJd000": ["Activate the previous editor tab."],"DPfwMq": ["Done"],"DVh_Tb": ["Failed to clean up after trash"],"DXd9LM": ["New worktree"],@@ -559,6 +560,7 @@"E1tG2u": ["Get Claude Code"],"E2Mv-X": ["Copy source"],"E4XYYH": ["Enable terminal for this project"],+ "E5WeIy": ["Reopen the most recently closed editor tab."],"E6lrpp": ["Manage the GitHub account OpenKnowledge uses to browse and sync your repositories."],@@ -880,6 +882,7 @@"Mb_20S": ["Visual"],"Md709y": ["Loading ", ["fileName"]],"MdpSC1": ["New skill"],+ "Mh_4hd": ["Previous tab"],"Mj8R8K": ["Couldn't install skill: ", ["0"]],"MmDDWK": ["Recently opened"],"MmqnGI": ["No global skills yet."],@@ -894,6 +897,7 @@["0"]," — your previous version is in history if you need to restore it."],+ "N1KkEO": ["Jump to last tab"],"N1YYa7": ["Loading image"],"N1mdmS": ["This file can't be opened in the text editor."],"N2FcBE": ["Synced"],@@ -1309,6 +1313,7 @@"ZBt4rI": ["Instruction for the AI"],"ZLQol-": ["You can turn this on later in <0>Settings → Sync</0>."],"ZNK2Tq": ["root"],+ "ZQJ1IV": ["Activate the last editor tab."],"ZQLDTl": ["created folder"],"ZU8VV_": ["Remove failed: ", ["error"]],"ZWgr0b": ["In a subfolder"],@@ -1327,6 +1332,7 @@"Zul8Ry": ["never"],"ZxXhLY": ["Hide Files (", ["sidebarShortcut"], ")"],"Zz25kq": ["Show Files (", ["sidebarShortcut"], ")"],+ "_6FVBz": ["Jump to tab 1-8"],"_7UQ7y": ["Whole word"],"_8quCH": ["From template"],"_902BE": [@@ -1617,6 +1623,7 @@"hjO0Mq": ["Add tab"],"hnq8fP": ["Remove ", ["label"], " from context"],"hpDtUm": ["External wiki link"],+ "hpzRlK": ["Reopen closed tab"],"hwFOFD": ["Settings failed to load"],"hxBHxQ": ["A line with a footnote<0><1>[1]</1></0> and a definition shown below."],"hxEUVJ": ["Initialize ", ["selectedPackName"]],@@ -1724,6 +1731,7 @@"l1l8sj": [["0"], "d ago"],"l3mSlL": ["Append-only timeline"],"l3s5ri": ["Import"],+ "l46MqT": ["Next tab"],"l6OXqI": ["No installed agents found"],"l8G3S9": ["Auto-sync is off — you don't have permission to push to this repo"],"lAiyU_": ["Only the current document uses <0>#", ["tag"], "</0>."],@@ -1765,6 +1773,7 @@],"mSJ3Rn": ["Computing scaffold plan"],"mU3j1b": ["Remove item ", ["0"]],+ "mVFyH-": [["accessibleLabel"], " (conflict)"],"mWVJRX": ["Collapsible section with a clickable summary."],"mY8U64": ["Teach agents a repeatable task. You can edit the body after creating."],"mYGY3B": ["Date"],@@ -2034,6 +2043,7 @@["trimmed"],"</0> will be created from the current commit, in its own worktree under <1>.ok/worktrees/</1>."],+ "t6w1cq": ["Open a blank editor tab."],"tAPZEx": ["Below"],"tHKQ6j": ["Renaming"],"tP5DDk": ["Apply link"],@@ -2044,6 +2054,7 @@"tfDRzk": ["Save"],"tfi40B": ["Failed to create page"],"tgWuMB": ["Modified"],+ "thnPBX": ["Activate the next editor tab."],"ti6aF_": ["Ask ", ["0"], " CLI"],"tiWX6q": ["Source editor"],"tjXez2": ["blog-post"],@@ -2133,6 +2144,7 @@"w7SsvI": ["That folder isn't an OpenKnowledge project yet. Initialize it and open?"],"w7nm4K": ["Indented blockquote for citations."],"wDgmsr": ["\"", ["0"], "\" install refreshed (", ["1"], ")"],+ "wGSHzy": ["Activate one of the first eight editor tabs."],"wJijgU": ["Location"],"wJo9oS": ["Close find"],"wQp1V3": ["Mirror of <0>", ["src"], "</0>"],diff --git a/packages/app/src/locales/en/messages.po b/packages/app/src/locales/en/messages.poindex 73ae38f35..a0a34cfad 100644--- a/packages/app/src/locales/en/messages.po+++ b/packages/app/src/locales/en/messages.po@@ -164,6 +164,10 @@ msgstr "{0}h ago"msgid "{0}m ago"msgstr "{0}m ago"+#: src/components/EditorTabs.tsx+msgid "{accessibleLabel} (conflict)"+msgstr "{accessibleLabel} (conflict)"+#: src/components/SyncStatusBadge.tsxmsgid "{ahead, plural, one {# commit ahead} other {# commits ahead}}"msgstr "{ahead, plural, one {# commit ahead} other {# commits ahead}}"@@ -561,6 +565,22 @@ msgstr "Actions for {label}"msgid "Activate new tab"msgstr "Activate new tab"+#: src/lib/keyboard-shortcuts.ts+msgid "Activate one of the first eight editor tabs."+msgstr "Activate one of the first eight editor tabs."++#: src/lib/keyboard-shortcuts.ts+msgid "Activate the last editor tab."+msgstr "Activate the last editor tab."++#: src/lib/keyboard-shortcuts.ts+msgid "Activate the next editor tab."+msgstr "Activate the next editor tab."++#: src/lib/keyboard-shortcuts.ts+msgid "Activate the previous editor tab."+msgstr "Activate the previous editor tab."+#: src/components/ActivityModeContent.tsxmsgid "Active"msgstr "Active"@@ -3561,10 +3581,18 @@ msgstr "Items to be created"msgid "Join us on Discord"msgstr "Join us on Discord"+#: src/lib/keyboard-shortcuts.ts+msgid "Jump to last tab"+msgstr "Jump to last tab"+#: src/editor/components/Pdf.tsxmsgid "Jump to page {pageNumber}"msgstr "Jump to page {pageNumber}"+#: src/lib/keyboard-shortcuts.ts+msgid "Jump to tab 1-8"+msgstr "Jump to tab 1-8"+#: src/components/FolderOverview.tsx#: src/components/FolderTimelineCard.tsx#: src/components/SyncStatusBadge.tsx@@ -4119,6 +4147,7 @@ msgid "New skill"msgstr "New skill"#: src/components/EditorTabs.tsx+#: src/lib/keyboard-shortcuts.tsmsgid "New tab"msgstr "New tab"@@ -4145,6 +4174,10 @@ msgstr "Next match"msgid "Next source diagnostic"msgstr "Next source diagnostic"+#: src/lib/keyboard-shortcuts.ts+msgid "Next tab"+msgstr "Next tab"+#: src/components/FileSidebar.tsxmsgid "No AI agents installed"msgstr "No AI agents installed"@@ -4509,6 +4542,10 @@ msgstr "Open <0><1>{verificationUri}</1><2/></0> and enter this code:"msgid "Open <0>Customize</0> in the sidebar <1/> <2>Skills</2>."msgstr "Open <0>Customize</0> in the sidebar <1/> <2>Skills</2>."+#: src/lib/keyboard-shortcuts.ts+msgid "Open a blank editor tab."+msgstr "Open a blank editor tab."+#: src/components/PublishToGitHubDialog.tsxmsgid "Open a doc to share its URL."msgstr "Open a doc to share its URL."@@ -5003,6 +5040,10 @@ msgstr "Preview unavailable: {errorDetail}"msgid "Previous match"msgstr "Previous match"+#: src/lib/keyboard-shortcuts.ts+msgid "Previous tab"+msgstr "Previous tab"+#: src/components/PublishToGitHubDialog.tsxmsgid "Private"msgstr "Private"@@ -5357,6 +5398,14 @@ msgstr "Renaming"msgid "Renaming changes the file on disk and the id agents use to pick this template."msgstr "Renaming changes the file on disk and the id agents use to pick this template."+#: src/lib/keyboard-shortcuts.ts+msgid "Reopen closed tab"+msgstr "Reopen closed tab"++#: src/lib/keyboard-shortcuts.ts+msgid "Reopen the most recently closed editor tab."+msgstr "Reopen the most recently closed editor tab."+#: src/components/EditorActivityPool.tsxmsgid "Reopening \"{docName}\" with a fresh local collaboration cache."msgstr "Reopening \"{docName}\" with a fresh local collaboration cache."diff --git a/packages/app/src/locales/pseudo/messages.json b/packages/app/src/locales/pseudo/messages.jsonindex e858ceee0..7278d1947 100644--- a/packages/app/src/locales/pseudo/messages.json+++ b/packages/app/src/locales/pseudo/messages.json@@ -525,6 +525,7 @@"DF1MtZ": ["Ĺōàďĩńĝ ćōńƒĺĩćţ ƒōŕ ", ["filePath"]],"DFfRbX": ["Śŷńć śţàţũś: ", ["syncStateLabel"], " — ĝĩţ ĩďēńţĩţŷ ũńśēţ"],"DId6MT": ["ƤŕōĴēćţ-ĺēvēĺ ƥàĝēś ŵĩţĥ ńō ōũţĝōĩńĝ ĝŕàƥĥ ēďĝēś."],+ "DJd000": ["Àćţĩvàţē ţĥē ƥŕēvĩōũś ēďĩţōŕ ţàƀ."],"DPfwMq": ["Ďōńē"],"DVh_Tb": ["Ƒàĩĺēď ţō ćĺēàń ũƥ àƒţēŕ ţŕàśĥ"],"DXd9LM": ["Ńēŵ ŵōŕķţŕēē"],@@ -559,6 +560,7 @@"E1tG2u": ["Ĝēţ Ćĺàũďē Ćōďē"],"E2Mv-X": ["Ćōƥŷ śōũŕćē"],"E4XYYH": ["Ēńàƀĺē ţēŕḿĩńàĺ ƒōŕ ţĥĩś ƥŕōĴēćţ"],+ "E5WeIy": ["Ŕēōƥēń ţĥē ḿōśţ ŕēćēńţĺŷ ćĺōśēď ēďĩţōŕ ţàƀ."],"E6lrpp": ["Ḿàńàĝē ţĥē ĜĩţĤũƀ àććōũńţ ŌƥēńĶńōŵĺēďĝē ũśēś ţō ƀŕōŵśē àńď śŷńć ŷōũŕ ŕēƥōśĩţōŕĩēś."],@@ -880,6 +882,7 @@"Mb_20S": ["Vĩśũàĺ"],"Md709y": ["Ĺōàďĩńĝ ", ["fileName"]],"MdpSC1": ["Ńēŵ śķĩĺĺ"],+ "Mh_4hd": ["Ƥŕēvĩōũś ţàƀ"],"Mj8R8K": ["Ćōũĺďń'ţ ĩńśţàĺĺ śķĩĺĺ: ", ["0"]],"MmDDWK": ["Ŕēćēńţĺŷ ōƥēńēď"],"MmqnGI": ["Ńō ĝĺōƀàĺ śķĩĺĺś ŷēţ."],@@ -894,6 +897,7 @@["0"]," — ŷōũŕ ƥŕēvĩōũś vēŕśĩōń ĩś ĩń ĥĩśţōŕŷ ĩƒ ŷōũ ńēēď ţō ŕēśţōŕē ĩţ."],+ "N1KkEO": ["ĵũḿƥ ţō ĺàśţ ţàƀ"],"N1YYa7": ["Ĺōàďĩńĝ ĩḿàĝē"],"N1mdmS": ["Ţĥĩś ƒĩĺē ćàń'ţ ƀē ōƥēńēď ĩń ţĥē ţēxţ ēďĩţōŕ."],"N2FcBE": ["Śŷńćēď"],@@ -1309,6 +1313,7 @@"ZBt4rI": ["Ĩńśţŕũćţĩōń ƒōŕ ţĥē ÀĨ"],"ZLQol-": ["Ŷōũ ćàń ţũŕń ţĥĩś ōń ĺàţēŕ ĩń <0>Śēţţĩńĝś → Śŷńć</0>."],"ZNK2Tq": ["ŕōōţ"],+ "ZQJ1IV": ["Àćţĩvàţē ţĥē ĺàśţ ēďĩţōŕ ţàƀ."],"ZQLDTl": ["ćŕēàţēď ƒōĺďēŕ"],"ZU8VV_": ["Ŕēḿōvē ƒàĩĺēď: ", ["error"]],"ZWgr0b": ["Ĩń à śũƀƒōĺďēŕ"],@@ -1327,6 +1332,7 @@"Zul8Ry": ["ńēvēŕ"],"ZxXhLY": ["Ĥĩďē Ƒĩĺēś (", ["sidebarShortcut"], ")"],"Zz25kq": ["Śĥōŵ Ƒĩĺēś (", ["sidebarShortcut"], ")"],+ "_6FVBz": ["ĵũḿƥ ţō ţàƀ 1-8"],"_7UQ7y": ["Ŵĥōĺē ŵōŕď"],"_8quCH": ["Ƒŕōḿ ţēḿƥĺàţē"],"_902BE": [@@ -1617,6 +1623,7 @@"hjO0Mq": ["Àďď ţàƀ"],"hnq8fP": ["Ŕēḿōvē ", ["label"], " ƒŕōḿ ćōńţēxţ"],"hpDtUm": ["Ēxţēŕńàĺ ŵĩķĩ ĺĩńķ"],+ "hpzRlK": ["Ŕēōƥēń ćĺōśēď ţàƀ"],"hwFOFD": ["Śēţţĩńĝś ƒàĩĺēď ţō ĺōàď"],"hxBHxQ": ["À ĺĩńē ŵĩţĥ à ƒōōţńōţē<0><1>[1]</1></0> àńď à ďēƒĩńĩţĩōń śĥōŵń ƀēĺōŵ."],"hxEUVJ": ["Ĩńĩţĩàĺĩźē ", ["selectedPackName"]],@@ -1724,6 +1731,7 @@"l1l8sj": [["0"], "ď àĝō"],"l3mSlL": ["Àƥƥēńď-ōńĺŷ ţĩḿēĺĩńē"],"l3s5ri": ["Ĩḿƥōŕţ"],+ "l46MqT": ["Ńēxţ ţàƀ"],"l6OXqI": ["Ńō ĩńśţàĺĺēď àĝēńţś ƒōũńď"],"l8G3S9": ["Àũţō-śŷńć ĩś ōƒƒ — ŷōũ ďōń'ţ ĥàvē ƥēŕḿĩśśĩōń ţō ƥũśĥ ţō ţĥĩś ŕēƥō"],"lAiyU_": ["Ōńĺŷ ţĥē ćũŕŕēńţ ďōćũḿēńţ ũśēś <0>#", ["tag"], "</0>."],@@ -1765,6 +1773,7 @@],"mSJ3Rn": ["Ćōḿƥũţĩńĝ śćàƒƒōĺď ƥĺàń"],"mU3j1b": ["Ŕēḿōvē ĩţēḿ ", ["0"]],+ "mVFyH-": [["accessibleLabel"], " (ćōńƒĺĩćţ)"],"mWVJRX": ["Ćōĺĺàƥśĩƀĺē śēćţĩōń ŵĩţĥ à ćĺĩćķàƀĺē śũḿḿàŕŷ."],"mY8U64": ["Ţēàćĥ àĝēńţś à ŕēƥēàţàƀĺē ţàśķ. Ŷōũ ćàń ēďĩţ ţĥē ƀōďŷ àƒţēŕ ćŕēàţĩńĝ."],"mYGY3B": ["Ďàţē"],@@ -2034,6 +2043,7 @@["trimmed"],"</0> ŵĩĺĺ ƀē ćŕēàţēď ƒŕōḿ ţĥē ćũŕŕēńţ ćōḿḿĩţ, ĩń ĩţś ōŵń ŵōŕķţŕēē ũńďēŕ <1>.ōķ/ŵōŕķţŕēēś/</1>."],+ "t6w1cq": ["Ōƥēń à ƀĺàńķ ēďĩţōŕ ţàƀ."],"tAPZEx": ["ßēĺōŵ"],"tHKQ6j": ["Ŕēńàḿĩńĝ"],"tP5DDk": ["Àƥƥĺŷ ĺĩńķ"],@@ -2044,6 +2054,7 @@"tfDRzk": ["Śàvē"],"tfi40B": ["Ƒàĩĺēď ţō ćŕēàţē ƥàĝē"],"tgWuMB": ["Ḿōďĩƒĩēď"],+ "thnPBX": ["Àćţĩvàţē ţĥē ńēxţ ēďĩţōŕ ţàƀ."],"ti6aF_": ["Àśķ ", ["0"], " ĆĹĨ"],"tiWX6q": ["Śōũŕćē ēďĩţōŕ"],"tjXez2": ["ƀĺōĝ-ƥōśţ"],@@ -2133,6 +2144,7 @@"w7SsvI": ["Ţĥàţ ƒōĺďēŕ ĩśń'ţ àń ŌƥēńĶńōŵĺēďĝē ƥŕōĴēćţ ŷēţ. Ĩńĩţĩàĺĩźē ĩţ àńď ōƥēń?"],"w7nm4K": ["Ĩńďēńţēď ƀĺōćķǫũōţē ƒōŕ ćĩţàţĩōńś."],"wDgmsr": ["\"", ["0"], "\" ĩńśţàĺĺ ŕēƒŕēśĥēď (", ["1"], ")"],+ "wGSHzy": ["Àćţĩvàţē ōńē ōƒ ţĥē ƒĩŕśţ ēĩĝĥţ ēďĩţōŕ ţàƀś."],"wJijgU": ["Ĺōćàţĩōń"],"wJo9oS": ["Ćĺōśē ƒĩńď"],"wQp1V3": ["Ḿĩŕŕōŕ ōƒ <0>", ["src"], "</0>"],diff --git a/packages/app/src/locales/pseudo/messages.po b/packages/app/src/locales/pseudo/messages.poindex f4f9757df..0ecede831 100644--- a/packages/app/src/locales/pseudo/messages.po+++ b/packages/app/src/locales/pseudo/messages.po@@ -164,6 +164,10 @@ msgstr ""msgid "{0}m ago"msgstr ""+#: src/components/EditorTabs.tsx+msgid "{accessibleLabel} (conflict)"+msgstr ""+#: src/components/SyncStatusBadge.tsxmsgid "{ahead, plural, one {# commit ahead} other {# commits ahead}}"msgstr ""@@ -556,6 +560,22 @@ msgstr ""msgid "Activate new tab"msgstr ""+#: src/lib/keyboard-shortcuts.ts+msgid "Activate one of the first eight editor tabs."+msgstr ""++#: src/lib/keyboard-shortcuts.ts+msgid "Activate the last editor tab."+msgstr ""++#: src/lib/keyboard-shortcuts.ts+msgid "Activate the next editor tab."+msgstr ""++#: src/lib/keyboard-shortcuts.ts+msgid "Activate the previous editor tab."+msgstr ""+#: src/components/ActivityModeContent.tsxmsgid "Active"msgstr ""@@ -3556,10 +3576,18 @@ msgstr ""msgid "Join us on Discord"msgstr ""+#: src/lib/keyboard-shortcuts.ts+msgid "Jump to last tab"+msgstr ""+#: src/editor/components/Pdf.tsxmsgid "Jump to page {pageNumber}"msgstr ""+#: src/lib/keyboard-shortcuts.ts+msgid "Jump to tab 1-8"+msgstr ""+#: src/components/FolderOverview.tsx#: src/components/FolderTimelineCard.tsx#: src/components/SyncStatusBadge.tsx@@ -4114,6 +4142,7 @@ msgid "New skill"msgstr ""#: src/components/EditorTabs.tsx+#: src/lib/keyboard-shortcuts.tsmsgid "New tab"msgstr ""@@ -4140,6 +4169,10 @@ msgstr ""msgid "Next source diagnostic"msgstr ""+#: src/lib/keyboard-shortcuts.ts+msgid "Next tab"+msgstr ""+#: src/components/FileSidebar.tsxmsgid "No AI agents installed"msgstr ""@@ -4504,6 +4537,10 @@ msgstr ""msgid "Open <0>Customize</0> in the sidebar <1/> <2>Skills</2>."msgstr ""+#: src/lib/keyboard-shortcuts.ts+msgid "Open a blank editor tab."+msgstr ""+#: src/components/PublishToGitHubDialog.tsxmsgid "Open a doc to share its URL."msgstr ""@@ -4998,6 +5035,10 @@ msgstr ""msgid "Previous match"msgstr ""+#: src/lib/keyboard-shortcuts.ts+msgid "Previous tab"+msgstr ""+#: src/components/PublishToGitHubDialog.tsxmsgid "Private"msgstr ""@@ -5352,6 +5393,14 @@ msgstr ""msgid "Renaming changes the file on disk and the id agents use to pick this template."msgstr ""+#: src/lib/keyboard-shortcuts.ts+msgid "Reopen closed tab"+msgstr ""++#: src/lib/keyboard-shortcuts.ts+msgid "Reopen the most recently closed editor tab."+msgstr ""+#: src/components/EditorActivityPool.tsxmsgid "Reopening \"{docName}\" with a fresh local collaboration cache."msgstr ""