@wordpress/edit-widgets 6.32.0 → 6.32.1-next.47f435fc9.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/build/blocks/widget-area/block.json +26 -0
- package/build/blocks/widget-area/edit/index.js +94 -87
- package/build/blocks/widget-area/edit/index.js.map +7 -1
- package/build/blocks/widget-area/edit/inner-blocks.js +68 -50
- package/build/blocks/widget-area/edit/inner-blocks.js.map +7 -1
- package/build/blocks/widget-area/edit/use-is-dragging-within.js +34 -40
- package/build/blocks/widget-area/edit/use-is-dragging-within.js.map +7 -1
- package/build/blocks/widget-area/index.js +49 -52
- package/build/blocks/widget-area/index.js.map +7 -1
- package/build/components/error-boundary/index.js +49 -51
- package/build/components/error-boundary/index.js.map +7 -1
- package/build/components/header/document-tools/index.js +104 -74
- package/build/components/header/document-tools/index.js.map +7 -1
- package/build/components/header/index.js +81 -62
- package/build/components/header/index.js.map +7 -1
- package/build/components/header/undo-redo/redo.js +50 -38
- package/build/components/header/undo-redo/redo.js.map +7 -1
- package/build/components/header/undo-redo/undo.js +49 -37
- package/build/components/header/undo-redo/undo.js.map +7 -1
- package/build/components/keyboard-shortcut-help-modal/config.js +74 -71
- package/build/components/keyboard-shortcut-help-modal/config.js.map +7 -1
- package/build/components/keyboard-shortcut-help-modal/dynamic-shortcut.js +61 -44
- package/build/components/keyboard-shortcut-help-modal/dynamic-shortcut.js.map +7 -1
- package/build/components/keyboard-shortcut-help-modal/index.js +154 -103
- package/build/components/keyboard-shortcut-help-modal/index.js.map +7 -1
- package/build/components/keyboard-shortcut-help-modal/shortcut.js +74 -56
- package/build/components/keyboard-shortcut-help-modal/shortcut.js.map +7 -1
- package/build/components/keyboard-shortcuts/index.js +89 -82
- package/build/components/keyboard-shortcuts/index.js.map +7 -1
- package/build/components/layout/index.js +75 -49
- package/build/components/layout/index.js.map +7 -1
- package/build/components/layout/interface.js +89 -75
- package/build/components/layout/interface.js.map +7 -1
- package/build/components/layout/unsaved-changes-warning.js +35 -42
- package/build/components/layout/unsaved-changes-warning.js.map +7 -1
- package/build/components/more-menu/index.js +189 -108
- package/build/components/more-menu/index.js.map +7 -1
- package/build/components/more-menu/tools-more-menu-group.js +29 -23
- package/build/components/more-menu/tools-more-menu-group.js.map +7 -1
- package/build/components/notices/index.js +62 -48
- package/build/components/notices/index.js.map +7 -1
- package/build/components/save-button/index.js +55 -47
- package/build/components/save-button/index.js.map +7 -1
- package/build/components/secondary-sidebar/index.js +41 -34
- package/build/components/secondary-sidebar/index.js.map +7 -1
- package/build/components/secondary-sidebar/inserter-sidebar.js +55 -46
- package/build/components/secondary-sidebar/inserter-sidebar.js.map +7 -1
- package/build/components/secondary-sidebar/list-view-sidebar.js +76 -67
- package/build/components/secondary-sidebar/list-view-sidebar.js.map +7 -1
- package/build/components/sidebar/index.js +149 -138
- package/build/components/sidebar/index.js.map +7 -1
- package/build/components/sidebar/widget-areas.js +73 -57
- package/build/components/sidebar/widget-areas.js.map +7 -1
- package/build/components/welcome-guide/index.js +182 -137
- package/build/components/welcome-guide/index.js.map +7 -1
- package/build/components/widget-areas-block-editor-content/index.js +64 -43
- package/build/components/widget-areas-block-editor-content/index.js.map +7 -1
- package/build/components/widget-areas-block-editor-provider/index.js +115 -92
- package/build/components/widget-areas-block-editor-provider/index.js.map +7 -1
- package/build/constants.js +30 -8
- package/build/constants.js.map +7 -1
- package/build/filters/index.js +3 -5
- package/build/filters/index.js.map +7 -1
- package/build/filters/move-to-widget-area.js +52 -59
- package/build/filters/move-to-widget-area.js.map +7 -1
- package/build/filters/replace-media-upload.js +9 -11
- package/build/filters/replace-media-upload.js.map +7 -1
- package/build/hooks/use-last-selected-widget-area.js +38 -44
- package/build/hooks/use-last-selected-widget-area.js.map +7 -1
- package/build/hooks/use-widget-library-insertion-point.js +60 -55
- package/build/hooks/use-widget-library-insertion-point.js.map +7 -1
- package/build/index.js +86 -93
- package/build/index.js.map +7 -1
- package/build/lock-unlock.js +31 -15
- package/build/lock-unlock.js.map +7 -1
- package/build/store/actions.js +181 -313
- package/build/store/actions.js.map +7 -1
- package/build/store/constants.js +27 -10
- package/build/store/constants.js.map +7 -1
- package/build/store/index.js +51 -51
- package/build/store/index.js.map +7 -1
- package/build/store/private-selectors.js +28 -7
- package/build/store/private-selectors.js.map +7 -1
- package/build/store/reducer.js +65 -118
- package/build/store/reducer.js.map +7 -1
- package/build/store/resolvers.js +64 -63
- package/build/store/resolvers.js.map +7 -1
- package/build/store/selectors.js +194 -231
- package/build/store/selectors.js.map +7 -1
- package/build/store/transformers.js +47 -41
- package/build/store/transformers.js.map +7 -1
- package/build/store/utils.js +47 -70
- package/build/store/utils.js.map +7 -1
- package/build-module/blocks/widget-area/block.json +26 -0
- package/build-module/blocks/widget-area/edit/index.js +63 -75
- package/build-module/blocks/widget-area/edit/index.js.map +7 -1
- package/build-module/blocks/widget-area/edit/inner-blocks.js +38 -41
- package/build-module/blocks/widget-area/edit/inner-blocks.js.map +7 -1
- package/build-module/blocks/widget-area/edit/use-is-dragging-within.js +14 -33
- package/build-module/blocks/widget-area/edit/use-is-dragging-within.js.map +7 -1
- package/build-module/blocks/widget-area/index.js +14 -46
- package/build-module/blocks/widget-area/index.js.map +7 -1
- package/build-module/components/error-boundary/index.js +30 -43
- package/build-module/components/error-boundary/index.js.map +7 -1
- package/build-module/components/header/document-tools/index.js +75 -66
- package/build-module/components/header/document-tools/index.js.map +7 -1
- package/build-module/components/header/index.js +52 -54
- package/build-module/components/header/index.js.map +7 -1
- package/build-module/components/header/undo-redo/redo.js +32 -32
- package/build-module/components/header/undo-redo/redo.js.map +7 -1
- package/build-module/components/header/undo-redo/undo.js +31 -31
- package/build-module/components/header/undo-redo/undo.js.map +7 -1
- package/build-module/components/keyboard-shortcut-help-modal/config.js +62 -75
- package/build-module/components/keyboard-shortcut-help-modal/config.js.map +7 -1
- package/build-module/components/keyboard-shortcut-help-modal/dynamic-shortcut.js +33 -37
- package/build-module/components/keyboard-shortcut-help-modal/dynamic-shortcut.js.map +7 -1
- package/build-module/components/keyboard-shortcut-help-modal/index.js +130 -97
- package/build-module/components/keyboard-shortcut-help-modal/index.js.map +7 -1
- package/build-module/components/keyboard-shortcut-help-modal/shortcut.js +56 -50
- package/build-module/components/keyboard-shortcut-help-modal/shortcut.js.map +7 -1
- package/build-module/components/keyboard-shortcuts/index.js +73 -75
- package/build-module/components/keyboard-shortcuts/index.js.map +7 -1
- package/build-module/components/layout/index.js +46 -41
- package/build-module/components/layout/index.js.map +7 -1
- package/build-module/components/layout/interface.js +63 -66
- package/build-module/components/layout/interface.js.map +7 -1
- package/build-module/components/layout/unsaved-changes-warning.js +17 -37
- package/build-module/components/layout/unsaved-changes-warning.js.map +7 -1
- package/build-module/components/more-menu/index.js +167 -102
- package/build-module/components/more-menu/index.js.map +7 -1
- package/build-module/components/more-menu/tools-more-menu-group.js +11 -17
- package/build-module/components/more-menu/tools-more-menu-group.js.map +7 -1
- package/build-module/components/notices/index.js +43 -42
- package/build-module/components/notices/index.js.map +7 -1
- package/build-module/components/save-button/index.js +37 -41
- package/build-module/components/save-button/index.js.map +7 -1
- package/build-module/components/secondary-sidebar/index.js +14 -27
- package/build-module/components/secondary-sidebar/index.js.map +7 -1
- package/build-module/components/secondary-sidebar/inserter-sidebar.js +26 -38
- package/build-module/components/secondary-sidebar/inserter-sidebar.js.map +7 -1
- package/build-module/components/secondary-sidebar/list-view-sidebar.js +57 -60
- package/build-module/components/secondary-sidebar/list-view-sidebar.js.map +7 -1
- package/build-module/components/sidebar/index.js +129 -127
- package/build-module/components/sidebar/index.js.map +7 -1
- package/build-module/components/sidebar/widget-areas.js +53 -49
- package/build-module/components/sidebar/widget-areas.js.map +7 -1
- package/build-module/components/welcome-guide/index.js +165 -132
- package/build-module/components/welcome-guide/index.js.map +7 -1
- package/build-module/components/widget-areas-block-editor-content/index.js +43 -36
- package/build-module/components/widget-areas-block-editor-content/index.js.map +7 -1
- package/build-module/components/widget-areas-block-editor-provider/index.js +85 -83
- package/build-module/components/widget-areas-block-editor-provider/index.js.map +7 -1
- package/build-module/constants.js +7 -3
- package/build-module/constants.js.map +7 -1
- package/build-module/filters/index.js +3 -6
- package/build-module/filters/index.js.map +7 -1
- package/build-module/filters/move-to-widget-area.js +52 -57
- package/build-module/filters/move-to-widget-area.js.map +7 -1
- package/build-module/filters/replace-media-upload.js +8 -7
- package/build-module/filters/replace-media-upload.js.map +7 -1
- package/build-module/hooks/use-last-selected-widget-area.js +20 -39
- package/build-module/hooks/use-last-selected-widget-area.js.map +7 -1
- package/build-module/hooks/use-widget-library-insertion-point.js +42 -49
- package/build-module/hooks/use-widget-library-insertion-point.js.map +7 -1
- package/build-module/index.js +60 -72
- package/build-module/index.js.map +7 -1
- package/build-module/lock-unlock.js +8 -7
- package/build-module/lock-unlock.js.map +7 -1
- package/build-module/store/actions.js +153 -293
- package/build-module/store/actions.js.map +7 -1
- package/build-module/store/constants.js +5 -5
- package/build-module/store/constants.js.map +7 -1
- package/build-module/store/index.js +16 -40
- package/build-module/store/index.js.map +7 -1
- package/build-module/store/private-selectors.js +7 -3
- package/build-module/store/private-selectors.js.map +7 -1
- package/build-module/store/reducer.js +42 -111
- package/build-module/store/reducer.js.map +7 -1
- package/build-module/store/resolvers.js +43 -51
- package/build-module/store/resolvers.js.map +7 -1
- package/build-module/store/selectors.js +171 -224
- package/build-module/store/selectors.js.map +7 -1
- package/build-module/store/transformers.js +23 -34
- package/build-module/store/transformers.js.map +7 -1
- package/build-module/store/utils.js +22 -63
- package/build-module/store/utils.js.map +7 -1
- package/build-style/style-rtl.css +216 -88
- package/build-style/style.css +216 -88
- package/package.json +36 -29
- package/src/blocks/widget-area/editor.scss +3 -0
- package/src/components/customizer-edit-widgets-initializer/style.scss +3 -0
- package/src/components/error-boundary/style.scss +2 -0
- package/src/components/header/style.scss +5 -0
- package/src/components/keyboard-shortcut-help-modal/style.scss +2 -0
- package/src/components/layout/style.scss +3 -0
- package/src/components/more-menu/style.scss +2 -0
- package/src/components/notices/style.scss +3 -0
- package/src/components/secondary-sidebar/style.scss +4 -0
- package/src/components/sidebar/style.scss +2 -0
- package/src/components/welcome-guide/style.scss +2 -0
- package/src/components/widget-areas-block-editor-content/style.scss +2 -0
- package/src/style.scss +16 -13
|
@@ -1,50 +1,71 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var
|
|
4
|
-
Object.
|
|
5
|
-
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
+
mod
|
|
26
|
+
));
|
|
27
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
+
var widget_areas_block_editor_content_exports = {};
|
|
29
|
+
__export(widget_areas_block_editor_content_exports, {
|
|
30
|
+
default: () => WidgetAreasBlockEditorContent
|
|
6
31
|
});
|
|
7
|
-
exports
|
|
8
|
-
var
|
|
9
|
-
var
|
|
10
|
-
var
|
|
11
|
-
var
|
|
12
|
-
var
|
|
13
|
-
var
|
|
14
|
-
var
|
|
15
|
-
var
|
|
16
|
-
/**
|
|
17
|
-
* WordPress dependencies
|
|
18
|
-
*/
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* Internal dependencies
|
|
22
|
-
*/
|
|
23
|
-
|
|
32
|
+
module.exports = __toCommonJS(widget_areas_block_editor_content_exports);
|
|
33
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
34
|
+
var import_block_editor = require("@wordpress/block-editor");
|
|
35
|
+
var import_compose = require("@wordpress/compose");
|
|
36
|
+
var import_data = require("@wordpress/data");
|
|
37
|
+
var import_element = require("@wordpress/element");
|
|
38
|
+
var import_preferences = require("@wordpress/preferences");
|
|
39
|
+
var import_notices = __toESM(require("../notices"));
|
|
40
|
+
var import_keyboard_shortcuts = __toESM(require("../keyboard-shortcuts"));
|
|
24
41
|
function WidgetAreasBlockEditorContent({
|
|
25
42
|
blockEditorSettings
|
|
26
43
|
}) {
|
|
27
|
-
const hasThemeStyles = (0,
|
|
28
|
-
|
|
29
|
-
|
|
44
|
+
const hasThemeStyles = (0, import_data.useSelect)(
|
|
45
|
+
(select) => !!select(import_preferences.store).get(
|
|
46
|
+
"core/edit-widgets",
|
|
47
|
+
"themeStyles"
|
|
48
|
+
),
|
|
49
|
+
[]
|
|
50
|
+
);
|
|
51
|
+
const isLargeViewport = (0, import_compose.useViewportMatch)("medium");
|
|
52
|
+
const styles = (0, import_element.useMemo)(() => {
|
|
30
53
|
return hasThemeStyles ? blockEditorSettings.styles : [];
|
|
31
54
|
}, [blockEditorSettings, hasThemeStyles]);
|
|
32
|
-
return
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
})]
|
|
48
|
-
});
|
|
55
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "edit-widgets-block-editor", children: [
|
|
56
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_notices.default, {}),
|
|
57
|
+
!isLargeViewport && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_block_editor.BlockToolbar, { hideDragHandle: true }),
|
|
58
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_block_editor.BlockTools, { children: [
|
|
59
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_keyboard_shortcuts.default, {}),
|
|
60
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
61
|
+
import_block_editor.__unstableEditorStyles,
|
|
62
|
+
{
|
|
63
|
+
styles,
|
|
64
|
+
scope: ":where(.editor-styles-wrapper)"
|
|
65
|
+
}
|
|
66
|
+
),
|
|
67
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_block_editor.BlockSelectionClearer, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_block_editor.WritingFlow, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_block_editor.BlockList, { className: "edit-widgets-main-block-list" }) }) })
|
|
68
|
+
] })
|
|
69
|
+
] });
|
|
49
70
|
}
|
|
50
|
-
//# sourceMappingURL=index.js.map
|
|
71
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/components/widget-areas-block-editor-content/index.js"],
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport {\n\tBlockList,\n\tBlockToolbar,\n\tBlockTools,\n\tBlockSelectionClearer,\n\tWritingFlow,\n\t__unstableEditorStyles as EditorStyles,\n} from '@wordpress/block-editor';\nimport { useViewportMatch } from '@wordpress/compose';\nimport { useSelect } from '@wordpress/data';\nimport { useMemo } from '@wordpress/element';\nimport { store as preferencesStore } from '@wordpress/preferences';\n\n/**\n * Internal dependencies\n */\nimport Notices from '../notices';\nimport KeyboardShortcuts from '../keyboard-shortcuts';\n\nexport default function WidgetAreasBlockEditorContent( {\n\tblockEditorSettings,\n} ) {\n\tconst hasThemeStyles = useSelect(\n\t\t( select ) =>\n\t\t\t!! select( preferencesStore ).get(\n\t\t\t\t'core/edit-widgets',\n\t\t\t\t'themeStyles'\n\t\t\t),\n\t\t[]\n\t);\n\tconst isLargeViewport = useViewportMatch( 'medium' );\n\n\tconst styles = useMemo( () => {\n\t\treturn hasThemeStyles ? blockEditorSettings.styles : [];\n\t}, [ blockEditorSettings, hasThemeStyles ] );\n\n\treturn (\n\t\t<div className=\"edit-widgets-block-editor\">\n\t\t\t<Notices />\n\t\t\t{ ! isLargeViewport && <BlockToolbar hideDragHandle /> }\n\t\t\t<BlockTools>\n\t\t\t\t<KeyboardShortcuts />\n\t\t\t\t<EditorStyles\n\t\t\t\t\tstyles={ styles }\n\t\t\t\t\tscope=\":where(.editor-styles-wrapper)\"\n\t\t\t\t/>\n\t\t\t\t<BlockSelectionClearer>\n\t\t\t\t\t<WritingFlow>\n\t\t\t\t\t\t<BlockList className=\"edit-widgets-main-block-list\" />\n\t\t\t\t\t</WritingFlow>\n\t\t\t\t</BlockSelectionClearer>\n\t\t\t</BlockTools>\n\t\t</div>\n\t);\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAyCG;AAtCH,0BAOO;AACP,qBAAiC;AACjC,kBAA0B;AAC1B,qBAAwB;AACxB,yBAA0C;AAK1C,qBAAoB;AACpB,gCAA8B;AAEf,SAAR,8BAAgD;AAAA,EACtD;AACD,GAAI;AACH,QAAM,qBAAiB;AAAA,IACtB,CAAE,WACD,CAAC,CAAE,OAAQ,mBAAAA,KAAiB,EAAE;AAAA,MAC7B;AAAA,MACA;AAAA,IACD;AAAA,IACD,CAAC;AAAA,EACF;AACA,QAAM,sBAAkB,iCAAkB,QAAS;AAEnD,QAAM,aAAS,wBAAS,MAAM;AAC7B,WAAO,iBAAiB,oBAAoB,SAAS,CAAC;AAAA,EACvD,GAAG,CAAE,qBAAqB,cAAe,CAAE;AAE3C,SACC,6CAAC,SAAI,WAAU,6BACd;AAAA,gDAAC,eAAAC,SAAA,EAAQ;AAAA,IACP,CAAE,mBAAmB,4CAAC,oCAAa,gBAAc,MAAC;AAAA,IACpD,6CAAC,kCACA;AAAA,kDAAC,0BAAAC,SAAA,EAAkB;AAAA,MACnB;AAAA,QAAC,oBAAAC;AAAA,QAAA;AAAA,UACA;AAAA,UACA,OAAM;AAAA;AAAA,MACP;AAAA,MACA,4CAAC,6CACA,sDAAC,mCACA,sDAAC,iCAAU,WAAU,gCAA+B,GACrD,GACD;AAAA,OACD;AAAA,KACD;AAEF;",
|
|
6
|
+
"names": ["preferencesStore", "Notices", "KeyboardShortcuts", "EditorStyles"]
|
|
7
|
+
}
|
|
@@ -1,51 +1,62 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var
|
|
4
|
-
Object.
|
|
5
|
-
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
+
mod
|
|
26
|
+
));
|
|
27
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
+
var widget_areas_block_editor_provider_exports = {};
|
|
29
|
+
__export(widget_areas_block_editor_provider_exports, {
|
|
30
|
+
default: () => WidgetAreasBlockEditorProvider
|
|
6
31
|
});
|
|
7
|
-
exports
|
|
8
|
-
var
|
|
9
|
-
var
|
|
10
|
-
var
|
|
11
|
-
var
|
|
12
|
-
var
|
|
13
|
-
var
|
|
14
|
-
var
|
|
15
|
-
var
|
|
16
|
-
var
|
|
17
|
-
var
|
|
18
|
-
var
|
|
19
|
-
var
|
|
20
|
-
var
|
|
21
|
-
var
|
|
22
|
-
var
|
|
23
|
-
var
|
|
24
|
-
var
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* Internal dependencies
|
|
31
|
-
*/
|
|
32
|
-
|
|
33
|
-
const {
|
|
34
|
-
ExperimentalBlockEditorProvider
|
|
35
|
-
} = (0, _lockUnlock.unlock)(_blockEditor.privateApis);
|
|
36
|
-
const {
|
|
37
|
-
PatternsMenuItems
|
|
38
|
-
} = (0, _lockUnlock.unlock)(_patterns.privateApis);
|
|
39
|
-
const {
|
|
40
|
-
BlockKeyboardShortcuts
|
|
41
|
-
} = (0, _lockUnlock.unlock)(_blockLibrary.privateApis);
|
|
32
|
+
module.exports = __toCommonJS(widget_areas_block_editor_provider_exports);
|
|
33
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
34
|
+
var import_components = require("@wordpress/components");
|
|
35
|
+
var import_compose = require("@wordpress/compose");
|
|
36
|
+
var import_media_utils = require("@wordpress/media-utils");
|
|
37
|
+
var import_data = require("@wordpress/data");
|
|
38
|
+
var import_core_data = require("@wordpress/core-data");
|
|
39
|
+
var import_element = require("@wordpress/element");
|
|
40
|
+
var import_block_editor = require("@wordpress/block-editor");
|
|
41
|
+
var import_patterns = require("@wordpress/patterns");
|
|
42
|
+
var import_preferences = require("@wordpress/preferences");
|
|
43
|
+
var import_block_library = require("@wordpress/block-library");
|
|
44
|
+
var import_keyboard_shortcuts = __toESM(require("../keyboard-shortcuts"));
|
|
45
|
+
var import_utils = require("../../store/utils");
|
|
46
|
+
var import_use_last_selected_widget_area = __toESM(require("../../hooks/use-last-selected-widget-area"));
|
|
47
|
+
var import_store = require("../../store");
|
|
48
|
+
var import_constants = require("../../constants");
|
|
49
|
+
var import_lock_unlock = require("../../lock-unlock");
|
|
50
|
+
const { ExperimentalBlockEditorProvider } = (0, import_lock_unlock.unlock)(import_block_editor.privateApis);
|
|
51
|
+
const { PatternsMenuItems } = (0, import_lock_unlock.unlock)(import_patterns.privateApis);
|
|
52
|
+
const { BlockKeyboardShortcuts } = (0, import_lock_unlock.unlock)(import_block_library.privateApis);
|
|
42
53
|
const EMPTY_ARRAY = [];
|
|
43
54
|
function WidgetAreasBlockEditorProvider({
|
|
44
55
|
blockEditorSettings,
|
|
45
56
|
children,
|
|
46
57
|
...props
|
|
47
58
|
}) {
|
|
48
|
-
const isLargeViewport = (0,
|
|
59
|
+
const isLargeViewport = (0, import_compose.useViewportMatch)("medium");
|
|
49
60
|
const {
|
|
50
61
|
hasUploadPermissions,
|
|
51
62
|
reusableBlocks,
|
|
@@ -53,44 +64,38 @@ function WidgetAreasBlockEditorProvider({
|
|
|
53
64
|
keepCaretInsideBlock,
|
|
54
65
|
pageOnFront,
|
|
55
66
|
pageForPosts
|
|
56
|
-
} = (0,
|
|
57
|
-
|
|
58
|
-
const {
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
} = select(_coreData.store);
|
|
63
|
-
const siteSettings = canUser('read', {
|
|
64
|
-
kind: 'root',
|
|
65
|
-
name: 'site'
|
|
66
|
-
}) ? getEntityRecord('root', 'site') : undefined;
|
|
67
|
+
} = (0, import_data.useSelect)((select) => {
|
|
68
|
+
const { canUser, getEntityRecord, getEntityRecords } = select(import_core_data.store);
|
|
69
|
+
const siteSettings = canUser("read", {
|
|
70
|
+
kind: "root",
|
|
71
|
+
name: "site"
|
|
72
|
+
}) ? getEntityRecord("root", "site") : void 0;
|
|
67
73
|
return {
|
|
68
|
-
hasUploadPermissions:
|
|
69
|
-
kind:
|
|
70
|
-
name:
|
|
71
|
-
})
|
|
72
|
-
reusableBlocks:
|
|
73
|
-
isFixedToolbarActive: !!select(
|
|
74
|
-
|
|
74
|
+
hasUploadPermissions: canUser("create", {
|
|
75
|
+
kind: "postType",
|
|
76
|
+
name: "attachment"
|
|
77
|
+
}) ?? true,
|
|
78
|
+
reusableBlocks: import_constants.ALLOW_REUSABLE_BLOCKS ? getEntityRecords("postType", "wp_block") : EMPTY_ARRAY,
|
|
79
|
+
isFixedToolbarActive: !!select(import_preferences.store).get(
|
|
80
|
+
"core/edit-widgets",
|
|
81
|
+
"fixedToolbar"
|
|
82
|
+
),
|
|
83
|
+
keepCaretInsideBlock: !!select(import_preferences.store).get(
|
|
84
|
+
"core/edit-widgets",
|
|
85
|
+
"keepCaretInsideBlock"
|
|
86
|
+
),
|
|
75
87
|
pageOnFront: siteSettings?.page_on_front,
|
|
76
88
|
pageForPosts: siteSettings?.page_for_posts
|
|
77
89
|
};
|
|
78
90
|
}, []);
|
|
79
|
-
const {
|
|
80
|
-
|
|
81
|
-
} = (0, _data.useDispatch)(_store.store);
|
|
82
|
-
const settings = (0, _element.useMemo)(() => {
|
|
91
|
+
const { setIsInserterOpened } = (0, import_data.useDispatch)(import_store.store);
|
|
92
|
+
const settings = (0, import_element.useMemo)(() => {
|
|
83
93
|
let mediaUploadBlockEditor;
|
|
84
94
|
if (hasUploadPermissions) {
|
|
85
|
-
mediaUploadBlockEditor = ({
|
|
86
|
-
|
|
87
|
-
...argumentsObject
|
|
88
|
-
}) => {
|
|
89
|
-
(0, _mediaUtils.uploadMedia)({
|
|
95
|
+
mediaUploadBlockEditor = ({ onError, ...argumentsObject }) => {
|
|
96
|
+
(0, import_media_utils.uploadMedia)({
|
|
90
97
|
wpAllowedMimeTypes: blockEditorSettings.allowedMimeTypes,
|
|
91
|
-
onError: ({
|
|
92
|
-
message
|
|
93
|
-
}) => onError(message),
|
|
98
|
+
onError: ({ message }) => onError(message),
|
|
94
99
|
...argumentsObject
|
|
95
100
|
});
|
|
96
101
|
};
|
|
@@ -101,29 +106,47 @@ function WidgetAreasBlockEditorProvider({
|
|
|
101
106
|
hasFixedToolbar: isFixedToolbarActive || !isLargeViewport,
|
|
102
107
|
keepCaretInsideBlock,
|
|
103
108
|
mediaUpload: mediaUploadBlockEditor,
|
|
104
|
-
templateLock:
|
|
109
|
+
templateLock: "all",
|
|
105
110
|
__experimentalSetIsInserterOpened: setIsInserterOpened,
|
|
106
111
|
pageOnFront,
|
|
107
112
|
pageForPosts,
|
|
108
|
-
editorTool:
|
|
113
|
+
editorTool: "edit"
|
|
109
114
|
};
|
|
110
|
-
}, [
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
115
|
+
}, [
|
|
116
|
+
hasUploadPermissions,
|
|
117
|
+
blockEditorSettings,
|
|
118
|
+
isFixedToolbarActive,
|
|
119
|
+
isLargeViewport,
|
|
120
|
+
keepCaretInsideBlock,
|
|
121
|
+
reusableBlocks,
|
|
122
|
+
setIsInserterOpened,
|
|
123
|
+
pageOnFront,
|
|
124
|
+
pageForPosts
|
|
125
|
+
]);
|
|
126
|
+
const widgetAreaId = (0, import_use_last_selected_widget_area.default)();
|
|
127
|
+
const [blocks, onInput, onChange] = (0, import_core_data.useEntityBlockEditor)(
|
|
128
|
+
import_utils.KIND,
|
|
129
|
+
import_utils.POST_TYPE,
|
|
130
|
+
{ id: (0, import_utils.buildWidgetAreasPostId)() }
|
|
131
|
+
);
|
|
132
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_components.SlotFillProvider, { children: [
|
|
133
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_keyboard_shortcuts.default.Register, {}),
|
|
134
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(BlockKeyboardShortcuts, {}),
|
|
135
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
136
|
+
ExperimentalBlockEditorProvider,
|
|
137
|
+
{
|
|
138
|
+
value: blocks,
|
|
139
|
+
onInput,
|
|
140
|
+
onChange,
|
|
141
|
+
settings,
|
|
142
|
+
useSubRegistry: false,
|
|
143
|
+
...props,
|
|
144
|
+
children: [
|
|
145
|
+
children,
|
|
146
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(PatternsMenuItems, { rootClientId: widgetAreaId })
|
|
147
|
+
]
|
|
148
|
+
}
|
|
149
|
+
)
|
|
150
|
+
] });
|
|
128
151
|
}
|
|
129
|
-
//# sourceMappingURL=index.js.map
|
|
152
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/components/widget-areas-block-editor-provider/index.js"],
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { SlotFillProvider } from '@wordpress/components';\nimport { useViewportMatch } from '@wordpress/compose';\nimport { uploadMedia } from '@wordpress/media-utils';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { useEntityBlockEditor, store as coreStore } from '@wordpress/core-data';\nimport { useMemo } from '@wordpress/element';\nimport { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';\nimport { privateApis as editPatternsPrivateApis } from '@wordpress/patterns';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport { privateApis as blockLibraryPrivateApis } from '@wordpress/block-library';\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 );\nconst { BlockKeyboardShortcuts } = unlock( blockLibraryPrivateApis );\n\nconst EMPTY_ARRAY = [];\n\nexport default function WidgetAreasBlockEditorProvider( {\n\tblockEditorSettings,\n\tchildren,\n\t...props\n} ) {\n\tconst isLargeViewport = useViewportMatch( 'medium' );\n\tconst {\n\t\thasUploadPermissions,\n\t\treusableBlocks,\n\t\tisFixedToolbarActive,\n\t\tkeepCaretInsideBlock,\n\t\tpageOnFront,\n\t\tpageForPosts,\n\t} = useSelect( ( select ) => {\n\t\tconst { canUser, getEntityRecord, getEntityRecords } =\n\t\t\tselect( coreStore );\n\t\tconst siteSettings = canUser( 'read', {\n\t\t\tkind: 'root',\n\t\t\tname: 'site',\n\t\t} )\n\t\t\t? getEntityRecord( 'root', 'site' )\n\t\t\t: undefined;\n\t\treturn {\n\t\t\thasUploadPermissions:\n\t\t\t\tcanUser( 'create', {\n\t\t\t\t\tkind: 'postType',\n\t\t\t\t\tname: 'attachment',\n\t\t\t\t} ) ?? true,\n\t\t\treusableBlocks: ALLOW_REUSABLE_BLOCKS\n\t\t\t\t? getEntityRecords( 'postType', 'wp_block' )\n\t\t\t\t: EMPTY_ARRAY,\n\t\t\tisFixedToolbarActive: !! select( preferencesStore ).get(\n\t\t\t\t'core/edit-widgets',\n\t\t\t\t'fixedToolbar'\n\t\t\t),\n\t\t\tkeepCaretInsideBlock: !! select( preferencesStore ).get(\n\t\t\t\t'core/edit-widgets',\n\t\t\t\t'keepCaretInsideBlock'\n\t\t\t),\n\t\t\tpageOnFront: siteSettings?.page_on_front,\n\t\t\tpageForPosts: siteSettings?.page_for_posts,\n\t\t};\n\t}, [] );\n\tconst { setIsInserterOpened } = useDispatch( editWidgetsStore );\n\n\tconst settings = useMemo( () => {\n\t\tlet mediaUploadBlockEditor;\n\t\tif ( hasUploadPermissions ) {\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 || ! isLargeViewport,\n\t\t\tkeepCaretInsideBlock,\n\t\t\tmediaUpload: mediaUploadBlockEditor,\n\t\t\ttemplateLock: 'all',\n\t\t\t__experimentalSetIsInserterOpened: setIsInserterOpened,\n\t\t\tpageOnFront,\n\t\t\tpageForPosts,\n\t\t\teditorTool: 'edit',\n\t\t};\n\t}, [\n\t\thasUploadPermissions,\n\t\tblockEditorSettings,\n\t\tisFixedToolbarActive,\n\t\tisLargeViewport,\n\t\tkeepCaretInsideBlock,\n\t\treusableBlocks,\n\t\tsetIsInserterOpened,\n\t\tpageOnFront,\n\t\tpageForPosts,\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<SlotFillProvider>\n\t\t\t<KeyboardShortcuts.Register />\n\t\t\t<BlockKeyboardShortcuts />\n\t\t\t<ExperimentalBlockEditorProvider\n\t\t\t\tvalue={ blocks }\n\t\t\t\tonInput={ onInput }\n\t\t\t\tonChange={ onChange }\n\t\t\t\tsettings={ settings }\n\t\t\t\tuseSubRegistry={ false }\n\t\t\t\t{ ...props }\n\t\t\t>\n\t\t\t\t{ children }\n\t\t\t\t<PatternsMenuItems rootClientId={ widgetAreaId } />\n\t\t\t</ExperimentalBlockEditorProvider>\n\t\t</SlotFillProvider>\n\t);\n}\n"],
|
|
5
|
+
"mappings": "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",
|
|
6
|
+
"names": ["blockEditorPrivateApis", "editPatternsPrivateApis", "blockLibraryPrivateApis", "coreStore", "preferencesStore", "editWidgetsStore", "useLastSelectedWidgetArea", "KeyboardShortcuts"]
|
|
7
|
+
}
|
package/build/constants.js
CHANGED
|
@@ -1,9 +1,31 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Object.
|
|
4
|
-
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
var constants_exports = {};
|
|
19
|
+
__export(constants_exports, {
|
|
20
|
+
ALLOW_REUSABLE_BLOCKS: () => ALLOW_REUSABLE_BLOCKS,
|
|
21
|
+
ENABLE_EXPERIMENTAL_FSE_BLOCKS: () => ENABLE_EXPERIMENTAL_FSE_BLOCKS
|
|
5
22
|
});
|
|
6
|
-
|
|
7
|
-
const ALLOW_REUSABLE_BLOCKS =
|
|
8
|
-
const ENABLE_EXPERIMENTAL_FSE_BLOCKS =
|
|
9
|
-
|
|
23
|
+
module.exports = __toCommonJS(constants_exports);
|
|
24
|
+
const ALLOW_REUSABLE_BLOCKS = false;
|
|
25
|
+
const ENABLE_EXPERIMENTAL_FSE_BLOCKS = false;
|
|
26
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
27
|
+
0 && (module.exports = {
|
|
28
|
+
ALLOW_REUSABLE_BLOCKS,
|
|
29
|
+
ENABLE_EXPERIMENTAL_FSE_BLOCKS
|
|
30
|
+
});
|
|
31
|
+
//# sourceMappingURL=constants.js.map
|
package/build/constants.js.map
CHANGED
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/constants.js"],
|
|
4
|
+
"sourcesContent": ["export const ALLOW_REUSABLE_BLOCKS = false;\nexport const ENABLE_EXPERIMENTAL_FSE_BLOCKS = false;\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAO,MAAM,wBAAwB;AAC9B,MAAM,iCAAiC;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
package/build/filters/index.js
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
require("./replace-media-upload");
|
|
5
|
-
//# sourceMappingURL=index.js.map
|
|
1
|
+
var import_move_to_widget_area = require("./move-to-widget-area");
|
|
2
|
+
var import_replace_media_upload = require("./replace-media-upload");
|
|
3
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/filters/index.js"],
|
|
4
|
+
"sourcesContent": ["/**\n * Internal dependencies\n */\nimport './move-to-widget-area';\nimport './replace-media-upload';\n"],
|
|
5
|
+
"mappings": "AAGA,iCAAO;AACP,kCAAO;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1,60 +1,53 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
var
|
|
6
|
-
var
|
|
7
|
-
var
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
* Internal dependencies
|
|
16
|
-
*/
|
|
17
|
-
|
|
18
|
-
const withMoveToWidgetAreaToolbarItem = (0, _compose.createHigherOrderComponent)(BlockEdit => props => {
|
|
19
|
-
const {
|
|
20
|
-
clientId,
|
|
21
|
-
name: blockName
|
|
22
|
-
} = props;
|
|
23
|
-
const {
|
|
24
|
-
widgetAreas,
|
|
25
|
-
currentWidgetAreaId,
|
|
26
|
-
canInsertBlockInWidgetArea
|
|
27
|
-
} = (0, _data.useSelect)(select => {
|
|
28
|
-
// Component won't display for a widget area, so don't run selectors.
|
|
29
|
-
if (blockName === 'core/widget-area') {
|
|
30
|
-
return {};
|
|
31
|
-
}
|
|
32
|
-
const selectors = select(_store.store);
|
|
33
|
-
const widgetAreaBlock = selectors.getParentWidgetAreaBlock(clientId);
|
|
34
|
-
return {
|
|
35
|
-
widgetAreas: selectors.getWidgetAreas(),
|
|
36
|
-
currentWidgetAreaId: widgetAreaBlock?.attributes?.id,
|
|
37
|
-
canInsertBlockInWidgetArea: selectors.canInsertBlockInWidgetArea(blockName)
|
|
38
|
-
};
|
|
39
|
-
}, [clientId, blockName]);
|
|
40
|
-
const {
|
|
41
|
-
moveBlockToWidgetArea
|
|
42
|
-
} = (0, _data.useDispatch)(_store.store);
|
|
43
|
-
const hasMultipleWidgetAreas = widgetAreas?.length > 1;
|
|
44
|
-
const isMoveToWidgetAreaVisible = blockName !== 'core/widget-area' && hasMultipleWidgetAreas && canInsertBlockInWidgetArea;
|
|
45
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
46
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(BlockEdit, {
|
|
47
|
-
...props
|
|
48
|
-
}, "edit"), isMoveToWidgetAreaVisible && /*#__PURE__*/(0, _jsxRuntime.jsx)(_blockEditor.BlockControls, {
|
|
49
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_widgets.MoveToWidgetArea, {
|
|
50
|
-
widgetAreas: widgetAreas,
|
|
51
|
-
currentWidgetAreaId: currentWidgetAreaId,
|
|
52
|
-
onSelect: widgetAreaId => {
|
|
53
|
-
moveBlockToWidgetArea(props.clientId, widgetAreaId);
|
|
1
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
2
|
+
var import_block_editor = require("@wordpress/block-editor");
|
|
3
|
+
var import_compose = require("@wordpress/compose");
|
|
4
|
+
var import_data = require("@wordpress/data");
|
|
5
|
+
var import_hooks = require("@wordpress/hooks");
|
|
6
|
+
var import_widgets = require("@wordpress/widgets");
|
|
7
|
+
var import_store = require("../store");
|
|
8
|
+
const withMoveToWidgetAreaToolbarItem = (0, import_compose.createHigherOrderComponent)(
|
|
9
|
+
(BlockEdit) => (props) => {
|
|
10
|
+
const { clientId, name: blockName } = props;
|
|
11
|
+
const { widgetAreas, currentWidgetAreaId, canInsertBlockInWidgetArea } = (0, import_data.useSelect)(
|
|
12
|
+
(select) => {
|
|
13
|
+
if (blockName === "core/widget-area") {
|
|
14
|
+
return {};
|
|
54
15
|
}
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
16
|
+
const selectors = select(import_store.store);
|
|
17
|
+
const widgetAreaBlock = selectors.getParentWidgetAreaBlock(clientId);
|
|
18
|
+
return {
|
|
19
|
+
widgetAreas: selectors.getWidgetAreas(),
|
|
20
|
+
currentWidgetAreaId: widgetAreaBlock?.attributes?.id,
|
|
21
|
+
canInsertBlockInWidgetArea: selectors.canInsertBlockInWidgetArea(blockName)
|
|
22
|
+
};
|
|
23
|
+
},
|
|
24
|
+
[clientId, blockName]
|
|
25
|
+
);
|
|
26
|
+
const { moveBlockToWidgetArea } = (0, import_data.useDispatch)(import_store.store);
|
|
27
|
+
const hasMultipleWidgetAreas = widgetAreas?.length > 1;
|
|
28
|
+
const isMoveToWidgetAreaVisible = blockName !== "core/widget-area" && hasMultipleWidgetAreas && canInsertBlockInWidgetArea;
|
|
29
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
30
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(BlockEdit, { ...props }, "edit"),
|
|
31
|
+
isMoveToWidgetAreaVisible && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_block_editor.BlockControls, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
32
|
+
import_widgets.MoveToWidgetArea,
|
|
33
|
+
{
|
|
34
|
+
widgetAreas,
|
|
35
|
+
currentWidgetAreaId,
|
|
36
|
+
onSelect: (widgetAreaId) => {
|
|
37
|
+
moveBlockToWidgetArea(
|
|
38
|
+
props.clientId,
|
|
39
|
+
widgetAreaId
|
|
40
|
+
);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
) })
|
|
44
|
+
] });
|
|
45
|
+
},
|
|
46
|
+
"withMoveToWidgetAreaToolbarItem"
|
|
47
|
+
);
|
|
48
|
+
(0, import_hooks.addFilter)(
|
|
49
|
+
"editor.BlockEdit",
|
|
50
|
+
"core/edit-widgets/block-edit",
|
|
51
|
+
withMoveToWidgetAreaToolbarItem
|
|
52
|
+
);
|
|
53
|
+
//# sourceMappingURL=move-to-widget-area.js.map
|