init
This commit is contained in:
10
src/getTextPlugin.ts
Normal file
10
src/getTextPlugin.ts
Normal 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())
|
||||
}
|
||||
},
|
||||
}))
|
||||
Reference in New Issue
Block a user