Файли
openidea/src/features/vcs/diff-editor-tab.tsx
T
l0ng-ai 7ec0a4fed2 feat(diff): Esc closes a diff tab; switch panes with ⌃⇧⇥; move a diff window back to a tab (#3517)
Close Diff Editor: Esc in a diff editor tab closes it once the find bar, a selection, completion or a popup don't take it; panels, dialogs and diff windows keep their own Esc. Select Opposite Diff Pane (⌃⇧⇥ in the IntelliJ keymaps) moves focus to the other side of a side-by-side diff and wins over the Switcher while a diff is focused. A diff window's Show Diff in Editor Tab saves its edits, opens the diff as a tab in its project window and closes the window.
2026-11-15 18:42:16 +08:00

28 рядки
1.0 KiB
TypeScript

import { editorService, type EditorInput } from "@/workbench/contributions";
import { hideAllToolWindows, useToolWindowLayout } from "@/workbench/toolwindows/store";
import { shortcutLabel } from "@/platform/keymap";
import { IconButton } from "@/ui";
import { DiffEditor } from "./DiffEditor";
import type { DiffData } from "./diffInput";
export function DiffEditorTab({ input }: { input: EditorInput }) {
const maximized = useToolWindowLayout((state) => !!state.stashed && !Object.values(state.visible).some(Boolean));
if ((input.data as DiffData).embedded) return <DiffEditor input={input} />;
return (
<DiffEditor
input={input}
onClose={() => void editorService().closeInput?.(input.key)}
toolbarActions={
<IconButton
icon={maximized ? "minimize" : "maximize"}
title={maximized ? "Restore Size" : "Maximize Editor"}
shortcut={shortcutLabel("toolwindow.hideAll")}
pressed={maximized}
size="small"
onClick={hideAllToolWindows}
/>
}
/>
);
}