X-Git-Url: https://git.mdrn.pl/redakcja.git/blobdiff_plain/4cab8b0725fd5a88f5a508e584b4acd346a824fc..732fe46593ff27a62c6f64f3d495c3d5619ece1c:/src/redakcja/static/js/wiki/caret.js diff --git a/src/redakcja/static/js/wiki/caret.js b/src/redakcja/static/js/wiki/caret.js index 8b3cbd84..7026e2f5 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]')) return; self.singleClick = true; setTimeout(function() { if (self.singleClick) { self.element.insertBefore( - selection.anchorNode.splitText( + anchorNode.splitText( selection.anchorOffset ) )