Leaflet / Leaflet.Editable

Make geometries editable in Leaflet.
http://leaflet.github.io/Leaflet.Editable/doc/api.html
553 stars 198 forks source link

enableEdit is not a function with L.Layer class #191

Open Milkker opened 5 years ago

Milkker commented 5 years ago

I am try to add Leaflet layer from well know text(wkt). I found it does not include EditableMixin cause that layer.enableEdit is not a function error. https://github.com/Leaflet/Leaflet.Editable/blob/6bf3b5a1a7ac4dce675eaf1d8a7bed2ba37f9361/src/Leaflet.Editable.js#L1917-L1938 How can I use enableEdit method with layer class? Sample code:http://jsfiddle.net/Lhq0ance/8

charlieforward9 commented 3 months ago

Make sure you are importing leaflet-editable AFTER leaflet & react-leaflet. This import augments the leaflet module with the editable fields.

import { ... } from "leaflet";
import { ... } from "react-leaflet";
import "leaflet-editable"; //Imports the augmented Leaflet module

Ref: https://stackoverflow.com/questions/40136890/this-props-enableedit-is-not-a-function-error-while-executing-function/78531060#78531060