Version Description
- Blog Posts Block: Tag Exclusion feature
- Blog Posts Block: Image orientation issues resolved.
- Blog Posts Block: Full width alignment issue resolved.
Download this release
Release Info
Developer | rabberson |
Plugin | ![]() |
Version | 0.18.1 |
Comparing to | |
See all releases |
Code changes from version 0.18 to 0.18.1
- {trunk/event-countdown-block → event-countdown-block}/blocks/event-countdown.js +0 -0
- {trunk/event-countdown-block → event-countdown-block}/blocks/event-countdown.php +0 -0
- {trunk/event-countdown-block → event-countdown-block}/editor.css +0 -0
- {trunk/event-countdown-block → event-countdown-block}/index.asset.php +0 -0
- {trunk/event-countdown-block → event-countdown-block}/index.js +0 -0
- {trunk/event-countdown-block → event-countdown-block}/index.php +0 -0
- {trunk/event-countdown-block → event-countdown-block}/license.txt +0 -0
- {trunk/event-countdown-block → event-countdown-block}/style.css +0 -0
- full-site-editing-plugin.php +2 -2
- {trunk/jetpack-timeline → jetpack-timeline}/blocks/timeline.php +0 -0
- {trunk/jetpack-timeline → jetpack-timeline}/editor.css +0 -0
- {trunk/jetpack-timeline → jetpack-timeline}/index.asset.php +0 -0
- {trunk/jetpack-timeline → jetpack-timeline}/index.js +0 -0
- {trunk/jetpack-timeline → jetpack-timeline}/index.php +0 -0
- {trunk/jetpack-timeline → jetpack-timeline}/style.css +0 -0
- readme.txt +2 -2
- trunk/blog-posts-block/README.md +0 -32
- trunk/blog-posts-block/dist/editor.asset.php +0 -1
- trunk/blog-posts-block/dist/editor.css +0 -1
- trunk/blog-posts-block/dist/editor.js +0 -2
- trunk/blog-posts-block/dist/editor.js.LICENSE +0 -5
- trunk/blog-posts-block/dist/editor.rtl.css +0 -1
- trunk/blog-posts-block/dist/view.asset.php +0 -1
- trunk/blog-posts-block/dist/view.css +0 -1
- trunk/blog-posts-block/dist/view.js +0 -1
- trunk/blog-posts-block/dist/view.rtl.css +0 -1
- trunk/blog-posts-block/editor.js +0 -38
- trunk/blog-posts-block/index.php +0 -92
- trunk/blog-posts-block/newspack-homepage-articles/README.md +0 -5
- trunk/blog-posts-block/newspack-homepage-articles/blocks/homepage-articles/block.json +0 -127
- trunk/blog-posts-block/newspack-homepage-articles/blocks/homepage-articles/class-wp-rest-newspack-articles-controller.php +0 -143
- trunk/blog-posts-block/newspack-homepage-articles/blocks/homepage-articles/edit.js +0 -677
- trunk/blog-posts-block/newspack-homepage-articles/blocks/homepage-articles/editor.js +0 -7
- trunk/blog-posts-block/newspack-homepage-articles/blocks/homepage-articles/editor.scss +0 -39
- trunk/blog-posts-block/newspack-homepage-articles/blocks/homepage-articles/index.js +0 -106
- trunk/blog-posts-block/newspack-homepage-articles/blocks/homepage-articles/templates/article.php +0 -143
- trunk/blog-posts-block/newspack-homepage-articles/blocks/homepage-articles/templates/articles-list.php +0 -21
- trunk/blog-posts-block/newspack-homepage-articles/blocks/homepage-articles/templates/articles-loop.php +0 -29
- trunk/blog-posts-block/newspack-homepage-articles/blocks/homepage-articles/view.js +0 -236
- trunk/blog-posts-block/newspack-homepage-articles/blocks/homepage-articles/view.php +0 -227
- trunk/blog-posts-block/newspack-homepage-articles/blocks/homepage-articles/view.scss +0 -582
- trunk/blog-posts-block/newspack-homepage-articles/class-newspack-blocks-api.php +0 -224
- trunk/blog-posts-block/newspack-homepage-articles/class-newspack-blocks.php +0 -407
- trunk/blog-posts-block/newspack-homepage-articles/components/autocomplete-tokenfield.js +0 -175
- trunk/blog-posts-block/newspack-homepage-articles/components/autocomplete-tokenfield.scss +0 -9
- trunk/blog-posts-block/newspack-homepage-articles/components/query-controls.js +0 -254
- trunk/blog-posts-block/newspack-homepage-articles/shared/sass/_colors.scss +0 -8
- trunk/blog-posts-block/newspack-homepage-articles/shared/sass/_legacy_colors.scss +0 -13
- trunk/blog-posts-block/newspack-homepage-articles/shared/sass/_mixins.scss +0 -26
- trunk/blog-posts-block/newspack-homepage-articles/shared/sass/_variables.scss +0 -27
- trunk/blog-posts-block/view.js +0 -1
- trunk/full-site-editing-plugin.php +0 -213
- trunk/full-site-editing/blocks/navigation-menu/edit.js +0 -98
- trunk/full-site-editing/blocks/navigation-menu/index.js +0 -33
- trunk/full-site-editing/blocks/navigation-menu/index.php +0 -125
- trunk/full-site-editing/blocks/navigation-menu/style.scss +0 -3
- trunk/full-site-editing/blocks/post-content/edit.js +0 -62
- trunk/full-site-editing/blocks/post-content/index.js +0 -57
- trunk/full-site-editing/blocks/post-content/index.php +0 -39
- trunk/full-site-editing/blocks/post-content/save.js +0 -6
- trunk/full-site-editing/blocks/post-content/style.scss +0 -69
- trunk/full-site-editing/blocks/site-credit/edit.js +0 -75
- trunk/full-site-editing/blocks/site-credit/footer-credit-choices.js +0 -24
- trunk/full-site-editing/blocks/site-credit/index.js +0 -38
- trunk/full-site-editing/blocks/site-credit/index.php +0 -205
- trunk/full-site-editing/blocks/site-credit/style.scss +0 -37
- trunk/full-site-editing/blocks/site-description/edit.js +0 -140
- trunk/full-site-editing/blocks/site-description/index.js +0 -61
- trunk/full-site-editing/blocks/site-description/index.php +0 -68
- trunk/full-site-editing/blocks/site-description/style.scss +0 -12
- trunk/full-site-editing/blocks/site-title/edit.js +0 -121
- trunk/full-site-editing/blocks/site-title/index.js +0 -50
- trunk/full-site-editing/blocks/site-title/index.php +0 -62
- trunk/full-site-editing/blocks/site-title/style.scss +0 -12
- trunk/full-site-editing/blocks/template/edit.js +0 -201
- trunk/full-site-editing/blocks/template/index.js +0 -60
- trunk/full-site-editing/blocks/template/index.php +0 -41
- trunk/full-site-editing/blocks/template/site-logo.js +0 -18
- trunk/full-site-editing/blocks/template/style.scss +0 -102
- trunk/full-site-editing/class-full-site-editing.php +0 -628
- trunk/full-site-editing/dist/full-site-editing.asset.php +0 -1
- trunk/full-site-editing/dist/full-site-editing.css +0 -1
- trunk/full-site-editing/dist/full-site-editing.js +0 -2
- trunk/full-site-editing/dist/full-site-editing.js.LICENSE +0 -5
- trunk/full-site-editing/dist/full-site-editing.rtl.css +0 -1
- trunk/full-site-editing/editor/block-inserter/index.js +0 -39
- trunk/full-site-editing/editor/block-inserter/post-content-block-appender.js +0 -27
- trunk/full-site-editing/editor/image-block-keywords/index.js +0 -23
- trunk/full-site-editing/editor/index.js +0 -10
- trunk/full-site-editing/editor/remove-editor-panels/index.js +0 -31
- trunk/full-site-editing/editor/style.scss +0 -95
- trunk/full-site-editing/editor/suppress-draft-action/index.js +0 -38
- trunk/full-site-editing/editor/suppress-trash-action/index.js +0 -26
- trunk/full-site-editing/editor/template-validity-override/index.js +0 -23
- trunk/full-site-editing/helpers.php +0 -181
- trunk/full-site-editing/index.js +0 -13
- trunk/full-site-editing/lib/index.js +0 -1
- trunk/full-site-editing/lib/site-options/index.js +0 -2
- trunk/full-site-editing/lib/site-options/use-previous.js +0 -24
- trunk/full-site-editing/lib/site-options/use-site-options.js +0 -127
- trunk/full-site-editing/lib/site-options/with-site-options.js +0 -99
- trunk/full-site-editing/plugins/close-button-override/index.js +0 -100
- trunk/full-site-editing/plugins/close-button-override/style.scss +0 -50
- trunk/full-site-editing/plugins/editor-template-classes/index.js +0 -53
- trunk/full-site-editing/plugins/template-update-notice/index.js +0 -20
- trunk/full-site-editing/sass/_mixins.scss +0 -17
- trunk/full-site-editing/serialize-block-fallback.php +0 -70
- trunk/full-site-editing/templates/class-rest-templates-controller.php +0 -49
- trunk/full-site-editing/templates/class-template-image-inserter.php +0 -174
- trunk/full-site-editing/templates/class-wp-template-inserter.php +0 -537
- trunk/full-site-editing/templates/class-wp-template.php +0 -204
- trunk/global-styles/README-DATA.md +0 -363
- trunk/global-styles/README.md +0 -230
- trunk/global-styles/class-global-styles.php +0 -515
- trunk/global-styles/dist/global-styles.asset.php +0 -1
- trunk/global-styles/dist/global-styles.css +0 -1
- trunk/global-styles/dist/global-styles.js +0 -2
- trunk/global-styles/dist/global-styles.js.LICENSE +0 -5
- trunk/global-styles/dist/global-styles.rtl.css +0 -1
- trunk/global-styles/editor.scss +0 -2
- trunk/global-styles/includes/class-data-point-literal.php +0 -44
- trunk/global-styles/includes/class-data-point-option.php +0 -104
- trunk/global-styles/includes/class-data-point-theme.php +0 -92
- trunk/global-styles/includes/class-data-set.php +0 -167
- trunk/global-styles/includes/class-json-endpoint.php +0 -116
- trunk/global-styles/includes/interface-data-point.php +0 -17
- trunk/global-styles/index.js +0 -51
- trunk/global-styles/src/constants.js +0 -7
- trunk/global-styles/src/dom-updater.js +0 -36
- trunk/global-styles/src/font-pairings-panel-previews.js +0 -73
- trunk/global-styles/src/font-pairings-panel.js +0 -50
- trunk/global-styles/src/font-pairings-panel.scss +0 -48
- trunk/global-styles/src/font-selection-panel.js +0 -49
- trunk/global-styles/src/global-styles-sidebar.js +0 -144
- trunk/global-styles/src/global-styles-sidebar.scss +0 -22
- trunk/global-styles/src/icon.js +0 -12
- trunk/global-styles/src/no-support.js +0 -11
- trunk/global-styles/src/store.js +0 -122
- trunk/global-styles/static/blank.css +0 -6
- trunk/global-styles/static/style.css +0 -28
- trunk/posts-list-block/blocks/posts-list/block.json +0 -10
- trunk/posts-list-block/blocks/posts-list/editor.scss +0 -9
- trunk/posts-list-block/blocks/posts-list/index.js +0 -110
- trunk/posts-list-block/blocks/posts-list/style.scss +0 -9
- trunk/posts-list-block/blocks/posts-list/transforms.js +0 -34
- trunk/posts-list-block/class-posts-list-block.php +0 -160
- trunk/posts-list-block/dist/posts-list-block.asset.php +0 -1
- trunk/posts-list-block/dist/posts-list-block.css +0 -1
- trunk/posts-list-block/dist/posts-list-block.js +0 -1
- trunk/posts-list-block/dist/posts-list-block.rtl.css +0 -1
- trunk/posts-list-block/index.js +0 -4
- trunk/posts-list-block/templates/no-posts.php +0 -26
- trunk/posts-list-block/templates/post-item.php +0 -44
- trunk/posts-list-block/templates/posts-list.php +0 -39
- trunk/posts-list-block/utils.php +0 -46
- trunk/readme.txt +0 -136
- trunk/starter-page-templates/class-starter-page-templates.php +0 -262
- trunk/starter-page-templates/class-wp-rest-sideload-image-controller.php +0 -294
- trunk/starter-page-templates/dist/starter-page-templates.asset.php +0 -1
- trunk/starter-page-templates/dist/starter-page-templates.css +0 -1
- trunk/starter-page-templates/dist/starter-page-templates.js +0 -2
- trunk/starter-page-templates/dist/starter-page-templates.js.LICENSE +0 -5
- trunk/starter-page-templates/dist/starter-page-templates.rtl.css +0 -1
- trunk/starter-page-templates/index.js +0 -87
- trunk/starter-page-templates/page-template-modal/components/block-preview.js +0 -27
- trunk/starter-page-templates/page-template-modal/components/block-template-preview.js +0 -34
- trunk/starter-page-templates/page-template-modal/components/preview-template-title.js +0 -22
- trunk/starter-page-templates/page-template-modal/components/sidebar-modal-opener.js +0 -124
- trunk/starter-page-templates/page-template-modal/components/template-selector-control.js +0 -78
- trunk/starter-page-templates/page-template-modal/components/template-selector-item.js +0 -75
- trunk/starter-page-templates/page-template-modal/components/template-selector-preview.js +0 -145
- trunk/starter-page-templates/page-template-modal/components/test/__snapshots__/template-selector-control-test.js.snap +0 -128
- trunk/starter-page-templates/page-template-modal/components/test/__snapshots__/template-selector-preview-test.js.snap +0 -48
- trunk/starter-page-templates/page-template-modal/components/test/helpers/templates-blocks-helpers.js +0 -58
- trunk/starter-page-templates/page-template-modal/components/test/template-selector-control-test.js +0 -200
- trunk/starter-page-templates/page-template-modal/components/test/template-selector-preview-test.js +0 -65
- trunk/starter-page-templates/page-template-modal/index.js +0 -401
- trunk/starter-page-templates/page-template-modal/styles/starter-page-templates-editor.scss +0 -503
- trunk/starter-page-templates/page-template-modal/utils/ensure-assets.js +0 -213
- trunk/starter-page-templates/page-template-modal/utils/replace-placeholders.js +0 -32
- trunk/starter-page-templates/page-template-modal/utils/tracking.js +0 -59
{trunk/event-countdown-block → event-countdown-block}/blocks/event-countdown.js
RENAMED
File without changes
|
{trunk/event-countdown-block → event-countdown-block}/blocks/event-countdown.php
RENAMED
File without changes
|
{trunk/event-countdown-block → event-countdown-block}/editor.css
RENAMED
File without changes
|
{trunk/event-countdown-block → event-countdown-block}/index.asset.php
RENAMED
File without changes
|
{trunk/event-countdown-block → event-countdown-block}/index.js
RENAMED
File without changes
|
{trunk/event-countdown-block → event-countdown-block}/index.php
RENAMED
File without changes
|
{trunk/event-countdown-block → event-countdown-block}/license.txt
RENAMED
File without changes
|
{trunk/event-countdown-block → event-countdown-block}/style.css
RENAMED
File without changes
|
full-site-editing-plugin.php
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
/**
|
3 |
* Plugin Name: Full Site Editing
|
4 |
* Description: Enhances your page creation workflow within the Block Editor.
|
5 |
-
* Version: 0.18
|
6 |
* Author: Automattic
|
7 |
* Author URI: https://automattic.com/wordpress-plugins/
|
8 |
* License: GPLv2 or later
|
@@ -35,7 +35,7 @@ namespace A8C\FSE;
|
|
35 |
*
|
36 |
* @var string
|
37 |
*/
|
38 |
-
define( 'PLUGIN_VERSION', '0.18' );
|
39 |
|
40 |
// Always include these helper files for FSE.
|
41 |
require_once __DIR__ . '/full-site-editing/helpers.php';
|
2 |
/**
|
3 |
* Plugin Name: Full Site Editing
|
4 |
* Description: Enhances your page creation workflow within the Block Editor.
|
5 |
+
* Version: 0.18.1
|
6 |
* Author: Automattic
|
7 |
* Author URI: https://automattic.com/wordpress-plugins/
|
8 |
* License: GPLv2 or later
|
35 |
*
|
36 |
* @var string
|
37 |
*/
|
38 |
+
define( 'PLUGIN_VERSION', '0.18.1' );
|
39 |
|
40 |
// Always include these helper files for FSE.
|
41 |
require_once __DIR__ . '/full-site-editing/helpers.php';
|
{trunk/jetpack-timeline → jetpack-timeline}/blocks/timeline.php
RENAMED
File without changes
|
{trunk/jetpack-timeline → jetpack-timeline}/editor.css
RENAMED
File without changes
|
{trunk/jetpack-timeline → jetpack-timeline}/index.asset.php
RENAMED
File without changes
|
{trunk/jetpack-timeline → jetpack-timeline}/index.js
RENAMED
File without changes
|
{trunk/jetpack-timeline → jetpack-timeline}/index.php
RENAMED
File without changes
|
{trunk/jetpack-timeline → jetpack-timeline}/style.css
RENAMED
File without changes
|
readme.txt
CHANGED
@@ -3,7 +3,7 @@ Contributors: alexislloyd, allancole, automattic, codebykat, copons, dmsnell, ge
|
|
3 |
Tags: block, blocks, editor, gutenberg, page
|
4 |
Requires at least: 5.0
|
5 |
Tested up to: 5.3
|
6 |
-
Stable tag: 0.18
|
7 |
Requires PHP: 5.6.20
|
8 |
License: GPLv2 or later
|
9 |
License URI: https://www.gnu.org/licenses/gpl-2.0.html
|
@@ -42,7 +42,7 @@ This plugin is experimental, so we don't provide any support for it outside of w
|
|
42 |
|
43 |
== Changelog ==
|
44 |
|
45 |
-
= 0.18 =
|
46 |
* Blog Posts Block: Tag Exclusion feature
|
47 |
* Blog Posts Block: Image orientation issues resolved.
|
48 |
* Blog Posts Block: Full width alignment issue resolved.
|
3 |
Tags: block, blocks, editor, gutenberg, page
|
4 |
Requires at least: 5.0
|
5 |
Tested up to: 5.3
|
6 |
+
Stable tag: 0.18.1
|
7 |
Requires PHP: 5.6.20
|
8 |
License: GPLv2 or later
|
9 |
License URI: https://www.gnu.org/licenses/gpl-2.0.html
|
42 |
|
43 |
== Changelog ==
|
44 |
|
45 |
+
= 0.18.1 =
|
46 |
* Blog Posts Block: Tag Exclusion feature
|
47 |
* Blog Posts Block: Image orientation issues resolved.
|
48 |
* Blog Posts Block: Full width alignment issue resolved.
|
trunk/blog-posts-block/README.md
DELETED
@@ -1,32 +0,0 @@
|
|
1 |
-
# Blog Posts Block
|
2 |
-
|
3 |
-
This block allows you to list your posts in various layouts and filter them by criteria like category, tag or author.
|
4 |
-
|
5 |
-
It originally comes from the [Newspack Blocks collection](https://github.com/automattic/newspack-blocks) and the block is still being developed there.
|
6 |
-
|
7 |
-
It was added to this repository in order to make it available to other parts of the FSE plugin, such as Starter Page Templates where this block will be used.
|
8 |
-
|
9 |
-
## Structure
|
10 |
-
|
11 |
-
```
|
12 |
-
index.php — main entry file, registers the block on backend
|
13 |
-
editor.js — assets for the block editor
|
14 |
-
view.js — assets for the block rendered on frontend
|
15 |
-
newspack-homepage-articles/** — source code synced from the Newspack Blocks repository
|
16 |
-
```
|
17 |
-
|
18 |
-
`editor.js`, `view.js` and `index.php` are files written in order to bridge the parent plugin with the Blog Posts Block. It changes the block name to `a8c/blog-posts` and does things like registering REST fields or styles and scripts. In these files we are free to do all those changes because they are not shared with Newspack and only live here in this repository.
|
19 |
-
|
20 |
-
### Synchronizing the code
|
21 |
-
|
22 |
-
You can see that `newspack-homepage-articles` is being synced with the Newspack Blocks repository. Please make all improvements and additions on the Newspack side. Please don't make any direct changes to files in this directory as the next synchronization will overwrite them.
|
23 |
-
|
24 |
-
Once your changes land on the Newspack side, coordinate with the team (over issues/PRs) to [make a new release](https://github.com/Automattic/newspack-blocks/releases) and once you have the release ID, you can pull the code into here.
|
25 |
-
|
26 |
-
While being in `apps/full-site-editing/` directory, you can run:
|
27 |
-
|
28 |
-
```
|
29 |
-
npm run sync:blog-posts-block --release=1.0.0-alpha.17
|
30 |
-
```
|
31 |
-
|
32 |
-
This will pull the code from the release and integrate it into this repository. Please review changes, make sure to update `NEWSPACK_BLOCKS__VERSION` in [index.php](./index.php) and commit.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/blog-posts-block/dist/editor.asset.php
DELETED
@@ -1 +0,0 @@
|
|
1 |
-
<?php return array('dependencies' => array('lodash', 'moment', 'wp-api-fetch', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-compose', 'wp-data', 'wp-element', 'wp-hooks', 'wp-html-entities', 'wp-i18n', 'wp-polyfill', 'wp-url'), 'version' => '3614c7b88f9588d96d19edc1a82772b4');
|
|
trunk/blog-posts-block/dist/editor.css
DELETED
@@ -1 +0,0 @@
|
|
1 |
-
.autocomplete-tokenfield{position:relative}.autocomplete-tokenfield .components-spinner{position:absolute;top:2em;right:0}.type-scale-slider .dashicon{height:16px;width:16px}.type-scale-slider input+.dashicon{height:24px;margin-left:10px;margin-right:0;width:24px}.wpnbha .editor-rich-text{width:100%}.wpnbha .cat-links{font-size:.7em}.wpnbha span.avatar{display:inline-block;margin-right:.5em}.wpnbha span.avatar div{display:inline}.wpnbha .excerpt-contain p{margin:.5em 0}.wpnbha{margin-bottom:1em}.wpnbha article{margin-bottom:1.5em;word-break:break-word;overflow-wrap:break-word;position:relative}.wpnbha article:last-of-type{margin-bottom:0}.wpnbha .article-section-title{font-size:.8em;margin-bottom:.5em;width:100%}.wpnbha.is-grid>div{display:flex;flex-wrap:wrap;justify-content:space-between;padding:0;list-style:none}.wpnbha.is-grid article{flex-basis:100%}@media only screen and (min-width:782px){.wpnbha.is-grid article,.wpnbha.is-grid article:last-child{margin-bottom:1em}}@media only screen and (min-width:600px){.wpnbha.columns-3 article,.wpnbha.columns-6 article{flex-basis:calc(33.333% - 16px)}.wpnbha.columns-2 article,.wpnbha.columns-4 article,.wpnbha.columns-5 article{flex-basis:calc(50% - 16px)}.wpnbha.columns-5 article:last-of-type:nth-child(odd){flex-grow:1}}@media only screen and (min-width:782px){.wpnbha.columns-2 article{flex-basis:calc(50% - 16px)}.wpnbha.columns-3 article{flex-basis:calc(33.33333% - 16px)}.wpnbha.columns-4 article{flex-basis:calc(25% - 16px)}.wpnbha.columns-5 article{flex-basis:calc(20% - 16px)}.wpnbha.columns-6 article{flex-basis:calc(16.66667% - 16px)}}.wpnbha .post-thumbnail{margin:0}.wpnbha .post-thumbnail img{height:auto;width:100%}.wpnbha figcaption{font-size:.6em}.wpnbha .post-thumbnail{margin-bottom:.25em}.wpnbha .post-thumbnail figcaption{margin-bottom:.5em}.wpnbha.image-alignleft .post-has-image,.wpnbha.image-alignright .post-has-image{display:flex}.wpnbha.image-alignleft .post-has-image .post-thumbnail,.wpnbha.image-alignright .post-has-image .post-thumbnail{flex-basis:33%}.wpnbha.image-alignleft .post-has-image .entry-wrapper,.wpnbha.image-alignright .post-has-image .entry-wrapper{flex-basis:67%}.wpnbha.image-alignleft.mobile-stack .post-has-image,.wpnbha.image-alignright.mobile-stack .post-has-image{display:block}@media only screen and (min-width:600px){.wpnbha.image-alignleft.mobile-stack .post-has-image,.wpnbha.image-alignright.mobile-stack .post-has-image{display:flex}}@media only screen and (min-width:600px){.wpnbha.image-alignleft.is-4 .post-thumbnail,.wpnbha.image-alignright.is-4 .post-thumbnail{flex-basis:75%}.wpnbha.image-alignleft.is-4 .entry-wrapper,.wpnbha.image-alignright.is-4 .entry-wrapper{flex-basis:25%}.wpnbha.image-alignleft.is-3 .entry-wrapper,.wpnbha.image-alignleft.is-3 .post-thumbnail,.wpnbha.image-alignright.is-3 .entry-wrapper,.wpnbha.image-alignright.is-3 .post-thumbnail{flex-basis:50%}}.wpnbha.image-alignleft.is-1 .post-thumbnail,.wpnbha.image-alignright.is-1 .post-thumbnail{flex-basis:25%}.wpnbha.image-alignleft.is-1 .entry-wrapper,.wpnbha.image-alignright.is-1 .entry-wrapper{flex-basis:75%}.wpnbha.image-alignleft .post-thumbnail{margin-right:1em}.wpnbha.image-alignright .post-thumbnail{margin-left:1em}.wpnbha.image-alignright .entry-wrapper{order:-1}.wpnbha.mobile-stack.image-alignleft .post-thumbnail,.wpnbha.mobile-stack.image-alignright .post-thumbnail{margin-left:0;margin-right:0}@media only screen and (min-width:600px){.wpnbha.mobile-stack.image-alignleft .post-thumbnail{margin-right:1em}.wpnbha.mobile-stack.image-alignright .post-thumbnail{margin-left:1em}}.wpnbha .entry-title{margin:0 0 .25em}.wpnbha .entry-title a{color:inherit;text-decoration:none}.wpnbha .cat-links{font-size:.6em;font-weight:700;margin:0 0 .5em}.wpnbha .cat-links a{text-decoration:none}.wpnbha .cat-links a:hover{text-decoration:underline}.wpnbha .entry-meta{display:flex;flex-wrap:wrap;align-items:center;margin-top:.5em}.wpnbha .entry-meta .byline:not(:last-child){margin-right:1.5em}.wpnbha .entry-meta .updated:not(.published){display:none}.wpnbha .avatar{border-radius:100%;display:block;margin-right:.5em}.wpnbha p{margin:.5em 0}.wpnbha.has-text-color .article-section-title,.wpnbha.has-text-color .cat-links,.wpnbha.has-text-color .cat-links a,.wpnbha.has-text-color .cat-links a:visited,.wpnbha.has-text-color .entry-meta,.wpnbha.has-text-color .entry-meta .byline a,.wpnbha.has-text-color .entry-meta .byline a:visited,.wpnbha.has-text-color .entry-meta a,.wpnbha.has-text-color .entry-title,.wpnbha.has-text-color .entry-title a,.wpnbha.has-text-color .entry-title a:visited,.wpnbha.has-text-color figcaption{color:inherit}.wpnbha.has-text-color .entry-meta span:not(.avatar){opacity:.8}.wpnbha.image-alignbehind .post-has-image{display:flex;align-items:flex-end;position:relative}.wpnbha.image-alignbehind .post-has-image .post-thumbnail{bottom:0;left:0;margin:0;overflow:hidden;position:absolute;right:0;top:0}.wpnbha.image-alignbehind .post-has-image .post-thumbnail img{height:100%;-o-object-fit:cover;object-fit:cover;max-width:1000%;width:100%}.wpnbha.image-alignbehind .post-has-image .post-thumbnail figcaption{bottom:1em;-webkit-box-orient:vertical;color:hsla(0,0%,100%,.9);display:-webkit-box;font-style:italic;left:0;-webkit-line-clamp:1;margin:0;max-height:1.6em;overflow:hidden;padding:0 1em;position:absolute;right:0;text-align:right;text-overflow:ellipsis;z-index:2}.wpnbha.image-alignbehind .post-has-image .post-thumbnail:after{background:rgba(0,0,0,.5);bottom:0;content:"";left:0;position:absolute;right:0;top:0;z-index:1}.wpnbha.image-alignbehind .post-has-image .entry-wrapper{padding:2em;position:relative;z-index:2}.wpnbha.image-alignbehind .post-has-image .cat-links a,.wpnbha.image-alignbehind .post-has-image .entry-meta,.wpnbha.image-alignbehind .post-has-image .entry-meta .byline a,.wpnbha.image-alignbehind .post-has-image .entry-title a,.wpnbha.image-alignbehind .post-has-image .entry-wrapper{color:#fff}.wpnbha article .entry-title{font-size:1.2em}.wpnbha article .entry-meta{font-size:.8em}.wpnbha article .avatar{height:25px;width:25px}@media only screen and (min-width:782px){.wpnbha article .entry-title{font-size:1.6em}.wpnbha article .avatar{height:40px;width:40px}}.wpnbha.ts-8 .entry-title,.wpnbha.ts-9 .entry-title,.wpnbha.ts-10 .entry-title{line-height:1.1em}@media only screen and (min-width:782px){.wpnbha.ts-8 article .avatar,.wpnbha.ts-9 article .avatar,.wpnbha.ts-10 article .avatar{height:2.4em;width:2.4em}}.wpnbha.ts-10 article .entry-title{font-size:2.6em}@media only screen and (min-width:782px){.wpnbha.ts-10 article .entry-title{font-size:3.6em}}@media only screen and (min-width:1168px){.wpnbha.ts-10 article .entry-title{font-size:4.8em}}.wpnbha.ts-9 article .entry-title{font-size:2.4em}@media only screen and (min-width:782px){.wpnbha.ts-9 article .entry-title{font-size:3.4em}}@media only screen and (min-width:1168px){.wpnbha.ts-9 article .entry-title{font-size:4.2em}}.wpnbha.ts-8 article .entry-title{font-size:2.2em}@media only screen and (min-width:782px){.wpnbha.ts-8 article .entry-title{font-size:3em}}@media only screen and (min-width:1168px){.wpnbha.ts-8 article .entry-title{font-size:3.6em}}.wpnbha.ts-7 article .entry-title{font-size:2em}@media only screen and (min-width:782px){.wpnbha.ts-7 article .entry-title{font-size:2.4em}.wpnbha.ts-7 article .avatar{height:48px;width:48px}}@media only screen and (min-width:1168px){.wpnbha.ts-7 article .entry-title{font-size:3em}}.wpnbha.ts-6 article .entry-title{font-size:1.7em}@media only screen and (min-width:782px){.wpnbha.ts-6 article .entry-title{font-size:2em}.wpnbha.ts-6 article .avatar{height:44px;width:44px}}@media only screen and (min-width:1168px){.wpnbha.ts-6 article .entry-title{font-size:2.4em}}.wpnbha.ts-5 article .entry-title{font-size:1.4em}@media only screen and (min-width:782px){.wpnbha.ts-5 article .entry-title{font-size:1.8em}.wpnbha.ts-5 article .avatar{height:40px;width:40px}}@media only screen and (min-width:1168px){.wpnbha.ts-5 article .entry-title{font-size:2em}}.wpnbha.ts-3 article .entry-title{font-size:1em}.wpnbha.ts-3 article .entry-wrapper p{font-size:.8em}.wpnbha.ts-3 article .entry-meta{font-size:.7em}@media only screen and (min-width:782px){.wpnbha.ts-3 article .entry-title{font-size:1.2em}.wpnbha.ts-3 article .avatar{height:32px;width:32px}}.wpnbha.ts-2 article .entry-title{font-size:.8em}.wpnbha.ts-2 article .entry-meta,.wpnbha.ts-2 article .entry-wrapper p{font-size:.7em}@media only screen and (min-width:782px){.wpnbha.ts-2 article .entry-title{font-size:.9em}.wpnbha.ts-2 article .avatar{height:28px;width:28px}}.wpnbha.ts-1 article .entry-title,.wpnbha.ts-1 article .entry-wrapper p{font-size:.7em}.wpnbha.ts-1 article .entry-meta{font-size:.6em}@media only screen and (min-width:782px){.wpnbha.ts-1 article .avatar{height:24px;width:24px}}.wpnbha.is-style-borders article{border:solid rgba(0,0,0,.2);border-width:0 0 1px;margin-bottom:1em;padding-bottom:1em}.wpnbha.is-style-borders article:last-of-type{margin-bottom:0}.wpnbha.is-style-borders article:last-of-type:not(:first-of-type){border-bottom:0}@media only screen and (min-width:782px){.wpnbha.is-style-borders.columns-2 article{padding-right:32px}.wpnbha.is-style-borders.columns-3 article{padding-right:24px}.wpnbha.is-style-borders.columns-4 article{padding-right:21.33333px}.wpnbha.is-style-borders.columns-5 article{padding-right:20px}.wpnbha.is-style-borders.columns-6 article{padding-right:19.2px}.wpnbha.is-style-borders.is-grid article{border-width:0 1px 0 0}.wpnbha.is-style-borders.columns-1 article,.wpnbha.is-style-borders.columns-2 article:nth-of-type(2n),.wpnbha.is-style-borders.columns-3 article:nth-of-type(3n),.wpnbha.is-style-borders.columns-4 article:nth-of-type(4n),.wpnbha.is-style-borders.columns-5 article:nth-of-type(5n),.wpnbha.is-style-borders.columns-6 article:nth-of-type(6n),.wpnbha.is-style-borders.is-grid article:last-of-type{border:0}}
|
|
trunk/blog-posts-block/dist/editor.js
DELETED
@@ -1,2 +0,0 @@
|
|
1 |
-
/*! For license information please see editor.js.LICENSE */
|
2 |
-
!function(e,t){for(var n in t)e[n]=t[n]}(window,function(e){var t={};function n(o){if(t[o])return t[o].exports;var c=t[o]={i:o,l:!1,exports:{}};return e[o].call(c.exports,c,c.exports,n),c.l=!0,c.exports}return n.m=e,n.c=t,n.d=function(e,t,o){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:o})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var o=Object.create(null);if(n.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var c in e)n.d(o,c,function(t){return e[t]}.bind(null,c));return o},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=33)}([function(e,t){!function(){e.exports=this.wp.element}()},function(e,t){!function(){e.exports=this.wp.i18n}()},function(e,t){!function(){e.exports=this.wp.components}()},function(e,t){e.exports=function(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}},function(e,t){e.exports=function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}},function(e,t){!function(){e.exports=this.wp.htmlEntities}()},function(e,t){!function(){e.exports=this.wp.url}()},function(e,t){!function(){e.exports=this.wp.apiFetch}()},function(e,t){!function(){e.exports=this.wp.blockEditor}()},function(e,t){e.exports=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}},function(e,t,n){var o=n(28),c=n(4);e.exports=function(e,t){return!t||"object"!==o(t)&&"function"!=typeof t?c(e):t}},function(e,t){function n(t){return e.exports=n=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},n(t)}e.exports=n},function(e,t,n){var o=n(29);e.exports=function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&o(e,t)}},function(e,t){!function(){e.exports=this.wp.blocks}()},function(e,t){!function(){e.exports=this.lodash}()},function(e,t){!function(){e.exports=this.wp.hooks}()},function(e,t,n){var o=n(25),c=n(26),a=n(27);e.exports=function(e){return o(e)||c(e)||a()}},function(e,t){function n(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}e.exports=function(e,t,o){return t&&n(e.prototype,t),o&&n(e,o),e}},function(e){e.exports=JSON.parse('{"name":"homepage-articles","category":"newspack","attributes":{"className":{"type":"string","default":""},"showExcerpt":{"type":"boolean","default":true},"showDate":{"type":"boolean","default":true},"showImage":{"type":"boolean","default":true},"showCaption":{"type":"boolean","default":false},"imageShape":{"type":"string","default":"landscape"},"minHeight":{"type":"integer","default":0},"moreButton":{"type":"boolean","default":false},"moreButtonText":{"type":"string","default":""},"showAuthor":{"type":"boolean","default":true},"showAvatar":{"type":"boolean","default":true},"showCategory":{"type":"boolean","default":false},"postLayout":{"type":"string","default":"list"},"columns":{"type":"integer","default":3},"postsToShow":{"type":"integer","default":3},"mediaPosition":{"type":"string","default":"top"},"authors":{"type":"array","default":[],"items":{"type":"integer"}},"categories":{"type":"array","default":[],"items":{"type":"integer"}},"tags":{"type":"array","default":[],"items":{"type":"integer"}},"tagExclusions":{"type":"array","default":[],"items":{"type":"integer"}},"specificPosts":{"type":"array","default":[],"items":{"type":"integer"}},"typeScale":{"type":"integer","default":4},"imageScale":{"type":"integer","default":3},"mobileStack":{"type":"boolean","default":false},"sectionHeader":{"type":"string","default":""},"specificMode":{"type":"boolean","default":false},"textColor":{"type":"string","default":""},"customTextColor":{"type":"string","default":""},"singleMode":{"type":"boolean","default":false}}}')},function(e,t,n){var o=n(3);function c(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}e.exports=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?c(Object(n),!0).forEach((function(t){o(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):c(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}},function(e,t){function n(){return e.exports=n=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},n.apply(this,arguments)}e.exports=n},function(e,t,n){var o;!function(){"use strict";var n={}.hasOwnProperty;function c(){for(var e=[],t=0;t<arguments.length;t++){var o=arguments[t];if(o){var a=typeof o;if("string"===a||"number"===a)e.push(o);else if(Array.isArray(o)&&o.length){var r=c.apply(null,o);r&&e.push(r)}else if("object"===a)for(var s in o)n.call(o,s)&&o[s]&&e.push(s)}}return e.join(" ")}e.exports?(c.default=c,e.exports=c):void 0===(o=function(){return c}.apply(t,[]))||(e.exports=o)}()},function(e,t){!function(){e.exports=this.moment}()},function(e,t){!function(){e.exports=this.wp.data}()},function(e,t){!function(){e.exports=this.wp.compose}()},function(e,t){e.exports=function(e){if(Array.isArray(e)){for(var t=0,n=new Array(e.length);t<e.length;t++)n[t]=e[t];return n}}},function(e,t){e.exports=function(e){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e))return Array.from(e)}},function(e,t){e.exports=function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}},function(e,t){function n(t){return"function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?e.exports=n=function(e){return typeof e}:e.exports=n=function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n(t)}e.exports=n},function(e,t){function n(t,o){return e.exports=n=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},n(t,o)}e.exports=n},function(e,t,n){},function(e,t,n){},function(e,t,n){},function(e,t,n){"use strict";n.r(t);var o=n(19),c=n.n(o),a=n(13),r=n(1),s=n(15),i=n(0),l=n(2),u=n(16),p=n.n(u),b=n(9),h=n.n(b),f=n(17),g=n.n(f),d=n(10),m=n.n(d),w=n(11),O=n.n(w),k=n(4),j=n.n(k),y=n(12),v=n.n(y),_=n(3),E=n.n(_),S=n(20),C=n.n(S),x=n(7),P=n.n(x),A=n(6),T=n(5),M=n(14),H=(n(30),function(e){function t(e){var n;return h()(this,t),(n=m()(this,O()(t).call(this,e))).state={suggestions:[],validValues:{},loading:!1},n.debouncedUpdateSuggestions=Object(M.debounce)(n.updateSuggestions,500),n}return v()(t,e),g()(t,[{key:"componentDidMount",value:function(){var e=this,t=this.props,n=t.tokens,o=t.fetchSavedInfo;n.length&&o&&this.setState({loading:!0},(function(){o(n).then((function(t){var n=e.state.validValues;t.forEach((function(e){n[e.value]=e.label})),e.setState({validValues:n,loading:!1})}))}))}},{key:"componentWillUnmount",value:function(){delete this.suggestionsRequest,this.debouncedUpdateSuggestions.cancel()}},{key:"getLabelsForValues",value:function(e){var t=this.state.validValues;return e.reduce((function(e,n){return t[n]?[].concat(p()(e),[t[n]]):e}),[])}},{key:"getValuesForLabels",value:function(e){var t=this.state.validValues;return e.map((function(e){return Object.keys(t).find((function(n){return t[n]===e}))}))}},{key:"updateSuggestions",value:function(e){var t=this,n=this.props.fetchSuggestions;n&&this.setState({loading:!0},(function(){var o=n(e);o.then((function(e){if(t.suggestionsRequest===o){var n=t.state.validValues,c=[];e.forEach((function(e){c.push(e.label),n[e.value]=e.label})),t.setState({suggestions:c,validValues:n,loading:!1})}})).catch((function(){t.suggestionsRequest===o&&t.setState({loading:!1})})),t.suggestionsRequest=o}))}},{key:"handleOnChange",value:function(e){(0,this.props.onChange)(this.getValuesForLabels(e))}},{key:"getTokens",value:function(){var e=this.props.tokens;return this.getLabelsForValues(e)}},{key:"render",value:function(){var e=this,t=this.props.label,n=void 0===t?"":t,o=this.state,c=o.suggestions,a=o.loading;return Object(i.createElement)("div",{className:"autocomplete-tokenfield"},Object(i.createElement)(l.FormTokenField,{value:this.getTokens(),suggestions:c,onChange:function(t){return e.handleOnChange(t)},onInputChange:function(t){return e.debouncedUpdateSuggestions(t)},label:n}),a&&Object(i.createElement)(l.Spinner,null))}}]),t}(i.Component)),V=function(e){function t(){var e,n;h()(this,t);for(var o=arguments.length,c=new Array(o),a=0;a<o;a++)c[a]=arguments[a];return n=m()(this,(e=O()(t)).call.apply(e,[this].concat(c))),E()(j()(n),"state",{showAdvancedFilters:!1}),E()(j()(n),"fetchPostSuggestions",(function(e){return P()({path:Object(A.addQueryArgs)("/wp/v2/search",{search:e,per_page:20,_fields:"id,title",type:"post"})}).then((function(e){return e.map((function(e){return{value:e.id,label:Object(T.decodeEntities)(e.title)||Object(r.__)("(no title)","newspack-blocks")}}))}))})),E()(j()(n),"fetchSavedPosts",(function(e){return P()({path:Object(A.addQueryArgs)("/wp/v2/posts",{per_page:100,include:e.join(","),_fields:"id,title"})}).then((function(e){return e.map((function(e){return{value:e.id,label:Object(T.decodeEntities)(e.title.rendered)||Object(r.__)("(no title)","newspack-blocks")}}))}))})),E()(j()(n),"fetchAuthorSuggestions",(function(e){return P()({path:Object(A.addQueryArgs)("/wp/v2/users",{search:e,per_page:20,_fields:"id,name"})}).then((function(e){return e.map((function(e){return{value:e.id,label:Object(T.decodeEntities)(e.name)||Object(r.__)("(no name)","newspack-blocks")}}))}))})),E()(j()(n),"fetchSavedAuthors",(function(e){return P()({path:Object(A.addQueryArgs)("/wp/v2/users",{per_page:100,include:e.join(","),_fields:"id,name"})}).then((function(e){return e.map((function(e){return{value:e.id,label:Object(T.decodeEntities)(e.name)||Object(r.__)("(no name)","newspack-blocks")}}))}))})),E()(j()(n),"fetchCategorySuggestions",(function(e){return P()({path:Object(A.addQueryArgs)("/wp/v2/categories",{search:e,per_page:20,_fields:"id,name",orderby:"count",order:"desc"})}).then((function(e){return e.map((function(e){return{value:e.id,label:Object(T.decodeEntities)(e.name)||Object(r.__)("(no title)","newspack-blocks")}}))}))})),E()(j()(n),"fetchSavedCategories",(function(e){return P()({path:Object(A.addQueryArgs)("/wp/v2/categories",{per_page:100,_fields:"id,name",include:e.join(",")})}).then((function(e){return e.map((function(e){return{value:e.id,label:Object(T.decodeEntities)(e.name)||Object(r.__)("(no title)","newspack-blocks")}}))}))})),E()(j()(n),"fetchTagSuggestions",(function(e){return P()({path:Object(A.addQueryArgs)("/wp/v2/tags",{search:e,per_page:20,_fields:"id,name",orderby:"count",order:"desc"})}).then((function(e){return e.map((function(e){return{value:e.id,label:Object(T.decodeEntities)(e.name)||Object(r.__)("(no title)","newspack-blocks")}}))}))})),E()(j()(n),"fetchSavedTags",(function(e){return P()({path:Object(A.addQueryArgs)("/wp/v2/tags",{per_page:100,_fields:"id,name",include:e.join(",")})}).then((function(e){return e.map((function(e){return{value:e.id,label:Object(T.decodeEntities)(e.name)||Object(r.__)("(no title)","newspack-blocks")}}))}))})),E()(j()(n),"render",(function(){var e=n.props,t=(e.numberOfItems,e.onNumberOfItemsChange,e.specificMode),o=e.onSpecificModeChange,c=e.specificPosts,a=e.onSpecificPostsChange,s=e.authors,u=e.onAuthorsChange,p=e.categories,b=e.onCategoriesChange,h=e.tags,f=e.onTagsChange,g=e.tagExclusions,d=e.onTagExclusionsChange,m=e.enableSpecific,w=n.state.showAdvancedFilters;return[m&&Object(i.createElement)(l.ToggleControl,{key:"specificMode",checked:t,onChange:o,label:Object(r.__)("Choose specific stories","newspack-blocks")}),t&&Object(i.createElement)(H,{key:"posts",tokens:c||[],onChange:a,fetchSuggestions:n.fetchPostSuggestions,fetchSavedInfo:n.fetchSavedPosts,label:Object(r.__)("Posts","newspack-blocks")}),!t&&Object(i.createElement)(l.QueryControls,C()({key:"queryControls"},n.props)),!t&&u&&Object(i.createElement)(H,{key:"authors",tokens:s||[],onChange:u,fetchSuggestions:n.fetchAuthorSuggestions,fetchSavedInfo:n.fetchSavedAuthors,label:Object(r.__)("Authors","newspack-blocks")}),!t&&b&&Object(i.createElement)(H,{key:"categories",tokens:p||[],onChange:b,fetchSuggestions:n.fetchCategorySuggestions,fetchSavedInfo:n.fetchSavedCategories,label:Object(r.__)("Categories","newspack-blocks")}),!t&&f&&Object(i.createElement)(H,{key:"tags",tokens:h||[],onChange:f,fetchSuggestions:n.fetchTagSuggestions,fetchSavedInfo:n.fetchSavedTags,label:Object(r.__)("Tags","newspack-blocks")}),!t&&d&&Object(i.createElement)("p",null,Object(i.createElement)(l.Button,{key:"toggle-advanced-filters",isLink:!0,onClick:function(){return n.setState({showAdvancedFilters:!w})}},w?Object(r.__)("Hide Advanced Filters","newspack-blocks"):Object(r.__)("Show Advanced Filters","newspack-blocks"))),!t&&d&&w&&Object(i.createElement)(H,{key:"tag-exclusion",tokens:g||[],onChange:d,fetchSuggestions:n.fetchTagSuggestions,fetchSavedInfo:n.fetchSavedTags,label:Object(r.__)("Excluded Tags","newspack-blocks")})]})),n}return v()(t,e),t}(i.Component);V.defaultProps={enableSpecific:!0,specificPosts:[],authors:[],categories:[],tags:[],tagExclusions:[]};var B=V,N=n(21),z=n.n(N),I=n(22),F=n.n(I),L=n(8),R=n(23),D=n(24),q=6,Q=Object(i.createElement)(l.SVG,{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24"},Object(i.createElement)(l.Path,{d:"M0 0h24v24H0z",fill:"none"}),Object(i.createElement)(l.Path,{d:"M19 5H5c-1.1 0-2 .9-2 2v10c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2zm0 12H5V7h14v10z"})),G=Object(i.createElement)(l.SVG,{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24"},Object(i.createElement)(l.Path,{d:"M0 0h24v24H0z",fill:"none"}),Object(i.createElement)(l.Path,{d:"M17 3H7c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h10c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm0 16H7V5h10v14z"})),U=Object(i.createElement)(l.SVG,{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24"},Object(i.createElement)(l.Path,{d:"M0 0h24v24H0z",fill:"none"}),Object(i.createElement)(l.Path,{d:"M18 4H6c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm0 14H6V6h12v12z"})),W=Object(i.createElement)(l.SVG,{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24"},Object(i.createElement)(l.Path,{d:"M0 0h24v24H0z",fill:"none"}),Object(i.createElement)(l.Path,{d:"M3 5v4h2V5h4V3H5c-1.1 0-2 .9-2 2zm2 10H3v4c0 1.1.9 2 2 2h4v-2H5v-4zm14 4h-4v2h4c1.1 0 2-.9 2-2v-4h-2v4zm0-16h-4v2h4v4h2V5c0-1.1-.9-2-2-2z"})),J=Object(i.createElement)(l.SVG,{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24"},Object(i.createElement)(l.Path,{d:"M0 0h24v24H0z",fill:"none"}),Object(i.createElement)(l.Path,{d:"M4 4h7V2H4c-1.1 0-2 .9-2 2v7h2V4zm6 9l-4 5h12l-3-4-2.03 2.71L10 13zm7-4.5c0-.83-.67-1.5-1.5-1.5S14 7.67 14 8.5s.67 1.5 1.5 1.5S17 9.33 17 8.5zM20 2h-7v2h7v7h2V4c0-1.1-.9-2-2-2zm0 18h-7v2h7c1.1 0 2-.9 2-2v-7h-2v7zM4 13H2v7c0 1.1.9 2 2 2h7v-2H4v-7z"})),X=function(e){function t(){var e,n;h()(this,t);for(var o=arguments.length,c=new Array(o),a=0;a<o;a++)c[a]=arguments[a];return n=m()(this,(e=O()(t)).call.apply(e,[this].concat(c))),E()(j()(n),"renderPost",(function(e){var t=n.props.attributes,o=t.showImage,c=t.imageShape,a=t.mediaPosition,r=t.minHeight,s=t.showCaption,l=t.showExcerpt,u=t.showAuthor,p=t.showAvatar,b=t.showDate,h=t.showCategory,f=t.sectionHeader,g={minHeight:"behind"===a&&o&&e.newspack_featured_image_src&&r+"vh",paddingTop:"behind"===a&&o&&e.newspack_featured_image_src&&r/5+"vh"},d=(e.newspack_author_info.length,n.titleForPost(e));return Object(i.createElement)("article",{className:e.newspack_featured_image_src?"post-has-image":null,key:e.id,style:g},o&&e.newspack_featured_image_src&&Object(i.createElement)("figure",{className:"post-thumbnail",key:"thumbnail"},Object(i.createElement)("a",{href:"#"},"landscape"===c&&Object(i.createElement)("img",{src:e.newspack_featured_image_src.landscape}),"portrait"===c&&Object(i.createElement)("img",{src:e.newspack_featured_image_src.portrait}),"square"===c&&Object(i.createElement)("img",{src:e.newspack_featured_image_src.square}),"uncropped"===c&&Object(i.createElement)("img",{src:e.newspack_featured_image_src.uncropped})),s&&""!==e.newspack_featured_image_caption&&Object(i.createElement)("figcaption",null,e.newspack_featured_image_caption)),Object(i.createElement)("div",{className:"entry-wrapper"},h&&e.newspack_category_info.length&&Object(i.createElement)("div",{className:"cat-links"},Object(i.createElement)("a",{href:"#"},e.newspack_category_info)),L.RichText.isEmpty(f)?Object(i.createElement)("h2",{className:"entry-title",key:"title"},Object(i.createElement)("a",{href:"#"},d)):Object(i.createElement)("h3",{className:"entry-title",key:"title"},Object(i.createElement)("a",{href:"#"},d)),l&&Object(i.createElement)(i.RawHTML,{key:"excerpt",className:"excerpt-contain"},e.excerpt.rendered),Object(i.createElement)("div",{className:"entry-meta"},u&&p&&n.formatAvatars(e.newspack_author_info),u&&n.formatByline(e.newspack_author_info),b&&Object(i.createElement)("time",{className:"entry-date published",key:"pub-date"},F()(e.date_gmt).local().format("MMMM DD, Y")))))})),E()(j()(n),"titleForPost",(function(e){return e.title?"string"==typeof e.title?Object(T.decodeEntities)(e.title.trim()):"object"==typeof e.title&&e.title.rendered?Object(T.decodeEntities)(e.title.rendered.trim()):void 0:""})),E()(j()(n),"formatAvatars",(function(e){return e.map((function(e){return Object(i.createElement)("span",{className:"avatar author-avatar",key:e.id},Object(i.createElement)("a",{className:"url fn n",href:"#"},Object(i.createElement)(i.RawHTML,null,e.avatar)))}))})),E()(j()(n),"formatByline",(function(e){return Object(i.createElement)("span",{className:"byline"},Object(r.__)("by","newspack-blocks")," ",e.reduce((function(t,n,o){return[].concat(p()(t),[Object(i.createElement)("span",{className:"author vcard",key:n.id},Object(i.createElement)("a",{className:"url fn n",href:"#"},n.display_name)),o<e.length-2&&", ",e.length>1&&o===e.length-2&&Object(r.__)(" and ","newspack-blocks")])}),[]))})),E()(j()(n),"renderInspectorControls",(function(){var e=n.props,t=e.attributes,o=e.setAttributes,c=e.latestPosts,a=(e.isSelected,e.textColor),s=e.setTextColor,u=Array.isArray(c)&&c.length,p=t.authors,b=t.specificPosts,h=t.postsToShow,f=t.categories,g=(t.sectionHeader,t.columns),d=t.showImage,m=t.showCaption,w=t.imageScale,O=t.mobileStack,k=t.minHeight,j=t.moreButton,y=(t.moreButtonText,t.showExcerpt),v=t.typeScale,_=t.showDate,E=t.showAuthor,S=t.showAvatar,C=t.showCategory,x=t.postLayout,P=t.mediaPosition,A=t.specificMode,T=t.tags,M=t.tagExclusions,H=(t.url,[{value:1,label:Object(r.__)("Small","newspack-blocks"),shortName:Object(r.__)("S","newspack-blocks")},{value:2,label:Object(r.__)("Medium","newspack-blocks"),shortName:Object(r.__)("M","newspack-blocks")},{value:3,label:Object(r.__)("Large","newspack-blocks"),shortName:Object(r.__)("L","newspack-blocks")},{value:4,label:Object(r.__)("Extra Large","newspack-blocks"),shortName:Object(r.__)("XL","newspack-blocks")}]);return Object(i.createElement)(i.Fragment,null,Object(i.createElement)(l.PanelBody,{title:Object(r.__)("Display Settings","newspack-blocks"),initialOpen:!0},h&&Object(i.createElement)(B,{numberOfItems:h,onNumberOfItemsChange:function(e){return o({postsToShow:e})},specificMode:A,onSpecificModeChange:function(e){return o({specificMode:e})},specificPosts:b,onSpecificPostsChange:function(e){return o({specificPosts:e})},authors:p,onAuthorsChange:function(e){return o({authors:e})},categories:f,onCategoriesChange:function(e){return o({categories:e})},tags:T,onTagsChange:function(e){return o({tags:e})},tagExclusions:M,onTagExclusionsChange:function(e){return o({tagExclusions:e})}}),"grid"===x&&Object(i.createElement)(l.RangeControl,{label:Object(r.__)("Columns","newspack-blocks"),value:g,onChange:function(e){return o({columns:e})},min:2,max:u?Math.min(q,c.length):q,required:!0}),!A&&Object(i.createElement)(l.ToggleControl,{label:Object(r.__)('Show "More" Button',"newspack-blocks"),checked:j,onChange:function(){return o({moreButton:!j})},help:Object(r.__)("Only available for non-AMP requests.","newspack-blocks")})),Object(i.createElement)(l.PanelBody,{title:Object(r.__)("Featured Image Settings","newspack-blocks")},Object(i.createElement)(l.PanelRow,null,Object(i.createElement)(l.ToggleControl,{label:Object(r.__)("Show Featured Image","newspack-blocks"),checked:d,onChange:function(){return o({showImage:!d})}})),d&&Object(i.createElement)(l.PanelRow,null,Object(i.createElement)(l.ToggleControl,{label:Object(r.__)("Show Featured Image Caption","newspack-blocks"),checked:m,onChange:function(){return o({showCaption:!m})}})),d&&"top"!==P&&"behind"!==P&&Object(i.createElement)(i.Fragment,null,Object(i.createElement)(l.PanelRow,null,Object(i.createElement)(l.ToggleControl,{label:Object(r.__)("Stack on mobile","newspack-blocks"),checked:O,onChange:function(){return o({mobileStack:!O})}})),Object(i.createElement)(l.BaseControl,{label:Object(r.__)("Featured Image Size","newspack-blocks")},Object(i.createElement)(l.PanelRow,null,Object(i.createElement)(l.ButtonGroup,{"aria-label":Object(r.__)("Featured Image Size","newspack-blocks")},H.map((function(e){var t=w===e.value;return Object(i.createElement)(l.Button,{isLarge:!0,isPrimary:t,"aria-pressed":t,"aria-label":e.label,key:e.value,onClick:function(){return o({imageScale:e.value})}},e.shortName)})))))),d&&"behind"===P&&Object(i.createElement)(l.RangeControl,{label:Object(r.__)("Minimum height","newspack-blocks"),help:Object(r.__)("Sets a minimum height for the block, using a percentage of the screen's current height.","newspack-blocks"),value:k,onChange:function(e){return o({minHeight:e})},min:0,max:100,required:!0})),Object(i.createElement)(l.PanelBody,{title:Object(r.__)("Post Control Settings","newspack-blocks")},Object(i.createElement)(l.PanelRow,null,Object(i.createElement)(l.ToggleControl,{label:Object(r.__)("Show Excerpt","newspack-blocks"),checked:y,onChange:function(){return o({showExcerpt:!y})}})),Object(i.createElement)(l.RangeControl,{className:"type-scale-slider",label:Object(r.__)("Type Scale","newspack-blocks"),value:v,onChange:function(e){return o({typeScale:e})},min:1,max:10,beforeIcon:"editor-textcolor",afterIcon:"editor-textcolor",required:!0})),Object(i.createElement)(L.PanelColorSettings,{title:Object(r.__)("Color Settings","newspack-blocks"),initialOpen:!0,colorSettings:[{value:a.color,onChange:s,label:Object(r.__)("Text Color","newspack-blocks")}]}),Object(i.createElement)(l.PanelBody,{title:Object(r.__)("Post Meta Settings","newspack-blocks")},Object(i.createElement)(l.PanelRow,null,Object(i.createElement)(l.ToggleControl,{label:Object(r.__)("Show Date","newspack-blocks"),checked:_,onChange:function(){return o({showDate:!_})}})),Object(i.createElement)(l.PanelRow,null,Object(i.createElement)(l.ToggleControl,{label:Object(r.__)("Show Category","newspack-blocks"),checked:C,onChange:function(){return o({showCategory:!C})}})),Object(i.createElement)(l.PanelRow,null,Object(i.createElement)(l.ToggleControl,{label:Object(r.__)("Show Author","newspack-blocks"),checked:E,onChange:function(){return o({showAuthor:!E})}})),E&&Object(i.createElement)(l.PanelRow,null,Object(i.createElement)(l.ToggleControl,{label:Object(r.__)("Show Author Avatar","newspack-blocks"),checked:S,onChange:function(){return o({showAvatar:!S})}}))))})),n}return v()(t,e),g()(t,[{key:"render",value:function(){var e,t=this,n=this.props,o=n.attributes,c=n.className,a=n.setAttributes,s=n.isSelected,u=n.latestPosts,p=(n.hasPosts,n.textColor),b=(o.showExcerpt,o.showDate,o.showImage),h=o.imageShape,f=(o.showAuthor,o.showAvatar,o.postsToShow,o.postLayout),g=o.mediaPosition,d=o.moreButton,m=o.moreButtonText,w=o.columns,O=(o.categories,o.typeScale),k=o.imageScale,j=o.mobileStack,y=o.sectionHeader,v=o.showCaption,_=o.showCategory,S=o.specificMode,C=z()(c,(e={"is-grid":"grid"===f,"show-image":b},E()(e,"columns-".concat(w),"grid"===f),E()(e,"ts-".concat(O),"5"!==O),E()(e,"image-align".concat(g),b),E()(e,"is-".concat(k),"1"!==k&&b),E()(e,"mobile-stack",j),E()(e,"image-shape".concat(h),"landscape"!==h),E()(e,"has-text-color",""!==p.color),E()(e,"show-caption",v),E()(e,"show-category",_),E()(e,"wpnbha",!0),e)),x=[{icon:"list-view",title:Object(r.__)("List View","newspack-blocks"),onClick:function(){return a({postLayout:"list"})},isActive:"list"===f},{icon:"grid-view",title:Object(r.__)("Grid View","newspack-blocks"),onClick:function(){return a({postLayout:"grid"})},isActive:"grid"===f}],P=[{icon:"align-none",title:Object(r.__)("Show media on top","newspack-blocks"),isActive:"top"===g,onClick:function(){return a({mediaPosition:"top"})}},{icon:"align-pull-left",title:Object(r.__)("Show media on left","newspack-blocks"),isActive:"left"===g,onClick:function(){return a({mediaPosition:"left"})}},{icon:"align-pull-right",title:Object(r.__)("Show media on right","newspack-blocks"),isActive:"right"===g,onClick:function(){return a({mediaPosition:"right"})}},{icon:J,title:Object(r.__)("Show media behind","newspack-blocks"),isActive:"behind"===g,onClick:function(){return a({mediaPosition:"behind"})}}],A=[{icon:Q,title:Object(r.__)("Landscape Image Shape","newspack-blocks"),isActive:"landscape"===h,onClick:function(){return a({imageShape:"landscape"})}},{icon:G,title:Object(r.__)("portrait Image Shape","newspack-blocks"),isActive:"portrait"===h,onClick:function(){return a({imageShape:"portrait"})}},{icon:U,title:Object(r.__)("Square Image Shape","newspack-blocks"),isActive:"square"===h,onClick:function(){return a({imageShape:"square"})}},{icon:W,title:Object(r.__)("Uncropped","newspack-blocks"),isActive:"uncropped"===h,onClick:function(){return a({imageShape:"uncropped"})}}];return Object(i.createElement)(i.Fragment,null,Object(i.createElement)("div",{className:C,style:{color:p.color}},Object(i.createElement)("div",null,u&&(!L.RichText.isEmpty(y)||s)&&Object(i.createElement)(L.RichText,{onChange:function(e){return a({sectionHeader:e})},placeholder:Object(r.__)("Write header…","newspack-blocks"),value:y,tagName:"h2",className:"article-section-title"}),u&&!u.length&&Object(i.createElement)(l.Placeholder,null,Object(r.__)("Sorry, no posts were found.","newspack-blocks")),!u&&Object(i.createElement)(l.Placeholder,null,Object(i.createElement)(l.Spinner,null)),u&&u.map((function(e){return t.renderPost(e)})))),!S&&u&&d&&Object(i.createElement)("div",{className:"editor-styles-wrapper"},Object(i.createElement)("div",{className:"wp-block-button"},Object(i.createElement)(L.RichText,{placeholder:Object(r.__)("Load more posts","newspack-blocks"),value:m,onChange:function(e){return a({moreButtonText:e})},className:"wp-block-button__link",keepPlaceholderOnFocus:!0,allowedFormats:[]}))),Object(i.createElement)(L.BlockControls,null,Object(i.createElement)(l.Toolbar,{controls:x}),b&&Object(i.createElement)(l.Toolbar,{controls:P}),b&&Object(i.createElement)(l.Toolbar,{controls:A})),Object(i.createElement)(L.InspectorControls,null,this.renderInspectorControls()))}}]),t}(i.Component),Y=Object(D.compose)([Object(L.withColors)({textColor:"color"}),Object(R.withSelect)((function(e,t){var n=t.attributes,o=n.postsToShow,c=n.authors,a=n.categories,r=n.tags,s=n.tagExclusions,i=n.specificPosts,l=n.specificMode,u=e("core");u.getAuthors;return{latestPosts:(0,u.getEntityRecords)("postType","post",Object(M.pickBy)(l&&i&&i.length?{include:i,orderby:"include"}:{per_page:o,categories:a,author:c,tags:r,tags_exclude:s},(function(e){return!Object(M.isUndefined)(e)})))}}))])(X),K=(n(31),n(32),n(18)),Z=(K.name,K.attributes),$=K.category,ee={title:Object(r.__)("Homepage Posts","newspack-blocks"),icon:Object(i.createElement)(l.SVG,{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24"},Object(i.createElement)(l.Path,{d:"M0 0h24v24H0z",fill:"none"}),Object(i.createElement)(l.Path,{d:"M4 6H2v14c0 1.1.9 2 2 2h14v-2H4V6zm16-4H8c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2zm0 14H8V4h12v12zM10 9h8v2h-8zm0 3h4v2h-4zm0-6h8v2h-8z"})),attributes:Z,category:$,keywords:[Object(r.__)("posts","newspack-blocks"),Object(r.__)("articles","newspack-blocks"),Object(r.__)("latest","newspack-blocks")],description:Object(r.__)("A block for displaying homepage posts.","newspack-blocks"),styles:[{name:"default",label:Object(r._x)("Default","block style","newspack-blocks"),isDefault:!0},{name:"borders",label:Object(r._x)("Borders","block style","newspack-blocks")}],supports:{html:!1,align:["wide","full"],default:""},edit:Y,save:function(){return null},transforms:{from:[{type:"block",blocks:["core/latest-posts"],transform:function(e){var t=e.displayPostContent,n=e.displayPostDate,o=e.postLayout,c=e.columns,r=e.postsToShow,i=e.categories;return Object(a.createBlock)(Object(s.applyFilters)("blocks.transforms_from_name","newspack-blocks/homepage-articles"),{showExcerpt:t,showDate:n,postLayout:o,columns:c,postsToShow:r,showAuthor:!1,categories:i?[i]:[]})}}],to:[{type:"block",blocks:["core/latest-posts"],transform:function(e){var t=e.showExcerpt,n=e.showDate,o=e.postLayout,c=e.columns,r=e.postsToShow,s=e.categories;return Object(a.createBlock)("core/latest-posts",{displayPostContent:t,displayPostDate:n,postLayout:o,columns:c,postsToShow:r,categories:s[0]||""})}}]}},te="a8c/blog-posts";Object(s.addFilter)("blocks.transforms_from_name","set-transformed-block-name",(function(e){return"newspack-blocks/homepage-articles"!==e?e:te})),Object(a.registerBlockType)(te,c()({},ee,{title:Object(r.__)("Blog Posts","full-site-editing"),category:"layout",supports:c()({},ee.supports,{multiple:!1})}))}]));
|
|
|
|
trunk/blog-posts-block/dist/editor.js.LICENSE
DELETED
@@ -1,5 +0,0 @@
|
|
1 |
-
/*!
|
2 |
-
Copyright (c) 2017 Jed Watson.
|
3 |
-
Licensed under the MIT License (MIT), see
|
4 |
-
http://jedwatson.github.io/classnames
|
5 |
-
*/
|
|
|
|
|
|
|
|
|
|
trunk/blog-posts-block/dist/editor.rtl.css
DELETED
@@ -1 +0,0 @@
|
|
1 |
-
.autocomplete-tokenfield{position:relative}.autocomplete-tokenfield .components-spinner{position:absolute;top:2em;left:0}.type-scale-slider .dashicon{height:16px;width:16px}.type-scale-slider input+.dashicon{height:24px;margin-right:10px;margin-left:0;width:24px}.wpnbha .editor-rich-text{width:100%}.wpnbha .cat-links{font-size:.7em}.wpnbha span.avatar{display:inline-block;margin-left:.5em}.wpnbha span.avatar div{display:inline}.wpnbha .excerpt-contain p{margin:.5em 0}.wpnbha{margin-bottom:1em}.wpnbha article{margin-bottom:1.5em;word-break:break-word;overflow-wrap:break-word;position:relative}.wpnbha article:last-of-type{margin-bottom:0}.wpnbha .article-section-title{font-size:.8em;margin-bottom:.5em;width:100%}.wpnbha.is-grid>div{display:flex;flex-wrap:wrap;justify-content:space-between;padding:0;list-style:none}.wpnbha.is-grid article{flex-basis:100%}@media only screen and (min-width:782px){.wpnbha.is-grid article,.wpnbha.is-grid article:last-child{margin-bottom:1em}}@media only screen and (min-width:600px){.wpnbha.columns-3 article,.wpnbha.columns-6 article{flex-basis:calc(33.333% - 16px)}.wpnbha.columns-2 article,.wpnbha.columns-4 article,.wpnbha.columns-5 article{flex-basis:calc(50% - 16px)}.wpnbha.columns-5 article:last-of-type:nth-child(odd){flex-grow:1}}@media only screen and (min-width:782px){.wpnbha.columns-2 article{flex-basis:calc(50% - 16px)}.wpnbha.columns-3 article{flex-basis:calc(33.33333% - 16px)}.wpnbha.columns-4 article{flex-basis:calc(25% - 16px)}.wpnbha.columns-5 article{flex-basis:calc(20% - 16px)}.wpnbha.columns-6 article{flex-basis:calc(16.66667% - 16px)}}.wpnbha .post-thumbnail{margin:0}.wpnbha .post-thumbnail img{height:auto;width:100%}.wpnbha figcaption{font-size:.6em}.wpnbha .post-thumbnail{margin-bottom:.25em}.wpnbha .post-thumbnail figcaption{margin-bottom:.5em}.wpnbha.image-alignleft .post-has-image,.wpnbha.image-alignright .post-has-image{display:flex}.wpnbha.image-alignleft .post-has-image .post-thumbnail,.wpnbha.image-alignright .post-has-image .post-thumbnail{flex-basis:33%}.wpnbha.image-alignleft .post-has-image .entry-wrapper,.wpnbha.image-alignright .post-has-image .entry-wrapper{flex-basis:67%}.wpnbha.image-alignleft.mobile-stack .post-has-image,.wpnbha.image-alignright.mobile-stack .post-has-image{display:block}@media only screen and (min-width:600px){.wpnbha.image-alignleft.mobile-stack .post-has-image,.wpnbha.image-alignright.mobile-stack .post-has-image{display:flex}}@media only screen and (min-width:600px){.wpnbha.image-alignleft.is-4 .post-thumbnail,.wpnbha.image-alignright.is-4 .post-thumbnail{flex-basis:75%}.wpnbha.image-alignleft.is-4 .entry-wrapper,.wpnbha.image-alignright.is-4 .entry-wrapper{flex-basis:25%}.wpnbha.image-alignleft.is-3 .entry-wrapper,.wpnbha.image-alignleft.is-3 .post-thumbnail,.wpnbha.image-alignright.is-3 .entry-wrapper,.wpnbha.image-alignright.is-3 .post-thumbnail{flex-basis:50%}}.wpnbha.image-alignleft.is-1 .post-thumbnail,.wpnbha.image-alignright.is-1 .post-thumbnail{flex-basis:25%}.wpnbha.image-alignleft.is-1 .entry-wrapper,.wpnbha.image-alignright.is-1 .entry-wrapper{flex-basis:75%}.wpnbha.image-alignleft .post-thumbnail{margin-left:1em}.wpnbha.image-alignright .post-thumbnail{margin-right:1em}.wpnbha.image-alignright .entry-wrapper{order:-1}.wpnbha.mobile-stack.image-alignleft .post-thumbnail,.wpnbha.mobile-stack.image-alignright .post-thumbnail{margin-right:0;margin-left:0}@media only screen and (min-width:600px){.wpnbha.mobile-stack.image-alignleft .post-thumbnail{margin-left:1em}.wpnbha.mobile-stack.image-alignright .post-thumbnail{margin-right:1em}}.wpnbha .entry-title{margin:0 0 .25em}.wpnbha .entry-title a{color:inherit;text-decoration:none}.wpnbha .cat-links{font-size:.6em;font-weight:700;margin:0 0 .5em}.wpnbha .cat-links a{text-decoration:none}.wpnbha .cat-links a:hover{text-decoration:underline}.wpnbha .entry-meta{display:flex;flex-wrap:wrap;align-items:center;margin-top:.5em}.wpnbha .entry-meta .byline:not(:last-child){margin-left:1.5em}.wpnbha .entry-meta .updated:not(.published){display:none}.wpnbha .avatar{border-radius:100%;display:block;margin-left:.5em}.wpnbha p{margin:.5em 0}.wpnbha.has-text-color .article-section-title,.wpnbha.has-text-color .cat-links,.wpnbha.has-text-color .cat-links a,.wpnbha.has-text-color .cat-links a:visited,.wpnbha.has-text-color .entry-meta,.wpnbha.has-text-color .entry-meta .byline a,.wpnbha.has-text-color .entry-meta .byline a:visited,.wpnbha.has-text-color .entry-meta a,.wpnbha.has-text-color .entry-title,.wpnbha.has-text-color .entry-title a,.wpnbha.has-text-color .entry-title a:visited,.wpnbha.has-text-color figcaption{color:inherit}.wpnbha.has-text-color .entry-meta span:not(.avatar){opacity:.8}.wpnbha.image-alignbehind .post-has-image{display:flex;align-items:flex-end;position:relative}.wpnbha.image-alignbehind .post-has-image .post-thumbnail{bottom:0;right:0;margin:0;overflow:hidden;position:absolute;left:0;top:0}.wpnbha.image-alignbehind .post-has-image .post-thumbnail img{height:100%;-o-object-fit:cover;object-fit:cover;max-width:1000%;width:100%}.wpnbha.image-alignbehind .post-has-image .post-thumbnail figcaption{bottom:1em;-webkit-box-orient:vertical;color:hsla(0,0%,100%,.9);display:-webkit-box;font-style:italic;right:0;-webkit-line-clamp:1;margin:0;max-height:1.6em;overflow:hidden;padding:0 1em;position:absolute;left:0;text-align:left;text-overflow:ellipsis;z-index:2}.wpnbha.image-alignbehind .post-has-image .post-thumbnail:after{background:rgba(0,0,0,.5);bottom:0;content:"";right:0;position:absolute;left:0;top:0;z-index:1}.wpnbha.image-alignbehind .post-has-image .entry-wrapper{padding:2em;position:relative;z-index:2}.wpnbha.image-alignbehind .post-has-image .cat-links a,.wpnbha.image-alignbehind .post-has-image .entry-meta,.wpnbha.image-alignbehind .post-has-image .entry-meta .byline a,.wpnbha.image-alignbehind .post-has-image .entry-title a,.wpnbha.image-alignbehind .post-has-image .entry-wrapper{color:#fff}.wpnbha article .entry-title{font-size:1.2em}.wpnbha article .entry-meta{font-size:.8em}.wpnbha article .avatar{height:25px;width:25px}@media only screen and (min-width:782px){.wpnbha article .entry-title{font-size:1.6em}.wpnbha article .avatar{height:40px;width:40px}}.wpnbha.ts-8 .entry-title,.wpnbha.ts-9 .entry-title,.wpnbha.ts-10 .entry-title{line-height:1.1em}@media only screen and (min-width:782px){.wpnbha.ts-8 article .avatar,.wpnbha.ts-9 article .avatar,.wpnbha.ts-10 article .avatar{height:2.4em;width:2.4em}}.wpnbha.ts-10 article .entry-title{font-size:2.6em}@media only screen and (min-width:782px){.wpnbha.ts-10 article .entry-title{font-size:3.6em}}@media only screen and (min-width:1168px){.wpnbha.ts-10 article .entry-title{font-size:4.8em}}.wpnbha.ts-9 article .entry-title{font-size:2.4em}@media only screen and (min-width:782px){.wpnbha.ts-9 article .entry-title{font-size:3.4em}}@media only screen and (min-width:1168px){.wpnbha.ts-9 article .entry-title{font-size:4.2em}}.wpnbha.ts-8 article .entry-title{font-size:2.2em}@media only screen and (min-width:782px){.wpnbha.ts-8 article .entry-title{font-size:3em}}@media only screen and (min-width:1168px){.wpnbha.ts-8 article .entry-title{font-size:3.6em}}.wpnbha.ts-7 article .entry-title{font-size:2em}@media only screen and (min-width:782px){.wpnbha.ts-7 article .entry-title{font-size:2.4em}.wpnbha.ts-7 article .avatar{height:48px;width:48px}}@media only screen and (min-width:1168px){.wpnbha.ts-7 article .entry-title{font-size:3em}}.wpnbha.ts-6 article .entry-title{font-size:1.7em}@media only screen and (min-width:782px){.wpnbha.ts-6 article .entry-title{font-size:2em}.wpnbha.ts-6 article .avatar{height:44px;width:44px}}@media only screen and (min-width:1168px){.wpnbha.ts-6 article .entry-title{font-size:2.4em}}.wpnbha.ts-5 article .entry-title{font-size:1.4em}@media only screen and (min-width:782px){.wpnbha.ts-5 article .entry-title{font-size:1.8em}.wpnbha.ts-5 article .avatar{height:40px;width:40px}}@media only screen and (min-width:1168px){.wpnbha.ts-5 article .entry-title{font-size:2em}}.wpnbha.ts-3 article .entry-title{font-size:1em}.wpnbha.ts-3 article .entry-wrapper p{font-size:.8em}.wpnbha.ts-3 article .entry-meta{font-size:.7em}@media only screen and (min-width:782px){.wpnbha.ts-3 article .entry-title{font-size:1.2em}.wpnbha.ts-3 article .avatar{height:32px;width:32px}}.wpnbha.ts-2 article .entry-title{font-size:.8em}.wpnbha.ts-2 article .entry-meta,.wpnbha.ts-2 article .entry-wrapper p{font-size:.7em}@media only screen and (min-width:782px){.wpnbha.ts-2 article .entry-title{font-size:.9em}.wpnbha.ts-2 article .avatar{height:28px;width:28px}}.wpnbha.ts-1 article .entry-title,.wpnbha.ts-1 article .entry-wrapper p{font-size:.7em}.wpnbha.ts-1 article .entry-meta{font-size:.6em}@media only screen and (min-width:782px){.wpnbha.ts-1 article .avatar{height:24px;width:24px}}.wpnbha.is-style-borders article{border:solid rgba(0,0,0,.2);border-width:0 0 1px;margin-bottom:1em;padding-bottom:1em}.wpnbha.is-style-borders article:last-of-type{margin-bottom:0}.wpnbha.is-style-borders article:last-of-type:not(:first-of-type){border-bottom:0}@media only screen and (min-width:782px){.wpnbha.is-style-borders.columns-2 article{padding-left:32px}.wpnbha.is-style-borders.columns-3 article{padding-left:24px}.wpnbha.is-style-borders.columns-4 article{padding-left:21.33333px}.wpnbha.is-style-borders.columns-5 article{padding-left:20px}.wpnbha.is-style-borders.columns-6 article{padding-left:19.2px}.wpnbha.is-style-borders.is-grid article{border-width:0 0 0 1px}.wpnbha.is-style-borders.columns-1 article,.wpnbha.is-style-borders.columns-2 article:nth-of-type(2n),.wpnbha.is-style-borders.columns-3 article:nth-of-type(3n),.wpnbha.is-style-borders.columns-4 article:nth-of-type(4n),.wpnbha.is-style-borders.columns-5 article:nth-of-type(5n),.wpnbha.is-style-borders.columns-6 article:nth-of-type(6n),.wpnbha.is-style-borders.is-grid article:last-of-type{border:0}}
|
|
trunk/blog-posts-block/dist/view.asset.php
DELETED
@@ -1 +0,0 @@
|
|
1 |
-
<?php return array('dependencies' => array('wp-polyfill'), 'version' => '205364fc4e1fe4f20229ec21744b8df1');
|
|
trunk/blog-posts-block/dist/view.css
DELETED
@@ -1 +0,0 @@
|
|
1 |
-
.wpnbha{margin-bottom:1em}.wpnbha article{margin-bottom:1.5em;word-break:break-word;overflow-wrap:break-word;position:relative}.wpnbha article:last-of-type{margin-bottom:0}.wpnbha .article-section-title{font-size:.8em;margin-bottom:.5em;width:100%}.wpnbha.is-grid>div{display:flex;flex-wrap:wrap;justify-content:space-between;padding:0;list-style:none}.wpnbha.is-grid article{flex-basis:100%}@media only screen and (min-width:782px){.wpnbha.is-grid article,.wpnbha.is-grid article:last-child{margin-bottom:1em}}@media only screen and (min-width:600px){.wpnbha.columns-3 article,.wpnbha.columns-6 article{flex-basis:calc(33.333% - 16px)}.wpnbha.columns-2 article,.wpnbha.columns-4 article,.wpnbha.columns-5 article{flex-basis:calc(50% - 16px)}.wpnbha.columns-5 article:last-of-type:nth-child(odd){flex-grow:1}}@media only screen and (min-width:782px){.wpnbha.columns-2 article{flex-basis:calc(50% - 16px)}.wpnbha.columns-3 article{flex-basis:calc(33.33333% - 16px)}.wpnbha.columns-4 article{flex-basis:calc(25% - 16px)}.wpnbha.columns-5 article{flex-basis:calc(20% - 16px)}.wpnbha.columns-6 article{flex-basis:calc(16.66667% - 16px)}}.wpnbha .post-thumbnail{margin:0}.wpnbha .post-thumbnail img{height:auto;width:100%}.wpnbha figcaption{font-size:.6em}.wpnbha .post-thumbnail{margin-bottom:.25em}.wpnbha .post-thumbnail figcaption{margin-bottom:.5em}.wpnbha.image-alignleft .post-has-image,.wpnbha.image-alignright .post-has-image{display:flex}.wpnbha.image-alignleft .post-has-image .post-thumbnail,.wpnbha.image-alignright .post-has-image .post-thumbnail{flex-basis:33%}.wpnbha.image-alignleft .post-has-image .entry-wrapper,.wpnbha.image-alignright .post-has-image .entry-wrapper{flex-basis:67%}.wpnbha.image-alignleft.mobile-stack .post-has-image,.wpnbha.image-alignright.mobile-stack .post-has-image{display:block}@media only screen and (min-width:600px){.wpnbha.image-alignleft.mobile-stack .post-has-image,.wpnbha.image-alignright.mobile-stack .post-has-image{display:flex}}@media only screen and (min-width:600px){.wpnbha.image-alignleft.is-4 .post-thumbnail,.wpnbha.image-alignright.is-4 .post-thumbnail{flex-basis:75%}.wpnbha.image-alignleft.is-4 .entry-wrapper,.wpnbha.image-alignright.is-4 .entry-wrapper{flex-basis:25%}.wpnbha.image-alignleft.is-3 .entry-wrapper,.wpnbha.image-alignleft.is-3 .post-thumbnail,.wpnbha.image-alignright.is-3 .entry-wrapper,.wpnbha.image-alignright.is-3 .post-thumbnail{flex-basis:50%}}.wpnbha.image-alignleft.is-1 .post-thumbnail,.wpnbha.image-alignright.is-1 .post-thumbnail{flex-basis:25%}.wpnbha.image-alignleft.is-1 .entry-wrapper,.wpnbha.image-alignright.is-1 .entry-wrapper{flex-basis:75%}.wpnbha.image-alignleft .post-thumbnail{margin-right:1em}.wpnbha.image-alignright .post-thumbnail{margin-left:1em}.wpnbha.image-alignright .entry-wrapper{order:-1}.wpnbha.mobile-stack.image-alignleft .post-thumbnail,.wpnbha.mobile-stack.image-alignright .post-thumbnail{margin-left:0;margin-right:0}@media only screen and (min-width:600px){.wpnbha.mobile-stack.image-alignleft .post-thumbnail{margin-right:1em}.wpnbha.mobile-stack.image-alignright .post-thumbnail{margin-left:1em}}.wpnbha .entry-title{margin:0 0 .25em}.wpnbha .entry-title a{color:inherit;text-decoration:none}.wpnbha .cat-links{font-size:.6em;font-weight:700;margin:0 0 .5em}.wpnbha .cat-links a{text-decoration:none}.wpnbha .cat-links a:hover{text-decoration:underline}.wpnbha .entry-meta{display:flex;flex-wrap:wrap;align-items:center;margin-top:.5em}.wpnbha .entry-meta .byline:not(:last-child){margin-right:1.5em}.wpnbha .entry-meta .updated:not(.published){display:none}.wpnbha .avatar{border-radius:100%;display:block;margin-right:.5em}.wpnbha p{margin:.5em 0}.wpnbha.has-text-color .article-section-title,.wpnbha.has-text-color .cat-links,.wpnbha.has-text-color .cat-links a,.wpnbha.has-text-color .cat-links a:visited,.wpnbha.has-text-color .entry-meta,.wpnbha.has-text-color .entry-meta .byline a,.wpnbha.has-text-color .entry-meta .byline a:visited,.wpnbha.has-text-color .entry-meta a,.wpnbha.has-text-color .entry-title,.wpnbha.has-text-color .entry-title a,.wpnbha.has-text-color .entry-title a:visited,.wpnbha.has-text-color figcaption{color:inherit}.wpnbha.has-text-color .entry-meta span:not(.avatar){opacity:.8}.wpnbha.image-alignbehind .post-has-image{display:flex;align-items:flex-end;position:relative}.wpnbha.image-alignbehind .post-has-image .post-thumbnail{bottom:0;left:0;margin:0;overflow:hidden;position:absolute;right:0;top:0}.wpnbha.image-alignbehind .post-has-image .post-thumbnail img{height:100%;-o-object-fit:cover;object-fit:cover;max-width:1000%;width:100%}.wpnbha.image-alignbehind .post-has-image .post-thumbnail figcaption{bottom:1em;-webkit-box-orient:vertical;color:hsla(0,0%,100%,.9);display:-webkit-box;font-style:italic;left:0;-webkit-line-clamp:1;margin:0;max-height:1.6em;overflow:hidden;padding:0 1em;position:absolute;right:0;text-align:right;text-overflow:ellipsis;z-index:2}.wpnbha.image-alignbehind .post-has-image .post-thumbnail:after{background:rgba(0,0,0,.5);bottom:0;content:"";left:0;position:absolute;right:0;top:0;z-index:1}.wpnbha.image-alignbehind .post-has-image .entry-wrapper{padding:2em;position:relative;z-index:2}.wpnbha.image-alignbehind .post-has-image .cat-links a,.wpnbha.image-alignbehind .post-has-image .entry-meta,.wpnbha.image-alignbehind .post-has-image .entry-meta .byline a,.wpnbha.image-alignbehind .post-has-image .entry-title a,.wpnbha.image-alignbehind .post-has-image .entry-wrapper{color:#fff}.wpnbha article .entry-title{font-size:1.2em}.wpnbha article .entry-meta{font-size:.8em}.wpnbha article .avatar{height:25px;width:25px}@media only screen and (min-width:782px){.wpnbha article .entry-title{font-size:1.6em}.wpnbha article .avatar{height:40px;width:40px}}.wpnbha.ts-8 .entry-title,.wpnbha.ts-9 .entry-title,.wpnbha.ts-10 .entry-title{line-height:1.1em}@media only screen and (min-width:782px){.wpnbha.ts-8 article .avatar,.wpnbha.ts-9 article .avatar,.wpnbha.ts-10 article .avatar{height:2.4em;width:2.4em}}.wpnbha.ts-10 article .entry-title{font-size:2.6em}@media only screen and (min-width:782px){.wpnbha.ts-10 article .entry-title{font-size:3.6em}}@media only screen and (min-width:1168px){.wpnbha.ts-10 article .entry-title{font-size:4.8em}}.wpnbha.ts-9 article .entry-title{font-size:2.4em}@media only screen and (min-width:782px){.wpnbha.ts-9 article .entry-title{font-size:3.4em}}@media only screen and (min-width:1168px){.wpnbha.ts-9 article .entry-title{font-size:4.2em}}.wpnbha.ts-8 article .entry-title{font-size:2.2em}@media only screen and (min-width:782px){.wpnbha.ts-8 article .entry-title{font-size:3em}}@media only screen and (min-width:1168px){.wpnbha.ts-8 article .entry-title{font-size:3.6em}}.wpnbha.ts-7 article .entry-title{font-size:2em}@media only screen and (min-width:782px){.wpnbha.ts-7 article .entry-title{font-size:2.4em}.wpnbha.ts-7 article .avatar{height:48px;width:48px}}@media only screen and (min-width:1168px){.wpnbha.ts-7 article .entry-title{font-size:3em}}.wpnbha.ts-6 article .entry-title{font-size:1.7em}@media only screen and (min-width:782px){.wpnbha.ts-6 article .entry-title{font-size:2em}.wpnbha.ts-6 article .avatar{height:44px;width:44px}}@media only screen and (min-width:1168px){.wpnbha.ts-6 article .entry-title{font-size:2.4em}}.wpnbha.ts-5 article .entry-title{font-size:1.4em}@media only screen and (min-width:782px){.wpnbha.ts-5 article .entry-title{font-size:1.8em}.wpnbha.ts-5 article .avatar{height:40px;width:40px}}@media only screen and (min-width:1168px){.wpnbha.ts-5 article .entry-title{font-size:2em}}.wpnbha.ts-3 article .entry-title{font-size:1em}.wpnbha.ts-3 article .entry-wrapper p{font-size:.8em}.wpnbha.ts-3 article .entry-meta{font-size:.7em}@media only screen and (min-width:782px){.wpnbha.ts-3 article .entry-title{font-size:1.2em}.wpnbha.ts-3 article .avatar{height:32px;width:32px}}.wpnbha.ts-2 article .entry-title{font-size:.8em}.wpnbha.ts-2 article .entry-meta,.wpnbha.ts-2 article .entry-wrapper p{font-size:.7em}@media only screen and (min-width:782px){.wpnbha.ts-2 article .entry-title{font-size:.9em}.wpnbha.ts-2 article .avatar{height:28px;width:28px}}.wpnbha.ts-1 article .entry-title,.wpnbha.ts-1 article .entry-wrapper p{font-size:.7em}.wpnbha.ts-1 article .entry-meta{font-size:.6em}@media only screen and (min-width:782px){.wpnbha.ts-1 article .avatar{height:24px;width:24px}}.wpnbha.is-style-borders article{border:solid rgba(0,0,0,.2);border-width:0 0 1px;margin-bottom:1em;padding-bottom:1em}.wpnbha.is-style-borders article:last-of-type{margin-bottom:0}.wpnbha.is-style-borders article:last-of-type:not(:first-of-type){border-bottom:0}@media only screen and (min-width:782px){.wpnbha.is-style-borders.columns-2 article{padding-right:32px}.wpnbha.is-style-borders.columns-3 article{padding-right:24px}.wpnbha.is-style-borders.columns-4 article{padding-right:21.33333px}.wpnbha.is-style-borders.columns-5 article{padding-right:20px}.wpnbha.is-style-borders.columns-6 article{padding-right:19.2px}.wpnbha.is-style-borders.is-grid article{border-width:0 1px 0 0}.wpnbha.is-style-borders.columns-1 article,.wpnbha.is-style-borders.columns-2 article:nth-of-type(2n),.wpnbha.is-style-borders.columns-3 article:nth-of-type(3n),.wpnbha.is-style-borders.columns-4 article:nth-of-type(4n),.wpnbha.is-style-borders.columns-5 article:nth-of-type(5n),.wpnbha.is-style-borders.columns-6 article:nth-of-type(6n),.wpnbha.is-style-borders.is-grid article:last-of-type{border:0}}
|
|
trunk/blog-posts-block/dist/view.js
DELETED
@@ -1 +0,0 @@
|
|
1 |
-
!function(t,e){for(var r in e)t[r]=e[r]}(window,function(t){var e={};function r(n){if(e[n])return e[n].exports;var o=e[n]={i:n,l:!1,exports:{}};return t[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}return r.m=t,r.c=e,r.d=function(t,e,n){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,e){if(1&e&&(t=r(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)r.d(n,o,function(e){return t[e]}.bind(null,o));return n},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="",r(r.s=5)}([function(t,e,r){var n=r(1),o=r(2),i=r(3);t.exports=function(t){return n(t)||o(t)||i()}},function(t,e){t.exports=function(t){if(Array.isArray(t)){for(var e=0,r=new Array(t.length);e<t.length;e++)r[e]=t[e];return r}}},function(t,e){t.exports=function(t){if(Symbol.iterator in Object(t)||"[object Arguments]"===Object.prototype.toString.call(t))return Array.from(t)}},function(t,e){t.exports=function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}},function(t,e,r){},function(t,e,r){"use strict";r.r(e);var n=r(0),o=r.n(n),i=(r(4),"data-load-more-url"),u=3;function a(t){t.style.display="none",t.setAttribute("hidden","")}function c(t){t.style.display="",t.removeAttribute("hidden")}function l(t,e){return Object.prototype.hasOwnProperty.call(t,e)}document.querySelectorAll("[data-load-more-btn]").forEach((function(t){if(!t)return null;var e=function(t){var e=t.parentElement,r=e.querySelector("[data-posts-container]"),n=e.querySelector("[data-load-more-loading-text]"),f=e.querySelector("[data-load-more-error-text]"),s=!1,d=!1;return function(){if(s||d)return!1;s=!0,a(t),a(f),c(n);var e,p,y=new URL(t.getAttribute(i));function m(){s=!1,a(n),c(f),c(t)}y.searchParams.set("exclude_ids",(e=document.querySelectorAll("article[data-post-id]"),p=Array.from(e).map((function(t){return t.getAttribute("data-post-id")})),o()(new Set(p))).join(",")),function t(e,r){var n=new XMLHttpRequest;n.onreadystatechange=function(){if(4===n.readyState){if(n.status>=200&&n.status<300){var o=JSON.parse(n.responseText);return e.onSuccess(o)}return r?t(e,r-1):e.onError()}},n.open("GET",e.url),n.send()}({url:y.toString(),onSuccess:function(e){if(!function(t){var e=!1;t&&l(t,"items")&&Array.isArray(t.items)&&l(t,"next")&&"string"==typeof t.next&&(e=!0,!t.items.length||l(t.items[0],"html")&&"string"==typeof t.items[0].html||(e=!1));return e}(e))return m();if(e.items.length){var o=e.items.map((function(t){return t.html})).join("");r.insertAdjacentHTML("beforeend",o)}e.next&&(t.setAttribute(i,e.next),c(t));e.items.length&&e.next||(d=!0);s=!1,a(n)},onError:m},u)}}(t);t.addEventListener("click",e)}))}]));
|
|
trunk/blog-posts-block/dist/view.rtl.css
DELETED
@@ -1 +0,0 @@
|
|
1 |
-
.wpnbha{margin-bottom:1em}.wpnbha article{margin-bottom:1.5em;word-break:break-word;overflow-wrap:break-word;position:relative}.wpnbha article:last-of-type{margin-bottom:0}.wpnbha .article-section-title{font-size:.8em;margin-bottom:.5em;width:100%}.wpnbha.is-grid>div{display:flex;flex-wrap:wrap;justify-content:space-between;padding:0;list-style:none}.wpnbha.is-grid article{flex-basis:100%}@media only screen and (min-width:782px){.wpnbha.is-grid article,.wpnbha.is-grid article:last-child{margin-bottom:1em}}@media only screen and (min-width:600px){.wpnbha.columns-3 article,.wpnbha.columns-6 article{flex-basis:calc(33.333% - 16px)}.wpnbha.columns-2 article,.wpnbha.columns-4 article,.wpnbha.columns-5 article{flex-basis:calc(50% - 16px)}.wpnbha.columns-5 article:last-of-type:nth-child(odd){flex-grow:1}}@media only screen and (min-width:782px){.wpnbha.columns-2 article{flex-basis:calc(50% - 16px)}.wpnbha.columns-3 article{flex-basis:calc(33.33333% - 16px)}.wpnbha.columns-4 article{flex-basis:calc(25% - 16px)}.wpnbha.columns-5 article{flex-basis:calc(20% - 16px)}.wpnbha.columns-6 article{flex-basis:calc(16.66667% - 16px)}}.wpnbha .post-thumbnail{margin:0}.wpnbha .post-thumbnail img{height:auto;width:100%}.wpnbha figcaption{font-size:.6em}.wpnbha .post-thumbnail{margin-bottom:.25em}.wpnbha .post-thumbnail figcaption{margin-bottom:.5em}.wpnbha.image-alignleft .post-has-image,.wpnbha.image-alignright .post-has-image{display:flex}.wpnbha.image-alignleft .post-has-image .post-thumbnail,.wpnbha.image-alignright .post-has-image .post-thumbnail{flex-basis:33%}.wpnbha.image-alignleft .post-has-image .entry-wrapper,.wpnbha.image-alignright .post-has-image .entry-wrapper{flex-basis:67%}.wpnbha.image-alignleft.mobile-stack .post-has-image,.wpnbha.image-alignright.mobile-stack .post-has-image{display:block}@media only screen and (min-width:600px){.wpnbha.image-alignleft.mobile-stack .post-has-image,.wpnbha.image-alignright.mobile-stack .post-has-image{display:flex}}@media only screen and (min-width:600px){.wpnbha.image-alignleft.is-4 .post-thumbnail,.wpnbha.image-alignright.is-4 .post-thumbnail{flex-basis:75%}.wpnbha.image-alignleft.is-4 .entry-wrapper,.wpnbha.image-alignright.is-4 .entry-wrapper{flex-basis:25%}.wpnbha.image-alignleft.is-3 .entry-wrapper,.wpnbha.image-alignleft.is-3 .post-thumbnail,.wpnbha.image-alignright.is-3 .entry-wrapper,.wpnbha.image-alignright.is-3 .post-thumbnail{flex-basis:50%}}.wpnbha.image-alignleft.is-1 .post-thumbnail,.wpnbha.image-alignright.is-1 .post-thumbnail{flex-basis:25%}.wpnbha.image-alignleft.is-1 .entry-wrapper,.wpnbha.image-alignright.is-1 .entry-wrapper{flex-basis:75%}.wpnbha.image-alignleft .post-thumbnail{margin-left:1em}.wpnbha.image-alignright .post-thumbnail{margin-right:1em}.wpnbha.image-alignright .entry-wrapper{order:-1}.wpnbha.mobile-stack.image-alignleft .post-thumbnail,.wpnbha.mobile-stack.image-alignright .post-thumbnail{margin-right:0;margin-left:0}@media only screen and (min-width:600px){.wpnbha.mobile-stack.image-alignleft .post-thumbnail{margin-left:1em}.wpnbha.mobile-stack.image-alignright .post-thumbnail{margin-right:1em}}.wpnbha .entry-title{margin:0 0 .25em}.wpnbha .entry-title a{color:inherit;text-decoration:none}.wpnbha .cat-links{font-size:.6em;font-weight:700;margin:0 0 .5em}.wpnbha .cat-links a{text-decoration:none}.wpnbha .cat-links a:hover{text-decoration:underline}.wpnbha .entry-meta{display:flex;flex-wrap:wrap;align-items:center;margin-top:.5em}.wpnbha .entry-meta .byline:not(:last-child){margin-left:1.5em}.wpnbha .entry-meta .updated:not(.published){display:none}.wpnbha .avatar{border-radius:100%;display:block;margin-left:.5em}.wpnbha p{margin:.5em 0}.wpnbha.has-text-color .article-section-title,.wpnbha.has-text-color .cat-links,.wpnbha.has-text-color .cat-links a,.wpnbha.has-text-color .cat-links a:visited,.wpnbha.has-text-color .entry-meta,.wpnbha.has-text-color .entry-meta .byline a,.wpnbha.has-text-color .entry-meta .byline a:visited,.wpnbha.has-text-color .entry-meta a,.wpnbha.has-text-color .entry-title,.wpnbha.has-text-color .entry-title a,.wpnbha.has-text-color .entry-title a:visited,.wpnbha.has-text-color figcaption{color:inherit}.wpnbha.has-text-color .entry-meta span:not(.avatar){opacity:.8}.wpnbha.image-alignbehind .post-has-image{display:flex;align-items:flex-end;position:relative}.wpnbha.image-alignbehind .post-has-image .post-thumbnail{bottom:0;right:0;margin:0;overflow:hidden;position:absolute;left:0;top:0}.wpnbha.image-alignbehind .post-has-image .post-thumbnail img{height:100%;-o-object-fit:cover;object-fit:cover;max-width:1000%;width:100%}.wpnbha.image-alignbehind .post-has-image .post-thumbnail figcaption{bottom:1em;-webkit-box-orient:vertical;color:hsla(0,0%,100%,.9);display:-webkit-box;font-style:italic;right:0;-webkit-line-clamp:1;margin:0;max-height:1.6em;overflow:hidden;padding:0 1em;position:absolute;left:0;text-align:left;text-overflow:ellipsis;z-index:2}.wpnbha.image-alignbehind .post-has-image .post-thumbnail:after{background:rgba(0,0,0,.5);bottom:0;content:"";right:0;position:absolute;left:0;top:0;z-index:1}.wpnbha.image-alignbehind .post-has-image .entry-wrapper{padding:2em;position:relative;z-index:2}.wpnbha.image-alignbehind .post-has-image .cat-links a,.wpnbha.image-alignbehind .post-has-image .entry-meta,.wpnbha.image-alignbehind .post-has-image .entry-meta .byline a,.wpnbha.image-alignbehind .post-has-image .entry-title a,.wpnbha.image-alignbehind .post-has-image .entry-wrapper{color:#fff}.wpnbha article .entry-title{font-size:1.2em}.wpnbha article .entry-meta{font-size:.8em}.wpnbha article .avatar{height:25px;width:25px}@media only screen and (min-width:782px){.wpnbha article .entry-title{font-size:1.6em}.wpnbha article .avatar{height:40px;width:40px}}.wpnbha.ts-8 .entry-title,.wpnbha.ts-9 .entry-title,.wpnbha.ts-10 .entry-title{line-height:1.1em}@media only screen and (min-width:782px){.wpnbha.ts-8 article .avatar,.wpnbha.ts-9 article .avatar,.wpnbha.ts-10 article .avatar{height:2.4em;width:2.4em}}.wpnbha.ts-10 article .entry-title{font-size:2.6em}@media only screen and (min-width:782px){.wpnbha.ts-10 article .entry-title{font-size:3.6em}}@media only screen and (min-width:1168px){.wpnbha.ts-10 article .entry-title{font-size:4.8em}}.wpnbha.ts-9 article .entry-title{font-size:2.4em}@media only screen and (min-width:782px){.wpnbha.ts-9 article .entry-title{font-size:3.4em}}@media only screen and (min-width:1168px){.wpnbha.ts-9 article .entry-title{font-size:4.2em}}.wpnbha.ts-8 article .entry-title{font-size:2.2em}@media only screen and (min-width:782px){.wpnbha.ts-8 article .entry-title{font-size:3em}}@media only screen and (min-width:1168px){.wpnbha.ts-8 article .entry-title{font-size:3.6em}}.wpnbha.ts-7 article .entry-title{font-size:2em}@media only screen and (min-width:782px){.wpnbha.ts-7 article .entry-title{font-size:2.4em}.wpnbha.ts-7 article .avatar{height:48px;width:48px}}@media only screen and (min-width:1168px){.wpnbha.ts-7 article .entry-title{font-size:3em}}.wpnbha.ts-6 article .entry-title{font-size:1.7em}@media only screen and (min-width:782px){.wpnbha.ts-6 article .entry-title{font-size:2em}.wpnbha.ts-6 article .avatar{height:44px;width:44px}}@media only screen and (min-width:1168px){.wpnbha.ts-6 article .entry-title{font-size:2.4em}}.wpnbha.ts-5 article .entry-title{font-size:1.4em}@media only screen and (min-width:782px){.wpnbha.ts-5 article .entry-title{font-size:1.8em}.wpnbha.ts-5 article .avatar{height:40px;width:40px}}@media only screen and (min-width:1168px){.wpnbha.ts-5 article .entry-title{font-size:2em}}.wpnbha.ts-3 article .entry-title{font-size:1em}.wpnbha.ts-3 article .entry-wrapper p{font-size:.8em}.wpnbha.ts-3 article .entry-meta{font-size:.7em}@media only screen and (min-width:782px){.wpnbha.ts-3 article .entry-title{font-size:1.2em}.wpnbha.ts-3 article .avatar{height:32px;width:32px}}.wpnbha.ts-2 article .entry-title{font-size:.8em}.wpnbha.ts-2 article .entry-meta,.wpnbha.ts-2 article .entry-wrapper p{font-size:.7em}@media only screen and (min-width:782px){.wpnbha.ts-2 article .entry-title{font-size:.9em}.wpnbha.ts-2 article .avatar{height:28px;width:28px}}.wpnbha.ts-1 article .entry-title,.wpnbha.ts-1 article .entry-wrapper p{font-size:.7em}.wpnbha.ts-1 article .entry-meta{font-size:.6em}@media only screen and (min-width:782px){.wpnbha.ts-1 article .avatar{height:24px;width:24px}}.wpnbha.is-style-borders article{border:solid rgba(0,0,0,.2);border-width:0 0 1px;margin-bottom:1em;padding-bottom:1em}.wpnbha.is-style-borders article:last-of-type{margin-bottom:0}.wpnbha.is-style-borders article:last-of-type:not(:first-of-type){border-bottom:0}@media only screen and (min-width:782px){.wpnbha.is-style-borders.columns-2 article{padding-left:32px}.wpnbha.is-style-borders.columns-3 article{padding-left:24px}.wpnbha.is-style-borders.columns-4 article{padding-left:21.33333px}.wpnbha.is-style-borders.columns-5 article{padding-left:20px}.wpnbha.is-style-borders.columns-6 article{padding-left:19.2px}.wpnbha.is-style-borders.is-grid article{border-width:0 0 0 1px}.wpnbha.is-style-borders.columns-1 article,.wpnbha.is-style-borders.columns-2 article:nth-of-type(2n),.wpnbha.is-style-borders.columns-3 article:nth-of-type(3n),.wpnbha.is-style-borders.columns-4 article:nth-of-type(4n),.wpnbha.is-style-borders.columns-5 article:nth-of-type(5n),.wpnbha.is-style-borders.columns-6 article:nth-of-type(6n),.wpnbha.is-style-borders.is-grid article:last-of-type{border:0}}
|
|
trunk/blog-posts-block/editor.js
DELETED
@@ -1,38 +0,0 @@
|
|
1 |
-
/* eslint-disable import/no-extraneous-dependencies */
|
2 |
-
/**
|
3 |
-
* Internal dependencies
|
4 |
-
*/
|
5 |
-
import { registerBlockType } from '@wordpress/blocks';
|
6 |
-
import { __ } from '@wordpress/i18n';
|
7 |
-
import { addFilter } from '@wordpress/hooks';
|
8 |
-
/* eslint-enable import/no-extraneous-dependencies */
|
9 |
-
|
10 |
-
/**
|
11 |
-
* NHA dependencies
|
12 |
-
*/
|
13 |
-
import { settings } from './newspack-homepage-articles/blocks/homepage-articles/index';
|
14 |
-
|
15 |
-
/**
|
16 |
-
* Block name in the A8C\FSE context.
|
17 |
-
*/
|
18 |
-
const blockName = 'a8c/blog-posts';
|
19 |
-
|
20 |
-
function setBlockTransformationName( name ) {
|
21 |
-
return name !== 'newspack-blocks/homepage-articles' ? name : blockName;
|
22 |
-
}
|
23 |
-
|
24 |
-
addFilter(
|
25 |
-
'blocks.transforms_from_name',
|
26 |
-
'set-transformed-block-name',
|
27 |
-
setBlockTransformationName
|
28 |
-
);
|
29 |
-
|
30 |
-
registerBlockType( blockName, {
|
31 |
-
...settings,
|
32 |
-
title: __( 'Blog Posts', 'full-site-editing' ),
|
33 |
-
category: 'layout',
|
34 |
-
supports: {
|
35 |
-
...settings.supports,
|
36 |
-
multiple: false,
|
37 |
-
},
|
38 |
-
} );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/blog-posts-block/index.php
DELETED
@@ -1,92 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Blog posts file.
|
4 |
-
*
|
5 |
-
* @package A8C\FSE
|
6 |
-
*/
|
7 |
-
|
8 |
-
namespace A8C\FSE;
|
9 |
-
|
10 |
-
define( 'NEWSPACK_BLOCKS__BLOCKS_DIRECTORY', 'dist/' );
|
11 |
-
define( 'NEWSPACK_BLOCKS__PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
|
12 |
-
define( 'NEWSPACK_BLOCKS__VERSION', '1.0.0-alpha.20' );
|
13 |
-
|
14 |
-
/**
|
15 |
-
* Filters block name.
|
16 |
-
*
|
17 |
-
* @param string $name Block name.
|
18 |
-
* @return string
|
19 |
-
*/
|
20 |
-
function blog_posts_block_name( $name ) {
|
21 |
-
if ( 'newspack-blocks/homepage-articles' === $name ) {
|
22 |
-
return 'a8c/blog-posts';
|
23 |
-
}
|
24 |
-
return $name;
|
25 |
-
}
|
26 |
-
add_filter( 'newspack_blocks_block_name', __NAMESPACE__ . '\blog_posts_block_name' );
|
27 |
-
|
28 |
-
/**
|
29 |
-
* Filters block arguments for `register_block_type()`.
|
30 |
-
*
|
31 |
-
* @param array $args Arguments to `register_block_type()`.
|
32 |
-
* @param string $name Block name.
|
33 |
-
* @return array
|
34 |
-
*/
|
35 |
-
function blog_posts_block_args( $args, $name ) {
|
36 |
-
if ( 'homepage-articles' !== $name ) {
|
37 |
-
return $args;
|
38 |
-
}
|
39 |
-
|
40 |
-
// Editor script.
|
41 |
-
$script_data = require NEWSPACK_BLOCKS__BLOCKS_DIRECTORY . 'editor.asset.php';
|
42 |
-
wp_register_script(
|
43 |
-
'blog-posts-block-editor',
|
44 |
-
plugins_url( NEWSPACK_BLOCKS__BLOCKS_DIRECTORY . 'editor.js', __FILE__ ),
|
45 |
-
$script_data['dependencies'],
|
46 |
-
$script_data['version'],
|
47 |
-
true
|
48 |
-
);
|
49 |
-
|
50 |
-
// Editor style.
|
51 |
-
$editor_style = plugins_url( NEWSPACK_BLOCKS__BLOCKS_DIRECTORY . 'editor.css', __FILE__ );
|
52 |
-
wp_register_style( 'blog-posts-block-editor', $editor_style, array(), NEWSPACK_BLOCKS__VERSION );
|
53 |
-
|
54 |
-
// View script.
|
55 |
-
$script_data = require NEWSPACK_BLOCKS__BLOCKS_DIRECTORY . 'view.asset.php';
|
56 |
-
wp_register_script(
|
57 |
-
'blog-posts-block-view',
|
58 |
-
plugins_url( NEWSPACK_BLOCKS__BLOCKS_DIRECTORY . 'view.js', __FILE__ ),
|
59 |
-
$script_data['dependencies'],
|
60 |
-
$script_data['version'],
|
61 |
-
true
|
62 |
-
);
|
63 |
-
|
64 |
-
// View style.
|
65 |
-
$editor_style = plugins_url( NEWSPACK_BLOCKS__BLOCKS_DIRECTORY . 'view.css', __FILE__ );
|
66 |
-
wp_register_style( 'blog-posts-block-view', $editor_style, array(), NEWSPACK_BLOCKS__VERSION );
|
67 |
-
|
68 |
-
$args['editor_script'] = 'blog-posts-block-editor';
|
69 |
-
$args['editor_style'] = 'blog-posts-block-editor';
|
70 |
-
$args['script'] = 'blog-posts-block-view';
|
71 |
-
$args['style'] = 'blog-posts-block-view';
|
72 |
-
|
73 |
-
return $args;
|
74 |
-
}
|
75 |
-
add_filter( 'newspack_blocks_block_args', __NAMESPACE__ . '\blog_posts_block_args', 10, 2 );
|
76 |
-
|
77 |
-
require_once __DIR__ . '/newspack-homepage-articles/class-newspack-blocks.php';
|
78 |
-
require_once __DIR__ . '/newspack-homepage-articles/class-newspack-blocks-api.php';
|
79 |
-
|
80 |
-
require_once __DIR__ . '/newspack-homepage-articles/blocks/homepage-articles/view.php';
|
81 |
-
|
82 |
-
// REST Controller for Articles Block.
|
83 |
-
require_once NEWSPACK_BLOCKS__PLUGIN_DIR . 'newspack-homepage-articles/blocks/homepage-articles/class-wp-rest-newspack-articles-controller.php';
|
84 |
-
|
85 |
-
/**
|
86 |
-
* Registers Articles block routes.
|
87 |
-
*/
|
88 |
-
function register_rest_routes() {
|
89 |
-
$articles_controller = new \WP_REST_Newspack_Articles_Controller();
|
90 |
-
$articles_controller->register_routes();
|
91 |
-
}
|
92 |
-
add_action( 'rest_api_init', __NAMESPACE__ . '\register_rest_routes' );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/blog-posts-block/newspack-homepage-articles/README.md
DELETED
@@ -1,5 +0,0 @@
|
|
1 |
-
# Newspack Homepage Articles
|
2 |
-
|
3 |
-
This folder is synchronized from [Newspack Blocks repository](https://github.com/automattic/newspack-blocks) where the original code lives.
|
4 |
-
|
5 |
-
Please don't make any changes to these files directly but rather open a PR in the original repository and once landed there, use the sync script.
|
|
|
|
|
|
|
|
|
|
trunk/blog-posts-block/newspack-homepage-articles/blocks/homepage-articles/block.json
DELETED
@@ -1,127 +0,0 @@
|
|
1 |
-
{
|
2 |
-
"name": "homepage-articles",
|
3 |
-
"category": "newspack",
|
4 |
-
"attributes": {
|
5 |
-
"className": {
|
6 |
-
"type": "string",
|
7 |
-
"default": ""
|
8 |
-
},
|
9 |
-
"showExcerpt": {
|
10 |
-
"type": "boolean",
|
11 |
-
"default": true
|
12 |
-
},
|
13 |
-
"showDate": {
|
14 |
-
"type": "boolean",
|
15 |
-
"default": true
|
16 |
-
},
|
17 |
-
"showImage": {
|
18 |
-
"type": "boolean",
|
19 |
-
"default": true
|
20 |
-
},
|
21 |
-
"showCaption": {
|
22 |
-
"type": "boolean",
|
23 |
-
"default": false
|
24 |
-
},
|
25 |
-
"imageShape": {
|
26 |
-
"type": "string",
|
27 |
-
"default": "landscape"
|
28 |
-
},
|
29 |
-
"minHeight": {
|
30 |
-
"type": "integer",
|
31 |
-
"default": 0
|
32 |
-
},
|
33 |
-
"moreButton": {
|
34 |
-
"type": "boolean",
|
35 |
-
"default": false
|
36 |
-
},
|
37 |
-
"moreButtonText": {
|
38 |
-
"type": "string",
|
39 |
-
"default": ""
|
40 |
-
},
|
41 |
-
"showAuthor": {
|
42 |
-
"type": "boolean",
|
43 |
-
"default": true
|
44 |
-
},
|
45 |
-
"showAvatar": {
|
46 |
-
"type": "boolean",
|
47 |
-
"default": true
|
48 |
-
},
|
49 |
-
"showCategory": {
|
50 |
-
"type": "boolean",
|
51 |
-
"default": false
|
52 |
-
},
|
53 |
-
"postLayout": {
|
54 |
-
"type": "string",
|
55 |
-
"default": "list"
|
56 |
-
},
|
57 |
-
"columns": {
|
58 |
-
"type": "integer",
|
59 |
-
"default": 3
|
60 |
-
},
|
61 |
-
"postsToShow": {
|
62 |
-
"type": "integer",
|
63 |
-
"default": 3
|
64 |
-
},
|
65 |
-
"mediaPosition": {
|
66 |
-
"type": "string",
|
67 |
-
"default": "top"
|
68 |
-
},
|
69 |
-
"authors": {
|
70 |
-
"type": "array",
|
71 |
-
"default": [],
|
72 |
-
"items": { "type": "integer" }
|
73 |
-
},
|
74 |
-
"categories": {
|
75 |
-
"type": "array",
|
76 |
-
"default": [],
|
77 |
-
"items": { "type": "integer" }
|
78 |
-
},
|
79 |
-
"tags": {
|
80 |
-
"type": "array",
|
81 |
-
"default": [],
|
82 |
-
"items": { "type": "integer" }
|
83 |
-
},
|
84 |
-
"tagExclusions": {
|
85 |
-
"type": "array",
|
86 |
-
"default": [],
|
87 |
-
"items": { "type": "integer" }
|
88 |
-
},
|
89 |
-
"specificPosts": {
|
90 |
-
"type": "array",
|
91 |
-
"default": [],
|
92 |
-
"items": { "type": "integer" }
|
93 |
-
},
|
94 |
-
"typeScale": {
|
95 |
-
"type": "integer",
|
96 |
-
"default": 4
|
97 |
-
},
|
98 |
-
"imageScale": {
|
99 |
-
"type": "integer",
|
100 |
-
"default": 3
|
101 |
-
},
|
102 |
-
"mobileStack": {
|
103 |
-
"type": "boolean",
|
104 |
-
"default": false
|
105 |
-
},
|
106 |
-
"sectionHeader": {
|
107 |
-
"type": "string",
|
108 |
-
"default": ""
|
109 |
-
},
|
110 |
-
"specificMode": {
|
111 |
-
"type": "boolean",
|
112 |
-
"default": false
|
113 |
-
},
|
114 |
-
"textColor": {
|
115 |
-
"type": "string",
|
116 |
-
"default": ""
|
117 |
-
},
|
118 |
-
"customTextColor": {
|
119 |
-
"type": "string",
|
120 |
-
"default": ""
|
121 |
-
},
|
122 |
-
"singleMode": {
|
123 |
-
"type": "boolean",
|
124 |
-
"default": false
|
125 |
-
}
|
126 |
-
}
|
127 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/blog-posts-block/newspack-homepage-articles/blocks/homepage-articles/class-wp-rest-newspack-articles-controller.php
DELETED
@@ -1,143 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* WP_REST_Newspack_Articles_Controller file.
|
4 |
-
*
|
5 |
-
* @package WordPress
|
6 |
-
*/
|
7 |
-
|
8 |
-
/**
|
9 |
-
* Class WP_REST_Newspack_Articles_Controller.
|
10 |
-
*/
|
11 |
-
class WP_REST_Newspack_Articles_Controller extends WP_REST_Controller {
|
12 |
-
|
13 |
-
/**
|
14 |
-
* Attribute schema.
|
15 |
-
*
|
16 |
-
* @var array
|
17 |
-
*/
|
18 |
-
public $attribute_schema;
|
19 |
-
|
20 |
-
/**
|
21 |
-
* Constructs the controller.
|
22 |
-
*
|
23 |
-
* @access public
|
24 |
-
*/
|
25 |
-
public function __construct() {
|
26 |
-
$this->namespace = 'newspack-blocks/v1';
|
27 |
-
$this->rest_base = 'articles';
|
28 |
-
}
|
29 |
-
|
30 |
-
/**
|
31 |
-
* Registers the necessary REST API routes.
|
32 |
-
*
|
33 |
-
* @access public
|
34 |
-
*/
|
35 |
-
public function register_routes() {
|
36 |
-
register_rest_route(
|
37 |
-
$this->namespace,
|
38 |
-
'/' . $this->rest_base,
|
39 |
-
array(
|
40 |
-
array(
|
41 |
-
'methods' => WP_REST_Server::READABLE,
|
42 |
-
'callback' => array( $this, 'get_items' ),
|
43 |
-
'args' => $this->get_attribute_schema(),
|
44 |
-
'permission_callback' => '__return_true',
|
45 |
-
),
|
46 |
-
)
|
47 |
-
);
|
48 |
-
}
|
49 |
-
|
50 |
-
/**
|
51 |
-
* Returns a list of rendered posts.
|
52 |
-
*
|
53 |
-
* @param WP_REST_Request $request Request object.
|
54 |
-
* @return WP_REST_Response
|
55 |
-
*/
|
56 |
-
public function get_items( $request ) {
|
57 |
-
$page = $request->get_param( 'page' ) ?? 1;
|
58 |
-
$exclude_ids = $request->get_param( 'exclude_ids' ) ?? array();
|
59 |
-
$next_page = $page + 1;
|
60 |
-
$attributes = wp_parse_args(
|
61 |
-
$request->get_params() ?? array(),
|
62 |
-
wp_list_pluck( $this->get_attribute_schema(), 'default' )
|
63 |
-
);
|
64 |
-
|
65 |
-
$article_query_args = Newspack_Blocks::build_articles_query( $attributes );
|
66 |
-
|
67 |
-
$query = array_merge(
|
68 |
-
$article_query_args,
|
69 |
-
array(
|
70 |
-
'post__not_in' => $exclude_ids,
|
71 |
-
)
|
72 |
-
);
|
73 |
-
|
74 |
-
// Run Query.
|
75 |
-
$article_query = new WP_Query( $query );
|
76 |
-
|
77 |
-
// Defaults.
|
78 |
-
$items = array();
|
79 |
-
$next_url = '';
|
80 |
-
|
81 |
-
// The Loop.
|
82 |
-
while ( $article_query->have_posts() ) {
|
83 |
-
$article_query->the_post();
|
84 |
-
$items[]['html'] = Newspack_Blocks::template_inc(
|
85 |
-
__DIR__ . '/templates/article.php',
|
86 |
-
array(
|
87 |
-
'attributes' => $attributes,
|
88 |
-
)
|
89 |
-
);
|
90 |
-
}
|
91 |
-
|
92 |
-
// Provide next URL if there are more pages.
|
93 |
-
if ( $next_page <= $article_query->max_num_pages ) {
|
94 |
-
$next_url = add_query_arg(
|
95 |
-
array_merge(
|
96 |
-
array_map(
|
97 |
-
function( $attribute ) {
|
98 |
-
return false === $attribute ? '0' : $attribute;
|
99 |
-
},
|
100 |
-
$attributes
|
101 |
-
),
|
102 |
-
array( 'page' => $next_page ) // phpcs:ignore PHPCompatibility.Syntax.NewShortArray.Found
|
103 |
-
),
|
104 |
-
rest_url( '/newspack-blocks/v1/articles' )
|
105 |
-
);
|
106 |
-
}
|
107 |
-
|
108 |
-
return rest_ensure_response(
|
109 |
-
array(
|
110 |
-
'items' => $items,
|
111 |
-
'next' => $next_url,
|
112 |
-
)
|
113 |
-
);
|
114 |
-
}
|
115 |
-
|
116 |
-
/**
|
117 |
-
* Sets up and returns attribute schema.
|
118 |
-
*
|
119 |
-
* @return array
|
120 |
-
*/
|
121 |
-
public function get_attribute_schema() {
|
122 |
-
if ( empty( $this->attribute_schema ) ) {
|
123 |
-
$block_json = json_decode(
|
124 |
-
file_get_contents( __DIR__ . '/block.json' ), // phpcs:ignore WordPress.WP.AlternativeFunctions.file_get_contents_file_get_contents
|
125 |
-
true
|
126 |
-
);
|
127 |
-
|
128 |
-
$this->attribute_schema = array_merge(
|
129 |
-
$block_json['attributes'],
|
130 |
-
array(
|
131 |
-
'exclude_ids' => array(
|
132 |
-
'type' => 'array',
|
133 |
-
'default' => array(),
|
134 |
-
'items' => array(
|
135 |
-
'type' => 'integer',
|
136 |
-
),
|
137 |
-
),
|
138 |
-
)
|
139 |
-
);
|
140 |
-
}
|
141 |
-
return $this->attribute_schema;
|
142 |
-
}
|
143 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/blog-posts-block/newspack-homepage-articles/blocks/homepage-articles/edit.js
DELETED
@@ -1,677 +0,0 @@
|
|
1 |
-
/**
|
2 |
-
* Internal dependencies
|
3 |
-
*/
|
4 |
-
import QueryControls from '../../components/query-controls';
|
5 |
-
|
6 |
-
/**
|
7 |
-
* External dependencies
|
8 |
-
*/
|
9 |
-
import classNames from 'classnames';
|
10 |
-
import { isUndefined, pickBy } from 'lodash';
|
11 |
-
import moment from 'moment';
|
12 |
-
|
13 |
-
/**
|
14 |
-
* WordPress dependencies
|
15 |
-
*/
|
16 |
-
import { __ } from '@wordpress/i18n';
|
17 |
-
import { Component, Fragment, RawHTML } from '@wordpress/element';
|
18 |
-
import {
|
19 |
-
BlockControls,
|
20 |
-
InspectorControls,
|
21 |
-
PanelColorSettings,
|
22 |
-
RichText,
|
23 |
-
withColors,
|
24 |
-
} from '@wordpress/block-editor';
|
25 |
-
import {
|
26 |
-
Button,
|
27 |
-
ButtonGroup,
|
28 |
-
PanelBody,
|
29 |
-
PanelRow,
|
30 |
-
RangeControl,
|
31 |
-
Toolbar,
|
32 |
-
ToggleControl,
|
33 |
-
Dashicon,
|
34 |
-
Placeholder,
|
35 |
-
Spinner,
|
36 |
-
BaseControl,
|
37 |
-
Path,
|
38 |
-
SVG,
|
39 |
-
} from '@wordpress/components';
|
40 |
-
import { withSelect } from '@wordpress/data';
|
41 |
-
import { compose } from '@wordpress/compose';
|
42 |
-
import { addQueryArgs } from '@wordpress/url';
|
43 |
-
import { decodeEntities } from '@wordpress/html-entities';
|
44 |
-
|
45 |
-
/**
|
46 |
-
* Module Constants
|
47 |
-
*/
|
48 |
-
const MAX_POSTS_COLUMNS = 6;
|
49 |
-
|
50 |
-
/* From https://material.io/tools/icons */
|
51 |
-
const landscapeIcon = (
|
52 |
-
<SVG xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24">
|
53 |
-
<Path d="M0 0h24v24H0z" fill="none" />
|
54 |
-
<Path d="M19 5H5c-1.1 0-2 .9-2 2v10c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2zm0 12H5V7h14v10z" />
|
55 |
-
</SVG>
|
56 |
-
);
|
57 |
-
|
58 |
-
const portraitIcon = (
|
59 |
-
<SVG xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24">
|
60 |
-
<Path d="M0 0h24v24H0z" fill="none" />
|
61 |
-
<Path d="M17 3H7c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h10c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm0 16H7V5h10v14z" />
|
62 |
-
</SVG>
|
63 |
-
);
|
64 |
-
|
65 |
-
const squareIcon = (
|
66 |
-
<SVG xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24">
|
67 |
-
<Path d="M0 0h24v24H0z" fill="none" />
|
68 |
-
<Path d="M18 4H6c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm0 14H6V6h12v12z" />
|
69 |
-
</SVG>
|
70 |
-
);
|
71 |
-
|
72 |
-
const uncroppedIcon = (
|
73 |
-
<SVG xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24">
|
74 |
-
<Path d="M0 0h24v24H0z" fill="none" />
|
75 |
-
<Path d="M3 5v4h2V5h4V3H5c-1.1 0-2 .9-2 2zm2 10H3v4c0 1.1.9 2 2 2h4v-2H5v-4zm14 4h-4v2h4c1.1 0 2-.9 2-2v-4h-2v4zm0-16h-4v2h4v4h2V5c0-1.1-.9-2-2-2z" />
|
76 |
-
</SVG>
|
77 |
-
);
|
78 |
-
|
79 |
-
const coverIcon = (
|
80 |
-
<SVG xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24">
|
81 |
-
<Path d="M0 0h24v24H0z" fill="none" />
|
82 |
-
<Path d="M4 4h7V2H4c-1.1 0-2 .9-2 2v7h2V4zm6 9l-4 5h12l-3-4-2.03 2.71L10 13zm7-4.5c0-.83-.67-1.5-1.5-1.5S14 7.67 14 8.5s.67 1.5 1.5 1.5S17 9.33 17 8.5zM20 2h-7v2h7v7h2V4c0-1.1-.9-2-2-2zm0 18h-7v2h7c1.1 0 2-.9 2-2v-7h-2v7zM4 13H2v7c0 1.1.9 2 2 2h7v-2H4v-7z" />
|
83 |
-
</SVG>
|
84 |
-
);
|
85 |
-
|
86 |
-
class Edit extends Component {
|
87 |
-
renderPost = post => {
|
88 |
-
const { attributes } = this.props;
|
89 |
-
const {
|
90 |
-
showImage,
|
91 |
-
imageShape,
|
92 |
-
mediaPosition,
|
93 |
-
minHeight,
|
94 |
-
showCaption,
|
95 |
-
showExcerpt,
|
96 |
-
showAuthor,
|
97 |
-
showAvatar,
|
98 |
-
showDate,
|
99 |
-
showCategory,
|
100 |
-
sectionHeader,
|
101 |
-
} = attributes;
|
102 |
-
|
103 |
-
const styles = {
|
104 |
-
minHeight:
|
105 |
-
mediaPosition === 'behind' &&
|
106 |
-
showImage &&
|
107 |
-
post.newspack_featured_image_src &&
|
108 |
-
minHeight + 'vh',
|
109 |
-
paddingTop:
|
110 |
-
mediaPosition === 'behind' &&
|
111 |
-
showImage &&
|
112 |
-
post.newspack_featured_image_src &&
|
113 |
-
minHeight / 5 + 'vh',
|
114 |
-
};
|
115 |
-
|
116 |
-
const authorNumber = post.newspack_author_info.length;
|
117 |
-
const postTitle = this.titleForPost( post );
|
118 |
-
return (
|
119 |
-
<article
|
120 |
-
className={ post.newspack_featured_image_src ? 'post-has-image' : null }
|
121 |
-
key={ post.id }
|
122 |
-
style={ styles }
|
123 |
-
>
|
124 |
-
{ showImage && post.newspack_featured_image_src && (
|
125 |
-
<figure className="post-thumbnail" key="thumbnail">
|
126 |
-
<a href="#">
|
127 |
-
{ imageShape === 'landscape' && (
|
128 |
-
<img src={ post.newspack_featured_image_src.landscape } />
|
129 |
-
) }
|
130 |
-
{ imageShape === 'portrait' && (
|
131 |
-
<img src={ post.newspack_featured_image_src.portrait } />
|
132 |
-
) }
|
133 |
-
{ imageShape === 'square' && <img src={ post.newspack_featured_image_src.square } /> }
|
134 |
-
|
135 |
-
{ imageShape === 'uncropped' && (
|
136 |
-
<img src={ post.newspack_featured_image_src.uncropped } />
|
137 |
-
) }
|
138 |
-
</a>
|
139 |
-
{ showCaption && '' !== post.newspack_featured_image_caption && (
|
140 |
-
<figcaption>{ post.newspack_featured_image_caption }</figcaption>
|
141 |
-
) }
|
142 |
-
</figure>
|
143 |
-
) }
|
144 |
-
|
145 |
-
<div className="entry-wrapper">
|
146 |
-
{ showCategory && post.newspack_category_info.length && (
|
147 |
-
<div className="cat-links">
|
148 |
-
<a href="#">{ post.newspack_category_info }</a>
|
149 |
-
</div>
|
150 |
-
) }
|
151 |
-
{ RichText.isEmpty( sectionHeader ) ? (
|
152 |
-
<h2 className="entry-title" key="title">
|
153 |
-
<a href="#">{ postTitle }</a>
|
154 |
-
</h2>
|
155 |
-
) : (
|
156 |
-
<h3 className="entry-title" key="title">
|
157 |
-
<a href="#">{ postTitle }</a>
|
158 |
-
</h3>
|
159 |
-
) }
|
160 |
-
{ showExcerpt && (
|
161 |
-
<RawHTML key="excerpt" className="excerpt-contain">
|
162 |
-
{ post.excerpt.rendered }
|
163 |
-
</RawHTML>
|
164 |
-
) }
|
165 |
-
<div className="entry-meta">
|
166 |
-
{ showAuthor && showAvatar && this.formatAvatars( post.newspack_author_info ) }
|
167 |
-
{ showAuthor && this.formatByline( post.newspack_author_info ) }
|
168 |
-
{ showDate && (
|
169 |
-
<time className="entry-date published" key="pub-date">
|
170 |
-
{ moment( post.date_gmt )
|
171 |
-
.local()
|
172 |
-
.format( 'MMMM DD, Y' ) }
|
173 |
-
</time>
|
174 |
-
) }
|
175 |
-
</div>
|
176 |
-
</div>
|
177 |
-
</article>
|
178 |
-
);
|
179 |
-
};
|
180 |
-
|
181 |
-
titleForPost = post => {
|
182 |
-
if ( ! post.title ) {
|
183 |
-
return '';
|
184 |
-
}
|
185 |
-
if ( typeof post.title === 'string' ) {
|
186 |
-
return decodeEntities( post.title.trim() );
|
187 |
-
}
|
188 |
-
if ( typeof post.title === 'object' && post.title.rendered ) {
|
189 |
-
return decodeEntities( post.title.rendered.trim() );
|
190 |
-
}
|
191 |
-
};
|
192 |
-
|
193 |
-
formatAvatars = authorInfo =>
|
194 |
-
authorInfo.map( author => (
|
195 |
-
<span className="avatar author-avatar" key={ author.id }>
|
196 |
-
<a className="url fn n" href="#">
|
197 |
-
<RawHTML>{ author.avatar }</RawHTML>
|
198 |
-
</a>
|
199 |
-
</span>
|
200 |
-
) );
|
201 |
-
|
202 |
-
formatByline = authorInfo => (
|
203 |
-
<span className="byline">
|
204 |
-
{ __( 'by', 'newspack-blocks' ) }{ ' ' }
|
205 |
-
{ authorInfo.reduce( ( accumulator, author, index ) => {
|
206 |
-
return [
|
207 |
-
...accumulator,
|
208 |
-
<span className="author vcard" key={ author.id }>
|
209 |
-
<a className="url fn n" href="#">
|
210 |
-
{ author.display_name }
|
211 |
-
</a>
|
212 |
-
</span>,
|
213 |
-
index < authorInfo.length - 2 && ', ',
|
214 |
-
authorInfo.length > 1 &&
|
215 |
-
index === authorInfo.length - 2 &&
|
216 |
-
__( ' and ', 'newspack-blocks' ),
|
217 |
-
];
|
218 |
-
}, [] ) }
|
219 |
-
</span>
|
220 |
-
);
|
221 |
-
|
222 |
-
renderInspectorControls = () => {
|
223 |
-
const {
|
224 |
-
attributes,
|
225 |
-
setAttributes,
|
226 |
-
latestPosts,
|
227 |
-
isSelected,
|
228 |
-
textColor,
|
229 |
-
setTextColor,
|
230 |
-
} = this.props;
|
231 |
-
const hasPosts = Array.isArray( latestPosts ) && latestPosts.length;
|
232 |
-
|
233 |
-
const {
|
234 |
-
authors,
|
235 |
-
specificPosts,
|
236 |
-
postsToShow,
|
237 |
-
categories,
|
238 |
-
sectionHeader,
|
239 |
-
columns,
|
240 |
-
showImage,
|
241 |
-
showCaption,
|
242 |
-
imageScale,
|
243 |
-
mobileStack,
|
244 |
-
minHeight,
|
245 |
-
moreButton,
|
246 |
-
moreButtonText,
|
247 |
-
showExcerpt,
|
248 |
-
typeScale,
|
249 |
-
showDate,
|
250 |
-
showAuthor,
|
251 |
-
showAvatar,
|
252 |
-
showCategory,
|
253 |
-
postLayout,
|
254 |
-
mediaPosition,
|
255 |
-
specificMode,
|
256 |
-
tags,
|
257 |
-
tagExclusions,
|
258 |
-
url,
|
259 |
-
} = attributes;
|
260 |
-
|
261 |
-
const imageSizeOptions = [
|
262 |
-
{
|
263 |
-
value: 1,
|
264 |
-
label: /* translators: label for small size option */ __( 'Small', 'newspack-blocks' ),
|
265 |
-
shortName: /* translators: abbreviation for small size */ __( 'S', 'newspack-blocks' ),
|
266 |
-
},
|
267 |
-
{
|
268 |
-
value: 2,
|
269 |
-
label: /* translators: label for medium size option */ __( 'Medium', 'newspack-blocks' ),
|
270 |
-
shortName: /* translators: abbreviation for medium size */ __( 'M', 'newspack-blocks' ),
|
271 |
-
},
|
272 |
-
{
|
273 |
-
value: 3,
|
274 |
-
label: /* translators: label for large size option */ __( 'Large', 'newspack-blocks' ),
|
275 |
-
shortName: /* translators: abbreviation for large size */ __( 'L', 'newspack-blocks' ),
|
276 |
-
},
|
277 |
-
{
|
278 |
-
value: 4,
|
279 |
-
label: /* translators: label for extra large size option */ __(
|
280 |
-
'Extra Large',
|
281 |
-
'newspack-blocks'
|
282 |
-
),
|
283 |
-
shortName: /* translators: abbreviation for extra large size */ __(
|
284 |
-
'XL',
|
285 |
-
'newspack-blocks'
|
286 |
-
),
|
287 |
-
},
|
288 |
-
];
|
289 |
-
|
290 |
-
return (
|
291 |
-
<Fragment>
|
292 |
-
<PanelBody title={ __( 'Display Settings', 'newspack-blocks' ) } initialOpen={ true }>
|
293 |
-
{ postsToShow && (
|
294 |
-
<QueryControls
|
295 |
-
numberOfItems={ postsToShow }
|
296 |
-
onNumberOfItemsChange={ value => setAttributes( { postsToShow: value } ) }
|
297 |
-
specificMode={ specificMode }
|
298 |
-
onSpecificModeChange={ value => setAttributes( { specificMode: value } ) }
|
299 |
-
specificPosts={ specificPosts }
|
300 |
-
onSpecificPostsChange={ value => setAttributes( { specificPosts: value } ) }
|
301 |
-
authors={ authors }
|
302 |
-
onAuthorsChange={ value => setAttributes( { authors: value } ) }
|
303 |
-
categories={ categories }
|
304 |
-
onCategoriesChange={ value => setAttributes( { categories: value } ) }
|
305 |
-
tags={ tags }
|
306 |
-
onTagsChange={ value => setAttributes( { tags: value } ) }
|
307 |
-
tagExclusions={ tagExclusions }
|
308 |
-
onTagExclusionsChange={ value => setAttributes( { tagExclusions: value } ) }
|
309 |
-
/>
|
310 |
-
) }
|
311 |
-
{ postLayout === 'grid' && (
|
312 |
-
<RangeControl
|
313 |
-
label={ __( 'Columns', 'newspack-blocks' ) }
|
314 |
-
value={ columns }
|
315 |
-
onChange={ value => setAttributes( { columns: value } ) }
|
316 |
-
min={ 2 }
|
317 |
-
max={
|
318 |
-
! hasPosts ? MAX_POSTS_COLUMNS : Math.min( MAX_POSTS_COLUMNS, latestPosts.length )
|
319 |
-
}
|
320 |
-
required
|
321 |
-
/>
|
322 |
-
) }
|
323 |
-
{ ! specificMode && (
|
324 |
-
<ToggleControl
|
325 |
-
label={ __( 'Show "More" Button', 'newspack-blocks' ) }
|
326 |
-
checked={ moreButton }
|
327 |
-
onChange={ () => setAttributes( { moreButton: ! moreButton } ) }
|
328 |
-
help={ __( 'Only available for non-AMP requests.', 'newspack-blocks' ) }
|
329 |
-
/>
|
330 |
-
) }
|
331 |
-
</PanelBody>
|
332 |
-
<PanelBody title={ __( 'Featured Image Settings', 'newspack-blocks' ) }>
|
333 |
-
<PanelRow>
|
334 |
-
<ToggleControl
|
335 |
-
label={ __( 'Show Featured Image', 'newspack-blocks' ) }
|
336 |
-
checked={ showImage }
|
337 |
-
onChange={ () => setAttributes( { showImage: ! showImage } ) }
|
338 |
-
/>
|
339 |
-
</PanelRow>
|
340 |
-
|
341 |
-
{ showImage && (
|
342 |
-
<PanelRow>
|
343 |
-
<ToggleControl
|
344 |
-
label={ __( 'Show Featured Image Caption', 'newspack-blocks' ) }
|
345 |
-
checked={ showCaption }
|
346 |
-
onChange={ () => setAttributes( { showCaption: ! showCaption } ) }
|
347 |
-
/>
|
348 |
-
</PanelRow>
|
349 |
-
) }
|
350 |
-
|
351 |
-
{ showImage && mediaPosition !== 'top' && mediaPosition !== 'behind' && (
|
352 |
-
<Fragment>
|
353 |
-
<PanelRow>
|
354 |
-
<ToggleControl
|
355 |
-
label={ __( 'Stack on mobile', 'newspack-blocks' ) }
|
356 |
-
checked={ mobileStack }
|
357 |
-
onChange={ () => setAttributes( { mobileStack: ! mobileStack } ) }
|
358 |
-
/>
|
359 |
-
</PanelRow>
|
360 |
-
<BaseControl label={ __( 'Featured Image Size', 'newspack-blocks' ) }>
|
361 |
-
<PanelRow>
|
362 |
-
<ButtonGroup aria-label={ __( 'Featured Image Size', 'newspack-blocks' ) }>
|
363 |
-
{ imageSizeOptions.map( option => {
|
364 |
-
const isCurrent = imageScale === option.value;
|
365 |
-
return (
|
366 |
-
<Button
|
367 |
-
isLarge
|
368 |
-
isPrimary={ isCurrent }
|
369 |
-
aria-pressed={ isCurrent }
|
370 |
-
aria-label={ option.label }
|
371 |
-
key={ option.value }
|
372 |
-
onClick={ () => setAttributes( { imageScale: option.value } ) }
|
373 |
-
>
|
374 |
-
{ option.shortName }
|
375 |
-
</Button>
|
376 |
-
);
|
377 |
-
} ) }
|
378 |
-
</ButtonGroup>
|
379 |
-
</PanelRow>
|
380 |
-
</BaseControl>
|
381 |
-
</Fragment>
|
382 |
-
) }
|
383 |
-
|
384 |
-
{ showImage && mediaPosition === 'behind' && (
|
385 |
-
<RangeControl
|
386 |
-
label={ __( 'Minimum height', 'newspack-blocks' ) }
|
387 |
-
help={ __(
|
388 |
-
"Sets a minimum height for the block, using a percentage of the screen's current height.",
|
389 |
-
'newspack-blocks'
|
390 |
-
) }
|
391 |
-
value={ minHeight }
|
392 |
-
onChange={ value => setAttributes( { minHeight: value } ) }
|
393 |
-
min={ 0 }
|
394 |
-
max={ 100 }
|
395 |
-
required
|
396 |
-
/>
|
397 |
-
) }
|
398 |
-
</PanelBody>
|
399 |
-
<PanelBody title={ __( 'Post Control Settings', 'newspack-blocks' ) }>
|
400 |
-
<PanelRow>
|
401 |
-
<ToggleControl
|
402 |
-
label={ __( 'Show Excerpt', 'newspack-blocks' ) }
|
403 |
-
checked={ showExcerpt }
|
404 |
-
onChange={ () => setAttributes( { showExcerpt: ! showExcerpt } ) }
|
405 |
-
/>
|
406 |
-
</PanelRow>
|
407 |
-
<RangeControl
|
408 |
-
className="type-scale-slider"
|
409 |
-
label={ __( 'Type Scale', 'newspack-blocks' ) }
|
410 |
-
value={ typeScale }
|
411 |
-
onChange={ value => setAttributes( { typeScale: value } ) }
|
412 |
-
min={ 1 }
|
413 |
-
max={ 10 }
|
414 |
-
beforeIcon="editor-textcolor"
|
415 |
-
afterIcon="editor-textcolor"
|
416 |
-
required
|
417 |
-
/>
|
418 |
-
</PanelBody>
|
419 |
-
<PanelColorSettings
|
420 |
-
title={ __( 'Color Settings', 'newspack-blocks' ) }
|
421 |
-
initialOpen={ true }
|
422 |
-
colorSettings={ [
|
423 |
-
{
|
424 |
-
value: textColor.color,
|
425 |
-
onChange: setTextColor,
|
426 |
-
label: __( 'Text Color', 'newspack-blocks' ),
|
427 |
-
},
|
428 |
-
] }
|
429 |
-
/>
|
430 |
-
<PanelBody title={ __( 'Post Meta Settings', 'newspack-blocks' ) }>
|
431 |
-
<PanelRow>
|
432 |
-
<ToggleControl
|
433 |
-
label={ __( 'Show Date', 'newspack-blocks' ) }
|
434 |
-
checked={ showDate }
|
435 |
-
onChange={ () => setAttributes( { showDate: ! showDate } ) }
|
436 |
-
/>
|
437 |
-
</PanelRow>
|
438 |
-
<PanelRow>
|
439 |
-
<ToggleControl
|
440 |
-
label={ __( 'Show Category', 'newspack-blocks' ) }
|
441 |
-
checked={ showCategory }
|
442 |
-
onChange={ () => setAttributes( { showCategory: ! showCategory } ) }
|
443 |
-
/>
|
444 |
-
</PanelRow>
|
445 |
-
<PanelRow>
|
446 |
-
<ToggleControl
|
447 |
-
label={ __( 'Show Author', 'newspack-blocks' ) }
|
448 |
-
checked={ showAuthor }
|
449 |
-
onChange={ () => setAttributes( { showAuthor: ! showAuthor } ) }
|
450 |
-
/>
|
451 |
-
</PanelRow>
|
452 |
-
{ showAuthor && (
|
453 |
-
<PanelRow>
|
454 |
-
<ToggleControl
|
455 |
-
label={ __( 'Show Author Avatar', 'newspack-blocks' ) }
|
456 |
-
checked={ showAvatar }
|
457 |
-
onChange={ () => setAttributes( { showAvatar: ! showAvatar } ) }
|
458 |
-
/>
|
459 |
-
</PanelRow>
|
460 |
-
) }
|
461 |
-
</PanelBody>
|
462 |
-
</Fragment>
|
463 |
-
);
|
464 |
-
};
|
465 |
-
|
466 |
-
render() {
|
467 |
-
/**
|
468 |
-
* Constants
|
469 |
-
*/
|
470 |
-
const {
|
471 |
-
attributes,
|
472 |
-
className,
|
473 |
-
setAttributes,
|
474 |
-
isSelected,
|
475 |
-
latestPosts,
|
476 |
-
hasPosts,
|
477 |
-
textColor,
|
478 |
-
} = this.props; // variables getting pulled out of props
|
479 |
-
const {
|
480 |
-
showExcerpt,
|
481 |
-
showDate,
|
482 |
-
showImage,
|
483 |
-
imageShape,
|
484 |
-
showAuthor,
|
485 |
-
showAvatar,
|
486 |
-
postsToShow,
|
487 |
-
postLayout,
|
488 |
-
mediaPosition,
|
489 |
-
moreButton,
|
490 |
-
moreButtonText,
|
491 |
-
columns,
|
492 |
-
categories,
|
493 |
-
typeScale,
|
494 |
-
imageScale,
|
495 |
-
mobileStack,
|
496 |
-
sectionHeader,
|
497 |
-
showCaption,
|
498 |
-
showCategory,
|
499 |
-
specificMode,
|
500 |
-
} = attributes;
|
501 |
-
|
502 |
-
const classes = classNames( className, {
|
503 |
-
'is-grid': postLayout === 'grid',
|
504 |
-
'show-image': showImage,
|
505 |
-
[ `columns-${ columns }` ]: postLayout === 'grid',
|
506 |
-
[ `ts-${ typeScale }` ]: typeScale !== '5',
|
507 |
-
[ `image-align${ mediaPosition }` ]: showImage,
|
508 |
-
[ `is-${ imageScale }` ]: imageScale !== '1' && showImage,
|
509 |
-
'mobile-stack': mobileStack,
|
510 |
-
[ `image-shape${ imageShape }` ]: imageShape !== 'landscape',
|
511 |
-
'has-text-color': textColor.color !== '',
|
512 |
-
'show-caption': showCaption,
|
513 |
-
'show-category': showCategory,
|
514 |
-
wpnbha: true,
|
515 |
-
} );
|
516 |
-
|
517 |
-
const blockControls = [
|
518 |
-
{
|
519 |
-
icon: 'list-view',
|
520 |
-
title: __( 'List View', 'newspack-blocks' ),
|
521 |
-
onClick: () => setAttributes( { postLayout: 'list' } ),
|
522 |
-
isActive: postLayout === 'list',
|
523 |
-
},
|
524 |
-
{
|
525 |
-
icon: 'grid-view',
|
526 |
-
title: __( 'Grid View', 'newspack-blocks' ),
|
527 |
-
onClick: () => setAttributes( { postLayout: 'grid' } ),
|
528 |
-
isActive: postLayout === 'grid',
|
529 |
-
},
|
530 |
-
];
|
531 |
-
|
532 |
-
const blockControlsImages = [
|
533 |
-
{
|
534 |
-
icon: 'align-none',
|
535 |
-
title: __( 'Show media on top', 'newspack-blocks' ),
|
536 |
-
isActive: mediaPosition === 'top',
|
537 |
-
onClick: () => setAttributes( { mediaPosition: 'top' } ),
|
538 |
-
},
|
539 |
-
{
|
540 |
-
icon: 'align-pull-left',
|
541 |
-
title: __( 'Show media on left', 'newspack-blocks' ),
|
542 |
-
isActive: mediaPosition === 'left',
|
543 |
-
onClick: () => setAttributes( { mediaPosition: 'left' } ),
|
544 |
-
},
|
545 |
-
{
|
546 |
-
icon: 'align-pull-right',
|
547 |
-
title: __( 'Show media on right', 'newspack-blocks' ),
|
548 |
-
isActive: mediaPosition === 'right',
|
549 |
-
onClick: () => setAttributes( { mediaPosition: 'right' } ),
|
550 |
-
},
|
551 |
-
{
|
552 |
-
icon: coverIcon,
|
553 |
-
title: __( 'Show media behind', 'newspack-blocks' ),
|
554 |
-
isActive: mediaPosition === 'behind',
|
555 |
-
onClick: () => setAttributes( { mediaPosition: 'behind' } ),
|
556 |
-
},
|
557 |
-
];
|
558 |
-
|
559 |
-
const blockControlsImageShape = [
|
560 |
-
{
|
561 |
-
icon: landscapeIcon,
|
562 |
-
title: __( 'Landscape Image Shape', 'newspack-blocks' ),
|
563 |
-
isActive: imageShape === 'landscape',
|
564 |
-
onClick: () => setAttributes( { imageShape: 'landscape' } ),
|
565 |
-
},
|
566 |
-
{
|
567 |
-
icon: portraitIcon,
|
568 |
-
title: __( 'portrait Image Shape', 'newspack-blocks' ),
|
569 |
-
isActive: imageShape === 'portrait',
|
570 |
-
onClick: () => setAttributes( { imageShape: 'portrait' } ),
|
571 |
-
},
|
572 |
-
{
|
573 |
-
icon: squareIcon,
|
574 |
-
title: __( 'Square Image Shape', 'newspack-blocks' ),
|
575 |
-
isActive: imageShape === 'square',
|
576 |
-
onClick: () => setAttributes( { imageShape: 'square' } ),
|
577 |
-
},
|
578 |
-
{
|
579 |
-
icon: uncroppedIcon,
|
580 |
-
title: __( 'Uncropped', 'newspack-blocks' ),
|
581 |
-
isActive: imageShape === 'uncropped',
|
582 |
-
onClick: () => setAttributes( { imageShape: 'uncropped' } ),
|
583 |
-
},
|
584 |
-
];
|
585 |
-
|
586 |
-
return (
|
587 |
-
<Fragment>
|
588 |
-
<div
|
589 |
-
className={ classes }
|
590 |
-
style={ {
|
591 |
-
color: textColor.color,
|
592 |
-
} }
|
593 |
-
>
|
594 |
-
<div>
|
595 |
-
{ latestPosts && ( ! RichText.isEmpty( sectionHeader ) || isSelected ) && (
|
596 |
-
<RichText
|
597 |
-
onChange={ value => setAttributes( { sectionHeader: value } ) }
|
598 |
-
placeholder={ __( 'Write header…', 'newspack-blocks' ) }
|
599 |
-
value={ sectionHeader }
|
600 |
-
tagName="h2"
|
601 |
-
className="article-section-title"
|
602 |
-
/>
|
603 |
-
) }
|
604 |
-
{ latestPosts && ! latestPosts.length && (
|
605 |
-
<Placeholder>{ __( 'Sorry, no posts were found.', 'newspack-blocks' ) }</Placeholder>
|
606 |
-
) }
|
607 |
-
{ ! latestPosts && (
|
608 |
-
<Placeholder>
|
609 |
-
<Spinner />
|
610 |
-
</Placeholder>
|
611 |
-
) }
|
612 |
-
{ latestPosts && latestPosts.map( post => this.renderPost( post ) ) }
|
613 |
-
</div>
|
614 |
-
</div>
|
615 |
-
|
616 |
-
{ ! specificMode && latestPosts && moreButton && (
|
617 |
-
<div className="editor-styles-wrapper">
|
618 |
-
<div className="wp-block-button">
|
619 |
-
<RichText
|
620 |
-
placeholder={ __( 'Load more posts', 'newspack-blocks' ) }
|
621 |
-
value={ moreButtonText }
|
622 |
-
onChange={ value => setAttributes( { moreButtonText: value } ) }
|
623 |
-
className="wp-block-button__link"
|
624 |
-
keepPlaceholderOnFocus
|
625 |
-
allowedFormats={ [] }
|
626 |
-
/>
|
627 |
-
</div>
|
628 |
-
</div>
|
629 |
-
) }
|
630 |
-
|
631 |
-
<BlockControls>
|
632 |
-
<Toolbar controls={ blockControls } />
|
633 |
-
{ showImage && <Toolbar controls={ blockControlsImages } /> }
|
634 |
-
{ showImage && <Toolbar controls={ blockControlsImageShape } /> }
|
635 |
-
</BlockControls>
|
636 |
-
<InspectorControls>{ this.renderInspectorControls() }</InspectorControls>
|
637 |
-
</Fragment>
|
638 |
-
);
|
639 |
-
}
|
640 |
-
}
|
641 |
-
|
642 |
-
export default compose( [
|
643 |
-
withColors( { textColor: 'color' } ),
|
644 |
-
withSelect( ( select, props ) => {
|
645 |
-
const {
|
646 |
-
postsToShow,
|
647 |
-
authors,
|
648 |
-
categories,
|
649 |
-
tags,
|
650 |
-
tagExclusions,
|
651 |
-
specificPosts,
|
652 |
-
specificMode,
|
653 |
-
} = props.attributes;
|
654 |
-
const { getAuthors, getEntityRecords } = select( 'core' );
|
655 |
-
const latestPostsQuery = pickBy(
|
656 |
-
specificMode && specificPosts && specificPosts.length
|
657 |
-
? {
|
658 |
-
include: specificPosts,
|
659 |
-
orderby: 'include',
|
660 |
-
}
|
661 |
-
: {
|
662 |
-
per_page: postsToShow,
|
663 |
-
categories,
|
664 |
-
author: authors,
|
665 |
-
tags,
|
666 |
-
tags_exclude: tagExclusions,
|
667 |
-
},
|
668 |
-
value => ! isUndefined( value )
|
669 |
-
);
|
670 |
-
const postsListQuery = {
|
671 |
-
per_page: 50,
|
672 |
-
};
|
673 |
-
return {
|
674 |
-
latestPosts: getEntityRecords( 'postType', 'post', latestPostsQuery ),
|
675 |
-
};
|
676 |
-
} ),
|
677 |
-
] )( Edit );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/blog-posts-block/newspack-homepage-articles/blocks/homepage-articles/editor.js
DELETED
@@ -1,7 +0,0 @@
|
|
1 |
-
/**
|
2 |
-
* Internal dependencies
|
3 |
-
*/
|
4 |
-
import { registerBlockType } from '@wordpress/blocks';
|
5 |
-
import { name, settings } from '.';
|
6 |
-
|
7 |
-
registerBlockType( `newspack-blocks/${ name }`, settings );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/blog-posts-block/newspack-homepage-articles/blocks/homepage-articles/editor.scss
DELETED
@@ -1,39 +0,0 @@
|
|
1 |
-
@import "../../shared/sass/variables";
|
2 |
-
|
3 |
-
.type-scale-slider {
|
4 |
-
.dashicon {
|
5 |
-
height: 16px;
|
6 |
-
width: 16px;
|
7 |
-
}
|
8 |
-
|
9 |
-
input + .dashicon {
|
10 |
-
height: 24px;
|
11 |
-
margin-left: 10px;
|
12 |
-
margin-right: 0;
|
13 |
-
width: 24px;
|
14 |
-
}
|
15 |
-
}
|
16 |
-
|
17 |
-
.wpnbha {
|
18 |
-
.editor-rich-text {
|
19 |
-
width: 100%;
|
20 |
-
}
|
21 |
-
|
22 |
-
/* Article meta */
|
23 |
-
.cat-links {
|
24 |
-
font-size: $font__size-xs;
|
25 |
-
}
|
26 |
-
|
27 |
-
span.avatar {
|
28 |
-
display: inline-block;
|
29 |
-
margin-right: 0.5em;
|
30 |
-
div {
|
31 |
-
display: inline;
|
32 |
-
}
|
33 |
-
}
|
34 |
-
|
35 |
-
/* Article excerpt */
|
36 |
-
.excerpt-contain p {
|
37 |
-
margin: 0.5em 0;
|
38 |
-
}
|
39 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/blog-posts-block/newspack-homepage-articles/blocks/homepage-articles/index.js
DELETED
@@ -1,106 +0,0 @@
|
|
1 |
-
/**
|
2 |
-
* External dependencies
|
3 |
-
*/
|
4 |
-
import { Path, SVG } from '@wordpress/components';
|
5 |
-
import { createBlock } from '@wordpress/blocks';
|
6 |
-
|
7 |
-
/**
|
8 |
-
* WordPress dependencies
|
9 |
-
*/
|
10 |
-
import { applyFilters } from '@wordpress/hooks';
|
11 |
-
import { __, _x } from '@wordpress/i18n';
|
12 |
-
|
13 |
-
/**
|
14 |
-
* Internal dependencies
|
15 |
-
*/
|
16 |
-
import edit from './edit';
|
17 |
-
|
18 |
-
/**
|
19 |
-
* Style dependencies - will load in editor
|
20 |
-
*/
|
21 |
-
import './editor.scss';
|
22 |
-
import './view.scss';
|
23 |
-
import metadata from './block.json';
|
24 |
-
const { name, attributes, category } = metadata;
|
25 |
-
|
26 |
-
// Name must be exported separately.
|
27 |
-
export { name };
|
28 |
-
|
29 |
-
export const title = __( 'Homepage Posts', 'newspack-blocks' );
|
30 |
-
|
31 |
-
/* From https://material.io/tools/icons */
|
32 |
-
export const icon = (
|
33 |
-
<SVG xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24">
|
34 |
-
<Path d="M0 0h24v24H0z" fill="none" />
|
35 |
-
<Path d="M4 6H2v14c0 1.1.9 2 2 2h14v-2H4V6zm16-4H8c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2zm0 14H8V4h12v12zM10 9h8v2h-8zm0 3h4v2h-4zm0-6h8v2h-8z" />
|
36 |
-
</SVG>
|
37 |
-
);
|
38 |
-
|
39 |
-
export const settings = {
|
40 |
-
title,
|
41 |
-
icon,
|
42 |
-
attributes,
|
43 |
-
category,
|
44 |
-
keywords: [
|
45 |
-
__( 'posts', 'newspack-blocks' ),
|
46 |
-
__( 'articles', 'newspack-blocks' ),
|
47 |
-
__( 'latest', 'newspack-blocks' ),
|
48 |
-
],
|
49 |
-
description: __( 'A block for displaying homepage posts.', 'newspack-blocks' ),
|
50 |
-
styles: [
|
51 |
-
{ name: 'default', label: _x( 'Default', 'block style', 'newspack-blocks' ), isDefault: true },
|
52 |
-
{ name: 'borders', label: _x( 'Borders', 'block style', 'newspack-blocks' ) },
|
53 |
-
],
|
54 |
-
supports: {
|
55 |
-
html: false,
|
56 |
-
align: [ 'wide', 'full' ],
|
57 |
-
default: '',
|
58 |
-
},
|
59 |
-
edit,
|
60 |
-
save: () => null, // to use view.php
|
61 |
-
transforms: {
|
62 |
-
from: [
|
63 |
-
{
|
64 |
-
type: 'block',
|
65 |
-
blocks: [ 'core/latest-posts' ],
|
66 |
-
transform: ( {
|
67 |
-
displayPostContent,
|
68 |
-
displayPostDate,
|
69 |
-
postLayout,
|
70 |
-
columns,
|
71 |
-
postsToShow,
|
72 |
-
categories,
|
73 |
-
} ) => {
|
74 |
-
return createBlock(
|
75 |
-
applyFilters( 'blocks.transforms_from_name', 'newspack-blocks/homepage-articles' ),
|
76 |
-
{
|
77 |
-
showExcerpt: displayPostContent,
|
78 |
-
showDate: displayPostDate,
|
79 |
-
postLayout,
|
80 |
-
columns,
|
81 |
-
postsToShow,
|
82 |
-
showAuthor: false,
|
83 |
-
categories: categories ? [ categories ] : [],
|
84 |
-
}
|
85 |
-
);
|
86 |
-
},
|
87 |
-
},
|
88 |
-
],
|
89 |
-
to: [
|
90 |
-
{
|
91 |
-
type: 'block',
|
92 |
-
blocks: [ 'core/latest-posts' ],
|
93 |
-
transform: ( { showExcerpt, showDate, postLayout, columns, postsToShow, categories } ) => {
|
94 |
-
return createBlock( 'core/latest-posts', {
|
95 |
-
displayPostContent: showExcerpt,
|
96 |
-
displayPostDate: showDate,
|
97 |
-
postLayout,
|
98 |
-
columns,
|
99 |
-
postsToShow,
|
100 |
-
categories: categories[ 0 ] || '',
|
101 |
-
} );
|
102 |
-
},
|
103 |
-
},
|
104 |
-
],
|
105 |
-
},
|
106 |
-
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/blog-posts-block/newspack-homepage-articles/blocks/homepage-articles/templates/article.php
DELETED
@@ -1,143 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Article template.
|
4 |
-
*
|
5 |
-
* @global array $attributes Block attributes.
|
6 |
-
* @package WordPress
|
7 |
-
*/
|
8 |
-
|
9 |
-
call_user_func(
|
10 |
-
function( $data ) {
|
11 |
-
$attributes = $data['attributes'];
|
12 |
-
|
13 |
-
$authors = Newspack_Blocks::prepare_authors();
|
14 |
-
|
15 |
-
$styles = '';
|
16 |
-
|
17 |
-
if ( 'behind' === $attributes['mediaPosition'] && $attributes['showImage'] && has_post_thumbnail() ) {
|
18 |
-
$styles = 'min-height: ' . $attributes['minHeight'] . 'vh; padding-top: ' . ( $attributes['minHeight'] / 5 ) . 'vh;';
|
19 |
-
}
|
20 |
-
$image_size = 'newspack-article-block-uncropped';
|
21 |
-
if ( has_post_thumbnail() && 'uncropped' !== $attributes['imageShape'] ) {
|
22 |
-
$image_size = Newspack_Blocks::image_size_for_orientation( $attributes['imageShape'] );
|
23 |
-
}
|
24 |
-
$thumbnail_args = '';
|
25 |
-
// If the image position is behind, pass the object-fit setting to maintain styles with AMP.
|
26 |
-
if ( 'behind' === $attributes['mediaPosition'] ) {
|
27 |
-
$thumbnail_args = array( 'object-fit' => 'cover' );
|
28 |
-
}
|
29 |
-
$category = false;
|
30 |
-
// Use Yoast primary category if set.
|
31 |
-
if ( class_exists( 'WPSEO_Primary_Term' ) ) {
|
32 |
-
$primary_term = new WPSEO_Primary_Term( 'category', get_the_ID() );
|
33 |
-
$category_id = $primary_term->get_primary_term();
|
34 |
-
if ( $category_id ) {
|
35 |
-
$category = get_term( $category_id );
|
36 |
-
}
|
37 |
-
}
|
38 |
-
if ( ! $category ) {
|
39 |
-
$categories_list = get_the_category();
|
40 |
-
if ( ! empty( $categories_list ) ) {
|
41 |
-
$category = $categories_list[0];
|
42 |
-
}
|
43 |
-
}
|
44 |
-
?>
|
45 |
-
<article data-post-id="<?php the_id(); ?>"
|
46 |
-
<?php if ( has_post_thumbnail() ) : ?>
|
47 |
-
class="post-has-image"
|
48 |
-
<?php endif; ?>
|
49 |
-
<?php if ( $styles ) : ?>
|
50 |
-
style="<?php echo esc_attr( $styles ); ?>"
|
51 |
-
<?php endif; ?>
|
52 |
-
>
|
53 |
-
<?php if ( has_post_thumbnail() && $attributes['showImage'] && $attributes['imageShape'] ) : ?>
|
54 |
-
<figure class="post-thumbnail">
|
55 |
-
<a href="<?php the_permalink(); ?>" rel="bookmark">
|
56 |
-
<?php the_post_thumbnail( $image_size, $thumbnail_args ); ?>
|
57 |
-
</a>
|
58 |
-
|
59 |
-
<?php if ( $attributes['showCaption'] && '' !== get_the_post_thumbnail_caption() ) : ?>
|
60 |
-
<figcaption><?php the_post_thumbnail_caption(); ?></figcaption>
|
61 |
-
<?php endif; ?>
|
62 |
-
</figure><!-- .featured-image -->
|
63 |
-
<?php endif; ?>
|
64 |
-
|
65 |
-
<div class="entry-wrapper">
|
66 |
-
<?php if ( $attributes['showCategory'] && $category ) : ?>
|
67 |
-
<div class="cat-links">
|
68 |
-
<a href="<?php echo esc_url( get_category_link( $category->term_id ) ); ?>">
|
69 |
-
<?php echo esc_html( $category->name ); ?>
|
70 |
-
</a>
|
71 |
-
</div>
|
72 |
-
<?php
|
73 |
-
endif;
|
74 |
-
if ( '' === $attributes['sectionHeader'] ) :
|
75 |
-
the_title( '<h2 class="entry-title"><a href="' . esc_url( get_permalink() ) . '" rel="bookmark">', '</a></h2>' );
|
76 |
-
else :
|
77 |
-
the_title( '<h3 class="entry-title"><a href="' . esc_url( get_permalink() ) . '" rel="bookmark">', '</a></h3>' );
|
78 |
-
endif;
|
79 |
-
if ( $attributes['showExcerpt'] ) :
|
80 |
-
the_excerpt();
|
81 |
-
endif;
|
82 |
-
if ( $attributes['showAuthor'] || $attributes['showDate'] ) :
|
83 |
-
?>
|
84 |
-
<div class="entry-meta">
|
85 |
-
<?php
|
86 |
-
if ( $attributes['showAuthor'] ) :
|
87 |
-
if ( $attributes['showAvatar'] ) :
|
88 |
-
echo wp_kses(
|
89 |
-
newspack_blocks_format_avatars( $authors ),
|
90 |
-
array(
|
91 |
-
'img' => array(
|
92 |
-
'class' => true,
|
93 |
-
'src' => true,
|
94 |
-
'alt' => true,
|
95 |
-
'width' => true,
|
96 |
-
'height' => true,
|
97 |
-
'data-*' => true,
|
98 |
-
'srcset' => true,
|
99 |
-
),
|
100 |
-
'noscript' => array(),
|
101 |
-
'a' => array(
|
102 |
-
'href' => true,
|
103 |
-
),
|
104 |
-
)
|
105 |
-
);
|
106 |
-
endif;
|
107 |
-
?>
|
108 |
-
<span class="byline">
|
109 |
-
<?php echo wp_kses_post( newspack_blocks_format_byline( $authors ) ); ?>
|
110 |
-
</span><!-- .author-name -->
|
111 |
-
<?php
|
112 |
-
endif;
|
113 |
-
if ( $attributes['showDate'] ) :
|
114 |
-
$time_string = '<time class="entry-date published updated" datetime="%1$s">%2$s</time>';
|
115 |
-
if ( get_the_time( 'U' ) !== get_the_modified_time( 'U' ) ) :
|
116 |
-
$time_string = '<time class="entry-date published" datetime="%1$s">%2$s</time><time class="updated" datetime="%3$s">%4$s</time>';
|
117 |
-
endif;
|
118 |
-
printf(
|
119 |
-
wp_kses(
|
120 |
-
$time_string,
|
121 |
-
array(
|
122 |
-
'time' => array(
|
123 |
-
'class' => true,
|
124 |
-
'datetime' => true,
|
125 |
-
),
|
126 |
-
)
|
127 |
-
),
|
128 |
-
esc_attr( get_the_date( DATE_W3C ) ),
|
129 |
-
esc_html( get_the_date() ),
|
130 |
-
esc_attr( get_the_modified_date( DATE_W3C ) ),
|
131 |
-
esc_html( get_the_modified_date() )
|
132 |
-
);
|
133 |
-
endif;
|
134 |
-
?>
|
135 |
-
</div><!-- .entry-meta -->
|
136 |
-
<?php endif; ?>
|
137 |
-
</div><!-- .entry-wrapper -->
|
138 |
-
</article>
|
139 |
-
|
140 |
-
<?php
|
141 |
-
},
|
142 |
-
$data // phpcs:ignore VariableAnalysis.CodeAnalysis.VariableAnalysis.UndefinedVariable
|
143 |
-
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/blog-posts-block/newspack-homepage-articles/blocks/homepage-articles/templates/articles-list.php
DELETED
@@ -1,21 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Article list template.
|
4 |
-
*
|
5 |
-
* @global WP_Query $article_query Article query.
|
6 |
-
* @global array $attributes
|
7 |
-
* @package WordPress
|
8 |
-
*/
|
9 |
-
|
10 |
-
call_user_func(
|
11 |
-
function( $data ) {
|
12 |
-
echo Newspack_Blocks::template_inc( // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
|
13 |
-
__DIR__ . '/articles-loop.php',
|
14 |
-
array(
|
15 |
-
'attributes' => $data['attributes'],
|
16 |
-
'article_query' => $data['article_query'],
|
17 |
-
)
|
18 |
-
);
|
19 |
-
},
|
20 |
-
$data // phpcs:ignore VariableAnalysis.CodeAnalysis.VariableAnalysis.UndefinedVariable
|
21 |
-
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/blog-posts-block/newspack-homepage-articles/blocks/homepage-articles/templates/articles-loop.php
DELETED
@@ -1,29 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Articles loop template.
|
4 |
-
*
|
5 |
-
* @package WordPress
|
6 |
-
* @global \WP_Query $article_query Article query.
|
7 |
-
* @global array $attributes
|
8 |
-
* @global array $newspack_blocks_post_id
|
9 |
-
*/
|
10 |
-
|
11 |
-
call_user_func(
|
12 |
-
function( $data ) {
|
13 |
-
$attributes = $data['attributes'];
|
14 |
-
$article_query = $data['article_query'];
|
15 |
-
global $newspack_blocks_post_id;
|
16 |
-
$post_counter = 0;
|
17 |
-
while ( $article_query->have_posts() ) {
|
18 |
-
$article_query->the_post();
|
19 |
-
if ( ! $attributes['specificMode'] && ( isset( $newspack_blocks_post_id[ get_the_ID() ] ) || $post_counter >= $attributes['postsToShow'] ) ) {
|
20 |
-
continue;
|
21 |
-
}
|
22 |
-
$newspack_blocks_post_id[ get_the_ID() ] = true;
|
23 |
-
$post_counter++;
|
24 |
-
echo Newspack_Blocks::template_inc( __DIR__ . '/article.php', array( 'attributes' => $attributes ) ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
|
25 |
-
}
|
26 |
-
wp_reset_postdata();
|
27 |
-
},
|
28 |
-
$data // phpcs:ignore VariableAnalysis.CodeAnalysis.VariableAnalysis.UndefinedVariable
|
29 |
-
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/blog-posts-bloc