diff --git a/app/updater.js b/app/updater.js index bdb35a7762..e616523c02 100644 --- a/app/updater.js +++ b/app/updater.js @@ -12,10 +12,7 @@ let updating = false let foundUpdates = false autoUpdater.on('error', error => { - dialog.showErrorBox( - 'Error: ', - error == null ? 'unknown' : (error.stack || error).toString() - ) + console.info(error.stack || error) }) autoUpdater.on('update-available', () => { diff --git a/index.html b/index.html index 8dfefd7863..2df156f964 100644 --- a/index.html +++ b/index.html @@ -8,5 +8,15 @@
+ diff --git a/src/components/PreferencesModal/AboutTab.tsx b/src/components/PreferencesModal/AboutTab.tsx index 89d698b5c8..c903d5ce96 100644 --- a/src/components/PreferencesModal/AboutTab.tsx +++ b/src/components/PreferencesModal/AboutTab.tsx @@ -1,11 +1,12 @@ -import React from 'react' +import React, { useCallback } from 'react' import styled from '../../lib/styled' import { Section, SectionHeader, SectionSubtleText, - PrimaryText + PrimaryAnchor } from './styled' +import { openNew } from '../../lib/utils/platform' const AboutContents = styled.div` max-width: 360px; @@ -72,6 +73,27 @@ const AboutContents = styled.div` } ` +interface PrimaryLinkProps { + href: string + children: string +} + +const PrimaryLink = ({ href, children }: PrimaryLinkProps) => { + const handleClick = useCallback( + (event: React.MouseEvent) => { + event.preventDefault() + openNew(href) + }, + [href] + ) + + return ( + + {children} + + ) +} + const AboutTab = () => { return (
@@ -90,13 +112,12 @@ const AboutTab = () => { you.

- + Official Website - - + + Boost Note for Team - - {/* Development: Development configuration for Boostnote */} +

@@ -111,39 +132,41 @@ const AboutTab = () => {
diff --git a/src/components/PreferencesModal/styled.tsx b/src/components/PreferencesModal/styled.tsx index 7fef05279e..734ea1aceb 100644 --- a/src/components/PreferencesModal/styled.tsx +++ b/src/components/PreferencesModal/styled.tsx @@ -34,7 +34,7 @@ export const SectionSubtleText = styled.p` ${disabledUiTextColor} ` -export const PrimaryText = styled.a` +export const PrimaryAnchor = styled.a` ${PrimaryTextColor} ` diff --git a/src/components/atoms/MarkdownPreviewer.tsx b/src/components/atoms/MarkdownPreviewer.tsx index d2f982ca42..a14fb32155 100644 --- a/src/components/atoms/MarkdownPreviewer.tsx +++ b/src/components/atoms/MarkdownPreviewer.tsx @@ -15,6 +15,7 @@ import useForceUpdate from 'use-force-update' import styled from '../../lib/styled' import cc from 'classcat' import { useDb } from '../../lib/db' +import { openNew } from '../../lib/utils/platform' const schema = mergeDeepRight(gh, { attributes: { '*': ['className'] } }) @@ -193,6 +194,19 @@ const MarkdownPreviewer = ({ } return + }, + a: ({ href, children }: any) => { + return ( + { + event.preventDefault() + openNew(href) + }} + > + {children} + + ) } } }) diff --git a/src/lib/utils/platform.ts b/src/lib/utils/platform.ts index f02c9e7475..41ee45dc3b 100644 --- a/src/lib/utils/platform.ts +++ b/src/lib/utils/platform.ts @@ -1,8 +1,12 @@ -export const isElectron = () => navigator.userAgent.indexOf('Electron') >= 0 +import isElectron from 'is-electron' + +declare function $openExternal(url: string): void export const openNew = (url: string) => { if (isElectron()) { - // electron implementation + if (url.length > 0) { + $openExternal(url) + } } else { window.open(url, '_blank') }