File tree Expand file tree Collapse file tree 3 files changed +13
-3
lines changed
pipeline-console-view/pipeline-console/main Expand file tree Collapse file tree 3 files changed +13
-3
lines changed Original file line number Diff line number Diff line change 1+ import { Opts } from "linkifyjs" ;
2+
3+ export const linkifyJsOptions : Opts = {
4+ rel : "noopener noreferrer" ,
5+ validate : {
6+ url : ( value ) => / ^ h t t p s ? : \/ \/ / . test ( value ) ,
7+ } ,
8+ } ;
Original file line number Diff line number Diff line change 11import linkifyHtml from "linkify-html" ;
22import { memo , useEffect , useRef } from "react" ;
33
4+ import { linkifyJsOptions } from "../../../common/utils/linkify-js.ts" ;
45import { makeReactChildren , tokenizeANSIString } from "./Ansi.tsx" ;
56
67export interface ConsoleLineProps {
@@ -45,7 +46,7 @@ export const ConsoleLine = memo(function ConsoleLine(props: ConsoleLineProps) {
4546 className = "console-text"
4647 >
4748 { makeReactChildren (
48- tokenizeANSIString ( linkifyHtml ( props . content ) ) ,
49+ tokenizeANSIString ( linkifyHtml ( props . content , linkifyJsOptions ) ) ,
4950 `${ props . stepId } -${ props . lineNumber } ` ,
5051 ) }
5152 </ div >
Original file line number Diff line number Diff line change @@ -12,6 +12,7 @@ import StatusIcon from "../../../common/components/status-icon.tsx";
1212import Tooltip from "../../../common/components/tooltip.tsx" ;
1313import { LocalizedMessageKey , useMessages } from "../../../common/i18n" ;
1414import { classNames } from "../../../common/utils/classnames.ts" ;
15+ import { linkifyJsOptions } from "../../../common/utils/linkify-js.ts" ;
1516import LiveTotal from "../../../common/utils/live-total.tsx" ;
1617import {
1718 LOG_FETCH_SIZE ,
@@ -69,13 +70,13 @@ export default function ConsoleLogCard(props: ConsoleLogCardProps) {
6970
7071 { props . step . title !== "" && (
7172 < span >
72- < Linkify > { props . step . title } </ Linkify >
73+ < Linkify options = { linkifyJsOptions } > { props . step . title } </ Linkify >
7374 </ span >
7475 ) }
7576
7677 { props . step . name !== "" && (
7778 < span >
78- < Linkify > { props . step . name } </ Linkify >
79+ < Linkify options = { linkifyJsOptions } > { props . step . name } </ Linkify >
7980 </ span >
8081 ) }
8182
You can’t perform that action at this time.
0 commit comments