@automattic/newspack-blocks 1.53.0 → 1.53.1
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.
- package/.cache/babel/1783de595f21d427355e559781275222.json.gz +0 -0
- package/CHANGELOG.md +7 -0
- package/dist/editor.asset.php +1 -1
- package/dist/editor.css +1 -1
- package/dist/editor.js +5 -5
- package/dist/editor.rtl.css +1 -1
- package/newspack-blocks.php +2 -2
- package/package.json +2 -2
- package/src/blocks/author-profile/edit.js +29 -6
- package/src/blocks/author-profile/editor.scss +1 -1
- package/vendor/autoload.php +1 -1
- package/vendor/composer/autoload_real.php +4 -4
- package/vendor/composer/autoload_static.php +2 -2
- package/vendor/composer/installed.php +2 -2
- package/.cache/babel/95c79f7af2e88cb1c48e88f304b1a1fd.json.gz +0 -0
package/newspack-blocks.php
CHANGED
|
@@ -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.53.
|
|
10
|
+
* Version: 1.53.1
|
|
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.53.
|
|
18
|
+
define( 'NEWSPACK_BLOCKS__VERSION', '1.53.1' );
|
|
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,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@automattic/newspack-blocks",
|
|
3
|
-
"version": "1.53.
|
|
3
|
+
"version": "1.53.1",
|
|
4
4
|
"author": "Automattic",
|
|
5
5
|
"devDependencies": {
|
|
6
6
|
"@rushstack/eslint-patch": "^1.1.3",
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"@stripe/stripe-js": "^1.31.0",
|
|
21
21
|
"classnames": "^2.3.1",
|
|
22
22
|
"lodash": "^4.17.21",
|
|
23
|
-
"newspack-components": "^2.0
|
|
23
|
+
"newspack-components": "^2.1.0",
|
|
24
24
|
"react": "^17.0.2",
|
|
25
25
|
"redux": "^4.2.0",
|
|
26
26
|
"redux-saga": "^1.1.3",
|
|
@@ -133,6 +133,7 @@ export const avatarSizeOptions = [
|
|
|
133
133
|
|
|
134
134
|
const AuthorProfile = ( { attributes, setAttributes } ) => {
|
|
135
135
|
const [ author, setAuthor ] = useState( null );
|
|
136
|
+
const [ suggestions, setSuggestions ] = useState( null );
|
|
136
137
|
const [ error, setError ] = useState( null );
|
|
137
138
|
const [ isLoading, setIsLoading ] = useState( false );
|
|
138
139
|
const [ maxItemsToSuggest, setMaxItemsToSuggest ] = useState( 0 );
|
|
@@ -155,7 +156,7 @@ const AuthorProfile = ( { attributes, setAttributes } ) => {
|
|
|
155
156
|
if ( 0 !== authorId ) {
|
|
156
157
|
getAuthorById();
|
|
157
158
|
}
|
|
158
|
-
}, [ authorId, avatarHideDefault ] );
|
|
159
|
+
}, [ authorId, avatarHideDefault, isGuestAuthor ] );
|
|
159
160
|
|
|
160
161
|
const getAuthorById = async () => {
|
|
161
162
|
setError( null );
|
|
@@ -367,6 +368,7 @@ const AuthorProfile = ( { attributes, setAttributes } ) => {
|
|
|
367
368
|
<SingleAuthor author={ author } attributes={ attributes } />
|
|
368
369
|
) : (
|
|
369
370
|
<Placeholder
|
|
371
|
+
className="newspack-blocks-author-profile"
|
|
370
372
|
icon={ <Icon icon={ postAuthor } /> }
|
|
371
373
|
label={ __( 'Author Profile', 'newspack-blocks' ) }
|
|
372
374
|
>
|
|
@@ -389,8 +391,11 @@ const AuthorProfile = ( { attributes, setAttributes } ) => {
|
|
|
389
391
|
'newspack-blocks'
|
|
390
392
|
) }
|
|
391
393
|
fetchSuggestions={ async ( search = null, offset = 0 ) => {
|
|
394
|
+
// Reset suggestions in state.
|
|
395
|
+
setSuggestions( null );
|
|
396
|
+
|
|
392
397
|
// If we already have a selected author, no need to fetch suggestions.
|
|
393
|
-
if ( authorId ) {
|
|
398
|
+
if ( authorId && ! error ) {
|
|
394
399
|
return [];
|
|
395
400
|
}
|
|
396
401
|
|
|
@@ -399,7 +404,6 @@ const AuthorProfile = ( { attributes, setAttributes } ) => {
|
|
|
399
404
|
path: addQueryArgs( '/newspack-blocks/v1/authors', {
|
|
400
405
|
search,
|
|
401
406
|
offset,
|
|
402
|
-
isGuestAuthor: true,
|
|
403
407
|
fields: 'id,name',
|
|
404
408
|
} ),
|
|
405
409
|
} );
|
|
@@ -412,17 +416,36 @@ const AuthorProfile = ( { attributes, setAttributes } ) => {
|
|
|
412
416
|
setMaxItemsToSuggest( total );
|
|
413
417
|
}
|
|
414
418
|
|
|
415
|
-
|
|
419
|
+
const _suggestions = authors.map( _author => ( {
|
|
416
420
|
value: _author.id,
|
|
417
421
|
label: decodeEntities( _author.name ) || __( '(no name)', 'newspack' ),
|
|
418
422
|
isGuestAuthor: _author.is_guest,
|
|
419
423
|
} ) );
|
|
424
|
+
|
|
425
|
+
setSuggestions( _suggestions );
|
|
426
|
+
|
|
427
|
+
return _suggestions;
|
|
420
428
|
} }
|
|
421
429
|
maxItemsToSuggest={ maxItemsToSuggest }
|
|
422
430
|
onChange={ items => {
|
|
431
|
+
let selectionIsGuest = false;
|
|
432
|
+
const selection = items[ 0 ];
|
|
433
|
+
|
|
434
|
+
// We need to check whether the selected author is a guest author or not.
|
|
435
|
+
if ( suggestions ) {
|
|
436
|
+
suggestions.forEach( suggestion => {
|
|
437
|
+
if (
|
|
438
|
+
parseInt( selection?.value ) === parseInt( suggestion?.value ) &&
|
|
439
|
+
suggestion?.isGuestAuthor
|
|
440
|
+
) {
|
|
441
|
+
selectionIsGuest = true;
|
|
442
|
+
}
|
|
443
|
+
} );
|
|
444
|
+
}
|
|
445
|
+
|
|
423
446
|
setAttributes( {
|
|
424
|
-
authorId: parseInt(
|
|
425
|
-
isGuestAuthor:
|
|
447
|
+
authorId: parseInt( selection?.value || 0 ),
|
|
448
|
+
isGuestAuthor: selectionIsGuest,
|
|
426
449
|
} );
|
|
427
450
|
} }
|
|
428
451
|
postTypeLabel={ __( 'author', 'newspack-blocks' ) }
|
package/vendor/autoload.php
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
// autoload_real.php @generated by Composer
|
|
4
4
|
|
|
5
|
-
class
|
|
5
|
+
class ComposerAutoloaderInitddb9ed3d8a2769081f45868acf01cf2e
|
|
6
6
|
{
|
|
7
7
|
private static $loader;
|
|
8
8
|
|
|
@@ -22,15 +22,15 @@ class ComposerAutoloaderInit23e7353bf7a8e11d2c7c2cc21cce61d6
|
|
|
22
22
|
return self::$loader;
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
-
spl_autoload_register(array('
|
|
25
|
+
spl_autoload_register(array('ComposerAutoloaderInitddb9ed3d8a2769081f45868acf01cf2e', 'loadClassLoader'), true, true);
|
|
26
26
|
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(\dirname(__FILE__)));
|
|
27
|
-
spl_autoload_unregister(array('
|
|
27
|
+
spl_autoload_unregister(array('ComposerAutoloaderInitddb9ed3d8a2769081f45868acf01cf2e', 'loadClassLoader'));
|
|
28
28
|
|
|
29
29
|
$useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
|
|
30
30
|
if ($useStaticLoader) {
|
|
31
31
|
require __DIR__ . '/autoload_static.php';
|
|
32
32
|
|
|
33
|
-
call_user_func(\Composer\Autoload\
|
|
33
|
+
call_user_func(\Composer\Autoload\ComposerStaticInitddb9ed3d8a2769081f45868acf01cf2e::getInitializer($loader));
|
|
34
34
|
} else {
|
|
35
35
|
$map = require __DIR__ . '/autoload_namespaces.php';
|
|
36
36
|
foreach ($map as $namespace => $path) {
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
namespace Composer\Autoload;
|
|
6
6
|
|
|
7
|
-
class
|
|
7
|
+
class ComposerStaticInitddb9ed3d8a2769081f45868acf01cf2e
|
|
8
8
|
{
|
|
9
9
|
public static $classMap = array (
|
|
10
10
|
'Composer\\InstalledVersions' => __DIR__ . '/..' . '/composer/InstalledVersions.php',
|
|
@@ -13,7 +13,7 @@ class ComposerStaticInit23e7353bf7a8e11d2c7c2cc21cce61d6
|
|
|
13
13
|
public static function getInitializer(ClassLoader $loader)
|
|
14
14
|
{
|
|
15
15
|
return \Closure::bind(function () use ($loader) {
|
|
16
|
-
$loader->classMap =
|
|
16
|
+
$loader->classMap = ComposerStaticInitddb9ed3d8a2769081f45868acf01cf2e::$classMap;
|
|
17
17
|
|
|
18
18
|
}, null, ClassLoader::class);
|
|
19
19
|
}
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
'type' => 'wordpress-plugin',
|
|
6
6
|
'install_path' => __DIR__ . '/../../',
|
|
7
7
|
'aliases' => array(),
|
|
8
|
-
'reference' => '
|
|
8
|
+
'reference' => '085efaf431b70ad15514a0d33c7ad0ce0697387e',
|
|
9
9
|
'name' => 'automattic/newspack-blocks',
|
|
10
10
|
'dev' => false,
|
|
11
11
|
),
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
'type' => 'wordpress-plugin',
|
|
17
17
|
'install_path' => __DIR__ . '/../../',
|
|
18
18
|
'aliases' => array(),
|
|
19
|
-
'reference' => '
|
|
19
|
+
'reference' => '085efaf431b70ad15514a0d33c7ad0ce0697387e',
|
|
20
20
|
'dev_requirement' => false,
|
|
21
21
|
),
|
|
22
22
|
),
|
|
Binary file
|