Index: CHANGELOG
===================================================================
--- CHANGELOG	(revision b175394b30266d82c56f085bcf9829231828db7c)
+++ CHANGELOG	(revision 14d494fd993a8530e41f65d548dd91e4a86c91b9)
@@ -2,4 +2,5 @@
 ===========================
 
+- Fix misleading display when chaning editor type (#1488104)
 - Add loading indicator on contact delete
 - Fix bug where after delete message rows can be added to the list of another folder (#1487752)
Index: program/js/app.js
===================================================================
--- program/js/app.js	(revision b175394b30266d82c56f085bcf9829231828db7c)
+++ program/js/app.js	(revision 14d494fd993a8530e41f65d548dd91e4a86c91b9)
@@ -440,4 +440,6 @@
   this.command = function(command, props, obj)
   {
+    var ret;
+
     if (obj && obj.blur)
       obj.blur();
@@ -463,9 +465,9 @@
     // process external commands
     if (typeof this.command_handlers[command] === 'function') {
-      var ret = this.command_handlers[command](props, obj);
+      ret = this.command_handlers[command](props, obj);
       return ret !== undefined ? ret : (obj ? false : true);
     }
     else if (typeof this.command_handlers[command] === 'string') {
-      var ret = window[this.command_handlers[command]](props, obj);
+      ret = window[this.command_handlers[command]](props, obj);
       return ret !== undefined ? ret : (obj ? false : true);
     }
@@ -473,7 +475,7 @@
     // trigger plugin hooks
     this.triggerEvent('actionbefore', {props:props, action:command});
-    var ret = this.triggerEvent('before'+command, props);
+    ret = this.triggerEvent('before'+command, props);
     if (ret !== undefined) {
-      // abort if one the handlers returned false
+      // abort if one of the handlers returned false
       if (ret === false)
         return false;
@@ -481,4 +483,6 @@
         props = ret;
     }
+
+    ret = undefined;
 
     // process internal command
@@ -1046,13 +1050,15 @@
       default:
         var func = command.replace(/-/g, '_');
-        if (this[func] && typeof this[func] === 'function')
-          this[func](props);
-        break;
-    }
-
-    this.triggerEvent('after'+command, props);
+        if (this[func] && typeof this[func] === 'function') {
+          ret = this[func](props);
+        }
+        break;
+    }
+
+    if (this.triggerEvent('after'+command, props) === false)
+      ret = false;
     this.triggerEvent('actionafter', {props:props, action:command});
 
-    return obj ? false : true;
+    return ret === false ? false : obj ? false : true;
   };
 
Index: program/js/editor.js
===================================================================
--- program/js/editor.js	(revision 66df084203a217ab74a416064c459cc3420a648c)
+++ program/js/editor.js	(revision 14d494fd993a8530e41f65d548dd91e4a86c91b9)
@@ -116,7 +116,5 @@
       flag.value = '1';
   }
-  else {
-    if (!res && select.tagName == 'SELECT')
-      select.value = 'html';
+  else if (res) {
     if (flagElement && (flag = rcube_find_object(flagElement)))
       flag.value = '0';
@@ -125,3 +123,9 @@
       rcube_find_object(rcmail.env.composebody).focus();
   }
+  else { // !res
+    if (select.tagName == 'SELECT')
+      select.value = 'html';
+    else if (select.tagName == 'INPUT')
+      select.checked = true;
+  }
 }
