Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is it possible to use just Quill deltas without Quill in ShareDB? #559

Open
GermanJablo opened this issue Mar 28, 2022 · 1 comment
Open

Comments

@GermanJablo
Copy link

The documentation for the rich text type indicates that it is based on quilljs deltas.

However, the example in shareDB uses the Quill editor entirely, and I haven't found any examples online that don't.

I see that Quilljs is an editor with some quirks that I don't like:

  • looks like a somewhat abandoned project.
  • would add a lot of things to my project that I don't need or won't use
  • I prefer not to depend on a library for my editor if possible.

I would like to know if I can create my custom editor with content-editable and connect ShareDB to it using only quill deltas instead of requiring the full quill editor. If possible, would you recommend doing it? Or will I find myself with a headache trying to solve difficulties that Quilljs has already solved?

On the other hand, if it is not possible to use rich-text type without QuillJs, then I wonder what is the advantage of using rich-text type, since from what I see when connecting quilljs to a WebSocket the RTC already works fine without needing ShareDB. Maybe I'm not understanding well.

related reading
slab/quill#993

@alecgibson
Copy link
Collaborator

Yes you can absolutely use the rich-text type without needing Quill. A trivial example with a plain text input might look something like:

let content = new Delta()

textArea.addEventListener('input', () => {
  const newContent = new Delta().insert(textArea.value)
  const diff = content.diff(newContent)
  content = newContent
  doc.submitOp(diff)
})

However the difficult part is dealing with rich text formatting, which is left as an exercise for the reader.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants