Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

allow special characters at the beginning of pattern #6

Open
agapas opened this issue Aug 25, 2015 · 5 comments
Open

allow special characters at the beginning of pattern #6

agapas opened this issue Aug 25, 2015 · 5 comments

Comments

@agapas
Copy link

agapas commented Aug 25, 2015

it stops work when you delete all characters from the input for pattern such as '(111) 111-1111',
but still works for pattern '111) 111-1111'

@insin
Copy link
Owner

insin commented Sep 11, 2015

Can you provide details on how to reproduce this?

A failing addition to the 'Leading static characters' test case would be ideal.

@AuthorProxy
Copy link

AuthorProxy commented Jun 23, 2016

@agapas currently plugin expect that you provide mask characters if you insert at begin of input, like mask.paste('(123)456-7890')

@onebit0fme
Copy link

onebit0fme commented Oct 3, 2016

@AuthorProxy Thanks for the clarification. I have the same issue with this pattern. Following your example, in order to work with (111)-111-1111 pattern, I'd need to do mask.paste('(1234567890'), since I want it to be masked for me, and not actually provide masked input.

If I read the code correctly, the intented behaviour of mask.paste() is to accept both masked and unmasked values (as mentioned here). Hovewer,

  // If there are static characters at the start of the pattern and the cursor
  // or selection is within them, the static characters must match for a valid
  // paste.

the code that checks the first character does not account for unmasked value as the first charater, and has to match exactly the static charater (that is missing, since it's unmasked). Hence, mask.paste('1234567890') will fail because of the first character, but mask.paste('(1234567890') will succeed because the rest of the paste (after the first character) supports unmasked value.

This is not a dealbreaker, the workaround is to loop through the string and do mask.input(char) instead, I just thought I'd clarify the issue we had working with this pattern.

thanks

@Khangeldy
Copy link

not working mask.paste with +7(111)-111-11-11

@Khangeldy
Copy link

Thank you i understand it. Sorry my bad english. Solution is mask.paste("+7(" + rest number).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants