From 66829d04fe45f9de7d2cdd8104f924643a4d03a8 Mon Sep 17 00:00:00 2001 From: "Brian R. Bondy" Date: Fri, 4 Dec 2015 10:59:44 -0500 Subject: [PATCH] Fix zoom support with preload script --- {js/lib => app/content}/webviewPreload.js | 11 +++++------ js/components/frame.js | 2 +- 2 files changed, 6 insertions(+), 7 deletions(-) rename {js/lib => app/content}/webviewPreload.js (65%) diff --git a/js/lib/webviewPreload.js b/app/content/webviewPreload.js similarity index 65% rename from js/lib/webviewPreload.js rename to app/content/webviewPreload.js index f855cea55e7..c5335616d5b 100644 --- a/js/lib/webviewPreload.js +++ b/app/content/webviewPreload.js @@ -1,26 +1,25 @@ -var electron = require('electron') -var ipc = electron.ipcRenderer -var webFrame = electron.webFrame +var webFrame = require('electron').webFrame +var ipc = require('electron').ipcRenderer var browserZoomLevel = 0 var browserMaxZoom = 9 var browserMinZoom = -8 -ipc.on('zoomIn', function () { +ipc.on('zoom-in', function () { if (browserMaxZoom > browserZoomLevel) { browserZoomLevel += 1 } webFrame.setZoomLevel(browserZoomLevel) }) -ipc.on('zoomOut', function () { +ipc.on('zoom-out', function () { if (browserMinZoom < browserZoomLevel) { browserZoomLevel -= 1 } webFrame.setZoomLevel(browserZoomLevel) }) -ipc.on('zoomReset', function () { +ipc.on('zoom-reset', function () { browserZoomLevel = 0 webFrame.setZoomLevel(browserZoomLevel) }) diff --git a/js/components/frame.js b/js/components/frame.js index 961b81f24f2..63b191e4021 100644 --- a/js/components/frame.js +++ b/js/components/frame.js @@ -126,7 +126,7 @@ class Frame extends ImmutableComponent { + preload='content/webviewPreload.js'/> } }