diff --git a/lib/client/edit.js b/lib/client/edit.js index 43097f9a..44bfd507 100644 --- a/lib/client/edit.js +++ b/lib/client/edit.js @@ -82,9 +82,7 @@ var CloudCmd, Util, DOM, ace; if ( Util.isString(pValue) ) { Ace.setValue(pValue); - CloudCmd.View.show(Element, function() { - Ace.focus(); - }); + CloudCmd.View.show(Element, focus); Key.unsetBind(); } else { @@ -96,9 +94,7 @@ var CloudCmd, Util, DOM, ace; lValue = pData.data; Ace.setValue(lValue); - CloudCmd.View.show(Element, function() { - Element.firstChild.focus(); - }); + CloudCmd.View.show(Element, focus); } }); } @@ -108,6 +104,11 @@ var CloudCmd, Util, DOM, ace; CloudCmd.View.hide(); }; + function focus() { + Ace.focus(); + Ace.clearSelection(); + Ace.moveCursorTo(0, 0); + } function load(pCallBack){ Util.time(Name + ' load');