@wordpress/edit-widgets 5.19.2 → 5.20.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +2 -0
- package/build/blocks/widget-area/edit/index.js +6 -5
- package/build/blocks/widget-area/edit/index.js.map +1 -1
- package/build/blocks/widget-area/edit/inner-blocks.js +4 -3
- package/build/blocks/widget-area/edit/inner-blocks.js.map +1 -1
- package/build/components/error-boundary/index.js +5 -4
- package/build/components/error-boundary/index.js.map +1 -1
- package/build/components/header/index.js +12 -11
- 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 +15 -15
- package/build/components/keyboard-shortcut-help-modal/index.js.map +1 -1
- package/build/components/keyboard-shortcut-help-modal/shortcut.js +8 -7
- package/build/components/keyboard-shortcut-help-modal/shortcut.js.map +1 -1
- package/build/components/layout/index.js +5 -5
- package/build/components/layout/index.js.map +1 -1
- package/build/components/layout/interface.js +9 -8
- package/build/components/layout/interface.js.map +1 -1
- package/build/components/layout/unsaved-changes-warning.js +1 -1
- package/build/components/layout/unsaved-changes-warning.js.map +1 -1
- package/build/components/more-menu/index.js +15 -14
- package/build/components/more-menu/index.js.map +1 -1
- package/build/components/more-menu/tools-more-menu-group.js +2 -2
- package/build/components/more-menu/tools-more-menu-group.js.map +1 -1
- package/build/components/notices/index.js +4 -4
- package/build/components/notices/index.js.map +1 -1
- package/build/components/save-button/index.js +2 -2
- 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 +7 -6
- package/build/components/secondary-sidebar/inserter-sidebar.js.map +1 -1
- package/build/components/secondary-sidebar/list-view-sidebar.js +7 -6
- package/build/components/secondary-sidebar/list-view-sidebar.js.map +1 -1
- package/build/components/sidebar/index.js +9 -8
- package/build/components/sidebar/index.js.map +1 -1
- package/build/components/sidebar/widget-areas.js +7 -6
- package/build/components/sidebar/widget-areas.js.map +1 -1
- package/build/components/welcome-guide/index.js +23 -22
- package/build/components/welcome-guide/index.js.map +1 -1
- package/build/components/widget-areas-block-editor-content/index.js +5 -4
- package/build/components/widget-areas-block-editor-content/index.js.map +1 -1
- package/build/components/widget-areas-block-editor-provider/index.js +4 -3
- package/build/components/widget-areas-block-editor-provider/index.js.map +1 -1
- package/build/filters/move-to-widget-area.js +3 -3
- package/build/filters/move-to-widget-area.js.map +1 -1
- package/build/index.js +3 -2
- package/build/index.js.map +1 -1
- package/build-module/blocks/widget-area/edit/index.js +1 -1
- package/build-module/blocks/widget-area/edit/inner-blocks.js +1 -1
- package/build-module/components/error-boundary/index.js +1 -1
- package/build-module/components/header/index.js +1 -1
- package/build-module/components/header/undo-redo/redo.js +1 -1
- package/build-module/components/header/undo-redo/undo.js +1 -1
- package/build-module/components/keyboard-shortcut-help-modal/dynamic-shortcut.js +1 -1
- package/build-module/components/keyboard-shortcut-help-modal/index.js +1 -1
- package/build-module/components/keyboard-shortcut-help-modal/shortcut.js +1 -1
- package/build-module/components/layout/index.js +1 -1
- package/build-module/components/layout/interface.js +1 -1
- package/build-module/components/layout/unsaved-changes-warning.js +1 -1
- package/build-module/components/layout/unsaved-changes-warning.js.map +1 -1
- package/build-module/components/more-menu/index.js +1 -1
- package/build-module/components/more-menu/tools-more-menu-group.js +1 -1
- package/build-module/components/notices/index.js +1 -1
- package/build-module/components/save-button/index.js +1 -1
- package/build-module/components/secondary-sidebar/index.js +1 -1
- package/build-module/components/secondary-sidebar/inserter-sidebar.js +1 -1
- package/build-module/components/secondary-sidebar/list-view-sidebar.js +1 -1
- package/build-module/components/sidebar/index.js +1 -1
- package/build-module/components/sidebar/widget-areas.js +1 -1
- package/build-module/components/welcome-guide/index.js +1 -1
- package/build-module/components/widget-areas-block-editor-content/index.js +1 -1
- package/build-module/components/widget-areas-block-editor-provider/index.js +3 -3
- package/build-module/components/widget-areas-block-editor-provider/index.js.map +1 -1
- package/build-module/filters/move-to-widget-area.js +1 -1
- package/build-module/index.js +1 -1
- package/build-style/style-rtl.css +11 -10
- package/build-style/style.css +11 -10
- package/package.json +28 -28
- package/src/components/layout/unsaved-changes-warning.js +1 -1
- package/src/components/widget-areas-block-editor-provider/index.js +2 -5
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
7
|
exports.default = WidgetAreaEdit;
|
|
8
|
+
var _react = require("react");
|
|
8
9
|
var _element = require("@wordpress/element");
|
|
9
10
|
var _data = require("@wordpress/data");
|
|
10
11
|
var _coreData = require("@wordpress/core-data");
|
|
@@ -51,10 +52,10 @@ function WidgetAreaEdit({
|
|
|
51
52
|
setOpen(false);
|
|
52
53
|
}
|
|
53
54
|
}, [isOpen, isDragging, isDraggingWithin, openedWhileDragging]);
|
|
54
|
-
return (0,
|
|
55
|
+
return (0, _react.createElement)(_components.Panel, {
|
|
55
56
|
className: className,
|
|
56
57
|
ref: wrapper
|
|
57
|
-
}, (0,
|
|
58
|
+
}, (0, _react.createElement)(_components.PanelBody, {
|
|
58
59
|
title: name,
|
|
59
60
|
opened: isOpen,
|
|
60
61
|
onToggle: () => {
|
|
@@ -68,14 +69,14 @@ function WidgetAreaEdit({
|
|
|
68
69
|
// unmounted when the panel is collapsed. Unmounting legacy
|
|
69
70
|
// widgets may have unintended consequences (e.g. TinyMCE
|
|
70
71
|
// not being properly reinitialized)
|
|
71
|
-
(0,
|
|
72
|
+
(0, _react.createElement)(_components.__unstableDisclosureContent, {
|
|
72
73
|
className: "wp-block-widget-area__panel-body-content",
|
|
73
74
|
visible: opened
|
|
74
|
-
}, (0,
|
|
75
|
+
}, (0, _react.createElement)(_coreData.EntityProvider, {
|
|
75
76
|
kind: "root",
|
|
76
77
|
type: "postType",
|
|
77
78
|
id: `widget-area-${id}`
|
|
78
|
-
}, (0,
|
|
79
|
+
}, (0, _react.createElement)(_innerBlocks.default, {
|
|
79
80
|
id: id
|
|
80
81
|
})))));
|
|
81
82
|
}
|
|
@@ -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","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":"
|
|
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","_react","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,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aAAa,CAAE,IAAK,CAAC;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"}
|
|
@@ -5,10 +5,11 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
7
|
exports.default = WidgetAreaInnerBlocks;
|
|
8
|
-
var
|
|
8
|
+
var _react = require("react");
|
|
9
9
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
10
10
|
var _coreData = require("@wordpress/core-data");
|
|
11
11
|
var _blockEditor = require("@wordpress/block-editor");
|
|
12
|
+
var _element = require("@wordpress/element");
|
|
12
13
|
var _useIsDraggingWithin = _interopRequireDefault(require("./use-is-dragging-within"));
|
|
13
14
|
/**
|
|
14
15
|
* External dependencies
|
|
@@ -39,12 +40,12 @@ function WidgetAreaInnerBlocks({
|
|
|
39
40
|
templateLock: false,
|
|
40
41
|
renderAppender: _blockEditor.InnerBlocks.ButtonBlockAppender
|
|
41
42
|
});
|
|
42
|
-
return (0,
|
|
43
|
+
return (0, _react.createElement)("div", {
|
|
43
44
|
"data-widget-area-id": id,
|
|
44
45
|
className: (0, _classnames.default)('wp-block-widget-area__inner-blocks block-editor-inner-blocks editor-styles-wrapper', {
|
|
45
46
|
'wp-block-widget-area__highlight-drop-zone': shouldHighlightDropZone
|
|
46
47
|
})
|
|
47
|
-
}, (0,
|
|
48
|
+
}, (0, _react.createElement)("div", {
|
|
48
49
|
...innerBlocksProps
|
|
49
50
|
}));
|
|
50
51
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["_classnames","_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","_react","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":";;;;;;;;AAGA,IAAAA,WAAA,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;AAfA;AACA;AACA;;AAGA;AACA;AACA;;AAKA;AACA;AACA;;AAGe,SAASK,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,IAAAC,MAAA,CAAAC,aAAA;IACC,uBAAsBnB,EAAI;IAC1BoB,SAAS,EAAG,IAAAC,mBAAU,EACrB,oFAAoF,EACpF;MACC,2CAA2C,EAC1CZ;IACF,CACD;EAAG,GAEH,IAAAS,MAAA,CAAAC,aAAA;IAAA,GAAUT;EAAgB,CAAI,CAC1B,CAAC;AAER"}
|
|
@@ -4,6 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
+
var _react = require("react");
|
|
7
8
|
var _element = require("@wordpress/element");
|
|
8
9
|
var _i18n = require("@wordpress/i18n");
|
|
9
10
|
var _components = require("@wordpress/components");
|
|
@@ -19,7 +20,7 @@ function CopyButton({
|
|
|
19
20
|
children
|
|
20
21
|
}) {
|
|
21
22
|
const ref = (0, _compose.useCopyToClipboard)(text);
|
|
22
|
-
return (0,
|
|
23
|
+
return (0, _react.createElement)(_components.Button, {
|
|
23
24
|
variant: "secondary",
|
|
24
25
|
ref: ref
|
|
25
26
|
}, children);
|
|
@@ -28,11 +29,11 @@ function ErrorBoundaryWarning({
|
|
|
28
29
|
message,
|
|
29
30
|
error
|
|
30
31
|
}) {
|
|
31
|
-
const actions = [(0,
|
|
32
|
+
const actions = [(0, _react.createElement)(CopyButton, {
|
|
32
33
|
key: "copy-error",
|
|
33
34
|
text: error.stack
|
|
34
35
|
}, (0, _i18n.__)('Copy Error'))];
|
|
35
|
-
return (0,
|
|
36
|
+
return (0, _react.createElement)(_blockEditor.Warning, {
|
|
36
37
|
className: "edit-widgets-error-boundary",
|
|
37
38
|
actions: actions
|
|
38
39
|
}, message);
|
|
@@ -56,7 +57,7 @@ class ErrorBoundary extends _element.Component {
|
|
|
56
57
|
if (!this.state.error) {
|
|
57
58
|
return this.props.children;
|
|
58
59
|
}
|
|
59
|
-
return (0,
|
|
60
|
+
return (0, _react.createElement)(ErrorBoundaryWarning, {
|
|
60
61
|
message: (0, _i18n.__)('The editor has encountered an unexpected error.'),
|
|
61
62
|
error: this.state.error
|
|
62
63
|
});
|
|
@@ -1 +1 @@
|
|
|
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\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":"
|
|
1
|
+
{"version":3,"names":["_element","require","_i18n","_components","_blockEditor","_compose","_hooks","CopyButton","text","children","ref","useCopyToClipboard","_react","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\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;AARA;A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;MACHJ,KAAK,EAAG,IAAI,CAACW,KAAK,CAACX;IAAO,CAC1B,CAAC;EAEJ;AACD;AAACiB,OAAA,CAAAC,OAAA,GAAAX,aAAA"}
|
|
@@ -5,13 +5,14 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
7
|
exports.default = void 0;
|
|
8
|
-
var
|
|
8
|
+
var _react = require("react");
|
|
9
9
|
var _data = require("@wordpress/data");
|
|
10
10
|
var _i18n = require("@wordpress/i18n");
|
|
11
11
|
var _components = require("@wordpress/components");
|
|
12
12
|
var _blockEditor = require("@wordpress/block-editor");
|
|
13
13
|
var _interface = require("@wordpress/interface");
|
|
14
14
|
var _icons = require("@wordpress/icons");
|
|
15
|
+
var _element = require("@wordpress/element");
|
|
15
16
|
var _compose = require("@wordpress/compose");
|
|
16
17
|
var _saveButton = _interopRequireDefault(require("../save-button"));
|
|
17
18
|
var _undo = _interopRequireDefault(require("./undo-redo/undo"));
|
|
@@ -87,20 +88,20 @@ function Header({
|
|
|
87
88
|
// If there's a block toolbar to be focused, disable the focus shortcut for the document toolbar.
|
|
88
89
|
// There's a fixed block toolbar when the fixed toolbar option is enabled or when the browser width is less than the large viewport.
|
|
89
90
|
const blockToolbarCanBeFocused = shouldShowContextualToolbar || canFocusHiddenToolbar || fixedToolbarCanBeFocused;
|
|
90
|
-
return (0,
|
|
91
|
+
return (0, _react.createElement)(_react.Fragment, null, (0, _react.createElement)("div", {
|
|
91
92
|
className: "edit-widgets-header"
|
|
92
|
-
}, (0,
|
|
93
|
+
}, (0, _react.createElement)("div", {
|
|
93
94
|
className: "edit-widgets-header__navigable-toolbar-wrapper"
|
|
94
|
-
}, isMediumViewport && (0,
|
|
95
|
+
}, isMediumViewport && (0, _react.createElement)("h1", {
|
|
95
96
|
className: "edit-widgets-header__title"
|
|
96
|
-
}, (0, _i18n.__)('Widgets')), !isMediumViewport && (0,
|
|
97
|
+
}, (0, _i18n.__)('Widgets')), !isMediumViewport && (0, _react.createElement)(_components.VisuallyHidden, {
|
|
97
98
|
as: "h1",
|
|
98
99
|
className: "edit-widgets-header__title"
|
|
99
|
-
}, (0, _i18n.__)('Widgets')), (0,
|
|
100
|
+
}, (0, _i18n.__)('Widgets')), (0, _react.createElement)(_blockEditor.NavigableToolbar, {
|
|
100
101
|
className: "edit-widgets-header-toolbar",
|
|
101
102
|
"aria-label": (0, _i18n.__)('Document tools'),
|
|
102
103
|
shouldUseKeyboardFocusShortcut: !blockToolbarCanBeFocused
|
|
103
|
-
}, (0,
|
|
104
|
+
}, (0, _react.createElement)(_components.ToolbarItem, {
|
|
104
105
|
ref: inserterButton,
|
|
105
106
|
as: _components.Button,
|
|
106
107
|
className: "edit-widgets-header-toolbar__inserter-toggle",
|
|
@@ -114,7 +115,7 @@ function Header({
|
|
|
114
115
|
/* translators: button label text should, if possible, be under 16
|
|
115
116
|
characters. */,
|
|
116
117
|
label: (0, _i18n._x)('Toggle block inserter', 'Generic label for block inserter button')
|
|
117
|
-
}), isMediumViewport && (0,
|
|
118
|
+
}), isMediumViewport && (0, _react.createElement)(_react.Fragment, null, (0, _react.createElement)(_undo.default, null), (0, _react.createElement)(_redo.default, null), (0, _react.createElement)(_components.ToolbarItem, {
|
|
118
119
|
as: _components.Button,
|
|
119
120
|
className: "edit-widgets-header-toolbar__list-view-toggle",
|
|
120
121
|
icon: _icons.listView,
|
|
@@ -123,11 +124,11 @@ function Header({
|
|
|
123
124
|
label: (0, _i18n.__)('List View'),
|
|
124
125
|
onClick: toggleListView,
|
|
125
126
|
ref: setListViewToggleElement
|
|
126
|
-
})))), (0,
|
|
127
|
+
})))), (0, _react.createElement)("div", {
|
|
127
128
|
className: "edit-widgets-header__actions"
|
|
128
|
-
}, (0,
|
|
129
|
+
}, (0, _react.createElement)(_saveButton.default, null), (0, _react.createElement)(_interface.PinnedItems.Slot, {
|
|
129
130
|
scope: "core/edit-widgets"
|
|
130
|
-
}), (0,
|
|
131
|
+
}), (0, _react.createElement)(_moreMenu.default, null))));
|
|
131
132
|
}
|
|
132
133
|
var _default = Header;
|
|
133
134
|
exports.default = _default;
|
|
@@ -1 +1 @@
|
|
|
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","setListViewToggleElement","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( { setListViewToggleElement } ) {\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\tref={ setListViewToggleElement }\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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,QAAE,EAAE,WAAY,CAAG;IAC3Ba,OAAO,EAAGtB,cAAgB;IAC1Be,GAAG,EAAGxC;EAA0B,CAChC,CACA,CAEc,CACd,CAAC,EACN,IAAArB,QAAA,CAAAoD,aAAA;IAAKE,SAAS,EAAC;EAA8B,GAC5C,IAAAtD,QAAA,CAAAoD,aAAA,EAAC3C,WAAA,CAAAgE,OAAU,MAAE,CAAC,EACd,IAAAzE,QAAA,CAAAoD,aAAA,EAAC9C,UAAA,CAAAqE,WAAW,CAACC,IAAI;IAACC,KAAK,EAAC;EAAmB,CAAE,CAAC,EAC9C,IAAA7E,QAAA,CAAAoD,aAAA,EAACvC,SAAA,CAAA4D,OAAQ,MAAE,CACP,CACD,CACJ,CAAC;AAEL;AAAC,IAAAK,QAAA,GAEc1D,MAAM;AAAA2D,OAAA,CAAAN,OAAA,GAAAK,QAAA"}
|
|
1
|
+
{"version":3,"names":["_data","require","_i18n","_components","_blockEditor","_interface","_icons","_element","_compose","_saveButton","_interopRequireDefault","_undo","_redo","_moreMenu","_useLastSelectedWidgetArea","_store","_lockUnlock","useShouldContextualToolbarShow","unlock","blockEditorPrivateApis","Header","setListViewToggleElement","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","_react","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( { setListViewToggleElement } ) {\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\tref={ setListViewToggleElement }\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":";;;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AACA,IAAAG,YAAA,GAAAH,OAAA;AAKA,IAAAI,UAAA,GAAAJ,OAAA;AACA,IAAAK,MAAA,GAAAL,OAAA;AACA,IAAAM,QAAA,GAAAN,OAAA;AACA,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,CAAE;EAAEC;AAAyB,CAAC,EAAG;EAC/C,MAAMC,gBAAgB,GAAG,IAAAC,yBAAgB,EAAE,QAAS,CAAC;EAC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,CAAC,EACAnD,gBAAgB,IACjB,IAAA8B,MAAA,CAAAC,aAAA,EAAAD,MAAA,CAAAE,QAAA,QACC,IAAAF,MAAA,CAAAC,aAAA,EAAC1C,KAAA,CAAA+D,OAAU,MAAE,CAAC,EACd,IAAAtB,MAAA,CAAAC,aAAA,EAACzC,KAAA,CAAA8D,OAAU,MAAE,CAAC,EACd,IAAAtB,MAAA,CAAAC,aAAA,EAAClD,WAAA,CAAA0D,WAAW;IACXH,EAAE,EAAGK,kBAAQ;IACbR,SAAS,EAAC,+CAA+C;IACzDe,IAAI,EAAGK,eAAU;IACjBV,SAAS,EAAG/B;IACZ;IACAsC,KAAK,EAAG,IAAAhB,QAAE,EAAE,WAAY,CAAG;IAC3Ba,OAAO,EAAGvB,cAAgB;IAC1BgB,GAAG,EAAGzC;EAA0B,CAChC,CACA,CAEc,CACd,CAAC,EACN,IAAA+B,MAAA,CAAAC,aAAA;IAAKE,SAAS,EAAC;EAA8B,GAC5C,IAAAH,MAAA,CAAAC,aAAA,EAAC5C,WAAA,CAAAiE,OAAU,MAAE,CAAC,EACd,IAAAtB,MAAA,CAAAC,aAAA,EAAChD,UAAA,CAAAuE,WAAW,CAACC,IAAI;IAACC,KAAK,EAAC;EAAmB,CAAE,CAAC,EAC9C,IAAA1B,MAAA,CAAAC,aAAA,EAACxC,SAAA,CAAA6D,OAAQ,MAAE,CACP,CACD,CACJ,CAAC;AAEL;AAAC,IAAAK,QAAA,GAEc3D,MAAM;AAAA4D,OAAA,CAAAN,OAAA,GAAAK,QAAA"}
|
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = RedoButton;
|
|
7
|
-
var
|
|
7
|
+
var _react = require("react");
|
|
8
8
|
var _i18n = require("@wordpress/i18n");
|
|
9
9
|
var _components = require("@wordpress/components");
|
|
10
10
|
var _data = require("@wordpress/data");
|
|
@@ -21,7 +21,7 @@ function RedoButton() {
|
|
|
21
21
|
const {
|
|
22
22
|
redo
|
|
23
23
|
} = (0, _data.useDispatch)(_coreData.store);
|
|
24
|
-
return (0,
|
|
24
|
+
return (0, _react.createElement)(_components.ToolbarButton, {
|
|
25
25
|
icon: !(0, _i18n.isRTL)() ? _icons.redo : _icons.undo,
|
|
26
26
|
label: (0, _i18n.__)('Redo'),
|
|
27
27
|
shortcut: shortcut
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_i18n","require","_components","_data","_icons","_keycodes","_coreData","RedoButton","shortcut","isAppleOS","displayShortcut","primaryShift","primary","hasRedo","useSelect","select","coreStore","redo","useDispatch","
|
|
1
|
+
{"version":3,"names":["_i18n","require","_components","_data","_icons","_keycodes","_coreData","RedoButton","shortcut","isAppleOS","displayShortcut","primaryShift","primary","hasRedo","useSelect","select","coreStore","redo","useDispatch","_react","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,MAAA,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"}
|
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = UndoButton;
|
|
7
|
-
var
|
|
7
|
+
var _react = require("react");
|
|
8
8
|
var _i18n = require("@wordpress/i18n");
|
|
9
9
|
var _components = require("@wordpress/components");
|
|
10
10
|
var _data = require("@wordpress/data");
|
|
@@ -20,7 +20,7 @@ function UndoButton() {
|
|
|
20
20
|
const {
|
|
21
21
|
undo
|
|
22
22
|
} = (0, _data.useDispatch)(_coreData.store);
|
|
23
|
-
return (0,
|
|
23
|
+
return (0, _react.createElement)(_components.ToolbarButton, {
|
|
24
24
|
icon: !(0, _i18n.isRTL)() ? _icons.undo : _icons.redo,
|
|
25
25
|
label: (0, _i18n.__)('Undo'),
|
|
26
26
|
shortcut: _keycodes.displayShortcut.primary('z')
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_i18n","require","_components","_data","_icons","_keycodes","_coreData","UndoButton","hasUndo","useSelect","select","coreStore","undo","useDispatch","
|
|
1
|
+
{"version":3,"names":["_i18n","require","_components","_data","_icons","_keycodes","_coreData","UndoButton","hasUndo","useSelect","select","coreStore","undo","useDispatch","_react","createElement","ToolbarButton","icon","isRTL","undoIcon","redoIcon","label","__","shortcut","displayShortcut","primary","onClick","undefined"],"sources":["@wordpress/edit-widgets/src/components/header/undo-redo/undo.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, isRTL } from '@wordpress/i18n';\nimport { ToolbarButton } from '@wordpress/components';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { undo as undoIcon, redo as redoIcon } from '@wordpress/icons';\nimport { displayShortcut } from '@wordpress/keycodes';\nimport { store as coreStore } from '@wordpress/core-data';\n\nexport default function UndoButton() {\n\tconst hasUndo = useSelect(\n\t\t( select ) => select( coreStore ).hasUndo(),\n\t\t[]\n\t);\n\tconst { undo } = useDispatch( coreStore );\n\treturn (\n\t\t<ToolbarButton\n\t\t\ticon={ ! isRTL() ? undoIcon : redoIcon }\n\t\t\tlabel={ __( 'Undo' ) }\n\t\t\tshortcut={ displayShortcut.primary( 'z' ) }\n\t\t\t// If there are no undo levels we don't want to actually disable this\n\t\t\t// button, because it will remove focus for keyboard users.\n\t\t\t// See: https://github.com/WordPress/gutenberg/issues/3486\n\t\t\taria-disabled={ ! hasUndo }\n\t\t\tonClick={ hasUndo ? undo : undefined }\n\t\t/>\n\t);\n}\n"],"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,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,MAAA,CAAAC,aAAA,EAACb,WAAA,CAAAc,aAAa;IACbC,IAAI,EAAG,CAAE,IAAAC,WAAK,EAAC,CAAC,GAAGC,WAAQ,GAAGC,WAAU;IACxCC,KAAK,EAAG,IAAAC,QAAE,EAAE,MAAO,CAAG;IACtBC,QAAQ,EAAGC,yBAAe,CAACC,OAAO,CAAE,GAAI;IACxC;IACA;IACA;IAAA;IACA,iBAAgB,CAAEjB,OAAS;IAC3BkB,OAAO,EAAGlB,OAAO,GAAGI,IAAI,GAAGe;EAAW,CACtC,CAAC;AAEJ"}
|
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
7
|
exports.default = void 0;
|
|
8
|
-
var
|
|
8
|
+
var _react = require("react");
|
|
9
9
|
var _data = require("@wordpress/data");
|
|
10
10
|
var _keyboardShortcuts = require("@wordpress/keyboard-shortcuts");
|
|
11
11
|
var _shortcut = _interopRequireDefault(require("./shortcut"));
|
|
@@ -39,7 +39,7 @@ function DynamicShortcut({
|
|
|
39
39
|
if (!keyCombination) {
|
|
40
40
|
return null;
|
|
41
41
|
}
|
|
42
|
-
return (0,
|
|
42
|
+
return (0, _react.createElement)(_shortcut.default, {
|
|
43
43
|
keyCombination: keyCombination,
|
|
44
44
|
description: description,
|
|
45
45
|
aliases: aliases
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_data","require","_keyboardShortcuts","_shortcut","_interopRequireDefault","DynamicShortcut","name","keyCombination","description","aliases","useSelect","select","getShortcutKeyCombination","getShortcutDescription","getShortcutAliases","keyboardShortcutsStore","
|
|
1
|
+
{"version":3,"names":["_data","require","_keyboardShortcuts","_shortcut","_interopRequireDefault","DynamicShortcut","name","keyCombination","description","aliases","useSelect","select","getShortcutKeyCombination","getShortcutDescription","getShortcutAliases","keyboardShortcutsStore","_react","createElement","default","_default","exports"],"sources":["@wordpress/edit-widgets/src/components/keyboard-shortcut-help-modal/dynamic-shortcut.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { store as keyboardShortcutsStore } from '@wordpress/keyboard-shortcuts';\n\n/**\n * Internal dependencies\n */\nimport Shortcut from './shortcut';\n\nfunction DynamicShortcut( { name } ) {\n\tconst { keyCombination, description, aliases } = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetShortcutKeyCombination,\n\t\t\t\tgetShortcutDescription,\n\t\t\t\tgetShortcutAliases,\n\t\t\t} = select( keyboardShortcutsStore );\n\n\t\t\treturn {\n\t\t\t\tkeyCombination: getShortcutKeyCombination( name ),\n\t\t\t\taliases: getShortcutAliases( name ),\n\t\t\t\tdescription: getShortcutDescription( name ),\n\t\t\t};\n\t\t},\n\t\t[ name ]\n\t);\n\n\tif ( ! keyCombination ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<Shortcut\n\t\t\tkeyCombination={ keyCombination }\n\t\t\tdescription={ description }\n\t\t\taliases={ aliases }\n\t\t/>\n\t);\n}\n\nexport default DynamicShortcut;\n"],"mappings":";;;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,kBAAA,GAAAD,OAAA;AAKA,IAAAE,SAAA,GAAAC,sBAAA,CAAAH,OAAA;AATA;AACA;AACA;;AAIA;AACA;AACA;;AAGA,SAASI,eAAeA,CAAE;EAAEC;AAAK,CAAC,EAAG;EACpC,MAAM;IAAEC,cAAc;IAAEC,WAAW;IAAEC;EAAQ,CAAC,GAAG,IAAAC,eAAS,EACvDC,MAAM,IAAM;IACb,MAAM;MACLC,yBAAyB;MACzBC,sBAAsB;MACtBC;IACD,CAAC,GAAGH,MAAM,CAAEI,wBAAuB,CAAC;IAEpC,OAAO;MACNR,cAAc,EAAEK,yBAAyB,CAAEN,IAAK,CAAC;MACjDG,OAAO,EAAEK,kBAAkB,CAAER,IAAK,CAAC;MACnCE,WAAW,EAAEK,sBAAsB,CAAEP,IAAK;IAC3C,CAAC;EACF,CAAC,EACD,CAAEA,IAAI,CACP,CAAC;EAED,IAAK,CAAEC,cAAc,EAAG;IACvB,OAAO,IAAI;EACZ;EAEA,OACC,IAAAS,MAAA,CAAAC,aAAA,EAACd,SAAA,CAAAe,OAAQ;IACRX,cAAc,EAAGA,cAAgB;IACjCC,WAAW,EAAGA,WAAa;IAC3BC,OAAO,EAAGA;EAAS,CACnB,CAAC;AAEJ;AAAC,IAAAU,QAAA,GAEcd,eAAe;AAAAe,OAAA,CAAAF,OAAA,GAAAC,QAAA"}
|
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
7
|
exports.default = KeyboardShortcutHelpModal;
|
|
8
|
-
var
|
|
8
|
+
var _react = require("react");
|
|
9
9
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
10
10
|
var _components = require("@wordpress/components");
|
|
11
11
|
var _i18n = require("@wordpress/i18n");
|
|
@@ -34,15 +34,15 @@ const ShortcutList = ({
|
|
|
34
34
|
* Safari+VoiceOver won't announce the list otherwise.
|
|
35
35
|
*/
|
|
36
36
|
/* eslint-disable jsx-a11y/no-redundant-roles */
|
|
37
|
-
(0,
|
|
37
|
+
(0, _react.createElement)("ul", {
|
|
38
38
|
className: "edit-widgets-keyboard-shortcut-help-modal__shortcut-list",
|
|
39
39
|
role: "list"
|
|
40
|
-
}, shortcuts.map((shortcut, index) => (0,
|
|
40
|
+
}, shortcuts.map((shortcut, index) => (0, _react.createElement)("li", {
|
|
41
41
|
className: "edit-widgets-keyboard-shortcut-help-modal__shortcut",
|
|
42
42
|
key: index
|
|
43
|
-
}, typeof shortcut === 'string' ? (0,
|
|
43
|
+
}, typeof shortcut === 'string' ? (0, _react.createElement)(_dynamicShortcut.default, {
|
|
44
44
|
name: shortcut
|
|
45
|
-
}) : (0,
|
|
45
|
+
}) : (0, _react.createElement)(_shortcut.default, {
|
|
46
46
|
...shortcut
|
|
47
47
|
}))))
|
|
48
48
|
/* eslint-enable jsx-a11y/no-redundant-roles */;
|
|
@@ -51,11 +51,11 @@ const ShortcutSection = ({
|
|
|
51
51
|
title,
|
|
52
52
|
shortcuts,
|
|
53
53
|
className
|
|
54
|
-
}) => (0,
|
|
54
|
+
}) => (0, _react.createElement)("section", {
|
|
55
55
|
className: (0, _classnames.default)('edit-widgets-keyboard-shortcut-help-modal__section', className)
|
|
56
|
-
}, !!title && (0,
|
|
56
|
+
}, !!title && (0, _react.createElement)("h2", {
|
|
57
57
|
className: "edit-widgets-keyboard-shortcut-help-modal__section-title"
|
|
58
|
-
}, title), (0,
|
|
58
|
+
}, title), (0, _react.createElement)(ShortcutList, {
|
|
59
59
|
shortcuts: shortcuts
|
|
60
60
|
}));
|
|
61
61
|
const ShortcutCategorySection = ({
|
|
@@ -66,7 +66,7 @@ const ShortcutCategorySection = ({
|
|
|
66
66
|
const categoryShortcuts = (0, _data.useSelect)(select => {
|
|
67
67
|
return select(_keyboardShortcuts.store).getCategoryShortcuts(categoryName);
|
|
68
68
|
}, [categoryName]);
|
|
69
|
-
return (0,
|
|
69
|
+
return (0, _react.createElement)(ShortcutSection, {
|
|
70
70
|
title: title,
|
|
71
71
|
shortcuts: categoryShortcuts.concat(additionalShortcuts)
|
|
72
72
|
});
|
|
@@ -81,20 +81,20 @@ function KeyboardShortcutHelpModal({
|
|
|
81
81
|
if (!isModalActive) {
|
|
82
82
|
return null;
|
|
83
83
|
}
|
|
84
|
-
return (0,
|
|
84
|
+
return (0, _react.createElement)(_components.Modal, {
|
|
85
85
|
className: "edit-widgets-keyboard-shortcut-help-modal",
|
|
86
86
|
title: (0, _i18n.__)('Keyboard shortcuts'),
|
|
87
87
|
onRequestClose: toggleModal
|
|
88
|
-
}, (0,
|
|
88
|
+
}, (0, _react.createElement)(ShortcutSection, {
|
|
89
89
|
className: "edit-widgets-keyboard-shortcut-help-modal__main-shortcuts",
|
|
90
90
|
shortcuts: ['core/edit-widgets/keyboard-shortcuts']
|
|
91
|
-
}), (0,
|
|
91
|
+
}), (0, _react.createElement)(ShortcutCategorySection, {
|
|
92
92
|
title: (0, _i18n.__)('Global shortcuts'),
|
|
93
93
|
categoryName: "global"
|
|
94
|
-
}), (0,
|
|
94
|
+
}), (0, _react.createElement)(ShortcutCategorySection, {
|
|
95
95
|
title: (0, _i18n.__)('Selection shortcuts'),
|
|
96
96
|
categoryName: "selection"
|
|
97
|
-
}), (0,
|
|
97
|
+
}), (0, _react.createElement)(ShortcutCategorySection, {
|
|
98
98
|
title: (0, _i18n.__)('Block shortcuts'),
|
|
99
99
|
categoryName: "block",
|
|
100
100
|
additionalShortcuts: [{
|
|
@@ -105,7 +105,7 @@ function KeyboardShortcutHelpModal({
|
|
|
105
105
|
/* translators: The forward-slash character. e.g. '/'. */
|
|
106
106
|
ariaLabel: (0, _i18n.__)('Forward-slash')
|
|
107
107
|
}]
|
|
108
|
-
}), (0,
|
|
108
|
+
}), (0, _react.createElement)(ShortcutSection, {
|
|
109
109
|
title: (0, _i18n.__)('Text formatting'),
|
|
110
110
|
shortcuts: _config.textFormattingShortcuts
|
|
111
111
|
}));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_classnames","_interopRequireDefault","require","_components","_i18n","_keyboardShortcuts","_data","_config","_shortcut","_dynamicShortcut","ShortcutList","shortcuts","
|
|
1
|
+
{"version":3,"names":["_classnames","_interopRequireDefault","require","_components","_i18n","_keyboardShortcuts","_data","_config","_shortcut","_dynamicShortcut","ShortcutList","shortcuts","_react","createElement","className","role","map","shortcut","index","key","default","name","ShortcutSection","title","classnames","ShortcutCategorySection","categoryName","additionalShortcuts","categoryShortcuts","useSelect","select","keyboardShortcutsStore","getCategoryShortcuts","concat","KeyboardShortcutHelpModal","isModalActive","toggleModal","useShortcut","bindGlobal","Modal","__","onRequestClose","keyCombination","character","description","ariaLabel","textFormattingShortcuts"],"sources":["@wordpress/edit-widgets/src/components/keyboard-shortcut-help-modal/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { Modal } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport {\n\tuseShortcut,\n\tstore as keyboardShortcutsStore,\n} from '@wordpress/keyboard-shortcuts';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { textFormattingShortcuts } from './config';\nimport Shortcut from './shortcut';\nimport DynamicShortcut from './dynamic-shortcut';\n\nconst ShortcutList = ( { shortcuts } ) => (\n\t/*\n\t * Disable reason: The `list` ARIA role is redundant but\n\t * Safari+VoiceOver won't announce the list otherwise.\n\t */\n\t/* eslint-disable jsx-a11y/no-redundant-roles */\n\t<ul\n\t\tclassName=\"edit-widgets-keyboard-shortcut-help-modal__shortcut-list\"\n\t\trole=\"list\"\n\t>\n\t\t{ shortcuts.map( ( shortcut, index ) => (\n\t\t\t<li\n\t\t\t\tclassName=\"edit-widgets-keyboard-shortcut-help-modal__shortcut\"\n\t\t\t\tkey={ index }\n\t\t\t>\n\t\t\t\t{ typeof shortcut === 'string' ? (\n\t\t\t\t\t<DynamicShortcut name={ shortcut } />\n\t\t\t\t) : (\n\t\t\t\t\t<Shortcut { ...shortcut } />\n\t\t\t\t) }\n\t\t\t</li>\n\t\t) ) }\n\t</ul>\n\t/* eslint-enable jsx-a11y/no-redundant-roles */\n);\n\nconst ShortcutSection = ( { title, shortcuts, className } ) => (\n\t<section\n\t\tclassName={ classnames(\n\t\t\t'edit-widgets-keyboard-shortcut-help-modal__section',\n\t\t\tclassName\n\t\t) }\n\t>\n\t\t{ !! title && (\n\t\t\t<h2 className=\"edit-widgets-keyboard-shortcut-help-modal__section-title\">\n\t\t\t\t{ title }\n\t\t\t</h2>\n\t\t) }\n\t\t<ShortcutList shortcuts={ shortcuts } />\n\t</section>\n);\n\nconst ShortcutCategorySection = ( {\n\ttitle,\n\tcategoryName,\n\tadditionalShortcuts = [],\n} ) => {\n\tconst categoryShortcuts = useSelect(\n\t\t( select ) => {\n\t\t\treturn select( keyboardShortcutsStore ).getCategoryShortcuts(\n\t\t\t\tcategoryName\n\t\t\t);\n\t\t},\n\t\t[ categoryName ]\n\t);\n\n\treturn (\n\t\t<ShortcutSection\n\t\t\ttitle={ title }\n\t\t\tshortcuts={ categoryShortcuts.concat( additionalShortcuts ) }\n\t\t/>\n\t);\n};\n\nexport default function KeyboardShortcutHelpModal( {\n\tisModalActive,\n\ttoggleModal,\n} ) {\n\tuseShortcut( 'core/edit-widgets/keyboard-shortcuts', toggleModal, {\n\t\tbindGlobal: true,\n\t} );\n\n\tif ( ! isModalActive ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<Modal\n\t\t\tclassName=\"edit-widgets-keyboard-shortcut-help-modal\"\n\t\t\ttitle={ __( 'Keyboard shortcuts' ) }\n\t\t\tonRequestClose={ toggleModal }\n\t\t>\n\t\t\t<ShortcutSection\n\t\t\t\tclassName=\"edit-widgets-keyboard-shortcut-help-modal__main-shortcuts\"\n\t\t\t\tshortcuts={ [ 'core/edit-widgets/keyboard-shortcuts' ] }\n\t\t\t/>\n\t\t\t<ShortcutCategorySection\n\t\t\t\ttitle={ __( 'Global shortcuts' ) }\n\t\t\t\tcategoryName=\"global\"\n\t\t\t/>\n\n\t\t\t<ShortcutCategorySection\n\t\t\t\ttitle={ __( 'Selection shortcuts' ) }\n\t\t\t\tcategoryName=\"selection\"\n\t\t\t/>\n\n\t\t\t<ShortcutCategorySection\n\t\t\t\ttitle={ __( 'Block shortcuts' ) }\n\t\t\t\tcategoryName=\"block\"\n\t\t\t\tadditionalShortcuts={ [\n\t\t\t\t\t{\n\t\t\t\t\t\tkeyCombination: { character: '/' },\n\t\t\t\t\t\tdescription: __(\n\t\t\t\t\t\t\t'Change the block type after adding a new paragraph.'\n\t\t\t\t\t\t),\n\t\t\t\t\t\t/* translators: The forward-slash character. e.g. '/'. */\n\t\t\t\t\t\tariaLabel: __( 'Forward-slash' ),\n\t\t\t\t\t},\n\t\t\t\t] }\n\t\t\t/>\n\t\t\t<ShortcutSection\n\t\t\t\ttitle={ __( 'Text formatting' ) }\n\t\t\t\tshortcuts={ textFormattingShortcuts }\n\t\t\t/>\n\t\t</Modal>\n\t);\n}\n"],"mappings":";;;;;;;;AAGA,IAAAA,WAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,WAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,kBAAA,GAAAH,OAAA;AAIA,IAAAI,KAAA,GAAAJ,OAAA;AAKA,IAAAK,OAAA,GAAAL,OAAA;AACA,IAAAM,SAAA,GAAAP,sBAAA,CAAAC,OAAA;AACA,IAAAO,gBAAA,GAAAR,sBAAA,CAAAC,OAAA;AArBA;AACA;AACA;;AAGA;AACA;AACA;;AASA;AACA;AACA;;AAKA,MAAMQ,YAAY,GAAGA,CAAE;EAAEC;AAAU,CAAC;AACnC;AACD;AACA;AACA;AACC;AACA,IAAAC,MAAA,CAAAC,aAAA;EACCC,SAAS,EAAC,0DAA0D;EACpEC,IAAI,EAAC;AAAM,GAETJ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,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
+
var _react = require("react");
|
|
7
8
|
var _element = require("@wordpress/element");
|
|
8
9
|
var _keycodes = require("@wordpress/keycodes");
|
|
9
10
|
/**
|
|
@@ -17,16 +18,16 @@ function KeyCombination({
|
|
|
17
18
|
const shortcut = keyCombination.modifier ? _keycodes.displayShortcutList[keyCombination.modifier](keyCombination.character) : keyCombination.character;
|
|
18
19
|
const ariaLabel = keyCombination.modifier ? _keycodes.shortcutAriaLabel[keyCombination.modifier](keyCombination.character) : keyCombination.character;
|
|
19
20
|
const shortcuts = Array.isArray(shortcut) ? shortcut : [shortcut];
|
|
20
|
-
return (0,
|
|
21
|
+
return (0, _react.createElement)("kbd", {
|
|
21
22
|
className: "edit-widgets-keyboard-shortcut-help-modal__shortcut-key-combination",
|
|
22
23
|
"aria-label": forceAriaLabel || ariaLabel
|
|
23
24
|
}, shortcuts.map((character, index) => {
|
|
24
25
|
if (character === '+') {
|
|
25
|
-
return (0,
|
|
26
|
+
return (0, _react.createElement)(_element.Fragment, {
|
|
26
27
|
key: index
|
|
27
28
|
}, character);
|
|
28
29
|
}
|
|
29
|
-
return (0,
|
|
30
|
+
return (0, _react.createElement)("kbd", {
|
|
30
31
|
key: index,
|
|
31
32
|
className: "edit-widgets-keyboard-shortcut-help-modal__shortcut-key"
|
|
32
33
|
}, character);
|
|
@@ -38,14 +39,14 @@ function Shortcut({
|
|
|
38
39
|
aliases = [],
|
|
39
40
|
ariaLabel
|
|
40
41
|
}) {
|
|
41
|
-
return (0,
|
|
42
|
+
return (0, _react.createElement)(_element.Fragment, null, (0, _react.createElement)("div", {
|
|
42
43
|
className: "edit-widgets-keyboard-shortcut-help-modal__shortcut-description"
|
|
43
|
-
}, description), (0,
|
|
44
|
+
}, description), (0, _react.createElement)("div", {
|
|
44
45
|
className: "edit-widgets-keyboard-shortcut-help-modal__shortcut-term"
|
|
45
|
-
}, (0,
|
|
46
|
+
}, (0, _react.createElement)(KeyCombination, {
|
|
46
47
|
keyCombination: keyCombination,
|
|
47
48
|
forceAriaLabel: ariaLabel
|
|
48
|
-
}), aliases.map((alias, index) => (0,
|
|
49
|
+
}), aliases.map((alias, index) => (0, _react.createElement)(KeyCombination, {
|
|
49
50
|
keyCombination: alias,
|
|
50
51
|
forceAriaLabel: ariaLabel,
|
|
51
52
|
key: index
|