Skip to content

Commit

Permalink
[Block Library - Latest Posts]: Prevent opening the links in editor
Browse files Browse the repository at this point in the history
  • Loading branch information
ntsekouras committed Apr 25, 2022
1 parent e34aac6 commit 43e126e
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion packages/block-library/src/latest-posts/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -466,7 +466,11 @@ export default function LatestPostsEdit( { attributes, setAttributes } ) {
.join( ' ' ) }
{ /* translators: excerpt truncation character, default … */ }
{ __( ' … ' ) }
<a href={ post.link } rel="noopener noreferrer">
<a
href={ post.link }
onClick={ ( event ) => event.preventDefault() }
rel="noopener noreferrer"
>
{ __( 'Read more' ) }
</a>
</>
Expand All @@ -482,6 +486,9 @@ export default function LatestPostsEdit( { attributes, setAttributes } ) {
<a
className="wp-block-latest-posts__post-title"
href={ post.link }
onClick={ ( event ) =>
event.preventDefault()
}
rel="noreferrer noopener"
>
{ featuredImage }
Expand All @@ -493,6 +500,7 @@ export default function LatestPostsEdit( { attributes, setAttributes } ) {
) }
<a
href={ post.link }
onClick={ ( event ) => event.preventDefault() }
rel="noreferrer noopener"
dangerouslySetInnerHTML={
!! titleTrimmed
Expand Down

0 comments on commit 43e126e

Please sign in to comment.