()
| 43 | } |
| 44 | |
| 45 | function 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 | } |
nothing calls this directly
no outgoing calls
no test coverage detected
searching dependent graphs…