diff options
| author | Alon Levy <alon@pobox.com> | 2014-12-04 00:58:53 +0200 |
|---|---|---|
| committer | Alon Levy <alon@pobox.com> | 2014-12-04 01:20:18 +0200 |
| commit | 3f8672553a2f43518e85acb3b9b9afb16597e145 (patch) | |
| tree | 17b6eee37489349634bc3d63643e5bf42d2530fe | |
| parent | b624af90282eba635e140ab42eb5c4db17c0c921 (diff) | |
tab should not change node from last edit; now can tab when sentence is empty
| -rw-r--r-- | src/textanalysis.js | 10 | ||||
| -rw-r--r-- | src/textanalysis.ui.js | 8 |
2 files changed, 14 insertions, 4 deletions
diff --git a/src/textanalysis.js b/src/textanalysis.js index 416106fc..44765916 100644 --- a/src/textanalysis.js +++ b/src/textanalysis.js @@ -217,6 +217,10 @@ var textAnalyser = function (newtext, finalize) { ret.link_set_add.push(link); } + if (newtext.indexOf('#') == -1 || finalize) { + lastnode = null; + } + //Sentence Sequencing //Build the words and cuts the main elements sentence = tokenize(newtext, '#', '"'); @@ -435,7 +439,11 @@ var textAnalyser = function (newtext, finalize) { if (true == finalize && node.state == 'temp') { console.log('bug: temp node creation on finalize'); } else { - lastnode = graph.addNode(node); + if (!finalize) { + lastnode = graph.addNode(node); + } else { + graph.addNode(node); + } } }); diff --git a/src/textanalysis.ui.js b/src/textanalysis.ui.js index 277d847e..d21a389c 100644 --- a/src/textanalysis.ui.js +++ b/src/textanalysis.ui.js @@ -124,9 +124,11 @@ return { switch (e.keyCode) { case 9: //TAB - e.preventDefault(); - changeType(e.shiftKey ? "up" : "down", textanalysis.lastnode()); - ret = false; + if (textanalysis.lastnode()) { + e.preventDefault(); + changeType(e.shiftKey ? "up" : "down", textanalysis.lastnode()); + ret = false; + } break; case 37: //UP $('html, body').scrollLeft(0); |
