@wordpress/edit-widgets 5.16.0 → 5.17.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +2 -0
- package/build/blocks/widget-area/edit/index.js +4 -16
- package/build/blocks/widget-area/edit/index.js.map +1 -1
- package/build/blocks/widget-area/edit/inner-blocks.js +5 -10
- package/build/blocks/widget-area/edit/inner-blocks.js.map +1 -1
- package/build/blocks/widget-area/edit/use-is-dragging-within.js +5 -10
- package/build/blocks/widget-area/edit/use-is-dragging-within.js.map +1 -1
- package/build/blocks/widget-area/index.js +0 -5
- package/build/blocks/widget-area/index.js.map +1 -1
- package/build/components/error-boundary/index.js +1 -15
- package/build/components/error-boundary/index.js.map +1 -1
- package/build/components/header/index.js +9 -32
- package/build/components/header/index.js.map +1 -1
- package/build/components/header/undo-redo/redo.js +3 -9
- package/build/components/header/undo-redo/redo.js.map +1 -1
- package/build/components/header/undo-redo/undo.js +3 -9
- package/build/components/header/undo-redo/undo.js.map +1 -1
- package/build/components/keyboard-shortcut-help-modal/config.js +1 -2
- package/build/components/keyboard-shortcut-help-modal/config.js.map +1 -1
- package/build/components/keyboard-shortcut-help-modal/dynamic-shortcut.js +1 -9
- package/build/components/keyboard-shortcut-help-modal/dynamic-shortcut.js.map +1 -1
- package/build/components/keyboard-shortcut-help-modal/index.js +4 -20
- package/build/components/keyboard-shortcut-help-modal/index.js.map +1 -1
- package/build/components/keyboard-shortcut-help-modal/shortcut.js +1 -6
- package/build/components/keyboard-shortcut-help-modal/shortcut.js.map +1 -1
- package/build/components/keyboard-shortcuts/index.js +1 -18
- package/build/components/keyboard-shortcuts/index.js.map +1 -1
- package/build/components/layout/index.js +2 -19
- package/build/components/layout/index.js.map +1 -1
- package/build/components/layout/interface.js +5 -21
- package/build/components/layout/interface.js.map +1 -1
- package/build/components/layout/unsaved-changes-warning.js +0 -6
- package/build/components/layout/unsaved-changes-warning.js.map +1 -1
- package/build/components/more-menu/index.js +2 -17
- package/build/components/more-menu/index.js.map +1 -1
- package/build/components/more-menu/tools-more-menu-group.js +1 -5
- package/build/components/more-menu/tools-more-menu-group.js.map +1 -1
- package/build/components/notices/index.js +1 -6
- package/build/components/notices/index.js.map +1 -1
- package/build/components/save-button/index.js +1 -7
- package/build/components/save-button/index.js.map +1 -1
- package/build/components/secondary-sidebar/index.js +1 -10
- package/build/components/secondary-sidebar/index.js.map +1 -1
- package/build/components/secondary-sidebar/inserter-sidebar.js +1 -11
- package/build/components/secondary-sidebar/inserter-sidebar.js.map +1 -1
- package/build/components/secondary-sidebar/list-view-sidebar.js +6 -15
- package/build/components/secondary-sidebar/list-view-sidebar.js.map +1 -1
- package/build/components/sidebar/index.js +12 -26
- package/build/components/sidebar/index.js.map +1 -1
- package/build/components/sidebar/widget-areas.js +1 -12
- package/build/components/sidebar/widget-areas.js.map +1 -1
- package/build/components/welcome-guide/index.js +3 -12
- package/build/components/welcome-guide/index.js.map +1 -1
- package/build/components/widget-areas-block-editor-content/index.js +1 -8
- package/build/components/widget-areas-block-editor-content/index.js.map +1 -1
- package/build/components/widget-areas-block-editor-provider/index.js +8 -23
- package/build/components/widget-areas-block-editor-provider/index.js.map +1 -1
- package/build/constants.js.map +1 -1
- package/build/filters/index.js +0 -1
- package/build/filters/index.js.map +1 -1
- package/build/filters/move-to-widget-area.js +3 -9
- package/build/filters/move-to-widget-area.js.map +1 -1
- package/build/filters/replace-media-upload.js +1 -3
- package/build/filters/replace-media-upload.js.map +1 -1
- package/build/hooks/use-last-selected-widget-area.js +5 -13
- package/build/hooks/use-last-selected-widget-area.js.map +1 -1
- package/build/hooks/use-widget-library-insertion-point.js +6 -14
- package/build/hooks/use-widget-library-insertion-point.js.map +1 -1
- package/build/index.js +6 -34
- package/build/index.js.map +1 -1
- package/build/lock-unlock.js +1 -2
- package/build/lock-unlock.js.map +1 -1
- package/build/store/actions.js +41 -79
- package/build/store/actions.js.map +1 -1
- package/build/store/constants.js +0 -1
- package/build/store/constants.js.map +1 -1
- package/build/store/index.js +4 -15
- package/build/store/index.js.map +1 -1
- package/build/store/reducer.js +4 -16
- package/build/store/reducer.js.map +1 -1
- package/build/store/resolvers.js +1 -17
- package/build/store/resolvers.js.map +1 -1
- package/build/store/selectors.js +28 -49
- package/build/store/selectors.js.map +1 -1
- package/build/store/transformers.js +7 -16
- package/build/store/transformers.js.map +1 -1
- package/build/store/utils.js +7 -16
- package/build/store/utils.js.map +1 -1
- package/build-module/blocks/widget-area/edit/index.js +5 -8
- package/build-module/blocks/widget-area/edit/index.js.map +1 -1
- package/build-module/blocks/widget-area/edit/inner-blocks.js +6 -6
- package/build-module/blocks/widget-area/edit/inner-blocks.js.map +1 -1
- package/build-module/blocks/widget-area/edit/use-is-dragging-within.js +6 -9
- package/build-module/blocks/widget-area/edit/use-is-dragging-within.js.map +1 -1
- package/build-module/blocks/widget-area/index.js +1 -1
- package/build-module/blocks/widget-area/index.js.map +1 -1
- package/build-module/components/error-boundary/index.js +0 -9
- package/build-module/components/error-boundary/index.js.map +1 -1
- package/build-module/components/header/index.js +9 -17
- 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/config.js.map +1 -1
- package/build-module/components/keyboard-shortcut-help-modal/dynamic-shortcut.js +1 -6
- package/build-module/components/keyboard-shortcut-help-modal/dynamic-shortcut.js.map +1 -1
- package/build-module/components/keyboard-shortcut-help-modal/index.js +5 -13
- package/build-module/components/keyboard-shortcut-help-modal/index.js.map +1 -1
- package/build-module/components/keyboard-shortcut-help-modal/shortcut.js +0 -5
- package/build-module/components/keyboard-shortcut-help-modal/shortcut.js.map +1 -1
- package/build-module/components/keyboard-shortcuts/index.js +1 -10
- package/build-module/components/keyboard-shortcuts/index.js.map +1 -1
- package/build-module/components/layout/index.js +2 -8
- package/build-module/components/layout/index.js.map +1 -1
- package/build-module/components/layout/interface.js +5 -9
- package/build-module/components/layout/interface.js.map +1 -1
- package/build-module/components/layout/unsaved-changes-warning.js +2 -3
- package/build-module/components/layout/unsaved-changes-warning.js.map +1 -1
- package/build-module/components/more-menu/index.js +2 -6
- package/build-module/components/more-menu/index.js.map +1 -1
- package/build-module/components/more-menu/tools-more-menu-group.js +0 -3
- package/build-module/components/more-menu/tools-more-menu-group.js.map +1 -1
- package/build-module/components/notices/index.js +0 -3
- package/build-module/components/notices/index.js.map +1 -1
- package/build-module/components/save-button/index.js +1 -4
- package/build-module/components/save-button/index.js.map +1 -1
- package/build-module/components/secondary-sidebar/index.js +1 -6
- package/build-module/components/secondary-sidebar/index.js.map +1 -1
- package/build-module/components/secondary-sidebar/inserter-sidebar.js +1 -2
- package/build-module/components/secondary-sidebar/inserter-sidebar.js.map +1 -1
- package/build-module/components/secondary-sidebar/list-view-sidebar.js +6 -7
- package/build-module/components/secondary-sidebar/list-view-sidebar.js.map +1 -1
- package/build-module/components/sidebar/index.js +13 -18
- package/build-module/components/sidebar/index.js.map +1 -1
- package/build-module/components/sidebar/widget-areas.js +1 -4
- package/build-module/components/sidebar/widget-areas.js.map +1 -1
- package/build-module/components/welcome-guide/index.js +3 -7
- package/build-module/components/welcome-guide/index.js.map +1 -1
- package/build-module/components/widget-areas-block-editor-content/index.js +1 -2
- package/build-module/components/widget-areas-block-editor-content/index.js.map +1 -1
- package/build-module/components/widget-areas-block-editor-provider/index.js +8 -7
- package/build-module/components/widget-areas-block-editor-provider/index.js.map +1 -1
- package/build-module/constants.js.map +1 -1
- package/build-module/filters/index.js.map +1 -1
- package/build-module/filters/move-to-widget-area.js +4 -4
- package/build-module/filters/move-to-widget-area.js.map +1 -1
- package/build-module/filters/replace-media-upload.js +0 -2
- package/build-module/filters/replace-media-upload.js.map +1 -1
- package/build-module/hooks/use-last-selected-widget-area.js +7 -9
- package/build-module/hooks/use-last-selected-widget-area.js.map +1 -1
- package/build-module/hooks/use-widget-library-insertion-point.js +6 -10
- package/build-module/hooks/use-widget-library-insertion-point.js.map +1 -1
- package/build-module/index.js +8 -20
- package/build-module/index.js.map +1 -1
- package/build-module/lock-unlock.js.map +1 -1
- package/build-module/store/actions.js +43 -56
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/constants.js.map +1 -1
- package/build-module/store/index.js +6 -6
- package/build-module/store/index.js.map +1 -1
- package/build-module/store/reducer.js +5 -11
- package/build-module/store/reducer.js.map +1 -1
- package/build-module/store/resolvers.js +3 -10
- package/build-module/store/resolvers.js.map +1 -1
- package/build-module/store/selectors.js +29 -38
- package/build-module/store/selectors.js.map +1 -1
- package/build-module/store/transformers.js +8 -13
- package/build-module/store/transformers.js.map +1 -1
- package/build-module/store/utils.js +7 -7
- package/build-module/store/utils.js.map +1 -1
- package/build-style/style-rtl.css +14 -8
- package/build-style/style.css +14 -8
- package/package.json +28 -27
- package/src/components/widget-areas-block-editor-provider/index.js +3 -3
- package/src/index.js +0 -1
- package/src/store/selectors.js +10 -2
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { createElement, Fragment } from "@wordpress/element";
|
|
2
|
-
|
|
3
2
|
/**
|
|
4
3
|
* WordPress dependencies
|
|
5
4
|
*/
|
|
@@ -8,14 +7,13 @@ import { ExternalLink, Guide } from '@wordpress/components';
|
|
|
8
7
|
import { __, sprintf, _n } from '@wordpress/i18n';
|
|
9
8
|
import { createInterpolateElement } from '@wordpress/element';
|
|
10
9
|
import { store as preferencesStore } from '@wordpress/preferences';
|
|
10
|
+
|
|
11
11
|
/**
|
|
12
12
|
* Internal dependencies
|
|
13
13
|
*/
|
|
14
|
-
|
|
15
14
|
import { store as editWidgetsStore } from '../../store';
|
|
16
15
|
export default function WelcomeGuide() {
|
|
17
16
|
var _widgetAreas$filter$l;
|
|
18
|
-
|
|
19
17
|
const isActive = useSelect(select => !!select(preferencesStore).get('core/edit-widgets', 'welcomeGuide'), []);
|
|
20
18
|
const {
|
|
21
19
|
toggle
|
|
@@ -23,11 +21,9 @@ export default function WelcomeGuide() {
|
|
|
23
21
|
const widgetAreas = useSelect(select => select(editWidgetsStore).getWidgetAreas({
|
|
24
22
|
per_page: -1
|
|
25
23
|
}), []);
|
|
26
|
-
|
|
27
24
|
if (!isActive) {
|
|
28
25
|
return null;
|
|
29
26
|
}
|
|
30
|
-
|
|
31
27
|
const isEntirelyBlockWidgets = widgetAreas?.every(widgetArea => widgetArea.id === 'wp_inactive_widgets' || widgetArea.widgets.every(widgetId => widgetId.startsWith('block-')));
|
|
32
28
|
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
29
|
return createElement(Guide, {
|
|
@@ -44,7 +40,8 @@ export default function WelcomeGuide() {
|
|
|
44
40
|
className: "edit-widgets-welcome-guide__heading"
|
|
45
41
|
}, __('Welcome to block Widgets')), isEntirelyBlockWidgets ? createElement(Fragment, null, createElement("p", {
|
|
46
42
|
className: "edit-widgets-welcome-guide__text"
|
|
47
|
-
}, sprintf(
|
|
43
|
+
}, sprintf(
|
|
44
|
+
// Translators: %s: Number of block areas in the current theme.
|
|
48
45
|
_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))) : createElement(Fragment, null, createElement("p", {
|
|
49
46
|
className: "edit-widgets-welcome-guide__text"
|
|
50
47
|
}, __('You can now add any block to your site’s widget areas. Don’t worry, all of your favorite widgets still work flawlessly.')), createElement("p", {
|
|
@@ -93,7 +90,6 @@ export default function WelcomeGuide() {
|
|
|
93
90
|
}]
|
|
94
91
|
});
|
|
95
92
|
}
|
|
96
|
-
|
|
97
93
|
function WelcomeGuideImage({
|
|
98
94
|
nonAnimatedSrc,
|
|
99
95
|
animatedSrc
|
|
@@ -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,CAF2B,EAG5B,EAH4B,CAA7B;;AAMA,MAAK,CAAEN,QAAP,EAAkB;AACjB,WAAO,IAAP;AACA;;AAED,QAAMO,sBAAsB,GAAGH,WAAW,EAAEI,KA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5B,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"]}
|
|
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,QAAQ,GAAGb,SAAS,CACvBc,MAAM,IACP,CAAC,CAAEA,MAAM,CAAEL,gBAAiB,CAAC,CAACM,GAAG,CAChC,mBAAmB,EACnB,cACD,CAAC,EACF,EACD,CAAC;EAED,MAAM;IAAEC;EAAO,CAAC,GAAGf,WAAW,CAAEQ,gBAAiB,CAAC;EAElD,MAAMQ,WAAW,GAAGjB,SAAS,CAC1Bc,MAAM,IACPA,MAAM,CAAEJ,gBAAiB,CAAC,CAACQ,cAAc,CAAE;IAAEC,QAAQ,EAAE,CAAC;EAAE,CAAE,CAAC,EAC9D,EACD,CAAC;EAED,IAAK,CAAEN,QAAQ,EAAG;IACjB,OAAO,IAAI;EACZ;EAEA,MAAMO,sBAAsB,GAAGH,WAAW,EAAEI,KAAK,CAC9CC,UAA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,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"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { createElement } from "@wordpress/element";
|
|
2
|
-
|
|
3
2
|
/**
|
|
4
3
|
* WordPress dependencies
|
|
5
4
|
*/
|
|
@@ -7,10 +6,10 @@ import { BlockList, BlockTools, BlockSelectionClearer, WritingFlow, ObserveTypin
|
|
|
7
6
|
import { useSelect } from '@wordpress/data';
|
|
8
7
|
import { useMemo } from '@wordpress/element';
|
|
9
8
|
import { store as preferencesStore } from '@wordpress/preferences';
|
|
9
|
+
|
|
10
10
|
/**
|
|
11
11
|
* Internal dependencies
|
|
12
12
|
*/
|
|
13
|
-
|
|
14
13
|
import Notices from '../notices';
|
|
15
14
|
import KeyboardShortcuts from '../keyboard-shortcuts';
|
|
16
15
|
export default function WidgetAreasBlockEditorContent({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"names":["BlockList","BlockTools","BlockSelectionClearer","WritingFlow","ObserveTyping","__unstableEditorStyles","EditorStyles","useSelect","useMemo","store","preferencesStore","Notices","KeyboardShortcuts","WidgetAreasBlockEditorContent","blockEditorSettings","hasThemeStyles","select","get","styles","createElement","className"],"sources":["@wordpress/edit-widgets/src/components/widget-areas-block-editor-content/index.js"],"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"],"mappings":";AAAA;AACA;AACA;AACA,SACCA,SAAS,EACTC,UAAU,EACVC,qBAAqB,EACrBC,WAAW,EACXC,aAAa,EACbC,sBAAsB,IAAIC,YAAY,QAChC,yBAAyB;AAChC,SAASC,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,OAAO,QAAQ,oBAAoB;AAC5C,SAASC,KAAK,IAAIC,gBAAgB,QAAQ,wBAAwB;;AAElE;AACA;AACA;AACA,OAAOC,OAAO,MAAM,YAAY;AAChC,OAAOC,iBAAiB,MAAM,uBAAuB;AAErD,eAAe,SAASC,6BAA6BA,CAAE;EACtDC;AACD,CAAC,EAAG;EACH,MAAMC,cAAc,GAAGR,SAAS,CAC7BS,MAAM,IACP,CAAC,CAAEA,MAAM,CAAEN,gBAAiB,CAAC,CAACO,GAAG,CAChC,mBAAmB,EACnB,aACD,CAAC,EACF,EACD,CAAC;EAED,MAAMC,MAAM,GAAGV,OAAO,CAAE,MAAM;IAC7B,OAAOO,cAAc,GAAGD,mBAAmB,CAACI,MAAM,GAAG,EAAE;EACxD,CAAC,EAAE,CAAEJ,mBAAmB,EAAEC,cAAc,CAAG,CAAC;EAE5C,OACCI,aAAA;IAAKC,SAAS,EAAC;EAA2B,GACzCD,aAAA,CAACR,OAAO,MAAE,CAAC,EACXQ,aAAA,CAAClB,UAAU,QACVkB,aAAA,CAACP,iBAAiB,MAAE,CAAC,EACrBO,aAAA,CAACb,YAAY;IAACY,MAAM,EAAGA;EAAQ,CAAE,CAAC,EAClCC,aAAA,CAACjB,qBAAqB,QACrBiB,aAAA,CAAChB,WAAW,QACXgB,aAAA,CAACf,aAAa,QACbe,aAAA,CAACnB,SAAS;IAACoB,SAAS,EAAC;EAA8B,CAAE,CACvC,CACH,CACS,CACZ,CACR,CAAC;AAER"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { createElement } from "@wordpress/element";
|
|
2
|
-
|
|
3
2
|
/**
|
|
4
3
|
* WordPress dependencies
|
|
5
4
|
*/
|
|
@@ -9,13 +8,13 @@ import { useDispatch, useSelect } from '@wordpress/data';
|
|
|
9
8
|
import { useEntityBlockEditor, store as coreStore, useResourcePermissions } from '@wordpress/core-data';
|
|
10
9
|
import { useMemo } from '@wordpress/element';
|
|
11
10
|
import { BlockEditorKeyboardShortcuts, CopyHandler, privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';
|
|
12
|
-
import {
|
|
11
|
+
import { privateApis as editPatternsPrivateApis } from '@wordpress/patterns';
|
|
13
12
|
import { ShortcutProvider } from '@wordpress/keyboard-shortcuts';
|
|
14
13
|
import { store as preferencesStore } from '@wordpress/preferences';
|
|
14
|
+
|
|
15
15
|
/**
|
|
16
16
|
* Internal dependencies
|
|
17
17
|
*/
|
|
18
|
-
|
|
19
18
|
import KeyboardShortcuts from '../keyboard-shortcuts';
|
|
20
19
|
import { buildWidgetAreasPostId, KIND, POST_TYPE } from '../../store/utils';
|
|
21
20
|
import useLastSelectedWidgetArea from '../../hooks/use-last-selected-widget-area';
|
|
@@ -25,6 +24,9 @@ import { unlock } from '../../lock-unlock';
|
|
|
25
24
|
const {
|
|
26
25
|
ExperimentalBlockEditorProvider
|
|
27
26
|
} = unlock(blockEditorPrivateApis);
|
|
27
|
+
const {
|
|
28
|
+
PatternsMenuItems
|
|
29
|
+
} = unlock(editPatternsPrivateApis);
|
|
28
30
|
export default function WidgetAreasBlockEditorProvider({
|
|
29
31
|
blockEditorSettings,
|
|
30
32
|
children,
|
|
@@ -47,7 +49,6 @@ export default function WidgetAreasBlockEditorProvider({
|
|
|
47
49
|
} = useDispatch(editWidgetsStore);
|
|
48
50
|
const settings = useMemo(() => {
|
|
49
51
|
let mediaUploadBlockEditor;
|
|
50
|
-
|
|
51
52
|
if (mediaPermissions.canCreate) {
|
|
52
53
|
mediaUploadBlockEditor = ({
|
|
53
54
|
onError,
|
|
@@ -62,8 +63,8 @@ export default function WidgetAreasBlockEditorProvider({
|
|
|
62
63
|
});
|
|
63
64
|
};
|
|
64
65
|
}
|
|
65
|
-
|
|
66
|
-
|
|
66
|
+
return {
|
|
67
|
+
...blockEditorSettings,
|
|
67
68
|
__experimentalReusableBlocks: reusableBlocks,
|
|
68
69
|
hasFixedToolbar: isFixedToolbarActive,
|
|
69
70
|
keepCaretInsideBlock,
|
|
@@ -83,7 +84,7 @@ export default function WidgetAreasBlockEditorProvider({
|
|
|
83
84
|
settings: settings,
|
|
84
85
|
useSubRegistry: false,
|
|
85
86
|
...props
|
|
86
|
-
}, createElement(CopyHandler, null, children), createElement(
|
|
87
|
+
}, createElement(CopyHandler, null, children), createElement(PatternsMenuItems, {
|
|
87
88
|
rootClientId: widgetAreaId
|
|
88
89
|
}))));
|
|
89
90
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"names":["SlotFillProvider","uploadMedia","useDispatch","useSelect","useEntityBlockEditor","store","coreStore","useResourcePermissions","useMemo","BlockEditorKeyboardShortcuts","CopyHandler","privateApis","blockEditorPrivateApis","editPatternsPrivateApis","ShortcutProvider","preferencesStore","KeyboardShortcuts","buildWidgetAreasPostId","KIND","POST_TYPE","useLastSelectedWidgetArea","editWidgetsStore","ALLOW_REUSABLE_BLOCKS","unlock","ExperimentalBlockEditorProvider","PatternsMenuItems","WidgetAreasBlockEditorProvider","blockEditorSettings","children","props","mediaPermissions","reusableBlocks","isFixedToolbarActive","keepCaretInsideBlock","select","widgetAreas","getWidgetAreas","widgets","getWidgets","getEntityRecords","get","setIsInserterOpened","settings","mediaUploadBlockEditor","canCreate","onError","argumentsObject","wpAllowedMimeTypes","allowedMimeTypes","message","__experimentalReusableBlocks","hasFixedToolbar","mediaUpload","templateLock","__experimentalSetIsInserterOpened","widgetAreaId","blocks","onInput","onChange","id","createElement","Register","value","useSubRegistry","rootClientId"],"sources":["@wordpress/edit-widgets/src/components/widget-areas-block-editor-provider/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { SlotFillProvider } from '@wordpress/components';\nimport { uploadMedia } from '@wordpress/media-utils';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport {\n\tuseEntityBlockEditor,\n\tstore as coreStore,\n\tuseResourcePermissions,\n} from '@wordpress/core-data';\nimport { useMemo } from '@wordpress/element';\nimport {\n\tBlockEditorKeyboardShortcuts,\n\tCopyHandler,\n\tprivateApis as blockEditorPrivateApis,\n} from '@wordpress/block-editor';\nimport { privateApis as editPatternsPrivateApis } from '@wordpress/patterns';\nimport { ShortcutProvider } from '@wordpress/keyboard-shortcuts';\nimport { store as preferencesStore } from '@wordpress/preferences';\n\n/**\n * Internal dependencies\n */\nimport KeyboardShortcuts from '../keyboard-shortcuts';\nimport { buildWidgetAreasPostId, KIND, POST_TYPE } from '../../store/utils';\nimport useLastSelectedWidgetArea from '../../hooks/use-last-selected-widget-area';\nimport { store as editWidgetsStore } from '../../store';\nimport { ALLOW_REUSABLE_BLOCKS } from '../../constants';\nimport { unlock } from '../../lock-unlock';\n\nconst { ExperimentalBlockEditorProvider } = unlock( blockEditorPrivateApis );\nconst { PatternsMenuItems } = unlock( editPatternsPrivateApis );\nexport default function WidgetAreasBlockEditorProvider( {\n\tblockEditorSettings,\n\tchildren,\n\t...props\n} ) {\n\tconst mediaPermissions = useResourcePermissions( 'media' );\n\tconst { reusableBlocks, isFixedToolbarActive, keepCaretInsideBlock } =\n\t\tuseSelect(\n\t\t\t( select ) => ( {\n\t\t\t\twidgetAreas: select( editWidgetsStore ).getWidgetAreas(),\n\t\t\t\twidgets: select( editWidgetsStore ).getWidgets(),\n\t\t\t\treusableBlocks: ALLOW_REUSABLE_BLOCKS\n\t\t\t\t\t? select( coreStore ).getEntityRecords(\n\t\t\t\t\t\t\t'postType',\n\t\t\t\t\t\t\t'wp_block'\n\t\t\t\t\t )\n\t\t\t\t\t: [],\n\t\t\t\tisFixedToolbarActive: !! select( preferencesStore ).get(\n\t\t\t\t\t'core/edit-widgets',\n\t\t\t\t\t'fixedToolbar'\n\t\t\t\t),\n\t\t\t\tkeepCaretInsideBlock: !! select( preferencesStore ).get(\n\t\t\t\t\t'core/edit-widgets',\n\t\t\t\t\t'keepCaretInsideBlock'\n\t\t\t\t),\n\t\t\t} ),\n\t\t\t[]\n\t\t);\n\tconst { setIsInserterOpened } = useDispatch( editWidgetsStore );\n\n\tconst settings = useMemo( () => {\n\t\tlet mediaUploadBlockEditor;\n\t\tif ( mediaPermissions.canCreate ) {\n\t\t\tmediaUploadBlockEditor = ( { onError, ...argumentsObject } ) => {\n\t\t\t\tuploadMedia( {\n\t\t\t\t\twpAllowedMimeTypes: blockEditorSettings.allowedMimeTypes,\n\t\t\t\t\tonError: ( { message } ) => onError( message ),\n\t\t\t\t\t...argumentsObject,\n\t\t\t\t} );\n\t\t\t};\n\t\t}\n\t\treturn {\n\t\t\t...blockEditorSettings,\n\t\t\t__experimentalReusableBlocks: reusableBlocks,\n\t\t\thasFixedToolbar: isFixedToolbarActive,\n\t\t\tkeepCaretInsideBlock,\n\t\t\tmediaUpload: mediaUploadBlockEditor,\n\t\t\ttemplateLock: 'all',\n\t\t\t__experimentalSetIsInserterOpened: setIsInserterOpened,\n\t\t};\n\t}, [\n\t\tblockEditorSettings,\n\t\tisFixedToolbarActive,\n\t\tkeepCaretInsideBlock,\n\t\tmediaPermissions.canCreate,\n\t\treusableBlocks,\n\t\tsetIsInserterOpened,\n\t] );\n\n\tconst widgetAreaId = useLastSelectedWidgetArea();\n\n\tconst [ blocks, onInput, onChange ] = useEntityBlockEditor(\n\t\tKIND,\n\t\tPOST_TYPE,\n\t\t{ id: buildWidgetAreasPostId() }\n\t);\n\n\treturn (\n\t\t<ShortcutProvider>\n\t\t\t<BlockEditorKeyboardShortcuts.Register />\n\t\t\t<KeyboardShortcuts.Register />\n\t\t\t<SlotFillProvider>\n\t\t\t\t<ExperimentalBlockEditorProvider\n\t\t\t\t\tvalue={ blocks }\n\t\t\t\t\tonInput={ onInput }\n\t\t\t\t\tonChange={ onChange }\n\t\t\t\t\tsettings={ settings }\n\t\t\t\t\tuseSubRegistry={ false }\n\t\t\t\t\t{ ...props }\n\t\t\t\t>\n\t\t\t\t\t<CopyHandler>{ children }</CopyHandler>\n\t\t\t\t\t<PatternsMenuItems rootClientId={ widgetAreaId } />\n\t\t\t\t</ExperimentalBlockEditorProvider>\n\t\t\t</SlotFillProvider>\n\t\t</ShortcutProvider>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,gBAAgB,QAAQ,uBAAuB;AACxD,S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tD,oBAAoB,CACzDc,IAAI,EACJC,SAAS,EACT;IAAEwC,EAAE,EAAE1C,sBAAsB,CAAC;EAAE,CAChC,CAAC;EAED,OACC2C,aAAA,CAAC9C,gBAAgB,QAChB8C,aAAA,CAACnD,4BAA4B,CAACoD,QAAQ,MAAE,CAAC,EACzCD,aAAA,CAAC5C,iBAAiB,CAAC6C,QAAQ,MAAE,CAAC,EAC9BD,aAAA,CAAC5D,gBAAgB,QAChB4D,aAAA,CAACpC,+BAA+B;IAC/BsC,KAAK,EAAGN,MAAQ;IAChBC,OAAO,EAAGA,OAAS;IACnBC,QAAQ,EAAGA,QAAU;IACrBhB,QAAQ,EAAGA,QAAU;IACrBqB,cAAc,EAAG,KAAO;IAAA,GACnBlC;EAAK,GAEV+B,aAAA,CAAClD,WAAW,QAAGkB,QAAuB,CAAC,EACvCgC,aAAA,CAACnC,iBAAiB;IAACuC,YAAY,EAAGT;EAAc,CAAE,CAClB,CAChB,CACD,CAAC;AAErB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-widgets/src/constants.js"],"
|
|
1
|
+
{"version":3,"names":["ALLOW_REUSABLE_BLOCKS","ENABLE_EXPERIMENTAL_FSE_BLOCKS"],"sources":["@wordpress/edit-widgets/src/constants.js"],"sourcesContent":["export const ALLOW_REUSABLE_BLOCKS = false;\nexport const ENABLE_EXPERIMENTAL_FSE_BLOCKS = false;\n"],"mappings":"AAAA,OAAO,MAAMA,qBAAqB,GAAG,KAAK;AAC1C,OAAO,MAAMC,8BAA8B,GAAG,KAAK"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-widgets/src/filters/index.js"],"
|
|
1
|
+
{"version":3,"names":[],"sources":["@wordpress/edit-widgets/src/filters/index.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport './move-to-widget-area';\nimport './replace-media-upload';\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAO,uBAAuB;AAC9B,OAAO,wBAAwB"}
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import { createElement, Fragment } from "@wordpress/element";
|
|
2
|
-
|
|
3
2
|
/**
|
|
4
3
|
* WordPress dependencies
|
|
5
4
|
*/
|
|
5
|
+
|
|
6
6
|
import { BlockControls } from '@wordpress/block-editor';
|
|
7
7
|
import { createHigherOrderComponent } from '@wordpress/compose';
|
|
8
8
|
import { useDispatch, useSelect } from '@wordpress/data';
|
|
9
9
|
import { addFilter } from '@wordpress/hooks';
|
|
10
10
|
import { MoveToWidgetArea } from '@wordpress/widgets';
|
|
11
|
+
|
|
11
12
|
/**
|
|
12
13
|
* Internal dependencies
|
|
13
14
|
*/
|
|
14
|
-
|
|
15
15
|
import { store as editWidgetsStore } from '../store';
|
|
16
16
|
const withMoveToWidgetAreaToolbarItem = createHigherOrderComponent(BlockEdit => props => {
|
|
17
17
|
const {
|
|
@@ -27,7 +27,6 @@ const withMoveToWidgetAreaToolbarItem = createHigherOrderComponent(BlockEdit =>
|
|
|
27
27
|
if (blockName === 'core/widget-area') {
|
|
28
28
|
return {};
|
|
29
29
|
}
|
|
30
|
-
|
|
31
30
|
const selectors = select(editWidgetsStore);
|
|
32
31
|
const widgetAreaBlock = selectors.getParentWidgetAreaBlock(clientId);
|
|
33
32
|
return {
|
|
@@ -41,7 +40,8 @@ const withMoveToWidgetAreaToolbarItem = createHigherOrderComponent(BlockEdit =>
|
|
|
41
40
|
} = useDispatch(editWidgetsStore);
|
|
42
41
|
const hasMultipleWidgetAreas = widgetAreas?.length > 1;
|
|
43
42
|
const isMoveToWidgetAreaVisible = blockName !== 'core/widget-area' && hasMultipleWidgetAreas && canInsertBlockInWidgetArea;
|
|
44
|
-
return createElement(Fragment, null, createElement(BlockEdit, {
|
|
43
|
+
return createElement(Fragment, null, createElement(BlockEdit, {
|
|
44
|
+
...props
|
|
45
45
|
}), isMoveToWidgetAreaVisible && createElement(BlockControls, null, createElement(MoveToWidgetArea, {
|
|
46
46
|
widgetAreas: widgetAreas,
|
|
47
47
|
currentWidgetAreaId: currentWidgetAreaId,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"names":["BlockControls","createHigherOrderComponent","useDispatch","useSelect","addFilter","MoveToWidgetArea","store","editWidgetsStore","withMoveToWidgetAreaToolbarItem","BlockEdit","props","clientId","name","blockName","widgetAreas","currentWidgetAreaId","canInsertBlockInWidgetArea","select","selectors","widgetAreaBlock","getParentWidgetAreaBlock","getWidgetAreas","attributes","id","moveBlockToWidgetArea","hasMultipleWidgetAreas","length","isMoveToWidgetAreaVisible","createElement","Fragment","onSelect","widgetAreaId"],"sources":["@wordpress/edit-widgets/src/filters/move-to-widget-area.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\n\nimport { BlockControls } from '@wordpress/block-editor';\nimport { createHigherOrderComponent } from '@wordpress/compose';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { addFilter } from '@wordpress/hooks';\nimport { MoveToWidgetArea } from '@wordpress/widgets';\n\n/**\n * Internal dependencies\n */\nimport { store as editWidgetsStore } from '../store';\n\nconst withMoveToWidgetAreaToolbarItem = createHigherOrderComponent(\n\t( BlockEdit ) => ( props ) => {\n\t\tconst { clientId, name: blockName } = props;\n\t\tconst { widgetAreas, currentWidgetAreaId, canInsertBlockInWidgetArea } =\n\t\t\tuseSelect(\n\t\t\t\t( select ) => {\n\t\t\t\t\t// Component won't display for a widget area, so don't run selectors.\n\t\t\t\t\tif ( blockName === 'core/widget-area' ) {\n\t\t\t\t\t\treturn {};\n\t\t\t\t\t}\n\n\t\t\t\t\tconst selectors = select( editWidgetsStore );\n\n\t\t\t\t\tconst widgetAreaBlock =\n\t\t\t\t\t\tselectors.getParentWidgetAreaBlock( clientId );\n\n\t\t\t\t\treturn {\n\t\t\t\t\t\twidgetAreas: selectors.getWidgetAreas(),\n\t\t\t\t\t\tcurrentWidgetAreaId: widgetAreaBlock?.attributes?.id,\n\t\t\t\t\t\tcanInsertBlockInWidgetArea:\n\t\t\t\t\t\t\tselectors.canInsertBlockInWidgetArea( blockName ),\n\t\t\t\t\t};\n\t\t\t\t},\n\t\t\t\t[ clientId, blockName ]\n\t\t\t);\n\n\t\tconst { moveBlockToWidgetArea } = useDispatch( editWidgetsStore );\n\t\tconst hasMultipleWidgetAreas = widgetAreas?.length > 1;\n\t\tconst isMoveToWidgetAreaVisible =\n\t\t\tblockName !== 'core/widget-area' &&\n\t\t\thasMultipleWidgetAreas &&\n\t\t\tcanInsertBlockInWidgetArea;\n\n\t\treturn (\n\t\t\t<>\n\t\t\t\t<BlockEdit { ...props } />\n\t\t\t\t{ isMoveToWidgetAreaVisible && (\n\t\t\t\t\t<BlockControls>\n\t\t\t\t\t\t<MoveToWidgetArea\n\t\t\t\t\t\t\twidgetAreas={ widgetAreas }\n\t\t\t\t\t\t\tcurrentWidgetAreaId={ currentWidgetAreaId }\n\t\t\t\t\t\t\tonSelect={ ( widgetAreaId ) => {\n\t\t\t\t\t\t\t\tmoveBlockToWidgetArea(\n\t\t\t\t\t\t\t\t\tprops.clientId,\n\t\t\t\t\t\t\t\t\twidgetAreaId\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</BlockControls>\n\t\t\t\t) }\n\t\t\t</>\n\t\t);\n\t},\n\t'withMoveToWidgetAreaToolbarItem'\n);\n\naddFilter(\n\t'editor.BlockEdit',\n\t'core/edit-widgets/block-edit',\n\twithMoveToWidgetAreaToolbarItem\n);\n"],"mappings":";AAAA;AACA;AACA;;AAEA,SAASA,aAAa,QAAQ,yBAAyB;AACvD,SAASC,0BAA0B,QAAQ,oBAAoB;AAC/D,SAASC,WAAW,EAAEC,SAAS,QAAQ,iBAAiB;AACxD,SAASC,SAAS,QAAQ,kBAAkB;AAC5C,SAASC,gBAAgB,QAAQ,oBAAoB;;AAErD;AACA;AACA;AACA,SAASC,KAAK,IAAIC,gBAAgB,QAAQ,UAAU;AAEpD,MAAM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EL,CAAC,EACD,iCACD,CAAC;AAED3B,SAAS,CACR,kBAAkB,EAClB,8BAA8B,EAC9BI,+BACD,CAAC"}
|
|
@@ -3,8 +3,6 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import { addFilter } from '@wordpress/hooks';
|
|
5
5
|
import { MediaUpload } from '@wordpress/media-utils';
|
|
6
|
-
|
|
7
6
|
const replaceMediaUpload = () => MediaUpload;
|
|
8
|
-
|
|
9
7
|
addFilter('editor.MediaUpload', 'core/edit-widgets/replace-media-upload', replaceMediaUpload);
|
|
10
8
|
//# sourceMappingURL=replace-media-upload.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-widgets/src/filters/replace-media-upload.js"],"
|
|
1
|
+
{"version":3,"names":["addFilter","MediaUpload","replaceMediaUpload"],"sources":["@wordpress/edit-widgets/src/filters/replace-media-upload.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { addFilter } from '@wordpress/hooks';\nimport { MediaUpload } from '@wordpress/media-utils';\n\nconst replaceMediaUpload = () => MediaUpload;\n\naddFilter(\n\t'editor.MediaUpload',\n\t'core/edit-widgets/replace-media-upload',\n\treplaceMediaUpload\n);\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,SAAS,QAAQ,kBAAkB;AAC5C,SAASC,WAAW,QAAQ,wBAAwB;AAEpD,MAAMC,kBAAkB,GAAGA,CAAA,KAAMD,WAAW;AAE5CD,SAAS,CACR,oBAAoB,EACpB,wCAAwC,EACxCE,kBACD,CAAC"}
|
|
@@ -4,48 +4,46 @@
|
|
|
4
4
|
import { useSelect } from '@wordpress/data';
|
|
5
5
|
import { store as blockEditorStore } from '@wordpress/block-editor';
|
|
6
6
|
import { store as coreStore } from '@wordpress/core-data';
|
|
7
|
+
|
|
7
8
|
/**
|
|
8
9
|
* Internal dependencies
|
|
9
10
|
*/
|
|
10
|
-
|
|
11
11
|
import { store as widgetsEditorStore } from '../store';
|
|
12
12
|
import { buildWidgetAreasPostId, KIND, POST_TYPE } from '../store/utils';
|
|
13
|
+
|
|
13
14
|
/**
|
|
14
15
|
* A react hook that returns the client id of the last widget area to have
|
|
15
16
|
* been selected, or to have a selected block within it.
|
|
16
17
|
*
|
|
17
18
|
* @return {string} clientId of the widget area last selected.
|
|
18
19
|
*/
|
|
19
|
-
|
|
20
20
|
const useLastSelectedWidgetArea = () => useSelect(select => {
|
|
21
21
|
const {
|
|
22
22
|
getBlockSelectionEnd,
|
|
23
23
|
getBlockName
|
|
24
24
|
} = select(blockEditorStore);
|
|
25
|
-
const selectionEndClientId = getBlockSelectionEnd();
|
|
25
|
+
const selectionEndClientId = getBlockSelectionEnd();
|
|
26
26
|
|
|
27
|
+
// If the selected block is a widget area, return its clientId.
|
|
27
28
|
if (getBlockName(selectionEndClientId) === 'core/widget-area') {
|
|
28
29
|
return selectionEndClientId;
|
|
29
30
|
}
|
|
30
|
-
|
|
31
31
|
const {
|
|
32
32
|
getParentWidgetAreaBlock
|
|
33
33
|
} = select(widgetsEditorStore);
|
|
34
34
|
const widgetAreaBlock = getParentWidgetAreaBlock(selectionEndClientId);
|
|
35
35
|
const widgetAreaBlockClientId = widgetAreaBlock?.clientId;
|
|
36
|
-
|
|
37
36
|
if (widgetAreaBlockClientId) {
|
|
38
37
|
return widgetAreaBlockClientId;
|
|
39
|
-
}
|
|
40
|
-
// area.
|
|
41
|
-
|
|
38
|
+
}
|
|
42
39
|
|
|
40
|
+
// If no widget area has been selected, return the clientId of the first
|
|
41
|
+
// area.
|
|
43
42
|
const {
|
|
44
43
|
getEntityRecord
|
|
45
44
|
} = select(coreStore);
|
|
46
45
|
const widgetAreasPost = getEntityRecord(KIND, POST_TYPE, buildWidgetAreasPostId());
|
|
47
46
|
return widgetAreasPost?.blocks[0]?.clientId;
|
|
48
47
|
}, []);
|
|
49
|
-
|
|
50
48
|
export default useLastSelectedWidgetArea;
|
|
51
49
|
//# sourceMappingURL=use-last-selected-widget-area.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"names":["useSelect","store","blockEditorStore","coreStore","widgetsEditorStore","buildWidgetAreasPostId","KIND","POST_TYPE","useLastSelectedWidgetArea","select","getBlockSelectionEnd","getBlockName","selectionEndClientId","getParentWidgetAreaBlock","widgetAreaBlock","widgetAreaBlockClientId","clientId","getEntityRecord","widgetAreasPost","blocks"],"sources":["@wordpress/edit-widgets/src/hooks/use-last-selected-widget-area.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { store as widgetsEditorStore } from '../store';\nimport { buildWidgetAreasPostId, KIND, POST_TYPE } from '../store/utils';\n\n/**\n * A react hook that returns the client id of the last widget area to have\n * been selected, or to have a selected block within it.\n *\n * @return {string} clientId of the widget area last selected.\n */\nconst useLastSelectedWidgetArea = () =>\n\tuseSelect( ( select ) => {\n\t\tconst { getBlockSelectionEnd, getBlockName } =\n\t\t\tselect( blockEditorStore );\n\t\tconst selectionEndClientId = getBlockSelectionEnd();\n\n\t\t// If the selected block is a widget area, return its clientId.\n\t\tif ( getBlockName( selectionEndClientId ) === 'core/widget-area' ) {\n\t\t\treturn selectionEndClientId;\n\t\t}\n\n\t\tconst { getParentWidgetAreaBlock } = select( widgetsEditorStore );\n\t\tconst widgetAreaBlock =\n\t\t\tgetParentWidgetAreaBlock( selectionEndClientId );\n\t\tconst widgetAreaBlockClientId = widgetAreaBlock?.clientId;\n\n\t\tif ( widgetAreaBlockClientId ) {\n\t\t\treturn widgetAreaBlockClientId;\n\t\t}\n\n\t\t// If no widget area has been selected, return the clientId of the first\n\t\t// area.\n\t\tconst { getEntityRecord } = select( coreStore );\n\t\tconst widgetAreasPost = getEntityRecord(\n\t\t\tKIND,\n\t\t\tPOST_TYPE,\n\t\t\tbuildWidgetAreasPostId()\n\t\t);\n\t\treturn widgetA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{ useSelect } from '@wordpress/data';
|
|
5
5
|
import { store as blockEditorStore } from '@wordpress/block-editor';
|
|
6
6
|
import { store as coreStore } from '@wordpress/core-data';
|
|
7
|
+
|
|
7
8
|
/**
|
|
8
9
|
* Internal dependencies
|
|
9
10
|
*/
|
|
10
|
-
|
|
11
11
|
import { store as editWidgetsStore } from '../store';
|
|
12
12
|
import { buildWidgetAreasPostId, KIND, POST_TYPE } from '../store/utils';
|
|
13
|
-
|
|
14
13
|
const useWidgetLibraryInsertionPoint = () => {
|
|
15
14
|
const firstRootId = useSelect(select => {
|
|
16
15
|
// Default to the first widget area
|
|
@@ -27,33 +26,30 @@ const useWidgetLibraryInsertionPoint = () => {
|
|
|
27
26
|
getBlockOrder,
|
|
28
27
|
getBlockIndex
|
|
29
28
|
} = select(blockEditorStore);
|
|
29
|
+
const insertionPoint = select(editWidgetsStore).__experimentalGetInsertionPoint();
|
|
30
30
|
|
|
31
|
-
|
|
31
|
+
// "Browse all" in the quick inserter will set the rootClientId to the current block.
|
|
32
32
|
// Otherwise, it will just be undefined, and we'll have to handle it differently below.
|
|
33
|
-
|
|
34
|
-
|
|
35
33
|
if (insertionPoint.rootClientId) {
|
|
36
34
|
return insertionPoint;
|
|
37
35
|
}
|
|
38
|
-
|
|
39
36
|
const clientId = getBlockSelectionEnd() || firstRootId;
|
|
40
|
-
const rootClientId = getBlockRootClientId(clientId);
|
|
37
|
+
const rootClientId = getBlockRootClientId(clientId);
|
|
38
|
+
|
|
39
|
+
// If the selected block is at the root level, it's a widget area and
|
|
41
40
|
// blocks can't be inserted here. Return this block as the root and the
|
|
42
41
|
// last child clientId indicating insertion at the end.
|
|
43
|
-
|
|
44
42
|
if (clientId && rootClientId === '') {
|
|
45
43
|
return {
|
|
46
44
|
rootClientId: clientId,
|
|
47
45
|
insertionIndex: getBlockOrder(clientId).length
|
|
48
46
|
};
|
|
49
47
|
}
|
|
50
|
-
|
|
51
48
|
return {
|
|
52
49
|
rootClientId,
|
|
53
50
|
insertionIndex: getBlockIndex(clientId) + 1
|
|
54
51
|
};
|
|
55
52
|
}, [firstRootId]);
|
|
56
53
|
};
|
|
57
|
-
|
|
58
54
|
export default useWidgetLibraryInsertionPoint;
|
|
59
55
|
//# sourceMappingURL=use-widget-library-insertion-point.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"names":["useSelect","store","blockEditorStore","coreStore","editWidgetsStore","buildWidgetAreasPostId","KIND","POST_TYPE","useWidgetLibraryInsertionPoint","firstRootId","select","getEntityRecord","widgetAreasPost","blocks","clientId","getBlockRootClientId","getBlockSelectionEnd","getBlockOrder","getBlockIndex","insertionPoint","__experimentalGetInsertionPoint","rootClientId","insertionIndex","length"],"sources":["@wordpress/edit-widgets/src/hooks/use-widget-library-insertion-point.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { store as editWidgetsStore } from '../store';\nimport { buildWidgetAreasPostId, KIND, POST_TYPE } from '../store/utils';\n\nconst useWidgetLibraryInsertionPoint = () => {\n\tconst firstRootId = useSelect( ( select ) => {\n\t\t// Default to the first widget area\n\t\tconst { getEntityRecord } = select( coreStore );\n\t\tconst widgetAreasPost = getEntityRecord(\n\t\t\tKIND,\n\t\t\tPOST_TYPE,\n\t\t\tbuildWidgetAreasPostId()\n\t\t);\n\t\treturn widgetAreasPost?.blocks[ 0 ]?.clientId;\n\t}, [] );\n\n\treturn useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetBlockRootClientId,\n\t\t\t\tgetBlockSelectionEnd,\n\t\t\t\tgetBlockOrder,\n\t\t\t\tgetBlockIndex,\n\t\t\t} = select( blockEditorStore );\n\n\t\t\tconst insertionPoint =\n\t\t\t\tselect( editWidgetsStore ).__experimentalGetInsertionPoint();\n\n\t\t\t// \"Browse all\" in the quick inserter will set the rootClientId to the current block.\n\t\t\t// Otherwise, it will just be undefined, and we'll have to handle it differently below.\n\t\t\tif ( insertionPoint.rootClientId ) {\n\t\t\t\treturn insertionPoint;\n\t\t\t}\n\n\t\t\tconst clientId = getBlockSelectionEnd() || firstRootId;\n\t\t\tconst rootClientId = getBlockRootClientId( clientId );\n\n\t\t\t// If the selected block is at the root level, it's a widget area and\n\t\t\t// blocks can't be inserted here. Return this block as the root and the\n\t\t\t// last child clientId indicating insertion at the end.\n\t\t\tif ( clientId && rootClientId === '' ) {\n\t\t\t\treturn {\n\t\t\t\t\trootClientId: clientId,\n\t\t\t\t\tinsertionIndex: getBlockOrder( clientId ).length,\n\t\t\t\t};\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\trootClientId,\n\t\t\t\tinsertionIndex: getBlockIndex( clientId ) + 1,\n\t\t\t};\n\t\t},\n\t\t[ firstRootId ]\n\t);\n};\n\nexport default useWidgetLibraryInsertionPoint;\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,KAAK,IAAIC,gBAAgB,QAAQ,yBAAyB;AACnE,SAASD,KAAK,IAAIE,SAAS,QAAQ,sBAAsB;;AAEzD;AACA;AACA;AACA,SAASF,KAAK,IAAIG,gBAAgB,QAAQ,UAAU;AACpD,SAASC,sBAAsB,EAAEC,IAAI,EAAEC,SAAS,QAAQ,gBAAgB;AAExE,MAAMC,8BAA8B,GAAGA,CAAA,KAAM;EAC5C,MAAMC,WAAW,GAAGT,SAAS,CAAIU,MAAM,IAAM;IAC5C;IACA,MAAM;MAAEC;IAAgB,CAAC,GAAGD,MAAM,CAAEP,SAAU,CAAC;IAC/C,MAAMS,eAAe,GAAGD,eAAe,CACtCL,IAAI,EACJC,SAAS,EACTF,sBAAsB,CAAC,CACxB,CAAC;IACD,OAAOO,eAAe,EAAEC,MAAM,CAAE,CAAC,CAAE,EAAEC,QAAQ;EAC9C,CAAC,EAAE,EAAG,CAAC;EAEP,OAAOd,SAAS,CACbU,MAAM,IAAM;IACb,MAAM;MACLK,oBAAoB;MACpBC,oBAAoB;MACpBC,aAAa;MACbC;IACD,CAAC,GAAGR,MAAM,CAAER,gBAAiB,CAAC;IAE9B,MAAMiB,cAAc,GACnBT,MAAM,CAAEN,gBAAiB,CAAC,CAACgB,+BAA+B,CAAC,CAAC;;IAE7D;IACA;IACA,IAAKD,cAAc,CAACE,YAAY,EAAG;MAClC,OAAOF,cAAc;IACtB;IAEA,MAAML,QAAQ,GAAGE,oBAAoB,CAAC,CAAC,IAAIP,WAAW;IACtD,MAAMY,YAAY,GAAGN,oBAAoB,CAAED,QAAS,CAAC;;IAErD;IACA;IACA;IACA,IAAKA,QAAQ,IAAIO,YAAY,KAAK,EAAE,EAAG;MACtC,OAAO;QACNA,YAAY,EAAEP,QAAQ;QACtBQ,cAAc,EAAEL,aAAa,CAAEH,QAAS,CAAC,CAACS;MAC3C,CAAC;IACF;IAEA,OAAO;MACNF,YAAY;MACZC,cAAc,EAAEJ,aAAa,CAAEJ,QAAS,CAAC,GAAG;IAC7C,CAAC;EACF,CAAC,EACD,CAAEL,WAAW,CACd,CAAC;AACF,CAAC;AAED,eAAeD,8BAA8B"}
|
package/build-module/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { createElement } from "@wordpress/element";
|
|
2
|
-
|
|
3
2
|
/**
|
|
4
3
|
* WordPress dependencies
|
|
5
4
|
*/
|
|
6
|
-
import { registerBlockType, unstable__bootstrapServerSideBlockDefinitions,
|
|
5
|
+
import { registerBlockType, unstable__bootstrapServerSideBlockDefinitions,
|
|
6
|
+
// eslint-disable-line camelcase
|
|
7
7
|
setFreeformContentHandlerName, store as blocksStore } from '@wordpress/blocks';
|
|
8
8
|
import { dispatch } from '@wordpress/data';
|
|
9
9
|
import deprecated from '@wordpress/deprecated';
|
|
@@ -12,69 +12,62 @@ import { registerCoreBlocks, __experimentalGetCoreBlocks, __experimentalRegister
|
|
|
12
12
|
import { __experimentalFetchLinkSuggestions as fetchLinkSuggestions } from '@wordpress/core-data';
|
|
13
13
|
import { registerLegacyWidgetBlock, registerLegacyWidgetVariations, registerWidgetGroupBlock } from '@wordpress/widgets';
|
|
14
14
|
import { store as preferencesStore } from '@wordpress/preferences';
|
|
15
|
+
|
|
15
16
|
/**
|
|
16
17
|
* Internal dependencies
|
|
17
18
|
*/
|
|
18
|
-
|
|
19
19
|
import './store';
|
|
20
20
|
import './filters';
|
|
21
21
|
import * as widgetArea from './blocks/widget-area';
|
|
22
22
|
import Layout from './components/layout';
|
|
23
23
|
import { ALLOW_REUSABLE_BLOCKS, ENABLE_EXPERIMENTAL_FSE_BLOCKS } from './constants';
|
|
24
24
|
const disabledBlocks = ['core/more', 'core/freeform', 'core/template-part', ...(ALLOW_REUSABLE_BLOCKS ? [] : ['core/block'])];
|
|
25
|
+
|
|
25
26
|
/**
|
|
26
27
|
* Initializes the block editor in the widgets screen.
|
|
27
28
|
*
|
|
28
29
|
* @param {string} id ID of the root element to render the screen in.
|
|
29
30
|
* @param {Object} settings Block editor settings.
|
|
30
31
|
*/
|
|
31
|
-
|
|
32
32
|
export function initializeEditor(id, settings) {
|
|
33
33
|
const target = document.getElementById(id);
|
|
34
34
|
const root = createRoot(target);
|
|
35
|
-
|
|
36
35
|
const coreBlocks = __experimentalGetCoreBlocks().filter(block => {
|
|
37
36
|
return !(disabledBlocks.includes(block.name) || block.name.startsWith('core/post') || block.name.startsWith('core/query') || block.name.startsWith('core/site') || block.name.startsWith('core/navigation'));
|
|
38
37
|
});
|
|
39
|
-
|
|
40
38
|
dispatch(preferencesStore).setDefaults('core/edit-widgets', {
|
|
41
39
|
fixedToolbar: false,
|
|
42
40
|
welcomeGuide: true,
|
|
43
41
|
showBlockBreadcrumbs: true,
|
|
44
42
|
themeStyles: true
|
|
45
43
|
});
|
|
46
|
-
|
|
47
44
|
dispatch(blocksStore).__experimentalReapplyBlockTypeFilters();
|
|
48
|
-
|
|
49
45
|
registerCoreBlocks(coreBlocks);
|
|
50
46
|
registerLegacyWidgetBlock();
|
|
51
|
-
|
|
52
47
|
if (process.env.IS_GUTENBERG_PLUGIN) {
|
|
53
48
|
__experimentalRegisterExperimentalCoreBlocks({
|
|
54
49
|
enableFSEBlocks: ENABLE_EXPERIMENTAL_FSE_BLOCKS
|
|
55
50
|
});
|
|
56
51
|
}
|
|
57
|
-
|
|
58
52
|
registerLegacyWidgetVariations(settings);
|
|
59
53
|
registerBlock(widgetArea);
|
|
60
54
|
registerWidgetGroupBlock();
|
|
55
|
+
settings.__experimentalFetchLinkSuggestions = (search, searchOptions) => fetchLinkSuggestions(search, searchOptions, settings);
|
|
61
56
|
|
|
62
|
-
|
|
57
|
+
// As we are unregistering `core/freeform` to avoid the Classic block, we must
|
|
63
58
|
// replace it with something as the default freeform content handler. Failure to
|
|
64
59
|
// do this will result in errors in the default block parser.
|
|
65
60
|
// see: https://github.com/WordPress/gutenberg/issues/33097
|
|
66
|
-
|
|
67
|
-
|
|
68
61
|
setFreeformContentHandlerName('core/html');
|
|
69
62
|
root.render(createElement(Layout, {
|
|
70
63
|
blockEditorSettings: settings
|
|
71
64
|
}));
|
|
72
65
|
return root;
|
|
73
66
|
}
|
|
67
|
+
|
|
74
68
|
/**
|
|
75
69
|
* Compatibility export under the old `initialize` name.
|
|
76
70
|
*/
|
|
77
|
-
|
|
78
71
|
export const initialize = initializeEditor;
|
|
79
72
|
export function reinitializeEditor() {
|
|
80
73
|
deprecated('wp.editWidgets.reinitializeEditor', {
|
|
@@ -82,32 +75,27 @@ export function reinitializeEditor() {
|
|
|
82
75
|
version: '6.3'
|
|
83
76
|
});
|
|
84
77
|
}
|
|
78
|
+
|
|
85
79
|
/**
|
|
86
80
|
* Function to register an individual block.
|
|
87
81
|
*
|
|
88
82
|
* @param {Object} block The block to be registered.
|
|
89
|
-
*
|
|
90
83
|
*/
|
|
91
|
-
|
|
92
84
|
const registerBlock = block => {
|
|
93
85
|
if (!block) {
|
|
94
86
|
return;
|
|
95
87
|
}
|
|
96
|
-
|
|
97
88
|
const {
|
|
98
89
|
metadata,
|
|
99
90
|
settings,
|
|
100
91
|
name
|
|
101
92
|
} = block;
|
|
102
|
-
|
|
103
93
|
if (metadata) {
|
|
104
94
|
unstable__bootstrapServerSideBlockDefinitions({
|
|
105
95
|
[name]: metadata
|
|
106
96
|
});
|
|
107
97
|
}
|
|
108
|
-
|
|
109
98
|
registerBlockType(name, settings);
|
|
110
99
|
};
|
|
111
|
-
|
|
112
100
|
export { store } from './store';
|
|
113
101
|
//# sourceMappingURL=index.js.map
|