FIX: Some toolbar operations weren't triggering the `change` event

FIX: Some toolbar operations weren’t triggering the change event

This would mean that some simple edits to queued posts did not get saved.

diff --git a/app/assets/javascripts/discourse/components/d-editor.js.es6 b/app/assets/javascripts/discourse/components/d-editor.js.es6
index 9521d3f..ed6ced3 100644
--- a/app/assets/javascripts/discourse/components/d-editor.js.es6
+++ b/app/assets/javascripts/discourse/components/d-editor.js.es6
@@ -541,7 +541,7 @@ export default Ember.Component.extend({
       }
       textarea.selectionStart = from;
       textarea.selectionEnd = from + length;
-
+      Ember.run.next(() => $textarea.trigger("change"));
       $textarea.scrollTop(oldScrollPos);
     });
   },
diff --git a/app/assets/javascripts/discourse/templates/components/d-editor.hbs b/app/assets/javascripts/discourse/templates/components/d-editor.hbs
index 544168f..1f82566 100644
--- a/app/assets/javascripts/discourse/templates/components/d-editor.hbs
+++ b/app/assets/javascripts/discourse/templates/components/d-editor.hbs
@@ -47,7 +47,7 @@
       class="d-editor-input"
       placeholder=placeholderTranslated
       disabled=disabled
-      change=change}}
+      input=change}}
     {{popup-input-tip validation=validation}}
     {{plugin-outlet name="after-d-editor" tagName="" args=outletArgs}}
   </div>

GitHub sha: fc026e12

1 Like