@lvce-editor/main-process 6.43.0 → 6.44.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.
@@ -7531,6 +7531,26 @@ const click = async (view, selector) => {
7531
7531
  });
7532
7532
  return true;
7533
7533
  };
7534
+ const pressKey = (view, keyCode, modifiers = []) => {
7535
+ string(keyCode);
7536
+ const {
7537
+ webContents
7538
+ } = view;
7539
+ if (webContents.isDestroyed()) {
7540
+ throw new Error('Cannot press a key in a closed browser tab');
7541
+ }
7542
+ webContents.focus();
7543
+ webContents.sendInputEvent({
7544
+ keyCode,
7545
+ modifiers,
7546
+ type: 'keyDown'
7547
+ });
7548
+ webContents.sendInputEvent({
7549
+ keyCode,
7550
+ modifiers,
7551
+ type: 'keyUp'
7552
+ });
7553
+ };
7534
7554
  const reload = view => {
7535
7555
  const {
7536
7556
  webContents
@@ -8160,6 +8180,7 @@ const commandMap = {
8160
8180
  'ElectronWebContentsViewFunctions.insertJavaScript': wrapBrowserViewCommand(executeJavaScript),
8161
8181
  'ElectronWebContentsViewFunctions.inspectElement': wrapBrowserViewCommand(inspectElement),
8162
8182
  'ElectronWebContentsViewFunctions.openDevtools': wrapBrowserViewCommand(openDevtools),
8183
+ 'ElectronWebContentsViewFunctions.pressKey': wrapBrowserViewCommand(pressKey),
8163
8184
  'ElectronWebContentsViewFunctions.reload': wrapBrowserViewCommand(reload),
8164
8185
  'ElectronWebContentsViewFunctions.resizeBrowserView': wrapBrowserViewCommand(resizeBrowserView),
8165
8186
  'ElectronWebContentsViewFunctions.setAudioMuted': wrapBrowserViewCommand(setAudioMuted),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/main-process",
3
- "version": "6.43.0",
3
+ "version": "6.44.0",
4
4
  "keywords": [
5
5
  "lvce-editor",
6
6
  "electron"