@wordpress/edit-widgets 5.24.1 → 5.25.1-next.79a6196f.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/LICENSE.md +1 -1
- package/build/blocks/widget-area/index.js +1 -0
- package/build/blocks/widget-area/index.js.map +1 -1
- package/build/components/header/document-tools/index.js +19 -18
- package/build/components/header/document-tools/index.js.map +1 -1
- package/build/components/header/index.js +4 -12
- package/build/components/header/index.js.map +1 -1
- package/build/components/header/undo-redo/redo.js +8 -3
- package/build/components/header/undo-redo/redo.js.map +1 -1
- package/build/components/header/undo-redo/undo.js +8 -3
- package/build/components/header/undo-redo/undo.js.map +1 -1
- package/build/components/layout/interface.js +2 -7
- package/build/components/layout/interface.js.map +1 -1
- package/build/components/secondary-sidebar/index.js +2 -6
- package/build/components/secondary-sidebar/index.js.map +1 -1
- package/build/components/secondary-sidebar/list-view-sidebar.js +7 -5
- package/build/components/secondary-sidebar/list-view-sidebar.js.map +1 -1
- package/build/components/widget-areas-block-editor-content/index.js +5 -1
- package/build/components/widget-areas-block-editor-content/index.js.map +1 -1
- package/build/components/widget-areas-block-editor-provider/index.js +4 -2
- package/build/components/widget-areas-block-editor-provider/index.js.map +1 -1
- package/build/store/index.js +3 -0
- package/build/store/index.js.map +1 -1
- package/build/store/private-selectors.js +10 -0
- package/build/store/private-selectors.js.map +1 -0
- package/build/store/reducer.js +14 -0
- package/build/store/reducer.js.map +1 -1
- package/build-module/blocks/widget-area/index.js +1 -0
- package/build-module/blocks/widget-area/index.js.map +1 -1
- package/build-module/components/header/document-tools/index.js +19 -18
- package/build-module/components/header/document-tools/index.js.map +1 -1
- package/build-module/components/header/index.js +5 -13
- package/build-module/components/header/index.js.map +1 -1
- package/build-module/components/header/undo-redo/redo.js +7 -3
- package/build-module/components/header/undo-redo/redo.js.map +1 -1
- package/build-module/components/header/undo-redo/undo.js +7 -3
- package/build-module/components/header/undo-redo/undo.js.map +1 -1
- package/build-module/components/layout/interface.js +3 -8
- package/build-module/components/layout/interface.js.map +1 -1
- package/build-module/components/secondary-sidebar/index.js +2 -6
- package/build-module/components/secondary-sidebar/index.js.map +1 -1
- package/build-module/components/secondary-sidebar/list-view-sidebar.js +8 -6
- package/build-module/components/secondary-sidebar/list-view-sidebar.js.map +1 -1
- package/build-module/components/widget-areas-block-editor-content/index.js +6 -2
- package/build-module/components/widget-areas-block-editor-content/index.js.map +1 -1
- package/build-module/components/widget-areas-block-editor-provider/index.js +4 -2
- package/build-module/components/widget-areas-block-editor-provider/index.js.map +1 -1
- package/build-module/store/index.js +3 -0
- package/build-module/store/index.js.map +1 -1
- package/build-module/store/private-selectors.js +4 -0
- package/build-module/store/private-selectors.js.map +1 -0
- package/build-module/store/reducer.js +13 -0
- package/build-module/store/reducer.js.map +1 -1
- package/build-style/style-rtl.css +25 -5
- package/build-style/style.css +25 -5
- package/package.json +30 -29
- package/src/blocks/widget-area/block.json +1 -0
- package/src/components/header/document-tools/index.js +19 -23
- package/src/components/header/index.js +4 -9
- package/src/components/header/style.scss +25 -5
- package/src/components/header/undo-redo/redo.js +8 -3
- package/src/components/header/undo-redo/undo.js +8 -3
- package/src/components/layout/interface.js +3 -14
- package/src/components/secondary-sidebar/index.js +2 -4
- package/src/components/secondary-sidebar/list-view-sidebar.js +6 -4
- package/src/components/widget-areas-block-editor-content/index.js +4 -0
- package/src/components/widget-areas-block-editor-provider/index.js +4 -1
- package/src/store/index.js +4 -0
- package/src/store/private-selectors.js +3 -0
- package/src/store/reducer.js +11 -0
|
@@ -7,6 +7,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.default = WidgetAreasBlockEditorProvider;
|
|
8
8
|
var _react = require("react");
|
|
9
9
|
var _components = require("@wordpress/components");
|
|
10
|
+
var _compose = require("@wordpress/compose");
|
|
10
11
|
var _mediaUtils = require("@wordpress/media-utils");
|
|
11
12
|
var _data = require("@wordpress/data");
|
|
12
13
|
var _coreData = require("@wordpress/core-data");
|
|
@@ -40,6 +41,7 @@ function WidgetAreasBlockEditorProvider({
|
|
|
40
41
|
...props
|
|
41
42
|
}) {
|
|
42
43
|
const mediaPermissions = (0, _coreData.useResourcePermissions)('media');
|
|
44
|
+
const isLargeViewport = (0, _compose.useViewportMatch)('medium');
|
|
43
45
|
const {
|
|
44
46
|
reusableBlocks,
|
|
45
47
|
isFixedToolbarActive,
|
|
@@ -85,7 +87,7 @@ function WidgetAreasBlockEditorProvider({
|
|
|
85
87
|
return {
|
|
86
88
|
...blockEditorSettings,
|
|
87
89
|
__experimentalReusableBlocks: reusableBlocks,
|
|
88
|
-
hasFixedToolbar: isFixedToolbarActive,
|
|
90
|
+
hasFixedToolbar: isFixedToolbarActive || !isLargeViewport,
|
|
89
91
|
keepCaretInsideBlock,
|
|
90
92
|
mediaUpload: mediaUploadBlockEditor,
|
|
91
93
|
templateLock: 'all',
|
|
@@ -93,7 +95,7 @@ function WidgetAreasBlockEditorProvider({
|
|
|
93
95
|
pageOnFront,
|
|
94
96
|
pageForPosts
|
|
95
97
|
};
|
|
96
|
-
}, [blockEditorSettings, isFixedToolbarActive, keepCaretInsideBlock, mediaPermissions.canCreate, reusableBlocks, setIsInserterOpened, pageOnFront, pageForPosts]);
|
|
98
|
+
}, [blockEditorSettings, isFixedToolbarActive, isLargeViewport, keepCaretInsideBlock, mediaPermissions.canCreate, reusableBlocks, setIsInserterOpened, pageOnFront, pageForPosts]);
|
|
97
99
|
const widgetAreaId = (0, _useLastSelectedWidgetArea.default)();
|
|
98
100
|
const [blocks, onInput, onChange] = (0, _coreData.useEntityBlockEditor)(_utils.KIND, _utils.POST_TYPE, {
|
|
99
101
|
id: (0, _utils.buildWidgetAreasPostId)()
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_components","require","_mediaUtils","_data","_coreData","_element","_blockEditor","_patterns","_preferences","_keyboardShortcuts","_interopRequireDefault","_utils","_useLastSelectedWidgetArea","_store","_constants","_lockUnlock","ExperimentalBlockEditorProvider","unlock","blockEditorPrivateApis","PatternsMenuItems","editPatternsPrivateApis","WidgetAreasBlockEditorProvider","blockEditorSettings","children","props","mediaPermissions","useResourcePermissions","reusableBlocks","isFixedToolbarActive","keepCaretInsideBlock","pageOnFront","pageForPosts","useSelect","select","canUser","getEntityRecord","getEntityRecords","coreStore","siteSettings","undefined","widgetAreas","editWidgetsStore","getWidgetAreas","widgets","getWidgets","ALLOW_REUSABLE_BLOCKS","preferencesStore","get","page_on_front","page_for_posts","setIsInserterOpened","useDispatch","settings","useMemo","mediaUploadBlockEditor","canCreate","onError","argumentsObject","uploadMedia","wpAllowedMimeTypes","allowedMimeTypes","message","__experimentalReusableBlocks","hasFixedToolbar","mediaUpload","templateLock","__experimentalSetIsInserterOpened","widgetAreaId","useLastSelectedWidgetArea","blocks","onInput","onChange","useEntityBlockEditor","KIND","POST_TYPE","id","buildWidgetAreasPostId","_react","createElement","SlotFillProvider","default","Register","value","useSubRegistry","rootClientId"],"sources":["@wordpress/edit-widgets/src/components/widget-areas-block-editor-provider/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { SlotFillProvider } from '@wordpress/components';\nimport { uploadMedia } from '@wordpress/media-utils';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport {\n\tuseEntityBlockEditor,\n\tstore as coreStore,\n\tuseResourcePermissions,\n} 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';\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 );\nexport default function WidgetAreasBlockEditorProvider( {\n\tblockEditorSettings,\n\tchildren,\n\t...props\n} ) {\n\tconst mediaPermissions = useResourcePermissions( 'media' );\n\tconst {\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', 'settings' )\n\t\t\t? getEntityRecord( 'root', 'site' )\n\t\t\t: undefined;\n\t\treturn {\n\t\t\twidgetAreas: select( editWidgetsStore ).getWidgetAreas(),\n\t\t\twidgets: select( editWidgetsStore ).getWidgets(),\n\t\t\treusableBlocks: ALLOW_REUSABLE_BLOCKS\n\t\t\t\t? getEntityRecords( 'postType', 'wp_block' )\n\t\t\t\t: [],\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 ( mediaPermissions.canCreate ) {\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,\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};\n\t}, [\n\t\tblockEditorSettings,\n\t\tisFixedToolbarActive,\n\t\tkeepCaretInsideBlock,\n\t\tmediaPermissions.canCreate,\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<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"],"mappings":";;;;;;;;AAGA,IAAAA,WAAA,GAAAC,OAAA;AACA,IAAAC,
|
|
1
|
+
{"version":3,"names":["_components","require","_compose","_mediaUtils","_data","_coreData","_element","_blockEditor","_patterns","_preferences","_keyboardShortcuts","_interopRequireDefault","_utils","_useLastSelectedWidgetArea","_store","_constants","_lockUnlock","ExperimentalBlockEditorProvider","unlock","blockEditorPrivateApis","PatternsMenuItems","editPatternsPrivateApis","WidgetAreasBlockEditorProvider","blockEditorSettings","children","props","mediaPermissions","useResourcePermissions","isLargeViewport","useViewportMatch","reusableBlocks","isFixedToolbarActive","keepCaretInsideBlock","pageOnFront","pageForPosts","useSelect","select","canUser","getEntityRecord","getEntityRecords","coreStore","siteSettings","undefined","widgetAreas","editWidgetsStore","getWidgetAreas","widgets","getWidgets","ALLOW_REUSABLE_BLOCKS","preferencesStore","get","page_on_front","page_for_posts","setIsInserterOpened","useDispatch","settings","useMemo","mediaUploadBlockEditor","canCreate","onError","argumentsObject","uploadMedia","wpAllowedMimeTypes","allowedMimeTypes","message","__experimentalReusableBlocks","hasFixedToolbar","mediaUpload","templateLock","__experimentalSetIsInserterOpened","widgetAreaId","useLastSelectedWidgetArea","blocks","onInput","onChange","useEntityBlockEditor","KIND","POST_TYPE","id","buildWidgetAreasPostId","_react","createElement","SlotFillProvider","default","Register","value","useSubRegistry","rootClientId"],"sources":["@wordpress/edit-widgets/src/components/widget-areas-block-editor-provider/index.js"],"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 {\n\tuseEntityBlockEditor,\n\tstore as coreStore,\n\tuseResourcePermissions,\n} 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';\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 );\nexport default function WidgetAreasBlockEditorProvider( {\n\tblockEditorSettings,\n\tchildren,\n\t...props\n} ) {\n\tconst mediaPermissions = useResourcePermissions( 'media' );\n\tconst isLargeViewport = useViewportMatch( 'medium' );\n\tconst {\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', 'settings' )\n\t\t\t? getEntityRecord( 'root', 'site' )\n\t\t\t: undefined;\n\t\treturn {\n\t\t\twidgetAreas: select( editWidgetsStore ).getWidgetAreas(),\n\t\t\twidgets: select( editWidgetsStore ).getWidgets(),\n\t\t\treusableBlocks: ALLOW_REUSABLE_BLOCKS\n\t\t\t\t? getEntityRecords( 'postType', 'wp_block' )\n\t\t\t\t: [],\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 ( mediaPermissions.canCreate ) {\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};\n\t}, [\n\t\tblockEditorSettings,\n\t\tisFixedToolbarActive,\n\t\tisLargeViewport,\n\t\tkeepCaretInsideBlock,\n\t\tmediaPermissions.canCreate,\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<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"],"mappings":";;;;;;;;AAGA,IAAAA,WAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AACA,IAAAG,KAAA,GAAAH,OAAA;AACA,IAAAI,SAAA,GAAAJ,OAAA;AAKA,IAAAK,QAAA,GAAAL,OAAA;AACA,IAAAM,YAAA,GAA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BpB,WAAW,EACXC,YAAY,CACX,CAAC;EAEH,MAAMoC,YAAY,GAAG,IAAAC,kCAAyB,EAAC,CAAC;EAEhD,MAAM,CAAEC,MAAM,EAAEC,OAAO,EAAEC,QAAQ,CAAE,GAAG,IAAAC,8BAAoB,EACzDC,WAAI,EACJC,gBAAS,EACT;IAAEC,EAAE,EAAE,IAAAC,6BAAsB,EAAC;EAAE,CAChC,CAAC;EAED,OACC,IAAAC,MAAA,CAAAC,aAAA,EAACjF,WAAA,CAAAkF,gBAAgB,QAChB,IAAAF,MAAA,CAAAC,aAAA,EAACvE,kBAAA,CAAAyE,OAAiB,CAACC,QAAQ,MAAE,CAAC,EAC9B,IAAAJ,MAAA,CAAAC,aAAA,EAAChE,+BAA+B;IAC/BoE,KAAK,EAAGb,MAAQ;IAChBC,OAAO,EAAGA,OAAS;IACnBC,QAAQ,EAAGA,QAAU;IACrBnB,QAAQ,EAAGA,QAAU;IACrB+B,cAAc,EAAG,KAAO;IAAA,GACnB7D;EAAK,GAERD,QAAQ,EACV,IAAAwD,MAAA,CAAAC,aAAA,EAAC7D,iBAAiB;IAACmE,YAAY,EAAGjB;EAAc,CAAE,CAClB,CAChB,CAAC;AAErB"}
|
package/build/store/index.js
CHANGED
|
@@ -11,7 +11,9 @@ var _reducer = _interopRequireDefault(require("./reducer"));
|
|
|
11
11
|
var resolvers = _interopRequireWildcard(require("./resolvers"));
|
|
12
12
|
var selectors = _interopRequireWildcard(require("./selectors"));
|
|
13
13
|
var actions = _interopRequireWildcard(require("./actions"));
|
|
14
|
+
var privateSelectors = _interopRequireWildcard(require("./private-selectors"));
|
|
14
15
|
var _constants = require("./constants");
|
|
16
|
+
var _lockUnlock = require("../lock-unlock");
|
|
15
17
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
16
18
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
17
19
|
/**
|
|
@@ -56,4 +58,5 @@ _apiFetch.default.use(function (options, next) {
|
|
|
56
58
|
}
|
|
57
59
|
return next(options);
|
|
58
60
|
});
|
|
61
|
+
(0, _lockUnlock.unlock)(store).registerPrivateSelectors(privateSelectors);
|
|
59
62
|
//# sourceMappingURL=index.js.map
|
package/build/store/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_apiFetch","_interopRequireDefault","require","_data","_reducer","resolvers","_interopRequireWildcard","selectors","actions","_constants","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","default","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","storeConfig","reducer","store","createReduxStore","STORE_NAME","exports","register","apiFetch","use","options","next","path","indexOf","Promise","resolve"],"sources":["@wordpress/edit-widgets/src/store/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport apiFetch from '@wordpress/api-fetch';\nimport { createReduxStore, register } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport reducer from './reducer';\nimport * as resolvers from './resolvers';\nimport * as selectors from './selectors';\nimport * as actions from './actions';\nimport { STORE_NAME } from './constants';\n\n/**\n * Block editor data store configuration.\n *\n * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/data/README.md#register\n *\n * @type {Object}\n */\nconst storeConfig = {\n\treducer,\n\tselectors,\n\tresolvers,\n\tactions,\n};\n\n/**\n * Store definition for the edit widgets namespace.\n *\n * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/data/README.md#createReduxStore\n *\n * @type {Object}\n */\nexport const store = createReduxStore( STORE_NAME, storeConfig );\nregister( store );\n\n// This package uses a few in-memory post types as wrappers for convenience.\n// This middleware prevents any network requests related to these types as they are\n// bound to fail anyway.\napiFetch.use( function ( options, next ) {\n\tif ( options.path?.indexOf( '/wp/v2/types/widget-area' ) === 0 ) {\n\t\treturn Promise.resolve( {} );\n\t}\n\n\treturn next( options );\n} );\n"],"mappings":";;;;;;;AAGA,IAAAA,SAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AAKA,IAAAE,QAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,SAAA,GAAAC,uBAAA,CAAAJ,OAAA;AACA,IAAAK,SAAA,GAAAD,uBAAA,CAAAJ,OAAA;AACA,IAAAM,OAAA,GAAAF,uBAAA,CAAAJ,OAAA;AACA,IAAAO,UAAA,
|
|
1
|
+
{"version":3,"names":["_apiFetch","_interopRequireDefault","require","_data","_reducer","resolvers","_interopRequireWildcard","selectors","actions","privateSelectors","_constants","_lockUnlock","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","default","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","storeConfig","reducer","store","createReduxStore","STORE_NAME","exports","register","apiFetch","use","options","next","path","indexOf","Promise","resolve","unlock","registerPrivateSelectors"],"sources":["@wordpress/edit-widgets/src/store/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport apiFetch from '@wordpress/api-fetch';\nimport { createReduxStore, register } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport reducer from './reducer';\nimport * as resolvers from './resolvers';\nimport * as selectors from './selectors';\nimport * as actions from './actions';\nimport * as privateSelectors from './private-selectors';\nimport { STORE_NAME } from './constants';\nimport { unlock } from '../lock-unlock';\n\n/**\n * Block editor data store configuration.\n *\n * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/data/README.md#register\n *\n * @type {Object}\n */\nconst storeConfig = {\n\treducer,\n\tselectors,\n\tresolvers,\n\tactions,\n};\n\n/**\n * Store definition for the edit widgets namespace.\n *\n * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/data/README.md#createReduxStore\n *\n * @type {Object}\n */\nexport const store = createReduxStore( STORE_NAME, storeConfig );\nregister( store );\n\n// This package uses a few in-memory post types as wrappers for convenience.\n// This middleware prevents any network requests related to these types as they are\n// bound to fail anyway.\napiFetch.use( function ( options, next ) {\n\tif ( options.path?.indexOf( '/wp/v2/types/widget-area' ) === 0 ) {\n\t\treturn Promise.resolve( {} );\n\t}\n\n\treturn next( options );\n} );\n\nunlock( store ).registerPrivateSelectors( privateSelectors );\n"],"mappings":";;;;;;;AAGA,IAAAA,SAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AAKA,IAAAE,QAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,SAAA,GAAAC,uBAAA,CAAAJ,OAAA;AACA,IAAAK,SAAA,GAAAD,uBAAA,CAAAJ,OAAA;AACA,IAAAM,OAAA,GAAAF,uBAAA,CAAAJ,OAAA;AACA,IAAAO,gBAAA,GAAAH,uBAAA,CAAAJ,OAAA;AACA,IAAAQ,UAAA,GAAAR,OAAA;AACA,IAAAS,WAAA,GAAAT,OAAA;AAAwC,SAAAU,yBAAAC,WAAA,eAAAC,OAAA,kCAAAC,iBAAA,OAAAD,OAAA,QAAAE,gBAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAA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AY,CAAC;AAACK,OAAA,CAAAH,KAAA,GAAAA,KAAA;AACjE,IAAAI,cAAQ,EAAEJ,KAAM,CAAC;;AAEjB;AACA;AACA;AACAK,iBAAQ,CAACC,GAAG,CAAE,UAAWC,OAAO,EAAEC,IAAI,EAAG;EACxC,IAAKD,OAAO,CAACE,IAAI,EAAEC,OAAO,CAAE,0BAA2B,CAAC,KAAK,CAAC,EAAG;IAChE,OAAOC,OAAO,CAACC,OAAO,CAAE,CAAC,CAAE,CAAC;EAC7B;EAEA,OAAOJ,IAAI,CAAED,OAAQ,CAAC;AACvB,CAAE,CAAC;AAEH,IAAAM,kBAAM,EAAEb,KAAM,CAAC,CAACc,wBAAwB,CAAEzC,gBAAiB,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.getListViewToggleRef = getListViewToggleRef;
|
|
7
|
+
function getListViewToggleRef(state) {
|
|
8
|
+
return state.listViewToggleRef;
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=private-selectors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["getListViewToggleRef","state","listViewToggleRef"],"sources":["@wordpress/edit-widgets/src/store/private-selectors.js"],"sourcesContent":["export function getListViewToggleRef( state ) {\n\treturn state.listViewToggleRef;\n}\n"],"mappings":";;;;;;AAAO,SAASA,oBAAoBA,CAAEC,KAAK,EAAG;EAC7C,OAAOA,KAAK,CAACC,iBAAiB;AAC/B"}
|
package/build/store/reducer.js
CHANGED
|
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.blockInserterPanel = blockInserterPanel;
|
|
7
7
|
exports.default = void 0;
|
|
8
8
|
exports.listViewPanel = listViewPanel;
|
|
9
|
+
exports.listViewToggleRef = listViewToggleRef;
|
|
9
10
|
exports.widgetAreasOpenState = widgetAreasOpenState;
|
|
10
11
|
var _data = require("@wordpress/data");
|
|
11
12
|
/**
|
|
@@ -84,6 +85,19 @@ function listViewPanel(state = false, action) {
|
|
|
84
85
|
}
|
|
85
86
|
return state;
|
|
86
87
|
}
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* This reducer does nothing aside initializing a ref to the list view toggle.
|
|
91
|
+
* We will have a unique ref per "editor" instance.
|
|
92
|
+
*
|
|
93
|
+
* @param {Object} state
|
|
94
|
+
* @return {Object} Reference to the list view toggle button.
|
|
95
|
+
*/
|
|
96
|
+
function listViewToggleRef(state = {
|
|
97
|
+
current: null
|
|
98
|
+
}) {
|
|
99
|
+
return state;
|
|
100
|
+
}
|
|
87
101
|
var _default = (0, _data.combineReducers)({
|
|
88
102
|
blockInserterPanel,
|
|
89
103
|
listViewPanel,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_data","require","widgetAreasOpenState","state","action","type","clientId","isOpen","blockInserterPanel","value","listViewPanel","_default","combineReducers","exports","default"],"sources":["@wordpress/edit-widgets/src/store/reducer.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { combineReducers } from '@wordpress/data';\n\n/**\n * Controls the open state of the widget areas.\n *\n * @param {Object} state Redux state.\n * @param {Object} action Redux action.\n *\n * @return {Array} Updated state.\n */\nexport function widgetAreasOpenState( state = {}, action ) {\n\tconst { type } = action;\n\tswitch ( type ) {\n\t\tcase 'SET_WIDGET_AREAS_OPEN_STATE': {\n\t\t\treturn action.widgetAreasOpenState;\n\t\t}\n\t\tcase 'SET_IS_WIDGET_AREA_OPEN': {\n\t\t\tconst { clientId, isOpen } = action;\n\t\t\treturn {\n\t\t\t\t...state,\n\t\t\t\t[ clientId ]: isOpen,\n\t\t\t};\n\t\t}\n\t\tdefault: {\n\t\t\treturn state;\n\t\t}\n\t}\n}\n\n/**\n * Reducer to set the block inserter panel open or closed.\n *\n * Note: this reducer interacts with the list view panel reducer\n * to make sure that only one of the two panels is open at the same time.\n *\n * @param {Object} state Current state.\n * @param {Object} action Dispatched action.\n */\nexport function blockInserterPanel( state = false, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'SET_IS_LIST_VIEW_OPENED':\n\t\t\treturn action.isOpen ? false : state;\n\t\tcase 'SET_IS_INSERTER_OPENED':\n\t\t\treturn action.value;\n\t}\n\treturn state;\n}\n\n/**\n * Reducer to set the list view panel open or closed.\n *\n * Note: this reducer interacts with the inserter panel reducer\n * to make sure that only one of the two panels is open at the same time.\n *\n * @param {Object} state Current state.\n * @param {Object} action Dispatched action.\n */\nexport function listViewPanel( state = false, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'SET_IS_INSERTER_OPENED':\n\t\t\treturn action.value ? false : state;\n\t\tcase 'SET_IS_LIST_VIEW_OPENED':\n\t\t\treturn action.isOpen;\n\t}\n\treturn state;\n}\n\nexport default combineReducers( {\n\tblockInserterPanel,\n\tlistViewPanel,\n\twidgetAreasOpenState,\n} );\n"],"mappings":"
|
|
1
|
+
{"version":3,"names":["_data","require","widgetAreasOpenState","state","action","type","clientId","isOpen","blockInserterPanel","value","listViewPanel","listViewToggleRef","current","_default","combineReducers","exports","default"],"sources":["@wordpress/edit-widgets/src/store/reducer.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { combineReducers } from '@wordpress/data';\n\n/**\n * Controls the open state of the widget areas.\n *\n * @param {Object} state Redux state.\n * @param {Object} action Redux action.\n *\n * @return {Array} Updated state.\n */\nexport function widgetAreasOpenState( state = {}, action ) {\n\tconst { type } = action;\n\tswitch ( type ) {\n\t\tcase 'SET_WIDGET_AREAS_OPEN_STATE': {\n\t\t\treturn action.widgetAreasOpenState;\n\t\t}\n\t\tcase 'SET_IS_WIDGET_AREA_OPEN': {\n\t\t\tconst { clientId, isOpen } = action;\n\t\t\treturn {\n\t\t\t\t...state,\n\t\t\t\t[ clientId ]: isOpen,\n\t\t\t};\n\t\t}\n\t\tdefault: {\n\t\t\treturn state;\n\t\t}\n\t}\n}\n\n/**\n * Reducer to set the block inserter panel open or closed.\n *\n * Note: this reducer interacts with the list view panel reducer\n * to make sure that only one of the two panels is open at the same time.\n *\n * @param {Object} state Current state.\n * @param {Object} action Dispatched action.\n */\nexport function blockInserterPanel( state = false, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'SET_IS_LIST_VIEW_OPENED':\n\t\t\treturn action.isOpen ? false : state;\n\t\tcase 'SET_IS_INSERTER_OPENED':\n\t\t\treturn action.value;\n\t}\n\treturn state;\n}\n\n/**\n * Reducer to set the list view panel open or closed.\n *\n * Note: this reducer interacts with the inserter panel reducer\n * to make sure that only one of the two panels is open at the same time.\n *\n * @param {Object} state Current state.\n * @param {Object} action Dispatched action.\n */\nexport function listViewPanel( state = false, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'SET_IS_INSERTER_OPENED':\n\t\t\treturn action.value ? false : state;\n\t\tcase 'SET_IS_LIST_VIEW_OPENED':\n\t\t\treturn action.isOpen;\n\t}\n\treturn state;\n}\n\n/**\n * This reducer does nothing aside initializing a ref to the list view toggle.\n * We will have a unique ref per \"editor\" instance.\n *\n * @param {Object} state\n * @return {Object} Reference to the list view toggle button.\n */\nexport function listViewToggleRef( state = { current: null } ) {\n\treturn state;\n}\n\nexport default combineReducers( {\n\tblockInserterPanel,\n\tlistViewPanel,\n\twidgetAreasOpenState,\n} );\n"],"mappings":";;;;;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AAHA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASC,oBAAoBA,CAAEC,KAAK,GAAG,CAAC,CAAC,EAAEC,MAAM,EAAG;EAC1D,MAAM;IAAEC;EAAK,CAAC,GAAGD,MAAM;EACvB,QAASC,IAAI;IACZ,KAAK,6BAA6B;MAAE;QACnC,OAAOD,MAAM,CAACF,oBAAoB;MACnC;IACA,KAAK,yBAAyB;MAAE;QAC/B,MAAM;UAAEI,QAAQ;UAAEC;QAAO,CAAC,GAAGH,MAAM;QACnC,OAAO;UACN,GAAGD,KAAK;UACR,CAAEG,QAAQ,GAAIC;QACf,CAAC;MACF;IACA;MAAS;QACR,OAAOJ,KAAK;MACb;EACD;AACD;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASK,kBAAkBA,CAAEL,KAAK,GAAG,KAAK,EAAEC,MAAM,EAAG;EAC3D,QAASA,MAAM,CAACC,IAAI;IACnB,KAAK,yBAAyB;MAC7B,OAAOD,MAAM,CAACG,MAAM,GAAG,KAAK,GAAGJ,KAAK;IACrC,KAAK,wBAAwB;MAC5B,OAAOC,MAAM,CAACK,KAAK;EACrB;EACA,OAAON,KAAK;AACb;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASO,aAAaA,CAAEP,KAAK,GAAG,KAAK,EAAEC,MAAM,EAAG;EACtD,QAASA,MAAM,CAACC,IAAI;IACnB,KAAK,wBAAwB;MAC5B,OAAOD,MAAM,CAACK,KAAK,GAAG,KAAK,GAAGN,KAAK;IACpC,KAAK,yBAAyB;MAC7B,OAAOC,MAAM,CAACG,MAAM;EACtB;EACA,OAAOJ,KAAK;AACb;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASQ,iBAAiBA,CAAER,KAAK,GAAG;EAAES,OAAO,EAAE;AAAK,CAAC,EAAG;EAC9D,OAAOT,KAAK;AACb;AAAC,IAAAU,QAAA,GAEc,IAAAC,qBAAe,EAAE;EAC/BN,kBAAkB;EAClBE,aAAa;EACbR;AACD,CAAE,CAAC;AAAAa,OAAA,CAAAC,OAAA,GAAAH,QAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["__","metadata","name","category","attributes","id","type","supports","html","inserter","customClassName","reusable","__experimentalToolbar","__experimentalParentSelector","__experimentalDisableBlockOverlay","editorStyle","style","edit","settings","title","description","__experimentalLabel","label"],"sources":["@wordpress/edit-widgets/src/blocks/widget-area/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport metadata from './block.json';\nimport edit from './edit';\n\nconst { name } = metadata;\nexport { metadata, name };\n\nexport const settings = {\n\ttitle: __( 'Widget Area' ),\n\tdescription: __( 'A widget area container.' ),\n\t__experimentalLabel: ( { name: label } ) => label,\n\tedit,\n};\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,EAAE,QAAQ,iBAAiB;;AAEpC;AACA;AACA;AAFA,MAAAC,QAAA;EAAAC,IAAA;EAAAC,QAAA;EAAAC,UAAA;IAAAC,EAAA;MAAAC,IAAA;IAAA;IAAAJ,IAAA;MAAAI,IAAA;IAAA;EAAA;EAAAC,QAAA;IAAAC,IAAA;IAAAC,QAAA;IAAAC,eAAA;IAAAC,QAAA;IAAAC,qBAAA;IAAAC,4BAAA;IAAAC,iCAAA;EAAA;EAAAC,WAAA;EAAAC,KAAA;AAAA;AAIA,OAAOC,IAAI,MAAM,QAAQ;AAEzB,MAAM;EAAEf;AAAK,CAAC,
|
|
1
|
+
{"version":3,"names":["__","metadata","$schema","name","category","attributes","id","type","supports","html","inserter","customClassName","reusable","__experimentalToolbar","__experimentalParentSelector","__experimentalDisableBlockOverlay","editorStyle","style","edit","settings","title","description","__experimentalLabel","label"],"sources":["@wordpress/edit-widgets/src/blocks/widget-area/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport metadata from './block.json';\nimport edit from './edit';\n\nconst { name } = metadata;\nexport { metadata, name };\n\nexport const settings = {\n\ttitle: __( 'Widget Area' ),\n\tdescription: __( 'A widget area container.' ),\n\t__experimentalLabel: ( { name: label } ) => label,\n\tedit,\n};\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,EAAE,QAAQ,iBAAiB;;AAEpC;AACA;AACA;AAFA,MAAAC,QAAA;EAAAC,OAAA;EAAAC,IAAA;EAAAC,QAAA;EAAAC,UAAA;IAAAC,EAAA;MAAAC,IAAA;IAAA;IAAAJ,IAAA;MAAAI,IAAA;IAAA;EAAA;EAAAC,QAAA;IAAAC,IAAA;IAAAC,QAAA;IAAAC,eAAA;IAAAC,QAAA;IAAAC,qBAAA;IAAAC,4BAAA;IAAAC,iCAAA;EAAA;EAAAC,WAAA;EAAAC,KAAA;AAAA;AAIA,OAAOC,IAAI,MAAM,QAAQ;AAEzB,MAAM;EAAEf;AAAK,CAAC,GAAGF,QAAQ;AACzB,SAASA,QAAQ,EAAEE,IAAI;AAEvB,OAAO,MAAMgB,QAAQ,GAAG;EACvBC,KAAK,EAAEpB,EAAE,CAAE,aAAc,CAAC;EAC1BqB,WAAW,EAAErB,EAAE,CAAE,0BAA2B,CAAC;EAC7CsB,mBAAmB,EAAEA,CAAE;IAAEnB,IAAI,EAAEoB;EAAM,CAAC,KAAMA,KAAK;EACjDL;AACD,CAAC"}
|
|
@@ -19,26 +19,27 @@ import useLastSelectedWidgetArea from '../../../hooks/use-last-selected-widget-a
|
|
|
19
19
|
import { store as editWidgetsStore } from '../../../store';
|
|
20
20
|
import { unlock } from '../../../lock-unlock';
|
|
21
21
|
const {
|
|
22
|
-
|
|
22
|
+
useCanBlockToolbarBeFocused
|
|
23
23
|
} = unlock(blockEditorPrivateApis);
|
|
24
|
-
function DocumentTools({
|
|
25
|
-
setListViewToggleElement
|
|
26
|
-
}) {
|
|
24
|
+
function DocumentTools() {
|
|
27
25
|
const isMediumViewport = useViewportMatch('medium');
|
|
28
26
|
const inserterButton = useRef();
|
|
29
27
|
const widgetAreaClientId = useLastSelectedWidgetArea();
|
|
30
28
|
const isLastSelectedWidgetAreaOpen = useSelect(select => select(editWidgetsStore).getIsWidgetAreaOpen(widgetAreaClientId), [widgetAreaClientId]);
|
|
31
29
|
const {
|
|
32
30
|
isInserterOpen,
|
|
33
|
-
isListViewOpen
|
|
31
|
+
isListViewOpen,
|
|
32
|
+
listViewToggleRef
|
|
34
33
|
} = useSelect(select => {
|
|
35
34
|
const {
|
|
36
35
|
isInserterOpened,
|
|
37
|
-
isListViewOpened
|
|
38
|
-
|
|
36
|
+
isListViewOpened,
|
|
37
|
+
getListViewToggleRef
|
|
38
|
+
} = unlock(select(editWidgetsStore));
|
|
39
39
|
return {
|
|
40
40
|
isInserterOpen: isInserterOpened(),
|
|
41
|
-
isListViewOpen: isListViewOpened()
|
|
41
|
+
isListViewOpen: isListViewOpened(),
|
|
42
|
+
listViewToggleRef: getListViewToggleRef()
|
|
42
43
|
};
|
|
43
44
|
}, []);
|
|
44
45
|
const {
|
|
@@ -69,18 +70,14 @@ function DocumentTools({
|
|
|
69
70
|
}
|
|
70
71
|
};
|
|
71
72
|
const toggleListView = useCallback(() => setIsListViewOpened(!isListViewOpen), [setIsListViewOpened, isListViewOpen]);
|
|
72
|
-
|
|
73
|
-
shouldShowContextualToolbar,
|
|
74
|
-
canFocusHiddenToolbar,
|
|
75
|
-
fixedToolbarCanBeFocused
|
|
76
|
-
} = useShouldContextualToolbarShow();
|
|
73
|
+
|
|
77
74
|
// If there's a block toolbar to be focused, disable the focus shortcut for the document toolbar.
|
|
78
|
-
|
|
79
|
-
const blockToolbarCanBeFocused = shouldShowContextualToolbar || canFocusHiddenToolbar || fixedToolbarCanBeFocused;
|
|
75
|
+
const blockToolbarCanBeFocused = useCanBlockToolbarBeFocused();
|
|
80
76
|
return createElement(NavigableToolbar, {
|
|
81
77
|
className: "edit-widgets-header-toolbar",
|
|
82
78
|
"aria-label": __('Document tools'),
|
|
83
|
-
shouldUseKeyboardFocusShortcut: !blockToolbarCanBeFocused
|
|
79
|
+
shouldUseKeyboardFocusShortcut: !blockToolbarCanBeFocused,
|
|
80
|
+
variant: "unstyled"
|
|
84
81
|
}, createElement(ToolbarItem, {
|
|
85
82
|
ref: inserterButton,
|
|
86
83
|
as: Button,
|
|
@@ -95,7 +92,11 @@ function DocumentTools({
|
|
|
95
92
|
/* translators: button label text should, if possible, be under 16
|
|
96
93
|
characters. */,
|
|
97
94
|
label: _x('Toggle block inserter', 'Generic label for block inserter button')
|
|
98
|
-
}), isMediumViewport && createElement(Fragment, null, createElement(
|
|
95
|
+
}), isMediumViewport && createElement(Fragment, null, createElement(ToolbarItem, {
|
|
96
|
+
as: UndoButton
|
|
97
|
+
}), createElement(ToolbarItem, {
|
|
98
|
+
as: RedoButton
|
|
99
|
+
}), createElement(ToolbarItem, {
|
|
99
100
|
as: Button,
|
|
100
101
|
className: "edit-widgets-header-toolbar__list-view-toggle",
|
|
101
102
|
icon: listView,
|
|
@@ -103,7 +104,7 @@ function DocumentTools({
|
|
|
103
104
|
/* translators: button label text should, if possible, be under 16 characters. */,
|
|
104
105
|
label: __('List View'),
|
|
105
106
|
onClick: toggleListView,
|
|
106
|
-
ref:
|
|
107
|
+
ref: listViewToggleRef
|
|
107
108
|
})));
|
|
108
109
|
}
|
|
109
110
|
export default DocumentTools;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useSelect","useDispatch","__","_x","Button","ToolbarItem","NavigableToolbar","store","blockEditorStore","privateApis","blockEditorPrivateApis","listView","plus","useCallback","useRef","useViewportMatch","UndoButton","RedoButton","useLastSelectedWidgetArea","editWidgetsStore","unlock","
|
|
1
|
+
{"version":3,"names":["useSelect","useDispatch","__","_x","Button","ToolbarItem","NavigableToolbar","store","blockEditorStore","privateApis","blockEditorPrivateApis","listView","plus","useCallback","useRef","useViewportMatch","UndoButton","RedoButton","useLastSelectedWidgetArea","editWidgetsStore","unlock","useCanBlockToolbarBeFocused","DocumentTools","isMediumViewport","inserterButton","widgetAreaClientId","isLastSelectedWidgetAreaOpen","select","getIsWidgetAreaOpen","isInserterOpen","isListViewOpen","listViewToggleRef","isInserterOpened","isListViewOpened","getListViewToggleRef","setIsWidgetAreaOpen","setIsInserterOpened","setIsListViewOpened","selectBlock","handleClick","window","requestAnimationFrame","toggleListView","blockToolbarCanBeFocused","createElement","className","shouldUseKeyboardFocusShortcut","variant","ref","as","isPressed","onMouseDown","event","preventDefault","onClick","icon","label","Fragment"],"sources":["@wordpress/edit-widgets/src/components/header/document-tools/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { __, _x } from '@wordpress/i18n';\nimport { Button, ToolbarItem } from '@wordpress/components';\nimport {\n\tNavigableToolbar,\n\tstore as blockEditorStore,\n\tprivateApis as blockEditorPrivateApis,\n} from '@wordpress/block-editor';\nimport { listView, plus } from '@wordpress/icons';\nimport { useCallback, useRef } from '@wordpress/element';\nimport { useViewportMatch } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport UndoButton from '../undo-redo/undo';\nimport RedoButton from '../undo-redo/redo';\nimport useLastSelectedWidgetArea from '../../../hooks/use-last-selected-widget-area';\nimport { store as editWidgetsStore } from '../../../store';\nimport { unlock } from '../../../lock-unlock';\n\nconst { useCanBlockToolbarBeFocused } = unlock( blockEditorPrivateApis );\n\nfunction DocumentTools() {\n\tconst isMediumViewport = useViewportMatch( 'medium' );\n\tconst inserterButton = useRef();\n\tconst widgetAreaClientId = useLastSelectedWidgetArea();\n\tconst isLastSelectedWidgetAreaOpen = useSelect(\n\t\t( select ) =>\n\t\t\tselect( editWidgetsStore ).getIsWidgetAreaOpen(\n\t\t\t\twidgetAreaClientId\n\t\t\t),\n\t\t[ widgetAreaClientId ]\n\t);\n\tconst { isInserterOpen, isListViewOpen, listViewToggleRef } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { isInserterOpened, isListViewOpened, getListViewToggleRef } =\n\t\t\t\tunlock( select( editWidgetsStore ) );\n\t\t\treturn {\n\t\t\t\tisInserterOpen: isInserterOpened(),\n\t\t\t\tisListViewOpen: isListViewOpened(),\n\t\t\t\tlistViewToggleRef: getListViewToggleRef(),\n\t\t\t};\n\t\t},\n\t\t[]\n\t);\n\tconst { setIsWidgetAreaOpen, setIsInserterOpened, setIsListViewOpened } =\n\t\tuseDispatch( editWidgetsStore );\n\tconst { selectBlock } = useDispatch( blockEditorStore );\n\tconst handleClick = () => {\n\t\tif ( isInserterOpen ) {\n\t\t\t// Focusing the inserter button closes the inserter popover.\n\t\t\tsetIsInserterOpened( false );\n\t\t} else {\n\t\t\tif ( ! isLastSelectedWidgetAreaOpen ) {\n\t\t\t\t// Select the last selected block if hasn't already.\n\t\t\t\tselectBlock( widgetAreaClientId );\n\t\t\t\t// Open the last selected widget area when opening the inserter.\n\t\t\t\tsetIsWidgetAreaOpen( widgetAreaClientId, true );\n\t\t\t}\n\t\t\t// The DOM updates resulting from selectBlock() and setIsInserterOpened() calls are applied the\n\t\t\t// same tick and pretty much in a random order. The inserter is closed if any other part of the\n\t\t\t// app receives focus. If selectBlock() happens to take effect after setIsInserterOpened() then\n\t\t\t// the inserter is visible for a brief moment and then gets auto-closed due to focus moving to\n\t\t\t// the selected block.\n\t\t\twindow.requestAnimationFrame( () => setIsInserterOpened( true ) );\n\t\t}\n\t};\n\n\tconst toggleListView = useCallback(\n\t\t() => setIsListViewOpened( ! isListViewOpen ),\n\t\t[ setIsListViewOpened, isListViewOpen ]\n\t);\n\n\t// If there's a block toolbar to be focused, disable the focus shortcut for the document toolbar.\n\tconst blockToolbarCanBeFocused = useCanBlockToolbarBeFocused();\n\n\treturn (\n\t\t<NavigableToolbar\n\t\t\tclassName=\"edit-widgets-header-toolbar\"\n\t\t\taria-label={ __( 'Document tools' ) }\n\t\t\tshouldUseKeyboardFocusShortcut={ ! blockToolbarCanBeFocused }\n\t\t\tvariant=\"unstyled\"\n\t\t>\n\t\t\t<ToolbarItem\n\t\t\t\tref={ inserterButton }\n\t\t\t\tas={ Button }\n\t\t\t\tclassName=\"edit-widgets-header-toolbar__inserter-toggle\"\n\t\t\t\tvariant=\"primary\"\n\t\t\t\tisPressed={ isInserterOpen }\n\t\t\t\tonMouseDown={ ( event ) => {\n\t\t\t\t\tevent.preventDefault();\n\t\t\t\t} }\n\t\t\t\tonClick={ handleClick }\n\t\t\t\ticon={ plus }\n\t\t\t\t/* translators: button label text should, if possible, be under 16\n\t\t\t\t\tcharacters. */\n\t\t\t\tlabel={ _x(\n\t\t\t\t\t'Toggle block inserter',\n\t\t\t\t\t'Generic label for block inserter button'\n\t\t\t\t) }\n\t\t\t/>\n\t\t\t{ isMediumViewport && (\n\t\t\t\t<>\n\t\t\t\t\t<ToolbarItem as={ UndoButton } />\n\t\t\t\t\t<ToolbarItem as={ RedoButton } />\n\t\t\t\t\t<ToolbarItem\n\t\t\t\t\t\tas={ Button }\n\t\t\t\t\t\tclassName=\"edit-widgets-header-toolbar__list-view-toggle\"\n\t\t\t\t\t\ticon={ listView }\n\t\t\t\t\t\tisPressed={ isListViewOpen }\n\t\t\t\t\t\t/* translators: button label text should, if possible, be under 16 characters. */\n\t\t\t\t\t\tlabel={ __( 'List View' ) }\n\t\t\t\t\t\tonClick={ toggleListView }\n\t\t\t\t\t\tref={ listViewToggleRef }\n\t\t\t\t\t/>\n\t\t\t\t</>\n\t\t\t) }\n\t\t</NavigableToolbar>\n\t);\n}\n\nexport default DocumentTools;\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACxD,SAASC,EAAE,EAAEC,EAAE,QAAQ,iBAAiB;AACxC,SAASC,MAAM,EAAEC,WAAW,QAAQ,uBAAuB;AAC3D,SACCC,gBAAgB,EAChBC,KAAK,IAAIC,gBAAgB,EACzBC,WAAW,IAAIC,sBAAsB,QAC/B,yBAAyB;AAChC,SAASC,QAAQ,EAAEC,IAAI,QAAQ,kBAAkB;AACjD,SAASC,WAAW,EAAEC,MAAM,QAAQ,oBAAoB;AACxD,SAASC,gBAAgB,QAAQ,oBAAoB;;AAErD;AACA;AACA;AACA,OAAOC,UAAU,MAAM,mBAAmB;AAC1C,OAAOC,UAAU,MAAM,mBAAmB;AAC1C,OAAOC,yBAAyB,MAAM,8CAA8C;AACpF,SAASX,KAAK,IAAIY,gBAAgB,QAAQ,gBAAgB;AAC1D,SAASC,MAAM,QAAQ,sBAAsB;AAE7C,MAAM;EAAEC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CACzB,CACA,CAEc,CAAC;AAErB;AAEA,eAAeT,aAAa"}
|
|
@@ -2,7 +2,7 @@ import { createElement, Fragment } from "react";
|
|
|
2
2
|
/**
|
|
3
3
|
* WordPress dependencies
|
|
4
4
|
*/
|
|
5
|
-
import {
|
|
5
|
+
import { BlockToolbar } from '@wordpress/block-editor';
|
|
6
6
|
import { useSelect } from '@wordpress/data';
|
|
7
7
|
import { useRef } from '@wordpress/element';
|
|
8
8
|
import { __ } from '@wordpress/i18n';
|
|
@@ -17,13 +17,7 @@ import { store as preferencesStore } from '@wordpress/preferences';
|
|
|
17
17
|
import DocumentTools from './document-tools';
|
|
18
18
|
import SaveButton from '../save-button';
|
|
19
19
|
import MoreMenu from '../more-menu';
|
|
20
|
-
|
|
21
|
-
const {
|
|
22
|
-
BlockContextualToolbar
|
|
23
|
-
} = unlock(blockEditorPrivateApis);
|
|
24
|
-
function Header({
|
|
25
|
-
setListViewToggleElement
|
|
26
|
-
}) {
|
|
20
|
+
function Header() {
|
|
27
21
|
const isLargeViewport = useViewportMatch('medium');
|
|
28
22
|
const blockToolbarRef = useRef();
|
|
29
23
|
const {
|
|
@@ -40,12 +34,10 @@ function Header({
|
|
|
40
34
|
}, __('Widgets')), !isLargeViewport && createElement(VisuallyHidden, {
|
|
41
35
|
as: "h1",
|
|
42
36
|
className: "edit-widgets-header__title"
|
|
43
|
-
}, __('Widgets')), createElement(DocumentTools, {
|
|
44
|
-
setListViewToggleElement: setListViewToggleElement
|
|
45
|
-
}), hasFixedToolbar && isLargeViewport && createElement(Fragment, null, createElement("div", {
|
|
37
|
+
}, __('Widgets')), createElement(DocumentTools, null), hasFixedToolbar && isLargeViewport && createElement(Fragment, null, createElement("div", {
|
|
46
38
|
className: "selected-block-tools-wrapper"
|
|
47
|
-
}, createElement(
|
|
48
|
-
|
|
39
|
+
}, createElement(BlockToolbar, {
|
|
40
|
+
hideDragHandle: true
|
|
49
41
|
})), createElement(Popover.Slot, {
|
|
50
42
|
ref: blockToolbarRef,
|
|
51
43
|
name: "block-toolbar"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["BlockToolbar","useSelect","useRef","__","Popover","VisuallyHidden","PinnedItems","useViewportMatch","store","preferencesStore","DocumentTools","SaveButton","MoreMenu","Header","isLargeViewport","blockToolbarRef","hasFixedToolbar","select","get","createElement","Fragment","className","as","hideDragHandle","Slot","ref","name","scope"],"sources":["@wordpress/edit-widgets/src/components/header/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { BlockToolbar } from '@wordpress/block-editor';\nimport { useSelect } from '@wordpress/data';\nimport { useRef } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport { Popover, VisuallyHidden } from '@wordpress/components';\nimport { PinnedItems } from '@wordpress/interface';\nimport { useViewportMatch } from '@wordpress/compose';\nimport { store as preferencesStore } from '@wordpress/preferences';\n\n/**\n * Internal dependencies\n */\nimport DocumentTools from './document-tools';\nimport SaveButton from '../save-button';\nimport MoreMenu from '../more-menu';\n\nfunction Header() {\n\tconst isLargeViewport = useViewportMatch( 'medium' );\n\tconst blockToolbarRef = useRef();\n\tconst { hasFixedToolbar } = useSelect(\n\t\t( select ) => ( {\n\t\t\thasFixedToolbar: !! select( preferencesStore ).get(\n\t\t\t\t'core/edit-widgets',\n\t\t\t\t'fixedToolbar'\n\t\t\t),\n\t\t} ),\n\t\t[]\n\t);\n\n\treturn (\n\t\t<>\n\t\t\t<div className=\"edit-widgets-header\">\n\t\t\t\t<div className=\"edit-widgets-header__navigable-toolbar-wrapper\">\n\t\t\t\t\t{ isLargeViewport && (\n\t\t\t\t\t\t<h1 className=\"edit-widgets-header__title\">\n\t\t\t\t\t\t\t{ __( 'Widgets' ) }\n\t\t\t\t\t\t</h1>\n\t\t\t\t\t) }\n\t\t\t\t\t{ ! isLargeViewport && (\n\t\t\t\t\t\t<VisuallyHidden\n\t\t\t\t\t\t\tas=\"h1\"\n\t\t\t\t\t\t\tclassName=\"edit-widgets-header__title\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Widgets' ) }\n\t\t\t\t\t\t</VisuallyHidden>\n\t\t\t\t\t) }\n\t\t\t\t\t<DocumentTools />\n\t\t\t\t\t{ hasFixedToolbar && isLargeViewport && (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<div className=\"selected-block-tools-wrapper\">\n\t\t\t\t\t\t\t\t<BlockToolbar hideDragHandle />\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t<Popover.Slot\n\t\t\t\t\t\t\t\tref={ blockToolbarRef }\n\t\t\t\t\t\t\t\tname=\"block-toolbar\"\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</>\n\t\t\t\t\t) }\n\t\t\t\t</div>\n\t\t\t\t<div className=\"edit-widgets-header__actions\">\n\t\t\t\t\t<SaveButton />\n\t\t\t\t\t<PinnedItems.Slot scope=\"core/edit-widgets\" />\n\t\t\t\t\t<MoreMenu />\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t</>\n\t);\n}\n\nexport default Header;\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,YAAY,QAAQ,yBAAyB;AACtD,SAASC,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,MAAM,QAAQ,oBAAoB;AAC3C,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SAASC,OAAO,EAAEC,cAAc,QAAQ,uBAAuB;AAC/D,SAASC,WAAW,QAAQ,sBAAsB;AAClD,SAASC,gBAAgB,QAAQ,oBAAoB;AACrD,SAASC,KAAK,IAAIC,gBAAgB,QAAQ,wBAAwB;;AAElE;AACA;AACA;AACA,OAAOC,aAAa,MAAM,kBAAkB;AAC5C,OAAOC,UAAU,MAAM,gBAAgB;AACvC,OAAOC,QAAQ,MAAM,cAAc;AAEnC,SAASC,MAAMA,CAAA,EAAG;EACjB,MAAMC,eAAe,GAAGP,gBAAgB,CAAE,QAAS,CAAC;EACpD,MAAMQ,eAAe,GAAGb,MAAM,CAAC,CAAC;EAChC,MAAM;IAAEc;EAAgB,CAAC,GAAGf,SAAS,CAClCgB,MAAM,KAAQ;IACfD,eAAe,EAAE,CAAC,CAAEC,MAAM,CAAER,gBAAiB,CAAC,CAACS,GAAG,CACjD,mBAAmB,EACnB,cACD;EACD,CAAC,CAAE,EACH,EACD,CAAC;EAED,OACCC,aAAA,CAAAC,QAAA,QACCD,aAAA;IAAKE,SAAS,EAAC;EAAqB,GACnCF,aAAA;IAAKE,SAAS,EAAC;EAAgD,GAC5DP,eAAe,IAChBK,aAAA;IAAIE,SAAS,EAAC;EAA4B,GACvClB,EAAE,CAAE,SAAU,CACb,CACJ,EACC,CAAEW,eAAe,IAClBK,aAAA,CAACd,cAAc;IACdiB,EAAE,EAAC,IAAI;IACPD,SAAS,EAAC;EAA4B,GAEpClB,EAAE,CAAE,SAAU,CACD,CAChB,EACDgB,aAAA,CAACT,aAAa,MAAE,CAAC,EACfM,eAAe,IAAIF,eAAe,IACnCK,aAAA,CAAAC,QAAA,QACCD,aAAA;IAAKE,SAAS,EAAC;EAA8B,GAC5CF,aAAA,CAACnB,YAAY;IAACuB,cAAc;EAAA,CAAE,CAC1B,CAAC,EACNJ,aAAA,CAACf,OAAO,CAACoB,IAAI;IACZC,GAAG,EAAGV,eAAiB;IACvBW,IAAI,EAAC;EAAe,CACpB,CACA,CAEC,CAAC,EACNP,aAAA;IAAKE,SAAS,EAAC;EAA8B,GAC5CF,aAAA,CAACR,UAAU,MAAE,CAAC,EACdQ,aAAA,CAACb,WAAW,CAACkB,IAAI;IAACG,KAAK,EAAC;EAAmB,CAAE,CAAC,EAC9CR,aAAA,CAACP,QAAQ,MAAE,CACP,CACD,CACJ,CAAC;AAEL;AAEA,eAAeC,MAAM"}
|
|
@@ -3,18 +3,21 @@ import { createElement } from "react";
|
|
|
3
3
|
* WordPress dependencies
|
|
4
4
|
*/
|
|
5
5
|
import { __, isRTL } from '@wordpress/i18n';
|
|
6
|
-
import {
|
|
6
|
+
import { Button } from '@wordpress/components';
|
|
7
7
|
import { useSelect, useDispatch } from '@wordpress/data';
|
|
8
8
|
import { redo as redoIcon, undo as undoIcon } from '@wordpress/icons';
|
|
9
9
|
import { displayShortcut, isAppleOS } from '@wordpress/keycodes';
|
|
10
10
|
import { store as coreStore } from '@wordpress/core-data';
|
|
11
|
-
|
|
11
|
+
import { forwardRef } from '@wordpress/element';
|
|
12
|
+
function RedoButton(props, ref) {
|
|
12
13
|
const shortcut = isAppleOS() ? displayShortcut.primaryShift('z') : displayShortcut.primary('y');
|
|
13
14
|
const hasRedo = useSelect(select => select(coreStore).hasRedo(), []);
|
|
14
15
|
const {
|
|
15
16
|
redo
|
|
16
17
|
} = useDispatch(coreStore);
|
|
17
|
-
return createElement(
|
|
18
|
+
return createElement(Button, {
|
|
19
|
+
...props,
|
|
20
|
+
ref: ref,
|
|
18
21
|
icon: !isRTL() ? redoIcon : undoIcon,
|
|
19
22
|
label: __('Redo'),
|
|
20
23
|
shortcut: shortcut
|
|
@@ -26,4 +29,5 @@ export default function RedoButton() {
|
|
|
26
29
|
onClick: hasRedo ? redo : undefined
|
|
27
30
|
});
|
|
28
31
|
}
|
|
32
|
+
export default forwardRef(RedoButton);
|
|
29
33
|
//# sourceMappingURL=redo.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["__","isRTL","
|
|
1
|
+
{"version":3,"names":["__","isRTL","Button","useSelect","useDispatch","redo","redoIcon","undo","undoIcon","displayShortcut","isAppleOS","store","coreStore","forwardRef","RedoButton","props","ref","shortcut","primaryShift","primary","hasRedo","select","createElement","icon","label","onClick","undefined"],"sources":["@wordpress/edit-widgets/src/components/header/undo-redo/redo.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, isRTL } from '@wordpress/i18n';\nimport { Button } from '@wordpress/components';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { redo as redoIcon, undo as undoIcon } from '@wordpress/icons';\nimport { displayShortcut, isAppleOS } from '@wordpress/keycodes';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { forwardRef } from '@wordpress/element';\n\nfunction RedoButton( props, ref ) {\n\tconst shortcut = isAppleOS()\n\t\t? displayShortcut.primaryShift( 'z' )\n\t\t: displayShortcut.primary( 'y' );\n\n\tconst hasRedo = useSelect(\n\t\t( select ) => select( coreStore ).hasRedo(),\n\t\t[]\n\t);\n\tconst { redo } = useDispatch( coreStore );\n\treturn (\n\t\t<Button\n\t\t\t{ ...props }\n\t\t\tref={ ref }\n\t\t\ticon={ ! isRTL() ? redoIcon : undoIcon }\n\t\t\tlabel={ __( 'Redo' ) }\n\t\t\tshortcut={ shortcut }\n\t\t\t// If there are no undo levels we don't want to actually disable this\n\t\t\t// button, because it will remove focus for keyboard users.\n\t\t\t// See: https://github.com/WordPress/gutenberg/issues/3486\n\t\t\taria-disabled={ ! hasRedo }\n\t\t\tonClick={ hasRedo ? redo : undefined }\n\t\t/>\n\t);\n}\n\nexport default forwardRef( RedoButton );\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,EAAE,EAAEC,KAAK,QAAQ,iBAAiB;AAC3C,SAASC,MAAM,QAAQ,uBAAuB;AAC9C,SAASC,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACxD,SAASC,IAAI,IAAIC,QAAQ,EAAEC,IAAI,IAAIC,QAAQ,QAAQ,kBAAkB;AACrE,SAASC,eAAe,EAAEC,SAAS,QAAQ,qBAAqB;AAChE,SAASC,KAAK,IAAIC,SAAS,QAAQ,sBAAsB;AACzD,SAASC,UAAU,QAAQ,oBAAoB;AAE/C,SAASC,UAAUA,CAAEC,KAAK,EAAEC,GAAG,EAAG;EACjC,MAAMC,QAAQ,GAAGP,SAAS,CAAC,CAAC,GACzBD,eAAe,CAACS,YAAY,CAAE,GAAI,CAAC,GACnCT,eAAe,CAACU,OAAO,CAAE,GAAI,CAAC;EAEjC,MAAMC,OAAO,GAAGjB,SAAS,CACtBkB,MAAM,IAAMA,MAAM,CAAET,SAAU,CAAC,CAACQ,OAAO,CAAC,CAAC,EAC3C,EACD,CAAC;EACD,MAAM;IAAEf;EAAK,CAAC,GAAGD,WAAW,CAAEQ,SAAU,CAAC;EACzC,OACCU,aAAA,CAACpB,MAAM;IAAA,GACDa,KAAK;IACVC,GAAG,EAAGA,GAAK;IACXO,IAAI,EAAG,CAAEtB,KAAK,CAAC,CAAC,GAAGK,QAAQ,GAAGE,QAAU;IACxCgB,KAAK,EAAGxB,EAAE,CAAE,MAAO,CAAG;IACtBiB,QAAQ,EAAGA;IACX;IACA;IACA;IAAA;IACA,iBAAgB,CAAEG,OAAS;IAC3BK,OAAO,EAAGL,OAAO,GAAGf,IAAI,GAAGqB;EAAW,CACtC,CAAC;AAEJ;AAEA,eAAeb,UAAU,CAAEC,UAAW,CAAC"}
|
|
@@ -3,17 +3,20 @@ import { createElement } from "react";
|
|
|
3
3
|
* WordPress dependencies
|
|
4
4
|
*/
|
|
5
5
|
import { __, isRTL } from '@wordpress/i18n';
|
|
6
|
-
import {
|
|
6
|
+
import { Button } from '@wordpress/components';
|
|
7
7
|
import { useSelect, useDispatch } from '@wordpress/data';
|
|
8
8
|
import { undo as undoIcon, redo as redoIcon } from '@wordpress/icons';
|
|
9
9
|
import { displayShortcut } from '@wordpress/keycodes';
|
|
10
10
|
import { store as coreStore } from '@wordpress/core-data';
|
|
11
|
-
|
|
11
|
+
import { forwardRef } from '@wordpress/element';
|
|
12
|
+
function UndoButton(props, ref) {
|
|
12
13
|
const hasUndo = useSelect(select => select(coreStore).hasUndo(), []);
|
|
13
14
|
const {
|
|
14
15
|
undo
|
|
15
16
|
} = useDispatch(coreStore);
|
|
16
|
-
return createElement(
|
|
17
|
+
return createElement(Button, {
|
|
18
|
+
...props,
|
|
19
|
+
ref: ref,
|
|
17
20
|
icon: !isRTL() ? undoIcon : redoIcon,
|
|
18
21
|
label: __('Undo'),
|
|
19
22
|
shortcut: displayShortcut.primary('z')
|
|
@@ -25,4 +28,5 @@ export default function UndoButton() {
|
|
|
25
28
|
onClick: hasUndo ? undo : undefined
|
|
26
29
|
});
|
|
27
30
|
}
|
|
31
|
+
export default forwardRef(UndoButton);
|
|
28
32
|
//# sourceMappingURL=undo.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["__","isRTL","
|
|
1
|
+
{"version":3,"names":["__","isRTL","Button","useSelect","useDispatch","undo","undoIcon","redo","redoIcon","displayShortcut","store","coreStore","forwardRef","UndoButton","props","ref","hasUndo","select","createElement","icon","label","shortcut","primary","onClick","undefined"],"sources":["@wordpress/edit-widgets/src/components/header/undo-redo/undo.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, isRTL } from '@wordpress/i18n';\nimport { Button } from '@wordpress/components';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { undo as undoIcon, redo as redoIcon } from '@wordpress/icons';\nimport { displayShortcut } from '@wordpress/keycodes';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { forwardRef } from '@wordpress/element';\n\nfunction UndoButton( props, ref ) {\n\tconst hasUndo = useSelect(\n\t\t( select ) => select( coreStore ).hasUndo(),\n\t\t[]\n\t);\n\tconst { undo } = useDispatch( coreStore );\n\treturn (\n\t\t<Button\n\t\t\t{ ...props }\n\t\t\tref={ ref }\n\t\t\ticon={ ! isRTL() ? undoIcon : redoIcon }\n\t\t\tlabel={ __( 'Undo' ) }\n\t\t\tshortcut={ displayShortcut.primary( 'z' ) }\n\t\t\t// If there are no undo levels we don't want to actually disable this\n\t\t\t// button, because it will remove focus for keyboard users.\n\t\t\t// See: https://github.com/WordPress/gutenberg/issues/3486\n\t\t\taria-disabled={ ! hasUndo }\n\t\t\tonClick={ hasUndo ? undo : undefined }\n\t\t/>\n\t);\n}\n\nexport default forwardRef( UndoButton );\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,EAAE,EAAEC,KAAK,QAAQ,iBAAiB;AAC3C,SAASC,MAAM,QAAQ,uBAAuB;AAC9C,SAASC,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACxD,SAASC,IAAI,IAAIC,QAAQ,EAAEC,IAAI,IAAIC,QAAQ,QAAQ,kBAAkB;AACrE,SAASC,eAAe,QAAQ,qBAAqB;AACrD,SAASC,KAAK,IAAIC,SAAS,QAAQ,sBAAsB;AACzD,SAASC,UAAU,QAAQ,oBAAoB;AAE/C,SAASC,UAAUA,CAAEC,KAAK,EAAEC,GAAG,EAAG;EACjC,MAAMC,OAAO,GAAGb,SAAS,CACtBc,MAAM,IAAMA,MAAM,CAAEN,SAAU,CAAC,CAACK,OAAO,CAAC,CAAC,EAC3C,EACD,CAAC;EACD,MAAM;IAAEX;EAAK,CAAC,GAAGD,WAAW,CAAEO,SAAU,CAAC;EACzC,OACCO,aAAA,CAAChB,MAAM;IAAA,GACDY,KAAK;IACVC,GAAG,EAAGA,GAAK;IACXI,IAAI,EAAG,CAAElB,KAAK,CAAC,CAAC,GAAGK,QAAQ,GAAGE,QAAU;IACxCY,KAAK,EAAGpB,EAAE,CAAE,MAAO,CAAG;IACtBqB,QAAQ,EAAGZ,eAAe,CAACa,OAAO,CAAE,GAAI;IACxC;IACA;IACA;IAAA;IACA,iBAAgB,CAAEN,OAAS;IAC3BO,OAAO,EAAGP,OAAO,GAAGX,IAAI,GAAGmB;EAAW,CACtC,CAAC;AAEJ;AAEA,eAAeZ,UAAU,CAAEC,UAAW,CAAC"}
|
|
@@ -4,7 +4,7 @@ import { createElement, Fragment } from "react";
|
|
|
4
4
|
*/
|
|
5
5
|
import { useViewportMatch } from '@wordpress/compose';
|
|
6
6
|
import { BlockBreadcrumb } from '@wordpress/block-editor';
|
|
7
|
-
import { useEffect
|
|
7
|
+
import { useEffect } from '@wordpress/element';
|
|
8
8
|
import { useDispatch, useSelect } from '@wordpress/data';
|
|
9
9
|
import { InterfaceSkeleton, ComplementaryArea, store as interfaceStore } from '@wordpress/interface';
|
|
10
10
|
import { __ } from '@wordpress/i18n';
|
|
@@ -53,7 +53,6 @@ function Interface({
|
|
|
53
53
|
previousShortcut: select(keyboardShortcutsStore).getAllShortcutKeyCombinations('core/edit-widgets/previous-region'),
|
|
54
54
|
nextShortcut: select(keyboardShortcutsStore).getAllShortcutKeyCombinations('core/edit-widgets/next-region')
|
|
55
55
|
}), []);
|
|
56
|
-
const [listViewToggleElement, setListViewToggleElement] = useState(null);
|
|
57
56
|
|
|
58
57
|
// Inserter and Sidebars are mutually exclusive
|
|
59
58
|
useEffect(() => {
|
|
@@ -74,12 +73,8 @@ function Interface({
|
|
|
74
73
|
...interfaceLabels,
|
|
75
74
|
secondarySidebar: secondarySidebarLabel
|
|
76
75
|
},
|
|
77
|
-
header: createElement(Header,
|
|
78
|
-
|
|
79
|
-
}),
|
|
80
|
-
secondarySidebar: hasSecondarySidebar && createElement(SecondarySidebar, {
|
|
81
|
-
listViewToggleElement: listViewToggleElement
|
|
82
|
-
}),
|
|
76
|
+
header: createElement(Header, null),
|
|
77
|
+
secondarySidebar: hasSecondarySidebar && createElement(SecondarySidebar, null),
|
|
83
78
|
sidebar: hasSidebarEnabled && createElement(ComplementaryArea.Slot, {
|
|
84
79
|
scope: "core/edit-widgets"
|
|
85
80
|
}),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useViewportMatch","BlockBreadcrumb","useEffect","
|
|
1
|
+
{"version":3,"names":["useViewportMatch","BlockBreadcrumb","useEffect","useDispatch","useSelect","InterfaceSkeleton","ComplementaryArea","store","interfaceStore","__","keyboardShortcutsStore","preferencesStore","Header","WidgetAreasBlockEditorContent","editWidgetsStore","SecondarySidebar","interfaceLabels","header","body","sidebar","footer","Interface","blockEditorSettings","isMobileViewport","isHugeViewport","setIsInserterOpened","setIsListViewOpened","closeGeneralSidebar","hasBlockBreadCrumbsEnabled","hasSidebarEnabled","isInserterOpened","isListViewOpened","previousShortcut","nextShortcut","select","getActiveComplementaryArea","name","get","getAllShortcutKeyCombinations","secondarySidebarLabel","hasSecondarySidebar","createElement","labels","secondarySidebar","Slot","scope","content","Fragment","className","rootLabelText","shortcuts","previous","next"],"sources":["@wordpress/edit-widgets/src/components/layout/interface.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useViewportMatch } from '@wordpress/compose';\nimport { BlockBreadcrumb } from '@wordpress/block-editor';\nimport { useEffect } from '@wordpress/element';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport {\n\tInterfaceSkeleton,\n\tComplementaryArea,\n\tstore as interfaceStore,\n} from '@wordpress/interface';\nimport { __ } from '@wordpress/i18n';\nimport { store as keyboardShortcutsStore } from '@wordpress/keyboard-shortcuts';\nimport { store as preferencesStore } from '@wordpress/preferences';\n\n/**\n * Internal dependencies\n */\nimport Header from '../header';\nimport WidgetAreasBlockEditorContent from '../widget-areas-block-editor-content';\nimport { store as editWidgetsStore } from '../../store';\nimport SecondarySidebar from '../secondary-sidebar';\n\nconst interfaceLabels = {\n\t/* translators: accessibility text for the widgets screen top bar landmark region. */\n\theader: __( 'Widgets top bar' ),\n\t/* translators: accessibility text for the widgets screen content landmark region. */\n\tbody: __( 'Widgets and blocks' ),\n\t/* translators: accessibility text for the widgets screen settings landmark region. */\n\tsidebar: __( 'Widgets settings' ),\n\t/* translators: accessibility text for the widgets screen footer landmark region. */\n\tfooter: __( 'Widgets footer' ),\n};\n\nfunction Interface( { blockEditorSettings } ) {\n\tconst isMobileViewport = useViewportMatch( 'medium', '<' );\n\tconst isHugeViewport = useViewportMatch( 'huge', '>=' );\n\tconst { setIsInserterOpened, setIsListViewOpened, closeGeneralSidebar } =\n\t\tuseDispatch( editWidgetsStore );\n\tconst {\n\t\thasBlockBreadCrumbsEnabled,\n\t\thasSidebarEnabled,\n\t\tisInserterOpened,\n\t\tisListViewOpened,\n\t\tpreviousShortcut,\n\t\tnextShortcut,\n\t} = useSelect(\n\t\t( select ) => ( {\n\t\t\thasSidebarEnabled: !! select(\n\t\t\t\tinterfaceStore\n\t\t\t).getActiveComplementaryArea( editWidgetsStore.name ),\n\t\t\tisInserterOpened: !! select( editWidgetsStore ).isInserterOpened(),\n\t\t\tisListViewOpened: !! select( editWidgetsStore ).isListViewOpened(),\n\t\t\thasBlockBreadCrumbsEnabled: !! select( preferencesStore ).get(\n\t\t\t\t'core/edit-widgets',\n\t\t\t\t'showBlockBreadcrumbs'\n\t\t\t),\n\t\t\tpreviousShortcut: select(\n\t\t\t\tkeyboardShortcutsStore\n\t\t\t).getAllShortcutKeyCombinations(\n\t\t\t\t'core/edit-widgets/previous-region'\n\t\t\t),\n\t\t\tnextShortcut: select(\n\t\t\t\tkeyboardShortcutsStore\n\t\t\t).getAllShortcutKeyCombinations( 'core/edit-widgets/next-region' ),\n\t\t} ),\n\t\t[]\n\t);\n\n\t// Inserter and Sidebars are mutually exclusive\n\tuseEffect( () => {\n\t\tif ( hasSidebarEnabled && ! isHugeViewport ) {\n\t\t\tsetIsInserterOpened( false );\n\t\t\tsetIsListViewOpened( false );\n\t\t}\n\t}, [ hasSidebarEnabled, isHugeViewport ] );\n\n\tuseEffect( () => {\n\t\tif ( ( isInserterOpened || isListViewOpened ) && ! isHugeViewport ) {\n\t\t\tcloseGeneralSidebar();\n\t\t}\n\t}, [ isInserterOpened, isListViewOpened, isHugeViewport ] );\n\n\tconst secondarySidebarLabel = isListViewOpened\n\t\t? __( 'List View' )\n\t\t: __( 'Block Library' );\n\n\tconst hasSecondarySidebar = isListViewOpened || isInserterOpened;\n\n\treturn (\n\t\t<InterfaceSkeleton\n\t\t\tlabels={ {\n\t\t\t\t...interfaceLabels,\n\t\t\t\tsecondarySidebar: secondarySidebarLabel,\n\t\t\t} }\n\t\t\theader={ <Header /> }\n\t\t\tsecondarySidebar={ hasSecondarySidebar && <SecondarySidebar /> }\n\t\t\tsidebar={\n\t\t\t\thasSidebarEnabled && (\n\t\t\t\t\t<ComplementaryArea.Slot scope=\"core/edit-widgets\" />\n\t\t\t\t)\n\t\t\t}\n\t\t\tcontent={\n\t\t\t\t<>\n\t\t\t\t\t<WidgetAreasBlockEditorContent\n\t\t\t\t\t\tblockEditorSettings={ blockEditorSettings }\n\t\t\t\t\t/>\n\t\t\t\t</>\n\t\t\t}\n\t\t\tfooter={\n\t\t\t\thasBlockBreadCrumbsEnabled &&\n\t\t\t\t! isMobileViewport && (\n\t\t\t\t\t<div className=\"edit-widgets-layout__footer\">\n\t\t\t\t\t\t<BlockBreadcrumb rootLabelText={ __( 'Widgets' ) } />\n\t\t\t\t\t</div>\n\t\t\t\t)\n\t\t\t}\n\t\t\tshortcuts={ {\n\t\t\t\tprevious: previousShortcut,\n\t\t\t\tnext: nextShortcut,\n\t\t\t} }\n\t\t/>\n\t);\n}\n\nexport default Interface;\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,gBAAgB,QAAQ,oBAAoB;AACrD,SAASC,eAAe,QAAQ,yBAAyB;AACzD,SAASC,SAAS,QAAQ,oBAAoB;AAC9C,SAASC,WAAW,EAAEC,SAAS,QAAQ,iBAAiB;AACxD,SACCC,iBAAiB,EACjBC,iBAAiB,EACjBC,KAAK,IAAIC,cAAc,QACjB,sBAAsB;AAC7B,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SAASF,KAAK,IAAIG,sBAAsB,QAAQ,+BAA+B;AAC/E,SAASH,KAAK,IAAII,gBAAgB,QAAQ,wBAAwB;;AAElE;AACA;AACA;AACA,OAAOC,MAAM,MAAM,WAAW;AAC9B,OAAOC,6BAA6B,MAAM,sCAAsC;AAChF,SAASN,KAAK,IAAIO,gBAAgB,QAAQ,aAAa;AACvD,OAAOC,gBAAgB,MAAM,sBAAsB;AAEnD,MAAMC,eAAe,GAAG;EACvB;EACAC,MAAM,EAAER,EAAE,CAAE,iBAAkB,CAAC;EAC/B;EACAS,IAAI,EAAET,EAAE,CAAE,oBAAqB,CAAC;EAChC;EACAU,OAAO,EAAEV,EAAE,CAAE,kBAAmB,CAAC;EACjC;EACAW,MAAM,EAAEX,EAAE,CAAE,gBAAiB;AAC9B,CAAC;AAED,SAASY,SAASA,CAAE;EAAEC;AAAoB,CAAC,EAAG;EAC7C,MAAMC,g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