@wordpress/edit-widgets 5.11.0 → 5.12.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +2 -0
- package/build/blocks/widget-area/edit/index.js +24 -29
- package/build/blocks/widget-area/edit/index.js.map +1 -1
- package/build/blocks/widget-area/edit/inner-blocks.js +5 -5
- package/build/blocks/widget-area/edit/inner-blocks.js.map +1 -1
- package/build/blocks/widget-area/index.js +3 -6
- package/build/blocks/widget-area/index.js.map +1 -1
- package/build/components/error-boundary/index.js +8 -10
- package/build/components/error-boundary/index.js.map +1 -1
- package/build/components/header/index.js +2 -2
- package/build/components/header/index.js.map +1 -1
- package/build/components/keyboard-shortcut-help-modal/dynamic-shortcut.js +3 -4
- package/build/components/keyboard-shortcut-help-modal/dynamic-shortcut.js.map +1 -1
- package/build/components/keyboard-shortcut-help-modal/index.js +42 -50
- package/build/components/keyboard-shortcut-help-modal/index.js.map +1 -1
- package/build/components/keyboard-shortcut-help-modal/shortcut.js +10 -12
- package/build/components/keyboard-shortcut-help-modal/shortcut.js.map +1 -1
- package/build/components/keyboard-shortcuts/index.js +4 -4
- package/build/components/keyboard-shortcuts/index.js.map +1 -1
- package/build/components/layout/index.js +3 -4
- package/build/components/layout/index.js.map +1 -1
- package/build/components/layout/interface.js +3 -4
- package/build/components/layout/interface.js.map +1 -1
- package/build/components/layout/unsaved-changes-warning.js +1 -1
- package/build/components/layout/unsaved-changes-warning.js.map +1 -1
- package/build/components/more-menu/tools-more-menu-group.js +5 -8
- package/build/components/more-menu/tools-more-menu-group.js.map +1 -1
- package/build/components/notices/index.js +11 -20
- package/build/components/notices/index.js.map +1 -1
- package/build/components/save-button/index.js +1 -3
- package/build/components/save-button/index.js.map +1 -1
- package/build/components/secondary-sidebar/inserter-sidebar.js +4 -6
- package/build/components/secondary-sidebar/inserter-sidebar.js.map +1 -1
- package/build/components/secondary-sidebar/list-view-sidebar.js +8 -3
- package/build/components/secondary-sidebar/list-view-sidebar.js.map +1 -1
- package/build/components/sidebar/index.js +7 -8
- package/build/components/sidebar/index.js.map +1 -1
- package/build/components/sidebar/widget-areas.js +5 -6
- package/build/components/sidebar/widget-areas.js.map +1 -1
- package/build/components/welcome-guide/index.js +6 -7
- package/build/components/welcome-guide/index.js.map +1 -1
- package/build/components/widget-areas-block-editor-content/index.js +3 -4
- package/build/components/widget-areas-block-editor-content/index.js.map +1 -1
- package/build/components/widget-areas-block-editor-provider/index.js +18 -24
- package/build/components/widget-areas-block-editor-provider/index.js.map +1 -1
- package/build/filters/move-to-widget-area.js +4 -5
- package/build/filters/move-to-widget-area.js.map +1 -1
- package/build/hooks/use-last-selected-widget-area.js +2 -4
- package/build/hooks/use-last-selected-widget-area.js.map +1 -1
- package/build/hooks/use-widget-library-insertion-point.js +1 -3
- package/build/hooks/use-widget-library-insertion-point.js.map +1 -1
- package/build/{private-apis.js → lock-unlock.js} +1 -1
- package/build/lock-unlock.js.map +1 -0
- package/build/store/actions.js +49 -74
- package/build/store/actions.js.map +1 -1
- package/build/store/index.js +1 -3
- package/build/store/index.js.map +1 -1
- package/build/store/reducer.js +3 -11
- package/build/store/reducer.js.map +1 -1
- package/build/store/resolvers.js +8 -10
- package/build/store/resolvers.js.map +1 -1
- package/build/store/selectors.js +15 -32
- package/build/store/selectors.js.map +1 -1
- package/build/store/transformers.js +1 -2
- package/build/store/transformers.js.map +1 -1
- package/build-module/blocks/widget-area/edit/index.js +24 -29
- package/build-module/blocks/widget-area/edit/index.js.map +1 -1
- package/build-module/blocks/widget-area/edit/inner-blocks.js +5 -5
- package/build-module/blocks/widget-area/edit/inner-blocks.js.map +1 -1
- package/build-module/blocks/widget-area/index.js +3 -6
- package/build-module/blocks/widget-area/index.js.map +1 -1
- package/build-module/components/error-boundary/index.js +8 -10
- package/build-module/components/error-boundary/index.js.map +1 -1
- package/build-module/components/header/index.js +1 -1
- package/build-module/components/header/index.js.map +1 -1
- package/build-module/components/keyboard-shortcut-help-modal/dynamic-shortcut.js +3 -4
- package/build-module/components/keyboard-shortcut-help-modal/dynamic-shortcut.js.map +1 -1
- package/build-module/components/keyboard-shortcut-help-modal/index.js +40 -48
- package/build-module/components/keyboard-shortcut-help-modal/index.js.map +1 -1
- package/build-module/components/keyboard-shortcut-help-modal/shortcut.js +10 -12
- package/build-module/components/keyboard-shortcut-help-modal/shortcut.js.map +1 -1
- package/build-module/components/keyboard-shortcuts/index.js +4 -4
- package/build-module/components/keyboard-shortcuts/index.js.map +1 -1
- package/build-module/components/layout/index.js +3 -4
- package/build-module/components/layout/index.js.map +1 -1
- package/build-module/components/layout/interface.js +3 -4
- package/build-module/components/layout/interface.js.map +1 -1
- package/build-module/components/layout/unsaved-changes-warning.js +1 -1
- package/build-module/components/layout/unsaved-changes-warning.js.map +1 -1
- package/build-module/components/more-menu/tools-more-menu-group.js +5 -8
- package/build-module/components/more-menu/tools-more-menu-group.js.map +1 -1
- package/build-module/components/notices/index.js +11 -20
- package/build-module/components/notices/index.js.map +1 -1
- package/build-module/components/save-button/index.js +1 -3
- package/build-module/components/save-button/index.js.map +1 -1
- package/build-module/components/secondary-sidebar/inserter-sidebar.js +4 -5
- package/build-module/components/secondary-sidebar/inserter-sidebar.js.map +1 -1
- package/build-module/components/secondary-sidebar/list-view-sidebar.js +9 -3
- package/build-module/components/secondary-sidebar/list-view-sidebar.js.map +1 -1
- package/build-module/components/sidebar/index.js +9 -10
- package/build-module/components/sidebar/index.js.map +1 -1
- package/build-module/components/sidebar/widget-areas.js +5 -6
- package/build-module/components/sidebar/widget-areas.js.map +1 -1
- package/build-module/components/welcome-guide/index.js +6 -7
- package/build-module/components/welcome-guide/index.js.map +1 -1
- package/build-module/components/widget-areas-block-editor-content/index.js +3 -4
- 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 +17 -22
- package/build-module/components/widget-areas-block-editor-provider/index.js.map +1 -1
- package/build-module/filters/move-to-widget-area.js +4 -5
- package/build-module/filters/move-to-widget-area.js.map +1 -1
- package/build-module/hooks/use-last-selected-widget-area.js +2 -4
- package/build-module/hooks/use-last-selected-widget-area.js.map +1 -1
- package/build-module/hooks/use-widget-library-insertion-point.js +1 -3
- package/build-module/hooks/use-widget-library-insertion-point.js.map +1 -1
- package/build-module/{private-apis.js → lock-unlock.js} +1 -1
- package/build-module/lock-unlock.js.map +1 -0
- package/build-module/store/actions.js +49 -74
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/index.js +1 -3
- package/build-module/store/index.js.map +1 -1
- package/build-module/store/reducer.js +3 -11
- package/build-module/store/reducer.js.map +1 -1
- package/build-module/store/resolvers.js +8 -10
- package/build-module/store/resolvers.js.map +1 -1
- package/build-module/store/selectors.js +15 -32
- package/build-module/store/selectors.js.map +1 -1
- package/build-module/store/transformers.js +1 -2
- package/build-module/store/transformers.js.map +1 -1
- package/package.json +27 -27
- package/src/components/header/index.js +1 -1
- package/src/components/keyboard-shortcuts/index.js +4 -4
- package/src/components/secondary-sidebar/list-view-sidebar.js +8 -1
- package/src/components/sidebar/index.js +3 -3
- package/src/components/widget-areas-block-editor-provider/index.js +1 -1
- package/build/private-apis.js.map +0 -1
- package/build-module/private-apis.js.map +0 -1
- /package/src/{private-apis.js → lock-unlock.js} +0 -0
|
@@ -9,14 +9,11 @@ const {
|
|
|
9
9
|
Slot
|
|
10
10
|
} = createSlotFill('EditWidgetsToolsMoreMenuGroup');
|
|
11
11
|
|
|
12
|
-
ToolsMoreMenuGroup.Slot =
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
fillProps: fillProps
|
|
18
|
-
}, fills => fills.length > 0 && fills);
|
|
19
|
-
};
|
|
12
|
+
ToolsMoreMenuGroup.Slot = ({
|
|
13
|
+
fillProps
|
|
14
|
+
}) => createElement(Slot, {
|
|
15
|
+
fillProps: fillProps
|
|
16
|
+
}, fills => fills.length > 0 && fills);
|
|
20
17
|
|
|
21
18
|
export default ToolsMoreMenuGroup;
|
|
22
19
|
//# sourceMappingURL=tools-more-menu-group.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-widgets/src/components/more-menu/tools-more-menu-group.js"],"names":["createSlotFill","Fill","ToolsMoreMenuGroup","Slot","fillProps","fills","length"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,cAAT,QAA+B,uBAA/B;AAEA,MAAM;AAAEC,EAAAA,IAAI,EAAEC,kBAAR;AAA4BC,EAAAA;AAA5B,IAAqCH,cAAc,CACxD,+BADwD,CAAzD;;AAIAE,kBAAkB,CAACC,IAAnB,GAA0B
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-widgets/src/components/more-menu/tools-more-menu-group.js"],"names":["createSlotFill","Fill","ToolsMoreMenuGroup","Slot","fillProps","fills","length"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,cAAT,QAA+B,uBAA/B;AAEA,MAAM;AAAEC,EAAAA,IAAI,EAAEC,kBAAR;AAA4BC,EAAAA;AAA5B,IAAqCH,cAAc,CACxD,+BADwD,CAAzD;;AAIAE,kBAAkB,CAACC,IAAnB,GAA0B,CAAE;AAAEC,EAAAA;AAAF,CAAF,KACzB,cAAC,IAAD;AAAM,EAAA,SAAS,EAAGA;AAAlB,GACKC,KAAF,IAAaA,KAAK,CAACC,MAAN,GAAe,CAAf,IAAoBD,KADpC,CADD;;AAMA,eAAeH,kBAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { createSlotFill } from '@wordpress/components';\n\nconst { Fill: ToolsMoreMenuGroup, Slot } = createSlotFill(\n\t'EditWidgetsToolsMoreMenuGroup'\n);\n\nToolsMoreMenuGroup.Slot = ( { fillProps } ) => (\n\t<Slot fillProps={ fillProps }>\n\t\t{ ( fills ) => fills.length > 0 && fills }\n\t</Slot>\n);\n\nexport default ToolsMoreMenuGroup;\n"]}
|
|
@@ -18,26 +18,17 @@ function Notices() {
|
|
|
18
18
|
notices: select(noticesStore).getNotices()
|
|
19
19
|
};
|
|
20
20
|
}, []);
|
|
21
|
-
const dismissibleNotices = notices.filter(
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
} = _ref2;
|
|
33
|
-
return !isDismissible && type === 'default';
|
|
34
|
-
});
|
|
35
|
-
const snackbarNotices = notices.filter(_ref3 => {
|
|
36
|
-
let {
|
|
37
|
-
type
|
|
38
|
-
} = _ref3;
|
|
39
|
-
return type === 'snackbar';
|
|
40
|
-
});
|
|
21
|
+
const dismissibleNotices = notices.filter(({
|
|
22
|
+
isDismissible,
|
|
23
|
+
type
|
|
24
|
+
}) => isDismissible && type === 'default');
|
|
25
|
+
const nonDismissibleNotices = notices.filter(({
|
|
26
|
+
isDismissible,
|
|
27
|
+
type
|
|
28
|
+
}) => !isDismissible && type === 'default');
|
|
29
|
+
const snackbarNotices = notices.filter(({
|
|
30
|
+
type
|
|
31
|
+
}) => type === 'snackbar');
|
|
41
32
|
return createElement(Fragment, null, createElement(NoticeList, {
|
|
42
33
|
notices: nonDismissibleNotices,
|
|
43
34
|
className: "edit-widgets-notices__pinned"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-widgets/src/components/notices/index.js"],"names":["NoticeList","SnackbarList","useSelect","useDispatch","store","noticesStore","Notices","removeNotice","notices","select","getNotices","dismissibleNotices","filter","isDismissible","type","nonDismissibleNotices","snackbarNotices"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,UAAT,EAAqBC,YAArB,QAAyC,uBAAzC;AACA,SAASC,SAAT,EAAoBC,WAApB,QAAuC,iBAAvC;AACA,SAASC,KAAK,IAAIC,YAAlB,QAAsC,oBAAtC;;AAEA,SAASC,OAAT,GAAmB;AAClB,QAAM;AAAEC,IAAAA;AAAF,MAAmBJ,WAAW,CAAEE,YAAF,CAApC;AACA,QAAM;AAAEG,IAAAA;AAAF,MAAcN,SAAS,CAAIO,MAAF,IAAc;AAC5C,WAAO;AACND,MAAAA,OAAO,EAAEC,MAAM,CAAEJ,YAAF,CAAN,CAAuBK,UAAvB;AADH,KAAP;AAGA,GAJ4B,EAI1B,EAJ0B,CAA7B;AAMA,QAAMC,kBAAkB,GAAGH,OAAO,CAACI,MAAR,CAC1B
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-widgets/src/components/notices/index.js"],"names":["NoticeList","SnackbarList","useSelect","useDispatch","store","noticesStore","Notices","removeNotice","notices","select","getNotices","dismissibleNotices","filter","isDismissible","type","nonDismissibleNotices","snackbarNotices"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,UAAT,EAAqBC,YAArB,QAAyC,uBAAzC;AACA,SAASC,SAAT,EAAoBC,WAApB,QAAuC,iBAAvC;AACA,SAASC,KAAK,IAAIC,YAAlB,QAAsC,oBAAtC;;AAEA,SAASC,OAAT,GAAmB;AAClB,QAAM;AAAEC,IAAAA;AAAF,MAAmBJ,WAAW,CAAEE,YAAF,CAApC;AACA,QAAM;AAAEG,IAAAA;AAAF,MAAcN,SAAS,CAAIO,MAAF,IAAc;AAC5C,WAAO;AACND,MAAAA,OAAO,EAAEC,MAAM,CAAEJ,YAAF,CAAN,CAAuBK,UAAvB;AADH,KAAP;AAGA,GAJ4B,EAI1B,EAJ0B,CAA7B;AAMA,QAAMC,kBAAkB,GAAGH,OAAO,CAACI,MAAR,CAC1B,CAAE;AAAEC,IAAAA,aAAF;AAAiBC,IAAAA;AAAjB,GAAF,KAA+BD,aAAa,IAAIC,IAAI,KAAK,SAD/B,CAA3B;AAGA,QAAMC,qBAAqB,GAAGP,OAAO,CAACI,MAAR,CAC7B,CAAE;AAAEC,IAAAA,aAAF;AAAiBC,IAAAA;AAAjB,GAAF,KAA+B,CAAED,aAAF,IAAmBC,IAAI,KAAK,SAD9B,CAA9B;AAGA,QAAME,eAAe,GAAGR,OAAO,CAACI,MAAR,CACvB,CAAE;AAAEE,IAAAA;AAAF,GAAF,KAAgBA,IAAI,KAAK,UADF,CAAxB;AAIA,SACC,8BACC,cAAC,UAAD;AACC,IAAA,OAAO,EAAGC,qBADX;AAEC,IAAA,SAAS,EAAC;AAFX,IADD,EAKC,cAAC,UAAD;AACC,IAAA,OAAO,EAAGJ,kBADX;AAEC,IAAA,SAAS,EAAC,mCAFX;AAGC,IAAA,QAAQ,EAAGJ;AAHZ,IALD,EAUC,cAAC,YAAD;AACC,IAAA,OAAO,EAAGS,eADX;AAEC,IAAA,SAAS,EAAC,gCAFX;AAGC,IAAA,QAAQ,EAAGT;AAHZ,IAVD,CADD;AAkBA;;AAED,eAAeD,OAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { NoticeList, SnackbarList } from '@wordpress/components';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as noticesStore } from '@wordpress/notices';\n\nfunction Notices() {\n\tconst { removeNotice } = useDispatch( noticesStore );\n\tconst { notices } = useSelect( ( select ) => {\n\t\treturn {\n\t\t\tnotices: select( noticesStore ).getNotices(),\n\t\t};\n\t}, [] );\n\n\tconst dismissibleNotices = notices.filter(\n\t\t( { isDismissible, type } ) => isDismissible && type === 'default'\n\t);\n\tconst nonDismissibleNotices = notices.filter(\n\t\t( { isDismissible, type } ) => ! isDismissible && type === 'default'\n\t);\n\tconst snackbarNotices = notices.filter(\n\t\t( { type } ) => type === 'snackbar'\n\t);\n\n\treturn (\n\t\t<>\n\t\t\t<NoticeList\n\t\t\t\tnotices={ nonDismissibleNotices }\n\t\t\t\tclassName=\"edit-widgets-notices__pinned\"\n\t\t\t/>\n\t\t\t<NoticeList\n\t\t\t\tnotices={ dismissibleNotices }\n\t\t\t\tclassName=\"edit-widgets-notices__dismissible\"\n\t\t\t\tonRemove={ removeNotice }\n\t\t\t/>\n\t\t\t<SnackbarList\n\t\t\t\tnotices={ snackbarNotices }\n\t\t\t\tclassName=\"edit-widgets-notices__snackbar\"\n\t\t\t\tonRemove={ removeNotice }\n\t\t\t/>\n\t\t</>\n\t);\n}\n\nexport default Notices;\n"]}
|
|
@@ -17,14 +17,12 @@ function SaveButton() {
|
|
|
17
17
|
hasEditedWidgetAreaIds,
|
|
18
18
|
isSaving
|
|
19
19
|
} = useSelect(select => {
|
|
20
|
-
var _getEditedWidgetAreas;
|
|
21
|
-
|
|
22
20
|
const {
|
|
23
21
|
getEditedWidgetAreas,
|
|
24
22
|
isSavingWidgetAreas
|
|
25
23
|
} = select(editWidgetsStore);
|
|
26
24
|
return {
|
|
27
|
-
hasEditedWidgetAreaIds:
|
|
25
|
+
hasEditedWidgetAreaIds: getEditedWidgetAreas()?.length > 0,
|
|
28
26
|
isSaving: isSavingWidgetAreas()
|
|
29
27
|
};
|
|
30
28
|
}, []);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-widgets/src/components/save-button/index.js"],"names":["Button","__","useDispatch","useSelect","store","editWidgetsStore","SaveButton","hasEditedWidgetAreaIds","isSaving","select","getEditedWidgetAreas","isSavingWidgetAreas","length","saveEditedWidgetAreas","undefined"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,MAAT,QAAuB,uBAAvB;AACA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,WAAT,EAAsBC,SAAtB,QAAuC,iBAAvC;AAEA;AACA;AACA;;AACA,SAASC,KAAK,IAAIC,gBAAlB,QAA0C,aAA1C;;AAEA,SAASC,UAAT,GAAsB;AACrB,QAAM;AAAEC,IAAAA,sBAAF;AAA0BC,IAAAA;AAA1B,MAAuCL,SAAS,CAAIM,MAAF,IAAc;
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-widgets/src/components/save-button/index.js"],"names":["Button","__","useDispatch","useSelect","store","editWidgetsStore","SaveButton","hasEditedWidgetAreaIds","isSaving","select","getEditedWidgetAreas","isSavingWidgetAreas","length","saveEditedWidgetAreas","undefined"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,MAAT,QAAuB,uBAAvB;AACA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,WAAT,EAAsBC,SAAtB,QAAuC,iBAAvC;AAEA;AACA;AACA;;AACA,SAASC,KAAK,IAAIC,gBAAlB,QAA0C,aAA1C;;AAEA,SAASC,UAAT,GAAsB;AACrB,QAAM;AAAEC,IAAAA,sBAAF;AAA0BC,IAAAA;AAA1B,MAAuCL,SAAS,CAAIM,MAAF,IAAc;AACrE,UAAM;AAAEC,MAAAA,oBAAF;AAAwBC,MAAAA;AAAxB,QACLF,MAAM,CAAEJ,gBAAF,CADP;AAGA,WAAO;AACNE,MAAAA,sBAAsB,EAAEG,oBAAoB,IAAIE,MAAxB,GAAiC,CADnD;AAENJ,MAAAA,QAAQ,EAAEG,mBAAmB;AAFvB,KAAP;AAIA,GARqD,EAQnD,EARmD,CAAtD;AASA,QAAM;AAAEE,IAAAA;AAAF,MAA4BX,WAAW,CAAEG,gBAAF,CAA7C;AAEA,SACC,cAAC,MAAD;AACC,IAAA,OAAO,EAAC,SADT;AAEC,IAAA,MAAM,EAAGG,QAFV;AAGC,qBAAgBA,QAHjB;AAIC,IAAA,OAAO,EAAGA,QAAQ,GAAGM,SAAH,GAAeD,qBAJlC;AAKC,IAAA,QAAQ,EAAG,CAAEN;AALd,KAOGC,QAAQ,GAAGP,EAAE,CAAE,SAAF,CAAL,GAAqBA,EAAE,CAAE,QAAF,CAPlC,CADD;AAWA;;AAED,eAAeK,UAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { Button } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { useDispatch, useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { store as editWidgetsStore } from '../../store';\n\nfunction SaveButton() {\n\tconst { hasEditedWidgetAreaIds, isSaving } = useSelect( ( select ) => {\n\t\tconst { getEditedWidgetAreas, isSavingWidgetAreas } =\n\t\t\tselect( editWidgetsStore );\n\n\t\treturn {\n\t\t\thasEditedWidgetAreaIds: getEditedWidgetAreas()?.length > 0,\n\t\t\tisSaving: isSavingWidgetAreas(),\n\t\t};\n\t}, [] );\n\tconst { saveEditedWidgetAreas } = useDispatch( editWidgetsStore );\n\n\treturn (\n\t\t<Button\n\t\t\tvariant=\"primary\"\n\t\t\tisBusy={ isSaving }\n\t\t\taria-disabled={ isSaving }\n\t\t\tonClick={ isSaving ? undefined : saveEditedWidgetAreas }\n\t\t\tdisabled={ ! hasEditedWidgetAreaIds }\n\t\t>\n\t\t\t{ isSaving ? __( 'Saving…' ) : __( 'Update' ) }\n\t\t</Button>\n\t);\n}\n\nexport default SaveButton;\n"]}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
1
|
import { createElement } from "@wordpress/element";
|
|
3
2
|
|
|
4
3
|
/**
|
|
@@ -38,11 +37,11 @@ export default function InserterSidebar() {
|
|
|
38
37
|
useEffect(() => {
|
|
39
38
|
libraryRef.current.focusSearch();
|
|
40
39
|
}, []);
|
|
41
|
-
return createElement("div",
|
|
42
|
-
ref: inserterDialogRef
|
|
43
|
-
|
|
40
|
+
return createElement("div", {
|
|
41
|
+
ref: inserterDialogRef,
|
|
42
|
+
...inserterDialogProps,
|
|
44
43
|
className: "edit-widgets-layout__inserter-panel"
|
|
45
|
-
}
|
|
44
|
+
}, createElement(TagName, {
|
|
46
45
|
className: "edit-widgets-layout__inserter-panel-header"
|
|
47
46
|
}, createElement(Button, {
|
|
48
47
|
icon: close,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-widgets/src/components/secondary-sidebar/inserter-sidebar.js"],"names":["Button","VisuallyHidden","close","__experimentalLibrary","Library","useViewportMatch","__experimentalUseDialog","useDialog","useCallback","useEffect","useRef","useDispatch","__","useWidgetLibraryInsertionPoint","store","editWidgetsStore","InserterSidebar","isMobileViewport","rootClientId","insertionIndex","setIsInserterOpened","closeInserter","TagName","inserterDialogRef","inserterDialogProps","onClose","focusOnMount","libraryRef","current","focusSearch"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-widgets/src/components/secondary-sidebar/inserter-sidebar.js"],"names":["Button","VisuallyHidden","close","__experimentalLibrary","Library","useViewportMatch","__experimentalUseDialog","useDialog","useCallback","useEffect","useRef","useDispatch","__","useWidgetLibraryInsertionPoint","store","editWidgetsStore","InserterSidebar","isMobileViewport","rootClientId","insertionIndex","setIsInserterOpened","closeInserter","TagName","inserterDialogRef","inserterDialogProps","onClose","focusOnMount","libraryRef","current","focusSearch"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,MAAT,EAAiBC,cAAjB,QAAuC,uBAAvC;AACA,SAASC,KAAT,QAAsB,kBAAtB;AACA,SAASC,qBAAqB,IAAIC,OAAlC,QAAiD,yBAAjD;AACA,SACCC,gBADD,EAECC,uBAAuB,IAAIC,SAF5B,QAGO,oBAHP;AAIA,SAASC,WAAT,EAAsBC,SAAtB,EAAiCC,MAAjC,QAA+C,oBAA/C;AACA,SAASC,WAAT,QAA4B,iBAA5B;AACA,SAASC,EAAT,QAAmB,iBAAnB;AAEA;AACA;AACA;;AACA,OAAOC,8BAAP,MAA2C,gDAA3C;AACA,SAASC,KAAK,IAAIC,gBAAlB,QAA0C,aAA1C;AAEA,eAAe,SAASC,eAAT,GAA2B;AACzC,QAAMC,gBAAgB,GAAGZ,gBAAgB,CAAE,QAAF,EAAY,GAAZ,CAAzC;AACA,QAAM;AAAEa,IAAAA,YAAF;AAAgBC,IAAAA;AAAhB,MAAmCN,8BAA8B,EAAvE;AAEA,QAAM;AAAEO,IAAAA;AAAF,MAA0BT,WAAW,CAAEI,gBAAF,CAA3C;AAEA,QAAMM,aAAa,GAAGb,WAAW,CAAE,MAAM;AACxC,WAAOY,mBAAmB,CAAE,KAAF,CAA1B;AACA,GAFgC,EAE9B,CAAEA,mBAAF,CAF8B,CAAjC;AAIA,QAAME,OAAO,GAAG,CAAEL,gBAAF,GAAqBhB,cAArB,GAAsC,KAAtD;AACA,QAAM,CAAEsB,iBAAF,EAAqBC,mBAArB,IAA6CjB,SAAS,CAAE;AAC7DkB,IAAAA,OAAO,EAAEJ,aADoD;AAE7DK,IAAAA,YAAY,EAAE;AAF+C,GAAF,CAA5D;AAKA,QAAMC,UAAU,GAAGjB,MAAM,EAAzB;AACAD,EAAAA,SAAS,CAAE,MAAM;AAChBkB,IAAAA,UAAU,CAACC,OAAX,CAAmBC,WAAnB;AACA,GAFQ,EAEN,EAFM,CAAT;AAIA,SACC;AACC,IAAA,GAAG,EAAGN,iBADP;AAAA,OAEMC,mBAFN;AAGC,IAAA,SAAS,EAAC;AAHX,KAKC,cAAC,OAAD;AAAS,IAAA,SAAS,EAAC;AAAnB,KACC,cAAC,MAAD;AACC,IAAA,IAAI,EAAGtB,KADR;AAEC,IAAA,OAAO,EAAGmB,aAFX;AAGC,IAAA,KAAK,EAAGT,EAAE,CAAE,sBAAF;AAHX,IADD,CALD,EAYC;AAAK,IAAA,SAAS,EAAC;AAAf,KACC,cAAC,OAAD;AACC,IAAA,qBAAqB,MADtB;AAEC,IAAA,gBAAgB,EAAGK,gBAFpB;AAGC,IAAA,YAAY,EAAGC,YAHhB;AAIC,IAAA,4BAA4B,EAAGC,cAJhC;AAKC,IAAA,GAAG,EAAGQ;AALP,IADD,CAZD,CADD;AAwBA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { Button, VisuallyHidden } from '@wordpress/components';\nimport { close } from '@wordpress/icons';\nimport { __experimentalLibrary as Library } from '@wordpress/block-editor';\nimport {\n\tuseViewportMatch,\n\t__experimentalUseDialog as useDialog,\n} from '@wordpress/compose';\nimport { useCallback, useEffect, useRef } from '@wordpress/element';\nimport { useDispatch } from '@wordpress/data';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport useWidgetLibraryInsertionPoint from '../../hooks/use-widget-library-insertion-point';\nimport { store as editWidgetsStore } from '../../store';\n\nexport default function InserterSidebar() {\n\tconst isMobileViewport = useViewportMatch( 'medium', '<' );\n\tconst { rootClientId, insertionIndex } = useWidgetLibraryInsertionPoint();\n\n\tconst { setIsInserterOpened } = useDispatch( editWidgetsStore );\n\n\tconst closeInserter = useCallback( () => {\n\t\treturn setIsInserterOpened( false );\n\t}, [ setIsInserterOpened ] );\n\n\tconst TagName = ! isMobileViewport ? VisuallyHidden : 'div';\n\tconst [ inserterDialogRef, inserterDialogProps ] = useDialog( {\n\t\tonClose: closeInserter,\n\t\tfocusOnMount: null,\n\t} );\n\n\tconst libraryRef = useRef();\n\tuseEffect( () => {\n\t\tlibraryRef.current.focusSearch();\n\t}, [] );\n\n\treturn (\n\t\t<div\n\t\t\tref={ inserterDialogRef }\n\t\t\t{ ...inserterDialogProps }\n\t\t\tclassName=\"edit-widgets-layout__inserter-panel\"\n\t\t>\n\t\t\t<TagName className=\"edit-widgets-layout__inserter-panel-header\">\n\t\t\t\t<Button\n\t\t\t\t\ticon={ close }\n\t\t\t\t\tonClick={ closeInserter }\n\t\t\t\t\tlabel={ __( 'Close block inserter' ) }\n\t\t\t\t/>\n\t\t\t</TagName>\n\t\t\t<div className=\"edit-widgets-layout__inserter-panel-content\">\n\t\t\t\t<Library\n\t\t\t\t\tshowInserterHelpPanel\n\t\t\t\t\tshouldFocusBlock={ isMobileViewport }\n\t\t\t\t\trootClientId={ rootClientId }\n\t\t\t\t\t__experimentalInsertionIndex={ insertionIndex }\n\t\t\t\t\tref={ libraryRef }\n\t\t\t\t/>\n\t\t\t</div>\n\t\t</div>\n\t);\n}\n"]}
|
|
@@ -7,6 +7,7 @@ import { __experimentalListView as ListView } from '@wordpress/block-editor';
|
|
|
7
7
|
import { Button } from '@wordpress/components';
|
|
8
8
|
import { useFocusOnMount, useFocusReturn, useMergeRefs } from '@wordpress/compose';
|
|
9
9
|
import { useDispatch } from '@wordpress/data';
|
|
10
|
+
import { useState } from '@wordpress/element';
|
|
10
11
|
import { __ } from '@wordpress/i18n';
|
|
11
12
|
import { closeSmall } from '@wordpress/icons';
|
|
12
13
|
import { ESCAPE } from '@wordpress/keycodes';
|
|
@@ -18,7 +19,10 @@ import { store as editWidgetsStore } from '../../store';
|
|
|
18
19
|
export default function ListViewSidebar() {
|
|
19
20
|
const {
|
|
20
21
|
setIsListViewOpened
|
|
21
|
-
} = useDispatch(editWidgetsStore);
|
|
22
|
+
} = useDispatch(editWidgetsStore); // Use internal state instead of a ref to make sure that the component
|
|
23
|
+
// re-renders when the dropZoneElement updates.
|
|
24
|
+
|
|
25
|
+
const [dropZoneElement, setDropZoneElement] = useState(null);
|
|
22
26
|
const focusOnMountRef = useFocusOnMount('firstElement');
|
|
23
27
|
const headerFocusReturnRef = useFocusReturn();
|
|
24
28
|
const contentFocusReturnRef = useFocusReturn();
|
|
@@ -43,8 +47,10 @@ export default function ListViewSidebar() {
|
|
|
43
47
|
onClick: () => setIsListViewOpened(false)
|
|
44
48
|
})), createElement("div", {
|
|
45
49
|
className: "edit-widgets-editor__list-view-panel-content",
|
|
46
|
-
ref: useMergeRefs([contentFocusReturnRef, focusOnMountRef])
|
|
47
|
-
}, createElement(ListView,
|
|
50
|
+
ref: useMergeRefs([contentFocusReturnRef, focusOnMountRef, setDropZoneElement])
|
|
51
|
+
}, createElement(ListView, {
|
|
52
|
+
dropZoneElement: dropZoneElement
|
|
53
|
+
})))
|
|
48
54
|
);
|
|
49
55
|
}
|
|
50
56
|
//# sourceMappingURL=list-view-sidebar.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-widgets/src/components/secondary-sidebar/list-view-sidebar.js"],"names":["__experimentalListView","ListView","Button","useFocusOnMount","useFocusReturn","useMergeRefs","useDispatch","__","closeSmall","ESCAPE","store","editWidgetsStore","ListViewSidebar","setIsListViewOpened","focusOnMountRef","headerFocusReturnRef","contentFocusReturnRef","closeOnEscape","event","keyCode","defaultPrevented","preventDefault"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,sBAAsB,IAAIC,QAAnC,QAAmD,yBAAnD;AACA,SAASC,MAAT,QAAuB,uBAAvB;AACA,SACCC,eADD,EAECC,cAFD,EAGCC,YAHD,QAIO,oBAJP;AAKA,SAASC,WAAT,QAA4B,iBAA5B;AACA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,UAAT,QAA2B,kBAA3B;AACA,SAASC,MAAT,QAAuB,qBAAvB;AAEA;AACA;AACA;;AACA,SAASC,KAAK,IAAIC,gBAAlB,QAA0C,aAA1C;AAEA,eAAe,SAASC,eAAT,GAA2B;AACzC,QAAM;AAAEC,IAAAA;AAAF,
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-widgets/src/components/secondary-sidebar/list-view-sidebar.js"],"names":["__experimentalListView","ListView","Button","useFocusOnMount","useFocusReturn","useMergeRefs","useDispatch","useState","__","closeSmall","ESCAPE","store","editWidgetsStore","ListViewSidebar","setIsListViewOpened","dropZoneElement","setDropZoneElement","focusOnMountRef","headerFocusReturnRef","contentFocusReturnRef","closeOnEscape","event","keyCode","defaultPrevented","preventDefault"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,sBAAsB,IAAIC,QAAnC,QAAmD,yBAAnD;AACA,SAASC,MAAT,QAAuB,uBAAvB;AACA,SACCC,eADD,EAECC,cAFD,EAGCC,YAHD,QAIO,oBAJP;AAKA,SAASC,WAAT,QAA4B,iBAA5B;AACA,SAASC,QAAT,QAAyB,oBAAzB;AACA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,UAAT,QAA2B,kBAA3B;AACA,SAASC,MAAT,QAAuB,qBAAvB;AAEA;AACA;AACA;;AACA,SAASC,KAAK,IAAIC,gBAAlB,QAA0C,aAA1C;AAEA,eAAe,SAASC,eAAT,GAA2B;AACzC,QAAM;AAAEC,IAAAA;AAAF,MAA0BR,WAAW,CAAEM,gBAAF,CAA3C,CADyC,CAGzC;AACA;;AACA,QAAM,CAAEG,eAAF,EAAmBC,kBAAnB,IAA0CT,QAAQ,CAAE,IAAF,CAAxD;AAEA,QAAMU,eAAe,GAAGd,eAAe,CAAE,cAAF,CAAvC;AACA,QAAMe,oBAAoB,GAAGd,cAAc,EAA3C;AACA,QAAMe,qBAAqB,GAAGf,cAAc,EAA5C;;AAEA,WAASgB,aAAT,CAAwBC,KAAxB,EAAgC;AAC/B,QAAKA,KAAK,CAACC,OAAN,KAAkBZ,MAAlB,IAA4B,CAAEW,KAAK,CAACE,gBAAzC,EAA4D;AAC3DF,MAAAA,KAAK,CAACG,cAAN;AACAV,MAAAA,mBAAmB,CAAE,KAAF,CAAnB;AACA;AACD;;AAED,SACC;AACA;AACC,MAAA,SAAS,EAAC,sCADX;AAEC,MAAA,SAAS,EAAGM;AAFb,OAIC;AACC,MAAA,SAAS,EAAC,6CADX;AAEC,MAAA,GAAG,EAAGF;AAFP,OAIC,8BAAUV,EAAE,CAAE,WAAF,CAAZ,CAJD,EAKC,cAAC,MAAD;AACC,MAAA,IAAI,EAAGC,UADR;AAEC,MAAA,KAAK,EAAGD,EAAE,CAAE,OAAF,CAFX;AAGC,MAAA,OAAO,EAAG,MAAMM,mBAAmB,CAAE,KAAF;AAHpC,MALD,CAJD,EAeC;AACC,MAAA,SAAS,EAAC,8CADX;AAEC,MAAA,GAAG,EAAGT,YAAY,CAAE,CACnBc,qBADmB,EAEnBF,eAFmB,EAGnBD,kBAHmB,CAAF;AAFnB,OAQC,cAAC,QAAD;AAAU,MAAA,eAAe,EAAGD;AAA5B,MARD,CAfD;AAFD;AA6BA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __experimentalListView as ListView } from '@wordpress/block-editor';\nimport { Button } from '@wordpress/components';\nimport {\n\tuseFocusOnMount,\n\tuseFocusReturn,\n\tuseMergeRefs,\n} from '@wordpress/compose';\nimport { useDispatch } from '@wordpress/data';\nimport { 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';\n\nexport default function ListViewSidebar() {\n\tconst { setIsListViewOpened } = useDispatch( 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\tconst headerFocusReturnRef = useFocusReturn();\n\tconst contentFocusReturnRef = useFocusReturn();\n\n\tfunction closeOnEscape( event ) {\n\t\tif ( event.keyCode === ESCAPE && ! event.defaultPrevented ) {\n\t\t\tevent.preventDefault();\n\t\t\tsetIsListViewOpened( false );\n\t\t}\n\t}\n\n\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\n\t\t\t\tclassName=\"edit-widgets-editor__list-view-panel-header\"\n\t\t\t\tref={ headerFocusReturnRef }\n\t\t\t>\n\t\t\t\t<strong>{ __( '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={ () => setIsListViewOpened( false ) }\n\t\t\t\t/>\n\t\t\t</div>\n\t\t\t<div\n\t\t\t\tclassName=\"edit-widgets-editor__list-view-panel-content\"\n\t\t\t\tref={ useMergeRefs( [\n\t\t\t\t\tcontentFocusReturnRef,\n\t\t\t\t\tfocusOnMountRef,\n\t\t\t\t\tsetDropZoneElement,\n\t\t\t\t] ) }\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"]}
|
|
@@ -9,10 +9,10 @@ import classnames from 'classnames';
|
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
11
|
import { useEffect, Platform } from '@wordpress/element';
|
|
12
|
-
import { __, sprintf } from '@wordpress/i18n';
|
|
12
|
+
import { isRTL, __, sprintf } from '@wordpress/i18n';
|
|
13
13
|
import { ComplementaryArea, store as interfaceStore } from '@wordpress/interface';
|
|
14
14
|
import { BlockInspector, store as blockEditorStore } from '@wordpress/block-editor';
|
|
15
|
-
import {
|
|
15
|
+
import { drawerLeft, drawerRight } from '@wordpress/icons';
|
|
16
16
|
import { Button } from '@wordpress/components';
|
|
17
17
|
import { useSelect, useDispatch } from '@wordpress/data';
|
|
18
18
|
const SIDEBAR_ACTIVE_BY_DEFAULT = Platform.select({
|
|
@@ -30,12 +30,11 @@ const WIDGET_AREAS_IDENTIFIER = 'edit-widgets/block-areas';
|
|
|
30
30
|
import WidgetAreas from './widget-areas';
|
|
31
31
|
import { store as editWidgetsStore } from '../../store';
|
|
32
32
|
|
|
33
|
-
function ComplementaryAreaTab(
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
} = _ref;
|
|
33
|
+
function ComplementaryAreaTab({
|
|
34
|
+
identifier,
|
|
35
|
+
label,
|
|
36
|
+
isActive
|
|
37
|
+
}) {
|
|
39
38
|
const {
|
|
40
39
|
enableComplementaryArea
|
|
41
40
|
} = useDispatch(interfaceStore);
|
|
@@ -126,10 +125,10 @@ export default function Sidebar() {
|
|
|
126
125
|
closeLabel: __('Close Settings'),
|
|
127
126
|
scope: "core/edit-widgets",
|
|
128
127
|
identifier: currentArea,
|
|
129
|
-
icon:
|
|
128
|
+
icon: isRTL() ? drawerLeft : drawerRight,
|
|
130
129
|
isActiveByDefault: SIDEBAR_ACTIVE_BY_DEFAULT
|
|
131
130
|
}, currentArea === WIDGET_AREAS_IDENTIFIER && createElement(WidgetAreas, {
|
|
132
|
-
selectedWidgetAreaId: selectedWidgetAreaBlock
|
|
131
|
+
selectedWidgetAreaId: selectedWidgetAreaBlock?.attributes.id
|
|
133
132
|
}), currentArea === BLOCK_INSPECTOR_IDENTIFIER && (hasSelectedNonAreaBlock ? createElement(BlockInspector, null) : // Pretend that Widget Areas are part of the UI by not
|
|
134
133
|
// showing the Block Inspector when one is selected.
|
|
135
134
|
createElement("span", {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-widgets/src/components/sidebar/index.js"],"names":["classnames","useEffect","Platform","__","sprintf","ComplementaryArea","store","interfaceStore","BlockInspector","blockEditorStore","cog","Button","useSelect","useDispatch","SIDEBAR_ACTIVE_BY_DEFAULT","select","web","native","BLOCK_INSPECTOR_IDENTIFIER","WIDGET_AREAS_IDENTIFIER","WidgetAreas","editWidgetsStore","ComplementaryAreaTab","identifier","label","isActive","enableComplementaryArea","name","Sidebar","currentArea","hasSelectedNonAreaBlock","isGeneralSidebarOpen","selectedWidgetAreaBlock","getSelectedBlock","getBlock","getBlockParentsByBlockName","getActiveComplementaryArea","selectedBlock","activeArea","currentSelection","widgetAreaBlock","clientId","attributes","id"],"mappings":";;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AAEA;AACA;AACA;;AACA,SAASC,SAAT,EAAoBC,QAApB,QAAoC,oBAApC;AACA,SAASC,EAAT,EAAaC,OAAb,QAA4B,iBAA5B;AACA,SACCC,iBADD,EAECC,KAAK,IAAIC,cAFV,QAGO,sBAHP;AAIA,SACCC,cADD,EAECF,KAAK,IAAIG,gBAFV,QAGO,yBAHP;AAKA,SAASC,GAAT,QAAoB,kBAApB;AACA,SAASC,MAAT,QAAuB,uBAAvB;AACA,SAASC,SAAT,EAAoBC,WAApB,QAAuC,iBAAvC;AAEA,MAAMC,yBAAyB,GAAGZ,QAAQ,CAACa,MAAT,CAAiB;AAClDC,EAAAA,GAAG,EAAE,IAD6C;AAElDC,EAAAA,MAAM,EAAE;AAF0C,CAAjB,CAAlC;AAKA,MAAMC,0BAA0B,GAAG,8BAAnC,C,CAEA;AACA;;AACA,MAAMC,uBAAuB,GAAG,0BAAhC;AAEA;AACA;AACA;;AACA,OAAOC,WAAP,MAAwB,gBAAxB;AACA,SAASd,KAAK,IAAIe,gBAAlB,QAA0C,aAA1C;;AAEA,SAASC,oBAAT,OAAiE;AAA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ADD,EAYC,0BACC,cAAC,oBAAD;AACC,MAAA,UAAU,EAAGD,0BADd;AAEC,MAAA,KAAK,EAAGf,EAAE,CAAE,OAAF,CAFX;AAGC,MAAA,QAAQ,EACP0B,WAAW,KAAKX;AAJlB,MADD,CAZD,CAHF;AA0BC,IAAA,eAAe,EAAC;AAChB;AA3BD;AA4BC,IAAA,KAAK,EAAGf,EAAE,CAAE,UAAF,CA5BX;AA6BC,IAAA,UAAU,EAAGA,EAAE,CAAE,gBAAF,CA7BhB;AA8BC,IAAA,KAAK,EAAC,mBA9BP;AA+BC,IAAA,UAAU,EAAG0B,WA/Bd;AAgCC,IAAA,IAAI,EAAGnB,GAhCR;AAiCC,IAAA,iBAAiB,EAAGI;AAjCrB,KAmCGe,WAAW,KAAKV,uBAAhB,IACD,cAAC,WAAD;AACC,IAAA,oBAAoB,EACnBa,uBADmB,aACnBA,uBADmB,uBACnBA,uBAAuB,CAAEU,UAAzB,CAAoCC;AAFtC,IApCF,EA0CGd,WAAW,KAAKX,0BAAhB,KACCY,uBAAuB,GACxB,cAAC,cAAD,OADwB,GAGxB;AACA;AACA;AAAM,IAAA,SAAS,EAAC;AAAhB,KACG3B,EAAE,CAAE,oBAAF,CADL,CANA,CA1CH,CADD;AAuDA","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { useEffect, Platform } from '@wordpress/element';\nimport { __, sprintf } 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 { cog } from '@wordpress/icons';\nimport { Button } 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';\n\nfunction ComplementaryAreaTab( { identifier, label, isActive } ) {\n\tconst { enableComplementaryArea } = useDispatch( interfaceStore );\n\treturn (\n\t\t<Button\n\t\t\tonClick={ () =>\n\t\t\t\tenableComplementaryArea( editWidgetsStore.name, identifier )\n\t\t\t}\n\t\t\tclassName={ classnames( 'edit-widgets-sidebar__panel-tab', {\n\t\t\t\t'is-active': isActive,\n\t\t\t} ) }\n\t\t\taria-label={\n\t\t\t\tisActive\n\t\t\t\t\t? // translators: %s: sidebar label e.g: \"Widget Areas\".\n\t\t\t\t\t sprintf( __( '%s (selected)' ), label )\n\t\t\t\t\t: label\n\t\t\t}\n\t\t\tdata-label={ label }\n\t\t>\n\t\t\t{ label }\n\t\t</Button>\n\t);\n}\n\nexport default function Sidebar() {\n\tconst { enableComplementaryArea } = useDispatch( interfaceStore );\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\t// currentArea, and isGeneralSidebarOpen are intentionally left out from the dependencies,\n\t// because we want to run the effect when a block is selected/unselected and not when the sidebar state changes.\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}, [ hasSelectedNonAreaBlock, enableComplementaryArea ] );\n\n\treturn (\n\t\t<ComplementaryArea\n\t\t\tclassName=\"edit-widgets-sidebar\"\n\t\t\theader={\n\t\t\t\t<ul>\n\t\t\t\t\t<li>\n\t\t\t\t\t\t<ComplementaryAreaTab\n\t\t\t\t\t\t\tidentifier={ WIDGET_AREAS_IDENTIFIER }\n\t\t\t\t\t\t\tlabel={\n\t\t\t\t\t\t\t\tselectedWidgetAreaBlock\n\t\t\t\t\t\t\t\t\t? selectedWidgetAreaBlock.attributes.name\n\t\t\t\t\t\t\t\t\t: __( 'Widget Areas' )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tisActive={ currentArea === WIDGET_AREAS_IDENTIFIER }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</li>\n\t\t\t\t\t<li>\n\t\t\t\t\t\t<ComplementaryAreaTab\n\t\t\t\t\t\t\tidentifier={ BLOCK_INSPECTOR_IDENTIFIER }\n\t\t\t\t\t\t\tlabel={ __( 'Block' ) }\n\t\t\t\t\t\t\tisActive={\n\t\t\t\t\t\t\t\tcurrentArea === BLOCK_INSPECTOR_IDENTIFIER\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</li>\n\t\t\t\t</ul>\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={ cog }\n\t\t\tisActiveByDefault={ SIDEBAR_ACTIVE_BY_DEFAULT }\n\t\t>\n\t\t\t{ currentArea === WIDGET_AREAS_IDENTIFIER && (\n\t\t\t\t<WidgetAreas\n\t\t\t\t\tselectedWidgetAreaId={\n\t\t\t\t\t\tselectedWidgetAreaBlock?.attributes.id\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ currentArea === BLOCK_INSPECTOR_IDENTIFIER &&\n\t\t\t\t( hasSelectedNonAreaBlock ? (\n\t\t\t\t\t<BlockInspector />\n\t\t\t\t) : (\n\t\t\t\t\t// Pretend that Widget Areas are part of the UI by not\n\t\t\t\t\t// showing the Block Inspector when one is selected.\n\t\t\t\t\t<span className=\"block-editor-block-inspector__no-blocks\">\n\t\t\t\t\t\t{ __( 'No block selected.' ) }\n\t\t\t\t\t</span>\n\t\t\t\t) ) }\n\t\t</ComplementaryArea>\n\t);\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-widgets/src/components/sidebar/index.js"],"names":["classnames","useEffect","Platform","isRTL","__","sprintf","ComplementaryArea","store","interfaceStore","BlockInspector","blockEditorStore","drawerLeft","drawerRight","Button","useSelect","useDispatch","SIDEBAR_ACTIVE_BY_DEFAULT","select","web","native","BLOCK_INSPECTOR_IDENTIFIER","WIDGET_AREAS_IDENTIFIER","WidgetAreas","editWidgetsStore","ComplementaryAreaTab","identifier","label","isActive","enableComplementaryArea","name","Sidebar","currentArea","hasSelectedNonAreaBlock","isGeneralSidebarOpen","selectedWidgetAreaBlock","getSelectedBlock","getBlock","getBlockParentsByBlockName","getActiveComplementaryArea","selectedBlock","activeArea","currentSelection","widgetAreaBlock","clientId","attributes","id"],"mappings":";;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AAEA;AACA;AACA;;AACA,SAASC,SAAT,EAAoBC,QAApB,QAAoC,oBAApC;AACA,SAASC,KAAT,EAAgBC,EAAhB,EAAoBC,OAApB,QAAmC,iBAAnC;AACA,SACCC,iBADD,EAECC,KAAK,IAAIC,cAFV,QAGO,sBAHP;AAIA,SACCC,cADD,EAECF,KAAK,IAAIG,gBAFV,QAGO,yBAHP;AAKA,SAASC,UAAT,EAAqBC,WAArB,QAAwC,kBAAxC;AACA,SAASC,MAAT,QAAuB,uBAAvB;AACA,SAASC,SAAT,EAAoBC,WAApB,QAAuC,iBAAvC;AAEA,MAAMC,yBAAyB,GAAGd,QAAQ,CAACe,MAAT,CAAiB;AAClDC,EAAAA,GAAG,EAAE,IAD6C;AAElDC,EAAAA,MAAM,EAAE;AAF0C,CAAjB,CAAlC;AAKA,MAAMC,0BAA0B,GAAG,8BAAnC,C,CAEA;AACA;;AACA,MAAMC,uBAAuB,GAAG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AAuB,GACpBA,uBAAuB,CAACU,UAAxB,CAAmCf,IADf,GAEpBzB,EAAE,CAAE,cAAF,CALP;AAOC,MAAA,QAAQ,EAAG2B,WAAW,KAAKV;AAP5B,MADD,CADD,EAYC,0BACC,cAAC,oBAAD;AACC,MAAA,UAAU,EAAGD,0BADd;AAEC,MAAA,KAAK,EAAGhB,EAAE,CAAE,OAAF,CAFX;AAGC,MAAA,QAAQ,EACP2B,WAAW,KAAKX;AAJlB,MADD,CAZD,CAHF;AA0BC,IAAA,eAAe,EAAC;AAChB;AA3BD;AA4BC,IAAA,KAAK,EAAGhB,EAAE,CAAE,UAAF,CA5BX;AA6BC,IAAA,UAAU,EAAGA,EAAE,CAAE,gBAAF,CA7BhB;AA8BC,IAAA,KAAK,EAAC,mBA9BP;AA+BC,IAAA,UAAU,EAAG2B,WA/Bd;AAgCC,IAAA,IAAI,EAAG5B,KAAK,KAAKQ,UAAL,GAAkBC,WAhC/B;AAiCC,IAAA,iBAAiB,EAAGI;AAjCrB,KAmCGe,WAAW,KAAKV,uBAAhB,IACD,cAAC,WAAD;AACC,IAAA,oBAAoB,EACnBa,uBAAuB,EAAEU,UAAzB,CAAoCC;AAFtC,IApCF,EA0CGd,WAAW,KAAKX,0BAAhB,KACCY,uBAAuB,GACxB,cAAC,cAAD,OADwB,GAGxB;AACA;AACA;AAAM,IAAA,SAAS,EAAC;AAAhB,KACG5B,EAAE,CAAE,oBAAF,CADL,CANA,CA1CH,CADD;AAuDA","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { useEffect, Platform } from '@wordpress/element';\nimport { isRTL, __, sprintf } 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 { Button } 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';\n\nfunction ComplementaryAreaTab( { identifier, label, isActive } ) {\n\tconst { enableComplementaryArea } = useDispatch( interfaceStore );\n\treturn (\n\t\t<Button\n\t\t\tonClick={ () =>\n\t\t\t\tenableComplementaryArea( editWidgetsStore.name, identifier )\n\t\t\t}\n\t\t\tclassName={ classnames( 'edit-widgets-sidebar__panel-tab', {\n\t\t\t\t'is-active': isActive,\n\t\t\t} ) }\n\t\t\taria-label={\n\t\t\t\tisActive\n\t\t\t\t\t? // translators: %s: sidebar label e.g: \"Widget Areas\".\n\t\t\t\t\t sprintf( __( '%s (selected)' ), label )\n\t\t\t\t\t: label\n\t\t\t}\n\t\t\tdata-label={ label }\n\t\t>\n\t\t\t{ label }\n\t\t</Button>\n\t);\n}\n\nexport default function Sidebar() {\n\tconst { enableComplementaryArea } = useDispatch( interfaceStore );\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\t// currentArea, and isGeneralSidebarOpen are intentionally left out from the dependencies,\n\t// because we want to run the effect when a block is selected/unselected and not when the sidebar state changes.\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}, [ hasSelectedNonAreaBlock, enableComplementaryArea ] );\n\n\treturn (\n\t\t<ComplementaryArea\n\t\t\tclassName=\"edit-widgets-sidebar\"\n\t\t\theader={\n\t\t\t\t<ul>\n\t\t\t\t\t<li>\n\t\t\t\t\t\t<ComplementaryAreaTab\n\t\t\t\t\t\t\tidentifier={ WIDGET_AREAS_IDENTIFIER }\n\t\t\t\t\t\t\tlabel={\n\t\t\t\t\t\t\t\tselectedWidgetAreaBlock\n\t\t\t\t\t\t\t\t\t? selectedWidgetAreaBlock.attributes.name\n\t\t\t\t\t\t\t\t\t: __( 'Widget Areas' )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tisActive={ currentArea === WIDGET_AREAS_IDENTIFIER }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</li>\n\t\t\t\t\t<li>\n\t\t\t\t\t\t<ComplementaryAreaTab\n\t\t\t\t\t\t\tidentifier={ BLOCK_INSPECTOR_IDENTIFIER }\n\t\t\t\t\t\t\tlabel={ __( 'Block' ) }\n\t\t\t\t\t\t\tisActive={\n\t\t\t\t\t\t\t\tcurrentArea === BLOCK_INSPECTOR_IDENTIFIER\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</li>\n\t\t\t\t</ul>\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{ currentArea === WIDGET_AREAS_IDENTIFIER && (\n\t\t\t\t<WidgetAreas\n\t\t\t\t\tselectedWidgetAreaId={\n\t\t\t\t\t\tselectedWidgetAreaBlock?.attributes.id\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ currentArea === BLOCK_INSPECTOR_IDENTIFIER &&\n\t\t\t\t( hasSelectedNonAreaBlock ? (\n\t\t\t\t\t<BlockInspector />\n\t\t\t\t) : (\n\t\t\t\t\t// Pretend that Widget Areas are part of the UI by not\n\t\t\t\t\t// showing the Block Inspector when one is selected.\n\t\t\t\t\t<span className=\"block-editor-block-inspector__no-blocks\">\n\t\t\t\t\t\t{ __( 'No block selected.' ) }\n\t\t\t\t\t</span>\n\t\t\t\t) ) }\n\t\t</ComplementaryArea>\n\t);\n}\n"]}
|
|
@@ -16,12 +16,11 @@ import { safeHTML } from '@wordpress/dom';
|
|
|
16
16
|
*/
|
|
17
17
|
|
|
18
18
|
import { store as editWidgetsStore } from '../../store';
|
|
19
|
-
export default function WidgetAreas(
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
} = _ref;
|
|
19
|
+
export default function WidgetAreas({
|
|
20
|
+
selectedWidgetAreaId
|
|
21
|
+
}) {
|
|
23
22
|
const widgetAreas = useSelect(select => select(editWidgetsStore).getWidgetAreas(), []);
|
|
24
|
-
const selectedWidgetArea = useMemo(() => selectedWidgetAreaId &&
|
|
23
|
+
const selectedWidgetArea = useMemo(() => selectedWidgetAreaId && widgetAreas?.find(widgetArea => widgetArea.id === selectedWidgetAreaId), [selectedWidgetAreaId, widgetAreas]);
|
|
25
24
|
let description;
|
|
26
25
|
|
|
27
26
|
if (!selectedWidgetArea) {
|
|
@@ -46,7 +45,7 @@ export default function WidgetAreas(_ref) {
|
|
|
46
45
|
dangerouslySetInnerHTML: {
|
|
47
46
|
__html: safeHTML(description)
|
|
48
47
|
}
|
|
49
|
-
}),
|
|
48
|
+
}), widgetAreas?.length === 0 && createElement("p", null, __('Your theme does not contain any Widget Areas.')), !selectedWidgetArea && createElement(Button, {
|
|
50
49
|
href: addQueryArgs('customize.php', {
|
|
51
50
|
'autofocus[panel]': 'widgets',
|
|
52
51
|
return: window.location.pathname
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-widgets/src/components/sidebar/widget-areas.js"],"names":["useSelect","useMemo","blockDefault","BlockIcon","Button","__","addQueryArgs","safeHTML","store","editWidgetsStore","WidgetAreas","selectedWidgetAreaId","widgetAreas","select","getWidgetAreas","selectedWidgetArea","find","widgetArea","id","description","__html","length","return","window","location","pathname"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,SAAT,QAA0B,iBAA1B;AACA,SAASC,OAAT,QAAwB,oBAAxB;AACA,SAASC,YAAT,QAA6B,kBAA7B;AACA,SAASC,SAAT,QAA0B,yBAA1B;AACA,SAASC,MAAT,QAAuB,uBAAvB;AACA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,YAAT,QAA6B,gBAA7B;AACA,SAASC,QAAT,QAAyB,gBAAzB;AAEA;AACA;AACA;;AACA,SAASC,KAAK,IAAIC,gBAAlB,QAA0C,aAA1C;AAEA,eAAe,SAASC,WAAT,
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-widgets/src/components/sidebar/widget-areas.js"],"names":["useSelect","useMemo","blockDefault","BlockIcon","Button","__","addQueryArgs","safeHTML","store","editWidgetsStore","WidgetAreas","selectedWidgetAreaId","widgetAreas","select","getWidgetAreas","selectedWidgetArea","find","widgetArea","id","description","__html","length","return","window","location","pathname"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,SAAT,QAA0B,iBAA1B;AACA,SAASC,OAAT,QAAwB,oBAAxB;AACA,SAASC,YAAT,QAA6B,kBAA7B;AACA,SAASC,SAAT,QAA0B,yBAA1B;AACA,SAASC,MAAT,QAAuB,uBAAvB;AACA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,YAAT,QAA6B,gBAA7B;AACA,SAASC,QAAT,QAAyB,gBAAzB;AAEA;AACA;AACA;;AACA,SAASC,KAAK,IAAIC,gBAAlB,QAA0C,aAA1C;AAEA,eAAe,SAASC,WAAT,CAAsB;AAAEC,EAAAA;AAAF,CAAtB,EAAiD;AAC/D,QAAMC,WAAW,GAAGZ,SAAS,CAC1Ba,MAAF,IAAcA,MAAM,CAAEJ,gBAAF,CAAN,CAA2BK,cAA3B,EADc,EAE5B,EAF4B,CAA7B;AAKA,QAAMC,kBAAkB,GAAGd,OAAO,CACjC,MACCU,oBAAoB,IACpBC,WAAW,EAAEI,IAAb,CACGC,UAAF,IAAkBA,UAAU,CAACC,EAAX,KAAkBP,oBADrC,CAHgC,EAMjC,CAAEA,oBAAF,EAAwBC,WAAxB,CANiC,CAAlC;AASA,MAAIO,WAAJ;;AACA,MAAK,CAAEJ,kBAAP,EAA4B;AAC3BI,IAAAA,WAAW,GAAGd,EAAE,CACf,uJADe,CAAhB;AAGA,GAJD,MAIO,IAAKM,oBAAoB,KAAK,qBAA9B,EAAsD;AAC5DQ,IAAAA,WAAW,GAAGd,EAAE,CACf,gEADe,CAAhB;AAGA,GAJM,MAIA;AACNc,IAAAA,WAAW,GAAGJ,kBAAkB,CAACI,WAAjC;AACA;;AAED,SACC;AAAK,IAAA,SAAS,EAAC;AAAf,KACC;AAAK,IAAA,SAAS,EAAC;AAAf,KACC,cAAC,SAAD;AAAW,IAAA,IAAI,EAAGjB;AAAlB,IADD,EAEC,2BACC;AACC;AACA;AACA;AACA;AACA,IAAA,uBAAuB,EAAG;AACzBkB,MAAAA,MAAM,EAAEb,QAAQ,CAAEY,WAAF;AADS;AAL3B,IADD,EAUGP,WAAW,EAAES,MAAb,KAAwB,CAAxB,IACD,yBACGhB,EAAE,CACH,+CADG,CADL,CAXF,EAiBG,CAAEU,kBAAF,IACD,cAAC,MAAD;AACC,IAAA,IAAI,EAAGT,YAAY,CAAE,eAAF,EAAmB;AACrC,0BAAoB,SADiB;AAErCgB,MAAAA,MAAM,EAAEC,MAAM,CAACC,QAAP,CAAgBC;AAFa,KAAnB,CADpB;AAKC,IAAA,OAAO,EAAC;AALT,KAOGpB,EAAE,CAAE,0BAAF,CAPL,CAlBF,CAFD,CADD,CADD;AAoCA","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"]}
|
|
@@ -28,8 +28,8 @@ export default function WelcomeGuide() {
|
|
|
28
28
|
return null;
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
-
const isEntirelyBlockWidgets = widgetAreas
|
|
32
|
-
const numWidgetAreas = (_widgetAreas$filter$l = widgetAreas
|
|
31
|
+
const isEntirelyBlockWidgets = widgetAreas?.every(widgetArea => widgetArea.id === 'wp_inactive_widgets' || widgetArea.widgets.every(widgetId => widgetId.startsWith('block-')));
|
|
32
|
+
const numWidgetAreas = (_widgetAreas$filter$l = widgetAreas?.filter(widgetArea => widgetArea.id !== 'wp_inactive_widgets').length) !== null && _widgetAreas$filter$l !== void 0 ? _widgetAreas$filter$l : 0;
|
|
33
33
|
return createElement(Guide, {
|
|
34
34
|
className: "edit-widgets-welcome-guide",
|
|
35
35
|
contentLabel: __('Welcome to block Widgets'),
|
|
@@ -94,11 +94,10 @@ export default function WelcomeGuide() {
|
|
|
94
94
|
});
|
|
95
95
|
}
|
|
96
96
|
|
|
97
|
-
function WelcomeGuideImage(
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
} = _ref;
|
|
97
|
+
function WelcomeGuideImage({
|
|
98
|
+
nonAnimatedSrc,
|
|
99
|
+
animatedSrc
|
|
100
|
+
}) {
|
|
102
101
|
return createElement("picture", {
|
|
103
102
|
className: "edit-widgets-welcome-guide__image"
|
|
104
103
|
}, createElement("source", {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-widgets/src/components/welcome-guide/index.js"],"names":["useSelect","useDispatch","ExternalLink","Guide","__","sprintf","_n","createInterpolateElement","store","preferencesStore","editWidgetsStore","WelcomeGuide","isActive","select","get","toggle","widgetAreas","getWidgetAreas","per_page","isEntirelyBlockWidgets","every","widgetArea","id","widgets","widgetId","startsWith","numWidgetAreas","filter","length","image","content","InserterIconImage","WelcomeGuideImage","nonAnimatedSrc","animatedSrc"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,SAAT,EAAoBC,WAApB,QAAuC,iBAAvC;AACA,SAASC,YAAT,EAAuBC,KAAvB,QAAoC,uBAApC;AACA,SAASC,EAAT,EAAaC,OAAb,EAAsBC,EAAtB,QAAgC,iBAAhC;AACA,SAASC,wBAAT,QAAyC,oBAAzC;AACA,SAASC,KAAK,IAAIC,gBAAlB,QAA0C,wBAA1C;AAEA;AACA;AACA;;AACA,SAASD,KAAK,IAAIE,gBAAlB,QAA0C,aAA1C;AAEA,eAAe,SAASC,YAAT,GAAwB;AAAA;;AACtC,QAAMC,QAAQ,GAAGZ,SAAS,CACvBa,MAAF,IACC,CAAC,CAAEA,MAAM,CAAEJ,gBAAF,CAAN,CAA2BK,GAA3B,CACF,mBADE,EAEF,cAFE,CAFqB,EAMzB,EANyB,CAA1B;AASA,QAAM;AAAEC,IAAAA;AAAF,MAAad,WAAW,CAAEQ,gBAAF,CAA9B;AAEA,QAAMO,WAAW,GAAGhB,SAAS,CAC1Ba,MAAF,IACCA,MAAM,CAAEH,gBAAF,CAAN,CAA2BO,cAA3B,CAA2C;AAAEC,IAAAA,QAAQ,EAAE,CAAC;AAAb,GAA3C,CA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AAI,EAAGA,EAAE,CACR,qEADQ;AADV,SAKGA,EAAE,CAAE,0BAAF,CALL,CAJD,CAJD;AARF,KA1GO;AALT,IADD;AA8IA;;AAED,SAAS4B,iBAAT,OAA8D;AAAA,MAAlC;AAAEC,IAAAA,cAAF;AAAkBC,IAAAA;AAAlB,GAAkC;AAC7D,SACC;AAAS,IAAA,SAAS,EAAC;AAAnB,KACC;AACC,IAAA,MAAM,EAAGD,cADV;AAEC,IAAA,KAAK,EAAC;AAFP,IADD,EAKC;AAAK,IAAA,GAAG,EAAGC,WAAX;AAAyB,IAAA,KAAK,EAAC,KAA/B;AAAqC,IAAA,MAAM,EAAC,KAA5C;AAAkD,IAAA,GAAG,EAAC;AAAtD,IALD,CADD;AASA","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"]}
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-widgets/src/components/welcome-guide/index.js"],"names":["useSelect","useDispatch","ExternalLink","Guide","__","sprintf","_n","createInterpolateElement","store","preferencesStore","editWidgetsStore","WelcomeGuide","isActive","select","get","toggle","widgetAreas","getWidgetAreas","per_page","isEntirelyBlockWidgets","every","widgetArea","id","widgets","widgetId","startsWith","numWidgetAreas","filter","length","image","content","InserterIconImage","WelcomeGuideImage","nonAnimatedSrc","animatedSrc"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,SAAT,EAAoBC,WAApB,QAAuC,iBAAvC;AACA,SAASC,YAAT,EAAuBC,KAAvB,QAAoC,uBAApC;AACA,SAASC,EAAT,EAAaC,OAAb,EAAsBC,EAAtB,QAAgC,iBAAhC;AACA,SAASC,wBAAT,QAAyC,oBAAzC;AACA,SAASC,KAAK,IAAIC,gBAAlB,QAA0C,wBAA1C;AAEA;AACA;AACA;;AACA,SAASD,KAAK,IAAIE,gBAAlB,QAA0C,aAA1C;AAEA,eAAe,SAASC,YAAT,GAAwB;AAAA;;AACtC,QAAMC,QAAQ,GAAGZ,SAAS,CACvBa,MAAF,IACC,CAAC,CAAEA,MAAM,CAAEJ,gBAAF,CAAN,CAA2BK,GAA3B,CACF,mBADE,EAEF,cAFE,CAFqB,EAMzB,EANyB,CAA1B;AASA,QAAM;AAAEC,IAAAA;AAAF,MAAad,WAAW,CAAEQ,gBAAF,CAA9B;AAEA,QAAMO,WAAW,GAAGhB,SAAS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C;AAAb,SACGA,EAAE,CACH,8DADG,CADL,EAIC,cAAC,YAAD;AACC,QAAA,IAAI,EAAGA,EAAE,CACR,qEADQ;AADV,SAKGA,EAAE,CAAE,0BAAF,CALL,CAJD,CAJD;AARF,KA1GO;AALT,IADD;AA8IA;;AAED,SAAS4B,iBAAT,CAA4B;AAAEC,EAAAA,cAAF;AAAkBC,EAAAA;AAAlB,CAA5B,EAA8D;AAC7D,SACC;AAAS,IAAA,SAAS,EAAC;AAAnB,KACC;AACC,IAAA,MAAM,EAAGD,cADV;AAEC,IAAA,KAAK,EAAC;AAFP,IADD,EAKC;AAAK,IAAA,GAAG,EAAGC,WAAX;AAAyB,IAAA,KAAK,EAAC,KAA/B;AAAqC,IAAA,MAAM,EAAC,KAA5C;AAAkD,IAAA,GAAG,EAAC;AAAtD,IALD,CADD;AASA","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"]}
|
|
@@ -13,10 +13,9 @@ import { store as preferencesStore } from '@wordpress/preferences';
|
|
|
13
13
|
|
|
14
14
|
import Notices from '../notices';
|
|
15
15
|
import KeyboardShortcuts from '../keyboard-shortcuts';
|
|
16
|
-
export default function WidgetAreasBlockEditorContent(
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
} = _ref;
|
|
16
|
+
export default function WidgetAreasBlockEditorContent({
|
|
17
|
+
blockEditorSettings
|
|
18
|
+
}) {
|
|
20
19
|
const hasThemeStyles = useSelect(select => !!select(preferencesStore).get('core/edit-widgets', 'themeStyles'), []);
|
|
21
20
|
const styles = useMemo(() => {
|
|
22
21
|
return hasThemeStyles ? blockEditorSettings.styles : [];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-widgets/src/components/widget-areas-block-editor-content/index.js"],"names":["BlockList","BlockTools","BlockSelectionClearer","WritingFlow","ObserveTyping","__unstableEditorStyles","EditorStyles","useSelect","useMemo","store","preferencesStore","Notices","KeyboardShortcuts","WidgetAreasBlockEditorContent","blockEditorSettings","hasThemeStyles","select","get","styles"],"mappings":";;AAAA;AACA;AACA;AACA,SACCA,SADD,EAECC,UAFD,EAGCC,qBAHD,EAICC,WAJD,EAKCC,aALD,EAMCC,sBAAsB,IAAIC,YAN3B,QAOO,yBAPP;AAQA,SAASC,SAAT,QAA0B,iBAA1B;AACA,SAASC,OAAT,QAAwB,oBAAxB;AACA,SAASC,KAAK,IAAIC,gBAAlB,QAA0C,wBAA1C;AAEA;AACA;AACA;;AACA,OAAOC,OAAP,MAAoB,YAApB;AACA,OAAOC,iBAAP,MAA8B,uBAA9B;AAEA,eAAe,SAASC,6BAAT,
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-widgets/src/components/widget-areas-block-editor-content/index.js"],"names":["BlockList","BlockTools","BlockSelectionClearer","WritingFlow","ObserveTyping","__unstableEditorStyles","EditorStyles","useSelect","useMemo","store","preferencesStore","Notices","KeyboardShortcuts","WidgetAreasBlockEditorContent","blockEditorSettings","hasThemeStyles","select","get","styles"],"mappings":";;AAAA;AACA;AACA;AACA,SACCA,SADD,EAECC,UAFD,EAGCC,qBAHD,EAICC,WAJD,EAKCC,aALD,EAMCC,sBAAsB,IAAIC,YAN3B,QAOO,yBAPP;AAQA,SAASC,SAAT,QAA0B,iBAA1B;AACA,SAASC,OAAT,QAAwB,oBAAxB;AACA,SAASC,KAAK,IAAIC,gBAAlB,QAA0C,wBAA1C;AAEA;AACA;AACA;;AACA,OAAOC,OAAP,MAAoB,YAApB;AACA,OAAOC,iBAAP,MAA8B,uBAA9B;AAEA,eAAe,SAASC,6BAAT,CAAwC;AACtDC,EAAAA;AADsD,CAAxC,EAEX;AACH,QAAMC,cAAc,GAAGR,SAAS,CAC7BS,MAAF,IACC,CAAC,CAAEA,MAAM,CAAEN,gBAAF,CAAN,CAA2BO,GAA3B,CACF,mBADE,EAEF,aAFE,CAF2B,EAM/B,EAN+B,CAAhC;AASA,QAAMC,MAAM,GAAGV,OAAO,CAAE,MAAM;AAC7B,WAAOO,cAAc,GAAGD,mBAAmB,CAACI,MAAvB,GAAgC,EAArD;AACA,GAFqB,EAEnB,CAAEJ,mBAAF,EAAuBC,cAAvB,CAFmB,CAAtB;AAIA,SACC;AAAK,IAAA,SAAS,EAAC;AAAf,KACC,cAAC,OAAD,OADD,EAEC,cAAC,UAAD,QACC,cAAC,iBAAD,OADD,EAEC,cAAC,YAAD;AAAc,IAAA,MAAM,EAAGG;AAAvB,IAFD,EAGC,cAAC,qBAAD,QACC,cAAC,WAAD,QACC,cAAC,aAAD,QACC,cAAC,SAAD;AAAW,IAAA,SAAS,EAAC;AAArB,IADD,CADD,CADD,CAHD,CAFD,CADD;AAgBA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tBlockList,\n\tBlockTools,\n\tBlockSelectionClearer,\n\tWritingFlow,\n\tObserveTyping,\n\t__unstableEditorStyles as EditorStyles,\n} from '@wordpress/block-editor';\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\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<BlockTools>\n\t\t\t\t<KeyboardShortcuts />\n\t\t\t\t<EditorStyles styles={ styles } />\n\t\t\t\t<BlockSelectionClearer>\n\t\t\t\t\t<WritingFlow>\n\t\t\t\t\t\t<ObserveTyping>\n\t\t\t\t\t\t\t<BlockList className=\"edit-widgets-main-block-list\" />\n\t\t\t\t\t\t</ObserveTyping>\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"]}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
1
|
import { createElement } from "@wordpress/element";
|
|
3
2
|
|
|
4
3
|
/**
|
|
@@ -22,16 +21,15 @@ import { buildWidgetAreasPostId, KIND, POST_TYPE } from '../../store/utils';
|
|
|
22
21
|
import useLastSelectedWidgetArea from '../../hooks/use-last-selected-widget-area';
|
|
23
22
|
import { store as editWidgetsStore } from '../../store';
|
|
24
23
|
import { ALLOW_REUSABLE_BLOCKS } from '../../constants';
|
|
25
|
-
import { unlock } from '../../
|
|
24
|
+
import { unlock } from '../../lock-unlock';
|
|
26
25
|
const {
|
|
27
26
|
ExperimentalBlockEditorProvider
|
|
28
27
|
} = unlock(blockEditorPrivateApis);
|
|
29
|
-
export default function WidgetAreasBlockEditorProvider(
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
} = _ref;
|
|
28
|
+
export default function WidgetAreasBlockEditorProvider({
|
|
29
|
+
blockEditorSettings,
|
|
30
|
+
children,
|
|
31
|
+
...props
|
|
32
|
+
}) {
|
|
35
33
|
const mediaPermissions = useResourcePermissions('media');
|
|
36
34
|
const {
|
|
37
35
|
reusableBlocks,
|
|
@@ -51,19 +49,15 @@ export default function WidgetAreasBlockEditorProvider(_ref) {
|
|
|
51
49
|
let mediaUploadBlockEditor;
|
|
52
50
|
|
|
53
51
|
if (mediaPermissions.canCreate) {
|
|
54
|
-
mediaUploadBlockEditor =
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
} = _ref2;
|
|
52
|
+
mediaUploadBlockEditor = ({
|
|
53
|
+
onError,
|
|
54
|
+
...argumentsObject
|
|
55
|
+
}) => {
|
|
59
56
|
uploadMedia({
|
|
60
57
|
wpAllowedMimeTypes: blockEditorSettings.allowedMimeTypes,
|
|
61
|
-
onError:
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
} = _ref3;
|
|
65
|
-
return onError(message);
|
|
66
|
-
},
|
|
58
|
+
onError: ({
|
|
59
|
+
message
|
|
60
|
+
}) => onError(message),
|
|
67
61
|
...argumentsObject
|
|
68
62
|
});
|
|
69
63
|
};
|
|
@@ -82,13 +76,14 @@ export default function WidgetAreasBlockEditorProvider(_ref) {
|
|
|
82
76
|
const [blocks, onInput, onChange] = useEntityBlockEditor(KIND, POST_TYPE, {
|
|
83
77
|
id: buildWidgetAreasPostId()
|
|
84
78
|
});
|
|
85
|
-
return createElement(ShortcutProvider, null, createElement(BlockEditorKeyboardShortcuts.Register, null), createElement(KeyboardShortcuts.Register, null), createElement(SlotFillProvider, null, createElement(ExperimentalBlockEditorProvider,
|
|
79
|
+
return createElement(ShortcutProvider, null, createElement(BlockEditorKeyboardShortcuts.Register, null), createElement(KeyboardShortcuts.Register, null), createElement(SlotFillProvider, null, createElement(ExperimentalBlockEditorProvider, {
|
|
86
80
|
value: blocks,
|
|
87
81
|
onInput: onInput,
|
|
88
82
|
onChange: onChange,
|
|
89
83
|
settings: settings,
|
|
90
|
-
useSubRegistry: false
|
|
91
|
-
|
|
84
|
+
useSubRegistry: false,
|
|
85
|
+
...props
|
|
86
|
+
}, createElement(CopyHandler, null, children), createElement(ReusableBlocksMenuItems, {
|
|
92
87
|
rootClientId: widgetAreaId
|
|
93
88
|
}))));
|
|
94
89
|
}
|