@wordpress/edit-widgets 5.35.0 → 6.0.1
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 +7 -0
- package/build/blocks/widget-area/edit/index.js +33 -30
- package/build/blocks/widget-area/edit/index.js.map +1 -1
- package/build/blocks/widget-area/edit/inner-blocks.js +6 -5
- package/build/blocks/widget-area/edit/inner-blocks.js.map +1 -1
- package/build/components/error-boundary/index.js +14 -12
- package/build/components/error-boundary/index.js.map +1 -1
- package/build/components/header/document-tools/index.js +36 -33
- package/build/components/header/document-tools/index.js.map +1 -1
- package/build/components/header/index.js +32 -22
- package/build/components/header/index.js.map +1 -1
- package/build/components/header/undo-redo/redo.js +2 -2
- package/build/components/header/undo-redo/redo.js.map +1 -1
- package/build/components/header/undo-redo/undo.js +2 -2
- package/build/components/header/undo-redo/undo.js.map +1 -1
- package/build/components/keyboard-shortcut-help-modal/dynamic-shortcut.js +2 -2
- package/build/components/keyboard-shortcut-help-modal/dynamic-shortcut.js.map +1 -1
- package/build/components/keyboard-shortcut-help-modal/index.js +53 -48
- package/build/components/keyboard-shortcut-help-modal/index.js.map +1 -1
- package/build/components/keyboard-shortcut-help-modal/shortcut.js +30 -26
- package/build/components/keyboard-shortcut-help-modal/shortcut.js.map +1 -1
- package/build/components/layout/index.js +11 -8
- package/build/components/layout/index.js.map +1 -1
- package/build/components/layout/interface.js +16 -13
- package/build/components/layout/interface.js.map +1 -1
- package/build/components/more-menu/index.js +81 -70
- package/build/components/more-menu/index.js.map +1 -1
- package/build/components/more-menu/tools-more-menu-group.js +5 -4
- package/build/components/more-menu/tools-more-menu-group.js.map +1 -1
- package/build/components/notices/index.js +15 -13
- package/build/components/notices/index.js.map +1 -1
- package/build/components/save-button/index.js +5 -4
- package/build/components/save-button/index.js.map +1 -1
- package/build/components/secondary-sidebar/index.js +3 -3
- package/build/components/secondary-sidebar/index.js.map +1 -1
- package/build/components/secondary-sidebar/inserter-sidebar.js +21 -18
- package/build/components/secondary-sidebar/inserter-sidebar.js.map +1 -1
- package/build/components/secondary-sidebar/list-view-sidebar.js +21 -15
- package/build/components/secondary-sidebar/list-view-sidebar.js.map +1 -1
- package/build/components/sidebar/index.js +49 -37
- package/build/components/sidebar/index.js.map +1 -1
- package/build/components/sidebar/widget-areas.js +29 -22
- package/build/components/sidebar/widget-areas.js.map +1 -1
- package/build/components/welcome-guide/index.js +80 -53
- package/build/components/welcome-guide/index.js.map +1 -1
- package/build/components/widget-areas-block-editor-content/index.js +18 -11
- package/build/components/widget-areas-block-editor-content/index.js.map +1 -1
- package/build/components/widget-areas-block-editor-provider/index.js +14 -11
- package/build/components/widget-areas-block-editor-provider/index.js.map +1 -1
- package/build/filters/move-to-widget-area.js +14 -10
- package/build/filters/move-to-widget-area.js.map +1 -1
- package/build/index.js +3 -3
- package/build/index.js.map +1 -1
- package/build-module/blocks/widget-area/edit/index.js +32 -28
- package/build-module/blocks/widget-area/edit/index.js.map +1 -1
- package/build-module/blocks/widget-area/edit/inner-blocks.js +6 -5
- package/build-module/blocks/widget-area/edit/inner-blocks.js.map +1 -1
- package/build-module/components/error-boundary/index.js +14 -12
- package/build-module/components/error-boundary/index.js.map +1 -1
- package/build-module/components/header/document-tools/index.js +38 -33
- package/build-module/components/header/document-tools/index.js.map +1 -1
- package/build-module/components/header/index.js +34 -22
- 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/dynamic-shortcut.js +2 -2
- package/build-module/components/keyboard-shortcut-help-modal/dynamic-shortcut.js.map +1 -1
- package/build-module/components/keyboard-shortcut-help-modal/index.js +54 -48
- package/build-module/components/keyboard-shortcut-help-modal/index.js.map +1 -1
- package/build-module/components/keyboard-shortcut-help-modal/shortcut.js +32 -26
- package/build-module/components/keyboard-shortcut-help-modal/shortcut.js.map +1 -1
- package/build-module/components/layout/index.js +12 -8
- package/build-module/components/layout/index.js.map +1 -1
- package/build-module/components/layout/interface.js +17 -13
- package/build-module/components/layout/interface.js.map +1 -1
- package/build-module/components/more-menu/index.js +83 -70
- package/build-module/components/more-menu/index.js.map +1 -1
- package/build-module/components/more-menu/tools-more-menu-group.js +5 -4
- package/build-module/components/more-menu/tools-more-menu-group.js.map +1 -1
- package/build-module/components/notices/index.js +17 -13
- package/build-module/components/notices/index.js.map +1 -1
- package/build-module/components/save-button/index.js +5 -4
- package/build-module/components/save-button/index.js.map +1 -1
- package/build-module/components/secondary-sidebar/index.js +3 -3
- package/build-module/components/secondary-sidebar/index.js.map +1 -1
- package/build-module/components/secondary-sidebar/inserter-sidebar.js +22 -18
- package/build-module/components/secondary-sidebar/inserter-sidebar.js.map +1 -1
- package/build-module/components/secondary-sidebar/list-view-sidebar.js +22 -15
- package/build-module/components/secondary-sidebar/list-view-sidebar.js.map +1 -1
- package/build-module/components/sidebar/index.js +50 -37
- package/build-module/components/sidebar/index.js.map +1 -1
- package/build-module/components/sidebar/widget-areas.js +30 -22
- package/build-module/components/sidebar/widget-areas.js.map +1 -1
- package/build-module/components/welcome-guide/index.js +82 -53
- package/build-module/components/welcome-guide/index.js.map +1 -1
- package/build-module/components/widget-areas-block-editor-content/index.js +19 -11
- 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 +15 -11
- package/build-module/components/widget-areas-block-editor-provider/index.js.map +1 -1
- package/build-module/filters/move-to-widget-area.js +16 -10
- package/build-module/filters/move-to-widget-area.js.map +1 -1
- package/build-module/index.js +3 -3
- package/build-module/index.js.map +1 -1
- package/build-style/style-rtl.css +9 -8
- package/build-style/style.css +9 -8
- package/package.json +30 -29
- package/src/components/layout/style.scss +1 -1
- package/src/index.js +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
## Unreleased
|
|
4
4
|
|
|
5
|
+
## 6.0.0 (2024-05-31)
|
|
6
|
+
|
|
7
|
+
### Breaking Changes
|
|
8
|
+
|
|
9
|
+
- Variables like `process.env.IS_GUTENBERG_PLUGIN` have been replaced by `globalThis.IS_GUTENBERG_PLUGIN`. Build systems using `process.env` should be updated ([#61486](https://github.com/WordPress/gutenberg/pull/61486)).
|
|
10
|
+
- Increase the minimum required Node.js version to v18.12.0 matching long-term support releases ([#31270](https://github.com/WordPress/gutenberg/pull/61930)). Learn more about [Node.js releases](https://nodejs.org/en/about/previous-releases).
|
|
11
|
+
|
|
5
12
|
## 5.35.0 (2024-05-16)
|
|
6
13
|
|
|
7
14
|
### Internal
|
|
@@ -5,7 +5,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
7
|
exports.default = WidgetAreaEdit;
|
|
8
|
-
var _react = require("react");
|
|
9
8
|
var _element = require("@wordpress/element");
|
|
10
9
|
var _data = require("@wordpress/data");
|
|
11
10
|
var _coreData = require("@wordpress/core-data");
|
|
@@ -13,6 +12,7 @@ var _components = require("@wordpress/components");
|
|
|
13
12
|
var _innerBlocks = _interopRequireDefault(require("./inner-blocks"));
|
|
14
13
|
var _store = require("../../../store");
|
|
15
14
|
var _useIsDraggingWithin = _interopRequireDefault(require("./use-is-dragging-within"));
|
|
15
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
16
16
|
/**
|
|
17
17
|
* WordPress dependencies
|
|
18
18
|
*/
|
|
@@ -21,9 +21,7 @@ var _useIsDraggingWithin = _interopRequireDefault(require("./use-is-dragging-wit
|
|
|
21
21
|
* Internal dependencies
|
|
22
22
|
*/
|
|
23
23
|
|
|
24
|
-
/** @typedef {import('@wordpress/element').RefObject} RefObject */
|
|
25
|
-
|
|
26
|
-
function WidgetAreaEdit({
|
|
24
|
+
/** @typedef {import('@wordpress/element').RefObject} RefObject */function WidgetAreaEdit({
|
|
27
25
|
clientId,
|
|
28
26
|
className,
|
|
29
27
|
attributes: {
|
|
@@ -52,33 +50,38 @@ function WidgetAreaEdit({
|
|
|
52
50
|
setOpen(false);
|
|
53
51
|
}
|
|
54
52
|
}, [isOpen, isDragging, isDraggingWithin, openedWhileDragging]);
|
|
55
|
-
return (0,
|
|
53
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Panel, {
|
|
56
54
|
className: className,
|
|
57
|
-
ref: wrapper
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
55
|
+
ref: wrapper,
|
|
56
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.PanelBody, {
|
|
57
|
+
title: name,
|
|
58
|
+
opened: isOpen,
|
|
59
|
+
onToggle: () => {
|
|
60
|
+
setIsWidgetAreaOpen(clientId, !isOpen);
|
|
61
|
+
},
|
|
62
|
+
scrollAfterOpen: !isDragging,
|
|
63
|
+
children: ({
|
|
64
|
+
opened
|
|
65
|
+
}) =>
|
|
66
|
+
/*#__PURE__*/
|
|
67
|
+
// This is required to ensure LegacyWidget blocks are not
|
|
68
|
+
// unmounted when the panel is collapsed. Unmounting legacy
|
|
69
|
+
// widgets may have unintended consequences (e.g. TinyMCE
|
|
70
|
+
// not being properly reinitialized)
|
|
71
|
+
(0, _jsxRuntime.jsx)(_components.__unstableDisclosureContent, {
|
|
72
|
+
className: "wp-block-widget-area__panel-body-content",
|
|
73
|
+
visible: opened,
|
|
74
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_coreData.EntityProvider, {
|
|
75
|
+
kind: "root",
|
|
76
|
+
type: "postType",
|
|
77
|
+
id: `widget-area-${id}`,
|
|
78
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_innerBlocks.default, {
|
|
79
|
+
id: id
|
|
80
|
+
})
|
|
81
|
+
})
|
|
82
|
+
})
|
|
83
|
+
})
|
|
84
|
+
});
|
|
82
85
|
}
|
|
83
86
|
|
|
84
87
|
/**
|
|
@@ -1 +1 @@
|
|
|
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","
|
|
1
|
+
{"version":3,"names":["_element","require","_data","_coreData","_components","_innerBlocks","_interopRequireDefault","_store","_useIsDraggingWithin","_jsxRuntime","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","jsx","Panel","ref","children","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;A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C;IACtB;IAEA,SAASI,aAAaA,CAAA,EAAG;MACxBJ,aAAa,CAAE,KAAM,CAAC;IACvB;IAEAC,aAAa,CAACI,gBAAgB,CAAE,WAAW,EAAEF,eAAgB,CAAC;IAC9DF,aAAa,CAACI,gBAAgB,CAAE,SAAS,EAAED,aAAc,CAAC;IAE1D,OAAO,MAAM;MACZH,aAAa,CAACK,mBAAmB,CAAE,WAAW,EAAEH,eAAgB,CAAC;MACjEF,aAAa,CAACK,mBAAmB,CAAE,SAAS,EAAEF,aAAc,CAAC;IAC9D,CAAC;EACF,CAAC,EAAE,EAAG,CAAC;EAEP,OAAO5B,UAAU;AAClB,CAAC","ignoreList":[]}
|
|
@@ -5,12 +5,12 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
7
|
exports.default = WidgetAreaInnerBlocks;
|
|
8
|
-
var _react = require("react");
|
|
9
8
|
var _clsx = _interopRequireDefault(require("clsx"));
|
|
10
9
|
var _coreData = require("@wordpress/core-data");
|
|
11
10
|
var _blockEditor = require("@wordpress/block-editor");
|
|
12
11
|
var _element = require("@wordpress/element");
|
|
13
12
|
var _useIsDraggingWithin = _interopRequireDefault(require("./use-is-dragging-within"));
|
|
13
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
14
14
|
/**
|
|
15
15
|
* External dependencies
|
|
16
16
|
*/
|
|
@@ -40,13 +40,14 @@ function WidgetAreaInnerBlocks({
|
|
|
40
40
|
templateLock: false,
|
|
41
41
|
renderAppender: _blockEditor.InnerBlocks.ButtonBlockAppender
|
|
42
42
|
});
|
|
43
|
-
return (0,
|
|
43
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
44
44
|
"data-widget-area-id": id,
|
|
45
45
|
className: (0, _clsx.default)('wp-block-widget-area__inner-blocks block-editor-inner-blocks editor-styles-wrapper', {
|
|
46
46
|
'wp-block-widget-area__highlight-drop-zone': shouldHighlightDropZone
|
|
47
|
+
}),
|
|
48
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
49
|
+
...innerBlocksProps
|
|
47
50
|
})
|
|
48
|
-
}
|
|
49
|
-
...innerBlocksProps
|
|
50
|
-
}));
|
|
51
|
+
});
|
|
51
52
|
}
|
|
52
53
|
//# sourceMappingURL=inner-blocks.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_clsx","_interopRequireDefault","require","_coreData","_blockEditor","_element","_useIsDraggingWithin","WidgetAreaInnerBlocks","id","blocks","onInput","onChange","useEntityBlockEditor","innerBlocksRef","useRef","isDraggingWithinInnerBlocks","useIsDraggingWithin","shouldHighlightDropZone","innerBlocksProps","useInnerBlocksProps","ref","value","templateLock","renderAppender","InnerBlocks","ButtonBlockAppender","
|
|
1
|
+
{"version":3,"names":["_clsx","_interopRequireDefault","require","_coreData","_blockEditor","_element","_useIsDraggingWithin","_jsxRuntime","WidgetAreaInnerBlocks","id","blocks","onInput","onChange","useEntityBlockEditor","innerBlocksRef","useRef","isDraggingWithinInnerBlocks","useIsDraggingWithin","shouldHighlightDropZone","innerBlocksProps","useInnerBlocksProps","ref","value","templateLock","renderAppender","InnerBlocks","ButtonBlockAppender","jsx","className","clsx","children"],"sources":["@wordpress/edit-widgets/src/blocks/widget-area/edit/inner-blocks.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\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={ clsx(\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":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,SAAA,GAAAD,OAAA;AACA,IAAAE,YAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AAKA,IAAAI,oBAAA,GAAAL,sBAAA,CAAAC,OAAA;AAA2D,IAAAK,WAAA,GAAAL,OAAA;AAf3D;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,oBACC,IAAAnB,WAAA,CAAAoB,GAAA;IACC,uBAAsBlB,EAAI;IAC1BmB,SAAS,EAAG,IAAAC,aAAI,EACf,oFAAoF,EACpF;MACC,2CAA2C,EAC1CX;IACF,CACD,CAAG;IAAAY,QAAA,eAEH,IAAAvB,WAAA,CAAAoB,GAAA;MAAA,GAAUR;IAAgB,CAAI;EAAC,CAC3B,CAAC;AAER","ignoreList":[]}
|
|
@@ -4,13 +4,13 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
var _react = require("react");
|
|
8
7
|
var _element = require("@wordpress/element");
|
|
9
8
|
var _i18n = require("@wordpress/i18n");
|
|
10
9
|
var _components = require("@wordpress/components");
|
|
11
10
|
var _blockEditor = require("@wordpress/block-editor");
|
|
12
11
|
var _compose = require("@wordpress/compose");
|
|
13
12
|
var _hooks = require("@wordpress/hooks");
|
|
13
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
14
14
|
/**
|
|
15
15
|
* WordPress dependencies
|
|
16
16
|
*/
|
|
@@ -20,23 +20,25 @@ function CopyButton({
|
|
|
20
20
|
children
|
|
21
21
|
}) {
|
|
22
22
|
const ref = (0, _compose.useCopyToClipboard)(text);
|
|
23
|
-
return (0,
|
|
23
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Button, {
|
|
24
24
|
variant: "secondary",
|
|
25
|
-
ref: ref
|
|
26
|
-
|
|
25
|
+
ref: ref,
|
|
26
|
+
children: children
|
|
27
|
+
});
|
|
27
28
|
}
|
|
28
29
|
function ErrorBoundaryWarning({
|
|
29
30
|
message,
|
|
30
31
|
error
|
|
31
32
|
}) {
|
|
32
|
-
const actions = [(0,
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
},
|
|
36
|
-
return (0,
|
|
33
|
+
const actions = [/*#__PURE__*/(0, _jsxRuntime.jsx)(CopyButton, {
|
|
34
|
+
text: error.stack,
|
|
35
|
+
children: (0, _i18n.__)('Copy Error')
|
|
36
|
+
}, "copy-error")];
|
|
37
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_blockEditor.Warning, {
|
|
37
38
|
className: "edit-widgets-error-boundary",
|
|
38
|
-
actions: actions
|
|
39
|
-
|
|
39
|
+
actions: actions,
|
|
40
|
+
children: message
|
|
41
|
+
});
|
|
40
42
|
}
|
|
41
43
|
class ErrorBoundary extends _element.Component {
|
|
42
44
|
constructor() {
|
|
@@ -57,7 +59,7 @@ class ErrorBoundary extends _element.Component {
|
|
|
57
59
|
if (!this.state.error) {
|
|
58
60
|
return this.props.children;
|
|
59
61
|
}
|
|
60
|
-
return (0,
|
|
62
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(ErrorBoundaryWarning, {
|
|
61
63
|
message: (0, _i18n.__)('The editor has encountered an unexpected error.'),
|
|
62
64
|
error: this.state.error
|
|
63
65
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_element","require","_i18n","_components","_blockEditor","_compose","_hooks","CopyButton","text","children","ref","useCopyToClipboard","
|
|
1
|
+
{"version":3,"names":["_element","require","_i18n","_components","_blockEditor","_compose","_hooks","_jsxRuntime","CopyButton","text","children","ref","useCopyToClipboard","jsx","Button","variant","ErrorBoundaryWarning","message","error","actions","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\t'The editor has encountered an unexpected error.'\n\t\t\t\t) }\n\t\t\t\terror={ this.state.error }\n\t\t\t/>\n\t\t);\n\t}\n}\n"],"mappings":";;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AACA,IAAAG,YAAA,GAAAH,OAAA;AACA,IAAAI,QAAA,GAAAJ,OAAA;AACA,IAAAK,MAAA,GAAAL,OAAA;AAA4C,IAAAM,WAAA,GAAAN,OAAA;AAR5C;AACA;AACA;;AAQA,SAASO,UAAUA,CAAE;EAAEC,IAAI;EAAEC;AAAS,CAAC,EAAG;EACzC,MAAMC,GAAG,GAAG,IAAAC,2BAAkB,EAAEH,IAAK,CAAC;EACtC,oBACC,IAAAF,WAAA,CAAAM,GAA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[]}
|
|
@@ -5,7 +5,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
7
|
exports.default = void 0;
|
|
8
|
-
var _react = require("react");
|
|
9
8
|
var _data = require("@wordpress/data");
|
|
10
9
|
var _i18n = require("@wordpress/i18n");
|
|
11
10
|
var _components = require("@wordpress/components");
|
|
@@ -17,6 +16,7 @@ var _undo = _interopRequireDefault(require("../undo-redo/undo"));
|
|
|
17
16
|
var _redo = _interopRequireDefault(require("../undo-redo/redo"));
|
|
18
17
|
var _store = require("../../../store");
|
|
19
18
|
var _lockUnlock = require("../../../lock-unlock");
|
|
19
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
20
20
|
/**
|
|
21
21
|
* WordPress dependencies
|
|
22
22
|
*/
|
|
@@ -52,40 +52,43 @@ function DocumentTools() {
|
|
|
52
52
|
} = (0, _data.useDispatch)(_store.store);
|
|
53
53
|
const toggleListView = (0, _element.useCallback)(() => setIsListViewOpened(!isListViewOpen), [setIsListViewOpened, isListViewOpen]);
|
|
54
54
|
const toggleInserterSidebar = (0, _element.useCallback)(() => setIsInserterOpened(!isInserterOpen), [setIsInserterOpened, isInserterOpen]);
|
|
55
|
-
return (0,
|
|
55
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_blockEditor.NavigableToolbar, {
|
|
56
56
|
className: "edit-widgets-header-toolbar",
|
|
57
57
|
"aria-label": (0, _i18n.__)('Document tools'),
|
|
58
|
-
variant: "unstyled"
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
58
|
+
variant: "unstyled",
|
|
59
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_components.ToolbarItem, {
|
|
60
|
+
ref: inserterSidebarToggleRef,
|
|
61
|
+
as: _components.Button,
|
|
62
|
+
className: "edit-widgets-header-toolbar__inserter-toggle",
|
|
63
|
+
variant: "primary",
|
|
64
|
+
isPressed: isInserterOpen,
|
|
65
|
+
onMouseDown: event => {
|
|
66
|
+
event.preventDefault();
|
|
67
|
+
},
|
|
68
|
+
onClick: toggleInserterSidebar,
|
|
69
|
+
icon: _icons.plus
|
|
70
|
+
/* translators: button label text should, if possible, be under 16
|
|
71
|
+
characters. */,
|
|
72
|
+
label: (0, _i18n._x)('Toggle block inserter', 'Generic label for block inserter button'),
|
|
73
|
+
size: "compact"
|
|
74
|
+
}), isMediumViewport && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
75
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_components.ToolbarItem, {
|
|
76
|
+
as: _undo.default
|
|
77
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.ToolbarItem, {
|
|
78
|
+
as: _redo.default
|
|
79
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.ToolbarItem, {
|
|
80
|
+
as: _components.Button,
|
|
81
|
+
className: "edit-widgets-header-toolbar__list-view-toggle",
|
|
82
|
+
icon: _icons.listView,
|
|
83
|
+
isPressed: isListViewOpen
|
|
84
|
+
/* translators: button label text should, if possible, be under 16 characters. */,
|
|
85
|
+
label: (0, _i18n.__)('List View'),
|
|
86
|
+
onClick: toggleListView,
|
|
87
|
+
ref: listViewToggleRef,
|
|
88
|
+
size: "compact"
|
|
89
|
+
})]
|
|
90
|
+
})]
|
|
91
|
+
});
|
|
89
92
|
}
|
|
90
93
|
var _default = exports.default = DocumentTools;
|
|
91
94
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_data","require","_i18n","_components","_blockEditor","_icons","_element","_compose","_undo","_interopRequireDefault","_redo","_store","_lockUnlock","DocumentTools","isMediumViewport","useViewportMatch","isInserterOpen","isListViewOpen","inserterSidebarToggleRef","listViewToggleRef","useSelect","select","isInserterOpened","getInserterSidebarToggleRef","isListViewOpened","getListViewToggleRef","unlock","editWidgetsStore","setIsInserterOpened","setIsListViewOpened","useDispatch","toggleListView","useCallback","toggleInserterSidebar","
|
|
1
|
+
{"version":3,"names":["_data","require","_i18n","_components","_blockEditor","_icons","_element","_compose","_undo","_interopRequireDefault","_redo","_store","_lockUnlock","_jsxRuntime","DocumentTools","isMediumViewport","useViewportMatch","isInserterOpen","isListViewOpen","inserterSidebarToggleRef","listViewToggleRef","useSelect","select","isInserterOpened","getInserterSidebarToggleRef","isListViewOpened","getListViewToggleRef","unlock","editWidgetsStore","setIsInserterOpened","setIsListViewOpened","useDispatch","toggleListView","useCallback","toggleInserterSidebar","jsxs","NavigableToolbar","className","__","variant","children","jsx","ToolbarItem","ref","as","Button","isPressed","onMouseDown","event","preventDefault","onClick","icon","plus","label","_x","size","Fragment","UndoButton","RedoButton","listView","_default","exports","default"],"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 { NavigableToolbar } from '@wordpress/block-editor';\nimport { listView, plus } from '@wordpress/icons';\nimport { useCallback } 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 { store as editWidgetsStore } from '../../../store';\nimport { unlock } from '../../../lock-unlock';\n\nfunction DocumentTools() {\n\tconst isMediumViewport = useViewportMatch( 'medium' );\n\n\tconst {\n\t\tisInserterOpen,\n\t\tisListViewOpen,\n\t\tinserterSidebarToggleRef,\n\t\tlistViewToggleRef,\n\t} = useSelect( ( select ) => {\n\t\tconst {\n\t\t\tisInserterOpened,\n\t\t\tgetInserterSidebarToggleRef,\n\t\t\tisListViewOpened,\n\t\t\tgetListViewToggleRef,\n\t\t} = unlock( select( editWidgetsStore ) );\n\t\treturn {\n\t\t\tisInserterOpen: isInserterOpened(),\n\t\t\tisListViewOpen: isListViewOpened(),\n\t\t\tinserterSidebarToggleRef: getInserterSidebarToggleRef(),\n\t\t\tlistViewToggleRef: getListViewToggleRef(),\n\t\t};\n\t}, [] );\n\tconst { setIsInserterOpened, setIsListViewOpened } =\n\t\tuseDispatch( editWidgetsStore );\n\n\tconst toggleListView = useCallback(\n\t\t() => setIsListViewOpened( ! isListViewOpen ),\n\t\t[ setIsListViewOpened, isListViewOpen ]\n\t);\n\n\tconst toggleInserterSidebar = useCallback(\n\t\t() => setIsInserterOpened( ! isInserterOpen ),\n\t\t[ setIsInserterOpened, isInserterOpen ]\n\t);\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\tvariant=\"unstyled\"\n\t\t>\n\t\t\t<ToolbarItem\n\t\t\t\tref={ inserterSidebarToggleRef }\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={ toggleInserterSidebar }\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\tsize=\"compact\"\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\tsize=\"compact\"\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":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AACA,IAAAG,YAAA,GAAAH,OAAA;AACA,IAAAI,MAAA,GAAAJ,OAAA;AACA,IAAAK,QAAA,GAAAL,OAAA;AACA,IAAAM,QAAA,GAAAN,OAAA;AAKA,IAAAO,KAAA,GAAAC,sBAAA,CAAAR,OAAA;AACA,IAAAS,KAAA,GAAAD,sBAAA,CAAAR,OAAA;AACA,IAAAU,MAAA,GAAAV,OAAA;AACA,IAAAW,WAAA,GAAAX,OAAA;AAA8C,IAAAY,WAAA,GAAAZ,OAAA;AAjB9C;AACA;AACA;;AASA;AACA;AACA;;AAMA,SAASa,aAAaA,CAAA,EAAG;EACxB,MAAMC,gBAAgB,GAAG,IAAAC,yBAAgB,EAAE,QAAS,CAAC;EAErD,MAAM;IACLC,cAAc;IACdC,cAAc;IACdC,wBAAwB;IACxBC;EACD,CAAC,GAAG,IAAAC,eAAS,EAAIC,MAAM,IAAM;IAC5B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AGC;MACP;AACJ,qBADI;MAEAC,KAAK,EAAG,IAAAC,QAAE,EACT,uBAAuB,EACvB,yCACD,CAAG;MACHC,IAAI,EAAC;IAAS,CACd,CAAC,EACAxC,gBAAgB,iBACjB,IAAAF,WAAA,CAAAsB,IAAA,EAAAtB,WAAA,CAAA2C,QAAA;MAAAhB,QAAA,gBACC,IAAA3B,WAAA,CAAA4B,GAAA,EAACtC,WAAA,CAAAuC,WAAW;QAACE,EAAE,EAAGa;MAAY,CAAE,CAAC,eACjC,IAAA5C,WAAA,CAAA4B,GAAA,EAACtC,WAAA,CAAAuC,WAAW;QAACE,EAAE,EAAGc;MAAY,CAAE,CAAC,eACjC,IAAA7C,WAAA,CAAA4B,GAAA,EAACtC,WAAA,CAAAuC,WAAW;QACXE,EAAE,EAAGC,kBAAQ;QACbR,SAAS,EAAC,+CAA+C;QACzDc,IAAI,EAAGQ,eAAU;QACjBb,SAAS,EAAG5B;QACZ;QACAmC,KAAK,EAAG,IAAAf,QAAE,EAAE,WAAY,CAAG;QAC3BY,OAAO,EAAGlB,cAAgB;QAC1BW,GAAG,EAAGvB,iBAAmB;QACzBmC,IAAI,EAAC;MAAS,CACd,CAAC;IAAA,CACD,CACF;EAAA,CACgB,CAAC;AAErB;AAAC,IAAAK,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEchD,aAAa","ignoreList":[]}
|
|
@@ -5,7 +5,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
7
|
exports.default = void 0;
|
|
8
|
-
var _react = require("react");
|
|
9
8
|
var _blockEditor = require("@wordpress/block-editor");
|
|
10
9
|
var _data = require("@wordpress/data");
|
|
11
10
|
var _element = require("@wordpress/element");
|
|
@@ -17,6 +16,7 @@ var _preferences = require("@wordpress/preferences");
|
|
|
17
16
|
var _documentTools = _interopRequireDefault(require("./document-tools"));
|
|
18
17
|
var _saveButton = _interopRequireDefault(require("../save-button"));
|
|
19
18
|
var _moreMenu = _interopRequireDefault(require("../more-menu"));
|
|
19
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
20
20
|
/**
|
|
21
21
|
* WordPress dependencies
|
|
22
22
|
*/
|
|
@@ -33,27 +33,37 @@ function Header() {
|
|
|
33
33
|
} = (0, _data.useSelect)(select => ({
|
|
34
34
|
hasFixedToolbar: !!select(_preferences.store).get('core/edit-widgets', 'fixedToolbar')
|
|
35
35
|
}), []);
|
|
36
|
-
return (0,
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
36
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
|
|
37
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
38
|
+
className: "edit-widgets-header",
|
|
39
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
40
|
+
className: "edit-widgets-header__navigable-toolbar-wrapper",
|
|
41
|
+
children: [isLargeViewport && /*#__PURE__*/(0, _jsxRuntime.jsx)("h1", {
|
|
42
|
+
className: "edit-widgets-header__title",
|
|
43
|
+
children: (0, _i18n.__)('Widgets')
|
|
44
|
+
}), !isLargeViewport && /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.VisuallyHidden, {
|
|
45
|
+
as: "h1",
|
|
46
|
+
className: "edit-widgets-header__title",
|
|
47
|
+
children: (0, _i18n.__)('Widgets')
|
|
48
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_documentTools.default, {}), hasFixedToolbar && isLargeViewport && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
49
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
50
|
+
className: "selected-block-tools-wrapper",
|
|
51
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_blockEditor.BlockToolbar, {
|
|
52
|
+
hideDragHandle: true
|
|
53
|
+
})
|
|
54
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Popover.Slot, {
|
|
55
|
+
ref: blockToolbarRef,
|
|
56
|
+
name: "block-toolbar"
|
|
57
|
+
})]
|
|
58
|
+
})]
|
|
59
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
60
|
+
className: "edit-widgets-header__actions",
|
|
61
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_saveButton.default, {}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_interface.PinnedItems.Slot, {
|
|
62
|
+
scope: "core/edit-widgets"
|
|
63
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_moreMenu.default, {})]
|
|
64
|
+
})]
|
|
65
|
+
})
|
|
66
|
+
});
|
|
57
67
|
}
|
|
58
68
|
var _default = exports.default = Header;
|
|
59
69
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_blockEditor","require","_data","_element","_i18n","_components","_interface","_compose","_preferences","_documentTools","_interopRequireDefault","_saveButton","_moreMenu","Header","isLargeViewport","useViewportMatch","blockToolbarRef","useRef","hasFixedToolbar","useSelect","select","preferencesStore","get","
|
|
1
|
+
{"version":3,"names":["_blockEditor","require","_data","_element","_i18n","_components","_interface","_compose","_preferences","_documentTools","_interopRequireDefault","_saveButton","_moreMenu","_jsxRuntime","Header","isLargeViewport","useViewportMatch","blockToolbarRef","useRef","hasFixedToolbar","useSelect","select","preferencesStore","get","jsx","Fragment","children","jsxs","className","__","VisuallyHidden","as","default","BlockToolbar","hideDragHandle","Popover","Slot","ref","name","PinnedItems","scope","_default","exports"],"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":";;;;;;;AAGA,IAAAA,YAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,KAAA,GAAAH,OAAA;AACA,IAAAI,WAAA,GAAAJ,OAAA;AACA,IAAAK,UAAA,GAAAL,OAAA;AACA,IAAAM,QAAA,GAAAN,OAAA;AACA,IAAAO,YAAA,GAAAP,OAAA;AAKA,IAAAQ,cAAA,GAAAC,sBAAA,CAAAT,OAAA;AACA,IAAAU,WAAA,GAAAD,sBAAA,CAAAT,OAAA;AACA,IAAAW,SAAA,GAAAF,sBAAA,CAAAT,OAAA;AAAoC,IAAAY,WAAA,GAAAZ,OAAA;AAjBpC;AACA;AACA;;AAUA;AACA;AACA;;AAKA,SAASa,MAAMA,CAAA,EAAG;EACjB,MAAMC,eAAe,GAAG,IAAAC,yBAAgB,EAAE,QAAS,CAAC;EACpD,MAAMC,eAAe,GAAG,IAAAC,eAAM,EAAC,CAAC;EAChC,MAAM;IAAEC;EAAgB,CAAC,GAAG,IAAAC,eAAS,EAClCC,MAAM,KAAQ;IACfF,eAAe,EAAE,CAAC,CAAEE,MAAM,CAAEC,kBAAiB,CAAC,CAACC,GAAG,CACjD,mBAAmB,EACnB,cACD;EACD,CAAC,CAAE,EACH,EACD,CAAC;EAED,oBACC,IAAAV,WAAA,CAAAW,GAAA,EAAAX,WAAA,CAAAY,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UAACI,KAAK,EAAC;QAAmB,CAAE,CAAC,eAC9C,IAAA3B,WAAA,CAAAW,GAAA,EAACZ,SAAA,CAAAoB,OAAQ,IAAE,CAAC;MAAA,CACR,CAAC;IAAA,CACF;EAAC,CACL,CAAC;AAEL;AAAC,IAAAS,QAAA,GAAAC,OAAA,CAAAV,OAAA,GAEclB,MAAM","ignoreList":[]}
|
|
@@ -4,7 +4,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
var _react = require("react");
|
|
8
7
|
var _i18n = require("@wordpress/i18n");
|
|
9
8
|
var _components = require("@wordpress/components");
|
|
10
9
|
var _data = require("@wordpress/data");
|
|
@@ -12,6 +11,7 @@ var _icons = require("@wordpress/icons");
|
|
|
12
11
|
var _keycodes = require("@wordpress/keycodes");
|
|
13
12
|
var _coreData = require("@wordpress/core-data");
|
|
14
13
|
var _element = require("@wordpress/element");
|
|
14
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
15
15
|
/**
|
|
16
16
|
* WordPress dependencies
|
|
17
17
|
*/
|
|
@@ -22,7 +22,7 @@ function RedoButton(props, ref) {
|
|
|
22
22
|
const {
|
|
23
23
|
redo
|
|
24
24
|
} = (0, _data.useDispatch)(_coreData.store);
|
|
25
|
-
return (0,
|
|
25
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Button, {
|
|
26
26
|
...props,
|
|
27
27
|
ref: ref,
|
|
28
28
|
icon: !(0, _i18n.isRTL)() ? _icons.redo : _icons.undo,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_i18n","require","_components","_data","_icons","_keycodes","_coreData","_element","RedoButton","props","ref","shortcut","isAppleOS","displayShortcut","primaryShift","primary","hasRedo","useSelect","select","coreStore","redo","useDispatch","
|
|
1
|
+
{"version":3,"names":["_i18n","require","_components","_data","_icons","_keycodes","_coreData","_element","_jsxRuntime","RedoButton","props","ref","shortcut","isAppleOS","displayShortcut","primaryShift","primary","hasRedo","useSelect","select","coreStore","redo","useDispatch","jsx","Button","icon","isRTL","redoIcon","undoIcon","label","__","onClick","undefined","size","_default","exports","default","forwardRef"],"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\tsize=\"compact\"\n\t\t/>\n\t);\n}\n\nexport default forwardRef( RedoButton );\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;AACA,IAAAM,QAAA,GAAAN,OAAA;AAAgD,IAAAO,WAAA,GAAAP,OAAA;AAThD;AACA;AACA;;AASA,SAASQ,UAAUA,CAAEC,KAAK,EAAEC,GAAG,EAAG;EACjC,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,oBACC,IAAAZ,WAAA,CAAAe,GAAA,EAACrB,WAAA,CAAAsB,MAAM;IAAA,GACDd,KAAK;IACVC,GAAG,EAAGA,GAAK;IACXc,IAAI,EAAG,CAAE,IAAAC,WAAK,EAAC,CAAC,GAAGC,WAAQ,GAAGC,WAAU;IACxCC,KAAK,EAAG,IAAAC,QAAE,EAAE,MAAO,CAAG;IACtBlB,QAAQ,EAAGA;IACX;IACA;IACA;IAAA;IACA,iBAAgB,CAAEK,OAAS;IAC3Bc,OAAO,EAAGd,OAAO,GAAGI,IAAI,GAAGW,SAAW;IACtCC,IAAI,EAAC;EAAS,CACd,CAAC;AAEJ;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEc,IAAAC,mBAAU,EAAE5B,UAAW,CAAC","ignoreList":[]}
|
|
@@ -4,7 +4,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
var _react = require("react");
|
|
8
7
|
var _i18n = require("@wordpress/i18n");
|
|
9
8
|
var _components = require("@wordpress/components");
|
|
10
9
|
var _data = require("@wordpress/data");
|
|
@@ -12,6 +11,7 @@ var _icons = require("@wordpress/icons");
|
|
|
12
11
|
var _keycodes = require("@wordpress/keycodes");
|
|
13
12
|
var _coreData = require("@wordpress/core-data");
|
|
14
13
|
var _element = require("@wordpress/element");
|
|
14
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
15
15
|
/**
|
|
16
16
|
* WordPress dependencies
|
|
17
17
|
*/
|
|
@@ -21,7 +21,7 @@ function UndoButton(props, ref) {
|
|
|
21
21
|
const {
|
|
22
22
|
undo
|
|
23
23
|
} = (0, _data.useDispatch)(_coreData.store);
|
|
24
|
-
return (0,
|
|
24
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Button, {
|
|
25
25
|
...props,
|
|
26
26
|
ref: ref,
|
|
27
27
|
icon: !(0, _i18n.isRTL)() ? _icons.undo : _icons.redo,
|