@wordpress/edit-widgets 6.31.1-next.f56bd8138.0 → 6.32.1-next.47f435fc9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +2 -0
- 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/components/widget-areas-block-editor-content/index.js"],
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport {\n\tBlockList,\n\tBlockToolbar,\n\tBlockTools,\n\tBlockSelectionClearer,\n\tWritingFlow,\n\t__unstableEditorStyles as EditorStyles,\n} from '@wordpress/block-editor';\nimport { useViewportMatch } from '@wordpress/compose';\nimport { useSelect } from '@wordpress/data';\nimport { useMemo } from '@wordpress/element';\nimport { store as preferencesStore } from '@wordpress/preferences';\n\n/**\n * Internal dependencies\n */\nimport Notices from '../notices';\nimport KeyboardShortcuts from '../keyboard-shortcuts';\n\nexport default function WidgetAreasBlockEditorContent( {\n\tblockEditorSettings,\n} ) {\n\tconst hasThemeStyles = useSelect(\n\t\t( select ) =>\n\t\t\t!! select( preferencesStore ).get(\n\t\t\t\t'core/edit-widgets',\n\t\t\t\t'themeStyles'\n\t\t\t),\n\t\t[]\n\t);\n\tconst isLargeViewport = useViewportMatch( 'medium' );\n\n\tconst styles = useMemo( () => {\n\t\treturn hasThemeStyles ? blockEditorSettings.styles : [];\n\t}, [ blockEditorSettings, hasThemeStyles ] );\n\n\treturn (\n\t\t<div className=\"edit-widgets-block-editor\">\n\t\t\t<Notices />\n\t\t\t{ ! isLargeViewport && <BlockToolbar hideDragHandle /> }\n\t\t\t<BlockTools>\n\t\t\t\t<KeyboardShortcuts />\n\t\t\t\t<EditorStyles\n\t\t\t\t\tstyles={ styles }\n\t\t\t\t\tscope=\":where(.editor-styles-wrapper)\"\n\t\t\t\t/>\n\t\t\t\t<BlockSelectionClearer>\n\t\t\t\t\t<WritingFlow>\n\t\t\t\t\t\t<BlockList className=\"edit-widgets-main-block-list\" />\n\t\t\t\t\t</WritingFlow>\n\t\t\t\t</BlockSelectionClearer>\n\t\t\t</BlockTools>\n\t\t</div>\n\t);\n}\n"],
|
|
5
|
+
"mappings": "AAyCG,cAEA,YAFA;AAtCH;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,0BAA0B;AAAA,OACpB;AACP,SAAS,wBAAwB;AACjC,SAAS,iBAAiB;AAC1B,SAAS,eAAe;AACxB,SAAS,SAAS,wBAAwB;AAK1C,OAAO,aAAa;AACpB,OAAO,uBAAuB;AAEf,SAAR,8BAAgD;AAAA,EACtD;AACD,GAAI;AACH,QAAM,iBAAiB;AAAA,IACtB,CAAE,WACD,CAAC,CAAE,OAAQ,gBAAiB,EAAE;AAAA,MAC7B;AAAA,MACA;AAAA,IACD;AAAA,IACD,CAAC;AAAA,EACF;AACA,QAAM,kBAAkB,iBAAkB,QAAS;AAEnD,QAAM,SAAS,QAAS,MAAM;AAC7B,WAAO,iBAAiB,oBAAoB,SAAS,CAAC;AAAA,EACvD,GAAG,CAAE,qBAAqB,cAAe,CAAE;AAE3C,SACC,qBAAC,SAAI,WAAU,6BACd;AAAA,wBAAC,WAAQ;AAAA,IACP,CAAE,mBAAmB,oBAAC,gBAAa,gBAAc,MAAC;AAAA,IACpD,qBAAC,cACA;AAAA,0BAAC,qBAAkB;AAAA,MACnB;AAAA,QAAC;AAAA;AAAA,UACA;AAAA,UACA,OAAM;AAAA;AAAA,MACP;AAAA,MACA,oBAAC,yBACA,8BAAC,eACA,8BAAC,aAAU,WAAU,gCAA+B,GACrD,GACD;AAAA,OACD;AAAA,KACD;AAEF;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1,43 +1,30 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import { privateApis as
|
|
12
|
-
import
|
|
13
|
-
import {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
import { store as editWidgetsStore } from '../../store';
|
|
22
|
-
import { ALLOW_REUSABLE_BLOCKS } from '../../constants';
|
|
23
|
-
import { unlock } from '../../lock-unlock';
|
|
24
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
25
|
-
const {
|
|
26
|
-
ExperimentalBlockEditorProvider
|
|
27
|
-
} = unlock(blockEditorPrivateApis);
|
|
28
|
-
const {
|
|
29
|
-
PatternsMenuItems
|
|
30
|
-
} = unlock(editPatternsPrivateApis);
|
|
31
|
-
const {
|
|
32
|
-
BlockKeyboardShortcuts
|
|
33
|
-
} = unlock(blockLibraryPrivateApis);
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { SlotFillProvider } from "@wordpress/components";
|
|
3
|
+
import { useViewportMatch } from "@wordpress/compose";
|
|
4
|
+
import { uploadMedia } from "@wordpress/media-utils";
|
|
5
|
+
import { useDispatch, useSelect } from "@wordpress/data";
|
|
6
|
+
import { useEntityBlockEditor, store as coreStore } from "@wordpress/core-data";
|
|
7
|
+
import { useMemo } from "@wordpress/element";
|
|
8
|
+
import { privateApis as blockEditorPrivateApis } from "@wordpress/block-editor";
|
|
9
|
+
import { privateApis as editPatternsPrivateApis } from "@wordpress/patterns";
|
|
10
|
+
import { store as preferencesStore } from "@wordpress/preferences";
|
|
11
|
+
import { privateApis as blockLibraryPrivateApis } from "@wordpress/block-library";
|
|
12
|
+
import KeyboardShortcuts from "../keyboard-shortcuts";
|
|
13
|
+
import { buildWidgetAreasPostId, KIND, POST_TYPE } from "../../store/utils";
|
|
14
|
+
import useLastSelectedWidgetArea from "../../hooks/use-last-selected-widget-area";
|
|
15
|
+
import { store as editWidgetsStore } from "../../store";
|
|
16
|
+
import { ALLOW_REUSABLE_BLOCKS } from "../../constants";
|
|
17
|
+
import { unlock } from "../../lock-unlock";
|
|
18
|
+
const { ExperimentalBlockEditorProvider } = unlock(blockEditorPrivateApis);
|
|
19
|
+
const { PatternsMenuItems } = unlock(editPatternsPrivateApis);
|
|
20
|
+
const { BlockKeyboardShortcuts } = unlock(blockLibraryPrivateApis);
|
|
34
21
|
const EMPTY_ARRAY = [];
|
|
35
|
-
|
|
22
|
+
function WidgetAreasBlockEditorProvider({
|
|
36
23
|
blockEditorSettings,
|
|
37
24
|
children,
|
|
38
25
|
...props
|
|
39
26
|
}) {
|
|
40
|
-
const isLargeViewport = useViewportMatch(
|
|
27
|
+
const isLargeViewport = useViewportMatch("medium");
|
|
41
28
|
const {
|
|
42
29
|
hasUploadPermissions,
|
|
43
30
|
reusableBlocks,
|
|
@@ -45,44 +32,38 @@ export default function WidgetAreasBlockEditorProvider({
|
|
|
45
32
|
keepCaretInsideBlock,
|
|
46
33
|
pageOnFront,
|
|
47
34
|
pageForPosts
|
|
48
|
-
} = useSelect(select => {
|
|
49
|
-
|
|
50
|
-
const {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
} = select(coreStore);
|
|
55
|
-
const siteSettings = canUser('read', {
|
|
56
|
-
kind: 'root',
|
|
57
|
-
name: 'site'
|
|
58
|
-
}) ? getEntityRecord('root', 'site') : undefined;
|
|
35
|
+
} = useSelect((select) => {
|
|
36
|
+
const { canUser, getEntityRecord, getEntityRecords } = select(coreStore);
|
|
37
|
+
const siteSettings = canUser("read", {
|
|
38
|
+
kind: "root",
|
|
39
|
+
name: "site"
|
|
40
|
+
}) ? getEntityRecord("root", "site") : void 0;
|
|
59
41
|
return {
|
|
60
|
-
hasUploadPermissions:
|
|
61
|
-
kind:
|
|
62
|
-
name:
|
|
63
|
-
})
|
|
64
|
-
reusableBlocks: ALLOW_REUSABLE_BLOCKS ? getEntityRecords(
|
|
65
|
-
isFixedToolbarActive: !!select(preferencesStore).get(
|
|
66
|
-
|
|
42
|
+
hasUploadPermissions: canUser("create", {
|
|
43
|
+
kind: "postType",
|
|
44
|
+
name: "attachment"
|
|
45
|
+
}) ?? true,
|
|
46
|
+
reusableBlocks: ALLOW_REUSABLE_BLOCKS ? getEntityRecords("postType", "wp_block") : EMPTY_ARRAY,
|
|
47
|
+
isFixedToolbarActive: !!select(preferencesStore).get(
|
|
48
|
+
"core/edit-widgets",
|
|
49
|
+
"fixedToolbar"
|
|
50
|
+
),
|
|
51
|
+
keepCaretInsideBlock: !!select(preferencesStore).get(
|
|
52
|
+
"core/edit-widgets",
|
|
53
|
+
"keepCaretInsideBlock"
|
|
54
|
+
),
|
|
67
55
|
pageOnFront: siteSettings?.page_on_front,
|
|
68
56
|
pageForPosts: siteSettings?.page_for_posts
|
|
69
57
|
};
|
|
70
58
|
}, []);
|
|
71
|
-
const {
|
|
72
|
-
setIsInserterOpened
|
|
73
|
-
} = useDispatch(editWidgetsStore);
|
|
59
|
+
const { setIsInserterOpened } = useDispatch(editWidgetsStore);
|
|
74
60
|
const settings = useMemo(() => {
|
|
75
61
|
let mediaUploadBlockEditor;
|
|
76
62
|
if (hasUploadPermissions) {
|
|
77
|
-
mediaUploadBlockEditor = ({
|
|
78
|
-
onError,
|
|
79
|
-
...argumentsObject
|
|
80
|
-
}) => {
|
|
63
|
+
mediaUploadBlockEditor = ({ onError, ...argumentsObject }) => {
|
|
81
64
|
uploadMedia({
|
|
82
65
|
wpAllowedMimeTypes: blockEditorSettings.allowedMimeTypes,
|
|
83
|
-
onError: ({
|
|
84
|
-
message
|
|
85
|
-
}) => onError(message),
|
|
66
|
+
onError: ({ message }) => onError(message),
|
|
86
67
|
...argumentsObject
|
|
87
68
|
});
|
|
88
69
|
};
|
|
@@ -93,29 +74,50 @@ export default function WidgetAreasBlockEditorProvider({
|
|
|
93
74
|
hasFixedToolbar: isFixedToolbarActive || !isLargeViewport,
|
|
94
75
|
keepCaretInsideBlock,
|
|
95
76
|
mediaUpload: mediaUploadBlockEditor,
|
|
96
|
-
templateLock:
|
|
77
|
+
templateLock: "all",
|
|
97
78
|
__experimentalSetIsInserterOpened: setIsInserterOpened,
|
|
98
79
|
pageOnFront,
|
|
99
80
|
pageForPosts,
|
|
100
|
-
editorTool:
|
|
81
|
+
editorTool: "edit"
|
|
101
82
|
};
|
|
102
|
-
}, [
|
|
83
|
+
}, [
|
|
84
|
+
hasUploadPermissions,
|
|
85
|
+
blockEditorSettings,
|
|
86
|
+
isFixedToolbarActive,
|
|
87
|
+
isLargeViewport,
|
|
88
|
+
keepCaretInsideBlock,
|
|
89
|
+
reusableBlocks,
|
|
90
|
+
setIsInserterOpened,
|
|
91
|
+
pageOnFront,
|
|
92
|
+
pageForPosts
|
|
93
|
+
]);
|
|
103
94
|
const widgetAreaId = useLastSelectedWidgetArea();
|
|
104
|
-
const [blocks, onInput, onChange] = useEntityBlockEditor(
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
95
|
+
const [blocks, onInput, onChange] = useEntityBlockEditor(
|
|
96
|
+
KIND,
|
|
97
|
+
POST_TYPE,
|
|
98
|
+
{ id: buildWidgetAreasPostId() }
|
|
99
|
+
);
|
|
100
|
+
return /* @__PURE__ */ jsxs(SlotFillProvider, { children: [
|
|
101
|
+
/* @__PURE__ */ jsx(KeyboardShortcuts.Register, {}),
|
|
102
|
+
/* @__PURE__ */ jsx(BlockKeyboardShortcuts, {}),
|
|
103
|
+
/* @__PURE__ */ jsxs(
|
|
104
|
+
ExperimentalBlockEditorProvider,
|
|
105
|
+
{
|
|
106
|
+
value: blocks,
|
|
107
|
+
onInput,
|
|
108
|
+
onChange,
|
|
109
|
+
settings,
|
|
110
|
+
useSubRegistry: false,
|
|
111
|
+
...props,
|
|
112
|
+
children: [
|
|
113
|
+
children,
|
|
114
|
+
/* @__PURE__ */ jsx(PatternsMenuItems, { rootClientId: widgetAreaId })
|
|
115
|
+
]
|
|
116
|
+
}
|
|
117
|
+
)
|
|
118
|
+
] });
|
|
120
119
|
}
|
|
121
|
-
|
|
120
|
+
export {
|
|
121
|
+
WidgetAreasBlockEditorProvider as default
|
|
122
|
+
};
|
|
123
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/components/widget-areas-block-editor-provider/index.js"],
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { SlotFillProvider } from '@wordpress/components';\nimport { useViewportMatch } from '@wordpress/compose';\nimport { uploadMedia } from '@wordpress/media-utils';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { useEntityBlockEditor, store as coreStore } from '@wordpress/core-data';\nimport { useMemo } from '@wordpress/element';\nimport { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';\nimport { privateApis as editPatternsPrivateApis } from '@wordpress/patterns';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport { privateApis as blockLibraryPrivateApis } from '@wordpress/block-library';\n\n/**\n * Internal dependencies\n */\nimport KeyboardShortcuts from '../keyboard-shortcuts';\nimport { buildWidgetAreasPostId, KIND, POST_TYPE } from '../../store/utils';\nimport useLastSelectedWidgetArea from '../../hooks/use-last-selected-widget-area';\nimport { store as editWidgetsStore } from '../../store';\nimport { ALLOW_REUSABLE_BLOCKS } from '../../constants';\nimport { unlock } from '../../lock-unlock';\n\nconst { ExperimentalBlockEditorProvider } = unlock( blockEditorPrivateApis );\nconst { PatternsMenuItems } = unlock( editPatternsPrivateApis );\nconst { BlockKeyboardShortcuts } = unlock( blockLibraryPrivateApis );\n\nconst EMPTY_ARRAY = [];\n\nexport default function WidgetAreasBlockEditorProvider( {\n\tblockEditorSettings,\n\tchildren,\n\t...props\n} ) {\n\tconst isLargeViewport = useViewportMatch( 'medium' );\n\tconst {\n\t\thasUploadPermissions,\n\t\treusableBlocks,\n\t\tisFixedToolbarActive,\n\t\tkeepCaretInsideBlock,\n\t\tpageOnFront,\n\t\tpageForPosts,\n\t} = useSelect( ( select ) => {\n\t\tconst { canUser, getEntityRecord, getEntityRecords } =\n\t\t\tselect( coreStore );\n\t\tconst siteSettings = canUser( 'read', {\n\t\t\tkind: 'root',\n\t\t\tname: 'site',\n\t\t} )\n\t\t\t? getEntityRecord( 'root', 'site' )\n\t\t\t: undefined;\n\t\treturn {\n\t\t\thasUploadPermissions:\n\t\t\t\tcanUser( 'create', {\n\t\t\t\t\tkind: 'postType',\n\t\t\t\t\tname: 'attachment',\n\t\t\t\t} ) ?? true,\n\t\t\treusableBlocks: ALLOW_REUSABLE_BLOCKS\n\t\t\t\t? getEntityRecords( 'postType', 'wp_block' )\n\t\t\t\t: EMPTY_ARRAY,\n\t\t\tisFixedToolbarActive: !! select( preferencesStore ).get(\n\t\t\t\t'core/edit-widgets',\n\t\t\t\t'fixedToolbar'\n\t\t\t),\n\t\t\tkeepCaretInsideBlock: !! select( preferencesStore ).get(\n\t\t\t\t'core/edit-widgets',\n\t\t\t\t'keepCaretInsideBlock'\n\t\t\t),\n\t\t\tpageOnFront: siteSettings?.page_on_front,\n\t\t\tpageForPosts: siteSettings?.page_for_posts,\n\t\t};\n\t}, [] );\n\tconst { setIsInserterOpened } = useDispatch( editWidgetsStore );\n\n\tconst settings = useMemo( () => {\n\t\tlet mediaUploadBlockEditor;\n\t\tif ( hasUploadPermissions ) {\n\t\t\tmediaUploadBlockEditor = ( { onError, ...argumentsObject } ) => {\n\t\t\t\tuploadMedia( {\n\t\t\t\t\twpAllowedMimeTypes: blockEditorSettings.allowedMimeTypes,\n\t\t\t\t\tonError: ( { message } ) => onError( message ),\n\t\t\t\t\t...argumentsObject,\n\t\t\t\t} );\n\t\t\t};\n\t\t}\n\t\treturn {\n\t\t\t...blockEditorSettings,\n\t\t\t__experimentalReusableBlocks: reusableBlocks,\n\t\t\thasFixedToolbar: isFixedToolbarActive || ! isLargeViewport,\n\t\t\tkeepCaretInsideBlock,\n\t\t\tmediaUpload: mediaUploadBlockEditor,\n\t\t\ttemplateLock: 'all',\n\t\t\t__experimentalSetIsInserterOpened: setIsInserterOpened,\n\t\t\tpageOnFront,\n\t\t\tpageForPosts,\n\t\t\teditorTool: 'edit',\n\t\t};\n\t}, [\n\t\thasUploadPermissions,\n\t\tblockEditorSettings,\n\t\tisFixedToolbarActive,\n\t\tisLargeViewport,\n\t\tkeepCaretInsideBlock,\n\t\treusableBlocks,\n\t\tsetIsInserterOpened,\n\t\tpageOnFront,\n\t\tpageForPosts,\n\t] );\n\n\tconst widgetAreaId = useLastSelectedWidgetArea();\n\n\tconst [ blocks, onInput, onChange ] = useEntityBlockEditor(\n\t\tKIND,\n\t\tPOST_TYPE,\n\t\t{ id: buildWidgetAreasPostId() }\n\t);\n\n\treturn (\n\t\t<SlotFillProvider>\n\t\t\t<KeyboardShortcuts.Register />\n\t\t\t<BlockKeyboardShortcuts />\n\t\t\t<ExperimentalBlockEditorProvider\n\t\t\t\tvalue={ blocks }\n\t\t\t\tonInput={ onInput }\n\t\t\t\tonChange={ onChange }\n\t\t\t\tsettings={ settings }\n\t\t\t\tuseSubRegistry={ false }\n\t\t\t\t{ ...props }\n\t\t\t>\n\t\t\t\t{ children }\n\t\t\t\t<PatternsMenuItems rootClientId={ widgetAreaId } />\n\t\t\t</ExperimentalBlockEditorProvider>\n\t\t</SlotFillProvider>\n\t);\n}\n"],
|
|
5
|
+
"mappings": "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",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
const ALLOW_REUSABLE_BLOCKS = false;
|
|
2
|
+
const ENABLE_EXPERIMENTAL_FSE_BLOCKS = false;
|
|
3
|
+
export {
|
|
4
|
+
ALLOW_REUSABLE_BLOCKS,
|
|
5
|
+
ENABLE_EXPERIMENTAL_FSE_BLOCKS
|
|
6
|
+
};
|
|
7
|
+
//# sourceMappingURL=constants.js.map
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/constants.js"],
|
|
4
|
+
"sourcesContent": ["export const ALLOW_REUSABLE_BLOCKS = false;\nexport const ENABLE_EXPERIMENTAL_FSE_BLOCKS = false;\n"],
|
|
5
|
+
"mappings": "AAAO,MAAM,wBAAwB;AAC9B,MAAM,iCAAiC;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/filters/index.js"],
|
|
4
|
+
"sourcesContent": ["/**\n * Internal dependencies\n */\nimport './move-to-widget-area';\nimport './replace-media-upload';\n"],
|
|
5
|
+
"mappings": "AAGA,OAAO;AACP,OAAO;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1,58 +1,53 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
16
|
-
const withMoveToWidgetAreaToolbarItem = createHigherOrderComponent(BlockEdit => props => {
|
|
17
|
-
const {
|
|
18
|
-
clientId,
|
|
19
|
-
name: blockName
|
|
20
|
-
} = props;
|
|
21
|
-
const {
|
|
22
|
-
widgetAreas,
|
|
23
|
-
currentWidgetAreaId,
|
|
24
|
-
canInsertBlockInWidgetArea
|
|
25
|
-
} = useSelect(select => {
|
|
26
|
-
// Component won't display for a widget area, so don't run selectors.
|
|
27
|
-
if (blockName === 'core/widget-area') {
|
|
28
|
-
return {};
|
|
29
|
-
}
|
|
30
|
-
const selectors = select(editWidgetsStore);
|
|
31
|
-
const widgetAreaBlock = selectors.getParentWidgetAreaBlock(clientId);
|
|
32
|
-
return {
|
|
33
|
-
widgetAreas: selectors.getWidgetAreas(),
|
|
34
|
-
currentWidgetAreaId: widgetAreaBlock?.attributes?.id,
|
|
35
|
-
canInsertBlockInWidgetArea: selectors.canInsertBlockInWidgetArea(blockName)
|
|
36
|
-
};
|
|
37
|
-
}, [clientId, blockName]);
|
|
38
|
-
const {
|
|
39
|
-
moveBlockToWidgetArea
|
|
40
|
-
} = useDispatch(editWidgetsStore);
|
|
41
|
-
const hasMultipleWidgetAreas = widgetAreas?.length > 1;
|
|
42
|
-
const isMoveToWidgetAreaVisible = blockName !== 'core/widget-area' && hasMultipleWidgetAreas && canInsertBlockInWidgetArea;
|
|
43
|
-
return /*#__PURE__*/_jsxs(_Fragment, {
|
|
44
|
-
children: [/*#__PURE__*/_jsx(BlockEdit, {
|
|
45
|
-
...props
|
|
46
|
-
}, "edit"), isMoveToWidgetAreaVisible && /*#__PURE__*/_jsx(BlockControls, {
|
|
47
|
-
children: /*#__PURE__*/_jsx(MoveToWidgetArea, {
|
|
48
|
-
widgetAreas: widgetAreas,
|
|
49
|
-
currentWidgetAreaId: currentWidgetAreaId,
|
|
50
|
-
onSelect: widgetAreaId => {
|
|
51
|
-
moveBlockToWidgetArea(props.clientId, widgetAreaId);
|
|
1
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { BlockControls } from "@wordpress/block-editor";
|
|
3
|
+
import { createHigherOrderComponent } from "@wordpress/compose";
|
|
4
|
+
import { useDispatch, useSelect } from "@wordpress/data";
|
|
5
|
+
import { addFilter } from "@wordpress/hooks";
|
|
6
|
+
import { MoveToWidgetArea } from "@wordpress/widgets";
|
|
7
|
+
import { store as editWidgetsStore } from "../store";
|
|
8
|
+
const withMoveToWidgetAreaToolbarItem = createHigherOrderComponent(
|
|
9
|
+
(BlockEdit) => (props) => {
|
|
10
|
+
const { clientId, name: blockName } = props;
|
|
11
|
+
const { widgetAreas, currentWidgetAreaId, canInsertBlockInWidgetArea } = useSelect(
|
|
12
|
+
(select) => {
|
|
13
|
+
if (blockName === "core/widget-area") {
|
|
14
|
+
return {};
|
|
52
15
|
}
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
16
|
+
const selectors = select(editWidgetsStore);
|
|
17
|
+
const widgetAreaBlock = selectors.getParentWidgetAreaBlock(clientId);
|
|
18
|
+
return {
|
|
19
|
+
widgetAreas: selectors.getWidgetAreas(),
|
|
20
|
+
currentWidgetAreaId: widgetAreaBlock?.attributes?.id,
|
|
21
|
+
canInsertBlockInWidgetArea: selectors.canInsertBlockInWidgetArea(blockName)
|
|
22
|
+
};
|
|
23
|
+
},
|
|
24
|
+
[clientId, blockName]
|
|
25
|
+
);
|
|
26
|
+
const { moveBlockToWidgetArea } = useDispatch(editWidgetsStore);
|
|
27
|
+
const hasMultipleWidgetAreas = widgetAreas?.length > 1;
|
|
28
|
+
const isMoveToWidgetAreaVisible = blockName !== "core/widget-area" && hasMultipleWidgetAreas && canInsertBlockInWidgetArea;
|
|
29
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
30
|
+
/* @__PURE__ */ jsx(BlockEdit, { ...props }, "edit"),
|
|
31
|
+
isMoveToWidgetAreaVisible && /* @__PURE__ */ jsx(BlockControls, { children: /* @__PURE__ */ jsx(
|
|
32
|
+
MoveToWidgetArea,
|
|
33
|
+
{
|
|
34
|
+
widgetAreas,
|
|
35
|
+
currentWidgetAreaId,
|
|
36
|
+
onSelect: (widgetAreaId) => {
|
|
37
|
+
moveBlockToWidgetArea(
|
|
38
|
+
props.clientId,
|
|
39
|
+
widgetAreaId
|
|
40
|
+
);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
) })
|
|
44
|
+
] });
|
|
45
|
+
},
|
|
46
|
+
"withMoveToWidgetAreaToolbarItem"
|
|
47
|
+
);
|
|
48
|
+
addFilter(
|
|
49
|
+
"editor.BlockEdit",
|
|
50
|
+
"core/edit-widgets/block-edit",
|
|
51
|
+
withMoveToWidgetAreaToolbarItem
|
|
52
|
+
);
|
|
53
|
+
//# sourceMappingURL=move-to-widget-area.js.map
|
|
@@ -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,mBACC,KADD;AA7CH,SAAS,qBAAqB;AAC9B,SAAS,kCAAkC;AAC3C,SAAS,aAAa,iBAAiB;AACvC,SAAS,iBAAiB;AAC1B,SAAS,wBAAwB;AAKjC,SAAS,SAAS,wBAAwB;AAE1C,MAAM,kCAAkC;AAAA,EACvC,CAAE,cAAe,CAAE,UAAW;AAC7B,UAAM,EAAE,UAAU,MAAM,UAAU,IAAI;AACtC,UAAM,EAAE,aAAa,qBAAqB,2BAA2B,IACpE;AAAA,MACC,CAAE,WAAY;AAEb,YAAK,cAAc,oBAAqB;AACvC,iBAAO,CAAC;AAAA,QACT;AAEA,cAAM,YAAY,OAAQ,gBAAiB;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,IAAI,YAAa,gBAAiB;AAChE,UAAM,yBAAyB,aAAa,SAAS;AACrD,UAAM,4BACL,cAAc,sBACd,0BACA;AAED,WACC,iCACC;AAAA,0BAAC,aAAuB,GAAG,SAAZ,MAAoB;AAAA,MACjC,6BACD,oBAAC,iBACA;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;AAEA;AAAA,EACC;AAAA,EACA;AAAA,EACA;AACD;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
*/
|
|
4
|
-
import { addFilter } from '@wordpress/hooks';
|
|
5
|
-
import { MediaUpload } from '@wordpress/media-utils';
|
|
1
|
+
import { addFilter } from "@wordpress/hooks";
|
|
2
|
+
import { MediaUpload } from "@wordpress/media-utils";
|
|
6
3
|
const replaceMediaUpload = () => MediaUpload;
|
|
7
|
-
addFilter(
|
|
8
|
-
|
|
4
|
+
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,SAAS,iBAAiB;AAC1B,SAAS,mBAAmB;AAE5B,MAAM,qBAAqB,MAAM;AAEjC;AAAA,EACC;AAAA,EACA;AAAA,EACA;AACD;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1,49 +1,30 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* Internal dependencies
|
|
10
|
-
*/
|
|
11
|
-
import { store as widgetsEditorStore } from '../store';
|
|
12
|
-
import { buildWidgetAreasPostId, KIND, POST_TYPE } from '../store/utils';
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* A react hook that returns the client id of the last widget area to have
|
|
16
|
-
* been selected, or to have a selected block within it.
|
|
17
|
-
*
|
|
18
|
-
* @return {string} clientId of the widget area last selected.
|
|
19
|
-
*/
|
|
20
|
-
const useLastSelectedWidgetArea = () => useSelect(select => {
|
|
21
|
-
const {
|
|
22
|
-
getBlockSelectionEnd,
|
|
23
|
-
getBlockName
|
|
24
|
-
} = select(blockEditorStore);
|
|
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 widgetsEditorStore } from "../store";
|
|
5
|
+
import { buildWidgetAreasPostId, KIND, POST_TYPE } from "../store/utils";
|
|
6
|
+
const useLastSelectedWidgetArea = () => useSelect((select) => {
|
|
7
|
+
const { getBlockSelectionEnd, getBlockName } = select(blockEditorStore);
|
|
25
8
|
const selectionEndClientId = getBlockSelectionEnd();
|
|
26
|
-
|
|
27
|
-
// If the selected block is a widget area, return its clientId.
|
|
28
|
-
if (getBlockName(selectionEndClientId) === 'core/widget-area') {
|
|
9
|
+
if (getBlockName(selectionEndClientId) === "core/widget-area") {
|
|
29
10
|
return selectionEndClientId;
|
|
30
11
|
}
|
|
31
|
-
const {
|
|
32
|
-
getParentWidgetAreaBlock
|
|
33
|
-
} = select(widgetsEditorStore);
|
|
12
|
+
const { getParentWidgetAreaBlock } = select(widgetsEditorStore);
|
|
34
13
|
const widgetAreaBlock = getParentWidgetAreaBlock(selectionEndClientId);
|
|
35
14
|
const widgetAreaBlockClientId = widgetAreaBlock?.clientId;
|
|
36
15
|
if (widgetAreaBlockClientId) {
|
|
37
16
|
return widgetAreaBlockClientId;
|
|
38
17
|
}
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
const widgetAreasPost = getEntityRecord(KIND, POST_TYPE, buildWidgetAreasPostId());
|
|
18
|
+
const { getEntityRecord } = select(coreStore);
|
|
19
|
+
const widgetAreasPost = getEntityRecord(
|
|
20
|
+
KIND,
|
|
21
|
+
POST_TYPE,
|
|
22
|
+
buildWidgetAreasPostId()
|
|
23
|
+
);
|
|
46
24
|
return widgetAreasPost?.blocks[0]?.clientId;
|
|
47
25
|
}, []);
|
|
48
|
-
|
|
49
|
-
|
|
26
|
+
var use_last_selected_widget_area_default = useLastSelectedWidgetArea;
|
|
27
|
+
export {
|
|
28
|
+
use_last_selected_widget_area_default as default
|
|
29
|
+
};
|
|
30
|
+
//# 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": "AAGA,SAAS,iBAAiB;AAC1B,SAAS,SAAS,wBAAwB;AAC1C,SAAS,SAAS,iBAAiB;AAKnC,SAAS,SAAS,0BAA0B;AAC5C,SAAS,wBAAwB,MAAM,iBAAiB;AAQxD,MAAM,4BAA4B,MACjC,UAAW,CAAE,WAAY;AACxB,QAAM,EAAE,sBAAsB,aAAa,IAC1C,OAAQ,gBAAiB;AAC1B,QAAM,uBAAuB,qBAAqB;AAGlD,MAAK,aAAc,oBAAqB,MAAM,oBAAqB;AAClE,WAAO;AAAA,EACR;AAEA,QAAM,EAAE,yBAAyB,IAAI,OAAQ,kBAAmB;AAChE,QAAM,kBACL,yBAA0B,oBAAqB;AAChD,QAAM,0BAA0B,iBAAiB;AAEjD,MAAK,yBAA0B;AAC9B,WAAO;AAAA,EACR;AAIA,QAAM,EAAE,gBAAgB,IAAI,OAAQ,SAAU;AAC9C,QAAM,kBAAkB;AAAA,IACvB;AAAA,IACA;AAAA,IACA,uBAAuB;AAAA,EACxB;AACA,SAAO,iBAAiB,OAAQ,CAAE,GAAG;AACtC,GAAG,CAAC,CAAE;AAEP,IAAO,wCAAQ;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|