diff --git a/src/modal.ts b/src/modal.ts index fde80a4..e68dde1 100644 --- a/src/modal.ts +++ b/src/modal.ts @@ -46,10 +46,13 @@ export class CreateNoteModal extends Modal { let addSpace = contentEl.createEl('div', { cls: 'oz-calendar-modal-addspacediv ' }); // Create - Cancel Buttons - const createButton = contentEl.createEl('button', { text: 'Create Note' }); + const createButton = contentEl.createEl('button', { + text: 'Create Note', + cls: this.plugin.settings.newNoteCancelButtonReverse ? 'oz-calendar-modal-float-right' : '', + }); const cancelButton = contentEl.createEl('button', { text: 'Cancel', - cls: 'oz-calendar-modal-float-right', + cls: this.plugin.settings.newNoteCancelButtonReverse ? '' : 'oz-calendar-modal-float-right', }); cancelButton.addEventListener('click', () => { thisModal.close(); diff --git a/src/settings/settings.ts b/src/settings/settings.ts index f3d2a5a..25937cd 100644 --- a/src/settings/settings.ts +++ b/src/settings/settings.ts @@ -21,6 +21,7 @@ export interface OZCalendarPluginSettings { openFileBehaviour: OpenFileBehaviourType; sortingOption: SortingOption; newNoteDate: NewNoteDateType; + newNoteCancelButtonReverse: boolean; } export const DEFAULT_SETTINGS: OZCalendarPluginSettings = { @@ -36,6 +37,7 @@ export const DEFAULT_SETTINGS: OZCalendarPluginSettings = { openFileBehaviour: 'current-tab', sortingOption: 'name', newNoteDate: 'current-date', + newNoteCancelButtonReverse: false, }; export class OZCalendarPluginSettingsTab extends PluginSettingTab { @@ -286,6 +288,18 @@ export class OZCalendarPluginSettingsTab extends PluginSettingTab { }); }); + new Setting(containerEl) + .setName('Reverse direction of Cancel and New Note Buttons') + .setDesc( + `Enable this setting to change the direction of Cancel and New Note buttons within the New Note Creation Modal` + ) + .addToggle((toggle) => { + toggle.setValue(this.plugin.settings.newNoteCancelButtonReverse).onChange((newValue) => { + this.plugin.settings.newNoteCancelButtonReverse = newValue; + this.plugin.saveSettings(); + }); + }); + containerEl.createEl('h2', { text: 'Style Settings' }); containerEl.createEl('p', {