From eb1ba7cdd0fdfdea870850fbe2398c848fabb94b Mon Sep 17 00:00:00 2001 From: Justin Foell <630830+jrfoell@users.noreply.github.com> Date: Fri, 26 Feb 2021 15:55:47 -0600 Subject: [PATCH 1/2] Add `block.json` --- src/blocks/activity/block.json | 31 +++++++++++++++++++++++++++++++ src/blocks/activity/index.js | 33 ++++++++------------------------- src/blocks/route/block.json | 31 +++++++++++++++++++++++++++++++ src/blocks/route/index.js | 33 ++++++++------------------------- 4 files changed, 78 insertions(+), 50 deletions(-) create mode 100644 src/blocks/activity/block.json create mode 100644 src/blocks/route/block.json diff --git a/src/blocks/activity/block.json b/src/blocks/activity/block.json new file mode 100644 index 0000000..dbfc2ad --- /dev/null +++ b/src/blocks/activity/block.json @@ -0,0 +1,31 @@ +{ + "apiVersion": 2, + "name": "wp-strava/activity", + "title": "Strava Activity", + "category": "embed", + "icon": "chart-line", + "description": "Embed a Strava Activity", + "keywords": [ "activity", "ride", "map" ], + "textdomain": "wp-strava", + "attributes": { + "url": { + "type": "string", + "default": "" + }, + "imageOnly": { + "type": "boolean", + "default": false + }, + "displayMarkers": { + "type": "boolean", + "default": false + }, + "som": { + "type": "string", + "default": null + } + }, + "editorScript": "wp-strava-block", + "editorStyle": "wp-strava-block-editor", + "style": "wp-strava-block" +} diff --git a/src/blocks/activity/index.js b/src/blocks/activity/index.js index 6209cf0..d9e698a 100644 --- a/src/blocks/activity/index.js +++ b/src/blocks/activity/index.js @@ -1,29 +1,12 @@ /* global wp, wpStrava */ import { registerBlockType } from '@wordpress/blocks'; import edit from './edit'; +import metadata from './block.json'; -registerBlockType( 'wp-strava/activity', { - title: 'Strava Activity', - icon: 'chart-line', - category: 'embed', - attributes: { - url: { - type: 'string', - default: '', - }, - imageOnly: { - type: 'boolean', - default: false, - }, - displayMarkers: { - type: 'boolean', - default: false, - }, - som: { - type: 'string', - default: null, - }, - }, - edit, - save: () => null, -} ); +metadata.edit = edit; +metadata.save = () => null; + +// Leaving this in place causes problems with the toolbar. +delete metadata.apiVersion; + +registerBlockType( metadata.name, metadata ); diff --git a/src/blocks/route/block.json b/src/blocks/route/block.json new file mode 100644 index 0000000..8fe11c1 --- /dev/null +++ b/src/blocks/route/block.json @@ -0,0 +1,31 @@ +{ + "apiVersion": 2, + "name": "wp-strava/route", + "title": "Strava Route", + "category": "embed", + "icon": "location-alt", + "description": "Embed a Strava Route", + "keywords": [ "route", "map" ], + "textdomain": "wp-strava", + "attributes": { + "url": { + "type": "string", + "default": "" + }, + "imageOnly": { + "type": "boolean", + "default": false + }, + "displayMarkers": { + "type": "boolean", + "default": false + }, + "som": { + "type": "string", + "default": null + } + }, + "editorScript": "wp-strava-block", + "editorStyle": "wp-strava-block-editor", + "style": "wp-strava-block" +} diff --git a/src/blocks/route/index.js b/src/blocks/route/index.js index 3a6a155..d9e698a 100644 --- a/src/blocks/route/index.js +++ b/src/blocks/route/index.js @@ -1,29 +1,12 @@ /* global wp, wpStrava */ import { registerBlockType } from '@wordpress/blocks'; import edit from './edit'; +import metadata from './block.json'; -registerBlockType( 'wp-strava/route', { - title: 'Strava Route', - icon: 'location-alt', - category: 'embed', - attributes: { - url: { - type: 'string', - default: '', - }, - imageOnly: { - type: 'boolean', - default: false, - }, - displayMarkers: { - type: 'boolean', - default: false, - }, - som: { - type: 'string', - default: null, - }, - }, - edit, - save: () => null, -} ); +metadata.edit = edit; +metadata.save = () => null; + +// Leaving this in place causes problems with the toolbar. +delete metadata.apiVersion; + +registerBlockType( metadata.name, metadata ); From 86f65bda31e2e79355907ce32af042bb5e5cc2ae Mon Sep 17 00:00:00 2001 From: Justin Foell <630830+jrfoell@users.noreply.github.com> Date: Fri, 26 Feb 2021 15:59:51 -0600 Subject: [PATCH 2/2] Update readme and version --- readme.txt | 3 ++- wp-strava.php | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/readme.txt b/readme.txt index 6d896b3..60ab67e 100755 --- a/readme.txt +++ b/readme.txt @@ -4,7 +4,7 @@ Contributors: cmanon, jrfoell, lancewillett, dlintott, sebastianerb Tags: strava, activity, bicycle, cycling, biking, running, run, swimming, swim, paddle, kayak, gps, shortcode, widget, plugin Requires at least: 4.6 Tested up to: 5.6 -Stable tag: 2.6.0 +Stable tag: 2.7.0 Requires PHP: 5.3 License: GPLv2 or later @@ -120,6 +120,7 @@ On the WP-Strava settings page you cannot currently remove and add another athle = 2.7.0 = Add setting to choose API cache interval (1 hour / 15 minutes) https://wordpress.org/support/topic/decrease-update-time-for-group-recent-activities/ +Move block type metadata to `block.json` for future discoverability. = 2.6.0 = diff --git a/wp-strava.php b/wp-strava.php index 1aae0fe..75f51bc 100755 --- a/wp-strava.php +++ b/wp-strava.php @@ -3,7 +3,7 @@ * Plugin Name: WP Strava * Plugin URI: https://wordpress.org/plugins/wp-strava/ * Description: Show your strava.com activity on your WordPress site. Some Icons are Copyright © Yusuke Kamiyamane. All rights reserved. Licensed under a Creative Commons Attribution 3.0 license. - * Version: 2.6.0 + * Version: 2.7.0 * Author: Carlos Santa Cruz, Justin Foell, Lance Willett, Daniel Lintott, Sebastian Erb * License: GPL2 * Text Domain: wp-strava @@ -27,7 +27,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -define( 'WPSTRAVA_PLUGIN_VERSION', '2.6.0' ); +define( 'WPSTRAVA_PLUGIN_VERSION', '2.7.0' ); define( 'WPSTRAVA_PLUGIN_FILE', __FILE__ ); define( 'WPSTRAVA_PLUGIN_DIR', trailingslashit( dirname( __FILE__ ) ) ); define( 'WPSTRAVA_PLUGIN_URL', plugins_url( '/', __FILE__ ) );