@@ -65,12 +65,16 @@ export default class CodeEditor extends React.Component {
6565 this . scrollToLineHandeler = this . scrollToLine . bind ( this )
6666
6767 this . formatTable = ( ) => this . handleFormatTable ( )
68- this . contextMenuHandler = function ( editor , event ) {
69- const menu = buildEditorContextMenu ( editor , event )
70- if ( menu != null ) {
71- setTimeout ( ( ) => menu . popup ( remote . getCurrentWindow ( ) ) , 30 )
68+
69+ if ( props . switchPreview !== 'RIGHTCLICK' ) {
70+ this . contextMenuHandler = function ( editor , event ) {
71+ const menu = buildEditorContextMenu ( editor , event )
72+ if ( menu != null ) {
73+ setTimeout ( ( ) => menu . popup ( remote . getCurrentWindow ( ) ) , 30 )
74+ }
7275 }
7376 }
77+
7478 this . editorActivityHandler = ( ) => this . handleEditorActivity ( )
7579
7680 this . turndownService = new TurndownService ( )
@@ -137,7 +141,7 @@ export default class CodeEditor extends React.Component {
137141 }
138142
139143 componentDidMount ( ) {
140- const { rulers, enableRulers } = this . props
144+ const { rulers, enableRulers, switchPreview } = this . props
141145 const expandSnippet = this . expandSnippet . bind ( this )
142146 eventEmitter . on ( 'line:jump' , this . scrollToLineHandeler )
143147
@@ -241,7 +245,9 @@ export default class CodeEditor extends React.Component {
241245 this . editor . on ( 'blur' , this . blurHandler )
242246 this . editor . on ( 'change' , this . changeHandler )
243247 this . editor . on ( 'paste' , this . pasteHandler )
244- this . editor . on ( 'contextmenu' , this . contextMenuHandler )
248+ if ( switchPreview !== 'RIGHTCLICK' ) {
249+ this . editor . on ( 'contextmenu' , this . contextMenuHandler )
250+ }
245251 eventEmitter . on ( 'top:search' , this . searchHandler )
246252
247253 eventEmitter . emit ( 'code:init' )
0 commit comments