@wordpress/edit-widgets 5.25.0 → 5.26.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/LICENSE.md +1 -1
- package/build/blocks/widget-area/index.js +1 -0
- package/build/blocks/widget-area/index.js.map +1 -1
- package/build/components/header/document-tools/index.js +12 -16
- package/build/components/header/document-tools/index.js.map +1 -1
- package/build/components/header/index.js +2 -6
- package/build/components/header/index.js.map +1 -1
- package/build/components/layout/interface.js +2 -7
- package/build/components/layout/interface.js.map +1 -1
- package/build/components/secondary-sidebar/index.js +2 -6
- package/build/components/secondary-sidebar/index.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/store/index.js +3 -0
- package/build/store/index.js.map +1 -1
- package/build/store/private-selectors.js +10 -0
- package/build/store/private-selectors.js.map +1 -0
- package/build/store/reducer.js +14 -0
- package/build/store/reducer.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/header/document-tools/index.js +12 -16
- package/build-module/components/header/document-tools/index.js.map +1 -1
- package/build-module/components/header/index.js +2 -6
- package/build-module/components/header/index.js.map +1 -1
- package/build-module/components/layout/interface.js +3 -8
- package/build-module/components/layout/interface.js.map +1 -1
- package/build-module/components/secondary-sidebar/index.js +2 -6
- package/build-module/components/secondary-sidebar/index.js.map +1 -1
- package/build-module/components/secondary-sidebar/list-view-sidebar.js +8 -6
- package/build-module/components/secondary-sidebar/list-view-sidebar.js.map +1 -1
- package/build-module/store/index.js +3 -0
- package/build-module/store/index.js.map +1 -1
- package/build-module/store/private-selectors.js +4 -0
- package/build-module/store/private-selectors.js.map +1 -0
- package/build-module/store/reducer.js +13 -0
- package/build-module/store/reducer.js.map +1 -1
- package/build-style/style-rtl.css +4 -0
- package/build-style/style.css +4 -0
- package/package.json +30 -29
- package/src/blocks/widget-area/block.json +1 -0
- package/src/components/header/document-tools/index.js +16 -21
- package/src/components/header/index.js +2 -4
- package/src/components/layout/interface.js +3 -14
- package/src/components/secondary-sidebar/index.js +2 -4
- package/src/components/secondary-sidebar/list-view-sidebar.js +6 -4
- package/src/store/index.js +4 -0
- package/src/store/private-selectors.js +3 -0
- package/src/store/reducer.js +11 -0
package/CHANGELOG.md
CHANGED
package/LICENSE.md
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_i18n","require","_edit","_interopRequireDefault","metadata","name","category","attributes","id","type","supports","html","inserter","customClassName","reusable","__experimentalToolbar","__experimentalParentSelector","__experimentalDisableBlockOverlay","editorStyle","style","exports","settings","title","__","description","__experimentalLabel","label","edit"],"sources":["@wordpress/edit-widgets/src/blocks/widget-area/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport metadata from './block.json';\nimport edit from './edit';\n\nconst { name } = metadata;\nexport { metadata, name };\n\nexport const settings = {\n\ttitle: __( 'Widget Area' ),\n\tdescription: __( 'A widget area container.' ),\n\t__experimentalLabel: ( { name: label } ) => label,\n\tedit,\n};\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AAMA,IAAAC,KAAA,GAAAC,sBAAA,CAAAF,OAAA;AATA;AACA;AACA;AAGA;AACA;AACA;AAFA,MAAAG,QAAA;EAAAC,IAAA;EAAAC,QAAA;EAAAC,UAAA;IAAAC,EAAA;MAAAC,IAAA;IAAA;IAAAJ,IAAA;MAAAI,IAAA;IAAA;EAAA;EAAAC,QAAA;IAAAC,IAAA;IAAAC,QAAA;IAAAC,eAAA;IAAAC,QAAA;IAAAC,qBAAA;IAAAC,4BAAA;IAAAC,iCAAA;EAAA;EAAAC,WAAA;EAAAC,KAAA;AAAA;AAAAC,OAAA,
|
|
1
|
+
{"version":3,"names":["_i18n","require","_edit","_interopRequireDefault","metadata","$schema","name","category","attributes","id","type","supports","html","inserter","customClassName","reusable","__experimentalToolbar","__experimentalParentSelector","__experimentalDisableBlockOverlay","editorStyle","style","exports","settings","title","__","description","__experimentalLabel","label","edit"],"sources":["@wordpress/edit-widgets/src/blocks/widget-area/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport metadata from './block.json';\nimport edit from './edit';\n\nconst { name } = metadata;\nexport { metadata, name };\n\nexport const settings = {\n\ttitle: __( 'Widget Area' ),\n\tdescription: __( 'A widget area container.' ),\n\t__experimentalLabel: ( { name: label } ) => label,\n\tedit,\n};\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AAMA,IAAAC,KAAA,GAAAC,sBAAA,CAAAF,OAAA;AATA;AACA;AACA;AAGA;AACA;AACA;AAFA,MAAAG,QAAA;EAAAC,OAAA;EAAAC,IAAA;EAAAC,QAAA;EAAAC,UAAA;IAAAC,EAAA;MAAAC,IAAA;IAAA;IAAAJ,IAAA;MAAAI,IAAA;IAAA;EAAA;EAAAC,QAAA;IAAAC,IAAA;IAAAC,QAAA;IAAAC,eAAA;IAAAC,QAAA;IAAAC,qBAAA;IAAAC,4BAAA;IAAAC,iCAAA;EAAA;EAAAC,WAAA;EAAAC,KAAA;AAAA;AAAAC,OAAA,CAAAjB,QAAA,GAAAA,QAAA;AAMA,MAAM;EAAEE;AAAK,CAAC,GAAGF,QAAQ;AAACiB,OAAA,CAAAf,IAAA,GAAAA,IAAA;AAGnB,MAAMgB,QAAQ,GAAG;EACvBC,KAAK,EAAE,IAAAC,QAAE,EAAE,aAAc,CAAC;EAC1BC,WAAW,EAAE,IAAAD,QAAE,EAAE,0BAA2B,CAAC;EAC7CE,mBAAmB,EAAEA,CAAE;IAAEpB,IAAI,EAAEqB;EAAM,CAAC,KAAMA,KAAK;EACjDC,IAAI,EAAJA;AACD,CAAC;AAACP,OAAA,CAAAC,QAAA,GAAAA,QAAA"}
|
|
@@ -27,26 +27,27 @@ var _lockUnlock = require("../../../lock-unlock");
|
|
|
27
27
|
*/
|
|
28
28
|
|
|
29
29
|
const {
|
|
30
|
-
|
|
30
|
+
useCanBlockToolbarBeFocused
|
|
31
31
|
} = (0, _lockUnlock.unlock)(_blockEditor.privateApis);
|
|
32
|
-
function DocumentTools({
|
|
33
|
-
setListViewToggleElement
|
|
34
|
-
}) {
|
|
32
|
+
function DocumentTools() {
|
|
35
33
|
const isMediumViewport = (0, _compose.useViewportMatch)('medium');
|
|
36
34
|
const inserterButton = (0, _element.useRef)();
|
|
37
35
|
const widgetAreaClientId = (0, _useLastSelectedWidgetArea.default)();
|
|
38
36
|
const isLastSelectedWidgetAreaOpen = (0, _data.useSelect)(select => select(_store.store).getIsWidgetAreaOpen(widgetAreaClientId), [widgetAreaClientId]);
|
|
39
37
|
const {
|
|
40
38
|
isInserterOpen,
|
|
41
|
-
isListViewOpen
|
|
39
|
+
isListViewOpen,
|
|
40
|
+
listViewToggleRef
|
|
42
41
|
} = (0, _data.useSelect)(select => {
|
|
43
42
|
const {
|
|
44
43
|
isInserterOpened,
|
|
45
|
-
isListViewOpened
|
|
46
|
-
|
|
44
|
+
isListViewOpened,
|
|
45
|
+
getListViewToggleRef
|
|
46
|
+
} = (0, _lockUnlock.unlock)(select(_store.store));
|
|
47
47
|
return {
|
|
48
48
|
isInserterOpen: isInserterOpened(),
|
|
49
|
-
isListViewOpen: isListViewOpened()
|
|
49
|
+
isListViewOpen: isListViewOpened(),
|
|
50
|
+
listViewToggleRef: getListViewToggleRef()
|
|
50
51
|
};
|
|
51
52
|
}, []);
|
|
52
53
|
const {
|
|
@@ -77,14 +78,9 @@ function DocumentTools({
|
|
|
77
78
|
}
|
|
78
79
|
};
|
|
79
80
|
const toggleListView = (0, _element.useCallback)(() => setIsListViewOpened(!isListViewOpen), [setIsListViewOpened, isListViewOpen]);
|
|
80
|
-
|
|
81
|
-
shouldShowContextualToolbar,
|
|
82
|
-
canFocusHiddenToolbar,
|
|
83
|
-
fixedToolbarCanBeFocused
|
|
84
|
-
} = useShouldContextualToolbarShow();
|
|
81
|
+
|
|
85
82
|
// If there's a block toolbar to be focused, disable the focus shortcut for the document toolbar.
|
|
86
|
-
|
|
87
|
-
const blockToolbarCanBeFocused = shouldShowContextualToolbar || canFocusHiddenToolbar || fixedToolbarCanBeFocused;
|
|
83
|
+
const blockToolbarCanBeFocused = useCanBlockToolbarBeFocused();
|
|
88
84
|
return (0, _react.createElement)(_blockEditor.NavigableToolbar, {
|
|
89
85
|
className: "edit-widgets-header-toolbar",
|
|
90
86
|
"aria-label": (0, _i18n.__)('Document tools'),
|
|
@@ -111,7 +107,7 @@ function DocumentTools({
|
|
|
111
107
|
/* translators: button label text should, if possible, be under 16 characters. */,
|
|
112
108
|
label: (0, _i18n.__)('List View'),
|
|
113
109
|
onClick: toggleListView,
|
|
114
|
-
ref:
|
|
110
|
+
ref: listViewToggleRef
|
|
115
111
|
})));
|
|
116
112
|
}
|
|
117
113
|
var _default = DocumentTools;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_data","require","_i18n","_components","_blockEditor","_icons","_element","_compose","_undo","_interopRequireDefault","_redo","_useLastSelectedWidgetArea","_store","_lockUnlock","
|
|
1
|
+
{"version":3,"names":["_data","require","_i18n","_components","_blockEditor","_icons","_element","_compose","_undo","_interopRequireDefault","_redo","_useLastSelectedWidgetArea","_store","_lockUnlock","useCanBlockToolbarBeFocused","unlock","blockEditorPrivateApis","DocumentTools","isMediumViewport","useViewportMatch","inserterButton","useRef","widgetAreaClientId","useLastSelectedWidgetArea","isLastSelectedWidgetAreaOpen","useSelect","select","editWidgetsStore","getIsWidgetAreaOpen","isInserterOpen","isListViewOpen","listViewToggleRef","isInserterOpened","isListViewOpened","getListViewToggleRef","setIsWidgetAreaOpen","setIsInserterOpened","setIsListViewOpened","useDispatch","selectBlock","blockEditorStore","handleClick","window","requestAnimationFrame","toggleListView","useCallback","blockToolbarCanBeFocused","_react","createElement","NavigableToolbar","className","__","shouldUseKeyboardFocusShortcut","ToolbarItem","ref","as","Button","variant","isPressed","onMouseDown","event","preventDefault","onClick","icon","plus","label","_x","Fragment","default","listView","_default","exports"],"sources":["@wordpress/edit-widgets/src/components/header/document-tools/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { __, _x } from '@wordpress/i18n';\nimport { Button, ToolbarItem } from '@wordpress/components';\nimport {\n\tNavigableToolbar,\n\tstore as blockEditorStore,\n\tprivateApis as blockEditorPrivateApis,\n} from '@wordpress/block-editor';\nimport { listView, plus } from '@wordpress/icons';\nimport { useCallback, useRef } from '@wordpress/element';\nimport { useViewportMatch } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport UndoButton from '../undo-redo/undo';\nimport RedoButton from '../undo-redo/redo';\nimport useLastSelectedWidgetArea from '../../../hooks/use-last-selected-widget-area';\nimport { store as editWidgetsStore } from '../../../store';\nimport { unlock } from '../../../lock-unlock';\n\nconst { useCanBlockToolbarBeFocused } = unlock( blockEditorPrivateApis );\n\nfunction DocumentTools() {\n\tconst isMediumViewport = useViewportMatch( 'medium' );\n\tconst inserterButton = useRef();\n\tconst widgetAreaClientId = useLastSelectedWidgetArea();\n\tconst isLastSelectedWidgetAreaOpen = useSelect(\n\t\t( select ) =>\n\t\t\tselect( editWidgetsStore ).getIsWidgetAreaOpen(\n\t\t\t\twidgetAreaClientId\n\t\t\t),\n\t\t[ widgetAreaClientId ]\n\t);\n\tconst { isInserterOpen, isListViewOpen, listViewToggleRef } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { isInserterOpened, isListViewOpened, getListViewToggleRef } =\n\t\t\t\tunlock( select( editWidgetsStore ) );\n\t\t\treturn {\n\t\t\t\tisInserterOpen: isInserterOpened(),\n\t\t\t\tisListViewOpen: isListViewOpened(),\n\t\t\t\tlistViewToggleRef: getListViewToggleRef(),\n\t\t\t};\n\t\t},\n\t\t[]\n\t);\n\tconst { setIsWidgetAreaOpen, setIsInserterOpened, setIsListViewOpened } =\n\t\tuseDispatch( editWidgetsStore );\n\tconst { selectBlock } = useDispatch( blockEditorStore );\n\tconst handleClick = () => {\n\t\tif ( isInserterOpen ) {\n\t\t\t// Focusing the inserter button closes the inserter popover.\n\t\t\tsetIsInserterOpened( false );\n\t\t} else {\n\t\t\tif ( ! isLastSelectedWidgetAreaOpen ) {\n\t\t\t\t// Select the last selected block if hasn't already.\n\t\t\t\tselectBlock( widgetAreaClientId );\n\t\t\t\t// Open the last selected widget area when opening the inserter.\n\t\t\t\tsetIsWidgetAreaOpen( widgetAreaClientId, true );\n\t\t\t}\n\t\t\t// The DOM updates resulting from selectBlock() and setIsInserterOpened() calls are applied the\n\t\t\t// same tick and pretty much in a random order. The inserter is closed if any other part of the\n\t\t\t// app receives focus. If selectBlock() happens to take effect after setIsInserterOpened() then\n\t\t\t// the inserter is visible for a brief moment and then gets auto-closed due to focus moving to\n\t\t\t// the selected block.\n\t\t\twindow.requestAnimationFrame( () => setIsInserterOpened( true ) );\n\t\t}\n\t};\n\n\tconst toggleListView = useCallback(\n\t\t() => setIsListViewOpened( ! isListViewOpen ),\n\t\t[ setIsListViewOpened, isListViewOpen ]\n\t);\n\n\t// If there's a block toolbar to be focused, disable the focus shortcut for the document toolbar.\n\tconst blockToolbarCanBeFocused = useCanBlockToolbarBeFocused();\n\n\treturn (\n\t\t<NavigableToolbar\n\t\t\tclassName=\"edit-widgets-header-toolbar\"\n\t\t\taria-label={ __( 'Document tools' ) }\n\t\t\tshouldUseKeyboardFocusShortcut={ ! blockToolbarCanBeFocused }\n\t\t>\n\t\t\t<ToolbarItem\n\t\t\t\tref={ inserterButton }\n\t\t\t\tas={ Button }\n\t\t\t\tclassName=\"edit-widgets-header-toolbar__inserter-toggle\"\n\t\t\t\tvariant=\"primary\"\n\t\t\t\tisPressed={ isInserterOpen }\n\t\t\t\tonMouseDown={ ( event ) => {\n\t\t\t\t\tevent.preventDefault();\n\t\t\t\t} }\n\t\t\t\tonClick={ handleClick }\n\t\t\t\ticon={ plus }\n\t\t\t\t/* translators: button label text should, if possible, be under 16\n\t\t\t\t\tcharacters. */\n\t\t\t\tlabel={ _x(\n\t\t\t\t\t'Toggle block inserter',\n\t\t\t\t\t'Generic label for block inserter button'\n\t\t\t\t) }\n\t\t\t/>\n\t\t\t{ isMediumViewport && (\n\t\t\t\t<>\n\t\t\t\t\t<UndoButton />\n\t\t\t\t\t<RedoButton />\n\t\t\t\t\t<ToolbarItem\n\t\t\t\t\t\tas={ Button }\n\t\t\t\t\t\tclassName=\"edit-widgets-header-toolbar__list-view-toggle\"\n\t\t\t\t\t\ticon={ listView }\n\t\t\t\t\t\tisPressed={ isListViewOpen }\n\t\t\t\t\t\t/* translators: button label text should, if possible, be under 16 characters. */\n\t\t\t\t\t\tlabel={ __( 'List View' ) }\n\t\t\t\t\t\tonClick={ toggleListView }\n\t\t\t\t\t\tref={ listViewToggleRef }\n\t\t\t\t\t/>\n\t\t\t\t</>\n\t\t\t) }\n\t\t</NavigableToolbar>\n\t);\n}\n\nexport default DocumentTools;\n"],"mappings":";;;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AACA,IAAAG,YAAA,GAAAH,OAAA;AAKA,IAAAI,MAAA,GAAAJ,OAAA;AACA,IAAAK,QAAA,GAAAL,OAAA;AACA,IAAAM,QAAA,GAAAN,OAAA;AAKA,IAAAO,KAAA,GAAAC,sBAAA,CAAAR,OAAA;AACA,IAAAS,KAAA,GAAAD,sBAAA,CAAAR,OAAA;AACA,IAAAU,0BAAA,GAAAF,sBAAA,CAAAR,OAAA;AACA,IAAAW,MAAA,GAAAX,OAAA;AACA,IAAAY,WAAA,GAAAZ,OAAA;AAtBA;AACA;AACA;;AAaA;AACA;AACA;;AAOA,MAAM;EAAEa;AAA4B,CAAC,GAAG,IAAAC,kBAAM,EAA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AU;IACjBX,SAAS,EAAG5B;IACZ;IACAmC,KAAK,EAAG,IAAAd,QAAE,EAAE,WAAY,CAAG;IAC3BW,OAAO,EAAGlB,cAAgB;IAC1BU,GAAG,EAAGvB;EAAmB,CACzB,CACA,CAEc,CAAC;AAErB;AAAC,IAAAuC,QAAA,GAEcrD,aAAa;AAAAsD,OAAA,CAAAH,OAAA,GAAAE,QAAA"}
|
|
@@ -25,9 +25,7 @@ var _moreMenu = _interopRequireDefault(require("../more-menu"));
|
|
|
25
25
|
* Internal dependencies
|
|
26
26
|
*/
|
|
27
27
|
|
|
28
|
-
function Header({
|
|
29
|
-
setListViewToggleElement
|
|
30
|
-
}) {
|
|
28
|
+
function Header() {
|
|
31
29
|
const isLargeViewport = (0, _compose.useViewportMatch)('medium');
|
|
32
30
|
const blockToolbarRef = (0, _element.useRef)();
|
|
33
31
|
const {
|
|
@@ -44,9 +42,7 @@ function Header({
|
|
|
44
42
|
}, (0, _i18n.__)('Widgets')), !isLargeViewport && (0, _react.createElement)(_components.VisuallyHidden, {
|
|
45
43
|
as: "h1",
|
|
46
44
|
className: "edit-widgets-header__title"
|
|
47
|
-
}, (0, _i18n.__)('Widgets')), (0, _react.createElement)(_documentTools.default, {
|
|
48
|
-
setListViewToggleElement: setListViewToggleElement
|
|
49
|
-
}), hasFixedToolbar && isLargeViewport && (0, _react.createElement)(_react.Fragment, null, (0, _react.createElement)("div", {
|
|
45
|
+
}, (0, _i18n.__)('Widgets')), (0, _react.createElement)(_documentTools.default, null), hasFixedToolbar && isLargeViewport && (0, _react.createElement)(_react.Fragment, null, (0, _react.createElement)("div", {
|
|
50
46
|
className: "selected-block-tools-wrapper"
|
|
51
47
|
}, (0, _react.createElement)(_blockEditor.BlockToolbar, {
|
|
52
48
|
hideDragHandle: true
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_blockEditor","require","_data","_element","_i18n","_components","_interface","_compose","_preferences","_documentTools","_interopRequireDefault","_saveButton","_moreMenu","Header","
|
|
1
|
+
{"version":3,"names":["_blockEditor","require","_data","_element","_i18n","_components","_interface","_compose","_preferences","_documentTools","_interopRequireDefault","_saveButton","_moreMenu","Header","isLargeViewport","useViewportMatch","blockToolbarRef","useRef","hasFixedToolbar","useSelect","select","preferencesStore","get","_react","createElement","Fragment","className","__","VisuallyHidden","as","default","BlockToolbar","hideDragHandle","Popover","Slot","ref","name","PinnedItems","scope","_default","exports"],"sources":["@wordpress/edit-widgets/src/components/header/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { BlockToolbar } from '@wordpress/block-editor';\nimport { useSelect } from '@wordpress/data';\nimport { useRef } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport { Popover, VisuallyHidden } from '@wordpress/components';\nimport { PinnedItems } from '@wordpress/interface';\nimport { useViewportMatch } from '@wordpress/compose';\nimport { store as preferencesStore } from '@wordpress/preferences';\n\n/**\n * Internal dependencies\n */\nimport DocumentTools from './document-tools';\nimport SaveButton from '../save-button';\nimport MoreMenu from '../more-menu';\n\nfunction Header() {\n\tconst isLargeViewport = useViewportMatch( 'medium' );\n\tconst blockToolbarRef = useRef();\n\tconst { hasFixedToolbar } = useSelect(\n\t\t( select ) => ( {\n\t\t\thasFixedToolbar: !! select( preferencesStore ).get(\n\t\t\t\t'core/edit-widgets',\n\t\t\t\t'fixedToolbar'\n\t\t\t),\n\t\t} ),\n\t\t[]\n\t);\n\n\treturn (\n\t\t<>\n\t\t\t<div className=\"edit-widgets-header\">\n\t\t\t\t<div className=\"edit-widgets-header__navigable-toolbar-wrapper\">\n\t\t\t\t\t{ isLargeViewport && (\n\t\t\t\t\t\t<h1 className=\"edit-widgets-header__title\">\n\t\t\t\t\t\t\t{ __( 'Widgets' ) }\n\t\t\t\t\t\t</h1>\n\t\t\t\t\t) }\n\t\t\t\t\t{ ! isLargeViewport && (\n\t\t\t\t\t\t<VisuallyHidden\n\t\t\t\t\t\t\tas=\"h1\"\n\t\t\t\t\t\t\tclassName=\"edit-widgets-header__title\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Widgets' ) }\n\t\t\t\t\t\t</VisuallyHidden>\n\t\t\t\t\t) }\n\t\t\t\t\t<DocumentTools />\n\t\t\t\t\t{ hasFixedToolbar && isLargeViewport && (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<div className=\"selected-block-tools-wrapper\">\n\t\t\t\t\t\t\t\t<BlockToolbar hideDragHandle />\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t<Popover.Slot\n\t\t\t\t\t\t\t\tref={ blockToolbarRef }\n\t\t\t\t\t\t\t\tname=\"block-toolbar\"\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</>\n\t\t\t\t\t) }\n\t\t\t\t</div>\n\t\t\t\t<div className=\"edit-widgets-header__actions\">\n\t\t\t\t\t<SaveButton />\n\t\t\t\t\t<PinnedItems.Slot scope=\"core/edit-widgets\" />\n\t\t\t\t\t<MoreMenu />\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t</>\n\t);\n}\n\nexport default Header;\n"],"mappings":";;;;;;;;AAGA,IAAAA,YAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,KAAA,GAAAH,OAAA;AACA,IAAAI,WAAA,GAAAJ,OAAA;AACA,IAAAK,UAAA,GAAAL,OAAA;AACA,IAAAM,QAAA,GAAAN,OAAA;AACA,IAAAO,YAAA,GAAAP,OAAA;AAKA,IAAAQ,cAAA,GAAAC,sBAAA,CAAAT,OAAA;AACA,IAAAU,WAAA,GAAAD,sBAAA,CAAAT,OAAA;AACA,IAAAW,SAAA,GAAAF,sBAAA,CAAAT,OAAA;AAjBA;AACA;AACA;;AAUA;AACA;AACA;;AAKA,SAASY,MAAMA,CAAA,EAAG;EACjB,MAAMC,eAAe,GAAG,IAAAC,yBAAgB,EAAE,QAAS,CAAC;EACpD,MAAMC,eAAe,GAAG,IAAAC,e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aAAA,EAACb,WAAA,CAAAmB,OAAU,MAAE,CAAC,EACd,IAAAP,MAAA,CAAAC,aAAA,EAAClB,UAAA,CAAA+B,WAAW,CAACH,IAAI;IAACI,KAAK,EAAC;EAAmB,CAAE,CAAC,EAC9C,IAAAf,MAAA,CAAAC,aAAA,EAACZ,SAAA,CAAAkB,OAAQ,MAAE,CACP,CACD,CACJ,CAAC;AAEL;AAAC,IAAAS,QAAA,GAEc1B,MAAM;AAAA2B,OAAA,CAAAV,OAAA,GAAAS,QAAA"}
|
|
@@ -61,7 +61,6 @@ function Interface({
|
|
|
61
61
|
previousShortcut: select(_keyboardShortcuts.store).getAllShortcutKeyCombinations('core/edit-widgets/previous-region'),
|
|
62
62
|
nextShortcut: select(_keyboardShortcuts.store).getAllShortcutKeyCombinations('core/edit-widgets/next-region')
|
|
63
63
|
}), []);
|
|
64
|
-
const [listViewToggleElement, setListViewToggleElement] = (0, _element.useState)(null);
|
|
65
64
|
|
|
66
65
|
// Inserter and Sidebars are mutually exclusive
|
|
67
66
|
(0, _element.useEffect)(() => {
|
|
@@ -82,12 +81,8 @@ function Interface({
|
|
|
82
81
|
...interfaceLabels,
|
|
83
82
|
secondarySidebar: secondarySidebarLabel
|
|
84
83
|
},
|
|
85
|
-
header: (0, _react.createElement)(_header.default,
|
|
86
|
-
|
|
87
|
-
}),
|
|
88
|
-
secondarySidebar: hasSecondarySidebar && (0, _react.createElement)(_secondarySidebar.default, {
|
|
89
|
-
listViewToggleElement: listViewToggleElement
|
|
90
|
-
}),
|
|
84
|
+
header: (0, _react.createElement)(_header.default, null),
|
|
85
|
+
secondarySidebar: hasSecondarySidebar && (0, _react.createElement)(_secondarySidebar.default, null),
|
|
91
86
|
sidebar: hasSidebarEnabled && (0, _react.createElement)(_interface.ComplementaryArea.Slot, {
|
|
92
87
|
scope: "core/edit-widgets"
|
|
93
88
|
}),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_compose","require","_blockEditor","_element","_data","_interface","_i18n","_keyboardShortcuts","_preferences","_header","_interopRequireDefault","_widgetAreasBlockEditorContent","_store","_secondarySidebar","interfaceLabels","header","__","body","sidebar","footer","Interface","blockEditorSettings","isMobileViewport","useViewportMatch","isHugeViewport","setIsInserterOpened","setIsListViewOpened","closeGeneralSidebar","useDispatch","editWidgetsStore","hasBlockBreadCrumbsEnabled","hasSidebarEnabled","isInserterOpened","isListViewOpened","previousShortcut","nextShortcut","useSelect","select","interfaceStore","getActiveComplementaryArea","name","preferencesStore","get","keyboardShortcutsStore","getAllShortcutKeyCombinations","
|
|
1
|
+
{"version":3,"names":["_compose","require","_blockEditor","_element","_data","_interface","_i18n","_keyboardShortcuts","_preferences","_header","_interopRequireDefault","_widgetAreasBlockEditorContent","_store","_secondarySidebar","interfaceLabels","header","__","body","sidebar","footer","Interface","blockEditorSettings","isMobileViewport","useViewportMatch","isHugeViewport","setIsInserterOpened","setIsListViewOpened","closeGeneralSidebar","useDispatch","editWidgetsStore","hasBlockBreadCrumbsEnabled","hasSidebarEnabled","isInserterOpened","isListViewOpened","previousShortcut","nextShortcut","useSelect","select","interfaceStore","getActiveComplementaryArea","name","preferencesStore","get","keyboardShortcutsStore","getAllShortcutKeyCombinations","useEffect","secondarySidebarLabel","hasSecondarySidebar","_react","createElement","InterfaceSkeleton","labels","secondarySidebar","default","ComplementaryArea","Slot","scope","content","Fragment","className","BlockBreadcrumb","rootLabelText","shortcuts","previous","next","_default","exports"],"sources":["@wordpress/edit-widgets/src/components/layout/interface.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useViewportMatch } from '@wordpress/compose';\nimport { BlockBreadcrumb } from '@wordpress/block-editor';\nimport { useEffect } from '@wordpress/element';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport {\n\tInterfaceSkeleton,\n\tComplementaryArea,\n\tstore as interfaceStore,\n} from '@wordpress/interface';\nimport { __ } from '@wordpress/i18n';\nimport { store as keyboardShortcutsStore } from '@wordpress/keyboard-shortcuts';\nimport { store as preferencesStore } from '@wordpress/preferences';\n\n/**\n * Internal dependencies\n */\nimport Header from '../header';\nimport WidgetAreasBlockEditorContent from '../widget-areas-block-editor-content';\nimport { store as editWidgetsStore } from '../../store';\nimport SecondarySidebar from '../secondary-sidebar';\n\nconst interfaceLabels = {\n\t/* translators: accessibility text for the widgets screen top bar landmark region. */\n\theader: __( 'Widgets top bar' ),\n\t/* translators: accessibility text for the widgets screen content landmark region. */\n\tbody: __( 'Widgets and blocks' ),\n\t/* translators: accessibility text for the widgets screen settings landmark region. */\n\tsidebar: __( 'Widgets settings' ),\n\t/* translators: accessibility text for the widgets screen footer landmark region. */\n\tfooter: __( 'Widgets footer' ),\n};\n\nfunction Interface( { blockEditorSettings } ) {\n\tconst isMobileViewport = useViewportMatch( 'medium', '<' );\n\tconst isHugeViewport = useViewportMatch( 'huge', '>=' );\n\tconst { setIsInserterOpened, setIsListViewOpened, closeGeneralSidebar } =\n\t\tuseDispatch( editWidgetsStore );\n\tconst {\n\t\thasBlockBreadCrumbsEnabled,\n\t\thasSidebarEnabled,\n\t\tisInserterOpened,\n\t\tisListViewOpened,\n\t\tpreviousShortcut,\n\t\tnextShortcut,\n\t} = useSelect(\n\t\t( select ) => ( {\n\t\t\thasSidebarEnabled: !! select(\n\t\t\t\tinterfaceStore\n\t\t\t).getActiveComplementaryArea( editWidgetsStore.name ),\n\t\t\tisInserterOpened: !! select( editWidgetsStore ).isInserterOpened(),\n\t\t\tisListViewOpened: !! select( editWidgetsStore ).isListViewOpened(),\n\t\t\thasBlockBreadCrumbsEnabled: !! select( preferencesStore ).get(\n\t\t\t\t'core/edit-widgets',\n\t\t\t\t'showBlockBreadcrumbs'\n\t\t\t),\n\t\t\tpreviousShortcut: select(\n\t\t\t\tkeyboardShortcutsStore\n\t\t\t).getAllShortcutKeyCombinations(\n\t\t\t\t'core/edit-widgets/previous-region'\n\t\t\t),\n\t\t\tnextShortcut: select(\n\t\t\t\tkeyboardShortcutsStore\n\t\t\t).getAllShortcutKeyCombinations( 'core/edit-widgets/next-region' ),\n\t\t} ),\n\t\t[]\n\t);\n\n\t// Inserter and Sidebars are mutually exclusive\n\tuseEffect( () => {\n\t\tif ( hasSidebarEnabled && ! isHugeViewport ) {\n\t\t\tsetIsInserterOpened( false );\n\t\t\tsetIsListViewOpened( false );\n\t\t}\n\t}, [ hasSidebarEnabled, isHugeViewport ] );\n\n\tuseEffect( () => {\n\t\tif ( ( isInserterOpened || isListViewOpened ) && ! isHugeViewport ) {\n\t\t\tcloseGeneralSidebar();\n\t\t}\n\t}, [ isInserterOpened, isListViewOpened, isHugeViewport ] );\n\n\tconst secondarySidebarLabel = isListViewOpened\n\t\t? __( 'List View' )\n\t\t: __( 'Block Library' );\n\n\tconst hasSecondarySidebar = isListViewOpened || isInserterOpened;\n\n\treturn (\n\t\t<InterfaceSkeleton\n\t\t\tlabels={ {\n\t\t\t\t...interfaceLabels,\n\t\t\t\tsecondarySidebar: secondarySidebarLabel,\n\t\t\t} }\n\t\t\theader={ <Header /> }\n\t\t\tsecondarySidebar={ hasSecondarySidebar && <SecondarySidebar /> }\n\t\t\tsidebar={\n\t\t\t\thasSidebarEnabled && (\n\t\t\t\t\t<ComplementaryArea.Slot scope=\"core/edit-widgets\" />\n\t\t\t\t)\n\t\t\t}\n\t\t\tcontent={\n\t\t\t\t<>\n\t\t\t\t\t<WidgetAreasBlockEditorContent\n\t\t\t\t\t\tblockEditorSettings={ blockEditorSettings }\n\t\t\t\t\t/>\n\t\t\t\t</>\n\t\t\t}\n\t\t\tfooter={\n\t\t\t\thasBlockBreadCrumbsEnabled &&\n\t\t\t\t! isMobileViewport && (\n\t\t\t\t\t<div className=\"edit-widgets-layout__footer\">\n\t\t\t\t\t\t<BlockBreadcrumb rootLabelText={ __( 'Widgets' ) } />\n\t\t\t\t\t</div>\n\t\t\t\t)\n\t\t\t}\n\t\t\tshortcuts={ {\n\t\t\t\tprevious: previousShortcut,\n\t\t\t\tnext: nextShortcut,\n\t\t\t} }\n\t\t/>\n\t);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C,MAAM,EAAG;MACR,GAAGrC,eAAe;MAClBsC,gBAAgB,EAAEN;IACnB,CAAG;IACH/B,MAAM,EAAG,IAAAiC,MAAA,CAAAC,aAAA,EAACxC,OAAA,CAAA4C,OAAM,MAAE,CAAG;IACrBD,gBAAgB,EAAGL,mBAAmB,IAAI,IAAAC,MAAA,CAAAC,aAAA,EAACpC,iBAAA,CAAAwC,OAAgB,MAAE,CAAG;IAChEnC,OAAO,EACNa,iBAAiB,IAChB,IAAAiB,MAAA,CAAAC,aAAA,EAAC5C,UAAA,CAAAiD,iBAAiB,CAACC,IAAI;MAACC,KAAK,EAAC;IAAmB,CAAE,CAEpD;IACDC,OAAO,EACN,IAAAT,MAAA,CAAAC,aAAA,EAAAD,MAAA,CAAAU,QAAA,QACC,IAAAV,MAAA,CAAAC,aAAA,EAACtC,8BAAA,CAAA0C,OAA6B;MAC7BhC,mBAAmB,EAAGA;IAAqB,CAC3C,CACA,CACF;IACDF,MAAM,EACLW,0BAA0B,IAC1B,CAAER,gBAAgB,IACjB,IAAA0B,MAAA,CAAAC,aAAA;MAAKU,SAAS,EAAC;IAA6B,GAC3C,IAAAX,MAAA,CAAAC,aAAA,EAAC/C,YAAA,CAAA0D,eAAe;MAACC,aAAa,EAAG,IAAA7C,QAAE,EAAE,SAAU;IAAG,CAAE,CAChD,CAEN;IACD8C,SAAS,EAAG;MACXC,QAAQ,EAAE7B,gBAAgB;MAC1B8B,IAAI,EAAE7B;IACP;EAAG,CACH,CAAC;AAEJ;AAAC,IAAA8B,QAAA,GAEc7C,SAAS;AAAA8C,OAAA,CAAAb,OAAA,GAAAY,QAAA"}
|
|
@@ -22,9 +22,7 @@ var _listViewSidebar = _interopRequireDefault(require("./list-view-sidebar"));
|
|
|
22
22
|
* Internal dependencies
|
|
23
23
|
*/
|
|
24
24
|
|
|
25
|
-
function SecondarySidebar({
|
|
26
|
-
listViewToggleElement
|
|
27
|
-
}) {
|
|
25
|
+
function SecondarySidebar() {
|
|
28
26
|
const {
|
|
29
27
|
isInserterOpen,
|
|
30
28
|
isListViewOpen
|
|
@@ -42,9 +40,7 @@ function SecondarySidebar({
|
|
|
42
40
|
return (0, _react.createElement)(_inserterSidebar.default, null);
|
|
43
41
|
}
|
|
44
42
|
if (isListViewOpen) {
|
|
45
|
-
return (0, _react.createElement)(_listViewSidebar.default,
|
|
46
|
-
listViewToggleElement: listViewToggleElement
|
|
47
|
-
});
|
|
43
|
+
return (0, _react.createElement)(_listViewSidebar.default, null);
|
|
48
44
|
}
|
|
49
45
|
return null;
|
|
50
46
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_data","require","_store","_inserterSidebar","_interopRequireDefault","_listViewSidebar","SecondarySidebar","
|
|
1
|
+
{"version":3,"names":["_data","require","_store","_inserterSidebar","_interopRequireDefault","_listViewSidebar","SecondarySidebar","isInserterOpen","isListViewOpen","useSelect","select","isInserterOpened","isListViewOpened","editWidgetsStore","_react","createElement","default"],"sources":["@wordpress/edit-widgets/src/components/secondary-sidebar/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\n/**\n * Internal dependencies\n */\nimport { store as editWidgetsStore } from '../../store';\n\n/**\n * Internal dependencies\n */\nimport InserterSidebar from './inserter-sidebar';\nimport ListViewSidebar from './list-view-sidebar';\n\nexport default function SecondarySidebar() {\n\tconst { isInserterOpen, isListViewOpen } = useSelect( ( select ) => {\n\t\tconst { isInserterOpened, isListViewOpened } =\n\t\t\tselect( editWidgetsStore );\n\t\treturn {\n\t\t\tisInserterOpen: isInserterOpened(),\n\t\t\tisListViewOpen: isListViewOpened(),\n\t\t};\n\t}, [] );\n\n\tif ( isInserterOpen ) {\n\t\treturn <InserterSidebar />;\n\t}\n\tif ( isListViewOpen ) {\n\t\treturn <ListViewSidebar />;\n\t}\n\treturn null;\n}\n"],"mappings":";;;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AAIA,IAAAC,MAAA,GAAAD,OAAA;AAKA,IAAAE,gBAAA,GAAAC,sBAAA,CAAAH,OAAA;AACA,IAAAI,gBAAA,GAAAD,sBAAA,CAAAH,OAAA;AAbA;AACA;AACA;;AAEA;AACA;AACA;;AAGA;AACA;AACA;;AAIe,SAASK,gBAAgBA,CAAA,EAAG;EAC1C,MAAM;IAAEC,cAAc;IAAEC;EAAe,CAAC,GAAG,IAAAC,eAAS,EAAIC,MAAM,IAAM;IACnE,MAAM;MAAEC,gBAAgB;MAAEC;IAAiB,CAAC,GAC3CF,MAAM,CAAEG,YAAiB,CAAC;IAC3B,OAAO;MACNN,cAAc,EAAEI,gBAAgB,CAAC,CAAC;MAClCH,cAAc,EAAEI,gBAAgB,CAAC;IAClC,CAAC;EACF,CAAC,EAAE,EAAG,CAAC;EAEP,IAAKL,cAAc,EAAG;IACrB,OAAO,IAAAO,MAAA,CAAAC,aAAA,EAACZ,gBAAA,CAAAa,OAAe,MAAE,CAAC;EAC3B;EACA,IAAKR,cAAc,EAAG;IACrB,OAAO,IAAAM,MAAA,CAAAC,aAAA,EAACV,gBAAA,CAAAW,OAAe,MAAE,CAAC;EAC3B;EACA,OAAO,IAAI;AACZ"}
|
|
@@ -14,6 +14,7 @@ var _i18n = require("@wordpress/i18n");
|
|
|
14
14
|
var _icons = require("@wordpress/icons");
|
|
15
15
|
var _keycodes = require("@wordpress/keycodes");
|
|
16
16
|
var _store = require("../../store");
|
|
17
|
+
var _lockUnlock = require("../../lock-unlock");
|
|
17
18
|
/**
|
|
18
19
|
* WordPress dependencies
|
|
19
20
|
*/
|
|
@@ -22,12 +23,13 @@ var _store = require("../../store");
|
|
|
22
23
|
* Internal dependencies
|
|
23
24
|
*/
|
|
24
25
|
|
|
25
|
-
function ListViewSidebar({
|
|
26
|
-
listViewToggleElement
|
|
27
|
-
}) {
|
|
26
|
+
function ListViewSidebar() {
|
|
28
27
|
const {
|
|
29
28
|
setIsListViewOpened
|
|
30
29
|
} = (0, _data.useDispatch)(_store.store);
|
|
30
|
+
const {
|
|
31
|
+
getListViewToggleRef
|
|
32
|
+
} = (0, _lockUnlock.unlock)((0, _data.useSelect)(_store.store));
|
|
31
33
|
|
|
32
34
|
// Use internal state instead of a ref to make sure that the component
|
|
33
35
|
// re-renders when the dropZoneElement updates.
|
|
@@ -37,8 +39,8 @@ function ListViewSidebar({
|
|
|
37
39
|
// When closing the list view, focus should return to the toggle button.
|
|
38
40
|
const closeListView = (0, _element.useCallback)(() => {
|
|
39
41
|
setIsListViewOpened(false);
|
|
40
|
-
|
|
41
|
-
}, [
|
|
42
|
+
getListViewToggleRef().current?.focus();
|
|
43
|
+
}, [getListViewToggleRef, setIsListViewOpened]);
|
|
42
44
|
const closeOnEscape = (0, _element.useCallback)(event => {
|
|
43
45
|
if (event.keyCode === _keycodes.ESCAPE && !event.defaultPrevented) {
|
|
44
46
|
event.preventDefault();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_blockEditor","require","_components","_compose","_data","_element","_i18n","_icons","_keycodes","_store","
|
|
1
|
+
{"version":3,"names":["_blockEditor","require","_components","_compose","_data","_element","_i18n","_icons","_keycodes","_store","_lockUnlock","ListViewSidebar","setIsListViewOpened","useDispatch","editWidgetsStore","getListViewToggleRef","unlock","useSelect","dropZoneElement","setDropZoneElement","useState","focusOnMountRef","useFocusOnMount","closeListView","useCallback","current","focus","closeOnEscape","event","keyCode","ESCAPE","defaultPrevented","preventDefault","_react","createElement","className","onKeyDown","__","Button","icon","closeSmall","label","onClick","ref","useMergeRefs","__experimentalListView"],"sources":["@wordpress/edit-widgets/src/components/secondary-sidebar/list-view-sidebar.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __experimentalListView as ListView } from '@wordpress/block-editor';\nimport { Button } from '@wordpress/components';\nimport { useFocusOnMount, useMergeRefs } from '@wordpress/compose';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { useCallback, useState } from '@wordpress/element';\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';\nimport { unlock } from '../../lock-unlock';\n\nexport default function ListViewSidebar() {\n\tconst { setIsListViewOpened } = useDispatch( editWidgetsStore );\n\tconst { getListViewToggleRef } = unlock( useSelect( editWidgetsStore ) );\n\n\t// Use internal state instead of a ref to make sure that the component\n\t// re-renders when the dropZoneElement updates.\n\tconst [ dropZoneElement, setDropZoneElement ] = useState( null );\n\n\tconst focusOnMountRef = useFocusOnMount( 'firstElement' );\n\n\t// When closing the list view, focus should return to the toggle button.\n\tconst closeListView = useCallback( () => {\n\t\tsetIsListViewOpened( false );\n\t\tgetListViewToggleRef().current?.focus();\n\t}, [ getListViewToggleRef, setIsListViewOpened ] );\n\n\tconst closeOnEscape = useCallback(\n\t\t( event ) => {\n\t\t\tif ( event.keyCode === ESCAPE && ! event.defaultPrevented ) {\n\t\t\t\tevent.preventDefault();\n\t\t\t\tcloseListView();\n\t\t\t}\n\t\t},\n\t\t[ closeListView ]\n\t);\n\n\treturn (\n\t\t// eslint-disable-next-line jsx-a11y/no-static-element-interactions\n\t\t<div\n\t\t\tclassName=\"edit-widgets-editor__list-view-panel\"\n\t\t\tonKeyDown={ closeOnEscape }\n\t\t>\n\t\t\t<div className=\"edit-widgets-editor__list-view-panel-header\">\n\t\t\t\t<strong>{ __( 'List View' ) }</strong>\n\t\t\t\t<Button\n\t\t\t\t\ticon={ closeSmall }\n\t\t\t\t\tlabel={ __( 'Close' ) }\n\t\t\t\t\tonClick={ closeListView }\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( [ focusOnMountRef, setDropZoneElement ] ) }\n\t\t\t>\n\t\t\t\t<ListView dropZoneElement={ dropZoneElement } />\n\t\t\t</div>\n\t\t</div>\n\t);\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,YAAA,GAAAC,OAAA;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,SAAS,EAAGT;IAAe,GAE3B,IAAAM,MAAA,CAAAC,aAAA;MAAKC,SAAS,EAAC;IAA6C,GAC3D,IAAAF,MAAA,CAAAC,aAAA,kBAAU,IAAAG,QAAE,EAAE,WAAY,CAAW,CAAC,EACtC,IAAAJ,MAAA,CAAAC,aAAA,EAAChC,WAAA,CAAAoC,MAAM;MACNC,IAAI,EAAGC,iBAAY;MACnBC,KAAK,EAAG,IAAAJ,QAAE,EAAE,OAAQ,CAAG;MACvBK,OAAO,EAAGnB;IAAe,CACzB,CACG,CAAC,EACN,IAAAU,MAAA,CAAAC,aAAA;MACCC,SAAS,EAAC,8CAA8C;MACxDQ,GAAG,EAAG,IAAAC,qBAAY,EAAE,CAAEvB,eAAe,EAAEF,kBAAkB,CAAG;IAAG,GAE/D,IAAAc,MAAA,CAAAC,aAAA,EAAClC,YAAA,CAAA6C,sBAAQ;MAAC3B,eAAe,EAAGA;IAAiB,CAAE,CAC3C,CACD;EAAC;AAER"}
|
package/build/store/index.js
CHANGED
|
@@ -11,7 +11,9 @@ var _reducer = _interopRequireDefault(require("./reducer"));
|
|
|
11
11
|
var resolvers = _interopRequireWildcard(require("./resolvers"));
|
|
12
12
|
var selectors = _interopRequireWildcard(require("./selectors"));
|
|
13
13
|
var actions = _interopRequireWildcard(require("./actions"));
|
|
14
|
+
var privateSelectors = _interopRequireWildcard(require("./private-selectors"));
|
|
14
15
|
var _constants = require("./constants");
|
|
16
|
+
var _lockUnlock = require("../lock-unlock");
|
|
15
17
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
16
18
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
17
19
|
/**
|
|
@@ -56,4 +58,5 @@ _apiFetch.default.use(function (options, next) {
|
|
|
56
58
|
}
|
|
57
59
|
return next(options);
|
|
58
60
|
});
|
|
61
|
+
(0, _lockUnlock.unlock)(store).registerPrivateSelectors(privateSelectors);
|
|
59
62
|
//# sourceMappingURL=index.js.map
|
package/build/store/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_apiFetch","_interopRequireDefault","require","_data","_reducer","resolvers","_interopRequireWildcard","selectors","actions","_constants","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","default","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","storeConfig","reducer","store","createReduxStore","STORE_NAME","exports","register","apiFetch","use","options","next","path","indexOf","Promise","resolve"],"sources":["@wordpress/edit-widgets/src/store/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport apiFetch from '@wordpress/api-fetch';\nimport { createReduxStore, register } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport reducer from './reducer';\nimport * as resolvers from './resolvers';\nimport * as selectors from './selectors';\nimport * as actions from './actions';\nimport { STORE_NAME } from './constants';\n\n/**\n * Block editor data store configuration.\n *\n * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/data/README.md#register\n *\n * @type {Object}\n */\nconst storeConfig = {\n\treducer,\n\tselectors,\n\tresolvers,\n\tactions,\n};\n\n/**\n * Store definition for the edit widgets namespace.\n *\n * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/data/README.md#createReduxStore\n *\n * @type {Object}\n */\nexport const store = createReduxStore( STORE_NAME, storeConfig );\nregister( store );\n\n// This package uses a few in-memory post types as wrappers for convenience.\n// This middleware prevents any network requests related to these types as they are\n// bound to fail anyway.\napiFetch.use( function ( options, next ) {\n\tif ( options.path?.indexOf( '/wp/v2/types/widget-area' ) === 0 ) {\n\t\treturn Promise.resolve( {} );\n\t}\n\n\treturn next( options );\n} );\n"],"mappings":";;;;;;;AAGA,IAAAA,SAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AAKA,IAAAE,QAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,SAAA,GAAAC,uBAAA,CAAAJ,OAAA;AACA,IAAAK,SAAA,GAAAD,uBAAA,CAAAJ,OAAA;AACA,IAAAM,OAAA,GAAAF,uBAAA,CAAAJ,OAAA;AACA,IAAAO,UAAA,
|
|
1
|
+
{"version":3,"names":["_apiFetch","_interopRequireDefault","require","_data","_reducer","resolvers","_interopRequireWildcard","selectors","actions","privateSelectors","_constants","_lockUnlock","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","default","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","storeConfig","reducer","store","createReduxStore","STORE_NAME","exports","register","apiFetch","use","options","next","path","indexOf","Promise","resolve","unlock","registerPrivateSelectors"],"sources":["@wordpress/edit-widgets/src/store/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport apiFetch from '@wordpress/api-fetch';\nimport { createReduxStore, register } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport reducer from './reducer';\nimport * as resolvers from './resolvers';\nimport * as selectors from './selectors';\nimport * as actions from './actions';\nimport * as privateSelectors from './private-selectors';\nimport { STORE_NAME } from './constants';\nimport { unlock } from '../lock-unlock';\n\n/**\n * Block editor data store configuration.\n *\n * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/data/README.md#register\n *\n * @type {Object}\n */\nconst storeConfig = {\n\treducer,\n\tselectors,\n\tresolvers,\n\tactions,\n};\n\n/**\n * Store definition for the edit widgets namespace.\n *\n * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/data/README.md#createReduxStore\n *\n * @type {Object}\n */\nexport const store = createReduxStore( STORE_NAME, storeConfig );\nregister( store );\n\n// This package uses a few in-memory post types as wrappers for convenience.\n// This middleware prevents any network requests related to these types as they are\n// bound to fail anyway.\napiFetch.use( function ( options, next ) {\n\tif ( options.path?.indexOf( '/wp/v2/types/widget-area' ) === 0 ) {\n\t\treturn Promise.resolve( {} );\n\t}\n\n\treturn next( options );\n} );\n\nunlock( store ).registerPrivateSelectors( privateSelectors );\n"],"mappings":";;;;;;;AAGA,IAAAA,SAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AAKA,IAAAE,QAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,SAAA,GAAAC,uBAAA,CAAAJ,OAAA;AACA,IAAAK,SAAA,GAAAD,uBAAA,CAAAJ,OAAA;AACA,IAAAM,OAAA,GAAAF,uBAAA,CAAAJ,OAAA;AACA,IAAAO,gBAAA,GAAAH,uBAAA,CAAAJ,OAAA;AACA,IAAAQ,UAAA,GAAAR,OAAA;AACA,IAAAS,WAAA,GAAAT,OAAA;AAAwC,SAAAU,yBAAAC,WAAA,eAAAC,OAAA,kCAAAC,iBAAA,OAAAD,OAAA,QAAAE,gBAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,WAAA,WAAAA,WAAA,GAAAG,gBAAA,GAAAD,iBAAA,KAAAF,WAAA;AAAA,SAAAP,wBAAAW,GAAA,EAAAJ,WAAA,SAAAA,WAAA,IAAAI,GAAA,IAAA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,UAAWC,OAAO,EAAEC,IAAI,EAAG;EACxC,IAAKD,OAAO,CAACE,IAAI,EAAEC,OAAO,CAAE,0BAA2B,CAAC,KAAK,CAAC,EAAG;IAChE,OAAOC,OAAO,CAACC,OAAO,CAAE,CAAC,CAAE,CAAC;EAC7B;EAEA,OAAOJ,IAAI,CAAED,OAAQ,CAAC;AACvB,CAAE,CAAC;AAEH,IAAAM,kBAAM,EAAEb,KAAM,CAAC,CAACc,wBAAwB,CAAEzC,gBAAiB,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.getListViewToggleRef = getListViewToggleRef;
|
|
7
|
+
function getListViewToggleRef(state) {
|
|
8
|
+
return state.listViewToggleRef;
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=private-selectors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["getListViewToggleRef","state","listViewToggleRef"],"sources":["@wordpress/edit-widgets/src/store/private-selectors.js"],"sourcesContent":["export function getListViewToggleRef( state ) {\n\treturn state.listViewToggleRef;\n}\n"],"mappings":";;;;;;AAAO,SAASA,oBAAoBA,CAAEC,KAAK,EAAG;EAC7C,OAAOA,KAAK,CAACC,iBAAiB;AAC/B"}
|
package/build/store/reducer.js
CHANGED
|
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.blockInserterPanel = blockInserterPanel;
|
|
7
7
|
exports.default = void 0;
|
|
8
8
|
exports.listViewPanel = listViewPanel;
|
|
9
|
+
exports.listViewToggleRef = listViewToggleRef;
|
|
9
10
|
exports.widgetAreasOpenState = widgetAreasOpenState;
|
|
10
11
|
var _data = require("@wordpress/data");
|
|
11
12
|
/**
|
|
@@ -84,6 +85,19 @@ function listViewPanel(state = false, action) {
|
|
|
84
85
|
}
|
|
85
86
|
return state;
|
|
86
87
|
}
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* This reducer does nothing aside initializing a ref to the list view toggle.
|
|
91
|
+
* We will have a unique ref per "editor" instance.
|
|
92
|
+
*
|
|
93
|
+
* @param {Object} state
|
|
94
|
+
* @return {Object} Reference to the list view toggle button.
|
|
95
|
+
*/
|
|
96
|
+
function listViewToggleRef(state = {
|
|
97
|
+
current: null
|
|
98
|
+
}) {
|
|
99
|
+
return state;
|
|
100
|
+
}
|
|
87
101
|
var _default = (0, _data.combineReducers)({
|
|
88
102
|
blockInserterPanel,
|
|
89
103
|
listViewPanel,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_data","require","widgetAreasOpenState","state","action","type","clientId","isOpen","blockInserterPanel","value","listViewPanel","_default","combineReducers","exports","default"],"sources":["@wordpress/edit-widgets/src/store/reducer.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { combineReducers } from '@wordpress/data';\n\n/**\n * Controls the open state of the widget areas.\n *\n * @param {Object} state Redux state.\n * @param {Object} action Redux action.\n *\n * @return {Array} Updated state.\n */\nexport function widgetAreasOpenState( state = {}, action ) {\n\tconst { type } = action;\n\tswitch ( type ) {\n\t\tcase 'SET_WIDGET_AREAS_OPEN_STATE': {\n\t\t\treturn action.widgetAreasOpenState;\n\t\t}\n\t\tcase 'SET_IS_WIDGET_AREA_OPEN': {\n\t\t\tconst { clientId, isOpen } = action;\n\t\t\treturn {\n\t\t\t\t...state,\n\t\t\t\t[ clientId ]: isOpen,\n\t\t\t};\n\t\t}\n\t\tdefault: {\n\t\t\treturn state;\n\t\t}\n\t}\n}\n\n/**\n * Reducer to set the block inserter panel open or closed.\n *\n * Note: this reducer interacts with the list view panel reducer\n * to make sure that only one of the two panels is open at the same time.\n *\n * @param {Object} state Current state.\n * @param {Object} action Dispatched action.\n */\nexport function blockInserterPanel( state = false, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'SET_IS_LIST_VIEW_OPENED':\n\t\t\treturn action.isOpen ? false : state;\n\t\tcase 'SET_IS_INSERTER_OPENED':\n\t\t\treturn action.value;\n\t}\n\treturn state;\n}\n\n/**\n * Reducer to set the list view panel open or closed.\n *\n * Note: this reducer interacts with the inserter panel reducer\n * to make sure that only one of the two panels is open at the same time.\n *\n * @param {Object} state Current state.\n * @param {Object} action Dispatched action.\n */\nexport function listViewPanel( state = false, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'SET_IS_INSERTER_OPENED':\n\t\t\treturn action.value ? false : state;\n\t\tcase 'SET_IS_LIST_VIEW_OPENED':\n\t\t\treturn action.isOpen;\n\t}\n\treturn state;\n}\n\nexport default combineReducers( {\n\tblockInserterPanel,\n\tlistViewPanel,\n\twidgetAreasOpenState,\n} );\n"],"mappings":"
|
|
1
|
+
{"version":3,"names":["_data","require","widgetAreasOpenState","state","action","type","clientId","isOpen","blockInserterPanel","value","listViewPanel","listViewToggleRef","current","_default","combineReducers","exports","default"],"sources":["@wordpress/edit-widgets/src/store/reducer.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { combineReducers } from '@wordpress/data';\n\n/**\n * Controls the open state of the widget areas.\n *\n * @param {Object} state Redux state.\n * @param {Object} action Redux action.\n *\n * @return {Array} Updated state.\n */\nexport function widgetAreasOpenState( state = {}, action ) {\n\tconst { type } = action;\n\tswitch ( type ) {\n\t\tcase 'SET_WIDGET_AREAS_OPEN_STATE': {\n\t\t\treturn action.widgetAreasOpenState;\n\t\t}\n\t\tcase 'SET_IS_WIDGET_AREA_OPEN': {\n\t\t\tconst { clientId, isOpen } = action;\n\t\t\treturn {\n\t\t\t\t...state,\n\t\t\t\t[ clientId ]: isOpen,\n\t\t\t};\n\t\t}\n\t\tdefault: {\n\t\t\treturn state;\n\t\t}\n\t}\n}\n\n/**\n * Reducer to set the block inserter panel open or closed.\n *\n * Note: this reducer interacts with the list view panel reducer\n * to make sure that only one of the two panels is open at the same time.\n *\n * @param {Object} state Current state.\n * @param {Object} action Dispatched action.\n */\nexport function blockInserterPanel( state = false, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'SET_IS_LIST_VIEW_OPENED':\n\t\t\treturn action.isOpen ? false : state;\n\t\tcase 'SET_IS_INSERTER_OPENED':\n\t\t\treturn action.value;\n\t}\n\treturn state;\n}\n\n/**\n * Reducer to set the list view panel open or closed.\n *\n * Note: this reducer interacts with the inserter panel reducer\n * to make sure that only one of the two panels is open at the same time.\n *\n * @param {Object} state Current state.\n * @param {Object} action Dispatched action.\n */\nexport function listViewPanel( state = false, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'SET_IS_INSERTER_OPENED':\n\t\t\treturn action.value ? false : state;\n\t\tcase 'SET_IS_LIST_VIEW_OPENED':\n\t\t\treturn action.isOpen;\n\t}\n\treturn state;\n}\n\n/**\n * This reducer does nothing aside initializing a ref to the list view toggle.\n * We will have a unique ref per \"editor\" instance.\n *\n * @param {Object} state\n * @return {Object} Reference to the list view toggle button.\n */\nexport function listViewToggleRef( state = { current: null } ) {\n\treturn state;\n}\n\nexport default combineReducers( {\n\tblockInserterPanel,\n\tlistViewPanel,\n\twidgetAreasOpenState,\n} );\n"],"mappings":";;;;;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AAHA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASC,oBAAoBA,CAAEC,KAAK,GAAG,CAAC,CAAC,EAAEC,MAAM,EAAG;EAC1D,MAAM;IAAEC;EAAK,CAAC,GAAGD,MAAM;EACvB,QAASC,IAAI;IACZ,KAAK,6BAA6B;MAAE;QACnC,OAAOD,MAAM,CAACF,oBAAoB;MACnC;IACA,KAAK,yBAAyB;MAAE;QAC/B,MAAM;UAAEI,QAAQ;UAAEC;QAAO,CAAC,GAAGH,MAAM;QACnC,OAAO;UACN,GAAGD,KAAK;UACR,CAAEG,QAAQ,GAAIC;QACf,CAAC;MACF;IACA;MAAS;QACR,OAAOJ,KAAK;MACb;EACD;AACD;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASK,kBAAkBA,CAAEL,KAAK,GAAG,KAAK,EAAEC,MAAM,EAAG;EAC3D,QAASA,MAAM,CAACC,IAAI;IACnB,KAAK,yBAAyB;MAC7B,OAAOD,MAAM,CAACG,MAAM,GAAG,KAAK,GAAGJ,KAAK;IACrC,KAAK,wBAAwB;MAC5B,OAAOC,MAAM,CAACK,KAAK;EACrB;EACA,OAAON,KAAK;AACb;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASO,aAAaA,CAAEP,KAAK,GAAG,KAAK,EAAEC,MAAM,EAAG;EACtD,QAASA,MAAM,CAACC,IAAI;IACnB,KAAK,wBAAwB;MAC5B,OAAOD,MAAM,CAACK,KAAK,GAAG,KAAK,GAAGN,KAAK;IACpC,KAAK,yBAAyB;MAC7B,OAAOC,MAAM,CAACG,MAAM;EACtB;EACA,OAAOJ,KAAK;AACb;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASQ,iBAAiBA,CAAER,KAAK,GAAG;EAAES,OAAO,EAAE;AAAK,CAAC,EAAG;EAC9D,OAAOT,KAAK;AACb;AAAC,IAAAU,QAAA,GAEc,IAAAC,qBAAe,EAAE;EAC/BN,kBAAkB;EAClBE,aAAa;EACbR;AACD,CAAE,CAAC;AAAAa,OAAA,CAAAC,OAAA,GAAAH,QAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["__","metadata","name","category","attributes","id","type","supports","html","inserter","customClassName","reusable","__experimentalToolbar","__experimentalParentSelector","__experimentalDisableBlockOverlay","editorStyle","style","edit","settings","title","description","__experimentalLabel","label"],"sources":["@wordpress/edit-widgets/src/blocks/widget-area/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport metadata from './block.json';\nimport edit from './edit';\n\nconst { name } = metadata;\nexport { metadata, name };\n\nexport const settings = {\n\ttitle: __( 'Widget Area' ),\n\tdescription: __( 'A widget area container.' ),\n\t__experimentalLabel: ( { name: label } ) => label,\n\tedit,\n};\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,EAAE,QAAQ,iBAAiB;;AAEpC;AACA;AACA;AAFA,MAAAC,QAAA;EAAAC,IAAA;EAAAC,QAAA;EAAAC,UAAA;IAAAC,EAAA;MAAAC,IAAA;IAAA;IAAAJ,IAAA;MAAAI,IAAA;IAAA;EAAA;EAAAC,QAAA;IAAAC,IAAA;IAAAC,QAAA;IAAAC,eAAA;IAAAC,QAAA;IAAAC,qBAAA;IAAAC,4BAAA;IAAAC,iCAAA;EAAA;EAAAC,WAAA;EAAAC,KAAA;AAAA;AAIA,OAAOC,IAAI,MAAM,QAAQ;AAEzB,MAAM;EAAEf;AAAK,CAAC,
|
|
1
|
+
{"version":3,"names":["__","metadata","$schema","name","category","attributes","id","type","supports","html","inserter","customClassName","reusable","__experimentalToolbar","__experimentalParentSelector","__experimentalDisableBlockOverlay","editorStyle","style","edit","settings","title","description","__experimentalLabel","label"],"sources":["@wordpress/edit-widgets/src/blocks/widget-area/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport metadata from './block.json';\nimport edit from './edit';\n\nconst { name } = metadata;\nexport { metadata, name };\n\nexport const settings = {\n\ttitle: __( 'Widget Area' ),\n\tdescription: __( 'A widget area container.' ),\n\t__experimentalLabel: ( { name: label } ) => label,\n\tedit,\n};\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,EAAE,QAAQ,iBAAiB;;AAEpC;AACA;AACA;AAFA,MAAAC,QAAA;EAAAC,OAAA;EAAAC,IAAA;EAAAC,QAAA;EAAAC,UAAA;IAAAC,EAAA;MAAAC,IAAA;IAAA;IAAAJ,IAAA;MAAAI,IAAA;IAAA;EAAA;EAAAC,QAAA;IAAAC,IAAA;IAAAC,QAAA;IAAAC,eAAA;IAAAC,QAAA;IAAAC,qBAAA;IAAAC,4BAAA;IAAAC,iCAAA;EAAA;EAAAC,WAAA;EAAAC,KAAA;AAAA;AAIA,OAAOC,IAAI,MAAM,QAAQ;AAEzB,MAAM;EAAEf;AAAK,CAAC,GAAGF,QAAQ;AACzB,SAASA,QAAQ,EAAEE,IAAI;AAEvB,OAAO,MAAMgB,QAAQ,GAAG;EACvBC,KAAK,EAAEpB,EAAE,CAAE,aAAc,CAAC;EAC1BqB,WAAW,EAAErB,EAAE,CAAE,0BAA2B,CAAC;EAC7CsB,mBAAmB,EAAEA,CAAE;IAAEnB,IAAI,EAAEoB;EAAM,CAAC,KAAMA,KAAK;EACjDL;AACD,CAAC"}
|
|
@@ -19,26 +19,27 @@ import useLastSelectedWidgetArea from '../../../hooks/use-last-selected-widget-a
|
|
|
19
19
|
import { store as editWidgetsStore } from '../../../store';
|
|
20
20
|
import { unlock } from '../../../lock-unlock';
|
|
21
21
|
const {
|
|
22
|
-
|
|
22
|
+
useCanBlockToolbarBeFocused
|
|
23
23
|
} = unlock(blockEditorPrivateApis);
|
|
24
|
-
function DocumentTools({
|
|
25
|
-
setListViewToggleElement
|
|
26
|
-
}) {
|
|
24
|
+
function DocumentTools() {
|
|
27
25
|
const isMediumViewport = useViewportMatch('medium');
|
|
28
26
|
const inserterButton = useRef();
|
|
29
27
|
const widgetAreaClientId = useLastSelectedWidgetArea();
|
|
30
28
|
const isLastSelectedWidgetAreaOpen = useSelect(select => select(editWidgetsStore).getIsWidgetAreaOpen(widgetAreaClientId), [widgetAreaClientId]);
|
|
31
29
|
const {
|
|
32
30
|
isInserterOpen,
|
|
33
|
-
isListViewOpen
|
|
31
|
+
isListViewOpen,
|
|
32
|
+
listViewToggleRef
|
|
34
33
|
} = useSelect(select => {
|
|
35
34
|
const {
|
|
36
35
|
isInserterOpened,
|
|
37
|
-
isListViewOpened
|
|
38
|
-
|
|
36
|
+
isListViewOpened,
|
|
37
|
+
getListViewToggleRef
|
|
38
|
+
} = unlock(select(editWidgetsStore));
|
|
39
39
|
return {
|
|
40
40
|
isInserterOpen: isInserterOpened(),
|
|
41
|
-
isListViewOpen: isListViewOpened()
|
|
41
|
+
isListViewOpen: isListViewOpened(),
|
|
42
|
+
listViewToggleRef: getListViewToggleRef()
|
|
42
43
|
};
|
|
43
44
|
}, []);
|
|
44
45
|
const {
|
|
@@ -69,14 +70,9 @@ function DocumentTools({
|
|
|
69
70
|
}
|
|
70
71
|
};
|
|
71
72
|
const toggleListView = useCallback(() => setIsListViewOpened(!isListViewOpen), [setIsListViewOpened, isListViewOpen]);
|
|
72
|
-
|
|
73
|
-
shouldShowContextualToolbar,
|
|
74
|
-
canFocusHiddenToolbar,
|
|
75
|
-
fixedToolbarCanBeFocused
|
|
76
|
-
} = useShouldContextualToolbarShow();
|
|
73
|
+
|
|
77
74
|
// If there's a block toolbar to be focused, disable the focus shortcut for the document toolbar.
|
|
78
|
-
|
|
79
|
-
const blockToolbarCanBeFocused = shouldShowContextualToolbar || canFocusHiddenToolbar || fixedToolbarCanBeFocused;
|
|
75
|
+
const blockToolbarCanBeFocused = useCanBlockToolbarBeFocused();
|
|
80
76
|
return createElement(NavigableToolbar, {
|
|
81
77
|
className: "edit-widgets-header-toolbar",
|
|
82
78
|
"aria-label": __('Document tools'),
|
|
@@ -103,7 +99,7 @@ function DocumentTools({
|
|
|
103
99
|
/* translators: button label text should, if possible, be under 16 characters. */,
|
|
104
100
|
label: __('List View'),
|
|
105
101
|
onClick: toggleListView,
|
|
106
|
-
ref:
|
|
102
|
+
ref: listViewToggleRef
|
|
107
103
|
})));
|
|
108
104
|
}
|
|
109
105
|
export default DocumentTools;
|