diff options
author | 2021-10-14 09:32:20 +0200 | |
---|---|---|
committer | 2021-10-14 13:02:20 +0530 | |
commit | 52211095aab71f8b59b093b19ae34c222be9f390 (patch) | |
tree | 28f24a9be5ee5577667cdd396fb3fc64fc861e65 /src/webview/contextMenu.ts | |
parent | chore: convert class components to functional (#2065) (diff) | |
download | ferdium-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.ts | 29 |
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 @@ | |||
1 | import { getCurrentWebContents } from '@electron/remote'; | ||
2 | import { ContextMenuBuilder } from './contextMenuBuilder'; | ||
3 | |||
4 | const webContents = getCurrentWebContents(); | ||
5 | |||
6 | export 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 | } | ||