From 076a9e921e4127a3282d7dd6a53abea61d937cf8 Mon Sep 17 00:00:00 2001 From: leopiccionia Date: Wed, 2 Oct 2024 16:00:36 -0300 Subject: [PATCH 1/5] Fix typo in README --- src/README.txt | 2 +- trunk/readme.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/README.txt b/src/README.txt index 261e46c1..9a6c1df6 100755 --- a/src/README.txt +++ b/src/README.txt @@ -50,7 +50,7 @@ After activating the plugin, a new item will appear on the WordPress dashboard: == Changelog == = 2.11.2 = -*bugfix: Fix regression in interactions loading +* bugfix: Fix regression on interactions loading = 2.11.1 = * Improve rendering of maps and storymaps diff --git a/trunk/readme.txt b/trunk/readme.txt index 261e46c1..9a6c1df6 100755 --- a/trunk/readme.txt +++ b/trunk/readme.txt @@ -50,7 +50,7 @@ After activating the plugin, a new item will appear on the WordPress dashboard: == Changelog == = 2.11.2 = -*bugfix: Fix regression in interactions loading +* bugfix: Fix regression on interactions loading = 2.11.1 = * Improve rendering of maps and storymaps From 54a4ce7eb589a0109c70ecbbb6975f5da6753e44 Mon Sep 17 00:00:00 2001 From: leopiccionia Date: Wed, 2 Oct 2024 18:10:29 -0300 Subject: [PATCH 2/5] Use MapboxGL from CDN This avoid distributing mapbox-gl-js, that's not GPL-friendly, with the source code --- src/includes/class-jeo.php | 32 +++++++++++++++++++++++--------- src/js/src/map-blocks/map.js | 2 -- src/js/src/mapboxgl-loader.js | 3 --- webpack.config.js | 3 +++ 4 files changed, 26 insertions(+), 14 deletions(-) diff --git a/src/includes/class-jeo.php b/src/includes/class-jeo.php index 40b94a1c..712a5e2f 100644 --- a/src/includes/class-jeo.php +++ b/src/includes/class-jeo.php @@ -150,21 +150,23 @@ public function register_assets() { wp_register_style( 'mapboxgl', - JEO_BASEURL . '/js/build/mapboxglLoader.css', + 'https://cdn.jsdelivr.net/npm/mapbox-gl@3.7.0/dist/mapbox-gl.css', array(), - JEO_VERSION + false, ); wp_register_script( - 'mapboxgl-loader', - JEO_BASEURL . '/js/build/mapboxglLoader.js' + 'mapboxgl', + 'https://cdn.jsdelivr.net/npm/mapbox-gl@3.7.0/dist/mapbox-gl.js', + array(), + false, ); + wp_register_script( - 'mapboxgl-spiderifier', - JEO_BASEURL . '/js/src/mapboxgl-spiderifier/index.js', - array( 'mapboxgl-loader' ), + 'mapboxgl-loader', + JEO_BASEURL . '/js/build/mapboxglLoader.js', + array( 'mapboxgl' ), JEO_VERSION, - false ); wp_localize_script( @@ -187,9 +189,21 @@ public function register_assets() { ) ); + wp_register_script( + 'mapboxgl-spiderifier', + JEO_BASEURL . '/js/src/mapboxgl-spiderifier/index.js', + array( 'mapboxgl-loader' ), + JEO_VERSION, + false + ); + $map_blocks_assets = include JEO_BASEPATH . '/js/build/mapBlocks.asset.php'; - wp_register_style( 'jeo-map-blocks', JEO_BASEURL . '/js/build/mapBlocks.css' ); + wp_register_style( + 'jeo-map-blocks', + JEO_BASEURL . '/js/build/mapBlocks.css', + array( 'mapboxgl' ) + ); wp_register_script( 'jeo-map-blocks', JEO_BASEURL . '/js/build/mapBlocks.js', diff --git a/src/js/src/map-blocks/map.js b/src/js/src/map-blocks/map.js index 6bd2758c..6d9b354b 100644 --- a/src/js/src/map-blocks/map.js +++ b/src/js/src/map-blocks/map.js @@ -2,8 +2,6 @@ import { forwardRef } from '@wordpress/element'; import mapboxgl from 'mapbox-gl' import MapGL, { FullscreenControl, NavigationControl } from 'react-map-gl'; -import 'mapbox-gl/dist/mapbox-gl.css'; - export const MapboxAPIKey = window.jeo_settings.mapbox_key; /** diff --git a/src/js/src/mapboxgl-loader.js b/src/js/src/mapboxgl-loader.js index f763997e..45147923 100644 --- a/src/js/src/mapboxgl-loader.js +++ b/src/js/src/mapboxgl-loader.js @@ -1,8 +1,5 @@ import mapboxgl from 'mapbox-gl'; -import 'mapbox-gl/dist/mapbox-gl.css'; - mapboxgl.accessToken = jeo_settings.mapbox_key; -window.mapboxgl = mapboxgl; export default mapboxgl; diff --git a/webpack.config.js b/webpack.config.js index 08ac489e..03943a70 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -27,6 +27,9 @@ module.exports = { }, postsSidebar: './src/js/src/posts-sidebar/index.js', }, + externals: { + 'mapbox-gl': 'mapboxgl', + }, output: { path: path.resolve( __dirname, './src/js/build/' ), publicPath: './src/js/build/', From 5cb19ca0f39e2acc116f12bbea041bbf64ed0c4e Mon Sep 17 00:00:00 2001 From: leopiccionia Date: Wed, 2 Oct 2024 18:15:34 -0300 Subject: [PATCH 3/5] Use MapboxGL official CDN --- src/includes/class-jeo.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/includes/class-jeo.php b/src/includes/class-jeo.php index 712a5e2f..3b516bfc 100644 --- a/src/includes/class-jeo.php +++ b/src/includes/class-jeo.php @@ -150,14 +150,14 @@ public function register_assets() { wp_register_style( 'mapboxgl', - 'https://cdn.jsdelivr.net/npm/mapbox-gl@3.7.0/dist/mapbox-gl.css', + 'https://api.mapbox.com/mapbox-gl-js/v3.7.0/mapbox-gl.css', array(), false, ); wp_register_script( 'mapboxgl', - 'https://cdn.jsdelivr.net/npm/mapbox-gl@3.7.0/dist/mapbox-gl.js', + 'https://api.mapbox.com/mapbox-gl-js/v3.7.0/mapbox-gl.js', array(), false, ); From 5f67fece0878f316fab6a98b20da087c9f924999 Mon Sep 17 00:00:00 2001 From: leopiccionia Date: Thu, 3 Oct 2024 11:57:08 -0300 Subject: [PATCH 4/5] Adjust max zoom for cluster source MapboxGL no longer supports clusters with zoom >= 31 --- src/js/src/discovery/blocks/stories.js | 2 +- src/js/src/jeo-map/class-jeo-map.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/js/src/discovery/blocks/stories.js b/src/js/src/discovery/blocks/stories.js index e49313b8..bbf50887 100644 --- a/src/js/src/discovery/blocks/stories.js +++ b/src/js/src/discovery/blocks/stories.js @@ -91,7 +91,7 @@ class Stories extends Component { type: 'geojson', data: sourceData, cluster: true, - clusterMaxZoom: 40, + clusterMaxZoom: 30, clusterRadius: 40, } ); diff --git a/src/js/src/jeo-map/class-jeo-map.js b/src/js/src/jeo-map/class-jeo-map.js index dfe7c37d..50e6b0d0 100644 --- a/src/js/src/jeo-map/class-jeo-map.js +++ b/src/js/src/jeo-map/class-jeo-map.js @@ -693,7 +693,7 @@ export default class JeoMap { type: 'geojson', data: sourceData, cluster: true, - clusterMaxZoom: 40, + clusterMaxZoom: 30, clusterRadius: 40, } ); map.loadImage( From 79b5bec1c2e2d596301ca0ac28a040fada8b899c Mon Sep 17 00:00:00 2001 From: leopiccionia Date: Thu, 3 Oct 2024 12:04:36 -0300 Subject: [PATCH 5/5] Release 2.12.0 --- src/README.txt | 8 ++++++-- src/jeo.php | 4 ++-- trunk/readme.txt | 8 ++++++-- 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/src/README.txt b/src/README.txt index 9a6c1df6..b11871c9 100755 --- a/src/README.txt +++ b/src/README.txt @@ -1,12 +1,12 @@ === JEO === Contributors: earthjournalism Tested up to: 6.6.2 -Stable tag: 2.11.2 +Stable tag: 2.12.0 Requires PHP: 7.2 Requires at least: 6.2 License: GPL-2.0+ License URI: http://www.gnu.org/licenses/gpl-2.0.txt -Version: 2.11.2 +Version: 2.12.0 The JEO plugin acts as a geojournalism platform that allows news organizations, bloggers and NGOs to publish news stories as layers of information on digital maps. @@ -49,6 +49,10 @@ After activating the plugin, a new item will appear on the WordPress dashboard: == Changelog == += 2.12.0 = +* Consume MapboxGL from CDN +* bugfix: Fix max zoom for cluster layer + = 2.11.2 = * bugfix: Fix regression on interactions loading diff --git a/src/jeo.php b/src/jeo.php index 49f0dbed..6e9da6e9 100755 --- a/src/jeo.php +++ b/src/jeo.php @@ -5,7 +5,7 @@ * @wordpress-plugin * Plugin Name: JEO WP * Description: Interactive Map blocks for Wordpress Gutenberg - * Version: 2.11.2 + * Version: 2.12.0 * License: GPL-2.0+ * License URI: http://www.gnu.org/licenses/gpl-2.0.txt * Text Domain: jeo @@ -22,7 +22,7 @@ * Start at version 1.0.0 and use SemVer - https://semver.org * Rename this for your plugin and update it as you release new versions. */ -define( 'JEO_VERSION', '2.11.2' ); +define( 'JEO_VERSION', '2.12.0' ); define( 'JEO_BASEPATH', plugin_dir_path( __FILE__ ) ); define( 'JEO_BASEURL', plugins_url('', __FILE__) ); diff --git a/trunk/readme.txt b/trunk/readme.txt index 9a6c1df6..b11871c9 100755 --- a/trunk/readme.txt +++ b/trunk/readme.txt @@ -1,12 +1,12 @@ === JEO === Contributors: earthjournalism Tested up to: 6.6.2 -Stable tag: 2.11.2 +Stable tag: 2.12.0 Requires PHP: 7.2 Requires at least: 6.2 License: GPL-2.0+ License URI: http://www.gnu.org/licenses/gpl-2.0.txt -Version: 2.11.2 +Version: 2.12.0 The JEO plugin acts as a geojournalism platform that allows news organizations, bloggers and NGOs to publish news stories as layers of information on digital maps. @@ -49,6 +49,10 @@ After activating the plugin, a new item will appear on the WordPress dashboard: == Changelog == += 2.12.0 = +* Consume MapboxGL from CDN +* bugfix: Fix max zoom for cluster layer + = 2.11.2 = * bugfix: Fix regression on interactions loading