This commit is contained in:
2023-11-15 23:14:17 +03:00
commit 6f147ca8b7
16 changed files with 3465 additions and 0 deletions

10
src/getTextPlugin.ts Normal file
View File

@@ -0,0 +1,10 @@
import { ViewPlugin, ViewUpdate } from '@codemirror/view'
export const getTextPlugin = (callback: (text: string) => void) =>
ViewPlugin.define(() => ({
update(update: ViewUpdate) {
if (update.docChanged) {
callback(update.state.doc.toString())
}
},
}))