X-Git-Url: https://git.mdrn.pl/fnpeditor.git/blobdiff_plain/85b90b418f5ae3731455f3bdf7f65e7f17406c72..620a7d196ada7e95c73418e92715076cfed39f76:/src/editor/plugins/core/core.js diff --git a/src/editor/plugins/core/core.js b/src/editor/plugins/core/core.js index 76be9e8..3921635 100644 --- a/src/editor/plugins/core/core.js +++ b/src/editor/plugins/core/core.js @@ -224,7 +224,16 @@ plugin.documentExtension.documentNode.transformations = { } else if(prev.is({tagName: 'span'})) { if((txtNode = prev.getLastTextNode())) { txt = txtNode.getText(); - txtNode.setText(txt.substr(0, txt.length-1)); + if(txt.length > 1) { + txtNode.setText(txt.substr(0, txt.length-1)); + } else { + if(txtNode.parent().contents().length === 1) { + txtNode.parent().detach(); + } else { + txtNode.detach(); + } + + } return toret; } }