@@ -17,7 +17,7 @@ import {
17
17
ToolbarGroup ,
18
18
} from '@wordpress/components' ;
19
19
import { useDispatch , useSelect } from '@wordpress/data' ;
20
- import { renderToString , useRef } from '@wordpress/element' ;
20
+ import { renderToString } from '@wordpress/element' ;
21
21
import { __ } from '@wordpress/i18n' ;
22
22
import { useInstanceId } from '@wordpress/compose' ;
23
23
import { store as noticeStore } from '@wordpress/notices' ;
@@ -58,15 +58,11 @@ export default function TableOfContentsEdit( {
58
58
) ;
59
59
60
60
// If a user clicks to a link prevent redirection and show a warning.
61
- const { createWarningNotice, removeNotice } = useDispatch ( noticeStore ) ;
62
- const noticeIdRef = useRef ( ) ;
61
+ const { createWarningNotice } = useDispatch ( noticeStore ) ;
63
62
const showRedirectionPreventedNotice = ( event ) => {
64
63
event . preventDefault ( ) ;
65
- // Remove previous warning if any, to show one at a time per block.
66
- removeNotice ( noticeIdRef . current ) ;
67
- noticeIdRef . current = `block-library/core/table-of-contents/redirection-prevented/${ instanceId } ` ;
68
64
createWarningNotice ( __ ( 'Links are disabled in the editor.' ) , {
69
- id : noticeIdRef . current ,
65
+ id : `block-library/core/table-of-contents/redirection-prevented/ ${ instanceId } ` ,
70
66
type : 'snackbar' ,
71
67
} ) ;
72
68
} ;
0 commit comments