@automattic/newspack-blocks 1.61.0 → 1.62.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -301,6 +301,7 @@ class Newspack_Blocks_API {
301
301
  'rendered' => post_password_required( $post ) ? '' : $content,
302
302
  ],
303
303
  'date_gmt' => mysql_to_rfc3339( $post_date_gmt ),
304
+ 'date' => mysql_to_rfc3339( $post->post_date ),
304
305
  'excerpt' => [
305
306
  'rendered' => post_password_required( $post ) ? '' : $excerpt,
306
307
  ],
@@ -7,7 +7,7 @@
7
7
  * Author URI: https://newspack.blog/
8
8
  * Text Domain: newspack-blocks
9
9
  * Domain Path: /languages
10
- * Version: 1.61.0
10
+ * Version: 1.62.0
11
11
  *
12
12
  * @package Newspack_Blocks
13
13
  */
@@ -15,7 +15,7 @@
15
15
  define( 'NEWSPACK_BLOCKS__PLUGIN_FILE', __FILE__ );
16
16
  define( 'NEWSPACK_BLOCKS__BLOCKS_DIRECTORY', 'dist/' );
17
17
  define( 'NEWSPACK_BLOCKS__PLUGIN_DIR', plugin_dir_path( NEWSPACK_BLOCKS__PLUGIN_FILE ) );
18
- define( 'NEWSPACK_BLOCKS__VERSION', '1.61.0' );
18
+ define( 'NEWSPACK_BLOCKS__VERSION', '1.62.0' );
19
19
 
20
20
  require_once NEWSPACK_BLOCKS__PLUGIN_DIR . 'includes/class-newspack-blocks.php';
21
21
  require_once NEWSPACK_BLOCKS__PLUGIN_DIR . 'includes/class-newspack-blocks-api.php';
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "@automattic/newspack-blocks",
3
- "version": "1.61.0",
3
+ "version": "1.62.0",
4
4
  "author": "Automattic",
5
5
  "devDependencies": {
6
6
  "@rushstack/eslint-patch": "^1.2.0",
7
- "@testing-library/dom": "^8.19.1",
7
+ "@testing-library/dom": "^8.20.0",
8
8
  "@testing-library/user-event": "^14.4.3",
9
9
  "@types/lodash": "^4.14.191",
10
10
  "@types/lodash.debounce": "^4.0.7",
@@ -28,7 +28,7 @@
28
28
  "redux": "^4.2.0",
29
29
  "redux-saga": "^1.2.2",
30
30
  "regenerator-runtime": "^0.13.11",
31
- "swiper": "8.4.5"
31
+ "swiper": "8.4.6"
32
32
  },
