PluginProbe ʕ •ᴥ•ʔ
GenerateBlocks / 1.4.0
GenerateBlocks v1.4.0
trunk 1.0 1.0.1 1.0.2 1.1.0 1.1.1 1.1.2 1.2.0 1.3.0 1.3.1 1.3.2 1.3.3 1.3.4 1.3.5 1.4.0 1.4.1 1.4.2 1.4.3 1.4.4 1.5.0 1.5.1 1.5.2 1.5.3 1.5.4 1.6.0 1.7.0 1.7.1 1.7.2 1.7.3 1.8.0 1.8.1 1.8.2 1.8.3 1.9.0 1.9.1 2.0.0 2.0.1 2.0.2 2.1.0 2.1.1 2.1.2 2.2.0 2.2.1 2.3.0
generateblocks / src / blocks / headline / save.js
generateblocks / src / blocks / headline Last commit date
css 5 years ago attributes.js 4 years ago block.js 4 years ago deprecated.js 5 years ago edit.js 4 years ago editor.scss 5 years ago element-icons.js 4 years ago markformat.js 4 years ago save.js 5 years ago transforms.js 5 years ago
save.js
63 lines
1 /**
2 * Block: Headline
3 */
4
5 import classnames from 'classnames';
6 import Element from '../../components/element';
7
8 import {
9 RichText,
10 } from '@wordpress/block-editor';
11
12 import {
13 applyFilters,
14 } from '@wordpress/hooks';
15
16 export default ( { attributes } ) => {
17 const {
18 uniqueId,
19 className,
20 anchor,
21 element,
22 content,
23 icon,
24 removeText,
25 ariaLabel,
26 } = attributes;
27
28 let htmlAttributes = {
29 className: classnames( {
30 'gb-headline': true,
31 [ `gb-headline-${ uniqueId }` ]: true,
32 'gb-headline-text': ! icon,
33 [ className ]: undefined !== className,
34 } ),
35 id: anchor ? anchor : null,
36 };
37
38 htmlAttributes = applyFilters( 'generateblocks.frontend.htmlAttributes', htmlAttributes, 'generateblocks/headline', attributes );
39
40 return (
41 <Element
42 tagName={ element }
43 htmlAttrs={ htmlAttributes }
44 >
45 { !! icon &&
46 <span
47 className="gb-icon"
48 aria-label={ !! removeText && !! ariaLabel ? ariaLabel : undefined }
49 dangerouslySetInnerHTML={ { __html: icon } }
50 />
51 }
52
53 { ! removeText &&
54 <RichText.Content
55 value={ content }
56 tagName={ !! icon ? 'span' : null }
57 className={ !! icon ? 'gb-headline-text' : null }
58 />
59 }
60 </Element>
61 );
62 };
63