fix config item childrens order being wrong

This commit is contained in:
Send_Nukez 2021-11-21 23:47:16 +01:00
parent 675ff2d94d
commit 83b2801a36

View file

@ -194,8 +194,8 @@ export default class ConfigMenu {
.join("\n"); .join("\n");
options._onChange = options.onChange; options._onChange = options.onChange;
options.onChange = (val) => { options.onChange = (val) => {
const isValid = validate(val); const isValid = validate(val) === true;
$(`.dribbblish-config-item[key="${options.key}"]`).attr("changed", isValid === true && val != options.defaultValue ? "" : null); $(`.dribbblish-config-item[key="${options.key}"]`).attr("changed", options.type != "button" && isValid && val != options.defaultValue ? "" : null);
if (!isValid) return; if (!isValid) return;
this.set(options.key, val, options.save); this.set(options.key, val, options.save);
@ -204,7 +204,7 @@ export default class ConfigMenu {
options.children.forEach((child) => this.#setHidden(child.key, Array.isArray(show) ? !show.includes(child.key) : !show)); options.children.forEach((child) => this.#setHidden(child.key, Array.isArray(show) ? !show.includes(child.key) : !show));
}; };
options.children = options.children.map((child) => { options.children = options.children.map((child) => {
return { ...child, area: options.area, childOf: options.key }; return { ...child, area: options.area, childOf: options.key, order: options.order ?? 0 + child.order ?? 0 };
}); });
this.#config[options.key] = options; this.#config[options.key] = options;