PluginProbe
TablePress – Tables in WordPress made easy / 2.0.4
TablePress – Tables in WordPress made easy v2.0.4
3.3.4 3.3.3 3.3.2 3.3.1 trunk 1.12 1.14 1.9.2 2.0.4 2.1.7 2.1.8 2.2 2.2.1 2.2.2 2.2.3 2.2.4 2.2.5 2.3 2.3.1 2.3.2 2.4 2.4.1 2.4.2 2.4.3 2.4.4 All 44 releases
tablepress / blocks / table / src / save.js

save.js in TablePress – Tables in WordPress made easy 2.0.4, at blocks/table/src/save.js

37 lines 1.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 /**
2 * JavaScript code for the TablePress table block in the block editor.
3 *
4 * @package TablePress
5 * @subpackage Blocks
6 * @author Tobias Bäthge
7 * @since 2.0.0
8 */
9
10 /**
11 * WordPress dependencies
12 */
13 import { RawHTML } from '@wordpress/element';
14
15 /**
16 * The save function defines the way in which the different attributes should
17 * be combined into the final markup, which is then serialized by the block
18 * editor into `post_content`.
19 *
20 * @param {Object} params Function parameters.
21 * @param {Object} params.attributes Block attributes.
22 * @param {string} params.attributes.id Table ID.
23 * @param {string} params.attributes.parameters Table render attributes.
24 * @return {WPElement} Element to render.
25 */
26 export default function save( { attributes: { id = '', parameters = '' } } ) {
27 if ( '' === id ) {
28 return;
29 }
30
31 parameters = parameters.trim();
32 if ( '' !== parameters ) {
33 parameters += ' ';
34 }
35 return <RawHTML>{ `[${ tp.table.shortcode } id=${ id } ${ parameters }/]` }</RawHTML>;
36 }
37