diff --git a/extensions/flags/js/src/forum/addFlagsToPosts.js b/extensions/flags/js/src/forum/addFlagsToPosts.js index 67f785f2c9..14fb73021e 100644 --- a/extensions/flags/js/src/forum/addFlagsToPosts.js +++ b/extensions/flags/js/src/forum/addFlagsToPosts.js @@ -75,7 +75,7 @@ export default function () { return items; }; - extend(Post.prototype, 'content', function (vdom) { + extend(Post.prototype, 'viewItems', function (items) { const post = this.attrs.post; const flags = post.flags(); @@ -83,7 +83,8 @@ export default function () { if (post.isHidden()) this.revealContent = true; - vdom.unshift( + items.add( + 'flagged',
{flags.map((flag) => ( @@ -91,7 +92,8 @@ export default function () { ))}
{this.flagActionItems().toArray()}
-
+ , + 110 ); }); diff --git a/framework/core/js/src/forum/components/CommentPost.js b/framework/core/js/src/forum/components/CommentPost.js index f8f0980317..680d944d0b 100644 --- a/framework/core/js/src/forum/components/CommentPost.js +++ b/framework/core/js/src/forum/components/CommentPost.js @@ -47,14 +47,35 @@ export default class CommentPost extends Post { } content() { - return super.content().concat([ + return super.content().concat(this.contentItems().toArray()); + } + + contentItems() { + const items = new ItemList(); + + items.add( + 'header',
, -
- {this.isEditing() ? : m.trust(this.attrs.post.contentHtml())} -
, - ]); + 100 + ); + + items.add('body',
{this.bodyItems().toArray()}
, 90); + + return items; + } + + bodyItems() { + const items = new ItemList(); + + items.add( + 'content', + this.isEditing() ? : m.trust(this.attrs.post.contentHtml()), + 100 + ); + + return items; } refreshContent() { diff --git a/framework/core/js/src/forum/components/Post.tsx b/framework/core/js/src/forum/components/Post.tsx index cfe610ffd3..2f1447fd7b 100644 --- a/framework/core/js/src/forum/components/Post.tsx +++ b/framework/core/js/src/forum/components/Post.tsx @@ -3,7 +3,7 @@ import Component, { ComponentAttrs } from '../../common/Component'; import SubtreeRetainer from '../../common/utils/SubtreeRetainer'; import Dropdown from '../../common/components/Dropdown'; import PostControls from '../utils/PostControls'; -import listItems from '../../common/helpers/listItems'; +import listItems, { ModdedChildrenWithItemName } from '../../common/helpers/listItems'; import ItemList from '../../common/utils/ItemList'; import type PostModel from '../../common/models/Post'; import LoadingIndicator from '../../common/components/LoadingIndicator'; @@ -55,34 +55,46 @@ export default abstract class Post return (
-
- {this.loading ? : this.content()} - -
{footerItems.length ?
    {listItems(footerItems)}
: null}
-
+
{this.viewItems(controls, footerItems).toArray()}
); } + viewItems(controls: Mithril.Children[], footerItems: ModdedChildrenWithItemName[]): ItemList { + const items = new ItemList(); + + items.add('content', this.loading ? : this.content(), 100); + + items.add( + 'actions', + , + 90 + ); + + items.add('footer',
{footerItems.length > 0 ?
    {listItems(footerItems)}
:
    }
    , 80); + + return items; + } + onbeforeupdate(vnode: Mithril.VnodeDOM) { super.onbeforeupdate(vnode); @@ -147,7 +159,7 @@ export default abstract class Post /** * Build an item list for the post's footer. */ - footerItems(): ItemList { - return new ItemList(); + footerItems(): ItemList { + return new ItemList(); } }