diff options
author | 2021-08-13 00:45:01 +0530 | |
---|---|---|
committer | 2021-08-13 00:45:01 +0530 | |
commit | 2d27d5e66649d4f5baf127a53ee5ae524eae3a59 (patch) | |
tree | c592ea219ac8cd987fc367f57b54034c450ab2ab /src/webview/find.js | |
parent | Ferdi v5.6.0 (diff) | |
parent | 5.6.1-nightly.24 [skip ci] (diff) | |
download | ferdium-app-2d27d5e66649d4f5baf127a53ee5ae524eae3a59.tar.gz ferdium-app-2d27d5e66649d4f5baf127a53ee5ae524eae3a59.tar.zst ferdium-app-2d27d5e66649d4f5baf127a53ee5ae524eae3a59.zip |
chore: merge from nightly branch into release branch in prep for next beta
Diffstat (limited to 'src/webview/find.js')
-rw-r--r-- | src/webview/find.js | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/webview/find.js b/src/webview/find.js new file mode 100644 index 000000000..040811d68 --- /dev/null +++ b/src/webview/find.js | |||
@@ -0,0 +1,23 @@ | |||
1 | import { ipcRenderer } from 'electron'; | ||
2 | import { FindInPage as ElectronFindInPage } from 'electron-find'; | ||
3 | |||
4 | // Shim to expose webContents functionality to electron-find without @electron/remote | ||
5 | const webContentsShim = { | ||
6 | findInPage: (text, options = {}) => ipcRenderer.sendSync('find-in-page', text, options), | ||
7 | stopFindInPage: (action) => { | ||
8 | ipcRenderer.sendSync('stop-find-in-page', action); | ||
9 | }, | ||
10 | on: (eventName, listener) => { | ||
11 | if (eventName === 'found-in-page') { | ||
12 | ipcRenderer.on('found-in-page', (_, result) => { | ||
13 | listener({ sender: this }, result); | ||
14 | }); | ||
15 | } | ||
16 | }, | ||
17 | }; | ||
18 | |||
19 | export default class FindInPage extends ElectronFindInPage { | ||
20 | constructor(options = {}) { | ||
21 | super(webContentsShim, options); | ||
22 | } | ||
23 | } | ||