From a564a35bcf9bcfedd6dc7bc60ce2c115badd6985 Mon Sep 17 00:00:00 2001 From: Stefan Malzner Date: Wed, 2 Oct 2019 21:39:03 +0200 Subject: Use native window.open --- src/webview/recipe.js | 12 ------------ 1 file changed, 12 deletions(-) (limited to 'src/webview/recipe.js') diff --git a/src/webview/recipe.js b/src/webview/recipe.js index c223b73de..7be307f05 100644 --- a/src/webview/recipe.js +++ b/src/webview/recipe.js @@ -169,15 +169,3 @@ class RecipeController { /* eslint-disable no-new */ new RecipeController(); /* eslint-enable no-new */ - -// Patching window.open -const originalWindowOpen = window.open; - -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) { - return ipcRenderer.sendToHost('new-window', url); - } - - return originalWindowOpen(url, frameName, features); -}; -- cgit v1.2.3-54-g00ecf 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/recipe.js') 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-54-g00ecf From faecce7f35b566e50224804108621ae6db4739ab Mon Sep 17 00:00:00 2001 From: Stefan Malzner Date: Thu, 3 Oct 2019 13:51:16 +0200 Subject: Add `window.log` for easier logging in event mode --- src/webview/recipe.js | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/webview/recipe.js') diff --git a/src/webview/recipe.js b/src/webview/recipe.js index e1ff44f05..353eb31fd 100644 --- a/src/webview/recipe.js +++ b/src/webview/recipe.js @@ -184,3 +184,7 @@ window.open = (url, frameName, features) => { return originalWindowOpen(url, frameName, features); }; + +if (isDevMode) { + window.log = console.log; +} -- cgit v1.2.3-54-g00ecf