@wordpress/edit-widgets 5.32.0 → 5.34.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 (120) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/build/blocks/widget-area/edit/index.js.map +1 -1
  3. package/build/blocks/widget-area/edit/inner-blocks.js.map +1 -1
  4. package/build/blocks/widget-area/edit/use-is-dragging-within.js.map +1 -1
  5. package/build/blocks/widget-area/index.js +1 -0
  6. package/build/blocks/widget-area/index.js.map +1 -1
  7. package/build/components/error-boundary/index.js.map +1 -1
  8. package/build/components/header/document-tools/index.js +0 -9
  9. package/build/components/header/document-tools/index.js.map +1 -1
  10. package/build/components/header/index.js.map +1 -1
  11. package/build/components/header/undo-redo/redo.js.map +1 -1
  12. package/build/components/header/undo-redo/undo.js.map +1 -1
  13. package/build/components/keyboard-shortcut-help-modal/config.js +4 -0
  14. package/build/components/keyboard-shortcut-help-modal/config.js.map +1 -1
  15. package/build/components/keyboard-shortcut-help-modal/dynamic-shortcut.js.map +1 -1
  16. package/build/components/keyboard-shortcut-help-modal/index.js.map +1 -1
  17. package/build/components/keyboard-shortcut-help-modal/shortcut.js.map +1 -1
  18. package/build/components/keyboard-shortcuts/index.js +0 -59
  19. package/build/components/keyboard-shortcuts/index.js.map +1 -1
  20. package/build/components/layout/index.js.map +1 -1
  21. package/build/components/layout/interface.js +1 -1
  22. package/build/components/layout/interface.js.map +1 -1
  23. package/build/components/layout/unsaved-changes-warning.js.map +1 -1
  24. package/build/components/more-menu/index.js.map +1 -1
  25. package/build/components/more-menu/tools-more-menu-group.js.map +1 -1
  26. package/build/components/notices/index.js.map +1 -1
  27. package/build/components/save-button/index.js.map +1 -1
  28. package/build/components/secondary-sidebar/index.js.map +1 -1
  29. package/build/components/secondary-sidebar/inserter-sidebar.js +1 -4
  30. package/build/components/secondary-sidebar/inserter-sidebar.js.map +1 -1
  31. package/build/components/secondary-sidebar/list-view-sidebar.js.map +1 -1
  32. package/build/components/sidebar/index.js.map +1 -1
  33. package/build/components/sidebar/widget-areas.js.map +1 -1
  34. package/build/components/welcome-guide/index.js.map +1 -1
  35. package/build/components/widget-areas-block-editor-content/index.js.map +1 -1
  36. package/build/components/widget-areas-block-editor-provider/index.js +5 -1
  37. package/build/components/widget-areas-block-editor-provider/index.js.map +1 -1
  38. package/build/constants.js.map +1 -1
  39. package/build/filters/index.js.map +1 -1
  40. package/build/filters/move-to-widget-area.js.map +1 -1
  41. package/build/filters/replace-media-upload.js.map +1 -1
  42. package/build/hooks/use-last-selected-widget-area.js.map +1 -1
  43. package/build/hooks/use-widget-library-insertion-point.js.map +1 -1
  44. package/build/index.js +1 -1
  45. package/build/index.js.map +1 -1
  46. package/build/lock-unlock.js.map +1 -1
  47. package/build/store/actions.js.map +1 -1
  48. package/build/store/constants.js.map +1 -1
  49. package/build/store/index.js +1 -1
  50. package/build/store/index.js.map +1 -1
  51. package/build/store/private-selectors.js.map +1 -1
  52. package/build/store/reducer.js.map +1 -1
  53. package/build/store/resolvers.js.map +1 -1
  54. package/build/store/selectors.js.map +1 -1
  55. package/build/store/transformers.js.map +1 -1
  56. package/build/store/utils.js.map +1 -1
  57. package/build-module/blocks/widget-area/edit/index.js.map +1 -1
  58. package/build-module/blocks/widget-area/edit/inner-blocks.js.map +1 -1
  59. package/build-module/blocks/widget-area/edit/use-is-dragging-within.js.map +1 -1
  60. package/build-module/blocks/widget-area/index.js +1 -0
  61. package/build-module/blocks/widget-area/index.js.map +1 -1
  62. package/build-module/components/error-boundary/index.js.map +1 -1
  63. package/build-module/components/header/document-tools/index.js +1 -10
  64. package/build-module/components/header/document-tools/index.js.map +1 -1
  65. package/build-module/components/header/index.js.map +1 -1
  66. package/build-module/components/header/undo-redo/redo.js.map +1 -1
  67. package/build-module/components/header/undo-redo/undo.js.map +1 -1
  68. package/build-module/components/keyboard-shortcut-help-modal/config.js +4 -0
  69. package/build-module/components/keyboard-shortcut-help-modal/config.js.map +1 -1
  70. package/build-module/components/keyboard-shortcut-help-modal/dynamic-shortcut.js.map +1 -1
  71. package/build-module/components/keyboard-shortcut-help-modal/index.js.map +1 -1
  72. package/build-module/components/keyboard-shortcut-help-modal/shortcut.js.map +1 -1
  73. package/build-module/components/keyboard-shortcuts/index.js +1 -60
  74. package/build-module/components/keyboard-shortcuts/index.js.map +1 -1
  75. package/build-module/components/layout/index.js.map +1 -1
  76. package/build-module/components/layout/interface.js +1 -1
  77. package/build-module/components/layout/interface.js.map +1 -1
  78. package/build-module/components/layout/unsaved-changes-warning.js.map +1 -1
  79. package/build-module/components/more-menu/index.js.map +1 -1
  80. package/build-module/components/more-menu/tools-more-menu-group.js.map +1 -1
  81. package/build-module/components/notices/index.js.map +1 -1
  82. package/build-module/components/save-button/index.js.map +1 -1
  83. package/build-module/components/secondary-sidebar/index.js.map +1 -1
  84. package/build-module/components/secondary-sidebar/inserter-sidebar.js +2 -5
  85. package/build-module/components/secondary-sidebar/inserter-sidebar.js.map +1 -1
  86. package/build-module/components/secondary-sidebar/list-view-sidebar.js.map +1 -1
  87. package/build-module/components/sidebar/index.js.map +1 -1
  88. package/build-module/components/sidebar/widget-areas.js.map +1 -1
  89. package/build-module/components/welcome-guide/index.js.map +1 -1
  90. package/build-module/components/widget-areas-block-editor-content/index.js.map +1 -1
  91. package/build-module/components/widget-areas-block-editor-provider/index.js +5 -1
  92. package/build-module/components/widget-areas-block-editor-provider/index.js.map +1 -1
  93. package/build-module/constants.js.map +1 -1
  94. package/build-module/filters/index.js.map +1 -1
  95. package/build-module/filters/move-to-widget-area.js.map +1 -1
  96. package/build-module/filters/replace-media-upload.js.map +1 -1
  97. package/build-module/hooks/use-last-selected-widget-area.js.map +1 -1
  98. package/build-module/hooks/use-widget-library-insertion-point.js.map +1 -1
  99. package/build-module/index.js.map +1 -1
  100. package/build-module/lock-unlock.js.map +1 -1
  101. package/build-module/store/actions.js.map +1 -1
  102. package/build-module/store/constants.js.map +1 -1
  103. package/build-module/store/index.js.map +1 -1
  104. package/build-module/store/private-selectors.js.map +1 -1
  105. package/build-module/store/reducer.js.map +1 -1
  106. package/build-module/store/resolvers.js.map +1 -1
  107. package/build-module/store/selectors.js.map +1 -1
  108. package/build-module/store/transformers.js.map +1 -1
  109. package/build-module/store/utils.js.map +1 -1
  110. package/build-style/style-rtl.css +17 -5
  111. package/build-style/style.css +17 -5
  112. package/package.json +29 -30
  113. package/src/blocks/widget-area/block.json +1 -0
  114. package/src/components/header/document-tools/index.js +0 -7
  115. package/src/components/keyboard-shortcut-help-modal/config.js +10 -1
  116. package/src/components/keyboard-shortcuts/index.js +1 -72
  117. package/src/components/layout/interface.js +1 -5
  118. package/src/components/layout/style.scss +4 -0
  119. package/src/components/secondary-sidebar/inserter-sidebar.js +2 -5
  120. package/src/components/widget-areas-block-editor-provider/index.js +4 -0
