FIX: makes focust text area after complete more resilient (#9879)

FIX: makes focust text area after complete more resilient (#9879)

diff --git a/app/assets/javascripts/discourse/app/components/d-editor.js b/app/assets/javascripts/discourse/app/components/d-editor.js
index 4fd5ec4..bfdf021 100644
--- a/app/assets/javascripts/discourse/app/components/d-editor.js
+++ b/app/assets/javascripts/discourse/app/components/d-editor.js
@@ -898,8 +898,16 @@ export default Component.extend({
 
   // ensures textarea scroll position is correct
   _focusTextArea() {
-    const textarea = this.element.querySelector("textarea.d-editor-input");
     schedule("afterRender", () => {
+      if (!this.element || this.isDestroying || this.isDestroyed) {
+        return;
+      }
+
+      const textarea = this.element.querySelector("textarea.d-editor-input");
+      if (!textarea) {
+        return;
+      }
+
       textarea.blur();
       textarea.focus();
     });

GitHub sha: 253a1857

This commit appears in #9879 which was merged by jjaffeux.