From 7644abe284501a190134ee725154a5de8946dc96 Mon Sep 17 00:00:00 2001 From: Ozan Tellioglu Date: Thu, 15 Jun 2023 19:39:21 +0200 Subject: [PATCH] File Name Overflow Customization --- src/components/noteList.tsx | 9 ++++++++- src/settings/settings.ts | 19 +++++++++++++++++++ styles.css | 11 +++++++++++ 3 files changed, 38 insertions(+), 1 deletion(-) diff --git a/src/components/noteList.tsx b/src/components/noteList.tsx index 7e12b1a..cf9891e 100644 --- a/src/components/noteList.tsx +++ b/src/components/noteList.tsx @@ -121,7 +121,14 @@ export default function NoteListComponent(params: NoteListComponentParams) { {selectedDayNotes.map((notePath) => { return (
openFilePath(e, notePath)} onContextMenu={(e) => triggerFileContextMenu(e, notePath)}> diff --git a/src/settings/settings.ts b/src/settings/settings.ts index 25937cd..ab215e8 100644 --- a/src/settings/settings.ts +++ b/src/settings/settings.ts @@ -7,6 +7,7 @@ export type SortingOption = 'name' | 'name-rev'; export type DateSourceOption = 'filename' | 'yaml'; export type NewNoteDateType = 'current-date' | 'active-date'; export type CalendarType = 'US' | 'ISO 8601'; +export type OverflowBehaviour = 'scroll' | 'hide' | 'next-line'; export interface OZCalendarPluginSettings { openViewOnStart: boolean; @@ -22,6 +23,7 @@ export interface OZCalendarPluginSettings { sortingOption: SortingOption; newNoteDate: NewNoteDateType; newNoteCancelButtonReverse: boolean; + fileNameOverflowBehaviour: OverflowBehaviour; } export const DEFAULT_SETTINGS: OZCalendarPluginSettings = { @@ -38,6 +40,7 @@ export const DEFAULT_SETTINGS: OZCalendarPluginSettings = { sortingOption: 'name', newNoteDate: 'current-date', newNoteCancelButtonReverse: false, + fileNameOverflowBehaviour: 'hide', }; export class OZCalendarPluginSettingsTab extends PluginSettingTab { @@ -321,5 +324,21 @@ export class OZCalendarPluginSettingsTab extends PluginSettingTab { this.plugin.calendarForceUpdate(); }); }); + + new Setting(containerEl) + .setName('File Names Overflow Behaviour') + .setDesc('Change the default behaviour for file names when they dont fit to the view') + .addDropdown((dropdown) => { + dropdown + .addOption('hide', 'Hide Overflow') + .addOption('scroll', 'Scroll Overflow') + .addOption('next-line', 'Show Overflow in the Next Line') + .setValue(this.plugin.settings.fileNameOverflowBehaviour) + .onChange((newValue: OverflowBehaviour) => { + this.plugin.settings.fileNameOverflowBehaviour = newValue; + this.plugin.saveSettings(); + this.plugin.calendarForceUpdate(); + }); + }); } } diff --git a/styles.css b/styles.css index 548f7be..48e3f41 100644 --- a/styles.css +++ b/styles.css @@ -291,3 +291,14 @@ settings: .oz-calendar-note-line { color: var(--text-muted); } + +.oz-calendar-overflow-scroll { + overflow: scroll; + white-space: nowrap; +} + +.oz-calendar-overflow-hide { + text-overflow: ellipsis; + overflow: hidden; + white-space: nowrap; +}