diff options
author | Eugen Rochko <eugen@zeonfederated.com> | 2016-11-15 18:38:57 +0100 |
---|---|---|
committer | Eugen Rochko <eugen@zeonfederated.com> | 2016-11-15 18:38:57 +0100 |
commit | 489bd99803cde976d78c312b0079d8de50f3617c (patch) | |
tree | ede8d0905f82850931446bdc5f0320a6dbc375bd /app/assets/javascripts/components/features/account | |
parent | 4f07fb1f0aee6d37d8b3c5fe0088cf36b3926372 (diff) |
Support emojis in display name, bio
Diffstat (limited to 'app/assets/javascripts/components/features/account')
-rw-r--r-- | app/assets/javascripts/components/features/account/components/header.jsx | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/app/assets/javascripts/components/features/account/components/header.jsx b/app/assets/javascripts/components/features/account/components/header.jsx index 062f4a0f2..7a086c99a 100644 --- a/app/assets/javascripts/components/features/account/components/header.jsx +++ b/app/assets/javascripts/components/features/account/components/header.jsx @@ -1,5 +1,7 @@ -import PureRenderMixin from 'react-addons-pure-render-mixin'; +import PureRenderMixin from 'react-addons-pure-render-mixin'; import ImmutablePropTypes from 'react-immutable-proptypes'; +import emojify from '../../../emoji'; +import escapeTextContentForBrowser from 'react/lib/escapeTextContentForBrowser'; const Header = React.createClass({ @@ -14,7 +16,7 @@ const Header = React.createClass({ const { account, me } = this.props; let displayName = account.get('display_name'); - let info = ''; + let info = ''; if (displayName.length === 0) { displayName = account.get('username'); @@ -24,7 +26,8 @@ const Header = React.createClass({ info = <span style={{ position: 'absolute', top: '10px', right: '10px', opacity: '0.7', display: 'inline-block', verticalAlign: 'top', background: 'rgba(0, 0, 0, 0.4)', color: '#fff', textTransform: 'uppercase', fontSize: '11px', fontWeight: '500', padding: '4px', borderRadius: '4px' }}>Follows you</span> } - const content = { __html: account.get('note') }; + const content = { __html: emojify(account.get('note')) }; + const displayNameHTML = { __html: emojify(escapeTextContentForBrowser(displayName)) }; return ( <div style={{ flex: '0 0 auto', background: '#2f3441', textAlign: 'center', backgroundImage: `url(${account.get('header')})`, backgroundSize: 'cover', position: 'relative' }}> @@ -34,7 +37,7 @@ const Header = React.createClass({ <img src={account.get('avatar')} alt='' style={{ display: 'block', width: '90px', height: '90px', borderRadius: '90px' }} /> </div> - <span style={{ display: 'inline-block', color: '#fff', fontSize: '20px', lineHeight: '27px', fontWeight: '500' }}>{displayName}</span> + <span style={{ display: 'inline-block', color: '#fff', fontSize: '20px', lineHeight: '27px', fontWeight: '500' }} className='account__header__display-name' dangerouslySetInnerHTML={displayNameHTML} /> </a> <span style={{ fontSize: '14px', fontWeight: '400', display: 'block', color: '#2b90d9', marginBottom: '10px' }}>@{account.get('acct')}</span> |