From 4f7cd7b78ee28f1ba7366b916a75bb403b842c4f Mon Sep 17 00:00:00 2001 From: Joffrey JAFFEUX Date: Tue, 16 Apr 2024 14:49:51 +0200 Subject: [PATCH] FIX: correctly unshrink composer when re-editing post (#26650) Prior to this fix we were manually expanding the composer but not setting the correct height. This commit adds a new `unshrink` function on the composer service to correctly set the state and the height on the composer model. --- app/assets/javascripts/discourse/app/controllers/topic.js | 2 +- app/assets/javascripts/discourse/app/services/composer.js | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/app/assets/javascripts/discourse/app/controllers/topic.js b/app/assets/javascripts/discourse/app/controllers/topic.js index 924112373bd..54dbd1907cc 100644 --- a/app/assets/javascripts/discourse/app/controllers/topic.js +++ b/app/assets/javascripts/discourse/app/controllers/topic.js @@ -847,7 +847,7 @@ export default Controller.extend(bufferedProperty("model"), { opts?.action === Composer.EDIT && composerModel?.draftKey === opts.draftKey; if (editingExisting) { - composerModel.set("composeState", Composer.OPEN); + composer.unshrink(); return; } diff --git a/app/assets/javascripts/discourse/app/services/composer.js b/app/assets/javascripts/discourse/app/services/composer.js index a6d7cc3d2cc..05cd5f462a1 100644 --- a/app/assets/javascripts/discourse/app/services/composer.js +++ b/app/assets/javascripts/discourse/app/services/composer.js @@ -1697,6 +1697,14 @@ export default class ComposerService extends Service { }); } + unshrink() { + this.model.set("composeState", Composer.OPEN); + document.documentElement.style.setProperty( + "--composer-height", + this.model.composerHeight + ); + } + shrink() { if ( this.get("model.replyDirty") ||