Fix schema not loading from presets. Fix ESLint warnings

This commit is contained in:
Cohee 2024-04-02 11:23:29 +03:00
parent 5210db5679
commit 0b76e1d350

View File

@ -565,12 +565,13 @@ jQuery(function () {
}); });
$('#tabby_json_schema').on('input', function () { $('#tabby_json_schema').on('input', function () {
const json_schema_string = $(this).val(); const json_schema_string = String($(this).val());
// Ignore errors from here
try { try {
settings.json_schema = JSON.parse(json_schema_string ?? '{}'); settings.json_schema = JSON.parse(json_schema_string ?? '{}');
} catch {} } catch {
// Ignore errors from here
}
saveSettingsDebounced(); saveSettingsDebounced();
}); });
@ -770,8 +771,8 @@ function setSettingByName(setting, value, trigger) {
} }
if ('json_schema' === setting) { if ('json_schema' === setting) {
settings.json_schema = value ?? {} settings.json_schema = value ?? {};
$('#tabby_json_schema').text(JSON.stringify(settings.json_schema, null, 2)) $('#tabby_json_schema').val(JSON.stringify(settings.json_schema, null, 2));
return; return;
} }