aboutsummaryrefslogtreecommitdiffstats
path: root/src/webview/contextMenu.js
diff options
context:
space:
mode:
authorLibravatar Stefan Malzner <stefan@adlk.io>2018-12-04 14:54:38 +0100
committerLibravatar Stefan Malzner <stefan@adlk.io>2018-12-04 14:54:38 +0100
commit5c18595d757d7cabf21a54123bf7ed37f1bf3e7f (patch)
tree1180ab8dfc4ef163f23905093914aaa52e39fadc /src/webview/contextMenu.js
parentfeat(Context Menu): Add Lookup, Search Google for (diff)
downloadferdium-app-5c18595d757d7cabf21a54123bf7ed37f1bf3e7f.tar.gz
ferdium-app-5c18595d757d7cabf21a54123bf7ed37f1bf3e7f.tar.zst
ferdium-app-5c18595d757d7cabf21a54123bf7ed37f1bf3e7f.zip
feat(Context Menu): Add "Go Back" and "Go Forward"
Diffstat (limited to 'src/webview/contextMenu.js')
-rw-r--r--src/webview/contextMenu.js27
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