ottypes / json1

This is an operational transform type replacement for ottypes/json0
316 stars 27 forks source link

CodeMirror Integration? #38

Closed curran closed 2 years ago

curran commented 2 years ago

I'm about to embark on an integration of JSON1 with CodeMirror 6.

Has anyone else already done this? Is anyone else interested in this work?

masad-frost commented 2 years ago

Hey Curran, I'm interested! Email me faris@replit.com

masad-frost commented 2 years ago

FWIW we implemented https://github.com/ottypes/text-unicode

curran commented 2 years ago

Nice! What do you mean you implemented it? Do you mean you implemented a CodeMirror integration for text-unicode? If so, is the implementation open source? That is actually the core problem at hand here. Extending that to encompass json should be fairly simple (just wrapping in something that contains a path to the text-unicode value).

This is still something I'm looking to unlock, hopefully fairly soon. Will post here if I get it working!

masad-frost commented 2 years ago

Yeah, we use text-unicode and codemirror.next at replit. By implemented I mean we use both and we have a translation layer from codemirror updates to text-unicode ops. Lemme see what I can open source because it's really intertwined with the rest of the codebase

curran commented 2 years ago

It would be so awesome to have an open source integration we could all use!

FWIW I'm looking at using it in https://vizhub.com/ , which is kind of similar to replit. It's currently using CodeMirror 5 on JSON0 and is undergoing a rewrite from the ground up. The CM6+JSON1 integration will be core to the product and I'm really looking forward to getting it working.

curran commented 2 years ago

I made some solid progress here https://github.com/vizhub-core/codemirror-ot/pull/35

Still WIP (no interactive demo to show for it yet) but lots of solid tests are passing now with the latest CodeMirror APIs. Leveraged json0-ot-diff for validation as well. The implementation supports both JSON0 and JSON1.

curran commented 2 years ago

I managed to get the CodeMirror 6 + JSON1 integration working.

Code is in codemirror-ot (plugin) and vizhub-codemirror (plugin use with interactive demo).

There is also a live demo of this component within a larger app (click "Open Editor"). This demo may go down at some point in the future.

If anyone has suggestions for improvement, please let me know!