• Robert Knight's avatar
    Preserve unsaved changes when switching groups · 72e37852
    Robert Knight authored
    Refactor the drafts service to preserve unsaved edits
    when switching groups.
    
    This rewrites the drafts service so that it can preserve
    unsaved changes for new and existing annotations when
    switching groups.
    
    For each annotation, the drafts service now maintains
    an object containing the unsaved changes in addition to
    the model for the annotation which was being edited.
    
     * For new annotations, the annotation is moved to the current
       group when switching groups.
    
     * For edits to existing annotations, the unsaved changes are
       saved to the drafts service.
    
     * When an annotation card is created, switch to editing mode
       automatically if a draft is present.
    
     * Avoid automatically discarding the draft when an annotation
       is unloaded. This allows unsaved edits to existing annotations
       in a group to be restored when switching back to the group.
    72e37852
drafts-test.js 1.59 KB