diff --git a/app/components/posts/PostEditor.tsx b/app/components/posts/PostEditor.tsx index 55135c4a..9ba4ed62 100644 --- a/app/components/posts/PostEditor.tsx +++ b/app/components/posts/PostEditor.tsx @@ -129,76 +129,72 @@ class PostEditor extends React.Component { {htmlContent ? ( ) : ( - { + this.props.onChanged(event.target.value); + }} + > + ({ + id: u.avatarUrl, + display: u.displayName, + you: u._id === currentUser._id ? true : false, + }))} + markup={'[`@#__display__`](__id__)'} + displayTransform={(_, display) => { + return `@${display}`; }} - autoFocus - value={content} - placeholder={this.props.placeholder ? this.props.placeholder : 'Compose new post'} - markup={'[`__type__#__display__`](__id__)'} - displayTransform={(id, display, type) => { - if (type === '@') { - return `@${display}`; - } - - return `[${display} ](${id})`; - }} - onChange={event => { - this.props.onChanged(event.target.value); - }} - > - ({ - id: u.avatarUrl, - display: u.displayName, - you: u._id === currentUser._id ? true : false, - }))} - renderSuggestion={suggestion => ( - - - {suggestion.display} - - )} - /> - - )} + renderSuggestion={suggestion => ( + + + {suggestion.display} + + )} + /> + + )} ); @@ -216,6 +212,11 @@ class PostEditor extends React.Component { renderer.link = (href, title, text) => { const t = title ? ` title="${title}"` : ''; + + if (text.startsWith('@#')) { + return `${text.replace('@#', '@')} `; + } + return ` ${text}