Issue
`LeafletEditor.remove()` calls `self.saveButton.remove()` unconditionally, but `self.saveButton` is only created when `_showSaveButton()` is called (i.e., after the user creates, edits, or deletes a feature). If `remove()` is called before any edits were made, it crashes with `TypeError: Cannot read properties of undefined (reading 'remove')`.
Steps to reproduce
- Initialize the LeafletEditor on a GeoJSON page
- Call `editor.remove()` without making any edits
Expected behavior
`remove()` should clean up gracefully regardless of whether edits were made.
Actual behavior
`TypeError: Cannot read properties of undefined (reading 'remove')` — the draw controls and GeoJSON layer are never cleaned up because the error occurs before `self.geoJsonLayer.remove()`.
Issue
`LeafletEditor.remove()` calls `self.saveButton.remove()` unconditionally, but `self.saveButton` is only created when `_showSaveButton()` is called (i.e., after the user creates, edits, or deletes a feature). If `remove()` is called before any edits were made, it crashes with `TypeError: Cannot read properties of undefined (reading 'remove')`.
Steps to reproduce
Expected behavior
`remove()` should clean up gracefully regardless of whether edits were made.
Actual behavior
`TypeError: Cannot read properties of undefined (reading 'remove')` — the draw controls and GeoJSON layer are never cleaned up because the error occurs before `self.geoJsonLayer.remove()`.