I am using Atlaskit Editor that uses prosemirror under the hood. I need to get the HTML to send the content in mail after all clients are disconnected.
I am trying to make use of Editor Json Transformer to convert the Prosemirror Node to JSON but I am not able to access the prosemirror node in writeState.
I have tried using yDocToProsemirror func from y-prosemirror but the content seems to be always empty.
I think yDocToProsemirror should also expect xmlFragment as it passes ydoc to yDocToProsemirrorJSON but not the xmlFragement. So, its only working when I provide the docName as ‘prosemirror’.
The reason why the author of that feature used Y.Doc as a baseline (instead of Y.XmlFragment) is that it seems more convenient than working with a Yjs type in this case. But I agree with you that it should have been Y.XmlFragment instead.
Maybe you could open a PR that also allows to create a Y.XmlFragment. I.e. implement yXmlFragmentToProsemirrorJSON and prosemirrorToYXmlFragment.
Alternatively, you implement a third parameter in yDocToProsemirror(schema, ydoc, typeName = 'prosemirror').
I think it is important to add the third parameter because I don’t want to remove the existing functions. Adding the functions for XmlFragment would be a welcoming addition as well.