Skip to content

Commit

Permalink
Improved external links in docs (#2004)
Browse files Browse the repository at this point in the history
  • Loading branch information
RunDevelopment committed Jul 28, 2023
1 parent aa8fb81 commit 5bd265c
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/renderer/components/NodeDocumentation/docsMarkdown.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import { Code, Link, Text } from '@chakra-ui/react';
import ChakraUIRenderer from 'chakra-ui-markdown-renderer';
import { shell } from 'electron';
import { memo } from 'react';
import { Components } from 'react-markdown';
import { useContext } from 'use-context-selector';
import { SchemaId } from '../../../common/common-types';
import { log } from '../../../common/log';
import { BackendContext } from '../../contexts/BackendContext';
import { SupportHighlighting } from './HighlightContainer';
import { SchemaLink } from './SchemaLink';
Expand All @@ -28,8 +30,14 @@ const getDocsMarkdownComponents = (interactive: boolean): Components => {
<Link
isExternal
href={href}
textColor={interactive && href ? 'blue.500' : 'inherit'}
textColor={interactive && href ? 'var(--link-color)' : 'inherit'}
textDecoration={interactive && href ? 'underline' : 'inherit'}
onClick={(e) => {
e.preventDefault();
if (interactive && href) {
shell.openExternal(href).catch(log.error);
}
}}
>
{children}
</Link>
Expand Down

0 comments on commit 5bd265c

Please sign in to comment.