Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve calculating the suggestion list's position #13

Open
minhhai2209 opened this issue Jun 11, 2013 · 0 comments
Open

Improve calculating the suggestion list's position #13

minhhai2209 opened this issue Jun 11, 2013 · 0 comments

Comments

@minhhai2209
Copy link

Hi. The current method for calculating the suggestion list's position does not work in IE. The problem is that editor.selection.getRng().getClientRects() always returns an empty array. I have just found out that it can be fixed by making a Range with positive length. Here is the new code:

    var range = ed.selection.getRng();
    var rangeStart = range.startOffset;
    range.setStart(range.startContainer, range.startOffset - 1);
    var rects = range.getClientRects();
    range.setStart(range.startContainer, rangeStart);
    if (rects.length > 0) {
      var rect = rects[0];
      textareaTop = rect.top + rect.height;
      textareaLeft = rect.left;
    }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant