I noticed that using the README.md example code:
import { ProseMirror } from "@nytimes/react-prosemirror" ;
import { useState } from "react" ;
import { EditorState } from "prosemirror-state" ;
import { schema } from "prosemirror-schema-basic" ;
export function ProseMirrorEditor ( ) {
const [ mount , setMount ] = useState < HTMLElement | null > ( null ) ;
const [ editorState , setEditorState ] = useState (
EditorState . create ( { schema} )
) ;
return (
< ProseMirror
mount = { mount }
state = { editorState }
dispatchTransaction = { ( tr ) => {
setEditorState ( ( s ) => s . apply ( tr ) ) ;
} }
>
< div ref = { setMount} / >
< / ProseMirror >
) ;
}
the CJK input in browser is stuttering.
Screencast.from.2023-06-26.02-37-59.webm
However, if I remove dispatchTransaction prop, i.e.
import { ProseMirror } from "@nytimes/react-prosemirror" ;
import { useState } from "react" ;
import { EditorState } from "prosemirror-state" ;
import { schema } from "prosemirror-schema-basic" ;
export function ProseMirrorEditor ( ) {
const [ mount , setMount ] = useState < HTMLElement | null > ( null ) ;
const [ editorState , setEditorState ] = useState (
EditorState . create ( { schema} )
) ;
return (
< ProseMirror
mount = { mount }
state = { editorState }
>
< div ref = { setMount} / >
< / ProseMirror >
) ;
}
it behaves normally:
Screencast.from.2023-06-26.02-38-52.webm
Any idea what is the source of problem?
I noticed that using the
README.mdexample code:the CJK input in browser is stuttering.
Screencast.from.2023-06-26.02-37-59.webm
However, if I remove
dispatchTransactionprop, i.e.it behaves normally:
Screencast.from.2023-06-26.02-38-52.webm
Any idea what is the source of problem?