1
0
mirror of https://github.com/flarum/core.git synced 2025-10-15 17:04:26 +02:00

Use all Mithril lifecycle stubs (#2847)

This commit is contained in:
Alexander Skvortsov
2021-05-09 18:09:45 -04:00
committed by GitHub
parent ceb567779e
commit d4e3254395
17 changed files with 77 additions and 23 deletions

View File

@@ -28,7 +28,9 @@ export default class ConfirmDocumentUnload extends Component {
$(window).on('beforeunload', this.boundHandler);
}
onremove() {
onremove(vnode) {
super.onremove(vnode);
$(window).off('beforeunload', this.boundHandler);
}

View File

@@ -27,7 +27,9 @@ export default class Modal extends Component {
this.attrs.animateShow(() => this.onready());
}
onbeforeremove() {
onbeforeremove(vnode) {
super.onbeforeremove(vnode);
// If the global modal state currently contains a modal,
// we've just opened up a new one, and accordingly,
// we don't need to show a hide animation.

View File

@@ -54,7 +54,9 @@ export default class Page extends Component {
}
}
onremove() {
onremove(vnode) {
super.onremove(vnode);
if (this.bodyClass) {
$('#app').removeClass(this.bodyClass);
}

View File

@@ -54,7 +54,9 @@ export default class TextEditor extends Component {
this.attrs.composer.editor = this.buildEditor(this.$('.TextEditor-editorContainer')[0]);
}
onupdate() {
onupdate(vnode) {
super.onupdate(vnode);
const newDisabled = !!this.attrs.disabled;
if (this.disabled !== newDisabled) {