From d39a9a0f189f3a2ce13e230ecd76ee4d9fd6e575 Mon Sep 17 00:00:00 2001 From: Matthew Hodgson Date: Sun, 10 Jan 2016 13:14:12 +0000 Subject: [PATCH] bring back select-all-on-click --- src/components/views/elements/EditableText.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/components/views/elements/EditableText.js b/src/components/views/elements/EditableText.js index 5d509a7831..6c6be899f5 100644 --- a/src/components/views/elements/EditableText.js +++ b/src/components/views/elements/EditableText.js @@ -148,6 +148,15 @@ module.exports = React.createClass({ onFocus: function(ev) { //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) {