Skip to content

Commit 2f023c7

Browse files
committed
chore: custom server banner should show only if live preview panel open
1 parent 8f3af8b commit 2f023c7

File tree

1 file changed

+11
-1
lines changed
  • src/extensionsIntegrated/Phoenix-live-preview

1 file changed

+11
-1
lines changed

src/extensionsIntegrated/Phoenix-live-preview/main.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,7 @@ define(function (require, exports, module) {
250250
$icon.toggleClass("active");
251251
panel.show();
252252
_loadPreview(true);
253+
_showCustomServerBannerIfNeeded();
253254
} else {
254255
$icon.toggleClass("active");
255256
_blankIframe();
@@ -688,9 +689,18 @@ define(function (require, exports, module) {
688689
}
689690
}
690691

692+
function _showCustomServerBannerIfNeeded() {
693+
const editor = EditorManager.getActiveEditor();
694+
if(!editor || !_shouldShowCustomServerBar(editor.document.file.fullPath)){
695+
return;
696+
}
697+
_showCustomServerBar();
698+
}
699+
691700
function _shouldShowCustomServerBar(fullPath) {
692701
const isBannerAck = StateManager.get(STATE_CUSTOM_SERVER_BANNER_ACK, StateManager.PROJECT_CONTEXT);
693-
if(isBannerAck || LivePreviewSettings.isUsingCustomServer()){
702+
let panelVisible = panel && panel.isVisible();
703+
if(isBannerAck || LivePreviewSettings.isUsingCustomServer() || !panelVisible){
694704
return false;
695705
}
696706
return utils.isServerRenderedFile(fullPath);

0 commit comments

Comments
 (0)