yorkie-js-sdk icon indicating copy to clipboard operation
yorkie-js-sdk copied to clipboard

Add ProseMirror example

Open hackerwins opened this issue 2 years ago • 8 comments

Description:

Add ProseMirror example.

Currently, we are providing Quill example for the RichText datatype. And Yjs also provides Prosemirror binding examples.

Why:

  • Make it easy for users of ProseMirror to use Yorkie.
  • We can easily replace CodePair's Markdown editor with the TUI Editor. https://github.com/yorkie-team/yorkie-codepair/issues/152

hackerwins avatar Oct 26 '21 02:10 hackerwins

I'll try on it!

blurfx avatar Dec 25 '21 10:12 blurfx

ProseMirror's document is designed based on the tree structure, and it is necessary to record the position of the cursor in the tree as a simple number, so Resolved Positions was introduced.

ResolvedPositions seems to be a value calculated by adding depth from the root.

https://github.com/ProseMirror/prosemirror-model/blob/eef20c8c6dbf841b1d70859df5d59c21b5108a4f/src/resolvedpos.js#L229-L244

When the following text is entered into the editor, the left and right sides of each text will have the following scalar number.

// 3 paragraphs of 6 chars
AB
CD
EF
Screen Shot 2022-02-01 at 1 13 59 AM

Since ProseMirror's document is a tree structure and RichText is designed based on a list, a simple conversion might cause some kind of impedance mismatch.

hackerwins avatar Jan 31 '22 16:01 hackerwins

I think we should think about our document model. Do we need to change it? If so, how should we change it? Can we support both text and tree structures?

blurfx avatar Feb 04 '22 07:02 blurfx

@blurfx I haven't thought about it yet. Perhaps it would be better to research the Y.js approach.

hackerwins avatar Feb 05 '22 01:02 hackerwins