X-Git-Url: https://git.mdrn.pl/fnpeditor.git/blobdiff_plain/232e5bd6f1b93f27e227a291b7913867e7d76be7..b18fdf0bf367567d1171c14438c03ac39fad3f6b:/src/smartxml/smartxml.js?ds=sidebyside 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) {