![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
strapi-plugin-map-field
Advanced tools
map-field
The map-field
Strapi plugin allows to add a Mapbox map custom field in your content-types.
You can use the seach box to pinpoint the location you are looking for. Alternatively, you can double-click anywhere on the map, which will put a marker on the closest geolocated point.
The address, longitude and latitude of the geolocated point are displayed in the readonly fields underneath the map.
The field will actually be stored as GeoJSON in a JSON field behing the scene.
{
"id": "address.7351440929350024",
"text": "Avenue Des Hauts-Fourneaux",
"type": "Feature",
"center": [
5.949249,
49.50255
],
"address": "9",
"context": [
{
"id": "postcode.13299336",
"text": "4364"
},
{
"id": "place.1271944",
"text": "Esch-sur-Alzette",
"wikidata": "Q16010"
},
{
"id": "region.9352",
"text": "Esch-sur-Alzette",
"wikidata": "Q188283",
"short_code": "LU-ES"
},
{
"id": "country.8840",
"text": "Luxembourg",
"wikidata": "Q32",
"short_code": "lu"
}
],
"geometry": {
"type": "Point",
"coordinates": [
5.949249,
49.50255
]
},
"relevance": 0.735,
"place_name": "9, Avenue Des Hauts-Fourneaux, 4364 Esch-sur-Alzette, Luxembourg",
"place_type": [
"address"
],
"properties": {
"accuracy": "rooftop"
}
}
This plugin was inspired by
It uses the following npm packages
To install this plugin, you need to add an NPM dependency to your Strapi application:
# Using Yarn
yarn add strapi-plugin-map-field
# Or using NPM
npm install strapi-plugin-map-field
You need to enable the plugin in your Strapi plugins configuration.
Open config/plugins.js
and add the following:
// config/plugins.js
module.exports = ({ env }) => ({
...
"map-field": {
enabled: true,
},
...
});
In order for the map to be displayed properly, you will need to update the strapi::security
middleware configuration.
For that, open config/middlewares.js
and add the directive 'worker-src': ['blob:']
to the contentSecurityPolicy
directives under strapi::security
. You also need to add api.mapbox.com
in the script-src
.
The whole file should look somewhat like this:
module.exports = ({
env
}) => [
'strapi::errors',
{
name: 'strapi::security',
config: {
contentSecurityPolicy: {
useDefaults: true,
directives: {
'connect-src': ["'self'", 'https:'],
'script-src': ["'self'", "'unsafe-inline'", 'cdn.jsdelivr.net', 'api.mapbox.com'],
'img-src': ["'self'", 'data:', 'blob:' ],
'media-src': ["'self'", 'data:', 'blob:'],
'worker-src': ['blob:'],
upgradeInsecureRequests: null,
},
}
},
},
'strapi::cors',
'strapi::poweredBy',
'strapi::logger',
'strapi::query',
'strapi::body',
'strapi::session',
'strapi::favicon',
'strapi::public',
];
Add a valid Mapbox Access Token as an environment variable in your .env
file
# .env
STRAPI_ADMIN_MAPBOX_ACCESS_TOKEN=pk.xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.xxxxxxxxxxxxxxxxx
In the content type builder
Add another field
Custom
tabMap
fieldFinish
FAQs
Strapi plugin for a map custom field
The npm package strapi-plugin-map-field receives a total of 34 weekly downloads. As such, strapi-plugin-map-field popularity was classified as not popular.
We found that strapi-plugin-map-field demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.