diff options
author | Stefan Malzner <stefan@adlk.io> | 2019-10-03 13:51:00 +0200 |
---|---|---|
committer | Stefan Malzner <stefan@adlk.io> | 2019-10-03 13:51:00 +0200 |
commit | d390f216c3e0ecd38067d19da8bd882e6a0303a7 (patch) | |
tree | c54a2f988c44ed655637c7f7082f0800a8ce3cee /src | |
parent | Add darkModeSupport (diff) | |
download | ferdium-app-d390f216c3e0ecd38067d19da8bd882e6a0303a7.tar.gz ferdium-app-d390f216c3e0ecd38067d19da8bd882e6a0303a7.tar.zst ferdium-app-d390f216c3e0ecd38067d19da8bd882e6a0303a7.zip |
re-fix & improve new-window handling
Diffstat (limited to 'src')
-rw-r--r-- | src/webview/recipe.js | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/webview/recipe.js b/src/webview/recipe.js index 7be307f05..e1ff44f05 100644 --- a/src/webview/recipe.js +++ b/src/webview/recipe.js | |||
@@ -12,6 +12,7 @@ import contextMenu from './contextMenu'; | |||
12 | import './notifications'; | 12 | import './notifications'; |
13 | 13 | ||
14 | import { DEFAULT_APP_SETTINGS } from '../config'; | 14 | import { DEFAULT_APP_SETTINGS } from '../config'; |
15 | import { isDevMode } from '../environment'; | ||
15 | 16 | ||
16 | const debug = require('debug')('Franz:Plugin'); | 17 | const debug = require('debug')('Franz:Plugin'); |
17 | 18 | ||
@@ -169,3 +170,17 @@ class RecipeController { | |||
169 | /* eslint-disable no-new */ | 170 | /* eslint-disable no-new */ |
170 | new RecipeController(); | 171 | new RecipeController(); |
171 | /* eslint-enable no-new */ | 172 | /* eslint-enable no-new */ |
173 | |||
174 | // Patching window.open | ||
175 | const originalWindowOpen = window.open; | ||
176 | |||
177 | |||
178 | window.open = (url, frameName, features) => { | ||
179 | debug('window.open', url, frameName, features); | ||
180 | // We need to differentiate if the link should be opened in a popup or in the systems default browser | ||
181 | if (!frameName && !features && typeof features !== 'string') { | ||
182 | return ipcRenderer.sendToHost('new-window', url); | ||
183 | } | ||
184 | |||
185 | return originalWindowOpen(url, frameName, features); | ||
186 | }; | ||