mirror of
https://github.com/friebetill/obsidian-file-diff.git
synced 2026-07-22 07:40:25 +00:00
Improve UX by opening in active leaf
This commit is contained in:
parent
81c8172a11
commit
e56eac7508
1 changed files with 11 additions and 9 deletions
20
src/main.ts
20
src/main.ts
|
|
@ -63,15 +63,17 @@ export default class FileDiffPlugin extends Plugin {
|
|||
}
|
||||
|
||||
// Open differences view
|
||||
const workspaceLeaf = this.app.workspace.getLeaf()
|
||||
await workspaceLeaf.open(
|
||||
new DifferencesView({
|
||||
leaf: workspaceLeaf,
|
||||
file1: activeFile,
|
||||
file2: compareFile,
|
||||
showMergeOption: true,
|
||||
})
|
||||
)
|
||||
const workspaceLeaf = this.app.workspace.getMostRecentLeaf()
|
||||
if (workspaceLeaf != null) {
|
||||
await workspaceLeaf.open(
|
||||
new DifferencesView({
|
||||
leaf: workspaceLeaf,
|
||||
file1: activeFile,
|
||||
file2: compareFile,
|
||||
showMergeOption: true,
|
||||
})
|
||||
)
|
||||
}
|
||||
},
|
||||
})
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue