showing results for - "leaflet draw save event"
Jan
28 Jan 2018
1L.EditToolbar.include({
2  getActions: function (handler) {
3    var actions = [
4      {
5        title: L.drawLocal.edit.toolbar.actions.save.title,
6        text: L.drawLocal.edit.toolbar.actions.save.text,
7        callback: this._save,
8        context: this
9      },
10      {
11        title: L.drawLocal.edit.toolbar.actions.cancel.title,
12        text: L.drawLocal.edit.toolbar.actions.cancel.text,
13//        callback: this.disable,  // --- original
14        callback: this._cancel,    // --- changed
15        context: this
16      }
17    ];
18
19    if (handler.removeAllLayers) {
20      actions.push({
21        title: L.drawLocal.edit.toolbar.actions.clearAll.title,
22        text: L.drawLocal.edit.toolbar.actions.clearAll.text,
23        callback: this._clearAllLayers,
24        context: this
25      });
26    }
27
28    return actions;
29  },
30
31// --- new -----------------
32  _cancel: function() {
33    this.disable();
34    this._map.fire('draw:editcancel');
35  }  
36});
37
38function processCancel(e) {
39  console.log('draw canceled');
40}
41
42map.on('draw:editcancel', processCancel);
43