-
Notifications
You must be signed in to change notification settings - Fork 528
New issue
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
feat(reverseHighlight/reverseSnippet): Implements reverseHighlight and reverseSnippet #4592
Conversation
In a future major we can drop the string form for a safer access to the values
…r method with reduce
…r method with reduce
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. Latest deployment of this branch, based on commit a88b614:
|
Thanks for trying out all those options @shortcuts, I'm a fan of the method #2's output, and I think it would be better for highlight itself too. |
…HighlightedParts` to match `autocomplete` implementation
@shortcuts The "sibling behavior" version is interesting. The only place I find it a bit weird is:
[...] where the last Have you seen this sibling pattern anywhere else? |
@francoischalifour I've never seen this pattern used before and this behavior is the only reason why I'm not sure about using it. I could think of a workaround for the parenthesis where if something inside is highlighted, we remove the highlight on the opening/closing one, but that would leave some characters bold
The thing is that it would add even more computation on top of what's already done |
I think the sibling behaviour in that case is actually correct, since you are matching on the rest of the sentence, including that closing parenthesis. I think (ModelExample) looks more "pay attention from here onwards", while (ModelExample) looks like "pay only attention to 'lExample'", which will be odd if there's other highlighted text after this word. Google's autocomplete seems to try following a sibling behaviour, although it often sees separators as typos and won't highlight the match |
…emove unused solutions
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good—great job!
Since the bundlesize integration is disabled right now, what's the bundle size increase of this feature?
Here's what I got for the bundle size FAIL ./dist/instantsearch.production.min.js: 65.29KB > maxSize 65.25KB (gzip)
PASS ./dist/instantsearch.development.js: 151.83KB < maxSize 160KB (gzip) |
You can increase it to 65.5KB then. |
…gex outside of the function without the global tag
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good!
This implements
reverseHighlight
andreverseSnippet
.