@wordpress/edit-widgets 4.0.2 → 4.1.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 +2 -0
- package/build/components/header/index.js +1 -1
- package/build/components/header/index.js.map +1 -1
- package/build/components/keyboard-shortcuts/index.js +1 -1
- package/build/components/keyboard-shortcuts/index.js.map +1 -1
- package/build/components/layout/interface.js +3 -1
- package/build/components/layout/interface.js.map +1 -1
- package/build/components/more-menu/index.js +12 -10
- package/build/components/more-menu/index.js.map +1 -1
- package/build/components/welcome-guide/index.js +5 -5
- package/build/components/welcome-guide/index.js.map +1 -1
- package/build/components/widget-areas-block-editor-content/index.js +2 -2
- package/build/components/widget-areas-block-editor-content/index.js.map +1 -1
- package/build/components/widget-areas-block-editor-provider/index.js +4 -4
- package/build/components/widget-areas-block-editor-provider/index.js.map +1 -1
- package/build/index.js +2 -2
- package/build/index.js.map +1 -1
- package/build/store/actions.js +1 -1
- package/build/store/actions.js.map +1 -1
- package/build/store/index.js +3 -5
- package/build/store/index.js.map +1 -1
- package/build-module/components/header/index.js +1 -1
- package/build-module/components/header/index.js.map +1 -1
- package/build-module/components/keyboard-shortcuts/index.js +1 -1
- package/build-module/components/keyboard-shortcuts/index.js.map +1 -1
- package/build-module/components/layout/interface.js +2 -1
- package/build-module/components/layout/interface.js.map +1 -1
- package/build-module/components/more-menu/index.js +12 -11
- package/build-module/components/more-menu/index.js.map +1 -1
- package/build-module/components/welcome-guide/index.js +5 -5
- package/build-module/components/welcome-guide/index.js.map +1 -1
- package/build-module/components/widget-areas-block-editor-content/index.js +2 -2
- 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 +3 -3
- package/build-module/components/widget-areas-block-editor-provider/index.js.map +1 -1
- package/build-module/index.js +2 -2
- package/build-module/index.js.map +1 -1
- package/build-module/store/actions.js +1 -1
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/index.js +4 -6
- package/build-module/store/index.js.map +1 -1
- package/build-style/style-rtl.css +90 -34
- package/build-style/style.css +90 -34
- package/package.json +29 -24
- package/src/components/header/index.js +1 -1
- package/src/components/keyboard-shortcuts/index.js +1 -1
- package/src/components/layout/interface.js +5 -3
- package/src/components/more-menu/index.js +12 -11
- package/src/components/welcome-guide/index.js +4 -6
- package/src/components/widget-areas-block-editor-content/index.js +2 -2
- package/src/components/widget-areas-block-editor-provider/index.js +3 -3
- package/src/index.js +2 -2
- package/src/store/actions.js +1 -1
- package/src/store/index.js +3 -6
- package/src/style.scss +0 -1
- package/src/components/more-menu/style.scss +0 -35
|
@@ -51,7 +51,7 @@ function Header() {
|
|
|
51
51
|
const { selectBlock } = useDispatch( blockEditorStore );
|
|
52
52
|
const handleClick = () => {
|
|
53
53
|
if ( isInserterOpen ) {
|
|
54
|
-
// Focusing the inserter button closes the inserter popover
|
|
54
|
+
// Focusing the inserter button closes the inserter popover.
|
|
55
55
|
setIsInserterOpened( false );
|
|
56
56
|
} else {
|
|
57
57
|
if ( ! isLastSelectedWidgetAreaOpen ) {
|
|
@@ -38,7 +38,7 @@ function KeyboardShortcuts() {
|
|
|
38
38
|
}
|
|
39
39
|
|
|
40
40
|
function KeyboardShortcutsRegister() {
|
|
41
|
-
// Registering the shortcuts
|
|
41
|
+
// Registering the shortcuts.
|
|
42
42
|
const { registerShortcut } = useDispatch( keyboardShortcutsStore );
|
|
43
43
|
useEffect( () => {
|
|
44
44
|
registerShortcut( {
|
|
@@ -12,6 +12,7 @@ import {
|
|
|
12
12
|
} from '@wordpress/interface';
|
|
13
13
|
import { __ } from '@wordpress/i18n';
|
|
14
14
|
import { store as keyboardShortcutsStore } from '@wordpress/keyboard-shortcuts';
|
|
15
|
+
import { store as preferencesStore } from '@wordpress/preferences';
|
|
15
16
|
|
|
16
17
|
/**
|
|
17
18
|
* Internal dependencies
|
|
@@ -54,9 +55,10 @@ function Interface( { blockEditorSettings } ) {
|
|
|
54
55
|
).getActiveComplementaryArea( editWidgetsStore.name ),
|
|
55
56
|
isInserterOpened: !! select( editWidgetsStore ).isInserterOpened(),
|
|
56
57
|
isListViewOpened: !! select( editWidgetsStore ).isListViewOpened(),
|
|
57
|
-
hasBlockBreadCrumbsEnabled: select(
|
|
58
|
-
|
|
59
|
-
|
|
58
|
+
hasBlockBreadCrumbsEnabled: !! select( preferencesStore ).get(
|
|
59
|
+
'core/edit-widgets',
|
|
60
|
+
'showBlockBreadcrumbs'
|
|
61
|
+
),
|
|
60
62
|
previousShortcut: select(
|
|
61
63
|
keyboardShortcutsStore
|
|
62
64
|
).getAllShortcutKeyCombinations(
|
|
@@ -5,7 +5,8 @@ import { MenuGroup, MenuItem, VisuallyHidden } from '@wordpress/components';
|
|
|
5
5
|
import { useState } from '@wordpress/element';
|
|
6
6
|
import { __, _x } from '@wordpress/i18n';
|
|
7
7
|
import { external } from '@wordpress/icons';
|
|
8
|
-
import { MoreMenuDropdown
|
|
8
|
+
import { MoreMenuDropdown } from '@wordpress/interface';
|
|
9
|
+
import { PreferenceToggleMenuItem } from '@wordpress/preferences';
|
|
9
10
|
import { displayShortcut } from '@wordpress/keycodes';
|
|
10
11
|
import { useShortcut } from '@wordpress/keyboard-shortcuts';
|
|
11
12
|
import { useViewportMatch } from '@wordpress/compose';
|
|
@@ -38,9 +39,9 @@ export default function MoreMenu() {
|
|
|
38
39
|
<>
|
|
39
40
|
{ isLargeViewport && (
|
|
40
41
|
<MenuGroup label={ _x( 'View', 'noun' ) }>
|
|
41
|
-
<
|
|
42
|
+
<PreferenceToggleMenuItem
|
|
42
43
|
scope="core/edit-widgets"
|
|
43
|
-
|
|
44
|
+
name="fixedToolbar"
|
|
44
45
|
label={ __( 'Top toolbar' ) }
|
|
45
46
|
info={ __(
|
|
46
47
|
'Access all block and document tools in a single place'
|
|
@@ -63,9 +64,9 @@ export default function MoreMenu() {
|
|
|
63
64
|
>
|
|
64
65
|
{ __( 'Keyboard shortcuts' ) }
|
|
65
66
|
</MenuItem>
|
|
66
|
-
<
|
|
67
|
+
<PreferenceToggleMenuItem
|
|
67
68
|
scope="core/edit-widgets"
|
|
68
|
-
|
|
69
|
+
name="welcomeGuide"
|
|
69
70
|
label={ __( 'Welcome Guide' ) }
|
|
70
71
|
/>
|
|
71
72
|
<MenuItem
|
|
@@ -90,9 +91,9 @@ export default function MoreMenu() {
|
|
|
90
91
|
/>
|
|
91
92
|
</MenuGroup>
|
|
92
93
|
<MenuGroup label={ __( 'Preferences' ) }>
|
|
93
|
-
<
|
|
94
|
+
<PreferenceToggleMenuItem
|
|
94
95
|
scope="core/edit-widgets"
|
|
95
|
-
|
|
96
|
+
name="keepCaretInsideBlock"
|
|
96
97
|
label={ __(
|
|
97
98
|
'Contain text cursor inside block'
|
|
98
99
|
) }
|
|
@@ -106,18 +107,18 @@ export default function MoreMenu() {
|
|
|
106
107
|
'Contain text cursor inside block deactivated'
|
|
107
108
|
) }
|
|
108
109
|
/>
|
|
109
|
-
<
|
|
110
|
+
<PreferenceToggleMenuItem
|
|
110
111
|
scope="core/edit-widgets"
|
|
111
|
-
|
|
112
|
+
name="themeStyles"
|
|
112
113
|
info={ __(
|
|
113
114
|
'Make the editor look like your theme.'
|
|
114
115
|
) }
|
|
115
116
|
label={ __( 'Use theme styles' ) }
|
|
116
117
|
/>
|
|
117
118
|
{ isLargeViewport && (
|
|
118
|
-
<
|
|
119
|
+
<PreferenceToggleMenuItem
|
|
119
120
|
scope="core/edit-widgets"
|
|
120
|
-
|
|
121
|
+
name="showBlockBreadcrumbs"
|
|
121
122
|
label={ __( 'Display block breadcrumbs' ) }
|
|
122
123
|
info={ __(
|
|
123
124
|
'Shows block breadcrumbs at the bottom of the editor.'
|
|
@@ -5,7 +5,7 @@ import { useSelect, useDispatch } from '@wordpress/data';
|
|
|
5
5
|
import { ExternalLink, Guide } from '@wordpress/components';
|
|
6
6
|
import { __, sprintf, _n } from '@wordpress/i18n';
|
|
7
7
|
import { createInterpolateElement } from '@wordpress/element';
|
|
8
|
-
import { store as
|
|
8
|
+
import { store as preferencesStore } from '@wordpress/preferences';
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* Internal dependencies
|
|
@@ -15,14 +15,14 @@ import { store as editWidgetsStore } from '../../store';
|
|
|
15
15
|
export default function WelcomeGuide() {
|
|
16
16
|
const isActive = useSelect(
|
|
17
17
|
( select ) =>
|
|
18
|
-
select(
|
|
18
|
+
!! select( preferencesStore ).get(
|
|
19
19
|
'core/edit-widgets',
|
|
20
20
|
'welcomeGuide'
|
|
21
21
|
),
|
|
22
22
|
[]
|
|
23
23
|
);
|
|
24
24
|
|
|
25
|
-
const {
|
|
25
|
+
const { toggle } = useDispatch( preferencesStore );
|
|
26
26
|
|
|
27
27
|
const widgetAreas = useSelect(
|
|
28
28
|
( select ) =>
|
|
@@ -52,9 +52,7 @@ export default function WelcomeGuide() {
|
|
|
52
52
|
className="edit-widgets-welcome-guide"
|
|
53
53
|
contentLabel={ __( 'Welcome to block Widgets' ) }
|
|
54
54
|
finishButtonText={ __( 'Get started' ) }
|
|
55
|
-
onFinish={ () =>
|
|
56
|
-
toggleFeature( 'core/edit-widgets', 'welcomeGuide' )
|
|
57
|
-
}
|
|
55
|
+
onFinish={ () => toggle( 'core/edit-widgets', 'welcomeGuide' ) }
|
|
58
56
|
pages={ [
|
|
59
57
|
{
|
|
60
58
|
image: (
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
} from '@wordpress/block-editor';
|
|
12
12
|
import { useSelect } from '@wordpress/data';
|
|
13
13
|
import { useMemo } from '@wordpress/element';
|
|
14
|
-
import { store as
|
|
14
|
+
import { store as preferencesStore } from '@wordpress/preferences';
|
|
15
15
|
|
|
16
16
|
/**
|
|
17
17
|
* Internal dependencies
|
|
@@ -24,7 +24,7 @@ export default function WidgetAreasBlockEditorContent( {
|
|
|
24
24
|
} ) {
|
|
25
25
|
const hasThemeStyles = useSelect(
|
|
26
26
|
( select ) =>
|
|
27
|
-
select(
|
|
27
|
+
!! select( preferencesStore ).get(
|
|
28
28
|
'core/edit-widgets',
|
|
29
29
|
'themeStyles'
|
|
30
30
|
),
|
|
@@ -16,8 +16,8 @@ import {
|
|
|
16
16
|
CopyHandler,
|
|
17
17
|
} from '@wordpress/block-editor';
|
|
18
18
|
import { ReusableBlocksMenuItems } from '@wordpress/reusable-blocks';
|
|
19
|
-
import { store as interfaceStore } from '@wordpress/interface';
|
|
20
19
|
import { ShortcutProvider } from '@wordpress/keyboard-shortcuts';
|
|
20
|
+
import { store as preferencesStore } from '@wordpress/preferences';
|
|
21
21
|
|
|
22
22
|
/**
|
|
23
23
|
* Internal dependencies
|
|
@@ -50,11 +50,11 @@ export default function WidgetAreasBlockEditorProvider( {
|
|
|
50
50
|
reusableBlocks: ALLOW_REUSABLE_BLOCKS
|
|
51
51
|
? select( coreStore ).getEntityRecords( 'postType', 'wp_block' )
|
|
52
52
|
: [],
|
|
53
|
-
isFixedToolbarActive: select(
|
|
53
|
+
isFixedToolbarActive: !! select( preferencesStore ).get(
|
|
54
54
|
'core/edit-widgets',
|
|
55
55
|
'fixedToolbar'
|
|
56
56
|
),
|
|
57
|
-
keepCaretInsideBlock: select(
|
|
57
|
+
keepCaretInsideBlock: !! select( preferencesStore ).get(
|
|
58
58
|
'core/edit-widgets',
|
|
59
59
|
'keepCaretInsideBlock'
|
|
60
60
|
),
|
package/src/index.js
CHANGED
|
@@ -20,7 +20,7 @@ import {
|
|
|
20
20
|
registerLegacyWidgetVariations,
|
|
21
21
|
registerWidgetGroupBlock,
|
|
22
22
|
} from '@wordpress/widgets';
|
|
23
|
-
import { store as
|
|
23
|
+
import { store as preferencesStore } from '@wordpress/preferences';
|
|
24
24
|
|
|
25
25
|
/**
|
|
26
26
|
* Internal dependencies
|
|
@@ -78,7 +78,7 @@ export function initialize( id, settings ) {
|
|
|
78
78
|
);
|
|
79
79
|
} );
|
|
80
80
|
|
|
81
|
-
dispatch(
|
|
81
|
+
dispatch( preferencesStore ).setDefaults( 'core/edit-widgets', {
|
|
82
82
|
fixedToolbar: false,
|
|
83
83
|
welcomeGuide: true,
|
|
84
84
|
showBlockBreadcrumbs: true,
|
package/src/store/actions.js
CHANGED
|
@@ -95,7 +95,7 @@ export const saveWidgetAreas = ( widgetAreas ) => async ( {
|
|
|
95
95
|
await dispatch.saveWidgetArea( widgetArea.id );
|
|
96
96
|
}
|
|
97
97
|
} finally {
|
|
98
|
-
// saveEditedEntityRecord resets the resolution status, let's fix it manually
|
|
98
|
+
// saveEditedEntityRecord resets the resolution status, let's fix it manually.
|
|
99
99
|
await registry
|
|
100
100
|
.dispatch( coreStore )
|
|
101
101
|
.finishResolution(
|
package/src/store/index.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
4
|
import apiFetch from '@wordpress/api-fetch';
|
|
5
|
-
import { createReduxStore,
|
|
5
|
+
import { createReduxStore, register } from '@wordpress/data';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* Internal dependencies
|
|
@@ -16,7 +16,7 @@ import { STORE_NAME } from './constants';
|
|
|
16
16
|
/**
|
|
17
17
|
* Block editor data store configuration.
|
|
18
18
|
*
|
|
19
|
-
* @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/data/README.md#
|
|
19
|
+
* @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/data/README.md#register
|
|
20
20
|
*
|
|
21
21
|
* @type {Object}
|
|
22
22
|
*/
|
|
@@ -35,10 +35,7 @@ const storeConfig = {
|
|
|
35
35
|
* @type {Object}
|
|
36
36
|
*/
|
|
37
37
|
export const store = createReduxStore( STORE_NAME, storeConfig );
|
|
38
|
-
|
|
39
|
-
// Once we build a more generic persistence plugin that works across types of stores
|
|
40
|
-
// we'd be able to replace this with a register call.
|
|
41
|
-
registerStore( STORE_NAME, storeConfig );
|
|
38
|
+
register( store );
|
|
42
39
|
|
|
43
40
|
// This package uses a few in-memory post types as wrappers for convenience.
|
|
44
41
|
// This middleware prevents any network requests related to these types as they are
|
package/src/style.scss
CHANGED
|
@@ -4,7 +4,6 @@
|
|
|
4
4
|
@import "./components/error-boundary/style.scss";
|
|
5
5
|
@import "./components/header/style.scss";
|
|
6
6
|
@import "./components/keyboard-shortcut-help-modal/style.scss";
|
|
7
|
-
@import "./components/more-menu/style.scss";
|
|
8
7
|
@import "./components/sidebar/style.scss";
|
|
9
8
|
@import "./components/notices/style.scss";
|
|
10
9
|
@import "./components/layout/style.scss";
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
.edit-widgets-more-menu {
|
|
2
|
-
margin-left: -4px;
|
|
3
|
-
|
|
4
|
-
// the padding and margin of the more menu is intentionally non-standard
|
|
5
|
-
.components-button {
|
|
6
|
-
width: auto;
|
|
7
|
-
padding: 0 2px;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
@include break-small() {
|
|
11
|
-
margin-left: 0;
|
|
12
|
-
|
|
13
|
-
.components-button {
|
|
14
|
-
padding: 0 4px;
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
.edit-widgets-more-menu__content .components-popover__content {
|
|
20
|
-
min-width: 280px;
|
|
21
|
-
|
|
22
|
-
// Let the menu scale to fit items.
|
|
23
|
-
@include break-mobile() {
|
|
24
|
-
width: auto;
|
|
25
|
-
max-width: $break-mobile;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
.components-dropdown-menu__menu {
|
|
29
|
-
padding: 0;
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
.components-popover.edit-widgets-more-menu__content {
|
|
34
|
-
z-index: z-index(".components-popover.edit-widgets-more-menu__content");
|
|
35
|
-
}
|