Rich Text type for Yjs
The fabulous feature of y-richtext is that you can bind it to a Quill instance (> v1.0.0) in order to enable collaborative richtext editing.
Retrieve y-richtext and Quill Editor with bower.
bower install y-richtext quill --save
npm install y-richtext y-array quill --save
This type depends on y-array. So you have to extend Yjs in the right order:
var Y = require('yjs')
require('y-array')(Y)
require('y-richtext')(Y)
Y({
db: {
name: 'memory'
},
connector: {
name: 'websockets-client',
room: 'richtext-example'
},
share: {
richtext: 'Richtext' // y.share.richtext is of type Y.Richtext
}
}).then(function (y) {
window.yquill = y
// create quill element
window.quill = new Quill('#editor', {
modules: {
'toolbar': { container: '#toolbar' },
'link-tooltip': true
},
theme: 'snow'
})
// bind quill to richtext type
y.share.richtext.bindQuill(window.quill)
})
.bind(editor)
does not preserve the existing value of the bound editorWe thank Linagora who sponsored this work, and agreed to publish it as Open Source.
Yjs and the RichText type are licensed under the MIT License.