@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.
- package/CHANGELOG.md +4 -0
- package/build/blocks/widget-area/edit/index.js.map +1 -1
- package/build/blocks/widget-area/edit/inner-blocks.js.map +1 -1
- package/build/blocks/widget-area/edit/use-is-dragging-within.js.map +1 -1
- package/build/blocks/widget-area/index.js +1 -0
- package/build/blocks/widget-area/index.js.map +1 -1
- package/build/components/error-boundary/index.js.map +1 -1
- package/build/components/header/document-tools/index.js +0 -9
- package/build/components/header/document-tools/index.js.map +1 -1
- package/build/components/header/index.js.map +1 -1
- package/build/components/header/undo-redo/redo.js.map +1 -1
- package/build/components/header/undo-redo/undo.js.map +1 -1
- package/build/components/keyboard-shortcut-help-modal/config.js +4 -0
- package/build/components/keyboard-shortcut-help-modal/config.js.map +1 -1
- package/build/components/keyboard-shortcut-help-modal/dynamic-shortcut.js.map +1 -1
- package/build/components/keyboard-shortcut-help-modal/index.js.map +1 -1
- package/build/components/keyboard-shortcut-help-modal/shortcut.js.map +1 -1
- package/build/components/keyboard-shortcuts/index.js +0 -59
- package/build/components/keyboard-shortcuts/index.js.map +1 -1
- package/build/components/layout/index.js.map +1 -1
- package/build/components/layout/interface.js +1 -1
- package/build/components/layout/interface.js.map +1 -1
- package/build/components/layout/unsaved-changes-warning.js.map +1 -1
- package/build/components/more-menu/index.js.map +1 -1
- package/build/components/more-menu/tools-more-menu-group.js.map +1 -1
- package/build/components/notices/index.js.map +1 -1
- package/build/components/save-button/index.js.map +1 -1
- package/build/components/secondary-sidebar/index.js.map +1 -1
- package/build/components/secondary-sidebar/inserter-sidebar.js +1 -4
- package/build/components/secondary-sidebar/inserter-sidebar.js.map +1 -1
- package/build/components/secondary-sidebar/list-view-sidebar.js.map +1 -1
- package/build/components/sidebar/index.js.map +1 -1
- package/build/components/sidebar/widget-areas.js.map +1 -1
- package/build/components/welcome-guide/index.js.map +1 -1
- package/build/components/widget-areas-block-editor-content/index.js.map +1 -1
- package/build/components/widget-areas-block-editor-provider/index.js +5 -1
- package/build/components/widget-areas-block-editor-provider/index.js.map +1 -1
- package/build/constants.js.map +1 -1
- package/build/filters/index.js.map +1 -1
- package/build/filters/move-to-widget-area.js.map +1 -1
- package/build/filters/replace-media-upload.js.map +1 -1
- package/build/hooks/use-last-selected-widget-area.js.map +1 -1
- package/build/hooks/use-widget-library-insertion-point.js.map +1 -1
- package/build/index.js +1 -1
- package/build/index.js.map +1 -1
- package/build/lock-unlock.js.map +1 -1
- package/build/store/actions.js.map +1 -1
- package/build/store/constants.js.map +1 -1
- package/build/store/index.js +1 -1
- package/build/store/index.js.map +1 -1
- package/build/store/private-selectors.js.map +1 -1
- package/build/store/reducer.js.map +1 -1
- package/build/store/resolvers.js.map +1 -1
- package/build/store/selectors.js.map +1 -1
- package/build/store/transformers.js.map +1 -1
- package/build/store/utils.js.map +1 -1
- package/build-module/blocks/widget-area/edit/index.js.map +1 -1
- package/build-module/blocks/widget-area/edit/inner-blocks.js.map +1 -1
- package/build-module/blocks/widget-area/edit/use-is-dragging-within.js.map +1 -1
- package/build-module/blocks/widget-area/index.js +1 -0
- package/build-module/blocks/widget-area/index.js.map +1 -1
- package/build-module/components/error-boundary/index.js.map +1 -1
- package/build-module/components/header/document-tools/index.js +1 -10
- package/build-module/components/header/document-tools/index.js.map +1 -1
- package/build-module/components/header/index.js.map +1 -1
- package/build-module/components/header/undo-redo/redo.js.map +1 -1
- package/build-module/components/header/undo-redo/undo.js.map +1 -1
- package/build-module/components/keyboard-shortcut-help-modal/config.js +4 -0
- package/build-module/components/keyboard-shortcut-help-modal/config.js.map +1 -1
- package/build-module/components/keyboard-shortcut-help-modal/dynamic-shortcut.js.map +1 -1
- package/build-module/components/keyboard-shortcut-help-modal/index.js.map +1 -1
- package/build-module/components/keyboard-shortcut-help-modal/shortcut.js.map +1 -1
- package/build-module/components/keyboard-shortcuts/index.js +1 -60
- package/build-module/components/keyboard-shortcuts/index.js.map +1 -1
- package/build-module/components/layout/index.js.map +1 -1
- package/build-module/components/layout/interface.js +1 -1
- package/build-module/components/layout/interface.js.map +1 -1
- package/build-module/components/layout/unsaved-changes-warning.js.map +1 -1
- package/build-module/components/more-menu/index.js.map +1 -1
- package/build-module/components/more-menu/tools-more-menu-group.js.map +1 -1
- package/build-module/components/notices/index.js.map +1 -1
- package/build-module/components/save-button/index.js.map +1 -1
- package/build-module/components/secondary-sidebar/index.js.map +1 -1
- package/build-module/components/secondary-sidebar/inserter-sidebar.js +2 -5
- package/build-module/components/secondary-sidebar/inserter-sidebar.js.map +1 -1
- package/build-module/components/secondary-sidebar/list-view-sidebar.js.map +1 -1
- package/build-module/components/sidebar/index.js.map +1 -1
- package/build-module/components/sidebar/widget-areas.js.map +1 -1
- package/build-module/components/welcome-guide/index.js.map +1 -1
- package/build-module/components/widget-areas-block-editor-content/index.js.map +1 -1
- package/build-module/components/widget-areas-block-editor-provider/index.js +5 -1
- package/build-module/components/widget-areas-block-editor-provider/index.js.map +1 -1
- package/build-module/constants.js.map +1 -1
- package/build-module/filters/index.js.map +1 -1
- package/build-module/filters/move-to-widget-area.js.map +1 -1
- package/build-module/filters/replace-media-upload.js.map +1 -1
- package/build-module/hooks/use-last-selected-widget-area.js.map +1 -1
- package/build-module/hooks/use-widget-library-insertion-point.js.map +1 -1
- package/build-module/index.js.map +1 -1
- package/build-module/lock-unlock.js.map +1 -1
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/constants.js.map +1 -1
- package/build-module/store/index.js.map +1 -1
- package/build-module/store/private-selectors.js.map +1 -1
- package/build-module/store/reducer.js.map +1 -1
- package/build-module/store/resolvers.js.map +1 -1
- package/build-module/store/selectors.js.map +1 -1
- package/build-module/store/transformers.js.map +1 -1
- package/build-module/store/utils.js.map +1 -1
- package/build-style/style-rtl.css +17 -5
- package/build-style/style.css +17 -5
- package/package.json +29 -30
- package/src/blocks/widget-area/block.json +1 -0
- package/src/components/header/document-tools/index.js +0 -7
- package/src/components/keyboard-shortcut-help-modal/config.js +10 -1
- package/src/components/keyboard-shortcuts/index.js +1 -72
- package/src/components/layout/interface.js +1 -5
- package/src/components/layout/style.scss +4 -0
- package/src/components/secondary-sidebar/inserter-sidebar.js +2 -5
- 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: {
|
|
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
|
|
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
|
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
useViewportMatch,
|
|
9
9
|
__experimentalUseDialog as useDialog,
|
|
10
10
|
} from '@wordpress/compose';
|
|
11
|
-
import { useCallback,
|
|
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:
|
|
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 }
|