X-Git-Url: https://git.mdrn.pl/fnpeditor.git/blobdiff_plain/215b225ef3f6716982d4bdc873c08f8561533a3d..15f4c3b:/src/editor/plugins/core/core.js diff --git a/src/editor/plugins/core/core.js b/src/editor/plugins/core/core.js index bc74e6b..d2791d0 100644 --- a/src/editor/plugins/core/core.js +++ b/src/editor/plugins/core/core.js @@ -122,6 +122,18 @@ plugin.documentExtension.textNode.transformations = { parent.contents().some(function(n) { return move(n, newNode); }); + if(newNodes.second.contents()[0].getText().length === 0) { + var textNode = newNodes.second.contents()[0]; + newNodes.second.detach(); + newNodes.second = parent; + emptyText = newNodes.second.append(textNode); + } + } + + var newNodeText = newNodes.second.contents()[0].getText(); + if(newNodes.second.is({tagName: 'header'}) && newNodeText === '') { + newNodes.second = newNodes.second.setTag('div'); + newNodes.second.setClass('p'); } return _.extend(newNodes, {emptyText: emptyText});