feat: restore files from trash

This commit is contained in:
2026-06-28 22:18:44 +08:00
parent e5bdaec0aa
commit cc0c050985
11 changed files with 505 additions and 24 deletions
+4 -2
View File
@@ -66,6 +66,8 @@ export function ListPluginCapabilities(arg1:string):Promise<Array<capability.Ent
export function ListVaultFiles(arg1:string,arg2:string):Promise<Array<files.FileEntry>|string>;
export function ListVaultTrash(arg1:string):Promise<Array<files.TrashEntry>|string>;
export function ListWorkspaces():Promise<Array<workspace.Workspace>|string>;
export function MoveVaultPath(arg1:string,arg2:string,arg3:string,arg4:files.MoveOptions):Promise<string>;
@@ -106,6 +108,8 @@ export function RecordDesiredPlugin(arg1:string,arg2:string,arg3:string):Promise
export function ReloadPlugins():Promise<number|string>;
export function RestoreVaultTrash(arg1:string,arg2:string,arg3:files.RestoreOptions):Promise<string|string>;
export function RenameWorkspace(arg1:string,arg2:string):Promise<string>;
export function RenameWorkspaceNode(arg1:string,arg2:string):Promise<string>;
@@ -126,8 +130,6 @@ export function SubscribePluginEvent(arg1:string,arg2:string):Promise<string>;
export function TrashVaultPath(arg1:string,arg2:string):Promise<files.TrashResult|string>;
export function ListVaultTrash(arg1:string):Promise<any[]|string>;
export function TrashWorkspace(arg1:string):Promise<workspace.TrashResult|string>;
export function UpdateAppSettings(arg1:Record<string, any>):Promise<string>;
+8 -4
View File
@@ -118,6 +118,10 @@ export function ListVaultFiles(arg1, arg2) {
return window['go']['api']['App']['ListVaultFiles'](arg1, arg2);
}
export function ListVaultTrash(arg1) {
return window['go']['api']['App']['ListVaultTrash'](arg1);
}
export function ListWorkspaces() {
return window['go']['api']['App']['ListWorkspaces']();
}
@@ -198,6 +202,10 @@ export function ReloadPlugins() {
return window['go']['api']['App']['ReloadPlugins']();
}
export function RestoreVaultTrash(arg1, arg2, arg3) {
return window['go']['api']['App']['RestoreVaultTrash'](arg1, arg2, arg3);
}
export function RenameWorkspace(arg1, arg2) {
return window['go']['api']['App']['RenameWorkspace'](arg1, arg2);
}
@@ -238,10 +246,6 @@ export function TrashVaultPath(arg1, arg2) {
return window['go']['api']['App']['TrashVaultPath'](arg1, arg2);
}
export function ListVaultTrash(arg1) {
return window['go']['api']['App']['ListVaultTrash'](arg1);
}
export function TrashWorkspace(arg1) {
return window['go']['api']['App']['TrashWorkspace'](arg1);
}
+109 -18
View File
@@ -1,5 +1,51 @@
export namespace api {
export class FlatContextMenuEntry {
pluginId: string;
id: string;
label: string;
context: string;
group?: string;
capability?: string;
handler?: string;
static createFrom(source: any = {}) {
return new FlatContextMenuEntry(source);
}
constructor(source: any = {}) {
if ('string' === typeof source) source = JSON.parse(source);
this.pluginId = source["pluginId"];
this.id = source["id"];
this.label = source["label"];
this.context = source["context"];
this.group = source["group"];
this.capability = source["capability"];
this.handler = source["handler"];
}
}
export class FlatAction {
pluginId: string;
id: string;
label: string;
icon?: string;
capability?: string;
handler?: string;
static createFrom(source: any = {}) {
return new FlatAction(source);
}
constructor(source: any = {}) {
if ('string' === typeof source) source = JSON.parse(source);
this.pluginId = source["pluginId"];
this.id = source["id"];
this.label = source["label"];
this.icon = source["icon"];
this.capability = source["capability"];
this.handler = source["handler"];
}
}
export class FlatWorkspaceItem {
pluginId: string;
id: string;
@@ -80,24 +126,6 @@ export namespace api {
return a;
}
}
export class FlatSearchProvider {
pluginId: string;
id: string;
label: string;
handler: string;
static createFrom(source: any = {}) {
return new FlatSearchProvider(source);
}
constructor(source: any = {}) {
if ('string' === typeof source) source = JSON.parse(source);
this.pluginId = source["pluginId"];
this.id = source["id"];
this.label = source["label"];
this.handler = source["handler"];
}
}
export class FlatStatusBarItem {
pluginId: string;
id: string;
@@ -160,6 +188,24 @@ export namespace api {
this.component = source["component"];
}
}
export class FlatSearchProvider {
pluginId: string;
id: string;
label: string;
handler: string;
static createFrom(source: any = {}) {
return new FlatSearchProvider(source);
}
constructor(source: any = {}) {
if ('string' === typeof source) source = JSON.parse(source);
this.pluginId = source["pluginId"];
this.id = source["id"];
this.label = source["label"];
this.handler = source["handler"];
}
}
export class FlatCommand {
pluginId: string;
id: string;
@@ -209,6 +255,9 @@ export namespace api {
statusBarItems: FlatStatusBarItem[];
openProviders: FlatOpenProvider[];
workspaceItems: FlatWorkspaceItem[];
fileActions: FlatAction[];
noteActions: FlatAction[];
contextMenuEntries: FlatContextMenuEntry[];
static createFrom(source: any = {}) {
return new ContributionSummary(source);
@@ -224,6 +273,9 @@ export namespace api {
this.statusBarItems = this.convertValues(source["statusBarItems"], FlatStatusBarItem);
this.openProviders = this.convertValues(source["openProviders"], FlatOpenProvider);
this.workspaceItems = this.convertValues(source["workspaceItems"], FlatWorkspaceItem);
this.fileActions = this.convertValues(source["fileActions"], FlatAction);
this.noteActions = this.convertValues(source["noteActions"], FlatAction);
this.contextMenuEntries = this.convertValues(source["contextMenuEntries"], FlatContextMenuEntry);
}
convertValues(a: any, classs: any, asMap: boolean = false): any {
@@ -252,6 +304,9 @@ export namespace api {
export class SyncStatusDTO {
configured: boolean;
serverUrl: string;
@@ -390,6 +445,42 @@ export namespace files {
this.overwrite = source["overwrite"];
}
}
export class RestoreOptions {
targetPath?: string;
overwrite: boolean;
static createFrom(source: any = {}) {
return new RestoreOptions(source);
}
constructor(source: any = {}) {
if ('string' === typeof source) source = JSON.parse(source);
this.targetPath = source["targetPath"];
this.overwrite = source["overwrite"];
}
}
export class TrashEntry {
originalPath: string;
trashPath: string;
trashId: string;
deletedAt: string;
originalType: string;
basename: string;
static createFrom(source: any = {}) {
return new TrashEntry(source);
}
constructor(source: any = {}) {
if ('string' === typeof source) source = JSON.parse(source);
this.originalPath = source["originalPath"];
this.trashPath = source["trashPath"];
this.trashId = source["trashId"];
this.deletedAt = source["deletedAt"];
this.originalType = source["originalType"];
this.basename = source["basename"];
}
}
export class TrashResult {
originalPath: string;
trashPath: string;