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

fix(core): remove editor keydown keyCaptureList duplicate code #1322

Merged
merged 1 commit into from
Jan 11, 2024

Conversation

ghiscoding
Copy link
Owner

@ghiscoding ghiscoding commented Jan 11, 2024

duplicate code exist at line shown below, so there's no need to keep keydown keyCaptureList duplicate code. I found this duplicate code while adding unit tests and the piece of code that I'm removing seems unreachable, hence why I'm removing it

if (!e.shiftKey && !e.altKey) {
// editor may specify an array of keys to bubble
if (this._options.editable && this.currentEditor?.keyCaptureList) {
if (this.currentEditor.keyCaptureList.indexOf(String(e.which)) > -1) {
return;
}
}

so we can remove duplicate code appearing with a slight different if condition

if (!e.shiftKey && !e.altKey && !e.ctrlKey) {
// editor may specify an array of keys to bubble
if (this._options.editable && this.currentEditor?.keyCaptureList) {
if (this.currentEditor.keyCaptureList.indexOf(String(e.which)) > -1) {
return;
}
}

Copy link

codecov bot commented Jan 11, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (801bd4c) 97.7% compared to head (aad0661) 97.7%.

Additional details and impacted files
@@           Coverage Diff            @@
##           master   #1322     +/-   ##
========================================
+ Coverage    97.7%   97.7%   +0.1%     
========================================
  Files         198     198             
  Lines       21288   21285      -3     
  Branches     7095    7093      -2     
========================================
- Hits        20789   20788      -1     
+ Misses        499     497      -2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@ghiscoding ghiscoding merged commit c5f6b85 into master Jan 11, 2024
5 checks passed
@ghiscoding ghiscoding deleted the bugfix/remove-duplicate-keycapturelist branch January 11, 2024 03:29
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

Successfully merging this pull request may close these issues.

1 participant