Get location field integrating with form saving/loading (#52)

This commit is contained in:
Anna Sidwell 2018-04-16 10:23:06 +10:00
parent e067443756
commit ee88a3160e

View File

@ -106,7 +106,6 @@
// Add a help text control
this._zoomHelpText = new ZoomHelpText().addTo(map)
console.log(this._zoomHelpText)
// Only allow editing past a certain zoom level (see #56)
// Remove the edit controls
@ -120,6 +119,19 @@
this.zoomLevelTooLow()
}
})
// Respond to underlying text field changing
const textarea = document.getElementById(this.options.fieldid)
textarea.addEventListener('change', evt => {
this.load()
})
const triggerChange = evt => {
document.getElementById('case-study-form').dispatchEvent(new Event('dirty'))
}
map.on(L.Draw.Event.CREATED, triggerChange)
map.on(L.Draw.Event.EDITED, triggerChange)
map.on(L.Draw.Event.DELETED, triggerChange)
},
})
</script>