Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions src/extensions/default/Git/src/Main.js
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,30 @@ define(function (require, exports) {
let scheduledRefresh = null;
const REFRESH_DEDUPE_TIME = 3000;

// this variable tracks if user clicked on the live preview iframe
// this is done cause when live preview iframe is clicked in highlight/edit mode,
// we set cursor back to the editor because of which editor regains focus and refreshes git
let focusWentToLivePreview = false;

// when editor window loses focus we check if focus went to live preview,
// if it did, then we just set the flag to true
$(window).on("blur", function () {
// delay to let activeElement update
setTimeout(function () {
const activeEl = document.activeElement;
if (activeEl && activeEl.id === "panel-live-preview-frame") {
focusWentToLivePreview = true;
}
}, 0);
});

function refreshOnFocusChange() {
// ignore git refresh if focus went to live preview
if (focusWentToLivePreview) {
focusWentToLivePreview = false;
return;
}

// to sync external git changes after switching to app.
if (gitEnabled) {
const isGitPanelVisible = Panel.getPanel().is(":visible");
Expand Down
Loading