@wordpress/block-editor 14.10.0 → 14.11.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.
Files changed (247) hide show
  1. package/CHANGELOG.md +3 -1
  2. package/build/components/background-image-control/index.js +0 -1
  3. package/build/components/background-image-control/index.js.map +1 -1
  4. package/build/components/block-actions/index.js +0 -3
  5. package/build/components/block-actions/index.js.map +1 -1
  6. package/build/components/block-inspector/index.js +6 -11
  7. package/build/components/block-inspector/index.js.map +1 -1
  8. package/build/components/block-list/use-block-props/use-focus-handler.js +1 -1
  9. package/build/components/block-list/use-block-props/use-focus-handler.js.map +1 -1
  10. package/build/components/block-rename/modal.js +36 -11
  11. package/build/components/block-rename/modal.js.map +1 -1
  12. package/build/components/block-rename/rename-control.js +2 -43
  13. package/build/components/block-rename/rename-control.js.map +1 -1
  14. package/build/components/block-settings-menu/block-settings-dropdown.js +12 -3
  15. package/build/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
  16. package/build/components/block-styles/preview.native.js +1 -1
  17. package/build/components/block-styles/preview.native.js.map +1 -1
  18. package/build/components/block-switcher/block-transformations-menu.js +7 -7
  19. package/build/components/block-switcher/block-transformations-menu.js.map +1 -1
  20. package/build/components/block-switcher/block-variation-transformations.js +2 -2
  21. package/build/components/block-switcher/block-variation-transformations.js.map +1 -1
  22. package/build/components/block-switcher/index.js +1 -1
  23. package/build/components/block-switcher/index.js.map +1 -1
  24. package/build/components/block-switcher/use-transformed-patterns.js +1 -1
  25. package/build/components/block-switcher/use-transformed-patterns.js.map +1 -1
  26. package/build/components/block-toolbar/index.native.js +2 -2
  27. package/build/components/block-toolbar/index.native.js.map +1 -1
  28. package/build/components/date-format-picker/index.js +1 -1
  29. package/build/components/date-format-picker/index.js.map +1 -1
  30. package/build/components/global-styles/filters-panel.js +2 -2
  31. package/build/components/global-styles/filters-panel.js.map +1 -1
  32. package/build/components/global-styles/image-settings-panel.js +2 -2
  33. package/build/components/global-styles/image-settings-panel.js.map +1 -1
  34. package/build/components/global-styles/use-global-styles-output.js +3 -3
  35. package/build/components/global-styles/use-global-styles-output.js.map +1 -1
  36. package/build/components/iframe/get-compatibility-styles.js +1 -1
  37. package/build/components/iframe/get-compatibility-styles.js.map +1 -1
  38. package/build/components/iframe/index.js +1 -1
  39. package/build/components/iframe/index.js.map +1 -1
  40. package/build/components/image-size-control/index.js +2 -1
  41. package/build/components/image-size-control/index.js.map +1 -1
  42. package/build/components/inserter/block-patterns-tab/patterns-filter.js +1 -1
  43. package/build/components/inserter/block-patterns-tab/patterns-filter.js.map +1 -1
  44. package/build/components/inserter/reusable-blocks-tab.native.js +1 -1
  45. package/build/components/inserter/reusable-blocks-tab.native.js.map +1 -1
  46. package/build/components/line-height-control/index.native.js +1 -1
  47. package/build/components/line-height-control/index.native.js.map +1 -1
  48. package/build/components/link-control/index.js +1 -1
  49. package/build/components/link-control/index.js.map +1 -1
  50. package/build/components/link-control/use-search-handler.js +1 -1
  51. package/build/components/link-control/use-search-handler.js.map +1 -1
  52. package/build/components/list-view/block-select-button.js +5 -2
  53. package/build/components/list-view/block-select-button.js.map +1 -1
  54. package/build/components/media-placeholder/index.js +1 -0
  55. package/build/components/media-placeholder/index.js.map +1 -1
  56. package/build/components/observe-typing/index.js +1 -1
  57. package/build/components/observe-typing/index.js.map +1 -1
  58. package/build/components/provider/index.js +0 -2
  59. package/build/components/provider/index.js.map +1 -1
  60. package/build/components/provider/use-block-sync.js +2 -2
  61. package/build/components/provider/use-block-sync.js.map +1 -1
  62. package/build/components/rich-text/event-listeners/input-rules.js +3 -3
  63. package/build/components/rich-text/event-listeners/input-rules.js.map +1 -1
  64. package/build/components/rich-text/native/use-format-types.js +1 -1
  65. package/build/components/rich-text/native/use-format-types.js.map +1 -1
  66. package/build/components/rich-text/use-format-types.js +1 -1
  67. package/build/components/rich-text/use-format-types.js.map +1 -1
  68. package/build/components/tabbed-sidebar/index.js +39 -0
  69. package/build/components/tabbed-sidebar/index.js.map +1 -1
  70. package/build/components/typewriter/index.js +1 -1
  71. package/build/components/typewriter/index.js.map +1 -1
  72. package/build/components/url-popover/image-url-input-ui.js +3 -3
  73. package/build/components/url-popover/image-url-input-ui.js.map +1 -1
  74. package/build/components/use-block-commands/index.js +1 -1
  75. package/build/components/use-block-commands/index.js.map +1 -1
  76. package/build/components/use-moving-animation/index.js +1 -1
  77. package/build/components/use-moving-animation/index.js.map +1 -1
  78. package/build/store/actions.js +1 -1
  79. package/build/store/actions.js.map +1 -1
  80. package/build/store/selectors.js +5 -5
  81. package/build/store/selectors.js.map +1 -1
  82. package/build/utils/transform-styles/index.js +1 -1
  83. package/build/utils/transform-styles/index.js.map +1 -1
  84. package/build/utils/use-notify-copy.js +19 -11
  85. package/build/utils/use-notify-copy.js.map +1 -1
  86. package/build-module/components/background-image-control/index.js +0 -1
  87. package/build-module/components/background-image-control/index.js.map +1 -1
  88. package/build-module/components/block-actions/index.js +0 -3
  89. package/build-module/components/block-actions/index.js.map +1 -1
  90. package/build-module/components/block-inspector/index.js +6 -11
  91. package/build-module/components/block-inspector/index.js.map +1 -1
  92. package/build-module/components/block-list/use-block-props/use-focus-handler.js +1 -1
  93. package/build-module/components/block-list/use-block-props/use-focus-handler.js.map +1 -1
  94. package/build-module/components/block-rename/modal.js +36 -11
  95. package/build-module/components/block-rename/modal.js.map +1 -1
  96. package/build-module/components/block-rename/rename-control.js +2 -43
  97. package/build-module/components/block-rename/rename-control.js.map +1 -1
  98. package/build-module/components/block-settings-menu/block-settings-dropdown.js +12 -3
  99. package/build-module/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
  100. package/build-module/components/block-styles/preview.native.js +1 -1
  101. package/build-module/components/block-styles/preview.native.js.map +1 -1
  102. package/build-module/components/block-switcher/block-transformations-menu.js +7 -7
  103. package/build-module/components/block-switcher/block-transformations-menu.js.map +1 -1
  104. package/build-module/components/block-switcher/block-variation-transformations.js +2 -2
  105. package/build-module/components/block-switcher/block-variation-transformations.js.map +1 -1
  106. package/build-module/components/block-switcher/index.js +1 -1
  107. package/build-module/components/block-switcher/index.js.map +1 -1
  108. package/build-module/components/block-switcher/use-transformed-patterns.js +1 -1
  109. package/build-module/components/block-switcher/use-transformed-patterns.js.map +1 -1
  110. package/build-module/components/block-toolbar/index.native.js +2 -2
  111. package/build-module/components/block-toolbar/index.native.js.map +1 -1
  112. package/build-module/components/date-format-picker/index.js +1 -1
  113. package/build-module/components/date-format-picker/index.js.map +1 -1
  114. package/build-module/components/global-styles/filters-panel.js +2 -2
  115. package/build-module/components/global-styles/filters-panel.js.map +1 -1
  116. package/build-module/components/global-styles/image-settings-panel.js +2 -2
  117. package/build-module/components/global-styles/image-settings-panel.js.map +1 -1
  118. package/build-module/components/global-styles/use-global-styles-output.js +3 -3
  119. package/build-module/components/global-styles/use-global-styles-output.js.map +1 -1
  120. package/build-module/components/iframe/get-compatibility-styles.js +1 -1
  121. package/build-module/components/iframe/get-compatibility-styles.js.map +1 -1
  122. package/build-module/components/iframe/index.js +1 -1
  123. package/build-module/components/iframe/index.js.map +1 -1
  124. package/build-module/components/image-size-control/index.js +3 -2
  125. package/build-module/components/image-size-control/index.js.map +1 -1
  126. package/build-module/components/inserter/block-patterns-tab/patterns-filter.js +1 -1
  127. package/build-module/components/inserter/block-patterns-tab/patterns-filter.js.map +1 -1
  128. package/build-module/components/inserter/reusable-blocks-tab.native.js +1 -1
  129. package/build-module/components/inserter/reusable-blocks-tab.native.js.map +1 -1
  130. package/build-module/components/line-height-control/index.native.js +1 -1
  131. package/build-module/components/line-height-control/index.native.js.map +1 -1
  132. package/build-module/components/link-control/index.js +1 -1
  133. package/build-module/components/link-control/index.js.map +1 -1
  134. package/build-module/components/link-control/use-search-handler.js +1 -1
  135. package/build-module/components/link-control/use-search-handler.js.map +1 -1
  136. package/build-module/components/list-view/block-select-button.js +6 -3
  137. package/build-module/components/list-view/block-select-button.js.map +1 -1
  138. package/build-module/components/media-placeholder/index.js +1 -0
  139. package/build-module/components/media-placeholder/index.js.map +1 -1
  140. package/build-module/components/observe-typing/index.js +1 -1
  141. package/build-module/components/observe-typing/index.js.map +1 -1
  142. package/build-module/components/provider/index.js +0 -1
  143. package/build-module/components/provider/index.js.map +1 -1
  144. package/build-module/components/provider/use-block-sync.js +2 -2
  145. package/build-module/components/provider/use-block-sync.js.map +1 -1
  146. package/build-module/components/rich-text/event-listeners/input-rules.js +3 -3
  147. package/build-module/components/rich-text/event-listeners/input-rules.js.map +1 -1
  148. package/build-module/components/rich-text/native/use-format-types.js +1 -1
  149. package/build-module/components/rich-text/native/use-format-types.js.map +1 -1
  150. package/build-module/components/rich-text/use-format-types.js +1 -1
  151. package/build-module/components/rich-text/use-format-types.js.map +1 -1
  152. package/build-module/components/tabbed-sidebar/index.js +39 -0
  153. package/build-module/components/tabbed-sidebar/index.js.map +1 -1
  154. package/build-module/components/typewriter/index.js +1 -1
  155. package/build-module/components/typewriter/index.js.map +1 -1
  156. package/build-module/components/url-popover/image-url-input-ui.js +3 -3
  157. package/build-module/components/url-popover/image-url-input-ui.js.map +1 -1
  158. package/build-module/components/use-block-commands/index.js +1 -1
  159. package/build-module/components/use-block-commands/index.js.map +1 -1
  160. package/build-module/components/use-moving-animation/index.js +1 -1
  161. package/build-module/components/use-moving-animation/index.js.map +1 -1
  162. package/build-module/store/actions.js +1 -1
  163. package/build-module/store/actions.js.map +1 -1
  164. package/build-module/store/selectors.js +5 -5
  165. package/build-module/store/selectors.js.map +1 -1
  166. package/build-module/utils/transform-styles/index.js +1 -1
  167. package/build-module/utils/transform-styles/index.js.map +1 -1
  168. package/build-module/utils/use-notify-copy.js +19 -11
  169. package/build-module/utils/use-notify-copy.js.map +1 -1
  170. package/build-style/content-rtl.css +0 -9
  171. package/build-style/content.css +0 -9
  172. package/build-style/style-rtl.css +18 -21
  173. package/build-style/style.css +18 -21
  174. package/package.json +34 -33
  175. package/src/components/background-image-control/index.js +0 -1
  176. package/src/components/block-actions/index.js +0 -3
  177. package/src/components/block-icon/content.scss +1 -1
  178. package/src/components/{block-card → block-icon}/stories/index.story.js +16 -26
  179. package/src/components/block-icon/style.scss +1 -1
  180. package/src/components/block-inspector/index.js +7 -10
  181. package/src/components/block-list/use-block-props/use-focus-handler.js +1 -1
  182. package/src/components/block-preview/style.scss +1 -1
  183. package/src/components/block-rename/modal.js +40 -12
  184. package/src/components/block-rename/rename-control.js +1 -53
  185. package/src/components/block-settings-menu/block-settings-dropdown.js +16 -2
  186. package/src/components/block-styles/preview.native.js +1 -1
  187. package/src/components/block-switcher/block-transformations-menu.js +9 -9
  188. package/src/components/block-switcher/block-variation-transformations.js +2 -2
  189. package/src/components/block-switcher/index.js +1 -1
  190. package/src/components/block-switcher/use-transformed-patterns.js +1 -1
  191. package/src/components/block-toolbar/index.native.js +2 -2
  192. package/src/components/color-palette/test/__snapshots__/control.js.snap +1 -1
  193. package/src/components/colors-gradients/style.scss +1 -0
  194. package/src/components/colors-gradients/test/control.js +2 -2
  195. package/src/components/date-format-picker/index.js +1 -1
  196. package/src/components/duotone-control/style.scss +2 -2
  197. package/src/components/global-styles/filters-panel.js +4 -2
  198. package/src/components/global-styles/image-settings-panel.js +2 -2
  199. package/src/components/global-styles/test/typography-utils.js +1 -1
  200. package/src/components/global-styles/use-global-styles-output.js +3 -3
  201. package/src/components/iframe/get-compatibility-styles.js +1 -1
  202. package/src/components/iframe/index.js +1 -1
  203. package/src/components/image-size-control/index.js +6 -2
  204. package/src/components/inner-blocks/README.md +1 -1
  205. package/src/components/inserter/block-patterns-tab/patterns-filter.js +1 -1
  206. package/src/components/inserter/reusable-blocks-tab.native.js +1 -1
  207. package/src/components/line-height-control/index.native.js +1 -1
  208. package/src/components/link-control/README.md +2 -2
  209. package/src/components/link-control/index.js +1 -1
  210. package/src/components/link-control/test/index.js +3 -3
  211. package/src/components/link-control/use-search-handler.js +1 -1
  212. package/src/components/list-view/README.md +1 -1
  213. package/src/components/list-view/block-select-button.js +5 -5
  214. package/src/components/list-view/style.scss +3 -7
  215. package/src/components/media-placeholder/content.scss +0 -8
  216. package/src/components/media-placeholder/index.js +1 -0
  217. package/src/components/media-placeholder/style.scss +7 -0
  218. package/src/components/observe-typing/index.js +1 -1
  219. package/src/components/provider/index.js +0 -1
  220. package/src/components/provider/use-block-sync.js +2 -2
  221. package/src/components/resolution-tool/stories/index.story.js +52 -2
  222. package/src/components/rich-text/README.md +1 -1
  223. package/src/components/rich-text/event-listeners/input-rules.js +3 -3
  224. package/src/components/rich-text/native/use-format-types.js +1 -1
  225. package/src/components/rich-text/use-format-types.js +1 -1
  226. package/src/components/tabbed-sidebar/README.md +24 -13
  227. package/src/components/tabbed-sidebar/index.js +38 -0
  228. package/src/components/tabbed-sidebar/stories/index.story.js +104 -0
  229. package/src/components/typewriter/index.js +1 -1
  230. package/src/components/unit-control/README.md +1 -1
  231. package/src/components/unit-control/stories/index.story.js +124 -0
  232. package/src/components/url-popover/image-url-input-ui.js +3 -3
  233. package/src/components/use-block-commands/index.js +1 -1
  234. package/src/components/use-moving-animation/index.js +1 -1
  235. package/src/components/use-settings/README.md +1 -1
  236. package/src/components/warning/content.scss +1 -1
  237. package/src/components/writing-flow/test/index.js +1 -1
  238. package/src/hooks/color.scss +0 -7
  239. package/src/store/actions.js +1 -1
  240. package/src/store/selectors.js +5 -5
  241. package/src/store/test/private-selectors.js +1 -1
  242. package/src/store/test/selectors.js +3 -3
  243. package/src/style.scss +1 -0
  244. package/src/utils/test/sorting.js +1 -1
  245. package/src/utils/transform-styles/index.js +1 -1
  246. package/src/utils/use-notify-copy.js +51 -43
  247. package/tsconfig.json +1 -0
