X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/75fbb4eabf0da2fceebf8196bec769e4cbc6547b..28aa75d2683d5f0472335ecef3b2ff505e72f30d:/services/workbench2/src/components/code-snippet/code-snippet.tsx diff --git a/services/workbench2/src/components/code-snippet/code-snippet.tsx b/services/workbench2/src/components/code-snippet/code-snippet.tsx index 209dbc44b5..3be1e4fc71 100644 --- a/services/workbench2/src/components/code-snippet/code-snippet.tsx +++ b/services/workbench2/src/components/code-snippet/code-snippet.tsx @@ -54,8 +54,8 @@ const mapStateToProps = (state: RootState): CodeSnippetAuthProps => ({ export const CodeSnippet = withStyles(styles)(connect(mapStateToProps)( ({ classes, lines, linked, className, apiResponse, dispatch, auth, children, inline }: CodeSnippetProps & CodeSnippetAuthProps & DispatchProp) => + component="div" + className={classNames([classes.root, className, inline ? classes.inlineRoot : undefined])}> {children} {linked ? @@ -64,9 +64,9 @@ export const CodeSnippet = withStyles(styles)(connect(mapStateToProps)( } - )); +)); -const renderLinks = (auth: FederationConfig, dispatch: Dispatch) => (text: string): JSX.Element => { +export const renderLinks = (auth: FederationConfig, dispatch: Dispatch) => (text: string): JSX.Element => { // Matches UUIDs & PDHs const REGEX = /[a-z0-9]{5}-[a-z0-9]{5}-[a-z0-9]{15}|[0-9a-f]{32}\+\d+/g; const links = text.match(REGEX); @@ -78,18 +78,18 @@ const renderLinks = (auth: FederationConfig, dispatch: Dispatch) => (text: strin {part} {links[index] && - { - const url = getNavUrl(links[index], auth) - if (url) { - window.open(`${window.location.origin}${url}`, '_blank'); - } else { - dispatch(navigationNotAvailable(links[index])); - } - }} - style={ {cursor: 'pointer'} }> - {links[index]} - } + { + const url = getNavUrl(links[index], auth) + if (url) { + window.open(`${window.location.origin}${url}`, '_blank', "noopener"); + } else { + dispatch(navigationNotAvailable(links[index])); + } + }} + style={{ cursor: 'pointer' }}> + {links[index]} + } )} ; - }; +};