@wordpress/edit-widgets 7.0.0 → 7.1.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/edit/index.cjs +106 -116
- package/build/blocks/widget-area/edit/index.cjs.map +1 -7
- package/build/blocks/widget-area/edit/inner-blocks.cjs +44 -62
- package/build/blocks/widget-area/edit/inner-blocks.cjs.map +1 -7
- package/build/blocks/widget-area/edit/use-is-dragging-within.cjs +41 -53
- package/build/blocks/widget-area/edit/use-is-dragging-within.cjs.map +1 -7
- package/build/blocks/widget-area/index.cjs +40 -44
- package/build/blocks/widget-area/index.cjs.map +1 -7
- package/build/components/error-boundary/index.cjs +115 -155
- package/build/components/error-boundary/index.cjs.map +1 -7
- package/build/components/header/document-tools/index.cjs +80 -115
- package/build/components/header/document-tools/index.cjs.map +1 -7
- package/build/components/header/index.cjs +72 -80
- package/build/components/header/index.cjs.map +1 -7
- package/build/components/header/undo-redo/redo.cjs +30 -52
- package/build/components/header/undo-redo/redo.cjs.map +1 -7
- package/build/components/header/undo-redo/undo.cjs +29 -51
- package/build/components/header/undo-redo/undo.cjs.map +1 -7
- package/build/components/keyboard-shortcut-help-modal/config.cjs +88 -85
- package/build/components/keyboard-shortcut-help-modal/config.cjs.map +1 -7
- package/build/components/keyboard-shortcut-help-modal/dynamic-shortcut.cjs +40 -57
- package/build/components/keyboard-shortcut-help-modal/dynamic-shortcut.cjs.map +1 -7
- package/build/components/keyboard-shortcut-help-modal/index.cjs +94 -161
- package/build/components/keyboard-shortcut-help-modal/index.cjs.map +1 -7
- package/build/components/keyboard-shortcut-help-modal/shortcut.cjs +37 -75
- package/build/components/keyboard-shortcut-help-modal/shortcut.cjs.map +1 -7
- package/build/components/keyboard-shortcuts/index.cjs +107 -140
- package/build/components/keyboard-shortcuts/index.cjs.map +1 -7
- package/build/components/layout/index.cjs +65 -74
- package/build/components/layout/index.cjs.map +1 -7
- package/build/components/layout/interface.cjs +82 -108
- package/build/components/layout/interface.cjs.map +1 -7
- package/build/components/layout/unsaved-changes-warning.cjs +44 -48
- package/build/components/layout/unsaved-changes-warning.cjs.map +1 -7
- package/build/components/more-menu/index.cjs +125 -191
- package/build/components/more-menu/index.cjs.map +1 -7
- package/build/components/more-menu/tools-more-menu-group.cjs +9 -29
- package/build/components/more-menu/tools-more-menu-group.cjs.map +1 -7
- package/build/components/notices/index.cjs +19 -39
- package/build/components/notices/index.cjs.map +1 -7
- package/build/components/save-button/index.cjs +31 -58
- package/build/components/save-button/index.cjs.map +1 -7
- package/build/components/secondary-sidebar/index.cjs +38 -45
- package/build/components/secondary-sidebar/index.cjs.map +1 -7
- package/build/components/secondary-sidebar/inserter-sidebar.cjs +50 -51
- package/build/components/secondary-sidebar/inserter-sidebar.cjs.map +1 -7
- package/build/components/secondary-sidebar/list-view-sidebar.cjs +51 -82
- package/build/components/secondary-sidebar/list-view-sidebar.cjs.map +1 -7
- package/build/components/sidebar/index.cjs +117 -180
- package/build/components/sidebar/index.cjs.map +1 -7
- package/build/components/sidebar/widget-areas.cjs +43 -85
- package/build/components/sidebar/widget-areas.cjs.map +1 -7
- package/build/components/welcome-guide/index.cjs +110 -186
- package/build/components/welcome-guide/index.cjs.map +1 -7
- package/build/components/widget-areas-block-editor-content/index.cjs +59 -64
- package/build/components/widget-areas-block-editor-content/index.cjs.map +1 -7
- package/build/components/widget-areas-block-editor-provider/index.cjs +105 -140
- package/build/components/widget-areas-block-editor-provider/index.cjs.map +1 -7
- package/build/constants.cjs +11 -32
- package/build/constants.cjs.map +1 -7
- package/build/filters/index.cjs +7 -4
- package/build/filters/move-to-widget-area.cjs +38 -53
- package/build/filters/move-to-widget-area.cjs.map +1 -7
- package/build/filters/replace-media-upload.cjs +11 -9
- package/build/filters/replace-media-upload.cjs.map +1 -7
- package/build/hooks/use-last-selected-widget-area.cjs +28 -49
- package/build/hooks/use-last-selected-widget-area.cjs.map +1 -7
- package/build/hooks/use-widget-library-insertion-point.cjs +33 -67
- package/build/hooks/use-widget-library-insertion-point.cjs.map +1 -7
- package/build/index.cjs +96 -97
- package/build/index.cjs.map +1 -7
- package/build/lock-unlock.cjs +10 -35
- package/build/lock-unlock.cjs.map +1 -7
- package/build/store/actions.cjs +269 -278
- package/build/store/actions.cjs.map +1 -7
- package/build/store/constants.cjs +12 -29
- package/build/store/constants.cjs.map +1 -7
- package/build/store/index.cjs +61 -52
- package/build/store/index.cjs.map +1 -7
- package/build/store/private-selectors.cjs +11 -32
- package/build/store/private-selectors.cjs.map +1 -7
- package/build/store/reducer.cjs +107 -88
- package/build/store/reducer.cjs.map +1 -7
- package/build/store/resolvers.cjs +60 -91
- package/build/store/resolvers.cjs.map +1 -7
- package/build/store/selectors.cjs +196 -229
- package/build/store/selectors.cjs.map +1 -7
- package/build/store/transformers.cjs +51 -82
- package/build/store/transformers.cjs.map +1 -7
- package/build/store/utils.cjs +76 -63
- package/build/store/utils.cjs.map +1 -7
- package/build-module/blocks/widget-area/edit/index.mjs +82 -94
- package/build-module/blocks/widget-area/edit/index.mjs.map +1 -7
- package/build-module/blocks/widget-area/edit/inner-blocks.mjs +19 -35
- package/build-module/blocks/widget-area/edit/inner-blocks.mjs.map +1 -7
- package/build-module/blocks/widget-area/edit/use-is-dragging-within.mjs +36 -33
- package/build-module/blocks/widget-area/edit/use-is-dragging-within.mjs.map +1 -7
- package/build-module/blocks/widget-area/index.mjs +12 -15
- package/build-module/blocks/widget-area/index.mjs.map +1 -7
- package/build-module/components/error-boundary/index.mjs +103 -128
- package/build-module/components/error-boundary/index.mjs.map +1 -7
- package/build-module/components/header/document-tools/index.mjs +51 -84
- package/build-module/components/header/document-tools/index.mjs.map +1 -7
- package/build-module/components/header/index.mjs +40 -47
- package/build-module/components/header/index.mjs.map +1 -7
- package/build-module/components/header/undo-redo/redo.mjs +20 -27
- package/build-module/components/header/undo-redo/redo.mjs.map +1 -7
- package/build-module/components/header/undo-redo/undo.mjs +19 -26
- package/build-module/components/header/undo-redo/undo.mjs.map +1 -7
- package/build-module/components/keyboard-shortcut-help-modal/config.mjs +83 -61
- package/build-module/components/keyboard-shortcut-help-modal/config.mjs.map +1 -7
- package/build-module/components/keyboard-shortcut-help-modal/dynamic-shortcut.mjs +19 -33
- package/build-module/components/keyboard-shortcut-help-modal/dynamic-shortcut.mjs.map +1 -7
- package/build-module/components/keyboard-shortcut-help-modal/index.mjs +67 -136
- package/build-module/components/keyboard-shortcut-help-modal/index.mjs.map +1 -7
- package/build-module/components/keyboard-shortcut-help-modal/shortcut.mjs +31 -54
- package/build-module/components/keyboard-shortcut-help-modal/shortcut.mjs.map +1 -7
- package/build-module/components/keyboard-shortcuts/index.mjs +99 -119
- package/build-module/components/keyboard-shortcuts/index.mjs.map +1 -7
- package/build-module/components/layout/index.mjs +29 -40
- package/build-module/components/layout/index.mjs.map +1 -7
- package/build-module/components/layout/interface.mjs +53 -82
- package/build-module/components/layout/interface.mjs.map +1 -7
- package/build-module/components/layout/unsaved-changes-warning.mjs +37 -26
- package/build-module/components/layout/unsaved-changes-warning.mjs.map +1 -7
- package/build-module/components/more-menu/index.mjs +95 -162
- package/build-module/components/more-menu/index.mjs.map +1 -7
- package/build-module/components/more-menu/tools-more-menu-group.mjs +5 -9
- package/build-module/components/more-menu/tools-more-menu-group.mjs.map +1 -7
- package/build-module/components/notices/index.mjs +12 -17
- package/build-module/components/notices/index.mjs.map +1 -7
- package/build-module/components/save-button/index.mjs +23 -35
- package/build-module/components/save-button/index.mjs.map +1 -7
- package/build-module/components/secondary-sidebar/index.mjs +15 -20
- package/build-module/components/secondary-sidebar/index.mjs.map +1 -7
- package/build-module/components/secondary-sidebar/inserter-sidebar.mjs +27 -25
- package/build-module/components/secondary-sidebar/inserter-sidebar.mjs.map +1 -7
- package/build-module/components/secondary-sidebar/list-view-sidebar.mjs +39 -55
- package/build-module/components/secondary-sidebar/list-view-sidebar.mjs.map +1 -7
- package/build-module/components/sidebar/index.mjs +96 -162
- package/build-module/components/sidebar/index.mjs.map +1 -7
- package/build-module/components/sidebar/widget-areas.mjs +30 -57
- package/build-module/components/sidebar/widget-areas.mjs.map +1 -7
- package/build-module/components/welcome-guide/index.mjs +103 -164
- package/build-module/components/welcome-guide/index.mjs.map +1 -7
- package/build-module/components/widget-areas-block-editor-content/index.mjs +34 -44
- package/build-module/components/widget-areas-block-editor-content/index.mjs.map +1 -7
- package/build-module/components/widget-areas-block-editor-provider/index.mjs +76 -109
- package/build-module/components/widget-areas-block-editor-provider/index.mjs.map +1 -7
- package/build-module/constants.mjs +5 -7
- package/build-module/constants.mjs.map +1 -7
- package/build-module/filters/index.mjs +0 -2
- package/build-module/filters/move-to-widget-area.mjs +28 -48
- package/build-module/filters/move-to-widget-area.mjs.map +1 -7
- package/build-module/filters/replace-media-upload.mjs +5 -8
- package/build-module/filters/replace-media-upload.mjs.map +1 -7
- package/build-module/hooks/use-last-selected-widget-area.mjs +23 -29
- package/build-module/hooks/use-last-selected-widget-area.mjs.map +1 -7
- package/build-module/hooks/use-widget-library-insertion-point.mjs +28 -47
- package/build-module/hooks/use-widget-library-insertion-point.mjs.map +1 -7
- package/build-module/index.mjs +62 -79
- package/build-module/index.mjs.map +1 -7
- package/build-module/lock-unlock.mjs +5 -10
- package/build-module/lock-unlock.mjs.map +1 -7
- package/build-module/store/actions.mjs +250 -247
- package/build-module/store/actions.mjs.map +1 -7
- package/build-module/store/constants.mjs +7 -5
- package/build-module/store/constants.mjs.map +1 -7
- package/build-module/store/index.mjs +18 -16
- package/build-module/store/index.mjs.map +1 -7
- package/build-module/store/private-selectors.mjs +5 -7
- package/build-module/store/private-selectors.mjs.map +1 -7
- package/build-module/store/reducer.mjs +95 -58
- package/build-module/store/reducer.mjs.map +1 -7
- package/build-module/store/resolvers.mjs +52 -71
- package/build-module/store/resolvers.mjs.map +1 -7
- package/build-module/store/selectors.mjs +178 -199
- package/build-module/store/selectors.mjs.map +1 -7
- package/build-module/store/transformers.mjs +44 -56
- package/build-module/store/transformers.mjs.map +1 -7
- package/build-module/store/utils.mjs +64 -32
- package/build-module/store/utils.mjs.map +1 -7
- package/package.json +33 -33
- package/src/components/header/index.jsx +2 -2
- package/src/components/sidebar/index.jsx +18 -18
- package/src/components/welcome-guide/index.jsx +4 -2
- package/build/filters/index.cjs.map +0 -7
- package/build-module/filters/index.mjs.map +0 -7
|
@@ -1,69 +1,35 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
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
|
-
|
|
19
|
-
// packages/edit-widgets/src/hooks/use-widget-library-insertion-point.js
|
|
20
|
-
var use_widget_library_insertion_point_exports = {};
|
|
21
|
-
__export(use_widget_library_insertion_point_exports, {
|
|
22
|
-
default: () => use_widget_library_insertion_point_default
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperties(exports, {
|
|
3
|
+
__esModule: { value: true },
|
|
4
|
+
[Symbol.toStringTag]: { value: "Module" }
|
|
23
5
|
});
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
return insertionPoint;
|
|
51
|
-
}
|
|
52
|
-
const clientId = getBlockSelectionEnd() || firstRootId;
|
|
53
|
-
const rootClientId = getBlockRootClientId(clientId);
|
|
54
|
-
if (clientId && rootClientId === "") {
|
|
55
|
-
return {
|
|
56
|
-
rootClientId: clientId,
|
|
57
|
-
insertionIndex: getBlockOrder(clientId).length
|
|
58
|
-
};
|
|
59
|
-
}
|
|
60
|
-
return {
|
|
61
|
-
rootClientId,
|
|
62
|
-
insertionIndex: getBlockIndex(clientId) + 1
|
|
63
|
-
};
|
|
64
|
-
},
|
|
65
|
-
[firstRootId]
|
|
66
|
-
);
|
|
6
|
+
let _wordpress_data = require("@wordpress/data");
|
|
7
|
+
let _wordpress_block_editor = require("@wordpress/block-editor");
|
|
8
|
+
let _wordpress_core_data = require("@wordpress/core-data");
|
|
9
|
+
let ___store_index_js = require("../store/index.cjs");
|
|
10
|
+
let ___store_utils_js = require("../store/utils.cjs");
|
|
11
|
+
// packages/edit-widgets/src/hooks/use-widget-library-insertion-point.js
|
|
12
|
+
const useWidgetLibraryInsertionPoint = () => {
|
|
13
|
+
const firstRootId = (0, _wordpress_data.useSelect)((select) => {
|
|
14
|
+
const { getEntityRecord } = select(_wordpress_core_data.store);
|
|
15
|
+
return getEntityRecord(___store_utils_js.KIND, ___store_utils_js.POST_TYPE, (0, ___store_utils_js.buildWidgetAreasPostId)())?.blocks[0]?.clientId;
|
|
16
|
+
}, []);
|
|
17
|
+
return (0, _wordpress_data.useSelect)((select) => {
|
|
18
|
+
const { getBlockRootClientId, getBlockSelectionEnd, getBlockOrder, getBlockIndex } = select(_wordpress_block_editor.store);
|
|
19
|
+
const insertionPoint = select(___store_index_js.store).__experimentalGetInsertionPoint();
|
|
20
|
+
if (insertionPoint.rootClientId) return insertionPoint;
|
|
21
|
+
const clientId = getBlockSelectionEnd() || firstRootId;
|
|
22
|
+
const rootClientId = getBlockRootClientId(clientId);
|
|
23
|
+
if (clientId && rootClientId === "") return {
|
|
24
|
+
rootClientId: clientId,
|
|
25
|
+
insertionIndex: getBlockOrder(clientId).length
|
|
26
|
+
};
|
|
27
|
+
return {
|
|
28
|
+
rootClientId,
|
|
29
|
+
insertionIndex: getBlockIndex(clientId) + 1
|
|
30
|
+
};
|
|
31
|
+
}, [firstRootId]);
|
|
67
32
|
};
|
|
68
|
-
|
|
69
|
-
|
|
33
|
+
exports.default = useWidgetLibraryInsertionPoint;
|
|
34
|
+
|
|
35
|
+
//# sourceMappingURL=use-widget-library-insertion-point.cjs.map
|
|
@@ -1,7 +1 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/hooks/use-widget-library-insertion-point.js"],
|
|
4
|
-
"sourcesContent": ["import { useSelect } from '@wordpress/data';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { store as coreStore } from '@wordpress/core-data';\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;AAAA,kBAA0B;AAC1B,0BAA0C;AAC1C,uBAAmC;AACnC,mBAA0C;AAC1C,mBAAwD;AAExD,IAAM,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
|
-
}
|
|
1
|
+
{"version":3,"file":"use-widget-library-insertion-point.cjs","names":["useSelect","coreStore","KIND","POST_TYPE","buildWidgetAreasPostId","blockEditorStore","editWidgetsStore"],"sources":["../../src/hooks/use-widget-library-insertion-point.js"],"sourcesContent":["import { useSelect } from '@wordpress/data';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { store as coreStore } from '@wordpress/core-data';\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":";;;;;;;;;;;AAMA,MAAM,uCAAuC;CAC5C,MAAM,eAAA,GAAcA,gBAAAA,UAAAA,EAAa,WAAY;EAE5C,MAAM,EAAE,oBAAoB,OAAQC,qBAAAA,KAAU;EAM9C,OALwB,gBACvBC,kBAAAA,MACAC,kBAAAA,YAAAA,GACAC,kBAAAA,uBAAAA,CAAuB,CAEH,CAAC,EAAE,OAAQ,EAAG,EAAE;CACtC,GAAG,CAAC,CAAE;CAEN,QAAA,GAAOJ,gBAAAA,UAAAA,EACJ,WAAY;EACb,MAAM,EACL,sBACA,sBACA,eACA,kBACG,OAAQK,wBAAAA,KAAiB;EAE7B,MAAM,iBACL,OAAQC,kBAAAA,KAAiB,CAAC,CAAC,gCAAgC;EAI5D,IAAK,eAAe,cACnB,OAAO;EAGR,MAAM,WAAW,qBAAqB,KAAK;EAC3C,MAAM,eAAe,qBAAsB,QAAS;EAKpD,IAAK,YAAY,iBAAiB,IACjC,OAAO;GACN,cAAc;GACd,gBAAgB,cAAe,QAAS,CAAC,CAAC;EAC3C;EAGD,OAAO;GACN;GACA,gBAAgB,cAAe,QAAS,IAAI;EAC7C;CACD,GACA,CAAE,WAAY,CACf;AACD"}
|
package/build/index.cjs
CHANGED
|
@@ -1,113 +1,112 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperties(exports, {
|
|
3
|
+
__esModule: { value: true },
|
|
4
|
+
[Symbol.toStringTag]: { value: "Module" }
|
|
5
|
+
});
|
|
6
|
+
// \0rolldown/runtime.js
|
|
1
7
|
var __create = Object.create;
|
|
2
8
|
var __defProp = Object.defineProperty;
|
|
3
9
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
10
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
11
|
var __getProtoOf = Object.getPrototypeOf;
|
|
6
12
|
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
13
|
var __copyProps = (to, from, except, desc) => {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
14
|
+
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
15
|
+
key = keys[i];
|
|
16
|
+
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
17
|
+
get: ((k) => from[k]).bind(null, key),
|
|
18
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
return to;
|
|
18
22
|
};
|
|
19
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
)
|
|
27
|
-
|
|
28
|
-
|
|
23
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
24
|
+
value: mod,
|
|
25
|
+
enumerable: true
|
|
26
|
+
}) : target, mod));
|
|
27
|
+
let _wordpress_blocks = require("@wordpress/blocks");
|
|
28
|
+
let _wordpress_data = require("@wordpress/data");
|
|
29
|
+
let _wordpress_deprecated = require("@wordpress/deprecated");
|
|
30
|
+
_wordpress_deprecated = __toESM(_wordpress_deprecated);
|
|
31
|
+
let _wordpress_element = require("@wordpress/element");
|
|
32
|
+
let _wordpress_block_library = require("@wordpress/block-library");
|
|
33
|
+
let _wordpress_core_data = require("@wordpress/core-data");
|
|
34
|
+
let _wordpress_widgets = require("@wordpress/widgets");
|
|
35
|
+
let _wordpress_preferences = require("@wordpress/preferences");
|
|
36
|
+
let __store_index_js = require("./store/index.cjs");
|
|
37
|
+
require("./filters/index.cjs");
|
|
38
|
+
let __blocks_widget_area_index_js = require("./blocks/widget-area/index.cjs");
|
|
39
|
+
__blocks_widget_area_index_js = __toESM(__blocks_widget_area_index_js);
|
|
40
|
+
let __components_layout_index_jsx = require("./components/layout/index.cjs");
|
|
41
|
+
__components_layout_index_jsx = __toESM(__components_layout_index_jsx);
|
|
42
|
+
let __constants_js = require("./constants.cjs");
|
|
43
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
29
44
|
// packages/edit-widgets/src/index.jsx
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
store: () => import_store2.store
|
|
36
|
-
});
|
|
37
|
-
module.exports = __toCommonJS(index_exports);
|
|
38
|
-
var import_blocks = require("@wordpress/blocks");
|
|
39
|
-
var import_data = require("@wordpress/data");
|
|
40
|
-
var import_deprecated = __toESM(require("@wordpress/deprecated"));
|
|
41
|
-
var import_element = require("@wordpress/element");
|
|
42
|
-
var import_block_library = require("@wordpress/block-library");
|
|
43
|
-
var import_core_data = require("@wordpress/core-data");
|
|
44
|
-
var import_widgets = require("@wordpress/widgets");
|
|
45
|
-
var import_preferences = require("@wordpress/preferences");
|
|
46
|
-
var import_store = require("./store/index.cjs");
|
|
47
|
-
var import_filters = require("./filters/index.cjs");
|
|
48
|
-
var widgetArea = __toESM(require("./blocks/widget-area/index.cjs"));
|
|
49
|
-
var import_layout = __toESM(require("./components/layout/index.cjs"));
|
|
50
|
-
var import_constants = require("./constants.cjs");
|
|
51
|
-
var import_store2 = require("./store/index.cjs");
|
|
52
|
-
var import_jsx_runtime = require("react/jsx-runtime");
|
|
53
|
-
var disabledBlocks = [
|
|
54
|
-
"core/more",
|
|
55
|
-
"core/freeform",
|
|
56
|
-
"core/template-part",
|
|
57
|
-
...import_constants.ALLOW_REUSABLE_BLOCKS ? [] : ["core/block"]
|
|
45
|
+
const disabledBlocks = [
|
|
46
|
+
"core/more",
|
|
47
|
+
"core/freeform",
|
|
48
|
+
"core/template-part",
|
|
49
|
+
...__constants_js.ALLOW_REUSABLE_BLOCKS ? [] : ["core/block"]
|
|
58
50
|
];
|
|
51
|
+
/**
|
|
52
|
+
* Initializes the block editor in the widgets screen.
|
|
53
|
+
*
|
|
54
|
+
* @param {string} id ID of the root element to render the screen in.
|
|
55
|
+
* @param {Object} settings Block editor settings.
|
|
56
|
+
*/
|
|
59
57
|
function initializeEditor(id, settings) {
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
settings.__experimentalFetchLinkSuggestions = (search, searchOptions) => (0, import_core_data.__experimentalFetchLinkSuggestions)(search, searchOptions, settings);
|
|
83
|
-
(0, import_blocks.setFreeformContentHandlerName)("core/html");
|
|
84
|
-
root.render(
|
|
85
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_element.StrictMode, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_layout.default, { blockEditorSettings: settings }) })
|
|
86
|
-
);
|
|
87
|
-
return root;
|
|
58
|
+
const target = document.getElementById(id);
|
|
59
|
+
const root = (0, _wordpress_element.createRoot)(target);
|
|
60
|
+
const coreBlocks = (0, _wordpress_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") || block.name.startsWith("core/term"));
|
|
62
|
+
});
|
|
63
|
+
(0, _wordpress_data.dispatch)(_wordpress_preferences.store).setDefaults("core/edit-widgets", {
|
|
64
|
+
fixedToolbar: false,
|
|
65
|
+
welcomeGuide: true,
|
|
66
|
+
showBlockBreadcrumbs: true,
|
|
67
|
+
themeStyles: true
|
|
68
|
+
});
|
|
69
|
+
(0, _wordpress_data.dispatch)(_wordpress_blocks.store).reapplyBlockTypeFilters();
|
|
70
|
+
(0, _wordpress_block_library.registerCoreBlocks)(coreBlocks);
|
|
71
|
+
(0, _wordpress_widgets.registerLegacyWidgetBlock)();
|
|
72
|
+
if (globalThis.IS_GUTENBERG_PLUGIN) (0, _wordpress_block_library.__experimentalRegisterExperimentalCoreBlocks)({ enableFSEBlocks: __constants_js.ENABLE_EXPERIMENTAL_FSE_BLOCKS });
|
|
73
|
+
(0, _wordpress_widgets.registerLegacyWidgetVariations)(settings);
|
|
74
|
+
registerBlock(__blocks_widget_area_index_js);
|
|
75
|
+
(0, _wordpress_widgets.registerWidgetGroupBlock)();
|
|
76
|
+
settings.__experimentalFetchLinkSuggestions = (search, searchOptions) => (0, _wordpress_core_data.__experimentalFetchLinkSuggestions)(search, searchOptions, settings);
|
|
77
|
+
(0, _wordpress_blocks.setFreeformContentHandlerName)("core/html");
|
|
78
|
+
root.render(/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_wordpress_element.StrictMode, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__components_layout_index_jsx.default, { blockEditorSettings: settings }) }));
|
|
79
|
+
return root;
|
|
88
80
|
}
|
|
89
|
-
|
|
81
|
+
/**
|
|
82
|
+
* Compatibility export under the old `initialize` name.
|
|
83
|
+
*/
|
|
84
|
+
const initialize = initializeEditor;
|
|
90
85
|
function reinitializeEditor() {
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
86
|
+
(0, _wordpress_deprecated.default)("wp.editWidgets.reinitializeEditor", {
|
|
87
|
+
since: "6.2",
|
|
88
|
+
version: "6.3"
|
|
89
|
+
});
|
|
95
90
|
}
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
91
|
+
/**
|
|
92
|
+
* Function to register an individual block.
|
|
93
|
+
*
|
|
94
|
+
* @param {Object} block The block to be registered.
|
|
95
|
+
*/
|
|
96
|
+
const registerBlock = (block) => {
|
|
97
|
+
if (!block) return;
|
|
98
|
+
const { metadata, settings, name } = block;
|
|
99
|
+
if (metadata) (0, _wordpress_blocks.unstable__bootstrapServerSideBlockDefinitions)({ [name]: metadata });
|
|
100
|
+
(0, _wordpress_blocks.registerBlockType)(name, settings);
|
|
105
101
|
};
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
102
|
+
exports.initialize = initialize;
|
|
103
|
+
exports.initializeEditor = initializeEditor;
|
|
104
|
+
exports.reinitializeEditor = reinitializeEditor;
|
|
105
|
+
Object.defineProperty(exports, "store", {
|
|
106
|
+
enumerable: true,
|
|
107
|
+
get: function() {
|
|
108
|
+
return __store_index_js.store;
|
|
109
|
+
}
|
|
112
110
|
});
|
|
113
|
-
|
|
111
|
+
|
|
112
|
+
//# sourceMappingURL=index.cjs.map
|
package/build/index.cjs.map
CHANGED
|
@@ -1,7 +1 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../src/index.jsx"],
|
|
4
|
-
"sourcesContent": ["import {\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';\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\tblock.name.startsWith( 'core/term' )\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;AAAA,oBAKO;AACP,kBAAyB;AACzB,wBAAuB;AACvB,qBAAuC;AACvC,2BAIO;AACP,uBAA2E;AAC3E,qBAIO;AACP,yBAA0C;AAC1C,mBAAO;AACP,qBAAO;AACP,iBAA4B;AAC5B,oBAAmB;AACnB,uBAGO;AA+FP,IAAAA,gBAAsB;AAnCnB;AA1DH,IAAM,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,KACzC,MAAM,KAAK,WAAY,WAAY;AAAA,EAErC,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,IAAM,aAAa;AAEnB,SAAS,qBAAqB;AACpC,wBAAAC,SAAY,qCAAqC;AAAA,IAChD,OAAO;AAAA,IACP,SAAS;AAAA,EACV,CAAE;AACH;AAOA,IAAM,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
|
-
}
|
|
1
|
+
{"version":3,"file":"index.cjs","names":["ALLOW_REUSABLE_BLOCKS","createRoot","__experimentalGetCoreBlocks","preferencesStore","blocksStore","ENABLE_EXPERIMENTAL_FSE_BLOCKS","widgetArea","fetchLinkSuggestions","StrictMode","Layout"],"sources":["../src/index.jsx"],"sourcesContent":["import {\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';\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\tblock.name.startsWith( 'core/term' )\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"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8BA,MAAM,iBAAiB;CACtB;CACA;CACA;CACA,GAAKA,eAAAA,wBAAwB,CAAC,IAAI,CAAE,YAAa;AAClD;;;;;;;AAQA,SAAgB,iBAAkB,IAAI,UAAW;CAChD,MAAM,SAAS,SAAS,eAAgB,EAAG;CAC3C,MAAM,QAAA,GAAOC,mBAAAA,WAAAA,CAAY,MAAO;CAEhC,MAAM,cAAA,GAAaC,yBAAAA,4BAAAA,CAA4B,CAAC,CAAC,QAAU,UAAW;EACrE,OAAO,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,KACzC,MAAM,KAAK,WAAY,WAAY;CAErC,CAAE;CAEF,CAAA,GAAA,gBAAA,SAAA,CAAUC,uBAAAA,KAAiB,CAAC,CAAC,YAAa,qBAAqB;EAC9D,cAAc;EACd,cAAc;EACd,sBAAsB;EACtB,aAAa;CACd,CAAE;CAEF,CAAA,GAAA,gBAAA,SAAA,CAAUC,kBAAAA,KAAY,CAAC,CAAC,wBAAwB;CAChD,CAAA,GAAA,yBAAA,mBAAA,CAAoB,UAAW;CAC/B,CAAA,GAAA,mBAAA,0BAAA,CAA0B;CAC1B,IAAK,WAAW,qBACf,CAAA,GAAA,yBAAA,6CAAA,CAA8C,EAC7C,iBAAiBC,eAAAA,+BAClB,CAAE;CAEH,CAAA,GAAA,mBAAA,+BAAA,CAAgC,QAAS;CACzC,cAAeC,6BAAW;CAC1B,CAAA,GAAA,mBAAA,yBAAA,CAAyB;CAEzB,SAAS,sCAAuC,QAAQ,mBAAA,GACvDC,qBAAAA,mCAAAA,CAAsB,QAAQ,eAAe,QAAS;CAMvD,CAAA,GAAA,kBAAA,8BAAA,CAA+B,WAAY;CAE3C,KAAK,OACJ,iBAAA,GAAA,kBAAA,IAAA,CAACC,mBAAAA,YAAD,EAAA,UACC,iBAAA,GAAA,kBAAA,IAAA,CAACC,8BAAAA,SAAD,EAAQ,qBAAsB,SAAY,CAAA,EAC/B,CAAA,CACb;CAEA,OAAO;AACR;;;;AAKA,MAAa,aAAa;AAE1B,SAAgB,qBAAqB;CACpC,CAAA,GAAA,sBAAA,QAAA,CAAY,qCAAqC;EAChD,OAAO;EACP,SAAS;CACV,CAAE;AACH;;;;;;AAOA,MAAM,iBAAkB,UAAW;CAClC,IAAK,CAAE,OACN;CAED,MAAM,EAAE,UAAU,UAAU,SAAS;CACrC,IAAK,UACJ,CAAA,GAAA,kBAAA,8CAAA,CAA+C,GAAI,OAAQ,SAAS,CAAE;CAEvE,CAAA,GAAA,kBAAA,kBAAA,CAAmB,MAAM,QAAS;AACnC"}
|
package/build/lock-unlock.cjs
CHANGED
|
@@ -1,36 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
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
|
-
|
|
19
|
-
// packages/edit-widgets/src/lock-unlock.js
|
|
20
|
-
var lock_unlock_exports = {};
|
|
21
|
-
__export(lock_unlock_exports, {
|
|
22
|
-
lock: () => lock,
|
|
23
|
-
unlock: () => unlock
|
|
24
|
-
});
|
|
25
|
-
module.exports = __toCommonJS(lock_unlock_exports);
|
|
26
|
-
var import_private_apis = require("@wordpress/private-apis");
|
|
27
|
-
var { lock, unlock } = (0, import_private_apis.__dangerousOptInToUnstableAPIsOnlyForCoreModules)(
|
|
28
|
-
"I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.",
|
|
29
|
-
"@wordpress/edit-widgets"
|
|
30
|
-
);
|
|
31
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
32
|
-
0 && (module.exports = {
|
|
33
|
-
lock,
|
|
34
|
-
unlock
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperties(exports, {
|
|
3
|
+
__esModule: { value: true },
|
|
4
|
+
[Symbol.toStringTag]: { value: "Module" }
|
|
35
5
|
});
|
|
36
|
-
|
|
6
|
+
// packages/edit-widgets/src/lock-unlock.js
|
|
7
|
+
const { lock, unlock } = (0, require("@wordpress/private-apis").__dangerousOptInToUnstableAPIsOnlyForCoreModules)("I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.", "@wordpress/edit-widgets");
|
|
8
|
+
exports.lock = lock;
|
|
9
|
+
exports.unlock = unlock;
|
|
10
|
+
|
|
11
|
+
//# sourceMappingURL=lock-unlock.cjs.map
|
|
@@ -1,7 +1 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../src/lock-unlock.js"],
|
|
4
|
-
"sourcesContent": ["import { __dangerousOptInToUnstableAPIsOnlyForCoreModules } from '@wordpress/private-apis';\n\nexport const { lock, unlock } =\n\t__dangerousOptInToUnstableAPIsOnlyForCoreModules(\n\t\t'I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.',\n\t\t'@wordpress/edit-widgets'\n\t);\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,0BAAiE;AAE1D,IAAM,EAAE,MAAM,OAAO,QAC3B;AAAA,EACC;AAAA,EACA;AACD;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
1
|
+
{"version":3,"file":"lock-unlock.cjs","names":["__dangerousOptInToUnstableAPIsOnlyForCoreModules"],"sources":["../src/lock-unlock.js"],"sourcesContent":["import { __dangerousOptInToUnstableAPIsOnlyForCoreModules } from '@wordpress/private-apis';\n\nexport const { lock, unlock } =\n\t__dangerousOptInToUnstableAPIsOnlyForCoreModules(\n\t\t'I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.',\n\t\t'@wordpress/edit-widgets'\n\t);\n"],"mappings":";;;;;;AAEA,MAAa,EAAE,MAAM,YAAA,G,iCACpBA,CAAAA,CAAAA,iDAAAA,CACC,iIACA,yBACD"}
|