@lvce-editor/main-process 6.41.2 → 6.42.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 +40 -14
- package/package.json +2 -2
package/dist/mainProcessMain.js
CHANGED
|
@@ -4813,8 +4813,8 @@ const create$3 = () => {
|
|
|
4813
4813
|
};
|
|
4814
4814
|
|
|
4815
4815
|
const windows = new Map();
|
|
4816
|
-
const setEnabled = (windowId, enabled) => {
|
|
4817
|
-
windows.get(windowId)?.setEnabled(enabled);
|
|
4816
|
+
const setEnabled = (windowId, enabled, modifier = 'ctrl=twice') => {
|
|
4817
|
+
windows.get(windowId)?.setEnabled(enabled, modifier);
|
|
4818
4818
|
};
|
|
4819
4819
|
const attach$e = (window, contents) => {
|
|
4820
4820
|
windows.get(window.id)?.attach(contents);
|
|
@@ -4822,10 +4822,16 @@ const attach$e = (window, contents) => {
|
|
|
4822
4822
|
const listen$2 = (window, rpc) => {
|
|
4823
4823
|
const gesture = create$3();
|
|
4824
4824
|
const disposers = new Map();
|
|
4825
|
+
let modifier = 'ctrl=twice';
|
|
4826
|
+
const heldControls = new Set();
|
|
4827
|
+
let holdTimer;
|
|
4825
4828
|
let enabled = false;
|
|
4826
4829
|
let pending;
|
|
4827
4830
|
const reset = () => {
|
|
4828
4831
|
gesture.reset();
|
|
4832
|
+
heldControls.clear();
|
|
4833
|
+
clearTimeout(holdTimer);
|
|
4834
|
+
holdTimer = undefined;
|
|
4829
4835
|
if (pending) {
|
|
4830
4836
|
clearImmediate(pending);
|
|
4831
4837
|
pending = undefined;
|
|
@@ -4840,6 +4846,25 @@ const listen$2 = (window, rpc) => {
|
|
|
4840
4846
|
reset();
|
|
4841
4847
|
return;
|
|
4842
4848
|
}
|
|
4849
|
+
if (modifier === 'ctrl-hold') {
|
|
4850
|
+
const isControl = input.code === 'ControlLeft' || input.code === 'ControlRight';
|
|
4851
|
+
const wasHeld = heldControls.has(input.code);
|
|
4852
|
+
if (isControl && input.type === 'keyDown') heldControls.add(input.code);
|
|
4853
|
+
if (isControl && input.type === 'keyUp') heldControls.delete(input.code);
|
|
4854
|
+
if (!isControl || input.type === 'keyUp' || input.alt || input.meta || input.shift || input.isComposing || heldControls.size !== 1) {
|
|
4855
|
+
clearTimeout(holdTimer);
|
|
4856
|
+
holdTimer = undefined;
|
|
4857
|
+
return;
|
|
4858
|
+
}
|
|
4859
|
+
if (input.type !== 'keyDown' || input.isAutoRepeat || wasHeld) return;
|
|
4860
|
+
holdTimer = setTimeout(() => {
|
|
4861
|
+
holdTimer = undefined;
|
|
4862
|
+
if (enabled && !contents.isDestroyed() && contents.isFocused() && window.isFocused()) {
|
|
4863
|
+
rpc.send('Window.handleBrowserFullWidthGesture');
|
|
4864
|
+
}
|
|
4865
|
+
}, 300);
|
|
4866
|
+
return;
|
|
4867
|
+
}
|
|
4843
4868
|
if (gesture.accept(input, performance.now())) {
|
|
4844
4869
|
// Deliver the key release before moving focus to another WebContents.
|
|
4845
4870
|
pending = setImmediate(() => {
|
|
@@ -4868,9 +4893,10 @@ const listen$2 = (window, rpc) => {
|
|
|
4868
4893
|
};
|
|
4869
4894
|
windows.set(window.id, {
|
|
4870
4895
|
attach: attachContents,
|
|
4871
|
-
setEnabled(value) {
|
|
4896
|
+
setEnabled(value, nextModifier) {
|
|
4872
4897
|
reset();
|
|
4873
4898
|
enabled = value;
|
|
4899
|
+
modifier = nextModifier;
|
|
4874
4900
|
}
|
|
4875
4901
|
});
|
|
4876
4902
|
attachContents(window.webContents);
|
|
@@ -4891,17 +4917,17 @@ const listen$2 = (window, rpc) => {
|
|
|
4891
4917
|
|
|
4892
4918
|
const closePreparationTimeout = 1000;
|
|
4893
4919
|
const prepareClose = async rpc => {
|
|
4894
|
-
|
|
4920
|
+
const {
|
|
4921
|
+
promise,
|
|
4922
|
+
reject
|
|
4923
|
+
} = Promise.withResolvers();
|
|
4924
|
+
const timeout = setTimeout(() => {
|
|
4925
|
+
reject(new Error(`Timed out preparing window close after ${closePreparationTimeout}ms`));
|
|
4926
|
+
}, closePreparationTimeout);
|
|
4895
4927
|
try {
|
|
4896
|
-
await Promise.race([rpc.invoke('Window.prepareClose'),
|
|
4897
|
-
timeout = setTimeout(() => {
|
|
4898
|
-
reject(new Error(`Timed out preparing window close after ${closePreparationTimeout}ms`));
|
|
4899
|
-
}, closePreparationTimeout);
|
|
4900
|
-
})]);
|
|
4928
|
+
await Promise.race([rpc.invoke('Window.prepareClose'), promise]);
|
|
4901
4929
|
} finally {
|
|
4902
|
-
|
|
4903
|
-
clearTimeout(timeout);
|
|
4904
|
-
}
|
|
4930
|
+
clearTimeout(timeout);
|
|
4905
4931
|
}
|
|
4906
4932
|
};
|
|
4907
4933
|
const createWindowCloseHandler = (window, rpc, onError, dispose = () => {}) => {
|
|
@@ -5884,13 +5910,13 @@ const toggleDevtools = browserWindow => {
|
|
|
5884
5910
|
const toggleFullScreen = browserWindow => {
|
|
5885
5911
|
browserWindow.setFullScreen(!browserWindow.isFullScreen());
|
|
5886
5912
|
};
|
|
5887
|
-
const executeWindowFunction = (browserWindowId, key) => {
|
|
5913
|
+
const executeWindowFunction = (browserWindowId, key, modifier = 'ctrl=twice') => {
|
|
5888
5914
|
const browserWindow = getBrowserWindow(browserWindowId);
|
|
5889
5915
|
if (!browserWindow) {
|
|
5890
5916
|
return;
|
|
5891
5917
|
}
|
|
5892
5918
|
if (key === 'enableBrowserFullWidthGesture' || key === 'disableBrowserFullWidthGesture') {
|
|
5893
|
-
setEnabled(browserWindowId, key === 'enableBrowserFullWidthGesture');
|
|
5919
|
+
setEnabled(browserWindowId, key === 'enableBrowserFullWidthGesture', modifier);
|
|
5894
5920
|
return;
|
|
5895
5921
|
}
|
|
5896
5922
|
if (key === 'toggleDevtools') {
|
package/package.json
CHANGED