Getting Origin of "Change" Event out of v6


I’ve building a real-time multiplayer code editor with web sockets and I could use some help.

I’ve tried using a React component for CodeMirror (@uiw/react-codemirror) and the vanilla V6 itself. I can’t figure out a way to get the origin input type (i.e., “+input”, “setValue”) — are there any ways around this?

Here are my snippets:

The React Version
import CodeMirror from "@uiw/react-codemirror";
import { ViewUpdate, EditorView } from "@codemirror/view";

const CodeMirrorEditor: FC = () => {

  const onChange = useCallback((value: string, viewUpdate: ViewUpdate) => {
  }, []);

return (
        value="console.log('hello world!');"
        extensions={[javascript({ jsx: true })]}

The Vanilla V6
import Codemirror from "codemirror";

const CodeMirrorEditor: FC = () => {

  const editor = useRef<any>();
  const { setContainer } = useCodeMirror({
    container: editor.current,
    extensions: [javascript()],
    value: 'console.log("yay")',

return (
  <textarea ref={editor} id="realtimeEditor"></textarea>

Thank you for your time.

origin doesn’t exist anymore, but Transaction.userEvent serves a similar purpose.

1 Like

Thanks for the enlightenment!