All questions query fix, question search highlight fix

This commit is contained in:
mrfry 2021-04-25 09:21:47 +02:00
parent 4bcbaa4cc1
commit 867568d446
2 changed files with 45 additions and 24 deletions

View file

@ -1,6 +1,9 @@
import React from 'react'
function highlightText(text, toHighlight) {
if (!text) {
return ''
}
const re = new RegExp(toHighlight, 'gi')
return text.replace(re, `<mark>${toHighlight}</mark>`)
}