Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • 09:22

    dmonad on improve-readme

    (compare)

  • 09:22

    dmonad on master

    update quill cursors support Merge pull request #169 from yj… (compare)

  • 09:22
    dmonad closed #169
  • 09:22
    nikgraf review_requested #169
  • 09:22
    nikgraf opened #169
  • 09:22

    nikgraf on improve-readme

    update quill cursors support (compare)

  • 09:11

    dmonad on v13.0.0-99

    (compare)

  • 09:11

    dmonad on master

    13.0.0-99 (compare)

  • 09:10

    nikgraf on fix-absolute-position-calculation

    (compare)

  • 09:09

    dmonad on master

    fix absolute position calculati… Merge pull request #168 from yj… (compare)

  • 09:09
    dmonad closed #168
  • 09:09
    dmonad commented #168
  • 09:08
    nikgraf review_requested #168
  • 09:08
    nikgraf opened #168
  • 09:08

    nikgraf on fix-absolute-position-calculation

    fix absolute position calculati… (compare)

  • Sep 20 06:42
    calibr commented #167
  • Sep 20 00:11
    chlec opened #167
  • Sep 17 16:55

    dmonad on v13.0.0-98

    (compare)

  • Sep 17 16:55

    dmonad on master

    13.0.0-98 (compare)

  • Sep 17 16:54

    dmonad on master

    implement PermanentUserData sto… (compare)

Corentin Cadiou
@cphyc
But the tradeoff is that if we want to extend a selection of a styleDef, we have to check that it's not shared by 2 styleDef
Kevin Jahns
@dmonad
I used as in regular expressions: E.g. ab means zero or more a's, and then exactly one b. Does this clarify?
Corentin Cadiou
@cphyc
Ok, that's what I figured out!
Not the same notation as my class about formal definition of langages! I got lost
Kevin Jahns
@dmonad
^^ oh. I never had the chance to learn BNF properly...
Ah I finally got what you mean. You are saying that if a user want to have a italic+bold selection. We could just do it like this
styleDef = {
  from = position_pointer,
  to = position_pointer,
  type: ["bold" | "Italic" | ..]
}
Corentin Cadiou
@cphyc
Yes, or we keep on styleDef per style but share a pointer to the position_pointer object instead of a direct reference to it
The advantage being that if we want to update the position_pointers, we can keep somewhere a list of all the position_pointers and just update them by reading the list. We don't need to go through styleDef to find them
Kevin Jahns
@dmonad
Good one, I like the idea
Corentin Cadiou
@cphyc
And we can sort them so access is quick
by ordering by startPosition then endPosition
Kevin Jahns
@dmonad
Another idea would be to store a reference from the word / br to the position pointer (this information is not transmitted to the other users. When an area is selected and styled then we have to
  1. check the words in the selection if any word / br already stores a position pointer
  2. If it points to a similar style selection, then we extend it. Possibly we have to merge two style selections. E.g. abcdef and someone makes cd bold
  3. otherwise a new style selection is created
Corentin Cadiou
@cphyc
yes
Corentin Cadiou
@cphyc
I'm talking to Fabian this afternoon about collaborative edition
Corentin Cadiou
@cphyc
And also, you can simplify point 1 and 2 as follow:
  1. read the words just out the boundaries and see if they have a position pointer with a similar style selection.
  2. if so, merge the area selected with the left hand-side and/or right hand-side
  3. update all the position pointers of the words in selection + words at boundaries
and we store words as follow:
word = {
  content: String,
  styles: [ style ]
}
style = {
  type: bold|italic|…,
  selection: selection
}
selection = {
  fromWord: Number,
  fromPos: Number,
  toWord: Number,
  toPos: Number
}
so we link words to styles and styles to selections
Kevin Jahns
@dmonad
I talked with him too.

Don't you mean to specify references to the words?

selection = {
  fromWord: word,
  fromPos: Number,
  toWord: word,
  toPos: Number
}

Furthermore, I don't think its the best idea to store a reference to the style from the word (just because its not necessary). It suffices that the most left, and the most right word stores a reference to the style or reference.

Corentin Cadiou
@cphyc
This message was deleted
This message was deleted
Kevin Jahns
@dmonad
word = {
  content: String,
  // optional
  ref_left = [selection] // this is the beginning of a selection 
  // optional
  ref_right = [selection] // end of selection
}
selection = {
  fromWord: Number,
  fromPos: Number,
  toWord: Number,
  toPos: Number
  type : bold | italic | ..
}
Corentin Cadiou
@cphyc
This means that each part of a word can only belong to one selection at a time
Kevin Jahns
@dmonad
no, I changed it accordingly
Corentin Cadiou
@cphyc
How would you store Hello with that?
because you can have a left selection and a right selection, but here you need three
Kevin Jahns
@dmonad
While being an unusual case, like this
word1 = {
  content : "Hello",
  ref_left = [sel1],
  ref_right = [sel1]
}
sel1 = {
  fromWord : word1
  fromPos: 2
  toWord: word1
  toPos: 4
  type: bold
}
again:
for He*ll*o
While being an unusual case, like this
word1 = {
  content : "Hello",
  ref_left = [sel1, sel2],
  ref_right = [sel1, sel2]
}
sel1 = {
  fromWord : word1
  fromPos: 2
  toWord: word1
  toPos: 4
  type: italic
}
sel2 = {
  fromWord : word1
  fromPos: 0
  toWord: word1
  toPos: 6
  type: bold
}
Corentin Cadiou
@cphyc
I didn't see the [ ] around the refs, but now I agree
Kevin Jahns
@dmonad
ok
Corentin Cadiou
@cphyc
even though usually we wouldn't have that kind of things
Kevin Jahns
@dmonad
thats true. This is more efficient for large selections
Corentin Cadiou
@cphyc
(except for people who like to have really messy strings)
Kevin Jahns
@dmonad
xD
screw them :)
Corentin Cadiou
@cphyc
For sure, let's screw them algorithmically speaking
Corentin Cadiou
@cphyc
Hi
I'm writing the type we were discussing using coffee script
This message was deleted
Kevin Jahns
@dmonad
Hey,
you don't have to do it in coffee. I think js is fine too
Corentin Cadiou
@cphyc
It's easier to write classes in coffee
Corentin Cadiou
@cphyc
and I don't particularly like js, moreover, it's easier to work with yjs in coffee
Kevin Jahns
@dmonad
True that :)
Corentin Cadiou
@cphyc
Do you have any news about your blog article?
On my side, I implemented a Rte class that supports insertion/deletion/merge operations
I'm working on using the deltas propagated by quill.js
Corentin Cadiou
@cphyc
This message was deleted