Skip to content

Commit

Permalink
chore: add error highlighting to textarea subfields
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisgurney committed Dec 27, 2024
1 parent dbb3c34 commit 692d7f4
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
6 changes: 4 additions & 2 deletions src/Settings/UI/Modals/ToolbarSettingsModal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1197,11 +1197,13 @@ export default class ToolbarSettingsModal extends Modal {
.setValue(initialValue ? initialValue : '')
.onChange(
debounce(async (value: string) => {
config[param.parameter as keyof ScriptConfig] = value;
let isValid = this.updateItemComponentStatus(value, param.type, cb.inputEl.parentElement);
config[param.parameter as keyof ScriptConfig] = isValid ? value : '';
this.toolbar.updated = new Date().toISOString();
await this.plugin.settingsManager.save();
this.renderPreview(toolbarItem); // to make sure error state is refreshed
}, 500));
}, 500));
this.updateItemComponentStatus(initialValue ? initialValue : '', param.type, cb.inputEl.parentElement);
});
break;
}
Expand Down
3 changes: 2 additions & 1 deletion src/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -886,7 +886,8 @@ body {
.setting-item-control:has(input[type="text"].note-toolbar-setting-error) {
flex-wrap: wrap;
}
input[type="text"].note-toolbar-setting-error {
input[type="text"].note-toolbar-setting-error,
.note-toolbar-setting-error textarea {
box-shadow: 0 0 0 1px var(--text-error);
}
.note-toolbar-setting-error {
Expand Down
3 changes: 2 additions & 1 deletion styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -1691,7 +1691,8 @@ body {
.setting-item-control:has(input[type="text"].note-toolbar-setting-error) {
flex-wrap: wrap;
}
input[type="text"].note-toolbar-setting-error {
input[type="text"].note-toolbar-setting-error,
.note-toolbar-setting-error textarea {
box-shadow: 0 0 0 1px var(--text-error);
}
.note-toolbar-setting-error {
Expand Down

0 comments on commit 692d7f4

Please sign in to comment.