ot.js
ot.js copied to clipboard
Send document identifier when emitting `doc`
Fixes issue when a client is editing multiple documents. The doc
command had no awareness of which doc it had successfully connected to.
@snikch I know this commit of yours is like really old, but I've been updating it along with updates to CM5 and adding a bunch of parts that you missed in your PR. Got it all working now, except one thing I somehow can't figure out myself. How to actually initiate multiple documents at the same time? Could you perhaps enlighten me on this?
You can check the work I've done so far yourself here: https://github.com/bjorno43/ot.js-multi-docs So far it works for text operations, but not for mouse positions and no idea yet how to implement 2 codemirror docs on the same page for example.
Update: Got it fully working. Still wish to find a way to have multiple CodeMirror instances on a single page, but at least for now it can initialize documents based on a URL parameter. As long as users use the same URL, they get the same document.
@bjorno43 oh man, this is such a long time ago I would literally have to start from scratch figuring out what I was talking about sorry. Glad you got working 👌