@wordpress/edit-widgets 3.1.19 → 4.0.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 +13 -1
- package/LICENSE.md +1 -1
- package/README.md +8 -2
- package/build/components/layout/index.js +19 -1
- package/build/components/layout/index.js.map +1 -1
- package/build/components/layout/interface.js +4 -2
- package/build/components/layout/interface.js.map +1 -1
- package/build/components/more-menu/index.js +8 -2
- package/build/components/more-menu/index.js.map +1 -1
- package/build/components/more-menu/tools-more-menu-group.js +37 -0
- package/build/components/more-menu/tools-more-menu-group.js.map +1 -0
- package/build/components/secondary-sidebar/inserter-sidebar.js +15 -5
- package/build/components/secondary-sidebar/inserter-sidebar.js.map +1 -1
- package/build/components/secondary-sidebar/list-view-sidebar.js +7 -5
- package/build/components/secondary-sidebar/list-view-sidebar.js.map +1 -1
- package/build/index.js +1 -1
- package/build/index.js.map +1 -1
- package/build-module/components/layout/index.js +16 -1
- package/build-module/components/layout/index.js.map +1 -1
- package/build-module/components/layout/interface.js +6 -4
- package/build-module/components/layout/interface.js.map +1 -1
- package/build-module/components/more-menu/index.js +7 -2
- package/build-module/components/more-menu/index.js.map +1 -1
- package/build-module/components/more-menu/tools-more-menu-group.js +27 -0
- package/build-module/components/more-menu/tools-more-menu-group.js.map +1 -0
- package/build-module/components/secondary-sidebar/inserter-sidebar.js +16 -7
- package/build-module/components/secondary-sidebar/inserter-sidebar.js.map +1 -1
- package/build-module/components/secondary-sidebar/list-view-sidebar.js +7 -5
- package/build-module/components/secondary-sidebar/list-view-sidebar.js.map +1 -1
- package/build-module/index.js +1 -1
- package/build-module/index.js.map +1 -1
- package/build-style/style-rtl.css +0 -5
- package/build-style/style.css +0 -5
- package/package.json +25 -29
- package/src/components/layout/index.js +18 -1
- package/src/components/layout/interface.js +7 -4
- package/src/components/layout/style.scss +0 -4
- package/src/components/more-menu/index.js +5 -1
- package/src/components/more-menu/tools-more-menu-group.js +21 -0
- package/src/components/secondary-sidebar/inserter-sidebar.js +19 -6
- package/src/components/secondary-sidebar/list-view-sidebar.js +12 -5
- package/src/index.js +1 -1
|
@@ -16,6 +16,7 @@ import { useViewportMatch } from '@wordpress/compose';
|
|
|
16
16
|
*/
|
|
17
17
|
|
|
18
18
|
import KeyboardShortcutHelpModal from '../keyboard-shortcut-help-modal';
|
|
19
|
+
import ToolsMoreMenuGroup from './tools-more-menu-group';
|
|
19
20
|
export default function MoreMenu() {
|
|
20
21
|
const [isKeyboardShortcutsModalActive, setIsKeyboardShortcutsModalVisible] = useState(false);
|
|
21
22
|
|
|
@@ -23,7 +24,7 @@ export default function MoreMenu() {
|
|
|
23
24
|
|
|
24
25
|
useShortcut('core/edit-widgets/keyboard-shortcuts', toggleKeyboardShortcutsModal);
|
|
25
26
|
const isLargeViewport = useViewportMatch('medium');
|
|
26
|
-
return createElement(Fragment, null, createElement(MoreMenuDropdown, null,
|
|
27
|
+
return createElement(Fragment, null, createElement(MoreMenuDropdown, null, onClose => createElement(Fragment, null, isLargeViewport && createElement(MenuGroup, {
|
|
27
28
|
label: _x('View', 'noun')
|
|
28
29
|
}, createElement(MoreMenuFeatureToggle, {
|
|
29
30
|
scope: "core/edit-widgets",
|
|
@@ -53,7 +54,11 @@ export default function MoreMenu() {
|
|
|
53
54
|
as: "span"
|
|
54
55
|
},
|
|
55
56
|
/* translators: accessibility text */
|
|
56
|
-
__('(opens in a new tab)')))
|
|
57
|
+
__('(opens in a new tab)'))), createElement(ToolsMoreMenuGroup.Slot, {
|
|
58
|
+
fillProps: {
|
|
59
|
+
onClose
|
|
60
|
+
}
|
|
61
|
+
})), createElement(MenuGroup, {
|
|
57
62
|
label: __('Preferences')
|
|
58
63
|
}, createElement(MoreMenuFeatureToggle, {
|
|
59
64
|
scope: "core/edit-widgets",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-widgets/src/components/more-menu/index.js"],"names":["MenuGroup","MenuItem","VisuallyHidden","useState","__","_x","external","MoreMenuDropdown","MoreMenuFeatureToggle","displayShortcut","useShortcut","useViewportMatch","KeyboardShortcutHelpModal","MoreMenu","isKeyboardShortcutsModalActive","setIsKeyboardShortcutsModalVisible","toggleKeyboardShortcutsModal","isLargeViewport","access"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,SAAT,EAAoBC,QAApB,EAA8BC,cAA9B,QAAoD,uBAApD;AACA,SAASC,QAAT,QAAyB,oBAAzB;AACA,SAASC,EAAT,EAAaC,EAAb,QAAuB,iBAAvB;AACA,SAASC,QAAT,QAAyB,kBAAzB;AACA,SAASC,gBAAT,EAA2BC,qBAA3B,QAAwD,sBAAxD;AACA,SAASC,eAAT,QAAgC,qBAAhC;AACA,SAASC,WAAT,QAA4B,+BAA5B;AACA,SAASC,gBAAT,QAAiC,oBAAjC;AAEA;AACA;AACA;;AACA,OAAOC,yBAAP,MAAsC,iCAAtC;AAEA,eAAe,SAASC,QAAT,GAAoB;AAClC,QAAM,CACLC,8BADK,EAELC,kCAFK,
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-widgets/src/components/more-menu/index.js"],"names":["MenuGroup","MenuItem","VisuallyHidden","useState","__","_x","external","MoreMenuDropdown","MoreMenuFeatureToggle","displayShortcut","useShortcut","useViewportMatch","KeyboardShortcutHelpModal","ToolsMoreMenuGroup","MoreMenu","isKeyboardShortcutsModalActive","setIsKeyboardShortcutsModalVisible","toggleKeyboardShortcutsModal","isLargeViewport","onClose","access"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,SAAT,EAAoBC,QAApB,EAA8BC,cAA9B,QAAoD,uBAApD;AACA,SAASC,QAAT,QAAyB,oBAAzB;AACA,SAASC,EAAT,EAAaC,EAAb,QAAuB,iBAAvB;AACA,SAASC,QAAT,QAAyB,kBAAzB;AACA,SAASC,gBAAT,EAA2BC,qBAA3B,QAAwD,sBAAxD;AACA,SAASC,eAAT,QAAgC,qBAAhC;AACA,SAASC,WAAT,QAA4B,+BAA5B;AACA,SA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EAAE,CACtB,uCADsB;AAVxB,IA1BF,CAtDD,CAFF,CADD,EAsGC,cAAC,yBAAD;AACC,IAAA,aAAa,EAAGW,8BADjB;AAEC,IAAA,WAAW,EAAGE;AAFf,IAtGD,CADD;AA6GA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { MenuGroup, MenuItem, VisuallyHidden } from '@wordpress/components';\nimport { useState } from '@wordpress/element';\nimport { __, _x } from '@wordpress/i18n';\nimport { external } from '@wordpress/icons';\nimport { MoreMenuDropdown, MoreMenuFeatureToggle } from '@wordpress/interface';\nimport { displayShortcut } from '@wordpress/keycodes';\nimport { useShortcut } from '@wordpress/keyboard-shortcuts';\nimport { useViewportMatch } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport KeyboardShortcutHelpModal from '../keyboard-shortcut-help-modal';\nimport ToolsMoreMenuGroup from './tools-more-menu-group';\n\nexport default function MoreMenu() {\n\tconst [\n\t\tisKeyboardShortcutsModalActive,\n\t\tsetIsKeyboardShortcutsModalVisible,\n\t] = useState( false );\n\tconst toggleKeyboardShortcutsModal = () =>\n\t\tsetIsKeyboardShortcutsModalVisible( ! isKeyboardShortcutsModalActive );\n\n\tuseShortcut(\n\t\t'core/edit-widgets/keyboard-shortcuts',\n\t\ttoggleKeyboardShortcutsModal\n\t);\n\n\tconst isLargeViewport = useViewportMatch( 'medium' );\n\n\treturn (\n\t\t<>\n\t\t\t<MoreMenuDropdown>\n\t\t\t\t{ ( onClose ) => (\n\t\t\t\t\t<>\n\t\t\t\t\t\t{ isLargeViewport && (\n\t\t\t\t\t\t\t<MenuGroup label={ _x( 'View', 'noun' ) }>\n\t\t\t\t\t\t\t\t<MoreMenuFeatureToggle\n\t\t\t\t\t\t\t\t\tscope=\"core/edit-widgets\"\n\t\t\t\t\t\t\t\t\tfeature=\"fixedToolbar\"\n\t\t\t\t\t\t\t\t\tlabel={ __( 'Top toolbar' ) }\n\t\t\t\t\t\t\t\t\tinfo={ __(\n\t\t\t\t\t\t\t\t\t\t'Access all block and document tools in a single place'\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\tmessageActivated={ __(\n\t\t\t\t\t\t\t\t\t\t'Top toolbar activated'\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\tmessageDeactivated={ __(\n\t\t\t\t\t\t\t\t\t\t'Top toolbar deactivated'\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</MenuGroup>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t<MenuGroup label={ __( 'Tools' ) }>\n\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\tsetIsKeyboardShortcutsModalVisible( true );\n\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\tshortcut={ displayShortcut.access( 'h' ) }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ __( 'Keyboard shortcuts' ) }\n\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t\t<MoreMenuFeatureToggle\n\t\t\t\t\t\t\t\tscope=\"core/edit-widgets\"\n\t\t\t\t\t\t\t\tfeature=\"welcomeGuide\"\n\t\t\t\t\t\t\t\tlabel={ __( 'Welcome Guide' ) }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\trole=\"menuitem\"\n\t\t\t\t\t\t\t\ticon={ external }\n\t\t\t\t\t\t\t\thref={ __(\n\t\t\t\t\t\t\t\t\t'https://wordpress.org/support/article/block-based-widgets-editor/'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\ttarget=\"_blank\"\n\t\t\t\t\t\t\t\trel=\"noopener noreferrer\"\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ __( 'Help' ) }\n\t\t\t\t\t\t\t\t<VisuallyHidden as=\"span\">\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t/* translators: accessibility text */\n\t\t\t\t\t\t\t\t\t\t__( '(opens in a new tab)' )\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t</VisuallyHidden>\n\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t\t<ToolsMoreMenuGroup.Slot\n\t\t\t\t\t\t\t\tfillProps={ { onClose } }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</MenuGroup>\n\t\t\t\t\t\t<MenuGroup label={ __( 'Preferences' ) }>\n\t\t\t\t\t\t\t<MoreMenuFeatureToggle\n\t\t\t\t\t\t\t\tscope=\"core/edit-widgets\"\n\t\t\t\t\t\t\t\tfeature=\"keepCaretInsideBlock\"\n\t\t\t\t\t\t\t\tlabel={ __(\n\t\t\t\t\t\t\t\t\t'Contain text cursor inside block'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\tinfo={ __(\n\t\t\t\t\t\t\t\t\t'Aids screen readers by stopping text caret from leaving blocks.'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\tmessageActivated={ __(\n\t\t\t\t\t\t\t\t\t'Contain text cursor inside block activated'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\tmessageDeactivated={ __(\n\t\t\t\t\t\t\t\t\t'Contain text cursor inside block deactivated'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<MoreMenuFeatureToggle\n\t\t\t\t\t\t\t\tscope=\"core/edit-widgets\"\n\t\t\t\t\t\t\t\tfeature=\"themeStyles\"\n\t\t\t\t\t\t\t\tinfo={ __(\n\t\t\t\t\t\t\t\t\t'Make the editor look like your theme.'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\tlabel={ __( 'Use theme styles' ) }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t{ isLargeViewport && (\n\t\t\t\t\t\t\t\t<MoreMenuFeatureToggle\n\t\t\t\t\t\t\t\t\tscope=\"core/edit-widgets\"\n\t\t\t\t\t\t\t\t\tfeature=\"showBlockBreadcrumbs\"\n\t\t\t\t\t\t\t\t\tlabel={ __( 'Display block breadcrumbs' ) }\n\t\t\t\t\t\t\t\t\tinfo={ __(\n\t\t\t\t\t\t\t\t\t\t'Shows block breadcrumbs at the bottom of the editor.'\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\tmessageActivated={ __(\n\t\t\t\t\t\t\t\t\t\t'Display block breadcrumbs activated'\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\tmessageDeactivated={ __(\n\t\t\t\t\t\t\t\t\t\t'Display block breadcrumbs deactivated'\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</MenuGroup>\n\t\t\t\t\t</>\n\t\t\t\t) }\n\t\t\t</MoreMenuDropdown>\n\t\t\t<KeyboardShortcutHelpModal\n\t\t\t\tisModalActive={ isKeyboardShortcutsModalActive }\n\t\t\t\ttoggleModal={ toggleKeyboardShortcutsModal }\n\t\t\t/>\n\t\t</>\n\t);\n}\n"]}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { createElement } from "@wordpress/element";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* External dependencies
|
|
5
|
+
*/
|
|
6
|
+
import { isEmpty } from 'lodash';
|
|
7
|
+
/**
|
|
8
|
+
* WordPress dependencies
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import { createSlotFill } from '@wordpress/components';
|
|
12
|
+
const {
|
|
13
|
+
Fill: ToolsMoreMenuGroup,
|
|
14
|
+
Slot
|
|
15
|
+
} = createSlotFill('EditWidgetsToolsMoreMenuGroup');
|
|
16
|
+
|
|
17
|
+
ToolsMoreMenuGroup.Slot = _ref => {
|
|
18
|
+
let {
|
|
19
|
+
fillProps
|
|
20
|
+
} = _ref;
|
|
21
|
+
return createElement(Slot, {
|
|
22
|
+
fillProps: fillProps
|
|
23
|
+
}, fills => !isEmpty(fills) && fills);
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
export default ToolsMoreMenuGroup;
|
|
27
|
+
//# sourceMappingURL=tools-more-menu-group.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-widgets/src/components/more-menu/tools-more-menu-group.js"],"names":["isEmpty","createSlotFill","Fill","ToolsMoreMenuGroup","Slot","fillProps","fills"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,OAAT,QAAwB,QAAxB;AAEA;AACA;AACA;;AACA,SAASC,cAAT,QAA+B,uBAA/B;AAEA,MAAM;AAAEC,EAAAA,IAAI,EAAEC,kBAAR;AAA4BC,EAAAA;AAA5B,IAAqCH,cAAc,CACxD,+BADwD,CAAzD;;AAIAE,kBAAkB,CAACC,IAAnB,GAA0B;AAAA,MAAE;AAAEC,IAAAA;AAAF,GAAF;AAAA,SACzB,cAAC,IAAD;AAAM,IAAA,SAAS,EAAGA;AAAlB,KACKC,KAAF,IAAa,CAAEN,OAAO,CAAEM,KAAF,CAAT,IAAsBA,KADtC,CADyB;AAAA,CAA1B;;AAMA,eAAeH,kBAAf","sourcesContent":["/**\n * External dependencies\n */\nimport { isEmpty } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { createSlotFill } from '@wordpress/components';\n\nconst { Fill: ToolsMoreMenuGroup, Slot } = createSlotFill(\n\t'EditWidgetsToolsMoreMenuGroup'\n);\n\nToolsMoreMenuGroup.Slot = ( { fillProps } ) => (\n\t<Slot fillProps={ fillProps }>\n\t\t{ ( fills ) => ! isEmpty( fills ) && fills }\n\t</Slot>\n);\n\nexport default ToolsMoreMenuGroup;\n"]}
|
|
@@ -4,12 +4,13 @@ import { createElement } from "@wordpress/element";
|
|
|
4
4
|
/**
|
|
5
5
|
* WordPress dependencies
|
|
6
6
|
*/
|
|
7
|
-
import { Button } from '@wordpress/components';
|
|
7
|
+
import { Button, VisuallyHidden } from '@wordpress/components';
|
|
8
8
|
import { close } from '@wordpress/icons';
|
|
9
9
|
import { __experimentalLibrary as Library } from '@wordpress/block-editor';
|
|
10
10
|
import { useViewportMatch, __experimentalUseDialog as useDialog } from '@wordpress/compose';
|
|
11
|
-
import { useCallback } from '@wordpress/element';
|
|
11
|
+
import { useCallback, useEffect, useRef } from '@wordpress/element';
|
|
12
12
|
import { useDispatch } from '@wordpress/data';
|
|
13
|
+
import { __ } from '@wordpress/i18n';
|
|
13
14
|
/**
|
|
14
15
|
* Internal dependencies
|
|
15
16
|
*/
|
|
@@ -26,27 +27,35 @@ export default function InserterSidebar() {
|
|
|
26
27
|
setIsInserterOpened
|
|
27
28
|
} = useDispatch(editWidgetsStore);
|
|
28
29
|
const closeInserter = useCallback(() => {
|
|
29
|
-
return
|
|
30
|
+
return setIsInserterOpened(false);
|
|
30
31
|
}, [setIsInserterOpened]);
|
|
32
|
+
const TagName = !isMobileViewport ? VisuallyHidden : 'div';
|
|
31
33
|
const [inserterDialogRef, inserterDialogProps] = useDialog({
|
|
32
|
-
onClose: closeInserter
|
|
34
|
+
onClose: closeInserter,
|
|
35
|
+
focusOnMount: null
|
|
33
36
|
});
|
|
37
|
+
const libraryRef = useRef();
|
|
38
|
+
useEffect(() => {
|
|
39
|
+
libraryRef.current.focusSearch();
|
|
40
|
+
}, []);
|
|
34
41
|
return createElement("div", _extends({
|
|
35
42
|
ref: inserterDialogRef
|
|
36
43
|
}, inserterDialogProps, {
|
|
37
44
|
className: "edit-widgets-layout__inserter-panel"
|
|
38
|
-
}), createElement(
|
|
45
|
+
}), createElement(TagName, {
|
|
39
46
|
className: "edit-widgets-layout__inserter-panel-header"
|
|
40
47
|
}, createElement(Button, {
|
|
41
48
|
icon: close,
|
|
42
|
-
onClick: closeInserter
|
|
49
|
+
onClick: closeInserter,
|
|
50
|
+
label: __('Close block inserter')
|
|
43
51
|
})), createElement("div", {
|
|
44
52
|
className: "edit-widgets-layout__inserter-panel-content"
|
|
45
53
|
}, createElement(Library, {
|
|
46
54
|
showInserterHelpPanel: true,
|
|
47
55
|
shouldFocusBlock: isMobileViewport,
|
|
48
56
|
rootClientId: rootClientId,
|
|
49
|
-
__experimentalInsertionIndex: insertionIndex
|
|
57
|
+
__experimentalInsertionIndex: insertionIndex,
|
|
58
|
+
ref: libraryRef
|
|
50
59
|
})));
|
|
51
60
|
}
|
|
52
61
|
//# sourceMappingURL=inserter-sidebar.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-widgets/src/components/secondary-sidebar/inserter-sidebar.js"],"names":["Button","close","__experimentalLibrary","Library","useViewportMatch","__experimentalUseDialog","useDialog","useCallback","useDispatch","useWidgetLibraryInsertionPoint","store","editWidgetsStore","InserterSidebar","isMobileViewport","rootClientId","insertionIndex","setIsInserterOpened","closeInserter","inserterDialogRef","inserterDialogProps","onClose"],"mappings":";;;AAAA;AACA;AACA;AACA,SAASA,MAAT,
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-widgets/src/components/secondary-sidebar/inserter-sidebar.js"],"names":["Button","VisuallyHidden","close","__experimentalLibrary","Library","useViewportMatch","__experimentalUseDialog","useDialog","useCallback","useEffect","useRef","useDispatch","__","useWidgetLibraryInsertionPoint","store","editWidgetsStore","InserterSidebar","isMobileViewport","rootClientId","insertionIndex","setIsInserterOpened","closeInserter","TagName","inserterDialogRef","inserterDialogProps","onClose","focusOnMount","libraryRef","current","focusSearch"],"mappings":";;;AAAA;AACA;AACA;AACA,SAASA,MAAT,EAAiBC,cAAjB,QAAuC,uBAAvC;AACA,SAASC,KAAT,QAAsB,kBAAtB;AACA,SAASC,qBAAqB,IAAIC,OAAlC,QAAiD,yBAAjD;AACA,SACCC,gBADD,EAECC,uBAAuB,IAAIC,SAF5B,QAGO,oBAHP;AAIA,SAASC,WAAT,EAAsBC,SAAtB,EAAiCC,MAAjC,QAA+C,oBAA/C;AACA,SAASC,WAAT,QAA4B,iBAA5B;AACA,S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C,IAAA,gBAAgB,EAAGK,gBAFpB;AAGC,IAAA,YAAY,EAAGC,YAHhB;AAIC,IAAA,4BAA4B,EAAGC,cAJhC;AAKC,IAAA,GAAG,EAAGQ;AALP,IADD,CAZD,CADD;AAwBA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { Button, VisuallyHidden } from '@wordpress/components';\nimport { close } from '@wordpress/icons';\nimport { __experimentalLibrary as Library } from '@wordpress/block-editor';\nimport {\n\tuseViewportMatch,\n\t__experimentalUseDialog as useDialog,\n} from '@wordpress/compose';\nimport { useCallback, useEffect, useRef } from '@wordpress/element';\nimport { useDispatch } from '@wordpress/data';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport useWidgetLibraryInsertionPoint from '../../hooks/use-widget-library-insertion-point';\nimport { store as editWidgetsStore } from '../../store';\n\nexport default function InserterSidebar() {\n\tconst isMobileViewport = useViewportMatch( 'medium', '<' );\n\tconst { rootClientId, insertionIndex } = useWidgetLibraryInsertionPoint();\n\n\tconst { setIsInserterOpened } = useDispatch( editWidgetsStore );\n\n\tconst closeInserter = useCallback( () => {\n\t\treturn setIsInserterOpened( false );\n\t}, [ setIsInserterOpened ] );\n\n\tconst TagName = ! isMobileViewport ? VisuallyHidden : 'div';\n\tconst [ inserterDialogRef, inserterDialogProps ] = useDialog( {\n\t\tonClose: closeInserter,\n\t\tfocusOnMount: null,\n\t} );\n\n\tconst libraryRef = useRef();\n\tuseEffect( () => {\n\t\tlibraryRef.current.focusSearch();\n\t}, [] );\n\n\treturn (\n\t\t<div\n\t\t\tref={ inserterDialogRef }\n\t\t\t{ ...inserterDialogProps }\n\t\t\tclassName=\"edit-widgets-layout__inserter-panel\"\n\t\t>\n\t\t\t<TagName className=\"edit-widgets-layout__inserter-panel-header\">\n\t\t\t\t<Button\n\t\t\t\t\ticon={ close }\n\t\t\t\t\tonClick={ closeInserter }\n\t\t\t\t\tlabel={ __( 'Close block inserter' ) }\n\t\t\t\t/>\n\t\t\t</TagName>\n\t\t\t<div className=\"edit-widgets-layout__inserter-panel-content\">\n\t\t\t\t<Library\n\t\t\t\t\tshowInserterHelpPanel\n\t\t\t\t\tshouldFocusBlock={ isMobileViewport }\n\t\t\t\t\trootClientId={ rootClientId }\n\t\t\t\t\t__experimentalInsertionIndex={ insertionIndex }\n\t\t\t\t\tref={ libraryRef }\n\t\t\t\t/>\n\t\t\t</div>\n\t\t</div>\n\t);\n}\n"]}
|
|
@@ -30,7 +30,8 @@ export default function ListViewSidebar() {
|
|
|
30
30
|
}
|
|
31
31
|
|
|
32
32
|
const focusOnMountRef = useFocusOnMount('firstElement');
|
|
33
|
-
const
|
|
33
|
+
const headerFocusReturnRef = useFocusReturn();
|
|
34
|
+
const contentFocusReturnRef = useFocusReturn();
|
|
34
35
|
|
|
35
36
|
function closeOnEscape(event) {
|
|
36
37
|
if (event.keyCode === ESCAPE && !event.defaultPrevented) {
|
|
@@ -47,16 +48,17 @@ export default function ListViewSidebar() {
|
|
|
47
48
|
className: "edit-widgets-editor__list-view-panel",
|
|
48
49
|
onKeyDown: closeOnEscape
|
|
49
50
|
}, createElement("div", {
|
|
50
|
-
className: "edit-widgets-editor__list-view-panel-header"
|
|
51
|
+
className: "edit-widgets-editor__list-view-panel-header",
|
|
52
|
+
ref: headerFocusReturnRef
|
|
51
53
|
}, createElement("strong", {
|
|
52
54
|
id: labelId
|
|
53
|
-
}, __('List
|
|
55
|
+
}, __('List View')), createElement(Button, {
|
|
54
56
|
icon: closeSmall,
|
|
55
|
-
label: __('Close
|
|
57
|
+
label: __('Close List View Sidebar'),
|
|
56
58
|
onClick: () => setIsListViewOpened(false)
|
|
57
59
|
})), createElement("div", {
|
|
58
60
|
className: "edit-widgets-editor__list-view-panel-content",
|
|
59
|
-
ref: useMergeRefs([
|
|
61
|
+
ref: useMergeRefs([contentFocusReturnRef, focusOnMountRef])
|
|
60
62
|
}, createElement(ListView, {
|
|
61
63
|
onSelect: selectEditorBlock,
|
|
62
64
|
showNestedBlocks: true,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-widgets/src/components/secondary-sidebar/list-view-sidebar.js"],"names":["__experimentalListView","ListView","store","blockEditorStore","Button","useFocusOnMount","useFocusReturn","useInstanceId","useMergeRefs","useDispatch","__","closeSmall","ESCAPE","editWidgetsStore","ListViewSidebar","setIsListViewOpened","clearSelectedBlock","selectBlock","selectEditorBlock","clientId","focusOnMountRef","
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-widgets/src/components/secondary-sidebar/list-view-sidebar.js"],"names":["__experimentalListView","ListView","store","blockEditorStore","Button","useFocusOnMount","useFocusReturn","useInstanceId","useMergeRefs","useDispatch","__","closeSmall","ESCAPE","editWidgetsStore","ListViewSidebar","setIsListViewOpened","clearSelectedBlock","selectBlock","selectEditorBlock","clientId","focusOnMountRef","headerFocusReturnRef","contentFocusReturnRef","closeOnEscape","event","keyCode","defaultPrevented","preventDefault","instanceId","labelId"],"mappings":";;AAAA;AACA;AACA;AACA,SACCA,sBAAsB,IAAIC,QAD3B,EAECC,KAAK,IAAIC,gBAFV,QAGO,yBAHP;AAIA,SAASC,MAAT,QAAuB,uBAAvB;AACA,SACCC,eADD,EAECC,cAFD,EAGCC,aAHD,EAICC,YAJD,QAKO,oBALP;AAMA,SAASC,WAAT,QAA4B,iBAA5B;AACA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,UAAT,QAA2B,kBAA3B;AACA,SAASC,MAAT,QAAuB,qBAAvB;AAEA;AACA;AACA;;AACA,SAASV,KAAK,IAAIW,gBAAlB,QAA0C,aAA1C;AAEA,eAAe,SAASC,eAAT,GAA2B;AACzC,QAAM;AAAEC,IAAAA;AAAF,MAA0BN,WAAW,CAAEI,gBAAF,CAA3C;AAEA,QAAM;AAAEG,IAAAA,kBAAF;AAAsBC,IAAAA;AAAtB,MAAsCR,WAAW,CAAEN,gBAAF,CAAvD;;AACA,iBAAee,iBAAf,CAAkCC,QAAlC,EAA6C;AAC5C,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D,CAhBD;AAFD;AAmCA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalListView as ListView,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { Button } from '@wordpress/components';\nimport {\n\tuseFocusOnMount,\n\tuseFocusReturn,\n\tuseInstanceId,\n\tuseMergeRefs,\n} from '@wordpress/compose';\nimport { useDispatch } from '@wordpress/data';\nimport { __ } from '@wordpress/i18n';\nimport { closeSmall } from '@wordpress/icons';\nimport { ESCAPE } from '@wordpress/keycodes';\n\n/**\n * Internal dependencies\n */\nimport { store as editWidgetsStore } from '../../store';\n\nexport default function ListViewSidebar() {\n\tconst { setIsListViewOpened } = useDispatch( editWidgetsStore );\n\n\tconst { clearSelectedBlock, selectBlock } = useDispatch( blockEditorStore );\n\tasync function selectEditorBlock( clientId ) {\n\t\tawait clearSelectedBlock();\n\t\tselectBlock( clientId, -1 );\n\t}\n\n\tconst focusOnMountRef = useFocusOnMount( 'firstElement' );\n\tconst headerFocusReturnRef = useFocusReturn();\n\tconst contentFocusReturnRef = useFocusReturn();\n\tfunction closeOnEscape( event ) {\n\t\tif ( event.keyCode === ESCAPE && ! event.defaultPrevented ) {\n\t\t\tevent.preventDefault();\n\t\t\tsetIsListViewOpened( false );\n\t\t}\n\t}\n\n\tconst instanceId = useInstanceId( ListViewSidebar );\n\tconst labelId = `edit-widgets-editor__list-view-panel-label-${ instanceId }`;\n\n\treturn (\n\t\t// eslint-disable-next-line jsx-a11y/no-static-element-interactions\n\t\t<div\n\t\t\taria-labelledby={ labelId }\n\t\t\tclassName=\"edit-widgets-editor__list-view-panel\"\n\t\t\tonKeyDown={ closeOnEscape }\n\t\t>\n\t\t\t<div\n\t\t\t\tclassName=\"edit-widgets-editor__list-view-panel-header\"\n\t\t\t\tref={ headerFocusReturnRef }\n\t\t\t>\n\t\t\t\t<strong id={ labelId }>{ __( 'List View' ) }</strong>\n\t\t\t\t<Button\n\t\t\t\t\ticon={ closeSmall }\n\t\t\t\t\tlabel={ __( 'Close List View Sidebar' ) }\n\t\t\t\t\tonClick={ () => setIsListViewOpened( false ) }\n\t\t\t\t/>\n\t\t\t</div>\n\t\t\t<div\n\t\t\t\tclassName=\"edit-widgets-editor__list-view-panel-content\"\n\t\t\t\tref={ useMergeRefs( [\n\t\t\t\t\tcontentFocusReturnRef,\n\t\t\t\t\tfocusOnMountRef,\n\t\t\t\t] ) }\n\t\t\t>\n\t\t\t\t<ListView\n\t\t\t\t\tonSelect={ selectEditorBlock }\n\t\t\t\t\tshowNestedBlocks\n\t\t\t\t\t__experimentalHideContainerBlockActions\n\t\t\t\t\t__experimentalFeatures\n\t\t\t\t\t__experimentalPersistentListViewFeatures\n\t\t\t\t/>\n\t\t\t</div>\n\t\t</div>\n\t);\n}\n"]}
|
package/build-module/index.js
CHANGED
|
@@ -65,7 +65,7 @@ export function initialize(id, settings) {
|
|
|
65
65
|
registerCoreBlocks(coreBlocks);
|
|
66
66
|
registerLegacyWidgetBlock();
|
|
67
67
|
|
|
68
|
-
if (process.env.
|
|
68
|
+
if (process.env.IS_GUTENBERG_PLUGIN) {
|
|
69
69
|
__experimentalRegisterExperimentalCoreBlocks({
|
|
70
70
|
enableFSEBlocks: ENABLE_EXPERIMENTAL_FSE_BLOCKS
|
|
71
71
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-widgets/src/index.js"],"names":["registerBlockType","unstable__bootstrapServerSideBlockDefinitions","setFreeformContentHandlerName","store","blocksStore","dispatch","render","unmountComponentAtNode","registerCoreBlocks","__experimentalGetCoreBlocks","__experimentalRegisterExperimentalCoreBlocks","__experimentalFetchLinkSuggestions","fetchLinkSuggestions","registerLegacyWidgetBlock","registerLegacyWidgetVariations","registerWidgetGroupBlock","interfaceStore","widgetArea","Layout","ALLOW_REUSABLE_BLOCKS","ENABLE_EXPERIMENTAL_FSE_BLOCKS","disabledBlocks","reinitializeEditor","target","settings","reboot","bind","initialize","id","document","getElementById","coreBlocks","filter","block","includes","name","startsWith","setFeatureDefaults","fixedToolbar","welcomeGuide","showBlockBreadcrumbs","themeStyles","__experimentalReapplyBlockTypeFilters","process","env","
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-widgets/src/index.js"],"names":["registerBlockType","unstable__bootstrapServerSideBlockDefinitions","setFreeformContentHandlerName","store","blocksStore","dispatch","render","unmountComponentAtNode","registerCoreBlocks","__experimentalGetCoreBlocks","__experimentalRegisterExperimentalCoreBlocks","__experimentalFetchLinkSuggestions","fetchLinkSuggestions","registerLegacyWidgetBlock","registerLegacyWidgetVariations","registerWidgetGroupBlock","interfaceStore","widgetArea","Layout","ALLOW_REUSABLE_BLOCKS","ENABLE_EXPERIMENTAL_FSE_BLOCKS","disabledBlocks","reinitializeEditor","target","settings","reboot","bind","initialize","id","document","getElementById","coreBlocks","filter","block","includes","name","startsWith","setFeatureDefaults","fixedToolbar","welcomeGuide","showBlockBreadcrumbs","themeStyles","__experimentalReapplyBlockTypeFilters","process","env","IS_GUTENBERG_PLUGIN","enableFSEBlocks","registerBlock","search","searchOptions","metadata"],"mappings":";;AAAA;AACA;AACA;AACA,SACCA,iBADD,EAECC,6CAFD,EAEgD;AAC/CC,6BAHD,EAICC,KAAK,IAAIC,WAJV,QAKO,mBALP;AAMA,SAASC,QAAT,QAAyB,iBAAzB;AACA,SAASC,MAAT,EAAiBC,sBAAjB,QAA+C,oBAA/C;AACA,SACCC,kBADD,EAECC,2BAFD,EAGCC,4CAHD,QAIO,0BAJP;AAKA,SAASC,kCAAkC,IAAIC,oBAA/C,QAA2E,sBAA3E;AACA,SACCC,yBADD,EAECC,8BAFD,EAGCC,wBAHD,QAIO,oBAJP;AAKA,SAASZ,KAAK,IAAIa,cAAlB,QAAwC,sBAAxC;AAEA;AACA;AACA;;AACA,OAAO,SAAP;AACA,OAAO,WAAP;AACA,OAAO,KAAKC,UAAZ,MAA4B,sBAA5B;AAEA,OAAOC,MAAP,MAAmB,qBAAnB;AACA,SACCC,qBADD,EAECC,8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ACA;;AACDlD,EAAAA,iBAAiB,CAAEmC,IAAF,EAAQX,QAAR,CAAjB;AACA,CATD","sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tregisterBlockType,\n\tunstable__bootstrapServerSideBlockDefinitions, // eslint-disable-line camelcase\n\tsetFreeformContentHandlerName,\n\tstore as blocksStore,\n} from '@wordpress/blocks';\nimport { dispatch } from '@wordpress/data';\nimport { render, unmountComponentAtNode } from '@wordpress/element';\nimport {\n\tregisterCoreBlocks,\n\t__experimentalGetCoreBlocks,\n\t__experimentalRegisterExperimentalCoreBlocks,\n} from '@wordpress/block-library';\nimport { __experimentalFetchLinkSuggestions as fetchLinkSuggestions } from '@wordpress/core-data';\nimport {\n\tregisterLegacyWidgetBlock,\n\tregisterLegacyWidgetVariations,\n\tregisterWidgetGroupBlock,\n} from '@wordpress/widgets';\nimport { store as interfaceStore } from '@wordpress/interface';\n\n/**\n * Internal dependencies\n */\nimport './store';\nimport './filters';\nimport * as widgetArea from './blocks/widget-area';\n\nimport Layout from './components/layout';\nimport {\n\tALLOW_REUSABLE_BLOCKS,\n\tENABLE_EXPERIMENTAL_FSE_BLOCKS,\n} from './constants';\n\nconst disabledBlocks = [\n\t'core/more',\n\t'core/freeform',\n\t'core/template-part',\n\t...( ALLOW_REUSABLE_BLOCKS ? [] : [ 'core/block' ] ),\n];\n\n/**\n * Reinitializes the editor after the user chooses to reboot the editor after\n * an unhandled error occurs, replacing previously mounted editor element using\n * an initial state from prior to the crash.\n *\n * @param {Element} target DOM node in which editor is rendered.\n * @param {?Object} settings Editor settings object.\n */\nexport function reinitializeEditor( target, settings ) {\n\tunmountComponentAtNode( target );\n\tconst reboot = reinitializeEditor.bind( null, target, settings );\n\trender(\n\t\t<Layout blockEditorSettings={ settings } onError={ reboot } />,\n\t\ttarget\n\t);\n}\n\n/**\n * Initializes the block editor in the widgets screen.\n *\n * @param {string} id ID of the root element to render the screen in.\n * @param {Object} settings Block editor settings.\n */\nexport function initialize( id, settings ) {\n\tconst target = document.getElementById( id );\n\tconst reboot = reinitializeEditor.bind( null, target, settings );\n\tconst coreBlocks = __experimentalGetCoreBlocks().filter( ( block ) => {\n\t\treturn ! (\n\t\t\tdisabledBlocks.includes( block.name ) ||\n\t\t\tblock.name.startsWith( 'core/post' ) ||\n\t\t\tblock.name.startsWith( 'core/query' ) ||\n\t\t\tblock.name.startsWith( 'core/site' ) ||\n\t\t\tblock.name.startsWith( 'core/navigation' )\n\t\t);\n\t} );\n\n\tdispatch( interfaceStore ).setFeatureDefaults( 'core/edit-widgets', {\n\t\tfixedToolbar: false,\n\t\twelcomeGuide: true,\n\t\tshowBlockBreadcrumbs: true,\n\t\tthemeStyles: true,\n\t} );\n\n\tdispatch( blocksStore ).__experimentalReapplyBlockTypeFilters();\n\tregisterCoreBlocks( coreBlocks );\n\tregisterLegacyWidgetBlock();\n\tif ( process.env.IS_GUTENBERG_PLUGIN ) {\n\t\t__experimentalRegisterExperimentalCoreBlocks( {\n\t\t\tenableFSEBlocks: ENABLE_EXPERIMENTAL_FSE_BLOCKS,\n\t\t} );\n\t}\n\tregisterLegacyWidgetVariations( settings );\n\tregisterBlock( widgetArea );\n\tregisterWidgetGroupBlock();\n\n\tsettings.__experimentalFetchLinkSuggestions = ( search, searchOptions ) =>\n\t\tfetchLinkSuggestions( search, searchOptions, settings );\n\n\t// As we are unregistering `core/freeform` to avoid the Classic block, we must\n\t// replace it with something as the default freeform content handler. Failure to\n\t// do this will result in errors in the default block parser.\n\t// see: https://github.com/WordPress/gutenberg/issues/33097\n\tsetFreeformContentHandlerName( 'core/html' );\n\trender(\n\t\t<Layout blockEditorSettings={ settings } onError={ reboot } />,\n\t\ttarget\n\t);\n}\n\n/**\n * Function to register an individual block.\n *\n * @param {Object} block The block to be registered.\n *\n */\nconst registerBlock = ( block ) => {\n\tif ( ! block ) {\n\t\treturn;\n\t}\n\tconst { metadata, settings, name } = block;\n\tif ( metadata ) {\n\t\tunstable__bootstrapServerSideBlockDefinitions( { [ name ]: metadata } );\n\t}\n\tregisterBlockType( name, settings );\n};\n"]}
|
|
@@ -824,11 +824,6 @@ body.is-fullscreen-mode .edit-widgets-notices__snackbar {
|
|
|
824
824
|
display: flex;
|
|
825
825
|
justify-content: flex-end;
|
|
826
826
|
}
|
|
827
|
-
@media (min-width: 782px) {
|
|
828
|
-
.edit-widgets-layout__inserter-panel-header {
|
|
829
|
-
display: none;
|
|
830
|
-
}
|
|
831
|
-
}
|
|
832
827
|
|
|
833
828
|
.edit-widgets-layout__inserter-panel-content {
|
|
834
829
|
height: calc(100% - 36px - 8px);
|
package/build-style/style.css
CHANGED
|
@@ -824,11 +824,6 @@ body.is-fullscreen-mode .edit-widgets-notices__snackbar {
|
|
|
824
824
|
display: flex;
|
|
825
825
|
justify-content: flex-end;
|
|
826
826
|
}
|
|
827
|
-
@media (min-width: 782px) {
|
|
828
|
-
.edit-widgets-layout__inserter-panel-header {
|
|
829
|
-
display: none;
|
|
830
|
-
}
|
|
831
|
-
}
|
|
832
827
|
|
|
833
828
|
.edit-widgets-layout__inserter-panel-content {
|
|
834
829
|
height: calc(100% - 36px - 8px);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wordpress/edit-widgets",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.0.0",
|
|
4
4
|
"description": "Widgets Page module for WordPress..",
|
|
5
5
|
"author": "The WordPress Contributors",
|
|
6
6
|
"license": "GPL-2.0-or-later",
|
|
@@ -27,37 +27,33 @@
|
|
|
27
27
|
"react-native": "src/index",
|
|
28
28
|
"dependencies": {
|
|
29
29
|
"@babel/runtime": "^7.16.0",
|
|
30
|
-
"@wordpress/
|
|
31
|
-
"@wordpress/
|
|
32
|
-
"@wordpress/block-
|
|
33
|
-
"@wordpress/
|
|
34
|
-
"@wordpress/
|
|
35
|
-
"@wordpress/
|
|
36
|
-
"@wordpress/
|
|
37
|
-
"@wordpress/
|
|
38
|
-
"@wordpress/
|
|
39
|
-
"@wordpress/
|
|
40
|
-
"@wordpress/
|
|
41
|
-
"@wordpress/
|
|
42
|
-
"@wordpress/
|
|
43
|
-
"@wordpress/
|
|
44
|
-
"@wordpress/
|
|
45
|
-
"@wordpress/
|
|
46
|
-
"@wordpress/
|
|
47
|
-
"@wordpress/
|
|
48
|
-
"@wordpress/
|
|
49
|
-
"@wordpress/
|
|
50
|
-
"@wordpress/
|
|
51
|
-
"@wordpress/
|
|
52
|
-
"@wordpress/url": "^3.3.1",
|
|
53
|
-
"@wordpress/widgets": "^2.0.21",
|
|
30
|
+
"@wordpress/api-fetch": "^6.0.1",
|
|
31
|
+
"@wordpress/block-editor": "^8.1.1",
|
|
32
|
+
"@wordpress/block-library": "^7.0.0",
|
|
33
|
+
"@wordpress/blocks": "^11.2.1",
|
|
34
|
+
"@wordpress/components": "^19.4.0",
|
|
35
|
+
"@wordpress/compose": "^5.1.1",
|
|
36
|
+
"@wordpress/core-data": "^4.1.1",
|
|
37
|
+
"@wordpress/data": "^6.2.1",
|
|
38
|
+
"@wordpress/dom": "^3.3.1",
|
|
39
|
+
"@wordpress/element": "^4.1.1",
|
|
40
|
+
"@wordpress/hooks": "^3.3.1",
|
|
41
|
+
"@wordpress/i18n": "^4.3.1",
|
|
42
|
+
"@wordpress/icons": "^6.3.0",
|
|
43
|
+
"@wordpress/interface": "^4.2.1",
|
|
44
|
+
"@wordpress/keyboard-shortcuts": "^3.1.1",
|
|
45
|
+
"@wordpress/keycodes": "^3.3.1",
|
|
46
|
+
"@wordpress/media-utils": "^3.1.1",
|
|
47
|
+
"@wordpress/notices": "^3.3.1",
|
|
48
|
+
"@wordpress/plugins": "^4.1.1",
|
|
49
|
+
"@wordpress/reusable-blocks": "^3.1.1",
|
|
50
|
+
"@wordpress/url": "^3.4.1",
|
|
51
|
+
"@wordpress/widgets": "^2.1.1",
|
|
54
52
|
"classnames": "^2.3.1",
|
|
55
|
-
"lodash": "^4.17.21"
|
|
56
|
-
"rememo": "^3.0.0",
|
|
57
|
-
"uuid": "^8.3.0"
|
|
53
|
+
"lodash": "^4.17.21"
|
|
58
54
|
},
|
|
59
55
|
"publishConfig": {
|
|
60
56
|
"access": "public"
|
|
61
57
|
},
|
|
62
|
-
"gitHead": "
|
|
58
|
+
"gitHead": "2e4922861e49f5a090f9dc52056165092cfba163"
|
|
63
59
|
}
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
|
+
import { __, sprintf } from '@wordpress/i18n';
|
|
4
5
|
import { Popover } from '@wordpress/components';
|
|
6
|
+
import { useDispatch } from '@wordpress/data';
|
|
5
7
|
import { PluginArea } from '@wordpress/plugins';
|
|
8
|
+
import { store as noticesStore } from '@wordpress/notices';
|
|
6
9
|
|
|
7
10
|
/**
|
|
8
11
|
* Internal dependencies
|
|
@@ -15,6 +18,20 @@ import UnsavedChangesWarning from './unsaved-changes-warning';
|
|
|
15
18
|
import WelcomeGuide from '../welcome-guide';
|
|
16
19
|
|
|
17
20
|
function Layout( { blockEditorSettings, onError } ) {
|
|
21
|
+
const { createErrorNotice } = useDispatch( noticesStore );
|
|
22
|
+
|
|
23
|
+
function onPluginAreaError( name ) {
|
|
24
|
+
createErrorNotice(
|
|
25
|
+
sprintf(
|
|
26
|
+
/* translators: %s: plugin name */
|
|
27
|
+
__(
|
|
28
|
+
'The "%s" plugin has encountered an error and cannot be rendered.'
|
|
29
|
+
),
|
|
30
|
+
name
|
|
31
|
+
)
|
|
32
|
+
);
|
|
33
|
+
}
|
|
34
|
+
|
|
18
35
|
return (
|
|
19
36
|
<ErrorBoundary onError={ onError }>
|
|
20
37
|
<WidgetAreasBlockEditorProvider
|
|
@@ -23,7 +40,7 @@ function Layout( { blockEditorSettings, onError } ) {
|
|
|
23
40
|
<Interface blockEditorSettings={ blockEditorSettings } />
|
|
24
41
|
<Sidebar />
|
|
25
42
|
<Popover.Slot />
|
|
26
|
-
<PluginArea />
|
|
43
|
+
<PluginArea onError={ onPluginAreaError } />
|
|
27
44
|
<UnsavedChangesWarning />
|
|
28
45
|
<WelcomeGuide />
|
|
29
46
|
</WidgetAreasBlockEditorProvider>
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
4
|
import { useViewportMatch } from '@wordpress/compose';
|
|
5
|
-
import { BlockBreadcrumb } from '@wordpress/block-editor';
|
|
5
|
+
import { BlockBreadcrumb, BlockStyles } from '@wordpress/block-editor';
|
|
6
6
|
import { useEffect } from '@wordpress/element';
|
|
7
7
|
import { useDispatch, useSelect } from '@wordpress/data';
|
|
8
8
|
import {
|
|
@@ -96,9 +96,12 @@ function Interface( { blockEditorSettings } ) {
|
|
|
96
96
|
)
|
|
97
97
|
}
|
|
98
98
|
content={
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
99
|
+
<>
|
|
100
|
+
<WidgetAreasBlockEditorContent
|
|
101
|
+
blockEditorSettings={ blockEditorSettings }
|
|
102
|
+
/>
|
|
103
|
+
<BlockStyles.Slot scope="core/block-inspector" />
|
|
104
|
+
</>
|
|
102
105
|
}
|
|
103
106
|
footer={
|
|
104
107
|
hasBlockBreadCrumbsEnabled &&
|
|
@@ -14,6 +14,7 @@ import { useViewportMatch } from '@wordpress/compose';
|
|
|
14
14
|
* Internal dependencies
|
|
15
15
|
*/
|
|
16
16
|
import KeyboardShortcutHelpModal from '../keyboard-shortcut-help-modal';
|
|
17
|
+
import ToolsMoreMenuGroup from './tools-more-menu-group';
|
|
17
18
|
|
|
18
19
|
export default function MoreMenu() {
|
|
19
20
|
const [
|
|
@@ -33,7 +34,7 @@ export default function MoreMenu() {
|
|
|
33
34
|
return (
|
|
34
35
|
<>
|
|
35
36
|
<MoreMenuDropdown>
|
|
36
|
-
{ () => (
|
|
37
|
+
{ ( onClose ) => (
|
|
37
38
|
<>
|
|
38
39
|
{ isLargeViewport && (
|
|
39
40
|
<MenuGroup label={ _x( 'View', 'noun' ) }>
|
|
@@ -84,6 +85,9 @@ export default function MoreMenu() {
|
|
|
84
85
|
}
|
|
85
86
|
</VisuallyHidden>
|
|
86
87
|
</MenuItem>
|
|
88
|
+
<ToolsMoreMenuGroup.Slot
|
|
89
|
+
fillProps={ { onClose } }
|
|
90
|
+
/>
|
|
87
91
|
</MenuGroup>
|
|
88
92
|
<MenuGroup label={ __( 'Preferences' ) }>
|
|
89
93
|
<MoreMenuFeatureToggle
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* External dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { isEmpty } from 'lodash';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* WordPress dependencies
|
|
8
|
+
*/
|
|
9
|
+
import { createSlotFill } from '@wordpress/components';
|
|
10
|
+
|
|
11
|
+
const { Fill: ToolsMoreMenuGroup, Slot } = createSlotFill(
|
|
12
|
+
'EditWidgetsToolsMoreMenuGroup'
|
|
13
|
+
);
|
|
14
|
+
|
|
15
|
+
ToolsMoreMenuGroup.Slot = ( { fillProps } ) => (
|
|
16
|
+
<Slot fillProps={ fillProps }>
|
|
17
|
+
{ ( fills ) => ! isEmpty( fills ) && fills }
|
|
18
|
+
</Slot>
|
|
19
|
+
);
|
|
20
|
+
|
|
21
|
+
export default ToolsMoreMenuGroup;
|
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
|
-
import { Button } from '@wordpress/components';
|
|
4
|
+
import { Button, VisuallyHidden } from '@wordpress/components';
|
|
5
5
|
import { close } from '@wordpress/icons';
|
|
6
6
|
import { __experimentalLibrary as Library } from '@wordpress/block-editor';
|
|
7
7
|
import {
|
|
8
8
|
useViewportMatch,
|
|
9
9
|
__experimentalUseDialog as useDialog,
|
|
10
10
|
} from '@wordpress/compose';
|
|
11
|
-
import { useCallback } from '@wordpress/element';
|
|
11
|
+
import { useCallback, useEffect, useRef } from '@wordpress/element';
|
|
12
12
|
import { useDispatch } from '@wordpress/data';
|
|
13
|
+
import { __ } from '@wordpress/i18n';
|
|
13
14
|
|
|
14
15
|
/**
|
|
15
16
|
* Internal dependencies
|
|
@@ -24,28 +25,40 @@ export default function InserterSidebar() {
|
|
|
24
25
|
const { setIsInserterOpened } = useDispatch( editWidgetsStore );
|
|
25
26
|
|
|
26
27
|
const closeInserter = useCallback( () => {
|
|
27
|
-
return
|
|
28
|
+
return setIsInserterOpened( false );
|
|
28
29
|
}, [ setIsInserterOpened ] );
|
|
29
30
|
|
|
31
|
+
const TagName = ! isMobileViewport ? VisuallyHidden : 'div';
|
|
30
32
|
const [ inserterDialogRef, inserterDialogProps ] = useDialog( {
|
|
31
33
|
onClose: closeInserter,
|
|
34
|
+
focusOnMount: null,
|
|
32
35
|
} );
|
|
33
36
|
|
|
37
|
+
const libraryRef = useRef();
|
|
38
|
+
useEffect( () => {
|
|
39
|
+
libraryRef.current.focusSearch();
|
|
40
|
+
}, [] );
|
|
41
|
+
|
|
34
42
|
return (
|
|
35
43
|
<div
|
|
36
44
|
ref={ inserterDialogRef }
|
|
37
45
|
{ ...inserterDialogProps }
|
|
38
46
|
className="edit-widgets-layout__inserter-panel"
|
|
39
47
|
>
|
|
40
|
-
<
|
|
41
|
-
<Button
|
|
42
|
-
|
|
48
|
+
<TagName className="edit-widgets-layout__inserter-panel-header">
|
|
49
|
+
<Button
|
|
50
|
+
icon={ close }
|
|
51
|
+
onClick={ closeInserter }
|
|
52
|
+
label={ __( 'Close block inserter' ) }
|
|
53
|
+
/>
|
|
54
|
+
</TagName>
|
|
43
55
|
<div className="edit-widgets-layout__inserter-panel-content">
|
|
44
56
|
<Library
|
|
45
57
|
showInserterHelpPanel
|
|
46
58
|
shouldFocusBlock={ isMobileViewport }
|
|
47
59
|
rootClientId={ rootClientId }
|
|
48
60
|
__experimentalInsertionIndex={ insertionIndex }
|
|
61
|
+
ref={ libraryRef }
|
|
49
62
|
/>
|
|
50
63
|
</div>
|
|
51
64
|
</div>
|
|
@@ -32,7 +32,8 @@ export default function ListViewSidebar() {
|
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
const focusOnMountRef = useFocusOnMount( 'firstElement' );
|
|
35
|
-
const
|
|
35
|
+
const headerFocusReturnRef = useFocusReturn();
|
|
36
|
+
const contentFocusReturnRef = useFocusReturn();
|
|
36
37
|
function closeOnEscape( event ) {
|
|
37
38
|
if ( event.keyCode === ESCAPE && ! event.defaultPrevented ) {
|
|
38
39
|
event.preventDefault();
|
|
@@ -50,17 +51,23 @@ export default function ListViewSidebar() {
|
|
|
50
51
|
className="edit-widgets-editor__list-view-panel"
|
|
51
52
|
onKeyDown={ closeOnEscape }
|
|
52
53
|
>
|
|
53
|
-
<div
|
|
54
|
-
|
|
54
|
+
<div
|
|
55
|
+
className="edit-widgets-editor__list-view-panel-header"
|
|
56
|
+
ref={ headerFocusReturnRef }
|
|
57
|
+
>
|
|
58
|
+
<strong id={ labelId }>{ __( 'List View' ) }</strong>
|
|
55
59
|
<Button
|
|
56
60
|
icon={ closeSmall }
|
|
57
|
-
label={ __( 'Close
|
|
61
|
+
label={ __( 'Close List View Sidebar' ) }
|
|
58
62
|
onClick={ () => setIsListViewOpened( false ) }
|
|
59
63
|
/>
|
|
60
64
|
</div>
|
|
61
65
|
<div
|
|
62
66
|
className="edit-widgets-editor__list-view-panel-content"
|
|
63
|
-
ref={ useMergeRefs( [
|
|
67
|
+
ref={ useMergeRefs( [
|
|
68
|
+
contentFocusReturnRef,
|
|
69
|
+
focusOnMountRef,
|
|
70
|
+
] ) }
|
|
64
71
|
>
|
|
65
72
|
<ListView
|
|
66
73
|
onSelect={ selectEditorBlock }
|