bring back select-all-on-click

This commit is contained in:
Matthew Hodgson 2016-01-10 13:14:12 +00:00
parent aa80a5d494
commit d39a9a0f18

View file

@ -148,6 +148,15 @@ module.exports = React.createClass({
onFocus: function(ev) { onFocus: function(ev) {
//ev.target.setSelectionRange(0, ev.target.textContent.length); //ev.target.setSelectionRange(0, ev.target.textContent.length);
var node = ev.target.childNodes[0];
var range = document.createRange();
range.setStart(node, 0);
range.setEnd(node, node.length);
var sel = window.getSelection();
sel.removeAllRanges();
sel.addRange(range);
}, },
onFinish: function(ev) { onFinish: function(ev) {