@wordpress/block-editor 12.10.12 → 12.10.14

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 (39) hide show
  1. package/build/components/block-patterns-list/index.js +4 -4
  2. package/build/components/block-patterns-list/index.js.map +1 -1
  3. package/build/components/global-styles/filters-panel.js +7 -8
  4. package/build/components/global-styles/filters-panel.js.map +1 -1
  5. package/build/components/inserter/block-patterns-filter.js +3 -3
  6. package/build/components/inserter/block-patterns-filter.js.map +1 -1
  7. package/build/components/provider/index.js +3 -1
  8. package/build/components/provider/index.js.map +1 -1
  9. package/build/hooks/background.js +16 -4
  10. package/build/hooks/background.js.map +1 -1
  11. package/build/hooks/block-rename.js +1 -1
  12. package/build/hooks/block-rename.js.map +1 -1
  13. package/build/store/selectors.js +1 -0
  14. package/build/store/selectors.js.map +1 -1
  15. package/build-module/components/block-patterns-list/index.js +4 -4
  16. package/build-module/components/block-patterns-list/index.js.map +1 -1
  17. package/build-module/components/global-styles/filters-panel.js +7 -8
  18. package/build-module/components/global-styles/filters-panel.js.map +1 -1
  19. package/build-module/components/inserter/block-patterns-filter.js +4 -4
  20. package/build-module/components/inserter/block-patterns-filter.js.map +1 -1
  21. package/build-module/components/provider/index.js +3 -1
  22. package/build-module/components/provider/index.js.map +1 -1
  23. package/build-module/hooks/background.js +17 -5
  24. package/build-module/hooks/background.js.map +1 -1
  25. package/build-module/hooks/block-rename.js +1 -1
  26. package/build-module/hooks/block-rename.js.map +1 -1
  27. package/build-module/store/selectors.js +1 -0
  28. package/build-module/store/selectors.js.map +1 -1
  29. package/build-style/content-rtl.css +7 -6
  30. package/build-style/content.css +7 -6
  31. package/package.json +32 -32
  32. package/src/components/block-list/content.scss +14 -10
  33. package/src/components/block-patterns-list/index.js +14 -11
  34. package/src/components/global-styles/filters-panel.js +9 -15
  35. package/src/components/inserter/block-patterns-filter.js +13 -4
  36. package/src/components/provider/index.js +1 -1
  37. package/src/hooks/background.js +28 -6
  38. package/src/hooks/block-rename.js +5 -1
  39. package/src/store/selectors.js +1 -0
@@ -140,15 +140,16 @@
140
140
  opacity: 0.4;
141
141
  }
142
142
  }
143
+ /* stylelint-disable */
144
+ _::-webkit-full-page-media, _:future, :root .block-editor-block-list__layout::selection,
145
+ _::-webkit-full-page-media, _:future, :root .has-multi-selection .block-editor-block-list__layout::selection {
146
+ background-color: transparent;
147
+ }
148
+
149
+ /* stylelint-enable */
143
150
  .block-editor-block-list__layout {
144
151
  position: relative;
145
152
  }
146
- .block-editor-block-list__layout::selection {
147
- background: transparent;
148
- }
149
- .has-multi-selection .block-editor-block-list__layout::selection {
150
- background: transparent;
151
- }
152
153
  .block-editor-block-list__layout:where(.block-editor-block-list__block.is-multi-selected:not(.is-partially-selected)) {
153
154
  border-radius: 2px;
154
155
  }
@@ -140,15 +140,16 @@
140
140
  opacity: 0.4;
141
141
  }
142
142
  }
143
+ /* stylelint-disable */
144
+ _::-webkit-full-page-media, _:future, :root .block-editor-block-list__layout::selection,
145
+ _::-webkit-full-page-media, _:future, :root .has-multi-selection .block-editor-block-list__layout::selection {
146
+ background-color: transparent;
147
+ }
148
+
149
+ /* stylelint-enable */
143
150
  .block-editor-block-list__layout {
144
151
  position: relative;
145
152
  }
146
- .block-editor-block-list__layout::selection {
147
- background: transparent;
148
- }
149
- .has-multi-selection .block-editor-block-list__layout::selection {
150
- background: transparent;
151
- }
152
153
  .block-editor-block-list__layout:where(.block-editor-block-list__block.is-multi-selected:not(.is-partially-selected)) {
153
154
  border-radius: 2px;
154
155
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wordpress/block-editor",
3
- "version": "12.10.12",
3
+ "version": "12.10.14",
4
4
  "description": "Generic block editor.",
5
5
  "author": "The WordPress Contributors",
6
6
  "license": "GPL-2.0-or-later",
@@ -35,36 +35,36 @@
35
35
  "@emotion/react": "^11.7.1",
36
36
  "@emotion/styled": "^11.6.0",
37
37
  "@react-spring/web": "^9.4.5",
38
- "@wordpress/a11y": "^3.42.12",
39
- "@wordpress/api-fetch": "^6.39.12",
40
- "@wordpress/blob": "^3.42.12",
41
- "@wordpress/blocks": "^12.19.12",
42
- "@wordpress/commands": "^0.13.12",
43
- "@wordpress/components": "^25.8.12",
44
- "@wordpress/compose": "^6.19.12",
45
- "@wordpress/data": "^9.12.12",
46
- "@wordpress/date": "^4.42.12",
47
- "@wordpress/deprecated": "^3.42.12",
48
- "@wordpress/dom": "^3.42.12",
49
- "@wordpress/element": "^5.19.12",
50
- "@wordpress/escape-html": "^2.42.12",
51
- "@wordpress/hooks": "^3.42.12",
52
- "@wordpress/html-entities": "^3.42.12",
53
- "@wordpress/i18n": "^4.42.12",
54
- "@wordpress/icons": "^9.33.12",
55
- "@wordpress/is-shallow-equal": "^4.42.12",
56
- "@wordpress/keyboard-shortcuts": "^4.19.12",
57
- "@wordpress/keycodes": "^3.42.12",
58
- "@wordpress/notices": "^4.10.12",
59
- "@wordpress/preferences": "^3.19.12",
60
- "@wordpress/private-apis": "^0.24.12",
61
- "@wordpress/rich-text": "^6.19.12",
62
- "@wordpress/shortcode": "^3.42.12",
63
- "@wordpress/style-engine": "^1.25.12",
64
- "@wordpress/token-list": "^2.42.12",
65
- "@wordpress/url": "^3.43.12",
66
- "@wordpress/warning": "^2.42.12",
67
- "@wordpress/wordcount": "^3.42.12",
38
+ "@wordpress/a11y": "^3.42.13",
39
+ "@wordpress/api-fetch": "^6.39.13",
40
+ "@wordpress/blob": "^3.42.13",
41
+ "@wordpress/blocks": "^12.19.13",
42
+ "@wordpress/commands": "^0.13.14",
43
+ "@wordpress/components": "^25.8.14",
44
+ "@wordpress/compose": "^6.19.13",
45
+ "@wordpress/data": "^9.12.13",
46
+ "@wordpress/date": "^4.42.13",
47
+ "@wordpress/deprecated": "^3.42.13",
48
+ "@wordpress/dom": "^3.42.13",
49
+ "@wordpress/element": "^5.19.13",
50
+ "@wordpress/escape-html": "^2.42.13",
51
+ "@wordpress/hooks": "^3.42.13",
52
+ "@wordpress/html-entities": "^3.42.13",
53
+ "@wordpress/i18n": "^4.42.13",
54
+ "@wordpress/icons": "^9.33.13",
55
+ "@wordpress/is-shallow-equal": "^4.42.13",
56
+ "@wordpress/keyboard-shortcuts": "^4.19.13",
57
+ "@wordpress/keycodes": "^3.42.13",
58
+ "@wordpress/notices": "^4.10.13",
59
+ "@wordpress/preferences": "^3.19.14",
60
+ "@wordpress/private-apis": "^0.24.13",
61
+ "@wordpress/rich-text": "^6.19.13",
62
+ "@wordpress/shortcode": "^3.42.13",
63
+ "@wordpress/style-engine": "^1.25.13",
64
+ "@wordpress/token-list": "^2.42.13",
65
+ "@wordpress/url": "^3.43.13",
66
+ "@wordpress/warning": "^2.42.13",
67
+ "@wordpress/wordcount": "^3.42.13",
68
68
  "change-case": "^4.1.2",
69
69
  "classnames": "^2.3.1",
70
70
  "colord": "^2.7.0",
@@ -86,5 +86,5 @@
86
86
  "publishConfig": {
87
87
  "access": "public"
88
88
  },
89
- "gitHead": "8447c60232efe04eb248a1c893bf3a1fc4e47ecc"
89
+ "gitHead": "fb3a11411cc4cc3af8a3c2a629842d1c63d8edbc"
90
90
  }
