Improve UX by opening in active leaf

This commit is contained in:
friebetill 2023-02-15 21:45:30 +08:00
parent 81c8172a11
commit e56eac7508

View file

@ -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,
})
)
}
},
})
}