diff options
author | Amine El Mouafik <412895+kytwb@users.noreply.github.com> | 2021-02-08 10:34:45 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-02-08 10:34:45 +0100 |
commit | 035002ceedf78d5ec73eabc0df7f06139939b967 (patch) | |
tree | 1c0d1e9531bae05fb65d70b9ea25baf404b74fe1 /src/webview/contextMenuBuilder.js | |
parent | docs: add k0staa as a contributor (#1193) (diff) | |
download | ferdium-app-035002ceedf78d5ec73eabc0df7f06139939b967.tar.gz ferdium-app-035002ceedf78d5ec73eabc0df7f06139939b967.tar.zst ferdium-app-035002ceedf78d5ec73eabc0df7f06139939b967.zip |
Synchronize with Franz 5.6.0 (#1033)
Co-authored-by: FranzBot <i18n@meetfranz.com>
Co-authored-by: vantezzen <hello@vantezzen.io>
Co-authored-by: Makazzz <makazzzpro@live.ca>
Co-authored-by: Stefan Malzner <stefan@adlk.io>
Co-authored-by: Amine Mouafik <amine@mouafik.fr>
Diffstat (limited to 'src/webview/contextMenuBuilder.js')
-rw-r--r-- | src/webview/contextMenuBuilder.js | 48 |
1 files changed, 24 insertions, 24 deletions
diff --git a/src/webview/contextMenuBuilder.js b/src/webview/contextMenuBuilder.js index 8adc3b432..d99dd6739 100644 --- a/src/webview/contextMenuBuilder.js +++ b/src/webview/contextMenuBuilder.js | |||
@@ -21,19 +21,19 @@ function matchesWord(string) { | |||
21 | } | 21 | } |
22 | 22 | ||
23 | const contextMenuStringTable = { | 23 | const contextMenuStringTable = { |
24 | copyMail: () => 'Copy Email Address', | ||
25 | copyLinkUrl: () => 'Copy Link', | ||
26 | openLinkUrl: () => 'Open Link', | ||
27 | copyImageUrl: () => 'Copy Image URL', | ||
28 | copyImage: () => 'Copy Image', | ||
29 | addToDictionary: () => 'Add to Dictionary', | ||
30 | lookUpDefinition: ({ word }) => `Look Up "${word}"`, | 24 | lookUpDefinition: ({ word }) => `Look Up "${word}"`, |
31 | searchGoogle: () => 'Search with Google', | ||
32 | cut: () => 'Cut', | 25 | cut: () => 'Cut', |
33 | copy: () => 'Copy', | 26 | copy: () => 'Copy', |
34 | paste: () => 'Paste', | 27 | paste: () => 'Paste', |
35 | inspectElement: () => 'Inspect Element', | 28 | searchGoogle: () => 'Search with Google', |
29 | openLinkUrl: () => 'Open Link', | ||
30 | copyLinkUrl: () => 'Copy Link', | ||
31 | copyImageUrl: () => 'Copy Image Address', | ||
32 | copyImage: () => 'Copy Image', | ||
33 | addToDictionary: () => 'Add to Dictionary', | ||
36 | goToHomePage: () => 'Go to Home Page', | 34 | goToHomePage: () => 'Go to Home Page', |
35 | copyMail: () => 'Copy Email Address', | ||
36 | inspectElement: () => 'Inspect Element', | ||
37 | }; | 37 | }; |
38 | 38 | ||
39 | /** | 39 | /** |
@@ -225,13 +225,13 @@ module.exports = class ContextMenuBuilder { | |||
225 | * if so, adds suggested spellings as individual menu items. | 225 | * if so, adds suggested spellings as individual menu items. |
226 | */ | 226 | */ |
227 | addSpellingItems(menu, menuInfo) { | 227 | addSpellingItems(menu, menuInfo) { |
228 | const target = this.getWebContents(); | 228 | const webContents = this.getWebContents(); |
229 | // Add each spelling suggestion | 229 | // Add each spelling suggestion |
230 | for (const suggestion of menuInfo.dictionarySuggestions) { | 230 | for (const suggestion of menuInfo.dictionarySuggestions) { |
231 | menu.append(new MenuItem({ | 231 | menu.append(new MenuItem({ |
232 | label: suggestion, | 232 | label: suggestion, |
233 | // eslint-disable-next-line no-loop-func | 233 | // eslint-disable-next-line no-loop-func |
234 | click: () => target.replaceMisspelling(suggestion), | 234 | click: () => webContents.replaceMisspelling(suggestion), |
235 | })); | 235 | })); |
236 | } | 236 | } |
237 | 237 | ||
@@ -240,7 +240,7 @@ module.exports = class ContextMenuBuilder { | |||
240 | menu.append( | 240 | menu.append( |
241 | new MenuItem({ | 241 | new MenuItem({ |
242 | label: 'Add to dictionary', | 242 | label: 'Add to dictionary', |
243 | click: () => target.session.addWordToSpellCheckerDictionary(menuInfo.misspelledWord), | 243 | click: () => webContents.session.addWordToSpellCheckerDictionary(menuInfo.misspelledWord), |
244 | }), | 244 | }), |
245 | ); | 245 | ); |
246 | } | 246 | } |
@@ -262,11 +262,11 @@ module.exports = class ContextMenuBuilder { | |||
262 | } | 262 | } |
263 | 263 | ||
264 | if (process.platform === 'darwin') { | 264 | if (process.platform === 'darwin') { |
265 | const target = this.getWebContents(); | 265 | const webContents = this.getWebContents(); |
266 | 266 | ||
267 | const lookUpDefinition = new MenuItem({ | 267 | const lookUpDefinition = new MenuItem({ |
268 | label: this.stringTable.lookUpDefinition({ word: menuInfo.selectionText.trim() }), | 268 | label: this.stringTable.lookUpDefinition({ word: menuInfo.selectionText.trim() }), |
269 | click: () => target.showDefinitionForSelection(), | 269 | click: () => webContents.showDefinitionForSelection(), |
270 | }); | 270 | }); |
271 | 271 | ||
272 | menu.append(lookUpDefinition); | 272 | menu.append(lookUpDefinition); |
@@ -316,12 +316,12 @@ module.exports = class ContextMenuBuilder { | |||
316 | * Adds the Cut menu item | 316 | * Adds the Cut menu item |
317 | */ | 317 | */ |
318 | addCut(menu, menuInfo) { | 318 | addCut(menu, menuInfo) { |
319 | const target = this.getWebContents(); | 319 | const webContents = this.getWebContents(); |
320 | menu.append(new MenuItem({ | 320 | menu.append(new MenuItem({ |
321 | label: this.stringTable.cut(), | 321 | label: this.stringTable.cut(), |
322 | accelerator: 'CommandOrControl+X', | 322 | accelerator: 'CommandOrControl+X', |
323 | enabled: menuInfo.editFlags.canCut, | 323 | enabled: menuInfo.editFlags.canCut, |
324 | click: () => target.cut(), | 324 | click: () => webContents.cut(), |
325 | })); | 325 | })); |
326 | 326 | ||
327 | return menu; | 327 | return menu; |
@@ -331,12 +331,12 @@ module.exports = class ContextMenuBuilder { | |||
331 | * Adds the Copy menu item. | 331 | * Adds the Copy menu item. |
332 | */ | 332 | */ |
333 | addCopy(menu, menuInfo) { | 333 | addCopy(menu, menuInfo) { |
334 | const target = this.getWebContents(); | 334 | const webContents = this.getWebContents(); |
335 | menu.append(new MenuItem({ | 335 | menu.append(new MenuItem({ |
336 | label: this.stringTable.copy(), | 336 | label: this.stringTable.copy(), |
337 | accelerator: 'CommandOrControl+C', | 337 | accelerator: 'CommandOrControl+C', |
338 | enabled: menuInfo.editFlags.canCopy, | 338 | enabled: menuInfo.editFlags.canCopy, |
339 | click: () => target.copy(), | 339 | click: () => webContents.copy(), |
340 | })); | 340 | })); |
341 | 341 | ||
342 | return menu; | 342 | return menu; |
@@ -346,12 +346,12 @@ module.exports = class ContextMenuBuilder { | |||
346 | * Adds the Paste menu item. | 346 | * Adds the Paste menu item. |
347 | */ | 347 | */ |
348 | addPaste(menu, menuInfo) { | 348 | addPaste(menu, menuInfo) { |
349 | const target = this.getWebContents(); | 349 | const webContents = this.getWebContents(); |
350 | menu.append(new MenuItem({ | 350 | menu.append(new MenuItem({ |
351 | label: this.stringTable.paste(), | 351 | label: this.stringTable.paste(), |
352 | accelerator: 'CommandOrControl+V', | 352 | accelerator: 'CommandOrControl+V', |
353 | enabled: menuInfo.editFlags.canPaste, | 353 | enabled: menuInfo.editFlags.canPaste, |
354 | click: () => target.paste(), | 354 | click: () => webContents.paste(), |
355 | })); | 355 | })); |
356 | 356 | ||
357 | return menu; | 357 | return menu; |
@@ -363,12 +363,12 @@ module.exports = class ContextMenuBuilder { | |||
363 | && !menuInfo.linkText | 363 | && !menuInfo.linkText |
364 | && !menuInfo.hasImageContents | 364 | && !menuInfo.hasImageContents |
365 | ) { | 365 | ) { |
366 | const target = this.getWebContents(); | 366 | const webContents = this.getWebContents(); |
367 | menu.append( | 367 | menu.append( |
368 | new MenuItem({ | 368 | new MenuItem({ |
369 | label: 'Paste as plain text', | 369 | label: 'Paste as plain text', |
370 | accelerator: 'CommandOrControl+Shift+V', | 370 | accelerator: 'CommandOrControl+Shift+V', |
371 | click: () => target.pasteAndMatchStyle(), | 371 | click: () => webContents.pasteAndMatchStyle(), |
372 | }), | 372 | }), |
373 | ); | 373 | ); |
374 | } | 374 | } |
@@ -386,13 +386,13 @@ module.exports = class ContextMenuBuilder { | |||
386 | * Adds the "Inspect Element" menu item. | 386 | * Adds the "Inspect Element" menu item. |
387 | */ | 387 | */ |
388 | addInspectElement(menu, menuInfo, needsSeparator = true) { | 388 | addInspectElement(menu, menuInfo, needsSeparator = true) { |
389 | const target = this.getWebContents(); | 389 | const webContents = this.getWebContents(); |
390 | if (!this.debugMode) return menu; | 390 | if (!this.debugMode) return menu; |
391 | if (needsSeparator) this.addSeparator(menu); | 391 | if (needsSeparator) this.addSeparator(menu); |
392 | 392 | ||
393 | const inspect = new MenuItem({ | 393 | const inspect = new MenuItem({ |
394 | label: this.stringTable.inspectElement(), | 394 | label: this.stringTable.inspectElement(), |
395 | click: () => target.inspectElement(menuInfo.x, menuInfo.y), | 395 | click: () => webContents.inspectElement(menuInfo.x, menuInfo.y), |
396 | }); | 396 | }); |
397 | 397 | ||
398 | menu.append(inspect); | 398 | menu.append(inspect); |
@@ -436,7 +436,7 @@ module.exports = class ContextMenuBuilder { | |||
436 | accelerator: 'CommandOrControl+Home', | 436 | accelerator: 'CommandOrControl+Home', |
437 | enabled: true, | 437 | enabled: true, |
438 | click: () => { | 438 | click: () => { |
439 | // target.loadURL(baseURL.origin); | 439 | // webContents.loadURL(baseURL.origin); |
440 | window.location.href = baseURL.origin; | 440 | window.location.href = baseURL.origin; |
441 | }, | 441 | }, |
442 | })); | 442 | })); |