@@ -11,24 +11,44 @@ import {
11
11
  import { __, sprintf } from '@wordpress/i18n';
12
12
  import { useState } from '@wordpress/element';
13
13
  import { speak } from '@wordpress/a11y';
14
+ import { useSelect, useDispatch } from '@wordpress/data';
14
15
 
15
16
  /**
16
17
  * Internal dependencies
17
18
  */
19
+ import { store as blockEditorStore } from '../../store';
20
+ import { useBlockDisplayInformation } from '..';
18
21
  import isEmptyString from './is-empty-string';
19
22
 
20
- export default function BlockRenameModal( {
21
- blockName,
22
- originalBlockName,
23
- onClose,
24
- onSave,
23
+ export default function BlockRenameModal( { clientId, onClose } ) {
24
+ const [ editedBlockName, setEditedBlockName ] = useState();
25
+
26
+ const blockInformation = useBlockDisplayInformation( clientId );
27
+ const { metadata } = useSelect(
28
+ ( select ) => {
29
+ const { getBlockAttributes } = select( blockEditorStore );
30
+
31
+ return {
32
+ metadata: getBlockAttributes( clientId )?.metadata,
33
+ };
34
+ },
35
+ [ clientId ]
36
+ );
37
+ const { updateBlockAttributes } = useDispatch( blockEditorStore );
38
+
39
+ const blockName = metadata?.name || '';
40
+ const originalBlockName = blockInformation?.title;
25
41
  // Pattern Overrides is a WordPress-only feature but it also uses the Block Binding API.
26
42
  // Ideally this should not be inside the block editor package, but we keep it here for simplicity.
27
- hasOverridesWarning,
28
- } ) {
29
- const [ editedBlockName, setEditedBlockName ] = useState( blockName );
43
+ const hasOverridesWarning =
44
+ !! blockName &&
45
+ !! metadata?.bindings &&
46
+ Object.values( metadata.bindings ).some(
47
+ ( binding ) => binding.source === 'core/pattern-overrides'
48
+ );
30
49
 
31
- const nameHasChanged = editedBlockName !== blockName;
50
+ const nameHasChanged =
51
+ editedBlockName !== undefined && editedBlockName !== blockName;
32
52
  const nameIsOriginal = editedBlockName === originalBlockName;
33
53
  const nameIsEmpty = isEmptyString( editedBlockName );
34
54
 
@@ -37,6 +57,8 @@ export default function BlockRenameModal( {
37
57
  const autoSelectInputText = ( event ) => event.target.select();
38
58
 
39
59
  const handleSubmit = () => {
60
+ const newName =
61
+ nameIsOriginal || nameIsEmpty ? undefined : editedBlockName;
40
62
  const message =
41
63
  nameIsOriginal || nameIsEmpty
42
64
  ? sprintf(
@@ -52,7 +74,12 @@ export default function BlockRenameModal( {
52
74
 
53
75
  // Must be assertive to immediately announce change.
54
76
  speak( message, 'assertive' );
55
- onSave( editedBlockName );
77
+ updateBlockAttributes( [ clientId ], {
78
+ metadata: {
79
+ ...metadata,
80
+ name: newName,
81
+ },
82
+ } );
56
83
 
57
84
  // Immediate close avoids ability to hit save multiple times.
58
85
  onClose();
@@ -81,7 +108,7 @@ export default function BlockRenameModal( {
81
108
  <TextControl
82
109
  __nextHasNoMarginBottom
83
110
  __next40pxDefaultSize
84
- value={ editedBlockName }
111
+ value={ editedBlockName ?? blockName }
85
112
  label={ __( 'Name' ) }
86
113
  help={
87
114
  hasOverridesWarning
@@ -105,7 +132,8 @@ export default function BlockRenameModal( {
105
132
 
106
133
  <Button
107
134
  __next40pxDefaultSize
108
- aria-disabled={ ! isNameValid }
135
+ accessibleWhenDisabled
136
+ disabled={ ! isNameValid }
109
137
  variant="primary"
110
138
  type="submit"
111
139
  >
@@ -2,54 +2,17 @@
2
2
  * WordPress dependencies
3
3
  */
4
4
  import { MenuItem } from '@wordpress/components';
5
- import { useSelect, useDispatch } from '@wordpress/data';
6
5
  import { __ } from '@wordpress/i18n';
7
6
  import { useState } from '@wordpress/element';
8
7
 
9
8
  /**
10
9
  * Internal dependencies
11
10
  */
12
- import { store as blockEditorStore } from '../../store';
13
- import { useBlockDisplayInformation } from '..';
14
- import isEmptyString from './is-empty-string';
15
11
  import BlockRenameModal from './modal';
16
12
 
17
13
  export default function BlockRenameControl( { clientId } ) {
18
14
  const [ renamingBlock, setRenamingBlock ] = useState( false );
19
15
 
20
- const { metadata } = useSelect(
21
- ( select ) => {
22
- const { getBlockAttributes } = select( blockEditorStore );
23
-
24
- const _metadata = getBlockAttributes( clientId )?.metadata;
25
- return {
26
- metadata: _metadata,
27
- };
28
- },
29
- [ clientId ]
30
- );
31
-
32
- const { updateBlockAttributes } = useDispatch( blockEditorStore );
33
-
34
- const customName = metadata?.name;
35
- const hasPatternOverrides =
36
- !! customName &&
37
- !! metadata?.bindings &&
38
- Object.values( metadata.bindings ).some(
39
- ( binding ) => binding.source === 'core/pattern-overrides'
40
- );
41
-
42
- function onChange( newName ) {
43
- updateBlockAttributes( [ clientId ], {
44
- metadata: {
45
- ...metadata,
46
- name: newName,
47
- },
48
- } );
49
- }
50
-
51
- const blockInformation = useBlockDisplayInformation( clientId );
52
-
53
16
  return (
54
17
  <>
55
18
  <MenuItem
@@ -63,23 +26,8 @@ export default function BlockRenameControl( { clientId } ) {
63
26
  </MenuItem>
64
27
  { renamingBlock && (
65
28
  <BlockRenameModal
66
- blockName={ customName || '' }
67
- originalBlockName={ blockInformation?.title }
68
- hasOverridesWarning={ hasPatternOverrides }
29
+ clientId={ clientId }
69
30
  onClose={ () => setRenamingBlock( false ) }
70
- onSave={ ( newName ) => {
71
- // If the new value is the block's original name (e.g. `Group`)
72
- // or it is an empty string then assume the intent is to reset
73
- // the value. Therefore reset the metadata.
74
- if (
75
- newName === blockInformation?.title ||
76
- isEmptyString( newName )
77
- ) {
78
- newName = undefined;
79
- }
80
-
81
- onChange( newName );
82
- } }
83
31
  />
84
32
  ) }
85
33
  </>
@@ -26,17 +26,30 @@ import BlockSettingsMenuControls from '../block-settings-menu-controls';
26
26
  import BlockParentSelectorMenuItem from './block-parent-selector-menu-item';
27
27
  import { store as blockEditorStore } from '../../store';
28
28
  import { unlock } from '../../lock-unlock';
29
+ import { useNotifyCopy } from '../../utils/use-notify-copy';
29
30
 
30
31
  const POPOVER_PROPS = {
31
32
  className: 'block-editor-block-settings-menu__popover',
32
33
  placement: 'bottom-start',
33
34
  };
34
35
 
35
- function CopyMenuItem( { clientIds, onCopy, label, shortcut } ) {
36
+ function CopyMenuItem( {
37
+ clientIds,
38
+ onCopy,
39
+ label,
40
+ shortcut,
41
+ eventType = 'copy',
42
+ } ) {
36
43
  const { getBlocksByClientId } = useSelect( blockEditorStore );
44
+ const notifyCopy = useNotifyCopy();
37
45
  const ref = useCopyToClipboard(
38
46
  () => serialize( getBlocksByClientId( clientIds ) ),
39
- onCopy
47
+ () => {
48
+ if ( onCopy && eventType === 'copy' ) {
49
+ onCopy();
50
+ }
51
+ notifyCopy( eventType, clientIds );
52
+ }
40
53
  );
41
54
  const copyMenuItemLabel = label ? label : __( 'Copy' );
42
55
  return (
@@ -305,6 +318,7 @@ export function BlockSettingsDropdown( {
305
318
  clientIds={ clientIds }
306
319
  onCopy={ onCopy }
307
320
  label={ __( 'Copy styles' ) }
321
+ eventType="copyStyles"
308
322
  />
309
323
  <MenuItem onClick={ onPasteStyles }>
310
324
  { __( 'Paste styles' ) }
@@ -33,7 +33,7 @@ function StylePreview( { onPress, isActive, style, url } ) {
33
33
 
34
34
  function onLayout() {
35
35
  const columnsNum =
36
- // To indicate scroll availabilty, there is a need to display additional half the column.
36
+ // To indicate scroll availability, there is a need to display additional half the column.
37
37
  Math.floor( BottomSheet.getWidth() / MAX_ITEM_WIDTH ) + HALF_COLUMN;
38
38
  setItemWidth( BottomSheet.getWidth() / columnsNum );
39
39
  }
@@ -27,20 +27,20 @@ import BlockVariationTransformations from './block-variation-transformations';
27
27
  * @return {Record<string, Object[]>} The grouped block transformations.
28
28
  */
29
29
  function useGroupedTransforms( possibleBlockTransformations ) {
30
- const priorityContentTranformationBlocks = {
30
+ const priorityContentTransformationBlocks = {
31
31
  'core/paragraph': 1,
32
32
  'core/heading': 2,
33
33
  'core/list': 3,
34
34
  'core/quote': 4,
35
35
  };
36
36
  const transformations = useMemo( () => {
37
- const priorityTextTranformsNames = Object.keys(
38
- priorityContentTranformationBlocks
37
+ const priorityTextTransformsNames = Object.keys(
38
+ priorityContentTransformationBlocks
39
39
  );
40
40
  const groupedPossibleTransforms = possibleBlockTransformations.reduce(
41
41
  ( accumulator, item ) => {
42
42
  const { name } = item;
43
- if ( priorityTextTranformsNames.includes( name ) ) {
43
+ if ( priorityTextTransformsNames.includes( name ) ) {
44
44
  accumulator.priorityTextTransformations.push( item );
45
45
  } else {
46
46
  accumulator.restTransformations.push( item );
@@ -71,8 +71,8 @@ function useGroupedTransforms( possibleBlockTransformations ) {
71
71
  // Order the priority text transformations.
72
72
  transformations.priorityTextTransformations.sort(
73
73
  ( { name: currentName }, { name: nextName } ) => {
74
- return priorityContentTranformationBlocks[ currentName ] <
75
- priorityContentTranformationBlocks[ nextName ]
74
+ return priorityContentTransformationBlocks[ currentName ] <
75
+ priorityContentTransformationBlocks[ nextName ]
76
76
  ? -1
77
77
  : 1;
78
78
  }
@@ -125,7 +125,7 @@ const BlockTransformationsMenu = ( {
125
125
  />
126
126
  ) }
127
127
  { priorityTextTransformations.map( ( item ) => (
128
- <BlockTranformationItem
128
+ <BlockTransformationItem
129
129
  key={ item.name }
130
130
  item={ item }
131
131
  onSelect={ onSelect }
@@ -151,7 +151,7 @@ function RestTransformationItems( {
151
151
  setHoveredTransformItemName,
152
152
  } ) {
153
153
  return restTransformations.map( ( item ) => (
154
- <BlockTranformationItem
154
+ <BlockTransformationItem
155
155
  key={ item.name }
156
156
  item={ item }
157
157
  onSelect={ onSelect }
@@ -160,7 +160,7 @@ function RestTransformationItems( {
160
160
  ) );
161
161
  }
162
162
 
163
- function BlockTranformationItem( {
163
+ function BlockTransformationItem( {
164
164
  item,
165
165
  onSelect,
166
166
  setHoveredTransformItemName,
@@ -74,7 +74,7 @@ const BlockVariationTransformations = ( {
74
74
  />
75
75
  ) }
76
76
  { transformations?.map( ( item ) => (
77
- <BlockVariationTranformationItem
77
+ <BlockVariationTransformationItem
78
78
  key={ item.name }
79
79
  item={ item }
80
80
  onSelect={ onSelect }
@@ -85,7 +85,7 @@ const BlockVariationTransformations = ( {
85
85
  );
86
86
  };
87
87
 
88
- function BlockVariationTranformationItem( {
88
+ function BlockVariationTransformationItem( {
89
89
  item,
90
90
  onSelect,
91
91
  setHoveredTransformItemName,
@@ -82,7 +82,7 @@ function BlockSwitcherDropdownMenuContents( {
82
82
  );
83
83
  }
84
84
  }
85
- // Simple block tranformation based on the `Block Transforms` API.
85
+ // Simple block transformation based on the `Block Transforms` API.
86
86
  function onBlockTransform( name ) {
87
87
  const newBlocks = switchToBlockType( blocks, name );
88
88
  replaceBlocks( clientIds, newBlocks );
@@ -72,7 +72,7 @@ export const getPatternTransformedBlocks = (
72
72
  // No need to loop through other pattern's blocks.
73
73
  break;
74
74
  }
75
- // Bail eary if a selected block has not been matched.
75
+ // Bail early if a selected block has not been matched.
76
76
  if ( ! isMatch ) {
77
77
  return;
78
78
  }
@@ -14,7 +14,7 @@ import UngroupButton from '../ungroup-button';
14
14
  import { BlockSettingsButton } from '../block-settings';
15
15
  import { store as blockEditorStore } from '../../store';
16
16
 
17
- const REMOVE_EMPY_PARENT_BLOCKS = [
17
+ const REMOVE_EMPTY_PARENT_BLOCKS = [
18
18
  'core/buttons',
19
19
  'core/columns',
20
20
  'core/social-links',
@@ -69,7 +69,7 @@ export default function BlockToolbar( { anchorNodeRef } ) {
69
69
  // have inner blocks, ideally we should match the behavior as in
70
70
  // the Web editor and show a placeholder instead of removing the parent.
71
71
  if (
72
- REMOVE_EMPY_PARENT_BLOCKS.includes( parentBlockName ) &&
72
+ REMOVE_EMPTY_PARENT_BLOCKS.includes( parentBlockName ) &&
73
73
  parentNumberOfInnerBlocks === 1
74
74
  ) {
75
75
  removeBlock( rootClientId );
@@ -217,7 +217,7 @@ exports[`ColorPaletteControl matches the snapshot 1`] = `
217
217
  class="components-circular-option-picker__option-wrapper"
218
218
  >
219
219
  <button
220
- aria-label="Color: red"
220
+ aria-label="red"
221
221
  aria-selected="true"
222
222
  class="components-button components-circular-option-picker__option is-next-40px-default-size"
223
223
  data-active-item="true"
@@ -111,6 +111,7 @@ $swatch-gap: 12px;
111
111
  white-space: nowrap;
112
112
  overflow: hidden;
113
113
  text-overflow: ellipsis;
114
+ max-width: calc(100% - ($button-size-next-default-40px + $grid-unit-05));
114
115
  }
115
116
  }
116
117
 
@@ -51,7 +51,7 @@ describe( 'ColorPaletteControl', () => {
51
51
  ).toBeInTheDocument();
52
52
 
53
53
  // Is showing the two predefined Colors.
54
- expect( screen.getAllByLabelText( /^Color:/ ) ).toHaveLength( 2 );
54
+ expect( screen.getAllByRole( 'option' ) ).toHaveLength( 2 );
55
55
  } );
56
56
 
57
57
  it( 'renders the color picker and does not render tabs if it is only possible to select a color', async () => {
@@ -80,7 +80,7 @@ describe( 'ColorPaletteControl', () => {
80
80
  ).not.toBeInTheDocument();
81
81
 
82
82
  // Is showing the two predefined Colors.
83
- expect( screen.getAllByLabelText( /^Color:/ ) ).toHaveLength( 2 );
83
+ expect( screen.getAllByRole( 'option' ) ).toHaveLength( 2 );
84
84
  } );
85
85
 
86
86
  it( 'renders the gradient picker and does not render tabs if it is only possible to select a gradient', async () => {
@@ -14,7 +14,7 @@ import {
14
14
  } from '@wordpress/components';
15
15
 
16
16
  // So that we illustrate the different formats in the dropdown properly, show a date that is
17
- // somwhat recent, has a day greater than 12, and a month with more than three letters.
17
+ // somewhat recent, has a day greater than 12, and a month with more than three letters.
18
18
  const exampleDate = new Date();
19
19
  exampleDate.setDate( 20 );
20
20
  exampleDate.setMonth( exampleDate.getMonth() - 3 );
@@ -4,11 +4,11 @@ $swatch-size: 28px;
4
4
  $swatch-gap: 12px;
5
5
 
6
6
  $popover-width: 260px;
7
- $popover-padding: $grid-unit-20;
7
+ $popover-padding: $grid-unit-10;
8
8
 
9
9
  $swatch-columns: math.floor(math.div($popover-width + $swatch-gap - 2 * $popover-padding, $swatch-size + $swatch-gap));
10
10
 
11
- .block-editor-duotone-control__popover {
11
+ .block-editor-duotone-control__popover.components-popover {
12
12
  > .components-popover__content {
13
13
  padding: $popover-padding;
14
14
  width: $popover-width;
@@ -144,10 +144,12 @@ export default function FiltersPanel( {
144
144
  const duotonePreset = duotonePalette.find( ( { colors } ) => {
145
145
  return colors === newValue;
146
146
  } );
147
- const settedValue = duotonePreset
147
+ const duotoneValue = duotonePreset
148
148
  ? `var:preset|duotone|${ duotonePreset.slug }`
149
149
  : newValue;
150
- onChange( setImmutably( value, [ 'filter', 'duotone' ], settedValue ) );
150
+ onChange(
151
+ setImmutably( value, [ 'filter', 'duotone' ], duotoneValue )
152
+ );
151
153
  };
152
154
  const hasDuotone = () => !! value?.filter?.duotone;
153
155
  const resetDuotone = () => setDuotone( undefined );
@@ -61,14 +61,14 @@ export default function ImageSettingsPanel( {
61
61
  // "RESET" button ONLY when the user has explicitly set a value in the
62
62
  // Global Styles.
63
63
  hasValue={ () => !! value?.lightbox }
64
- label={ __( 'Expand on click' ) }
64
+ label={ __( 'Enlarge on click' ) }
65
65
  onDeselect={ resetLightbox }
66
66
  isShownByDefault
67
67
  panelId={ panelId }
68
68
  >
69
69
  <ToggleControl
70
70
  __nextHasNoMarginBottom
71
- label={ __( 'Expand on click' ) }
71
+ label={ __( 'Enlarge on click' ) }
72
72
  checked={ lightboxChecked }
73
73
  onChange={ onChangeLightbox }
74
74
  />
@@ -585,7 +585,7 @@ describe( 'typography utils', () => {
585
585
  'clamp(14px, 0.875rem + ((1vw - 3.2px) * 0.078), 15px)',
586
586
  },
587
587
 
588
- // Equivalent custom config PHP unit tests in `test_should_covert_font_sizes_to_fluid_values()`.
588
+ // Equivalent custom config PHP unit tests in `test_should_convert_font_sizes_to_fluid_values()`.
589
589
  {
590
590
  message: 'should return clamp value using custom fluid config',
591
591
  preset: {
@@ -1337,12 +1337,12 @@ export function processCSSNesting( css, blockSelector ) {
1337
1337
  processedCSS += `:root :where(${ blockSelector }){${ part.trim() }}`;
1338
1338
  } else {
1339
1339
  // If the part contains braces, it's a nested CSS rule.
1340
- const splittedPart = part.replace( '}', '' ).split( '{' );
1341
- if ( splittedPart.length !== 2 ) {
1340
+ const splitPart = part.replace( '}', '' ).split( '{' );
1341
+ if ( splitPart.length !== 2 ) {
1342
1342
  return;
1343
1343
  }
1344
1344
 
1345
- const [ nestedSelector, cssValue ] = splittedPart;
1345
+ const [ nestedSelector, cssValue ] = splitPart;
1346
1346
 
1347
1347
  // Handle pseudo elements such as ::before, ::after, etc. Regex will also
1348
1348
  // capture any leading combinator such as >, +, or ~, as well as spaces.
@@ -2,7 +2,7 @@ let compatibilityStyles = null;
2
2
 
3
3
  /**
4
4
  * Returns a list of stylesheets that target the editor canvas. A stylesheet is
5
- * considered targetting the editor a canvas if it contains the
5
+ * considered targeting the editor a canvas if it contains the
6
6
  * `editor-styles-wrapper`, `wp-block`, or `wp-block-*` class selectors.
7
7
  *
8
8
  * Ideally, this hook should be removed in the future and styles should be added
@@ -330,7 +330,7 @@ function Iframe( {
330
330
  >
331
331
  { iframeDocument &&
332
332
  createPortal(
333
- // We want to prevent React events from bubbling throught the iframe
333
+ // We want to prevent React events from bubbling through the iframe
334
334
  // we bubble these manually.
335
335
  /* eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions */
336
336
  <body
@@ -8,7 +8,7 @@ import {
8
8
  __experimentalToggleGroupControl as ToggleGroupControl,
9
9
  __experimentalToggleGroupControlOption as ToggleGroupControlOption,
10
10
  } from '@wordpress/components';
11
- import { __ } from '@wordpress/i18n';
11
+ import { __, sprintf } from '@wordpress/i18n';
12
12
 
13
13
  /**
14
14
  * Internal dependencies
@@ -137,7 +137,11 @@ export default function ImageSizeControl( {
137
137
  <ToggleGroupControlOption
138
138
  key={ scale }
139
139
  value={ scale }
140
- label={ `${ scale }%` }
140
+ label={ sprintf(
141
+ /* translators: Percentage value. */
142
+ __( '%d%%' ),
143
+ scale
144
+ ) }
141
145
  />
142
146
  );
143
147
  } ) }
@@ -125,7 +125,7 @@ Template locking of `InnerBlocks` is similar to [Custom Post Type templates lock
125
125
  Template locking allows locking the `InnerBlocks` area for the current template.
126
126
  _Options:_
127
127
 
128
- - `contentOnly` — prevents all operations. Additionally, the block types that don't have content are hidden from the list view and can't gain focus within the block list. Unlike the other lock types, this is not overrideable by children.
128
+ - `contentOnly` — prevents all operations. Additionally, the block types that don't have content are hidden from the list view and can't gain focus within the block list. Unlike the other lock types, this is not overridable by children.
129
129
  - `'all'` — prevents all operations. It is not possible to insert new blocks. Move existing blocks or delete them.
130
130
  - `'insert'` — prevents inserting or removing blocks, but allows moving existing ones.
131
131
  - `false` — prevents locking from being applied to an `InnerBlocks` area even if a parent block contains locking. ( Boolean )
@@ -57,7 +57,7 @@ export function PatternsFilter( {
57
57
  } ) {
58
58
  // If the category is `myPatterns` then we need to set the source filter to `user`, but
59
59
  // we do this by deriving from props rather than calling setPatternSourceFilter otherwise
60
- // the user may be confused when switching to another category if the haven't explicity set
60
+ // the user may be confused when switching to another category if the haven't explicitly set
61
61
  // this filter themselves.
62
62
  const currentPatternSourceFilter =
63
63
  category?.name === myPatternsCategory.name
@@ -29,7 +29,7 @@ function ReusableBlocksTab( { onSelect, rootClientId, listProps } ) {
29
29
  return filterInserterItems( inserterItems, { onlyReusable: true } );
30
30
  }, [ inserterItems ] );
31
31
 
32
- const sections = [ createInserterSection( { key: 'reuseable', items } ) ];
32
+ const sections = [ createInserterSection( { key: 'reusable', items } ) ];
33
33
 
34
34
  return (
35
35
  <BlockTypesList
@@ -14,7 +14,7 @@ export default function LineHeightControl( { value: lineHeight, onChange } ) {
14
14
  return (
15
15
  <UnitControl
16
16
  label={ __( 'Line Height' ) }
17
- // Set minimun value of 1 since lower values break on Android
17
+ // Set minimum value of 1 since lower values break on Android
18
18
  min={ 1 }
19
19
  max={ 5 }
20
20
  step={ STEP }
@@ -50,7 +50,7 @@ Consumers who which to take advantage of this functionality should ensure that t
50
50
  When creating links the `LinkControl` component will handle two kinds of input from users:
51
51
 
52
52
  1. Entity searches - the user may input free-text based search queries for entities retrieved from remote data sources (in the context of WordPress these are post-type entities). For example, a user might search for a `Page` they have just created by name (eg: About) and the UI will return a matching result if found.
53
- 2. Direct entry - the user may also enter any arbitrary URL-like text. This includes full URLs (https://), URL fragements (eg: `#myinternallink`), `tel` protocol links (eg: `tel: 0800 1234`) and `mailto` protocol links (eg: `mailto: hello@wordpress.org`).
53
+ 2. Direct entry - the user may also enter any arbitrary URL-like text. This includes full URLs (https://), URL fragments (eg: `#myinternallink`), `tel` protocol links (eg: `tel: 0800 1234`) and `mailto` protocol links (eg: `mailto: hello@wordpress.org`).
54
54
 
55
55
  In addition, `<LinkControl>` also allows for on the fly creation of links based on the **current content of the `<input>` element**. When enabled, a default "Create new" search suggestion is appended to all non-URL-like search results.
56
56
 
@@ -79,7 +79,7 @@ The resulting default properties of `value` include:
79
79
  - `title` (`string`, optional): Link title.
80
80
  - `opensInNewTab` (`boolean`, optional): Whether link should open in a new browser tab. This value is only assigned when not providing a custom `settings` prop.
81
81
 
82
- Note: `<LinkControl>` maintains an internal state tracking temporary user edits to the link `value` prior to submission. To avoid unwanted synchronization of this internal value, it is advised that the `value` prop is stablized (likely via memozation) before it is passed to the component. This will avoid unwanted loss of any changes users have may made whilst interacting with the control.
82
+ Note: `<LinkControl>` maintains an internal state tracking temporary user edits to the link `value` prior to submission. To avoid unwanted synchronization of this internal value, it is advised that the `value` prop is stabilized (likely via memozation) before it is passed to the component. This will avoid unwanted loss of any changes users have may made whilst interacting with the control.
83
83
 
84
84
  ```jsx
85
85
  const memoizedValue = useMemo(
@@ -265,7 +265,7 @@ function LinkControl( {
265
265
 
266
266
  const handleSelectSuggestion = ( updatedValue ) => {
267
267
  // Suggestions may contains "settings" values (e.g. `opensInNewTab`)
268
- // which should not overide any existing settings values set by the
268
+ // which should not override any existing settings values set by the
269
269
  // user. This filters out any settings values from the suggestion.
270
270
  const nonSettingsChanges = Object.keys( updatedValue ).reduce(
271
271
  ( acc, key ) => {
@@ -31,7 +31,7 @@ const mockFetchSearchSuggestions = jest.fn();
31
31
  /**
32
32
  * The call to the real method `fetchRichUrlData` is wrapped in a promise in order to make it cancellable.
33
33
  * Therefore if we pass any value as the mock of `fetchRichUrlData` then ALL of the tests will require
34
- * addition code to handle the async nature of `fetchRichUrlData`. This is unecessary. Instead we default
34
+ * addition code to handle the async nature of `fetchRichUrlData`. This is unnecessary. Instead we default
35
35
  * to an undefined value which will ensure that the code under test does not call `fetchRichUrlData`. Only
36
36
  * when we are testing the "rich previews" to we update this value with a true mock.
37
37
  */
@@ -354,7 +354,7 @@ describe( 'Basic rendering', () => {
354
354
 
355
355
  it( 'should display human friendly error message if value URL prop is empty when component is forced into no-editing (preview) mode', async () => {
356
356
  // Why do we need this test?
357
- // Occasionally `forceIsEditingLink` is set explictly to `false` which causes the Link UI to render
357
+ // Occasionally `forceIsEditingLink` is set explicitly to `false` which causes the Link UI to render
358
358
  // it's preview even if the `value` has no URL.
359
359
  // for an example of this see the usage in the following file whereby forceIsEditingLink is used to start/stop editing mode:
360
360
  // https://github.com/WordPress/gutenberg/blob/fa5728771df7cdc86369f7157d6aa763649937a7/packages/format-library/src/link/inline.js#L151.
@@ -2422,7 +2422,7 @@ describe( 'Controlling link title text', () => {
2422
2422
 
2423
2423
  it.each( [
2424
2424
  [ '', 'Testing' ],
2425
- [ '(with leading and traling whitespace)', ' Testing ' ],
2425
+ [ '(with leading and trailing whitespace)', ' Testing ' ],
2426
2426
  [
2427
2427
  // Note: link control should always preserve the original value.
2428
2428
  // The consumer is responsible for filtering or otherwise handling the value.
@@ -94,7 +94,7 @@ const handleEntitySearch = async (
94
94
  return isURLLike( val ) || ! withCreateSuggestion
95
95
  ? results
96
96
  : results.concat( {
97
- // the `id` prop is intentionally ommitted here because it
97
+ // the `id` prop is intentionally omitted here because it
98
98
  // is never exposed as part of the component's public API.
99
99
  // see: https://github.com/WordPress/gutenberg/pull/19775#discussion_r378931316.
100
100
  title: val, // Must match the existing `<input>`s text value.
@@ -15,7 +15,7 @@ In addition to presenting the structure of the blocks in the editor, the ListVie
15
15
 
16
16
  ### Usage
17
17
 
18
- Renders a list view with default syles.
18
+ Renders a list view with default styles.
19
19
 
20
20
  ```jsx
21
21
  import { ListView } from '@wordpress/block-editor';