Skip to content

Commit

Permalink
[shell] fix eclipse-theia#4697: reset prevent close on keyup and befo…
Browse files Browse the repository at this point in the history
…reunload

Signed-off-by: Anton Kosyakov <anton.kosyakov@typefox.io>
  • Loading branch information
akosyakov committed Mar 25, 2019
1 parent 4d74d28 commit 5cbb4f1
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions packages/core/src/browser/common-frontend-contribution.ts
Original file line number Diff line number Diff line change
Expand Up @@ -599,16 +599,18 @@ export class CommonFrontendContribution implements FrontendApplicationContributi
this.shouldPreventClose = isCtrlCmd(event) || event.code === 'KeyW';
});

window.document.addEventListener('keyup', event => {
if (isCtrlCmd(event) || event.code === 'KeyW') {
this.shouldPreventClose = false;
}
window.document.addEventListener('keyup', () => {
this.shouldPreventClose = false;
});
}

onWillStop() {
if (this.shouldPreventClose || this.shell.canSaveAll()) {
return true;
try {
if (this.shouldPreventClose || this.shell.canSaveAll()) {
return true;
}
} finally {
this.shouldPreventClose = false;
}
}
}

0 comments on commit 5cbb4f1

Please sign in to comment.