-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
highlightedvalue: add transform function parameter
Previously, in the SpellCheck component, if the suggested text contained an escaped character (for example `'`), then we would escape the string before applying our highlighting transformations (in this case, adding <strong> markup in between the highlighted values). This caused the indices to be misaligned (as, for example, ' would become '). Thus the <strong> tags would interrupt the escaped strings and they would not longer be escaped. To fix this, we accept a transformFunction in the highlightedValue get functions. This is a generalization of the escapeExpression function, so any transformations can be used. We change the highlightValue hbs partial to call the highlighted values with an escape function as the transformFunction. J=SLAP-696 TEST=manual Test on a local HH Theme Jambo site using a local SDK, with a SpellCheck component. Try searching for "my locaton's", this should give you a string Did you mean: my location's And not Did you mean: my location's You should also see the entire word "location's" be highlighted, not a portion of the string. Try searching for "my locaton&", this should give you a SpellCheck string Did you mean: my location& Where location is highlighted, not the & Tested on an npm run test, added a test case for the transformFn
- Loading branch information
1 parent
e1b0826
commit 3668f5c
Showing
3 changed files
with
68 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters