PluginProbe
Friends / 4.3.0
Friends v4.3.0
4.3.2 4.3.1 4.3.0 4.2.2 4.2.1 4.2.0 4.1.0 2.7.4 2.7.5 2.7.6 2.7.7 2.7.8 2.7.9 2.8.0 2.8.1 2.8.2 2.8.3 2.8.4 2.8.5 2.8.6 2.8.7 2.8.8 2.8.9 2.9.0 2.9.1 All 88 releases
friends / blocks / sidebar-blocks / index.js

index.js in Friends 4.3.0, at blocks/sidebar-blocks/index.js

61 lines 2.7 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 ( function ( blocks, element, serverSideRender ) {
2 var el = element.createElement;
3 var SSR = serverSideRender;
4
5 var listSupports = {
6 color: { background: true, text: true, link: true },
7 typography: { fontSize: true, lineHeight: true },
8 spacing: { padding: true, margin: true },
9 };
10
11 var chipSupports = {
12 color: { background: true, text: true, link: true },
13 typography: { fontSize: true },
14 spacing: { padding: true, margin: true },
15 };
16
17 var headingSupports = {
18 color: { background: true, text: true, link: true },
19 typography: { fontSize: true, lineHeight: true },
20 };
21
22 var sidebarBlocks = [
23 { name: 'friends/stats', title: 'Friend Stats', icon: 'chart-area', supports: listSupports },
24 { name: 'friends/refresh', title: 'Friend Posts Refresh', icon: 'update', supports: listSupports },
25 { name: 'friends/post-formats', title: 'Post Formats', icon: 'filter', supports: listSupports },
26 { name: 'friends/add-subscription', title: 'Follow', icon: 'plus-alt', supports: listSupports },
27 { name: 'friends/search', title: 'Friends Search', icon: 'search' },
28 { name: 'friends/feed-title', title: 'Feed Title', icon: 'admin-site-alt3', supports: headingSupports },
29 { name: 'friends/feed-chips', title: 'Feed Chips', icon: 'tag', supports: chipSupports },
30 { name: 'friends/post-content', title: 'Friend Post Content', icon: 'text-page' },
31 { name: 'friends/post-permalink', title: 'Post Permalink', icon: 'admin-links', supports: listSupports },
32 { name: 'friends/post-reblog', title: 'Reblog Button', icon: 'controls-repeat' },
33 { name: 'friends/post-boost', title: 'Boost Button', icon: 'controls-repeat' },
34 { name: 'friends/post-reactions', title: 'Reactions', icon: 'star-filled' },
35 { name: 'friends/post-comments', title: 'Comments', icon: 'admin-comments' },
36 { name: 'friends/author-star', title: 'Author Star', icon: 'star-empty' },
37 { name: 'friends/author-avatar', title: 'Author Avatar', icon: 'admin-users' },
38 { name: 'friends/author-name', title: 'Author Name', icon: 'nametag', supports: headingSupports },
39 { name: 'friends/author-description', title: 'Author Description', icon: 'editor-paragraph', supports: listSupports },
40 { name: 'friends/author-chips', title: 'Author Chips', icon: 'tag', supports: chipSupports },
41 ];
42
43 sidebarBlocks.forEach( function ( block ) {
44 var config = {
45 title: block.title,
46 icon: block.icon,
47 category: 'widgets',
48 edit: function () {
49 return el( SSR, { block: block.name } );
50 },
51 save: function () {
52 return null;
53 },
54 };
55 if ( block.supports ) {
56 config.supports = block.supports;
57 }
58 blocks.registerBlockType( block.name, config );
59 } );
60 } )( window.wp.blocks, window.wp.element, window.wp.serverSideRender );
61