mirror of https://github.com/logseq/logseq
fix: caret pos
parent
73e0c9968a
commit
8d4f44a326
|
@ -29,10 +29,11 @@
|
||||||
|
|
||||||
If you only need character position, use `pos` instead. Do NOT call this."
|
If you only need character position, use `pos` instead. Do NOT call this."
|
||||||
[input]
|
[input]
|
||||||
|
(when input
|
||||||
(let [pos (util/get-selection-start input)
|
(let [pos (util/get-selection-start input)
|
||||||
rect (bean/->clj (.. input (getBoundingClientRect) (toJSON)))]
|
rect (bean/->clj (.. input (getBoundingClientRect) (toJSON)))]
|
||||||
(try
|
(try
|
||||||
(-> (gdom/getElement "mock-text")
|
(some-> (gdom/getElement "mock-text")
|
||||||
gdom/getChildren
|
gdom/getChildren
|
||||||
array-seq
|
array-seq
|
||||||
(util/nth-safe pos)
|
(util/nth-safe pos)
|
||||||
|
@ -43,7 +44,7 @@
|
||||||
{:pos pos
|
{:pos pos
|
||||||
:rect rect
|
:rect rect
|
||||||
:left js/Number.MAX_SAFE_INTEGER
|
:left js/Number.MAX_SAFE_INTEGER
|
||||||
:top js/Number.MAX_SAFE_INTEGER}))))
|
:top js/Number.MAX_SAFE_INTEGER})))))
|
||||||
|
|
||||||
|
|
||||||
(defn pos [input]
|
(defn pos [input]
|
||||||
|
|
Loading…
Reference in New Issue