fire input event when file is read, fix deprecated func and improved display

This commit is contained in:
dcore94 2024-04-23 16:41:53 +02:00
parent e3efc70bad
commit f7cd0932b5
1 changed files with 4 additions and 1 deletions

View File

@ -524,7 +524,10 @@ class CCPFileInputWidgetController extends CCPBaseInputWidgetController {
encoded += '='.repeat(4 - (encoded.length % 4));
}
this.value[index] = encoded
this.querySelector("small[name=preview]").textContent = encoded.substr(0, 5) + "..." + encoded.substr(encoded.length - 5)
this.querySelector("small[name=preview]").textContent =
encoded.length > 15 ? encoded.substring(0, 5) + "..." + encoded.substring(encoded.length - 5) : encoded
const newev = new Event("input", { bubbles : true})
this.dispatchEvent(newev)
})
reader.readAsDataURL(file)
}