How can I have offline synchronization?

How can I have offline synchronization?

You can use something like that https://github.com/yjs/y-prosemirror

Otherwise it might get tricky to implement the merging logic after getting online on your own.