@@ -37,7 +37,16 @@ export const textFormattingShortcuts = [
37
37
  description: __( 'Make the selected text inline code.' ),
38
38
  },
39
39
  {
40
- keyCombination: { modifier: 'access', character: '0' },
40
+ keyCombination: {
41
+ modifier: 'access',
42
+ character: '0',
43
+ },
44
+ aliases: [
45
+ {
46
+ modifier: 'access',
47
+ character: '7',
48
+ },
49
+ ],
41
50
  description: __( 'Convert the current heading to a paragraph.' ),
42
51
  },
43
52
  {
@@ -7,11 +7,9 @@ import {
7
7
  store as keyboardShortcutsStore,
8
8
  } from '@wordpress/keyboard-shortcuts';
9
9
  import { isAppleOS } from '@wordpress/keycodes';
10
- import { useDispatch, useSelect } from '@wordpress/data';
10
+ import { useDispatch } from '@wordpress/data';
11
11
  import { __ } from '@wordpress/i18n';
12
12
  import { store as coreStore } from '@wordpress/core-data';
13
- import { store as blockEditorStore } from '@wordpress/block-editor';
14
- import { createBlock } from '@wordpress/blocks';
15
13
 
16
14
  /**
17
15
  * Internal dependencies
@@ -22,38 +20,6 @@ function KeyboardShortcuts() {
22
20
  const { redo, undo } = useDispatch( coreStore );
23
21
  const { saveEditedWidgetAreas } = useDispatch( editWidgetsStore );
24
22
 
25
- const { replaceBlocks } = useDispatch( blockEditorStore );
26
- const { getBlockName, getSelectedBlockClientId, getBlockAttributes } =
27
- useSelect( blockEditorStore );
28
-
29
- const handleTextLevelShortcut = ( event, level ) => {
30
- event.preventDefault();
31
- const destinationBlockName =
32
- level === 0 ? 'core/paragraph' : 'core/heading';
33
- const currentClientId = getSelectedBlockClientId();
34
- if ( currentClientId === null ) {
35
- return;
36
- }
37
- const blockName = getBlockName( currentClientId );
38
- if ( blockName !== 'core/paragraph' && blockName !== 'core/heading' ) {
39
- return;
40
- }
41
- const attributes = getBlockAttributes( currentClientId );
42
- const textAlign =
43
- blockName === 'core/paragraph' ? 'align' : 'textAlign';
44
- const destinationTextAlign =
45
- destinationBlockName === 'core/paragraph' ? 'align' : 'textAlign';
46
-
47
- replaceBlocks(
48
- currentClientId,
49
- createBlock( destinationBlockName, {
50
- level,
51
- content: attributes.content,
52
- ...{ [ destinationTextAlign ]: attributes[ textAlign ] },
53
- } )
54
- );
55
- };
56
-
57
23
  useShortcut( 'core/edit-widgets/undo', ( event ) => {
58
24
  undo();
59
25
  event.preventDefault();
@@ -69,21 +35,6 @@ function KeyboardShortcuts() {
69
35
  saveEditedWidgetAreas();
70
36
  } );
71
37
 
72
- useShortcut(
73
- 'core/edit-widgets/transform-heading-to-paragraph',
74
- ( event ) => handleTextLevelShortcut( event, 0 )
75
- );
76
-
77
- [ 1, 2, 3, 4, 5, 6 ].forEach( ( level ) => {
78
- //the loop is based off on a constant therefore
79
- //the hook will execute the same way every time
80
- //eslint-disable-next-line react-hooks/rules-of-hooks
81
- useShortcut(
82
- `core/edit-widgets/transform-paragraph-to-heading-${ level }`,
83
- ( event ) => handleTextLevelShortcut( event, level )
84
- );
85
- } );
86
-
87
38
  return null;
88
39
  }
89
40
 
@@ -178,28 +129,6 @@ function KeyboardShortcutsRegister() {
178
129
  },
179
130
  ],
180
131
  } );
181
-
182
- registerShortcut( {
183
- name: 'core/edit-widgets/transform-heading-to-paragraph',
184
- category: 'block-library',
185
- description: __( 'Transform heading to paragraph.' ),
186
- keyCombination: {
187
- modifier: 'access',
188
- character: `0`,
189
- },
190
- } );
191
-
192
- [ 1, 2, 3, 4, 5, 6 ].forEach( ( level ) => {
193
- registerShortcut( {
194
- name: `core/edit-widgets/transform-paragraph-to-heading-${ level }`,
195
- category: 'block-library',
196
- description: __( 'Transform paragraph to heading.' ),
197
- keyCombination: {
198
- modifier: 'access',
199
- character: `${ level }`,
200
- },
201
- } );
202
- } );
203
132
  }, [ registerShortcut ] );
204
133
 
205
134
  return null;
@@ -96,11 +96,7 @@ function Interface( { blockEditorSettings } ) {
96
96
  } }
97
97
  header={ <Header /> }
98
98
  secondarySidebar={ hasSecondarySidebar && <SecondarySidebar /> }
99
- sidebar={
100
- hasSidebarEnabled && (
101
- <ComplementaryArea.Slot scope="core/edit-widgets" />
102
- )
103
- }
99
+ sidebar={ <ComplementaryArea.Slot scope="core/edit-widgets" /> }
104
100
  content={
105
101
  <>
106
102
  <WidgetAreasBlockEditorContent
@@ -18,6 +18,10 @@
18
18
  // Leave space for the close button
19
19
  height: calc(100% - #{$button-size} - #{$grid-unit-10});
20
20
 
21
+ .block-editor-inserter__tab {
22
+ display: none;
23
+ }
24
+
21
25
  @include break-medium() {
22
26
  height: 100%;
23
27
  }
@@ -8,7 +8,7 @@ import {
8
8
  useViewportMatch,
9
9
  __experimentalUseDialog as useDialog,
10
10
  } from '@wordpress/compose';
11
- import { useCallback, useEffect, useRef } from '@wordpress/element';
11
+ import { useCallback, useRef } from '@wordpress/element';
12
12
  import { useDispatch } from '@wordpress/data';
13
13
  import { __ } from '@wordpress/i18n';
14
14
 
@@ -31,13 +31,10 @@ export default function InserterSidebar() {
31
31
  const TagName = ! isMobileViewport ? VisuallyHidden : 'div';
32
32
  const [ inserterDialogRef, inserterDialogProps ] = useDialog( {
33
33
  onClose: closeInserter,
34
- focusOnMount: null,
34
+ focusOnMount: true,
35
35
  } );
36
36
 
37
37
  const libraryRef = useRef();
38
- useEffect( () => {
39
- libraryRef.current.focusSearch();
40
- }, [] );
41
38
 
42
39
  return (
43
40
  <div
@@ -14,6 +14,7 @@ import { useMemo } from '@wordpress/element';
14
14
  import { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';
15
15
  import { privateApis as editPatternsPrivateApis } from '@wordpress/patterns';
16
16
  import { store as preferencesStore } from '@wordpress/preferences';
17
+ import { privateApis as blockLibraryPrivateApis } from '@wordpress/block-library';
17
18
 
18
19
  /**
19
20
  * Internal dependencies
@@ -27,6 +28,8 @@ import { unlock } from '../../lock-unlock';
27
28
 
28
29
  const { ExperimentalBlockEditorProvider } = unlock( blockEditorPrivateApis );
29
30
  const { PatternsMenuItems } = unlock( editPatternsPrivateApis );
31
+ const { BlockKeyboardShortcuts } = unlock( blockLibraryPrivateApis );
32
+
30
33
  export default function WidgetAreasBlockEditorProvider( {
31
34
  blockEditorSettings,
32
35
  children,
@@ -111,6 +114,7 @@ export default function WidgetAreasBlockEditorProvider( {
111
114
  return (
112
115
  <SlotFillProvider>
113
116
  <KeyboardShortcuts.Register />
117
+ <BlockKeyboardShortcuts />
114
118
  <ExperimentalBlockEditorProvider
115
119
  value={ blocks }
116
120
  onInput={ onInput }