Commit 903ae57ad0b262c3a6121da6deca07aad6f1ab66
Merge branch 'keyboard-shortcuts--back' of https://github.com/mrchrisadams/patchwork into mrchrisadams-keyboard-shortcuts--back
Matt McKegg committed on 5/14/2018, 12:48:11 AMParent: c173c2b41b860fbb9c38b6c51a466f9652d0461f
Parent: b6ad2e7692f72c980a5ef0564f60b049333a9e1e
Files changed
index.js | changed |
main-window.js | changed |
modules/page/html/render/gatherings.js | changed |
modules/page/html/render/public.js | changed |
index.js | |||
---|---|---|---|
@@ -44,9 +44,31 @@ | |||
44 | 44 … | electron.app.on('ready', () => { | |
45 | 45 … | setupContext('ssb', { | |
46 | 46 … | server: !(process.argv.includes('-g') || process.argv.includes('--use-global-ssb')) | |
47 | 47 … | }, () => { | |
48 … | + var browserWindow = openMainWindow() | ||
48 | 49 … | var menu = defaultMenu(electron.app, electron.shell) | |
50 … | + | ||
51 … | + menu.splice(4, 0, { | ||
52 … | + label: 'History', | ||
53 … | + submenu: [ | ||
54 … | + { | ||
55 … | + label: 'Forward', | ||
56 … | + accelerator: 'CmdOrCtrl+]', | ||
57 … | + click: () => { | ||
58 … | + browserWindow.webContents.send('goForward') | ||
59 … | + } | ||
60 … | + }, | ||
61 … | + { | ||
62 … | + label: 'Back', | ||
63 … | + accelerator: 'CmdOrCtrl+[', | ||
64 … | + click: () => { | ||
65 … | + browserWindow.webContents.send('goBack') | ||
66 … | + } | ||
67 … | + } | ||
68 … | + ] | ||
69 … | + }) | ||
70 … | + | ||
49 | 71 … | var view = menu.find(x => x.label === 'View') | |
50 | 72 … | view.submenu = [ | |
51 | 73 … | { role: 'reload' }, | |
52 | 74 … | { role: 'toggledevtools' }, | |
@@ -73,10 +95,10 @@ | |||
73 | 95 … | { type: 'separator' }, | |
74 | 96 … | { role: 'front' } | |
75 | 97 … | ] | |
76 | 98 … | } | |
99 … | + | ||
77 | 100 … | Menu.setApplicationMenu(Menu.buildFromTemplate(menu)) | |
78 | - openMainWindow() | ||
79 | 101 … | }) | |
80 | 102 … | ||
81 | 103 … | electron.app.on('activate', function (e) { | |
82 | 104 … | if (windows.main) { | |
@@ -126,8 +148,9 @@ | |||
126 | 148 … | windows.main = null | |
127 | 149 … | if (process.platform !== 'darwin') electron.app.quit() | |
128 | 150 … | }) | |
129 | 151 … | } | |
152 … | + return windows.main | ||
130 | 153 … | } | |
131 | 154 … | ||
132 | 155 … | function setupContext (appName, opts, cb) { | |
133 | 156 … | ssbConfig = require('ssb-config/inject')(appName, extend({ |
main-window.js | ||
---|---|---|
@@ -72,8 +72,11 @@ | ||
72 | 72 … | watch(pendingCount, count => { |
73 | 73 … | electron.remote.app.setBadgeCount(count) |
74 | 74 … | }) |
75 | 75 … | |
76 … | + electron.ipcRenderer.on('goForward', views.goForward) | |
77 … | + electron.ipcRenderer.on('goBack', views.goBack) | |
78 … | + | |
76 | 79 … | document.head.appendChild( |
77 | 80 … | h('style', { |
78 | 81 … | innerHTML: computed(api.settings.obs.get('patchwork.theme', 'light'), themeName => { |
79 | 82 … | return themes[themeName] || themes['light'] |
@@ -146,9 +149,8 @@ | ||
146 | 149 … | } else { |
147 | 150 … | api.app.navigate(href) |
148 | 151 … | } |
149 | 152 … | }) |
150 | - | |
151 | 153 … | return [container, previewElement] |
152 | 154 … | |
153 | 155 … | // scoped |
154 | 156 … |
Built with git-ssb-web