DEV: do not process composer preview when collapsed (#13941)

DEV: do not process composer preview when collapsed (#13941)

diff --git a/app/assets/javascripts/discourse/app/components/composer-editor.js b/app/assets/javascripts/discourse/app/components/composer-editor.js
index c9a1a2d..7ffdb99 100644
--- a/app/assets/javascripts/discourse/app/components/composer-editor.js
+++ b/app/assets/javascripts/discourse/app/components/composer-editor.js
@@ -74,6 +74,7 @@ export default Component.extend(ComposerUpload, {
 
   shouldBuildScrollMap: true,
   scrollMap: null,
+  processPreview: true,
 
   uploadMarkdownResolvers,
   uploadProcessorActions,
diff --git a/app/assets/javascripts/discourse/app/components/d-editor.js b/app/assets/javascripts/discourse/app/components/d-editor.js
index adcbc6b..e2cc964 100644
--- a/app/assets/javascripts/discourse/app/components/d-editor.js
+++ b/app/assets/javascripts/discourse/app/components/d-editor.js
@@ -252,6 +252,7 @@ export default Component.extend({
   emojiPickerIsActive: false,
   emojiStore: service("emoji-store"),
   isEditorFocused: false,
+  processPreview: true,
 
   @discourseComputed("placeholder")
   placeholderTranslated(placeholder) {
@@ -387,7 +388,7 @@ export default Component.extend({
   },
 
   _updatePreview() {
-    if (this._state !== "inDOM") {
+    if (this._state !== "inDOM" || !this.processPreview) {
       return;
     }
 
@@ -453,7 +454,7 @@ export default Component.extend({
     });
   },
 
-  @observes("ready", "value")
+  @observes("ready", "value", "processPreview")
   _watchForChanges() {
     if (!this.ready) {
       return;
diff --git a/app/assets/javascripts/discourse/app/templates/components/composer-editor.hbs b/app/assets/javascripts/discourse/app/templates/components/composer-editor.hbs
index 1d2aeb7..84a88a8 100644
--- a/app/assets/javascripts/discourse/app/templates/components/composer-editor.hbs
+++ b/app/assets/javascripts/discourse/app/templates/components/composer-editor.hbs
@@ -8,6 +8,7 @@
   importQuote=(action "importQuote")
   showUploadModal=showUploadModal
   togglePreview=(action "togglePreview")
+  processPreview=processPreview
   validation=validation
   loading=composer.loading
   forcePreview=forcePreview
diff --git a/app/assets/javascripts/discourse/app/templates/composer.hbs b/app/assets/javascripts/discourse/app/templates/composer.hbs
index b74974e..75fe8f7 100644
--- a/app/assets/javascripts/discourse/app/templates/composer.hbs
+++ b/app/assets/javascripts/discourse/app/templates/composer.hbs
@@ -127,6 +127,7 @@
                           cannotSeeMention=(action "cannotSeeMention")
                           importQuote=(action "importQuote")
                           togglePreview=(action "togglePreview")
+                          processPreview=showPreview
                           showToolbar=showToolbar
                           afterRefresh=(action "afterRefresh")
                           focusTarget=focusTarget}}

GitHub sha: 5b85b254dbeccc0c004184a4f67dc6509cba2add

This commit appears in #13941 which was approved by ZogStriP and eviltrout. It was merged by jjaffeux.