generated from obsidianmd/obsidian-sample-plugin
-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0723984
commit de33818
Showing
7 changed files
with
286 additions
and
160 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
import { Notice } from "obsidian"; | ||
import type BreadcrumbsPlugin from "src/main"; | ||
import { new_setting } from "src/utils/settings"; | ||
|
||
export const _add_settings_dendron_note = ( | ||
plugin: BreadcrumbsPlugin, | ||
containerEl: HTMLElement, | ||
) => { | ||
new_setting(containerEl, { | ||
name: "Enabled", | ||
desc: "Look for dendron notes to use as edge sources", | ||
toggle: { | ||
value: plugin.settings.explicit_edge_sources.dendron_note.enabled, | ||
cb: async (value) => { | ||
plugin.settings.explicit_edge_sources.dendron_note.enabled = | ||
value; | ||
plugin.refresh(); | ||
await plugin.saveSettings(); | ||
}, | ||
}, | ||
}); | ||
|
||
new_setting(containerEl, { | ||
name: "Delimiter", | ||
desc: "Delimiter to use to split the note name", | ||
input: { | ||
value: plugin.settings.explicit_edge_sources.dendron_note.delimiter, | ||
cb: async (value) => { | ||
if (!value) new Notice("Delimiter cannot be empty"); | ||
else { | ||
plugin.settings.explicit_edge_sources.dendron_note.delimiter = | ||
value; | ||
plugin.refresh(); | ||
await plugin.saveSettings(); | ||
} | ||
}, | ||
}, | ||
}); | ||
|
||
new_setting(containerEl, { | ||
name: "Default Field", | ||
desc: "Field to use if the BC-dendron-note-field is not specified", | ||
select: { | ||
value: plugin.settings.explicit_edge_sources.dendron_note | ||
.default_field, | ||
options: plugin.settings.hierarchies | ||
.map((h) => Object.values(h.dirs)) | ||
.flat(2), | ||
cb: async (value) => { | ||
plugin.settings.explicit_edge_sources.dendron_note.default_field = | ||
value; | ||
plugin.refresh(); | ||
await plugin.saveSettings(); | ||
}, | ||
}, | ||
}); | ||
|
||
new_setting(containerEl, { | ||
name: "Display Trimmed", | ||
desc: "Display Dendron note names as the right-most split of the delimiter. e.g. `a.b.c` -> `c`", | ||
toggle: { | ||
value: plugin.settings.explicit_edge_sources.dendron_note | ||
.display_trimmed, | ||
cb: async (value) => { | ||
plugin.settings.explicit_edge_sources.dendron_note.display_trimmed = | ||
value; | ||
plugin.refresh(); | ||
await plugin.saveSettings(); | ||
}, | ||
}, | ||
}); | ||
}; |
Oops, something went wrong.