bring back select-all-on-click

pull/21833/head
Matthew Hodgson 2016-01-10 13:14:12 +00:00
parent aa80a5d494
commit d39a9a0f18
1 changed files with 9 additions and 0 deletions

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) {