Skip to content

Commit

Permalink
feat!(settings): add toggle for case insensitive mode for extensions
Browse files Browse the repository at this point in the history
  • Loading branch information
Falcion committed Oct 4, 2024
1 parent bf17ff1 commit 6477cc3
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 1 deletion.
7 changes: 6 additions & 1 deletion source/locales/langs/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ export const LOCALES_EN = {
},
"SETTINGS_DEBUG_MODE": {
0: "Debug mode:",
1: "This mode starts output in application\'s console about actions you do.",
1: "This mode starts output in application's console about actions you do.",
2: "Do not use this mode if you are not developer or familliar with console."
},
"SETTINGS_SILENCE_ERRORS": {
Expand Down Expand Up @@ -158,5 +158,10 @@ export const LOCALES_EN = {
},
"ERROR_COMMON_MESSAGE": {
0: "Error from UNITADE plugin:"
},
"SETTINGS_CASE_INSENSITIVE": {
0: "Case insensitive mode:",
1: "If turned on, plugin would registry every upper and lower case variations of extension to provide Windows-like experience for extension.",
2: "Unstable on UNIX-systems."
}
};
23 changes: 23 additions & 0 deletions source/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ import CompatibilityModule from './addons/compatibility';
export interface UNITADE_SETTINGS {
markdown_overcharge: boolean,
extensions: string,
is_case_insensitive: boolean,
is_onload: boolean,
is_onload_unsafe: boolean,
forced_extensions: string,
Expand Down Expand Up @@ -67,6 +68,7 @@ export interface UNITADE_SETTINGS {
export const DEFAULT_SETTINGS: UNITADE_SETTINGS = {
markdown_overcharge: false,
extensions: 'txt',
is_case_insensitive: true,
is_onload: false,
is_onload_unsafe: false,
forced_extensions: '',
Expand Down Expand Up @@ -181,6 +183,27 @@ export default class UNITADE_SETTINGS_TAB extends PluginSettingTab {
this.__updateErrors();
});

new Setting(containerEl)
.setName(this.plugin.locale.getLocaleItem('SETTINGS_CASE_INSENSITIVE')[0]!)
.setDesc(this.plugin.locale.getLocaleItem('SETTINGS_CASE_INSENSITIVE')[1]!)
.setTooltip(this.plugin.locale.getLocaleItem('SETTINGS_CASE_INSENSITIVE')[2]!)
.addToggle(toggle => {
toggle
.setValue(this.plugin.settings.is_case_insensitive)
.onChange(async (value) => {
const next = {
...this.plugin.settings,
is_case_insensitive: value,
};

await this.plugin.uptSettings(next);

this.__updateErrors();
});

return toggle;
});

configInput.inputEl.style.width = '100%';
configInput.inputEl.style.height = '48px';
configInput.inputEl.style.minHeight = '36px';
Expand Down

0 comments on commit 6477cc3

Please sign in to comment.