don't save drafts if no changes

Ticket

+commit
 

Currently, drafts are apparently saved without checking if any changes have been made. Suppose i edit a card and make some changes - a draft is saved. Then i lose the tab, go to edit again and realize the changes aren't there. Wagn saves a new draft, over-writing the one i wanted to retrieve. (Even worse, in some contexts now if you double-click it retriggers edit mode immediately and you lose your draft.)

 

 

 

I almost set this to high; it bit me pretty hard.


does the draft save immediately? or does this mean that the edit area was left open for a while? quickest fix might be to avoid immediate saves.

  --Ethan McCutchen.....Wed Apr 15 13:14:25 -0700 2009


Seemed to save right away; i knew what would happen, and was trying to navigate away asap. Now that the heat of the moment has passed, really, the comment thing bites me much more often.

  --John Abbe.....Wed Apr 15 19:11:49 -0700 2009


This may have some of the same diff issues as in multi-edit only update inclusions that changed, but I did code in a check for changes that may help in some cases. I still think less immediate saves may be the answer.

  --Ethan McCutchen.....Thu Apr 30 11:15:57 -0700 2009


the comment thing = double clicking? where is that ticket?

  --Ethan McCutchen.....Thu Apr 30 11:16:56 -0700 2009


ignore double-click in comment box

How long are you waiting to autosave?

  --John Abbe.....Thu Apr 30 12:27:29 -0700 2009


On most wikis, the edit feature is either the most obvious or the only place to see in the raw the wiki markup that generated the page. A user not yet aware of the autosave feature may unwittingly overwrite autosaved drafts entirely by accident by simply bringing up the edit tab and viewing the markup. (I admit I was one such user here.)

 

Also, this bug causes anyone merely viewing the edit tab of a card, and not writing or changing any content, to be counted as one of that card's editors.

 

Autosave should not be triggered until there's actual typing in the edit box.

 

TinyMCE has a function called isDirty(), which returns true if the editor's current contents deviate from its initial contents (meaning the editor created a new undo level); and a property called isNotDirty, which can be set to true to indicate the editor's contents have been saved and won't be reset to false until a new undo level is created. This function and property should probably be used during the autosave trigger to determine whether or not to actually save a draft.

 

Autosave plugin vs. isDirty() - Bram.us blog

Method: isDirty - TinyMCE Wiki

Property: isNotDirty - TinyMCE Wiki

  --Ariel Millennium Thornton.....Sat May 23 17:20:24 -0700 2009


Disregard previous suggestion. I forgot that card types likely to see huge blocks of editing include types that don't use TinyMCE, such as Plain Text and HTML.

  --Ariel Millennium Thornton.....Sat May 23 20:01:56 -0700 2009


this ticket's status said coded. And I changed it. What?

 

Any changes I coded a month ago will have long since made it through to dwagn. John, would you mind testing this? I kind of doubt I actually fixed it, but it's worth having a look.

 

If it's still broken, could you make it "open" and take it off of 1.0?

  --Ethan McCutchen.....Tue Jun 02 14:25:02 -0700 2009


Still broken.

  --John Abbe.....Tue Jun 02 17:06:10 -0700 2009


Almost lost a lot of notes jut now, but cancelled just in time.

  --John Abbe.....Tue Sep 08 22:47:13 -0700 2009


I think maybe this works now. I don't think the update should even be sent unless there's a change.

  --Ethan McCutchen.....Tue Nov 29 10:47:18 -0800 2011


hmm, I'm going to mark this testing anyway, but I'm not so sure it's working perfectly. helpful to gather more info about current behavior.

  --Ethan McCutchen.....Sun Dec 18 21:40:48 -0800 2011


Looks to be working well to me. In the new system, the javascript doesn't submit the autosave call at all unless it perceives an update. Ariel's comment above about needing a generalized system is correct, though we may at some point use isDirty to optimize autosave. (not currently using it).

 

Closing.

  --Ethan McCutchen.....Fri Feb 03 14:23:33 -0800 2012