Append a dom node to YJS

Hello,

Is there an easy way to bind a document.querySelector(’#DomID’), to YJS?.

For example. If I add an extra childnode in the node with id DomID, the other open pages will be automatically been updated.

Thanks in advance!

Dennis

Hi Dennis,

great to see you here!

Is there an easy way to bind a document.querySelector(’#DomID’), to YJS?.

Are you looking for a method to find a document using something similar to querySelector? Or are you actually looking to do something with the Dom in Yjs?

Yes! Still a big fan :slight_smile:

Or are you actually looking to do something with the Dom in Yjs?

This one. I want to sync dom changes in browser with others.

1 Like

Made me think of this…
Could you use Prosemirror and the DOMParser with a loose schema definition? https://prosemirror.net/docs/ref/#model.DOM_Representation? Then use y-prosemirror etc etc…

It sounds like you want collaborative contenteditable.

Not sure what @dmonad makes of this…

There is this hidden repo:

But this is really dangerous. People could add script tags and other nasty things.

So yes, ProseMirror or (shameless plug) tiptap are probably better suited. :v:

1 Like