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

Updated Toolbar Plugin to Add keyboard shortcut for adding hyperlinks #4413

Merged
merged 2 commits into from May 1, 2023

Conversation

AnuragBalhra
Copy link
Contributor

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.

@vercel
Copy link

vercel bot commented Apr 26, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
lexical ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 26, 2023 11:52pm
lexical-playground ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 26, 2023 11:52pm

@facebook-github-bot
Copy link
Contributor

Hi @AnuragBalhra!

Thank you for your pull request and welcome to our community.

Action Required

In 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.

Process

In 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 CLA signed. The tagging process may take up to 1 hour after signing. Please give it that time before contacting us about it.

If you have received this in error or have any questions, please contact us at cla@meta.com. Thanks!

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Apr 26, 2023
@affvalente
Copy link

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) {
Copy link
Contributor

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

Copy link
Contributor Author

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.

@AnuragBalhra
Copy link
Contributor Author

@affvalente Just curious how do other contributors test their changes on different os platforms? I just have Mac. Should I install VM for win?

@fantactuka
Copy link
Contributor

@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()

Copy link
Contributor

@fantactuka fantactuka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Copy link
Member

@zurfyx zurfyx left a 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!

@zurfyx zurfyx merged commit a9a2a09 into facebook:main May 1, 2023
43 of 45 checks passed
This was referenced May 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants