Skip to content

Undo/Redo Functionality. #145

Closed
Closed
@smitpatelx

Description

@smitpatelx

Get redo stack returns empty array:

  • Steps to reproduce:
  1. Create a new task.
  2. Click on undo (This will delete the newly created task).

After this, here are two scenarios:
3.1 - Click on undo again (This creates a new task with the same name, instead of doing nothing).
3.2 - Click on redo (This does not add the deleted task, instead it does not do anything).

Implementation:

handleUndo() {
    const undoStack = gantt.ext.undo.getUndoStack();
    if (undoStack.length === 0) {
        console.error('No more undo actions available');
        return;
    }
    gantt.undo();
},

handleRedo() {
    const redoStack = gantt.ext.undo.getRedoStack();
    if (redoStack.length === 0) {
        console.error('No more redo actions available');
        return;
    }
    gantt.redo();
},

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions