@lvce-editor/main-process 6.41.0 → 6.41.2

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.
@@ -4748,14 +4748,39 @@ const create$3 = () => {
4748
4748
  let pressedAt = -1;
4749
4749
  let releasedAt = -1;
4750
4750
  let controlCode = '';
4751
- const reset = () => {
4751
+ const heldControls = new Set();
4752
+ let overlappingControls = false;
4753
+ const resetTaps = () => {
4752
4754
  pressedAt = -1;
4753
4755
  releasedAt = -1;
4754
4756
  controlCode = '';
4755
4757
  };
4758
+ const reset = () => {
4759
+ resetTaps();
4760
+ heldControls.clear();
4761
+ overlappingControls = false;
4762
+ };
4763
+ const hasOverlappingControls = (input, isControl) => {
4764
+ if (isControl && !input.isAutoRepeat) {
4765
+ if (input.type === 'keyDown') {
4766
+ if (heldControls.size > 0) overlappingControls = true;
4767
+ heldControls.add(input.code);
4768
+ } else if (input.type === 'keyUp') {
4769
+ heldControls.delete(input.code);
4770
+ }
4771
+ if (overlappingControls) {
4772
+ resetTaps();
4773
+ if (heldControls.size === 0) overlappingControls = false;
4774
+ return true;
4775
+ }
4776
+ }
4777
+ return false;
4778
+ };
4756
4779
  const accept = (input, now) => {
4757
- if (!['ControlLeft', 'ControlRight'].includes(input.code) || input.alt || input.meta || input.shift || input.isComposing) {
4758
- reset();
4780
+ const isControl = ['ControlLeft', 'ControlRight'].includes(input.code);
4781
+ if (hasOverlappingControls(input, isControl)) return false;
4782
+ if (!isControl || input.alt || input.meta || input.shift || input.isComposing) {
4783
+ resetTaps();
4759
4784
  return false;
4760
4785
  }
4761
4786
  if (input.isAutoRepeat) {
@@ -4763,19 +4788,19 @@ const create$3 = () => {
4763
4788
  }
4764
4789
  if (input.type === 'keyDown') {
4765
4790
  if (pressedAt !== -1 || controlCode !== input.code || now - releasedAt > 400) {
4766
- reset();
4791
+ resetTaps();
4767
4792
  }
4768
4793
  controlCode = input.code;
4769
4794
  pressedAt = now;
4770
4795
  return false;
4771
4796
  }
4772
4797
  if (input.type !== 'keyUp' || controlCode !== input.code || pressedAt === -1 || now - pressedAt > 250) {
4773
- reset();
4798
+ resetTaps();
4774
4799
  return false;
4775
4800
  }
4776
4801
  pressedAt = -1;
4777
4802
  if (releasedAt !== -1 && now - releasedAt <= 400) {
4778
- reset();
4803
+ resetTaps();
4779
4804
  return true;
4780
4805
  }
4781
4806
  releasedAt = now;
@@ -5443,6 +5468,10 @@ const beep = () => {
5443
5468
  shell.beep();
5444
5469
  };
5445
5470
 
5471
+ const writeText = async text => {
5472
+ await clipboard.writeText(text);
5473
+ };
5474
+
5446
5475
  /**
5447
5476
  * @param { Electron.TraceConfig | Electron.TraceCategoriesAndOptions} options
5448
5477
  */
@@ -7983,6 +8012,7 @@ const commandMap = {
7983
8012
  'ElectronApp.isPackagedDeb': isPackagedDeb,
7984
8013
  'ElectronApplicationMenu.setItems': setItems,
7985
8014
  'ElectronBeep.beep': beep,
8015
+ 'ElectronClipBoard.writeText': writeText,
7986
8016
  'ElectronContentTracing.startRecording': startRecording,
7987
8017
  'ElectronContentTracing.stopRecording': stopRecording,
7988
8018
  'ElectronContextMenu.openContextMenu': openContextMenu,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/main-process",
3
- "version": "6.41.0",
3
+ "version": "6.41.2",
4
4
  "keywords": [
5
5
  "lvce-editor",
6
6
  "electron"