anchor-ui
Advanced tools
Comparing version 1.9.4 to 1.9.5
@@ -49,2 +49,6 @@ 'use strict'; | ||
var _urlRegex = require('../url-regex'); | ||
var _urlRegex2 = _interopRequireDefault(_urlRegex); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
@@ -63,13 +67,2 @@ | ||
_createClass(Message, null, [{ | ||
key: 'createMarkup', | ||
value: function createMarkup(text) { | ||
var escapedText = (0, _escapeHtml2.default)(text); | ||
return { | ||
__html: _emojione2.default.toImage(escapedText) | ||
}; | ||
} | ||
}]); | ||
function Message(props) { | ||
@@ -102,2 +95,30 @@ _classCallCheck(this, Message); | ||
_createClass(Message, [{ | ||
key: 'createMarkup', | ||
value: function createMarkup(text) { | ||
var enableLinks = this.props.enableLinks; | ||
var escapedText = (0, _escapeHtml2.default)(text); | ||
var parsedText = escapedText; | ||
if (enableLinks) { | ||
(function () { | ||
var urlSchemeRegex = /^(?:https?:\/\/)/; | ||
parsedText = escapedText.replace(_urlRegex2.default, function (url) { | ||
if (!urlSchemeRegex.test(url)) { | ||
// Add default http:// scheme for urls like example.com | ||
return '<a href="http://' + url + '" target="_blank">' + url + '</a>'; | ||
} | ||
return '<a href="' + url + '" target="_blank">' + url + '</a>'; | ||
}); | ||
})(); | ||
} | ||
return { | ||
__html: _emojione2.default.toImage(parsedText) | ||
}; | ||
} | ||
}, { | ||
key: 'render', | ||
@@ -158,3 +179,3 @@ value: function render() { | ||
{ className: messageBodyClassName }, | ||
emoji ? _react2.default.createElement('span', { dangerouslySetInnerHTML: Message.createMarkup(message.body) }) : message.body | ||
emoji ? _react2.default.createElement('span', { dangerouslySetInnerHTML: this.createMarkup(message.body) }) : message.body | ||
), | ||
@@ -197,3 +218,4 @@ _react2.default.createElement( | ||
myMessage: _react.PropTypes.bool, | ||
emoji: _react.PropTypes.bool | ||
emoji: _react.PropTypes.bool, | ||
enableLinks: _react.PropTypes.bool | ||
}; | ||
@@ -208,3 +230,4 @@ Message.defaultProps = { | ||
myMessage: false, | ||
emoji: false | ||
emoji: false, | ||
enableLinks: false | ||
}; | ||
@@ -211,0 +234,0 @@ Message.contextTypes = { |
@@ -53,7 +53,10 @@ 'use strict'; | ||
backgroundColor: _colors2.default.theme, | ||
color: 'white', | ||
color: _colors2.default.white, | ||
marginLeft: '0', | ||
marginRight: '16px', | ||
'& $messageBody': { | ||
color: _colors2.default.white | ||
color: _colors2.default.white, | ||
'& a': { | ||
color: _colors2.default.white | ||
} | ||
}, | ||
@@ -92,3 +95,6 @@ '& $messageHeader': { | ||
lineHeight: '18px', | ||
margin: '0' | ||
margin: '0', | ||
'& a': { | ||
color: _colors2.default.primaryText | ||
} | ||
}, | ||
@@ -95,0 +101,0 @@ messageTime: { |
{ | ||
"name": "anchor-ui", | ||
"version": "1.9.4", | ||
"version": "1.9.5", | ||
"description": "React Component UI Kit", | ||
@@ -69,4 +69,5 @@ "main": "dist/index.js", | ||
"dependencies": { | ||
"escape-html": "^1.0.3" | ||
"escape-html": "^1.0.3", | ||
"tlds": "^1.182.0" | ||
} | ||
} |
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
216956
67
3620
8
+ Addedtlds@^1.182.0
+ Addedtlds@1.255.0(transitive)