#1103 vnTextfield doesnt blur anymore
This commit is contained in:
parent
a37fdd1e33
commit
60ec49abbd
|
@ -18,18 +18,15 @@ export default class Textfield extends Input {
|
||||||
if (!this.oldValue)
|
if (!this.oldValue)
|
||||||
this.saveOldValue();
|
this.saveOldValue();
|
||||||
});
|
});
|
||||||
|
|
||||||
this.input.addEventListener('keyup', e => {
|
this.input.addEventListener('keyup', e => {
|
||||||
if (e.key == 'Escape') {
|
if (e.defaultPrevented || e.key != 'Escape')
|
||||||
|
return;
|
||||||
|
|
||||||
this.value = this.oldValue;
|
this.value = this.oldValue;
|
||||||
this.cancelled = true;
|
this.cancelled = true;
|
||||||
e.stopPropagation();
|
e.preventDefault();
|
||||||
}
|
|
||||||
if (e.key == 'Escape' || e.key == 'Enter')
|
|
||||||
this.input.blur();
|
|
||||||
});
|
});
|
||||||
|
this.input.addEventListener('change', e => {
|
||||||
this.input.addEventListener('blur', () => {
|
|
||||||
if (this.onChange && !this.cancelled && (this.oldValue != this.value)) {
|
if (this.onChange && !this.cancelled && (this.oldValue != this.value)) {
|
||||||
this.onChange();
|
this.onChange();
|
||||||
this.saveOldValue();
|
this.saveOldValue();
|
||||||
|
|
Loading…
Reference in New Issue