@@ -28,7 +28,12 @@ const ChakraMarkdown = React.memo<any>(({ content }) => {
28
28
setEditorHeight ( `${ lines * lineHeight } px` ) ;
29
29
} , [ children ] ) ;
30
30
return (
31
- < Box border = "1px solid" borderColor = { useColorModeValue ( "gray.200" , "gray.600" ) } borderRadius = "md" overflow = "visible" my = { 2 } >
31
+ < Box
32
+ border = "1px solid"
33
+ borderColor = { useColorModeValue ( "gray.200" , "gray.600" ) }
34
+ borderRadius = "0"
35
+ overflow = "visible"
36
+ my = { 2 } >
32
37
< MonacoEditor
33
38
height = { editorHeight }
34
39
language = { language }
@@ -40,17 +45,22 @@ const ChakraMarkdown = React.memo<any>(({ content }) => {
40
45
scrollBeyondLastLine : false ,
41
46
lineNumbers : "off" ,
42
47
scrollbar : { vertical : 'hidden' } ,
43
- overviewRulerLanes : 0 , // Disable the overview ruler
44
- hideCursorInOverviewRuler : true , // Hide cursor in the ruler
45
- folding : false , // Disable code folding
46
- glyphMargin : false , // Hide the glyph margin (left margin with icons)
47
- contextmenu : false , // Disable default context menu
48
+ overviewRulerLanes : 0 , // Disable the overview ruler
49
+ hideCursorInOverviewRuler : true , // Hide cursor in the ruler
50
+ folding : false , // Disable code folding
51
+ glyphMargin : false , // Hide the glyph margin (left margin with icons)
52
+ renderLineHighlight : 'none' , // Disable the current line highlight
48
53
} }
49
54
onMount = { ( editor , monaco ) => {
50
- // Disable the right-click context menu
51
- editor . onContextMenu ( ( e ) => {
52
- e . event . preventDefault ( ) ; // Prevent default context menu
53
- } ) ;
55
+ const keepIds = [ "editor.action.clipboardCopyAction" ] ;
56
+ const contextmenu = editor . getContribution ( 'editor.contrib.contextmenu' ) ;
57
+ const realMethod = contextmenu . _getMenuActions ;
58
+ contextmenu . _getMenuActions = function ( ) {
59
+ const items = realMethod . apply ( contextmenu , arguments ) ;
60
+ return items . filter ( function ( item ) {
61
+ return keepIds . includes ( item . id ) ;
62
+ } ) ;
63
+ } ;
54
64
} }
55
65
/>
56
66
</ Box >
0 commit comments