]> cat aescling's git repositories - mastodon.git/commitdiff
Character counter fix
authorKibigo <marrus-sh@users.noreply.github.com>
Mon, 27 Feb 2017 12:32:41 +0000 (04:32 -0800)
committerKibigo <marrus-sh@users.noreply.github.com>
Mon, 27 Feb 2017 12:32:41 +0000 (04:32 -0800)
app/assets/javascripts/components/features/compose/components/character_counter.jsx

index f0c1b7c8d86e70d2488e83c879c09e701bf7dfc1..e6b67535443d78e3383e61d38ba4c6d9c5db67e5 100644 (file)
@@ -10,7 +10,7 @@ const CharacterCounter = React.createClass({
   mixins: [PureRenderMixin],
 
   render () {
-    const diff = this.props.max - this.props.text.length;
+    const diff = this.props.max - this.props.text.replace(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g, "_").length;
 
     return (
       <span style={{ fontSize: '16px', cursor: 'default' }}>