Y-websocket sync file

Now I’m trying to make a latex editor like overleaf.Because I need compile tex files,so I need storge text to files then compile these files use latex compiler.Now I’m not discover a method which bind the file and editor.Is there a method to do this,or is there a better program.Thanks,I love YJS

Hi @NGUAlexZhang,

this is a pretty generic question. You can, of course, store the Yjs document. However, latex doesn’t understand the Yjs format. So I recommend storing your files in pure text instead. This could happen, for example, after a debounce on every change. You can find another place to store the Yjs document. A fun idea might be to store the Yjs document in a comment in the latex file. Then you could retain the Yjs editing history and also allow other applications to read the content.

1 Like

emmm,I am wondering how to store my text in a file.Now I just know three methods to storage text(indexdb,leveldb and redis like docs website,but they are all binary type).Now the biggest problem is how to save yjs in the remote server file.My English is very poor,I hope my expression is not biased.Thanks for your answer!

The binary objects that you observed in y-indexeddb and y-levelddb are how Yjs encodes its document state. The format is documented here: Document Updates - Yjs Docs

If you want to save the Yjs document, use the “update format”. If you want to compile latex then you should extract the content first and store it in some kind of file. You are probably using a Y.Text type. Here is the documentation: Y.Text - Yjs Docs (it’s as simple as ytext.toString())

Thanks for your answer.I’ll try it soon