A map block for WordPress' Gutenberg Editor which uses OpenStreetMap and Leaflet.js. It needs no API keys and works out of the box. Benefiting from Gutenberg’s potential, the plugin tries a different take on how to add your locations on the map and rethinks a few things, UX-wise. Install it from https://wordpress.org/plugins/ootb-openstreetmap/
Version 2.4.0 adds an option to prevent the default map scroll/touch behaviours to make it easier for users to navigate in a page (pretty much like in Google Maps).
The option is deactivated by default, to keep the default Leaflet.js functionality, and avoid loading an additional script. You might want to activate it, though, as it prevents users from getting trapped on the map when scrolling a long page.
The new feature utilizes leaflet-gesture-handling. It will auto detect a user's language from the browser setting and show the appropriate translation.
However if you wish to override this, you can set your own text, using the ootb_gesture_handling_options filter as shown below (you must specify text for touch, scroll and scrollMac):
add_filter(
'ootb_gesture_handling_options',
function () {
return [
'text' => [
'touch' => 'Hey bro, use two fingers to move the map',
'scroll' => 'Hey bro, use ctrl + scroll to zoom the map',
'scrollMac' => 'Hey bro, use \u2318 + scroll to zoom the map',
],
'locale' => 'en', // set language of the warning message.
'duration' => 5000, // set time in ms before the message should disappear.
];
}
);
Version 2.4.0 adds an option to prevent the default map scroll/touch behaviours to make it easier for users to navigate in a page (pretty much like in Google Maps).
The option is deactivated by default, to keep the default Leaflet.js functionality, and avoid loading an additional script. You might want to activate it, though, as it prevents users from getting trapped on the map when scrolling a long page.
The new feature utilizes leaflet-gesture-handling. It will auto detect a user's language from the browser setting and show the appropriate translation.
However if you wish to override this, you can set your own text, using the
ootb_gesture_handling_options
filter as shown below (you must specify text for touch, scroll and scrollMac):