File tree 2 files changed +35
-0
lines changed
2 files changed +35
-0
lines changed Original file line number Diff line number Diff line change
1
+ import CodeMirror , { ReactCodeMirrorRef } from '@uiw/react-codemirror' ;
2
+ import { langs } from '@uiw/codemirror-extensions-langs' ;
3
+ import { useEffect , useRef } from 'react' ;
4
+
5
+ export function Component ( ) {
6
+ const $edit = useRef < ReactCodeMirrorRef > ( null ) ;
7
+ useEffect ( ( ) => {
8
+ console . log ( '$edit:' , $edit ) ;
9
+ setTimeout ( ( ) => {
10
+ console . log ( '$edit:view:' , $edit . current ?. view ) ;
11
+ console . log ( '$edit:state:' , $edit . current ?. state ) ;
12
+ } , 300 ) ;
13
+ console . log ( '$edit:' , $edit . current ?. view ) ;
14
+ } , [ $edit ] ) ;
15
+ return (
16
+ < div >
17
+ < CodeMirror
18
+ value = { `console.log('hello')` }
19
+ theme = "none"
20
+ ref = { $edit }
21
+ height = "400px"
22
+ width = "100%"
23
+ style = { { margin : '0 0 23px 0' , flex : 1 } }
24
+ extensions = { [ langs . markdown ( ) ] }
25
+ />
26
+ </ div >
27
+ ) ;
28
+ }
29
+
30
+ Component . displayName = 'HomePage' ;
Original file line number Diff line number Diff line change @@ -525,6 +525,11 @@ export const routes: MenuRouteObject[] = [
525
525
label : 'How to remove all syntax highlighting?' ,
526
526
Component : PageExample431 ,
527
527
} ,
528
+ {
529
+ path : 'refs' ,
530
+ label : 'Refs Example' ,
531
+ lazy : ( ) => import ( './pages/examples/ExampleRef' ) ,
532
+ } ,
528
533
] ,
529
534
} ,
530
535
] ,
You can’t perform that action at this time.
0 commit comments