y-quill
v1.0.0
Published
QuillJs bindings for Yjs
Downloads
13,483
Readme
y-quill
Quill Editor binding for Yjs - Demo
This binding maps a Y.Text to a Quill instance. It optionally supports shared cursors via the quill-cursors module.
Example
import { QuillBinding } from 'y-quill'
import Quill from 'quill'
import QuillCursors from 'quill-cursors'
..
Quill.register('modules/cursors', QuillCursors)
const type = ydoc.getText('quill')
var editor = new Quill('#editor-container', {
modules: {
cursors: true,
toolbar: [
[{ header: [1, 2, false] }],
['bold', 'italic', 'underline'],
['image', 'code-block']
]
},
placeholder: 'Start collaborating...',
theme: 'snow' // or 'bubble'
})
// Optionally specify an Awareness instance, if supported by the Provider
const binding = new QuillBinding(type, editor, provider.awareness)
/*
// Define user name and user name
// Check the quill-cursors package on how to change the way cursors are rendered
provider.awareness.setLocalStateField('user', {
name: 'Typing Jimmy',
color: 'blue'
})
*/
Also look here for a working example.
License
The MIT License © Kevin Jahns