()
| 120 | } |
| 121 | |
| 122 | async syncGlobalToLocal() { |
| 123 | const configDir = this.app.vault.configDir; |
| 124 | const graphConfigPath = normalizePath(configDir + '/graph.json'); |
| 125 | |
| 126 | // this.app.vault.getAbstractFileByPath('.obsidian/graph.json') would return null |
| 127 | // So we're doing it the less safe way |
| 128 | const graphConfigJson = await this.app.vault.adapter.read(graphConfigPath); |
| 129 | const graphConfig = JSON.parse(graphConfigJson); |
| 130 | const graphColorGroups = graphConfig.colorGroups; |
| 131 | const searchFilters = graphConfig.search; |
| 132 | const closeSettings = graphConfig.close; |
| 133 | const lineSizeMultiplier = graphConfig.lineSizeMultiplier; |
| 134 | const nodeSizeMultiplier = graphConfig.nodeSizeMultiplier; |
| 135 | const showTags = graphConfig.showTags; |
| 136 | this.getLocalGraphLeaves().forEach((leaf) => { |
| 137 | this.setSettings(leaf, graphColorGroups, searchFilters, closeSettings, lineSizeMultiplier, nodeSizeMultiplier, showTags); |
| 138 | }) |
| 139 | } |
| 140 | |
| 141 | getLocalGraphLeaves() { |
| 142 | return this.app.workspace.getLeavesOfType('localgraph'); |
no test coverage detected