diff options
Diffstat (limited to 'plugins/base/frontend')
-rw-r--r-- | plugins/base/frontend/package-lock.json | 6 | ||||
-rw-r--r-- | plugins/base/frontend/package.json | 2 | ||||
-rw-r--r-- | plugins/base/frontend/src/main/components/search/searchResultRow.tsx | 20 | ||||
-rw-r--r-- | plugins/base/frontend/src/main/types/@jetbrains/index.d.ts | 4 | ||||
-rw-r--r-- | plugins/base/frontend/tsconfig.json | 3 |
5 files changed, 28 insertions, 7 deletions
diff --git a/plugins/base/frontend/package-lock.json b/plugins/base/frontend/package-lock.json index 0940acc8..c671c752 100644 --- a/plugins/base/frontend/package-lock.json +++ b/plugins/base/frontend/package-lock.json @@ -1520,6 +1520,12 @@ "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.5.tgz", "integrity": "sha512-7+2BITlgjgDhH0vvwZU/HZJVyk+2XUlvxXe8dFMedNX/aMkaOq++rMAFXc0tM7ij15QaWlbdQASBR9dihi+bDQ==" }, + "@types/lodash": { + "version": "4.14.158", + "resolved": "https://registry.npmjs.org/@types/lodash/-/lodash-4.14.158.tgz", + "integrity": "sha512-InCEXJNTv/59yO4VSfuvNrZHt7eeNtWQEgnieIA+mIC+MOWM9arOWG2eQ8Vhk6NbOre6/BidiXhkZYeDY9U35w==", + "dev": true + }, "@types/minimatch": { "version": "3.0.3", "resolved": "https://registry.npmjs.org/@types/minimatch/-/minimatch-3.0.3.tgz", diff --git a/plugins/base/frontend/package.json b/plugins/base/frontend/package.json index 4415dd1c..14a44e8e 100644 --- a/plugins/base/frontend/package.json +++ b/plugins/base/frontend/package.json @@ -31,6 +31,7 @@ "@types/react": "^16.9.0", "@types/react-dom": "^16.9.0", "babel-loader": "^8.0.6", + "lodash": "^4.17.19", "postcss-import": "^12.0.1", "postcss-preset-env": "^6.7.0", "react": "^16.12.0", @@ -44,6 +45,7 @@ }, "devDependencies": { "@jetbrains/stylelint-config": "^2.0.0", + "@types/lodash": "^4.14.158", "babel-eslint": "^10.0.3", "eslint": "^6.8.0", "react-svg-loader": "^3.0.3", diff --git a/plugins/base/frontend/src/main/components/search/searchResultRow.tsx b/plugins/base/frontend/src/main/components/search/searchResultRow.tsx index 81e1bad9..83dd2bcb 100644 --- a/plugins/base/frontend/src/main/components/search/searchResultRow.tsx +++ b/plugins/base/frontend/src/main/components/search/searchResultRow.tsx @@ -1,6 +1,14 @@ import React from "react"; import {OptionWithSearchResult, SearchProps, SearchRank} from "./types"; -import Markdown from '@jetbrains/ring-ui/components/markdown/markdown'; +import _ from "lodash"; + +type HighlighterProps = { + label: string +} + +const Highlighter: React.FC<HighlighterProps> = ({label}: HighlighterProps) => { + return <strong>{label}</strong> +} export const SearchResultRow: React.FC<SearchProps> = ({searchResult}: SearchProps) => { const signatureFromSearchResult = (searchResult: OptionWithSearchResult): string => { @@ -10,9 +18,17 @@ export const SearchResultRow: React.FC<SearchProps> = ({searchResult}: SearchPro return searchResult.highlight } + /* + This is a work-around for an issue: https://youtrack.jetbrains.com/issue/RG-2108 + */ + const out = _.chunk(signatureFromSearchResult(searchResult).split('**'), 2).flatMap(([txt, label]) => [ + txt, + label ? <Highlighter label={label}></Highlighter> : null, + ]); + return ( <div className="template-wrapper"> - <span><Markdown source={signatureFromSearchResult(searchResult)}/></span> + <span>{out}</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 ceee5179..3d209657 100644 --- a/plugins/base/frontend/src/main/types/@jetbrains/index.d.ts +++ b/plugins/base/frontend/src/main/types/@jetbrains/index.d.ts @@ -2,7 +2,3 @@ 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 -} diff --git a/plugins/base/frontend/tsconfig.json b/plugins/base/frontend/tsconfig.json index 4cc8fd37..0f0a4555 100644 --- a/plugins/base/frontend/tsconfig.json +++ b/plugins/base/frontend/tsconfig.json @@ -5,7 +5,8 @@ "lib": [ "dom", "dom.iterable", - "esnext" + "esnext", + "es2019" ], "noImplicitAny": true, "allowJs": true, |