HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

Thanks for the plugin - small improvement to the position handling

edited April 2013 in Feedback

Instead of roughly trying to calculate the selection box position, I used jquery-caret-position-getter (https://github.com/beviz/jquery-caret-position-getter) which will actually place the window below the caret is.

in default.php add (inside LoadLookup function):
$Sender->AddJsFile($this->GetResource('js/jquery.caretposition.js', FALSE, FALSE));

Then in the js/query.js replace all the textarea position handling with:

var caretpos = $(context).getCaretPosition();
var boxleft = $(context).offset().left+caretpos.left;
var boxtop = $(context).offset().top+caretpos.top;
$('.MentionsLookup').css({'left':boxleft,'top':boxtop});

Comments

  • I will bare this in mind for a later date.

    I'd probably do my own you have rangy to get the caret position (in order not to replicate), and then use some of these methods to get the offset.

    grep is your friend.

Sign In or Register to comment.