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 |
Comparing to | |
See all releases |
Code changes from version 0.17 to 0.18
- blog-posts-block/README.md +2 -0
- blog-posts-block/dist/editor.asset.php +1 -1
- blog-posts-block/dist/editor.css +1 -1
- blog-posts-block/dist/editor.js +1 -1
- blog-posts-block/dist/editor.rtl.css +1 -1
- blog-posts-block/dist/view.asset.php +1 -1
- blog-posts-block/dist/view.css +1 -1
- blog-posts-block/dist/view.js +1 -1
- blog-posts-block/dist/view.rtl.css +1 -1
- blog-posts-block/editor.js +4 -0
- blog-posts-block/index.php +1 -1
- blog-posts-block/newspack-homepage-articles/blocks/homepage-articles/block.json +125 -116
- blog-posts-block/newspack-homepage-articles/blocks/homepage-articles/class-wp-rest-newspack-articles-controller.php +43 -23
- blog-posts-block/newspack-homepage-articles/blocks/homepage-articles/edit.js +64 -28
- blog-posts-block/newspack-homepage-articles/blocks/homepage-articles/templates/article.php +2 -2
- blog-posts-block/newspack-homepage-articles/blocks/homepage-articles/view.js +52 -27
- blog-posts-block/newspack-homepage-articles/blocks/homepage-articles/view.php +18 -12
- blog-posts-block/newspack-homepage-articles/blocks/homepage-articles/view.scss +35 -7
- blog-posts-block/newspack-homepage-articles/class-newspack-blocks-api.php +36 -32
- blog-posts-block/newspack-homepage-articles/class-newspack-blocks.php +18 -4
- blog-posts-block/newspack-homepage-articles/components/query-controls.js +43 -3
- full-site-editing-plugin.php +22 -2
- full-site-editing/blocks/site-credit/index.js +1 -1
- full-site-editing/dist/full-site-editing.asset.php +1 -1
- full-site-editing/dist/full-site-editing.css +1 -1
- full-site-editing/dist/full-site-editing.js +1 -1
- full-site-editing/dist/full-site-editing.rtl.css +1 -1
- full-site-editing/plugins/close-button-override/style.scss +4 -0
- global-styles/dist/global-styles.asset.php +1 -1
- posts-list-block/dist/posts-list-block.asset.php +1 -1
- readme.txt +6 -1
- starter-page-templates/dist/starter-page-templates.asset.php +1 -1
- starter-page-templates/dist/starter-page-templates.css +1 -1
- starter-page-templates/dist/starter-page-templates.js +1 -1
- starter-page-templates/dist/starter-page-templates.rtl.css +1 -1
- starter-page-templates/index.js +1 -1
- starter-page-templates/page-template-modal/components/preview-template-title.js +6 -4
- starter-page-templates/page-template-modal/components/template-selector-control.js +0 -2
- starter-page-templates/page-template-modal/components/template-selector-item.js +0 -12
- starter-page-templates/page-template-modal/components/template-selector-preview.js +63 -54
- starter-page-templates/page-template-modal/components/test/__snapshots__/template-selector-preview-test.js.snap +2 -1
- starter-page-templates/page-template-modal/index.js +14 -2
- starter-page-templates/page-template-modal/styles/starter-page-templates-editor.scss +199 -255
- trunk/blog-posts-block/README.md +32 -0
- trunk/blog-posts-block/dist/editor.asset.php +1 -0
- trunk/blog-posts-block/dist/editor.css +1 -0
- trunk/blog-posts-block/dist/editor.js +2 -0
- trunk/blog-posts-block/dist/editor.js.LICENSE +5 -0
- trunk/blog-posts-block/dist/editor.rtl.css +1 -0
- trunk/blog-posts-block/dist/view.asset.php +1 -0
- trunk/blog-posts-block/dist/view.css +1 -0
- trunk/blog-posts-block/dist/view.js +1 -0
- trunk/blog-posts-block/dist/view.rtl.css +1 -0
- trunk/blog-posts-block/editor.js +38 -0
- trunk/blog-posts-block/index.php +92 -0
- trunk/blog-posts-block/newspack-homepage-articles/README.md +5 -0
- trunk/blog-posts-block/newspack-homepage-articles/blocks/homepage-articles/block.json +127 -0
- trunk/blog-posts-block/newspack-homepage-articles/blocks/homepage-articles/class-wp-rest-newspack-articles-controller.php +143 -0
- trunk/blog-posts-block/newspack-homepage-articles/blocks/homepage-articles/edit.js +677 -0
- trunk/blog-posts-block/newspack-homepage-articles/blocks/homepage-articles/editor.js +7 -0
- trunk/blog-posts-block/newspack-homepage-articles/blocks/homepage-articles/editor.scss +39 -0
- trunk/blog-posts-block/newspack-homepage-articles/blocks/homepage-articles/index.js +106 -0
- trunk/blog-posts-block/newspack-homepage-articles/blocks/homepage-articles/templates/article.php +143 -0
- trunk/blog-posts-block/newspack-homepage-articles/blocks/homepage-articles/templates/articles-list.php +21 -0
- trunk/blog-posts-block/newspack-homepage-articles/blocks/homepage-articles/templates/articles-loop.php +29 -0
- trunk/blog-posts-block/newspack-homepage-articles/blocks/homepage-articles/view.js +236 -0
- trunk/blog-posts-block/newspack-homepage-articles/blocks/homepage-articles/view.php +227 -0
- trunk/blog-posts-block/newspack-homepage-articles/blocks/homepage-articles/view.scss +582 -0
- trunk/blog-posts-block/newspack-homepage-articles/class-newspack-blocks-api.php +224 -0
- trunk/blog-posts-block/newspack-homepage-articles/class-newspack-blocks.php +407 -0
- trunk/blog-posts-block/newspack-homepage-articles/components/autocomplete-tokenfield.js +175 -0
- trunk/blog-posts-block/newspack-homepage-articles/components/autocomplete-tokenfield.scss +9 -0
- trunk/blog-posts-block/newspack-homepage-articles/components/query-controls.js +254 -0
- trunk/blog-posts-block/newspack-homepage-articles/shared/sass/_colors.scss +8 -0
- trunk/blog-posts-block/newspack-homepage-articles/shared/sass/_legacy_colors.scss +13 -0
- trunk/blog-posts-block/newspack-homepage-articles/shared/sass/_mixins.scss +26 -0
- trunk/blog-posts-block/newspack-homepage-articles/shared/sass/_variables.scss +27 -0
- trunk/blog-posts-block/view.js +1 -0
- trunk/event-countdown-block/blocks/event-countdown.js +80 -0
- trunk/event-countdown-block/blocks/event-countdown.php +21 -0
- trunk/event-countdown-block/editor.css +10 -0
- trunk/event-countdown-block/index.asset.php +1 -0
- trunk/event-countdown-block/index.js +294 -0
- trunk/event-countdown-block/index.php +40 -0
- trunk/event-countdown-block/license.txt +364 -0
- trunk/event-countdown-block/style.css +134 -0
- trunk/full-site-editing-plugin.php +213 -0
- trunk/full-site-editing/blocks/navigation-menu/edit.js +98 -0
- trunk/full-site-editing/blocks/navigation-menu/index.js +33 -0
- trunk/full-site-editing/blocks/navigation-menu/index.php +125 -0
- trunk/full-site-editing/blocks/navigation-menu/style.scss +3 -0
- trunk/full-site-editing/blocks/post-content/edit.js +62 -0
- trunk/full-site-editing/blocks/post-content/index.js +57 -0
- trunk/full-site-editing/blocks/post-content/index.php +39 -0
- trunk/full-site-editing/blocks/post-content/save.js +6 -0
- trunk/full-site-editing/blocks/post-content/style.scss +69 -0
- trunk/full-site-editing/blocks/site-credit/edit.js +75 -0
- trunk/full-site-editing/blocks/site-credit/footer-credit-choices.js +24 -0
- trunk/full-site-editing/blocks/site-credit/index.js +38 -0
- trunk/full-site-editing/blocks/site-credit/index.php +205 -0
- trunk/full-site-editing/blocks/site-credit/style.scss +37 -0
- trunk/full-site-editing/blocks/site-description/edit.js +140 -0
- trunk/full-site-editing/blocks/site-description/index.js +61 -0
- trunk/full-site-editing/blocks/site-description/index.php +68 -0
- trunk/full-site-editing/blocks/site-description/style.scss +12 -0
- trunk/full-site-editing/blocks/site-title/edit.js +121 -0
- trunk/full-site-editing/blocks/site-title/index.js +50 -0
- trunk/full-site-editing/blocks/site-title/index.php +62 -0
- trunk/full-site-editing/blocks/site-title/style.scss +12 -0
- trunk/full-site-editing/blocks/template/edit.js +201 -0
- trunk/full-site-editing/blocks/template/index.js +60 -0
- trunk/full-site-editing/blocks/template/index.php +41 -0
- trunk/full-site-editing/blocks/template/site-logo.js +18 -0
- trunk/full-site-editing/blocks/template/style.scss +102 -0
- trunk/full-site-editing/class-full-site-editing.php +628 -0
- trunk/full-site-editing/dist/full-site-editing.asset.php +1 -0
- trunk/full-site-editing/dist/full-site-editing.css +1 -0
- trunk/full-site-editing/dist/full-site-editing.js +2 -0
- trunk/full-site-editing/dist/full-site-editing.js.LICENSE +5 -0
- trunk/full-site-editing/dist/full-site-editing.rtl.css +1 -0
- trunk/full-site-editing/editor/block-inserter/index.js +39 -0
- trunk/full-site-editing/editor/block-inserter/post-content-block-appender.js +27 -0
- trunk/full-site-editing/editor/image-block-keywords/index.js +23 -0
- trunk/full-site-editing/editor/index.js +10 -0
- trunk/full-site-editing/editor/remove-editor-panels/index.js +31 -0
- trunk/full-site-editing/editor/style.scss +95 -0
- trunk/full-site-editing/editor/suppress-draft-action/index.js +38 -0
- trunk/full-site-editing/editor/suppress-trash-action/index.js +26 -0
- trunk/full-site-editing/editor/template-validity-override/index.js +23 -0
- trunk/full-site-editing/helpers.php +181 -0
- trunk/full-site-editing/index.js +13 -0
- trunk/full-site-editing/lib/index.js +1 -0
- trunk/full-site-editing/lib/site-options/index.js +2 -0
- trunk/full-site-editing/lib/site-options/use-previous.js +24 -0
- trunk/full-site-editing/lib/site-options/use-site-options.js +127 -0
- trunk/full-site-editing/lib/site-options/with-site-options.js +99 -0
- trunk/full-site-editing/plugins/close-button-override/index.js +100 -0
- trunk/full-site-editing/plugins/close-button-override/style.scss +50 -0
- trunk/full-site-editing/plugins/editor-template-classes/index.js +53 -0
- trunk/full-site-editing/plugins/template-update-notice/index.js +20 -0
- trunk/full-site-editing/sass/_mixins.scss +17 -0
- trunk/full-site-editing/serialize-block-fallback.php +70 -0
- trunk/full-site-editing/templates/class-rest-templates-controller.php +49 -0
- trunk/full-site-editing/templates/class-template-image-inserter.php +174 -0
- trunk/full-site-editing/templates/class-wp-template-inserter.php +537 -0
- trunk/full-site-editing/templates/class-wp-template.php +204 -0
- trunk/global-styles/README-DATA.md +363 -0
- trunk/global-styles/README.md +230 -0
- trunk/global-styles/class-global-styles.php +515 -0
- trunk/global-styles/dist/global-styles.asset.php +1 -0
- trunk/global-styles/dist/global-styles.css +1 -0
- trunk/global-styles/dist/global-styles.js +2 -0
- trunk/global-styles/dist/global-styles.js.LICENSE +5 -0
- trunk/global-styles/dist/global-styles.rtl.css +1 -0
- trunk/global-styles/editor.scss +2 -0
- trunk/global-styles/includes/class-data-point-literal.php +44 -0
- trunk/global-styles/includes/class-data-point-option.php +104 -0
- trunk/global-styles/includes/class-data-point-theme.php +92 -0
- trunk/global-styles/includes/class-data-set.php +167 -0
- trunk/global-styles/includes/class-json-endpoint.php +116 -0
- trunk/global-styles/includes/interface-data-point.php +17 -0
- trunk/global-styles/index.js +51 -0
- trunk/global-styles/src/constants.js +7 -0
- trunk/global-styles/src/dom-updater.js +36 -0
- trunk/global-styles/src/font-pairings-panel-previews.js +73 -0
- trunk/global-styles/src/font-pairings-panel.js +50 -0
- trunk/global-styles/src/font-pairings-panel.scss +48 -0
- trunk/global-styles/src/font-selection-panel.js +49 -0
- trunk/global-styles/src/global-styles-sidebar.js +144 -0
- trunk/global-styles/src/global-styles-sidebar.scss +22 -0
- trunk/global-styles/src/icon.js +12 -0
- trunk/global-styles/src/no-support.js +11 -0
- trunk/global-styles/src/store.js +122 -0
- trunk/global-styles/static/blank.css +6 -0
- trunk/global-styles/static/style.css +28 -0
- trunk/jetpack-timeline/blocks/timeline.php +18 -0
- trunk/jetpack-timeline/editor.css +28 -0
- trunk/jetpack-timeline/index.asset.php +1 -0
- trunk/jetpack-timeline/index.js +252 -0
- trunk/jetpack-timeline/index.php +40 -0
- trunk/jetpack-timeline/style.css +48 -0
- trunk/posts-list-block/blocks/posts-list/block.json +10 -0
- trunk/posts-list-block/blocks/posts-list/editor.scss +9 -0
- trunk/posts-list-block/blocks/posts-list/index.js +110 -0
- trunk/posts-list-block/blocks/posts-list/style.scss +9 -0
- trunk/posts-list-block/blocks/posts-list/transforms.js +34 -0
- trunk/posts-list-block/class-posts-list-block.php +160 -0
- trunk/posts-list-block/dist/posts-list-block.asset.php +1 -0
- trunk/posts-list-block/dist/posts-list-block.css +1 -0
- trunk/posts-list-block/dist/posts-list-block.js +1 -0
- trunk/posts-list-block/dist/posts-list-block.rtl.css +1 -0
- trunk/posts-list-block/index.js +4 -0
- trunk/posts-list-block/templates/no-posts.php +26 -0
- trunk/posts-list-block/templates/post-item.php +44 -0
- trunk/posts-list-block/templates/posts-list.php +39 -0
- trunk/posts-list-block/utils.php +46 -0
- trunk/readme.txt +136 -0
- trunk/starter-page-templates/class-starter-page-templates.php +262 -0
- trunk/starter-page-templates/class-wp-rest-sideload-image-controller.php +294 -0
- trunk/starter-page-templates/dist/starter-page-templates.asset.php +1 -0
- trunk/starter-page-templates/dist/starter-page-templates.css +1 -0
- trunk/starter-page-templates/dist/starter-page-templates.js +2 -0
blog-posts-block/README.md
CHANGED
@@ -15,6 +15,8 @@ view.js — assets for the block rendered on frontend
|
|
15 |
newspack-homepage-articles/** — source code synced from the Newspack Blocks repository
|
16 |
```
|
17 |
|
|
|
|
|
18 |
### Synchronizing the code
|
19 |
|
20 |
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.
|
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.
|
blog-posts-block/dist/editor.asset.php
CHANGED
@@ -1 +1 @@
|
|
1 |
-
<?php return array('dependencies' => array('lodash', 'moment', 'wp-api-fetch', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-compose', 'wp-data', 'wp-
|
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');
|
blog-posts-block/dist/editor.css
CHANGED
@@ -1 +1 @@
|
|
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{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
|
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}}
|
blog-posts-block/dist/editor.js
CHANGED
@@ -1,2 +1,2 @@
|
|
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){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.editor}()},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},"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"}},"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){!function(){e.exports=this.wp.blockEditor}()},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,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(20),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(8),h=n.n(b),f=n(17),g=n.n(f),m=n(9),d=n.n(m),w=n(10),O=n.n(w),k=n(4),j=n.n(k),_=n(11),y=n.n(_),v=n(3),S=n.n(v),E=n(7),C=n.n(E),P=n(6),x=n(5),A=n(14),T=(n(30),function(e){function t(e){var n;return h()(this,t),(n=d()(this,O()(t).call(this,e))).state={suggestions:[],validValues:{},loading:!1},n.debouncedUpdateSuggestions=Object(A.debounce)(n.updateSuggestions,500),n}return y()(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)),M=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=d()(this,(e=O()(t)).call.apply(e,[this].concat(c))),S()(j()(n),"fetchPostSuggestions",(function(e){return C()({path:Object(P.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(x.decodeEntities)(e.title)||Object(r.__)("(no title)","newspack-blocks")}}))}))})),S()(j()(n),"fetchSavedPosts",(function(e){return C()({path:Object(P.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(x.decodeEntities)(e.title.rendered)||Object(r.__)("(no title)","newspack-blocks")}}))}))})),S()(j()(n),"fetchAuthorSuggestions",(function(e){return C()({path:Object(P.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(x.decodeEntities)(e.name)||Object(r.__)("(no name)","newspack-blocks")}}))}))})),S()(j()(n),"fetchSavedAuthors",(function(e){return C()({path:Object(P.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(x.decodeEntities)(e.name)||Object(r.__)("(no name)","newspack-blocks")}}))}))})),S()(j()(n),"fetchCategorySuggestions",(function(e){return C()({path:Object(P.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(x.decodeEntities)(e.name)||Object(r.__)("(no title)","newspack-blocks")}}))}))})),S()(j()(n),"fetchSavedCategories",(function(e){return C()({path:Object(P.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(x.decodeEntities)(e.name)||Object(r.__)("(no title)","newspack-blocks")}}))}))})),S()(j()(n),"fetchTagSuggestions",(function(e){return C()({path:Object(P.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(x.decodeEntities)(e.name)||Object(r.__)("(no title)","newspack-blocks")}}))}))})),S()(j()(n),"fetchSavedTags",(function(e){return C()({path:Object(P.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(x.decodeEntities)(e.name)||Object(r.__)("(no title)","newspack-blocks")}}))}))})),S()(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;return[e.enableSpecific&&Object(i.createElement)(l.ToggleControl,{checked:t,onChange:o,label:Object(r.__)("Choose specific stories","newspack-blocks")}),t&&Object(i.createElement)(T,{tokens:c||[],onChange:a,fetchSuggestions:n.fetchPostSuggestions,fetchSavedInfo:n.fetchSavedPosts,label:Object(r.__)("Posts","newspack-blocks")}),!t&&Object(i.createElement)(l.QueryControls,n.props),!t&&u&&Object(i.createElement)(T,{tokens:s||[],onChange:u,fetchSuggestions:n.fetchAuthorSuggestions,fetchSavedInfo:n.fetchSavedAuthors,label:Object(r.__)("Authors","newspack-blocks")}),!t&&b&&Object(i.createElement)(T,{tokens:p||[],onChange:b,fetchSuggestions:n.fetchCategorySuggestions,fetchSavedInfo:n.fetchSavedCategories,label:Object(r.__)("Categories","newspack-blocks")}),!t&&f&&Object(i.createElement)(T,{tokens:h||[],onChange:f,fetchSuggestions:n.fetchTagSuggestions,fetchSavedInfo:n.fetchSavedTags,label:Object(r.__)("Tags","newspack-blocks")})]})),n}return y()(t,e),t}(i.Component);M.defaultProps={enableSpecific:!0,specificPosts:[],authors:[],categories:[],tags:[]};var H=M,V=n(21),z=n.n(V),N=n(22),I=n.n(N),B=n(12),L=n(23),R=n(24),D=n(19),F=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"})),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:"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"})),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:"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"})),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:"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"})),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:"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"})),J=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=d()(this,(e=O()(t)).call.apply(e,[this].concat(c))),S()(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"};e.newspack_author_info.length;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)),B.RichText.isEmpty(f)?Object(i.createElement)("h2",{className:"entry-title",key:"title"},Object(i.createElement)("a",{href:"#"},Object(x.decodeEntities)(e.title.rendered.trim()))):Object(i.createElement)("h3",{className:"entry-title",key:"title"},Object(i.createElement)("a",{href:"#"},Object(x.decodeEntities)(e.title.rendered.trim()))),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"},I()(e.date_gmt).local().format("MMMM DD, Y")))))})),S()(j()(n),"formatAvatars",(function(e){return e.map((function(e){return Object(i.createElement)("span",{className:"avatar author-avatar"},Object(i.createElement)("a",{className:"url fn n",href:"#"},Object(i.createElement)(i.RawHTML,{key:e.id},e.avatar)))}))})),S()(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")])}),[]))})),S()(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),m=t.showImage,d=t.showCaption,w=t.imageScale,O=t.mobileStack,k=t.minHeight,j=t.moreButton,_=t.showExcerpt,y=t.typeScale,v=t.showDate,S=t.showAuthor,E=t.showAvatar,C=t.showCategory,P=t.postLayout,x=t.mediaPosition,A=t.specificMode,T=t.tags,M=(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)(H,{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})}}),"grid"===P&&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(F,c.length):F,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:m,onChange:function(){return o({showImage:!m})}})),m&&Object(i.createElement)(l.PanelRow,null,Object(i.createElement)(l.ToggleControl,{label:Object(r.__)("Show Featured Image Caption","newspack-blocks"),checked:d,onChange:function(){return o({showCaption:!d})}})),m&&"top"!==x&&"behind"!==x&&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")},M.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,onClick:function(){return o({imageScale:e.value})}},e.shortName)})))))),m&&"behind"===x&&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:_,onChange:function(){return o({showExcerpt:!_})}})),Object(i.createElement)(l.RangeControl,{className:"type-scale-slider",label:Object(r.__)("Type Scale","newspack-blocks"),value:y,onChange:function(e){return o({typeScale:e})},min:1,max:10,beforeIcon:"editor-textcolor",afterIcon:"editor-textcolor",required:!0})),Object(i.createElement)(D.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:v,onChange:function(){return o({showDate:!v})}})),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:S,onChange:function(){return o({showAuthor:!S})}})),S&&Object(i.createElement)(l.PanelRow,null,Object(i.createElement)(l.ToggleControl,{label:Object(r.__)("Show Author Avatar","newspack-blocks"),checked:E,onChange:function(){return o({showAvatar:!E})}}))))})),n}return y()(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,m=o.moreButton,d=o.columns,w=(o.categories,o.typeScale),O=o.imageScale,k=o.mobileStack,j=o.sectionHeader,_=o.showCaption,y=o.showCategory,v=o.specificMode,E=z()(c,(e={"is-grid":"grid"===f,"show-image":b},S()(e,"columns-".concat(d),"grid"===f),S()(e,"ts-".concat(w),"5"!==w),S()(e,"image-align".concat(g),b),S()(e,"is-".concat(O),"1"!==O&&b),S()(e,"mobile-stack",k),S()(e,"image-shape".concat(h),"landscape"!==h),S()(e,"has-text-color",""!==p.color),S()(e,"show-caption",_),S()(e,"show-category",y),S()(e,"wpnbha",!0),e)),C=[{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:W,title:Object(r.__)("Show media behind","newspack-blocks"),isActive:"behind"===g,onClick:function(){return a({mediaPosition:"behind"})}}],x=[{icon:q,title:Object(r.__)("Landscape Image Shape","newspack-blocks"),isActive:"landscape"===h,onClick:function(){return a({imageShape:"landscape"})}},{icon:Q,title:Object(r.__)("portrait Image Shape","newspack-blocks"),isActive:"portrait"===h,onClick:function(){return a({imageShape:"portrait"})}},{icon:G,title:Object(r.__)("Square Image Shape","newspack-blocks"),isActive:"square"===h,onClick:function(){return a({imageShape:"square"})}},{icon:U,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:E,style:{color:p.color}},u&&(!B.RichText.isEmpty(j)||s)&&Object(i.createElement)(B.RichText,{onChange:function(e){return a({sectionHeader:e})},placeholder:Object(r.__)("Write header…","newspack-blocks"),value:j,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)}))),!v&&u&&m&&Object(i.createElement)("button",{className:"button",type:"button"},Object(r.__)("More…","newspack-blocks")),Object(i.createElement)(B.BlockControls,null,Object(i.createElement)(l.Toolbar,{controls:C}),b&&Object(i.createElement)(l.Toolbar,{controls:P}),b&&Object(i.createElement)(l.Toolbar,{controls:x})),Object(i.createElement)(B.InspectorControls,null,this.renderInspectorControls()))}}]),t}(i.Component),X=Object(R.compose)([Object(D.withColors)({textColor:"color"}),Object(L.withSelect)((function(e,t){var n=t.attributes,o=n.postsToShow,c=n.authors,a=n.categories,r=n.tags,s=n.specificPosts,i=n.specificMode,l=e("core");l.getAuthors;return{latestPosts:(0,l.getEntityRecords)("postType","post",Object(A.pickBy)(i&&s&&s.length?{include:s,orderby:"include"}:{per_page:o,categories:a,author:c,tags:r},(function(e){return!Object(A.isUndefined)(e)})))}}))])(J),Y=(n(31),n(32),n(18)),K=(Y.name,Y.attributes),Z=Y.category,$={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:K,category:Z,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:X,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]||""})}}]}},ee="a8c/blog-posts";Object(s.addFilter)("blocks.transforms_from_name","set-transformed-block-name",(function(e){return"newspack-blocks/homepage-articles"!==e?e:ee})),Object(a.registerBlockType)(ee,c()({},$,{title:Object(r.__)("Blog Posts","full-site-editing"),category:"layout"}))}]));
|
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})}))}]));
|
blog-posts-block/dist/editor.rtl.css
CHANGED
@@ -1 +1 @@
|
|
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{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
|
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}}
|
blog-posts-block/dist/view.asset.php
CHANGED
@@ -1 +1 @@
|
|
1 |
-
<?php return array('dependencies' => array('wp-polyfill'), 'version' => '
|
1 |
+
<?php return array('dependencies' => array('wp-polyfill'), 'version' => '205364fc4e1fe4f20229ec21744b8df1');
|
blog-posts-block/dist/view.css
CHANGED
@@ -1 +1 @@
|
|
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{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
|
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}}
|
blog-posts-block/dist/view.js
CHANGED
@@ -1 +1 @@
|
|
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=1)}([function(t,e,r){},function(t,e,r){"use strict";r.r(e);r(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)}))}]));
|
blog-posts-block/dist/view.rtl.css
CHANGED
@@ -1 +1 @@
|
|
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{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
|
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}}
|
blog-posts-block/editor.js
CHANGED
@@ -31,4 +31,8 @@ registerBlockType( blockName, {
|
|
31 |
...settings,
|
32 |
title: __( 'Blog Posts', 'full-site-editing' ),
|
33 |
category: 'layout',
|
|
|
|
|
|
|
|
|
34 |
} );
|
31 |
...settings,
|
32 |
title: __( 'Blog Posts', 'full-site-editing' ),
|
33 |
category: 'layout',
|
34 |
+
supports: {
|
35 |
+
...settings.supports,
|
36 |
+
multiple: false,
|
37 |
+
},
|
38 |
} );
|
blog-posts-block/index.php
CHANGED
@@ -9,7 +9,7 @@ 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.
|
13 |
|
14 |
/**
|
15 |
* Filters block name.
|
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.
|
blog-posts-block/newspack-homepage-articles/blocks/homepage-articles/block.json
CHANGED
@@ -1,118 +1,127 @@
|
|
1 |
{
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
118 |
}
|
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 |
}
|
blog-posts-block/newspack-homepage-articles/blocks/homepage-articles/class-wp-rest-newspack-articles-controller.php
CHANGED
@@ -1,6 +1,8 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
* WP_REST_Newspack_Articles_Controller file.
|
|
|
|
|
4 |
*/
|
5 |
|
6 |
/**
|
@@ -34,14 +36,14 @@ class WP_REST_Newspack_Articles_Controller extends WP_REST_Controller {
|
|
34 |
register_rest_route(
|
35 |
$this->namespace,
|
36 |
'/' . $this->rest_base,
|
37 |
-
|
38 |
-
|
39 |
'methods' => WP_REST_Server::READABLE,
|
40 |
-
'callback' =>
|
41 |
'args' => $this->get_attribute_schema(),
|
42 |
'permission_callback' => '__return_true',
|
43 |
-
|
44 |
-
|
45 |
);
|
46 |
}
|
47 |
|
@@ -52,22 +54,28 @@ class WP_REST_Newspack_Articles_Controller extends WP_REST_Controller {
|
|
52 |
* @return WP_REST_Response
|
53 |
*/
|
54 |
public function get_items( $request ) {
|
55 |
-
$page
|
56 |
-
$
|
57 |
-
$
|
58 |
-
|
|
|
59 |
wp_list_pluck( $this->get_attribute_schema(), 'default' )
|
60 |
);
|
|
|
61 |
$article_query_args = Newspack_Blocks::build_articles_query( $attributes );
|
62 |
|
63 |
-
|
64 |
-
|
|
|
|
|
|
|
|
|
65 |
|
66 |
// Run Query.
|
67 |
-
$article_query = new WP_Query( $
|
68 |
|
69 |
// Defaults.
|
70 |
-
$items =
|
71 |
$next_url = '';
|
72 |
|
73 |
// The Loop.
|
@@ -75,9 +83,9 @@ class WP_REST_Newspack_Articles_Controller extends WP_REST_Controller {
|
|
75 |
$article_query->the_post();
|
76 |
$items[]['html'] = Newspack_Blocks::template_inc(
|
77 |
__DIR__ . '/templates/article.php',
|
78 |
-
|
79 |
'attributes' => $attributes,
|
80 |
-
|
81 |
);
|
82 |
}
|
83 |
|
@@ -87,20 +95,21 @@ class WP_REST_Newspack_Articles_Controller extends WP_REST_Controller {
|
|
87 |
array_merge(
|
88 |
array_map(
|
89 |
function( $attribute ) {
|
90 |
-
|
|
|
91 |
$attributes
|
92 |
),
|
93 |
-
|
94 |
),
|
95 |
rest_url( '/newspack-blocks/v1/articles' )
|
96 |
);
|
97 |
}
|
98 |
|
99 |
return rest_ensure_response(
|
100 |
-
|
101 |
'items' => $items,
|
102 |
'next' => $next_url,
|
103 |
-
|
104 |
);
|
105 |
}
|
106 |
|
@@ -111,13 +120,24 @@ class WP_REST_Newspack_Articles_Controller extends WP_REST_Controller {
|
|
111 |
*/
|
112 |
public function get_attribute_schema() {
|
113 |
if ( empty( $this->attribute_schema ) ) {
|
114 |
-
$block_json
|
115 |
-
file_get_contents( __DIR__ . '/block.json' ),
|
116 |
true
|
117 |
);
|
118 |
-
$this->attribute_schema = $block_json['attributes'];
|
119 |
-
}
|
120 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
121 |
return $this->attribute_schema;
|
122 |
}
|
123 |
}
|
1 |
<?php
|
2 |
/**
|
3 |
* WP_REST_Newspack_Articles_Controller file.
|
4 |
+
*
|
5 |
+
* @package WordPress
|
6 |
*/
|
7 |
|
8 |
/**
|
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 |
|
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.
|
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 |
|
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 |
|
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 |
}
|
blog-posts-block/newspack-homepage-articles/blocks/homepage-articles/edit.js
CHANGED
@@ -15,7 +15,13 @@ import moment from 'moment';
|
|
15 |
*/
|
16 |
import { __ } from '@wordpress/i18n';
|
17 |
import { Component, Fragment, RawHTML } from '@wordpress/element';
|
18 |
-
import {
|
|
|
|
|
|
|
|
|
|
|
|
|
19 |
import {
|
20 |
Button,
|
21 |
ButtonGroup,
|
@@ -35,7 +41,6 @@ import { withSelect } from '@wordpress/data';
|
|
35 |
import { compose } from '@wordpress/compose';
|
36 |
import { addQueryArgs } from '@wordpress/url';
|
37 |
import { decodeEntities } from '@wordpress/html-entities';
|
38 |
-
import { PanelColorSettings, withColors } from '@wordpress/block-editor';
|
39 |
|
40 |
/**
|
41 |
* Module Constants
|
@@ -109,7 +114,7 @@ class Edit extends Component {
|
|
109 |
};
|
110 |
|
111 |
const authorNumber = post.newspack_author_info.length;
|
112 |
-
|
113 |
return (
|
114 |
<article
|
115 |
className={ post.newspack_featured_image_src ? 'post-has-image' : null }
|
@@ -145,11 +150,11 @@ class Edit extends Component {
|
|
145 |
) }
|
146 |
{ RichText.isEmpty( sectionHeader ) ? (
|
147 |
<h2 className="entry-title" key="title">
|
148 |
-
<a href="#">{
|
149 |
</h2>
|
150 |
) : (
|
151 |
<h3 className="entry-title" key="title">
|
152 |
-
<a href="#">{
|
153 |
</h3>
|
154 |
) }
|
155 |
{ showExcerpt && (
|
@@ -173,11 +178,23 @@ class Edit extends Component {
|
|
173 |
);
|
174 |
};
|
175 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
176 |
formatAvatars = authorInfo =>
|
177 |
authorInfo.map( author => (
|
178 |
-
<span className="avatar author-avatar">
|
179 |
<a className="url fn n" href="#">
|
180 |
-
<RawHTML
|
181 |
</a>
|
182 |
</span>
|
183 |
) );
|
@@ -226,6 +243,7 @@ class Edit extends Component {
|
|
226 |
mobileStack,
|
227 |
minHeight,
|
228 |
moreButton,
|
|
|
229 |
showExcerpt,
|
230 |
typeScale,
|
231 |
showDate,
|
@@ -236,6 +254,7 @@ class Edit extends Component {
|
|
236 |
mediaPosition,
|
237 |
specificMode,
|
238 |
tags,
|
|
|
239 |
url,
|
240 |
} = attributes;
|
241 |
|
@@ -285,6 +304,8 @@ class Edit extends Component {
|
|
285 |
onCategoriesChange={ value => setAttributes( { categories: value } ) }
|
286 |
tags={ tags }
|
287 |
onTagsChange={ value => setAttributes( { tags: value } ) }
|
|
|
|
|
288 |
/>
|
289 |
) }
|
290 |
{ postLayout === 'grid' && (
|
@@ -347,6 +368,7 @@ class Edit extends Component {
|
|
347 |
isPrimary={ isCurrent }
|
348 |
aria-pressed={ isCurrent }
|
349 |
aria-label={ option.label }
|
|
|
350 |
onClick={ () => setAttributes( { imageScale: option.value } ) }
|
351 |
>
|
352 |
{ option.shortName }
|
@@ -465,6 +487,7 @@ class Edit extends Component {
|
|
465 |
postLayout,
|
466 |
mediaPosition,
|
467 |
moreButton,
|
|
|
468 |
columns,
|
469 |
categories,
|
470 |
typeScale,
|
@@ -568,30 +591,41 @@ class Edit extends Component {
|
|
568 |
color: textColor.color,
|
569 |
} }
|
570 |
>
|
571 |
-
|
572 |
-
|
573 |
-
|
574 |
-
|
575 |
-
|
576 |
-
|
577 |
-
|
578 |
-
|
579 |
-
|
580 |
-
|
581 |
-
|
582 |
-
|
583 |
-
|
584 |
-
|
585 |
-
<
|
586 |
-
|
587 |
-
|
588 |
-
|
|
|
|
|
589 |
</div>
|
590 |
|
591 |
{ ! specificMode && latestPosts && moreButton && (
|
592 |
-
<
|
593 |
-
|
594 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
595 |
) }
|
596 |
|
597 |
<BlockControls>
|
@@ -613,6 +647,7 @@ export default compose( [
|
|
613 |
authors,
|
614 |
categories,
|
615 |
tags,
|
|
|
616 |
specificPosts,
|
617 |
specificMode,
|
618 |
} = props.attributes;
|
@@ -628,6 +663,7 @@ export default compose( [
|
|
628 |
categories,
|
629 |
author: authors,
|
630 |
tags,
|
|
|
631 |
},
|
632 |
value => ! isUndefined( value )
|
633 |
);
|
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,
|
41 |
import { compose } from '@wordpress/compose';
|
42 |
import { addQueryArgs } from '@wordpress/url';
|
43 |
import { decodeEntities } from '@wordpress/html-entities';
|
|
|
44 |
|
45 |
/**
|
46 |
* Module Constants
|
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 }
|
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 && (
|
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 |
) );
|
243 |
mobileStack,
|
244 |
minHeight,
|
245 |
moreButton,
|
246 |
+
moreButtonText,
|
247 |
showExcerpt,
|
248 |
typeScale,
|
249 |
showDate,
|
254 |
mediaPosition,
|
255 |
specificMode,
|
256 |
tags,
|
257 |
+
tagExclusions,
|
258 |
url,
|
259 |
} = attributes;
|
260 |
|
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' && (
|
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 }
|
487 |
postLayout,
|
488 |
mediaPosition,
|
489 |
moreButton,
|
490 |
+
moreButtonText,
|
491 |
columns,
|
492 |
categories,
|
493 |
typeScale,
|
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>
|
647 |
authors,
|
648 |
categories,
|
649 |
tags,
|
650 |
+
tagExclusions,
|
651 |
specificPosts,
|
652 |
specificMode,
|
653 |
} = props.attributes;
|
663 |
categories,
|
664 |
author: authors,
|
665 |
tags,
|
666 |
+
tags_exclude: tagExclusions,
|
667 |
},
|
668 |
value => ! isUndefined( value )
|
669 |
);
|
blog-posts-block/newspack-homepage-articles/blocks/homepage-articles/templates/article.php
CHANGED
@@ -18,7 +18,7 @@ call_user_func(
|
|
18 |
$styles = 'min-height: ' . $attributes['minHeight'] . 'vh; padding-top: ' . ( $attributes['minHeight'] / 5 ) . 'vh;';
|
19 |
}
|
20 |
$image_size = 'newspack-article-block-uncropped';
|
21 |
-
if ( 'uncropped' !== $attributes['imageShape'] ) {
|
22 |
$image_size = Newspack_Blocks::image_size_for_orientation( $attributes['imageShape'] );
|
23 |
}
|
24 |
$thumbnail_args = '';
|
@@ -42,7 +42,7 @@ call_user_func(
|
|
42 |
}
|
43 |
}
|
44 |
?>
|
45 |
-
<article
|
46 |
<?php if ( has_post_thumbnail() ) : ?>
|
47 |
class="post-has-image"
|
48 |
<?php endif; ?>
|
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 = '';
|
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; ?>
|
blog-posts-block/newspack-homepage-articles/blocks/homepage-articles/view.js
CHANGED
@@ -62,45 +62,63 @@ function buildLoadMoreHandler( btnEl ) {
|
|
62 |
hideEl( errorEl );
|
63 |
showEl( loadingEl );
|
64 |
|
65 |
-
const
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
66 |
// Validate received data.
|
67 |
-
if ( isPostsDataValid( data ) ) {
|
|
|
|
|
|
|
|
|
68 |
// Render posts' HTML from string.
|
69 |
const postsHTML = data.items.map( item => item.html ).join( '' );
|
70 |
postsContainerEl.insertAdjacentHTML( 'beforeend', postsHTML );
|
|
|
71 |
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
// Unhide button since there are more posts available.
|
77 |
-
showEl( btnEl );
|
78 |
-
} else {
|
79 |
-
isEndOfData = true;
|
80 |
-
}
|
81 |
|
82 |
-
|
|
|
|
|
83 |
|
84 |
-
|
|
|
85 |
}
|
86 |
-
};
|
87 |
|
88 |
-
|
|
|
|
|
|
|
|
|
|
|
89 |
isFetching = false;
|
90 |
|
91 |
// Display error message and keep the button visible to enable retrying.
|
92 |
hideEl( loadingEl );
|
93 |
showEl( errorEl );
|
94 |
showEl( btnEl );
|
95 |
-
}
|
96 |
-
|
97 |
-
fetchWithRetry(
|
98 |
-
{ url: btnEl.getAttribute( btnURLAttr ), onSuccess, onError },
|
99 |
-
fetchRetryCount
|
100 |
-
);
|
101 |
};
|
102 |
}
|
103 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
104 |
/**
|
105 |
* Wrapper for XMLHttpRequest that performs given number of retries when error
|
106 |
* occurs.
|
@@ -165,19 +183,26 @@ function fetchWithRetry( options, n ) {
|
|
165 |
* @param {Object} data posts endpoint payload
|
166 |
*/
|
167 |
function isPostsDataValid( data ) {
|
|
|
|
|
168 |
if (
|
169 |
data &&
|
170 |
hasOwnProp( data, 'items' ) &&
|
171 |
-
hasOwnProp( data, 'next' ) &&
|
172 |
Array.isArray( data.items ) &&
|
173 |
-
data
|
174 |
-
|
175 |
-
typeof data.items[ 0 ].html === 'string'
|
176 |
) {
|
177 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
178 |
}
|
179 |
|
180 |
-
return
|
181 |
}
|
182 |
|
183 |
/**
|
62 |
hideEl( errorEl );
|
63 |
showEl( loadingEl );
|
64 |
|
65 |
+
const requestURL = new URL( btnEl.getAttribute( btnURLAttr ) );
|
66 |
+
|
67 |
+
// Set currenty rendered posts' IDs as a query param (e.g. exclude_ids=1,2,3)
|
68 |
+
requestURL.searchParams.set( 'exclude_ids', getRenderedPostsIds().join( ',' ) );
|
69 |
+
|
70 |
+
fetchWithRetry( { url: requestURL.toString(), onSuccess, onError }, fetchRetryCount );
|
71 |
+
|
72 |
+
function onSuccess( data ) {
|
73 |
// Validate received data.
|
74 |
+
if ( ! isPostsDataValid( data ) ) {
|
75 |
+
return onError();
|
76 |
+
}
|
77 |
+
|
78 |
+
if ( data.items.length ) {
|
79 |
// Render posts' HTML from string.
|
80 |
const postsHTML = data.items.map( item => item.html ).join( '' );
|
81 |
postsContainerEl.insertAdjacentHTML( 'beforeend', postsHTML );
|
82 |
+
}
|
83 |
|
84 |
+
if ( data.next ) {
|
85 |
+
// Save next URL as button's attribute.
|
86 |
+
btnEl.setAttribute( btnURLAttr, data.next );
|
|
|
|
|
|
|
|
|
|
|
|
|
87 |
|
88 |
+
// Unhide button since there are more posts available.
|
89 |
+
showEl( btnEl );
|
90 |
+
}
|
91 |
|
92 |
+
if ( ! data.items.length || ! data.next ) {
|
93 |
+
isEndOfData = true;
|
94 |
}
|
|
|
95 |
|
96 |
+
isFetching = false;
|
97 |
+
|
98 |
+
hideEl( loadingEl );
|
99 |
+
}
|
100 |
+
|
101 |
+
function onError() {
|
102 |
isFetching = false;
|
103 |
|
104 |
// Display error message and keep the button visible to enable retrying.
|
105 |
hideEl( loadingEl );
|
106 |
showEl( errorEl );
|
107 |
showEl( btnEl );
|
108 |
+
}
|
|
|
|
|
|
|
|
|
|
|
109 |
};
|
110 |
}
|
111 |
|
112 |
+
/**
|
113 |
+
* Returns unique IDs for posts that are currently in the DOM.
|
114 |
+
*/
|
115 |
+
function getRenderedPostsIds() {
|
116 |
+
const postEls = document.querySelectorAll( 'article[data-post-id]' );
|
117 |
+
const postIds = Array.from( postEls ).map( el => el.getAttribute( 'data-post-id' ) );
|
118 |
+
|
119 |
+
return [ ...new Set( postIds ) ]; // Make values unique with Set
|
120 |
+
}
|
121 |
+
|
122 |
/**
|
123 |
* Wrapper for XMLHttpRequest that performs given number of retries when error
|
124 |
* occurs.
|
183 |
* @param {Object} data posts endpoint payload
|
184 |
*/
|
185 |
function isPostsDataValid( data ) {
|
186 |
+
let isValid = false;
|
187 |
+
|
188 |
if (
|
189 |
data &&
|
190 |
hasOwnProp( data, 'items' ) &&
|
|
|
191 |
Array.isArray( data.items ) &&
|
192 |
+
hasOwnProp( data, 'next' ) &&
|
193 |
+
typeof data.next === 'string'
|
|
|
194 |
) {
|
195 |
+
isValid = true;
|
196 |
+
|
197 |
+
if (
|
198 |
+
data.items.length &&
|
199 |
+
! ( hasOwnProp( data.items[ 0 ], 'html' ) && typeof data.items[ 0 ].html === 'string' )
|
200 |
+
) {
|
201 |
+
isValid = false;
|
202 |
+
}
|
203 |
}
|
204 |
|
205 |
+
return isValid;
|
206 |
}
|
207 |
|
208 |
/**
|
blog-posts-block/newspack-homepage-articles/blocks/homepage-articles/view.php
CHANGED
@@ -15,7 +15,7 @@
|
|
15 |
function newspack_blocks_render_block_homepage_articles( $attributes ) {
|
16 |
$article_query = new WP_Query( Newspack_Blocks::build_articles_query( $attributes ) );
|
17 |
|
18 |
-
$classes = Newspack_Blocks::block_classes( 'homepage-articles', $attributes,
|
19 |
|
20 |
if ( isset( $attributes['postLayout'] ) && 'grid' === $attributes['postLayout'] ) {
|
21 |
$classes .= ' is-grid';
|
@@ -69,7 +69,7 @@ function newspack_blocks_render_block_homepage_articles( $attributes ) {
|
|
69 |
},
|
70 |
$attributes
|
71 |
),
|
72 |
-
|
73 |
),
|
74 |
rest_url( '/newspack-blocks/v1/articles' )
|
75 |
);
|
@@ -77,8 +77,8 @@ function newspack_blocks_render_block_homepage_articles( $attributes ) {
|
|
77 |
ob_start();
|
78 |
|
79 |
if ( $article_query->have_posts() ) : ?>
|
80 |
-
<div>
|
81 |
-
<div data-posts-container
|
82 |
<?php if ( '' !== $attributes['sectionHeader'] ) : ?>
|
83 |
<h2 class="article-section-title">
|
84 |
<span><?php echo wp_kses_post( $attributes['sectionHeader'] ); ?></span>
|
@@ -94,11 +94,11 @@ function newspack_blocks_render_block_homepage_articles( $attributes ) {
|
|
94 |
|
95 |
echo Newspack_Blocks::template_inc(
|
96 |
__DIR__ . '/templates/articles-list.php',
|
97 |
-
|
98 |
'articles_rest_url' => $articles_rest_url,
|
99 |
'article_query' => $article_query,
|
100 |
'attributes' => $attributes,
|
101 |
-
|
102 |
);
|
103 |
?>
|
104 |
</div>
|
@@ -119,7 +119,13 @@ function newspack_blocks_render_block_homepage_articles( $attributes ) {
|
|
119 |
if ( ! Newspack_Blocks::is_amp() && $has_more_pages && boolval( $attributes['moreButton'] ) ) :
|
120 |
?>
|
121 |
<button type="button" data-load-more-btn data-load-more-url="<?php echo esc_url( $articles_rest_url ); ?>">
|
122 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
123 |
</button>
|
124 |
<p data-load-more-loading-text hidden>
|
125 |
<?php _e( 'Loading...', 'newspack-blocks' ); ?>
|
@@ -190,9 +196,9 @@ function newspack_blocks_format_avatars( $author_info ) {
|
|
190 |
function newspack_blocks_format_byline( $author_info ) {
|
191 |
$index = -1;
|
192 |
$elements = array_merge(
|
193 |
-
|
194 |
esc_html_x( 'by', 'post author', 'newspack-blocks' ) . ' ',
|
195 |
-
|
196 |
array_reduce(
|
197 |
$author_info,
|
198 |
function ( $accumulator, $author ) use ( $author_info, &$index ) {
|
@@ -201,7 +207,7 @@ function newspack_blocks_format_byline( $author_info ) {
|
|
201 |
|
202 |
return array_merge(
|
203 |
$accumulator,
|
204 |
-
|
205 |
sprintf(
|
206 |
/* translators: 1: author link. 2: author name. 3. variable seperator (comma, 'and', or empty) */
|
207 |
'<span class="author vcard"><a class="url fn n" href="%1$s">%2$s</a></span>',
|
@@ -210,10 +216,10 @@ function newspack_blocks_format_byline( $author_info ) {
|
|
210 |
),
|
211 |
( $index < $penultimate ) ? ', ' : '',
|
212 |
( count( $author_info ) > 1 && $penultimate === $index ) ? esc_html_x( ' and ', 'post author', 'newspack-blocks' ) : '',
|
213 |
-
|
214 |
);
|
215 |
},
|
216 |
-
|
217 |
)
|
218 |
);
|
219 |
|
15 |
function newspack_blocks_render_block_homepage_articles( $attributes ) {
|
16 |
$article_query = new WP_Query( Newspack_Blocks::build_articles_query( $attributes ) );
|
17 |
|
18 |
+
$classes = Newspack_Blocks::block_classes( 'homepage-articles', $attributes, array( 'wpnbha' ) );
|
19 |
|
20 |
if ( isset( $attributes['postLayout'] ) && 'grid' === $attributes['postLayout'] ) {
|
21 |
$classes .= ' is-grid';
|
69 |
},
|
70 |
$attributes
|
71 |
),
|
72 |
+
array( 'page' => 2 )
|
73 |
),
|
74 |
rest_url( '/newspack-blocks/v1/articles' )
|
75 |
);
|
77 |
ob_start();
|
78 |
|
79 |
if ( $article_query->have_posts() ) : ?>
|
80 |
+
<div class="<?php echo esc_attr( $classes ); ?>" style="<?php echo esc_attr( $styles ); ?>">
|
81 |
+
<div data-posts-container>
|
82 |
<?php if ( '' !== $attributes['sectionHeader'] ) : ?>
|
83 |
<h2 class="article-section-title">
|
84 |
<span><?php echo wp_kses_post( $attributes['sectionHeader'] ); ?></span>
|
94 |
|
95 |
echo Newspack_Blocks::template_inc(
|
96 |
__DIR__ . '/templates/articles-list.php',
|
97 |
+
array(
|
98 |
'articles_rest_url' => $articles_rest_url,
|
99 |
'article_query' => $article_query,
|
100 |
'attributes' => $attributes,
|
101 |
+
)
|
102 |
);
|
103 |
?>
|
104 |
</div>
|
119 |
if ( ! Newspack_Blocks::is_amp() && $has_more_pages && boolval( $attributes['moreButton'] ) ) :
|
120 |
?>
|
121 |
<button type="button" data-load-more-btn data-load-more-url="<?php echo esc_url( $articles_rest_url ); ?>">
|
122 |
+
<?php
|
123 |
+
if ( ! empty( $attributes['moreButtonText'] ) ) {
|
124 |
+
echo esc_html( $attributes['moreButtonText'] );
|
125 |
+
} else {
|
126 |
+
esc_html_e( 'Load more posts', 'newspack-blocks' );
|
127 |
+
}
|
128 |
+
?>
|
129 |
</button>
|
130 |
<p data-load-more-loading-text hidden>
|
131 |
<?php _e( 'Loading...', 'newspack-blocks' ); ?>
|
196 |
function newspack_blocks_format_byline( $author_info ) {
|
197 |
$index = -1;
|
198 |
$elements = array_merge(
|
199 |
+
array(
|
200 |
esc_html_x( 'by', 'post author', 'newspack-blocks' ) . ' ',
|
201 |
+
),
|
202 |
array_reduce(
|
203 |
$author_info,
|
204 |
function ( $accumulator, $author ) use ( $author_info, &$index ) {
|
207 |
|
208 |
return array_merge(
|
209 |
$accumulator,
|
210 |
+
array(
|
211 |
sprintf(
|
212 |
/* translators: 1: author link. 2: author name. 3. variable seperator (comma, 'and', or empty) */
|
213 |
'<span class="author vcard"><a class="url fn n" href="%1$s">%2$s</a></span>',
|
216 |
),
|
217 |
( $index < $penultimate ) ? ', ' : '',
|
218 |
( count( $author_info ) > 1 && $penultimate === $index ) ? esc_html_x( ' and ', 'post author', 'newspack-blocks' ) : '',
|
219 |
+
)
|
220 |
);
|
221 |
},
|
222 |
+
array()
|
223 |
)
|
224 |
);
|
225 |
|
blog-posts-block/newspack-homepage-articles/blocks/homepage-articles/view.scss
CHANGED
@@ -23,13 +23,15 @@
|
|
23 |
}
|
24 |
|
25 |
/* Column styles */
|
26 |
-
&.is-grid {
|
27 |
display: flex;
|
28 |
flex-wrap: wrap;
|
29 |
justify-content: space-between;
|
30 |
padding: 0;
|
31 |
list-style: none;
|
|
|
32 |
|
|
|
33 |
article {
|
34 |
flex-basis: 100%;
|
35 |
|
@@ -82,7 +84,7 @@
|
|
82 |
font-size: $font__size-xxs;
|
83 |
}
|
84 |
|
85 |
-
|
86 |
margin-bottom: 0.25em;
|
87 |
|
88 |
figcaption {
|
@@ -107,12 +109,14 @@
|
|
107 |
display: block;
|
108 |
}
|
109 |
|
110 |
-
// Image scale
|
111 |
@include media(mobile) {
|
112 |
&.mobile-stack .post-has-image {
|
113 |
display: flex;
|
114 |
}
|
|
|
115 |
|
|
|
|
|
116 |
&.is-4 {
|
117 |
.post-thumbnail {
|
118 |
flex-basis: 75%;
|
@@ -142,21 +146,40 @@
|
|
142 |
}
|
143 |
}
|
144 |
|
145 |
-
&.image-alignleft {
|
146 |
-
|
147 |
-
margin-right: 1em;
|
148 |
-
}
|
149 |
}
|
150 |
|
151 |
&.image-alignright {
|
152 |
.post-thumbnail {
|
153 |
margin-left: 1em;
|
154 |
}
|
|
|
155 |
.entry-wrapper {
|
156 |
order: -1;
|
157 |
}
|
158 |
}
|
159 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
160 |
/* Headings */
|
161 |
.entry-title {
|
162 |
margin: 0 0 0.25em;
|
@@ -190,6 +213,10 @@
|
|
190 |
.byline:not(:last-child) {
|
191 |
margin-right: 1.5em;
|
192 |
}
|
|
|
|
|
|
|
|
|
193 |
}
|
194 |
|
195 |
.avatar {
|
@@ -234,6 +261,7 @@
|
|
234 |
.post-thumbnail {
|
235 |
bottom: 0;
|
236 |
left: 0;
|
|
|
237 |
overflow: hidden;
|
238 |
position: absolute;
|
239 |
right: 0;
|
23 |
}
|
24 |
|
25 |
/* Column styles */
|
26 |
+
&.is-grid > div {
|
27 |
display: flex;
|
28 |
flex-wrap: wrap;
|
29 |
justify-content: space-between;
|
30 |
padding: 0;
|
31 |
list-style: none;
|
32 |
+
}
|
33 |
|
34 |
+
&.is-grid {
|
35 |
article {
|
36 |
flex-basis: 100%;
|
37 |
|
84 |
font-size: $font__size-xxs;
|
85 |
}
|
86 |
|
87 |
+
.post-thumbnail {
|
88 |
margin-bottom: 0.25em;
|
89 |
|
90 |
figcaption {
|
109 |
display: block;
|
110 |
}
|
111 |
|
|
|
112 |
@include media(mobile) {
|
113 |
&.mobile-stack .post-has-image {
|
114 |
display: flex;
|
115 |
}
|
116 |
+
}
|
117 |
|
118 |
+
// Image scale
|
119 |
+
@include media(mobile) {
|
120 |
&.is-4 {
|
121 |
.post-thumbnail {
|
122 |
flex-basis: 75%;
|
146 |
}
|
147 |
}
|
148 |
|
149 |
+
&.image-alignleft .post-thumbnail {
|
150 |
+
margin-right: 1em;
|
|
|
|
|
151 |
}
|
152 |
|
153 |
&.image-alignright {
|
154 |
.post-thumbnail {
|
155 |
margin-left: 1em;
|
156 |
}
|
157 |
+
|
158 |
.entry-wrapper {
|
159 |
order: -1;
|
160 |
}
|
161 |
}
|
162 |
|
163 |
+
&.mobile-stack {
|
164 |
+
&.image-alignleft,
|
165 |
+
&.image-alignright {
|
166 |
+
.post-thumbnail {
|
167 |
+
margin-left: 0;
|
168 |
+
margin-right: 0;
|
169 |
+
}
|
170 |
+
}
|
171 |
+
}
|
172 |
+
|
173 |
+
@include media( mobile ) {
|
174 |
+
&.mobile-stack.image-alignleft .post-thumbnail {
|
175 |
+
margin-right: 1em;
|
176 |
+
}
|
177 |
+
|
178 |
+
&.mobile-stack.image-alignright .post-thumbnail {
|
179 |
+
margin-left: 1em;
|
180 |
+
}
|
181 |
+
}
|
182 |
+
|
183 |
/* Headings */
|
184 |
.entry-title {
|
185 |
margin: 0 0 0.25em;
|
213 |
.byline:not(:last-child) {
|
214 |
margin-right: 1.5em;
|
215 |
}
|
216 |
+
|
217 |
+
.updated:not(.published) {
|
218 |
+
display: none;
|
219 |
+
}
|
220 |
}
|
221 |
|
222 |
.avatar {
|
261 |
.post-thumbnail {
|
262 |
bottom: 0;
|
263 |
left: 0;
|
264 |
+
margin: 0;
|
265 |
overflow: hidden;
|
266 |
position: absolute;
|
267 |
right: 0;
|
blog-posts-block/newspack-homepage-articles/class-newspack-blocks-api.php
CHANGED
@@ -15,61 +15,61 @@ class Newspack_Blocks_API {
|
|
15 |
*/
|
16 |
public static function register_rest_fields() {
|
17 |
register_rest_field(
|
18 |
-
|
19 |
'newspack_featured_image_src',
|
20 |
-
|
21 |
-
'get_callback' =>
|
22 |
-
'schema' =>
|
23 |
-
'context' =>
|
24 |
'edit',
|
25 |
-
|
26 |
'type' => 'array',
|
27 |
-
|
28 |
-
|
29 |
);
|
30 |
|
31 |
register_rest_field(
|
32 |
-
|
33 |
'newspack_featured_image_caption',
|
34 |
-
|
35 |
-
'get_callback' =>
|
36 |
-
'schema' =>
|
37 |
-
'context' =>
|
38 |
'edit',
|
39 |
-
|
40 |
'type' => 'string',
|
41 |
-
|
42 |
-
|
43 |
);
|
44 |
|
45 |
/* Add author info source */
|
46 |
register_rest_field(
|
47 |
'post',
|
48 |
'newspack_author_info',
|
49 |
-
|
50 |
-
'get_callback' =>
|
51 |
-
'schema' =>
|
52 |
-
'context' =>
|
53 |
'edit',
|
54 |
-
|
55 |
'type' => 'array',
|
56 |
-
|
57 |
-
|
58 |
);
|
59 |
|
60 |
/* Add first category source */
|
61 |
register_rest_field(
|
62 |
'post',
|
63 |
'newspack_category_info',
|
64 |
-
|
65 |
-
'get_callback' =>
|
66 |
-
'schema' =>
|
67 |
-
'context' =>
|
68 |
'edit',
|
69 |
-
|
70 |
'type' => 'string',
|
71 |
-
|
72 |
-
|
73 |
);
|
74 |
}
|
75 |
|
@@ -80,7 +80,7 @@ class Newspack_Blocks_API {
|
|
80 |
* @return array | bool Featured image if available, false if not.
|
81 |
*/
|
82 |
public static function newspack_blocks_get_image_src( $object ) {
|
83 |
-
$featured_image_set =
|
84 |
|
85 |
if ( 0 === $object['featured_media'] ) {
|
86 |
return false;
|
@@ -146,7 +146,7 @@ class Newspack_Blocks_API {
|
|
146 |
* @return array Author data.
|
147 |
*/
|
148 |
public static function newspack_blocks_get_author_info( $object ) {
|
149 |
-
$author_data =
|
150 |
|
151 |
if ( function_exists( 'coauthors_posts_links' ) ) :
|
152 |
$authors = get_coauthors();
|
@@ -169,6 +169,8 @@ class Newspack_Blocks_API {
|
|
169 |
'display_name' => esc_html( $author->display_name ),
|
170 |
/* Get the author avatar */
|
171 |
'avatar' => wp_kses_post( $author_avatar ),
|
|
|
|
|
172 |
);
|
173 |
}
|
174 |
else :
|
@@ -177,6 +179,8 @@ class Newspack_Blocks_API {
|
|
177 |
'display_name' => get_the_author_meta( 'display_name', $object['author'] ),
|
178 |
/* Get the author avatar */
|
179 |
'avatar' => get_avatar( $object['author'], 48 ),
|
|
|
|
|
180 |
);
|
181 |
endif;
|
182 |
|
15 |
*/
|
16 |
public static function register_rest_fields() {
|
17 |
register_rest_field(
|
18 |
+
array( 'post', 'page' ),
|
19 |
'newspack_featured_image_src',
|
20 |
+
array(
|
21 |
+
'get_callback' => array( 'Newspack_Blocks_API', 'newspack_blocks_get_image_src' ),
|
22 |
+
'schema' => array(
|
23 |
+
'context' => array(
|
24 |
'edit',
|
25 |
+
),
|
26 |
'type' => 'array',
|
27 |
+
),
|
28 |
+
)
|
29 |
);
|
30 |
|
31 |
register_rest_field(
|
32 |
+
array( 'post', 'page' ),
|
33 |
'newspack_featured_image_caption',
|
34 |
+
array(
|
35 |
+
'get_callback' => array( 'Newspack_Blocks_API', 'newspack_blocks_get_image_caption' ),
|
36 |
+
'schema' => array(
|
37 |
+
'context' => array(
|
38 |
'edit',
|
39 |
+
),
|
40 |
'type' => 'string',
|
41 |
+
),
|
42 |
+
)
|
43 |
);
|
44 |
|
45 |
/* Add author info source */
|
46 |
register_rest_field(
|
47 |
'post',
|
48 |
'newspack_author_info',
|
49 |
+
array(
|
50 |
+
'get_callback' => array( 'Newspack_Blocks_API', 'newspack_blocks_get_author_info' ),
|
51 |
+
'schema' => array(
|
52 |
+
'context' => array(
|
53 |
'edit',
|
54 |
+
),
|
55 |
'type' => 'array',
|
56 |
+
),
|
57 |
+
)
|
58 |
);
|
59 |
|
60 |
/* Add first category source */
|
61 |
register_rest_field(
|
62 |
'post',
|
63 |
'newspack_category_info',
|
64 |
+
array(
|
65 |
+
'get_callback' => array( 'Newspack_Blocks_API', 'newspack_blocks_get_primary_category' ),
|
66 |
+
'schema' => array(
|
67 |
+
'context' => array(
|
68 |
'edit',
|
69 |
+
),
|
70 |
'type' => 'string',
|
71 |
+
),
|
72 |
+
)
|
73 |
);
|
74 |
}
|
75 |
|
80 |
* @return array | bool Featured image if available, false if not.
|
81 |
*/
|
82 |
public static function newspack_blocks_get_image_src( $object ) {
|
83 |
+
$featured_image_set = array();
|
84 |
|
85 |
if ( 0 === $object['featured_media'] ) {
|
86 |
return false;
|
146 |
* @return array Author data.
|
147 |
*/
|
148 |
public static function newspack_blocks_get_author_info( $object ) {
|
149 |
+
$author_data = array();
|
150 |
|
151 |
if ( function_exists( 'coauthors_posts_links' ) ) :
|
152 |
$authors = get_coauthors();
|
169 |
'display_name' => esc_html( $author->display_name ),
|
170 |
/* Get the author avatar */
|
171 |
'avatar' => wp_kses_post( $author_avatar ),
|
172 |
+
/* Get the author ID */
|
173 |
+
'id' => $author->ID,
|
174 |
);
|
175 |
}
|
176 |
else :
|
179 |
'display_name' => get_the_author_meta( 'display_name', $object['author'] ),
|
180 |
/* Get the author avatar */
|
181 |
'avatar' => get_avatar( $object['author'], 48 ),
|
182 |
+
/* Get the author ID */
|
183 |
+
'id' => $object['author'],
|
184 |
);
|
185 |
endif;
|
186 |
|
blog-posts-block/newspack-homepage-articles/class-newspack-blocks.php
CHANGED
@@ -10,6 +10,13 @@
|
|
10 |
*/
|
11 |
class Newspack_Blocks {
|
12 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
13 |
/**
|
14 |
* Gather dependencies and paths needed for script enqueuing.
|
15 |
*
|
@@ -169,7 +176,7 @@ class Newspack_Blocks {
|
|
169 |
* @return string Class list separated by spaces.
|
170 |
*/
|
171 |
public static function block_classes( $type, $attributes = array(), $extra = array() ) {
|
172 |
-
$classes =
|
173 |
|
174 |
if ( ! empty( $attributes['align'] ) ) {
|
175 |
$classes[] = 'align' . $attributes['align'];
|
@@ -267,6 +274,8 @@ class Newspack_Blocks {
|
|
267 |
return 'newspack-article-block-' . $orientation . '-' . $key;
|
268 |
}
|
269 |
}
|
|
|
|
|
270 |
}
|
271 |
|
272 |
/**
|
@@ -307,6 +316,7 @@ class Newspack_Blocks {
|
|
307 |
$authors = isset( $attributes['authors'] ) ? $attributes['authors'] : array();
|
308 |
$categories = isset( $attributes['categories'] ) ? $attributes['categories'] : array();
|
309 |
$tags = isset( $attributes['tags'] ) ? $attributes['tags'] : array();
|
|
|
310 |
$specific_posts = isset( $attributes['specificPosts'] ) ? $attributes['specificPosts'] : array();
|
311 |
$posts_to_show = intval( $attributes['postsToShow'] );
|
312 |
$specific_mode = intval( $attributes['specificMode'] );
|
@@ -320,15 +330,18 @@ class Newspack_Blocks {
|
|
320 |
$args['orderby'] = 'post__in';
|
321 |
} else {
|
322 |
$args['posts_per_page'] = $posts_to_show + count( $newspack_blocks_post_id );
|
323 |
-
if ( $authors ) {
|
324 |
$args['author__in'] = $authors;
|
325 |
}
|
326 |
-
if ( $categories ) {
|
327 |
$args['category__in'] = $categories;
|
328 |
}
|
329 |
-
if ( $tags ) {
|
330 |
$args['tag__in'] = $tags;
|
331 |
}
|
|
|
|
|
|
|
332 |
}
|
333 |
return $args;
|
334 |
}
|
@@ -391,3 +404,4 @@ class Newspack_Blocks {
|
|
391 |
);
|
392 |
}
|
393 |
}
|
|
10 |
*/
|
11 |
class Newspack_Blocks {
|
12 |
|
13 |
+
/**
|
14 |
+
* Add hooks and filters.
|
15 |
+
*/
|
16 |
+
public static function init() {
|
17 |
+
add_action( 'after_setup_theme', array( __CLASS__, 'add_image_sizes' ) );
|
18 |
+
}
|
19 |
+
|
20 |
/**
|
21 |
* Gather dependencies and paths needed for script enqueuing.
|
22 |
*
|
176 |
* @return string Class list separated by spaces.
|
177 |
*/
|
178 |
public static function block_classes( $type, $attributes = array(), $extra = array() ) {
|
179 |
+
$classes = array( "wp-block-newspack-blocks-{$type}" );
|
180 |
|
181 |
if ( ! empty( $attributes['align'] ) ) {
|
182 |
$classes[] = 'align' . $attributes['align'];
|
274 |
return 'newspack-article-block-' . $orientation . '-' . $key;
|
275 |
}
|
276 |
}
|
277 |
+
|
278 |
+
return 'large';
|
279 |
}
|
280 |
|
281 |
/**
|
316 |
$authors = isset( $attributes['authors'] ) ? $attributes['authors'] : array();
|
317 |
$categories = isset( $attributes['categories'] ) ? $attributes['categories'] : array();
|
318 |
$tags = isset( $attributes['tags'] ) ? $attributes['tags'] : array();
|
319 |
+
$tag_exclusions = isset( $attributes['tagExclusions'] ) ? $attributes['tagExclusions'] : array();
|
320 |
$specific_posts = isset( $attributes['specificPosts'] ) ? $attributes['specificPosts'] : array();
|
321 |
$posts_to_show = intval( $attributes['postsToShow'] );
|
322 |
$specific_mode = intval( $attributes['specificMode'] );
|
330 |
$args['orderby'] = 'post__in';
|
331 |
} else {
|
332 |
$args['posts_per_page'] = $posts_to_show + count( $newspack_blocks_post_id );
|
333 |
+
if ( $authors && count( $authors ) ) {
|
334 |
$args['author__in'] = $authors;
|
335 |
}
|
336 |
+
if ( $categories && count( $categories ) ) {
|
337 |
$args['category__in'] = $categories;
|
338 |
}
|
339 |
+
if ( $tags && count( $tags ) ) {
|
340 |
$args['tag__in'] = $tags;
|
341 |
}
|
342 |
+
if ( $tag_exclusions && count( $tag_exclusions ) ) {
|
343 |
+
$args['tag__not_in'] = $tag_exclusions;
|
344 |
+
}
|
345 |
}
|
346 |
return $args;
|
347 |
}
|
404 |
);
|
405 |
}
|
406 |
}
|
407 |
+
Newspack_Blocks::init();
|
blog-posts-block/newspack-homepage-articles/components/query-controls.js
CHANGED
@@ -3,7 +3,12 @@
|
|
3 |
*/
|
4 |
import { __ } from '@wordpress/i18n';
|
5 |
import { Component, Fragment } from '@wordpress/element';
|
6 |
-
import {
|
|
|
|
|
|
|
|
|
|
|
7 |
import apiFetch from '@wordpress/api-fetch';
|
8 |
import { addQueryArgs } from '@wordpress/url';
|
9 |
import { decodeEntities } from '@wordpress/html-entities';
|
@@ -14,6 +19,9 @@ import { decodeEntities } from '@wordpress/html-entities';
|
|
14 |
import AutocompleteTokenField from './autocomplete-tokenfield';
|
15 |
|
16 |
class QueryControls extends Component {
|
|
|
|
|
|
|
17 |
|
18 |
fetchPostSuggestions = search => {
|
19 |
return apiFetch( {
|
@@ -151,12 +159,16 @@ class QueryControls extends Component {
|
|
151 |
onCategoriesChange,
|
152 |
tags,
|
153 |
onTagsChange,
|
|
|
|
|
154 |
enableSpecific,
|
155 |
} = this.props;
|
|
|
156 |
|
157 |
return [
|
158 |
enableSpecific && (
|
159 |
<ToggleControl
|
|
|
160 |
checked={ specificMode }
|
161 |
onChange={ onSpecificModeChange }
|
162 |
label={ __( 'Choose specific stories', 'newspack-blocks' ) }
|
@@ -164,6 +176,7 @@ class QueryControls extends Component {
|
|
164 |
),
|
165 |
specificMode && (
|
166 |
<AutocompleteTokenField
|
|
|
167 |
tokens={ specificPosts || [] }
|
168 |
onChange={ onSpecificPostsChange }
|
169 |
fetchSuggestions={ this.fetchPostSuggestions }
|
@@ -171,9 +184,10 @@ class QueryControls extends Component {
|
|
171 |
label={ __( 'Posts', 'newspack-blocks' ) }
|
172 |
/>
|
173 |
),
|
174 |
-
! specificMode && <BaseControl { ...this.props } />,
|
175 |
! specificMode && onAuthorsChange && (
|
176 |
<AutocompleteTokenField
|
|
|
177 |
tokens={ authors || [] }
|
178 |
onChange={ onAuthorsChange }
|
179 |
fetchSuggestions={ this.fetchAuthorSuggestions }
|
@@ -183,15 +197,17 @@ class QueryControls extends Component {
|
|
183 |
),
|
184 |
! specificMode && onCategoriesChange && (
|
185 |
<AutocompleteTokenField
|
|
|
186 |
tokens={ categories || [] }
|
187 |
onChange={ onCategoriesChange }
|
188 |
fetchSuggestions={ this.fetchCategorySuggestions }
|
189 |
fetchSavedInfo={ this.fetchSavedCategories }
|
190 |
label={ __( 'Categories', 'newspack-blocks' ) }
|
191 |
-
|
192 |
),
|
193 |
! specificMode && onTagsChange && (
|
194 |
<AutocompleteTokenField
|
|
|
195 |
tokens={ tags || [] }
|
196 |
onChange={ onTagsChange }
|
197 |
fetchSuggestions={ this.fetchTagSuggestions }
|
@@ -199,6 +215,29 @@ class QueryControls extends Component {
|
|
199 |
label={ __( 'Tags', 'newspack-blocks' ) }
|
200 |
/>
|
201 |
),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
202 |
];
|
203 |
};
|
204 |
}
|
@@ -209,6 +248,7 @@ QueryControls.defaultProps = {
|
|
209 |
authors: [],
|
210 |
categories: [],
|
211 |
tags: [],
|
|
|
212 |
};
|
213 |
|
214 |
export default QueryControls;
|
3 |
*/
|
4 |
import { __ } from '@wordpress/i18n';
|
5 |
import { Component, Fragment } from '@wordpress/element';
|
6 |
+
import {
|
7 |
+
Button,
|
8 |
+
QueryControls as BaseControl,
|
9 |
+
SelectControl,
|
10 |
+
ToggleControl,
|
11 |
+
} from '@wordpress/components';
|
12 |
import apiFetch from '@wordpress/api-fetch';
|
13 |
import { addQueryArgs } from '@wordpress/url';
|
14 |
import { decodeEntities } from '@wordpress/html-entities';
|
19 |
import AutocompleteTokenField from './autocomplete-tokenfield';
|
20 |
|
21 |
class QueryControls extends Component {
|
22 |
+
state = {
|
23 |
+
showAdvancedFilters: false,
|
24 |
+
};
|
25 |
|
26 |
fetchPostSuggestions = search => {
|
27 |
return apiFetch( {
|
159 |
onCategoriesChange,
|
160 |
tags,
|
161 |
onTagsChange,
|
162 |
+
tagExclusions,
|
163 |
+
onTagExclusionsChange,
|
164 |
enableSpecific,
|
165 |
} = this.props;
|
166 |
+
const { showAdvancedFilters } = this.state;
|
167 |
|
168 |
return [
|
169 |
enableSpecific && (
|
170 |
<ToggleControl
|
171 |
+
key="specificMode"
|
172 |
checked={ specificMode }
|
173 |
onChange={ onSpecificModeChange }
|
174 |
label={ __( 'Choose specific stories', 'newspack-blocks' ) }
|
176 |
),
|
177 |
specificMode && (
|
178 |
<AutocompleteTokenField
|
179 |
+
key="posts"
|
180 |
tokens={ specificPosts || [] }
|
181 |
onChange={ onSpecificPostsChange }
|
182 |
fetchSuggestions={ this.fetchPostSuggestions }
|
184 |
label={ __( 'Posts', 'newspack-blocks' ) }
|
185 |
/>
|
186 |
),
|
187 |
+
! specificMode && <BaseControl key="queryControls" { ...this.props } />,
|
188 |
! specificMode && onAuthorsChange && (
|
189 |
<AutocompleteTokenField
|
190 |
+
key="authors"
|
191 |
tokens={ authors || [] }
|
192 |
onChange={ onAuthorsChange }
|
193 |
fetchSuggestions={ this.fetchAuthorSuggestions }
|
197 |
),
|
198 |
! specificMode && onCategoriesChange && (
|
199 |
<AutocompleteTokenField
|
200 |
+
key="categories"
|
201 |
tokens={ categories || [] }
|
202 |
onChange={ onCategoriesChange }
|
203 |
fetchSuggestions={ this.fetchCategorySuggestions }
|
204 |
fetchSavedInfo={ this.fetchSavedCategories }
|
205 |
label={ __( 'Categories', 'newspack-blocks' ) }
|
206 |
+
/>
|
207 |
),
|
208 |
! specificMode && onTagsChange && (
|
209 |
<AutocompleteTokenField
|
210 |
+
key="tags"
|
211 |
tokens={ tags || [] }
|
212 |
onChange={ onTagsChange }
|
213 |
fetchSuggestions={ this.fetchTagSuggestions }
|
215 |
label={ __( 'Tags', 'newspack-blocks' ) }
|
216 |
/>
|
217 |
),
|
218 |
+
! specificMode && onTagExclusionsChange && (
|
219 |
+
<p>
|
220 |
+
<Button
|
221 |
+
key="toggle-advanced-filters"
|
222 |
+
isLink
|
223 |
+
onClick={ () => this.setState( { showAdvancedFilters: ! showAdvancedFilters } ) }
|
224 |
+
>
|
225 |
+
{ showAdvancedFilters
|
226 |
+
? __( 'Hide Advanced Filters', 'newspack-blocks' )
|
227 |
+
: __( 'Show Advanced Filters', 'newspack-blocks' ) }
|
228 |
+
</Button>
|
229 |
+
</p>
|
230 |
+
),
|
231 |
+
! specificMode && onTagExclusionsChange && showAdvancedFilters && (
|
232 |
+
<AutocompleteTokenField
|
233 |
+
key="tag-exclusion"
|
234 |
+
tokens={ tagExclusions || [] }
|
235 |
+
onChange={ onTagExclusionsChange }
|
236 |
+
fetchSuggestions={ this.fetchTagSuggestions }
|
237 |
+
fetchSavedInfo={ this.fetchSavedTags }
|
238 |
+
label={ __( 'Excluded Tags', 'newspack-blocks' ) }
|
239 |
+
/>
|
240 |
+
),
|
241 |
];
|
242 |
};
|
243 |
}
|
248 |
authors: [],
|
249 |
categories: [],
|
250 |
tags: [],
|
251 |
+
tagExclusions: [],
|
252 |
};
|
253 |
|
254 |
export default QueryControls;
|
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 |