Our pure JavaScript Scheduler component


Post by ezzamel »

Hi bryntum team,

I have enabled STM for my scheduler which works fine but I want to disable just the redo action but keep the undo action enabled.

Is this configuration possible? I've went through the STM documentation but couldn't find a solution,


Post by tasnim »

Hi,

You could try resetting the redo queue every time you undo

    tbar : [{
        type  : 'undoredo',
        icon  : 'b-fa-undo',
        items : {
            undoBtn : {
                onAction({ source }) {
                    const scheduler = source.parent.parent.parent;
                    scheduler.project.stm.undo();
                    scheduler.project.stm.resetRedoQueue();
                }
            }
        }
    }]

https://bryntum.com/products/scheduler/docs/api/Core/data/stm/StateTrackingManager#function-resetRedoQueue


Post by ezzamel »

Hi Tasnim,

Thanks for the suggestion. This would work when performing an undo by clicking the toolbar/buttons.
But how about undo via keyboard commands? Is there an event that i can listen to?
I searched for one that triggers specifically on undo but couldn't find any under the STM events docs.


Post by tasnim »

Hi,

You could set the Ctrl+z and Ctrl+Shift+z to null inside keymap https://bryntum.com/products/scheduler/docs/api/Scheduler/view/Scheduler#config-keyMap
https://bryntum.com/products/scheduler/docs/api/Grid/view/Grid#keyboard-shortcuts

Example:

    keyMap : {
        'Ctrl+z' : null,
        'Ctrl+Shift+z' : null
    },

Post Reply