1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-09-20 09:18:48 +02:00
phorge-phorge/webroot/rsrc
epriestley fe042def42 Add a Javascript method to find the pixel position of a range in a textarea
Summary:
Ref T3725. This might eventually allow us to do `@username` typeaheads in textareas.

Javascript!!!

Test Plan:
Dumped this into console and got a "<<<" at the caret position in Safari, Firefox and Chrome.

```
setInterval(function() {

var area = JX.$('comment-content');
var r = JX.TextAreaUtils.getSelectionRange(area);
var d = JX.TextAreaUtils.getPixelDimensions(area, r.start, r.end);

JX.log(d);

try {
  JX.DOM.remove(JX.$('ptr'));
} catch (_) {}

document.body.appendChild(
  JX.$N(
    'div',
    {id: "ptr", style: { position: 'absolute', left: d.start.x + 'px', top: d.start.y + 'px', zIndex: 9999, border: '2px solid red' }},
    '<<<'));
}, 1000);
```

Reviewers: chad, btrahan

Reviewed By: btrahan

Subscribers: epriestley

Maniphest Tasks: T3725

Differential Revision: https://secure.phabricator.com/D10280
2014-08-18 13:15:40 -07:00
..
css Add a Javascript method to find the pixel position of a range in a textarea 2014-08-18 13:15:40 -07:00
externals Projects - tokenize projects more aggressively with respect to '-' 2014-08-14 12:28:11 -07:00
image Replace ActionHeader minicons with Font icons 2014-08-15 11:08:28 -07:00
js Add a Javascript method to find the pixel position of a range in a textarea 2014-08-18 13:15:40 -07:00
swf React to Aphlict disconnects in the UI 2014-06-24 09:41:40 -07:00