aboutsummaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorMarcin Aman <maman@virtuslab.com>2020-07-30 13:37:53 +0200
committerPaweł Marks <Kordyjan@users.noreply.github.com>2020-08-03 13:47:51 +0200
commitb84bd718c4bbe86eb7d08df7c9ddd68afcf00be2 (patch)
treea3bfa191c8e5f4d705a87a6d26603584ddb4e5cf /plugins
parentb14e0617a126ed3b8b9256542ce857c060e3e295 (diff)
downloaddokka-b84bd718c4bbe86eb7d08df7c9ddd68afcf00be2.tar.gz
dokka-b84bd718c4bbe86eb7d08df7c9ddd68afcf00be2.tar.bz2
dokka-b84bd718c4bbe86eb7d08df7c9ddd68afcf00be2.zip
Remove unsafe html usage
Diffstat (limited to 'plugins')
-rw-r--r--plugins/base/frontend/package-lock.json6
-rw-r--r--plugins/base/frontend/src/main/components/search/searchResultRow.tsx9
-rw-r--r--plugins/base/frontend/src/main/types/@jetbrains/index.d.ts4
3 files changed, 9 insertions, 10 deletions
diff --git a/plugins/base/frontend/package-lock.json b/plugins/base/frontend/package-lock.json
index 4ccf72f2..0940acc8 100644
--- a/plugins/base/frontend/package-lock.json
+++ b/plugins/base/frontend/package-lock.json
@@ -7531,9 +7531,9 @@
}
},
"lodash": {
- "version": "4.17.15",
- "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.15.tgz",
- "integrity": "sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A=="
+ "version": "4.17.19",
+ "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.19.tgz",
+ "integrity": "sha512-JNvd8XER9GQX0v2qJgsaN/mzFCNA5BRe/j8JN9d+tWyGLSodKQHKFicdwNYzWwI3wjRnaKPsGj1XkBjx/F96DQ=="
},
"lodash._reinterpolate": {
"version": "3.0.0",
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>
)
diff --git a/plugins/base/frontend/src/main/types/@jetbrains/index.d.ts b/plugins/base/frontend/src/main/types/@jetbrains/index.d.ts
index 3d209657..ceee5179 100644
--- a/plugins/base/frontend/src/main/types/@jetbrains/index.d.ts
+++ b/plugins/base/frontend/src/main/types/@jetbrains/index.d.ts
@@ -2,3 +2,7 @@ declare module '@jetbrains/ring-ui' {
export const Select: any;
export const List: any;
}
+
+declare module '@jetbrains/ring-ui/components/markdown/markdown' {
+ export const Markdown: any
+}