1
0
mirror of https://github.com/flarum/core.git synced 2025-07-20 08:11:27 +02:00

Refactor composer preview logic

This commit is contained in:
Toby Zerner
2015-11-23 08:47:16 +10:30
parent ca83a5b9ea
commit 11560342a2
3 changed files with 6 additions and 2 deletions

View File

@@ -332,6 +332,10 @@ class Composer extends Component {
this.oldPosition = this.position;
}
isMobile() {
return this.$backdrop && this.$backdrop.length;
}
/**
* Confirm with the user that they want to close the composer and lose their
* content.

View File

@@ -20,7 +20,7 @@ export default class EditPostComposer extends ComposerBody {
// 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) {
if (app.composer.isMobile()) {
setTimeout(() => app.composer.minimize(), 0);
}

View File

@@ -22,7 +22,7 @@ export default class ReplyComposer extends ComposerBody {
// 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) {
if (app.composer.isMobile()) {
setTimeout(() => app.composer.minimize(), 0);
}