]> git.za3k.com Git - flowy.git/commitdiff
Make focusing work correctly for line breaks in bullets.
authorZachary Vance <vanceza@gmail.com>
Thu, 14 May 2015 02:47:41 +0000 (19:47 -0700)
committerZachary Vance <vanceza@gmail.com>
Thu, 14 May 2015 02:47:41 +0000 (19:47 -0700)
dist/flowy.js
dist/flowy.unwrapped.js
src/views/todo.js

index a9c1e73e119cf3d7566e29cdace6be7160e3616a..d4213e8f600a871779f2de70f53261cb48ae08d0 100644 (file)
@@ -76,26 +76,20 @@ var TodoView = Backbone.View.extend({
     // NOTE: Shift-enter is overridden and handled seperately, to allow "notes" spanning multiple lines.
 
      } else if ((lines.length === 2 && lines[1].length === 0) || (lines.length === 3 && lines[1].length === 0 && lines[2].length === 0)) { // Line break at end
-        console.log("TODO: Line breaks not implemented <end>");
         this.model.setText(this.decodeText(lines[0]));
         var emptyAfter = this.model.addTodoAfter({text: this.decodeText(lines[1])}, collection); // Child or not depending on whether this has children
         this.stopEditingText();
-        //emptyAfter.view.startEditingText();
-        // TODO: Focus emptyAfter
+        emptyAfter.getView().startEditingText();
      } else if (lines.length === 2 && lines[0].length === 0) { // Line break at beginning
-        console.log("TODO: Line breaks not implemented <start>");
         var emptyBefore = this.model.addTodoBefore({text: this.decodeText(lines[0])}, collection);
         this.model.setText(this.decodeText(lines[1]));
         this.stopEditingText();
-        //emptyBefore.view.startEditingText();
-        // TODO: Focus emptyBefore
+        emptyBefore.getView().startEditingText();
     } else if (lines.length === 2) { // Line break in middle
-        console.log("TODO: Line breaks not implemented <middle>");
         var newNode = this.model.addTodoBefore({text: this.decodeText(lines[0])}, collection);
         this.model.setText(this.decodeText(lines[1]));
         this.stopEditingText(); // For re-render
-        this.startEditingText();
-        // Keep focus on current node (second half)
+        this.startEditingText(); // Keep focus on current node (second half)
     } else if (lines.length > 2) {
         console.log(lines.length);
         console.log($(e.target).html());
index 52df4b366f4daab1f00aa1f39e9fb63d9709b5f9..aafe4636020f85a146c16f9fedcfa9d7f8fa3849 100644 (file)
@@ -75,26 +75,20 @@ var TodoView = Backbone.View.extend({
     // NOTE: Shift-enter is overridden and handled seperately, to allow "notes" spanning multiple lines.
 
      } else if ((lines.length === 2 && lines[1].length === 0) || (lines.length === 3 && lines[1].length === 0 && lines[2].length === 0)) { // Line break at end
-        console.log("TODO: Line breaks not implemented <end>");
         this.model.setText(this.decodeText(lines[0]));
         var emptyAfter = this.model.addTodoAfter({text: this.decodeText(lines[1])}, collection); // Child or not depending on whether this has children
         this.stopEditingText();
-        //emptyAfter.view.startEditingText();
-        // TODO: Focus emptyAfter
+        emptyAfter.getView().startEditingText();
      } else if (lines.length === 2 && lines[0].length === 0) { // Line break at beginning
-        console.log("TODO: Line breaks not implemented <start>");
         var emptyBefore = this.model.addTodoBefore({text: this.decodeText(lines[0])}, collection);
         this.model.setText(this.decodeText(lines[1]));
         this.stopEditingText();
-        //emptyBefore.view.startEditingText();
-        // TODO: Focus emptyBefore
+        emptyBefore.getView().startEditingText();
     } else if (lines.length === 2) { // Line break in middle
-        console.log("TODO: Line breaks not implemented <middle>");
         var newNode = this.model.addTodoBefore({text: this.decodeText(lines[0])}, collection);
         this.model.setText(this.decodeText(lines[1]));
         this.stopEditingText(); // For re-render
-        this.startEditingText();
-        // Keep focus on current node (second half)
+        this.startEditingText(); // Keep focus on current node (second half)
     } else if (lines.length > 2) {
         console.log(lines.length);
         console.log($(e.target).html());
index 3c5d35ececae595ee632640474d3208a989cb48c..dd66f4cb108838dc393c24002a9776fbadee25cb 100644 (file)
@@ -75,26 +75,20 @@ var TodoView = Backbone.View.extend({
     // NOTE: Shift-enter is overridden and handled seperately, to allow "notes" spanning multiple lines.
 
      } else if ((lines.length === 2 && lines[1].length === 0) || (lines.length === 3 && lines[1].length === 0 && lines[2].length === 0)) { // Line break at end
-        console.log("TODO: Line breaks not implemented <end>");
         this.model.setText(this.decodeText(lines[0]));
         var emptyAfter = this.model.addTodoAfter({text: this.decodeText(lines[1])}, collection); // Child or not depending on whether this has children
         this.stopEditingText();
-        //emptyAfter.view.startEditingText();
-        // TODO: Focus emptyAfter
+        emptyAfter.getView().startEditingText();
      } else if (lines.length === 2 && lines[0].length === 0) { // Line break at beginning
-        console.log("TODO: Line breaks not implemented <start>");
         var emptyBefore = this.model.addTodoBefore({text: this.decodeText(lines[0])}, collection);
         this.model.setText(this.decodeText(lines[1]));
         this.stopEditingText();
-        //emptyBefore.view.startEditingText();
-        // TODO: Focus emptyBefore
+        emptyBefore.getView().startEditingText();
     } else if (lines.length === 2) { // Line break in middle
-        console.log("TODO: Line breaks not implemented <middle>");
         var newNode = this.model.addTodoBefore({text: this.decodeText(lines[0])}, collection);
         this.model.setText(this.decodeText(lines[1]));
         this.stopEditingText(); // For re-render
-        this.startEditingText();
-        // Keep focus on current node (second half)
+        this.startEditingText(); // Keep focus on current node (second half)
     } else if (lines.length > 2) {
         console.log(lines.length);
         console.log($(e.target).html());