Skip to content

Commit

Permalink
fix settings when no presets exist
Browse files Browse the repository at this point in the history
  • Loading branch information
cosmicoptima committed Nov 21, 2023
1 parent ab6180b commit 12e5d8c
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 2 deletions.
5 changes: 5 additions & 0 deletions main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1627,6 +1627,11 @@ class LoomSettingTab extends PluginSettingTab {
const updatePresetFields = () => {
presetFields.empty();

if (this.plugin.settings.modelPreset === -1) {
presetFields.createEl("p", { cls: "loom__no-preset-selected", text: "No preset selected." });
return;
}

new Setting(presetFields).setName("Name").addText((text) =>
text.setValue(this.plugin.settings.modelPresets[this.plugin.settings.modelPreset].name).onChange((value) => {
this.plugin.settings.modelPresets[this.plugin.settings.modelPreset].name = value;
Expand Down
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"id": "loom",
"name": "Loom",
"version": "1.19.1",
"version": "1.19.2",
"minAppVersion": "0.15.0",
"description": "Loom in Obsidian",
"author": "celeste",
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "obsidian-loom",
"version": "1.19.1",
"version": "1.19.2",
"description": "Loom in Obsidian",
"main": "main.js",
"scripts": {
Expand Down
5 changes: 5 additions & 0 deletions styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -381,6 +381,11 @@ body {
margin-right: 0.5em;
}

.loom__no-preset-selected {
color: var(--text-faint);
font-size: var(--font-ui-small);
}

/* hidden -- must be at end */

.hidden {
Expand Down

0 comments on commit 12e5d8c

Please sign in to comment.