diff options
| author | Patrick Simianer <p@simianer.de> | 2015-09-09 10:54:43 +0200 | 
|---|---|---|
| committer | Patrick Simianer <p@simianer.de> | 2015-09-09 10:54:43 +0200 | 
| commit | 594f8a24b18bee907b7e28a7e649a168f89c892c (patch) | |
| tree | a927c0dea84e2a4cac0793f558b2c9cf6699588b | |
| parent | 92d9590026c229ec82ceddfd5a2971ac31309605 (diff) | |
finish text editing with 'return'
| -rw-r--r-- | edit.js | 13 | 
1 files changed, 9 insertions, 4 deletions
| @@ -295,14 +295,19 @@ var make_obj = function(x, text, type)        curEdShape = this;        var input = curEd.inlineTextEditing.startEditing();        input.addEventListener("keypress", function(e) { -        if (e.keyCode == 13) { // return -          e.preventDefault(); -          return; -        } else if (e.keyCode==27||e.keyCode==37||e.keyCode==38||e.keyCode==39||e.keyCode==40) { // esc, arrows, backspace +        if (e.keyCode==27||e.keyCode==37||e.keyCode==38||e.keyCode==39||e.keyCode==40) { // esc, arrows, backspace            return;          } else if (e.keyCode == 8) { // backspace            curEdShape.animate({width:curEdShape.getBBox().width-font_width},125);            setTimeout(function(){snap_to_grid(true);},125); +        } else if (e.keyCode == 13) { // enter +          e.preventDefault(); +          curEd.inlineTextEditing.stopEditing(); +          curEdShape.toFront(); +          curEd.toBack(); +          curEdShape.animate({width:curEd.getBBox().width+(margin-padding)},125); +          setTimeout(function(){snap_to_grid(true);},125); +          edit_mode = false;          } else {            curEdShape.animate({width:(this.value.length*font_width)+2*font_width+2*padding},25);            setTimeout(function(){ | 
