MCPcopy Create free account
hub / github.com/Xallt/sync-graph-settings / syncGlobalToLocal

Method syncGlobalToLocal

main.ts:122–139  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

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');

Callers 1

onloadMethod · 0.95

Calls 2

getLocalGraphLeavesMethod · 0.95
setSettingsMethod · 0.95

Tested by

no test coverage detected