@wordpress/block-editor 13.0.0 → 13.0.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.
Files changed (68) hide show
  1. package/build/components/block-bindings-toolbar-indicator/index.js +1 -1
  2. package/build/components/block-bindings-toolbar-indicator/index.js.map +1 -1
  3. package/build/components/button-block-appender/index.js +4 -1
  4. package/build/components/button-block-appender/index.js.map +1 -1
  5. package/build/components/global-styles/background-panel.js +3 -3
  6. package/build/components/global-styles/background-panel.js.map +1 -1
  7. package/build/components/global-styles/hooks.js +1 -1
  8. package/build/components/global-styles/hooks.js.map +1 -1
  9. package/build/components/inserter/block-types-tab.js +3 -3
  10. package/build/components/inserter/block-types-tab.js.map +1 -1
  11. package/build/components/inserter/hooks/use-block-types-state.js +3 -2
  12. package/build/components/inserter/hooks/use-block-types-state.js.map +1 -1
  13. package/build/components/link-control/link-preview.js +1 -0
  14. package/build/components/link-control/link-preview.js.map +1 -1
  15. package/build/components/link-control/search-input.js +1 -1
  16. package/build/components/link-control/search-input.js.map +1 -1
  17. package/build/components/spacing-sizes-control/hooks/use-spacing-sizes.js +9 -12
  18. package/build/components/spacing-sizes-control/hooks/use-spacing-sizes.js.map +1 -1
  19. package/build/components/writing-flow/use-clipboard-handler.js +22 -3
  20. package/build/components/writing-flow/use-clipboard-handler.js.map +1 -1
  21. package/build/store/actions.js +1 -1
  22. package/build/store/actions.js.map +1 -1
  23. package/build/store/selectors.js +2 -1
  24. package/build/store/selectors.js.map +1 -1
  25. package/build-module/components/block-bindings-toolbar-indicator/index.js +1 -1
  26. package/build-module/components/block-bindings-toolbar-indicator/index.js.map +1 -1
  27. package/build-module/components/button-block-appender/index.js +4 -1
  28. package/build-module/components/button-block-appender/index.js.map +1 -1
  29. package/build-module/components/global-styles/background-panel.js +4 -4
  30. package/build-module/components/global-styles/background-panel.js.map +1 -1
  31. package/build-module/components/global-styles/hooks.js +1 -1
  32. package/build-module/components/global-styles/hooks.js.map +1 -1
  33. package/build-module/components/inserter/block-types-tab.js +3 -3
  34. package/build-module/components/inserter/block-types-tab.js.map +1 -1
  35. package/build-module/components/inserter/hooks/use-block-types-state.js +4 -3
  36. package/build-module/components/inserter/hooks/use-block-types-state.js.map +1 -1
  37. package/build-module/components/link-control/link-preview.js +1 -0
  38. package/build-module/components/link-control/link-preview.js.map +1 -1
  39. package/build-module/components/link-control/search-input.js +1 -1
  40. package/build-module/components/link-control/search-input.js.map +1 -1
  41. package/build-module/components/spacing-sizes-control/hooks/use-spacing-sizes.js +9 -12
  42. package/build-module/components/spacing-sizes-control/hooks/use-spacing-sizes.js.map +1 -1
  43. package/build-module/components/writing-flow/use-clipboard-handler.js +23 -4
  44. package/build-module/components/writing-flow/use-clipboard-handler.js.map +1 -1
  45. package/build-module/store/actions.js +1 -1
  46. package/build-module/store/actions.js.map +1 -1
  47. package/build-module/store/selectors.js +2 -1
  48. package/build-module/store/selectors.js.map +1 -1
  49. package/build-style/content-rtl.css +1 -1
  50. package/build-style/content.css +1 -1
  51. package/build-style/style-rtl.css +6 -2
  52. package/build-style/style.css +6 -2
  53. package/package.json +31 -31
  54. package/src/components/block-bindings-toolbar-indicator/index.js +3 -1
  55. package/src/components/block-canvas/style.scss +2 -2
  56. package/src/components/block-variation-picker/content.scss +1 -1
  57. package/src/components/button-block-appender/index.js +2 -0
  58. package/src/components/global-styles/background-panel.js +13 -4
  59. package/src/components/global-styles/hooks.js +1 -0
  60. package/src/components/inserter/block-types-tab.js +0 -1
  61. package/src/components/inserter/hooks/use-block-types-state.js +10 -5
  62. package/src/components/inserter/style.scss +4 -0
  63. package/src/components/link-control/link-preview.js +1 -0
  64. package/src/components/link-control/search-input.js +1 -1
  65. package/src/components/spacing-sizes-control/hooks/use-spacing-sizes.js +14 -4
  66. package/src/components/writing-flow/use-clipboard-handler.js +29 -7
  67. package/src/store/actions.js +1 -1
  68. package/src/store/selectors.js +3 -1
