Leaflet Widget has some issues when other DOM elements fire AJAX events (like when uploading images). It could throw bunch of error notices and could make other loaded JS files to not work properly.
Upon further investigation, the culprit is that the 'leaflet-draw' String map key becomes ['leaflet-draw', 'leaflet-draw'] Array key when some AJAX events on the current page are happening.
I've created a workaround/patch for this and the patch solves the following JS error notices, and may be more:
Uncaught TypeError: Cannot call method 'addLayer' of null
Uncaught TypeError: Cannot read property 'tools' of null
Uncaught TypeError: Cannot read property 'polyline' of undefined
Comment | File | Size | Author |
---|---|---|---|
#2 | leaflet_widget-type_error-2187847-2.patch | 1.04 KB | ranelpadon |
Leaflet Widget Type Error.png | 145.83 KB | ranelpadon | |
#1 | leaflet_widget-type_error-2187847-0.patch | 1.33 KB | ranelpadon |
Comments
Comment #1
ranelpadon CreditAttribution: ranelpadon commentedComment #2
ranelpadon CreditAttribution: ranelpadon commentedAttached is an additional patch when encountering errors from the Leaflet core. See related issue also here:
https://drupal.org/node/2111081
Comment #3
SocialNicheGuru CreditAttribution: SocialNicheGuru commentedbecause there is a patch I changed the status to "Needs review"
Comment #4
das-peter CreditAttribution: das-peter commentedWell, this patches
modules/contribs/leaflet_draw/js/leaflet_draw_input.js
. We're not in control over that.So according to what I see the approach and / or the location where this is handled has to be changed.
Comment #5
vlooivlerke CreditAttribution: vlooivlerke commentedI have the same issue in the new 7.x-2.0-beta1
Cant use media browser with leaflet.wedget. The ajax gets broken when you add images.
Comment #6
scotwith1tI'm super-confused here too. The patch is against some leaflet_draw module, which is not even mentioned in the docs. The only one I can find is a sandbox project, and surely you're not depending on a sandbox project and then not even mentioning it in the instructions? Please help?! This module doesn't work for us and we've got a pretty simple setup. The widget renders, I can click the pin icon in the corner, click to place a pin but then every mouse move throws a "Uncaught TypeError: Cannot set property '_leaflet_pos' of undefined" in the console.