Added live-editing in browser option of dataOption (json).
This commit is contained in:
@@ -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();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user