From ef0cf3ffef2bbeb622c64046bd19094a81370f73 Mon Sep 17 00:00:00 2001 From: Rich Harris Date: Thu, 20 Dec 2018 17:51:13 -0500 Subject: [PATCH] various --- .../repl/_components/Output/PropEditor.html | 19 ++++++++++++++++++- .../routes/repl/_components/Output/index.html | 5 +++-- 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/site/src/routes/repl/_components/Output/PropEditor.html b/site/src/routes/repl/_components/Output/PropEditor.html index 1839c53627..2d2cf7f393 100644 --- a/site/src/routes/repl/_components/Output/PropEditor.html +++ b/site/src/routes/repl/_components/Output/PropEditor.html @@ -14,6 +14,7 @@ code = 'undefined'; } else { code = fleece.stringify(value); + console.log({ value, code }); } $: try { @@ -22,15 +23,31 @@ error = e; } + let previous_code; + function handleChange(event) { try { const value = fleece.evaluate(event.detail.value); + previous_code = event.detail.value; error = null; dispatch('change', { value }); } catch (e) { error = e; } } + + function stringify(value) { + if (value === undefined) return ''; + + console.log(value); + + const code = previous_code + ? fleece.patch(previous_code, value) + : fleece.stringify(value); + + previous_code = code; + return code; + }