@@ -23,6 +23,9 @@ import {
2323 LOCKED ,
2424 MANUAL ,
2525} from '../../constants' ;
26+ import { buildBlockContainerUrl } from '../utils' ;
27+ import { useCourseAuthoringContext } from '@src/CourseAuthoringContext' ;
28+ import { Link } from 'react-router-dom' ;
2629
2730const BrokenLinkHref : FC < { href : string ; } > = ( { href } ) => {
2831 const handleClick = ( event : React . MouseEvent < HTMLAnchorElement > ) => {
@@ -40,16 +43,11 @@ const BrokenLinkHref: FC<{ href: string; }> = ({ href }) => {
4043} ;
4144
4245const GoToBlock : FC < { block : { url : string ; displayName ?: string ; } ; } > = ( { block } ) => {
43- const handleClick = ( event : React . MouseEvent < HTMLAnchorElement > ) => {
44- event . preventDefault ( ) ;
45- window . open ( block . url , '_blank' ) ;
46- } ;
47-
4846 return (
4947 < div className = "go-to-block-link-container" >
50- < a href = { block . url } onClick = { handleClick } className = "broken-link" rel = "noreferrer" >
48+ < Link to = { block . url } className = "broken-link" rel = "noreferrer" target = "_blank ">
5149 { block . displayName }
52- </ a >
50+ </ Link >
5351 </ div >
5452 ) ;
5553} ;
@@ -181,6 +179,7 @@ const BrokenLinkTable: FC<BrokenLinkTableProps> = ({
181179 updatedLinkMap = { } ,
182180 updatedLinkInProgress = { } ,
183181} ) => {
182+ const { courseId } = useCourseAuthoringContext ( ) ;
184183 const brokenLinkList = unit . blocks . reduce (
185184 (
186185 acc : TableData ,
@@ -208,7 +207,11 @@ const BrokenLinkTable: FC<BrokenLinkTableProps> = ({
208207 return {
209208 Links : (
210209 < LinksCol
211- block = { { url : block . url , displayName : block . displayName || 'Go to block' , id : block . id } }
210+ block = { {
211+ url : buildBlockContainerUrl ( courseId , unit . id , block . id ) ,
212+ displayName : block . displayName || 'Go to block' ,
213+ id : block . id ,
214+ } }
212215 href = { displayLink }
213216 showIcon = { false }
214217 showUpdateButton
@@ -237,7 +240,10 @@ const BrokenLinkTable: FC<BrokenLinkTableProps> = ({
237240 const blockBrokenLinks = block . brokenLinks . map ( ( link ) => ( {
238241 Links : (
239242 < LinksCol
240- block = { { url : block . url , displayName : block . displayName || 'Go to block' } }
243+ block = { {
244+ url : buildBlockContainerUrl ( courseId , unit . id , block . id ) ,
245+ displayName : block . displayName || 'Go to block' ,
246+ } }
241247 href = { link }
242248 linkType = { BROKEN }
243249 />
@@ -253,7 +259,10 @@ const BrokenLinkTable: FC<BrokenLinkTableProps> = ({
253259 const blockLockedLinks = block . lockedLinks . map ( ( link ) => ( {
254260 Links : (
255261 < LinksCol
256- block = { { url : block . url , displayName : block . displayName || 'Go to block' } }
262+ block = { {
263+ url : buildBlockContainerUrl ( courseId , unit . id , block . id ) ,
264+ displayName : block . displayName || 'Go to block' ,
265+ } }
257266 href = { link }
258267 linkType = { LOCKED }
259268 />
@@ -270,7 +279,10 @@ const BrokenLinkTable: FC<BrokenLinkTableProps> = ({
270279 const externalForbiddenLinks = block . externalForbiddenLinks . map ( ( link ) => ( {
271280 Links : (
272281 < LinksCol
273- block = { { url : block . url , displayName : block . displayName || 'Go to block' } }
282+ block = { {
283+ url : buildBlockContainerUrl ( courseId , unit . id , block . id ) ,
284+ displayName : block . displayName || 'Go to block' ,
285+ } }
274286 href = { link }
275287 linkType = { MANUAL }
276288 />
0 commit comments