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

feat(extension-link): add openOnMetaClick option to handle meta/ctrl on click #4896

Closed
wants to merge 1 commit into from

Conversation

sudo97
Copy link

@sudo97 sudo97 commented Feb 16, 2024

Please describe your changes

Add new option to link extension. openOnMetaClick. When it is true clicks on the link will work only when CMD/Ctrl are pressed.

How did you accomplish your changes

[add a detailed description of how you accomplished your changes here]

How have you tested your changes

[add a detailed description of how you tested your changes here]

How can we verify your changes

[add a detailed description of how we can verify your changes here]

Remarks

[add any additional remarks here]

Checklist

  • The changes are not breaking the editor
  • Added tests where possible
  • Followed the guidelines
  • Fixed linting issues

Related issues

[add a link to the related issues here]

Copy link

netlify bot commented Feb 16, 2024

Deploy Preview for tiptap-embed failed.

Name Link
🔨 Latest commit 4755d4e
🔍 Latest deploy log https://app.netlify.com/sites/tiptap-embed/deploys/65cfb7f8f022650008c8a801

@nperez0111
Copy link
Contributor

nperez0111 commented May 13, 2024

What is the use case for this? Doesn't this break the default behavior of CMD+Click being to open in a new tab? I'm not sure that we would want to use this in everyone's editor.

Perhaps this is a good extension for you, that you can override in your editor use case?

@sudo97
Copy link
Author

sudo97 commented May 14, 2024

Does nothing unless the option is explicitly used, so no it shouldn't break any defaults, it just adds a popular (from my point of view) option. But maybe you're right, I actually don't have resource to finish it the right way, so maybe it's better to close it

@nperez0111
Copy link
Contributor

I agree on closing it too. I'm not sure that we would want this behavior as an option. Though we do appreciate you trying to contribute and would encourage you to contribute again.

Extensions are very flexible so we want their behavior to be easily overridable by the consumer for such situations. We prefer extensions to configuration of every possibility.

@nperez0111 nperez0111 closed this May 14, 2024
@sudo97
Copy link
Author

sudo97 commented May 14, 2024

@nperez0111 it was like this: I had to achieve this cmd+click behaviour in the app I worked on (same thing, I think we have in Jira comments, and in Azure as well, which my boss used as a reference), I was unable to do it with the existing extension, and what worked for me is to just copy-paste the extension and add what you see in this PR to it. This was the moment I decided I'd try to create a PR, but then life happened so I never made it right haha

@nperez0111
Copy link
Contributor

No worries!

I'd also recommend that instead of copy-pasting the entire extension whole-sale that you can just .extend the existing extension and override what you need out of it. See this example of using a custom keyboard combo for bullet lists as an example. For your situation, you'd override the addProseMirrorPlugins to use your custom handler.

Happy tip tapping!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

None yet

2 participants