Skip to content

Commit

Permalink
Removed HTML tags from excerpt and only displaying text
Browse files Browse the repository at this point in the history
  • Loading branch information
Amartya committed Apr 24, 2019
1 parent c2b2d9f commit 2699ea4
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion packages/block-library/src/latest-posts/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -193,8 +193,11 @@ class LatestPostsEdit extends Component {
const titleTrimmed = post.title.rendered.trim();
let excerpt = post.excerpt.rendered;
if ( post.excerpt.raw === '' ) {
excerpt = post.content.rendered;
excerpt = post.content.raw;
}
const temp = document.createElement( 'div' );
temp.innerHTML = excerpt;
excerpt = temp.textContent || temp.innerText || '';
return (
<li key={ i }>
<a href={ post.link } target="_blank" rel="noreferrer noopener">
Expand Down

0 comments on commit 2699ea4

Please sign in to comment.