| 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 |
|