fix(docs): regenerate playground GIF with held output during typing

This commit is contained in:
Yang Jun
2026-06-23 00:34:12 +08:00
parent 3e332ebe97
commit c0ec9fcb66
2 changed files with 5 additions and 1 deletions
Binary file not shown.

Before

Width:  |  Height:  |  Size: 36 KiB

After

Width:  |  Height:  |  Size: 35 KiB

+5 -1
View File
@@ -52,6 +52,7 @@
const editors = [editor, dataEditor];
let previewValue = '';
let hadPreview = false;
colorScheme.addEventListener('change', function() {
editors.forEach(applyEditorTheme);
if (previewValue) setPreview(previewValue);
@@ -176,7 +177,10 @@
history.replaceState({}, '', '#' + serializeArgs({tpl, data}));
try {
const html = await engine.parseAndRender(tpl, JSON.parse(data));
setPreview(html);
if (html !== '' || !hadPreview) {
setPreview(html);
if (html !== '') hadPreview = true;
}
} catch (err) {
// keep last successful output while template or context is invalid
}