1
0
mirror of https://github.com/flarum/core.git synced 2025-08-11 19:04:29 +02:00

update: ModalManager

This commit is contained in:
Alexander Skvortsov
2020-08-07 15:58:17 -04:00
committed by Franz Liedke
parent 62cb71d4e1
commit 5606eae0f1

View File

@@ -6,12 +6,12 @@ import Component from '../Component';
* overwrite the previous one.
*/
export default class ModalManager extends Component {
init() {
this.state = this.props.state;
oninit(vnode) {
this.state = vnode.attrs.state;
}
view() {
const modal = this.state.modal;
view(vnode) {
const modal = vnode.attrs.state.modal;
return (
<div className="ModalManager modal fade">
@@ -20,13 +20,8 @@ export default class ModalManager extends Component {
);
}
config(isInitialized, context) {
if (isInitialized) return;
// Since this component is 'above' the content of the page (that is, it is a
// part of the global UI that persists between routes), we will flag the DOM
// to be retained across route changes.
context.retain = true;
oncreate(vnode) {
super.oncreate(vnode);
// Ensure the modal state is notified about a closed modal, even when the
// DOM-based Bootstrap JavaScript code triggered the closing of the modal,