1
0
mirror of https://github.com/flarum/core.git synced 2025-08-05 07:57:46 +02:00

ComposerPostPreview: Inject entire composer

This commit is contained in:
Franz Liedke
2020-09-11 17:08:46 +02:00
parent 0f99e7c015
commit 24935eacaf
2 changed files with 3 additions and 3 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 content={() => app.composer.fields.content()} /> : m.trust(this.attrs.post.contentHtml())}
{this.isEditing() ? <ComposerPostPreview composer={app.composer} /> : m.trust(this.attrs.post.contentHtml())}
</div>,
]);
}

View File

@@ -10,7 +10,7 @@ import Component from '../../common/Component';
*
* ### Attrs
*
* - `content` A callback that retrieves the latest content that should be rendered.
* - `composer` The state of the composer controlling this preview.
*/
export default class ComposerPostPreview extends Component {
view() {
@@ -24,7 +24,7 @@ export default class ComposerPostPreview extends Component {
// body with a preview.
let preview;
const updatePreview = () => {
const content = this.attrs.content();
const content = this.attrs.composer.fields.content();
if (preview === content) return;