Measurement-induced phase transition in a quantum spin system