MCPcopy Create free account
hub / github.com/uiwjs/react-codemirror / Example

Function Example

www/src/pages/examples/Example681.tsx:45–80  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

43}
44
45function Example() {
46 const [value, setValue] = useState(doc);
47 const [valueModified, setValueModified] = useState(doc);
48 const $ref = useRef<CodeMirrorMergeRef>(null);
49 const handle1 = () => {
50 $ref.current?.view?.a.dispatch({
51 effects: StateEffect.appendConfig.of([log2UpdatePlugin]),
52 });
53 };
54 return (
55 <div style={{ width: '100%' }}>
56 <div>
57 <button onClick={handle1}>Add extension 2</button>
58 </div>
59 <CodeMirrorMerge ref={$ref} destroyRerender={false}>
60 <Original
61 value={value}
62 extensions={[log1UpdatePlugin]}
63 onChange={(val) => {
64 setValue(val);
65 }}
66 />
67 <Modified
68 value={valueModified}
69 onChange={(val) => {
70 setValueModified(val);
71 }}
72 />
73 </CodeMirrorMerge>
74 <div style={{ display: 'flex', marginTop: 10 }}>
75 <pre style={{ flex: 1 }}>{value} </pre>
76 <pre style={{ backgroundColor: '#fff', flex: 1 }}>{valueModified} </pre>
77 </div>
78 </div>
79 );
80}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…