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. * overwrite the previous one.
*/ */
export default class ModalManager extends Component { export default class ModalManager extends Component {
init() { oninit(vnode) {
this.state = this.props.state; this.state = vnode.attrs.state;
} }
view() { view(vnode) {
const modal = this.state.modal; const modal = vnode.attrs.state.modal;
return ( return (
<div className="ModalManager modal fade"> <div className="ModalManager modal fade">
@@ -20,13 +20,8 @@ export default class ModalManager extends Component {
); );
} }
config(isInitialized, context) { oncreate(vnode) {
if (isInitialized) return; super.oncreate(vnode);
// 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;
// Ensure the modal state is notified about a closed modal, even when the // Ensure the modal state is notified about a closed modal, even when the
// DOM-based Bootstrap JavaScript code triggered the closing of the modal, // DOM-based Bootstrap JavaScript code triggered the closing of the modal,