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
Updated Toolbar Plugin to Add keyboard shortcut for adding hyperlinks #4413
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
Hi @AnuragBalhra! Thank you for your pull request and welcome to our community. Action RequiredIn order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you. ProcessIn order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA. Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with If you have received this in error or have any questions, please contact us at cla@meta.com. Thanks! |
When I press Ctrl+K on windows this change opens the browser's search bar, rather than Lexical's link edit box |
@@ -515,6 +515,16 @@ export default function ToolbarPlugin(): JSX.Element { | |||
editor.registerEditableListener((editable) => { | |||
setIsEditable(editable); | |||
}), | |||
activeEditor.registerRootListener((rootElement) => { | |||
if (rootElement) { |
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.
Can use KEY_MODIFIER_COMMAND handler to be called on KEY_DOWN if any of meta/ctr/alt are pressed
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.
Really appriciate the suggestion.
I've updated the changes to use KEY_MODIFIER_COMMAND command handler.
@affvalente Just curious how do other contributors test their changes on different os platforms? I just have Mac. Should I install VM for win? |
e2e tests would run on all platforms, as it's pretty hard to have all of them available to test locally. That said, I think it should work fine now with preventDefault() |
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.
👍
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.
Thank you, LGTM! Please have a look into #4439 if you have some time, some small nits but the UX would improve greatly!
Fix for Issue #4347
Registered new event listener in Toolbar plugin to insert link using TOGGLE_LINK_COMMAND when we press Cmd/Ctrl + K
This is my first contribution in the repo so not sure if I did it the right way.