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 );