@lvce-editor/main-process 6.44.0 → 6.45.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.
- package/dist/mainProcessMain.js +42 -2
- package/package.json +2 -2
package/dist/mainProcessMain.js
CHANGED
|
@@ -7288,6 +7288,10 @@ const attachEventListenersToWebContents = (webContentsId, webContents, browserWi
|
|
|
7288
7288
|
const createWindow = (options, url, disposition) => {
|
|
7289
7289
|
const view = createWebContentsViewForWindow(browserWindow, options);
|
|
7290
7290
|
send('ElectronWebContents.handleWindowOpen', webContentsId, view.webContents.id, url, disposition);
|
|
7291
|
+
// Link-created tabs have no supplied contents or pending navigation, unlike scripted popups.
|
|
7292
|
+
if (!options.webContents) {
|
|
7293
|
+
void view.webContents.loadURL(url).catch(console.error);
|
|
7294
|
+
}
|
|
7291
7295
|
return view.webContents;
|
|
7292
7296
|
};
|
|
7293
7297
|
// @ts-ignore Electron event handlers have different argument tuples
|
|
@@ -7484,10 +7488,46 @@ const getDomTree = async view => {
|
|
|
7484
7488
|
const result = await getBodyOuterHtml(view);
|
|
7485
7489
|
return getSlimCode(result);
|
|
7486
7490
|
};
|
|
7487
|
-
const
|
|
7488
|
-
|
|
7491
|
+
const pendingCaptures = new WeakMap();
|
|
7492
|
+
const recoverableCaptureErrors = new Set(['Empty page capture', 'UnknownVizError', 'VizSentEmptyBitmap', 'Current display surface not available for capture']);
|
|
7493
|
+
const captureNonEmptyPage = async webContents => {
|
|
7494
|
+
const image = await webContents.capturePage();
|
|
7495
|
+
if (image.isEmpty()) {
|
|
7496
|
+
throw new Error('Empty page capture');
|
|
7497
|
+
}
|
|
7489
7498
|
return image.toPNG();
|
|
7490
7499
|
};
|
|
7500
|
+
const captureWithRecovery = async webContents => {
|
|
7501
|
+
try {
|
|
7502
|
+
return await captureNonEmptyPage(webContents);
|
|
7503
|
+
} catch (error) {
|
|
7504
|
+
if (!(error instanceof Error) || !recoverableCaptureErrors.has(error.message) || webContents.isDestroyed()) {
|
|
7505
|
+
throw error;
|
|
7506
|
+
}
|
|
7507
|
+
// A missing compositor surface must not become a blank overlay. Request a repaint without reloading the page.
|
|
7508
|
+
webContents.invalidate();
|
|
7509
|
+
return captureNonEmptyPage(webContents);
|
|
7510
|
+
}
|
|
7511
|
+
};
|
|
7512
|
+
const captureAndRelease = async webContents => {
|
|
7513
|
+
try {
|
|
7514
|
+
return await captureWithRecovery(webContents);
|
|
7515
|
+
} finally {
|
|
7516
|
+
pendingCaptures.delete(webContents);
|
|
7517
|
+
}
|
|
7518
|
+
};
|
|
7519
|
+
const capturePage = view => {
|
|
7520
|
+
const {
|
|
7521
|
+
webContents
|
|
7522
|
+
} = view;
|
|
7523
|
+
const pending = pendingCaptures.get(webContents);
|
|
7524
|
+
if (pending) {
|
|
7525
|
+
return pending;
|
|
7526
|
+
}
|
|
7527
|
+
const capture = captureAndRelease(webContents);
|
|
7528
|
+
pendingCaptures.set(webContents, capture);
|
|
7529
|
+
return capture;
|
|
7530
|
+
};
|
|
7491
7531
|
const insertCss = async (view, code) => {
|
|
7492
7532
|
const {
|
|
7493
7533
|
webContents
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lvce-editor/main-process",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.45.0",
|
|
4
4
|
"keywords": [
|
|
5
5
|
"lvce-editor",
|
|
6
6
|
"electron"
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"type": "module",
|
|
15
15
|
"main": "dist/mainProcessMain.js",
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"electron": "44.
|
|
17
|
+
"electron": "44.3.0"
|
|
18
18
|
},
|
|
19
19
|
"engines": {
|
|
20
20
|
"node": ">=22.11.0"
|