Skip to content

Commit

Permalink
feat(Juggl): ✨ Use only Juggl links
Browse files Browse the repository at this point in the history
  • Loading branch information
SkepticMystic committed Aug 14, 2021
1 parent e1a8f39 commit 09d8d98
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 4 deletions.
17 changes: 16 additions & 1 deletion src/BreadcrumbsSettingTab.ts
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,22 @@ export class BreadcrumbsSettingTab extends PluginSettingTab {
);

new Setting(generalDetails)
.setName("Use Juggl link syntax without having Juggl installed")
.setName("Use yaml or inline fields for hierarchy data")
.setDesc(
"If enabled, Breadcrumbs will make it's hierarchy using yaml fields, and inline fields (if you have Dataview enabled). If this is disabled, it will only use Juggl links for it's metadata (See below)."
)
.addToggle((toggle) =>
toggle
.setValue(plugin.settings.useAllMetadata)
.onChange(async (value) => {
plugin.settings.useAllMetadata = value;
await plugin.saveSettings();
await plugin.refreshIndex();
})
);

new Setting(generalDetails)
.setName("Use Juggl link syntax without having Juggl installed.")
.setDesc(
"Should Breadcrumbs look for [Juggl links](https://juggl.io/Link+Types) even if you don't have Juggl installed? If you do have Juggl installed, it will always look for Juggl links."
)
Expand Down
1 change: 1 addition & 0 deletions src/interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ export interface BreadcrumbsSettings {
userHierarchies: userHierarchy[];
indexNote: string[];
refreshIndexOnActiveLeafChange: boolean;
useAllMetadata: boolean;
parseJugglLinksWithoutJuggl: boolean;
dvWaitTime: number;
refreshIntervalTime: number;
Expand Down
4 changes: 2 additions & 2 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ const DEFAULT_SETTINGS: BreadcrumbsSettings = {
userHierarchies: [],
indexNote: [""],
refreshIndexOnActiveLeafChange: false,
useAllMetadata: true,
parseJugglLinksWithoutJuggl: false,
dvWaitTime: 5000,
refreshIntervalTime: 0,
Expand Down Expand Up @@ -393,9 +394,8 @@ export default class BreadcrumbsPlugin extends Plugin {
}
});

console.log({ graphs });

debug(this.settings, "graphs inited");
debug(this.settings, { graphs });

return graphs;
}
Expand Down
6 changes: 5 additions & 1 deletion src/sharedFunctions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,8 @@ export async function getNeighbourObjArr(
const fieldsArr = Object.values(hier) as [string[], string[], string[]];
const newHier: HierarchyFields = { up: {}, same: {}, down: {} };

// Add regular metadata links
if (plugin.settings.useAllMetadata) {
DIRECTIONS.forEach((dir, i) => {
fieldsArr[i].forEach((field) => {
newHier[dir][field] = getFieldValues(
Expand All @@ -276,7 +278,9 @@ export async function getNeighbourObjArr(
);
});
});
}

// Add Juggl Links
if (jugglLinks.length) {
const jugglLinksInFile = jugglLinks.filter((jugglLink) => {
return jugglLink.note === currFileName;
Expand All @@ -287,7 +291,7 @@ export async function getNeighbourObjArr(
if ((hier[line.dir] as string[]).includes(line.type)) {
newHier[line.dir][line.type] = [
...new Set([
...(newHier[line.dir][line.type] as string[]),
...(newHier[line.dir][line.type] ?? []),
...line.linksInLine,
]),
];
Expand Down

0 comments on commit 09d8d98

Please sign in to comment.