Giter VIP home page Giter VIP logo

Comments (7)

BitPhinix avatar BitPhinix commented on June 25, 2024

Fixed in slate-yjs 0.1.3

from slate-yjs.

ovionlogis avatar ovionlogis commented on June 25, 2024

@BitPhinix I tested the demo again, the error repeats exactly the same

from slate-yjs.

BitPhinix avatar BitPhinix commented on June 25, 2024

Hmm weird, I'll recheck this again asap.

from slate-yjs.

Yshmeel avatar Yshmeel commented on June 25, 2024

This bug also occurs when you change selected mark at some part of text and refresh page.
And one more bug, i can't select more than 1 mark marks on one line, weird thing...

from slate-yjs.

BitPhinix avatar BitPhinix commented on June 25, 2024

I took a look at this today and the root cause is the way the split_node operation is translated.

Let's say we have 2 clients with the same state (a paragraph with the text hello world):
{type: "paragraph", children: [{ text: "hello world"}]}

Client 1 performs a split_node operation inside the paragraph with offset 5 this results in the following operations:

  • remove text " world" from [0, 0]
  • insert new text node containing " world" at [0, 1]

Client 2 simultaneously performs a split_node operation inside the paragraph with offset 6 this results in the following operations:

  • remove text "world" from [0, 0]
  • insert new text node containing "world" at [0, 1]

If the clients are now synced the remove text operations will be combined and both insert node operations will be applied resulting in both the "word" and " word" text nodes to be inserted. YJs can't know that the new nodes are a result of a split_node operations.

slate-collaborative has the exact same issue cudr/slate-collaborative#29. I'll try to find a solution as soon as I find the time to or just port over the solution of slate-collaborative if they manage to solve it.

from slate-yjs.

BitPhinix avatar BitPhinix commented on June 25, 2024

Closing this issue because this is the intended behavior. For more details refer to: https://discuss.yjs.dev/t/modeling-slate-split-node-behavior-in-yjs/283/2

from slate-yjs.

big-camel avatar big-camel commented on June 25, 2024

This problem will cause PathRef to fail

from slate-yjs.

Related Issues (20)

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.