Add block.json

This commit is contained in:
Justin Foell
2021-02-26 15:55:47 -06:00
parent b7833cbe4c
commit eb1ba7cdd0
4 changed files with 78 additions and 50 deletions
+31
View File
@@ -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"
}
+8 -25
View File
@@ -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 );
+31
View File
@@ -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"
}
+8 -25
View File
@@ -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 );