feat(admin): WYSIWYG shortcode generator tab#70
Merged
Conversation
Some themes apply `svg { max-width: 100%; height: auto; }` globally.
Leaflet's renderer pane <div> is position:absolute with no explicit
width, so 100% resolves to 0 β wiping out the width/height attributes
Leaflet sets on the renderer SVG. Circle markers (L.circleMarker) are
clipped to nothing, while polylines remain visible because they overflow
their SVG differently.
Fix: add `max-width: none !important` to `.leaflet-pane > svg` in
custom.css so the SVG can expand to its Leaflet-set intrinsic width.
Also move the circle-dot renderer from markerPane to a dedicated
spotmapCirclePane (z-index 450) so circle markers render above
polylines and avoid any pane-specific theme overrides.
Adds a new "Shortcode Generator" tab to the Spotmap admin page that lets users configure a map visually and copy the resulting [spotmap] shortcode β no manual parameter lookup required. Key changes: - New ShortcodeTab with live map preview (500 ms debounced), full toolbar (feeds, maps, time filter, GPX, settings), and one-click copy of the generated shortcode string - Extracted shared components: NavigationButtonsControl, GpxManagerModal, FeedsToolbarGroup, COLORS constant, SATELLITE_ICON, getDefaultMaps β all reused between the block editor, Edit Points tab, and Shortcode tab - GpxManagerModal now uses wp.media instead of MediaUpload, so it works in both block editor and admin contexts - Fix TimeToolbarGroup: isPressed reflects modal-open state, not filter-active state - Fix admin enqueue: load build/spotmap-map.css so fullscreen icon and easybutton styles appear in admin map previews
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
[spotmap]map visually and copy the resulting shortcode string without needing to know any parametersGpxManagerModal), and a Settings dropdown (height, zoom-to, toggles for all map options)Shared components extracted
Several pieces that were duplicated or block-editor-only are now properly shared:
src/spotmap/constants.jssrc/spotmap/icons.jsxsrc/spotmap/components/NavigationButtonsControl.jsxsrc/spotmap/components/GpxManagerModal.jsxsrc/spotmap-admin/components/FeedsToolbarGroup.jsxsrc/spotmap-admin/mapDefaults.jsGpxManagerModalnow useswp.mediainstead ofMediaUploadfrom@wordpress/block-editor, making it work in admin pages without a block editor store context.Other fixes
isPressednow reflects whether the modal is open, not whether a filter is active β consistent with all other toolbar buttonsbuild/spotmap-map.css(bundled leaflet-fullscreen + easybutton styles) is now enqueued in admin, fixing missing fullscreen icon and undersized navigate-to buttons in the Edit Points and Shortcode Generator mapsTest plan
npm run build)npm run test:js)π€ Generated with Claude Code