=== Insight Maps block for OpenStreetMap ===
Contributors: basbuis
Tags: map, location, openstreetmap, gutenberg
Requires at least: 6.0
Tested up to: 7.1
Requires PHP: 7.4
Stable tag: 2.5.14
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

OpenStreetMap maps in Gutenberg—no API key. Type an address, set height and zoom. Powered by Leaflet.

== Description ==

**Insight Maps** is a Gutenberg block for OpenStreetMap maps — no Google Maps API key, no billing account. It uses Leaflet and community OSM tiles. Type a manual address; the plugin geocodes it (Nominatim, cached) and renders the map.

1. Insert the **Insight Maps** block in the editor.
2. Type a **manual address** in the block sidebar.
3. Adjust height, width, and zoom.

No Google Maps API key is required.

* Unlimited map blocks
* Single location with a manual address
* Map height, width, and zoom
* Site-wide marker color presets
* Leaflet + OpenStreetMap community tiles (no API key)

= Pro add-on =
Need more? See [Insight Maps Pro](https://wpinsight.eu/dynamic-osm-maps-wordpres-gutenberg-plugin/).
* Show one or multiple markers on the map.
* Works with a simple ‘set in the block‘ value, with custom fields and repeaters.
* With simple custom fields (address in a text field) you can show up to 3 markers on a map.
* When using a repeater, the nr of markers on a map is endless.
* Popups (tooltip style) with location name, location extras info, location logo, and URL (https:// or tel:+)
* Works with custom fields from ACF, SCF, ACPT, Meta Box, and Modern Fields.
* Type of data accepted: custom field coordinates, custom field address text, multiple locations (field sets and repeaters).
* When using a custom field as the source, every map with an empty field is automatically hidden on the front-end.

= Privacy =

When geocoding an address, the plugin sends the address text to the OpenStreetMap Nominatim service. See the [Nominatim usage policy](https://operations.osm.org/policies/nominatim/).

Map tiles load in the visitor’s browser from community tile servers (default: tile.openstreetmap.de). The plugin does not use tile.openstreetmap.org by default; see the [OSM tile usage policy](https://operations.osmfoundation.org/policies/tiles/).

== Installation ==

1. Install the plugin from WordPress.org, or upload the `insight-maps` folder to `/wp-content/plugins/`.
2. Activate the plugin.
3. Add the **Insight Maps** block to a page or post.
4. Enter a manual address and publish.

== Frequently Asked Questions ==

= Do I need a Google Maps API key? =

No. Maps use Leaflet and OpenStreetMap tiles. Address geocoding uses Nominatim.

= Is there a limit on the number of maps? =

No. You can place as many Insight Maps blocks as you need.

= Can I use custom fields or multiple markers? =

Those options are available in the optional [Insight Maps Pro](https://wpinsight.eu/dynamic-osm-maps-wordpres-gutenberg-plugin/) add-on.

= Can I change how markers look? =

Yes. Open Settings → Insight Maps and choose a marker color preset. The free plugin does not accept arbitrary per-block CSS.

= Is this a Gutenberg / block editor map plugin? =

Yes. Insight Maps adds an **Insight Maps** block. Insert it on any post or page, enter a manual address, and publish. No shortcode is required for the free workflow.

= Does it use Leaflet and OpenStreetMap? =

Yes. Maps render with Leaflet and OpenStreetMap community tiles. Address lookup uses OpenStreetMap Nominatim. You do not need a Google Maps API key.

== Screenshots ==

1. Map block in the editor with a manual address.
2. Frontend map with a Leaflet and a custom marker.
3. Settings page (Admin - Settings - Insight Maps).
4. Guide (settings) page (Admin - Settings - Insight Maps).
5. Settings page [Pro] (Admin - Settings - Insight Maps).
6. Map 3 locations with popup frontend [pro].
7. Map 3 locations with popup backend [pro].


== Changelog ==

= 2.5.14 =
* Support URL constant points to https://wpinsight.eu/support/ (no Pro license UI in the free plugin).

= 2.5.13 =
* Geocoder: use WordPress HTTP API only (remove direct cURL fallback) for Plugin Check compliance.

= 2.5.12 =
* Guide: Manual address fine-tuning copy matches current editor UX (Shift+drag pan, click/drag pin; no arrow-button pan instructions).

= 2.5.11 =
* Editor: restore live marker follow while dragging the pin (custom pointer drag + setLatLng each move). Shift+pan unchanged.

= 2.5.10 =
* Editor: Shift+drag pans the Leaflet map (pointer capture / stopPropagation so Gutenberg does not move the block). Drag without Shift moves the block as usual.
* Click (no Shift) still places the marker; drag the pin to move it. Leaflet map dragging stays off unless Shift-pan is active.

= 2.5.9 =
* Editor: stop sticky pan after long-press/drag — capture-phase mouseup/pointerup on iframe + admin documents, finish drag when `buttons === 0`, block HTML5 tile drag that ate mouseup and “shrank” the map.
* Pan only while the mouse button is held; release always ends pan. Click-to-place and marker offset behavior from 2.5.8 kept.

= 2.5.8 =
* Editor: fix sticky map pan after click (Leaflet Draggable mouseup was bound to the admin document while the map lives in the canvas iframe).
* Editor: marker follows cursor without offset (SVG L.icon + iframe-aware mouse position); click places marker; pan/marker-drag release no longer places a marker.

= 2.5.7 =
* Editor map UX: mouse pan/drag on the map; marker click/drag saves placement without zooming out or re-fitting.
* Fix marker drag offset (Leaflet divIcon chrome vs 18×18 anchor). Marker drop keeps current zoom/center.

= 2.5.6 =
* Editor: restore click-to-place and marker drag for manual maps. Free no longer registers `sourceType`, so checks now treat a missing source as manual (Pro still owns other sources).

= 2.5.5 =
* Geocode robustness: no negative caching; reuse prior successes under v3/v2/legacy keys; cURL fallback when `wp_remote_get` fails; surface HTTP/transport detail in the error message.
* REST `/location` accepts full block attributes without schema stripping; JSON body fallback for attributes.

= 2.5.4 =
* Fix geocoding: stop treating long-lived negative geocode transients as final failures; use `insight_maps_geocode_v2_*` keys, reuse prior successful lookups, and do not cache transport errors.
* Nominatim requests send an `InsightMaps/{version}` User-Agent and Referer.

= 2.5.3 =
* WordPress.org unique prefix: rename PHP classes, constants, hooks, options, and form fields from `osm_*` / `OSM_*` to `insight_maps_*` / `Insight_Maps_*` / `INSIGHT_MAPS_*`.
* Migrate saved settings from `osm_location_map_settings` to `insight_maps_settings` on first load.
* Keep registered block name `osm-location-map/map` and public CSS classes (`.osm-location-map`, `.osm-settings`) so existing maps keep rendering without re-saving posts.
* REST namespace is now `insight-maps/v1`; legacy `osm-location-map/v1` remains registered as an alias.

= 2.5.2 =
* Plugin Check: add text domain to plugins-list i18n strings.

= 2.5.1 =
* Remove unused editor license JavaScript bootstrap.
* Unsupported / legacy non-manual map configs render nothing instead of a Pro-required message; manual address is used when present.

= 2.5.0 =
* WordPress.org compliance: free plugin is manual-address only; custom fields / Multiple locations / field registry live in Insight Maps Pro.
* Removed arbitrary per-block custom CSS (no free-form CSS paste or raw style tags).
* Prefixed geocode transient keys with `insight_maps_`.
* Keep marker presets and height / width / zoom for free maps.

= 2.4.0 =
* Renamed the plugin to Insight Maps. The WordPress.org slug and text domain are `insight-maps`.
* Existing maps keep working. The block name stays `osm-location-map/map`.
* Saved settings stay in place. Insight Maps Pro still unlocks the same maps.
* Deactivate and delete the older Dynamic OSM maps plugin if it is still installed. Do not run both.

= 2.3.3 =
* Bundle Leaflet locally (no CDN) for WordPress.org Plugin Check compliance.
* Sanitize admin/input usage; use slug-prefixed Pro helpers and block category callback.
* Exclude hidden files from the distribution package.

= 2.3.2 =
* Guide: clearer explanation of map background tiles and the optional tile URL setting.

= 2.3.1 =
* Settings: popup logo height only when Pro is active; clearer map-background (tile) help text.

= 2.3.0 =
* Free tier: Single location + Manual address only; unlimited map blocks (no 5-map limit).
* Custom fields, Multiple locations, and related options require the Pro add-on (licensed).
* Editor UI limited to free options unless Pro is active; WordPress.org-oriented readme.

= 2.2.0 =
* Earlier WordPress.org-oriented packaging pass.

= 2.1.1 =
* Settings tabs filterable for a shared Licence screen with the Pro add-on.

= 2.1.0 =
* Text domain aligned with plugin slug (`dynamic-osm-maps`).

= 2.0.19 =
* Earlier monolithic release.
