дзеркало
https://github.com/l0ng-ai/openidea.git
синхронізовано 2026-12-05 09:41:34 +02:00
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.
28 рядки
1.0 KiB
TypeScript
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}
|
|
/>
|
|
}
|
|
/>
|
|
);
|
|
}
|