fixed error in selecting path and naming screenshot

This commit is contained in:
Queen Bee 2018-01-19 09:03:45 -08:00
parent 8ab1dadf54
commit 01fdfcf420
3 changed files with 913 additions and 237 deletions

1124
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -4,7 +4,8 @@
"description": "tool for documenting online harassment", "description": "tool for documenting online harassment",
"main": "main.js", "main": "main.js",
"dependencies": { "dependencies": {
"electron": "^1.7.10" "electron": "^1.7.10",
"eslint": "^4.15.0"
}, },
"devDependencies": {}, "devDependencies": {},
"scripts": { "scripts": {

View File

@ -1,7 +1,9 @@
const electron = require('electron'); const electron = require('electron');
const remote = electron.remote;
const desktopCapturer = electron.desktopCapturer; const desktopCapturer = electron.desktopCapturer;
const electronScreen = electron.screen; const electronScreen = electron.screen;
const shell = electron.shell; const shell = electron.shell;
const dialog = remote.dialog;
const fs = require('fs'); const fs = require('fs');
const os = require('os'); const os = require('os');
@ -16,13 +18,18 @@ var screenshotPath = '';
var caseName = ''; var caseName = '';
pathButton.addEventListener('click', function(event) { pathButton.addEventListener('click', function(event) {
dialog.showSaveDialog(function(fileName) { dialog.showSaveDialog({
if (fileName === undefined) { filters: [
return; { name: 'png', extensions: ['png'] }
} ]
screenshotPath = fileName; },
screenshotMsg.textContent = screenshotPath; function(fileName) {
}); if (fileName === undefined) {
return;
}
screenshotPath = fileName;
screenshotMsg.textContent = screenshotPath;
});
}); });
screenshot.addEventListener('click', function(event) { screenshot.addEventListener('click', function(event) {