@wordpress/edit-widgets 5.15.0 → 5.17.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 +4 -0
- package/build/blocks/widget-area/edit/index.js +4 -16
- package/build/blocks/widget-area/edit/index.js.map +1 -1
- package/build/blocks/widget-area/edit/inner-blocks.js +5 -10
- package/build/blocks/widget-area/edit/inner-blocks.js.map +1 -1
- package/build/blocks/widget-area/edit/use-is-dragging-within.js +5 -10
- package/build/blocks/widget-area/edit/use-is-dragging-within.js.map +1 -1
- package/build/blocks/widget-area/index.js +0 -5
- package/build/blocks/widget-area/index.js.map +1 -1
- package/build/components/error-boundary/index.js +1 -15
- package/build/components/error-boundary/index.js.map +1 -1
- package/build/components/header/index.js +9 -32
- package/build/components/header/index.js.map +1 -1
- package/build/components/header/undo-redo/redo.js +3 -9
- package/build/components/header/undo-redo/redo.js.map +1 -1
- package/build/components/header/undo-redo/undo.js +3 -9
- package/build/components/header/undo-redo/undo.js.map +1 -1
- package/build/components/keyboard-shortcut-help-modal/config.js +1 -2
- package/build/components/keyboard-shortcut-help-modal/config.js.map +1 -1
- package/build/components/keyboard-shortcut-help-modal/dynamic-shortcut.js +1 -9
- package/build/components/keyboard-shortcut-help-modal/dynamic-shortcut.js.map +1 -1
- package/build/components/keyboard-shortcut-help-modal/index.js +4 -20
- package/build/components/keyboard-shortcut-help-modal/index.js.map +1 -1
- package/build/components/keyboard-shortcut-help-modal/shortcut.js +1 -6
- package/build/components/keyboard-shortcut-help-modal/shortcut.js.map +1 -1
- package/build/components/keyboard-shortcuts/index.js +1 -18
- package/build/components/keyboard-shortcuts/index.js.map +1 -1
- package/build/components/layout/index.js +2 -19
- package/build/components/layout/index.js.map +1 -1
- package/build/components/layout/interface.js +5 -21
- package/build/components/layout/interface.js.map +1 -1
- package/build/components/layout/unsaved-changes-warning.js +0 -6
- package/build/components/layout/unsaved-changes-warning.js.map +1 -1
- package/build/components/more-menu/index.js +2 -17
- package/build/components/more-menu/index.js.map +1 -1
- package/build/components/more-menu/tools-more-menu-group.js +1 -5
- package/build/components/more-menu/tools-more-menu-group.js.map +1 -1
- package/build/components/notices/index.js +1 -6
- package/build/components/notices/index.js.map +1 -1
- package/build/components/save-button/index.js +1 -7
- package/build/components/save-button/index.js.map +1 -1
- package/build/components/secondary-sidebar/index.js +1 -10
- package/build/components/secondary-sidebar/index.js.map +1 -1
- package/build/components/secondary-sidebar/inserter-sidebar.js +1 -11
- package/build/components/secondary-sidebar/inserter-sidebar.js.map +1 -1
- package/build/components/secondary-sidebar/list-view-sidebar.js +6 -15
- package/build/components/secondary-sidebar/list-view-sidebar.js.map +1 -1
- package/build/components/sidebar/index.js +12 -26
- package/build/components/sidebar/index.js.map +1 -1
- package/build/components/sidebar/widget-areas.js +1 -12
- package/build/components/sidebar/widget-areas.js.map +1 -1
- package/build/components/welcome-guide/index.js +3 -12
- package/build/components/welcome-guide/index.js.map +1 -1
- package/build/components/widget-areas-block-editor-content/index.js +1 -8
- package/build/components/widget-areas-block-editor-content/index.js.map +1 -1
- package/build/components/widget-areas-block-editor-provider/index.js +8 -23
- package/build/components/widget-areas-block-editor-provider/index.js.map +1 -1
- package/build/constants.js.map +1 -1
- package/build/filters/index.js +0 -1
- package/build/filters/index.js.map +1 -1
- package/build/filters/move-to-widget-area.js +3 -9
- package/build/filters/move-to-widget-area.js.map +1 -1
- package/build/filters/replace-media-upload.js +1 -3
- package/build/filters/replace-media-upload.js.map +1 -1
- package/build/hooks/use-last-selected-widget-area.js +5 -13
- package/build/hooks/use-last-selected-widget-area.js.map +1 -1
- package/build/hooks/use-widget-library-insertion-point.js +6 -14
- package/build/hooks/use-widget-library-insertion-point.js.map +1 -1
- package/build/index.js +6 -34
- package/build/index.js.map +1 -1
- package/build/lock-unlock.js +1 -2
- package/build/lock-unlock.js.map +1 -1
- package/build/store/actions.js +41 -79
- package/build/store/actions.js.map +1 -1
- package/build/store/constants.js +0 -1
- package/build/store/constants.js.map +1 -1
- package/build/store/index.js +4 -15
- package/build/store/index.js.map +1 -1
- package/build/store/reducer.js +4 -16
- package/build/store/reducer.js.map +1 -1
- package/build/store/resolvers.js +1 -17
- package/build/store/resolvers.js.map +1 -1
- package/build/store/selectors.js +28 -49
- package/build/store/selectors.js.map +1 -1
- package/build/store/transformers.js +7 -16
- package/build/store/transformers.js.map +1 -1
- package/build/store/utils.js +7 -16
- package/build/store/utils.js.map +1 -1
- package/build-module/blocks/widget-area/edit/index.js +5 -8
- package/build-module/blocks/widget-area/edit/index.js.map +1 -1
- package/build-module/blocks/widget-area/edit/inner-blocks.js +6 -6
- package/build-module/blocks/widget-area/edit/inner-blocks.js.map +1 -1
- package/build-module/blocks/widget-area/edit/use-is-dragging-within.js +6 -9
- package/build-module/blocks/widget-area/edit/use-is-dragging-within.js.map +1 -1
- package/build-module/blocks/widget-area/index.js +1 -1
- package/build-module/blocks/widget-area/index.js.map +1 -1
- package/build-module/components/error-boundary/index.js +0 -9
- package/build-module/components/error-boundary/index.js.map +1 -1
- package/build-module/components/header/index.js +9 -17
- package/build-module/components/header/index.js.map +1 -1
- package/build-module/components/header/undo-redo/redo.js +2 -2
- package/build-module/components/header/undo-redo/redo.js.map +1 -1
- package/build-module/components/header/undo-redo/undo.js +2 -2
- package/build-module/components/header/undo-redo/undo.js.map +1 -1
- package/build-module/components/keyboard-shortcut-help-modal/config.js.map +1 -1
- package/build-module/components/keyboard-shortcut-help-modal/dynamic-shortcut.js +1 -6
- package/build-module/components/keyboard-shortcut-help-modal/dynamic-shortcut.js.map +1 -1
- package/build-module/components/keyboard-shortcut-help-modal/index.js +5 -13
- package/build-module/components/keyboard-shortcut-help-modal/index.js.map +1 -1
- package/build-module/components/keyboard-shortcut-help-modal/shortcut.js +0 -5
- package/build-module/components/keyboard-shortcut-help-modal/shortcut.js.map +1 -1
- package/build-module/components/keyboard-shortcuts/index.js +1 -10
- package/build-module/components/keyboard-shortcuts/index.js.map +1 -1
- package/build-module/components/layout/index.js +2 -8
- package/build-module/components/layout/index.js.map +1 -1
- package/build-module/components/layout/interface.js +5 -9
- package/build-module/components/layout/interface.js.map +1 -1
- package/build-module/components/layout/unsaved-changes-warning.js +2 -3
- package/build-module/components/layout/unsaved-changes-warning.js.map +1 -1
- package/build-module/components/more-menu/index.js +2 -6
- package/build-module/components/more-menu/index.js.map +1 -1
- package/build-module/components/more-menu/tools-more-menu-group.js +0 -3
- package/build-module/components/more-menu/tools-more-menu-group.js.map +1 -1
- package/build-module/components/notices/index.js +0 -3
- package/build-module/components/notices/index.js.map +1 -1
- package/build-module/components/save-button/index.js +1 -4
- package/build-module/components/save-button/index.js.map +1 -1
- package/build-module/components/secondary-sidebar/index.js +1 -6
- package/build-module/components/secondary-sidebar/index.js.map +1 -1
- package/build-module/components/secondary-sidebar/inserter-sidebar.js +1 -2
- package/build-module/components/secondary-sidebar/inserter-sidebar.js.map +1 -1
- package/build-module/components/secondary-sidebar/list-view-sidebar.js +6 -7
- package/build-module/components/secondary-sidebar/list-view-sidebar.js.map +1 -1
- package/build-module/components/sidebar/index.js +13 -18
- package/build-module/components/sidebar/index.js.map +1 -1
- package/build-module/components/sidebar/widget-areas.js +1 -4
- package/build-module/components/sidebar/widget-areas.js.map +1 -1
- package/build-module/components/welcome-guide/index.js +3 -7
- package/build-module/components/welcome-guide/index.js.map +1 -1
- package/build-module/components/widget-areas-block-editor-content/index.js +1 -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 +8 -7
- package/build-module/components/widget-areas-block-editor-provider/index.js.map +1 -1
- package/build-module/constants.js.map +1 -1
- package/build-module/filters/index.js.map +1 -1
- package/build-module/filters/move-to-widget-area.js +4 -4
- package/build-module/filters/move-to-widget-area.js.map +1 -1
- package/build-module/filters/replace-media-upload.js +0 -2
- package/build-module/filters/replace-media-upload.js.map +1 -1
- package/build-module/hooks/use-last-selected-widget-area.js +7 -9
- package/build-module/hooks/use-last-selected-widget-area.js.map +1 -1
- package/build-module/hooks/use-widget-library-insertion-point.js +6 -10
- package/build-module/hooks/use-widget-library-insertion-point.js.map +1 -1
- package/build-module/index.js +8 -20
- package/build-module/index.js.map +1 -1
- package/build-module/lock-unlock.js.map +1 -1
- package/build-module/store/actions.js +43 -56
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/constants.js.map +1 -1
- package/build-module/store/index.js +6 -6
- package/build-module/store/index.js.map +1 -1
- package/build-module/store/reducer.js +5 -11
- package/build-module/store/reducer.js.map +1 -1
- package/build-module/store/resolvers.js +3 -10
- package/build-module/store/resolvers.js.map +1 -1
- package/build-module/store/selectors.js +29 -38
- package/build-module/store/selectors.js.map +1 -1
- package/build-module/store/transformers.js +8 -13
- package/build-module/store/transformers.js.map +1 -1
- package/build-module/store/utils.js +7 -7
- package/build-module/store/utils.js.map +1 -1
- package/build-style/style-rtl.css +14 -8
- package/build-style/style.css +14 -8
- package/package.json +28 -27
- package/src/components/widget-areas-block-editor-provider/index.js +3 -3
- package/src/index.js +0 -1
- package/src/store/selectors.js +10 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,26 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
7
|
exports.default = WidgetAreaEdit;
|
|
9
|
-
|
|
10
8
|
var _element = require("@wordpress/element");
|
|
11
|
-
|
|
12
9
|
var _data = require("@wordpress/data");
|
|
13
|
-
|
|
14
10
|
var _coreData = require("@wordpress/core-data");
|
|
15
|
-
|
|
16
11
|
var _components = require("@wordpress/components");
|
|
17
|
-
|
|
18
12
|
var _innerBlocks = _interopRequireDefault(require("./inner-blocks"));
|
|
19
|
-
|
|
20
13
|
var _store = require("../../../store");
|
|
21
|
-
|
|
22
14
|
var _useIsDraggingWithin = _interopRequireDefault(require("./use-is-dragging-within"));
|
|
23
|
-
|
|
24
15
|
/**
|
|
25
16
|
* WordPress dependencies
|
|
26
17
|
*/
|
|
@@ -30,6 +21,7 @@ var _useIsDraggingWithin = _interopRequireDefault(require("./use-is-dragging-wit
|
|
|
30
21
|
*/
|
|
31
22
|
|
|
32
23
|
/** @typedef {import('@wordpress/element').RefObject} RefObject */
|
|
24
|
+
|
|
33
25
|
function WidgetAreaEdit({
|
|
34
26
|
clientId,
|
|
35
27
|
className,
|
|
@@ -52,7 +44,6 @@ function WidgetAreaEdit({
|
|
|
52
44
|
setOpenedWhileDragging(false);
|
|
53
45
|
return;
|
|
54
46
|
}
|
|
55
|
-
|
|
56
47
|
if (isDraggingWithin && !isOpen) {
|
|
57
48
|
setOpen(true);
|
|
58
49
|
setOpenedWhileDragging(true);
|
|
@@ -72,7 +63,8 @@ function WidgetAreaEdit({
|
|
|
72
63
|
scrollAfterOpen: !isDragging
|
|
73
64
|
}, ({
|
|
74
65
|
opened
|
|
75
|
-
}) =>
|
|
66
|
+
}) =>
|
|
67
|
+
// This is required to ensure LegacyWidget blocks are not
|
|
76
68
|
// unmounted when the panel is collapsed. Unmounting legacy
|
|
77
69
|
// widgets may have unintended consequences (e.g. TinyMCE
|
|
78
70
|
// not being properly reinitialized)
|
|
@@ -87,6 +79,7 @@ function WidgetAreaEdit({
|
|
|
87
79
|
id: id
|
|
88
80
|
})))));
|
|
89
81
|
}
|
|
82
|
+
|
|
90
83
|
/**
|
|
91
84
|
* A React hook to determine if dragging is active.
|
|
92
85
|
*
|
|
@@ -94,23 +87,18 @@ function WidgetAreaEdit({
|
|
|
94
87
|
*
|
|
95
88
|
* @return {boolean} Is dragging within the entire document.
|
|
96
89
|
*/
|
|
97
|
-
|
|
98
|
-
|
|
99
90
|
const useIsDragging = elementRef => {
|
|
100
91
|
const [isDragging, setIsDragging] = (0, _element.useState)(false);
|
|
101
92
|
(0, _element.useEffect)(() => {
|
|
102
93
|
const {
|
|
103
94
|
ownerDocument
|
|
104
95
|
} = elementRef.current;
|
|
105
|
-
|
|
106
96
|
function handleDragStart() {
|
|
107
97
|
setIsDragging(true);
|
|
108
98
|
}
|
|
109
|
-
|
|
110
99
|
function handleDragEnd() {
|
|
111
100
|
setIsDragging(false);
|
|
112
101
|
}
|
|
113
|
-
|
|
114
102
|
ownerDocument.addEventListener('dragstart', handleDragStart);
|
|
115
103
|
ownerDocument.addEventListener('dragend', handleDragEnd);
|
|
116
104
|
return () => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"names":["_element","require","_data","_coreData","_components","_innerBlocks","_interopRequireDefault","_store","_useIsDraggingWithin","WidgetAreaEdit","clientId","className","attributes","id","name","isOpen","useSelect","select","editWidgetsStore","getIsWidgetAreaOpen","setIsWidgetAreaOpen","useDispatch","wrapper","useRef","setOpen","useCallback","openState","isDragging","useIsDragging","isDraggingWithin","useIsDraggingWithin","openedWhileDragging","setOpenedWhileDragging","useState","useEffect","createElement","Panel","ref","PanelBody","title","opened","onToggle","scrollAfterOpen","__unstableDisclosureContent","visible","EntityProvider","kind","type","default","elementRef","setIsDragging","ownerDocument","current","handleDragStart","handleDragEnd","addEventListener","removeEventListener"],"sources":["@wordpress/edit-widgets/src/blocks/widget-area/edit/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useEffect, useState, useCallback, useRef } from '@wordpress/element';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { EntityProvider } from '@wordpress/core-data';\nimport {\n\t__unstableDisclosureContent as DisclosureContent,\n\tPanel,\n\tPanelBody,\n} from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport WidgetAreaInnerBlocks from './inner-blocks';\nimport { store as editWidgetsStore } from '../../../store';\nimport useIsDraggingWithin from './use-is-dragging-within';\n\n/** @typedef {import('@wordpress/element').RefObject} RefObject */\n\nexport default function WidgetAreaEdit( {\n\tclientId,\n\tclassName,\n\tattributes: { id, name },\n} ) {\n\tconst isOpen = useSelect(\n\t\t( select ) =>\n\t\t\tselect( editWidgetsStore ).getIsWidgetAreaOpen( clientId ),\n\t\t[ clientId ]\n\t);\n\tconst { setIsWidgetAreaOpen } = useDispatch( editWidgetsStore );\n\n\tconst wrapper = useRef();\n\tconst setOpen = useCallback(\n\t\t( openState ) => setIsWidgetAreaOpen( clientId, openState ),\n\t\t[ clientId ]\n\t);\n\tconst isDragging = useIsDragging( wrapper );\n\tconst isDraggingWithin = useIsDraggingWithin( wrapper );\n\n\tconst [ openedWhileDragging, setOpenedWhileDragging ] = useState( false );\n\tuseEffect( () => {\n\t\tif ( ! isDragging ) {\n\t\t\tsetOpenedWhileDragging( false );\n\t\t\treturn;\n\t\t}\n\n\t\tif ( isDraggingWithin && ! isOpen ) {\n\t\t\tsetOpen( true );\n\t\t\tsetOpenedWhileDragging( true );\n\t\t} else if ( ! isDraggingWithin && isOpen && openedWhileDragging ) {\n\t\t\tsetOpen( false );\n\t\t}\n\t}, [ isOpen, isDragging, isDraggingWithin, openedWhileDragging ] );\n\n\treturn (\n\t\t<Panel className={ className } ref={ wrapper }>\n\t\t\t<PanelBody\n\t\t\t\ttitle={ name }\n\t\t\t\topened={ isOpen }\n\t\t\t\tonToggle={ () => {\n\t\t\t\t\tsetIsWidgetAreaOpen( clientId, ! isOpen );\n\t\t\t\t} }\n\t\t\t\tscrollAfterOpen={ ! isDragging }\n\t\t\t>\n\t\t\t\t{ ( { opened } ) => (\n\t\t\t\t\t// This is required to ensure LegacyWidget blocks are not\n\t\t\t\t\t// unmounted when the panel is collapsed. Unmounting legacy\n\t\t\t\t\t// widgets may have unintended consequences (e.g. TinyMCE\n\t\t\t\t\t// not being properly reinitialized)\n\t\t\t\t\t<DisclosureContent\n\t\t\t\t\t\tclassName=\"wp-block-widget-area__panel-body-content\"\n\t\t\t\t\t\tvisible={ opened }\n\t\t\t\t\t>\n\t\t\t\t\t\t<EntityProvider\n\t\t\t\t\t\t\tkind=\"root\"\n\t\t\t\t\t\t\ttype=\"postType\"\n\t\t\t\t\t\t\tid={ `widget-area-${ id }` }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<WidgetAreaInnerBlocks id={ id } />\n\t\t\t\t\t\t</EntityProvider>\n\t\t\t\t\t</DisclosureContent>\n\t\t\t\t) }\n\t\t\t</PanelBody>\n\t\t</Panel>\n\t);\n}\n\n/**\n * A React hook to determine if dragging is active.\n *\n * @param {RefObject<HTMLElement>} elementRef The target elementRef object.\n *\n * @return {boolean} Is dragging within the entire document.\n */\nconst useIsDragging = ( elementRef ) => {\n\tconst [ isDragging, setIsDragging ] = useState( false );\n\n\tuseEffect( () => {\n\t\tconst { ownerDocument } = elementRef.current;\n\n\t\tfunction handleDragStart() {\n\t\t\tsetIsDragging( true );\n\t\t}\n\n\t\tfunction handleDragEnd() {\n\t\t\tsetIsDragging( false );\n\t\t}\n\n\t\townerDocument.addEventListener( 'dragstart', handleDragStart );\n\t\townerDocument.addEventListener( 'dragend', handleDragEnd );\n\n\t\treturn () => {\n\t\t\townerDocument.removeEventListener( 'dragstart', handleDragStart );\n\t\t\townerDocument.removeEventListener( 'dragend', handleDragEnd );\n\t\t};\n\t}, [] );\n\n\treturn isDragging;\n};\n"],"mappings":";;;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,SAAA,GAAAF,OAAA;AACA,IAAAG,WAAA,GAAAH,OAAA;AASA,IAAAI,YAAA,GAAAC,sBAAA,CAAAL,OAAA;AACA,IAAAM,MAAA,GAAAN,OAAA;AACA,IAAAO,oBAAA,GAAAF,sBAAA,CAAAL,OAAA;AAjBA;AACA;AACA;;AAUA;AACA;AACA;;AAKA;;AAEe,SAASQ,cAAcA,CAAE;EACvCC,QAAQ;EACRC,SAAS;EACTC,UAAU,EAAE;IAAEC,EAAE;IAAEC;EAAK;AACxB,CAAC,EAAG;EACH,MAAMC,MAAM,GAAG,IAAAC,eAAS,EACrBC,MAAM,IACPA,MAAM,CAAEC,YAAiB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AAC,EAAE,EAAG,CAAC;EAEP,OAAO3B,UAAU;AAClB,CAAC"}
|
|
@@ -1,22 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
7
|
exports.default = WidgetAreaInnerBlocks;
|
|
9
|
-
|
|
10
8
|
var _element = require("@wordpress/element");
|
|
11
|
-
|
|
12
9
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
13
|
-
|
|
14
10
|
var _coreData = require("@wordpress/core-data");
|
|
15
|
-
|
|
16
11
|
var _blockEditor = require("@wordpress/block-editor");
|
|
17
|
-
|
|
18
12
|
var _useIsDraggingWithin = _interopRequireDefault(require("./use-is-dragging-within"));
|
|
19
|
-
|
|
20
13
|
/**
|
|
21
14
|
* External dependencies
|
|
22
15
|
*/
|
|
@@ -28,14 +21,15 @@ var _useIsDraggingWithin = _interopRequireDefault(require("./use-is-dragging-wit
|
|
|
28
21
|
/**
|
|
29
22
|
* Internal dependencies
|
|
30
23
|
*/
|
|
24
|
+
|
|
31
25
|
function WidgetAreaInnerBlocks({
|
|
32
26
|
id
|
|
33
27
|
}) {
|
|
34
28
|
const [blocks, onInput, onChange] = (0, _coreData.useEntityBlockEditor)('root', 'postType');
|
|
35
29
|
const innerBlocksRef = (0, _element.useRef)();
|
|
36
30
|
const isDraggingWithinInnerBlocks = (0, _useIsDraggingWithin.default)(innerBlocksRef);
|
|
37
|
-
const shouldHighlightDropZone = isDraggingWithinInnerBlocks;
|
|
38
|
-
|
|
31
|
+
const shouldHighlightDropZone = isDraggingWithinInnerBlocks;
|
|
32
|
+
// Using the experimental hook so that we can control the className of the element.
|
|
39
33
|
const innerBlocksProps = (0, _blockEditor.useInnerBlocksProps)({
|
|
40
34
|
ref: innerBlocksRef
|
|
41
35
|
}, {
|
|
@@ -50,7 +44,8 @@ function WidgetAreaInnerBlocks({
|
|
|
50
44
|
className: (0, _classnames.default)('wp-block-widget-area__inner-blocks block-editor-inner-blocks editor-styles-wrapper', {
|
|
51
45
|
'wp-block-widget-area__highlight-drop-zone': shouldHighlightDropZone
|
|
52
46
|
})
|
|
53
|
-
}, (0, _element.createElement)("div", {
|
|
47
|
+
}, (0, _element.createElement)("div", {
|
|
48
|
+
...innerBlocksProps
|
|
54
49
|
}));
|
|
55
50
|
}
|
|
56
51
|
//# sourceMappingURL=inner-blocks.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"names":["_element","require","_classnames","_interopRequireDefault","_coreData","_blockEditor","_useIsDraggingWithin","WidgetAreaInnerBlocks","id","blocks","onInput","onChange","useEntityBlockEditor","innerBlocksRef","useRef","isDraggingWithinInnerBlocks","useIsDraggingWithin","shouldHighlightDropZone","innerBlocksProps","useInnerBlocksProps","ref","value","templateLock","renderAppender","InnerBlocks","ButtonBlockAppender","createElement","className","classnames"],"sources":["@wordpress/edit-widgets/src/blocks/widget-area/edit/inner-blocks.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { useEntityBlockEditor } from '@wordpress/core-data';\nimport { InnerBlocks, useInnerBlocksProps } from '@wordpress/block-editor';\nimport { useRef } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport useIsDraggingWithin from './use-is-dragging-within';\n\nexport default function WidgetAreaInnerBlocks( { id } ) {\n\tconst [ blocks, onInput, onChange ] = useEntityBlockEditor(\n\t\t'root',\n\t\t'postType'\n\t);\n\tconst innerBlocksRef = useRef();\n\tconst isDraggingWithinInnerBlocks = useIsDraggingWithin( innerBlocksRef );\n\tconst shouldHighlightDropZone = isDraggingWithinInnerBlocks;\n\t// Using the experimental hook so that we can control the className of the element.\n\tconst innerBlocksProps = useInnerBlocksProps(\n\t\t{ ref: innerBlocksRef },\n\t\t{\n\t\t\tvalue: blocks,\n\t\t\tonInput,\n\t\t\tonChange,\n\t\t\ttemplateLock: false,\n\t\t\trenderAppender: InnerBlocks.ButtonBlockAppender,\n\t\t}\n\t);\n\n\treturn (\n\t\t<div\n\t\t\tdata-widget-area-id={ id }\n\t\t\tclassName={ classnames(\n\t\t\t\t'wp-block-widget-area__inner-blocks block-editor-inner-blocks editor-styles-wrapper',\n\t\t\t\t{\n\t\t\t\t\t'wp-block-widget-area__highlight-drop-zone':\n\t\t\t\t\t\tshouldHighlightDropZone,\n\t\t\t\t}\n\t\t\t) }\n\t\t>\n\t\t\t<div { ...innerBlocksProps } />\n\t\t</div>\n\t);\n}\n"],"mappings":";;;;;;;AAUA,IAAAA,QAAA,GAAAC,OAAA;AAPA,IAAAC,WAAA,GAAAC,sBAAA,CAAAF,OAAA;AAKA,IAAAG,SAAA,GAAAH,OAAA;AACA,IAAAI,YAAA,GAAAJ,OAAA;AAMA,IAAAK,oBAAA,GAAAH,sBAAA,CAAAF,OAAA;AAfA;AACA;AACA;;AAGA;AACA;AACA;;AAKA;AACA;AACA;;AAGe,SAASM,qBAAqBA,CAAE;EAAEC;AAAG,CAAC,EAAG;EACvD,MAAM,CAAEC,MAAM,EAAEC,OAAO,EAAEC,QAAQ,CAAE,GAAG,IAAAC,8BAAoB,EACzD,MAAM,EACN,UACD,CAAC;EACD,MAAMC,cAAc,GAAG,IAAAC,eAAM,EAAC,CAAC;EAC/B,MAAMC,2BAA2B,GAAG,IAAAC,4BAAmB,EAAEH,cAAe,CAAC;EACzE,MAAMI,uBAAuB,GAAGF,2BAA2B;EAC3D;EACA,MAAMG,gBAAgB,GAAG,IAAAC,gCAAmB,EAC3C;IAAEC,GAAG,EAAEP;EAAe,CAAC,EACvB;IACCQ,KAAK,EAAEZ,MAAM;IACbC,OAAO;IACPC,QAAQ;IACRW,YAAY,EAAE,KAAK;IACnBC,cAAc,EAAEC,wBAAW,CAACC;EAC7B,CACD,CAAC;EAED,OACC,IAAAzB,QAAA,CAAA0B,aAAA;IACC,uBAAsBlB,EAAI;IAC1BmB,SAAS,EAAG,IAAAC,mBAAU,EACrB,oFAAoF,EACpF;MACC,2CAA2C,EAC1CX;IACF,CACD;EAAG,GAEH,IAAAjB,QAAA,CAAA0B,aAAA;IAAA,GAAUR;EAAgB,CAAI,CAC1B,CAAC;AAER"}
|
|
@@ -4,9 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
|
|
8
7
|
var _element = require("@wordpress/element");
|
|
9
|
-
|
|
10
8
|
/**
|
|
11
9
|
* WordPress dependencies
|
|
12
10
|
*/
|
|
@@ -26,17 +24,15 @@ const useIsDraggingWithin = elementRef => {
|
|
|
26
24
|
const {
|
|
27
25
|
ownerDocument
|
|
28
26
|
} = elementRef.current;
|
|
29
|
-
|
|
30
27
|
function handleDragStart(event) {
|
|
31
28
|
// Check the first time when the dragging starts.
|
|
32
29
|
handleDragEnter(event);
|
|
33
|
-
}
|
|
34
|
-
|
|
30
|
+
}
|
|
35
31
|
|
|
32
|
+
// Set to false whenever the user cancel the drag event by either releasing the mouse or press Escape.
|
|
36
33
|
function handleDragEnd() {
|
|
37
34
|
setIsDraggingWithin(false);
|
|
38
35
|
}
|
|
39
|
-
|
|
40
36
|
function handleDragEnter(event) {
|
|
41
37
|
// Check if the current target is inside the item element.
|
|
42
38
|
if (elementRef.current.contains(event.target)) {
|
|
@@ -44,10 +40,10 @@ const useIsDraggingWithin = elementRef => {
|
|
|
44
40
|
} else {
|
|
45
41
|
setIsDraggingWithin(false);
|
|
46
42
|
}
|
|
47
|
-
}
|
|
48
|
-
// Ideally, we can also use `event.relatedTarget`, but sadly that doesn't work in Safari.
|
|
49
|
-
|
|
43
|
+
}
|
|
50
44
|
|
|
45
|
+
// Bind these events to the document to catch all drag events.
|
|
46
|
+
// Ideally, we can also use `event.relatedTarget`, but sadly that doesn't work in Safari.
|
|
51
47
|
ownerDocument.addEventListener('dragstart', handleDragStart);
|
|
52
48
|
ownerDocument.addEventListener('dragend', handleDragEnd);
|
|
53
49
|
ownerDocument.addEventListener('dragenter', handleDragEnter);
|
|
@@ -59,7 +55,6 @@ const useIsDraggingWithin = elementRef => {
|
|
|
59
55
|
}, []);
|
|
60
56
|
return isDraggingWithin;
|
|
61
57
|
};
|
|
62
|
-
|
|
63
58
|
var _default = useIsDraggingWithin;
|
|
64
59
|
exports.default = _default;
|
|
65
60
|
//# sourceMappingURL=use-is-dragging-within.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"names":["_element","require","useIsDraggingWithin","elementRef","isDraggingWithin","setIsDraggingWithin","useState","useEffect","ownerDocument","current","handleDragStart","event","handleDragEnter","handleDragEnd","contains","target","addEventListener","removeEventListener","_default","exports","default"],"sources":["@wordpress/edit-widgets/src/blocks/widget-area/edit/use-is-dragging-within.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useState, useEffect } from '@wordpress/element';\n\n/** @typedef {import('@wordpress/element').RefObject} RefObject */\n\n/**\n * A React hook to determine if it's dragging within the target element.\n *\n * @param {RefObject<HTMLElement>} elementRef The target elementRef object.\n *\n * @return {boolean} Is dragging within the target element.\n */\nconst useIsDraggingWithin = ( elementRef ) => {\n\tconst [ isDraggingWithin, setIsDraggingWithin ] = useState( false );\n\n\tuseEffect( () => {\n\t\tconst { ownerDocument } = elementRef.current;\n\n\t\tfunction handleDragStart( event ) {\n\t\t\t// Check the first time when the dragging starts.\n\t\t\thandleDragEnter( event );\n\t\t}\n\n\t\t// Set to false whenever the user cancel the drag event by either releasing the mouse or press Escape.\n\t\tfunction handleDragEnd() {\n\t\t\tsetIsDraggingWithin( false );\n\t\t}\n\n\t\tfunction handleDragEnter( event ) {\n\t\t\t// Check if the current target is inside the item element.\n\t\t\tif ( elementRef.current.contains( event.target ) ) {\n\t\t\t\tsetIsDraggingWithin( true );\n\t\t\t} else {\n\t\t\t\tsetIsDraggingWithin( false );\n\t\t\t}\n\t\t}\n\n\t\t// Bind these events to the document to catch all drag events.\n\t\t// Ideally, we can also use `event.relatedTarget`, but sadly that doesn't work in Safari.\n\t\townerDocument.addEventListener( 'dragstart', handleDragStart );\n\t\townerDocument.addEventListener( 'dragend', handleDragEnd );\n\t\townerDocument.addEventListener( 'dragenter', handleDragEnter );\n\n\t\treturn () => {\n\t\t\townerDocument.removeEventListener( 'dragstart', handleDragStart );\n\t\t\townerDocument.removeEventListener( 'dragend', handleDragEnd );\n\t\t\townerDocument.removeEventListener( 'dragenter', handleDragEnter );\n\t\t};\n\t}, [] );\n\n\treturn isDraggingWithin;\n};\n\nexport default useIsDraggingWithin;\n"],"mappings":";;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AAHA;AACA;AACA;;AAGA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMC,mBAAmB,GAAKC,UAAU,IAAM;EAC7C,MAAM,CAAEC,gBAAgB,EAAEC,mBAAmB,CAAE,GAAG,IAAAC,iBAAQ,EAAE,KAAM,CAAC;EAEnE,IAAAC,kBAAS,EAAE,MAAM;IAChB,MAAM;MAAEC;IAAc,CAAC,GAAGL,UAAU,CAACM,OAAO;IAE5C,SAASC,eAAeA,CAAEC,KAAK,EAAG;MACjC;MACAC,eAAe,CAAED,KAAM,CAAC;IACzB;;IAEA;IACA,SAASE,aAAaA,CAAA,EAAG;MACxBR,mBAAmB,CAAE,KAAM,CAAC;IAC7B;IAEA,SAASO,eAAeA,CAAED,KAAK,EAAG;MACjC;MACA,IAAKR,UAAU,CAACM,OAAO,CAACK,QAAQ,CAAEH,KAAK,CAACI,MAAO,CAAC,EAAG;QAClDV,mBAAmB,CAAE,IAAK,CAAC;MAC5B,CAAC,MAAM;QACNA,mBAAmB,CAAE,KAAM,CAAC;MAC7B;IACD;;IAEA;IACA;IACAG,aAAa,CAACQ,gBAAgB,CAAE,WAAW,EAAEN,eAAgB,CAAC;IAC9DF,aAAa,CAACQ,gBAAgB,CAAE,SAAS,EAAEH,aAAc,CAAC;IAC1DL,aAAa,CAACQ,gBAAgB,CAAE,WAAW,EAAEJ,eAAgB,CAAC;IAE9D,OAAO,MAAM;MACZJ,aAAa,CAACS,mBAAmB,CAAE,WAAW,EAAEP,eAAgB,CAAC;MACjEF,aAAa,CAACS,mBAAmB,CAAE,SAAS,EAAEJ,aAAc,CAAC;MAC7DL,aAAa,CAACS,mBAAmB,CAAE,WAAW,EAAEL,eAAgB,CAAC;IAClE,CAAC;EACF,CAAC,EAAE,EAAG,CAAC;EAEP,OAAOR,gBAAgB;AACxB,CAAC;AAAC,IAAAc,QAAA,GAEahB,mBAAmB;AAAAiB,OAAA,CAAAC,OAAA,GAAAF,QAAA"}
|
|
@@ -1,20 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
7
|
exports.settings = exports.name = exports.metadata = void 0;
|
|
9
|
-
|
|
10
8
|
var _i18n = require("@wordpress/i18n");
|
|
11
|
-
|
|
12
9
|
var _edit = _interopRequireDefault(require("./edit"));
|
|
13
|
-
|
|
14
10
|
/**
|
|
15
11
|
* WordPress dependencies
|
|
16
12
|
*/
|
|
17
|
-
|
|
18
13
|
/**
|
|
19
14
|
* Internal dependencies
|
|
20
15
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"names":["_i18n","require","_edit","_interopRequireDefault","metadata","name","category","attributes","id","type","supports","html","inserter","customClassName","reusable","__experimentalToolbar","__experimentalParentSelector","__experimentalDisableBlockOverlay","editorStyle","style","exports","settings","title","__","description","__experimentalLabel","label","edit"],"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":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AAMA,IAAAC,KAAA,GAAAC,sBAAA,CAAAF,OAAA;AATA;AACA;AACA;AAGA;AACA;AACA;AAFA,MAAAG,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;AAAAC,OAAA,CAAAhB,QAAA,GAAAA,QAAA;AAMA,MAAM;EAAEC;AAAK,CAAC,GAAGD,QAAQ;AAACgB,OAAA,CAAAf,IAAA,GAAAA,IAAA;AAGnB,MAAMgB,QAAQ,GAAG;EACvBC,KAAK,EAAE,IAAAC,QAAE,EAAE,aAAc,CAAC;EAC1BC,WAAW,EAAE,IAAAD,QAAE,EAAE,0BAA2B,CAAC;EAC7CE,mBAAmB,EAAEA,CAAE;IAAEpB,IAAI,EAAEqB;EAAM,CAAC,KAAMA,KAAK;EACjDC,IAAI,EAAJA;AACD,CAAC;AAACP,OAAA,CAAAC,QAAA,GAAAA,QAAA"}
|
|
@@ -4,22 +4,16 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
|
|
8
7
|
var _element = require("@wordpress/element");
|
|
9
|
-
|
|
10
8
|
var _i18n = require("@wordpress/i18n");
|
|
11
|
-
|
|
12
9
|
var _components = require("@wordpress/components");
|
|
13
|
-
|
|
14
10
|
var _blockEditor = require("@wordpress/block-editor");
|
|
15
|
-
|
|
16
11
|
var _compose = require("@wordpress/compose");
|
|
17
|
-
|
|
18
12
|
var _hooks = require("@wordpress/hooks");
|
|
19
|
-
|
|
20
13
|
/**
|
|
21
14
|
* WordPress dependencies
|
|
22
15
|
*/
|
|
16
|
+
|
|
23
17
|
function CopyButton({
|
|
24
18
|
text,
|
|
25
19
|
children
|
|
@@ -30,7 +24,6 @@ function CopyButton({
|
|
|
30
24
|
ref: ref
|
|
31
25
|
}, children);
|
|
32
26
|
}
|
|
33
|
-
|
|
34
27
|
function ErrorBoundaryWarning({
|
|
35
28
|
message,
|
|
36
29
|
error
|
|
@@ -44,7 +37,6 @@ function ErrorBoundaryWarning({
|
|
|
44
37
|
actions: actions
|
|
45
38
|
}, message);
|
|
46
39
|
}
|
|
47
|
-
|
|
48
40
|
class ErrorBoundary extends _element.Component {
|
|
49
41
|
constructor() {
|
|
50
42
|
super(...arguments);
|
|
@@ -52,29 +44,23 @@ class ErrorBoundary extends _element.Component {
|
|
|
52
44
|
error: null
|
|
53
45
|
};
|
|
54
46
|
}
|
|
55
|
-
|
|
56
47
|
componentDidCatch(error) {
|
|
57
48
|
(0, _hooks.doAction)('editor.ErrorBoundary.errorLogged', error);
|
|
58
49
|
}
|
|
59
|
-
|
|
60
50
|
static getDerivedStateFromError(error) {
|
|
61
51
|
return {
|
|
62
52
|
error
|
|
63
53
|
};
|
|
64
54
|
}
|
|
65
|
-
|
|
66
55
|
render() {
|
|
67
56
|
if (!this.state.error) {
|
|
68
57
|
return this.props.children;
|
|
69
58
|
}
|
|
70
|
-
|
|
71
59
|
return (0, _element.createElement)(ErrorBoundaryWarning, {
|
|
72
60
|
message: (0, _i18n.__)('The editor has encountered an unexpected error.'),
|
|
73
61
|
error: this.state.error
|
|
74
62
|
});
|
|
75
63
|
}
|
|
76
|
-
|
|
77
64
|
}
|
|
78
|
-
|
|
79
65
|
exports.default = ErrorBoundary;
|
|
80
66
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"names":["_element","require","_i18n","_components","_blockEditor","_compose","_hooks","CopyButton","text","children","ref","useCopyToClipboard","createElement","Button","variant","ErrorBoundaryWarning","message","error","actions","key","stack","__","Warning","className","ErrorBoundary","Component","constructor","arguments","state","componentDidCatch","doAction","getDerivedStateFromError","render","props","exports","default"],"sources":["@wordpress/edit-widgets/src/components/error-boundary/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { Component } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport { Button } from '@wordpress/components';\nimport { Warning } from '@wordpress/block-editor';\nimport { useCopyToClipboard } from '@wordpress/compose';\nimport { doAction } from '@wordpress/hooks';\n\nfunction CopyButton( { text, children } ) {\n\tconst ref = useCopyToClipboard( text );\n\treturn (\n\t\t<Button variant=\"secondary\" ref={ ref }>\n\t\t\t{ children }\n\t\t</Button>\n\t);\n}\n\nfunction ErrorBoundaryWarning( { message, error } ) {\n\tconst actions = [\n\t\t<CopyButton key=\"copy-error\" text={ error.stack }>\n\t\t\t{ __( 'Copy Error' ) }\n\t\t</CopyButton>,\n\t];\n\n\treturn (\n\t\t<Warning className=\"edit-widgets-error-boundary\" actions={ actions }>\n\t\t\t{ message }\n\t\t</Warning>\n\t);\n}\n\nexport default class ErrorBoundary extends Component {\n\tconstructor() {\n\t\tsuper( ...arguments );\n\n\t\tthis.state = {\n\t\t\terror: null,\n\t\t};\n\t}\n\n\tcomponentDidCatch( error ) {\n\t\tdoAction( 'editor.ErrorBoundary.errorLogged', error );\n\t}\n\n\tstatic getDerivedStateFromError( error ) {\n\t\treturn { error };\n\t}\n\n\trender() {\n\t\tif ( ! this.state.error ) {\n\t\t\treturn this.props.children;\n\t\t}\n\n\t\treturn (\n\t\t\t<ErrorBoundaryWarning\n\t\t\t\tmessage={ __(\n\t\t\t\t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AOc,wBAAwBA,CAAEd,KAAK,EAAG;IACxC,OAAO;MAAEA;IAAM,CAAC;EACjB;EAEAe,MAAMA,CAAA,EAAG;IACR,IAAK,CAAE,IAAI,CAACJ,KAAK,CAACX,KAAK,EAAG;MACzB,OAAO,IAAI,CAACgB,KAAK,CAACxB,QAAQ;IAC3B;IAEA,OACC,IAAAT,QAAA,CAAAY,aAAA,EAACG,oBAAoB;MACpBC,OAAO,EAAG,IAAAK,QAAE,EACX,iDACD,CAAG;MACHJ,KAAK,EAAG,IAAI,CAACW,KAAK,CAACX;IAAO,CAC1B,CAAC;EAEJ;AACD;AAACiB,OAAA,CAAAC,OAAA,GAAAX,aAAA"}
|
|
@@ -1,42 +1,25 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
7
|
exports.default = void 0;
|
|
9
|
-
|
|
10
8
|
var _element = require("@wordpress/element");
|
|
11
|
-
|
|
12
9
|
var _data = require("@wordpress/data");
|
|
13
|
-
|
|
14
10
|
var _i18n = require("@wordpress/i18n");
|
|
15
|
-
|
|
16
11
|
var _components = require("@wordpress/components");
|
|
17
|
-
|
|
18
12
|
var _blockEditor = require("@wordpress/block-editor");
|
|
19
|
-
|
|
20
13
|
var _interface = require("@wordpress/interface");
|
|
21
|
-
|
|
22
14
|
var _icons = require("@wordpress/icons");
|
|
23
|
-
|
|
24
15
|
var _compose = require("@wordpress/compose");
|
|
25
|
-
|
|
26
16
|
var _saveButton = _interopRequireDefault(require("../save-button"));
|
|
27
|
-
|
|
28
17
|
var _undo = _interopRequireDefault(require("./undo-redo/undo"));
|
|
29
|
-
|
|
30
18
|
var _redo = _interopRequireDefault(require("./undo-redo/redo"));
|
|
31
|
-
|
|
32
19
|
var _moreMenu = _interopRequireDefault(require("../more-menu"));
|
|
33
|
-
|
|
34
20
|
var _useLastSelectedWidgetArea = _interopRequireDefault(require("../../hooks/use-last-selected-widget-area"));
|
|
35
|
-
|
|
36
21
|
var _store = require("../../store");
|
|
37
|
-
|
|
38
22
|
var _lockUnlock = require("../../lock-unlock");
|
|
39
|
-
|
|
40
23
|
/**
|
|
41
24
|
* WordPress dependencies
|
|
42
25
|
*/
|
|
@@ -44,10 +27,10 @@ var _lockUnlock = require("../../lock-unlock");
|
|
|
44
27
|
/**
|
|
45
28
|
* Internal dependencies
|
|
46
29
|
*/
|
|
30
|
+
|
|
47
31
|
const {
|
|
48
32
|
useShouldContextualToolbarShow
|
|
49
33
|
} = (0, _lockUnlock.unlock)(_blockEditor.privateApis);
|
|
50
|
-
|
|
51
34
|
function Header() {
|
|
52
35
|
const isMediumViewport = (0, _compose.useViewportMatch)('medium');
|
|
53
36
|
const inserterButton = (0, _element.useRef)();
|
|
@@ -74,7 +57,6 @@ function Header() {
|
|
|
74
57
|
const {
|
|
75
58
|
selectBlock
|
|
76
59
|
} = (0, _data.useDispatch)(_blockEditor.store);
|
|
77
|
-
|
|
78
60
|
const handleClick = () => {
|
|
79
61
|
if (isInserterOpen) {
|
|
80
62
|
// Focusing the inserter button closes the inserter popover.
|
|
@@ -82,28 +64,26 @@ function Header() {
|
|
|
82
64
|
} else {
|
|
83
65
|
if (!isLastSelectedWidgetAreaOpen) {
|
|
84
66
|
// Select the last selected block if hasn't already.
|
|
85
|
-
selectBlock(widgetAreaClientId);
|
|
86
|
-
|
|
67
|
+
selectBlock(widgetAreaClientId);
|
|
68
|
+
// Open the last selected widget area when opening the inserter.
|
|
87
69
|
setIsWidgetAreaOpen(widgetAreaClientId, true);
|
|
88
|
-
}
|
|
70
|
+
}
|
|
71
|
+
// The DOM updates resulting from selectBlock() and setIsInserterOpened() calls are applied the
|
|
89
72
|
// same tick and pretty much in a random order. The inserter is closed if any other part of the
|
|
90
73
|
// app receives focus. If selectBlock() happens to take effect after setIsInserterOpened() then
|
|
91
74
|
// the inserter is visible for a brief moment and then gets auto-closed due to focus moving to
|
|
92
75
|
// the selected block.
|
|
93
|
-
|
|
94
|
-
|
|
95
76
|
window.requestAnimationFrame(() => setIsInserterOpened(true));
|
|
96
77
|
}
|
|
97
78
|
};
|
|
98
|
-
|
|
99
79
|
const toggleListView = (0, _element.useCallback)(() => setIsListViewOpened(!isListViewOpen), [setIsListViewOpened, isListViewOpen]);
|
|
100
80
|
const {
|
|
101
81
|
shouldShowContextualToolbar,
|
|
102
82
|
canFocusHiddenToolbar,
|
|
103
83
|
fixedToolbarCanBeFocused
|
|
104
|
-
} = useShouldContextualToolbarShow();
|
|
84
|
+
} = useShouldContextualToolbarShow();
|
|
85
|
+
// If there's a block toolbar to be focused, disable the focus shortcut for the document toolbar.
|
|
105
86
|
// There's a fixed block toolbar when the fixed toolbar option is enabled or when the browser width is less than the large viewport.
|
|
106
|
-
|
|
107
87
|
const blockToolbarCanBeFocused = shouldShowContextualToolbar || canFocusHiddenToolbar || fixedToolbarCanBeFocused;
|
|
108
88
|
return (0, _element.createElement)(_element.Fragment, null, (0, _element.createElement)("div", {
|
|
109
89
|
className: "edit-widgets-header"
|
|
@@ -130,16 +110,14 @@ function Header() {
|
|
|
130
110
|
onClick: handleClick,
|
|
131
111
|
icon: _icons.plus
|
|
132
112
|
/* translators: button label text should, if possible, be under 16
|
|
133
|
-
characters.
|
|
134
|
-
,
|
|
113
|
+
characters. */,
|
|
135
114
|
label: (0, _i18n._x)('Toggle block inserter', 'Generic label for block inserter button')
|
|
136
115
|
}), isMediumViewport && (0, _element.createElement)(_element.Fragment, null, (0, _element.createElement)(_undo.default, null), (0, _element.createElement)(_redo.default, null), (0, _element.createElement)(_components.ToolbarItem, {
|
|
137
116
|
as: _components.Button,
|
|
138
117
|
className: "edit-widgets-header-toolbar__list-view-toggle",
|
|
139
118
|
icon: _icons.listView,
|
|
140
119
|
isPressed: isListViewOpen
|
|
141
|
-
/* translators: button label text should, if possible, be under 16 characters.
|
|
142
|
-
,
|
|
120
|
+
/* translators: button label text should, if possible, be under 16 characters. */,
|
|
143
121
|
label: (0, _i18n.__)('List View'),
|
|
144
122
|
onClick: toggleListView
|
|
145
123
|
})))), (0, _element.createElement)("div", {
|
|
@@ -148,7 +126,6 @@ function Header() {
|
|
|
148
126
|
scope: "core/edit-widgets"
|
|
149
127
|
}), (0, _element.createElement)(_moreMenu.default, null))));
|
|
150
128
|
}
|
|
151
|
-
|
|
152
129
|
var _default = Header;
|
|
153
130
|
exports.default = _default;
|
|
154
131
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-widgets/src/components/header/index.js"],"names":["useShouldContextualToolbarShow","blockEditorPrivateApis","Header","isMediumViewport","inserterButton","widgetAreaClientId","isLastSelectedWidgetAreaOpen","select","editWidgetsStore","getIsWidgetAreaOpen","isInserterOpen","isListViewOpen","isInserterOpened","isListViewOpened","setIsWidgetAreaOpen","setIsInserterOpened","setIsListViewOpened","selectBlock","blockEditorStore","handleClick","window","requestAnimationFrame","toggleListView","shouldShowContextualToolbar","canFocusHiddenToolbar","fixedToolbarCanBeFocused","blockToolbarCanBeFocused","Button","event","preventDefault","plus","listView"],"mappings":";;;;;;;;;AAaA;;AAVA;;AACA;;AACA;;AACA;;AAKA;;AACA;;AAEA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAzBA;AACA;AACA;;AAcA;AACA;AACA;AASA,MAAM;AAAEA,EAAAA;AAAF,IAAqC,wBAAQC,wBAAR,CAA3C;;AAEA,SAASC,MAAT,GAAkB;AACjB,QAAMC,gBAAgB,GAAG,+BAAkB,QAAlB,CAAzB;AACA,QAAMC,cAAc,GAAG,sBAAvB;AACA,QAAMC,kBAAkB,GAAG,yCAA3B;AACA,QAAMC,4BAA4B,GAAG,qBAClCC,MAAF,IACCA,MAAM,CAAEC,YAAF,CAAN,CAA2BC,mBAA3B,CACCJ,kBADD,CAFmC,EAKpC,CAAEA,kB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,EAGC,4BAAC,iBAAD,OAHD,CAzDD,CADD,CADD;AAmEA;;eAEcpB,M","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { __, _x } from '@wordpress/i18n';\nimport { Button, ToolbarItem, VisuallyHidden } from '@wordpress/components';\nimport {\n\tNavigableToolbar,\n\tstore as blockEditorStore,\n\tprivateApis as blockEditorPrivateApis,\n} from '@wordpress/block-editor';\nimport { PinnedItems } from '@wordpress/interface';\nimport { listView, plus } from '@wordpress/icons';\nimport { useCallback, useRef } from '@wordpress/element';\nimport { useViewportMatch } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport SaveButton from '../save-button';\nimport UndoButton from './undo-redo/undo';\nimport RedoButton from './undo-redo/redo';\nimport MoreMenu from '../more-menu';\nimport useLastSelectedWidgetArea from '../../hooks/use-last-selected-widget-area';\nimport { store as editWidgetsStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\n\nconst { useShouldContextualToolbarShow } = unlock( blockEditorPrivateApis );\n\nfunction Header() {\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 } = useSelect( ( select ) => {\n\t\tconst { isInserterOpened, isListViewOpened } =\n\t\t\tselect( editWidgetsStore );\n\t\treturn {\n\t\t\tisInserterOpen: isInserterOpened(),\n\t\t\tisListViewOpen: isListViewOpened(),\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\tconst {\n\t\tshouldShowContextualToolbar,\n\t\tcanFocusHiddenToolbar,\n\t\tfixedToolbarCanBeFocused,\n\t} = useShouldContextualToolbarShow();\n\t// If there's a block toolbar to be focused, disable the focus shortcut for the document toolbar.\n\t// There's a fixed block toolbar when the fixed toolbar option is enabled or when the browser width is less than the large viewport.\n\tconst blockToolbarCanBeFocused =\n\t\tshouldShowContextualToolbar ||\n\t\tcanFocusHiddenToolbar ||\n\t\tfixedToolbarCanBeFocused;\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{ isMediumViewport && (\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{ ! isMediumViewport && (\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<NavigableToolbar\n\t\t\t\t\t\tclassName=\"edit-widgets-header-toolbar\"\n\t\t\t\t\t\taria-label={ __( 'Document tools' ) }\n\t\t\t\t\t\tshouldUseKeyboardFocusShortcut={\n\t\t\t\t\t\t\t! blockToolbarCanBeFocused\n\t\t\t\t\t\t}\n\t\t\t\t\t>\n\t\t\t\t\t\t<ToolbarItem\n\t\t\t\t\t\t\tref={ inserterButton }\n\t\t\t\t\t\t\tas={ Button }\n\t\t\t\t\t\t\tclassName=\"edit-widgets-header-toolbar__inserter-toggle\"\n\t\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\t\tisPressed={ isInserterOpen }\n\t\t\t\t\t\t\tonMouseDown={ ( event ) => {\n\t\t\t\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tonClick={ handleClick }\n\t\t\t\t\t\t\ticon={ plus }\n\t\t\t\t\t\t\t/* translators: button label text should, if possible, be under 16\n\t\t\t\t\tcharacters. */\n\t\t\t\t\t\t\tlabel={ _x(\n\t\t\t\t\t\t\t\t'Toggle block inserter',\n\t\t\t\t\t\t\t\t'Generic label for block inserter button'\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t{ isMediumViewport && (\n\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t<UndoButton />\n\t\t\t\t\t\t\t\t<RedoButton />\n\t\t\t\t\t\t\t\t<ToolbarItem\n\t\t\t\t\t\t\t\t\tas={ Button }\n\t\t\t\t\t\t\t\t\tclassName=\"edit-widgets-header-toolbar__list-view-toggle\"\n\t\t\t\t\t\t\t\t\ticon={ listView }\n\t\t\t\t\t\t\t\t\tisPressed={ isListViewOpen }\n\t\t\t\t\t\t\t\t\t/* translators: button label text should, if possible, be under 16 characters. */\n\t\t\t\t\t\t\t\t\tlabel={ __( 'List View' ) }\n\t\t\t\t\t\t\t\t\tonClick={ toggleListView }\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</NavigableToolbar>\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"]}
|
|
1
|
+
{"version":3,"names":["_element","require","_data","_i18n","_components","_blockEditor","_interface","_icons","_compose","_saveButton","_interopRequireDefault","_undo","_redo","_moreMenu","_useLastSelectedWidgetArea","_store","_lockUnlock","useShouldContextualToolbarShow","unlock","blockEditorPrivateApis","Header","isMediumViewport","useViewportMatch","inserterButton","useRef","widgetAreaClientId","useLastSelectedWidgetArea","isLastSelectedWidgetAreaOpen","useSelect","select","editWidgetsStore","getIsWidgetAreaOpen","isInserterOpen","isListViewOpen","isInserterOpened","isListViewOpened","setIsWidgetAreaOpen","setIsInserterOpened","setIsListViewOpened","useDispatch","selectBlock","blockEditorStore","handleClick","window","requestAnimationFrame","toggleListView","useCallback","shouldShowContextualToolbar","canFocusHiddenToolbar","fixedToolbarCanBeFocused","blockToolbarCanBeFocused","createElement","Fragment","className","__","VisuallyHidden","as","NavigableToolbar","shouldUseKeyboardFocusShortcut","ToolbarItem","ref","Button","variant","isPressed","onMouseDown","event","preventDefault","onClick","icon","plus","label","_x","default","listView","PinnedItems","Slot","scope","_default","exports"],"sources":["@wordpress/edit-widgets/src/components/header/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { __, _x } from '@wordpress/i18n';\nimport { Button, ToolbarItem, VisuallyHidden } from '@wordpress/components';\nimport {\n\tNavigableToolbar,\n\tstore as blockEditorStore,\n\tprivateApis as blockEditorPrivateApis,\n} from '@wordpress/block-editor';\nimport { PinnedItems } from '@wordpress/interface';\nimport { listView, plus } from '@wordpress/icons';\nimport { useCallback, useRef } from '@wordpress/element';\nimport { useViewportMatch } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport SaveButton from '../save-button';\nimport UndoButton from './undo-redo/undo';\nimport RedoButton from './undo-redo/redo';\nimport MoreMenu from '../more-menu';\nimport useLastSelectedWidgetArea from '../../hooks/use-last-selected-widget-area';\nimport { store as editWidgetsStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\n\nconst { useShouldContextualToolbarShow } = unlock( blockEditorPrivateApis );\n\nfunction Header() {\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 } = useSelect( ( select ) => {\n\t\tconst { isInserterOpened, isListViewOpened } =\n\t\t\tselect( editWidgetsStore );\n\t\treturn {\n\t\t\tisInserterOpen: isInserterOpened(),\n\t\t\tisListViewOpen: isListViewOpened(),\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\tconst {\n\t\tshouldShowContextualToolbar,\n\t\tcanFocusHiddenToolbar,\n\t\tfixedToolbarCanBeFocused,\n\t} = useShouldContextualToolbarShow();\n\t// If there's a block toolbar to be focused, disable the focus shortcut for the document toolbar.\n\t// There's a fixed block toolbar when the fixed toolbar option is enabled or when the browser width is less than the large viewport.\n\tconst blockToolbarCanBeFocused =\n\t\tshouldShowContextualToolbar ||\n\t\tcanFocusHiddenToolbar ||\n\t\tfixedToolbarCanBeFocused;\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{ isMediumViewport && (\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{ ! isMediumViewport && (\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<NavigableToolbar\n\t\t\t\t\t\tclassName=\"edit-widgets-header-toolbar\"\n\t\t\t\t\t\taria-label={ __( 'Document tools' ) }\n\t\t\t\t\t\tshouldUseKeyboardFocusShortcut={\n\t\t\t\t\t\t\t! blockToolbarCanBeFocused\n\t\t\t\t\t\t}\n\t\t\t\t\t>\n\t\t\t\t\t\t<ToolbarItem\n\t\t\t\t\t\t\tref={ inserterButton }\n\t\t\t\t\t\t\tas={ Button }\n\t\t\t\t\t\t\tclassName=\"edit-widgets-header-toolbar__inserter-toggle\"\n\t\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\t\tisPressed={ isInserterOpen }\n\t\t\t\t\t\t\tonMouseDown={ ( event ) => {\n\t\t\t\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tonClick={ handleClick }\n\t\t\t\t\t\t\ticon={ plus }\n\t\t\t\t\t\t\t/* translators: button label text should, if possible, be under 16\n\t\t\t\t\tcharacters. */\n\t\t\t\t\t\t\tlabel={ _x(\n\t\t\t\t\t\t\t\t'Toggle block inserter',\n\t\t\t\t\t\t\t\t'Generic label for block inserter button'\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t{ isMediumViewport && (\n\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t<UndoButton />\n\t\t\t\t\t\t\t\t<RedoButton />\n\t\t\t\t\t\t\t\t<ToolbarItem\n\t\t\t\t\t\t\t\t\tas={ Button }\n\t\t\t\t\t\t\t\t\tclassName=\"edit-widgets-header-toolbar__list-view-toggle\"\n\t\t\t\t\t\t\t\t\ticon={ listView }\n\t\t\t\t\t\t\t\t\tisPressed={ isListViewOpen }\n\t\t\t\t\t\t\t\t\t/* translators: button label text should, if possible, be under 16 characters. */\n\t\t\t\t\t\t\t\t\tlabel={ __( 'List View' ) }\n\t\t\t\t\t\t\t\t\tonClick={ toggleListView }\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</NavigableToolbar>\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,IAAAA,QAAA,GAAAC,OAAA;AAVA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,WAAA,GAAAH,OAAA;AACA,IAAAI,YAAA,GAAAJ,OAAA;AAKA,IAAAK,UAAA,GAAAL,OAAA;AACA,IAAAM,MAAA,GAAAN,OAAA;AAEA,IAAAO,QAAA,GAAAP,OAAA;AAKA,IAAAQ,WAAA,GAAAC,sBAAA,CAAAT,OAAA;AACA,IAAAU,KAAA,GAAAD,sBAAA,CAAAT,OAAA;AACA,IAAAW,KAAA,GAAAF,sBAAA,CAAAT,OAAA;AACA,IAAAY,SAAA,GAAAH,sBAAA,CAAAT,OAAA;AACA,IAAAa,0BAAA,GAAAJ,sBAAA,CAAAT,OAAA;AACA,IAAAc,MAAA,GAAAd,OAAA;AACA,IAAAe,WAAA,GAAAf,OAAA;AAzBA;AACA;AACA;;AAcA;AACA;AACA;;AASA,MAAM;EAAEgB;AAA+B,CAAC,GAAG,IAAAC,kBAAM,EAAEC,wBAAuB,CAAC;AAE3E,SAASC,MAAMA,CAAA,EAAG;EACjB,MAAMC,gBAAgB,GAAG,IAAAC,yBAAgB,EAAE,QAAS,CAAC;EACrD,MAAMC,cAAc,GAAG,IAAAC,eAAM,EAAC,CAAC;EAC/B,MAAMC,kBAAkB,GAAG,IAAAC,kCAAyB,EAAC,CAAC;EACtD,MAAMC,4BAA4B,GAAG,IAAAC,eAAS,EAC3CC,MAAM,IACPA,MAAM,CAAEC,YAAiB,C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AAA,CAAAmD,aAAA,EAACvC,KAAA,CAAA4D,OAAU,MAAE,CAAC,EACd,IAAAxE,QAAA,CAAAmD,aAAA,EAAC/C,WAAA,CAAAuD,WAAW;IACXH,EAAE,EAAGK,kBAAQ;IACbR,SAAS,EAAC,+CAA+C;IACzDe,IAAI,EAAGK,eAAU;IACjBV,SAAS,EAAG9B;IACZ;IACAqC,KAAK,EAAG,IAAAhB,QAAE,EAAE,WAAY,CAAG;IAC3Ba,OAAO,EAAGtB;EAAgB,CAC1B,CACA,CAEc,CACd,CAAC,EACN,IAAA7C,QAAA,CAAAmD,aAAA;IAAKE,SAAS,EAAC;EAA8B,GAC5C,IAAArD,QAAA,CAAAmD,aAAA,EAAC1C,WAAA,CAAA+D,OAAU,MAAE,CAAC,EACd,IAAAxE,QAAA,CAAAmD,aAAA,EAAC7C,UAAA,CAAAoE,WAAW,CAACC,IAAI;IAACC,KAAK,EAAC;EAAmB,CAAE,CAAC,EAC9C,IAAA5E,QAAA,CAAAmD,aAAA,EAACtC,SAAA,CAAA2D,OAAQ,MAAE,CACP,CACD,CACJ,CAAC;AAEL;AAAC,IAAAK,QAAA,GAEczD,MAAM;AAAA0D,OAAA,CAAAN,OAAA,GAAAK,QAAA"}
|
|
@@ -4,24 +4,17 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = RedoButton;
|
|
7
|
-
|
|
8
7
|
var _element = require("@wordpress/element");
|
|
9
|
-
|
|
10
8
|
var _i18n = require("@wordpress/i18n");
|
|
11
|
-
|
|
12
9
|
var _components = require("@wordpress/components");
|
|
13
|
-
|
|
14
10
|
var _data = require("@wordpress/data");
|
|
15
|
-
|
|
16
11
|
var _icons = require("@wordpress/icons");
|
|
17
|
-
|
|
18
12
|
var _keycodes = require("@wordpress/keycodes");
|
|
19
|
-
|
|
20
13
|
var _coreData = require("@wordpress/core-data");
|
|
21
|
-
|
|
22
14
|
/**
|
|
23
15
|
* WordPress dependencies
|
|
24
16
|
*/
|
|
17
|
+
|
|
25
18
|
function RedoButton() {
|
|
26
19
|
const shortcut = (0, _keycodes.isAppleOS)() ? _keycodes.displayShortcut.primaryShift('z') : _keycodes.displayShortcut.primary('y');
|
|
27
20
|
const hasRedo = (0, _data.useSelect)(select => select(_coreData.store).hasRedo(), []);
|
|
@@ -31,7 +24,8 @@ function RedoButton() {
|
|
|
31
24
|
return (0, _element.createElement)(_components.ToolbarButton, {
|
|
32
25
|
icon: !(0, _i18n.isRTL)() ? _icons.redo : _icons.undo,
|
|
33
26
|
label: (0, _i18n.__)('Redo'),
|
|
34
|
-
shortcut: shortcut
|
|
27
|
+
shortcut: shortcut
|
|
28
|
+
// If there are no undo levels we don't want to actually disable this
|
|
35
29
|
// button, because it will remove focus for keyboard users.
|
|
36
30
|
// See: https://github.com/WordPress/gutenberg/issues/3486
|
|
37
31
|
,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"names":["_i18n","require","_components","_data","_icons","_keycodes","_coreData","RedoButton","shortcut","isAppleOS","displayShortcut","primaryShift","primary","hasRedo","useSelect","select","coreStore","redo","useDispatch","_element","createElement","ToolbarButton","icon","isRTL","redoIcon","undoIcon","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 { ToolbarButton } 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';\n\nexport default function RedoButton() {\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<ToolbarButton\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"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,MAAA,GAAAH,OAAA;AACA,IAAAI,SAAA,GAAAJ,OAAA;AACA,IAAAK,SAAA,GAAAL,OAAA;AARA;AACA;AACA;;AAQe,SAASM,UAAUA,CAAA,EAAG;EACpC,MAAMC,QAAQ,GAAG,IAAAC,mBAAS,EAAC,CAAC,GACzBC,yBAAe,CAACC,YAAY,CAAE,GAAI,CAAC,GACnCD,yBAAe,CAACE,OAAO,CAAE,GAAI,CAAC;EAEjC,MAAMC,OAAO,GAAG,IAAAC,eAAS,EACtBC,MAAM,IAAMA,MAAM,CAAEC,eAAU,CAAC,CAACH,OAAO,CAAC,CAAC,EAC3C,EACD,CAAC;EACD,MAAM;IAAEI;EAAK,CAAC,GAAG,IAAAC,iBAAW,EAAEF,eAAU,CAAC;EACzC,OACC,IAAAG,QAAA,CAAAC,aAAA,EAAClB,WAAA,CAAAmB,aAAa;IACbC,IAAI,EAAG,CAAE,IAAAC,WAAK,EAAC,CAAC,GAAGC,WAAQ,GAAGC,WAAU;IACxCC,KAAK,EAAG,IAAAC,QAAE,EAAE,MAAO,CAAG;IACtBnB,QAAQ,EAAGA;IACX;IACA;IACA;IAAA;IACA,iBAAgB,CAAEK,OAAS;IAC3Be,OAAO,EAAGf,OAAO,GAAGI,IAAI,GAAGY;EAAW,CACtC,CAAC;AAEJ"}
|