feat(project-tree): Undo restores files deleted in the Project view (#1103)

Ctrl+Z / Cmd+Z in the Project view (and Edit › Undo while it has focus) reverts the latest file operation there: a delete as well as a move or rename. Deleted files come back from their last Local History snapshot, folders are re-created and the restored items selected; items without a snapshot are named in a warning. Edit › Undo reaches the view through a new registerUndoHandler contribution; the Project view is found by a data attribute instead of its translated aria-label (also fixes the New popup's fallback anchor).
Цей коміт міститься в:
l0ng-ai authored and GitHub committed 2026-11-04 04:53:48 +08:00
1 джерело fe0ee338f4
коміт 5ad5dc2a28
8 files changed
+184 -11

No files matched your search

+2 -1
Переглянути файл
@@ -3,7 +3,7 @@ import { EditorView } from "@codemirror/view";
import type { Action } from "@/platform/actions";
import { t } from "@/platform/i18n";
import { call, commands, isTauri } from "@/platform/ipc";
import { maybeEditorService, notifications } from "@/workbench/contributions";
import { maybeEditorService, notifications, runUndoHandlers } from "@/workbench/contributions";
import { showAbout } from "./AboutDialog";
import { quitApp } from "./closeGuard";
import { guessOs } from "./host";
@@ -46,6 +46,7 @@ export function editCommand(command: "undo" | "redo" | "cut" | "copy" | "paste"
(command === "undo" ? undo : redo)(view);
return;
}
if (focused instanceof Element && runUndoHandlers(command, focused)) return;
}
if (command === "paste" && navigator.clipboard?.readText) {
void navigator.clipboard.readText().then((text) => document.execCommand("insertText", false, text));