Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions app/updater.js
Original file line number Diff line number Diff line change
Expand Up @@ -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', () => {
Expand Down
10 changes: 10 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,15 @@
</head>
<body>
<div id="root"></div>
<script>
;(function() {
const electron = require('electron')
function $openExternal(url) {
console.log('opening ...', url)
electron.shell.openExternal(url)
}
window.$openExternal = $openExterna
})()
</script>
</body>
</html>
63 changes: 43 additions & 20 deletions src/components/PreferencesModal/AboutTab.tsx
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -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 (
<PrimaryAnchor href={href} onClick={handleClick}>
{children}
</PrimaryAnchor>
)
}

const AboutTab = () => {
return (
<div>
Expand All @@ -90,13 +112,12 @@ const AboutTab = () => {
you.
</p>
<p>
<PrimaryText href='//boostnote.io/'>
<PrimaryLink href='https://boostnote.io/'>
Official Website
</PrimaryText>
<PrimaryText href='//boostnote.io/wiki/'>
</PrimaryLink>
<PrimaryLink href='https://boostnote.io/wiki/'>
Boost Note for Team
</PrimaryText>
{/* <PrimaryText href='github.com/BoostIO/BoostNote.next/blob/master/docs/build.md'>Development: Development configuration for Boostnote</PrimaryText> */}
</PrimaryLink>
</p>
</div>
</div>
Expand All @@ -111,39 +132,41 @@ const AboutTab = () => {
<div className='about-community-links'>
<ul>
<li>
<PrimaryText href='//issuehunt.io/r/BoostIo/Boostnote'>
<PrimaryLink href='https://issuehunt.io/r/BoostIo/Boostnote'>
Bounty on IssueHunt
</PrimaryText>
</PrimaryLink>
</li>
<li>
<PrimaryText href='//github.com/BoostIO/BoostNote.next'>
<PrimaryLink href='https://github.com/BoostIO/BoostNote.next'>
GitHub
</PrimaryText>
</PrimaryLink>
</li>
<li>
<PrimaryText href='//medium.com/boostnote'>Blog</PrimaryText>
<PrimaryLink href='https://medium.com/boostnote'>
Blog
</PrimaryLink>
</li>
</ul>
<ul>
<li>
<PrimaryText href='//boostnote-group.slack.com/join/shared_invite/enQtMzkxOTk4ODkyNzc0LWQxZTQwNjBlMDI4YjkyYjg2MTRiZGJhNzA1YjQ5ODA5M2M0M2NlMjI5YjhiYWQzNzgzYmU0MDMwOTlmZmZmMGE'>
<PrimaryLink href='https://boostnote-group.slack.com/join/shared_invite/enQtMzkxOTk4ODkyNzc0LWQxZTQwNjBlMDI4YjkyYjg2MTRiZGJhNzA1YjQ5ODA5M2M0M2NlMjI5YjhiYWQzNzgzYmU0MDMwOTlmZmZmMGE'>
Slack Group
</PrimaryText>
</PrimaryLink>
</li>
<li>
<PrimaryText href='//twitter.com/boostnoteapp'>
<PrimaryLink href='https://twitter.com/boostnoteapp'>
Twitter Account
</PrimaryText>
</PrimaryLink>
</li>
<li>
<PrimaryText href='//www.facebook.com/groups/boostnote/'>
<PrimaryLink href='https://www.facebook.com/groups/boostnote/'>
Facebook Group
</PrimaryText>
</PrimaryLink>
</li>
<li>
<PrimaryText href='//www.reddit.com/r/Boostnote/'>
<PrimaryLink href='https://www.reddit.com/r/Boostnote/'>
Reddit
</PrimaryText>
</PrimaryLink>
</li>
</ul>
</div>
Expand Down
2 changes: 1 addition & 1 deletion src/components/PreferencesModal/styled.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export const SectionSubtleText = styled.p`
${disabledUiTextColor}
`

export const PrimaryText = styled.a`
export const PrimaryAnchor = styled.a`
${PrimaryTextColor}
`

Expand Down
14 changes: 14 additions & 0 deletions src/components/atoms/MarkdownPreviewer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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'] } })

Expand Down Expand Up @@ -193,6 +194,19 @@ const MarkdownPreviewer = ({
}

return <img {...props} src={src} />
},
a: ({ href, children }: any) => {
return (
<a
href={href}
onClick={event => {
event.preventDefault()
openNew(href)
}}
>
{children}
</a>
)
}
}
})
Expand Down
8 changes: 6 additions & 2 deletions src/lib/utils/platform.ts
Original file line number Diff line number Diff line change
@@ -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')
}
Expand Down