summaryrefslogtreecommitdiffstats
path: root/src/webview/contextMenu.ts
diff options
context:
space:
mode:
authorLibravatar Markus Hatvan <markus_hatvan@aon.at>2021-10-14 09:32:20 +0200
committerLibravatar GitHub <noreply@github.com>2021-10-14 13:02:20 +0530
commit52211095aab71f8b59b093b19ae34c222be9f390 (patch)
tree28f24a9be5ee5577667cdd396fb3fc64fc861e65 /src/webview/contextMenu.ts
parentchore: convert class components to functional (#2065) (diff)
downloadferdium-app-52211095aab71f8b59b093b19ae34c222be9f390.tar.gz
ferdium-app-52211095aab71f8b59b093b19ae34c222be9f390.tar.zst
ferdium-app-52211095aab71f8b59b093b19ae34c222be9f390.zip
chore: convert various JS to TS (#2062)
Diffstat (limited to 'src/webview/contextMenu.ts')
-rw-r--r--src/webview/contextMenu.ts29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/webview/contextMenu.ts b/src/webview/contextMenu.ts
new file mode 100644
index 000000000..72f927ef4
--- /dev/null
+++ b/src/webview/contextMenu.ts
@@ -0,0 +1,29 @@
1import { getCurrentWebContents } from '@electron/remote';
2import { ContextMenuBuilder } from './contextMenuBuilder';
3
4const webContents = getCurrentWebContents();
5
6export default async function setupContextMenu(
7 isSpellcheckEnabled: () => void,
8 getDefaultSpellcheckerLanguage: () => void,
9 getSpellcheckerLanguage: () => void,
10 getSearchEngine: () => void,
11 getClipboardNotifications: () => void,
12) {
13 const contextMenuBuilder = new ContextMenuBuilder(webContents);
14
15 webContents.on('context-menu', (_e, props) => {
16 // TODO?: e.preventDefault();
17 contextMenuBuilder.showPopupMenu(
18 {
19 ...props,
20 searchEngine: getSearchEngine(),
21 clipboardNotifications: getClipboardNotifications(),
22 },
23 // @ts-expect-error Expected 1 arguments, but got 4.
24 isSpellcheckEnabled(),
25 getDefaultSpellcheckerLanguage(),
26 getSpellcheckerLanguage(),
27 );
28 });
29}