Fixed detection of relative caret position
authorAlexander Ebert <ebert@woltlab.com>
Mon, 23 Jan 2017 16:48:03 +0000 (17:48 +0100)
committerAlexander Ebert <ebert@woltlab.com>
Mon, 23 Jan 2017 16:48:03 +0000 (17:48 +0100)
wcfsetup/install/files/js/3rdParty/redactor/plugins/wutil.js

index 81453a2085726cc701c7d32c401356188e9d2f14..957c223e3eba524fc84c8ddb2b79c6bf1dad7385 100644 (file)
@@ -815,6 +815,11 @@ RedactorPlugins.wutil = function() {
                                return false;
                        }
                        
+                       // check if caret is there are child nodes beyond the current end offset
+                       if ($range.endContainer.childNodes.length > $range.endOffset) {
+                               return false;
+                       }
+                       
                        if ($range.endContainer.nodeType === Element.TEXT_NODE) {
                                // caret is not at the end
                                if ($range.endOffset < $range.endContainer.length) {