-
-
Notifications
You must be signed in to change notification settings - Fork 58
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
Feature: Plus sign support #755
Feature: Plus sign support #755
Conversation
@leoeuclids while that statement is totally true, was there any problem with that approach? Were there some use cases where it failed? |
@leoeuclids could you please fix prettier/lint errors so we could trigger CI? |
Not really, no. It's just an improvement in readability, but nothing more. I'm fine with removing it, if you want.
Will do. |
if you don't mind, let's keep PR focused and revert that specific |
a99750d
to
3fac1a3
Compare
Done |
@SergeAstapov Could you help me with the CI errors? They seem to be happening on every recent PR, so unrelated to this PR changes? |
3fac1a3
to
6e9f009
Compare
Is there anything missing to get this merged? Would really love to add some keyboard shortcuts with |
6e9f009
to
7629bd5
Compare
Why?
Ember-keyboard currently does not support key combos that contain a plus sign and modifier keys, e.g. shift++ and ctrl++.
Also, the colon usage was being achieved through a split/join, but it could be replaced by regex match.
What it achieves
Adds support for the plus sign in any configuration and uses regex matching to separate the eventType from the keyCombo.
Upgrade path
No changes are needed, since all previously supported features still work the same way.
Caveats
The plus sign support could be achieved with a regex split, but it requires lookbehind, which has support conflict with Ember 3.8 and IE.
For that reason, the solution involves splitting by the plus sign and collapsing two subsequent empty strings into a plus sign.
Example:
'Ctrl++'
>['Ctrl', '', '']
>['Ctrl', '+']
Regex with lookbehind:
/(?<=[^+])\+|\+(?=[^+])/g
What this PR does