diff --git a/package.json b/package.json index a54c4233..cac5d2ce 100644 --- a/package.json +++ b/package.json @@ -55,7 +55,7 @@ "dependencies": { "@lexical/markdown": "^0.22.0", "@sindresorhus/transliterate": "^1.6.0", - "@sveltia/ui": "^0.22.1", + "@sveltia/ui": "^0.22.2", "@sveltia/utils": "^0.6.3", "deepmerge": "^4.3.1", "fast-deep-equal": "^3.1.3", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 190090ee..66efc66b 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -15,8 +15,8 @@ importers: specifier: ^1.6.0 version: 1.6.0 '@sveltia/ui': - specifier: ^0.22.1 - version: 0.22.1(svelte@5.15.0) + specifier: ^0.22.2 + version: 0.22.2(svelte@5.15.0) '@sveltia/utils': specifier: ^0.6.3 version: 0.6.3 @@ -1125,8 +1125,8 @@ packages: svelte: ^5.0.0 vite: ^6.0.0 - '@sveltia/ui@0.22.1': - resolution: {integrity: sha512-2Vdhb80sHYpU8yq4LMX+wSS/tdZcWzzivTHkONuCL4sgvOJFB4StZjlxcz0haftW6XQvqbsPTukPxnIL87t/OQ==} + '@sveltia/ui@0.22.2': + resolution: {integrity: sha512-lbKka4IUpTIZgV/4XnIQTlU/j1ljLXlbRL+gRuKdxgOIysxzWplbw8Gscz9nm/T64/QrLFB9CF2KVPOZ2becOA==} peerDependencies: svelte: ^5.0.0 @@ -4011,7 +4011,7 @@ snapshots: transitivePeerDependencies: - supports-color - '@sveltia/ui@0.22.1(svelte@5.15.0)': + '@sveltia/ui@0.22.2(svelte@5.15.0)': dependencies: '@lexical/code': 0.22.0 '@lexical/dragon': 0.22.0 diff --git a/src/lib/components/contents/details/widgets/number/number-editor.svelte b/src/lib/components/contents/details/widgets/number/number-editor.svelte index 35944797..8e43ecab 100644 --- a/src/lib/components/contents/details/widgets/number/number-editor.svelte +++ b/src/lib/components/contents/details/widgets/number/number-editor.svelte @@ -68,9 +68,15 @@ // Avoid a cycle dependency & infinite loop if (currentValue !== undefined) { if (isNumeric && numInputValue !== currentValue) { - const value = Number(currentValue); + if (typeof currentValue === 'number') { + numInputValue = currentValue; + } else if (typeof currentValue === 'string') { + const value = currentValue.trim() ? Number(currentValue) : NaN; - numInputValue = !Number.isNaN(value) ? value : undefined; + numInputValue = !Number.isNaN(value) ? value : undefined; + } else { + numInputValue = undefined; + } } if (!isNumeric && strInputValue !== currentValue) {