@wordpress/block-library 9.8.4 → 9.8.5

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/src/block/edit.js CHANGED
@@ -32,7 +32,7 @@ import {
32
32
  InnerBlocks,
33
33
  } from '@wordpress/block-editor';
34
34
  import { privateApis as patternsPrivateApis } from '@wordpress/patterns';
35
- import { store as blocksStore } from '@wordpress/blocks';
35
+ import { getBlockBindingsSource } from '@wordpress/blocks';
36
36
 
37
37
  /**
38
38
  * Internal dependencies
@@ -196,7 +196,6 @@ function ReusableBlockEdit( {
196
196
  ( select ) => {
197
197
  const { getBlocks, getSettings, getBlockEditingMode } =
198
198
  select( blockEditorStore );
199
- const { getBlockBindingsSource } = unlock( select( blocksStore ) );
200
199
  // For editing link to the site editor if the theme and user permissions support it.
201
200
  return {
202
201
  innerBlocks: getBlocks( patternClientId ),
@@ -9,7 +9,6 @@ import clsx from 'clsx';
9
9
  import { NEW_TAB_TARGET, NOFOLLOW_REL } from './constants';
10
10
  import { getUpdatedLinkAttributes } from './get-updated-link-attributes';
11
11
  import removeAnchorTag from '../utils/remove-anchor-tag';
12
- import { unlock } from '../lock-unlock';
13
12
 
14
13
  /**
15
14
  * WordPress dependencies
@@ -45,10 +44,10 @@ import {
45
44
  createBlock,
46
45
  cloneBlock,
47
46
  getDefaultBlockName,
48
- store as blocksStore,
47
+ getBlockBindingsSource,
49
48
  } from '@wordpress/blocks';
50
49
  import { useMergeRefs, useRefEffect } from '@wordpress/compose';
51
- import { useSelect, useDispatch, useRegistry } from '@wordpress/data';
50
+ import { useSelect, useDispatch } from '@wordpress/data';
52
51
 
53
52
  const LINK_SETTINGS = [
54
53
  ...LinkControl.DEFAULT_LINK_SETTINGS,
@@ -190,7 +189,6 @@ function ButtonEdit( props ) {
190
189
  const colorProps = useColorProps( attributes );
191
190
  const spacingProps = useSpacingProps( attributes );
192
191
  const shadowProps = useShadowProps( attributes );
193
- const registry = useRegistry();
194
192
  const ref = useRef();
195
193
  const richTextRef = useRef();
196
194
  const blockProps = useBlockProps( {
@@ -241,15 +239,15 @@ function ButtonEdit( props ) {
241
239
  return {};
242
240
  }
243
241
 
244
- const blockBindingsSource = unlock(
245
- select( blocksStore )
246
- ).getBlockBindingsSource( metadata?.bindings?.url?.source );
242
+ const blockBindingsSource = getBlockBindingsSource(
243
+ metadata?.bindings?.url?.source
244
+ );
247
245
 
248
246
  return {
249
247
  lockUrlControls:
250
248
  !! metadata?.bindings?.url &&
251
249
  ! blockBindingsSource?.canUserEditValue?.( {
252
- registry,
250
+ select,
253
251
  context,
254
252
  args: metadata?.bindings?.url?.args,
255
253
  } ),
@@ -49,7 +49,7 @@ function render_block_core_categories( $attributes, $content, $block ) {
49
49
 
50
50
  $show_label = empty( $attributes['showLabel'] ) ? ' screen-reader-text' : '';
51
51
  $default_label = $taxonomy->label;
52
- $label_text = ! empty( $attributes['label'] ) ? $attributes['label'] : $default_label;
52
+ $label_text = ! empty( $attributes['label'] ) ? wp_kses_post( $attributes['label'] ) : $default_label;
53
53
  $wrapper_markup = '<div %1$s><label class="wp-block-categories__label' . $show_label . '" for="' . esc_attr( $id ) . '">' . $label_text . '</label>%2$s</div>';
54
54
  $items_markup = wp_dropdown_categories( $args );
55
55
  $type = 'dropdown';
package/src/image/edit.js CHANGED
@@ -7,9 +7,9 @@ import clsx from 'clsx';
7
7
  * WordPress dependencies
8
8
  */
9
9
  import { isBlobURL, createBlobURL } from '@wordpress/blob';
10
- import { store as blocksStore, createBlock } from '@wordpress/blocks';
10
+ import { createBlock, getBlockBindingsSource } from '@wordpress/blocks';
11
11
  import { Placeholder } from '@wordpress/components';
