{"action":"created","issue":{"url":"https://api.github.com/repos/Voog/wysihtml/issues/234","labels_url":"https://api.github.com/repos/Voog/wysihtml/issues/234/labels{/name}","comments_url":"https://api.github.com/repos/Voog/wysihtml/issues/234/comments","events_url":"https://api.github.com/repos/Voog/wysihtml/issues/234/events","html_url":"https://github.com/Voog/wysihtml/issues/234","id":108817229,"number":234,"title":"Get current caret position","user":{"login":"alessandrofrancesconi","id":1595223,"avatar_url":"https://avatars.githubusercontent.com/u/1595223?v=3","gravatar_id":"","url":"https://api.github.com/users/alessandrofrancesconi","html_url":"https://github.com/alessandrofrancesconi","followers_url":"https://api.github.com/users/alessandrofrancesconi/followers","following_url":"https://api.github.com/users/alessandrofrancesconi/following{/other_user}","gists_url":"https://api.github.com/users/alessandrofrancesconi/gists{/gist_id}","starred_url":"https://api.github.com/users/alessandrofrancesconi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alessandrofrancesconi/subscriptions","organizations_url":"https://api.github.com/users/alessandrofrancesconi/orgs","repos_url":"https://api.github.com/users/alessandrofrancesconi/repos","events_url":"https://api.github.com/users/alessandrofrancesconi/events{/privacy}","received_events_url":"https://api.github.com/users/alessandrofrancesconi/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-09-29T08:20:30Z","updated_at":"2015-10-06T13:45:10Z","closed_at":null,"body":"Hello, I see that the editor uses Rangy to work with selection and so on.\r\nAssuming this... is it possible to have a public method that returns the current (relative or absolute) position of the caret inside the editable area?\r\n\r\nSomething like `editor.getCaretPosition() => { left; top }`"},"comment":{"url":"https://api.github.com/repos/Voog/wysihtml/issues/comments/145860514","html_url":"https://github.com/Voog/wysihtml/issues/234#issuecomment-145860514","issue_url":"https://api.github.com/repos/Voog/wysihtml/issues/234","id":145860514,"user":{"login":"ChristofferJoergensen","id":1053239,"avatar_url":"https://avatars.githubusercontent.com/u/1053239?v=3","gravatar_id":"","url":"https://api.github.com/users/ChristofferJoergensen","html_url":"https://github.com/ChristofferJoergensen","followers_url":"https://api.github.com/users/ChristofferJoergensen/followers","following_url":"https://api.github.com/users/ChristofferJoergensen/following{/other_user}","gists_url":"https://api.github.com/users/ChristofferJoergensen/gists{/gist_id}","starred_url":"https://api.github.com/users/ChristofferJoergensen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ChristofferJoergensen/subscriptions","organizations_url":"https://api.github.com/users/ChristofferJoergensen/orgs","repos_url":"https://api.github.com/users/ChristofferJoergensen/repos","events_url":"https://api.github.com/users/ChristofferJoergensen/events{/privacy}","received_events_url":"https://api.github.com/users/ChristofferJoergensen/received_events","type":"User","site_admin":false},"created_at":"2015-10-06T13:45:10Z","updated_at":"2015-10-06T13:45:10Z","body":"+1, I would really like to know this as well. My current implementation only gets me this far:\r\n\r\nI can identify my currently focussed textbox with [Window.selection](https://developer.mozilla.org/en-US/docs/Web/API/Selection):\r\n\r\n    var selection = window.getSelection();\r\n\r\nI can identify the caret position with [Selection.focusOffset](https://developer.mozilla.org/en-US/docs/Web/API/Selection/focusOffset):\r\n\r\n    var focus = selection.focusOffset;\r\n\r\nHowever, this counter only counts characters on the current line. So if I'm 2 characters in on line 3 `focus` will be 2. This dosn't tell me anything about how many characters I am into the entire text. "}}