Code Monkey home page Code Monkey logo

teletype-crdt's Introduction

Atom and all repositories under Atom will be archived on December 15, 2022. Learn more in our official announcement

teletype-crdt

The string-wise sequence CRDT powering peer-to-peer collaborative editing in Teletype for Atom.

Hacking

After cloning this repository, you can install its dependencies by running:

npm install

And then run tests via:

npm test

Background

For more details on the techniques used for this data structure, we recommend reading the following papers:

TODO

  • Document APIs

teletype-crdt's People

Contributors

anderoonies avatar darangi avatar jasonrudolph avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

teletype-crdt's Issues

Documentation and Comments

Perhaps consider adding a comment or two to the codebase? Perhaps even documenting some of the functions so that we can understand how exactly your CRDT implementation works and hence, can contribute some code for performance improvements?

Can you please document this at least a tiny bit

Summary

I'm working on p2p collaborative rich text editor. I've started with https://quilljs.com/ for editor component and Automerge JSON CRDTs library that uses RGA algorithm for text.

However I find RGA to be problematic with a rich text because data model consists of marked text fragments which fairly often get split and that corresponds to deleting one part of the marked fragment and then reinserting which breaks causality (for changes of the part of the fragment that got deleted and then reinserted).

Motivation

I'm inclined to think that RGASplit (which I believe what this library is based on) might provide a solution for the outlined problem. Unfortunately lack of documentation makes it really hard to asses viability or even get started with this library.

Describe alternatives you've considered

Trying to figure out the API by reading the source code.

Incorrect absolute position returned from integrateOperations with multiple edits

I believe there is a bug in document.js on line 1363:

const segmentOldStart =
  lastChange
    ? traverse(>>>lastChange.oldEnd<<<, traversal(segmentNewStart, lastChange.newEnd))
    : segmentNewStart

If I understand the intent of the authors correctly, then it should traverse from lastChange.newEnd, not oldEnd.

Here's basic example. Lets assume there are two operations to integrate in the following order (1, then 2):

int foo() {
   /* (2) insert
       multiple lines */
   // (1) delete single line
}

You will have them reordered in collectSegments because of segment index (which I believe is based on the appearance order, rather than modification time/sequence number). Now having operations [2, 1] being processed by computeChangesForSegments, you need to adjust absolute positions of operation 1, to make sure it accounts for all the integrated changes that appear in the document before it. These calls to traverse/traversal are supposed to do it, but traverse call is adding the distance to previous segment's (modification 2) oldEnd position, which for multi-line changes will be different from newEnd: old (end=start) is line 1 (insertion on line 1), but new is line 2 (start=1, end=2). This causes subsequent delete operation to be adjusted off by 1 line. This, in turn, when applied to the actual editor will delete text on the previous line (multiple lines */) rather than the expected one (// (1) delete single line).

So if that is true, and it should be changed to newEnd, then it might as well be replaced with just the segmentNewStart, because it will always produce the same value: you measure distance from lastChange.newEnd to segmentNewStart and apply it to lastChange.newEnd.

In fact, if my understanding of what is old and new (before and after current modification?) is correct, then I can't think of a case where oldStart will be different from a newStart (both insertion or deletion).

Can teletype-crdt work with other wysiwyg editor ?

Hello! I am interested in this repo. It's great. And Can teletype-crdt work with other wysiwyg editor, like CKEditor? I want to apply teletype-crdt to wysiwyg editors, so that they can collaborative editing. Can you give me some advice? Thank u ๐Ÿ˜Š

y.js versus teletype

is this rude to ask you to compare ?

CRDT is quite complex and so it woudl be awesome if you could give your opinion.

I am planning to write a port of CRDT to Dart and golang and looking for any hints.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.