Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion js/src/controls/DrawControl.js
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,10 @@ export class LeafletDrawControlView extends control.LeafletControlView {
let newData = [];
this.feature_group.eachLayer((layer) => {
const geoJson = layer.toGeoJSON();
geoJson.properties.style = layer.options;
// Sanitize layer options for serialization via `structuredClone`:
// https://web.dev/structured-clone/#features-and-limitations
const sanitizedLayerOptions = JSON.parse(JSON.stringify(layer.options));
geoJson.properties.style = sanitizedLayerOptions;
newData.push(geoJson);
});
this.model.set('data', newData);
Expand Down