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>`;
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
.showMessageBox(focusedWindow, {
message:
@ -69,13 +80,7 @@ ${JSON.stringify(getPlugins(), null, 2)}
})
.then((result) => {
if (result.response === 0) {
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'
)}`
);
copyAndSend();
}
});
} else {