Skip to content

Commit

Permalink
Fix editor bug that meant you couldn't have nested groups within a pr…
Browse files Browse the repository at this point in the history
…operty group if there wasn't also a (non-nested group) property within the parent group
  • Loading branch information
FayCross committed Feb 28, 2024
1 parent 66adde0 commit af07e60
Showing 1 changed file with 14 additions and 12 deletions.
26 changes: 14 additions & 12 deletions editor/js/tree.js
Expand Up @@ -836,7 +836,7 @@ var EDITOR = (function ($, parent) {
if (node_label.length > 0 && !node_options['cdata']) {
toolbox.displayParameter('#mainPanel .wizard', node_options['normal'], node_name, '', key, node_label);
}

getGroups(node_options['normal']);

// The rest of the normal params
Expand Down Expand Up @@ -895,10 +895,10 @@ var EDITOR = (function ($, parent) {
.attr('alt', 'Flash only attribute');
var flashonlytxt = '<img class="flash-icon" src="editor/img/flashonly.png" alt="Flash only attribute">';
var tooltipavailable = '<i class="tooltipIcon iconEnabled fa fa-info-circle"></i>';

getGroups(node_options['optional']);

// Determine whether optional properties are used and if they are visble according to their condition
// Determine whether optional properties are used and if they are visible according to their condition
// is optional property (or any children of group) already in project?
for (var i = 0; i < node_options['optional'].length; i++) {
var found = [];
Expand Down Expand Up @@ -956,7 +956,6 @@ var EDITOR = (function ($, parent) {
for (var j = 0; j < data.children.length; j++) {
if (!data.children[j].value.deprecated) {
var load = (j == data.children.length - 1);

if (data.children[j].value.children != undefined) {
// nested group
var temp = data.children[j].value;
Expand Down Expand Up @@ -1070,9 +1069,7 @@ var EDITOR = (function ($, parent) {
toolbox.displayParameter('#mainPanel .wizard', node_options['optional'], attribute_name, attribute_value.value, key);
}
} else {

if (node_options['optional'][i].visible) {

groupSetUp(node_options['optional'][i], attributes, node_options, key);

}
Expand Down Expand Up @@ -1340,12 +1337,17 @@ var EDITOR = (function ($, parent) {
{
var found = [];
var groupChildren = group.value.children;
for (var j = 0; j < groupChildren.length; j++) {
var child_value = toolbox.getAttributeValue(attributes, groupChildren[j].name, node_options, key);
found.push(child_value.found);
}

return found;
for (var j = 0; j < groupChildren.length; j++) {
if (groupChildren[j].value.type == 'group') {
// it's a nested group so check inside this too
$.merge(found,checkGroupFound(groupChildren[j], attributes, node_options, key));
} else {
var child_value = toolbox.getAttributeValue(attributes, groupChildren[j].name, node_options, key);
found.push(child_value.found);
}
}

return found;
}

addNodeToTree = function(key, pos, nodeName, xmlData, tree, select)
Expand Down

0 comments on commit af07e60

Please sign in to comment.