After merging https://github.com/contentful/field-editors/pull/1542 , copy pasting rich text content with links behaved differently. Before, a link would get copied over successfully. Afterwards, a link would not get copied anymore and it would include the link separately. This PR fixes that.
I render the edit link popover component with a portal. This introduces some issues with positioning. First of all, we have to now check when the popover component should be displayed. It will only display when the editor is focussed and the caret is inside a link OR when the mouse interacts with the popover.
I've also changed the Text to TextLink in the rich text editor, which will make sure that when an editor copies over the content, it will be copied over as a link.
Description
After merging https://github.com/contentful/field-editors/pull/1542 , copy pasting rich text content with links behaved differently. Before, a link would get copied over successfully. Afterwards, a link would not get copied anymore and it would include the link separately. This PR fixes that.
Ticket: https://contentful.atlassian.net/browse/TOL-1647
How?
I render the edit link popover component with a portal. This introduces some issues with positioning. First of all, we have to now check when the popover component should be displayed. It will only display when the editor is focussed and the caret is inside a link OR when the mouse interacts with the popover. I've also changed the Text to TextLink in the rich text editor, which will make sure that when an editor copies over the content, it will be copied over as a link.