@lvce-editor/main-process 6.45.0 → 6.46.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -7330,11 +7330,13 @@ const createWebContentsViewForWindow = (browserWindow, options = {}) => {
7330
7330
  attachEventListenersToWebContents(webContents.id, webContents, browserWindow);
7331
7331
  return view;
7332
7332
  };
7333
-
7334
- // TODO use electron 30 webcontentsview api
7335
- const createWebContentsView = async () => {
7336
- // TODO get browser window id from renderer worker
7337
- const browserWindow = BrowserWindow.getFocusedWindow() || BrowserWindow.getAllWindows()[0];
7333
+ const createWebContentsView = async (_restoreId = 0, windowId = 0) => {
7334
+ number(windowId);
7335
+ // Legacy callers omit the owner. A supplied owner must never be replaced by whichever window currently has focus.
7336
+ const browserWindow = windowId ? BrowserWindow.fromId(windowId) : BrowserWindow.getFocusedWindow() || BrowserWindow.getAllWindows()[0];
7337
+ if (!browserWindow || browserWindow.isDestroyed()) {
7338
+ throw new Error('Cannot create a browser tab because its window is closed');
7339
+ }
7338
7340
  const view = createWebContentsViewForWindow(browserWindow);
7339
7341
  return view.webContents.id;
7340
7342
  };
@@ -7621,7 +7623,6 @@ const cancelNavigation = view => {
7621
7623
  }
7622
7624
  };
7623
7625
  const show = id => {
7624
- // console.log('[main-process] show browser view', id)
7625
7626
  const state = get$4(id);
7626
7627
  if (!state) {
7627
7628
  return;
@@ -7630,7 +7631,10 @@ const show = id => {
7630
7631
  browserWindow,
7631
7632
  view
7632
7633
  } = state;
7633
- browserWindow.contentView.addChildView(view);
7634
+ if (!browserWindow.contentView.children.includes(view)) {
7635
+ browserWindow.contentView.addChildView(view);
7636
+ }
7637
+ view.setVisible(true);
7634
7638
  };
7635
7639
  const addToWindow = (browserWindowId, browserViewId) => {
7636
7640
  const state = get$4(browserViewId);
@@ -7649,10 +7653,11 @@ const hide = id => {
7649
7653
  return;
7650
7654
  }
7651
7655
  const {
7652
- browserWindow,
7653
7656
  view
7654
7657
  } = state;
7655
- browserWindow.contentView.removeChildView(view);
7658
+ // Detaching and reattaching can leave Electron's native page hidden even when
7659
+ // the View is visible. Keep its parent and compositor surface across overlays.
7660
+ view.setVisible(false);
7656
7661
  };
7657
7662
 
7658
7663
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/main-process",
3
- "version": "6.45.0",
3
+ "version": "6.46.0",
4
4
  "keywords": [
5
5
  "lvce-editor",
6
6
  "electron"