Disabling link extension no longer works
Describe the bug
In the latest version (0.44.2) of BlockNote you cannot use disableExtensions: ['link'], in useCreateBlockNote in order to disable the built in link functionality. In version 0.41.1 this worked, which allowed me to create my own link implementation with features that are missing from the base implementation.
How would I go about disabling the link in the latest version?
To Reproduce
- Create some content that has links and add to editor
- Add 'link' to
disableExtensions. Observe that it has no effect. - Downgrade version to 0.41.1, now the links should be parsed as plain text.
Example
Go to Stackblitz example. Observe that link is added to disabledExtensions, yet the links are still displayed as links with link toolbars etc. Downgrade the version to 0.41.1 and observe that the links are no longer parsed as links, since disableExtensions now works.
Thanks for pointing out this issue @skjalghodneland, I've attached a PR which resolves the issue.
Can I ask what was insufficient about the Link extension that you need to disable it?
The Link extension is in a strange in-between where it both an extension and part of the schema, for other block / inline content / styles it would be recommended to have customized the schema instead of relying on this mechanism. But, I realize this is the only way to disable the Link functionality right now.
Thanks a lot for swiftly creating a PR to fix the issue!
For us the biggest issue with the built in link implementation was that we needed to be able to set if clicking a link should open in a new tab or in the current tab on a per-link basis, with support for parsing this from html as well to not break links from legacy (created in Froala) documents.
This is mostly due to a requirement of being able to create links to scroll to sections of a document, for instance for a table of content at the start of a document. We needed to allow our users to easily set and control this behaviour when creating their documents.
If there are better ways to achieve this im not opposed to rewrite this on my end, but when we made the switch disabling the Link and creating a CustomLink seemed like the best approach.
@skjalghodneland in your case, I think the easiest thing to do is what you've already done & replace the implementation. In the future we can provide options to the BlockNote Link extension to be able to support your use-case, but for now I think what you've done should be fine
closed by https://github.com/TypeCellOS/BlockNote/issues/2282#issuecomment-3646691152
I noticed this too on the Link example, I clicked on the link expecting some menu to show up when I double-clicked. But, it displays after hovering on it for a bit.
I was able to disable clicking on the link in the editor by using CSS:
.bn-container a {
pointer-events: none;
}