diff options
author | 2020-03-02 10:05:58 +0100 | |
---|---|---|
committer | 2020-03-02 10:05:58 +0100 | |
commit | 581663761d44d91bf00a96956823b92d354d2bf1 (patch) | |
tree | 5cf1a189445d1d83aa83418b134d0201beb0354c | |
parent | Add "Open Link in Ferdi" to context menu (diff) | |
download | ferdium-app-581663761d44d91bf00a96956823b92d354d2bf1.tar.gz ferdium-app-581663761d44d91bf00a96956823b92d354d2bf1.tar.zst ferdium-app-581663761d44d91bf00a96956823b92d354d2bf1.zip |
Run linter
-rw-r--r-- | src/lib/Menu.js | 2 | ||||
-rw-r--r-- | src/stores/SettingsStore.js | 7 | ||||
-rw-r--r-- | src/webview/contextMenu.js | 32 |
3 files changed, 23 insertions, 18 deletions
diff --git a/src/lib/Menu.js b/src/lib/Menu.js index 1c4cc6ab5..6d5eb0095 100644 --- a/src/lib/Menu.js +++ b/src/lib/Menu.js | |||
@@ -819,7 +819,7 @@ export default class FranzMenu { | |||
819 | locked: true, | 819 | locked: true, |
820 | }, | 820 | }, |
821 | }); | 821 | }); |
822 | } | 822 | }, |
823 | }); | 823 | }); |
824 | 824 | ||
825 | if (serviceTpl.length > 0) { | 825 | if (serviceTpl.length > 0) { |
diff --git a/src/stores/SettingsStore.js b/src/stores/SettingsStore.js index 26e83b725..71d4e1702 100644 --- a/src/stores/SettingsStore.js +++ b/src/stores/SettingsStore.js | |||
@@ -1,5 +1,7 @@ | |||
1 | import { ipcRenderer, remote } from 'electron'; | 1 | import { ipcRenderer, remote } from 'electron'; |
2 | import { action, computed, observable, reaction } from 'mobx'; | 2 | import { |
3 | action, computed, observable, reaction, | ||
4 | } from 'mobx'; | ||
3 | import localStorage from 'mobx-localstorage'; | 5 | import localStorage from 'mobx-localstorage'; |
4 | import { DEFAULT_APP_SETTINGS, FILE_SYSTEM_SETTINGS_TYPES, LOCAL_SERVER } from '../config'; | 6 | import { DEFAULT_APP_SETTINGS, FILE_SYSTEM_SETTINGS_TYPES, LOCAL_SERVER } from '../config'; |
5 | import { API } from '../environment'; | 7 | import { API } from '../environment'; |
@@ -12,6 +14,7 @@ const debug = require('debug')('Ferdi:SettingsStore'); | |||
12 | 14 | ||
13 | export default class SettingsStore extends Store { | 15 | export default class SettingsStore extends Store { |
14 | @observable updateAppSettingsRequest = new Request(this.api.local, 'updateAppSettings'); | 16 | @observable updateAppSettingsRequest = new Request(this.api.local, 'updateAppSettings'); |
17 | |||
15 | startup = true; | 18 | startup = true; |
16 | 19 | ||
17 | fileSystemSettingsTypes = FILE_SYSTEM_SETTINGS_TYPES; | 20 | fileSystemSettingsTypes = FILE_SYSTEM_SETTINGS_TYPES; |
@@ -103,7 +106,7 @@ export default class SettingsStore extends Store { | |||
103 | // So we lock manually | 106 | // So we lock manually |
104 | window.ferdi.stores.router.push('/auth/locked'); | 107 | window.ferdi.stores.router.push('/auth/locked'); |
105 | } | 108 | } |
106 | }) | 109 | }); |
107 | } | 110 | } |
108 | debug('Get appSettings resolves', resp.type, resp.data); | 111 | debug('Get appSettings resolves', resp.type, resp.data); |
109 | Object.assign(this._fileSystemSettingsCache[resp.type], resp.data); | 112 | Object.assign(this._fileSystemSettingsCache[resp.type], resp.data); |
diff --git a/src/webview/contextMenu.js b/src/webview/contextMenu.js index e77ff2326..eeb825ece 100644 --- a/src/webview/contextMenu.js +++ b/src/webview/contextMenu.js | |||
@@ -1,34 +1,36 @@ | |||
1 | import { remote } from "electron"; | 1 | import { remote } from 'electron'; |
2 | import { ContextMenuBuilder, ContextMenuListener } from "electron-spellchecker"; | 2 | import { ContextMenuBuilder, ContextMenuListener } from 'electron-spellchecker'; |
3 | 3 | ||
4 | const webContents = remote.getCurrentWebContents(); | 4 | const webContents = remote.getCurrentWebContents(); |
5 | 5 | ||
6 | export default async function setupContextMenu(handler) { | 6 | export default async function setupContextMenu(handler) { |
7 | const processMenu = (menu, menuInfo) => { | 7 | const addCustomMenuItems = (menu, menuInfo) => { |
8 | // Add "Paste as plain text" item when right-clicking editable content | ||
8 | if ( | 9 | if ( |
9 | menuInfo.editFlags.canPaste && | 10 | menuInfo.editFlags.canPaste |
10 | !menuInfo.linkText && | 11 | && !menuInfo.linkText |
11 | !menuInfo.hasImageContents | 12 | && !menuInfo.hasImageContents |
12 | ) { | 13 | ) { |
13 | menu.insert( | 14 | menu.insert( |
14 | 3, | 15 | 3, |
15 | new remote.MenuItem({ | 16 | new remote.MenuItem({ |
16 | label: "Paste as plain text", | 17 | label: 'Paste as plain text', |
17 | accelerator: "CommandOrControl+Shift+V", | 18 | accelerator: 'CommandOrControl+Shift+V', |
18 | click: () => webContents.pasteAndMatchStyle() | 19 | click: () => webContents.pasteAndMatchStyle(), |
19 | }) | 20 | }), |
20 | ); | 21 | ); |
21 | } | 22 | } |
22 | 23 | ||
24 | // Add "Open Link in Ferdi" item for links | ||
23 | if (menuInfo.linkURL) { | 25 | if (menuInfo.linkURL) { |
24 | menu.insert( | 26 | menu.insert( |
25 | 2, | 27 | 2, |
26 | new remote.MenuItem({ | 28 | new remote.MenuItem({ |
27 | label: "Open Link in Ferdi", | 29 | label: 'Open Link in Ferdi', |
28 | click: () => { | 30 | click: () => { |
29 | window.location.href = menuInfo.linkURL; | 31 | window.location.href = menuInfo.linkURL; |
30 | } | 32 | }, |
31 | }) | 33 | }), |
32 | ); | 34 | ); |
33 | } | 35 | } |
34 | 36 | ||
@@ -39,10 +41,10 @@ export default async function setupContextMenu(handler) { | |||
39 | handler, | 41 | handler, |
40 | null, | 42 | null, |
41 | true, | 43 | true, |
42 | processMenu | 44 | addCustomMenuItems, |
43 | ); | 45 | ); |
44 | // eslint-disable-next-line no-new | 46 | // eslint-disable-next-line no-new |
45 | new ContextMenuListener(info => { | 47 | new ContextMenuListener((info) => { |
46 | contextMenuBuilder.showPopupMenu(info); | 48 | contextMenuBuilder.showPopupMenu(info); |
47 | }); | 49 | }); |
48 | } | 50 | } |