         $(this.element).trigger('mapeditor:feature_update', layer.feature)
 
         widget._saveUpdates()
+        $(this.element).trigger('mapchange')
         false
 
       widget.element.trigger "mapeditor:loaded"


      widget = this

      this.map.on "draw:created", (e) ->
        widget.edition.addLayer e.layer
        widget._saveUpdates()
        widget.element.trigger "mapchange"


        this.element.val JSON.stringify(this.edition.toGeoJSON())
      true

    update: ->
      this._saveUpdates()
      this.element.trigger "mapchange"

  $(document).ready ->
    $("input[data-map-editor]").each ->
      $(this).mapeditor()