@@ -17,6 +17,20 @@
17
17
  }
18
18
  }
19
19
 
20
+
21
+ // Hide selections on this element, otherwise Safari will include it stacked
22
+ // under your actual selection.
23
+ // This uses a CSS hack to show the rules to Safari only. Failing here is okay,
24
+ // it just makes the selection indication slightly less precise. That makes this
25
+ // hack a progressive enhancement. Stylelint is disabled to allow the hack to work.
26
+ /* stylelint-disable */
27
+ _::-webkit-full-page-media, _:future, :root .block-editor-block-list__layout::selection,
28
+ _::-webkit-full-page-media, _:future, :root .has-multi-selection .block-editor-block-list__layout::selection {
29
+ background-color: transparent;
30
+ }
31
+ /* stylelint-enable */
32
+
33
+
20
34
  // Note to developers refactoring this, please test navigation mode, and
21
35
  // multi selection and hovering the block switcher to highlight the block.
22
36
  // Also be sure to test partial selections in Safari, as it draws the
@@ -24,16 +38,6 @@
24
38
  .block-editor-block-list__layout {
25
39
  position: relative;
26
40
 
27
- // Hide selections on this element, otherwise Safari will include it stacked
28
- // under your actual selection.
29
- &::selection {
30
- background: transparent;
31
- }
32
-
33
- .has-multi-selection &::selection {
34
- background: transparent;
35
- }
36
-
37
41
  // Block multi selection
38
42
  // Apply a rounded radius to the entire block when multi selected, but with low specificity
39
43
  // so explicit radii set by tools are preserved.
@@ -71,7 +71,7 @@ function BlockPattern( {
71
71
  } }
72
72
  >
73
73
  <WithToolTip
74
- showTooltip={ showTooltip && ! pattern.id }
74
+ showTooltip={ showTooltip && ! pattern.type === 'user' }
75
75
  title={ pattern.title }
76
76
  >
77
77
  <CompositeItem
@@ -82,7 +82,8 @@ function BlockPattern( {
82
82
  'block-editor-block-patterns-list__item',
83
83
  {
84
84
  'block-editor-block-patterns-list__list-item-synced':
85
- pattern.id && ! pattern.syncStatus,
85
+ pattern.type === 'user' &&
86
+ ! pattern.syncStatus,
86
87
  }
87
88
  ) }
88
89
  onClick={ () => {
@@ -107,15 +108,17 @@ function BlockPattern( {
107
108
  />
108
109
 
109
110
  <HStack className="block-editor-patterns__pattern-details">
110
- { pattern.id && ! pattern.syncStatus && (
111
- <div className="block-editor-patterns__pattern-icon-wrapper">
112
- <Icon
113
- className="block-editor-patterns__pattern-icon"
114
- icon={ symbol }
115
- />
116
- </div>
117
- ) }
118
- { ( ! showTooltip || pattern.id ) && (
111
+ { pattern.type === 'user' &&
112
+ ! pattern.syncStatus && (
113
+ <div className="block-editor-patterns__pattern-icon-wrapper">
114
+ <Icon
115
+ className="block-editor-patterns__pattern-icon"
116
+ icon={ symbol }
117
+ />
118
+ </div>
119
+ ) }
120
+ { ( ! showTooltip ||
121
+ pattern.type === 'user' ) && (
119
122
  <div className="block-editor-block-patterns-list__item-title">
120
123
  { pattern.title }
121
124
  </div>
@@ -54,13 +54,15 @@ function useMultiOriginColorPresets(
54
54
  }
55
55
 
56
56
  export function useHasFiltersPanel( settings ) {
57
- const hasDuotone = useHasDuotoneControl( settings );
58
-
59
- return hasDuotone;
57
+ return useHasDuotoneControl( settings );
60
58
  }
61
59
 
62
60
  function useHasDuotoneControl( settings ) {
63
- return settings.color.customDuotone || settings.color.defaultDuotone;
61
+ return (
62
+ settings.color.customDuotone ||
63
+ settings.color.defaultDuotone ||
64
+ settings.color.duotone.length > 0
65
+ );
64
66
  }
65
67
 
66
68
  function FiltersToolsPanel( {
@@ -148,11 +150,6 @@ export default function FiltersPanel( {
148
150
  const hasDuotone = () => !! value?.filter?.duotone;
149
151
  const resetDuotone = () => setDuotone( undefined );
150
152
 
151
- const disableCustomColors = ! settings?.color?.custom;
152
- const disableCustomDuotone =
153
- ! settings?.color?.customDuotone ||
154
- ( colorPalette?.length === 0 && disableCustomColors );
155
-
156
153
  const resetAllFilter = useCallback( ( previousValue ) => {
157
154
  return {
158
155
  ...previousValue,
@@ -210,12 +207,9 @@ export default function FiltersPanel( {
210
207
  <DuotonePicker
211
208
  colorPalette={ colorPalette }
212
209
  duotonePalette={ duotonePalette }
213
- disableCustomColors={
214
- disableCustomColors
215
- }
216
- disableCustomDuotone={
217
- disableCustomDuotone
218
- }
210
+ // TODO: Re-enable both when custom colors are supported for block-level styles.
211
+ disableCustomColors
212
+ disableCustomDuotone
219
213
  value={ duotone }
220
214
  onChange={ setDuotone }
221
215
  />
@@ -9,7 +9,7 @@ import {
9
9
  MenuItemsChoice,
10
10
  ExternalLink,
11
11
  } from '@wordpress/components';
12
- import { __ } from '@wordpress/i18n';
12
+ import { __, _x } from '@wordpress/i18n';
13
13
  import { Icon } from '@wordpress/icons';
14
14
  import { useMemo, createInterpolateElement } from '@wordpress/element';
15
15
 
@@ -70,15 +70,24 @@ export function BlockPatternsSyncFilter( {
70
70
 
71
71
  const patternSyncMenuOptions = useMemo(
72
72
  () => [
73
- { value: SYNC_TYPES.all, label: __( 'All' ) },
73
+ {
74
+ value: SYNC_TYPES.all,
75
+ label: _x( 'All', 'Option that shows all patterns' ),
76
+ },
74
77
  {
75
78
  value: SYNC_TYPES.full,
76
- label: __( 'Synced' ),
79
+ label: _x(
80
+ 'Synced',
81
+ 'Option that shows all synchronized patterns'
82
+ ),
77
83
  disabled: shouldDisableSyncFilter,
78
84
  },
79
85
  {
80
86
  value: SYNC_TYPES.unsynced,
81
- label: __( 'Not synced' ),
87
+ label: _x(
88
+ 'Not synced',
89
+ 'Option that shows all patterns that are not synchronized'
90
+ ),
82
91
  disabled: shouldDisableSyncFilter,
83
92
  },
84
93
  ],
@@ -45,7 +45,7 @@ export const ExperimentalBlockEditorProvider = withRegistryProvider(
45
45
  useBlockSync( props );
46
46
 
47
47
  return (
48
- <SlotFillProvider>
48
+ <SlotFillProvider passthrough>
49
49
  <KeyboardShortcuts.Register />
50
50
  <BlockRefsProvider>{ children }</BlockRefsProvider>
51
51
  </SlotFillProvider>
@@ -8,6 +8,7 @@ import classnames from 'classnames';
8
8
  */
9
9
  import { isBlobURL } from '@wordpress/blob';
10
10
  import { getBlockSupport } from '@wordpress/blocks';
11
+ import { focus } from '@wordpress/dom';
11
12
  import {
12
13
  __experimentalToolsPanelItem as ToolsPanelItem,
13
14
  DropZone,
@@ -19,7 +20,7 @@ import {
19
20
  __experimentalTruncate as Truncate,
20
21
  } from '@wordpress/components';
21
22
  import { useDispatch, useSelect } from '@wordpress/data';
22
- import { Platform, useCallback } from '@wordpress/element';
23
+ import { Platform, useCallback, useRef } from '@wordpress/element';
23
24
  import { __, sprintf } from '@wordpress/i18n';
24
25
  import { store as noticesStore } from '@wordpress/notices';
25
26
  import { getFilename } from '@wordpress/url';
@@ -150,6 +151,8 @@ function BackgroundImagePanelItem( props ) {
150
151
  const { id, title, url } =
151
152
  attributes.style?.background?.backgroundImage || {};
152
153
 
154
+ const replaceContainerRef = useRef();
155
+
153
156
  const { mediaUpload } = useSelect( ( select ) => {
154
157
  return {
155
158
  mediaUpload: select( blockEditorStore ).getSettings().mediaUpload,
@@ -241,17 +244,22 @@ function BackgroundImagePanelItem( props ) {
241
244
  };
242
245
  }, [] );
243
246
 
247
+ const hasValue = hasBackgroundImageValue( props );
248
+
244
249
  return (
245
250
  <ToolsPanelItem
246
251
  className="single-column"
247
- hasValue={ () => hasBackgroundImageValue( props ) }
252
+ hasValue={ () => hasValue }
248
253
  label={ __( 'Background image' ) }
249
254
  onDeselect={ () => resetBackgroundImage( props ) }
250
255
  isShownByDefault={ true }
251
256
  resetAllFilter={ resetAllFilter }
252
257
  panelId={ clientId }
253
258
  >
254
- <div className="block-editor-hooks__background__inspector-media-replace-container">
259
+ <div
260
+ className="block-editor-hooks__background__inspector-media-replace-container"
261
+ ref={ replaceContainerRef }
262
+ >
255
263
  <MediaReplaceFlow
256
264
  mediaId={ id }
257
265
  mediaURL={ url }
@@ -267,9 +275,23 @@ function BackgroundImagePanelItem( props ) {
267
275
  }
268
276
  variant="secondary"
269
277
  >
270
- <MenuItem onClick={ () => resetBackgroundImage( props ) }>
271
- { __( 'Reset ' ) }
272
- </MenuItem>
278
+ { hasValue && (
279
+ <MenuItem
280
+ onClick={ () => {
281
+ const [ toggleButton ] = focus.tabbable.find(
282
+ replaceContainerRef.current
283
+ );
284
+ // Focus the toggle button and close the dropdown menu.
285
+ // This ensures similar behaviour as to selecting an image, where the dropdown is
286
+ // closed and focus is redirected to the dropdown toggle button.
287
+ toggleButton?.focus();
288
+ toggleButton?.click();
289
+ resetBackgroundImage( props );
290
+ } }
291
+ >
292
+ { __( 'Reset ' ) }
293
+ </MenuItem>
294
+ ) }
273
295
  </MediaReplaceFlow>
274
296
  <DropZone
275
297
  onFilesDrop={ onFilesDrop }
@@ -16,7 +16,11 @@ export const withBlockRenameControl = createHigherOrderComponent(
16
16
  ( BlockEdit ) => ( props ) => {
17
17
  const { name, attributes, setAttributes, isSelected } = props;
18
18
 
19
- const supportsBlockNaming = hasBlockSupport( name, 'renaming', true );
19
+ const supportsBlockNaming = hasBlockSupport(
20
+ name,
21
+ '__experimentalMetadata',
22
+ false
23
+ );
20
24
 
21
25
  return (
22
26
  <>
@@ -2304,6 +2304,7 @@ function getUserPatterns( state ) {
2304
2304
  return {
2305
2305
  name: `core/block/${ userPattern.id }`,
2306
2306
  id: userPattern.id,
2307
+ type: 'user',
2307
2308
  title: userPattern.title.raw,
2308
2309
  categories: userPattern.wp_pattern_category.map( ( catId ) =>
2309
2310
  categories && categories.get( catId )