From b4375e4f7d42d0264bcfb538fc8ed0526438c674 Mon Sep 17 00:00:00 2001 From: Toby Zerner Date: Tue, 7 Nov 2017 21:12:03 +1030 Subject: [PATCH] Fix Composer textarea losing its height across route changes There is a Mithril bug which causes context.retain to be ineffective for children nodes. https://github.com/MithrilJS/mithril.js/issues/1300 Thus, we have to assume that the children nodes (like the textarea) may be recreated and thus we need to update its height on each redraw. fixes #948 --- framework/core/js/forum/dist/app.js | 4 ++++ framework/core/js/forum/src/components/Composer.js | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/framework/core/js/forum/dist/app.js b/framework/core/js/forum/dist/app.js index 60e3bd907..21e7cf8ef 100644 --- a/framework/core/js/forum/dist/app.js +++ b/framework/core/js/forum/dist/app.js @@ -19820,6 +19820,10 @@ System.register('flarum/components/Composer', ['flarum/Component', 'flarum/utils defaultHeight = this.$().height(); } + // Set the height of the Composer element and its contents on each redraw, + // so that they do not lose it if their DOM elements are recreated. + this.updateHeight(); + if (isInitialized) return; // Since this component is a part of the global UI that persists between diff --git a/framework/core/js/forum/src/components/Composer.js b/framework/core/js/forum/src/components/Composer.js index f498333e6..93532d700 100644 --- a/framework/core/js/forum/src/components/Composer.js +++ b/framework/core/js/forum/src/components/Composer.js @@ -91,6 +91,10 @@ class Composer extends Component { defaultHeight = this.$().height(); } + // Set the height of the Composer element and its contents on each redraw, + // so that they do not lose it if their DOM elements are recreated. + this.updateHeight(); + if (isInitialized) return; // Since this component is a part of the global UI that persists between