Skip to content

Editor - n-level undo #2223

@steff-o

Description

@steff-o

Is your feature request related to a problem? Please describe.
When a user makes a mistake while editing there is no way of undoing the edit. In autosave mode the only way out is to create a corrective edit. When autosave is not used (which the user can't decide by itself), it is possible to abandon the abort session by reloading the application. Both are quite annoying.

Describe the solution you'd like
It should be possible to undo edit operations. Preferably n-level undo for any type of edit. Also it should be possible to abort an edit session. Sorry, no piccies, but I propose adding three buttons to the edit toolbar

  1. Discard edits, only visible when not using autosave
  2. Undo. Always visible, but greyed out when there are no undoable edits
  3. Redo. Always visible, but greyed out when there are no redoable edits

The undo/redo should work regardless of autosave is active or not.

For autosave the following principles will be used:

  1. The last n edits are pushed on a n-level undo stack. The number of edits to keep has a reasonable default, but is possible to override by configuration. If 0 level is configured, undo is disabled and buttons removed.
  2. When the undo button is pressed, a corrective edit is created and automatically posted to the server
  3. If a feature is deleted, a corrective Insert transaction is sent trying to recreate the deleted feature's private key. As this may not be possible for all backends, it will be the default behavior but possible to configure to just create a new feature. Retaining the private key could be useful when related tables and attachments are used with the private key as relation (which may or may not be a smart decision).
  4. Redo will redo the next edit in the stack.
  5. Performing a new edit after an undo operation will erase top of undo stack, making it impossible to redo older operations.

When autosave is not active undo/redo works similar to autosave mode with the exception that no corrective edits are created. Instead undo is performed by restoring the feature's state within the edit session. If that results in a feature being completely unchanged, it should be removed from the editstore and not sent to server at all on save. It is not possible to undo between edit sessions. An edit session is defined as starting when an edit is made until save or abort is pressed, not opening/closing the edit menu.

Describe alternatives you've considered
Lecturing the users to don't make mistakes and teaching them the joy of making correct actions from the start

Additional context
This issue is related to #2018 but applies to the editor, not Draw Control as they don't share any code.
I know I've been reluctant to introducing undo to the editor, but after looking into it further I believe that it can be done with a reasonable effort.

Metadata

Metadata

Assignees

No one assigned

    Labels

    PR acceptedAnyone can write a PR for this issue

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions