mirror of
https://github.com/flarum/framework.git
synced 2025-04-26 14:44:03 +08:00
Fix composer preview button on mobile. closes #196
This commit is contained in:
parent
6374f92676
commit
c79bda6279
@ -16,6 +16,14 @@ export default class EditPostComposer extends ComposerBody {
|
|||||||
super.init();
|
super.init();
|
||||||
|
|
||||||
this.editor.props.preview = () => {
|
this.editor.props.preview = () => {
|
||||||
|
// If the composer backdrop is visible, assume we're on mobile and need to
|
||||||
|
// minimize the composer in order to see the preview. We do this as a
|
||||||
|
// timeout so that it occurs after the click handler on the composer
|
||||||
|
// itself that shows the composer if minimized.
|
||||||
|
if (app.composer.$backdrop.length) {
|
||||||
|
setTimeout(() => app.composer.minimize(), 0);
|
||||||
|
}
|
||||||
|
|
||||||
m.route(app.route.post(this.props.post));
|
m.route(app.route.post(this.props.post));
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -18,6 +18,14 @@ export default class ReplyComposer extends ComposerBody {
|
|||||||
super.init();
|
super.init();
|
||||||
|
|
||||||
this.editor.props.preview = () => {
|
this.editor.props.preview = () => {
|
||||||
|
// If the composer backdrop is visible, assume we're on mobile and need to
|
||||||
|
// minimize the composer in order to see the preview. We do this as a
|
||||||
|
// timeout so that it occurs after the click handler on the composer
|
||||||
|
// itself that shows the composer if minimized.
|
||||||
|
if (app.composer.$backdrop.length) {
|
||||||
|
setTimeout(() => app.composer.minimize(), 0);
|
||||||
|
}
|
||||||
|
|
||||||
m.route(app.route.discussion(this.props.discussion, 'reply'));
|
m.route(app.route.discussion(this.props.discussion, 'reply'));
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user