Files
yjs/examples/quill.mjs

29 lines
868 B
JavaScript
Raw Normal View History

2018-11-25 22:39:30 +01:00
import * as Y from '../index.mjs'
import { WebsocketProvider } from '../provider/websocket.mjs'
import { QuillBinding } from '../bindings/quill.mjs'
2018-11-25 03:17:00 +01:00
import Quill from 'quill'
2017-05-19 02:21:50 +02:00
2018-11-25 03:17:00 +01:00
const provider = new WebsocketProvider('ws://localhost:1234/')
const ydocument = provider.get('quill')
const ytext = ydocument.define('quill', Y.Text)
2017-05-19 02:21:50 +02:00
2018-11-25 03:17:00 +01:00
const quill = new Quill('#quill-container', {
2018-02-26 02:18:39 +01:00
modules: {
toolbar: [
[{ header: [1, 2, false] }],
['bold', 'italic', 'underline'],
['image', 'code-block'],
[{ color: [] }, { background: [] }], // Snow theme fills in values
2018-02-26 02:18:39 +01:00
[{ script: 'sub' }, { script: 'super' }],
['link', 'image'],
['link', 'code-block'],
[{ list: 'ordered' }, { list: 'bullet' }]
]
},
placeholder: 'Compose an epic...',
theme: 'snow' // or 'bubble'
2017-07-05 18:33:16 +02:00
})
2018-02-26 02:18:39 +01:00
2018-11-25 03:17:00 +01:00
window.quillBinding = new QuillBinding(ytext, quill)