Input cleanup

This commit is contained in:
barsdeveloper
2022-11-11 20:31:17 +01:00
parent 18bf858db3
commit 48065a4777
12 changed files with 91 additions and 112 deletions

View File

@@ -5,7 +5,12 @@ import ITemplate from "./ITemplate"
/** @extends {ITemplate<InputElement>} */
export default class InputTemplate extends ITemplate {
#focusHandler = () => this.element.blueprint.dispatchEditTextEvent(true)
#focusHandler = () => {
this.element.blueprint.dispatchEditTextEvent(true)
if (this.element.selectOnFocus) {
getSelection().selectAllChildren(this.element)
}
}
#focusoutHandler = () => {
this.element.blueprint.dispatchEditTextEvent(false)
document.getSelection()?.removeAllRanges() // Deselect eventually selected text inside the input