diff options
author | 2023-06-17 15:37:45 +0100 | |
---|---|---|
committer | 2023-06-17 15:37:45 +0100 | |
commit | 61ced65b756d9120e77155a849877580e4cbcc64 (patch) | |
tree | 83ea02c6ea3c917dbfe26418062d542a1bba6f27 /src/components/settings/releaseNotes/ReleaseNotesDashboard.tsx | |
parent | 6.4.0-nightly.5 [skip ci] (diff) | |
download | ferdium-app-61ced65b756d9120e77155a849877580e4cbcc64.tar.gz ferdium-app-61ced65b756d9120e77155a849877580e4cbcc64.tar.zst ferdium-app-61ced65b756d9120e77155a849877580e4cbcc64.zip |
fix: changelog links opening in-app instead of browser (#1241)
Diffstat (limited to 'src/components/settings/releaseNotes/ReleaseNotesDashboard.tsx')
-rw-r--r-- | src/components/settings/releaseNotes/ReleaseNotesDashboard.tsx | 31 |
1 files changed, 12 insertions, 19 deletions
diff --git a/src/components/settings/releaseNotes/ReleaseNotesDashboard.tsx b/src/components/settings/releaseNotes/ReleaseNotesDashboard.tsx index d0be82312..ff7c45bb1 100644 --- a/src/components/settings/releaseNotes/ReleaseNotesDashboard.tsx +++ b/src/components/settings/releaseNotes/ReleaseNotesDashboard.tsx | |||
@@ -2,7 +2,6 @@ import { Component } from 'react'; | |||
2 | import { observer } from 'mobx-react'; | 2 | import { observer } from 'mobx-react'; |
3 | import { defineMessages, injectIntl } from 'react-intl'; | 3 | import { defineMessages, injectIntl } from 'react-intl'; |
4 | import Markdown from 'markdown-to-jsx'; | 4 | import Markdown from 'markdown-to-jsx'; |
5 | import { openExternalUrl } from '../../../helpers/url-helpers'; | ||
6 | import { ferdiumVersion } from '../../../environment-remote'; | 5 | import { ferdiumVersion } from '../../../environment-remote'; |
7 | import { | 6 | import { |
8 | getFerdiumVersion, | 7 | getFerdiumVersion, |
@@ -53,25 +52,12 @@ class ReleaseNotesDashboard extends Component<IProps> { | |||
53 | this.setState({ | 52 | this.setState({ |
54 | data, | 53 | data, |
55 | }); | 54 | }); |
56 | |||
57 | for (const link of document.querySelectorAll('.releasenotes__body a')) { | ||
58 | link.addEventListener('click', this.handleClick.bind(this), false); | ||
59 | } | ||
60 | } | ||
61 | |||
62 | handleClick(e) { | ||
63 | e.preventDefault(); | ||
64 | openExternalUrl(e.target.href); | ||
65 | } | 55 | } |
66 | 56 | ||
67 | componentWillUnmount() { | 57 | overrideAnchor = props => ( |
68 | document.removeEventListener( | 58 | // eslint-disable-next-line jsx-a11y/anchor-has-content |
69 | 'click', | 59 | <a {...props} target="_blank" rel="noopener noreferrer" /> |
70 | // eslint-disable-next-line unicorn/no-invalid-remove-event-listener | 60 | ); |
71 | this.handleClick.bind(this), | ||
72 | false, | ||
73 | ); | ||
74 | } | ||
75 | 61 | ||
76 | render() { | 62 | render() { |
77 | const { intl } = this.props; | 63 | const { intl } = this.props; |
@@ -89,7 +75,14 @@ class ReleaseNotesDashboard extends Component<IProps> { | |||
89 | </span> | 75 | </span> |
90 | </div> | 76 | </div> |
91 | <div className="settings__body releasenotes__body"> | 77 | <div className="settings__body releasenotes__body"> |
92 | <Markdown options={{ wrapper: 'article' }}>{data}</Markdown> | 78 | <Markdown |
79 | options={{ | ||
80 | wrapper: 'article', | ||
81 | overrides: { a: this.overrideAnchor }, | ||
82 | }} | ||
83 | > | ||
84 | {data} | ||
85 | </Markdown> | ||
93 | </div> | 86 | </div> |
94 | </div> | 87 | </div> |
95 | ); | 88 | ); |