PluginProbe
Block Animations, Motion & Scroll Effects – Ghost Kit / 3.3.2
Block Animations, Motion & Scroll Effects – Ghost Kit v3.3.2
3.7.2 3.7.1 3.7.0 3.6.1 trunk 1.6.3 2.25.0 3.3.0 3.3.1 3.3.2 3.3.3 3.4.0 3.4.1 3.4.2 3.4.3 3.4.4 3.4.5 3.4.6 3.5.0 3.5.1 3.6.0
ghostkit / gutenberg / blocks / testimonial / transforms.js

transforms.js in Block Animations, Motion & Scroll Effects – Ghost Kit 3.3.2, at gutenberg/blocks/testimonial/transforms.js

38 lines 669 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 import { createBlock } from '@wordpress/blocks';
2 import {
3 __UNSTABLE_LINE_SEPARATOR,
4 create,
5 split,
6 toHTMLString,
7 } from '@wordpress/rich-text';
8
9 export default {
10 from: [
11 {
12 type: 'block',
13 blocks: ['core/quote', 'core/pullquote'],
14 transform(attrs) {
15 const paragraphs = split(
16 create({
17 html: attrs.value,
18 multilineTag: 'p',
19 }),
20 __UNSTABLE_LINE_SEPARATOR
21 );
22
23 return createBlock(
24 'ghostkit/testimonial',
25 {
26 source: attrs.citation || '',
27 },
28 paragraphs.map((piece) =>
29 createBlock('core/paragraph', {
30 content: toHTMLString({ value: piece }),
31 })
32 )
33 );
34 },
35 },
36 ],
37 };
38