12
- import { useDispatch, useSelect, useRegistry } from '@wordpress/data';
12
+ import { useDispatch, useSelect } from '@wordpress/data';
13
13
  import {
14
14
  BlockIcon,
15
15
  useBlockProps,
@@ -28,7 +28,6 @@ import { useResizeObserver } from '@wordpress/compose';
28
28
  /**
29
29
  * Internal dependencies
30
30
  */
31
- import { unlock } from '../lock-unlock';
32
31
  import { useUploadMediaFromBlobURL } from '../utils/hooks';
33
32
  import Image from './image';
34
33
  import { isValidFileType } from './utils';
@@ -113,7 +112,6 @@ export function ImageEdit( {
113
112
 
114
113
  const [ temporaryURL, setTemporaryURL ] = useState( attributes.blob );
115
114
 
116
- const registry = useRegistry();
117
115
  const containerRef = useRef();
118
116
  // Only observe the max width from the parent container when the parent layout is not flex nor grid.
119
117
  // This won't work for them because the container width changes with the image.
@@ -373,15 +371,15 @@ export function ImageEdit( {
373
371
  return {};
374
372
  }
375
373
 
376
- const blockBindingsSource = unlock(
377
- select( blocksStore )
378
- ).getBlockBindingsSource( metadata?.bindings?.url?.source );
374
+ const blockBindingsSource = getBlockBindingsSource(
375
+ metadata?.bindings?.url?.source
376
+ );
379
377
 
380
378
  return {
381
379
  lockUrlControls:
382
380
  !! metadata?.bindings?.url &&
383
381
  ! blockBindingsSource?.canUserEditValue?.( {
384
- registry,
382
+ select,
385
383
  context,
386
384
  args: metadata?.bindings?.url?.args,
387
385
  } ),
@@ -17,7 +17,7 @@ import {
17
17
  Placeholder,
18
18
  } from '@wordpress/components';
19
19
  import { useViewportMatch } from '@wordpress/compose';
20
- import { useSelect, useDispatch, useRegistry } from '@wordpress/data';
20
+ import { useSelect, useDispatch } from '@wordpress/data';
21
21
  import {
22
22
  BlockControls,
23
23
  InspectorControls,
@@ -34,7 +34,7 @@ import { useEffect, useMemo, useState, useRef } from '@wordpress/element';
34
34
  import { __, _x, sprintf, isRTL } from '@wordpress/i18n';
35
35
  import { DOWN } from '@wordpress/keycodes';
36
36
  import { getFilename } from '@wordpress/url';
37
- import { switchToBlockType, store as blocksStore } from '@wordpress/blocks';
37
+ import { getBlockBindingsSource, switchToBlockType } from '@wordpress/blocks';
38
38
  import { crop, overlayText, upload } from '@wordpress/icons';
39
39
  import { store as noticesStore } from '@wordpress/notices';
40
40
  import { store as coreStore } from '@wordpress/core-data';
@@ -134,7 +134,6 @@ export default function Image( {
134
134
  const numericWidth = width ? parseInt( width, 10 ) : undefined;
135
135
  const numericHeight = height ? parseInt( height, 10 ) : undefined;
136
136
 
137
- const registry = useRegistry();
138
137
  const imageRef = useRef();
139
138
  const { allowResize = true } = context;
140
139
  const { getBlock, getSettings } = useSelect( blockEditorStore );
@@ -477,7 +476,6 @@ export default function Image( {
477
476
  if ( ! isSingleSelected ) {
478
477
  return {};
479
478
  }
480
- const { getBlockBindingsSource } = unlock( select( blocksStore ) );
481
479
  const {
482
480
  url: urlBinding,
483
481
  alt: altBinding,
@@ -497,7 +495,7 @@ export default function Image( {
497
495
  lockUrlControls:
498
496
  !! urlBinding &&
499
497
  ! urlBindingSource?.canUserEditValue?.( {
500
- registry,
498
+ select,
501
499
  context,
502
500
  args: urlBinding?.args,
503
501
  } ),
@@ -512,7 +510,7 @@ export default function Image( {
512
510
  lockAltControls:
513
511
  !! altBinding &&
514
512
  ! altBindingSource?.canUserEditValue?.( {
515
- registry,
513
+ select,
516
514
  context,
517
515
  args: altBinding?.args,
518
516
  } ),
@@ -526,7 +524,7 @@ export default function Image( {
526
524
  lockTitleControls:
527
525
  !! titleBinding &&
528
526
  ! titleBindingSource?.canUserEditValue?.( {
529
- registry,
527
+ select,
530
528
  context,
531
529
  args: titleBinding?.args,
532
530
  } ),