mirror of
https://github.com/flarum/core.git
synced 2025-08-04 23:47:32 +02:00
ComposerPostPreview: Inject entire composer
This commit is contained in:
@@ -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>,
|
||||
]);
|
||||
}
|
||||
|
@@ -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;
|
||||
|
||||
|
Reference in New Issue
Block a user