How to use the y-codemirror.CodeMirrorBinding function in y-codemirror

To help you get started, we’ve selected a few y-codemirror examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github yjs / yjs / examples / codemirror.js View on Github external
import * as conf from './exampleConfig.js'

import CodeMirror from 'codemirror'
import 'codemirror/mode/javascript/javascript.js'

const provider = new WebsocketProvider(conf.serverAddress)
const ydocument = provider.get('codemirror')
const ytext = ydocument.getText('codemirror')

const editor = new CodeMirror(document.querySelector('#container'), {
  mode: 'javascript',
  lineNumbers: true
})

const binding = new CodeMirrorBinding(ytext, editor)

window.codemirrorExample = {
  binding, editor, ytext, ydocument
}

y-codemirror

CodeMirror binding for Yjs

MIT
Latest version published 3 years ago

Package Health Score

48 / 100
Full package analysis

Popular y-codemirror functions