Had a few people run into this lately, someone copies a drawtools polygon from iitc, the pastes it into a hangout along with descriptive text before or after. Someone else copies the whole text block and pastes it into drawtools, which fails to render because of the extra text.
This PR adds an extra try/catch that activates only if parsing the pasted JSON fails. It strips out anything before and after the first and last [{ }]. What's left is probably what the user actually wanted to paste, and is parsed as JSON.
Had a few people run into this lately, someone copies a drawtools polygon from iitc, the pastes it into a hangout along with descriptive text before or after. Someone else copies the whole text block and pastes it into drawtools, which fails to render because of the extra text.
This PR adds an extra try/catch that activates only if parsing the pasted JSON fails. It strips out anything before and after the first and last [{ }]. What's left is probably what the user actually wanted to paste, and is parsed as JSON.