33
33
  "scripts": {
34
34
  "cm": "newspack-scripts commit",
@@ -331,7 +331,7 @@ class Edit extends Component {
331
331
  formatByline( post.newspack_author_info ) }
332
332
  { showDate && (
333
333
  <time className="entry-date published" key="pub-date">
334
- { dateI18n( dateFormat, post.date_gmt ) }
334
+ { dateI18n( dateFormat, post.date ) }
335
335
  </time>
336
336
  ) }
337
337
  </div>
@@ -1,170 +1,174 @@
1
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
- "excerptLength": {
14
- "type": "number",
15
- "default": 55
16
- },
17
- "showReadMore": {
18
- "type": "boolean",
19
- "default": false
20
- },
21
- "readMoreLabel": {
22
- "type": "string",
23
- "default": "Keep reading"
24
- },
25
- "showDate": {
26
- "type": "boolean",
27
- "default": true
28
- },
29
- "showImage": {
30
- "type": "boolean",
31
- "default": true
32
- },
33
- "showCaption": {
34
- "type": "boolean",
35
- "default": false
36
- },
37
- "disableImageLazyLoad": {
38
- "type": "boolean",
39
- "default": false
40
- },
41
- "imageShape": {
42
- "type": "string",
43
- "default": "landscape"
44
- },
45
- "minHeight": {
46
- "type": "integer",
47
- "default": 0
48
- },
49
- "moreButton": {
50
- "type": "boolean",
51
- "default": false
52
- },
53
- "moreButtonText": {
54
- "type": "string",
55
- "default": ""
56
- },
57
- "showAuthor": {
58
- "type": "boolean",
59
- "default": true
60
- },
61
- "showAvatar": {
62
- "type": "boolean",
63
- "default": true
64
- },
65
- "showCategory": {
66
- "type": "boolean",
67
- "default": false
68
- },
69
- "postLayout": {
70
- "type": "string",
71
- "default": "list"
72
- },
73
- "columns": {
74
- "type": "integer",
75
- "default": 3
76
- },
77
- "colGap": {
78
- "type": "integer",
79
- "default": 3
80
- },
81
- "postsToShow": {
82
- "type": "integer",
83
- "default": 3
84
- },
85
- "mediaPosition": {
86
- "type": "string",
87
- "default": "top"
88
- },
89
- "authors": {
90
- "type": "array",
91
- "default": [],
92
- "items": { "type": "integer" }
93
- },
94
- "categories": {
95
- "type": "array",
96
- "default": [],
97
- "items": { "type": "integer" }
98
- },
99
- "tags": {
100
- "type": "array",
101
- "default": [],
102
- "items": { "type": "integer" }
103
- },
104
- "tagExclusions": {
105
- "type": "array",
106
- "default": [],
107
- "items": { "type": "integer" }
108
- },
109
- "categoryExclusions": {
110
- "type": "array",
111
- "default": [],
112
- "items": { "type": "integer" }
113
- },
114
- "specificPosts": {
115
- "type": "array",
116
- "default": [],
117
- "items": { "type": "integer" }
118
- },
119
- "typeScale": {
120
- "type": "integer",
121
- "default": 4
122
- },
123
- "imageScale": {
124
- "type": "integer",
125
- "default": 3
126
- },
127
- "mobileStack": {
128
- "type": "boolean",
129
- "default": false
130
- },
131
- "sectionHeader": {
132
- "type": "string",
133
- "default": ""
134
- },
135
- "specificMode": {
136
- "type": "boolean",
137
- "default": false
138
- },
139
- "textColor": {
140
- "type": "string",
141
- "default": ""
142
- },
143
- "customTextColor": {
144
- "type": "string",
145
- "default": ""
146
- },
147
- "singleMode": {
148
- "type": "boolean",
149
- "default": false
150
- },
151
- "showSubtitle": {
152
- "type": "boolean",
153
- "default": false
154
- },
155
- "postType": {
156
- "type": "array",
157
- "default": [ "post" ],
158
- "items": { "type": "string" }
159
- },
160
- "textAlign": {
161
- "type": "string",
162
- "default": "left"
163
- },
164
- "includedPostStatuses": {
165
- "type": "array",
166
- "default": [ "publish" ],
167
- "items": { "type": "string" }
168
- }
169
- }
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
+ "excerptLength": {
14
+ "type": "number",
15
+ "default": 55
16
+ },
17
+ "showReadMore": {
18
+ "type": "boolean",
19
+ "default": false
20
+ },
21
+ "readMoreLabel": {
22
+ "type": "string",
23
+ "default": "Keep reading"
24
+ },
25
+ "showDate": {
26
+ "type": "boolean",
27
+ "default": true
28
+ },
29
+ "showImage": {
30
+ "type": "boolean",
31
+ "default": true
32
+ },
33
+ "showCaption": {
34
+ "type": "boolean",
35
+ "default": false
36
+ },
37
+ "disableImageLazyLoad": {
38
+ "type": "boolean",
39
+ "default": false
40
+ },
41
+ "fetchPriority": {
42
+ "type": "string",
43
+ "default": ""
44
+ },
45
+ "imageShape": {
46
+ "type": "string",
47
+ "default": "landscape"
48
+ },
49
+ "minHeight": {
50
+ "type": "integer",
51
+ "default": 0
52
+ },
53
+ "moreButton": {
54
+ "type": "boolean",
55
+ "default": false
56
+ },
57
+ "moreButtonText": {
58
+ "type": "string",
59
+ "default": ""
60
+ },
61
+ "showAuthor": {
62
+ "type": "boolean",
63
+ "default": true
64
+ },
65
+ "showAvatar": {
66
+ "type": "boolean",
67
+ "default": true
68
+ },
69
+ "showCategory": {
70
+ "type": "boolean",
71
+ "default": false
72
+ },
73
+ "postLayout": {
74
+ "type": "string",
75
+ "default": "list"
76
+ },
77
+ "columns": {
78
+ "type": "integer",
79
+ "default": 3
80
+ },
81
+ "colGap": {
82
+ "type": "integer",
83
+ "default": 3
84
+ },
85
+ "postsToShow": {
86
+ "type": "integer",
87
+ "default": 3
88
+ },
89
+ "mediaPosition": {
90
+ "type": "string",
91
+ "default": "top"
92
+ },
93
+ "authors": {
94
+ "type": "array",
95
+ "default": [],
96
+ "items": { "type": "integer" }
97
+ },
98
+ "categories": {
99
+ "type": "array",
100
+ "default": [],
101
+ "items": { "type": "integer" }
102
+ },
103
+ "tags": {
104
+ "type": "array",
105
+ "default": [],
106
+ "items": { "type": "integer" }
107
+ },
108
+ "tagExclusions": {
109
+ "type": "array",
110
+ "default": [],
111
+ "items": { "type": "integer" }
112
+ },
113
+ "categoryExclusions": {
114
+ "type": "array",
115
+ "default": [],
116
+ "items": { "type": "integer" }
117
+ },
118
+ "specificPosts": {
119
+ "type": "array",
120
+ "default": [],
121
+ "items": { "type": "integer" }
122
+ },
123
+ "typeScale": {
124
+ "type": "integer",
125
+ "default": 4
126
+ },
127
+ "imageScale": {
128
+ "type": "integer",
129
+ "default": 3
130
+ },
131
+ "mobileStack": {
132
+ "type": "boolean",
133
+ "default": false
134
+ },
135
+ "sectionHeader": {
136
+ "type": "string",
137
+ "default": ""
138
+ },
139
+ "specificMode": {
140
+ "type": "boolean",
141
+ "default": false
142
+ },
143
+ "textColor": {
144
+ "type": "string",
145
+ "default": ""
146
+ },
147
+ "customTextColor": {
148
+ "type": "string",
149
+ "default": ""
150
+ },
151
+ "singleMode": {
152
+ "type": "boolean",
153
+ "default": false
154
+ },
155
+ "showSubtitle": {
156
+ "type": "boolean",
157
+ "default": false
158
+ },
159
+ "postType": {
160
+ "type": "array",
161
+ "default": [ "post" ],
162
+ "items": { "type": "string" }
163
+ },
164
+ "textAlign": {
165
+ "type": "string",
166
+ "default": "left"
167
+ },
168
+ "includedPostStatuses": {
169
+ "type": "array",
170
+ "default": [ "publish" ],
171
+ "items": { "type": "string" }
172
+ }
173
+ }
170
174
  }
@@ -237,7 +237,7 @@ class Edit extends Component {
237
237
 
238
238
  { showDate && ! post.newspack_listings_hide_publish_date && (
239
239
  <time className="entry-date published" key="pub-date">
240
- { dateI18n( dateFormat, post.date_gmt ) }
240
+ { dateI18n( dateFormat, post.date ) }
241
241
  </time>
242
242
  ) }
243
243
  </div>
@@ -271,7 +271,6 @@ class Edit extends Component {
271
271
  postType,
272
272
  showImage,
273
273
  showCaption,
274
- disableImageLazyLoad,
275
274
  imageScale,
276
275
  mobileStack,
277
276
  minHeight,
@@ -450,20 +449,6 @@ class Edit extends Component {
450
449
  </PanelRow>
451
450
  ) }
452
451
 
453
- { showImage && (
454
- <PanelRow>
455
- <ToggleControl
456
- label={ __( 'Disable Featured Image Lazy Loading', 'newspack-blocks' ) }
457
- help={ __(
458
- 'Improve Largest Contentful Paint (LCP) score if the block is on initial viewport.',
459
- 'newspack-blocks'
460
- ) }
461
- checked={ disableImageLazyLoad }
462
- onChange={ () => setAttributes( { disableImageLazyLoad: ! disableImageLazyLoad } ) }
463
- />
464
- </PanelRow>
465
- ) }
466
-
467
452
  { showImage && mediaPosition !== 'top' && mediaPosition !== 'behind' && (
468
453
  <Fragment>
469
454
  <PanelRow>
@@ -8,7 +8,7 @@
8
8
 
9
9
  call_user_func(
10
10
  function( $data ) {
11
- $attributes = $data['attributes'];
11
+ $attributes = apply_filters( 'newspack_blocks_homepage_posts_block_attributes', $data['attributes'] );
12
12
  $authors = Newspack_Blocks::prepare_authors();
13
13
  $classes = array();
14
14
  $styles = '';
@@ -53,6 +53,9 @@ call_user_func(
53
53
  if ( $attributes['disableImageLazyLoad'] ) {
54
54
  $thumbnail_args['loading'] = 'none';
55
55
  }
56
+ if ( $attributes['fetchPriority'] && in_array( $attributes['fetchPriority'], [ 'high', 'low', 'auto' ], true ) ) {
57
+ $thumbnail_args['fetchpriority'] = $attributes['fetchPriority'];
58
+ }
56
59
  $category = false;
57
60
  // Use Yoast primary category if set.
58
61
  if ( class_exists( 'WPSEO_Primary_Term' ) ) {
@@ -22,4 +22,4 @@ if (PHP_VERSION_ID < 50600) {
22
22
 
23
23
  require_once __DIR__ . '/composer/autoload_real.php';
24
24
 
25
- return ComposerAutoloaderInit6c48257b500dde261f28a2d07827bdd6::getLoader();
25
+ return ComposerAutoloaderInitfed483a0b27a6f9cec5c9b8bf07b0858::getLoader();
@@ -2,7 +2,7 @@
2
2
 
3
3
  // autoload_real.php @generated by Composer
4
4
 
5
- class ComposerAutoloaderInit6c48257b500dde261f28a2d07827bdd6
5
+ class ComposerAutoloaderInitfed483a0b27a6f9cec5c9b8bf07b0858
6
6
  {
7
7
  private static $loader;
8
8
 
@@ -22,12 +22,12 @@ class ComposerAutoloaderInit6c48257b500dde261f28a2d07827bdd6
22
22
  return self::$loader;
23
23
  }
24
24
 
25
- spl_autoload_register(array('ComposerAutoloaderInit6c48257b500dde261f28a2d07827bdd6', 'loadClassLoader'), true, true);
25
+ spl_autoload_register(array('ComposerAutoloaderInitfed483a0b27a6f9cec5c9b8bf07b0858', 'loadClassLoader'), true, true);
26
26
  self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
27
- spl_autoload_unregister(array('ComposerAutoloaderInit6c48257b500dde261f28a2d07827bdd6', 'loadClassLoader'));
27
+ spl_autoload_unregister(array('ComposerAutoloaderInitfed483a0b27a6f9cec5c9b8bf07b0858', 'loadClassLoader'));
28
28
 
29
29
  require __DIR__ . '/autoload_static.php';
30
- call_user_func(\Composer\Autoload\ComposerStaticInit6c48257b500dde261f28a2d07827bdd6::getInitializer($loader));
30
+ call_user_func(\Composer\Autoload\ComposerStaticInitfed483a0b27a6f9cec5c9b8bf07b0858::getInitializer($loader));
31
31
 
32
32
  $loader->register(true);
33
33
 
@@ -4,7 +4,7 @@
4
4
 
5
5
  namespace Composer\Autoload;
6
6
 
7
- class ComposerStaticInit6c48257b500dde261f28a2d07827bdd6
7
+ class ComposerStaticInitfed483a0b27a6f9cec5c9b8bf07b0858
8
8
  {
9
9
  public static $classMap = array (
10
10
  'Composer\\InstalledVersions' => __DIR__ . '/..' . '/composer/InstalledVersions.php',
@@ -13,7 +13,7 @@ class ComposerStaticInit6c48257b500dde261f28a2d07827bdd6
13
13
  public static function getInitializer(ClassLoader $loader)
14
14
  {
15
15
  return \Closure::bind(function () use ($loader) {
16
- $loader->classMap = ComposerStaticInit6c48257b500dde261f28a2d07827bdd6::$classMap;
16
+ $loader->classMap = ComposerStaticInitfed483a0b27a6f9cec5c9b8bf07b0858::$classMap;
17
17
 
18
18
  }, null, ClassLoader::class);
19
19
  }
@@ -3,7 +3,7 @@
3
3
  'name' => 'automattic/newspack-blocks',
4
4
  'pretty_version' => 'dev-master',
5
5
  'version' => 'dev-master',
6
- 'reference' => '9fb95823000c240c7c838087cd464251002801f0',
6
+ 'reference' => '1ea783a6c7ffb2adb5360c6ea9b5619888683ebb',
7
7
  'type' => 'wordpress-plugin',
8
8
  'install_path' => __DIR__ . '/../../',
9
9
  'aliases' => array(),
@@ -13,7 +13,7 @@
13
13
  'automattic/newspack-blocks' => array(
14
14
  'pretty_version' => 'dev-master',
15
15
  'version' => 'dev-master',
16
- 'reference' => '9fb95823000c240c7c838087cd464251002801f0',
16
+ 'reference' => '1ea783a6c7ffb2adb5360c6ea9b5619888683ebb',
17
17
  'type' => 'wordpress-plugin',
18
18
  'install_path' => __DIR__ . '/../../',
19
19
  'aliases' => array(),