From d6d3df2ce7d003e9c2bdeecdd31c8fa689f64e83 Mon Sep 17 00:00:00 2001 From: lin onetwo Date: Thu, 16 May 2024 01:34:47 +0800 Subject: [PATCH] fix: remove warning on solve --- src/super-tag/widgets/utils/formOnChange.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/super-tag/widgets/utils/formOnChange.ts b/src/super-tag/widgets/utils/formOnChange.ts index ab2b90e..ffc3b4f 100644 --- a/src/super-tag/widgets/utils/formOnChange.ts +++ b/src/super-tag/widgets/utils/formOnChange.ts @@ -8,10 +8,17 @@ export function formOnChange(currentTiddlerTitle?: string, editor?: JSONEditor.J } // Get an array of errors from the validator const errors = editor.validate(); + // DEBUG: console errors + console.log(`errors`, errors); if (errors.length > 0) { if (errorValidatorInfoElement !== undefined) { errorValidatorInfoElement.className = 'label label-warning'; - errorValidatorInfoElement.textContent = 'Form not valid'; + errorValidatorInfoElement.textContent = `Form not valid (${errors.map((error) => error.message).join(', ')})`; + } + } else { + if (errorValidatorInfoElement !== undefined) { + errorValidatorInfoElement.className = 'label'; + errorValidatorInfoElement.textContent = ''; } } let tiddlerFields = $tw.wiki.getTiddler(currentTiddlerTitle)?.fields ?? ({} as Record);