Skip to content

Commit 72ff514

Browse files
Merge pull request #4 from WebDevStudios/bug/html-entities-fix
Adds support for decoding html entities in post title correctly.
2 parents 2ad1ac4 + 8e580d8 commit 72ff514

File tree

4 files changed

+31
-7
lines changed

4 files changed

+31
-7
lines changed

assets/js/components/searchResult.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
import React from 'react';
2-
2+
import { decodeEntities } from '@wordpress/html-entities';
33
export default class SearchResult extends React.Component {
44

55
constructor( props ) {
66
super( props );
77
}
88

9-
render() {
9+
render() {
1010
return (
1111
<li className="search-results-item">
12-
<a href={ this.props.result.link }>{ this.props.result.title }</a>
12+
<a href={ this.props.result.link }>{ decodeEntities( this.props.result.title ) }</a>
1313
</li>
1414
)
1515
}

assets/js/public.min.js

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package-lock.json

Lines changed: 23 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
"description": "Power up the basic WordPress search field with React.",
55
"main": "assets/js/public.js",
66
"dependencies": {
7+
"@wordpress/html-entities": "^2.0.2",
78
"babel-core": "^6.26.3",
89
"babel-loader": "^7.1.4",
910
"babel-preset-env": "^1.7.0",

0 commit comments

Comments
 (0)