]> git.za3k.com Git - flowy.git/commitdiff
Pressing down on the last node should move the cursor to the end
authorZachary Vance <vanceza@gmail.com>
Thu, 28 May 2015 01:45:46 +0000 (18:45 -0700)
committerZachary Vance <vanceza@gmail.com>
Thu, 28 May 2015 01:45:46 +0000 (18:45 -0700)
dist/flowy.js
dist/flowy.unwrapped.js
src/views/todo.js

index 8c7252821bb1a4f1b2c91605fb24ff688e02d8d9..547ad42d99ac8ced88ffa730522e904cda00f78c 100644 (file)
@@ -475,8 +475,12 @@ var TodoView = Backbone.View.extend({
     return false;
   },
   focusNext: function() {
+    if (!this.duringEditing()) return true;
     var nextNode = this.model.nextNode({ childrenAllowed: true });
-    if (!nextNode) return false;
+    if (!nextNode) { // If it's the last node, move the cursor to the end of the node by allowing the default action.
+        return true;
+    }
+
     this.stopEditingText();
     nextNode.getView().startEditingText();
     return false;
@@ -604,8 +608,9 @@ var TodoView = Backbone.View.extend({
   },
   moveDown: function() {
     this._maintainingFocus(_.bind(function() {
-        this.model.moveDown();
+        return this.model.moveDown();
     }, this));
+
     return false;
   },
   moveUp: function() {
index 1e19a3831ccc78be1db015fc6b05ac6dfd952059..c168b12adcd058f7cb9d11fcdc0175b77dd6a4d4 100644 (file)
@@ -474,8 +474,12 @@ var TodoView = Backbone.View.extend({
     return false;
   },
   focusNext: function() {
+    if (!this.duringEditing()) return true;
     var nextNode = this.model.nextNode({ childrenAllowed: true });
-    if (!nextNode) return false;
+    if (!nextNode) { // If it's the last node, move the cursor to the end of the node by allowing the default action.
+        return true;
+    }
+
     this.stopEditingText();
     nextNode.getView().startEditingText();
     return false;
@@ -603,8 +607,9 @@ var TodoView = Backbone.View.extend({
   },
   moveDown: function() {
     this._maintainingFocus(_.bind(function() {
-        this.model.moveDown();
+        return this.model.moveDown();
     }, this));
+
     return false;
   },
   moveUp: function() {
index 05d49faf6ef3cf68b1b4599e834fb4380df993d7..1a774b8833fdbcb1737b7f2bcde43cb2cc32b42a 100644 (file)
@@ -78,8 +78,12 @@ var TodoView = Backbone.View.extend({
     return false;
   },
   focusNext: function() {
+    if (!this.duringEditing()) return true;
     var nextNode = this.model.nextNode({ childrenAllowed: true });
-    if (!nextNode) return false;
+    if (!nextNode) { // If it's the last node, move the cursor to the end of the node by allowing the default action.
+        return true;
+    }
+
     this.stopEditingText();
     nextNode.getView().startEditingText();
     return false;
@@ -207,8 +211,9 @@ var TodoView = Backbone.View.extend({
   },
   moveDown: function() {
     this._maintainingFocus(_.bind(function() {
-        this.model.moveDown();
+        return this.model.moveDown();
     }, this));
+
     return false;
   },
   moveUp: function() {