Handle undefined focusedWindow in help menu item click (Report Issue)

This commit is contained in:
Labhansh Agrawal 2020-06-29 19:20:56 +05:30 committed by Benjamin Staneck
parent d6cb7e930b
commit d01a4a8897

View file

@ -58,7 +58,18 @@ ${JSON.stringify(getPlugins(), null, 2)}
</details>`; </details>`;
const issueURL = `https://github.com/zeit/hyper/issues/new?body=${encodeURIComponent(body)}`; const issueURL = `https://github.com/zeit/hyper/issues/new?body=${encodeURIComponent(body)}`;
if (issueURL.length > 6144) { const copyAndSend = () => {
clipboard.writeText(body);
shell.openExternal(
`https://github.com/zeit/hyper/issues/new?body=${encodeURIComponent(
'<!-- We have written the needed data into your clipboard because it was too large to send. ' +
'Please paste. -->\n'
)}`
);
};
if (!focusedWindow) {
copyAndSend();
} else if (issueURL.length > 6144) {
dialog dialog
.showMessageBox(focusedWindow, { .showMessageBox(focusedWindow, {
message: message:
@ -69,13 +80,7 @@ ${JSON.stringify(getPlugins(), null, 2)}
}) })
.then((result) => { .then((result) => {
if (result.response === 0) { if (result.response === 0) {
clipboard.writeText(body); copyAndSend();
shell.openExternal(
`https://github.com/zeit/hyper/issues/new?body=${encodeURIComponent(
'<!-- We have written the needed data into your clipboard because it was too large to send. ' +
'Please paste. -->\n'
)}`
);
} }
}); });
} else { } else {