electron-screenshots 0.5.2 → 0.5.3

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/index.js CHANGED
@@ -43,6 +43,12 @@ electron_1.app.whenReady().then(function () {
43
43
  screenshots.on('save', function (e, buffer, bounds) {
44
44
  console.log('capture', buffer, bounds);
45
45
  });
46
+ var mainWin = new electron_1.BrowserWindow({
47
+ fullscreen: true,
48
+ show: true
49
+ });
50
+ mainWin.removeMenu();
51
+ mainWin.loadURL('https://github.com/nashaofu');
46
52
  });
47
53
  electron_1.app.on('window-all-closed', function () {
48
54
  if (process.platform !== 'darwin') {
@@ -127,11 +127,6 @@ var Screenshots = /** @class */ (function (_super) {
127
127
  case 2:
128
128
  _a.sent();
129
129
  this.$view.webContents.send('SCREENSHOTS:capture', display, imageUrl);
130
- if (!this.$win) {
131
- return [2 /*return*/];
132
- }
133
- this.$win.blur();
134
- this.$win.show();
135
130
  return [2 /*return*/];
136
131
  }
137
132
  });
@@ -157,10 +152,9 @@ var Screenshots = /** @class */ (function (_super) {
157
152
  this.$win.setFullScreen(false);
158
153
  this.$win.setSimpleFullScreen(false);
159
154
  this.$win.blur();
160
- this.$win.setBrowserView(null);
161
- // 必须设置为 closable 为 true
162
- // 否者不能关闭窗口
163
- this.$win.setClosable(true);
155
+ this.$win.blurWebView();
156
+ this.$win.unmaximize();
157
+ this.$win.removeBrowserView(this.$view);
164
158
  if (this.singleWindow) {
165
159
  this.$win.hide();
166
160
  }
@@ -241,11 +235,9 @@ var Screenshots = /** @class */ (function (_super) {
241
235
  show: false,
242
236
  autoHideMenuBar: true,
243
237
  transparent: true,
244
- resizable: false,
238
+ // resizable 设置为 false 会导致页面崩溃
239
+ // resizable: false,
245
240
  movable: false,
246
- closable: false,
247
- minimizable: false,
248
- maximizable: false,
249
241
  // focusable: true, 否则窗口不能及时响应esc按键,输入框也不能输入
250
242
  focusable: true,
251
243
  // linux 下必须设置为false,否则不能全屏显示在最上层
@@ -270,10 +262,16 @@ var Screenshots = /** @class */ (function (_super) {
270
262
  (_b = _this.$win) === null || _b === void 0 ? void 0 : _b.setKiosk(true);
271
263
  });
272
264
  }
273
- this.$win.setFullScreen(process.platform === 'darwin');
274
- // 设置为 false,mac 就不显示左上角关闭按钮
275
- this.$win.setClosable(false);
276
265
  this.$win.setBrowserView(this.$view);
266
+ this.$win.setWindowButtonVisibility(false);
267
+ this.$win.setVisibleOnAllWorkspaces(true, {
268
+ visibleOnFullScreen: true,
269
+ skipTransformProcessType: true
270
+ });
271
+ this.$win.blur();
272
+ this.$win.setKiosk(false);
273
+ this.$win.setFullScreen(process.platform === 'darwin');
274
+ this.$win.setSimpleFullScreen(process.platform === 'darwin');
277
275
  this.$win.setBounds(display);
278
276
  this.$view.setBounds({
279
277
  x: 0,
@@ -281,6 +279,7 @@ var Screenshots = /** @class */ (function (_super) {
281
279
  width: display.width,
282
280
  height: display.height
283
281
  });
282
+ this.$win.show();
284
283
  return [2 /*return*/];
285
284
  }
286
285
  });
@@ -396,7 +395,6 @@ var Screenshots = /** @class */ (function (_super) {
396
395
  milliseconds = (0, padStart_1.default)(time.getMilliseconds(), 3, '0');
397
396
  this.$win.setAlwaysOnTop(false);
398
397
  return [4 /*yield*/, electron_1.dialog.showSaveDialog(this.$win, {
399
- title: '保存图片',
400
398
  defaultPath: "".concat(year).concat(month).concat(date).concat(hours).concat(minutes).concat(seconds).concat(milliseconds, ".png")
401
399
  })];
402
400
  case 1:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "electron-screenshots",
3
- "version": "0.5.2",
3
+ "version": "0.5.3",
4
4
  "description": "electron 截图插件",
5
5
  "types": "lib/screenshots.d.ts",
6
6
  "main": "lib/screenshots.js",
@@ -58,5 +58,5 @@
58
58
  "rimraf": "^3.0.2",
59
59
  "typescript": "^4.5.5"
60
60
  },
61
- "gitHead": "8cfc003a0b5159255cea5e2990515fc824982b1e"
61
+ "gitHead": "6c796ef93f36904a0ad5cd54b50c23e6e58aecf5"
62
62
  }