From 16defd6b1e186b34449c9b34fb6487cdc2e1ba27 Mon Sep 17 00:00:00 2001 From: Ross Keenan Date: Thu, 16 Dec 2021 09:19:35 +0200 Subject: [PATCH] feat(DendronNote): :sparkles: Option to display trimmed dendron note --- src/BreadcrumbsSettingTab.ts | 13 +++++++++++++ src/Components/Down.svelte | 3 ++- src/Components/Lists.svelte | 7 +++++-- src/Components/Matrix.svelte | 6 ++++-- src/Components/TrailGrid.svelte | 14 +++++++------- src/Components/TrailPath.svelte | 3 ++- src/constants.ts | 1 + src/interfaces.ts | 1 + src/sharedFunctions.ts | 10 ++++++++++ 9 files changed, 45 insertions(+), 13 deletions(-) diff --git a/src/BreadcrumbsSettingTab.ts b/src/BreadcrumbsSettingTab.ts index 5de328aa..320f95c5 100644 --- a/src/BreadcrumbsSettingTab.ts +++ b/src/BreadcrumbsSettingTab.ts @@ -752,6 +752,19 @@ export class BCSettingTab extends PluginSettingTab { }; }); + new Setting(alternativeHierarchyDetails) + .setName("Trim Dendron Note Names") + .setDesc( + "When displaying a dendron note name, should it be trimmed to only show the last item in the chain? e.g. `A.B.C` would be trimmed to only display `C`." + ) + .addToggle((toggle) => + toggle.setValue(settings.trimDendronNotes).onChange(async (value) => { + settings.trimDendronNotes = value; + await plugin.saveSettings(); + await plugin.getActiveTYPEView(MATRIX_VIEW).draw(); + }) + ); + const fields = getFields(settings.userHiers); if (!fields.includes(settings.dendronNoteField)) { diff --git a/src/Components/Down.svelte b/src/Components/Down.svelte index 0282096c..0d7398c9 100644 --- a/src/Components/Down.svelte +++ b/src/Components/Down.svelte @@ -14,6 +14,7 @@ getSubInDirs, } from "../graphUtils"; import type BCPlugin from "../main"; + import { dropDendron } from "../sharedFunctions"; export let plugin: BCPlugin; export let view: DownView; @@ -91,7 +92,7 @@ {line[1]}{dropDendron(line[1], settings)} diff --git a/src/Components/Lists.svelte b/src/Components/Lists.svelte index 5c991644..c33e5944 100644 --- a/src/Components/Lists.svelte +++ b/src/Components/Lists.svelte @@ -1,6 +1,7 @@