File tree Expand file tree Collapse file tree
src/extensions/default/Git/src Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -411,7 +411,30 @@ define(function (require, exports) {
411411 let scheduledRefresh = null ;
412412 const REFRESH_DEDUPE_TIME = 3000 ;
413413
414+ // this variable tracks if user clicked on the live preview iframe
415+ // this is done cause when live preview iframe is clicked in highlight/edit mode,
416+ // we set cursor back to the editor because of which editor regains focus and refreshes git
417+ let focusWentToLivePreview = false ;
418+
419+ // when editor window loses focus we check if focus went to live preview,
420+ // if it did, then we just set the flag to true
421+ $ ( window ) . on ( "blur" , function ( ) {
422+ // delay to let activeElement update
423+ setTimeout ( function ( ) {
424+ const activeEl = document . activeElement ;
425+ if ( activeEl && activeEl . id === "panel-live-preview-frame" ) {
426+ focusWentToLivePreview = true ;
427+ }
428+ } , 0 ) ;
429+ } ) ;
430+
414431 function refreshOnFocusChange ( ) {
432+ // ignore git refresh if focus went to live preview
433+ if ( focusWentToLivePreview ) {
434+ focusWentToLivePreview = false ;
435+ return ;
436+ }
437+
415438 // to sync external git changes after switching to app.
416439 if ( gitEnabled ) {
417440 const isGitPanelVisible = Panel . getPanel ( ) . is ( ":visible" ) ;
You can’t perform that action at this time.
0 commit comments