-
Notifications
You must be signed in to change notification settings - Fork 55
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
Not sure how to add a new XML fragment #126
Comments
Ok, change of plan, I'm now using the 'field' property inside the TipTap Collaboration.configure({
document: getYjsDoc(collaborativeStore),
field: documentId,
}), I need to do a little more reading to understand the implications of this but it seems to work! Happy for any comments on this approach (rich text documents stored in the fields of the ydoc and folder structure managed in an object on the synced store). |
I’m figuring this out too, right now. For those following along, this is what I’ve figured out after playing around with the library for a day or two: It’s stated in the docs that the The part where you declare a top-level type as This only works in the I’ve learned that if you want to store a
This creates an Of course, you can also directly create a But by creating the XmlFragment using the SyncedStore proxy, everything is tracked by SyncedStore which might be more convenient, especially if manipulating the I don’t know if this approach is recommended or if there are any downsides. @YousefED if you could comment on this? |
I think passing a nested XmlFragment like you're doing should be fine @andrictham ! |
Hello!
I'm not sure how to add a new XML fragment to my array of objects.
The use case is around having multiple 'pages' in a rich text editor. I would then have a separate object in the synced store that would maintain the folder structure.
My store currently looks like this:
It works great for the todo list:
But if I try and add a new doc I'm not sure what I should be pushing to the array...
If I use a fragment that's created at initialization of the synced store, everything works (collaboration cursor, collaborative editing, persistence, etc.) for a single document:
I've tried to populate the array
collaborativeStore.docs
in various ways and each has failed. They all follow this pattern:Gives this error:
Gives no error but the collaboration does not work (no cursor, no collaborative editing, no save)
Gives the following error
Note that I am doing this outside of the react lifecycle (i.e. not using
useSyncedStore
just operating on the store directly but from what I understand that's not likely to be the issue. Oh and we're using TipTap for the rich text editorWhat should I be doing? 🙏
The text was updated successfully, but these errors were encountered: