Skip to content

Commit

Permalink
refactor EditAttributesView
Browse files Browse the repository at this point in the history
  • Loading branch information
llFreetimell committed Nov 11, 2022
1 parent 528782f commit 954e4d2
Showing 1 changed file with 14 additions and 8 deletions.
22 changes: 14 additions & 8 deletions media/CircleEditor/view-sidebar.js
Original file line number Diff line number Diff line change
Expand Up @@ -274,10 +274,8 @@ sidebar.EditAttributesView = class {
return (au < bu) ? -1 : (au > bu) ? 1 : 0;
});
this._addHeader('Attributes');
let index = 0;
for (const attribute of sortedAttributes) {
this._addAttribute(attribute.name, attribute, index);
index++;
for (let idx = 0; idx < sortedAttributes.length; idx++) {
this._addAttribute(sortedAttributes[idx].name, sortedAttributes[idx], idx);
}
if (isCustom === true) {
const addAttribute = this._host.document.createElement('div');
Expand Down Expand Up @@ -321,10 +319,18 @@ sidebar.EditAttributesView = class {
this._editObject._attribute[key.name] = key.value;
this._editObject._attribute[key.name + '_type'] = key.type;
}
keys.push('attribute');
this._editObject._attribute['attribute'] = 'value';
this._editObject._attribute['attribute_type'] = 'string';
this._editObject._attribute.keys = keys;

for (let i = 1; true; i++) {
if (!keys.includes('NewAttribute' + i.toString())) {
const key = 'NewAttribute' + i.toString();
keys.push(key);

this._editObject._attribute[key] = 'Write a new value for this attribute';
this._editObject._attribute[key + '_type'] = 'string';
this._editObject._attribute.keys = keys;
break;
}
}

vscode.postMessage({
command: 'edit',
Expand Down

0 comments on commit 954e4d2

Please sign in to comment.