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:
@@ -332,6 +332,10 @@ class Composer extends Component {
|
|||||||
this.oldPosition = this.position;
|
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
|
* Confirm with the user that they want to close the composer and lose their
|
||||||
* content.
|
* content.
|
||||||
|
@@ -20,7 +20,7 @@ export default class EditPostComposer extends ComposerBody {
|
|||||||
// minimize the composer in order to see the preview. We do this as a
|
// 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
|
// timeout so that it occurs after the click handler on the composer
|
||||||
// itself that shows the composer if minimized.
|
// itself that shows the composer if minimized.
|
||||||
if (app.composer.$backdrop.length) {
|
if (app.composer.isMobile()) {
|
||||||
setTimeout(() => app.composer.minimize(), 0);
|
setTimeout(() => app.composer.minimize(), 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -22,7 +22,7 @@ export default class ReplyComposer extends ComposerBody {
|
|||||||
// minimize the composer in order to see the preview. We do this as a
|
// 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
|
// timeout so that it occurs after the click handler on the composer
|
||||||
// itself that shows the composer if minimized.
|
// itself that shows the composer if minimized.
|
||||||
if (app.composer.$backdrop.length) {
|
if (app.composer.isMobile()) {
|
||||||
setTimeout(() => app.composer.minimize(), 0);
|
setTimeout(() => app.composer.minimize(), 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user