@@ -31,7 +31,8 @@ export class DeleteCommandHandler extends TreeViewCommandHandler<DownloadedExpor
3131
3232 private confirm (
3333 itemName : string ,
34- hasLocalFile = true
34+ hasLocalFile = true ,
35+ detail : string | undefined | null = '数据可能无法恢复, 请谨慎操作!'
3536 ) : Thenable < null | { shouldDeleteLocal : boolean } | undefined > {
3637 const options : ( MessageItem & {
3738 result : ReturnType < DeleteCommandHandler [ 'confirm' ] > extends Thenable < infer R > ? R : never ;
@@ -42,7 +43,7 @@ export class DeleteCommandHandler extends TreeViewCommandHandler<DownloadedExpor
4243 return window
4344 . showInformationMessage (
4445 `确定要删除 ${ itemName } 吗?` ,
45- { modal : true , detail : '数据可能无法恢复, 请谨慎操作!' } ,
46+ { modal : true , detail : detail ? detail : undefined } ,
4647 ...options
4748 )
4849 . then (
@@ -55,26 +56,30 @@ export class DeleteCommandHandler extends TreeViewCommandHandler<DownloadedExpor
5556 item : DownloadedExportTreeItem ,
5657 { hasConfirmed = false } = { }
5758 ) : Promise < void > {
58- const parent = item . parent ;
59- const isChildOfRecord = parent instanceof BlogExportRecordTreeItem ;
6059 const result = hasConfirmed
6160 ? { shouldDeleteLocal : true }
62- : await this . confirm ( `博客备份-${ path . basename ( item . downloadedExport . filePath ) } ` , ! isChildOfRecord ) ;
61+ : await this . confirm (
62+ `博客备份-${ path . basename ( item . downloadedExport . filePath ) } ` ,
63+ false ,
64+ '删除后备份文件无法恢复'
65+ ) ;
6366 if ( result == null ) return ;
6467
65- let { shouldDeleteLocal } = result ;
66- shouldDeleteLocal = shouldDeleteLocal || isChildOfRecord ;
67- await this . removeDownloadedBlogExport ( item . downloadedExport , { shouldDeleteLocal } ) ;
68+ await this . removeDownloadedBlogExport ( item . downloadedExport , { shouldDeleteLocal : true } ) ;
6869
69- if ( shouldDeleteLocal ) await BlogExportProvider . optionalInstance ?. refreshRecords ( { force : false } ) ;
70- else await BlogExportProvider . optionalInstance ?. refreshDownloadedExports ( ) ;
70+ await BlogExportProvider . optionalInstance ?. refreshRecords ( { force : false } ) ;
71+ await BlogExportProvider . optionalInstance ?. refreshDownloadedExports ( ) ;
7172 }
7273
7374 private async deleteExportRecordItem ( item : BlogExportRecordTreeItem ) {
7475 const { record } = item ;
7576 const downloaded = await DownloadedExportStore . instance . findById ( record . id ) ;
7677
77- const confirmResult = await this . confirm ( `云端博客备份-${ record . fileName } ` , downloaded != null ) ;
78+ const confirmResult = await this . confirm (
79+ `云端博客备份-${ record . fileName } ` ,
80+ downloaded != null ,
81+ '删除后备份无法恢复'
82+ ) ;
7883 if ( confirmResult == null ) return ;
7984
8085 const { shouldDeleteLocal } = confirmResult ;
0 commit comments