@wordpress/edit-widgets 6.32.0 → 6.32.1-next.ff1cebbba.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 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/filters/move-to-widget-area.js"],
|
|
4
|
+
"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 key=\"edit\" { ...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"],
|
|
5
|
+
"mappings": "AAiDG;AA7CH,0BAA8B;AAC9B,qBAA2C;AAC3C,kBAAuC;AACvC,mBAA0B;AAC1B,qBAAiC;AAKjC,mBAA0C;AAE1C,MAAM,sCAAkC;AAAA,EACvC,CAAE,cAAe,CAAE,UAAW;AAC7B,UAAM,EAAE,UAAU,MAAM,UAAU,IAAI;AACtC,UAAM,EAAE,aAAa,qBAAqB,2BAA2B,QACpE;AAAA,MACC,CAAE,WAAY;AAEb,YAAK,cAAc,oBAAqB;AACvC,iBAAO,CAAC;AAAA,QACT;AAEA,cAAM,YAAY,OAAQ,aAAAA,KAAiB;AAE3C,cAAM,kBACL,UAAU,yBAA0B,QAAS;AAE9C,eAAO;AAAA,UACN,aAAa,UAAU,eAAe;AAAA,UACtC,qBAAqB,iBAAiB,YAAY;AAAA,UAClD,4BACC,UAAU,2BAA4B,SAAU;AAAA,QAClD;AAAA,MACD;AAAA,MACA,CAAE,UAAU,SAAU;AAAA,IACvB;AAED,UAAM,EAAE,sBAAsB,QAAI,yBAAa,aAAAA,KAAiB;AAChE,UAAM,yBAAyB,aAAa,SAAS;AACrD,UAAM,4BACL,cAAc,sBACd,0BACA;AAED,WACC,4EACC;AAAA,kDAAC,aAAuB,GAAG,SAAZ,MAAoB;AAAA,MACjC,6BACD,4CAAC,qCACA;AAAA,QAAC;AAAA;AAAA,UACA;AAAA,UACA;AAAA,UACA,UAAW,CAAE,iBAAkB;AAC9B;AAAA,cACC,MAAM;AAAA,cACN;AAAA,YACD;AAAA,UACD;AAAA;AAAA,MACD,GACD;AAAA,OAEF;AAAA,EAEF;AAAA,EACA;AACD;AAAA,IAEA;AAAA,EACC;AAAA,EACA;AAAA,EACA;AACD;",
|
|
6
|
+
"names": ["editWidgetsStore"]
|
|
7
|
+
}
|
|
@@ -1,11 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
(0, _hooks.addFilter)('editor.MediaUpload', 'core/edit-widgets/replace-media-upload', replaceMediaUpload);
|
|
11
|
-
//# sourceMappingURL=replace-media-upload.js.map
|
|
1
|
+
var import_hooks = require("@wordpress/hooks");
|
|
2
|
+
var import_media_utils = require("@wordpress/media-utils");
|
|
3
|
+
const replaceMediaUpload = () => import_media_utils.MediaUpload;
|
|
4
|
+
(0, import_hooks.addFilter)(
|
|
5
|
+
"editor.MediaUpload",
|
|
6
|
+
"core/edit-widgets/replace-media-upload",
|
|
7
|
+
replaceMediaUpload
|
|
8
|
+
);
|
|
9
|
+
//# sourceMappingURL=replace-media-upload.js.map
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/filters/replace-media-upload.js"],
|
|
4
|
+
"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"],
|
|
5
|
+
"mappings": "AAGA,mBAA0B;AAC1B,yBAA4B;AAE5B,MAAM,qBAAqB,MAAM;AAAA,IAEjC;AAAA,EACC;AAAA,EACA;AAAA,EACA;AACD;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1,55 +1,49 @@
|
|
|
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 use_last_selected_widget_area_exports = {};
|
|
19
|
+
__export(use_last_selected_widget_area_exports, {
|
|
20
|
+
default: () => use_last_selected_widget_area_default
|
|
5
21
|
});
|
|
6
|
-
exports
|
|
7
|
-
var
|
|
8
|
-
var
|
|
9
|
-
var
|
|
10
|
-
var
|
|
11
|
-
var
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
*/
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* Internal dependencies
|
|
18
|
-
*/
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* A react hook that returns the client id of the last widget area to have
|
|
22
|
-
* been selected, or to have a selected block within it.
|
|
23
|
-
*
|
|
24
|
-
* @return {string} clientId of the widget area last selected.
|
|
25
|
-
*/
|
|
26
|
-
const useLastSelectedWidgetArea = () => (0, _data.useSelect)(select => {
|
|
27
|
-
const {
|
|
28
|
-
getBlockSelectionEnd,
|
|
29
|
-
getBlockName
|
|
30
|
-
} = select(_blockEditor.store);
|
|
22
|
+
module.exports = __toCommonJS(use_last_selected_widget_area_exports);
|
|
23
|
+
var import_data = require("@wordpress/data");
|
|
24
|
+
var import_block_editor = require("@wordpress/block-editor");
|
|
25
|
+
var import_core_data = require("@wordpress/core-data");
|
|
26
|
+
var import_store = require("../store");
|
|
27
|
+
var import_utils = require("../store/utils");
|
|
28
|
+
const useLastSelectedWidgetArea = () => (0, import_data.useSelect)((select) => {
|
|
29
|
+
const { getBlockSelectionEnd, getBlockName } = select(import_block_editor.store);
|
|
31
30
|
const selectionEndClientId = getBlockSelectionEnd();
|
|
32
|
-
|
|
33
|
-
// If the selected block is a widget area, return its clientId.
|
|
34
|
-
if (getBlockName(selectionEndClientId) === 'core/widget-area') {
|
|
31
|
+
if (getBlockName(selectionEndClientId) === "core/widget-area") {
|
|
35
32
|
return selectionEndClientId;
|
|
36
33
|
}
|
|
37
|
-
const {
|
|
38
|
-
getParentWidgetAreaBlock
|
|
39
|
-
} = select(_store.store);
|
|
34
|
+
const { getParentWidgetAreaBlock } = select(import_store.store);
|
|
40
35
|
const widgetAreaBlock = getParentWidgetAreaBlock(selectionEndClientId);
|
|
41
36
|
const widgetAreaBlockClientId = widgetAreaBlock?.clientId;
|
|
42
37
|
if (widgetAreaBlockClientId) {
|
|
43
38
|
return widgetAreaBlockClientId;
|
|
44
39
|
}
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
const widgetAreasPost = getEntityRecord(_utils.KIND, _utils.POST_TYPE, (0, _utils.buildWidgetAreasPostId)());
|
|
40
|
+
const { getEntityRecord } = select(import_core_data.store);
|
|
41
|
+
const widgetAreasPost = getEntityRecord(
|
|
42
|
+
import_utils.KIND,
|
|
43
|
+
import_utils.POST_TYPE,
|
|
44
|
+
(0, import_utils.buildWidgetAreasPostId)()
|
|
45
|
+
);
|
|
52
46
|
return widgetAreasPost?.blocks[0]?.clientId;
|
|
53
47
|
}, []);
|
|
54
|
-
var
|
|
55
|
-
//# sourceMappingURL=use-last-selected-widget-area.js.map
|
|
48
|
+
var use_last_selected_widget_area_default = useLastSelectedWidgetArea;
|
|
49
|
+
//# sourceMappingURL=use-last-selected-widget-area.js.map
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/hooks/use-last-selected-widget-area.js"],
|
|
4
|
+
"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 widgetAreasPost?.blocks[ 0 ]?.clientId;\n\t}, [] );\n\nexport default useLastSelectedWidgetArea;\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAA0B;AAC1B,0BAA0C;AAC1C,uBAAmC;AAKnC,mBAA4C;AAC5C,mBAAwD;AAQxD,MAAM,4BAA4B,UACjC,uBAAW,CAAE,WAAY;AACxB,QAAM,EAAE,sBAAsB,aAAa,IAC1C,OAAQ,oBAAAA,KAAiB;AAC1B,QAAM,uBAAuB,qBAAqB;AAGlD,MAAK,aAAc,oBAAqB,MAAM,oBAAqB;AAClE,WAAO;AAAA,EACR;AAEA,QAAM,EAAE,yBAAyB,IAAI,OAAQ,aAAAC,KAAmB;AAChE,QAAM,kBACL,yBAA0B,oBAAqB;AAChD,QAAM,0BAA0B,iBAAiB;AAEjD,MAAK,yBAA0B;AAC9B,WAAO;AAAA,EACR;AAIA,QAAM,EAAE,gBAAgB,IAAI,OAAQ,iBAAAC,KAAU;AAC9C,QAAM,kBAAkB;AAAA,IACvB;AAAA,IACA;AAAA,QACA,qCAAuB;AAAA,EACxB;AACA,SAAO,iBAAiB,OAAQ,CAAE,GAAG;AACtC,GAAG,CAAC,CAAE;AAEP,IAAO,wCAAQ;",
|
|
6
|
+
"names": ["blockEditorStore", "widgetsEditorStore", "coreStore"]
|
|
7
|
+
}
|
|
@@ -1,62 +1,67 @@
|
|
|
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 use_widget_library_insertion_point_exports = {};
|
|
19
|
+
__export(use_widget_library_insertion_point_exports, {
|
|
20
|
+
default: () => use_widget_library_insertion_point_default
|
|
5
21
|
});
|
|
6
|
-
exports
|
|
7
|
-
var
|
|
8
|
-
var
|
|
9
|
-
var
|
|
10
|
-
var
|
|
11
|
-
var
|
|
12
|
-
/**
|
|
13
|
-
* WordPress dependencies
|
|
14
|
-
*/
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* Internal dependencies
|
|
18
|
-
*/
|
|
19
|
-
|
|
22
|
+
module.exports = __toCommonJS(use_widget_library_insertion_point_exports);
|
|
23
|
+
var import_data = require("@wordpress/data");
|
|
24
|
+
var import_block_editor = require("@wordpress/block-editor");
|
|
25
|
+
var import_core_data = require("@wordpress/core-data");
|
|
26
|
+
var import_store = require("../store");
|
|
27
|
+
var import_utils = require("../store/utils");
|
|
20
28
|
const useWidgetLibraryInsertionPoint = () => {
|
|
21
|
-
const firstRootId = (0,
|
|
22
|
-
|
|
23
|
-
const
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
29
|
+
const firstRootId = (0, import_data.useSelect)((select) => {
|
|
30
|
+
const { getEntityRecord } = select(import_core_data.store);
|
|
31
|
+
const widgetAreasPost = getEntityRecord(
|
|
32
|
+
import_utils.KIND,
|
|
33
|
+
import_utils.POST_TYPE,
|
|
34
|
+
(0, import_utils.buildWidgetAreasPostId)()
|
|
35
|
+
);
|
|
27
36
|
return widgetAreasPost?.blocks[0]?.clientId;
|
|
28
37
|
}, []);
|
|
29
|
-
return (0,
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
if (clientId && rootClientId === '') {
|
|
38
|
+
return (0, import_data.useSelect)(
|
|
39
|
+
(select) => {
|
|
40
|
+
const {
|
|
41
|
+
getBlockRootClientId,
|
|
42
|
+
getBlockSelectionEnd,
|
|
43
|
+
getBlockOrder,
|
|
44
|
+
getBlockIndex
|
|
45
|
+
} = select(import_block_editor.store);
|
|
46
|
+
const insertionPoint = select(import_store.store).__experimentalGetInsertionPoint();
|
|
47
|
+
if (insertionPoint.rootClientId) {
|
|
48
|
+
return insertionPoint;
|
|
49
|
+
}
|
|
50
|
+
const clientId = getBlockSelectionEnd() || firstRootId;
|
|
51
|
+
const rootClientId = getBlockRootClientId(clientId);
|
|
52
|
+
if (clientId && rootClientId === "") {
|
|
53
|
+
return {
|
|
54
|
+
rootClientId: clientId,
|
|
55
|
+
insertionIndex: getBlockOrder(clientId).length
|
|
56
|
+
};
|
|
57
|
+
}
|
|
50
58
|
return {
|
|
51
|
-
rootClientId
|
|
52
|
-
insertionIndex:
|
|
59
|
+
rootClientId,
|
|
60
|
+
insertionIndex: getBlockIndex(clientId) + 1
|
|
53
61
|
};
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
insertionIndex: getBlockIndex(clientId) + 1
|
|
58
|
-
};
|
|
59
|
-
}, [firstRootId]);
|
|
62
|
+
},
|
|
63
|
+
[firstRootId]
|
|
64
|
+
);
|
|
60
65
|
};
|
|
61
|
-
var
|
|
62
|
-
//# sourceMappingURL=use-widget-library-insertion-point.js.map
|
|
66
|
+
var use_widget_library_insertion_point_default = useWidgetLibraryInsertionPoint;
|
|
67
|
+
//# sourceMappingURL=use-widget-library-insertion-point.js.map
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/hooks/use-widget-library-insertion-point.js"],
|
|
4
|
+
"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"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAA0B;AAC1B,0BAA0C;AAC1C,uBAAmC;AAKnC,mBAA0C;AAC1C,mBAAwD;AAExD,MAAM,iCAAiC,MAAM;AAC5C,QAAM,kBAAc,uBAAW,CAAE,WAAY;AAE5C,UAAM,EAAE,gBAAgB,IAAI,OAAQ,iBAAAA,KAAU;AAC9C,UAAM,kBAAkB;AAAA,MACvB;AAAA,MACA;AAAA,UACA,qCAAuB;AAAA,IACxB;AACA,WAAO,iBAAiB,OAAQ,CAAE,GAAG;AAAA,EACtC,GAAG,CAAC,CAAE;AAEN,aAAO;AAAA,IACN,CAAE,WAAY;AACb,YAAM;AAAA,QACL;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,MACD,IAAI,OAAQ,oBAAAC,KAAiB;AAE7B,YAAM,iBACL,OAAQ,aAAAC,KAAiB,EAAE,gCAAgC;AAI5D,UAAK,eAAe,cAAe;AAClC,eAAO;AAAA,MACR;AAEA,YAAM,WAAW,qBAAqB,KAAK;AAC3C,YAAM,eAAe,qBAAsB,QAAS;AAKpD,UAAK,YAAY,iBAAiB,IAAK;AACtC,eAAO;AAAA,UACN,cAAc;AAAA,UACd,gBAAgB,cAAe,QAAS,EAAE;AAAA,QAC3C;AAAA,MACD;AAEA,aAAO;AAAA,QACN;AAAA,QACA,gBAAgB,cAAe,QAAS,IAAI;AAAA,MAC7C;AAAA,IACD;AAAA,IACA,CAAE,WAAY;AAAA,EACf;AACD;AAEA,IAAO,6CAAQ;",
|
|
6
|
+
"names": ["coreStore", "blockEditorStore", "editWidgetsStore"]
|
|
7
|
+
}
|
package/build/index.js
CHANGED
|
@@ -1,118 +1,111 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var
|
|
4
|
-
Object.
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
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 });
|
|
14
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 index_exports = {};
|
|
29
|
+
__export(index_exports, {
|
|
30
|
+
initialize: () => initialize,
|
|
31
|
+
initializeEditor: () => initializeEditor,
|
|
32
|
+
reinitializeEditor: () => reinitializeEditor,
|
|
33
|
+
store: () => import_store2.store
|
|
15
34
|
});
|
|
16
|
-
|
|
17
|
-
var
|
|
18
|
-
var
|
|
19
|
-
var
|
|
20
|
-
var
|
|
21
|
-
var
|
|
22
|
-
var
|
|
23
|
-
var
|
|
24
|
-
var
|
|
25
|
-
require("
|
|
26
|
-
var
|
|
27
|
-
var
|
|
28
|
-
var
|
|
29
|
-
var
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
*/
|
|
39
|
-
|
|
40
|
-
const disabledBlocks = ['core/more', 'core/freeform', 'core/template-part', ...(_constants.ALLOW_REUSABLE_BLOCKS ? [] : ['core/block'])];
|
|
41
|
-
|
|
42
|
-
/**
|
|
43
|
-
* Initializes the block editor in the widgets screen.
|
|
44
|
-
*
|
|
45
|
-
* @param {string} id ID of the root element to render the screen in.
|
|
46
|
-
* @param {Object} settings Block editor settings.
|
|
47
|
-
*/
|
|
35
|
+
module.exports = __toCommonJS(index_exports);
|
|
36
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
37
|
+
var import_blocks = require("@wordpress/blocks");
|
|
38
|
+
var import_data = require("@wordpress/data");
|
|
39
|
+
var import_deprecated = __toESM(require("@wordpress/deprecated"));
|
|
40
|
+
var import_element = require("@wordpress/element");
|
|
41
|
+
var import_block_library = require("@wordpress/block-library");
|
|
42
|
+
var import_core_data = require("@wordpress/core-data");
|
|
43
|
+
var import_widgets = require("@wordpress/widgets");
|
|
44
|
+
var import_preferences = require("@wordpress/preferences");
|
|
45
|
+
var import_store = require("./store");
|
|
46
|
+
var import_filters = require("./filters");
|
|
47
|
+
var widgetArea = __toESM(require("./blocks/widget-area"));
|
|
48
|
+
var import_layout = __toESM(require("./components/layout"));
|
|
49
|
+
var import_constants = require("./constants");
|
|
50
|
+
var import_store2 = require("./store");
|
|
51
|
+
const disabledBlocks = [
|
|
52
|
+
"core/more",
|
|
53
|
+
"core/freeform",
|
|
54
|
+
"core/template-part",
|
|
55
|
+
...import_constants.ALLOW_REUSABLE_BLOCKS ? [] : ["core/block"]
|
|
56
|
+
];
|
|
48
57
|
function initializeEditor(id, settings) {
|
|
49
58
|
const target = document.getElementById(id);
|
|
50
|
-
const root = (0,
|
|
51
|
-
const coreBlocks = (0,
|
|
52
|
-
return !(disabledBlocks.includes(block.name) || block.name.startsWith(
|
|
59
|
+
const root = (0, import_element.createRoot)(target);
|
|
60
|
+
const coreBlocks = (0, import_block_library.__experimentalGetCoreBlocks)().filter((block) => {
|
|
61
|
+
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"));
|
|
53
62
|
});
|
|
54
|
-
(0,
|
|
63
|
+
(0, import_data.dispatch)(import_preferences.store).setDefaults("core/edit-widgets", {
|
|
55
64
|
fixedToolbar: false,
|
|
56
65
|
welcomeGuide: true,
|
|
57
66
|
showBlockBreadcrumbs: true,
|
|
58
67
|
themeStyles: true
|
|
59
68
|
});
|
|
60
|
-
(0,
|
|
61
|
-
(0,
|
|
62
|
-
(0,
|
|
69
|
+
(0, import_data.dispatch)(import_blocks.store).reapplyBlockTypeFilters();
|
|
70
|
+
(0, import_block_library.registerCoreBlocks)(coreBlocks);
|
|
71
|
+
(0, import_widgets.registerLegacyWidgetBlock)();
|
|
63
72
|
if (globalThis.IS_GUTENBERG_PLUGIN) {
|
|
64
|
-
(0,
|
|
65
|
-
enableFSEBlocks:
|
|
73
|
+
(0, import_block_library.__experimentalRegisterExperimentalCoreBlocks)({
|
|
74
|
+
enableFSEBlocks: import_constants.ENABLE_EXPERIMENTAL_FSE_BLOCKS
|
|
66
75
|
});
|
|
67
76
|
}
|
|
68
|
-
(0,
|
|
77
|
+
(0, import_widgets.registerLegacyWidgetVariations)(settings);
|
|
69
78
|
registerBlock(widgetArea);
|
|
70
|
-
(0,
|
|
71
|
-
settings.__experimentalFetchLinkSuggestions = (search, searchOptions) => (0,
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
// see: https://github.com/WordPress/gutenberg/issues/33097
|
|
77
|
-
(0, _blocks.setFreeformContentHandlerName)('core/html');
|
|
78
|
-
root.render(/*#__PURE__*/(0, _jsxRuntime.jsx)(_element.StrictMode, {
|
|
79
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_layout.default, {
|
|
80
|
-
blockEditorSettings: settings
|
|
81
|
-
})
|
|
82
|
-
}));
|
|
79
|
+
(0, import_widgets.registerWidgetGroupBlock)();
|
|
80
|
+
settings.__experimentalFetchLinkSuggestions = (search, searchOptions) => (0, import_core_data.__experimentalFetchLinkSuggestions)(search, searchOptions, settings);
|
|
81
|
+
(0, import_blocks.setFreeformContentHandlerName)("core/html");
|
|
82
|
+
root.render(
|
|
83
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_element.StrictMode, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_layout.default, { blockEditorSettings: settings }) })
|
|
84
|
+
);
|
|
83
85
|
return root;
|
|
84
86
|
}
|
|
85
|
-
|
|
86
|
-
/**
|
|
87
|
-
* Compatibility export under the old `initialize` name.
|
|
88
|
-
*/
|
|
89
|
-
const initialize = exports.initialize = initializeEditor;
|
|
87
|
+
const initialize = initializeEditor;
|
|
90
88
|
function reinitializeEditor() {
|
|
91
|
-
(0,
|
|
92
|
-
since:
|
|
93
|
-
version:
|
|
89
|
+
(0, import_deprecated.default)("wp.editWidgets.reinitializeEditor", {
|
|
90
|
+
since: "6.2",
|
|
91
|
+
version: "6.3"
|
|
94
92
|
});
|
|
95
93
|
}
|
|
96
|
-
|
|
97
|
-
/**
|
|
98
|
-
* Function to register an individual block.
|
|
99
|
-
*
|
|
100
|
-
* @param {Object} block The block to be registered.
|
|
101
|
-
*/
|
|
102
|
-
const registerBlock = block => {
|
|
94
|
+
const registerBlock = (block) => {
|
|
103
95
|
if (!block) {
|
|
104
96
|
return;
|
|
105
97
|
}
|
|
106
|
-
const {
|
|
107
|
-
metadata,
|
|
108
|
-
settings,
|
|
109
|
-
name
|
|
110
|
-
} = block;
|
|
98
|
+
const { metadata, settings, name } = block;
|
|
111
99
|
if (metadata) {
|
|
112
|
-
(0,
|
|
113
|
-
[name]: metadata
|
|
114
|
-
});
|
|
100
|
+
(0, import_blocks.unstable__bootstrapServerSideBlockDefinitions)({ [name]: metadata });
|
|
115
101
|
}
|
|
116
|
-
(0,
|
|
102
|
+
(0, import_blocks.registerBlockType)(name, settings);
|
|
117
103
|
};
|
|
118
|
-
|
|
104
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
105
|
+
0 && (module.exports = {
|
|
106
|
+
initialize,
|
|
107
|
+
initializeEditor,
|
|
108
|
+
reinitializeEditor,
|
|
109
|
+
store
|
|
110
|
+
});
|
|
111
|
+
//# sourceMappingURL=index.js.map
|
package/build/index.js.map
CHANGED
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/index.js"],
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport {\n\tregisterBlockType,\n\tunstable__bootstrapServerSideBlockDefinitions, // eslint-disable-line camelcase\n\tsetFreeformContentHandlerName,\n\tstore as blocksStore,\n} from '@wordpress/blocks';\nimport { dispatch } from '@wordpress/data';\nimport deprecated from '@wordpress/deprecated';\nimport { StrictMode, createRoot } from '@wordpress/element';\nimport {\n\tregisterCoreBlocks,\n\t__experimentalGetCoreBlocks,\n\t__experimentalRegisterExperimentalCoreBlocks,\n} from '@wordpress/block-library';\nimport { __experimentalFetchLinkSuggestions as fetchLinkSuggestions } from '@wordpress/core-data';\nimport {\n\tregisterLegacyWidgetBlock,\n\tregisterLegacyWidgetVariations,\n\tregisterWidgetGroupBlock,\n} from '@wordpress/widgets';\nimport { store as preferencesStore } from '@wordpress/preferences';\n\n/**\n * Internal dependencies\n */\nimport './store';\nimport './filters';\nimport * as widgetArea from './blocks/widget-area';\nimport Layout from './components/layout';\nimport {\n\tALLOW_REUSABLE_BLOCKS,\n\tENABLE_EXPERIMENTAL_FSE_BLOCKS,\n} from './constants';\n\nconst disabledBlocks = [\n\t'core/more',\n\t'core/freeform',\n\t'core/template-part',\n\t...( ALLOW_REUSABLE_BLOCKS ? [] : [ 'core/block' ] ),\n];\n\n/**\n * Initializes the block editor in the widgets screen.\n *\n * @param {string} id ID of the root element to render the screen in.\n * @param {Object} settings Block editor settings.\n */\nexport function initializeEditor( id, settings ) {\n\tconst target = document.getElementById( id );\n\tconst root = createRoot( target );\n\n\tconst coreBlocks = __experimentalGetCoreBlocks().filter( ( block ) => {\n\t\treturn ! (\n\t\t\tdisabledBlocks.includes( block.name ) ||\n\t\t\tblock.name.startsWith( 'core/post' ) ||\n\t\t\tblock.name.startsWith( 'core/query' ) ||\n\t\t\tblock.name.startsWith( 'core/site' ) ||\n\t\t\tblock.name.startsWith( 'core/navigation' )\n\t\t);\n\t} );\n\n\tdispatch( preferencesStore ).setDefaults( 'core/edit-widgets', {\n\t\tfixedToolbar: false,\n\t\twelcomeGuide: true,\n\t\tshowBlockBreadcrumbs: true,\n\t\tthemeStyles: true,\n\t} );\n\n\tdispatch( blocksStore ).reapplyBlockTypeFilters();\n\tregisterCoreBlocks( coreBlocks );\n\tregisterLegacyWidgetBlock();\n\tif ( globalThis.IS_GUTENBERG_PLUGIN ) {\n\t\t__experimentalRegisterExperimentalCoreBlocks( {\n\t\t\tenableFSEBlocks: ENABLE_EXPERIMENTAL_FSE_BLOCKS,\n\t\t} );\n\t}\n\tregisterLegacyWidgetVariations( settings );\n\tregisterBlock( widgetArea );\n\tregisterWidgetGroupBlock();\n\n\tsettings.__experimentalFetchLinkSuggestions = ( search, searchOptions ) =>\n\t\tfetchLinkSuggestions( search, searchOptions, settings );\n\n\t// As we are unregistering `core/freeform` to avoid the Classic block, we must\n\t// replace it with something as the default freeform content handler. Failure to\n\t// do this will result in errors in the default block parser.\n\t// see: https://github.com/WordPress/gutenberg/issues/33097\n\tsetFreeformContentHandlerName( 'core/html' );\n\n\troot.render(\n\t\t<StrictMode>\n\t\t\t<Layout blockEditorSettings={ settings } />\n\t\t</StrictMode>\n\t);\n\n\treturn root;\n}\n\n/**\n * Compatibility export under the old `initialize` name.\n */\nexport const initialize = initializeEditor;\n\nexport function reinitializeEditor() {\n\tdeprecated( 'wp.editWidgets.reinitializeEditor', {\n\t\tsince: '6.2',\n\t\tversion: '6.3',\n\t} );\n}\n\n/**\n * Function to register an individual block.\n *\n * @param {Object} block The block to be registered.\n */\nconst registerBlock = ( block ) => {\n\tif ( ! block ) {\n\t\treturn;\n\t}\n\tconst { metadata, settings, name } = block;\n\tif ( metadata ) {\n\t\tunstable__bootstrapServerSideBlockDefinitions( { [ name ]: metadata } );\n\t}\n\tregisterBlockType( name, settings );\n};\n\nexport { store } from './store';\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AA8FG;AA3FH,oBAKO;AACP,kBAAyB;AACzB,wBAAuB;AACvB,qBAAuC;AACvC,2BAIO;AACP,uBAA2E;AAC3E,qBAIO;AACP,yBAA0C;AAK1C,mBAAO;AACP,qBAAO;AACP,iBAA4B;AAC5B,oBAAmB;AACnB,uBAGO;AA8FP,IAAAA,gBAAsB;AA5FtB,MAAM,iBAAiB;AAAA,EACtB;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAK,yCAAwB,CAAC,IAAI,CAAE,YAAa;AAClD;AAQO,SAAS,iBAAkB,IAAI,UAAW;AAChD,QAAM,SAAS,SAAS,eAAgB,EAAG;AAC3C,QAAM,WAAO,2BAAY,MAAO;AAEhC,QAAM,iBAAa,kDAA4B,EAAE,OAAQ,CAAE,UAAW;AACrE,WAAO,EACN,eAAe,SAAU,MAAM,IAAK,KACpC,MAAM,KAAK,WAAY,WAAY,KACnC,MAAM,KAAK,WAAY,YAAa,KACpC,MAAM,KAAK,WAAY,WAAY,KACnC,MAAM,KAAK,WAAY,iBAAkB;AAAA,EAE3C,CAAE;AAEF,4BAAU,mBAAAC,KAAiB,EAAE,YAAa,qBAAqB;AAAA,IAC9D,cAAc;AAAA,IACd,cAAc;AAAA,IACd,sBAAsB;AAAA,IACtB,aAAa;AAAA,EACd,CAAE;AAEF,4BAAU,cAAAC,KAAY,EAAE,wBAAwB;AAChD,+CAAoB,UAAW;AAC/B,gDAA0B;AAC1B,MAAK,WAAW,qBAAsB;AACrC,2EAA8C;AAAA,MAC7C,iBAAiB;AAAA,IAClB,CAAE;AAAA,EACH;AACA,qDAAgC,QAAS;AACzC,gBAAe,UAAW;AAC1B,+CAAyB;AAEzB,WAAS,qCAAqC,CAAE,QAAQ,sBACvD,iBAAAC,oCAAsB,QAAQ,eAAe,QAAS;AAMvD,mDAA+B,WAAY;AAE3C,OAAK;AAAA,IACJ,4CAAC,6BACA,sDAAC,cAAAC,SAAA,EAAO,qBAAsB,UAAW,GAC1C;AAAA,EACD;AAEA,SAAO;AACR;AAKO,MAAM,aAAa;AAEnB,SAAS,qBAAqB;AACpC,wBAAAC,SAAY,qCAAqC;AAAA,IAChD,OAAO;AAAA,IACP,SAAS;AAAA,EACV,CAAE;AACH;AAOA,MAAM,gBAAgB,CAAE,UAAW;AAClC,MAAK,CAAE,OAAQ;AACd;AAAA,EACD;AACA,QAAM,EAAE,UAAU,UAAU,KAAK,IAAI;AACrC,MAAK,UAAW;AACf,qEAA+C,EAAE,CAAE,IAAK,GAAG,SAAS,CAAE;AAAA,EACvE;AACA,uCAAmB,MAAM,QAAS;AACnC;",
|
|
6
|
+
"names": ["import_store", "preferencesStore", "blocksStore", "fetchLinkSuggestions", "Layout", "deprecated"]
|
|
7
|
+
}
|
package/build/lock-unlock.js
CHANGED
|
@@ -1,18 +1,34 @@
|
|
|
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 lock_unlock_exports = {};
|
|
19
|
+
__export(lock_unlock_exports, {
|
|
20
|
+
lock: () => lock,
|
|
21
|
+
unlock: () => unlock
|
|
5
22
|
});
|
|
6
|
-
|
|
7
|
-
var
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
23
|
+
module.exports = __toCommonJS(lock_unlock_exports);
|
|
24
|
+
var import_private_apis = require("@wordpress/private-apis");
|
|
25
|
+
const { lock, unlock } = (0, import_private_apis.__dangerousOptInToUnstableAPIsOnlyForCoreModules)(
|
|
26
|
+
"I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.",
|
|
27
|
+
"@wordpress/edit-widgets"
|
|
28
|
+
);
|
|
29
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
30
|
+
0 && (module.exports = {
|
|
13
31
|
lock,
|
|
14
32
|
unlock
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
exports.lock = lock;
|
|
18
|
-
//# sourceMappingURL=lock-unlock.js.map
|
|
33
|
+
});
|
|
34
|
+
//# sourceMappingURL=lock-unlock.js.map
|