mirror of
https://github.com/kuaifan/dootask.git
synced 2025-12-10 18:02:55 +00:00
fix: 修复桌面端部分机器新窗口任务报错的情况
This commit is contained in:
parent
f2719eb742
commit
a86bd9a05e
5
electron/electron.js
vendored
5
electron/electron.js
vendored
@ -521,6 +521,11 @@ function createChildWindow(args) {
|
||||
contextIsolation: true,
|
||||
}, webPreferences),
|
||||
}, config)
|
||||
|
||||
options.width = utils.normalizeSize(options.width, 1280)
|
||||
options.height = utils.normalizeSize(options.height, 800)
|
||||
options.minWidth = utils.normalizeSize(options.minWidth, 360)
|
||||
options.minHeight = utils.normalizeSize(options.minHeight, 360)
|
||||
if (!options.webPreferences.contextIsolation) {
|
||||
delete options.webPreferences.preload;
|
||||
}
|
||||
|
||||
11
electron/lib/utils.js
vendored
11
electron/lib/utils.js
vendored
@ -108,6 +108,17 @@ const utils = {
|
||||
return _s;
|
||||
},
|
||||
|
||||
/**
|
||||
* 兜底处理尺寸类数值,确保传入的是有限数字
|
||||
* @param value
|
||||
* @param fallback
|
||||
* @returns {number}
|
||||
*/
|
||||
normalizeSize(value, fallback) {
|
||||
const parsed = Number(value);
|
||||
return Number.isFinite(parsed) ? parsed : fallback;
|
||||
},
|
||||
|
||||
/**
|
||||
* 随机字符串
|
||||
* @param len
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user