File tree 3 files changed +42
-3
lines changed
3 files changed +42
-3
lines changed Original file line number Diff line number Diff line change @@ -9,11 +9,16 @@ module.exports = function(commandId, args={}) {
9
9
createWindow ( args ) ;
10
10
break ;
11
11
case 'refreshWindow' :
12
- const win = BrowserWindow . getFocusedWindow ( ) ;
13
- win . webContents . send ( 'web:refresh' ) ;
14
- break ;
12
+ BrowserWindow . getFocusedWindow ( ) . webContents . send ( 'web:refresh' ) ;
13
+ break ;
15
14
case 'learnMore' :
16
15
shell . openExternal ( 'https://hackmd.io' ) ;
16
+ break ;
17
+ case 'goForward' :
18
+ BrowserWindow . getFocusedWindow ( ) . webContents . send ( 'web:go-forward' ) ;
19
+ break ;
20
+ case 'goBack' :
21
+ BrowserWindow . getFocusedWindow ( ) . webContents . send ( 'web:go-back' ) ;
17
22
break ;
18
23
default :
19
24
break ;
Original file line number Diff line number Diff line change @@ -69,6 +69,25 @@ const template = [
69
69
}
70
70
]
71
71
} ,
72
+ {
73
+ label : 'History' ,
74
+ submenu : [
75
+ {
76
+ label : 'Forward' ,
77
+ accelerator : 'CmdOrCtrl+]' ,
78
+ click ( ) {
79
+ exec ( 'goForward' ) ;
80
+ }
81
+ } ,
82
+ {
83
+ label : 'Back' ,
84
+ accelerator : 'CmdOrCtrl+[' ,
85
+ click ( ) {
86
+ exec ( 'goBack' ) ;
87
+ }
88
+ } ,
89
+ ]
90
+ } ,
72
91
{
73
92
role : 'window' ,
74
93
submenu : [
@@ -78,6 +97,9 @@ const template = [
78
97
{
79
98
role : 'close'
80
99
} ,
100
+ {
101
+ type : 'separator'
102
+ } ,
81
103
{
82
104
label : 'Refresh' ,
83
105
accelerator : 'CmdOrCtrl+R' ,
Original file line number Diff line number Diff line change @@ -102,6 +102,18 @@ onload = () => {
102
102
webview . loadURL ( webview . getURL ( ) ) ;
103
103
} ) ;
104
104
105
+ ipcRenderer . on ( 'web:go-foward' , ( event ) => {
106
+ if ( webview . canGoForward ( ) ) {
107
+ webview . goForward ( ) ;
108
+ }
109
+ } )
110
+
111
+ ipcRenderer . on ( 'web:go-back' , ( event ) => {
112
+ if ( webview . canGoBack ( ) ) {
113
+ webview . goBack ( ) ;
114
+ }
115
+ } )
116
+
105
117
ipcRenderer . on ( 'enter-full-screen' , ( ) => {
106
118
document . querySelector ( 'navbar' ) . style . display = 'none' ;
107
119
} )
You can’t perform that action at this time.
0 commit comments