mirror of
https://github.com/10h30/wp-strava.git
synced 2026-06-05 15:10:01 +09:00
First pass at server-side render (working)
This commit is contained in:
@@ -28,6 +28,20 @@ class WPStrava_Blocks_Activity implements WPStrava_Blocks_Interface {
|
||||
'editor_style' => 'wp-strava-block-editor',
|
||||
'editor_script' => 'wp-strava-block',
|
||||
'render_callback' => array( $this, 'render_block' ),
|
||||
'attributes' => array(
|
||||
'url' => array(
|
||||
'type' => 'string',
|
||||
'default' => '',
|
||||
),
|
||||
'imageOnly' => array(
|
||||
'type' => 'boolean',
|
||||
'default' => false,
|
||||
),
|
||||
'displayMarkers' => array(
|
||||
'type' => 'boolean',
|
||||
'default' => false,
|
||||
),
|
||||
),
|
||||
)
|
||||
);
|
||||
add_action( 'wp_footer', array( $this, 'print_scripts' ) );
|
||||
|
||||
@@ -7,6 +7,7 @@ const { Component } = wp.element;
|
||||
const { InspectorControls } = wp.editor;
|
||||
const { PanelBody, ToggleControl } = wp.components;
|
||||
const { isEmpty } = lodash;
|
||||
const { serverSideRender: ServerSideRender } = wp;
|
||||
|
||||
|
||||
/**
|
||||
@@ -83,7 +84,14 @@ class Edit extends Component {
|
||||
<EmbedControls
|
||||
switchBackToURLInput={ this.switchBackToURLInput }
|
||||
/>
|
||||
<img className="wp-strava-img" src={placeholderActivityImg} />
|
||||
<ServerSideRender
|
||||
block="wp-strava/activity"
|
||||
attributes={ {
|
||||
url: url,
|
||||
imageOnly: imageOnly,
|
||||
displayMarkers: displayMarkers,
|
||||
} }
|
||||
/>
|
||||
<InspectorControls>
|
||||
<PanelBody
|
||||
title={ __( 'Display Options' ) }
|
||||
|
||||
Reference in New Issue
Block a user