@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,55 +1,48 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import { store as coreStore } from '@wordpress/core-data';
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* Internal dependencies
|
|
10
|
-
*/
|
|
11
|
-
import { store as editWidgetsStore } from '../store';
|
|
12
|
-
import { buildWidgetAreasPostId, KIND, POST_TYPE } from '../store/utils';
|
|
1
|
+
import { useSelect } from "@wordpress/data";
|
|
2
|
+
import { store as blockEditorStore } from "@wordpress/block-editor";
|
|
3
|
+
import { store as coreStore } from "@wordpress/core-data";
|
|
4
|
+
import { store as editWidgetsStore } from "../store";
|
|
5
|
+
import { buildWidgetAreasPostId, KIND, POST_TYPE } from "../store/utils";
|
|
13
6
|
const useWidgetLibraryInsertionPoint = () => {
|
|
14
|
-
const firstRootId = useSelect(select => {
|
|
15
|
-
|
|
16
|
-
const
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
7
|
+
const firstRootId = useSelect((select) => {
|
|
8
|
+
const { getEntityRecord } = select(coreStore);
|
|
9
|
+
const widgetAreasPost = getEntityRecord(
|
|
10
|
+
KIND,
|
|
11
|
+
POST_TYPE,
|
|
12
|
+
buildWidgetAreasPostId()
|
|
13
|
+
);
|
|
20
14
|
return widgetAreasPost?.blocks[0]?.clientId;
|
|
21
15
|
}, []);
|
|
22
|
-
return useSelect(
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
if (clientId && rootClientId === '') {
|
|
16
|
+
return useSelect(
|
|
17
|
+
(select) => {
|
|
18
|
+
const {
|
|
19
|
+
getBlockRootClientId,
|
|
20
|
+
getBlockSelectionEnd,
|
|
21
|
+
getBlockOrder,
|
|
22
|
+
getBlockIndex
|
|
23
|
+
} = select(blockEditorStore);
|
|
24
|
+
const insertionPoint = select(editWidgetsStore).__experimentalGetInsertionPoint();
|
|
25
|
+
if (insertionPoint.rootClientId) {
|
|
26
|
+
return insertionPoint;
|
|
27
|
+
}
|
|
28
|
+
const clientId = getBlockSelectionEnd() || firstRootId;
|
|
29
|
+
const rootClientId = getBlockRootClientId(clientId);
|
|
30
|
+
if (clientId && rootClientId === "") {
|
|
31
|
+
return {
|
|
32
|
+
rootClientId: clientId,
|
|
33
|
+
insertionIndex: getBlockOrder(clientId).length
|
|
34
|
+
};
|
|
35
|
+
}
|
|
43
36
|
return {
|
|
44
|
-
rootClientId
|
|
45
|
-
insertionIndex:
|
|
37
|
+
rootClientId,
|
|
38
|
+
insertionIndex: getBlockIndex(clientId) + 1
|
|
46
39
|
};
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
insertionIndex: getBlockIndex(clientId) + 1
|
|
51
|
-
};
|
|
52
|
-
}, [firstRootId]);
|
|
40
|
+
},
|
|
41
|
+
[firstRootId]
|
|
42
|
+
);
|
|
53
43
|
};
|
|
54
|
-
|
|
55
|
-
|
|
44
|
+
var use_widget_library_insertion_point_default = useWidgetLibraryInsertionPoint;
|
|
45
|
+
export {
|
|
46
|
+
use_widget_library_insertion_point_default as default
|
|
47
|
+
};
|
|
48
|
+
//# 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": "AAGA,SAAS,iBAAiB;AAC1B,SAAS,SAAS,wBAAwB;AAC1C,SAAS,SAAS,iBAAiB;AAKnC,SAAS,SAAS,wBAAwB;AAC1C,SAAS,wBAAwB,MAAM,iBAAiB;AAExD,MAAM,iCAAiC,MAAM;AAC5C,QAAM,cAAc,UAAW,CAAE,WAAY;AAE5C,UAAM,EAAE,gBAAgB,IAAI,OAAQ,SAAU;AAC9C,UAAM,kBAAkB;AAAA,MACvB;AAAA,MACA;AAAA,MACA,uBAAuB;AAAA,IACxB;AACA,WAAO,iBAAiB,OAAQ,CAAE,GAAG;AAAA,EACtC,GAAG,CAAC,CAAE;AAEN,SAAO;AAAA,IACN,CAAE,WAAY;AACb,YAAM;AAAA,QACL;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,MACD,IAAI,OAAQ,gBAAiB;AAE7B,YAAM,iBACL,OAAQ,gBAAiB,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": []
|
|
7
|
+
}
|
package/build-module/index.js
CHANGED
|
@@ -1,41 +1,46 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
import {
|
|
23
|
-
import
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import {
|
|
3
|
+
registerBlockType,
|
|
4
|
+
unstable__bootstrapServerSideBlockDefinitions,
|
|
5
|
+
setFreeformContentHandlerName,
|
|
6
|
+
store as blocksStore
|
|
7
|
+
} from "@wordpress/blocks";
|
|
8
|
+
import { dispatch } from "@wordpress/data";
|
|
9
|
+
import deprecated from "@wordpress/deprecated";
|
|
10
|
+
import { StrictMode, createRoot } from "@wordpress/element";
|
|
11
|
+
import {
|
|
12
|
+
registerCoreBlocks,
|
|
13
|
+
__experimentalGetCoreBlocks,
|
|
14
|
+
__experimentalRegisterExperimentalCoreBlocks
|
|
15
|
+
} from "@wordpress/block-library";
|
|
16
|
+
import { __experimentalFetchLinkSuggestions as fetchLinkSuggestions } from "@wordpress/core-data";
|
|
17
|
+
import {
|
|
18
|
+
registerLegacyWidgetBlock,
|
|
19
|
+
registerLegacyWidgetVariations,
|
|
20
|
+
registerWidgetGroupBlock
|
|
21
|
+
} from "@wordpress/widgets";
|
|
22
|
+
import { store as preferencesStore } from "@wordpress/preferences";
|
|
23
|
+
import "./store";
|
|
24
|
+
import "./filters";
|
|
25
|
+
import * as widgetArea from "./blocks/widget-area";
|
|
26
|
+
import Layout from "./components/layout";
|
|
27
|
+
import {
|
|
28
|
+
ALLOW_REUSABLE_BLOCKS,
|
|
29
|
+
ENABLE_EXPERIMENTAL_FSE_BLOCKS
|
|
30
|
+
} from "./constants";
|
|
31
|
+
const disabledBlocks = [
|
|
32
|
+
"core/more",
|
|
33
|
+
"core/freeform",
|
|
34
|
+
"core/template-part",
|
|
35
|
+
...ALLOW_REUSABLE_BLOCKS ? [] : ["core/block"]
|
|
36
|
+
];
|
|
37
|
+
function initializeEditor(id, settings) {
|
|
33
38
|
const target = document.getElementById(id);
|
|
34
39
|
const root = createRoot(target);
|
|
35
|
-
const coreBlocks = __experimentalGetCoreBlocks().filter(block => {
|
|
36
|
-
return !(disabledBlocks.includes(block.name) || block.name.startsWith(
|
|
40
|
+
const coreBlocks = __experimentalGetCoreBlocks().filter((block) => {
|
|
41
|
+
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"));
|
|
37
42
|
});
|
|
38
|
-
dispatch(preferencesStore).setDefaults(
|
|
43
|
+
dispatch(preferencesStore).setDefaults("core/edit-widgets", {
|
|
39
44
|
fixedToolbar: false,
|
|
40
45
|
welcomeGuide: true,
|
|
41
46
|
showBlockBreadcrumbs: true,
|
|
@@ -53,51 +58,34 @@ export function initializeEditor(id, settings) {
|
|
|
53
58
|
registerBlock(widgetArea);
|
|
54
59
|
registerWidgetGroupBlock();
|
|
55
60
|
settings.__experimentalFetchLinkSuggestions = (search, searchOptions) => fetchLinkSuggestions(search, searchOptions, settings);
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
// see: https://github.com/WordPress/gutenberg/issues/33097
|
|
61
|
-
setFreeformContentHandlerName('core/html');
|
|
62
|
-
root.render(/*#__PURE__*/_jsx(StrictMode, {
|
|
63
|
-
children: /*#__PURE__*/_jsx(Layout, {
|
|
64
|
-
blockEditorSettings: settings
|
|
65
|
-
})
|
|
66
|
-
}));
|
|
61
|
+
setFreeformContentHandlerName("core/html");
|
|
62
|
+
root.render(
|
|
63
|
+
/* @__PURE__ */ jsx(StrictMode, { children: /* @__PURE__ */ jsx(Layout, { blockEditorSettings: settings }) })
|
|
64
|
+
);
|
|
67
65
|
return root;
|
|
68
66
|
}
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
export function reinitializeEditor() {
|
|
75
|
-
deprecated('wp.editWidgets.reinitializeEditor', {
|
|
76
|
-
since: '6.2',
|
|
77
|
-
version: '6.3'
|
|
67
|
+
const initialize = initializeEditor;
|
|
68
|
+
function reinitializeEditor() {
|
|
69
|
+
deprecated("wp.editWidgets.reinitializeEditor", {
|
|
70
|
+
since: "6.2",
|
|
71
|
+
version: "6.3"
|
|
78
72
|
});
|
|
79
73
|
}
|
|
80
|
-
|
|
81
|
-
/**
|
|
82
|
-
* Function to register an individual block.
|
|
83
|
-
*
|
|
84
|
-
* @param {Object} block The block to be registered.
|
|
85
|
-
*/
|
|
86
|
-
const registerBlock = block => {
|
|
74
|
+
const registerBlock = (block) => {
|
|
87
75
|
if (!block) {
|
|
88
76
|
return;
|
|
89
77
|
}
|
|
90
|
-
const {
|
|
91
|
-
metadata,
|
|
92
|
-
settings,
|
|
93
|
-
name
|
|
94
|
-
} = block;
|
|
78
|
+
const { metadata, settings, name } = block;
|
|
95
79
|
if (metadata) {
|
|
96
|
-
unstable__bootstrapServerSideBlockDefinitions({
|
|
97
|
-
[name]: metadata
|
|
98
|
-
});
|
|
80
|
+
unstable__bootstrapServerSideBlockDefinitions({ [name]: metadata });
|
|
99
81
|
}
|
|
100
82
|
registerBlockType(name, settings);
|
|
101
83
|
};
|
|
102
|
-
|
|
103
|
-
|
|
84
|
+
import { store } from "./store";
|
|
85
|
+
export {
|
|
86
|
+
initialize,
|
|
87
|
+
initializeEditor,
|
|
88
|
+
reinitializeEditor,
|
|
89
|
+
store
|
|
90
|
+
};
|
|
91
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -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": "AA8FG;AA3FH;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,EACA,SAAS;AAAA,OACH;AACP,SAAS,gBAAgB;AACzB,OAAO,gBAAgB;AACvB,SAAS,YAAY,kBAAkB;AACvC;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,OACM;AACP,SAAS,sCAAsC,4BAA4B;AAC3E;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,OACM;AACP,SAAS,SAAS,wBAAwB;AAK1C,OAAO;AACP,OAAO;AACP,YAAY,gBAAgB;AAC5B,OAAO,YAAY;AACnB;AAAA,EACC;AAAA,EACA;AAAA,OACM;AAEP,MAAM,iBAAiB;AAAA,EACtB;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAK,wBAAwB,CAAC,IAAI,CAAE,YAAa;AAClD;AAQO,SAAS,iBAAkB,IAAI,UAAW;AAChD,QAAM,SAAS,SAAS,eAAgB,EAAG;AAC3C,QAAM,OAAO,WAAY,MAAO;AAEhC,QAAM,aAAa,4BAA4B,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,WAAU,gBAAiB,EAAE,YAAa,qBAAqB;AAAA,IAC9D,cAAc;AAAA,IACd,cAAc;AAAA,IACd,sBAAsB;AAAA,IACtB,aAAa;AAAA,EACd,CAAE;AAEF,WAAU,WAAY,EAAE,wBAAwB;AAChD,qBAAoB,UAAW;AAC/B,4BAA0B;AAC1B,MAAK,WAAW,qBAAsB;AACrC,iDAA8C;AAAA,MAC7C,iBAAiB;AAAA,IAClB,CAAE;AAAA,EACH;AACA,iCAAgC,QAAS;AACzC,gBAAe,UAAW;AAC1B,2BAAyB;AAEzB,WAAS,qCAAqC,CAAE,QAAQ,kBACvD,qBAAsB,QAAQ,eAAe,QAAS;AAMvD,gCAA+B,WAAY;AAE3C,OAAK;AAAA,IACJ,oBAAC,cACA,8BAAC,UAAO,qBAAsB,UAAW,GAC1C;AAAA,EACD;AAEA,SAAO;AACR;AAKO,MAAM,aAAa;AAEnB,SAAS,qBAAqB;AACpC,aAAY,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,kDAA+C,EAAE,CAAE,IAAK,GAAG,SAAS,CAAE;AAAA,EACvE;AACA,oBAAmB,MAAM,QAAS;AACnC;AAEA,SAAS,aAAa;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import { __dangerousOptInToUnstableAPIsOnlyForCoreModules } from "@wordpress/private-apis";
|
|
2
|
+
const { lock, unlock } = __dangerousOptInToUnstableAPIsOnlyForCoreModules(
|
|
3
|
+
"I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.",
|
|
4
|
+
"@wordpress/edit-widgets"
|
|
5
|
+
);
|
|
6
|
+
export {
|
|
6
7
|
lock,
|
|
7
8
|
unlock
|
|
8
|
-
}
|
|
9
|
-
//# sourceMappingURL=lock-unlock.js.map
|
|
9
|
+
};
|
|
10
|
+
//# sourceMappingURL=lock-unlock.js.map
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/lock-unlock.js"],
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __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": "AAGA,SAAS,wDAAwD;AAE1D,MAAM,EAAE,MAAM,OAAO,IAC3B;AAAA,EACC;AAAA,EACA;AACD;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|