--- editor.old	2010-09-08 19:34:39.000000000 +0200
+++ editor.js	2010-09-21 15:32:35.089456774 +0200
@@ -57,7 +57,8 @@
       remove_script_host : false,
       relative_urls : false,
       rc_client : rcmail,
-      oninit : 'rcmail_editor_callback'
+      oninit : 'rcmail_editor_callback',
+      setup : function (ed) { ed.onKeyUp.add( function(ed, evt) { rcmail_editor_keyup_handler(ed, evt); }) }
     });
 }
 
@@ -121,3 +122,30 @@
       rcube_find_object(rcmail.env.composebody).focus();
   }
 }
+
+// Enter key handler
+function rcmail_editor_keyup_handler(editor, e)
+{
+  if (e.keyCode == 13) { // Enter
+    var node = editor.selection.getNode();
+
+    if (editor.formatter.match('blockquote', null, node)) {
+      // just break citation block
+      if (node.tagName.toUpperCase() == 'P') {
+        editor.execCommand('mceBlockQuote');
+      }
+      // we need more logic if we're breaking citation using <BR>
+      else {
+        var html = $(node).html(), prev = node.previousSibling;
+
+        $(node).html(html.replace(/^<br>/, ''));
+        if (prev) {
+          var p = editor.dom.create('p');
+          editor.dom.insertAfter(p, prev);
+          editor.selection.select(p);
+          editor.execCommand('mceRepaint');
+        }    
+      }
+    }
+  }
+}
