@lvce-editor/main-process 6.22.0 → 6.22.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.
@@ -4064,6 +4064,7 @@ const handleSecondInstance = async (event, commandLine, workingDirectory, additi
4064
4064
 
4065
4065
  const ContextMenu = 'context-menu';
4066
4066
  const WillNavigate = 'will-navigate';
4067
+ const DidStartNavigation = 'did-start-navigation';
4067
4068
  const DidNavigate = 'did-navigate';
4068
4069
  const PageTitleUpdated = 'page-title-updated';
4069
4070
  const Destroyed = 'destroyed';
@@ -6290,7 +6291,7 @@ const handleWebContentsViewZoomKeyBinding = (webContentsId, input) => {
6290
6291
  };
6291
6292
 
6292
6293
  const key$7 = 'before-input';
6293
- const attach$7 = (webContents, listener) => {
6294
+ const attach$8 = (webContents, listener) => {
6294
6295
  webContents.on(BeforeInputEvent, listener);
6295
6296
  };
6296
6297
  const detach$7 = (webContents, listener) => {
@@ -6330,14 +6331,14 @@ const handler$7 = (event, input, webContentsId) => {
6330
6331
 
6331
6332
  const ElectronBrowserViewEventListenerBeforeInput = {
6332
6333
  __proto__: null,
6333
- attach: attach$7,
6334
+ attach: attach$8,
6334
6335
  detach: detach$7,
6335
6336
  handler: handler$7,
6336
6337
  key: key$7
6337
6338
  };
6338
6339
 
6339
6340
  const key$6 = 'context-menu';
6340
- const attach$6 = (webContents, listener) => {
6341
+ const attach$7 = (webContents, listener) => {
6341
6342
  webContents.on(ContextMenu, listener);
6342
6343
  };
6343
6344
  const detach$6 = (webContents, listener) => {
@@ -6352,14 +6353,14 @@ const handler$6 = (event, params) => {
6352
6353
 
6353
6354
  const ElectronBrowserViewEventListenerContextMenu = {
6354
6355
  __proto__: null,
6355
- attach: attach$6,
6356
+ attach: attach$7,
6356
6357
  detach: detach$6,
6357
6358
  handler: handler$6,
6358
6359
  key: key$6
6359
6360
  };
6360
6361
 
6361
6362
  const key$5 = 'destroyed';
6362
- const attach$5 = (webContents, listener) => {
6363
+ const attach$6 = (webContents, listener) => {
6363
6364
  webContents.on(Destroyed, listener);
6364
6365
  };
6365
6366
  const detach$5 = (webContents, listener) => {
@@ -6374,14 +6375,14 @@ const handler$5 = () => {
6374
6375
 
6375
6376
  const ElectronBrowserViewEventListenerDestroyed = {
6376
6377
  __proto__: null,
6377
- attach: attach$5,
6378
+ attach: attach$6,
6378
6379
  detach: detach$5,
6379
6380
  handler: handler$5,
6380
6381
  key: key$5
6381
6382
  };
6382
6383
 
6383
6384
  const key$4 = 'did-navigate';
6384
- const attach$4 = (webContents, listener) => {
6385
+ const attach$5 = (webContents, listener) => {
6385
6386
  webContents.on(DidNavigate, listener);
6386
6387
  };
6387
6388
  const detach$4 = (webContents, listener) => {
@@ -6396,7 +6397,7 @@ const handler$4 = (event, url) => {
6396
6397
 
6397
6398
  const ElectronBrowserViewEventListenerDidNavigate = {
6398
6399
  __proto__: null,
6399
- attach: attach$4,
6400
+ attach: attach$5,
6400
6401
  detach: detach$4,
6401
6402
  handler: handler$4,
6402
6403
  key: key$4
@@ -6436,7 +6437,7 @@ const cancelForWebContents = webContentsId => {
6436
6437
  };
6437
6438
 
6438
6439
  const key$3 = Login;
6439
- const attach$3 = (webContents, listener) => {
6440
+ const attach$4 = (webContents, listener) => {
6440
6441
  webContents.on(Login, listener);
6441
6442
  };
6442
6443
  const detach$3 = (webContents, listener) => {
@@ -6461,14 +6462,14 @@ const handler$3 = (event, authenticationResponseDetails, authInfo, callback, web
6461
6462
 
6462
6463
  const ElectronBrowserViewEventListenerLogin = {
6463
6464
  __proto__: null,
6464
- attach: attach$3,
6465
+ attach: attach$4,
6465
6466
  detach: detach$3,
6466
6467
  handler: handler$3,
6467
6468
  key: key$3
6468
6469
  };
6469
6470
 
6470
6471
  const key$2 = 'page-title-updated';
6471
- const attach$2 = (webContents, listener) => {
6472
+ const attach$3 = (webContents, listener) => {
6472
6473
  webContents.on(PageTitleUpdated, listener);
6473
6474
  };
6474
6475
  const detach$2 = (webContents, listener) => {
@@ -6483,14 +6484,14 @@ const handler$2 = (event, title) => {
6483
6484
 
6484
6485
  const ElectronBrowserViewEventListenerPageTitleUpdated = {
6485
6486
  __proto__: null,
6486
- attach: attach$2,
6487
+ attach: attach$3,
6487
6488
  detach: detach$2,
6488
6489
  handler: handler$2,
6489
6490
  key: key$2
6490
6491
  };
6491
6492
 
6492
6493
  const key$1 = 'will-navigate';
6493
- const attach$1 = (webContents, listener) => {
6494
+ const attach$2 = (webContents, listener) => {
6494
6495
  webContents.on(WillNavigate, listener);
6495
6496
  };
6496
6497
  const detach$1 = (webContents, listener) => {
@@ -6505,14 +6506,14 @@ const handler$1 = (event, url) => {
6505
6506
 
6506
6507
  const ElectronBrowserViewEventListenerWillNavigate = {
6507
6508
  __proto__: null,
6508
- attach: attach$1,
6509
+ attach: attach$2,
6509
6510
  detach: detach$1,
6510
6511
  handler: handler$1,
6511
6512
  key: key$1
6512
6513
  };
6513
6514
 
6514
6515
  const key = 'window-open';
6515
- const attach = (webContents, listener) => {
6516
+ const attach$1 = (webContents, listener) => {
6516
6517
  webContents.setWindowOpenHandler(listener);
6517
6518
  };
6518
6519
  const detach = (webContents, listener) => {
@@ -6534,7 +6535,7 @@ const handler = ({
6534
6535
 
6535
6536
  const ElectronBrowserViewEventListenerWindowOpen = {
6536
6537
  __proto__: null,
6537
- attach,
6538
+ attach: attach$1,
6538
6539
  detach,
6539
6540
  handler,
6540
6541
  key
@@ -6552,6 +6553,23 @@ const ElectronBrowserViewEventListeners = {
6552
6553
  windowOpen: ElectronBrowserViewEventListenerWindowOpen
6553
6554
  };
6554
6555
 
6556
+ const attach = (webContents, parentWebContents) => {
6557
+ let shouldRestoreParentFocus = false;
6558
+ webContents.on(DidStartNavigation, (_event, _url, _isInPlace, isMainFrame) => {
6559
+ if (!isMainFrame) {
6560
+ return;
6561
+ }
6562
+ shouldRestoreParentFocus = parentWebContents.isFocused();
6563
+ });
6564
+ webContents.on(DidNavigate, () => {
6565
+ if (!shouldRestoreParentFocus) {
6566
+ return;
6567
+ }
6568
+ shouldRestoreParentFocus = false;
6569
+ parentWebContents.focus();
6570
+ });
6571
+ };
6572
+
6555
6573
  const send = (method, ...params) => {
6556
6574
  const rpc = get(EmbedsProcess);
6557
6575
  if (!rpc) {
@@ -6581,9 +6599,11 @@ const createWebContentsView = async () => {
6581
6599
  const attachEventListeners = webContentsId => {
6582
6600
  number(webContentsId);
6583
6601
  const webContents = Electron.webContents.fromId(webContentsId);
6584
- if (!webContents) {
6602
+ const state = get$3(webContentsId);
6603
+ if (!webContents || !state) {
6585
6604
  return;
6586
6605
  }
6606
+ attach(webContents, state.browserWindow.webContents);
6587
6607
  const values = Object.values(ElectronBrowserViewEventListeners);
6588
6608
  for (const value of values) {
6589
6609
  const wrappedListener = (...args) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/main-process",
3
- "version": "6.22.0",
3
+ "version": "6.22.1",
4
4
  "keywords": [
5
5
  "lvce-editor",
6
6
  "electron"