From: Zachary Vance Date: Thu, 28 May 2015 00:53:46 +0000 (-0700) Subject: Maintain cursor position while un-completing an item X-Git-Url: https://git.za3k.com/?a=commitdiff_plain;h=7413a09b9ef1ca45b3a0a0c8c794568f55952f71;p=flowy.git Maintain cursor position while un-completing an item --- diff --git a/dist/flowy.js b/dist/flowy.js index fefa3a4..395bb7a 100644 --- a/dist/flowy.js +++ b/dist/flowy.js @@ -461,9 +461,11 @@ var TodoView = Backbone.View.extend({ }, toggleComplete: function() { if (this.model.get("completed")) { - this.stopEditingText(); - this.model.toggleComplete(); - this.startEditingText(); // TODO: Don't lose place + var self = this; + this._maintainingFocus(function() { + self.stopEditingText(); + self.model.toggleComplete(); + }); } else { this.stopEditingText(); this.model.toggleComplete(); diff --git a/dist/flowy.unwrapped.js b/dist/flowy.unwrapped.js index 20777ee..6fee3ce 100644 --- a/dist/flowy.unwrapped.js +++ b/dist/flowy.unwrapped.js @@ -460,9 +460,11 @@ var TodoView = Backbone.View.extend({ }, toggleComplete: function() { if (this.model.get("completed")) { - this.stopEditingText(); - this.model.toggleComplete(); - this.startEditingText(); // TODO: Don't lose place + var self = this; + this._maintainingFocus(function() { + self.stopEditingText(); + self.model.toggleComplete(); + }); } else { this.stopEditingText(); this.model.toggleComplete(); diff --git a/src/views/todo.js b/src/views/todo.js index f5df801..12b9c2b 100644 --- a/src/views/todo.js +++ b/src/views/todo.js @@ -64,9 +64,11 @@ var TodoView = Backbone.View.extend({ }, toggleComplete: function() { if (this.model.get("completed")) { - this.stopEditingText(); - this.model.toggleComplete(); - this.startEditingText(); // TODO: Don't lose place + var self = this; + this._maintainingFocus(function() { + self.stopEditingText(); + self.model.toggleComplete(); + }); } else { this.stopEditingText(); this.model.toggleComplete();