aboutsummaryrefslogtreecommitdiffstats
path: root/src/webview/find.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/webview/find.js')
-rw-r--r--src/webview/find.js23
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 @@
1import { ipcRenderer } from 'electron';
2import { FindInPage as ElectronFindInPage } from 'electron-find';
3
4// Shim to expose webContents functionality to electron-find without @electron/remote
5const 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
19export default class FindInPage extends ElectronFindInPage {
20 constructor(options = {}) {
21 super(webContentsShim, options);
22 }
23}