diff options
Diffstat (limited to 'src/components/ui/Link.js')
-rw-r--r-- | src/components/ui/Link.js | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/components/ui/Link.js b/src/components/ui/Link.js index fd14b7018..003211e5c 100644 --- a/src/components/ui/Link.js +++ b/src/components/ui/Link.js | |||
@@ -1,4 +1,3 @@ | |||
1 | import { shell } from 'electron'; | ||
2 | import React, { Component } from 'react'; | 1 | import React, { Component } from 'react'; |
3 | import PropTypes from 'prop-types'; | 2 | import PropTypes from 'prop-types'; |
4 | import { inject, observer } from 'mobx-react'; | 3 | import { inject, observer } from 'mobx-react'; |
@@ -7,15 +6,18 @@ import classnames from 'classnames'; | |||
7 | 6 | ||
8 | import { oneOrManyChildElements } from '../../prop-types'; | 7 | import { oneOrManyChildElements } from '../../prop-types'; |
9 | import { matchRoute } from '../../helpers/routing-helpers'; | 8 | import { matchRoute } from '../../helpers/routing-helpers'; |
9 | import { openExternalUrl } from '../../helpers/url-helpers'; | ||
10 | 10 | ||
11 | // TODO: create container component for this component | 11 | // TODO: create container component for this component |
12 | export default @inject('stores') @observer class Link extends Component { | 12 | export default @inject('stores') @observer class Link extends Component { |
13 | onClick(e) { | 13 | onClick(e) { |
14 | if (this.props.disabled) e.preventDefault(); | 14 | if (this.props.disabled) { |
15 | else if (this.props.target === '_blank') { | ||
16 | e.preventDefault(); | 15 | e.preventDefault(); |
17 | shell.openExternal(this.props.to); | 16 | } else if (this.props.target === '_blank') { |
17 | e.preventDefault(); | ||
18 | openExternalUrl(this.props.to, true); | ||
18 | } | 19 | } |
20 | // Note: if neither of the above, then let the other onClick handlers process it | ||
19 | } | 21 | } |
20 | 22 | ||
21 | render() { | 23 | render() { |