Skip to content

Commit

Permalink
Closes RocketChat#120; Add zoom options
Browse files Browse the repository at this point in the history
  • Loading branch information
rodrigok committed Mar 5, 2016
1 parent 6508a1c commit e36a1d7
Showing 1 changed file with 83 additions and 22 deletions.
105 changes: 83 additions & 22 deletions app/scripts/menus.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { remote } from 'electron';
import { servers } from './servers';
import { sidebar } from './sidebar';
import { webview } from './webview';
import webFrame from 'web-frame';
import config from './config';
import '../branding/branding.js';

Expand Down Expand Up @@ -105,26 +106,37 @@ if (process.platform === 'darwin') {
label: 'View',
submenu: [
{
label: 'Reload current server',
accelerator: 'Command+R',
label: 'Original Zoom',
accelerator: 'Command+0',
click: function() {
const activeWebview = webview.getActive();
if (activeWebview) {
activeWebview.reload();
}
webFrame.setZoomLevel(0);
}
},
{
label: 'Reload application',
accelerator: 'Command+Shift+R',
label: 'Zoom In',
accelerator: 'Command+=',
click: function() {
remote.getCurrentWindow().reload();
webFrame.setZoomLevel(webFrame.getZoomLevel()+1);
}
},
{
label: 'Toggle server list',
label: 'Zoom Out',
accelerator: 'Command+-',
click: function() {
sidebar.toggle();
webFrame.setZoomLevel(webFrame.getZoomLevel()-1);
}
},
{
type: 'separator'
},
{
label: 'Reload - current server',
accelerator: 'Command+R',
click: function() {
const activeWebview = webview.getActive();
if (activeWebview) {
activeWebview.reload();
}
}
},
{
Expand All @@ -137,11 +149,30 @@ if (process.platform === 'darwin') {
}
}
},
{
type: 'separator'
},
{
label: 'Reload - application',
accelerator: 'Command+Shift+R',
click: function() {
remote.getCurrentWindow().reload();
}
},
{
label: 'Toggle DevTools - application',
click: function() {
remote.getCurrentWindow().toggleDevTools();
}
},
{
type: 'separator'
},
{
label: 'Toggle server list',
click: function() {
sidebar.toggle();
}
}
]
},
Expand Down Expand Up @@ -237,26 +268,37 @@ if (process.platform === 'darwin') {
label: 'View',
submenu: [
{
label: 'Reload current server',
accelerator: 'Ctrl+R',
label: 'Original Zoom',
accelerator: 'Command+0',
click: function() {
const activeWebview = webview.getActive();
if (activeWebview) {
activeWebview.reload();
}
webFrame.setZoomLevel(0);
}
},
{
label: 'Reload application',
accelerator: 'Ctrl+Shift+R',
label: 'Zoom In',
accelerator: 'Command+=',
click: function() {
remote.getCurrentWindow().reload();
webFrame.setZoomLevel(webFrame.getZoomLevel()+1);
}
},
{
label: 'Toggle server list',
label: 'Zoom Out',
accelerator: 'Command+-',
click: function() {
sidebar.toggle();
webFrame.setZoomLevel(webFrame.getZoomLevel()-1);
}
},
{
type: 'separator'
},
{
label: 'Reload - current server',
accelerator: 'Ctrl+R',
click: function() {
const activeWebview = webview.getActive();
if (activeWebview) {
activeWebview.reload();
}
}
},
{
Expand All @@ -269,11 +311,30 @@ if (process.platform === 'darwin') {
}
}
},
{
type: 'separator'
},
{
label: 'Reload - application',
accelerator: 'Ctrl+Shift+R',
click: function() {
remote.getCurrentWindow().reload();
}
},
{
label: 'Toggle DevTools - application',
click: function() {
remote.getCurrentWindow().toggleDevTools();
}
},
{
type: 'separator'
},
{
label: 'Toggle server list',
click: function() {
sidebar.toggle();
}
}
]
},
Expand Down

0 comments on commit e36a1d7

Please sign in to comment.