diff options
author | 2022-03-28 23:37:15 +0200 | |
---|---|---|
committer | 2022-05-16 00:54:56 +0200 | |
commit | 04555cc62c9cded08c3090288fa372d961c50737 (patch) | |
tree | 4566893892216446dfe24490c98881316b97cb41 /packages/main/src/infrastructure/electron | |
parent | design: Increase location bar UI density (diff) | |
download | sophie-04555cc62c9cded08c3090288fa372d961c50737.tar.gz sophie-04555cc62c9cded08c3090288fa372d961c50737.tar.zst sophie-04555cc62c9cded08c3090288fa372d961c50737.zip |
feat: New window banner
* Add renderer code for notification banners with buttons
* Handle new window open requests by denying them and displaying
a notification
Signed-off-by: Kristóf Marussy <kristof@marussy.com>
Diffstat (limited to 'packages/main/src/infrastructure/electron')
-rw-r--r-- | packages/main/src/infrastructure/electron/impl/ElectronServiceView.ts | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/packages/main/src/infrastructure/electron/impl/ElectronServiceView.ts b/packages/main/src/infrastructure/electron/impl/ElectronServiceView.ts index edcf758..089e63a 100644 --- a/packages/main/src/infrastructure/electron/impl/ElectronServiceView.ts +++ b/packages/main/src/infrastructure/electron/impl/ElectronServiceView.ts | |||
@@ -136,6 +136,16 @@ export default class ElectronServiceView implements ServiceView { | |||
136 | const { reason, exitCode } = details; | 136 | const { reason, exitCode } = details; |
137 | service.setCrashed(reason, exitCode); | 137 | service.setCrashed(reason, exitCode); |
138 | }); | 138 | }); |
139 | |||
140 | webContents.setWindowOpenHandler(({ url }) => { | ||
141 | // TODO Add filtering (allowlist) by URL. | ||
142 | // TODO Handle `new-window` disposition where the service wants an object returned by | ||
143 | // `window.open`. | ||
144 | // TODO Handle downloads with `save-to-disk` disposition. | ||
145 | // TODO Handle POST bodies where the window must be allowed to open or the data is lost. | ||
146 | service.addBlockedPopup(url); | ||
147 | return { action: 'deny' }; | ||
148 | }); | ||
139 | } | 149 | } |
140 | 150 | ||
141 | get webContentsId(): number { | 151 | get webContentsId(): number { |