Doist / typist

The mighty Tiptap-based rich-text editor that powers Doist products.

Home Page:https://typist.doist.dev

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Pasting a URL on a text selection no longer hyperlinks the selection

rfgamaral opened this issue · comments

With #411 we fixed Markdown hyperlink pasting which stopped working, however, that introduced this new issue where pasting a URL on a text selection no longer hyperlinks the selection. Instead, the text selection is completely replaced with the URL. This mechanism came from Tiptap, and with the recent updates, the mechanism was moved to the pasteHandler plugin, which got disabled with #411.

The fix for this issue involves reverting #411, and fixing the issue that #411 aimed to fix with a different solution.

One possible solution that I thought of was to implement the validate function from Linkify here, and test for the Markdown hyperlink syntax. If the Markdown hyperlink syntax is found, return false, otherwise return true. This fix will need to be pushed upstream to Tiptap. Also, it may be worth it to introduce a new option to the Link extension to allows users control over this behaviour.

However, the above solution does not work because there's a bug in the Linkify find function, which I reported here. Once that's fixed, and a new Linkify version is released, we can then start working on pushing a fix to Tiptap.

The upstream Tiptap issue is also reported here.