mirror of
https://github.com/flarum/core.git
synced 2025-07-19 07:41:22 +02:00
Pass ModalManagerState into Modal instances instead of calling the global.
This commit is contained in:
@@ -31,7 +31,7 @@ export default class Modal extends Component {
|
|||||||
// If the global modal state currently contains a modal,
|
// If the global modal state currently contains a modal,
|
||||||
// we've just opened up a new one, and accordingly,
|
// we've just opened up a new one, and accordingly,
|
||||||
// we don't need to show a hide animation.
|
// we don't need to show a hide animation.
|
||||||
if (!app.modal.modal) {
|
if (!this.attrs.state.modal) {
|
||||||
this.attrs.onhide();
|
this.attrs.onhide();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -112,7 +112,7 @@ export default class Modal extends Component {
|
|||||||
* Hide the modal.
|
* Hide the modal.
|
||||||
*/
|
*/
|
||||||
hide() {
|
hide() {
|
||||||
app.modal.close();
|
this.attrs.state.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -11,7 +11,14 @@ export default class ModalManager extends Component {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="ModalManager modal fade">
|
<div className="ModalManager modal fade">
|
||||||
{modal ? modal.componentClass.component({ ...modal.attrs, onshow: this.animateShow.bind(this), onhide: this.animateHide.bind(this) }) : ''}
|
{modal
|
||||||
|
? modal.componentClass.component({
|
||||||
|
...modal.attrs,
|
||||||
|
onshow: this.animateShow.bind(this),
|
||||||
|
onhide: this.animateHide.bind(this),
|
||||||
|
state: this.attrs.state,
|
||||||
|
})
|
||||||
|
: ''}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user