EditBox: fixed size calculation (#2181)

Signed-off-by: Alexander Platov <sas_lord@mail.ru>
This commit is contained in:
Alexander Platov 2022-06-30 14:24:53 +03:00 committed by GitHub
parent 7653c1cf83
commit 03cd4703e8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -48,7 +48,10 @@
function computeSize (t: HTMLInputElement | EventTarget | null) { function computeSize (t: HTMLInputElement | EventTarget | null) {
const target = t as HTMLInputElement const target = t as HTMLInputElement
const value = target.value const value = target.value
text.innerHTML = (value === '' ? phTraslate : value).replaceAll(' ', '&nbsp;') text.innerHTML = (value === '' ? phTraslate : value)
.replaceAll(' ', '&nbsp;')
.replaceAll('<', '&lt;')
.replaceAll('>', '&gt;')
if (format === 'number') { if (format === 'number') {
target.style.width = maxWidth ?? '5rem' target.style.width = maxWidth ?? '5rem'
} else if (kind === 'underline') { } else if (kind === 'underline') {