From d390f216c3e0ecd38067d19da8bd882e6a0303a7 Mon Sep 17 00:00:00 2001 From: Stefan Malzner Date: Thu, 3 Oct 2019 13:51:00 +0200 Subject: re-fix & improve new-window handling --- src/webview/recipe.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'src/webview') 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'; import './notifications'; import { DEFAULT_APP_SETTINGS } from '../config'; +import { isDevMode } from '../environment'; const debug = require('debug')('Franz:Plugin'); @@ -169,3 +170,17 @@ class RecipeController { /* eslint-disable no-new */ new RecipeController(); /* eslint-enable no-new */ + +// Patching window.open +const originalWindowOpen = window.open; + + +window.open = (url, frameName, features) => { + debug('window.open', url, frameName, features); + // We need to differentiate if the link should be opened in a popup or in the systems default browser + if (!frameName && !features && typeof features !== 'string') { + return ipcRenderer.sendToHost('new-window', url); + } + + return originalWindowOpen(url, frameName, features); +}; -- cgit v1.2.3-70-g09d2