diff options
author | Marcin Aman <maman@virtuslab.com> | 2020-07-30 13:37:53 +0200 |
---|---|---|
committer | Paweł Marks <Kordyjan@users.noreply.github.com> | 2020-08-03 13:47:51 +0200 |
commit | b84bd718c4bbe86eb7d08df7c9ddd68afcf00be2 (patch) | |
tree | a3bfa191c8e5f4d705a87a6d26603584ddb4e5cf /plugins/base/frontend/src/main/components/search | |
parent | b14e0617a126ed3b8b9256542ce857c060e3e295 (diff) | |
download | dokka-b84bd718c4bbe86eb7d08df7c9ddd68afcf00be2.tar.gz dokka-b84bd718c4bbe86eb7d08df7c9ddd68afcf00be2.tar.bz2 dokka-b84bd718c4bbe86eb7d08df7c9ddd68afcf00be2.zip |
Remove unsafe html usage
Diffstat (limited to 'plugins/base/frontend/src/main/components/search')
-rw-r--r-- | plugins/base/frontend/src/main/components/search/searchResultRow.tsx | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/plugins/base/frontend/src/main/components/search/searchResultRow.tsx b/plugins/base/frontend/src/main/components/search/searchResultRow.tsx index 9ae19cb9..81e1bad9 100644 --- a/plugins/base/frontend/src/main/components/search/searchResultRow.tsx +++ b/plugins/base/frontend/src/main/components/search/searchResultRow.tsx @@ -1,5 +1,6 @@ import React from "react"; import {OptionWithSearchResult, SearchProps, SearchRank} from "./types"; +import Markdown from '@jetbrains/ring-ui/components/markdown/markdown'; export const SearchResultRow: React.FC<SearchProps> = ({searchResult}: SearchProps) => { const signatureFromSearchResult = (searchResult: OptionWithSearchResult): string => { @@ -9,15 +10,9 @@ export const SearchResultRow: React.FC<SearchProps> = ({searchResult}: SearchPro return searchResult.highlight } - const renderHighlightMarkersAsHtml = (record: string): string => { - return record.replace(/\*\*(.*?)\*\*/g, '<span class="phraseHighlight">$1</span>') - } - return ( <div className="template-wrapper"> - <span dangerouslySetInnerHTML={ - {__html: renderHighlightMarkersAsHtml(signatureFromSearchResult(searchResult)) } - }/> + <span><Markdown source={signatureFromSearchResult(searchResult)}/></span> <span className="template-description">{searchResult.description}</span> </div> ) |