@@ -18,6 +18,8 @@ var _reactDom2 = _interopRequireDefault(_reactDom);
18
18
19
19
var _reactRedux = require ( 'react-redux' ) ;
20
20
21
+ var _dompurify = require ( 'dompurify' ) ;
22
+
21
23
var _utils = require ( './utils' ) ;
22
24
23
25
var _styles = require ( './styles' ) ;
@@ -55,7 +57,7 @@ var Tooltip = function (_Component) {
55
57
origin : _react . PropTypes . object ,
56
58
el : _react . PropTypes . object ,
57
59
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 ) ] ) ,
59
61
auto : _react . PropTypes . bool . isRequired ,
60
62
within : _react . PropTypes . func ,
61
63
@@ -101,7 +103,7 @@ var Tooltip = function (_Component) {
101
103
value : function updatePosition ( props ) {
102
104
var _this2 = this ;
103
105
104
- // Setup hidden DOM element to determine size of the content
106
+ // Render content into hidden DOM element to determine size
105
107
var content = this . children ( props ) ;
106
108
_reactDom2 . default . render ( _react2 . default . createElement (
107
109
'div' ,
@@ -114,22 +116,22 @@ var Tooltip = function (_Component) {
114
116
}
115
117
} , {
116
118
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 ;
123
122
123
+ if ( typeof content === 'string' ) {
124
+ content = _react2 . default . createElement ( 'div' , { dangerouslySetInnerHTML : { __html : ( 0 , _dompurify . sanitize ) ( content ) } } ) ;
125
+ }
124
126
return content ? content : props . children ;
125
127
}
126
128
} , {
127
129
key : 'render' ,
128
130
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 ;
133
135
134
136
var origin = ( 0 , _utils . originOrEl ) ( this . props ) ;
135
137
var _state = this . state ;
0 commit comments