Added live-editing in browser option of dataOption (json).

This commit is contained in:
2023-06-25 07:00:07 +03:00
parent e964892e65
commit 996d222436
9 changed files with 121 additions and 21 deletions
+11 -1
View File
@@ -159,8 +159,18 @@ function renderBlock(templateHbs, jsonData, target) {
return '/';
});
target.innerHTML = template(jsonData);
let html;
try {
html = template(jsonData);
} catch (e) {
html = `<div style="max-width: 1280px; margin: 1rem auto;">
<h1 style="all: unset; font-size: 1.5rem; font-weight: bold; display: block;">Syntax Error:</h1>
<pre style="all: unset; padding: 10px 15px; background-color: #ffe6e6; border: 1px solid red; border-radius: 0.25rem; overflow: auto; display: block; white-space: pre;">${e.toString()}</pre>
</div>`;
}
target.innerHTML = html;
if (reload) {
reload();
}