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

[BUG] Clicking delete with a portion of the text highlighted #23

Open
lqxchad opened this issue Oct 18, 2018 · 0 comments
Open

[BUG] Clicking delete with a portion of the text highlighted #23

lqxchad opened this issue Oct 18, 2018 · 0 comments

Comments

@lqxchad
Copy link

lqxchad commented Oct 18, 2018

When highlighting a portion of the text, the delete key does not work.
I modified the code to not ignore partially highlighted text and I did not find any negative impacts.

Here is the modified code below. Can you tell me if there is a problem with doing it this way?

InputHandler.prototype.handleKeydown = function (event) {
    var keyCode = event.which || event.charCode || event.keyCode;
    if (keyCode == 8 || keyCode == 46 || keyCode == 63272) {
        event.preventDefault();
        var selectionRangeLength = Math.abs(this.inputService.inputSelection.selectionEnd - this.inputService.inputSelection.selectionStart);

        if (selectionRangeLength >= (this.inputService.rawValue.length - this.inputService.prefixLength())) {
            this.clearValue();
        } else {
            this.inputService.removeNumber(keyCode);
            this.onModelChange(this.inputService.value);
        }
    }
};
@nbfontana nbfontana changed the title Clicking delete with a portion of the text highlighted [BUG] Clicking delete with a portion of the text highlighted May 21, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants