Skip to content

Commit 08cae70

Browse files
committed
Fix #19: Editing an extendable dict's key makes it disappear
1 parent b24dd1d commit 08cae70

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/ui.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -375,6 +375,11 @@ function handleKeyEdit(data, key, value, coords, onAdd, onRemove) {
375375
else if (data.hasOwnProperty(newKey))
376376
return alert("(!) Duplicate keys not allowed. This key already exists.\r\n\r\n‎");
377377

378-
onAdd(value, name + '-' + newKey);
378+
let newCoords = coords.split('-');
379+
newCoords.pop();
380+
newCoords.push(newKey);
381+
newCoords = newCoords.join('-');
382+
383+
onAdd(value, newCoords);
379384
onRemove(coords);
380385
}

0 commit comments

Comments
 (0)