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:
@@ -51,7 +51,7 @@ export default class CommentPost extends Post {
|
|||||||
<ul>{listItems(this.headerItems().toArray())}</ul>
|
<ul>{listItems(this.headerItems().toArray())}</ul>
|
||||||
</header>,
|
</header>,
|
||||||
<div className="Post-body">
|
<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>,
|
</div>,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
@@ -10,7 +10,7 @@ import Component from '../../common/Component';
|
|||||||
*
|
*
|
||||||
* ### Attrs
|
* ### 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 {
|
export default class ComposerPostPreview extends Component {
|
||||||
view() {
|
view() {
|
||||||
@@ -24,7 +24,7 @@ export default class ComposerPostPreview extends Component {
|
|||||||
// body with a preview.
|
// body with a preview.
|
||||||
let preview;
|
let preview;
|
||||||
const updatePreview = () => {
|
const updatePreview = () => {
|
||||||
const content = this.attrs.content();
|
const content = this.attrs.composer.fields.content();
|
||||||
|
|
||||||
if (preview === content) return;
|
if (preview === content) return;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user