Fix composer preview button on mobile. closes #196

This commit is contained in:
Toby Zerner 2015-11-21 13:16:25 +10:30
parent 6374f92676
commit c79bda6279
2 changed files with 16 additions and 0 deletions

View File

@ -16,6 +16,14 @@ export default class EditPostComposer extends ComposerBody {
super.init();
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));
};
}

View File

@ -18,6 +18,14 @@ export default class ReplyComposer extends ComposerBody {
super.init();
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'));
};
}