mirror of
https://github.com/10h30/wp-strava.git
synced 2026-07-19 22:54:14 +09:00
Merge pull request #116 from cmanon/feature/115-block-transforms
Added some transformations
This commit is contained in:
+5
-1
@@ -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, block, blocks
|
Tags: strava, activity, bicycle, cycling, biking, running, run, swimming, swim, paddle, kayak, gps, shortcode, widget, plugin, block, blocks
|
||||||
Requires at least: 4.6
|
Requires at least: 4.6
|
||||||
Tested up to: 5.8
|
Tested up to: 5.8
|
||||||
Stable tag: 2.10.1
|
Stable tag: 2.11.0
|
||||||
Requires PHP: 5.3
|
Requires PHP: 5.3
|
||||||
License: GPLv2 or later
|
License: GPLv2 or later
|
||||||
|
|
||||||
@@ -134,6 +134,10 @@ On the WP-Strava settings page you cannot currently remove and add another athle
|
|||||||
|
|
||||||
== Changelog ==
|
== Changelog ==
|
||||||
|
|
||||||
|
= 2.11.0 =
|
||||||
|
Added additional block transformations for "Activity" (from: Paragraph, Classic Shortcode; to: Paragraph)
|
||||||
|
|
||||||
|
|
||||||
= 2.10.1 =
|
= 2.10.1 =
|
||||||
Reworked settings save with multiple athletes, related to https://wordpress.org/support/topic/wp-strava-error-401-unauthorized/
|
Reworked settings save with multiple athletes, related to https://wordpress.org/support/topic/wp-strava-error-401-unauthorized/
|
||||||
|
|
||||||
|
|||||||
@@ -9,19 +9,51 @@ metadata.save = () => null;
|
|||||||
metadata.transforms = {
|
metadata.transforms = {
|
||||||
from: [
|
from: [
|
||||||
{
|
{
|
||||||
type: "raw",
|
type: 'raw',
|
||||||
priority: 10,
|
isMatch: ( node ) => {
|
||||||
isMatch: ( node ) =>
|
return (
|
||||||
node.nodeName === "P" &&
|
node.nodeName === 'P' &&
|
||||||
node.innerText.startsWith( "https://www.strava.com/activities/" ),
|
node.innerText.startsWith( 'https://www.strava.com/activities/' )
|
||||||
|
);
|
||||||
|
},
|
||||||
transform: function( node ) {
|
transform: function( node ) {
|
||||||
return createBlock( metadata.name, {
|
return createBlock( metadata.name, {
|
||||||
url: node.innerText,
|
url: node.innerText,
|
||||||
} );
|
} );
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: 'block',
|
||||||
|
blocks: [ 'core/paragraph' ],
|
||||||
|
isMatch: ( node ) => {
|
||||||
|
return node.content.startsWith( 'https://www.strava.com/activities/' );
|
||||||
|
},
|
||||||
|
transform: function( node ) {
|
||||||
|
return createBlock( metadata.name, { url: node.content } );
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: 'shortcode',
|
||||||
|
tag: [ 'activity', 'ride' ],
|
||||||
|
attributes: {
|
||||||
|
url: {
|
||||||
|
type: 'string',
|
||||||
|
shortcode: ( { named: atts } ) => {
|
||||||
|
return 'https://www.strava.com/activities/' + atts.id;
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
}
|
}
|
||||||
]
|
],
|
||||||
|
to: [
|
||||||
|
{
|
||||||
|
type: 'block',
|
||||||
|
blocks: [ 'core/paragraph' ],
|
||||||
|
transform: ( attributes ) => {
|
||||||
|
return createBlock( 'core/paragraph', { content: attributes.url } );
|
||||||
|
}
|
||||||
|
},
|
||||||
|
],
|
||||||
};
|
};
|
||||||
|
|
||||||
registerBlockType( metadata.name, metadata );
|
registerBlockType( metadata.name, metadata );
|
||||||
|
|||||||
+2
-2
@@ -3,7 +3,7 @@
|
|||||||
* Plugin Name: WP Strava
|
* Plugin Name: WP Strava
|
||||||
* Plugin URI: https://wordpress.org/plugins/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.
|
* 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.10.1
|
* Version: 2.11.0
|
||||||
* Author: Carlos Santa Cruz, Justin Foell, Lance Willett, Daniel Lintott, Sebastian Erb
|
* Author: Carlos Santa Cruz, Justin Foell, Lance Willett, Daniel Lintott, Sebastian Erb
|
||||||
* License: GPL2
|
* License: GPL2
|
||||||
* Text Domain: wp-strava
|
* 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
|
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
define( 'WPSTRAVA_PLUGIN_VERSION', '2.10.1' );
|
define( 'WPSTRAVA_PLUGIN_VERSION', '2.11.0' );
|
||||||
define( 'WPSTRAVA_PLUGIN_FILE', __FILE__ );
|
define( 'WPSTRAVA_PLUGIN_FILE', __FILE__ );
|
||||||
define( 'WPSTRAVA_PLUGIN_DIR', trailingslashit( dirname( __FILE__ ) ) );
|
define( 'WPSTRAVA_PLUGIN_DIR', trailingslashit( dirname( __FILE__ ) ) );
|
||||||
define( 'WPSTRAVA_PLUGIN_URL', plugins_url( '/', __FILE__ ) );
|
define( 'WPSTRAVA_PLUGIN_URL', plugins_url( '/', __FILE__ ) );
|
||||||
|
|||||||
Reference in New Issue
Block a user