@lvce-editor/main-process 6.45.0 → 6.46.1

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.
@@ -7313,6 +7313,9 @@ const createWebContentsViewForWindow = (browserWindow, options = {}) => {
7313
7313
  }),
7314
7314
  webPreferences: {
7315
7315
  ...options.webPreferences,
7316
+ // Tab selection controls focus. A hidden background tab must not steal it
7317
+ // when Electron commits its navigation while the view remains attached.
7318
+ focusOnNavigation: false,
7316
7319
  session: getSession()
7317
7320
  }
7318
7321
  });
@@ -7330,11 +7333,13 @@ const createWebContentsViewForWindow = (browserWindow, options = {}) => {
7330
7333
  attachEventListenersToWebContents(webContents.id, webContents, browserWindow);
7331
7334
  return view;
7332
7335
  };
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];
7336
+ const createWebContentsView = async (_restoreId = 0, windowId = 0) => {
7337
+ number(windowId);
7338
+ // Legacy callers omit the owner. A supplied owner must never be replaced by whichever window currently has focus.
7339
+ const browserWindow = windowId ? BrowserWindow.fromId(windowId) : BrowserWindow.getFocusedWindow() || BrowserWindow.getAllWindows()[0];
7340
+ if (!browserWindow || browserWindow.isDestroyed()) {
7341
+ throw new Error('Cannot create a browser tab because its window is closed');
7342
+ }
7338
7343
  const view = createWebContentsViewForWindow(browserWindow);
7339
7344
  return view.webContents.id;
7340
7345
  };
@@ -7621,7 +7626,6 @@ const cancelNavigation = view => {
7621
7626
  }
7622
7627
  };
7623
7628
  const show = id => {
7624
- // console.log('[main-process] show browser view', id)
7625
7629
  const state = get$4(id);
7626
7630
  if (!state) {
7627
7631
  return;
@@ -7630,7 +7634,10 @@ const show = id => {
7630
7634
  browserWindow,
7631
7635
  view
7632
7636
  } = state;
7633
- browserWindow.contentView.addChildView(view);
7637
+ if (!browserWindow.contentView.children.includes(view)) {
7638
+ browserWindow.contentView.addChildView(view);
7639
+ }
7640
+ view.setVisible(true);
7634
7641
  };
7635
7642
  const addToWindow = (browserWindowId, browserViewId) => {
7636
7643
  const state = get$4(browserViewId);
@@ -7649,10 +7656,11 @@ const hide = id => {
7649
7656
  return;
7650
7657
  }
7651
7658
  const {
7652
- browserWindow,
7653
7659
  view
7654
7660
  } = state;
7655
- browserWindow.contentView.removeChildView(view);
7661
+ // Detaching and reattaching can leave Electron's native page hidden even when
7662
+ // the View is visible. Keep its parent and compositor surface across overlays.
7663
+ view.setVisible(false);
7656
7664
  };
7657
7665
 
7658
7666
  /**
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.1",
4
4
  "keywords": [
5
5
  "lvce-editor",
6
6
  "electron"