From: Jan Szejko Date: Thu, 23 Feb 2017 16:38:04 +0000 (+0100) Subject: prevent empty span in a new node X-Git-Url: https://git.mdrn.pl/fnpeditor.git/commitdiff_plain/63ee9d994b0718108e45386230d6045f00af27a6 prevent empty span in a new node (cherry picked from commit 0bbec0d) --- diff --git a/src/editor/plugins/core/core.js b/src/editor/plugins/core/core.js index 6cb39e2..18bf7c6 100644 --- a/src/editor/plugins/core/core.js +++ b/src/editor/plugins/core/core.js @@ -120,6 +120,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});