@@ -126,11 +126,11 @@ export class CommandBox {
126126
127127 _registerCommandBoxEventListeners ( ) {
128128 document . getElementById ( "popup-run-command" ) .
129- addEventListener ( "click" , ( pClickEvent ) => CommandBox . _hideManualRun ( pClickEvent ) ) ;
129+ addEventListener ( "click" , ( pClickEvent ) => CommandBox . hideManualRun ( pClickEvent ) ) ;
130130 document . getElementById ( "button-manual-run" ) .
131131 addEventListener ( "click" , ( pClickEvent ) => CommandBox . showManualRun ( pClickEvent , this . api ) ) ;
132132 document . getElementById ( "cmd-close-button" ) .
133- addEventListener ( "click" , ( pClickEvent ) => CommandBox . _hideManualRun ( pClickEvent ) ) ;
133+ addEventListener ( "click" , ( pClickEvent ) => CommandBox . hideManualRun ( pClickEvent ) ) ;
134134
135135 document . querySelector ( ".run-command input[type='submit']" ) .
136136 addEventListener ( "click" , ( ) => {
@@ -315,14 +315,14 @@ export class CommandBox {
315315 TargetType . autoSelectTargetType ( targetField . value ) ;
316316 targetField . onkeyup = ( keyUpEvent ) => {
317317 if ( keyUpEvent . key === "Escape" ) {
318- CommandBox . _hideManualRun ( keyUpEvent ) ;
318+ CommandBox . hideManualRun ( keyUpEvent ) ;
319319 }
320320 } ;
321321
322322 const commandField = document . getElementById ( "command" ) ;
323323 commandField . onkeyup = ( keyUpEvent ) => {
324324 if ( keyUpEvent . key === "Escape" ) {
325- CommandBox . _hideManualRun ( keyUpEvent ) ;
325+ CommandBox . hideManualRun ( keyUpEvent ) ;
326326 }
327327 } ;
328328
@@ -369,9 +369,9 @@ export class CommandBox {
369369 // pEvent is:
370370 // a MouseEvent(type="click") or
371371 // a KeyEvent(type="keyup")
372- static _hideManualRun ( pEvent ) {
372+ static hideManualRun ( pEvent ) {
373373 // Don't close if they click inside the window
374- if ( pEvent . type === "click" && ! pEvent . target . classList . contains ( "popup" ) && ! pEvent . target . classList . contains ( "nearly-visible-button" ) ) {
374+ if ( pEvent && pEvent . type === "click" && ! pEvent . target . classList . contains ( "popup" ) && ! pEvent . target . classList . contains ( "nearly-visible-button" ) ) {
375375 return ;
376376 }
377377
@@ -382,9 +382,13 @@ export class CommandBox {
382382 RunType . setRunTypeDefault ( ) ;
383383 TargetType . setTargetTypeDefault ( ) ;
384384
385- Router . currentPage . refreshPage ( ) ;
385+ if ( Router . currentPage ) {
386+ Router . currentPage . refreshPage ( ) ;
387+ }
386388
387- pEvent . stopPropagation ( ) ;
389+ if ( pEvent ) {
390+ pEvent . stopPropagation ( ) ;
391+ }
388392 }
389393
390394 static _showError ( pMessage ) {
0 commit comments