Skip to content

Commit 29ca363

Browse files
committed
fix(live-preview): keep LP panel open after popout while in design mode
In design mode the LP panel fills the editor area, so hiding it on popout left the user with an empty workspace. Skip _setPanelVisibility(false) when in design mode and capture the decision before the async openUrlInBrowser so both code paths agree even if design mode flips mid-call. Outside design mode, the original close-panel behavior is unchanged.
1 parent 7df8cb5 commit 29ca363

1 file changed

Lines changed: 10 additions & 2 deletions

File tree

  • src/extensionsIntegrated/Phoenix-live-preview

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

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -675,12 +675,18 @@ define(function (require, exports, module) {
675675
function _popoutLivePreview(browserName) {
676676
// We cannot use $iframe.src here if panel is hidden
677677
const openURL = StaticServer.getTabPopoutURL(currentLivePreviewURL);
678+
// In design mode the LP panel fills the editor area — hiding it would
679+
// leave the user staring at a blank workspace. Keep the panel open and
680+
// just open the popout alongside it.
681+
const closePanelAfterPopout = !WorkspaceManager.isInDesignMode();
678682
if(browserName && ALLOWED_BROWSERS_NAMES.includes(browserName)){
679683
Metrics.countEvent(Metrics.EVENT_TYPE.LIVE_PREVIEW, "popout", browserName);
680684
NodeUtils.openUrlInBrowser(openURL, browserName)
681685
.then(()=>{
682686
_loadPreview(true);
683-
_setPanelVisibility(false);
687+
if (closePanelAfterPopout) {
688+
_setPanelVisibility(false);
689+
}
684690
})
685691
.catch(err=>{
686692
console.error("Error opening url in browser: ", browserName, err);
@@ -695,7 +701,9 @@ define(function (require, exports, module) {
695701
NativeApp.openURLInDefaultBrowser(openURL, "livePreview");
696702
Metrics.countEvent(Metrics.EVENT_TYPE.LIVE_PREVIEW, "popoutBtn", "click");
697703
_loadPreview(true);
698-
_setPanelVisibility(false);
704+
if (closePanelAfterPopout) {
705+
_setPanelVisibility(false);
706+
}
699707
}
700708
}
701709

0 commit comments

Comments
 (0)