Ref T3725. This might eventually allow us to do @username typeaheads in textareas.
Javascript!!!
Differential D10280
Add a Javascript method to find the pixel position of a range in a textarea Authored by epriestley on Aug 15 2014, 10:10 PM.
Details
Ref T3725. This might eventually allow us to do @username typeaheads in textareas. Javascript!!! 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);
Diff Detail
|