suneditor icon indicating copy to clipboard operation
suneditor copied to clipboard

How to get caret position (pixel x, y on the screen)

Open phuongnh5 opened this issue 4 years ago • 2 comments

I have a scenario need show popover suggestion at caret location. I have used function core.getSelection() and have information about anchorNode (text), anchorOffset. The position, width height of anchorNode.parentNode is available, however I cannot find the way to get relative position(x,y) of current caret to parentNode. Is there anyway to get this position?

phuongnh5 avatar Mar 09 '21 14:03 phuongnh5

@phuongnh5 https://github.com/JiHong88/SunEditor/blob/master/src/lib/core.js#L5700 This is a method to designate the position of the balloon toolbar. (It is coded taking into account the case that the size of the toolbar varies depending on the screen.)

In version 3.0.0, I will add common methods related to the position of the cursor.

JiHong88 avatar Mar 11 '21 17:03 JiHong88

it seems that the provided link no longer points to the proper position in your code - could you please provide a function name or s.th. similar instead?

rozek avatar Aug 14 '24 08:08 rozek