Skip to content

[Bug] Twitch Extension nodes converted to HTML don't convert back properly if loaded into the editor again #7563

@MMOSimca

Description

@MMOSimca

Affected Packages

@tiptap/extension-twitch

Version(s)

3.20.0

Bug Description

The issue occurs when the editor's content, after being read as HTML, is fed back into itself. For some reason, it strips the unique parts of the links out from the iframe elements, leaving generic player.twitch.tv URLs for Channel and Video links (which turn into "Invalid Twitch URL"). For Clips links, the unique clip ID is stripped, resulting in a "clip not found" entry. While it never turns into "Invalid Twitch URL", this is also wrong.

Browser Used

Chrome

Code Example URL

https://codesandbox.io/p/devbox/boring-star-xr4mhf?workspaceId=ws_7RxxXybA9sS3v4RjCuas2r

Expected Behavior

I expect the HTML to be converted back into PM nodes in Tiptap. This is how the YouTube extension functions.

Additional Context (Optional)

I assume this has to do with how Twitch's URLs have to be converted from the "normal" format to those weird player.twitch.tv links - the conversion probably isn't working right in the other direction. The YouTube extension doesn't need to do this, I think, so it doesn't have this issue.

In the example I provided, the issue is present. Just click on the big button at the top to trigger the issue repeatedly. I'm not sure how to get around codesandbox.io blocking Twitch content from loading, but that doesn't seem to matter since the underlying div/iframe structure is correct and the rest shouldn't matter (plus this code works fine locally and has the same bug).

Dependency Updates

  • Yes, I've updated all my dependencies.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Open SourceThe issue or pull reuqest is related to the open source packages of Tiptap.

    Type

    No fields configured for Bug.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions