X-Git-Url: https://git.mdrn.pl/redakcja.git/blobdiff_plain/b9166b62220208f49bfd3521e547d60d377ab7c1..6c81c82481a5407bc6e4f3c5cdd16baedbc2a523:/src/redakcja/static/js/wiki/caret.js?ds=sidebyside diff --git a/src/redakcja/static/js/wiki/caret.js b/src/redakcja/static/js/wiki/caret.js index 8b3cbd84..b2cf1826 100644 --- a/src/redakcja/static/js/wiki/caret.js +++ b/src/redakcja/static/js/wiki/caret.js @@ -28,12 +28,15 @@ class Caret { var selection = window.getSelection(); if (!selection.isCollapsed) return; + var anchorNode = selection.anchorNode; + // Is selection still inside a node? + if (!$(anchorNode).closest('[x-node]').length) return; self.singleClick = true; setTimeout(function() { if (self.singleClick) { self.element.insertBefore( - selection.anchorNode.splitText( + anchorNode.splitText( selection.anchorOffset ) )