Fix bug breaking collapsible objects

This commit is contained in:
Misode
2019-09-24 23:37:59 +02:00
parent ddd560b474
commit d36d77a945
3 changed files with 12 additions and 6 deletions

View File

@@ -94,7 +94,7 @@
<div class="input-group-prepend">
<span class="input-group-text" data-name></span>
</div>
<select class="form-control entry-type" onchange="updateField(this)">
<select class="form-control" onchange="updateField(this)">
</select>
</div>
<div class="input-group mt-3" data-type="random">

View File

@@ -227,12 +227,13 @@ function removeFromSet(el, array) {
}
function toggleCollapseObject(el) {
let parent = getSuperParent(el);
let field = $(el).closest('[data-field]').attr('data-field');
if (!parent[field]) {
parent[field] = {};
let path = getPath(el);
let index = path.pop();
let node = getNode(path);
if (!node[index]) {
node[index] = {};
} else {
delete parent[field];
delete node[index];
}
invalidated();
}

View File

@@ -81,6 +81,11 @@
"minecraft:dynamic"
]
},
{
"id": "quality",
"type": "random",
"luck_based": true
},
{
"id": "children",
"type": "array",