Skip to content

Commit

Permalink
feat(DownView): ✨ Option to enable/disable linewrapping (fix #188)
Browse files Browse the repository at this point in the history
  • Loading branch information
SkepticMystic committed Dec 3, 2021
1 parent 929e5c9 commit 4ea9560
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 4 deletions.
15 changes: 15 additions & 0 deletions src/BreadcrumbsSettingTab.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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", {
Expand Down
6 changes: 3 additions & 3 deletions src/Components/Down.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@
<div class="BC-downs">
{#each lines as line}
{#if line.length > 1}
<div>
<div style={settings.downViewWrap ? "" : "white-space: nowrap;"}>
<pre>{line[0] + "-"}</pre>
<span
class="internal-link"
Expand All @@ -103,9 +103,9 @@
.BC-downs {
padding-left: 5px;
}
.BC-downs > div {
/* .BC-downs > div {
white-space: nowrap;
}
} */
pre {
display: inline;
}
Expand Down
3 changes: 2 additions & 1 deletion src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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: {},
Expand Down
1 change: 1 addition & 0 deletions src/interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ export interface BCSettings {
dvWaitTime: number;
debugMode: DebugLevel;
defaultView: boolean;
downViewWrap: boolean;
dotsColour: string;
fieldSuggestor: boolean;
filterImpliedSiblingsOfDifferentTypes: boolean;
Expand Down

0 comments on commit 4ea9560

Please sign in to comment.