Skip to content

Commit ec75931

Browse files
committed
Bump 0.5.1
1 parent e302de3 commit ec75931

File tree

3 files changed

+16
-14
lines changed

3 files changed

+16
-14
lines changed

lib/origin.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ var Origin = function (_Component) {
115115
get: function get() {
116116
return {
117117
name: _react.PropTypes.oneOfType([_react.PropTypes.string, _react.PropTypes.arrayOf(_react.PropTypes.string)]),
118-
content: _react.PropTypes.string,
118+
content: _react.PropTypes.oneOfType([_react.PropTypes.string, _react.PropTypes.object, _react.PropTypes.arrayOf(_react.PropTypes.object)]),
119119
place: _react.PropTypes.oneOfType([_react.PropTypes.string, _react.PropTypes.arrayOf(_react.PropTypes.string)]),
120120
tagName: _react.PropTypes.string,
121121
delay: _react.PropTypes.oneOfType([_react.PropTypes.bool, _react.PropTypes.number, _react.PropTypes.string]),

lib/tooltip.js

+14-12
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ var _reactDom2 = _interopRequireDefault(_reactDom);
1818

1919
var _reactRedux = require('react-redux');
2020

21+
var _dompurify = require('dompurify');
22+
2123
var _utils = require('./utils');
2224

2325
var _styles = require('./styles');
@@ -55,7 +57,7 @@ var Tooltip = function (_Component) {
5557
origin: _react.PropTypes.object,
5658
el: _react.PropTypes.object,
5759
place: _react.PropTypes.oneOfType([_react.PropTypes.string, _react.PropTypes.array]).isRequired,
58-
content: _react.PropTypes.string,
60+
content: _react.PropTypes.oneOfType([_react.PropTypes.string, _react.PropTypes.object, _react.PropTypes.arrayOf(_react.PropTypes.object)]),
5961
auto: _react.PropTypes.bool.isRequired,
6062
within: _react.PropTypes.func,
6163

@@ -101,7 +103,7 @@ var Tooltip = function (_Component) {
101103
value: function updatePosition(props) {
102104
var _this2 = this;
103105

104-
// Setup hidden DOM element to determine size of the content
106+
// Render content into hidden DOM element to determine size
105107
var content = this.children(props);
106108
_reactDom2.default.render(_react2.default.createElement(
107109
'div',
@@ -114,22 +116,22 @@ var Tooltip = function (_Component) {
114116
}
115117
}, {
116118
key: 'children',
117-
value: function children(props) {
118-
if (typeof props === 'undefined') {
119-
props = this.props;
120-
}
121-
var _props = props;
122-
var content = _props.content;
119+
value: function children() {
120+
var props = arguments.length <= 0 || arguments[0] === undefined ? this.props : arguments[0];
121+
var content = props.content;
123122

123+
if (typeof content === 'string') {
124+
content = _react2.default.createElement('div', { dangerouslySetInnerHTML: { __html: (0, _dompurify.sanitize)(content) } });
125+
}
124126
return content ? content : props.children;
125127
}
126128
}, {
127129
key: 'render',
128130
value: function render() {
129-
var _props2 = this.props;
130-
var show = _props2.show;
131-
var onHover = _props2.onHover;
132-
var onLeave = _props2.onLeave;
131+
var _props = this.props;
132+
var show = _props.show;
133+
var onHover = _props.onHover;
134+
var onLeave = _props.onLeave;
133135

134136
var origin = (0, _utils.originOrEl)(this.props);
135137
var _state = this.state;

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "redux-tooltip",
3-
"version": "0.5.0",
3+
"version": "0.5.1",
44
"description": "A tooltip React component for Redux",
55
"main": "./lib/index.js",
66
"repository": {

0 commit comments

Comments
 (0)