File Name Overflow Customization

This commit is contained in:
Ozan Tellioglu 2023-06-15 19:39:21 +02:00
parent 56e19dcaf3
commit 7644abe284
3 changed files with 38 additions and 1 deletions

View file

@ -121,7 +121,14 @@ export default function NoteListComponent(params: NoteListComponentParams) {
{selectedDayNotes.map((notePath) => {
return (
<div
className="oz-calendar-note-line"
className={
'oz-calendar-note-line' +
(plugin.settings.fileNameOverflowBehaviour == 'scroll'
? ' oz-calendar-overflow-scroll'
: plugin.settings.fileNameOverflowBehaviour == 'hide'
? ' oz-calendar-overflow-hide'
: '')
}
id={notePath}
onClick={(e) => openFilePath(e, notePath)}
onContextMenu={(e) => triggerFileContextMenu(e, notePath)}>

View file

@ -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();
});
});
}
}

View file

@ -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;
}