react-highlight-words
Advanced tools
Comparing version 0.5.0 to 0.6.0
@@ -90,2 +90,4 @@ module.exports = | ||
Highlighter.propTypes = { | ||
activeClassName: _react.PropTypes.string, | ||
activeIndex: _react.PropTypes.string, | ||
autoEscape: _react.PropTypes.bool, | ||
@@ -106,2 +108,6 @@ highlightClassName: _react.PropTypes.string, | ||
function Highlighter(_ref) { | ||
var _ref$activeClassName = _ref.activeClassName; | ||
var activeClassName = _ref$activeClassName === undefined ? '' : _ref$activeClassName; | ||
var _ref$activeIndex = _ref.activeIndex; | ||
var activeIndex = _ref$activeIndex === undefined ? -1 : _ref$activeIndex; | ||
var autoEscape = _ref.autoEscape; | ||
@@ -125,2 +131,4 @@ var _ref$highlightClassName = _ref.highlightClassName; | ||
var HighlightTag = highlightTag; | ||
var highlightCount = -1; | ||
var highlightClassNames = ''; | ||
@@ -134,6 +142,9 @@ return _react2['default'].createElement( | ||
if (chunk.highlight) { | ||
highlightCount++; | ||
highlightClassNames = highlightClassName + ' ' + (highlightCount === +activeIndex ? activeClassName : ''); | ||
return _react2['default'].createElement( | ||
HighlightTag, | ||
{ | ||
className: highlightClassName, | ||
className: highlightClassNames, | ||
key: index, | ||
@@ -140,0 +151,0 @@ style: highlightStyle |
{ | ||
"name": "react-highlight-words", | ||
"version": "0.5.0", | ||
"version": "0.6.0", | ||
"description": "React component to highlight words within a larger body of text", | ||
@@ -88,3 +88,3 @@ "main": "dist/main.js", | ||
"react-transform-hmr": "^1.0.1", | ||
"redbox-react": "^1.2.6", | ||
"redbox-react": "1.2.6", | ||
"rimraf": "^2.4.4", | ||
@@ -91,0 +91,0 @@ "standard": "^5.4.1", |
@@ -28,2 +28,4 @@ <img src="https://cloud.githubusercontent.com/assets/29597/11913937/0d2dcd78-a629-11e5-83e7-6a17b6d765a5.png" width="260" height="260"> | ||
| autoEscape | Boolean | | Escape characters which are meaningful in regular expressions | | ||
| activeClassName | String | | The class name to be applied to an active match. Use along with `activeIndex` | | ||
| activeIndex | String | | Specify the match index that should be actively highlighted. Use along with `activeClassName` | | ||
| highlightClassName | String | | CSS class name applied to highlighted text | | ||
@@ -30,0 +32,0 @@ | highlightStyle | Object | | Inline styles applied to highlighted text | |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
2483196
1228
44