electron-screenshots 0.5.19 → 0.5.21
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/lib/screenshots.js +22 -21
- package/package.json +4 -4
package/lib/screenshots.js
CHANGED
|
@@ -152,7 +152,6 @@ var Screenshots = /** @class */ (function (_super) {
|
|
|
152
152
|
}
|
|
153
153
|
// 先清除 Kiosk 模式,然后取消全屏才有效
|
|
154
154
|
this.$win.setKiosk(false);
|
|
155
|
-
this.$win.setSimpleFullScreen(false);
|
|
156
155
|
this.$win.blur();
|
|
157
156
|
this.$win.blurWebView();
|
|
158
157
|
this.$win.unmaximize();
|
|
@@ -216,6 +215,7 @@ var Screenshots = /** @class */ (function (_super) {
|
|
|
216
215
|
Screenshots.prototype.createWindow = function (display) {
|
|
217
216
|
var _a, _b;
|
|
218
217
|
return __awaiter(this, void 0, void 0, function () {
|
|
218
|
+
var windowTypes;
|
|
219
219
|
var _this = this;
|
|
220
220
|
return __generator(this, function (_c) {
|
|
221
221
|
switch (_c.label) {
|
|
@@ -227,6 +227,11 @@ var Screenshots = /** @class */ (function (_super) {
|
|
|
227
227
|
_c.sent();
|
|
228
228
|
// 复用未销毁的窗口
|
|
229
229
|
if (!this.$win || ((_b = (_a = this.$win) === null || _a === void 0 ? void 0 : _a.isDestroyed) === null || _b === void 0 ? void 0 : _b.call(_a))) {
|
|
230
|
+
windowTypes = {
|
|
231
|
+
darwin: 'panel',
|
|
232
|
+
linux: 'dock',
|
|
233
|
+
win32: 'toolbar',
|
|
234
|
+
};
|
|
230
235
|
this.$win = new electron_1.BrowserWindow({
|
|
231
236
|
title: 'screenshots',
|
|
232
237
|
x: display.x,
|
|
@@ -234,40 +239,40 @@ var Screenshots = /** @class */ (function (_super) {
|
|
|
234
239
|
width: display.width,
|
|
235
240
|
height: display.height,
|
|
236
241
|
useContentSize: true,
|
|
242
|
+
type: windowTypes[process.platform],
|
|
237
243
|
frame: false,
|
|
238
244
|
show: false,
|
|
239
245
|
autoHideMenuBar: true,
|
|
240
246
|
transparent: true,
|
|
241
|
-
|
|
242
|
-
resizable: process.platform !== 'darwin',
|
|
247
|
+
resizable: false,
|
|
243
248
|
movable: false,
|
|
244
|
-
|
|
249
|
+
minimizable: false,
|
|
250
|
+
maximizable: false,
|
|
251
|
+
// focusable 必须设置为 true, 否则窗口不能及时响应esc按键,输入框也不能输入
|
|
245
252
|
focusable: true,
|
|
253
|
+
skipTaskbar: true,
|
|
254
|
+
alwaysOnTop: true,
|
|
246
255
|
/**
|
|
247
256
|
* linux 下必须设置为false,否则不能全屏显示在最上层
|
|
248
|
-
* mac 下设置为false
|
|
249
|
-
* https://github.com/nashaofu/screenshots/issues/148
|
|
257
|
+
* mac 下设置为false,否则可能会导致程序坞不恢复问题,且与 kiosk 模式冲突
|
|
250
258
|
*/
|
|
251
|
-
|
|
252
|
-
//
|
|
253
|
-
|
|
259
|
+
fullscreen: false,
|
|
260
|
+
// mac fullscreenable 设置为 true 会导致应用崩溃
|
|
261
|
+
fullscreenable: false,
|
|
262
|
+
kiosk: true,
|
|
254
263
|
backgroundColor: '#00000000',
|
|
255
264
|
titleBarStyle: 'hidden',
|
|
256
|
-
alwaysOnTop: true,
|
|
257
|
-
enableLargerThanScreen: true,
|
|
258
|
-
skipTaskbar: true,
|
|
259
265
|
hasShadow: false,
|
|
260
266
|
paintWhenInitiallyHidden: false,
|
|
267
|
+
// mac 特有的属性
|
|
268
|
+
roundedCorners: false,
|
|
269
|
+
enableLargerThanScreen: false,
|
|
261
270
|
acceptFirstMouse: true,
|
|
262
271
|
});
|
|
263
272
|
this.$win.on('show', function () {
|
|
264
273
|
var _a, _b;
|
|
265
274
|
(_a = _this.$win) === null || _a === void 0 ? void 0 : _a.focus();
|
|
266
|
-
|
|
267
|
-
* 在窗口显示时设置,防止与 fullscreen、x、y、width、height 等冲突, 导致显示效果不符合预期
|
|
268
|
-
* mac 下不设置 kiosk 模式,https://github.com/nashaofu/screenshots/issues/148
|
|
269
|
-
*/
|
|
270
|
-
(_b = _this.$win) === null || _b === void 0 ? void 0 : _b.setKiosk(process.platform !== 'darwin');
|
|
275
|
+
(_b = _this.$win) === null || _b === void 0 ? void 0 : _b.setKiosk(true);
|
|
271
276
|
});
|
|
272
277
|
this.$win.on('closed', function () {
|
|
273
278
|
_this.$win = null;
|
|
@@ -285,10 +290,6 @@ var Screenshots = /** @class */ (function (_super) {
|
|
|
285
290
|
});
|
|
286
291
|
}
|
|
287
292
|
this.$win.blur();
|
|
288
|
-
this.$win.setKiosk(false);
|
|
289
|
-
if (process.platform === 'darwin') {
|
|
290
|
-
this.$win.setSimpleFullScreen(true);
|
|
291
|
-
}
|
|
292
293
|
this.$win.setBounds(display);
|
|
293
294
|
this.$view.setBounds({
|
|
294
295
|
x: 0,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "electron-screenshots",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.21",
|
|
4
4
|
"description": "electron 截图插件",
|
|
5
5
|
"types": "lib/screenshots.d.ts",
|
|
6
6
|
"main": "lib/screenshots.js",
|
|
@@ -37,8 +37,8 @@
|
|
|
37
37
|
"dependencies": {
|
|
38
38
|
"debug": "^4.3.4",
|
|
39
39
|
"fs-extra": "^11.1.1",
|
|
40
|
-
"node-screenshots": "^0.1.
|
|
41
|
-
"react-screenshots": "^0.5.
|
|
40
|
+
"node-screenshots": "^0.1.4",
|
|
41
|
+
"react-screenshots": "^0.5.21"
|
|
42
42
|
},
|
|
43
43
|
"peerDependencies": {
|
|
44
44
|
"electron": ">=14"
|
|
@@ -58,5 +58,5 @@
|
|
|
58
58
|
"rimraf": "^4.4.1",
|
|
59
59
|
"typescript": "^5.0.2"
|
|
60
60
|
},
|
|
61
|
-
"gitHead": "
|
|
61
|
+
"gitHead": "34341ff2e6ae3856ff2c838b9b8f8843c90a789d"
|
|
62
62
|
}
|