[DF-3808] Fix undo/redo in tilemask editor