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

custom mask incorrect logic on deletion of character before a delimiter #128

Closed
rsouthgate opened this issue Mar 3, 2019 · 0 comments · Fixed by #129
Closed

custom mask incorrect logic on deletion of character before a delimiter #128

rsouthgate opened this issue Mar 3, 2019 · 0 comments · Fixed by #129

Comments

@rsouthgate
Copy link

Take a mask 999-999 for example.

Input the text 123456 which is translated to 123-456.

Position caret before delimiter: 123|-456 and delete; 12-456

The logic on the custom mask to replace the characters here:

var translationHandler = translation[maskChar];
    if (translationHandler) {
      var resolverValue = translationHandler(valueChar || '');
      if (resolverValue !== null) {
        result += resolverValue;
        valueCharIndex += 1;
      } else {
        result += maskChar;
      }
      maskCharIndex += 1;
      continue;
    }
    result += maskChar;
    maskCharIndex += 1;
    continue;

after the deletion when it meets character 3 ('-') with the mask character 3 ('9') will replace with '' and move to character 4 ('4') and compare with mask character 4 ('-') for which there is no translation handler so the result gets the mask character ('-').

I have modified this in a fork and will submit a PR referencing this issue.

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