diff --git a/js/src/forum/components/ReplyPlaceholder.js b/js/src/forum/components/ReplyPlaceholder.js index 7a7970403..ce7107a2b 100644 --- a/js/src/forum/components/ReplyPlaceholder.js +++ b/js/src/forum/components/ReplyPlaceholder.js @@ -4,18 +4,19 @@ import Component from '../../common/Component'; import avatar from '../../common/helpers/avatar'; import username from '../../common/helpers/username'; import DiscussionControls from '../utils/DiscussionControls'; +import ReplyPlaceholderPreview from './ReplyPlaceholderPreview'; /** * The `ReplyPlaceholder` component displays a placeholder for a reply, which, * when clicked, opens the reply composer. * - * ### Props + * ### Attrs * * - `discussion` */ export default class ReplyPlaceholder extends Component { view() { - if (app.composer.composingReplyTo(this.props.discussion)) { + if (app.composer.composingReplyTo(this.attrs.discussion)) { return (
@@ -26,13 +27,13 @@ export default class ReplyPlaceholder extends Component {
-
+
); } const reply = () => { - DiscussionControls.replyAction.call(this.props.discussion, true); + DiscussionControls.replyAction.call(this.attrs.discussion, true); }; return ( @@ -43,33 +44,4 @@ export default class ReplyPlaceholder extends Component { ); } - - configPreview(element, isInitialized, context) { - if (isInitialized) return; - - // Every 50ms, if the composer content has changed, then update the post's - // body with a preview. - let preview; - const updateInterval = setInterval(() => { - // Since we're polling, the composer may have been closed in the meantime, - // so we bail in that case. - if (!app.composer.isVisible()) return; - - const content = app.composer.fields.content(); - - if (preview === content) return; - - preview = content; - - const anchorToBottom = $(window).scrollTop() + $(window).height() >= $(document).height(); - - s9e.TextFormatter.preview(preview || '', element); - - if (anchorToBottom) { - $(window).scrollTop($(document).height()); - } - }, 50); - - context.onunload = () => clearInterval(updateInterval); - } }