mirror of
https://github.com/barsdeveloper/ueblueprint.git
synced 2026-02-27 10:44:43 +08:00
Color picker improvements
This commit is contained in:
24
js/template/InputTemplate.js
Normal file
24
js/template/InputTemplate.js
Normal file
@@ -0,0 +1,24 @@
|
||||
import ITemplate from "./ITemplate"
|
||||
|
||||
/** @typedef {import ("../element/InputElement").default} InputElement */
|
||||
|
||||
/** @extends {ITemplate<InputElement>} */
|
||||
export default class InputTemplate extends ITemplate {
|
||||
|
||||
/** @param {Map} changedProperties */
|
||||
firstUpdated(changedProperties) {
|
||||
super.firstUpdated(changedProperties)
|
||||
this.onFocusHandler =
|
||||
/** @param {FocusEvent} e */
|
||||
e => this.element.blueprint.dispatchEditTextEvent(true)
|
||||
this.onFocusOutHandler =
|
||||
/** @param {FocusEvent} e */
|
||||
e => {
|
||||
e.preventDefault()
|
||||
document.getSelection()?.removeAllRanges() // Deselect text inside the input
|
||||
this.element.blueprint.dispatchEditTextEvent(false)
|
||||
}
|
||||
this.element.addEventListener("focus", this.onFocusHandler)
|
||||
this.element.addEventListener("focusout", this.onFocusOutHandler)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user