fix(post-location): fix map rendering and marker on new posts#62
Merged
Conversation
Without a Spotmap block, should_enqueue() returned false and Leaflet CSS was never loaded in the block editor. This caused tiles to overflow the map container and cover the Clear location button, making it appear unresponsive on new posts. - Always enqueue spotmap-map.css in enqueue_block_editor_assets(), bypassing the should_enqueue() guard - Add overflow:hidden + position:relative to the map container div - Replace default Leaflet PNG marker with L.BeautifyIcon using the POST marker config from spotmapjsobj (thumbtack icon by default)
Codecov Reportβ All modified and coverable lines are covered by tests. π’ Thoughts on this report? Let us know! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
enqueue_block_editor_assets()calledenqueue_styles()which bails early viashould_enqueue()when the post has no Spotmap block yet. Replaced the call with a directwp_enqueue_style()so the CSS is always loaded in the editor.overflow: hiddenandposition: relativeto the map container div (belt-and-suspenders, since Leaflet CSS also sets this on.leaflet-container). Without CSS loaded, tiles bled outside the div and sat on top of the Clear location button, causing apparent click misses and tiny coordinate shifts from accidental map clicks.L.BeautifyIconusing thePOSTtype config fromspotmapjsobj.marker(thumbtack icon by default, respects admin customisation).Test plan