mirror of
https://github.com/friebetill/obsidian-file-diff.git
synced 2026-07-22 07:40:25 +00:00
Improve UX by opening file 1 after deleting file 2
This commit is contained in:
parent
fbd14edf23
commit
81c8172a11
1 changed files with 6 additions and 3 deletions
|
|
@ -1,5 +1,4 @@
|
|||
import { Modal, TFile } from 'obsidian'
|
||||
import { DifferencesView } from '../differences_view'
|
||||
|
||||
export class DeleteFileModal extends Modal {
|
||||
constructor(args: {
|
||||
|
|
@ -52,8 +51,12 @@ export class DeleteFileModal extends Modal {
|
|||
this.app.vault.delete(this.file2)
|
||||
|
||||
this.close()
|
||||
// Close currently active file
|
||||
this.app.workspace.getActiveViewOfType(DifferencesView)?.leaf.detach()
|
||||
|
||||
const leaf = this.app.workspace.getMostRecentLeaf()
|
||||
if (leaf != null) {
|
||||
leaf.openFile(this.file1)
|
||||
}
|
||||
|
||||
this.onDone(null)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue