diff options
author | 2020-06-15 15:04:34 +0000 | |
---|---|---|
committer | 2020-06-15 20:34:34 +0530 | |
commit | ee8281730e0847530cb3c5db21bedb1301b6f7eb (patch) | |
tree | 5d8867748f2e7752702eebad0198b2537c6463b5 /src/index.js | |
parent | Update global user agent to conform with spec (#779) (diff) | |
download | ferdium-app-ee8281730e0847530cb3c5db21bedb1301b6f7eb.tar.gz ferdium-app-ee8281730e0847530cb3c5db21bedb1301b6f7eb.tar.zst ferdium-app-ee8281730e0847530cb3c5db21bedb1301b6f7eb.zip |
Open Documents inside Ferdi instead of external browser (#787)
* Bump version number
* no message
* Revert "no message"
This reverts commit 060f3084460d07e3b08394cd7703611f28095ea9.
* fix: Documents opened in Google drive should open inside Ferdi as a new BrowserWindow
- modify 'new-window' listener of service webview in Service.js to open links in external browser only when event.disposition != 'foreground-tab'. If event.disposition === 'foreground-tab' send an ipc-message to main to open the link inside Ferdi as a new Browser window
- Listen to 'open-browser-window' in index.js (main process) and check for event disposition
- create a child BrowserWindow with the main Ferdi window as parent
- Copy session information from the appropriate service (here google drive)
- Load the URL that was sent from the service renderer.
* Update src/index.js
refactor: Remove extra spaces in index.js
Co-authored-by: Sampath Kumar Krishnan <sampathBlam@users.noreply.github.com>
Co-authored-by: Amine Mouafik <amine@mouafik.fr>
Co-authored-by: vantezzen <hello@vantezzen.io>
Co-authored-by: Sampath Kumar Krishnan <sampathBlam@users.noreply.github.com>
Diffstat (limited to 'src/index.js')
-rw-r--r-- | src/index.js | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/index.js b/src/index.js index 9dfbb4d8f..dac8ec770 100644 --- a/src/index.js +++ b/src/index.js | |||
@@ -332,7 +332,7 @@ const createWindow = () => { | |||
332 | e.preventDefault(); | 332 | e.preventDefault(); |
333 | 333 | ||
334 | if (isValidExternalURL(url)) { | 334 | if (isValidExternalURL(url)) { |
335 | shell.openExternal(url); | 335 | shell.openExternal(url); |
336 | } | 336 | } |
337 | }); | 337 | }); |
338 | 338 | ||
@@ -411,6 +411,15 @@ ipcMain.on('feature-basic-auth-credentials', (e, { user, password }) => { | |||
411 | authCallback = noop; | 411 | authCallback = noop; |
412 | }); | 412 | }); |
413 | 413 | ||
414 | ipcMain.on('open-browser-window', (e, {disposition, url}, serviceId) => { | ||
415 | if (disposition === 'foreground-tab') { | ||
416 | let serviceSession = session.fromPartition(`persist:service-${serviceId}`) | ||
417 | let child = new BrowserWindow({ parent: mainWindow, webPreferences: {session: serviceSession}}); | ||
418 | child.show(); | ||
419 | child.loadURL(url); | ||
420 | } | ||
421 | debug('Received open-browser-window', disposition, url); | ||
422 | }); | ||
414 | 423 | ||
415 | ipcMain.on('modifyRequestHeaders', (e, { modifiedRequestHeaders, serviceId }) => { | 424 | ipcMain.on('modifyRequestHeaders', (e, { modifiedRequestHeaders, serviceId }) => { |
416 | debug('Received modifyRequestHeaders', modifiedRequestHeaders, serviceId); | 425 | debug('Received modifyRequestHeaders', modifiedRequestHeaders, serviceId); |