From 0bbec0dc1ee08f4855b030189a4025994150b38c Mon Sep 17 00:00:00 2001 From: Jan Szejko Date: Thu, 23 Feb 2017 17:38:04 +0100 Subject: [PATCH 1/1] prevent empty span in a new node --- src/editor/plugins/core/core.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/editor/plugins/core/core.js b/src/editor/plugins/core/core.js index bc74e6b..9a333d0 100644 --- a/src/editor/plugins/core/core.js +++ b/src/editor/plugins/core/core.js @@ -122,6 +122,11 @@ plugin.documentExtension.textNode.transformations = { parent.contents().some(function(n) { return move(n, newNode); }); + if(newNodes.second.contents()[0].getText().length === 0) { + newNodes.second.detach(); + newNodes.second = parent; + emptyText = newNodes.second.append({text: '\u200b'}); // why? why is ZWS needed here? + } } return _.extend(newNodes, {emptyText: emptyText}); -- 2.20.1