FIX: Clear theme editor content on switching tabs

FIX: Clear theme editor content on switching tabs

Issue happens when sending a null value to ACE Editor. Fixed by sending an empty string to ACE instead of null.

diff --git a/app/assets/javascripts/admin/components/ace-editor.js.es6 b/app/assets/javascripts/admin/components/ace-editor.js.es6
index d289d7e..ff3203f 100644
--- a/app/assets/javascripts/admin/components/ace-editor.js.es6
+++ b/app/assets/javascripts/admin/components/ace-editor.js.es6
@@ -17,8 +17,9 @@ export default Ember.Component.extend({
 
   @observes("content")
   contentChanged() {
-    if (this._editor && !this._skipContentChangeEvent && this.content) {
-      this._editor.getSession().setValue(this.content);
+    const content = this.content || "";
+    if (this._editor && !this._skipContentChangeEvent) {
+      this._editor.getSession().setValue(content);
     }
   },

GitHub sha: f4dc6de9

1 Like