File tree Expand file tree Collapse file tree 1 file changed +14
-9
lines changed Expand file tree Collapse file tree 1 file changed +14
-9
lines changed Original file line number Diff line number Diff line change 1- import { type Dispatch , useEffect , useState } from 'react'
1+ import { type Dispatch , useCallback , useEffect , useState } from 'react'
22import { Button , Div , Flex , P } from 'honorable'
33import { useTheme } from 'styled-components'
44
@@ -58,14 +58,19 @@ export default function CodeEditor({
5858 const [ copied , setCopied ] = useState < boolean > ( false )
5959 const changed = current !== value
6060
61- const onEditorMount = ( editor : any ) => {
62- editor . addAction ( {
63- id : 'remeasure-fonts' ,
64- label : 'Remeasure Fonts' ,
65- keybindings : [ monaco . KeyMod . CtrlCmd | monaco . KeyCode . KeyB ] ,
66- run : ( ) => monaco ?. editor ?. remeasureFonts ( ) ,
67- } )
68- }
61+ const onEditorMount = useCallback (
62+ ( editor : any ) => {
63+ if ( ! monaco ) return
64+
65+ editor . addAction ( {
66+ id : 'remeasure-fonts' ,
67+ label : 'Remeasure Fonts' ,
68+ keybindings : [ monaco ?. KeyMod ?. CtrlCmd | monaco ?. KeyCode ?. KeyB ] ,
69+ run : ( ) => monaco ?. editor ?. remeasureFonts ( ) ,
70+ } )
71+ } ,
72+ [ monaco ]
73+ )
6974
7075 useEffect ( ( ) => {
7176 if ( copied ) {
You can’t perform that action at this time.
0 commit comments