Spaces:
Running
Running
🐳 10/02 - 14:07 - the hint is stil lpopping up a green eve nthough the bottom right is correctly red--but it should be more helpful than just 'invalid json' i... even the hint that pops in with the g
Browse files
script.js
CHANGED
|
@@ -20,7 +20,7 @@ document.addEventListener('DOMContentLoaded', function() {
|
|
| 20 |
}
|
| 21 |
};
|
| 22 |
|
| 23 |
-
|
| 24 |
const jsonEditor = document.getElementById('jsonEditor');
|
| 25 |
const jsonOutput = document.getElementById('jsonOutput');
|
| 26 |
const notification = document.getElementById('notification');
|
|
@@ -447,6 +447,12 @@ document.addEventListener('DOMContentLoaded', function() {
|
|
| 447 |
// Make an element editable
|
| 448 |
function makeEditable(span, type, key, parentKey) {
|
| 449 |
const currentValue = type === 'key' ? key : getValue(parentKey, key);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 450 |
let displayValue = type === 'key' ? currentValue : JSON.stringify(currentValue);
|
| 451 |
|
| 452 |
// Remove quotes from display for editing
|
|
|
|
| 20 |
}
|
| 21 |
};
|
| 22 |
|
| 23 |
+
======= DOM elements
|
| 24 |
const jsonEditor = document.getElementById('jsonEditor');
|
| 25 |
const jsonOutput = document.getElementById('jsonOutput');
|
| 26 |
const notification = document.getElementById('notification');
|
|
|
|
| 447 |
// Make an element editable
|
| 448 |
function makeEditable(span, type, key, parentKey) {
|
| 449 |
const currentValue = type === 'key' ? key : getValue(parentKey, key);
|
| 450 |
+
|
| 451 |
+
// Handle undefined/null values gracefully
|
| 452 |
+
if (currentValue === undefined) {
|
| 453 |
+
return;
|
| 454 |
+
}
|
| 455 |
+
|
| 456 |
let displayValue = type === 'key' ? currentValue : JSON.stringify(currentValue);
|
| 457 |
|
| 458 |
// Remove quotes from display for editing
|