-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Remove link under cursor when no text is selected #449
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
Comments
+1 |
Can you explain how you did this part of your work? |
import { Link as BaseLink } from 'tiptap-extensions';
export default class Link extends BaseLink {
/**
* Remove the default plugin so that clicking on a link does not open it.
*/
get plugins() {
return [];
}
} |
Cool thanks. New to Vue and Typescript, I forgot we have classes that can be inherited. |
There is a new setting for links: new Link({
openOnClick: false,
}) I've also changed how updating marks work now, so you'll be able to update links for empty selections. |
Both changes are working great for me, thanks! |
Is your feature request related to a problem? Please describe.
Using the menu bubble component, I am trying to build a UI for editing/remove links similar to Google Docs. The desired behaviour is that when you place the cursor inside a link, the menu bubble shows with the link's URL, and controls to edit/remove the link.
I can get halfway there.
First, I overrode the Link extension to remove the ProseMirror plugin that causes the URL to open when you click on a link mark (I think that is not a great choice for the default behaviour, at the very least it should be configurable, or maybe require a modifier key like Ctrl to be pressed).
Second, rather than using
menu.isActive
to show or hide the menu bubble, if I just useisActive.link()
I can get the menu bubble to display when the cursor is inside a link, even without a text selection:However, clicking the Remove button without a text selection, it does nothing.
Describe the solution you'd like
If the link command is executed with
{ attr: null }
without a text selection, I would like any link marks that the cursor is within to be removed.The text was updated successfully, but these errors were encountered: