Closed Ostrzyciel closed 4 years ago
I just tried walking around this issue by loading the said CSS file manually through JS, it works perfectly.
So the question is – can this CSS file be loaded with ResourceLoader somehow instead of the current solution (that I admittedly don't uderstand :P)?
This file is no longer loaded via resource loader due to https://github.com/JeroenDeDauw/Maps/issues/607
If this https://phabricator.wikimedia.org/T249129#6053125 works then we can switch back to using resource loader.
@Ostrzyciel a PR is definitely welcome
Setup
Issue
Displaying maps using Leaflet works fine in most cases, the problem arises when one uses API's action=parse method. It can (and will) return the required ResourceLoader modules that can be then loaded by client JS when displaying the parsed wikitext to the user. After doing that (and triggering the appropriate
wikipage.content
JS hook) the Leaflet map loads, but most CSS is missing, leaflet.css is not loaded for sure.This exact method of parsing and displaying parsed wikitext is used by core's live preview feature and probably quite a few gadgets.
After doing a quick code search I think what's causing this is the fact that Leaflet's CSS is loaded somehow in LeafletService.php, not using ResourceLoader, which means action=parse has no way of knowing about this CSS: https://github.com/JeroenDeDauw/Maps/blob/d35b5e9cb90035d97dc07a839068c3b88c97fe29/src/LeafletService.php#L205
Steps to reproduce the observation: