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!: injection chains to allow merging custom and addons/themes keyboard shortcuts #702
Conversation
Following the failing cypress, I'll force push the replacement of |
BREAKING CHANGE: Previous code that redefines shortcuts will remove all default ones.
7698a6d
to
40e872e
Compare
I am not sure if the breaking change is necessary, but @manniL since you are using the feature, I guess we could have it if it make sense to you |
I'm fine with the suggested changes as they put defining shortcuts a little bit more "in line" with other features, especially regarding "implicit" mutation of the shortcuts object |
Another solution, which is better for backward compatibility and at the same time allow the new API... but is maybe over-engineered given than slidev is still in version 0.*... would be to keep the old API untouched and rename this one as setupShortcuts2 or something like that. This could be combined with runtime messages and progressive deprecation... but again it is probably too much here. The solution I'd (now) recommend is to do the breaking change + add a check: if all shortcuts have been removed (not returned by the injected function) then we warn the user (how?) with a link to the updated doc. |
I proposed the doc update there slidevjs/docs#90 |
I think that combined with the docs PR this is a decent solution. I currently both alert and console.warn the message (to have a clickable link to the documentation). |
@antfu considering the discussion, I'd say this one is ok to merge together with the doc PR mentioned). As it is a breaking change, I leave you the final click. |
Fixes #629
IMPORTANT, There are 4 commits
Basically, the third commit breaks every situation that used setup/shortcuts (the default shortcuts are then removed).
The doc update would suggest something like:
Related to #659 (authored by @manniL )