From 9557ca14bff558f3a2b0b0693d2231490fa98a51 Mon Sep 17 00:00:00 2001 From: Kolja Lampe Date: Thu, 11 Aug 2016 20:58:32 +0200 Subject: [PATCH] Use default electron implementation for zoomin, zoomout and resetzoom See: https://github.com/electron/electron/pull/6777 --- src/browser/index.jsx | 19 ------------------- src/main/menus/app.js | 22 ++++------------------ 2 files changed, 4 insertions(+), 37 deletions(-) diff --git a/src/browser/index.jsx b/src/browser/index.jsx index bd1d618751c..2428d97a2f2 100644 --- a/src/browser/index.jsx +++ b/src/browser/index.jsx @@ -386,9 +386,6 @@ var MattermostView = React.createClass({ webview.addEventListener("dom-ready", function() { // webview.openDevTools(); - // In order to apply the zoom level to webview. - webFrame.setZoomLevel(parseInt(localStorage.getItem('zoomLevel'))); - // Use 'Meiryo UI' and 'MS Gothic' to prevent CJK fonts on Windows(JP). if (process.platform === 'win32') { var applyCssFile = function(cssFile) { @@ -662,22 +659,6 @@ var showUnreadBadge = function(unreadCount, mentionCount) { } } -if (!localStorage.getItem('zoomLevel')) { - localStorage.setItem('zoomLevel', 0); -} -webFrame.setZoomLevel(parseInt(localStorage.getItem('zoomLevel'))); - -ipcRenderer.on('zoom-in', (event, increment) => { - const zoomLevel = webFrame.getZoomLevel() + increment - webFrame.setZoomLevel(zoomLevel); - localStorage.setItem('zoomLevel', zoomLevel); -}); - -ipcRenderer.on('zoom-reset', (event) => { - webFrame.setZoomLevel(0); - localStorage.setItem('zoomLevel', 0); -}); - ReactDOM.render( , document.getElementById('content') diff --git a/src/main/menus/app.js b/src/main/menus/app.js index 5fd9c304cd1..7bf7fb6b813 100644 --- a/src/main/menus/app.js +++ b/src/main/menus/app.js @@ -112,30 +112,16 @@ var createTemplate = function(mainWindow, config) { }, { role: 'togglefullscreen' }, separatorItem, { - label: 'Actual Size', - accelerator: 'CmdOrCtrl+0', - click: () => { - mainWindow.webContents.send('zoom-reset'); - } + role: 'resetzoom' }, { - label: 'Zoom In', - accelerator: 'CmdOrCtrl+Plus', - click: () => { - mainWindow.webContents.send('zoom-in', 1); - } + role: 'zoomin' }, { label: 'Zoom In (hidden)', accelerator: 'CmdOrCtrl+=', visible: false, - click: () => { - mainWindow.webContents.send('zoom-in', 1); - } + role: 'zoomin' }, { - label: 'Zoom Out', - accelerator: 'CmdOrCtrl+-', - click: () => { - mainWindow.webContents.send('zoom-in', -1); - } + role: 'zoomout' }, separatorItem, { label: 'Toggle Developer Tools', accelerator: (function() {