From 048bc4ae943509dea2946764efaa69f845b6c478 Mon Sep 17 00:00:00 2001 From: Corentin Thomasset Date: Sat, 14 May 2022 16:29:50 +0200 Subject: [PATCH] refactor(json-viewer): add clear button --- src/tools/json-viewer/json-viewer.vue | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/src/tools/json-viewer/json-viewer.vue b/src/tools/json-viewer/json-viewer.vue index 3307cba3..55352821 100644 --- a/src/tools/json-viewer/json-viewer.vue +++ b/src/tools/json-viewer/json-viewer.vue @@ -5,8 +5,21 @@ :feedback="rawJsonValidation.message" :validation-status="rawJsonValidation.status" > - + + + + Clear + @@ -39,7 +52,7 @@ const rawJsonValidation = useValidation({ source: rawJson, rules: [ { - validator: (v) => JSON.parse(v), + validator: (v) => v === '' || JSON.parse(v), message: 'Invalid json string', }, ],