wiki-plugin-rcnmap 0.4.0 → 0.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/client/rcnmap.js +10 -1
  2. package/package.json +1 -1
package/client/rcnmap.js CHANGED
@@ -416,7 +416,16 @@
416
416
  $(`<link rel="stylesheet" href="${LEAFLET_CSS}">`).appendTo('head')
417
417
  }
418
418
  if (window.L && window.L.map) return done()
419
- wiki.getScript(LEAFLET_JS, done)
419
+ // A plain script tag, not wiki.getScript: newer wiki-clients load through
420
+ // import(), and Leaflet's UMD wrapper then never sets window.L.
421
+ let s = document.querySelector(`script[src='${LEAFLET_JS}']`)
422
+ if (!s) {
423
+ s = document.createElement('script')
424
+ s.src = LEAFLET_JS
425
+ document.head.appendChild(s)
426
+ }
427
+ s.addEventListener('load', () => done())
428
+ s.addEventListener('error', () => console.log('rcnmap: could not load Leaflet from', LEAFLET_JS))
420
429
  }
421
430
 
422
431
  function legendHTML (m) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wiki-plugin-rcnmap",
3
- "version": "0.4.0",
3
+ "version": "0.4.1",
4
4
  "description": "Federated Wiki plugin: a small RCN map on a page that draws points and the ties between them; each point opens its page",
5
5
  "keywords": ["wiki", "federated wiki", "plugin", "rcn", "map"],
6
6
  "author": "RCN Network <rcn@relocalizecreativity.net>",