TagSpaces is an offline, open source, document manager with tagging support
TSN516 - Migrate away from using remoteModule in Electron (#1475)
Stanimir6b86bb81741f
diff --git a/app/components/HelpFeedbackPanel.tsx b/app/components/HelpFeedbackPanel.tsxindex e371c2489..02e708b51 100644--- a/app/components/HelpFeedbackPanel.tsx+++ b/app/components/HelpFeedbackPanel.tsx@@ -53,11 +53,11 @@ import { bindActionCreators } from 'redux';import CustomLogo from './CustomLogo';import ProTeaser from '../assets/images/spacerocket_undraw.svg';import styles from './SidePanels.css';-import AppConfig from '../config';import i18n from '../services/i18n';import { clearAllURLParams } from '-/utils/misc';import { Pro } from '-/pro';import { actions as AppActions } from '-/reducers/app';+import Links from '-/links';interface Props {classes?: any;@@ -247,7 +247,7 @@ const HelpFeedbackPanel = (props: Props) => {<ListItembuttononClick={() =>- openURLExternally(AppConfig.documentationLinks.general, true)+ openURLExternally(Links.documentationLinks.general, true)}><ListItemIcon>@@ -267,9 +267,7 @@ const HelpFeedbackPanel = (props: Props) => {</ListItem><ListItembutton- onClick={() =>- openURLExternally(AppConfig.links.changelogURL, true)- }+ onClick={() => openURLExternally(Links.links.changelogURL, true)}title="Opens the changelog of the app"><ListItemIcon>@@ -289,7 +287,7 @@ const HelpFeedbackPanel = (props: Props) => {</ListItem><ListItembutton- onClick={() => openURLExternally(AppConfig.links.webClipper, true)}+ onClick={() => openURLExternally(Links.links.webClipper, true)}><ListItemIcon><WebClipperIcon />@@ -301,9 +299,7 @@ const HelpFeedbackPanel = (props: Props) => {<Divider /><ListItembutton- onClick={() =>- openURLExternally(AppConfig.links.suggestFeature, true)- }+ onClick={() => openURLExternally(Links.links.suggestFeature, true)}><ListItemIcon><NewFeatureIcon />@@ -314,7 +310,7 @@ const HelpFeedbackPanel = (props: Props) => {</ListItem><ListItembutton- onClick={() => openURLExternally(AppConfig.links.reportIssue, true)}+ onClick={() => openURLExternally(Links.links.reportIssue, true)}><ListItemIcon><IssueIcon />@@ -325,9 +321,7 @@ const HelpFeedbackPanel = (props: Props) => {</ListItem><ListItembutton- onClick={() =>- openURLExternally(AppConfig.links.helpTranslating, true)- }+ onClick={() => openURLExternally(Links.links.helpTranslating, true)}><ListItemIcon><TranslationIcon />@@ -339,9 +333,7 @@ const HelpFeedbackPanel = (props: Props) => {<Divider /><ListItembutton- onClick={() =>- openURLExternally(AppConfig.links.emailContact, true)- }+ onClick={() => openURLExternally(Links.links.emailContact, true)}><ListItemIcon><EmailIcon />@@ -352,7 +344,7 @@ const HelpFeedbackPanel = (props: Props) => {</ListItem><ListItembutton- onClick={() => openURLExternally(AppConfig.links.twitter)}+ onClick={() => openURLExternally(Links.links.twitter)}><ListItemIcon><Social2Icon />@@ -363,7 +355,7 @@ const HelpFeedbackPanel = (props: Props) => {</ListItem><ListItembutton- onClick={() => openURLExternally(AppConfig.links.facebook)}+ onClick={() => openURLExternally(Links.links.facebook)}><ListItemIcon><SocialIcon />@@ -433,7 +425,7 @@ const HelpFeedbackPanel = (props: Props) => {onClick={(event: any) => {event.preventDefault();event.stopPropagation();- openURLExternally(AppConfig.links.productsOverview, true);+ openURLExternally(Links.links.productsOverview, true);}}>Get Itdiff --git a/app/components/WelcomePanel.tsx b/app/components/WelcomePanel.tsxindex ad8038c47..6d72f6728 100644--- a/app/components/WelcomePanel.tsx+++ b/app/components/WelcomePanel.tsx@@ -44,7 +44,7 @@ import {getDesktopMode,actions as SettingsActions} from '../reducers/settings';-import AppConfig from '../config';+import Links from '../links';const styles: any = (theme: any) => ({mainPanel: {@@ -116,7 +116,7 @@ const WelcomePanel = (props: Props) => {<ListItembuttononClick={() =>- openURLExternally(AppConfig.documentationLinks.general, true)+ openURLExternally(Links.documentationLinks.general, true)}><Button startIcon={<DocumentationIcon />}>Open Documentation</Button>@@ -128,7 +128,7 @@ const WelcomePanel = (props: Props) => {</ListItem><ListItembutton- onClick={() => openURLExternally(AppConfig.links.changelogURL, true)}+ onClick={() => openURLExternally(Links.links.changelogURL, true)}><ButtonstartIcon={<ChangeLogIcon />}@@ -139,7 +139,7 @@ const WelcomePanel = (props: Props) => {</ListItem><ListItembutton- onClick={() => openURLExternally(AppConfig.links.webClipper, true)}+ onClick={() => openURLExternally(Links.links.webClipper, true)}><Button startIcon={<WebClipperIcon />}>{i18n.t('core:webClipper')}@@ -148,9 +148,7 @@ const WelcomePanel = (props: Props) => {<Divider /><ListItembutton- onClick={() =>- openURLExternally(AppConfig.links.suggestFeature, true)- }+ onClick={() => openURLExternally(Links.links.suggestFeature, true)}><Button startIcon={<NewFeatureIcon />}>{i18n.t('core:suggestNewFeatures')}@@ -158,7 +156,7 @@ const WelcomePanel = (props: Props) => {</ListItem><ListItembutton- onClick={() => openURLExternally(AppConfig.links.reportIssue, true)}+ onClick={() => openURLExternally(Links.links.reportIssue, true)}><Button startIcon={<IssueIcon />}>{i18n.t('core:reportIssues')}@@ -166,7 +164,7 @@ const WelcomePanel = (props: Props) => {</ListItem><ListItembutton- onClick={() => openURLExternally(AppConfig.links.helpTranslating)}+ onClick={() => openURLExternally(Links.links.helpTranslating)}><Button startIcon={<TranslationIcon />}>{i18n.t('core:helpWithTranslation')}@@ -175,23 +173,20 @@ const WelcomePanel = (props: Props) => {<Divider /><ListItembutton- onClick={() => openURLExternally(AppConfig.links.emailContact, true)}+ onClick={() => openURLExternally(Links.links.emailContact, true)}><Button startIcon={<EmailIcon />}>{i18n.t('core:emailContact')}</Button></ListItem>- <ListItem- button- onClick={() => openURLExternally(AppConfig.links.twitter)}- >+ <ListItem button onClick={() => openURLExternally(Links.links.twitter)}><Button startIcon={<Social2Icon />}>{i18n.t('core:followOnTwitter')}</Button></ListItem><ListItembutton- onClick={() => openURLExternally(AppConfig.links.facebook)}+ onClick={() => openURLExternally(Links.links.facebook)}><Button startIcon={<SocialIcon />}>{i18n.t('core:likeUsOnFacebook')}diff --git a/app/components/dialogs/AboutDialog.tsx b/app/components/dialogs/AboutDialog.tsxindex 93e1baa1e..c146766cb 100644--- a/app/components/dialogs/AboutDialog.tsx+++ b/app/components/dialogs/AboutDialog.tsx@@ -31,8 +31,8 @@ import i18n from '-/services/i18n';import versionMeta from '-/version.json';import { Pro } from '-/pro';import { getLastVersionPromise } from '-/reducers/settings';-import AppConfig from '-/config';import DialogCloseButton from '-/components/dialogs/DialogCloseButton';+import Links from '-/links';interface Props {open: boolean;@@ -58,7 +58,7 @@ const AboutDialog = (props: Props) => {function checkForUpdates() {if (updateAvailable) {- props.openURLExternally(AppConfig.links.downloadURL, true);+ props.openURLExternally(Links.links.downloadURL, true);} else {getLastVersionPromise().then(lastVersion => {@@ -163,7 +163,7 @@ const AboutDialog = (props: Props) => {size="small"color="primary"onClick={() => {- props.openURLExternally(AppConfig.links.imprintURL, true);+ props.openURLExternally(Links.links.imprintURL, true);}}>Imprint@@ -172,7 +172,7 @@ const AboutDialog = (props: Props) => {size="small"color="primary"onClick={() => {- props.openURLExternally(AppConfig.links.privacyURL, true);+ props.openURLExternally(Links.links.privacyURL, true);}}>Privacy Policy@@ -181,7 +181,7 @@ const AboutDialog = (props: Props) => {size="small"color="primary"onClick={() => {- props.openURLExternally(AppConfig.links.changelogURL, true);+ props.openURLExternally(Links.links.changelogURL, true);}}>Changelog@@ -202,7 +202,7 @@ const AboutDialog = (props: Props) => {data-tid="checkForUpdates"title={i18n.t('core:checkForNewVersion')}onClick={() => {- props.openURLExternally(AppConfig.links.productsOverview, true);+ props.openURLExternally(Links.links.productsOverview, true);}}color="primary">diff --git a/app/components/dialogs/OnboardingDialog.tsx b/app/components/dialogs/OnboardingDialog.tsxindex 4948abcc4..37a6844ec 100644--- a/app/components/dialogs/OnboardingDialog.tsx+++ b/app/components/dialogs/OnboardingDialog.tsx@@ -49,6 +49,7 @@ import {import { actions as AppActions } from '-/reducers/app';import AppConfig from '-/config';import DialogCloseButton from '-/components/dialogs/DialogCloseButton';+import Links from '-/links';interface Props {classes: any;@@ -240,7 +241,7 @@ const OnboardingDialog = (props: Props) => {<Buttonstyle={{ marginTop: 20 }}onClick={() => {- props.openURLExternally(AppConfig.links.webClipper, true);+ props.openURLExternally(Links.links.webClipper, true);}}variant="contained"color="primary"diff --git a/app/components/dialogs/ProTeaserDialog.tsx b/app/components/dialogs/ProTeaserDialog.tsxindex 41291e30a..f9bfed1eb 100644--- a/app/components/dialogs/ProTeaserDialog.tsx+++ b/app/components/dialogs/ProTeaserDialog.tsx@@ -35,8 +35,8 @@ import MapImage from '-/assets/images/map-undraw.svg';import AnnotateImage from '-/assets/images/annotate-undraw.svg';import EnterpriseImage from '-/assets/images/world-undraw.svg';import i18n from '-/services/i18n';-import AppConfig from '-/config';import DialogCloseButton from '-/components/dialogs/DialogCloseButton';+import Links from '-/links';interface Props {open: boolean;@@ -86,7 +86,7 @@ slidesEN['general'] = {</>,<>Generating persistent thumbnails</>],- ctaURL: AppConfig.links.productsOverview,+ ctaURL: Links.links.productsOverview,ctaTitle: 'Open Product Comparison',pictureURL: DecideImage,pictureHeight: 150@@ -111,7 +111,7 @@ slidesEN['search'] = {'Filter for files, folders or untagged files','Filter by size, date and gps-coordinates'],- ctaURL: AppConfig.links.productProAdvancedSearch,+ ctaURL: Links.links.productProAdvancedSearch,ctaTitle: 'Learn more',pictureURL: SearchImage,pictureHeight: 150@@ -134,7 +134,7 @@ slidesEN['objectstorage'] = {<>Direct streaming of the supported audio and video formats</>,<>Upload files with simple drag and drop actions</>],- ctaURL: AppConfig.links.productProObjectStore,+ ctaURL: Links.links.productProObjectStore,ctaTitle: 'Learn more',pictureURL: CloudImage,pictureHeight: 120@@ -168,7 +168,7 @@ slidesEN['perspectives'] = {can be your tasks.</>],- ctaURL: AppConfig.documentationLinks.perspectives,+ ctaURL: Links.documentationLinks.perspectives,ctaTitle: 'Learn more',pictureURL: PerspectivesImage,pictureHeight: 120@@ -195,7 +195,7 @@ slidesEN['annotation'] = {Set a <b>custom background color</b> to folders</>],- ctaURL: AppConfig.links.productProFileFolderMeta,+ ctaURL: Links.links.productProFileFolderMeta,ctaTitle: 'Learn more',pictureURL: AnnotateImage,pictureHeight: 200@@ -211,7 +211,7 @@ slidesEN['geotagging'] = {<>Useful for planing or documenting trips and vacations.</>,<>Useful for adding annotations for places on a map.</>],- ctaURL: AppConfig.links.productProGeoTagging,+ ctaURL: Links.links.productProGeoTagging,ctaTitle: 'Learn more',pictureURL: MapImage,pictureHeight: 200@@ -225,7 +225,7 @@ slidesEN['persistentThumbs'] = {archives and PDFs.</>),- ctaURL: AppConfig.links.productProThumbnailsGeneration,+ ctaURL: Links.links.productProThumbnailsGeneration,ctaTitle: 'Learn more',pictureURL: ThumbsImage,pictureHeight: 200@@ -253,7 +253,7 @@ slidesEN['enterprise'] = {</>,<>Premium technical support and signed installers</>],- ctaURL: AppConfig.links.emailContact,+ ctaURL: Links.links.emailContact,ctaTitle: 'Contact Us',pictureURL: EnterpriseImage,pictureHeight: 200diff --git a/app/components/menus/DirectoryMenu.tsx b/app/components/menus/DirectoryMenu.tsxindex 26df040f4..584b2629b 100644--- a/app/components/menus/DirectoryMenu.tsx+++ b/app/components/menus/DirectoryMenu.tsx@@ -43,6 +43,7 @@ import { Progress } from 'aws-sdk/clients/s3';import ImageIcon from '@material-ui/icons/Image';import { Pro } from '../../pro';import CreateDirectoryDialog from '../dialogs/CreateDirectoryDialog';+// import RenameDirectoryDialog from '../dialogs/RenameDirectoryDialog';import AppConfig from '-/config';import i18n from '-/services/i18n';import {@@ -66,6 +67,7 @@ import FileUploadContainer, {} from '-/components/FileUploadContainer';import { TS } from '-/tagspaces.namespace';import { ProLabel, BetaLabel } from '-/components/HelperComponents';+import Links from '-/links';interface Props {open: boolean;@@ -160,7 +162,7 @@ const DirectoryMenu = (props: Props) => {);if (openPersDocs) {props.openURLExternally(- AppConfig.documentationLinks.galleryPerspective,+ Links.documentationLinks.galleryPerspective,true);}@@ -170,7 +172,7 @@ const DirectoryMenu = (props: Props) => {);if (openPersDocs) {props.openURLExternally(- AppConfig.documentationLinks.mapiquePerspective,+ Links.documentationLinks.mapiquePerspective,true);}@@ -180,7 +182,7 @@ const DirectoryMenu = (props: Props) => {);if (openPersDocs) {props.openURLExternally(- AppConfig.documentationLinks.kanbanPerspective,+ Links.documentationLinks.kanbanPerspective,true);}diff --git a/app/components/menus/LocationManagerMenu.tsx b/app/components/menus/LocationManagerMenu.tsxindex c0ae96ecb..23b3ce5a7 100644--- a/app/components/menus/LocationManagerMenu.tsx+++ b/app/components/menus/LocationManagerMenu.tsx@@ -36,6 +36,7 @@ import AppConfig from '-/config';import i18n from '-/services/i18n';import { Pro } from '../../pro';import { actions as AppActions } from '-/reducers/app';+import Links from '-/links';import { ProLabel } from '-/components/HelperComponents';interface Props {@@ -161,7 +162,7 @@ const LocationManagerMenu = (props: Props) => {data-tid="locationManagerMenuHelp"onClick={() => {setLocationManagerMenuAnchorEl(null);- props.openURLExternally(AppConfig.documentationLinks.locations, true);+ props.openURLExternally(Links.documentationLinks.locations, true);}}><ListItemIcon>diff --git a/app/components/menus/SearchMenu.tsx b/app/components/menus/SearchMenu.tsxindex f8826d00d..53c2436be 100644--- a/app/components/menus/SearchMenu.tsx+++ b/app/components/menus/SearchMenu.tsx@@ -25,8 +25,8 @@ import HelpIcon from '@material-ui/icons/Help';import UpdateIndexIcon from '@material-ui/icons/Update';import ExportImportIcon from '@material-ui/icons/SwapHoriz';import i18n from '-/services/i18n';-import AppConfig from '-/config';import { Pro } from '../../pro';+import Links from '-/links';interface Props {classes?: any;@@ -93,7 +93,7 @@ const SearchMenu = (props: Props) => {data-tid="searchMenuHelp"onClick={() => {props.onClose();- props.openURLExternally(AppConfig.documentationLinks.search, true);+ props.openURLExternally(Links.documentationLinks.search, true);}}><ListItemIcon>diff --git a/app/components/menus/TagLibraryMenu.tsx b/app/components/menus/TagLibraryMenu.tsxindex c8c93e999..884d70d20 100644--- a/app/components/menus/TagLibraryMenu.tsx+++ b/app/components/menus/TagLibraryMenu.tsx@@ -29,6 +29,7 @@ import ImportExportTagGroupsDialog from '../dialogs/ImportExportTagGroupsDialog'import i18n from '-/services/i18n';import AppConfig from '-/config';import { TS } from '-/tagspaces.namespace';+import Links from '-/links';import { ProLabel, ProTooltip } from '-/components/HelperComponents';import { Pro } from '-/pro';@@ -171,10 +172,7 @@ const TagLibraryMenu = (props: Props) => {data-tid="taglibraryHelp"onClick={() => {props.onClose();- props.openURLExternally(- AppConfig.documentationLinks.taglibrary,- true- );+ props.openURLExternally(Links.documentationLinks.taglibrary, true);}}><ListItemIcon>diff --git a/app/config.ts b/app/config.tsindex 064a13d01..a80a1e302 100644--- a/app/config.ts+++ b/app/config.ts@@ -47,49 +47,6 @@ export const AppConfig = {// maxSearchResult: 1000,defaultFileColor: '#808080',defaultFolderColor: '#582727', // 555 transparent #FDEEBD #ff791b #2c001e #880e4f- links: {- checkNewVersionURL: 'https://www.tagspaces.org/releases/tagspaces.json',- productsOverview: 'https://www.tagspaces.org/products/',- productProObjectStore:- 'https://www.tagspaces.org/products/pro/#connectingObjectStorage',- productProAdvancedSearch:- 'https://www.tagspaces.org/products/pro/#advancedSearch',- productProFileFolderMeta:- 'https://www.tagspaces.org/products/pro/#fileFolderMeta',- productProThumbnailsGeneration:- 'https://www.tagspaces.org/products/pro/#thumbnailsGeneration',- productProGeoTagging: 'https://www.tagspaces.org/usecases/geotagging/',- productPro: 'https://www.tagspaces.org/products/pro/',- productEnterprise: 'https://www.tagspaces.org/products/enterprise/',- downloadURL: 'https://www.tagspaces.org/downloads/',- changelogURL: 'https://www.tagspaces.org/whatsnew/',- imprintURL: 'https://www.tagspaces.org/about/imprint/',- privacyURL: 'https://www.tagspaces.org/about/privacy/',- suggestFeature: 'https://trello.com/b/TGeG5bi9',- reportIssue: 'https://github.com/tagspaces/tagspaces/issues/',- helpTranslating: 'https://www.transifex.com/tagspaces/tagspaces/',- webClipperChrome:- 'https://chrome.google.com/webstore/detail/tagspaces-web-clipper/ldalmgifdlgpiiadeccbcjojljeanhjk',- webClipperFirefox:- 'https://addons.mozilla.org/en-US/firefox/addon/tagspaces/',- webClipper: 'https://www.tagspaces.org/products/webclipper/',- twitter: 'https://twitter.com/tagspaces',- facebook: 'https://www.facebook.com/tagspacesapp',- emailContact: 'mailto:[email protected]?subject=App'- },- documentationLinks: {- general: 'https://docs.tagspaces.org/',- perspectives: 'https://docs.tagspaces.org/browsing-files/',- defaultPerspective: 'https://docs.tagspaces.org/perspectives/grid/',- mapiquePerspective: 'https://docs.tagspaces.org/perspectives/mapique/',- treevizPerspective: 'https://docs.tagspaces.org/perspectives/treeviz/',- galleryPerspective: 'https://docs.tagspaces.org/perspectives/gallery/',- kanbanPerspective: 'https://docs.tagspaces.org/perspectives/kanban/',- locations: 'https://docs.tagspaces.org/ui/locations',- taglibrary: 'https://docs.tagspaces.org/ui/taglibrary',- search: 'https://docs.tagspaces.org/search',- settings: 'https://docs.tagspaces.org/ui/settings'- },isElectron: navigator.userAgent.toLowerCase().indexOf(' electron/') > -1,isFirefox: navigator.userAgent.toLowerCase().includes('firefox'), // typeof InstallTrigger !== 'undefined';isWin: navigator.appVersion.includes('Win'),diff --git a/app/containers/MainPage.tsx b/app/containers/MainPage.tsxindex 306468fb8..7b4f50069 100644--- a/app/containers/MainPage.tsx+++ b/app/containers/MainPage.tsx@@ -73,8 +73,6 @@ import {import { buffer } from '-/utils/misc';import TargetFileBox from '../components/TargetFileBox';import AppConfig from '../config';-import buildDesktopMenu from '../services/electron-menus';-import buildTrayIconMenu from '../services/electron-tray-menu';import i18n from '../services/i18n';import LoadingLazy from '../components/LoadingLazy';import withDnDContext from '-/containers/withDnDContext';@@ -86,6 +84,7 @@ import useEventListener from '-/utils/useEventListener';import ConfirmDialog from '-/components/dialogs/ConfirmDialog';import { TS } from '-/tagspaces.namespace';import PageNotification from '-/containers/PageNotification';+import listen from '-/containers/RendererListener';const initialSplitSize = 44;const drawerWidth = 300;@@ -327,18 +326,13 @@ const MainPage = (props: Props) => {if (!AppConfig.isCordova) {updateDimensions();}- // this.setupDesktopMenu();- buildDesktopMenu(props);- buildTrayIconMenu(props);+ listen(props);}, []);useEffect(() => {if (props.isEntryInFullWidth) {props.closeAllVerticalPanels();- // setMainSplitSize('0%');} else {- // setMainSplitSize(props.mainSplitSize);- // setManagementPanelVisible(true);showDrawer();}}, [props.isEntryInFullWidth]);@@ -638,12 +632,6 @@ const MainPage = (props: Props) => {<CustomDragLayer /><SplitPanesplit="vertical"- // style={{- // borderTop:- // AppConfig.isElectron && !AppConfig.isMacLike- // ? '1px solid lightgray'- // : 'none'- // }}minSize={200}maxSize={450}resizerStyle={{ backgroundColor: theme.palette.divider }}@@ -654,7 +642,6 @@ const MainPage = (props: Props) => {: initialSplitSize}onChange={size => {- // setManagementPanelVisible(size > initialSplitSize);bufferedLeftSplitResize(() =>props.setLeftVerticalSplitSize(size));@@ -691,7 +678,6 @@ const MainPage = (props: Props) => {onOpen={showDrawer}hysteresis={0.1}disableBackdropTransition={!AppConfig.isIOS}- // disableDiscovery={AppConfig.isIOS}><MobileNavigationhideDrawer={() => props.closeAllVerticalPanels()}@@ -740,7 +726,6 @@ function mapStateToProps(state) {isProgressDialogOpened: isProgressOpened(state),isReadOnlyMode: isReadOnlyMode(state),isGeneratingThumbs: isGeneratingThumbs(state),- // isFileOpened: isFileOpened(state),openedFiles: getOpenedFiles(state),isEntryInFullWidth: isEntryInFullWidth(state),isDesktopMode: getDesktopMode(state),@@ -784,7 +769,6 @@ function mapDispatchToProps(dispatch) {toggleAboutDialog: AppActions.toggleAboutDialog,toggleOnboardingDialog: AppActions.toggleOnboardingDialog,toggleOpenLinkDialog: AppActions.toggleOpenLinkDialog,- // setLastSelectedEntry: AppActions.setLastSelectedEntry,setSelectedEntries: AppActions.setSelectedEntries,setGeneratingThumbnails: AppActions.setGeneratingThumbnails,openFsEntry: AppActions.openFsEntry,diff --git a/app/containers/PageNotification.tsx b/app/containers/PageNotification.tsxindex c888f60f2..66f686453 100644--- a/app/containers/PageNotification.tsx+++ b/app/containers/PageNotification.tsx@@ -33,9 +33,9 @@ import {actions as LocationIndexActions,isIndexing} from '../reducers/location-index';-import AppConfig from '../config';import i18n from '../services/i18n';import { Pro } from '../pro';+import Links from '-/links';interface Props {notificationStatus: any;@@ -59,7 +59,7 @@ const PageNotification = (props: Props) => {};const openChangelogPage = () => {- props.openURLExternally(AppConfig.links.changelogURL, true);+ props.openURLExternally(Links.links.changelogURL, true);};const getLatestVersion = () => {@@ -70,7 +70,7 @@ const PageNotification = (props: Props) => {false);} else {- props.openURLExternally(AppConfig.links.downloadURL, true);+ props.openURLExternally(Links.links.downloadURL, true);}props.setUpdateAvailable(false);};diff --git a/app/containers/RendererListener.ts b/app/containers/RendererListener.tsnew file mode 100644index 000000000..97f33a1cf--- /dev/null+++ b/app/containers/RendererListener.ts@@ -0,0 +1,135 @@+/**+ * TagSpaces - universal file and folder organizer+ * Copyright (C) 2017-present TagSpaces UG (haftungsbeschraenkt)+ *+ * This program is free software: you can redistribute it and/or modify+ * it under the terms of the GNU Affero General Public License (version 3) as+ * published by the Free Software Foundation.+ *+ * This program is distributed in the hope that it will be useful,+ * but WITHOUT ANY WARRANTY; without even the implied warranty of+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+ * GNU Affero General Public License for more details.+ *+ * You should have received a copy of the GNU Affero General Public License+ * along with this program. If not, see <https://www.gnu.org/licenses/>.+ *+ */++import AppConfig from '-/config';++export default function listen(props) {+ let ipcRenderer;+ if (AppConfig.isElectron && window.require) {+ const electron = window.require('electron');+ ({ ipcRenderer } = electron);++ ipcRenderer.on('cmd', (event, arg) => {+ // console.log('Global events: ' + arg);+ switch (arg) {+ case 'new-text-file':+ props.toggleCreateFileDialog();+ break;+ case 'open-search':+ props.openSearchPanel();+ break;+ case 'open-location-manager-panel':+ props.openLocationManagerPanel();+ break;+ case 'open-tag-library-panel':+ props.openTagLibraryPanel();+ break;+ case 'audio':+ // console.log('showAudioRecordingDialog');+ break;+ case 'next-file': {+ props.openNextFile();+ break;+ }+ case 'previous-file': {+ props.openPrevFile();+ break;+ }+ case 'show-create-directory-dialog': {+ props.showCreateDirectoryDialog();+ break;+ }+ case 'toggle-open-link-dialog': {+ props.toggleOpenLinkDialog();+ break;+ }+ case 'go-back': {+ window.history.back();+ // console.log('navigate to: ' + window.location.href);+ break;+ }+ case 'go-forward': {+ window.history.forward();+ break;+ }+ case 'set-zoom-reset-app': {+ props.setZoomResetApp();+ break;+ }+ case 'set-zoom-in-app': {+ props.setZoomInApp();+ break;+ }+ case 'set-zoom-out-app': {+ props.setZoomOutApp();+ break;+ }+ case 'exit-fullscreen': {+ document.exitFullscreen();+ break;+ }+ case 'toggle-settings-dialog': {+ props.toggleSettingsDialog();+ break;+ }+ case 'open-help-feedback-panel': {+ props.openHelpFeedbackPanel();+ break;+ }+ case 'toggle-keys-dialog': {+ props.toggleKeysDialog();+ break;+ }+ case 'toggle-onboarding-dialog': {+ props.toggleOnboardingDialog();+ break;+ }+ case 'open-url-externally': {+ props.openURLExternally();+ break;+ }+ case 'toggle-license-dialog': {+ props.toggleLicenseDialog();+ break;+ }+ case 'toggle-third-party-libs-dialog': {+ props.toggleThirdPartyLibsDialog();+ break;+ }+ case 'toggle-about-dialog': {+ props.toggleAboutDialog();+ break;+ }+ default:+ return false;+ }+ });++ ipcRenderer.on('open-url-externally', (event, arg) => {+ const { url, skipConfirm } = arg;+ props.openURLExternally(url, skipConfirm);+ });++ ipcRenderer.on('play-pause', (event, arg) => {+ // Create the event.+ const audioEvent = new CustomEvent('toggle-resume', { detail: '' });+ window.dispatchEvent(audioEvent);+ });+ }+ return ipcRenderer;+}diff --git a/app/electron-tray-menu.ts b/app/electron-tray-menu.tsnew file mode 100644index 000000000..5cf7a3fff--- /dev/null+++ b/app/electron-tray-menu.ts@@ -0,0 +1,118 @@+/**+ * TagSpaces - universal file and folder organizer+ * Copyright (C) 2017-present TagSpaces UG (haftungsbeschraenkt)+ *+ * This program is free software: you can redistribute it and/or modify+ * it under the terms of the GNU Affero General Public License (version 3) as+ * published by the Free Software Foundation.+ *+ * This program is distributed in the hope that it will be useful,+ * but WITHOUT ANY WARRANTY; without even the implied warranty of+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+ * GNU Affero General Public License for more details.+ *+ * You should have received a copy of the GNU Affero General Public License+ * along with this program. If not, see <https://www.gnu.org/licenses/>.+ *+ */++import { app, Menu, Tray } from 'electron';+import pathLib from 'path';+// import TrayIcon2x from '-/assets/icons/[email protected]';+// import TrayIcon from '-/assets/icons/trayIcon.png';+// import TrayIcon3x from '-/assets/icons/[email protected]';++export default function buildTrayIconMenu(mainPageProps: any, i18n, isMacLike) {+ const cKey = isMacLike ? ' - Cmd' : ' - Ctrl';++ function openNextFile() {+ mainPageProps.openNextFile();+ }++ function openPrevFile() {+ mainPageProps.openPrevFile();+ }++ function playResumePlayback() {+ mainPageProps.resumePlayback();+ }++ function quitApp() {+ app.quit();+ }++ const trayMenuTemplate = [+ {+ label: i18n.t('showTagSpaces') + cKey + '+Shift+W',+ click: mainPageProps.showTagSpaces+ },+ {+ label: i18n.t('showSearch') + cKey + '+Shift+F',+ click: mainPageProps.openSearchPanel+ },+ {+ type: 'separator'+ },+ {+ label: i18n.t('newFileNote') + cKey + '+Shift+N',+ click: mainPageProps.toggleCreateFileDialog+ },+ {+ type: 'separator'+ },+ {+ label: i18n.t('openNextFileTooltip') + cKey + '+Shift+D',+ click: openNextFile+ },+ {+ label: i18n.t('openPrevFileTooltip') + cKey + '+Shift+A',+ click: openPrevFile+ },+ {+ type: 'separator'+ },+ {+ label: i18n.t('pauseResumePlayback') + cKey + '+Shift+P',+ click: playResumePlayback+ },+ {+ type: 'separator'+ },+ {+ label: i18n.t('quitTagSpaces') + cKey + '+Q',+ click: quitApp+ }+ ];++ /* let nImage;++ if (process.platform === 'win32') {+ nImage = nativeImage.createFromDataURL(TrayIcon2x);+ } else if (process.platform === 'darwin') {+ nImage = nativeImage.createFromDataURL(TrayIcon);+ nImage.addRepresentation({+ scaleFactor: 2.0,+ dataURL: TrayIcon2x+ });+ nImage.addRepresentation({+ scaleFactor: 3.0,+ dataURL: TrayIcon3x+ });+ } else {+ nImage = nativeImage.createFromDataURL(TrayIcon2x);+ } */++ // const tray = new Tray(nImage);+ const tray = new Tray(+ pathLib.resolve(__dirname, 'assets', 'icons', '[email protected]')+ );+ tray.on('click', () => {+ mainPageProps.showTagSpaces();+ });++ // @ts-ignore+ const contextMenu = Menu.buildFromTemplate(trayMenuTemplate);+ tray.setToolTip('TagSpaces');+ tray.setContextMenu(contextMenu);+ return tray;+}diff --git a/app/i18nBackend.ts b/app/i18nBackend.tsnew file mode 100644index 000000000..a708deccf--- /dev/null+++ b/app/i18nBackend.ts@@ -0,0 +1,45 @@+/**+ * TagSpaces - universal file and folder organizer+ * Copyright (C) 2017-present TagSpaces UG (haftungsbeschraenkt)+ *+ * This program is free software: you can redistribute it and/or modify+ * it under the terms of the GNU Affero General Public License (version 3) as+ * published by the Free Software Foundation.+ *+ * This program is distributed in the hope that it will be useful,+ * but WITHOUT ANY WARRANTY; without even the implied warranty of+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+ * GNU Affero General Public License for more details.+ *+ * You should have received a copy of the GNU Affero General Public License+ * along with this program. If not, see <https://www.gnu.org/licenses/>.+ *+ */++import i18n from 'i18next';+import Backend from 'i18next-fs-backend';+// import LanguageDetector from 'i18next-browser-languagedetector';++const { join } = require('path');+const { readdirSync, lstatSync } = require('fs');++i18n+ .use(Backend)+ // .use(LanguageDetector)+ .init({+ debug: false,+ initImmediate: false,+ fallbackLng: 'en',+ lng: 'en',+ preload: readdirSync(join(__dirname, 'locales')).filter(fileName => {+ const joinedPath = join(join(__dirname, 'locales'), fileName);+ return lstatSync(joinedPath).isDirectory();+ }),+ ns: 'backend-app',+ defaultNS: 'backend-app',+ backend: {+ loadPath: join(__dirname, 'locales/{{lng}}/core.json')+ }+ });++export default i18n;diff --git a/app/links.ts b/app/links.tsnew file mode 100644index 000000000..44d52ed17--- /dev/null+++ b/app/links.ts@@ -0,0 +1,64 @@+/**+ * TagSpaces - universal file and folder organizer+ * Copyright (C) 2017-present TagSpaces UG (haftungsbeschraenkt)+ *+ * This program is free software: you can redistribute it and/or modify+ * it under the terms of the GNU Affero General Public License (version 3) as+ * published by the Free Software Foundation.+ *+ * This program is distributed in the hope that it will be useful,+ * but WITHOUT ANY WARRANTY; without even the implied warranty of+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+ * GNU Affero General Public License for more details.+ *+ * You should have received a copy of the GNU Affero General Public License+ * along with this program. If not, see <https://www.gnu.org/licenses/>.+ *+ */+export const Links = {+ links: {+ checkNewVersionURL: 'https://www.tagspaces.org/releases/tagspaces.json',+ productsOverview: 'https://www.tagspaces.org/products/',+ productProObjectStore:+ 'https://www.tagspaces.org/products/pro/#connectingObjectStorage',+ productProAdvancedSearch:+ 'https://www.tagspaces.org/products/pro/#advancedSearch',+ productProFileFolderMeta:+ 'https://www.tagspaces.org/products/pro/#fileFolderMeta',+ productProThumbnailsGeneration:+ 'https://www.tagspaces.org/products/pro/#thumbnailsGeneration',+ productProGeoTagging: 'https://www.tagspaces.org/usecases/geotagging/',+ productPro: 'https://www.tagspaces.org/products/pro/',+ productEnterprise: 'https://www.tagspaces.org/products/enterprise/',+ downloadURL: 'https://www.tagspaces.org/downloads/',+ changelogURL: 'https://www.tagspaces.org/whatsnew/',+ imprintURL: 'https://www.tagspaces.org/about/imprint/',+ privacyURL: 'https://www.tagspaces.org/about/privacy/',+ suggestFeature: 'https://trello.com/b/TGeG5bi9',+ reportIssue: 'https://github.com/tagspaces/tagspaces/issues/',+ helpTranslating: 'https://www.transifex.com/tagspaces/tagspaces/',+ webClipperChrome:+ 'https://chrome.google.com/webstore/detail/tagspaces-web-clipper/ldalmgifdlgpiiadeccbcjojljeanhjk',+ webClipperFirefox:+ 'https://addons.mozilla.org/en-US/firefox/addon/tagspaces/',+ webClipper: 'https://www.tagspaces.org/products/webclipper/',+ twitter: 'https://twitter.com/tagspaces',+ facebook: 'https://www.facebook.com/tagspacesapp',+ emailContact: 'mailto:[email protected]?subject=App'+ },+ documentationLinks: {+ general: 'https://docs.tagspaces.org/',+ perspectives: 'https://docs.tagspaces.org/browsing-files/',+ defaultPerspective: 'https://docs.tagspaces.org/perspectives/grid/',+ mapiquePerspective: 'https://docs.tagspaces.org/perspectives/mapique/',+ treevizPerspective: 'https://docs.tagspaces.org/perspectives/treeviz/',+ galleryPerspective: 'https://docs.tagspaces.org/perspectives/gallery/',+ kanbanPerspective: 'https://docs.tagspaces.org/perspectives/kanban/',+ locations: 'https://docs.tagspaces.org/ui/locations',+ taglibrary: 'https://docs.tagspaces.org/ui/taglibrary',+ search: 'https://docs.tagspaces.org/search',+ settings: 'https://docs.tagspaces.org/ui/settings'+ }+};++export default Links;diff --git a/app/main.dev.ts b/app/main.dev.tsindex 26f66264d..a7c5467c5 100644--- a/app/main.dev.ts+++ b/app/main.dev.ts@@ -16,16 +16,20 @@**/-import { app, BrowserWindow, ipcMain, globalShortcut, dialog } from 'electron';+import { app, BrowserWindow, dialog, globalShortcut, ipcMain } from 'electron';import windowStateKeeper from 'electron-window-state';import path from 'path';--// require('@electron/remote/main').initialize();+import i18n from '-/i18nBackend';+import buildTrayIconMenu from '-/electron-tray-menu';+import buildDesktopMenu from '-/services/electron-menus';+import keyBindings from '-/utils/keyBindings';// delete process.env.ELECTRON_ENABLE_SECURITY_WARNINGS;// process.env.ELECTRON_DISABLE_SECURITY_WARNINGS = 'true';+const isMac = process.platform === 'darwin';let mainWindow = null;+let tray = null;(global as any).splashWorkerWindow = null;if (process.env.NODE_ENV === 'production') {@@ -80,12 +84,17 @@ process.argv.forEach((arg, count) => {}});+let mainHTML = `file://${__dirname}/app.html`;+let workerDevMode = false;+if (devMode) {// eslint-disable-next-linerequire('electron-debug')({ showDevTools: false, devToolsMode: 'right' });const p = path.join(__dirname, '..', 'app', 'node_modules');// eslint-disable-next-linerequire('module').globalPaths.push(p);+ // workerDevMode = true; // hide worker window in dev mode+ mainHTML = `file://${__dirname}/appd.html`;}// if (process.platform === 'linux') {@@ -114,59 +123,56 @@ const installExtensions = async () => {).catch(console.log);};-app.commandLine.appendSwitch('autoplay-policy', 'no-user-gesture-required'); // Fix broken autoplay functionality in the av player--app.on('window-all-closed', () => {- globalShortcut.unregisterAll();- app.quit();-});--app.on('ready', async () => {- let workerDevMode = false;- let mainHTML = `file://${__dirname}/app.html`;-- if (- process.env.NODE_ENV === 'development' ||- process.env.DEBUG_PROD === 'true'- ) {- await installExtensions();- }+function createSplashWorker() {+ // console.log('Dev ' + process.env.NODE_ENV + ' worker ' + showWorkerWindow);+ (global as any).splashWorkerWindow = new BrowserWindow({+ show: workerDevMode,+ x: 0,+ y: 0,+ width: workerDevMode ? 800 : 1,+ height: workerDevMode ? 600 : 1,+ frame: false,+ webPreferences: {+ nodeIntegration: true,+ enableRemoteModule: false,+ contextIsolation: false+ }+ });- if (process.env.NODE_ENV === 'development') {- // workerDevMode = true; // hide worker window in dev mode- mainHTML = `file://${__dirname}/appd.html`;+ if (!process.env.DISABLE_WORKER) {+ (global as any).splashWorkerWindow.loadURL(+ `file://${__dirname}/splash.html`+ );}- const mainWindowState = windowStateKeeper({- defaultWidth: 1280,- defaultHeight: 800+ (global as any).splashWorkerWindow.webContents.on('crashed', () => {+ try {+ (global as any).splashWorkerWindow.close();+ (global as any).splashWorkerWindow = null;+ } catch (err) {+ console.warn('Error closing the splash window. ' + err);+ }+ createSplashWorker();});- function createSplashWorker() {- // console.log('Dev ' + process.env.NODE_ENV + ' worker ' + showWorkerWindow);- (global as any).splashWorkerWindow = new BrowserWindow({- show: workerDevMode,- x: 0,- y: 0,- width: workerDevMode ? 800 : 1,- height: workerDevMode ? 600 : 1,- frame: false,- webPreferences: {- nodeIntegration: true,- enableRemoteModule: true,- contextIsolation: false+ // electron-io actions+ ipcMain.on('is-worker-available', event => {+ let workerAvailable = false;+ try {+ if (+ (global as any).splashWorkerWindow &&+ (global as any).splashWorkerWindow.webContents+ ) {+ workerAvailable = true;}- });-- if (!process.env.DISABLE_WORKER) {- (global as any).splashWorkerWindow.loadURL(- `file://${__dirname}/splash.html`- );+ } catch (err) {+ console.info('Error by finding if worker is available.');}- }-- createSplashWorker();+ event.returnValue = workerAvailable;+ });+}+async function createAppWindow() {let startupParameter = '';if (startupFilePath) {if (startupFilePath.startsWith('./') || startupFilePath.startsWith('.\\')) {@@ -177,7 +183,11 @@ app.on('ready', async () => {}}- // TODO remote module is deprecated https://stackoverflow.com/questions/37884130/electron-remote-is-undefined+ const mainWindowState = windowStateKeeper({+ defaultWidth: 1280,+ defaultHeight: 800+ });+mainWindow = new BrowserWindow({show: true,x: mainWindowState.x,@@ -189,7 +199,7 @@ app.on('ready', async () => {spellcheck: true,nodeIntegration: true,webviewTag: true,- enableRemoteModule: true,+ enableRemoteModule: false,contextIsolation: false}});@@ -198,12 +208,13 @@ app.on('ready', async () => {'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.77 Safari/537.36';const testWinOnUnix = false; // set to true to simulate windows os, useful for testing s3 handling- mainWindow.loadURL(+ await mainWindow.loadURL(mainHTML + startupParameter,testWinOnUnix ? { userAgent: winUserAgent } : {});mainWindow.setMenuBarVisibility(false);mainWindow.setAutoHideMenuBar(true);+ mainWindowState.manage(mainWindow);mainWindow.webContents.on('did-finish-load', () => {if (!mainWindow) {@@ -247,30 +258,92 @@ app.on('ready', async () => {dialog.showMessageBox(mainWindow, options).then(dialogResponse => {mainWindow.hide();if (dialogResponse.response === 0) {- reloadApp();+ mainWindow.loadURL(mainHTML); //reloadApp();} else {mainWindow.close();globalShortcut.unregisterAll();}});});+}- (global as any).splashWorkerWindow.webContents.on('crashed', () => {- try {- (global as any).splashWorkerWindow.close();- (global as any).splashWorkerWindow = null;- } catch (err) {- console.warn('Error closing the splash window. ' + err);+app.commandLine.appendSwitch('autoplay-policy', 'no-user-gesture-required'); // Fix broken autoplay functionality in the av player++app.on('window-all-closed', () => {+ globalShortcut.unregisterAll();+ app.quit();+});++app.on('ready', async () => {+ if (+ process.env.NODE_ENV === 'development' ||+ process.env.DEBUG_PROD === 'true'+ ) {+ await installExtensions();+ }++ createSplashWorker();+ await createAppWindow();++ ipcMain.on('show-main-window', () => {+ if (mainWindow) {+ if (mainWindow.isMinimized()) {+ mainWindow.restore();+ }+ mainWindow.show();}- createSplashWorker();+ });++ ipcMain.on('focus-window', () => {+ if (mainWindow) {+ mainWindow.focus();+ }+ });++ ipcMain.on('get-device-paths', event => {+ event.returnValue = {+ desktopFolder: app.getPath('desktop'),+ documentsFolder: app.getPath('documents'),+ downloadsFolder: app.getPath('downloads'),+ musicFolder: app.getPath('music'),+ picturesFolder: app.getPath('pictures'),+ videosFolder: app.getPath('videos')+ };+ });++ ipcMain.on('get-user-home-path', event => {+ event.returnValue = app.getPath('home');});ipcMain.on('worker', (event, arg) => {+ // console.log('worker event in main.' + arg.result.length);+ if ((global as any).splashWorkerWindow) {+ (global as any).splashWorkerWindow.webContents.send('worker', arg);+ }+ });++ ipcMain.handle('select-directory-dialog', async () => {+ const options = {+ properties: ['openDirectory', 'createDirectory']+ };+ // @ts-ignore+ const resultObject = await dialog.showOpenDialog(options);++ if (resultObject.filePaths && resultObject.filePaths.length) {+ // alert(JSON.stringify(resultObject.filePaths));+ return resultObject.filePaths;+ }+ return false;+ });++ ///// end electron-io++ /*ipcMain.on('worker', (event, arg) => { TODO Why?// console.log('worker event in main.' + arg.result.length);if (mainWindow) {mainWindow.webContents.send(arg.id, arg);}- });+ });*/ipcMain.on('setSplashVisibility', (event, arg) => {// worker window needed to be visible for the PDF tmb generation@@ -324,8 +397,6 @@ app.on('ready', async () => {reloadApp();});- mainWindowState.manage(mainWindow);-function showTagSpaces() {if (mainWindow) {if (mainWindow.isMinimized()) {@@ -335,29 +406,137 @@ app.on('ready', async () => {}}+ function openLocationManagerPanel() {+ if (mainWindow) {+ showTagSpaces();+ mainWindow.webContents.send('cmd', 'open-location-manager-panel');+ }+ }+ function openTagLibraryPanel() {+ if (mainWindow) {+ showTagSpaces();+ mainWindow.webContents.send('cmd', 'open-tag-library-panel');+ }+ }+ function goBack() {+ if (mainWindow) {+ showTagSpaces();+ mainWindow.webContents.send('cmd', 'go-back');+ }+ }+ function goForward() {+ if (mainWindow) {+ showTagSpaces();+ mainWindow.webContents.send('cmd', 'go-forward');+ }+ }+ function setZoomResetApp() {+ if (mainWindow) {+ showTagSpaces();+ mainWindow.webContents.send('cmd', 'set-zoom-reset-app');+ }+ }+ function setZoomInApp() {+ if (mainWindow) {+ showTagSpaces();+ mainWindow.webContents.send('cmd', 'set-zoom-in-app');+ }+ }+ function setZoomOutApp() {+ if (mainWindow) {+ showTagSpaces();+ mainWindow.webContents.send('cmd', 'set-zoom-out-app');+ }+ }+ function exitFullscreen() {+ if (mainWindow) {+ showTagSpaces();+ mainWindow.webContents.send('cmd', 'exit-fullscreen');+ }+ }+ function toggleSettingsDialog() {+ if (mainWindow) {+ showTagSpaces();+ mainWindow.webContents.send('cmd', 'toggle-settings-dialog');+ }+ }+ function openHelpFeedbackPanel() {+ if (mainWindow) {+ showTagSpaces();+ mainWindow.webContents.send('cmd', 'open-help-feedback-panel');+ }+ }+ function toggleKeysDialog() {+ if (mainWindow) {+ showTagSpaces();+ mainWindow.webContents.send('cmd', 'toggle-keys-dialog');+ }+ }+ function toggleOnboardingDialog() {+ if (mainWindow) {+ showTagSpaces();+ mainWindow.webContents.send('cmd', 'toggle-onboarding-dialog');+ }+ }+ function openURLExternally(data) {+ if (mainWindow) {+ showTagSpaces();+ mainWindow.webContents.send('open-url-externally', data);+ }+ }+ function toggleLicenseDialog() {+ if (mainWindow) {+ showTagSpaces();+ mainWindow.webContents.send('cmd', 'toggle-license-dialog');+ }+ }+ function toggleThirdPartyLibsDialog() {+ if (mainWindow) {+ showTagSpaces();+ mainWindow.webContents.send('cmd', 'toggle-third-party-libs-dialog');+ }+ }+ function toggleAboutDialog() {+ if (mainWindow) {+ showTagSpaces();+ mainWindow.webContents.send('cmd', 'toggle-about-dialog');+ }+ }function showSearch() {if (mainWindow) {showTagSpaces();- mainWindow.webContents.send('file', 'open-search');+ mainWindow.webContents.send('cmd', 'open-search');}}function newTextFile() {if (mainWindow) {showTagSpaces();- mainWindow.webContents.send('file', 'new-text-file');+ mainWindow.webContents.send('cmd', 'new-text-file');}}function getNextFile() {if (mainWindow) {- mainWindow.webContents.send('file', 'next-file');+ mainWindow.webContents.send('cmd', 'next-file');}}function getPreviousFile() {if (mainWindow) {- mainWindow.webContents.send('file', 'previous-file');+ mainWindow.webContents.send('cmd', 'previous-file');+ }+ }++ function showCreateDirectoryDialog() {+ if (mainWindow) {+ mainWindow.webContents.send('cmd', 'show-create-directory-dialog');+ }+ }++ function toggleOpenLinkDialog() {+ if (mainWindow) {+ mainWindow.webContents.send('cmd', 'toggle-open-link-dialog');}}@@ -372,4 +551,54 @@ app.on('ready', async () => {mainWindow.loadURL(mainHTML);}}++ tray = buildTrayIconMenu(+ {+ showTagSpaces,+ resumePlayback,+ openSearchPanel: showSearch,+ toggleCreateFileDialog: newTextFile,+ openNextFile: getNextFile,+ openPrevFile: getPreviousFile,+ quitApp: reloadApp+ },+ i18n,+ isMac+ );+ buildDesktopMenu(+ {+ showTagSpaces,+ openSearchPanel: showSearch,+ toggleCreateFileDialog: newTextFile,+ openNextFile: getNextFile,+ openPrevFile: getPreviousFile,+ quitApp: reloadApp,+ showCreateDirectoryDialog: showCreateDirectoryDialog,+ toggleOpenLinkDialog: toggleOpenLinkDialog,+ openLocationManagerPanel: openLocationManagerPanel,+ openTagLibraryPanel: openTagLibraryPanel,+ goBack: goBack,+ goForward: goForward,+ setZoomResetApp: setZoomResetApp,+ setZoomInApp: setZoomInApp,+ setZoomOutApp: setZoomOutApp,+ exitFullscreen: exitFullscreen,+ toggleSettingsDialog: toggleSettingsDialog,+ openHelpFeedbackPanel: openHelpFeedbackPanel,+ toggleKeysDialog: toggleKeysDialog,+ toggleOnboardingDialog: toggleOnboardingDialog,+ openURLExternally: openURLExternally,+ toggleLicenseDialog: toggleLicenseDialog,+ toggleThirdPartyLibsDialog: toggleThirdPartyLibsDialog,+ toggleAboutDialog: toggleAboutDialog,+ keyBindings: keyBindings(isMac)+ },+ i18n+ );});++// i18n.on('languageChanged', lng => {+// 'loaded', loaded => {+// i18n.changeLanguage('en');+// i18n.off('loaded');+// });diff --git a/app/perspectives/grid-perspective/components/MainContainer.tsx b/app/perspectives/grid-perspective/components/MainContainer.tsxindex 6771db4c8..a65efc03b 100644--- a/app/perspectives/grid-perspective/components/MainContainer.tsx+++ b/app/perspectives/grid-perspective/components/MainContainer.tsx@@ -62,6 +62,7 @@ import GridSettingsDialog from '-/perspectives/grid-perspective/components/GridSimport AddTagToTagGroupDialog from '-/components/dialogs/AddTagToTagGroupDialog';import { TS } from '-/tagspaces.namespace';import { Pro } from '-/pro';+import Links from '-/links';interface Props {classes: any;@@ -388,7 +389,7 @@ const GridPerspective = (props: Props) => {const openHelpWebPage = () => {closeOptionsMenu();- props.openURLExternally(AppConfig.documentationLinks.defaultPerspective);+ props.openURLExternally(Links.documentationLinks.defaultPerspective);};const openSettings = () => {diff --git a/app/reducers/settings-default.ts b/app/reducers/settings-default.tsindex f679f6c84..d34eaaa83 100644--- a/app/reducers/settings-default.ts+++ b/app/reducers/settings-default.ts@@ -17,6 +17,7 @@*/import AppConfig from '../config';+import keyBindings from '-/utils/keyBindings';let desktopMode = !AppConfig.isMobile;if (window.ExtDisplayMode && window.ExtDisplayMode === 'mobile') {@@ -270,108 +271,7 @@ export default {title: 'Bokmål (Norwegian)'}],- keyBindings: [- {- name: 'selectAll',- command: (AppConfig.isMacLike ? 'command' : 'ctrl') + '+a'- },- {- name: 'closeViewer',- command: (AppConfig.isMacLike ? 'command' : 'ctrl') + '+w'- },- {- name: 'saveDocument',- command: (AppConfig.isMacLike ? 'command' : 'ctrl') + '+s'- },- {- name: 'reloadDocument',- command: (AppConfig.isMacLike ? 'command' : 'ctrl') + '+r'- },- {- name: 'editDocument',- command: (AppConfig.isMacLike ? 'command' : 'ctrl') + '+e'- },- {- name: 'deleteDocument',- command: 'del'- },- {- name: 'showLocationManager',- command: (AppConfig.isMacLike ? 'command' : 'ctrl') + '+1'- },- {- name: 'showTagLibrary',- command: (AppConfig.isMacLike ? 'command' : 'ctrl') + '+2'- },- {- name: 'showSearch',- command: (AppConfig.isMacLike ? 'command' : 'ctrl') + '+3'- },- {- name: 'toggleShowHiddenEntries',- command: (AppConfig.isMacLike ? 'command' : 'ctrl') + '+h'- },- {- name: 'addRemoveTags',- command: (AppConfig.isMacLike ? 'command' : 'ctrl') + '+t'- },- /* {- name: 'propertiesDocument',- command: 'alt+enter',- }, */- {- name: 'nextDocument',- command: 'down'- },- {- name: 'prevDocument',- command: 'up'- },- {- name: 'showHelp',- command: 'f1'- },- {- name: 'reloadApplication',- command: 'r a'- },- {- name: 'toggleFullScreen',- command: 'f11'- },- {- name: 'openDevTools',- command: 'f10'- },- {- name: 'openSearch',- command: (AppConfig.isMacLike ? 'command' : 'ctrl') + '+f'- },- {- name: 'renameFile',- command: 'f2'- },- {- name: 'openEntry',- command: 'enter'- },- {- name: 'openParentDirectory',- command: 'backspace'- },- {- name: 'openFileExternally',- command: (AppConfig.isMacLike ? 'command' : 'ctrl') + '+enter'- },- {- name: 'zoomIn',- command: (AppConfig.isMacLike ? 'command' : 'ctrl') + '+'- },- {- name: 'zoomOut',- command: (AppConfig.isMacLike ? 'command' : 'ctrl') + '-'- }- ],+ keyBindings: keyBindings(AppConfig.isMacLike),supportedFileTypes: [{type: 'bmp',diff --git a/app/reducers/settings.ts b/app/reducers/settings.tsindex c9213ae1b..7e53f23ff 100644--- a/app/reducers/settings.ts+++ b/app/reducers/settings.ts@@ -22,6 +22,7 @@ import i18n from '-/services/i18n';import defaultSettings from './settings-default';import PlatformIO from '-/services/platform-io';import AppConfig from '-/config';+import Links from '-/links';import versionMeta from '-/version.json';import { actions as AppActions } from './app';import { TS } from '-/tagspaces.namespace';@@ -556,7 +557,7 @@ export function getLastVersionPromise(): Promise<string> {console.log('Checking for new version...');const xhr = new XMLHttpRequest();const updateUrl =- AppConfig.links.checkNewVersionURL + '?cv=' + versionMeta.version;+ Links.links.checkNewVersionURL + '?cv=' + versionMeta.version;xhr.open('GET', updateUrl, true);xhr.responseType = 'json';xhr.onerror = reject;diff --git a/app/services/electron-io.ts b/app/services/electron-io.tsindex 8a60767f6..cef1e6e51 100644--- a/app/services/electron-io.ts+++ b/app/services/electron-io.ts@@ -29,26 +29,18 @@ import {import { arrayBufferToBuffer } from '-/utils/misc';import AppConfig from '../config';import PlatformIO from './platform-io';-import TrayIcon from '../assets/icons/trayIcon.png';+// import TrayIcon from '../assets/icons/trayIcon.png';// import TrayIconWin from '../assets/icons/trayIcon.ico';-import TrayIcon2x from '../assets/icons/[email protected]';-import TrayIcon3x from '../assets/icons/[email protected]';+// import TrayIcon2x from '../assets/icons/[email protected]';+// import TrayIcon3x from '../assets/icons/[email protected]';import { Pro } from '../pro';import { TS } from '-/tagspaces.namespace';export default class ElectronIO {electron: any;- win: any;-- app: any;-ipcRenderer: any;- remote: any;-- workerWindow: any;-pathUtils: any;fs: any;@@ -64,22 +56,12 @@ export default class ElectronIO {this.electron = window.require('electron');this.ipcRenderer = this.electron.ipcRenderer;this.webFrame = this.electron.webFrame;- this.remote = this.electron.remote; // window.require('@electron/remote'); // this.electron.remote;- this.workerWindow = this.remote.getGlobal('splashWorkerWindow');- this.win = this.remote.getCurrentWindow();- this.app = this.remote.app;- this.fs = fsextra; // window.require('fs-extra');+ this.fs = fsextra;this.pathUtils = window.require('path');}}- initMainMenu = (menuConfig: Array<Object>) => {- const { Menu } = this.remote;- const defaultMenu = Menu.buildFromTemplate(menuConfig);- Menu.setApplicationMenu(defaultMenu);- };-- initTrayMenu = (menuConfig: Array<Object>) => {+ /* initTrayMenu = (menuConfig: Array<Object>) => {const mainWindow = this.win;const { Menu } = this.remote;const { Tray } = this.remote;@@ -124,10 +106,10 @@ export default class ElectronIO {const trayMenu = Menu.buildFromTemplate(menuConfig);this.tsTray.setToolTip('TagSpaces');this.tsTray.setContextMenu(trayMenu);- };+ }; */- isWorkerAvailable = (): boolean => {- let workerAvailable = false;+ isWorkerAvailable = (): boolean =>+ /* let workerAvailable = false;try {if (this.workerWindow && this.workerWindow.webContents) {workerAvailable = true;@@ -135,14 +117,16 @@ export default class ElectronIO {} catch (err) {console.info('Error by finding if worker is available.');}- return workerAvailable;- };+ return workerAvailable; */++ this.ipcRenderer.sendSync('is-worker-available', 'notNeededArgument');showMainWindow = (): void => {- if (this.win.isMinimized()) {+ this.ipcRenderer.send('show-main-window', 'notNeededArgument');+ /* if (this.win.isMinimized()) {this.win.restore();}- this.win.show();+ this.win.show(); */};quitApp = (): void => {@@ -162,22 +146,15 @@ export default class ElectronIO {// Sets the current window on top of the windowsfocusWindow = (): void => {- this.win.focus();+ this.ipcRenderer.send('focus-window', 'notNeededArgument');+ // this.win.focus();};- getDevicePaths = (): Object => {- const paths = {- desktopFolder: this.app.getPath('desktop'),- documentsFolder: this.app.getPath('documents'),- downloadsFolder: this.app.getPath('downloads'),- musicFolder: this.app.getPath('music'),- picturesFolder: this.app.getPath('pictures'),- videosFolder: this.app.getPath('videos')- };- return paths;- };+ getDevicePaths = (): Object =>+ this.ipcRenderer.sendSync('get-device-paths', 'notNeededArgument');- getUserHomePath = (): string => this.app.getPath('home');+ getUserHomePath = (): string =>+ this.ipcRenderer.sendSync('get-user-home-path', 'notNeededArgument');getAppDataPath = (): string =>this.ipcRenderer.sendSync('app-data-path-request', 'notNeededArgument');@@ -236,7 +213,7 @@ export default class ElectronIO {new Promise((resolve, reject) => {if (this.isWorkerAvailable()) {const timestamp = new Date().getTime().toString();- this.workerWindow.webContents.send('worker', {+ this.ipcRenderer.send('worker', {id: timestamp,action: 'createDirectoryIndex',path: directoryPath,@@ -257,7 +234,7 @@ export default class ElectronIO {const tmbGenChannel = 'TMB_GEN_CHANNEL';this.ipcRenderer.removeAllListeners(tmbGenChannel);if (this.isWorkerAvailable()) {- this.workerWindow.webContents.send('worker', {+ this.ipcRenderer.send('worker', {id: tmbGenChannel,action: 'createThumbnails',tmbGenerationList@@ -877,14 +854,17 @@ export default class ElectronIO {resolveFilePath = (filePath: string): string => pathLib.resolve(filePath);- selectFileDialog = (): Promise<any> => {+ /**+ * not used+ */+ /* selectFileDialog = (): Promise<any> => {const options = {- /* filters: [- {- name: 'Images',- extensions: ['jpg', 'png', 'gif']- }- ] */+ // filters: [+ // {+ // name: 'Images',+ // extensions: ['jpg', 'png', 'gif']+ // }+ // ]};return new Promise((resolve, reject) => {this.remote.dialog@@ -902,13 +882,12 @@ export default class ElectronIO {reject('Error opening file ' + e);});});- };+ }; */- selectDirectoryDialog = (): Promise<any> => {- const options = {- properties: ['openDirectory', 'createDirectory']- };- return new Promise((resolve, reject) => {+ selectDirectoryDialog = (): Promise<any> =>+ this.ipcRenderer.invoke('select-directory-dialog', 'noArg');++ /* return new Promise((resolve, reject) => {this.remote.dialog.showOpenDialog(options).then(resultObject => {@@ -923,8 +902,7 @@ export default class ElectronIO {.catch(e => {reject('Error opening directory ' + e);});- });- };+ }); */shareFiles = (files: Array<string>) => {console.log('shareFiles is not implemented in electron.');diff --git a/app/services/electron-menus.ts b/app/services/electron-menus.tsindex 00bd9bdcf..db61f2e36 100644--- a/app/services/electron-menus.ts+++ b/app/services/electron-menus.ts@@ -16,59 +16,20 @@**/-import i18n from './i18n';-import PlatformIO from './platform-io';-import AppConfig from '../config';+import { app, Menu } from 'electron';+import Links from '-/links';-let ipcRenderer;--if (AppConfig.isElectron && window.require) {- const electron = window.require('electron');- ({ ipcRenderer } = electron);-}--export default function buildDesktopMenu(mainPageProps: any) {- if (!AppConfig.isElectron) {- return;+export default function buildDesktopMenu(props: any, i18n) {+ function quitApp() {+ app.quit();}- ipcRenderer.on('file', (event, arg) => {- // console.log('Global events: ' + arg);- switch (arg) {- case 'new-text-file':- mainPageProps.toggleCreateFileDialog();- break;- case 'open-search':- mainPageProps.openSearchPanel();- break;- case 'audio':- // console.log('showAudioRecordingDialog');- break;- case 'next-file': {- mainPageProps.openNextFile();- break;- }- case 'previous-file': {- mainPageProps.openPrevFile();- break;- }- default:- return false;- }- });-- ipcRenderer.on('play-pause', (event, arg) => {- // Create the event.- const audioEvent = new CustomEvent('toggle-resume', { detail: '' });- window.dispatchEvent(audioEvent);- });-const templateDefault = [{- label: i18n.t('core:file'),+ label: i18n.t('file'),submenu: [/* {- label: i18n.t('core:openNewInstance'),+ label: i18n.t('openNewInstance'),accelerator: '',click: () => {// ipcRenderer.send('new-win', 'newWin');@@ -78,28 +39,28 @@ export default function buildDesktopMenu(mainPageProps: any) {type: 'separator'}, */{- label: i18n.t('core:newFileNote'),+ label: i18n.t('newFileNote'),// accelerator: 'CommandOrControl+Alt+N',- click: mainPageProps.toggleCreateFileDialog+ click: props.toggleCreateFileDialog},{- label: i18n.t('core:createDirectory'),+ label: i18n.t('createDirectory'),accelerator: '',- click: mainPageProps.showCreateDirectoryDialog+ click: props.showCreateDirectoryDialog},{type: 'separator'},{- label: i18n.t('core:openLink'),+ label: i18n.t('openLink'),accelerator: 'Ctrl+o',- click: mainPageProps.toggleOpenLinkDialog+ click: props.toggleOpenLinkDialog},{type: 'separator'},/* {- label: i18n.t('core:saveFile'),+ label: i18n.t('saveFile'),accelerator: mainPageProps.keyBindings.saveDocument,click: () => {mainPageProps.saveFile();@@ -109,22 +70,22 @@ export default function buildDesktopMenu(mainPageProps: any) {type: 'separator'},{- label: i18n.t('core:exitApp'),+ label: i18n.t('exitApp'),accelerator: 'CmdOrCtrl+Q',- click: PlatformIO.quitApp+ click: quitApp // PlatformIO.quitApp}]},{- label: i18n.t('core:edit'),+ label: i18n.t('edit'),submenu: [{- label: i18n.t('core:undo'),+ label: i18n.t('undo'),accelerator: 'CmdOrCtrl+Z',role: 'undo'},{- label: i18n.t('core:redo'),+ label: i18n.t('redo'),accelerator: 'Shift+CmdOrCtrl+Z',role: 'redo'},@@ -132,55 +93,55 @@ export default function buildDesktopMenu(mainPageProps: any) {type: 'separator'},{- label: i18n.t('core:cut'),+ label: i18n.t('cut'),accelerator: 'CmdOrCtrl+X',role: 'cut'},{- label: i18n.t('core:copy'),+ label: i18n.t('copy'),accelerator: 'CmdOrCtrl+C',role: 'copy'},{- label: i18n.t('core:paste'),+ label: i18n.t('paste'),accelerator: 'CmdOrCtrl+V',role: 'paste'},{- label: i18n.t('core:selectAll'),+ label: i18n.t('selectAll'),accelerator: 'CmdOrCtrl+A',role: 'selectall'}]},{- label: i18n.t('core:view'),+ label: i18n.t('view'),submenu: [{- label: i18n.t('core:showLocationManager'),- accelerator: mainPageProps.keyBindings.showLocationManager,- click: mainPageProps.openLocationManagerPanel+ label: i18n.t('showLocationManager'),+ accelerator: props.keyBindings.showLocationManager,+ click: props.openLocationManagerPanel},{- label: i18n.t('core:showTagLibrary'),- accelerator: mainPageProps.keyBindings.showTagLibrary,- click: mainPageProps.openTagLibraryPanel+ label: i18n.t('showTagLibrary'),+ accelerator: props.keyBindings.showTagLibrary,+ click: props.openTagLibraryPanel},{- label: i18n.t('core:showSearch'),- accelerator: mainPageProps.keyBindings.showSearch,- click: mainPageProps.openSearchPanel+ label: i18n.t('showSearch'),+ accelerator: props.keyBindings.showSearch,+ click: props.openSearchPanel},{- label: i18n.t('core:showDevTools'),- accelerator: mainPageProps.keyBindings.openDevTools,+ label: i18n.t('showDevTools'),+ accelerator: props.keyBindings.openDevTools,click: (item, focusedWindow) => {focusedWindow.toggleDevTools();}},{- label: i18n.t('core:reloadApplication'),- accelerator: mainPageProps.keyBindings.reloadApplication,+ label: i18n.t('reloadApplication'),+ accelerator: props.keyBindings.reloadApplication,click: (item, focusedWindow) => {// ipcRenderer.send('relaunch-app', 'relaunch');focusedWindow.webContents.reload();@@ -190,45 +151,40 @@ export default function buildDesktopMenu(mainPageProps: any) {type: 'separator'},{- label: i18n.t('core:goback'),+ label: i18n.t('goback'),accelerator: 'Alt+Left',- click: () => {- window.history.back();- console.log('navigate to: ' + window.location.href);- }+ click: props.goBack},{- label: i18n.t('core:goforward'),+ label: i18n.t('goforward'),accelerator: 'Alt+Right',- click: () => {- window.history.forward();- console.log('navigate to: ' + window.location.href);- }+ click: props.goForward},{type: 'separator'},{- label: i18n.t('core:zoomReset'),+ label: i18n.t('zoomReset'),accelerator: 'CmdOrCtrl+0',- click: mainPageProps.setZoomResetApp+ click: props.setZoomResetApp},{- label: i18n.t('core:zoomIn'),+ label: i18n.t('zoomIn'),accelerator: 'CmdOrCtrl+Plus',- click: mainPageProps.setZoomInApp+ click: props.setZoomInApp},{- label: i18n.t('core:zoomOut'),+ label: i18n.t('zoomOut'),accelerator: 'CmdOrCtrl+-',- click: mainPageProps.setZoomOutApp+ click: props.setZoomOutApp},{- label: i18n.t('core:toggleFullScreen'),- accelerator: mainPageProps.keyBindings.toggleFullScreen,+ label: i18n.t('toggleFullScreen'),+ accelerator: props.keyBindings.toggleFullScreen,click: (item, focusedWindow) => {+ // props.toggleFullScreenif (focusedWindow.isFullScreen()) {- document.exitFullscreen();+ props.exitFullscreen();focusedWindow.setFullScreen(false);} else {focusedWindow.setFullScreen(true);@@ -239,101 +195,116 @@ export default function buildDesktopMenu(mainPageProps: any) {type: 'separator'},{- label: i18n.t('core:settings'),- click: mainPageProps.toggleSettingsDialog+ label: i18n.t('settings'),+ click: props.toggleSettingsDialog}]},{- label: '&' + i18n.t('core:help'),+ label: '&' + i18n.t('help'),submenu: [{- label: '&' + i18n.t('core:documentation'),- accelerator: mainPageProps.keyBindings.showHelp,- click: mainPageProps.openHelpFeedbackPanel+ label: '&' + i18n.t('documentation'),+ accelerator: props.keyBindings.showHelp,+ click: props.openHelpFeedbackPanel},{- label: '&' + i18n.t('core:shortcutKeys'),- click: mainPageProps.toggleKeysDialog+ label: '&' + i18n.t('shortcutKeys'),+ click: props.toggleKeysDialog},{label: 'Welcome Wizzard',- click: mainPageProps.toggleOnboardingDialog+ click: props.toggleOnboardingDialog},{- label: '&' + i18n.t('core:whatsNew'),+ label: '&' + i18n.t('whatsNew'),click: () => {- mainPageProps.openURLExternally(AppConfig.links.changelogURL, true);+ props.openURLExternally({+ url: Links.links.changelogURL,+ skipConfirm: true+ });}},{type: 'separator'},{- label: '&' + i18n.t('core:likeUsOnFacebook'),+ label: '&' + i18n.t('likeUsOnFacebook'),click: () => {- mainPageProps.openURLExternally(AppConfig.links.facebook);+ props.openURLExternally({+ url: Links.links.facebook+ });}},{- label: '&' + i18n.t('core:followOnTwitter'),+ label: '&' + i18n.t('followOnTwitter'),click: () => {- mainPageProps.openURLExternally(AppConfig.links.twitter);+ props.openURLExternally({+ url: Links.links.twitter+ });}},{type: 'separator'},{- label: '&' + i18n.t('core:suggestNewFeatures'),+ label: '&' + i18n.t('suggestNewFeatures'),click: () => {- mainPageProps.openURLExternally(AppConfig.links.suggestFeature);+ props.openURLExternally({+ url: Links.links.suggestFeature+ });}},{- label: '&' + i18n.t('core:reportIssues'),+ label: '&' + i18n.t('reportIssues'),click: () => {- mainPageProps.openURLExternally(AppConfig.links.reportIssue);+ props.openURLExternally({+ url: Links.links.reportIssue+ });}},{type: 'separator'},{- label: i18n.t('core:webClipperChrome'),+ label: i18n.t('webClipperChrome'),click: () => {- mainPageProps.openURLExternally(- AppConfig.links.webClipperChrome,- true- );+ props.openURLExternally({+ url: Links.links.webClipperChrome,+ skipConfirm: true+ });}},{- label: i18n.t('core:webClipperFirefox'),+ label: i18n.t('webClipperFirefox'),click: () => {- mainPageProps.openURLExternally(- AppConfig.links.webClipperFirefox,- true- );+ props.openURLExternally({+ url: Links.links.webClipperFirefox,+ skipConfirm: true+ });}},{type: 'separator'},{- label: '&' + i18n.t('core:license'),- click: mainPageProps.toggleLicenseDialog+ label: '&' + i18n.t('license'),+ click: props.toggleLicenseDialog},{- label: '&' + i18n.t('core:thirdPartyLibs'),- click: mainPageProps.toggleThirdPartyLibsDialog+ label: '&' + i18n.t('thirdPartyLibs'),+ click: props.toggleThirdPartyLibsDialog},{- label: '&' + i18n.t('core:aboutTagSpaces'),- click: mainPageProps.toggleAboutDialog+ label: '&' + i18n.t('aboutTagSpaces'),+ click: props.toggleAboutDialog}]}];- PlatformIO.initMainMenu(templateDefault);+ // PlatformIO.initMainMenu(templateDefault);++ // @ts-ignore+ const defaultMenu = Menu.buildFromTemplate(templateDefault); // menuConfig);+ Menu.setApplicationMenu(defaultMenu);}diff --git a/app/services/electron-tray-menu.ts b/app/services/electron-tray-menu.tsdeleted file mode 100644index d90ed6aa5..000000000--- a/app/services/electron-tray-menu.ts+++ /dev/null@@ -1,87 +0,0 @@-/**- * TagSpaces - universal file and folder organizer- * Copyright (C) 2017-present TagSpaces UG (haftungsbeschraenkt)- *- * This program is free software: you can redistribute it and/or modify- * it under the terms of the GNU Affero General Public License (version 3) as- * published by the Free Software Foundation.- *- * This program is distributed in the hope that it will be useful,- * but WITHOUT ANY WARRANTY; without even the implied warranty of- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the- * GNU Affero General Public License for more details.- *- * You should have received a copy of the GNU Affero General Public License- * along with this program. If not, see <https://www.gnu.org/licenses/>.- *- */--// import { webFrame, ipcRenderer } from 'electron';-import PlatformIO from './platform-io';-import i18n from './i18n';-import AppConfig from '../config';--export default function buildTrayIconMenu(mainPageProps: any) {- if (!AppConfig.isElectron) {- return;- }-- const cKey = AppConfig.isMacLike ? ' - Cmd' : ' - Ctrl';-- function openNextFile() {- mainPageProps.openNextFile();- }-- function openPrevFile() {- mainPageProps.openPrevFile();- }-- function playResumePlayback() {- const audioEvent = new CustomEvent('toggle-resume', { detail: '' });- window.dispatchEvent(audioEvent);- }-- const trayMenuTemplate = [- {- label: i18n.t('core:showTagSpaces') + cKey + '+Shift+W',- click: PlatformIO.showMainWindow- },- {- label: i18n.t('core:showSearch') + cKey + '+Shift+F',- click: mainPageProps.openSearchPanel- },- {- type: 'separator'- },- {- label: i18n.t('core:newFileNote') + cKey + '+Shift+N',- click: mainPageProps.toggleCreateFileDialog- },- {- type: 'separator'- },- {- label: i18n.t('core:openNextFileTooltip') + cKey + '+Shift+D',- click: openNextFile- },- {- label: i18n.t('core:openPrevFileTooltip') + cKey + '+Shift+A',- click: openPrevFile- },- {- type: 'separator'- },- {- label: i18n.t('core:pauseResumePlayback') + cKey + '+Shift+P',- click: playResumePlayback- },- {- type: 'separator'- },- {- label: i18n.t('core:quitTagSpaces') + cKey + '+Q',- click: PlatformIO.quitApp- }- ];- PlatformIO.initTrayMenu(trayMenuTemplate);-}diff --git a/app/utils/keyBindings.ts b/app/utils/keyBindings.tsnew file mode 100644index 000000000..7348749e5--- /dev/null+++ b/app/utils/keyBindings.ts@@ -0,0 +1,104 @@+export default function keyBindings(isMacLike) {+ return [+ {+ name: 'selectAll',+ command: (isMacLike ? 'command' : 'ctrl') + '+a'+ },+ {+ name: 'closeViewer',+ command: (isMacLike ? 'command' : 'ctrl') + '+w'+ },+ {+ name: 'saveDocument',+ command: (isMacLike ? 'command' : 'ctrl') + '+s'+ },+ {+ name: 'reloadDocument',+ command: (isMacLike ? 'command' : 'ctrl') + '+r'+ },+ {+ name: 'editDocument',+ command: (isMacLike ? 'command' : 'ctrl') + '+e'+ },+ {+ name: 'deleteDocument',+ command: 'del'+ },+ {+ name: 'showLocationManager',+ command: (isMacLike ? 'command' : 'ctrl') + '+1'+ },+ {+ name: 'showTagLibrary',+ command: (isMacLike ? 'command' : 'ctrl') + '+2'+ },+ {+ name: 'showSearch',+ command: (isMacLike ? 'command' : 'ctrl') + '+3'+ },+ {+ name: 'toggleShowHiddenEntries',+ command: (isMacLike ? 'command' : 'ctrl') + '+h'+ },+ {+ name: 'addRemoveTags',+ command: (isMacLike ? 'command' : 'ctrl') + '+t'+ },+ /* {+ name: 'propertiesDocument',+ command: 'alt+enter',+ }, */+ {+ name: 'nextDocument',+ command: 'down'+ },+ {+ name: 'prevDocument',+ command: 'up'+ },+ {+ name: 'showHelp',+ command: 'f1'+ },+ {+ name: 'reloadApplication',+ command: 'r a'+ },+ {+ name: 'toggleFullScreen',+ command: 'f11'+ },+ {+ name: 'openDevTools',+ command: 'f10'+ },+ {+ name: 'openSearch',+ command: (isMacLike ? 'command' : 'ctrl') + '+f'+ },+ {+ name: 'renameFile',+ command: 'f2'+ },+ {+ name: 'openEntry',+ command: 'enter'+ },+ {+ name: 'openParentDirectory',+ command: 'backspace'+ },+ {+ name: 'openFileExternally',+ command: (isMacLike ? 'command' : 'ctrl') + '+enter'+ },+ {+ name: 'zoomIn',+ command: (isMacLike ? 'command' : 'ctrl') + '+'+ },+ {+ name: 'zoomOut',+ command: (isMacLike ? 'command' : 'ctrl') + '-'+ }+ ];+}diff --git a/package.json b/package.jsonindex 67e3a6ada..892ba2a5e 100644--- a/package.json+++ b/package.json@@ -245,7 +245,6 @@"dependencies": {"@aws-amplify/ui-react": "^1.0.7","@date-io/date-fns": "^1.3.9",- "@electron/remote": "^1.2.0","@gorillastack/jmespath": "^1.3.0","@material-ui/core": "^4.11.3","@material-ui/icons": "^4.11.2",@@ -274,6 +273,7 @@"html2canvas": "^1.0.0-alpha.12","i18next": "^11.3.3","i18next-browser-languagedetector": "^2.0.0",+ "i18next-fs-backend": "^1.1.1","i18next-xhr-backend": "^1.4.2","jszip": "^3.1.5","leaflet": "^1.7.1",diff --git a/yarn.lock b/yarn.lockindex 60f883c4c..d805a40e1 100644--- a/yarn.lock+++ b/yarn.lock@@ -3507,11 +3507,6 @@global-agent "^2.0.2"global-tunnel-ng "^2.7.1"-"@electron/remote@^1.2.0":- version "1.2.0"- resolved "https://registry.yarnpkg.com/@electron/remote/-/remote-1.2.0.tgz#772eb4c3ac17aaba5a9cf05a09092f6277f5671f"- integrity sha512-C774t2DFVJsa+dxU9Gc2nYzylRZoJ79I0Sxrh8T9cN69fBkntfGbyBEQiD9UfZopqL0CYLzk1anY2Ywhql6h1w==-"@electron/[email protected]":version "1.0.4"resolved "https://registry.yarnpkg.com/@electron/universal/-/universal-1.0.4.tgz#231ac246c39d45b80e159bd21c3f9027dcaa10f5"@@ -10188,6 +10183,11 @@ i18next-browser-languagedetector@^2.0.0:resolved "https://registry.yarnpkg.com/i18next-browser-languagedetector/-/i18next-browser-languagedetector-2.2.4.tgz#b02412d7ab15d7d74e1b1317d67d8a244b219ee3"integrity sha512-wPbtH18FdOuB245I8Bhma5/XSDdN/HpYlX+wga1eMy+slhaFQSnrWX6fp+aYSL2eEuj0RlfHeEVz6Fo/lxAj6A==+i18next-fs-backend@^1.1.1:+ version "1.1.1"+ resolved "https://registry.yarnpkg.com/i18next-fs-backend/-/i18next-fs-backend-1.1.1.tgz#1d8028926803f63784ffa0f2b1478fb369f92735"+ integrity sha512-RFkfy10hNxJqc7MVAp5iAZq0Tum6msBCNebEe3OelOBvrROvzHUPaR8Qe10RQrOGokTm0W4vJGEJzruFkEt+hQ==+i18next-xhr-backend@^1.4.2:version "1.5.1"resolved "https://registry.yarnpkg.com/i18next-xhr-backend/-/i18next-xhr-backend-1.5.1.tgz#50282610780c6a696d880dfa7f4ac1d01e8c3ad5"