mirror of
https://github.com/mossy1022/Smart-Connections-Visualizer.git
synced 2026-07-22 05:14:43 +00:00
Fix for no nodes bug + only allowed one view at a time
This commit is contained in:
parent
2cda805032
commit
084891cee1
3 changed files with 21 additions and 15 deletions
32
main.ts
32
main.ts
|
|
@ -2057,22 +2057,28 @@ export default class ScGraphView extends Plugin {
|
|||
// Register the new view
|
||||
this.registerView("smart-connections-visualizer", (leaf: WorkspaceLeaf) => new ScGraphItemView(leaf, this));
|
||||
|
||||
// Register hover link source
|
||||
this.registerHoverLinkSource('smart-connections-visualizer', {
|
||||
display: 'Smart connections visualizer hover link source',
|
||||
defaultMod: true
|
||||
});
|
||||
// Register hover link source
|
||||
this.registerHoverLinkSource('smart-connections-visualizer', {
|
||||
display: 'Smart connections visualizer hover link source',
|
||||
defaultMod: true
|
||||
});
|
||||
|
||||
// This creates an icon in the left ribbon.
|
||||
this.addRibbonIcon('git-fork', 'Open smart connections visualizer', (evt: MouseEvent) => {
|
||||
// Create a new leaf in the current workspace
|
||||
let leaf = this.app.workspace.getLeaf(true);
|
||||
|
||||
// Set the new leaf's view to your custom view
|
||||
leaf.setViewState({
|
||||
type: "smart-connections-visualizer",
|
||||
active: true,
|
||||
});
|
||||
// Check if the view is already open
|
||||
const existingLeaf = this.app.workspace.getLeavesOfType("smart-connections-visualizer")[0];
|
||||
if (existingLeaf) {
|
||||
// If it exists, focus on it
|
||||
this.app.workspace.setActiveLeaf(existingLeaf);
|
||||
} else {
|
||||
// Create a new leaf in the current workspace
|
||||
let leaf = this.app.workspace.getLeaf(true);
|
||||
// Set the new leaf's view to your custom view
|
||||
leaf.setViewState({
|
||||
type: "smart-connections-visualizer",
|
||||
active: true,
|
||||
});
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"id": "smart-connections-visualizer",
|
||||
"name": "Smart Connections Visualizer",
|
||||
"version": "1.0.17",
|
||||
"version": "1.0.18",
|
||||
"minAppVersion": "0.15.0",
|
||||
"description": "View your Smart Connections in a visualized format.",
|
||||
"author": "Evan Moscoso",
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "smart-connections-visualizer",
|
||||
"version": "1.0.17",
|
||||
"version": "1.0.18",
|
||||
"description": "A plugin that allows you to view your Smart Connections in a visualized format.",
|
||||
"main": "main.js",
|
||||
"scripts": {
|
||||
|
|
|
|||
Loading…
Reference in a new issue