Merge pull request #166 from matrix-org/rav/keys_on_search_highlights
Give <a> elements in search results a key
This commit is contained in:
commit
3f1db5ac86
1 changed files with 7 additions and 9 deletions
|
@ -146,19 +146,17 @@ class TextHighlighter extends BaseHighlighter {
|
||||||
* returns a React node
|
* returns a React node
|
||||||
*/
|
*/
|
||||||
_processSnippet(snippet, highlight) {
|
_processSnippet(snippet, highlight) {
|
||||||
var spanProps = {
|
var key = this._key++;
|
||||||
key: this._key++,
|
|
||||||
};
|
|
||||||
|
|
||||||
if (highlight) {
|
var node =
|
||||||
spanProps.className = this.highlightClass;
|
<span key={key} className={highlight ? this.highlightClass : null }>
|
||||||
}
|
{ snippet }
|
||||||
|
</span>;
|
||||||
var node = <span {...spanProps}>{ snippet }</span>;
|
|
||||||
|
|
||||||
if (highlight && this.highlightLink) {
|
if (highlight && this.highlightLink) {
|
||||||
node = <a href={this.highlightLink}>{node}</a>
|
node = <a key={key} href={this.highlightLink}>{node}</a>
|
||||||
}
|
}
|
||||||
|
|
||||||
return node;
|
return node;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue