X-Git-Url: https://git.mdrn.pl/fnpeditor.git/blobdiff_plain/232e5bd6f1b93f27e227a291b7913867e7d76be7..4b2e5f26a2bf27ea2cf41c0d4818e5b85785cd67:/src/smartxml/smartxml.js?ds=inline diff --git a/src/smartxml/smartxml.js b/src/smartxml/smartxml.js index 3ee49b7..749d4f4 100644 --- a/src/smartxml/smartxml.js +++ b/src/smartxml/smartxml.js @@ -122,10 +122,18 @@ $.extend(DocumentNode.prototype, { return myIdx < parentContents.length - 1 ? parentContents[myIdx+1] : null; }, - isSurroundedByTextElements: function() { - var prev = this.prev(), - next = this.next(); - return prev && (prev.nodeType === Node.TEXT_NODE) && next && (next.nodeType === Node.TEXT_NODE); + isSurroundedByTextNodes: function() { + return this.isPrecededByTextNode() && this.isFollowedByTextNode(); + }, + + isPrecededByTextNode: function() { + var prev = this.prev(); + return prev && prev.nodeType === Node.TEXT_NODE; + }, + + isFollowedByTextNode: function() { + var next = this.next(); + return next && next.nodeType === Node.TEXT_NODE; }, triggerChangeEvent: function(type, metaData, origParent, nodeWasContained) {