We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Before you start - checklist
Description
I'm using this highlighting recipe and it doesn't match any text content if I set my searchText string with more than one word.
Steps to reproduce
Steps to reproduce the behavior:
Expected behavior
I'd like to select multiple words. Thanks a lot for this great package.
Additional information
Code:
function highlightPattern(text, pattern) { const splitText = text.split(pattern) if (splitText.length <= 1) { return text; } const matches = text.match(pattern); return splitText.reduce( (arr, element, index) => matches[index] ? [ ...arr, element, <mark ref={(r) => r && r.scrollIntoView({ behavior: "smooth", block: "center", inline: "center", }) } style={{ backgroundColor: "orange" }} key={index} > {matches[index]} </mark>, ] : [...arr, element], [] ); }
function makeTextRenderer(searchText) { return function textRenderer(textItem) { return highlightPattern(textItem.str, searchText); }; }
Environment
The text was updated successfully, but these errors were encountered:
I think it's a duplicate? Sorry
Sorry, something went wrong.
No branches or pull requests
Before you start - checklist
Description
I'm using this highlighting recipe
and it doesn't match any text content if I set my searchText string with more than one word.
Steps to reproduce
Steps to reproduce the behavior:
Expected behavior
I'd like to select multiple words.
Thanks a lot for this great package.
Additional information
Code:
Environment
The text was updated successfully, but these errors were encountered: