-
Notifications
You must be signed in to change notification settings - Fork 2k
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
feat: allow configuring when to use the 'copy' dropEffect #3498
base: main
Are you sure you want to change the base?
Conversation
if (this.optionsArgs?.copyKey === undefined) { | ||
return e.altKey | ||
} | ||
switch (this.optionsArgs?.copyKey) { | ||
case 'shift': | ||
return e.shiftKey | ||
case 'ctrl': | ||
return e.ctrlKey | ||
case 'alt': | ||
return e.altKey | ||
case 'meta': | ||
return e.metaKey |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if (this.optionsArgs?.copyKey === undefined) { | |
return e.altKey | |
} | |
switch (this.optionsArgs?.copyKey) { | |
case 'shift': | |
return e.shiftKey | |
case 'ctrl': | |
return e.ctrlKey | |
case 'alt': | |
return e.altKey | |
case 'meta': | |
return e.metaKey | |
switch (this.optionsArgs?.copyKey) { | |
case 'shift': | |
return e.shiftKey | |
case 'ctrl': | |
return e.ctrlKey | |
case undefined: | |
case 'alt': | |
return e.altKey | |
case 'meta': | |
return e.metaKey |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like this won't type check without a non-null assertion which is forbidden by the linter. Seems to be a TypeScript issue (minimal reproduction: https://www.typescriptlang.org/play?ts=4.9.0-dev.20221007#code/CYUwxgNghgTiAEYD2A7AzgF3gDwFzwG94AjWAfgAoBKfANyQEth4BfeAH3gFcVQAzBihDAA3ACg+PMBgap4fJEmqEx8NfDQB3BhjAALeBWxkAdKRhUV664ihoEPfoOG5VN93AxcYKcdZZuathmsNTiAUA).
There was an unnecessary optional chaining operator there though which I've removed.
Allows using keys other than alt to set the dropEffect to 'copy', and allows using a predicate callback in case the user wants more complex behavior.
Resolves #2979