-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
[Bug]: Cannot parse generated html from YouTube extension #4089
Comments
Facing same issue in
After running
|
Quick follow up on this issue, it seems like it is due to the underlying HTML parsing library used, so not an issue with TipTap or Prosemirror. Switching to a different library than export function generateJSON(html: string, extensions: Extensions): Record<string, any> {
const schema = getSchema(extensions)
const dom = parseHTML(html) as unknown as Node
return DOMParser.fromSchema(schema).parse(dom).toJSON()
} |
@ben-bourdin451 What library did you end up using instead of |
Still digging into it, opened an issue in Update: I re-implemented the latest version of zeed-dom locally and it looks like it works, despite throwing a warning. |
we ended up using linkedom |
Is there any recommendation on what to do, until this bug is fixed? I want to use YouTube Videos in my documents and need to store them as HTML files. I tried |
@vekunz
import { Extensions, getSchema, JSONContent } from '@tiptap/core';
import { DOMSerializer, Node } from '@tiptap/pm/model';
import { Window } from 'happy-dom';
export function generateHTML(doc: JSONContent, extensions: Extensions): string {
const schema = getSchema(extensions);
const contentNode = Node.fromJSON(schema, doc);
const window = new Window();
const fragment = DOMSerializer.fromSchema(schema).serializeFragment(
contentNode.content,
{
document: window.document as unknown as Document,
},
);
const serializer = new window.XMLSerializer();
// @ts-ignore
return serializer.serializeToString(fragment as unknown as Node);
} Edit: The |
Which packages did you experience the bug in?
extension-youtube, html
What Tiptap version are you using?
^2.0.0
What’s the bug you are facing?
Using
generateHTML
&generateJSON
utilities from@tiptap/html
doesn't work with the YouTube extension. Sample easily replicable test case:Test fails with:
What browser are you using?
Chrome
Code example
No response
What did you expect to happen?
I would expect the above test to pass.
Anything to add? (optional)
Looks like this could be an issue with
zeed-dom
and how it parses the html. I would happily open an issue there however since I couldn't find much information relating to a similar issue (only this seems close) it's hard to tell exactly what the issue is.Did you update your dependencies?
Are you sponsoring us?
The text was updated successfully, but these errors were encountered: