From 4ea9560ea2973e0c0e9c218596cd81df055c084b Mon Sep 17 00:00:00 2001 From: Ross Keenan Date: Fri, 3 Dec 2021 21:32:55 +0200 Subject: [PATCH] feat(DownView): :sparkles: Option to enable/disable linewrapping (fix #188) --- src/BreadcrumbsSettingTab.ts | 15 +++++++++++++++ src/Components/Down.svelte | 6 +++--- src/constants.ts | 3 ++- src/interfaces.ts | 1 + 4 files changed, 21 insertions(+), 4 deletions(-) diff --git a/src/BreadcrumbsSettingTab.ts b/src/BreadcrumbsSettingTab.ts index e2587c7f..173ef2bd 100644 --- a/src/BreadcrumbsSettingTab.ts +++ b/src/BreadcrumbsSettingTab.ts @@ -666,6 +666,21 @@ export class BCSettingTab extends PluginSettingTab { }) ); + const downViewDetails: HTMLDetailsElement = containerEl.createEl("details"); + downViewDetails.createEl("summary", { text: "Down View" }); + + new Setting(downViewDetails) + .setName("Enable line wrapping") + .setDesc( + "Make the items in the down view line wrap when there isn't enough space (On). Off makes them overflow off the screen." + ) + .addToggle((toggle) => + toggle.setValue(settings.downViewWrap).onChange(async (value) => { + settings.downViewWrap = value; + await plugin.saveSettings(); + }) + ); + const writeBCsToFileDetails: HTMLDetailsElement = containerEl.createEl("details"); writeBCsToFileDetails.createEl("summary", { diff --git a/src/Components/Down.svelte b/src/Components/Down.svelte index 051083ea..0282096c 100644 --- a/src/Components/Down.svelte +++ b/src/Components/Down.svelte @@ -80,7 +80,7 @@
{#each lines as line} {#if line.length > 1} -
+
{line[0] + "-"}
div { + /* .BC-downs > div { white-space: nowrap; - } + } */ pre { display: inline; } diff --git a/src/constants.ts b/src/constants.ts index 5fb6901c..a6901b3c 100644 --- a/src/constants.ts +++ b/src/constants.ts @@ -141,8 +141,9 @@ export const DEFAULT_SETTINGS: BCSettings = { CSVPaths: "", debugMode: "WARN", defaultView: true, - dvWaitTime: 5000, + downViewWrap: false, dotsColour: "#000000", + dvWaitTime: 5000, fieldSuggestor: true, filterImpliedSiblingsOfDifferentTypes: false, limitWriteBCCheckboxStates: {}, diff --git a/src/interfaces.ts b/src/interfaces.ts index 6676581d..322133b3 100644 --- a/src/interfaces.ts +++ b/src/interfaces.ts @@ -16,6 +16,7 @@ export interface BCSettings { dvWaitTime: number; debugMode: DebugLevel; defaultView: boolean; + downViewWrap: boolean; dotsColour: string; fieldSuggestor: boolean; filterImpliedSiblingsOfDifferentTypes: boolean;