@@ -572,7 +572,7 @@ _::-webkit-full-page-media, _:future, :root .has-multi-selection .block-editor-b
572
572
  .block-editor-block-variation-picker__variations svg,
573
573
  .block-editor-block-variation-picker__skip svg,
574
574
  .wp-block-group-placeholder__variations svg {
575
- fill: #ccc !important;
575
+ fill: #949494 !important;
576
576
  }
577
577
  .block-editor-block-variation-picker__variations .components-button,
578
578
  .block-editor-block-variation-picker__skip .components-button,
@@ -572,7 +572,7 @@ _::-webkit-full-page-media, _:future, :root .has-multi-selection .block-editor-b
572
572
  .block-editor-block-variation-picker__variations svg,
573
573
  .block-editor-block-variation-picker__skip svg,
574
574
  .wp-block-group-placeholder__variations svg {
575
- fill: #ccc !important;
575
+ fill: #949494 !important;
576
576
  }
577
577
  .block-editor-block-variation-picker__variations .components-button,
578
578
  .block-editor-block-variation-picker__skip .components-button,
@@ -136,11 +136,11 @@
136
136
  }
137
137
 
138
138
  iframe[name=editor-canvas] {
139
+ box-sizing: border-box;
139
140
  width: 100%;
140
141
  height: 100%;
141
142
  display: block;
142
- background-color: #ddd;
143
- box-sizing: border-box;
143
+ background-color: transparent;
144
144
  }
145
145
 
146
146
  .block-editor-block-icon {
@@ -3852,6 +3852,10 @@ iframe[name=editor-canvas] {
3852
3852
  padding-bottom: 4px;
3853
3853
  }
3854
3854
 
3855
+ .block-editor-inserter__insertable-blocks-at-selection {
3856
+ border-bottom: 1px solid #e0e0e0;
3857
+ }
3858
+
3855
3859
  .block-editor-inserter__media-tabs-container,
3856
3860
  .block-editor-inserter__block-patterns-tabs-container {
3857
3861
  padding: 16px;
@@ -136,11 +136,11 @@
136
136
  }
137
137
 
138
138
  iframe[name=editor-canvas] {
139
+ box-sizing: border-box;
139
140
  width: 100%;
140
141
  height: 100%;
141
142
  display: block;
142
- background-color: #ddd;
143
- box-sizing: border-box;
143
+ background-color: transparent;
144
144
  }
145
145
 
146
146
  .block-editor-block-icon {
@@ -3853,6 +3853,10 @@ iframe[name=editor-canvas] {
3853
3853
  padding-bottom: 4px;
3854
3854
  }
3855
3855
 
3856
+ .block-editor-inserter__insertable-blocks-at-selection {
3857
+ border-bottom: 1px solid #e0e0e0;
3858
+ }
3859
+
3856
3860
  .block-editor-inserter__media-tabs-container,
3857
3861
  .block-editor-inserter__block-patterns-tabs-container {
3858
3862
  padding: 16px;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wordpress/block-editor",
3
- "version": "13.0.0",
3
+ "version": "13.0.1",
4
4
  "description": "Generic block editor.",
5
5
  "author": "The WordPress Contributors",
6
6
  "license": "GPL-2.0-or-later",
@@ -36,35 +36,35 @@
36
36
  "@emotion/react": "^11.7.1",
37
37
  "@emotion/styled": "^11.6.0",
38
38
  "@react-spring/web": "^9.4.5",
39
- "@wordpress/a11y": "^4.0.0",
40
- "@wordpress/api-fetch": "^7.0.0",
41
- "@wordpress/blob": "^4.0.0",
42
- "@wordpress/blocks": "^13.0.0",
43
- "@wordpress/commands": "^1.0.0",
44
- "@wordpress/components": "^28.0.0",
45
- "@wordpress/compose": "^7.0.0",
46
- "@wordpress/data": "^10.0.0",
47
- "@wordpress/date": "^5.0.0",
48
- "@wordpress/deprecated": "^4.0.0",
49
- "@wordpress/dom": "^4.0.0",
50
- "@wordpress/element": "^6.0.0",
51
- "@wordpress/escape-html": "^3.0.0",
52
- "@wordpress/hooks": "^4.0.0",
53
- "@wordpress/html-entities": "^4.0.0",
54
- "@wordpress/i18n": "^5.0.0",
55
- "@wordpress/icons": "^10.0.0",
56
- "@wordpress/is-shallow-equal": "^5.0.0",
57
- "@wordpress/keyboard-shortcuts": "^5.0.0",
58
- "@wordpress/keycodes": "^4.0.0",
59
- "@wordpress/notices": "^5.0.0",
60
- "@wordpress/preferences": "^4.0.0",
61
- "@wordpress/private-apis": "^1.0.0",
62
- "@wordpress/rich-text": "^7.0.0",
63
- "@wordpress/style-engine": "^2.0.0",
64
- "@wordpress/token-list": "^3.0.0",
65
- "@wordpress/url": "^4.0.0",
66
- "@wordpress/warning": "^3.0.0",
67
- "@wordpress/wordcount": "^4.0.0",
39
+ "@wordpress/a11y": "^4.0.1",
40
+ "@wordpress/api-fetch": "^7.0.1",
41
+ "@wordpress/blob": "^4.0.1",
42
+ "@wordpress/blocks": "^13.0.1",
43
+ "@wordpress/commands": "^1.0.1",
44
+ "@wordpress/components": "^28.0.1",
45
+ "@wordpress/compose": "^7.0.1",
46
+ "@wordpress/data": "^10.0.1",
47
+ "@wordpress/date": "^5.0.1",
48
+ "@wordpress/deprecated": "^4.0.1",
49
+ "@wordpress/dom": "^4.0.1",
50
+ "@wordpress/element": "^6.0.1",
51
+ "@wordpress/escape-html": "^3.0.1",
52
+ "@wordpress/hooks": "^4.0.1",
53
+ "@wordpress/html-entities": "^4.0.1",
54
+ "@wordpress/i18n": "^5.0.1",
55
+ "@wordpress/icons": "^10.0.1",
56
+ "@wordpress/is-shallow-equal": "^5.0.1",
57
+ "@wordpress/keyboard-shortcuts": "^5.0.1",
58
+ "@wordpress/keycodes": "^4.0.1",
59
+ "@wordpress/notices": "^5.0.1",
60
+ "@wordpress/preferences": "^4.0.1",
61
+ "@wordpress/private-apis": "^1.0.1",
62
+ "@wordpress/rich-text": "^7.0.1",
63
+ "@wordpress/style-engine": "^2.0.1",
64
+ "@wordpress/token-list": "^3.0.1",
65
+ "@wordpress/url": "^4.0.1",
66
+ "@wordpress/warning": "^3.0.1",
67
+ "@wordpress/wordcount": "^4.0.1",
68
68
  "change-case": "^4.1.2",
69
69
  "clsx": "^2.1.1",
70
70
  "colord": "^2.7.0",
@@ -86,5 +86,5 @@
86
86
  "publishConfig": {
87
87
  "access": "public"
88
88
  },
89
- "gitHead": "2f30cddff15723ac7017fd009fc5913b7b419400"
89
+ "gitHead": "0e973525f7787401b5a544e0727774d52a78639f"
90
90
  }
@@ -57,7 +57,9 @@ export default function BlockBindingsToolbarIndicator( { clientIds } ) {
57
57
  isConnectedToPatternOverrides: getBlocksByClientId(
58
58
  clientIds
59
59
  ).some( ( block ) =>
60
- Object.values( block?.attributes.metadata?.bindings ).some(
60
+ Object.values(
61
+ block?.attributes?.metadata?.bindings || {}
62
+ ).some(
61
63
  ( binding ) =>
62
64
  binding.source === 'core/pattern-overrides'
63
65
  )
@@ -1,7 +1,7 @@
1
1
  iframe[name="editor-canvas"] {
2
+ box-sizing: border-box;
2
3
  width: 100%;
3
4
  height: 100%;
4
5
  display: block;
5
- background-color: $gray-300;
6
- box-sizing: border-box;
6
+ background-color: transparent;
7
7
  }
@@ -13,7 +13,7 @@
13
13
  font-size: $helptext-font-size;
14
14
 
15
15
  svg {
16
- fill: $gray-400 !important;
16
+ fill: $gray-600 !important;
17
17
  }
18
18
 
19
19
  .components-button {
@@ -60,6 +60,8 @@ function ButtonBlockAppender(
60
60
  onClick={ onToggle }
61
61
  aria-haspopup={ isToggleButton ? 'true' : undefined }
62
62
  aria-expanded={ isToggleButton ? isOpen : undefined }
63
+ // Disable reason: There shouldn't be a case where this button is disabled but not visually hidden.
64
+ // eslint-disable-next-line no-restricted-syntax
63
65
  disabled={ disabled }
64
66
  label={ label }
65
67
  >
@@ -23,7 +23,7 @@ import {
23
23
  __experimentalHStack as HStack,
24
24
  __experimentalTruncate as Truncate,
25
25
  } from '@wordpress/components';
26
- import { __, sprintf } from '@wordpress/i18n';
26
+ import { __, _x, sprintf } from '@wordpress/i18n';
27
27
  import { store as noticesStore } from '@wordpress/notices';
28
28
  import { getFilename } from '@wordpress/url';
29
29
  import { useCallback, Platform, useRef } from '@wordpress/element';
@@ -544,17 +544,26 @@ function BackgroundSizeToolsPanelItem( {
544
544
  <ToggleGroupControlOption
545
545
  key="cover"
546
546
  value="cover"
547
- label={ __( 'Cover' ) }
547
+ label={ _x(
548
+ 'Cover',
549
+ 'Size option for background image control'
550
+ ) }
548
551
  />
549
552
  <ToggleGroupControlOption
550
553
  key="contain"
551
554
  value="contain"
552
- label={ __( 'Contain' ) }
555
+ label={ _x(
556
+ 'Contain',
557
+ 'Size option for background image control'
558
+ ) }
553
559
  />
554
560
  <ToggleGroupControlOption
555
561
  key="tile"
556
562
  value="auto"
557
- label={ __( 'Tile' ) }
563
+ label={ _x(
564
+ 'Tile',
565
+ 'Size option for background image control'
566
+ ) }
558
567
  />
559
568
  </ToggleGroupControl>
560
569
  <HStack justify="flex-start" spacing={ 2 } as="span">
@@ -299,6 +299,7 @@ export function useSettingsForBlockElement(
299
299
  'fontStyle',
300
300
  'fontWeight',
301
301
  'letterSpacing',
302
+ 'textAlign',
302
303
  'textTransform',
303
304
  'textDecoration',
304
305
  'writingMode',
@@ -207,7 +207,6 @@ export function BlockTypesTab(
207
207
  showMostUsedBlocks={ showMostUsedBlocks }
208
208
  className="block-editor-inserter__insertable-blocks-at-selection"
209
209
  />
210
- <hr />
211
210
  </>
212
211
  ) }
213
212
  <BlockTypesTabPanel
@@ -8,7 +8,7 @@ import {
8
8
  parse,
9
9
  } from '@wordpress/blocks';
10
10
  import { useSelect } from '@wordpress/data';
11
- import { useCallback } from '@wordpress/element';
11
+ import { useCallback, useMemo } from '@wordpress/element';
12
12
 
13
13
  /**
14
14
  * Internal dependencies
@@ -25,13 +25,18 @@ import { withRootClientIdOptionKey } from '../../../store/utils';
25
25
  * @return {Array} Returns the block types state. (block types, categories, collections, onSelect handler)
26
26
  */
27
27
  const useBlockTypesState = ( rootClientId, onInsert, isQuick ) => {
28
+ const options = useMemo(
29
+ () => ( { [ withRootClientIdOptionKey ]: ! isQuick } ),
30
+ [ isQuick ]
31
+ );
28
32
  const [ items ] = useSelect(
29
33
  ( select ) => [
30
- select( blockEditorStore ).getInserterItems( rootClientId, {
31
- [ withRootClientIdOptionKey ]: ! isQuick,
32
- } ),
34
+ select( blockEditorStore ).getInserterItems(
35
+ rootClientId,
36
+ options
37
+ ),
33
38
  ],
34
- [ rootClientId, isQuick ]
39
+ [ rootClientId, options ]
35
40
  );
36
41
 
37
42
  const [ categories, collections ] = useSelect( ( select ) => {
@@ -253,6 +253,10 @@ $block-inserter-tabs-height: 44px;
253
253
  }
254
254
  }
255
255
 
256
+ .block-editor-inserter__insertable-blocks-at-selection {
257
+ border-bottom: $border-width solid $gray-200;
258
+ }
259
+
256
260
  .block-editor-inserter__media-tabs-container,
257
261
  .block-editor-inserter__block-patterns-tabs-container {
258
262
  padding: $grid-unit-20;
@@ -149,6 +149,7 @@ export default function LinkPreview( {
149
149
  isEmptyURL || showIconLabels ? '' : ': ' + value.url
150
150
  ) }
151
151
  ref={ ref }
152
+ __experimentalIsFocusable
152
153
  disabled={ isEmptyURL }
153
154
  size="compact"
154
155
  />
@@ -125,7 +125,7 @@ const LinkControlSearchInput = forwardRef(
125
125
  className={ className }
126
126
  value={ value }
127
127
  onChange={ onInputChange }
128
- placeholder={ placeholder ?? __( 'Search or type url' ) }
128
+ placeholder={ placeholder ?? __( 'Search or type URL' ) }
129
129
  __experimentalRenderSuggestions={
130
130
  showSuggestions ? handleRenderSuggestions : null
131
131
  }
@@ -42,7 +42,19 @@ export default function useSpacingSizes() {
42
42
  ...customSizes,
43
43
  ...themeSizes,
44
44
  ...defaultSizes,
45
- ].sort( ( a, b ) => compare( a.slug, b.slug ) );
45
+ ];
46
+
47
+ // Only sort if more than one origin has presets defined in order to
48
+ // preserve order for themes that don't include default presets and
49
+ // want a custom order.
50
+ if (
51
+ ( customSizes.length && 1 ) +
52
+ ( themeSizes.length && 1 ) +
53
+ ( defaultSizes.length && 1 ) >
54
+ 1
55
+ ) {
56
+ sizes.sort( ( a, b ) => compare( a.slug, b.slug ) );
57
+ }
46
58
 
47
59
  return sizes.length > RANGE_CONTROL_MAX_SIZE
48
60
  ? [
@@ -53,8 +65,6 @@ export default function useSpacingSizes() {
53
65
  },
54
66
  ...sizes,
55
67
  ]
56
- : // See https://github.com/WordPress/gutenberg/pull/44247 for reasoning
57
- // to use the index as the name in the range control.
58
- sizes.map( ( { slug, size }, i ) => ( { name: i, slug, size } ) );
68
+ : sizes;
59
69
  }, [ customSizes, themeSizes, defaultSizes ] );
60
70
  }
@@ -6,6 +6,7 @@ import {
6
6
  findTransform,
7
7
  getBlockTransforms,
8
8
  hasBlockSupport,
9
+ switchToBlockType,
9
10
  } from '@wordpress/blocks';
10
11
  import {
11
12
  documentHasSelection,
@@ -208,15 +209,36 @@ export default function useClipboardHandler() {
208
209
  firstSelectedClientId
209
210
  );
210
211
 
211
- if (
212
- ! blocks.every( ( block ) =>
213
- canInsertBlockType( block.name, rootClientId )
214
- )
215
- ) {
216
- return;
212
+ const newBlocks = [];
213
+
214
+ for ( const block of blocks ) {
215
+ if ( canInsertBlockType( block.name, rootClientId ) ) {
216
+ newBlocks.push( block );
217
+ } else {
218
+ // If a block cannot be inserted in a root block, try
219
+ // converting it to that root block type and insert the
220
+ // inner blocks.
221
+ // Example: paragraphs cannot be inserted into a list,
222
+ // so convert the paragraphs to a list for list items.
223
+ const rootBlockName = getBlockName( rootClientId );
224
+ const switchedBlocks =
225
+ block.name !== rootBlockName
226
+ ? switchToBlockType( block, rootBlockName )
227
+ : [ block ];
228
+
229
+ if ( ! switchedBlocks ) {
230
+ return;
231
+ }
232
+
233
+ for ( const switchedBlock of switchedBlocks ) {
234
+ for ( const innerBlock of switchedBlock.innerBlocks ) {
235
+ newBlocks.push( innerBlock );
236
+ }
237
+ }
238
+ }
217
239
  }
218
240
 
219
- __unstableSplitSelection( blocks );
241
+ __unstableSplitSelection( newBlocks );
220
242
  event.preventDefault();
221
243
  }
222
244
  }
@@ -2010,7 +2010,7 @@ export function __unstableSetTemporarilyEditingAsBlocks(
2010
2010
  * per_page: 'page_size',
2011
2011
  * search: 'q',
2012
2012
  * };
2013
- * const url = new URL( 'https://api.openverse.engineering/v1/images/' );
2013
+ * const url = new URL( 'https://api.openverse.org/v1/images/' );
2014
2014
  * Object.entries( finalQuery ).forEach( ( [ key, value ] ) => {
2015
2015
  * const queryKey = mapFromInserterMediaRequest[ key ] || key;
2016
2016
  * url.searchParams.set( queryKey, value );
@@ -76,6 +76,8 @@ const EMPTY_ARRAY = [];
76
76
  */
77
77
  const EMPTY_SET = new Set();
78
78
 
79
+ const EMPTY_OBJECT = {};
80
+
79
81
  /**
80
82
  * Returns a block's name given its client ID, or null if no block exists with
81
83
  * the client ID.
@@ -1996,7 +1998,7 @@ const buildBlockTypeItem =
1996
1998
  */
1997
1999
  export const getInserterItems = createRegistrySelector( ( select ) =>
1998
2000
  createSelector(
1999
- ( state, rootClientId = null, options = {} ) => {
2001
+ ( state, rootClientId = null, options = EMPTY_OBJECT ) => {
2000
2002
  const buildReusableBlockInserterItem = ( reusableBlock ) => {
2001
2003
  const icon = ! reusableBlock.wp_pattern_sync_status
2002
2004
  ? {