You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The idea is simple, when any of the masks is complete I just want to call a function (covered in inputmask.js) to do some business logic there.
The problem is: The input does not allow more typing after the first mask is complete! I've checked if is a inputmask bug but I think is not, because everything works when I remove @update part (of course with bunch of console errors because @update is required by the component).
I've tried to reproduce this behaviour in tests right here in this repo, as placed in: #144
The text was updated successfully, but these errors were encountered:
brunoocasali
added a commit
to brunoocasali/ember-inputmask
that referenced
this issue
Feb 13, 2021
To workaround this i've implemented a really simple version:
importComponentfrom'@glimmer/component';importInputmaskfrom'inputmask';import{action}from'@ember/object';import{tracked}from'@glimmer/tracking';constDEFAULT_OPTIONS={rightAlign: false,};// TODO: must be tested or replaced by ember-input-mask version when this issue was closed// https://github.com/brandynbennett/ember-inputmask/issues/143exportdefaultclassFormsInputMaskComponentextendsComponent{
@trackedinputmask;
@actionsetupMask(element){letoptions={ ...DEFAULT_OPTIONS, ...this.args.options};this.inputmask=newInputmask(this.args.mask,options);this.inputmask.mask(element);}
@actionprocessNewValue({ target }){letcursorStart=target.selectionStart;letcursorEnd=target.selectionEnd;this.sendUpdate(target.inputmask.unmaskedvalue(),target.value);target.setSelectionRange(cursorStart,cursorEnd);}sendUpdate(unmaskedValue,value){this.args.update&&this.args.update(unmaskedValue,value);}willDestroy(){this.inputmask.remove();}}
Hello!!
In my app I have a field with two kinds of masks:
The idea is simple, when any of the masks is complete I just want to call a function (covered in inputmask.js) to do some business logic there.
The problem is: The input does not allow more typing after the first mask is complete! I've checked if is a inputmask bug but I think is not, because everything works when I remove
@update
part (of course with bunch of console errors because@update
is required by the component).I've tried to reproduce this behaviour in tests right here in this repo, as placed in: #144
The text was updated successfully, but these errors were encountered: