Merge pull request #6 from isdmg/master

Also sync `close` setting from global graph, responsible for whether the graph settings panel is closed/open
This commit is contained in:
Dmitry Shabat 2024-08-02 10:05:25 +04:00 committed by GitHub
commit e57cc920ee
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -121,8 +121,9 @@ export default class SyncGraphPlugin extends Plugin {
const graphConfig = JSON.parse(graphConfigJson);
const graphColorGroups = graphConfig.colorGroups;
const searchFilters = graphConfig.search;
const closeSettings = graphConfig.close;
this.getLocalGraphLeaves().forEach((leaf) => {
this.setSettings(leaf, graphColorGroups, searchFilters);
this.setSettings(leaf, graphColorGroups, searchFilters, closeSettings);
})
}
@ -130,10 +131,11 @@ export default class SyncGraphPlugin extends Plugin {
return this.app.workspace.getLeavesOfType('localgraph');
}
setSettings(localGraphLeaf: WorkspaceLeaf, colorGroups: any, searchFilters: any) {
setSettings(localGraphLeaf: WorkspaceLeaf, colorGroups: any, searchFilters: any, closeSettings: any) {
const viewState = localGraphLeaf.getViewState();
viewState.state.options.colorGroups = colorGroups;
viewState.state.options.search = searchFilters;
viewState.state.options.close = closeSettings;
viewState.state.options.localJumps = this.settings.defaultDepth;
viewState.state.options.localBacklinks = this.settings.defaultIncomingLinks;