In the application, I am restricting the undo event based on keyCode and a boolean flag. I want to restrict undo only in case the boolean is true. But, once the boolean flag chages its value and undo event is fired, I am getting the output which I wanted to restrict. Is there any way that I can clear undo history stack whenever I am restricting user to do undo.
Here is sample of code:
var ctrlZ = e.ctrlKey && e.which === 90 ;
if(ctrlZ && restrictUndoFlag){
e.preventDefault();
//clear the undo history here
globalConfig.restrictUndoFlag = false;
}
I think the browser is maintaining the history for my application for undo and redo. Please suggest me the way that I can restrict this behavior.