File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -27,6 +27,9 @@ const buildMenuTpl = (props, suggestions) => {
2727 const hasText = textSelection . length > 0 ;
2828 const can = type => editFlags [ `can${ type } ` ] && hasText ;
2929
30+ const canGoBack = webContents . canGoBack ( ) ;
31+ const canGoForward = webContents . canGoForward ( ) ;
32+
3033 let menuTpl = [
3134 {
3235 type : 'separator' ,
@@ -165,6 +168,28 @@ const buildMenuTpl = (props, suggestions) => {
165168 } ) ) ;
166169 }
167170
171+ if ( canGoBack || canGoForward ) {
172+ menuTpl . push ( {
173+ type : 'separator' ,
174+ } , {
175+ id : 'goBack' ,
176+ label : 'Go Back' ,
177+ enabled : canGoBack ,
178+ click ( ) {
179+ webContents . goBack ( ) ;
180+ } ,
181+ } , {
182+ id : 'goForward' ,
183+ label : 'Go Forward' ,
184+ enabled : canGoForward ,
185+ click ( ) {
186+ webContents . goForward ( ) ;
187+ } ,
188+ } , {
189+ type : 'separator' ,
190+ } ) ;
191+ }
192+
168193 if ( isDevMode ) {
169194 menuTpl . push ( {
170195 type : 'separator' ,
@@ -174,8 +199,6 @@ const buildMenuTpl = (props, suggestions) => {
174199 click ( ) {
175200 webContents . inspectElement ( props . x , props . y ) ;
176201 } ,
177- } , {
178- type : 'separator' ,
179202 } ) ;
180203 }
181204
You can’t perform that action at this time.
0 commit comments