Skip to content

Undo/Redo #105

@raineorshine

Description

@raineorshine

Add Undo and Redo functionality.

Requirements:

  • Review 2-3 undo/redo libraries for Redux and provide reasoning for or against.
  • Add undo and redo buttons to toolbar with appropriate svg icons.
  • Undo history should persist in state, local, and remote stores (See: Data Storage).
  • Work with iterative loading (Thought Cache & Iterative Loading #703).
  • Undo groups of actions at once.

Groups

Each undo should be associated with one or more actions.

Consider the following sequence of actions:

  1. newThought
  2. existingThoughtChange1
  3. existingThoughtChange2
  4. existingThoughtChange3

These should be undoable in a single undo.

Another example, based on the following state:

  • a
    • b [cursor]
      • c
  1. existingThoughtChange1
  2. existingThoughtChange2
  3. existingThoughtChange3
  4. cursorDown
  5. existingThoughtChange4
  6. existingThoughtChange5
  7. existingThoughtChange6
  8. cursorUp

Activating undo should undo 5-8, i.e. navigation and contiguous edits.

Actions

Undoable

The following action types should be undoable:

archiveThought
bumpThoughtDown
cursorBack (navigation)
cursorBeforeSearch (navigation)
cursorDown (navigation)
cursorForward (navigation)
cursorHistory (navigation)
cursorUp (navigation)
deleteAttribute
deleteData
deleteEmptyThought
deleteThought
existingThoughtChange
existingThoughtDelete
existingThoughtMove
expandContextThought
indent
moveThoughtDown
moveThoughtUp
newThought
newThoughtSubmit
outdent
searchLimit
setAttribute
setCursor (navigation)
setFirstSubthought
settings
splitThought
subCategorizeAll
subCategorizeOne
toggleAttribute
toggleCodeView
toggleContextView
toggleHiddenThoughts
toggleSplitView
toolbarOverlay
tutorial
tutorialChoice
tutorialNext
tutorialPrev
tutorialStep

Non-undoable

Patches should not be generated for the following actions and they should be ignored completely by the undo/redo history:

alert
authenticate
clear
clearQueue
dragHold
dragInProgress
editing
editingValue
error
invalidState
loadLocalState
loadLocalThoughts
modalComplete
modalRemindMeLater
prependRevision
render
search
selectionChange
setResourceCache
showModal
status
toggleSidebar
undoArchive (will be replaced with new undo/redo logic)
updateSplitPosition
unknownAction
updateThoughts (complicated)

Metadata

Metadata

Assignees

Labels

featureNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions