1
0
mirror of https://github.com/flarum/core.git synced 2025-08-04 23:47:32 +02:00

ComposerPostPreview: Allow injecting CSS class

This commit is contained in:
Franz Liedke
2020-09-11 17:13:43 +02:00
parent 47ce93d2fd
commit 174f3aba90
2 changed files with 7 additions and 2 deletions

View File

@@ -51,7 +51,7 @@ export default class CommentPost extends Post {
<ul>{listItems(this.headerItems().toArray())}</ul>
</header>,
<div className="Post-body">
{this.isEditing() ? <ComposerPostPreview composer={app.composer} /> : m.trust(this.attrs.post.contentHtml())}
{this.isEditing() ? <ComposerPostPreview className="Post-preview" composer={app.composer} /> : m.trust(this.attrs.post.contentHtml())}
</div>,
]);
}

View File

@@ -11,10 +11,15 @@ import Component from '../../common/Component';
* ### Attrs
*
* - `composer` The state of the composer controlling this preview.
* - `className` A CSS class for the element surrounding the preview.
*/
export default class ComposerPostPreview extends Component {
static initAttrs(attrs) {
attrs.className = attrs.className || '';
}
view() {
return <div className="Post-preview" />;
return <div className={this.attrs.className} />;
}
oncreate(vnode) {