fnp
/
redakcja.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
4cab8b0
)
Fix caret positioning outside editable.
author
Radek Czajka
<rczajka@rczajka.pl>
Tue, 27 Jun 2023 10:18:22 +0000
(12:18 +0200)
committer
Radek Czajka
<rczajka@rczajka.pl>
Tue, 27 Jun 2023 10:18:22 +0000
(12:18 +0200)
src/redakcja/static/js/wiki/caret.js
patch
|
blob
|
history
diff --git
a/src/redakcja/static/js/wiki/caret.js
b/src/redakcja/static/js/wiki/caret.js
index
8b3cbd8
..
7026e2f
100644
(file)
--- 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 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(
self.singleClick = true;
setTimeout(function() {
if (self.singleClick) {
self.element.insertBefore(
-
selection.
anchorNode.splitText(
+ anchorNode.splitText(
selection.anchorOffset
)
)
selection.anchorOffset
)
)