From 4c26d4b10a04a17a82fe09abf15e3884ac7085ca Mon Sep 17 00:00:00 2001 From: xevidos Date: Sat, 19 Jan 2019 19:13:17 -0500 Subject: [PATCH] Fixed error coming up when editor context menu was triggered while no files were open. --- components/editor/init.js | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/components/editor/init.js b/components/editor/init.js index b7cba5c..8dd3305 100755 --- a/components/editor/init.js +++ b/components/editor/init.js @@ -293,10 +293,15 @@ // Context Menu e.preventDefault(); - let path = codiad.active.getPath(); - $(e.target).attr('data-path', path); - codiad.filemanager.contextMenuShow( e, path, 'editor', 'editor'); - $(this).addClass('context-menu-active'); + _this = codiad.editor + + if( _this.getActive() ) { + + let path = codiad.active.getPath(); + $(e.target).attr('data-path', path); + codiad.filemanager.contextMenuShow( e, path, 'editor', 'editor'); + $(this).addClass('context-menu-active'); + } }); $(window).resize(function(){