cmReactiveViewof = {
const blocker = cmImports.view.ViewPlugin.fromClass(class {
constructor(view) {
this.elContent = null
return true
}
update({view}) {
if (this.elContent) return;
const el = view.dom.querySelector('.cm-content')
if (el) {
this.elContent = el
this.elContent.addEventListener('input', this.handler)
}
}
destroy() {
if (!this.elContent) return;
this.elContent.removeEventListener('input', this.handler)
this.elContent = null
}
handler(evt) {
evt.stopImmediatePropagation()
}
})
const handler = EditorView.updateListener.of(update => {
const { dom } = update.view
if (!update.docChanged) return
dom.value = update.state.doc.toString()
dom.dispatchEvent(new CustomEvent('input'))
})
return [blocker, handler]
}