Skip to content

Commit

Permalink
fix: correctly resolve doc URLs for links with child elements (#473)
Browse files Browse the repository at this point in the history
  • Loading branch information
dm-p committed Aug 1, 2024
1 parent 032a36a commit 633bc22
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/features/json-editor/components/json-editor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -245,13 +245,13 @@ const getDefaultValue = (role: TEditorRole) => {
* host.
*/
const onLinkClick = (e: MouseEvent) => {
if (
e.target instanceof HTMLAnchorElement &&
e.target.getAttribute('data-href')
) {
const url = (e.target as HTMLElement)
.closest('a')
?.getAttribute('data-href');
if (url) {
e.preventDefault();
e.stopPropagation();
launchUrl(e.target.getAttribute('data-href'));
launchUrl(url);
}
};

Expand Down

0 comments on commit 633bc22

Please sign in to comment.