diff --git a/frontend/src/pages/components/TomlEditor.vue b/frontend/src/pages/components/TomlEditor.vue index 80a4660..8444a0d 100644 --- a/frontend/src/pages/components/TomlEditor.vue +++ b/frontend/src/pages/components/TomlEditor.vue @@ -11,7 +11,7 @@ -
+
-
+
{ + const convertTypes = (obj, path = '') => { for (const key in obj) { + const fullPath = path ? `${path}.${key}` : key; const value = obj[key]; - if (value && typeof value === 'object' && !Array.isArray(value)) { - convertTypes(value); - } else if (typeof value === 'string') { - // Check if this was originally a number - const fullPath = this.getFullPath(obj, key); - if (fullPath && this.originalTypes[fullPath] === 'number') { - const numValue = Number(value); - if (!isNaN(numValue)) { - obj[key] = numValue; - } + if (this.isObject(value)) { + convertTypes(value, fullPath); + } else if (typeof value === 'string' && this.originalTypes[fullPath] === 'number') { + const numValue = this.toNumber(value); + if (!isNaN(numValue)) { + obj[key] = numValue; } } } @@ -343,33 +352,6 @@ export default { } }, - // Helper to get the full path of a nested property - getFullPath(obj, key) { - for (const path in this.originalTypes) { - const parts = path.split('.'); - const lastPart = parts[parts.length - 1]; - - if (lastPart === key) { - // Check if this is actually the right object - let currentObj = this.config; - let found = true; - - for (let i = 0; i < parts.length - 1; i++) { - if (currentObj[parts[i]] === undefined) { - found = false; - break; - } - currentObj = currentObj[parts[i]]; - } - - if (found && currentObj === obj) { - return path; - } - } - } - return null; - }, - cancelEdit() { this.$emit('close-editor'); },