//Require selection

APP.pointer = {};

// APP.pointer.dragging = false;
// APP.pointer.getState = function (event) {
  //TODO: pointer dragging logic, should use native dragging if possibble
// }

APP.pointer.mousedown = function (event) {
  var sel = APP.selection;
  var elm = event.target;
  if (APP.utils.elementInDoc(elm) && !APP.utils.elementIsText(elm)) {
    sel = APP.select.element(elm, sel);
    event.preventDefault();
    APP.selection = sel;
  }
}
APP.pointer.mouseup = function (event) {
  var sel = APP.selection;
  var elm = event.target;
  if (!APP.utils.elementIsText(elm)) {
    event.preventDefault();
  }
}
APP.pointer.click = function(event) {
  event.preventDefault();
}
APP.pointer.doubleclick = function(event) {
  var sel = APP.selection;
  var elm = event.target;
  if (APP.utils.elementInDoc(elm) && !APP.utils.elementIsText(elm)) {
    sel = APP.select.text(sel);
    event.preventDefault();
    APP.selection = sel;
  }
}

@@ -725,32 +725,56 @@
 nction(event) %7B%0A
+  var key = 'dblclick';%0A
   var sel = APP.
@@ -794,155 +794,121 @@
 var 
-elm = event.target;%0A  if (APP.utils.elementInDoc(elm) && !APP.utils.elementIsText(elm)) %7B%0A    sel = APP.select.text(sel);%0A    event.preventDefault(
+context = APP.input.getContext(event);%0A  if (!context.text) %7B%0A    var newSel = APP.actions.edit(key, context, sel
 );%0A 
@@ -914,31 +914,34 @@
     APP.selection = 
-s
+newS
 el;%0A  %7D%0A%7D%0A

refactor doubleclick to use app actions