Prevent undo/redo from working in readOnly mode

Closes #1369