Open NathanLauth opened 1 year ago
I have stumbled upon this issue as well.
This makes it very difficult to restore a XmlFragment from the output of XmlFragment.toJSON(). Especially, because the XmlFragment cannot be properly cloned to be inserted in another yDoc.
You can see a reproduction of the above and the problem with the clone here: https://codesandbox.io/p/sandbox/agitated-night-7fgj8d
You just have to open the console from the served page to the right.
I think you can create the XmlFragment
with prosemirrorJSONToYXmlFragment(schema, state)
, but you can only get its contents after linking to a Y.Doc. See https://github.com/yjs/yjs/blob/main/src/types/YXmlFragment.js#L306.
Describe the bug In order to initially create and populate my Y.Doc in my server (Before sharing it with my frontend) I want to use y-prosemirror utility fonctions. The final goal is to have my Tiptap Wysiwyg nicely displayed with the already existing data in my DataBase (HTML stored as String). I already have my Y.Doc, and I only want to create a new Y.XmlFragment populated with my existing HTML.
So the utility function
prosemirrorJSONToYXmlFragment(schema, state)
looks perfect for my usage. But it seems that the method cannot return a populated Y.XmlFragment, without giving an existing one already linked to an existing Y.DocTo Reproduce I think the best thing I can do is to provide a real exemple of what I am trying to do :
Expected behavior I expect that if i use the method
prosemirrorJSONToYXmlFragment(schema, state)
with valid schema and json, it should create me a populated Y.XmlFragmentEnvironment Information