@wordpress/edit-widgets 5.34.0 → 6.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 +15 -2
- package/build/blocks/widget-area/edit/index.js +33 -30
- package/build/blocks/widget-area/edit/index.js.map +1 -1
- package/build/blocks/widget-area/edit/inner-blocks.js +8 -7
- package/build/blocks/widget-area/edit/inner-blocks.js.map +1 -1
- package/build/components/error-boundary/index.js +14 -12
- package/build/components/error-boundary/index.js.map +1 -1
- package/build/components/header/document-tools/index.js +40 -60
- package/build/components/header/document-tools/index.js.map +1 -1
- package/build/components/header/index.js +32 -22
- package/build/components/header/index.js.map +1 -1
- package/build/components/header/undo-redo/redo.js +2 -2
- package/build/components/header/undo-redo/redo.js.map +1 -1
- package/build/components/header/undo-redo/undo.js +2 -2
- package/build/components/header/undo-redo/undo.js.map +1 -1
- package/build/components/keyboard-shortcut-help-modal/dynamic-shortcut.js +2 -2
- package/build/components/keyboard-shortcut-help-modal/dynamic-shortcut.js.map +1 -1
- package/build/components/keyboard-shortcut-help-modal/index.js +54 -49
- package/build/components/keyboard-shortcut-help-modal/index.js.map +1 -1
- package/build/components/keyboard-shortcut-help-modal/shortcut.js +30 -26
- package/build/components/keyboard-shortcut-help-modal/shortcut.js.map +1 -1
- package/build/components/layout/index.js +11 -8
- package/build/components/layout/index.js.map +1 -1
- package/build/components/layout/interface.js +16 -13
- package/build/components/layout/interface.js.map +1 -1
- package/build/components/more-menu/index.js +81 -70
- package/build/components/more-menu/index.js.map +1 -1
- package/build/components/more-menu/tools-more-menu-group.js +5 -4
- package/build/components/more-menu/tools-more-menu-group.js.map +1 -1
- package/build/components/notices/index.js +15 -13
- package/build/components/notices/index.js.map +1 -1
- package/build/components/save-button/index.js +5 -4
- package/build/components/save-button/index.js.map +1 -1
- package/build/components/secondary-sidebar/index.js +3 -3
- package/build/components/secondary-sidebar/index.js.map +1 -1
- package/build/components/secondary-sidebar/inserter-sidebar.js +21 -18
- package/build/components/secondary-sidebar/inserter-sidebar.js.map +1 -1
- package/build/components/secondary-sidebar/list-view-sidebar.js +21 -15
- package/build/components/secondary-sidebar/list-view-sidebar.js.map +1 -1
- package/build/components/sidebar/index.js +49 -37
- package/build/components/sidebar/index.js.map +1 -1
- package/build/components/sidebar/widget-areas.js +29 -22
- package/build/components/sidebar/widget-areas.js.map +1 -1
- package/build/components/welcome-guide/index.js +80 -53
- package/build/components/welcome-guide/index.js.map +1 -1
- package/build/components/widget-areas-block-editor-content/index.js +18 -11
- package/build/components/widget-areas-block-editor-content/index.js.map +1 -1
- package/build/components/widget-areas-block-editor-provider/index.js +14 -11
- package/build/components/widget-areas-block-editor-provider/index.js.map +1 -1
- package/build/filters/move-to-widget-area.js +14 -10
- package/build/filters/move-to-widget-area.js.map +1 -1
- package/build/index.js +3 -3
- package/build/index.js.map +1 -1
- package/build/store/private-selectors.js +4 -0
- package/build/store/private-selectors.js.map +1 -1
- package/build/store/reducer.js +16 -0
- package/build/store/reducer.js.map +1 -1
- package/build-module/blocks/widget-area/edit/index.js +32 -28
- package/build-module/blocks/widget-area/edit/index.js.map +1 -1
- package/build-module/blocks/widget-area/edit/inner-blocks.js +8 -7
- package/build-module/blocks/widget-area/edit/inner-blocks.js.map +1 -1
- package/build-module/components/error-boundary/index.js +14 -12
- package/build-module/components/error-boundary/index.js.map +1 -1
- package/build-module/components/header/document-tools/index.js +44 -62
- package/build-module/components/header/document-tools/index.js.map +1 -1
- package/build-module/components/header/index.js +34 -22
- package/build-module/components/header/index.js.map +1 -1
- package/build-module/components/header/undo-redo/redo.js +2 -2
- package/build-module/components/header/undo-redo/redo.js.map +1 -1
- package/build-module/components/header/undo-redo/undo.js +2 -2
- package/build-module/components/header/undo-redo/undo.js.map +1 -1
- package/build-module/components/keyboard-shortcut-help-modal/dynamic-shortcut.js +2 -2
- package/build-module/components/keyboard-shortcut-help-modal/dynamic-shortcut.js.map +1 -1
- package/build-module/components/keyboard-shortcut-help-modal/index.js +55 -49
- package/build-module/components/keyboard-shortcut-help-modal/index.js.map +1 -1
- package/build-module/components/keyboard-shortcut-help-modal/shortcut.js +32 -26
- package/build-module/components/keyboard-shortcut-help-modal/shortcut.js.map +1 -1
- package/build-module/components/layout/index.js +12 -8
- package/build-module/components/layout/index.js.map +1 -1
- package/build-module/components/layout/interface.js +17 -13
- package/build-module/components/layout/interface.js.map +1 -1
- package/build-module/components/more-menu/index.js +83 -70
- package/build-module/components/more-menu/index.js.map +1 -1
- package/build-module/components/more-menu/tools-more-menu-group.js +5 -4
- package/build-module/components/more-menu/tools-more-menu-group.js.map +1 -1
- package/build-module/components/notices/index.js +17 -13
- package/build-module/components/notices/index.js.map +1 -1
- package/build-module/components/save-button/index.js +5 -4
- package/build-module/components/save-button/index.js.map +1 -1
- package/build-module/components/secondary-sidebar/index.js +3 -3
- package/build-module/components/secondary-sidebar/index.js.map +1 -1
- package/build-module/components/secondary-sidebar/inserter-sidebar.js +22 -18
- package/build-module/components/secondary-sidebar/inserter-sidebar.js.map +1 -1
- package/build-module/components/secondary-sidebar/list-view-sidebar.js +22 -15
- package/build-module/components/secondary-sidebar/list-view-sidebar.js.map +1 -1
- package/build-module/components/sidebar/index.js +50 -37
- package/build-module/components/sidebar/index.js.map +1 -1
- package/build-module/components/sidebar/widget-areas.js +30 -22
- package/build-module/components/sidebar/widget-areas.js.map +1 -1
- package/build-module/components/welcome-guide/index.js +82 -53
- package/build-module/components/welcome-guide/index.js.map +1 -1
- package/build-module/components/widget-areas-block-editor-content/index.js +19 -11
- package/build-module/components/widget-areas-block-editor-content/index.js.map +1 -1
- package/build-module/components/widget-areas-block-editor-provider/index.js +15 -11
- package/build-module/components/widget-areas-block-editor-provider/index.js.map +1 -1
- package/build-module/filters/move-to-widget-area.js +16 -10
- package/build-module/filters/move-to-widget-area.js.map +1 -1
- package/build-module/index.js +3 -3
- package/build-module/index.js.map +1 -1
- package/build-module/store/private-selectors.js +3 -0
- package/build-module/store/private-selectors.js.map +1 -1
- package/build-module/store/reducer.js +15 -0
- package/build-module/store/reducer.js.map +1 -1
- package/build-style/style-rtl.css +15 -14
- package/build-style/style.css +15 -14
- package/package.json +31 -30
- package/src/blocks/widget-area/edit/inner-blocks.js +2 -2
- package/src/components/header/document-tools/index.js +30 -50
- package/src/components/keyboard-shortcut-help-modal/index.js +2 -2
- package/src/components/layout/style.scss +1 -1
- package/src/index.js +1 -1
- package/src/store/private-selectors.js +4 -0
- package/src/store/reducer.js +13 -0
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { createElement } from "react";
|
|
2
1
|
/**
|
|
3
2
|
* WordPress dependencies
|
|
4
3
|
*/
|
|
@@ -25,17 +24,23 @@ const WIDGET_AREAS_IDENTIFIER = 'edit-widgets/block-areas';
|
|
|
25
24
|
import WidgetAreas from './widget-areas';
|
|
26
25
|
import { store as editWidgetsStore } from '../../store';
|
|
27
26
|
import { unlock } from '../../lock-unlock';
|
|
27
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
28
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
28
29
|
const {
|
|
29
30
|
Tabs
|
|
30
31
|
} = unlock(componentsPrivateApis);
|
|
31
32
|
function SidebarHeader({
|
|
32
33
|
selectedWidgetAreaBlock
|
|
33
34
|
}) {
|
|
34
|
-
return
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
35
|
+
return /*#__PURE__*/_jsxs(Tabs.TabList, {
|
|
36
|
+
children: [/*#__PURE__*/_jsx(Tabs.Tab, {
|
|
37
|
+
tabId: WIDGET_AREAS_IDENTIFIER,
|
|
38
|
+
children: selectedWidgetAreaBlock ? selectedWidgetAreaBlock.attributes.name : __('Widget Areas')
|
|
39
|
+
}), /*#__PURE__*/_jsx(Tabs.Tab, {
|
|
40
|
+
tabId: BLOCK_INSPECTOR_IDENTIFIER,
|
|
41
|
+
children: __('Block')
|
|
42
|
+
})]
|
|
43
|
+
});
|
|
39
44
|
}
|
|
40
45
|
function SidebarContent({
|
|
41
46
|
hasSelectedNonAreaBlock,
|
|
@@ -59,13 +64,14 @@ function SidebarContent({
|
|
|
59
64
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
60
65
|
}, [hasSelectedNonAreaBlock, enableComplementaryArea]);
|
|
61
66
|
const tabsContextValue = useContext(Tabs.Context);
|
|
62
|
-
return
|
|
67
|
+
return /*#__PURE__*/_jsx(ComplementaryArea, {
|
|
63
68
|
className: "edit-widgets-sidebar",
|
|
64
|
-
header:
|
|
65
|
-
value: tabsContextValue
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
+
header: /*#__PURE__*/_jsx(Tabs.Context.Provider, {
|
|
70
|
+
value: tabsContextValue,
|
|
71
|
+
children: /*#__PURE__*/_jsx(SidebarHeader, {
|
|
72
|
+
selectedWidgetAreaBlock: selectedWidgetAreaBlock
|
|
73
|
+
})
|
|
74
|
+
}),
|
|
69
75
|
headerClassName: "edit-widgets-sidebar__panel-tabs"
|
|
70
76
|
/* translators: button label text should, if possible, be under 16 characters. */,
|
|
71
77
|
title: __('Settings'),
|
|
@@ -73,23 +79,29 @@ function SidebarContent({
|
|
|
73
79
|
scope: "core/edit-widgets",
|
|
74
80
|
identifier: currentArea,
|
|
75
81
|
icon: isRTL() ? drawerLeft : drawerRight,
|
|
76
|
-
isActiveByDefault: SIDEBAR_ACTIVE_BY_DEFAULT
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
82
|
+
isActiveByDefault: SIDEBAR_ACTIVE_BY_DEFAULT,
|
|
83
|
+
children: /*#__PURE__*/_jsxs(Tabs.Context.Provider, {
|
|
84
|
+
value: tabsContextValue,
|
|
85
|
+
children: [/*#__PURE__*/_jsx(Tabs.TabPanel, {
|
|
86
|
+
tabId: WIDGET_AREAS_IDENTIFIER,
|
|
87
|
+
focusable: false,
|
|
88
|
+
children: /*#__PURE__*/_jsx(WidgetAreas, {
|
|
89
|
+
selectedWidgetAreaId: selectedWidgetAreaBlock?.attributes.id
|
|
90
|
+
})
|
|
91
|
+
}), /*#__PURE__*/_jsx(Tabs.TabPanel, {
|
|
92
|
+
tabId: BLOCK_INSPECTOR_IDENTIFIER,
|
|
93
|
+
focusable: false,
|
|
94
|
+
children: hasSelectedNonAreaBlock ? /*#__PURE__*/_jsx(BlockInspector, {}) :
|
|
95
|
+
/*#__PURE__*/
|
|
96
|
+
// Pretend that Widget Areas are part of the UI by not
|
|
97
|
+
// showing the Block Inspector when one is selected.
|
|
98
|
+
_jsx("span", {
|
|
99
|
+
className: "block-editor-block-inspector__no-blocks",
|
|
100
|
+
children: __('No block selected.')
|
|
101
|
+
})
|
|
102
|
+
})]
|
|
103
|
+
})
|
|
104
|
+
});
|
|
93
105
|
}
|
|
94
106
|
export default function Sidebar() {
|
|
95
107
|
const {
|
|
@@ -144,7 +156,7 @@ export default function Sidebar() {
|
|
|
144
156
|
enableComplementaryArea(editWidgetsStore.name, newSelectedTabId);
|
|
145
157
|
}
|
|
146
158
|
}, [enableComplementaryArea]);
|
|
147
|
-
return
|
|
159
|
+
return /*#__PURE__*/_jsx(Tabs
|
|
148
160
|
// Due to how this component is controlled (via a value from the
|
|
149
161
|
// `interfaceStore`), when the sidebar closes the currently selected
|
|
150
162
|
// tab can't be found. This causes the component to continuously reset
|
|
@@ -153,12 +165,13 @@ export default function Sidebar() {
|
|
|
153
165
|
, {
|
|
154
166
|
selectedTabId: isGeneralSidebarOpen ? currentArea : null,
|
|
155
167
|
onSelect: onTabSelect,
|
|
156
|
-
selectOnMove: false
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
168
|
+
selectOnMove: false,
|
|
169
|
+
children: /*#__PURE__*/_jsx(SidebarContent, {
|
|
170
|
+
hasSelectedNonAreaBlock: hasSelectedNonAreaBlock,
|
|
171
|
+
currentArea: currentArea,
|
|
172
|
+
isGeneralSidebarOpen: isGeneralSidebarOpen,
|
|
173
|
+
selectedWidgetAreaBlock: selectedWidgetAreaBlock
|
|
174
|
+
})
|
|
175
|
+
});
|
|
163
176
|
}
|
|
164
177
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useEffect","Platform","useContext","useCallback","isRTL","__","ComplementaryArea","store","interfaceStore","BlockInspector","blockEditorStore","drawerLeft","drawerRight","privateApis","componentsPrivateApis","useSelect","useDispatch","SIDEBAR_ACTIVE_BY_DEFAULT","select","web","native","BLOCK_INSPECTOR_IDENTIFIER","WIDGET_AREAS_IDENTIFIER","WidgetAreas","editWidgetsStore","unlock","Tabs","SidebarHeader","selectedWidgetAreaBlock","createElement","TabList","Tab","tabId","attributes","name","SidebarContent","hasSelectedNonAreaBlock","currentArea","isGeneralSidebarOpen","enableComplementaryArea","tabsContextValue","Context","className","header","Provider","value","headerClassName","title","closeLabel","scope","identifier","icon","isActiveByDefault","TabPanel","focusable","selectedWidgetAreaId","id","Sidebar","getSelectedBlock","getBlock","getBlockParentsByBlockName","getActiveComplementaryArea","selectedBlock","activeArea","currentSelection","widgetAreaBlock","clientId","onTabSelect","newSelectedTabId","selectedTabId","onSelect","selectOnMove"],"sources":["@wordpress/edit-widgets/src/components/sidebar/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tuseEffect,\n\tPlatform,\n\tuseContext,\n\tuseCallback,\n} from '@wordpress/element';\nimport { isRTL, __ } from '@wordpress/i18n';\nimport {\n\tComplementaryArea,\n\tstore as interfaceStore,\n} from '@wordpress/interface';\nimport {\n\tBlockInspector,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\n\nimport { drawerLeft, drawerRight } from '@wordpress/icons';\nimport { privateApis as componentsPrivateApis } from '@wordpress/components';\nimport { useSelect, useDispatch } from '@wordpress/data';\n\nconst SIDEBAR_ACTIVE_BY_DEFAULT = Platform.select( {\n\tweb: true,\n\tnative: false,\n} );\n\nconst BLOCK_INSPECTOR_IDENTIFIER = 'edit-widgets/block-inspector';\n\n// Widget areas were one called block areas, so use 'edit-widgets/block-areas'\n// for backwards compatibility.\nconst WIDGET_AREAS_IDENTIFIER = 'edit-widgets/block-areas';\n\n/**\n * Internal dependencies\n */\nimport WidgetAreas from './widget-areas';\nimport { store as editWidgetsStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\n\nconst { Tabs } = unlock( componentsPrivateApis );\n\nfunction SidebarHeader( { selectedWidgetAreaBlock } ) {\n\treturn (\n\t\t<Tabs.TabList>\n\t\t\t<Tabs.Tab tabId={ WIDGET_AREAS_IDENTIFIER }>\n\t\t\t\t{ selectedWidgetAreaBlock\n\t\t\t\t\t? selectedWidgetAreaBlock.attributes.name\n\t\t\t\t\t: __( 'Widget Areas' ) }\n\t\t\t</Tabs.Tab>\n\t\t\t<Tabs.Tab tabId={ BLOCK_INSPECTOR_IDENTIFIER }>\n\t\t\t\t{ __( 'Block' ) }\n\t\t\t</Tabs.Tab>\n\t\t</Tabs.TabList>\n\t);\n}\n\nfunction SidebarContent( {\n\thasSelectedNonAreaBlock,\n\tcurrentArea,\n\tisGeneralSidebarOpen,\n\tselectedWidgetAreaBlock,\n} ) {\n\tconst { enableComplementaryArea } = useDispatch( interfaceStore );\n\n\tuseEffect( () => {\n\t\tif (\n\t\t\thasSelectedNonAreaBlock &&\n\t\t\tcurrentArea === WIDGET_AREAS_IDENTIFIER &&\n\t\t\tisGeneralSidebarOpen\n\t\t) {\n\t\t\tenableComplementaryArea(\n\t\t\t\t'core/edit-widgets',\n\t\t\t\tBLOCK_INSPECTOR_IDENTIFIER\n\t\t\t);\n\t\t}\n\t\tif (\n\t\t\t! hasSelectedNonAreaBlock &&\n\t\t\tcurrentArea === BLOCK_INSPECTOR_IDENTIFIER &&\n\t\t\tisGeneralSidebarOpen\n\t\t) {\n\t\t\tenableComplementaryArea(\n\t\t\t\t'core/edit-widgets',\n\t\t\t\tWIDGET_AREAS_IDENTIFIER\n\t\t\t);\n\t\t}\n\t\t// We're intentionally leaving `currentArea` and `isGeneralSidebarOpen`\n\t\t// out of the dep array because we want this effect to run based on\n\t\t// block selection changes, not sidebar state changes.\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t}, [ hasSelectedNonAreaBlock, enableComplementaryArea ] );\n\n\tconst tabsContextValue = useContext( Tabs.Context );\n\n\treturn (\n\t\t<ComplementaryArea\n\t\t\tclassName=\"edit-widgets-sidebar\"\n\t\t\theader={\n\t\t\t\t<Tabs.Context.Provider value={ tabsContextValue }>\n\t\t\t\t\t<SidebarHeader\n\t\t\t\t\t\tselectedWidgetAreaBlock={ selectedWidgetAreaBlock }\n\t\t\t\t\t/>\n\t\t\t\t</Tabs.Context.Provider>\n\t\t\t}\n\t\t\theaderClassName=\"edit-widgets-sidebar__panel-tabs\"\n\t\t\t/* translators: button label text should, if possible, be under 16 characters. */\n\t\t\ttitle={ __( 'Settings' ) }\n\t\t\tcloseLabel={ __( 'Close Settings' ) }\n\t\t\tscope=\"core/edit-widgets\"\n\t\t\tidentifier={ currentArea }\n\t\t\ticon={ isRTL() ? drawerLeft : drawerRight }\n\t\t\tisActiveByDefault={ SIDEBAR_ACTIVE_BY_DEFAULT }\n\t\t>\n\t\t\t<Tabs.Context.Provider value={ tabsContextValue }>\n\t\t\t\t<Tabs.TabPanel\n\t\t\t\t\ttabId={ WIDGET_AREAS_IDENTIFIER }\n\t\t\t\t\tfocusable={ false }\n\t\t\t\t>\n\t\t\t\t\t<WidgetAreas\n\t\t\t\t\t\tselectedWidgetAreaId={\n\t\t\t\t\t\t\tselectedWidgetAreaBlock?.attributes.id\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t</Tabs.TabPanel>\n\t\t\t\t<Tabs.TabPanel\n\t\t\t\t\ttabId={ BLOCK_INSPECTOR_IDENTIFIER }\n\t\t\t\t\tfocusable={ false }\n\t\t\t\t>\n\t\t\t\t\t{ hasSelectedNonAreaBlock ? (\n\t\t\t\t\t\t<BlockInspector />\n\t\t\t\t\t) : (\n\t\t\t\t\t\t// Pretend that Widget Areas are part of the UI by not\n\t\t\t\t\t\t// showing the Block Inspector when one is selected.\n\t\t\t\t\t\t<span className=\"block-editor-block-inspector__no-blocks\">\n\t\t\t\t\t\t\t{ __( 'No block selected.' ) }\n\t\t\t\t\t\t</span>\n\t\t\t\t\t) }\n\t\t\t\t</Tabs.TabPanel>\n\t\t\t</Tabs.Context.Provider>\n\t\t</ComplementaryArea>\n\t);\n}\n\nexport default function Sidebar() {\n\tconst {\n\t\tcurrentArea,\n\t\thasSelectedNonAreaBlock,\n\t\tisGeneralSidebarOpen,\n\t\tselectedWidgetAreaBlock,\n\t} = useSelect( ( select ) => {\n\t\tconst { getSelectedBlock, getBlock, getBlockParentsByBlockName } =\n\t\t\tselect( blockEditorStore );\n\t\tconst { getActiveComplementaryArea } = select( interfaceStore );\n\n\t\tconst selectedBlock = getSelectedBlock();\n\n\t\tconst activeArea = getActiveComplementaryArea( editWidgetsStore.name );\n\n\t\tlet currentSelection = activeArea;\n\t\tif ( ! currentSelection ) {\n\t\t\tif ( selectedBlock ) {\n\t\t\t\tcurrentSelection = BLOCK_INSPECTOR_IDENTIFIER;\n\t\t\t} else {\n\t\t\t\tcurrentSelection = WIDGET_AREAS_IDENTIFIER;\n\t\t\t}\n\t\t}\n\n\t\tlet widgetAreaBlock;\n\t\tif ( selectedBlock ) {\n\t\t\tif ( selectedBlock.name === 'core/widget-area' ) {\n\t\t\t\twidgetAreaBlock = selectedBlock;\n\t\t\t} else {\n\t\t\t\twidgetAreaBlock = getBlock(\n\t\t\t\t\tgetBlockParentsByBlockName(\n\t\t\t\t\t\tselectedBlock.clientId,\n\t\t\t\t\t\t'core/widget-area'\n\t\t\t\t\t)[ 0 ]\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\n\t\treturn {\n\t\t\tcurrentArea: currentSelection,\n\t\t\thasSelectedNonAreaBlock: !! (\n\t\t\t\tselectedBlock && selectedBlock.name !== 'core/widget-area'\n\t\t\t),\n\t\t\tisGeneralSidebarOpen: !! activeArea,\n\t\t\tselectedWidgetAreaBlock: widgetAreaBlock,\n\t\t};\n\t}, [] );\n\n\tconst { enableComplementaryArea } = useDispatch( interfaceStore );\n\n\t// `newSelectedTabId` could technically be falsey if no tab is selected (i.e.\n\t// the initial render) or when we don't want a tab displayed (i.e. the\n\t// sidebar is closed). These cases should both be covered by the `!!` check\n\t// below, so we shouldn't need any additional falsey handling.\n\tconst onTabSelect = useCallback(\n\t\t( newSelectedTabId ) => {\n\t\t\tif ( !! newSelectedTabId ) {\n\t\t\t\tenableComplementaryArea(\n\t\t\t\t\teditWidgetsStore.name,\n\t\t\t\t\tnewSelectedTabId\n\t\t\t\t);\n\t\t\t}\n\t\t},\n\t\t[ enableComplementaryArea ]\n\t);\n\n\treturn (\n\t\t<Tabs\n\t\t\t// Due to how this component is controlled (via a value from the\n\t\t\t// `interfaceStore`), when the sidebar closes the currently selected\n\t\t\t// tab can't be found. This causes the component to continuously reset\n\t\t\t// the selection to `null` in an infinite loop. Proactively setting\n\t\t\t// the selected tab to `null` avoids that.\n\t\t\tselectedTabId={ isGeneralSidebarOpen ? currentArea : null }\n\t\t\tonSelect={ onTabSelect }\n\t\t\tselectOnMove={ false }\n\t\t>\n\t\t\t<SidebarContent\n\t\t\t\thasSelectedNonAreaBlock={ hasSelectedNonAreaBlock }\n\t\t\t\tcurrentArea={ currentArea }\n\t\t\t\tisGeneralSidebarOpen={ isGeneralSidebarOpen }\n\t\t\t\tselectedWidgetAreaBlock={ selectedWidgetAreaBlock }\n\t\t\t/>\n\t\t</Tabs>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,SACCA,SAAS,EACTC,QAAQ,EACRC,UAAU,EACVC,WAAW,QACL,oBAAoB;AAC3B,SAASC,KAAK,E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AAa,CAAC5B,IAAI,KAAK,kBAAkB,CAC1D;MACDI,oBAAoB,EAAE,CAAC,CAAEyB,UAAU;MACnCnC,uBAAuB,EAAEqC;IAC1B,CAAC;EACF,CAAC,EAAE,EAAG,CAAC;EAEP,MAAM;IAAE1B;EAAwB,CAAC,GAAGvB,WAAW,CAAER,cAAe,CAAC;;EAEjE;EACA;EACA;EACA;EACA,MAAM2D,WAAW,GAAGhE,WAAW,CAC5BiE,gBAAgB,IAAM;IACvB,IAAK,CAAC,CAAEA,gBAAgB,EAAG;MAC1B7B,uBAAuB,CACtBf,gBAAgB,CAACU,IAAI,EACrBkC,gBACD,CAAC;IACF;EACD,CAAC,EACD,CAAE7B,uBAAuB,CAC1B,CAAC;EAED,OACCV,aAAA,CAACH;EACA;EACA;EACA;EACA;EACA;EAAA;IACA2C,aAAa,EAAG/B,oBAAoB,GAAGD,WAAW,GAAG,IAAM;IAC3DiC,QAAQ,EAAGH,WAAa;IACxBI,YAAY,EAAG;EAAO,GAEtB1C,aAAA,CAACM,cAAc;IACdC,uBAAuB,EAAGA,uBAAyB;IACnDC,WAAW,EAAGA,WAAa;IAC3BC,oBAAoB,EAAGA,oBAAsB;IAC7CV,uBAAuB,EAAGA;EAAyB,CACnD,CACI,CAAC;AAET","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["useEffect","Platform","useContext","useCallback","isRTL","__","ComplementaryArea","store","interfaceStore","BlockInspector","blockEditorStore","drawerLeft","drawerRight","privateApis","componentsPrivateApis","useSelect","useDispatch","SIDEBAR_ACTIVE_BY_DEFAULT","select","web","native","BLOCK_INSPECTOR_IDENTIFIER","WIDGET_AREAS_IDENTIFIER","WidgetAreas","editWidgetsStore","unlock","jsx","_jsx","jsxs","_jsxs","Tabs","SidebarHeader","selectedWidgetAreaBlock","TabList","children","Tab","tabId","attributes","name","SidebarContent","hasSelectedNonAreaBlock","currentArea","isGeneralSidebarOpen","enableComplementaryArea","tabsContextValue","Context","className","header","Provider","value","headerClassName","title","closeLabel","scope","identifier","icon","isActiveByDefault","TabPanel","focusable","selectedWidgetAreaId","id","Sidebar","getSelectedBlock","getBlock","getBlockParentsByBlockName","getActiveComplementaryArea","selectedBlock","activeArea","currentSelection","widgetAreaBlock","clientId","onTabSelect","newSelectedTabId","selectedTabId","onSelect","selectOnMove"],"sources":["@wordpress/edit-widgets/src/components/sidebar/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tuseEffect,\n\tPlatform,\n\tuseContext,\n\tuseCallback,\n} from '@wordpress/element';\nimport { isRTL, __ } from '@wordpress/i18n';\nimport {\n\tComplementaryArea,\n\tstore as interfaceStore,\n} from '@wordpress/interface';\nimport {\n\tBlockInspector,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\n\nimport { drawerLeft, drawerRight } from '@wordpress/icons';\nimport { privateApis as componentsPrivateApis } from '@wordpress/components';\nimport { useSelect, useDispatch } from '@wordpress/data';\n\nconst SIDEBAR_ACTIVE_BY_DEFAULT = Platform.select( {\n\tweb: true,\n\tnative: false,\n} );\n\nconst BLOCK_INSPECTOR_IDENTIFIER = 'edit-widgets/block-inspector';\n\n// Widget areas were one called block areas, so use 'edit-widgets/block-areas'\n// for backwards compatibility.\nconst WIDGET_AREAS_IDENTIFIER = 'edit-widgets/block-areas';\n\n/**\n * Internal dependencies\n */\nimport WidgetAreas from './widget-areas';\nimport { store as editWidgetsStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\n\nconst { Tabs } = unlock( componentsPrivateApis );\n\nfunction SidebarHeader( { selectedWidgetAreaBlock } ) {\n\treturn (\n\t\t<Tabs.TabList>\n\t\t\t<Tabs.Tab tabId={ WIDGET_AREAS_IDENTIFIER }>\n\t\t\t\t{ selectedWidgetAreaBlock\n\t\t\t\t\t? selectedWidgetAreaBlock.attributes.name\n\t\t\t\t\t: __( 'Widget Areas' ) }\n\t\t\t</Tabs.Tab>\n\t\t\t<Tabs.Tab tabId={ BLOCK_INSPECTOR_IDENTIFIER }>\n\t\t\t\t{ __( 'Block' ) }\n\t\t\t</Tabs.Tab>\n\t\t</Tabs.TabList>\n\t);\n}\n\nfunction SidebarContent( {\n\thasSelectedNonAreaBlock,\n\tcurrentArea,\n\tisGeneralSidebarOpen,\n\tselectedWidgetAreaBlock,\n} ) {\n\tconst { enableComplementaryArea } = useDispatch( interfaceStore );\n\n\tuseEffect( () => {\n\t\tif (\n\t\t\thasSelectedNonAreaBlock &&\n\t\t\tcurrentArea === WIDGET_AREAS_IDENTIFIER &&\n\t\t\tisGeneralSidebarOpen\n\t\t) {\n\t\t\tenableComplementaryArea(\n\t\t\t\t'core/edit-widgets',\n\t\t\t\tBLOCK_INSPECTOR_IDENTIFIER\n\t\t\t);\n\t\t}\n\t\tif (\n\t\t\t! hasSelectedNonAreaBlock &&\n\t\t\tcurrentArea === BLOCK_INSPECTOR_IDENTIFIER &&\n\t\t\tisGeneralSidebarOpen\n\t\t) {\n\t\t\tenableComplementaryArea(\n\t\t\t\t'core/edit-widgets',\n\t\t\t\tWIDGET_AREAS_IDENTIFIER\n\t\t\t);\n\t\t}\n\t\t// We're intentionally leaving `currentArea` and `isGeneralSidebarOpen`\n\t\t// out of the dep array because we want this effect to run based on\n\t\t// block selection changes, not sidebar state changes.\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t}, [ hasSelectedNonAreaBlock, enableComplementaryArea ] );\n\n\tconst tabsContextValue = useContext( Tabs.Context );\n\n\treturn (\n\t\t<ComplementaryArea\n\t\t\tclassName=\"edit-widgets-sidebar\"\n\t\t\theader={\n\t\t\t\t<Tabs.Context.Provider value={ tabsContextValue }>\n\t\t\t\t\t<SidebarHeader\n\t\t\t\t\t\tselectedWidgetAreaBlock={ selectedWidgetAreaBlock }\n\t\t\t\t\t/>\n\t\t\t\t</Tabs.Context.Provider>\n\t\t\t}\n\t\t\theaderClassName=\"edit-widgets-sidebar__panel-tabs\"\n\t\t\t/* translators: button label text should, if possible, be under 16 characters. */\n\t\t\ttitle={ __( 'Settings' ) }\n\t\t\tcloseLabel={ __( 'Close Settings' ) }\n\t\t\tscope=\"core/edit-widgets\"\n\t\t\tidentifier={ currentArea }\n\t\t\ticon={ isRTL() ? drawerLeft : drawerRight }\n\t\t\tisActiveByDefault={ SIDEBAR_ACTIVE_BY_DEFAULT }\n\t\t>\n\t\t\t<Tabs.Context.Provider value={ tabsContextValue }>\n\t\t\t\t<Tabs.TabPanel\n\t\t\t\t\ttabId={ WIDGET_AREAS_IDENTIFIER }\n\t\t\t\t\tfocusable={ false }\n\t\t\t\t>\n\t\t\t\t\t<WidgetAreas\n\t\t\t\t\t\tselectedWidgetAreaId={\n\t\t\t\t\t\t\tselectedWidgetAreaBlock?.attributes.id\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t</Tabs.TabPanel>\n\t\t\t\t<Tabs.TabPanel\n\t\t\t\t\ttabId={ BLOCK_INSPECTOR_IDENTIFIER }\n\t\t\t\t\tfocusable={ false }\n\t\t\t\t>\n\t\t\t\t\t{ hasSelectedNonAreaBlock ? (\n\t\t\t\t\t\t<BlockInspector />\n\t\t\t\t\t) : (\n\t\t\t\t\t\t// Pretend that Widget Areas are part of the UI by not\n\t\t\t\t\t\t// showing the Block Inspector when one is selected.\n\t\t\t\t\t\t<span className=\"block-editor-block-inspector__no-blocks\">\n\t\t\t\t\t\t\t{ __( 'No block selected.' ) }\n\t\t\t\t\t\t</span>\n\t\t\t\t\t) }\n\t\t\t\t</Tabs.TabPanel>\n\t\t\t</Tabs.Context.Provider>\n\t\t</ComplementaryArea>\n\t);\n}\n\nexport default function Sidebar() {\n\tconst {\n\t\tcurrentArea,\n\t\thasSelectedNonAreaBlock,\n\t\tisGeneralSidebarOpen,\n\t\tselectedWidgetAreaBlock,\n\t} = useSelect( ( select ) => {\n\t\tconst { getSelectedBlock, getBlock, getBlockParentsByBlockName } =\n\t\t\tselect( blockEditorStore );\n\t\tconst { getActiveComplementaryArea } = select( interfaceStore );\n\n\t\tconst selectedBlock = getSelectedBlock();\n\n\t\tconst activeArea = getActiveComplementaryArea( editWidgetsStore.name );\n\n\t\tlet currentSelection = activeArea;\n\t\tif ( ! currentSelection ) {\n\t\t\tif ( selectedBlock ) {\n\t\t\t\tcurrentSelection = BLOCK_INSPECTOR_IDENTIFIER;\n\t\t\t} else {\n\t\t\t\tcurrentSelection = WIDGET_AREAS_IDENTIFIER;\n\t\t\t}\n\t\t}\n\n\t\tlet widgetAreaBlock;\n\t\tif ( selectedBlock ) {\n\t\t\tif ( selectedBlock.name === 'core/widget-area' ) {\n\t\t\t\twidgetAreaBlock = selectedBlock;\n\t\t\t} else {\n\t\t\t\twidgetAreaBlock = getBlock(\n\t\t\t\t\tgetBlockParentsByBlockName(\n\t\t\t\t\t\tselectedBlock.clientId,\n\t\t\t\t\t\t'core/widget-area'\n\t\t\t\t\t)[ 0 ]\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\n\t\treturn {\n\t\t\tcurrentArea: currentSelection,\n\t\t\thasSelectedNonAreaBlock: !! (\n\t\t\t\tselectedBlock && selectedBlock.name !== 'core/widget-area'\n\t\t\t),\n\t\t\tisGeneralSidebarOpen: !! activeArea,\n\t\t\tselectedWidgetAreaBlock: widgetAreaBlock,\n\t\t};\n\t}, [] );\n\n\tconst { enableComplementaryArea } = useDispatch( interfaceStore );\n\n\t// `newSelectedTabId` could technically be falsey if no tab is selected (i.e.\n\t// the initial render) or when we don't want a tab displayed (i.e. the\n\t// sidebar is closed). These cases should both be covered by the `!!` check\n\t// below, so we shouldn't need any additional falsey handling.\n\tconst onTabSelect = useCallback(\n\t\t( newSelectedTabId ) => {\n\t\t\tif ( !! newSelectedTabId ) {\n\t\t\t\tenableComplementaryArea(\n\t\t\t\t\teditWidgetsStore.name,\n\t\t\t\t\tnewSelectedTabId\n\t\t\t\t);\n\t\t\t}\n\t\t},\n\t\t[ enableComplementaryArea ]\n\t);\n\n\treturn (\n\t\t<Tabs\n\t\t\t// Due to how this component is controlled (via a value from the\n\t\t\t// `interfaceStore`), when the sidebar closes the currently selected\n\t\t\t// tab can't be found. This causes the component to continuously reset\n\t\t\t// the selection to `null` in an infinite loop. Proactively setting\n\t\t\t// the selected tab to `null` avoids that.\n\t\t\tselectedTabId={ isGeneralSidebarOpen ? currentArea : null }\n\t\t\tonSelect={ onTabSelect }\n\t\t\tselectOnMove={ false }\n\t\t>\n\t\t\t<SidebarContent\n\t\t\t\thasSelectedNonAreaBlock={ hasSelectedNonAreaBlock }\n\t\t\t\tcurrentArea={ currentArea }\n\t\t\t\tisGeneralSidebarOpen={ isGeneralSidebarOpen }\n\t\t\t\tselectedWidgetAreaBlock={ selectedWidgetAreaBlock }\n\t\t\t/>\n\t\t</Tabs>\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SACCA,SAAS,EACTC,QAAQ,EACRC,UAAU,EACVC,WAAW,QACL,oBAAoB;AAC3B,SAASC,KAAK,EAAEC,EAAE,QAAQ,iBAAiB;AAC3C,SACCC,iBAAiB,EACjBC,KAAK,IAAIC,cAAc,QACjB,sBAAsB;AAC7B,SACCC,cAAc,EACdF,KAAK,IAAIG,gBAAgB,QACnB,yBAAyB;AAEhC,SAASC,UAAU,EAAEC,WAAW,QAAQ,kBAAkB;AAC1D,SAASC,WAAW,IAAIC,qBAAqB,QAAQ,uBAAuB;AAC5E,SAASC,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AAExD,MAAMC,yBAAyB,GAAGhB,QAAQ,CAACiB,MAAM,CAAE;EAClDC,GAAG,EAAE,IAAI;EACTC,MAAM,EAAE;AACT,CAAE,CAAC;AAEH,MAAMC,0BAA0B,GAAG,8BAA8B;;AAEjE;AACA;AACA,MAAMC,uBAAuB,GAAG,0BAA0B;;AAE1D;AACA;AACA;AACA,OAAOC,WAAW,MAAM,gBAAgB;AACxC,SAAShB,KAAK,IAAIiB,gBAAgB,QAAQ,aAAa;AACvD,SAASC,MAAM,QAAQ,mBAAmB;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAAA,SAAAC,IAAA,IA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ACD,CAAC,EACD,CAAE7B,uBAAuB,CAC1B,CAAC;EAED,oBACChB,IAAA,CAACG;EACA;EACA;EACA;EACA;EACA;EAAA;IACA2C,aAAa,EAAG/B,oBAAoB,GAAGD,WAAW,GAAG,IAAM;IAC3DiC,QAAQ,EAAGH,WAAa;IACxBI,YAAY,EAAG,KAAO;IAAAzC,QAAA,eAEtBP,IAAA,CAACY,cAAc;MACdC,uBAAuB,EAAGA,uBAAyB;MACnDC,WAAW,EAAGA,WAAa;MAC3BC,oBAAoB,EAAGA,oBAAsB;MAC7CV,uBAAuB,EAAGA;IAAyB,CACnD;EAAC,CACG,CAAC;AAET","ignoreList":[]}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { createElement } from "react";
|
|
2
1
|
/**
|
|
3
2
|
* WordPress dependencies
|
|
4
3
|
*/
|
|
@@ -15,6 +14,8 @@ import { safeHTML } from '@wordpress/dom';
|
|
|
15
14
|
* Internal dependencies
|
|
16
15
|
*/
|
|
17
16
|
import { store as editWidgetsStore } from '../../store';
|
|
17
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
18
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
18
19
|
export default function WidgetAreas({
|
|
19
20
|
selectedWidgetAreaId
|
|
20
21
|
}) {
|
|
@@ -28,26 +29,33 @@ export default function WidgetAreas({
|
|
|
28
29
|
} else {
|
|
29
30
|
description = selectedWidgetArea.description;
|
|
30
31
|
}
|
|
31
|
-
return
|
|
32
|
-
className: "edit-widgets-widget-areas"
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
32
|
+
return /*#__PURE__*/_jsx("div", {
|
|
33
|
+
className: "edit-widgets-widget-areas",
|
|
34
|
+
children: /*#__PURE__*/_jsxs("div", {
|
|
35
|
+
className: "edit-widgets-widget-areas__top-container",
|
|
36
|
+
children: [/*#__PURE__*/_jsx(BlockIcon, {
|
|
37
|
+
icon: blockDefault
|
|
38
|
+
}), /*#__PURE__*/_jsxs("div", {
|
|
39
|
+
children: [/*#__PURE__*/_jsx("p", {
|
|
40
|
+
// Use `dangerouslySetInnerHTML` to keep backwards
|
|
41
|
+
// compatibility. Basic markup in the description is an
|
|
42
|
+
// established feature of WordPress.
|
|
43
|
+
// @see https://github.com/WordPress/gutenberg/issues/33106
|
|
44
|
+
dangerouslySetInnerHTML: {
|
|
45
|
+
__html: safeHTML(description)
|
|
46
|
+
}
|
|
47
|
+
}), widgetAreas?.length === 0 && /*#__PURE__*/_jsx("p", {
|
|
48
|
+
children: __('Your theme does not contain any Widget Areas.')
|
|
49
|
+
}), !selectedWidgetArea && /*#__PURE__*/_jsx(Button, {
|
|
50
|
+
href: addQueryArgs('customize.php', {
|
|
51
|
+
'autofocus[panel]': 'widgets',
|
|
52
|
+
return: window.location.pathname
|
|
53
|
+
}),
|
|
54
|
+
variant: "tertiary",
|
|
55
|
+
children: __('Manage with live preview')
|
|
56
|
+
})]
|
|
57
|
+
})]
|
|
58
|
+
})
|
|
59
|
+
});
|
|
52
60
|
}
|
|
53
61
|
//# sourceMappingURL=widget-areas.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useSelect","useMemo","blockDefault","BlockIcon","Button","__","addQueryArgs","safeHTML","store","editWidgetsStore","WidgetAreas","selectedWidgetAreaId","widgetAreas","select","getWidgetAreas","selectedWidgetArea","find","widgetArea","id","description","
|
|
1
|
+
{"version":3,"names":["useSelect","useMemo","blockDefault","BlockIcon","Button","__","addQueryArgs","safeHTML","store","editWidgetsStore","jsx","_jsx","jsxs","_jsxs","WidgetAreas","selectedWidgetAreaId","widgetAreas","select","getWidgetAreas","selectedWidgetArea","find","widgetArea","id","description","className","children","icon","dangerouslySetInnerHTML","__html","length","href","return","window","location","pathname","variant"],"sources":["@wordpress/edit-widgets/src/components/sidebar/widget-areas.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { useMemo } from '@wordpress/element';\nimport { blockDefault } from '@wordpress/icons';\nimport { BlockIcon } from '@wordpress/block-editor';\nimport { Button } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { addQueryArgs } from '@wordpress/url';\nimport { safeHTML } from '@wordpress/dom';\n\n/**\n * Internal dependencies\n */\nimport { store as editWidgetsStore } from '../../store';\n\nexport default function WidgetAreas( { selectedWidgetAreaId } ) {\n\tconst widgetAreas = useSelect(\n\t\t( select ) => select( editWidgetsStore ).getWidgetAreas(),\n\t\t[]\n\t);\n\n\tconst selectedWidgetArea = useMemo(\n\t\t() =>\n\t\t\tselectedWidgetAreaId &&\n\t\t\twidgetAreas?.find(\n\t\t\t\t( widgetArea ) => widgetArea.id === selectedWidgetAreaId\n\t\t\t),\n\t\t[ selectedWidgetAreaId, widgetAreas ]\n\t);\n\n\tlet description;\n\tif ( ! selectedWidgetArea ) {\n\t\tdescription = __(\n\t\t\t'Widget Areas are global parts in your site’s layout that can accept blocks. These vary by theme, but are typically parts like your Sidebar or Footer.'\n\t\t);\n\t} else if ( selectedWidgetAreaId === 'wp_inactive_widgets' ) {\n\t\tdescription = __(\n\t\t\t'Blocks in this Widget Area will not be displayed in your site.'\n\t\t);\n\t} else {\n\t\tdescription = selectedWidgetArea.description;\n\t}\n\n\treturn (\n\t\t<div className=\"edit-widgets-widget-areas\">\n\t\t\t<div className=\"edit-widgets-widget-areas__top-container\">\n\t\t\t\t<BlockIcon icon={ blockDefault } />\n\t\t\t\t<div>\n\t\t\t\t\t<p\n\t\t\t\t\t\t// Use `dangerouslySetInnerHTML` to keep backwards\n\t\t\t\t\t\t// compatibility. Basic markup in the description is an\n\t\t\t\t\t\t// established feature of WordPress.\n\t\t\t\t\t\t// @see https://github.com/WordPress/gutenberg/issues/33106\n\t\t\t\t\t\tdangerouslySetInnerHTML={ {\n\t\t\t\t\t\t\t__html: safeHTML( description ),\n\t\t\t\t\t\t} }\n\t\t\t\t\t/>\n\t\t\t\t\t{ widgetAreas?.length === 0 && (\n\t\t\t\t\t\t<p>\n\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t'Your theme does not contain any Widget Areas.'\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</p>\n\t\t\t\t\t) }\n\t\t\t\t\t{ ! selectedWidgetArea && (\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\thref={ addQueryArgs( 'customize.php', {\n\t\t\t\t\t\t\t\t'autofocus[panel]': 'widgets',\n\t\t\t\t\t\t\t\treturn: window.location.pathname,\n\t\t\t\t\t\t\t} ) }\n\t\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Manage with live preview' ) }\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t) }\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t</div>\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,OAAO,QAAQ,oBAAoB;AAC5C,SAASC,YAAY,QAAQ,kBAAkB;AAC/C,SAASC,SAAS,QAAQ,yBAAyB;AACnD,SAASC,MAAM,QAAQ,uBAAuB;AAC9C,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SAASC,YAAY,QAAQ,gBAAgB;AAC7C,SAASC,QAAQ,QAAQ,gBAAgB;;AAEzC;AACA;AACA;AACA,SAASC,KAAK,IAAIC,gBAAgB,QAAQ,aAAa;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAAA,SAAAC,IAAA,IAAAC,KAAA;AAExD,eAAe,SAASC,WAAWA,CAAE;EAAEC;AAAqB,CAAC,EAAG;EAC/D,MAAMC,WAAW,GAAGhB,SAAS,CAC1BiB,MAAM,IAAMA,MAA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AAC;IAAA,CACF;EAAC,CACF,CAAC;AAER","ignoreList":[]}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { createElement, Fragment } from "react";
|
|
2
1
|
/**
|
|
3
2
|
* WordPress dependencies
|
|
4
3
|
*/
|
|
@@ -12,6 +11,9 @@ import { store as preferencesStore } from '@wordpress/preferences';
|
|
|
12
11
|
* Internal dependencies
|
|
13
12
|
*/
|
|
14
13
|
import { store as editWidgetsStore } from '../../store';
|
|
14
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
15
|
+
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
16
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
15
17
|
export default function WelcomeGuide() {
|
|
16
18
|
var _widgetAreas$filter$l;
|
|
17
19
|
const isActive = useSelect(select => !!select(preferencesStore).get('core/edit-widgets', 'welcomeGuide'), []);
|
|
@@ -26,67 +28,93 @@ export default function WelcomeGuide() {
|
|
|
26
28
|
}
|
|
27
29
|
const isEntirelyBlockWidgets = widgetAreas?.every(widgetArea => widgetArea.id === 'wp_inactive_widgets' || widgetArea.widgets.every(widgetId => widgetId.startsWith('block-')));
|
|
28
30
|
const numWidgetAreas = (_widgetAreas$filter$l = widgetAreas?.filter(widgetArea => widgetArea.id !== 'wp_inactive_widgets').length) !== null && _widgetAreas$filter$l !== void 0 ? _widgetAreas$filter$l : 0;
|
|
29
|
-
return
|
|
31
|
+
return /*#__PURE__*/_jsx(Guide, {
|
|
30
32
|
className: "edit-widgets-welcome-guide",
|
|
31
33
|
contentLabel: __('Welcome to block Widgets'),
|
|
32
34
|
finishButtonText: __('Get started'),
|
|
33
35
|
onFinish: () => toggle('core/edit-widgets', 'welcomeGuide'),
|
|
34
36
|
pages: [{
|
|
35
|
-
image:
|
|
37
|
+
image: /*#__PURE__*/_jsx(WelcomeGuideImage, {
|
|
36
38
|
nonAnimatedSrc: "https://s.w.org/images/block-editor/welcome-canvas.svg",
|
|
37
39
|
animatedSrc: "https://s.w.org/images/block-editor/welcome-canvas.gif"
|
|
38
40
|
}),
|
|
39
|
-
content:
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
41
|
+
content: /*#__PURE__*/_jsxs(_Fragment, {
|
|
42
|
+
children: [/*#__PURE__*/_jsx("h1", {
|
|
43
|
+
className: "edit-widgets-welcome-guide__heading",
|
|
44
|
+
children: __('Welcome to block Widgets')
|
|
45
|
+
}), isEntirelyBlockWidgets ? /*#__PURE__*/_jsx(_Fragment, {
|
|
46
|
+
children: /*#__PURE__*/_jsx("p", {
|
|
47
|
+
className: "edit-widgets-welcome-guide__text",
|
|
48
|
+
children: sprintf(
|
|
49
|
+
// Translators: %s: Number of block areas in the current theme.
|
|
50
|
+
_n('Your theme provides %s “block” area for you to add and edit content. Try adding a search bar, social icons, or other types of blocks here and see how they’ll look on your site.', 'Your theme provides %s different “block” areas for you to add and edit content. Try adding a search bar, social icons, or other types of blocks here and see how they’ll look on your site.', numWidgetAreas), numWidgetAreas)
|
|
51
|
+
})
|
|
52
|
+
}) : /*#__PURE__*/_jsxs(_Fragment, {
|
|
53
|
+
children: [/*#__PURE__*/_jsx("p", {
|
|
54
|
+
className: "edit-widgets-welcome-guide__text",
|
|
55
|
+
children: __('You can now add any block to your site’s widget areas. Don’t worry, all of your favorite widgets still work flawlessly.')
|
|
56
|
+
}), /*#__PURE__*/_jsxs("p", {
|
|
57
|
+
className: "edit-widgets-welcome-guide__text",
|
|
58
|
+
children: [/*#__PURE__*/_jsx("strong", {
|
|
59
|
+
children: __('Want to stick with the old widgets?')
|
|
60
|
+
}), ' ', /*#__PURE__*/_jsx(ExternalLink, {
|
|
61
|
+
href: __('https://wordpress.org/plugins/classic-widgets/'),
|
|
62
|
+
children: __('Get the Classic Widgets plugin.')
|
|
63
|
+
})]
|
|
64
|
+
})]
|
|
65
|
+
})]
|
|
66
|
+
})
|
|
52
67
|
}, {
|
|
53
|
-
image:
|
|
68
|
+
image: /*#__PURE__*/_jsx(WelcomeGuideImage, {
|
|
54
69
|
nonAnimatedSrc: "https://s.w.org/images/block-editor/welcome-editor.svg",
|
|
55
70
|
animatedSrc: "https://s.w.org/images/block-editor/welcome-editor.gif"
|
|
56
71
|
}),
|
|
57
|
-
content:
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
72
|
+
content: /*#__PURE__*/_jsxs(_Fragment, {
|
|
73
|
+
children: [/*#__PURE__*/_jsx("h1", {
|
|
74
|
+
className: "edit-widgets-welcome-guide__heading",
|
|
75
|
+
children: __('Make each block your own')
|
|
76
|
+
}), /*#__PURE__*/_jsx("p", {
|
|
77
|
+
className: "edit-widgets-welcome-guide__text",
|
|
78
|
+
children: __('Each block comes with its own set of controls for changing things like color, width, and alignment. These will show and hide automatically when you have a block selected.')
|
|
79
|
+
})]
|
|
80
|
+
})
|
|
62
81
|
}, {
|
|
63
|
-
image:
|
|
82
|
+
image: /*#__PURE__*/_jsx(WelcomeGuideImage, {
|
|
64
83
|
nonAnimatedSrc: "https://s.w.org/images/block-editor/welcome-library.svg",
|
|
65
84
|
animatedSrc: "https://s.w.org/images/block-editor/welcome-library.gif"
|
|
66
85
|
}),
|
|
67
|
-
content:
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
86
|
+
content: /*#__PURE__*/_jsxs(_Fragment, {
|
|
87
|
+
children: [/*#__PURE__*/_jsx("h1", {
|
|
88
|
+
className: "edit-widgets-welcome-guide__heading",
|
|
89
|
+
children: __('Get to know the block library')
|
|
90
|
+
}), /*#__PURE__*/_jsx("p", {
|
|
91
|
+
className: "edit-widgets-welcome-guide__text",
|
|
92
|
+
children: createInterpolateElement(__('All of the blocks available to you live in the block library. You’ll find it wherever you see the <InserterIconImage /> icon.'), {
|
|
93
|
+
InserterIconImage: /*#__PURE__*/_jsx("img", {
|
|
94
|
+
className: "edit-widgets-welcome-guide__inserter-icon",
|
|
95
|
+
alt: __('inserter'),
|
|
96
|
+
src: "data:image/svg+xml,%3Csvg width='18' height='18' viewBox='0 0 18 18' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Crect width='18' height='18' rx='2' fill='%231E1E1E'/%3E%3Cpath d='M9.22727 4V14M4 8.77273H14' stroke='white' stroke-width='1.5'/%3E%3C/svg%3E%0A"
|
|
97
|
+
})
|
|
98
|
+
})
|
|
99
|
+
})]
|
|
100
|
+
})
|
|
78
101
|
}, {
|
|
79
|
-
image:
|
|
102
|
+
image: /*#__PURE__*/_jsx(WelcomeGuideImage, {
|
|
80
103
|
nonAnimatedSrc: "https://s.w.org/images/block-editor/welcome-documentation.svg",
|
|
81
104
|
animatedSrc: "https://s.w.org/images/block-editor/welcome-documentation.gif"
|
|
82
105
|
}),
|
|
83
|
-
content:
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
106
|
+
content: /*#__PURE__*/_jsxs(_Fragment, {
|
|
107
|
+
children: [/*#__PURE__*/_jsx("h1", {
|
|
108
|
+
className: "edit-widgets-welcome-guide__heading",
|
|
109
|
+
children: __('Learn how to use the block editor')
|
|
110
|
+
}), /*#__PURE__*/_jsxs("p", {
|
|
111
|
+
className: "edit-widgets-welcome-guide__text",
|
|
112
|
+
children: [__('New to the block editor? Want to learn more about using it? '), /*#__PURE__*/_jsx(ExternalLink, {
|
|
113
|
+
href: __('https://wordpress.org/documentation/article/wordpress-block-editor/'),
|
|
114
|
+
children: __("Here's a detailed guide.")
|
|
115
|
+
})]
|
|
116
|
+
})]
|
|
117
|
+
})
|
|
90
118
|
}]
|
|
91
119
|
});
|
|
92
120
|
}
|
|
@@ -94,16 +122,17 @@ function WelcomeGuideImage({
|
|
|
94
122
|
nonAnimatedSrc,
|
|
95
123
|
animatedSrc
|
|
96
124
|
}) {
|
|
97
|
-
return
|
|
98
|
-
className: "edit-widgets-welcome-guide__image"
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
125
|
+
return /*#__PURE__*/_jsxs("picture", {
|
|
126
|
+
className: "edit-widgets-welcome-guide__image",
|
|
127
|
+
children: [/*#__PURE__*/_jsx("source", {
|
|
128
|
+
srcSet: nonAnimatedSrc,
|
|
129
|
+
media: "(prefers-reduced-motion: reduce)"
|
|
130
|
+
}), /*#__PURE__*/_jsx("img", {
|
|
131
|
+
src: animatedSrc,
|
|
132
|
+
width: "312",
|
|
133
|
+
height: "240",
|
|
134
|
+
alt: ""
|
|
135
|
+
})]
|
|
136
|
+
});
|
|
108
137
|
}
|
|
109
138
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useSelect","useDispatch","ExternalLink","Guide","__","sprintf","_n","createInterpolateElement","store","preferencesStore","editWidgetsStore","WelcomeGuide","_widgetAreas$filter$l","isActive","select","get","toggle","widgetAreas","getWidgetAreas","per_page","isEntirelyBlockWidgets","every","widgetArea","id","widgets","widgetId","startsWith","numWidgetAreas","filter","length","createElement","className","contentLabel","finishButtonText","onFinish","pages","image","WelcomeGuideImage","nonAnimatedSrc","animatedSrc","content","Fragment","href","InserterIconImage","alt","src","srcSet","media","width","height"],"sources":["@wordpress/edit-widgets/src/components/welcome-guide/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { ExternalLink, Guide } from '@wordpress/components';\nimport { __, sprintf, _n } from '@wordpress/i18n';\nimport { createInterpolateElement } from '@wordpress/element';\nimport { store as preferencesStore } from '@wordpress/preferences';\n\n/**\n * Internal dependencies\n */\nimport { store as editWidgetsStore } from '../../store';\n\nexport default function WelcomeGuide() {\n\tconst isActive = useSelect(\n\t\t( select ) =>\n\t\t\t!! select( preferencesStore ).get(\n\t\t\t\t'core/edit-widgets',\n\t\t\t\t'welcomeGuide'\n\t\t\t),\n\t\t[]\n\t);\n\n\tconst { toggle } = useDispatch( preferencesStore );\n\n\tconst widgetAreas = useSelect(\n\t\t( select ) =>\n\t\t\tselect( editWidgetsStore ).getWidgetAreas( { per_page: -1 } ),\n\t\t[]\n\t);\n\n\tif ( ! isActive ) {\n\t\treturn null;\n\t}\n\n\tconst isEntirelyBlockWidgets = widgetAreas?.every(\n\t\t( widgetArea ) =>\n\t\t\twidgetArea.id === 'wp_inactive_widgets' ||\n\t\t\twidgetArea.widgets.every( ( widgetId ) =>\n\t\t\t\twidgetId.startsWith( 'block-' )\n\t\t\t)\n\t);\n\n\tconst numWidgetAreas =\n\t\twidgetAreas?.filter(\n\t\t\t( widgetArea ) => widgetArea.id !== 'wp_inactive_widgets'\n\t\t).length ?? 0;\n\n\treturn (\n\t\t<Guide\n\t\t\tclassName=\"edit-widgets-welcome-guide\"\n\t\t\tcontentLabel={ __( 'Welcome to block Widgets' ) }\n\t\t\tfinishButtonText={ __( 'Get started' ) }\n\t\t\tonFinish={ () => toggle( 'core/edit-widgets', 'welcomeGuide' ) }\n\t\t\tpages={ [\n\t\t\t\t{\n\t\t\t\t\timage: (\n\t\t\t\t\t\t<WelcomeGuideImage\n\t\t\t\t\t\t\tnonAnimatedSrc=\"https://s.w.org/images/block-editor/welcome-canvas.svg\"\n\t\t\t\t\t\t\tanimatedSrc=\"https://s.w.org/images/block-editor/welcome-canvas.gif\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t),\n\t\t\t\t\tcontent: (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<h1 className=\"edit-widgets-welcome-guide__heading\">\n\t\t\t\t\t\t\t\t{ __( 'Welcome to block Widgets' ) }\n\t\t\t\t\t\t\t</h1>\n\t\t\t\t\t\t\t{ isEntirelyBlockWidgets ? (\n\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t<p className=\"edit-widgets-welcome-guide__text\">\n\t\t\t\t\t\t\t\t\t\t{ sprintf(\n\t\t\t\t\t\t\t\t\t\t\t// Translators: %s: Number of block areas in the current theme.\n\t\t\t\t\t\t\t\t\t\t\t_n(\n\t\t\t\t\t\t\t\t\t\t\t\t'Your theme provides %s “block” area for you to add and edit content. Try adding a search bar, social icons, or other types of blocks here and see how they’ll look on your site.',\n\t\t\t\t\t\t\t\t\t\t\t\t'Your theme provides %s different “block” areas for you to add and edit content. Try adding a search bar, social icons, or other types of blocks here and see how they’ll look on your site.',\n\t\t\t\t\t\t\t\t\t\t\t\tnumWidgetAreas\n\t\t\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\t\t\tnumWidgetAreas\n\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t</p>\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\t<>\n\t\t\t\t\t\t\t\t\t<p className=\"edit-widgets-welcome-guide__text\">\n\t\t\t\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t\t\t\t'You can now add any block to your site’s widget areas. Don’t worry, all of your favorite widgets still work flawlessly.'\n\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t</p>\n\t\t\t\t\t\t\t\t\t<p className=\"edit-widgets-welcome-guide__text\">\n\t\t\t\t\t\t\t\t\t\t<strong>\n\t\t\t\t\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t\t\t\t\t'Want to stick with the old widgets?'\n\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t</strong>{ ' ' }\n\t\t\t\t\t\t\t\t\t\t<ExternalLink\n\t\t\t\t\t\t\t\t\t\t\thref={ __(\n\t\t\t\t\t\t\t\t\t\t\t\t'https://wordpress.org/plugins/classic-widgets/'\n\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t\t\t\t\t'Get the Classic Widgets plugin.'\n\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t</ExternalLink>\n\t\t\t\t\t\t\t\t\t</p>\n\t\t\t\t\t\t\t\t</>\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},\n\t\t\t\t{\n\t\t\t\t\timage: (\n\t\t\t\t\t\t<WelcomeGuideImage\n\t\t\t\t\t\t\tnonAnimatedSrc=\"https://s.w.org/images/block-editor/welcome-editor.svg\"\n\t\t\t\t\t\t\tanimatedSrc=\"https://s.w.org/images/block-editor/welcome-editor.gif\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t),\n\t\t\t\t\tcontent: (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<h1 className=\"edit-widgets-welcome-guide__heading\">\n\t\t\t\t\t\t\t\t{ __( 'Make each block your own' ) }\n\t\t\t\t\t\t\t</h1>\n\t\t\t\t\t\t\t<p className=\"edit-widgets-welcome-guide__text\">\n\t\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t\t'Each block comes with its own set of controls for changing things like color, width, and alignment. These will show and hide automatically when you have a block selected.'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t</p>\n\t\t\t\t\t\t</>\n\t\t\t\t\t),\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\timage: (\n\t\t\t\t\t\t<WelcomeGuideImage\n\t\t\t\t\t\t\tnonAnimatedSrc=\"https://s.w.org/images/block-editor/welcome-library.svg\"\n\t\t\t\t\t\t\tanimatedSrc=\"https://s.w.org/images/block-editor/welcome-library.gif\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t),\n\t\t\t\t\tcontent: (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<h1 className=\"edit-widgets-welcome-guide__heading\">\n\t\t\t\t\t\t\t\t{ __( 'Get to know the block library' ) }\n\t\t\t\t\t\t\t</h1>\n\t\t\t\t\t\t\t<p className=\"edit-widgets-welcome-guide__text\">\n\t\t\t\t\t\t\t\t{ createInterpolateElement(\n\t\t\t\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t\t\t\t'All of the blocks available to you live in the block library. You’ll find it wherever you see the <InserterIconImage /> icon.'\n\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tInserterIconImage: (\n\t\t\t\t\t\t\t\t\t\t\t<img\n\t\t\t\t\t\t\t\t\t\t\t\tclassName=\"edit-widgets-welcome-guide__inserter-icon\"\n\t\t\t\t\t\t\t\t\t\t\t\talt={ __( 'inserter' ) }\n\t\t\t\t\t\t\t\t\t\t\t\tsrc=\"data:image/svg+xml,%3Csvg width='18' height='18' viewBox='0 0 18 18' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Crect width='18' height='18' rx='2' fill='%231E1E1E'/%3E%3Cpath d='M9.22727 4V14M4 8.77273H14' stroke='white' stroke-width='1.5'/%3E%3C/svg%3E%0A\"\n\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t),\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</p>\n\t\t\t\t\t\t</>\n\t\t\t\t\t),\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\timage: (\n\t\t\t\t\t\t<WelcomeGuideImage\n\t\t\t\t\t\t\tnonAnimatedSrc=\"https://s.w.org/images/block-editor/welcome-documentation.svg\"\n\t\t\t\t\t\t\tanimatedSrc=\"https://s.w.org/images/block-editor/welcome-documentation.gif\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t),\n\t\t\t\t\tcontent: (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<h1 className=\"edit-widgets-welcome-guide__heading\">\n\t\t\t\t\t\t\t\t{ __( 'Learn how to use the block editor' ) }\n\t\t\t\t\t\t\t</h1>\n\t\t\t\t\t\t\t<p className=\"edit-widgets-welcome-guide__text\">\n\t\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t\t'New to the block editor? Want to learn more about using it? '\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t<ExternalLink\n\t\t\t\t\t\t\t\t\thref={ __(\n\t\t\t\t\t\t\t\t\t\t'https://wordpress.org/documentation/article/wordpress-block-editor/'\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\t\t{ __( \"Here's a detailed guide.\" ) }\n\t\t\t\t\t\t\t\t</ExternalLink>\n\t\t\t\t\t\t\t</p>\n\t\t\t\t\t\t</>\n\t\t\t\t\t),\n\t\t\t\t},\n\t\t\t] }\n\t\t/>\n\t);\n}\n\nfunction WelcomeGuideImage( { nonAnimatedSrc, animatedSrc } ) {\n\treturn (\n\t\t<picture className=\"edit-widgets-welcome-guide__image\">\n\t\t\t<source\n\t\t\t\tsrcSet={ nonAnimatedSrc }\n\t\t\t\tmedia=\"(prefers-reduced-motion: reduce)\"\n\t\t\t/>\n\t\t\t<img src={ animatedSrc } width=\"312\" height=\"240\" alt=\"\" />\n\t\t</picture>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACxD,SAASC,YAAY,EAAEC,KAAK,QAAQ,uBAAuB;AAC3D,SAASC,EAAE,EAAEC,OAAO,EAAEC,EAAE,QAAQ,iBAAiB;AACjD,SAASC,wBAAwB,QAAQ,oBAAoB;AAC7D,SAASC,KAAK,IAAIC,gBAAgB,QAAQ,wBAAwB;;AAElE;AACA;AACA;AACA,SAASD,KAAK,IAAIE,gBAAgB,QAAQ,aAAa;AAEvD,eAAe,SAASC,YAAYA,CAAA,EAAG;EAAA,IAAAC,qBAAA;EACtC,MAAMC,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AChBb,aAAA;UACCC,SAAS,EAAC,2CAA2C;UACrDa,GAAG,EAAGxC,EAAE,CAAE,UAAW,CAAG;UACxByC,GAAG,EAAC;QAA2Q,CAC/Q;MAEH,CACD,CACE,CACF;IAEJ,CAAC,EACD;MACCT,KAAK,EACJN,aAAA,CAACO,iBAAiB;QACjBC,cAAc,EAAC,+DAA+D;QAC9EC,WAAW,EAAC;MAA+D,CAC3E,CACD;MACDC,OAAO,EACNV,aAAA,CAAAW,QAAA,QACCX,aAAA;QAAIC,SAAS,EAAC;MAAqC,GAChD3B,EAAE,CAAE,mCAAoC,CACvC,CAAC,EACL0B,aAAA;QAAGC,SAAS,EAAC;MAAkC,GAC5C3B,EAAE,CACH,8DACD,CAAC,EACD0B,aAAA,CAAC5B,YAAY;QACZwC,IAAI,EAAGtC,EAAE,CACR,qEACD;MAAG,GAEDA,EAAE,CAAE,0BAA2B,CACpB,CACZ,CACF;IAEJ,CAAC;EACC,CACH,CAAC;AAEJ;AAEA,SAASiC,iBAAiBA,CAAE;EAAEC,cAAc;EAAEC;AAAY,CAAC,EAAG;EAC7D,OACCT,aAAA;IAASC,SAAS,EAAC;EAAmC,GACrDD,aAAA;IACCgB,MAAM,EAAGR,cAAgB;IACzBS,KAAK,EAAC;EAAkC,CACxC,CAAC,EACFjB,aAAA;IAAKe,GAAG,EAAGN,WAAa;IAACS,KAAK,EAAC,KAAK;IAACC,MAAM,EAAC,KAAK;IAACL,GAAG,EAAC;EAAE,CAAE,CAClD,CAAC;AAEZ","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["useSelect","useDispatch","ExternalLink","Guide","__","sprintf","_n","createInterpolateElement","store","preferencesStore","editWidgetsStore","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","WelcomeGuide","_widgetAreas$filter$l","isActive","select","get","toggle","widgetAreas","getWidgetAreas","per_page","isEntirelyBlockWidgets","every","widgetArea","id","widgets","widgetId","startsWith","numWidgetAreas","filter","length","className","contentLabel","finishButtonText","onFinish","pages","image","WelcomeGuideImage","nonAnimatedSrc","animatedSrc","content","children","href","InserterIconImage","alt","src","srcSet","media","width","height"],"sources":["@wordpress/edit-widgets/src/components/welcome-guide/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { ExternalLink, Guide } from '@wordpress/components';\nimport { __, sprintf, _n } from '@wordpress/i18n';\nimport { createInterpolateElement } from '@wordpress/element';\nimport { store as preferencesStore } from '@wordpress/preferences';\n\n/**\n * Internal dependencies\n */\nimport { store as editWidgetsStore } from '../../store';\n\nexport default function WelcomeGuide() {\n\tconst isActive = useSelect(\n\t\t( select ) =>\n\t\t\t!! select( preferencesStore ).get(\n\t\t\t\t'core/edit-widgets',\n\t\t\t\t'welcomeGuide'\n\t\t\t),\n\t\t[]\n\t);\n\n\tconst { toggle } = useDispatch( preferencesStore );\n\n\tconst widgetAreas = useSelect(\n\t\t( select ) =>\n\t\t\tselect( editWidgetsStore ).getWidgetAreas( { per_page: -1 } ),\n\t\t[]\n\t);\n\n\tif ( ! isActive ) {\n\t\treturn null;\n\t}\n\n\tconst isEntirelyBlockWidgets = widgetAreas?.every(\n\t\t( widgetArea ) =>\n\t\t\twidgetArea.id === 'wp_inactive_widgets' ||\n\t\t\twidgetArea.widgets.every( ( widgetId ) =>\n\t\t\t\twidgetId.startsWith( 'block-' )\n\t\t\t)\n\t);\n\n\tconst numWidgetAreas =\n\t\twidgetAreas?.filter(\n\t\t\t( widgetArea ) => widgetArea.id !== 'wp_inactive_widgets'\n\t\t).length ?? 0;\n\n\treturn (\n\t\t<Guide\n\t\t\tclassName=\"edit-widgets-welcome-guide\"\n\t\t\tcontentLabel={ __( 'Welcome to block Widgets' ) }\n\t\t\tfinishButtonText={ __( 'Get started' ) }\n\t\t\tonFinish={ () => toggle( 'core/edit-widgets', 'welcomeGuide' ) }\n\t\t\tpages={ [\n\t\t\t\t{\n\t\t\t\t\timage: (\n\t\t\t\t\t\t<WelcomeGuideImage\n\t\t\t\t\t\t\tnonAnimatedSrc=\"https://s.w.org/images/block-editor/welcome-canvas.svg\"\n\t\t\t\t\t\t\tanimatedSrc=\"https://s.w.org/images/block-editor/welcome-canvas.gif\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t),\n\t\t\t\t\tcontent: (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<h1 className=\"edit-widgets-welcome-guide__heading\">\n\t\t\t\t\t\t\t\t{ __( 'Welcome to block Widgets' ) }\n\t\t\t\t\t\t\t</h1>\n\t\t\t\t\t\t\t{ isEntirelyBlockWidgets ? (\n\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t<p className=\"edit-widgets-welcome-guide__text\">\n\t\t\t\t\t\t\t\t\t\t{ sprintf(\n\t\t\t\t\t\t\t\t\t\t\t// Translators: %s: Number of block areas in the current theme.\n\t\t\t\t\t\t\t\t\t\t\t_n(\n\t\t\t\t\t\t\t\t\t\t\t\t'Your theme provides %s “block” area for you to add and edit content. Try adding a search bar, social icons, or other types of blocks here and see how they’ll look on your site.',\n\t\t\t\t\t\t\t\t\t\t\t\t'Your theme provides %s different “block” areas for you to add and edit content. Try adding a search bar, social icons, or other types of blocks here and see how they’ll look on your site.',\n\t\t\t\t\t\t\t\t\t\t\t\tnumWidgetAreas\n\t\t\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\t\t\tnumWidgetAreas\n\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t</p>\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\t<>\n\t\t\t\t\t\t\t\t\t<p className=\"edit-widgets-welcome-guide__text\">\n\t\t\t\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t\t\t\t'You can now add any block to your site’s widget areas. Don’t worry, all of your favorite widgets still work flawlessly.'\n\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t</p>\n\t\t\t\t\t\t\t\t\t<p className=\"edit-widgets-welcome-guide__text\">\n\t\t\t\t\t\t\t\t\t\t<strong>\n\t\t\t\t\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t\t\t\t\t'Want to stick with the old widgets?'\n\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t</strong>{ ' ' }\n\t\t\t\t\t\t\t\t\t\t<ExternalLink\n\t\t\t\t\t\t\t\t\t\t\thref={ __(\n\t\t\t\t\t\t\t\t\t\t\t\t'https://wordpress.org/plugins/classic-widgets/'\n\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t\t\t\t\t'Get the Classic Widgets plugin.'\n\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t</ExternalLink>\n\t\t\t\t\t\t\t\t\t</p>\n\t\t\t\t\t\t\t\t</>\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},\n\t\t\t\t{\n\t\t\t\t\timage: (\n\t\t\t\t\t\t<WelcomeGuideImage\n\t\t\t\t\t\t\tnonAnimatedSrc=\"https://s.w.org/images/block-editor/welcome-editor.svg\"\n\t\t\t\t\t\t\tanimatedSrc=\"https://s.w.org/images/block-editor/welcome-editor.gif\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t),\n\t\t\t\t\tcontent: (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<h1 className=\"edit-widgets-welcome-guide__heading\">\n\t\t\t\t\t\t\t\t{ __( 'Make each block your own' ) }\n\t\t\t\t\t\t\t</h1>\n\t\t\t\t\t\t\t<p className=\"edit-widgets-welcome-guide__text\">\n\t\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t\t'Each block comes with its own set of controls for changing things like color, width, and alignment. These will show and hide automatically when you have a block selected.'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t</p>\n\t\t\t\t\t\t</>\n\t\t\t\t\t),\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\timage: (\n\t\t\t\t\t\t<WelcomeGuideImage\n\t\t\t\t\t\t\tnonAnimatedSrc=\"https://s.w.org/images/block-editor/welcome-library.svg\"\n\t\t\t\t\t\t\tanimatedSrc=\"https://s.w.org/images/block-editor/welcome-library.gif\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t),\n\t\t\t\t\tcontent: (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<h1 className=\"edit-widgets-welcome-guide__heading\">\n\t\t\t\t\t\t\t\t{ __( 'Get to know the block library' ) }\n\t\t\t\t\t\t\t</h1>\n\t\t\t\t\t\t\t<p className=\"edit-widgets-welcome-guide__text\">\n\t\t\t\t\t\t\t\t{ createInterpolateElement(\n\t\t\t\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t\t\t\t'All of the blocks available to you live in the block library. You’ll find it wherever you see the <InserterIconImage /> icon.'\n\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tInserterIconImage: (\n\t\t\t\t\t\t\t\t\t\t\t<img\n\t\t\t\t\t\t\t\t\t\t\t\tclassName=\"edit-widgets-welcome-guide__inserter-icon\"\n\t\t\t\t\t\t\t\t\t\t\t\talt={ __( 'inserter' ) }\n\t\t\t\t\t\t\t\t\t\t\t\tsrc=\"data:image/svg+xml,%3Csvg width='18' height='18' viewBox='0 0 18 18' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Crect width='18' height='18' rx='2' fill='%231E1E1E'/%3E%3Cpath d='M9.22727 4V14M4 8.77273H14' stroke='white' stroke-width='1.5'/%3E%3C/svg%3E%0A\"\n\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t),\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</p>\n\t\t\t\t\t\t</>\n\t\t\t\t\t),\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\timage: (\n\t\t\t\t\t\t<WelcomeGuideImage\n\t\t\t\t\t\t\tnonAnimatedSrc=\"https://s.w.org/images/block-editor/welcome-documentation.svg\"\n\t\t\t\t\t\t\tanimatedSrc=\"https://s.w.org/images/block-editor/welcome-documentation.gif\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t),\n\t\t\t\t\tcontent: (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<h1 className=\"edit-widgets-welcome-guide__heading\">\n\t\t\t\t\t\t\t\t{ __( 'Learn how to use the block editor' ) }\n\t\t\t\t\t\t\t</h1>\n\t\t\t\t\t\t\t<p className=\"edit-widgets-welcome-guide__text\">\n\t\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t\t'New to the block editor? Want to learn more about using it? '\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t<ExternalLink\n\t\t\t\t\t\t\t\t\thref={ __(\n\t\t\t\t\t\t\t\t\t\t'https://wordpress.org/documentation/article/wordpress-block-editor/'\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\t\t{ __( \"Here's a detailed guide.\" ) }\n\t\t\t\t\t\t\t\t</ExternalLink>\n\t\t\t\t\t\t\t</p>\n\t\t\t\t\t\t</>\n\t\t\t\t\t),\n\t\t\t\t},\n\t\t\t] }\n\t\t/>\n\t);\n}\n\nfunction WelcomeGuideImage( { nonAnimatedSrc, animatedSrc } ) {\n\treturn (\n\t\t<picture className=\"edit-widgets-welcome-guide__image\">\n\t\t\t<source\n\t\t\t\tsrcSet={ nonAnimatedSrc }\n\t\t\t\tmedia=\"(prefers-reduced-motion: reduce)\"\n\t\t\t/>\n\t\t\t<img src={ animatedSrc } width=\"312\" height=\"240\" alt=\"\" />\n\t\t</picture>\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA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AoC;QAAC,CACxC,CAAC,eACLY,KAAA;UAAGoB,SAAS,EAAC,kCAAkC;UAAAU,QAAA,GAC5C1C,EAAE,CACH,8DACD,CAAC,eACDQ,IAAA,CAACV,YAAY;YACZ6C,IAAI,EAAG3C,EAAE,CACR,qEACD,CAAG;YAAA0C,QAAA,EAED1C,EAAE,CAAE,0BAA2B;UAAC,CACrB,CAAC;QAAA,CACb,CAAC;MAAA,CACH;IAEJ,CAAC;EACC,CACH,CAAC;AAEJ;AAEA,SAASsC,iBAAiBA,CAAE;EAAEC,cAAc;EAAEC;AAAY,CAAC,EAAG;EAC7D,oBACC5B,KAAA;IAASoB,SAAS,EAAC,mCAAmC;IAAAU,QAAA,gBACrDlC,IAAA;MACCuC,MAAM,EAAGR,cAAgB;MACzBS,KAAK,EAAC;IAAkC,CACxC,CAAC,eACFxC,IAAA;MAAKsC,GAAG,EAAGN,WAAa;MAACS,KAAK,EAAC,KAAK;MAACC,MAAM,EAAC,KAAK;MAACL,GAAG,EAAC;IAAE,CAAE,CAAC;EAAA,CACnD,CAAC;AAEZ","ignoreList":[]}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { createElement } from "react";
|
|
2
1
|
/**
|
|
3
2
|
* WordPress dependencies
|
|
4
3
|
*/
|
|
@@ -13,6 +12,8 @@ import { store as preferencesStore } from '@wordpress/preferences';
|
|
|
13
12
|
*/
|
|
14
13
|
import Notices from '../notices';
|
|
15
14
|
import KeyboardShortcuts from '../keyboard-shortcuts';
|
|
15
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
16
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
16
17
|
export default function WidgetAreasBlockEditorContent({
|
|
17
18
|
blockEditorSettings
|
|
18
19
|
}) {
|
|
@@ -21,15 +22,22 @@ export default function WidgetAreasBlockEditorContent({
|
|
|
21
22
|
const styles = useMemo(() => {
|
|
22
23
|
return hasThemeStyles ? blockEditorSettings.styles : [];
|
|
23
24
|
}, [blockEditorSettings, hasThemeStyles]);
|
|
24
|
-
return
|
|
25
|
-
className: "edit-widgets-block-editor"
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
25
|
+
return /*#__PURE__*/_jsxs("div", {
|
|
26
|
+
className: "edit-widgets-block-editor",
|
|
27
|
+
children: [/*#__PURE__*/_jsx(Notices, {}), !isLargeViewport && /*#__PURE__*/_jsx(BlockToolbar, {
|
|
28
|
+
hideDragHandle: true
|
|
29
|
+
}), /*#__PURE__*/_jsxs(BlockTools, {
|
|
30
|
+
children: [/*#__PURE__*/_jsx(KeyboardShortcuts, {}), /*#__PURE__*/_jsx(EditorStyles, {
|
|
31
|
+
styles: styles,
|
|
32
|
+
scope: ".editor-styles-wrapper"
|
|
33
|
+
}), /*#__PURE__*/_jsx(BlockSelectionClearer, {
|
|
34
|
+
children: /*#__PURE__*/_jsx(WritingFlow, {
|
|
35
|
+
children: /*#__PURE__*/_jsx(BlockList, {
|
|
36
|
+
className: "edit-widgets-main-block-list"
|
|
37
|
+
})
|
|
38
|
+
})
|
|
39
|
+
})]
|
|
40
|
+
})]
|
|
41
|
+
});
|
|
34
42
|
}
|
|
35
43
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["BlockList","BlockToolbar","BlockTools","BlockSelectionClearer","WritingFlow","__unstableEditorStyles","EditorStyles","useViewportMatch","useSelect","useMemo","store","preferencesStore","Notices","KeyboardShortcuts","WidgetAreasBlockEditorContent","blockEditorSettings","hasThemeStyles","select","get","isLargeViewport","styles","
|
|
1
|
+
{"version":3,"names":["BlockList","BlockToolbar","BlockTools","BlockSelectionClearer","WritingFlow","__unstableEditorStyles","EditorStyles","useViewportMatch","useSelect","useMemo","store","preferencesStore","Notices","KeyboardShortcuts","jsx","_jsx","jsxs","_jsxs","WidgetAreasBlockEditorContent","blockEditorSettings","hasThemeStyles","select","get","isLargeViewport","styles","className","children","hideDragHandle","scope"],"sources":["@wordpress/edit-widgets/src/components/widget-areas-block-editor-content/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tBlockList,\n\tBlockToolbar,\n\tBlockTools,\n\tBlockSelectionClearer,\n\tWritingFlow,\n\t__unstableEditorStyles as EditorStyles,\n} from '@wordpress/block-editor';\nimport { useViewportMatch } from '@wordpress/compose';\nimport { useSelect } from '@wordpress/data';\nimport { useMemo } from '@wordpress/element';\nimport { store as preferencesStore } from '@wordpress/preferences';\n\n/**\n * Internal dependencies\n */\nimport Notices from '../notices';\nimport KeyboardShortcuts from '../keyboard-shortcuts';\n\nexport default function WidgetAreasBlockEditorContent( {\n\tblockEditorSettings,\n} ) {\n\tconst hasThemeStyles = useSelect(\n\t\t( select ) =>\n\t\t\t!! select( preferencesStore ).get(\n\t\t\t\t'core/edit-widgets',\n\t\t\t\t'themeStyles'\n\t\t\t),\n\t\t[]\n\t);\n\tconst isLargeViewport = useViewportMatch( 'medium' );\n\n\tconst styles = useMemo( () => {\n\t\treturn hasThemeStyles ? blockEditorSettings.styles : [];\n\t}, [ blockEditorSettings, hasThemeStyles ] );\n\n\treturn (\n\t\t<div className=\"edit-widgets-block-editor\">\n\t\t\t<Notices />\n\t\t\t{ ! isLargeViewport && <BlockToolbar hideDragHandle /> }\n\t\t\t<BlockTools>\n\t\t\t\t<KeyboardShortcuts />\n\t\t\t\t<EditorStyles\n\t\t\t\t\tstyles={ styles }\n\t\t\t\t\tscope=\".editor-styles-wrapper\"\n\t\t\t\t/>\n\t\t\t\t<BlockSelectionClearer>\n\t\t\t\t\t<WritingFlow>\n\t\t\t\t\t\t<BlockList className=\"edit-widgets-main-block-list\" />\n\t\t\t\t\t</WritingFlow>\n\t\t\t\t</BlockSelectionClearer>\n\t\t\t</BlockTools>\n\t\t</div>\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SACCA,SAAS,EACTC,YAAY,EACZC,UAAU,EACVC,qBAAqB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