mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2025-11-03 03:59:12 +00:00
Fix: text highlight issue on search (#1850)
This commit is contained in:
parent
eda7222c9e
commit
b6d585fe51
@ -62,22 +62,15 @@ const SearchedData: React.FC<SearchedDataProp> = ({
|
||||
const highlightSearchResult = () => {
|
||||
return data.map((table, index) => {
|
||||
let tDesc = table.description;
|
||||
const highLightedTexts = !isEmpty(table.highlight?.description)
|
||||
? table.highlight?.description.join(' ') || ''
|
||||
: '';
|
||||
const highlightTxtMatch = highLightedTexts.match(
|
||||
/<span(.*?)>(.*?)<\/span>/g
|
||||
);
|
||||
if (highlightTxtMatch) {
|
||||
const matchTextArr = highlightTxtMatch.map((val) =>
|
||||
const highLightedTexts = table.highlight?.description || [];
|
||||
|
||||
if (highLightedTexts) {
|
||||
const matchTextArr = highLightedTexts.map((val) =>
|
||||
val.replace(/<\/?span(.*?)>/g, '')
|
||||
);
|
||||
matchTextArr.forEach((text) => {
|
||||
const regEx = new RegExp(`\\b${text}\\b`, 'g');
|
||||
tDesc = tDesc.replace(
|
||||
regEx,
|
||||
`<span class="text-highlighter">${text}</span>`
|
||||
);
|
||||
|
||||
matchTextArr.forEach((text, i) => {
|
||||
tDesc = tDesc.replace(text, highLightedTexts[i]);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@ -706,7 +706,7 @@ a:focus {
|
||||
|
||||
.text-highlighter {
|
||||
background-color: #ffc34e40;
|
||||
padding: 0.25rem;
|
||||
padding: 0 0.25rem;
|
||||
}
|
||||
|
||||
body .profiler-graph .recharts-active-dot circle {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user