mirror of
https://github.com/jesse-r-s-hines/obsidian-open-tab-settings.git
synced 2026-07-22 05:43:41 +00:00
Update src/settings.ts
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
parent
28e5ba2f6d
commit
0dd8dcfb6e
1 changed files with 11 additions and 6 deletions
|
|
@ -105,17 +105,22 @@ export class OpenTabSettingsPluginSettingTab extends PluginSettingTab {
|
|||
'When the limit is exceeded, the oldest opened tab is closed. ' +
|
||||
'If open order cannot be determined, the leftmost tab is closed.'
|
||||
)
|
||||
.addText(text =>
|
||||
text
|
||||
.addText(text => {
|
||||
text.inputEl.type = 'number';
|
||||
text.inputEl.min = '0';
|
||||
text.inputEl.step = '1';
|
||||
|
||||
return text
|
||||
.setPlaceholder('0')
|
||||
.setValue(String(this.plugin.settings.maxOpenTabs))
|
||||
.onChange(async (value) => {
|
||||
const parsed = Number.parseInt(value.trim(), 10);
|
||||
const trimmed = value.trim();
|
||||
const parsed = Number(trimmed);
|
||||
await this.plugin.updateSettings({
|
||||
maxOpenTabs: Number.isFinite(parsed) && parsed > 0 ? parsed : 0,
|
||||
maxOpenTabs: Number.isInteger(parsed) && parsed >= 0 ? parsed : 0,
|
||||
});
|
||||
})
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
new Setting(this.containerEl)
|
||||
.setName('Focus explicit new tabs')
|
||||
|
|
|
|||
Loading…
Reference in a new issue