From cb0381b9670fd26c43e808bd2f35aac8d50c9288 Mon Sep 17 00:00:00 2001
From: =?utf8?q?Aleksander=20=C5=81ukasz?=
 <aleksander.lukasz@nowoczesnapolska.org.pl>
Date: Wed, 24 Apr 2013 11:20:00 +0200
Subject: [PATCH] Visual editor - handling double enter

If enter is hit in empty node, the node gets deleted and
clone of it's parent is created and inserted after the original.
---
 modules/visualEditor.js | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/modules/visualEditor.js b/modules/visualEditor.js
index 77ed078..83bf329 100644
--- a/modules/visualEditor.js
+++ b/modules/visualEditor.js
@@ -37,6 +37,11 @@ rng.modules.visualEditor = function(sandbox) {
                     var anchor = $(window.getSelection().anchorNode);
                     if(anchor[0].nodeType === Node.TEXT_NODE)
                         anchor = anchor.parent();
+                    if(anchor.text() === '') {
+                        var todel = anchor;
+                        anchor = anchor.parent();
+                        todel.remove();
+                    }
                     var newNode = anchor.clone().empty();
                     newNode.attr('id', '');
                     anchor.after(newNode);
-- 
2.20.1