1
0
mirror of https://github.com/flarum/core.git synced 2025-07-28 12:10:51 +02:00

Live preview of post editing/replying thanks to TextFormatter 👏

This commit is contained in:
Toby Zerner
2015-07-22 16:05:00 +09:30
parent a0fe68272c
commit 017c258e46
14 changed files with 130 additions and 26 deletions

View File

@@ -229,8 +229,7 @@ class PostStream extends mixin(Component, evented) {
// If we're viewing the end of the discussion, the user can reply, and
// is not already doing so, then show a 'write a reply' placeholder.
this.viewingEnd &&
(!app.session.user || this.discussion.canReply()) &&
!app.composingReplyTo(this.discussion)
(!app.session.user || this.discussion.canReply())
? (
<div className="PostStream-item" key="reply">
{ReplyPlaceholder.component({discussion: this.discussion})}
@@ -517,8 +516,12 @@ class PostStream extends mixin(Component, evented) {
const scrollBottom = scrollTop + $(window).height();
// If the item is already in the viewport, we may not need to scroll.
// If we're scrolling to the bottom of an item, then we'll make sure the
// bottom will line up with the top of the composer.
if (force || itemTop < scrollTop || itemBottom > scrollBottom) {
const top = bottom ? itemBottom : ($item.is(':first-child') ? 0 : itemTop);
const top = bottom
? itemBottom - $(window).height() + app.composer.computedHeight()
: ($item.is(':first-child') ? 0 : itemTop);
if (noAnimation) {
$container.scrollTop(top);