@lvce-editor/main-process 6.43.0 → 6.44.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.
- package/dist/mainProcessMain.js +25 -0
- package/package.json +1 -1
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
|
|
@@ -7531,6 +7535,26 @@ const click = async (view, selector) => {
|
|
|
7531
7535
|
});
|
|
7532
7536
|
return true;
|
|
7533
7537
|
};
|
|
7538
|
+
const pressKey = (view, keyCode, modifiers = []) => {
|
|
7539
|
+
string(keyCode);
|
|
7540
|
+
const {
|
|
7541
|
+
webContents
|
|
7542
|
+
} = view;
|
|
7543
|
+
if (webContents.isDestroyed()) {
|
|
7544
|
+
throw new Error('Cannot press a key in a closed browser tab');
|
|
7545
|
+
}
|
|
7546
|
+
webContents.focus();
|
|
7547
|
+
webContents.sendInputEvent({
|
|
7548
|
+
keyCode,
|
|
7549
|
+
modifiers,
|
|
7550
|
+
type: 'keyDown'
|
|
7551
|
+
});
|
|
7552
|
+
webContents.sendInputEvent({
|
|
7553
|
+
keyCode,
|
|
7554
|
+
modifiers,
|
|
7555
|
+
type: 'keyUp'
|
|
7556
|
+
});
|
|
7557
|
+
};
|
|
7534
7558
|
const reload = view => {
|
|
7535
7559
|
const {
|
|
7536
7560
|
webContents
|
|
@@ -8160,6 +8184,7 @@ const commandMap = {
|
|
|
8160
8184
|
'ElectronWebContentsViewFunctions.insertJavaScript': wrapBrowserViewCommand(executeJavaScript),
|
|
8161
8185
|
'ElectronWebContentsViewFunctions.inspectElement': wrapBrowserViewCommand(inspectElement),
|
|
8162
8186
|
'ElectronWebContentsViewFunctions.openDevtools': wrapBrowserViewCommand(openDevtools),
|
|
8187
|
+
'ElectronWebContentsViewFunctions.pressKey': wrapBrowserViewCommand(pressKey),
|
|
8163
8188
|
'ElectronWebContentsViewFunctions.reload': wrapBrowserViewCommand(reload),
|
|
8164
8189
|
'ElectronWebContentsViewFunctions.resizeBrowserView': wrapBrowserViewCommand(resizeBrowserView),
|
|
8165
8190
|
'ElectronWebContentsViewFunctions.setAudioMuted': wrapBrowserViewCommand(setAudioMuted),
|