mirror of
https://github.com/xallt/sync-graph-settings.git
synced 2026-07-22 07:10:28 +00:00
Enable syncing search filter settings
This commit is contained in:
parent
3ac6eb0d3f
commit
abe41f48c0
1 changed files with 4 additions and 2 deletions
6
main.ts
6
main.ts
|
|
@ -18,8 +18,9 @@ export default class SyncGraphPlugin extends Plugin {
|
|||
const graphConfigJson = await this.app.vault.adapter.read(graphConfigPath);
|
||||
const graphConfig = JSON.parse(graphConfigJson);
|
||||
const graphColorGroups = graphConfig.colorGroups;
|
||||
const searchFilters = graphConfig.search;
|
||||
this.getLocalGraphLeaves().forEach((leaf) => {
|
||||
this.setColorGroups(leaf, graphColorGroups);
|
||||
this.setSettings(leaf, graphColorGroups, searchFilters);
|
||||
})
|
||||
}
|
||||
|
||||
|
|
@ -27,9 +28,10 @@ export default class SyncGraphPlugin extends Plugin {
|
|||
return this.app.workspace.getLeavesOfType('localgraph');
|
||||
}
|
||||
|
||||
setColorGroups(localGraphLeaf: WorkspaceLeaf, colorGroups: any) {
|
||||
setSettings(localGraphLeaf: WorkspaceLeaf, colorGroups: any, searchFilters: any) {
|
||||
const viewState = localGraphLeaf.getViewState();
|
||||
viewState.state.options.colorGroups = colorGroups;
|
||||
viewState.state.options.search = searchFilters;
|
||||
localGraphLeaf.setViewState(viewState);
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue