diff options
author | 2020-03-09 19:29:44 +0100 | |
---|---|---|
committer | 2020-03-09 19:29:44 +0100 | |
commit | 64071db3351ab50fc6f457c38a425a52847eed4d (patch) | |
tree | 2512b1d81014c7f431138a5dfeebe88b178ddfc4 /src/lib | |
parent | docs: add n0emis as a contributor (#449) (diff) | |
download | ferdium-app-64071db3351ab50fc6f457c38a425a52847eed4d.tar.gz ferdium-app-64071db3351ab50fc6f457c38a425a52847eed4d.tar.zst ferdium-app-64071db3351ab50fc6f457c38a425a52847eed4d.zip |
Add "Find in Page" feature (#446)
* Add "Find in Page" feature
* Add custom theme to overlay
* Fix lint
Diffstat (limited to 'src/lib')
-rw-r--r-- | src/lib/Menu.js | 48 |
1 files changed, 47 insertions, 1 deletions
diff --git a/src/lib/Menu.js b/src/lib/Menu.js index 957621f94..4547e84f9 100644 --- a/src/lib/Menu.js +++ b/src/lib/Menu.js | |||
@@ -51,6 +51,10 @@ const menuItems = defineMessages({ | |||
51 | id: 'menu.edit.selectAll', | 51 | id: 'menu.edit.selectAll', |
52 | defaultMessage: '!!!Select All', | 52 | defaultMessage: '!!!Select All', |
53 | }, | 53 | }, |
54 | findInPage: { | ||
55 | id: 'menu.edit.findInPage', | ||
56 | defaultMessage: '!!!Find in Page', | ||
57 | }, | ||
54 | speech: { | 58 | speech: { |
55 | id: 'menu.edit.speech', | 59 | id: 'menu.edit.speech', |
56 | defaultMessage: '!!!Speech', | 60 | defaultMessage: '!!!Speech', |
@@ -376,6 +380,27 @@ const _templateFactory = (intl, locked) => [ | |||
376 | type: 'separator', | 380 | type: 'separator', |
377 | }, | 381 | }, |
378 | { | 382 | { |
383 | label: intl.formatMessage(menuItems.findInPage), | ||
384 | accelerator: 'CmdOrCtrl+F', | ||
385 | click() { | ||
386 | // Check if there is a service active | ||
387 | if (!window.ferdi.stores.services.active) return; | ||
388 | |||
389 | // Focus webview so find in page popup gets focused | ||
390 | window.ferdi.stores.services.active.webview.focus(); | ||
391 | |||
392 | const currentService = window.ferdi.stores.services.active.id; | ||
393 | window.ferdi.actions.service.sendIPCMessage({ | ||
394 | serviceId: currentService, | ||
395 | channel: 'find-in-page', | ||
396 | args: {}, | ||
397 | }); | ||
398 | }, | ||
399 | }, | ||
400 | { | ||
401 | type: 'separator', | ||
402 | }, | ||
403 | { | ||
379 | label: intl.formatMessage(menuItems.back), | 404 | label: intl.formatMessage(menuItems.back), |
380 | accelerator: 'CmdOrCtrl+Left', | 405 | accelerator: 'CmdOrCtrl+Left', |
381 | click() { | 406 | click() { |
@@ -584,6 +609,27 @@ const _titleBarTemplateFactory = (intl, locked) => [ | |||
584 | type: 'separator', | 609 | type: 'separator', |
585 | }, | 610 | }, |
586 | { | 611 | { |
612 | label: intl.formatMessage(menuItems.findInPage), | ||
613 | accelerator: 'CmdOrCtrl+F', | ||
614 | click() { | ||
615 | // Check if there is a service active | ||
616 | if (!window.ferdi.stores.services.active) return; | ||
617 | |||
618 | // Focus webview so find in page popup gets focused | ||
619 | window.ferdi.stores.services.active.webview.focus(); | ||
620 | |||
621 | const currentService = window.ferdi.stores.services.active.id; | ||
622 | window.ferdi.actions.service.sendIPCMessage({ | ||
623 | serviceId: currentService, | ||
624 | channel: 'find-in-page', | ||
625 | args: {}, | ||
626 | }); | ||
627 | }, | ||
628 | }, | ||
629 | { | ||
630 | type: 'separator', | ||
631 | }, | ||
632 | { | ||
587 | label: intl.formatMessage(menuItems.back), | 633 | label: intl.formatMessage(menuItems.back), |
588 | accelerator: 'CmdOrCtrl+Left', | 634 | accelerator: 'CmdOrCtrl+Left', |
589 | click() { | 635 | click() { |
@@ -861,7 +907,7 @@ export default class FranzMenu { | |||
861 | }, | 907 | }, |
862 | }, { | 908 | }, { |
863 | type: 'separator', | 909 | type: 'separator', |
864 | visible: touchIdEnabled | 910 | visible: touchIdEnabled, |
865 | }); | 911 | }); |
866 | } | 912 | } |
867 | 913 | ||