diff options
-rw-r--r-- | src/webview/contextMenu.js | 27 |
1 files changed, 25 insertions, 2 deletions
diff --git a/src/webview/contextMenu.js b/src/webview/contextMenu.js index ff6d3b21a..ad156128c 100644 --- a/src/webview/contextMenu.js +++ b/src/webview/contextMenu.js | |||
@@ -27,6 +27,9 @@ const buildMenuTpl = (props, suggestions) => { | |||
27 | const hasText = textSelection.length > 0; | 27 | const hasText = textSelection.length > 0; |
28 | const can = type => editFlags[`can${type}`] && hasText; | 28 | const can = type => editFlags[`can${type}`] && hasText; |
29 | 29 | ||
30 | const canGoBack = webContents.canGoBack(); | ||
31 | const canGoForward = webContents.canGoForward(); | ||
32 | |||
30 | let menuTpl = [ | 33 | let menuTpl = [ |
31 | { | 34 | { |
32 | type: 'separator', | 35 | type: 'separator', |
@@ -165,6 +168,28 @@ const buildMenuTpl = (props, suggestions) => { | |||
165 | })); | 168 | })); |
166 | } | 169 | } |
167 | 170 | ||
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 | |||
168 | if (isDevMode) { | 193 | if (isDevMode) { |
169 | menuTpl.push({ | 194 | menuTpl.push({ |
170 | type: 'separator', | 195 | type: 'separator', |
@@ -174,8 +199,6 @@ const buildMenuTpl = (props, suggestions) => { | |||
174 | click() { | 199 | click() { |
175 | webContents.inspectElement(props.x, props.y); | 200 | webContents.inspectElement(props.x, props.y); |
176 | }, | 201 | }, |
177 | }, { | ||
178 | type: 'separator', | ||
179 | }); | 202 | }); |
180 | } | 203 | } |
181 | 204 | ||