@wordpress/edit-widgets 5.34.0 → 6.0.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 +15 -2
- 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 +8 -7
- 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 +40 -60
- 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 +54 -49
- 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/store/private-selectors.js +4 -0
- package/build/store/private-selectors.js.map +1 -1
- package/build/store/reducer.js +16 -0
- package/build/store/reducer.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 +8 -7
- 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 +44 -62
- 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 +55 -49
- 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-module/store/private-selectors.js +3 -0
- package/build-module/store/private-selectors.js.map +1 -1
- package/build-module/store/reducer.js +15 -0
- package/build-module/store/reducer.js.map +1 -1
- package/build-style/style-rtl.css +15 -14
- package/build-style/style.css +15 -14
- package/package.json +31 -30
- package/src/blocks/widget-area/edit/inner-blocks.js +2 -2
- package/src/components/header/document-tools/index.js +30 -50
- package/src/components/keyboard-shortcut-help-modal/index.js +2 -2
- package/src/components/layout/style.scss +1 -1
- package/src/index.js +1 -1
- package/src/store/private-selectors.js +4 -0
- package/src/store/reducer.js +13 -0
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { createElement } from "react";
|
|
2
1
|
/**
|
|
3
2
|
* WordPress dependencies
|
|
4
3
|
*/
|
|
@@ -8,28 +7,31 @@ import { Button } from '@wordpress/components';
|
|
|
8
7
|
import { Warning } from '@wordpress/block-editor';
|
|
9
8
|
import { useCopyToClipboard } from '@wordpress/compose';
|
|
10
9
|
import { doAction } from '@wordpress/hooks';
|
|
10
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
11
11
|
function CopyButton({
|
|
12
12
|
text,
|
|
13
13
|
children
|
|
14
14
|
}) {
|
|
15
15
|
const ref = useCopyToClipboard(text);
|
|
16
|
-
return
|
|
16
|
+
return /*#__PURE__*/_jsx(Button, {
|
|
17
17
|
variant: "secondary",
|
|
18
|
-
ref: ref
|
|
19
|
-
|
|
18
|
+
ref: ref,
|
|
19
|
+
children: children
|
|
20
|
+
});
|
|
20
21
|
}
|
|
21
22
|
function ErrorBoundaryWarning({
|
|
22
23
|
message,
|
|
23
24
|
error
|
|
24
25
|
}) {
|
|
25
|
-
const actions = [
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
},
|
|
29
|
-
return
|
|
26
|
+
const actions = [/*#__PURE__*/_jsx(CopyButton, {
|
|
27
|
+
text: error.stack,
|
|
28
|
+
children: __('Copy Error')
|
|
29
|
+
}, "copy-error")];
|
|
30
|
+
return /*#__PURE__*/_jsx(Warning, {
|
|
30
31
|
className: "edit-widgets-error-boundary",
|
|
31
|
-
actions: actions
|
|
32
|
-
|
|
32
|
+
actions: actions,
|
|
33
|
+
children: message
|
|
34
|
+
});
|
|
33
35
|
}
|
|
34
36
|
export default class ErrorBoundary extends Component {
|
|
35
37
|
constructor() {
|
|
@@ -50,7 +52,7 @@ export default class ErrorBoundary extends Component {
|
|
|
50
52
|
if (!this.state.error) {
|
|
51
53
|
return this.props.children;
|
|
52
54
|
}
|
|
53
|
-
return
|
|
55
|
+
return /*#__PURE__*/_jsx(ErrorBoundaryWarning, {
|
|
54
56
|
message: __('The editor has encountered an unexpected error.'),
|
|
55
57
|
error: this.state.error
|
|
56
58
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["Component","__","Button","Warning","useCopyToClipboard","doAction","CopyButton","text","children","ref","
|
|
1
|
+
{"version":3,"names":["Component","__","Button","Warning","useCopyToClipboard","doAction","jsx","_jsx","CopyButton","text","children","ref","variant","ErrorBoundaryWarning","message","error","actions","stack","className","ErrorBoundary","constructor","arguments","state","componentDidCatch","getDerivedStateFromError","render","props"],"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":"AAAA;AACA;AACA;AACA,SAASA,SAAS,QAAQ,oBAAoB;AAC9C,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SAASC,MAAM,QAAQ,uBAAuB;AAC9C,SAASC,OAAO,QAAQ,yBAAyB;AACjD,SAASC,kBAAkB,QAAQ,oBAAoB;AACvD,SAASC,QAAQ,QAAQ,kBAAkB;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAE5C,SAASC,UAAUA,CAAE;EAAEC,IAAI;EAAEC;AAAS,CAAC,EAAG;EACzC,MAAMC,GAAG,GAAGP,kBAAkB,CAAEK,IAAK,CAAC;EACtC,oBACCF,IAAA,CAACL,MAAM;IAACU,OAAO,EAAC,WAAW;IAACD,GAAG,EAAGA,GAAK;IAAAD,QAAA,EACpCA;EAAQ,CACH,CAAC;AAEX;AAEA,SAASG,oBAAoBA,CAAE;EAAEC,OAAO;EAAEC;AAAM,CAAC,EAAG;EACnD,MAAMC,OAAO,GAAG,cACfT,IAAA,CAACC,UAAU;IAAkBC,IAAI,EAAGM,KAAK,CAACE,KAAO;IAAAP,QAAA,EAC9CT,EAAE,CAAE,YAAa;EAAC,GADL,YAEJ,CAAC,CACb;EAED,oBACCM,IAAA,CAACJ,OAAO;IAACe,SAAS,EAAC,6BAA6B;IAACF,OAAO,EAAGA,OAAS;IAAAN,QAAA,EACjEI;EAAO,CACD,CAAC;AAEZ;AAEA,eAAe,MAAMK,aAAa,SAASnB,SAAS,CAAC;EACpDoB,WAAWA,CAAA,EAAG;IACb,KAAK,CAAE,GAAGC,SAAU,CAAC;IAErB,IAAI,CAACC,KAAK,GAAG;MACZP,KAAK,EAAE;IACR,CAAC;EACF;EAEAQ,iBAAiBA,CAAER,KAAK,EAAG;IAC1BV,QAAQ,CAAE,kCAAkC,EAAEU,KAAM,CAAC;EACtD;EAEA,OAAOS,wBAAwBA,CAAET,KAAK,EAAG;IACxC,OAAO;MAAEA;IAAM,CAAC;EACjB;EAEAU,MAAMA,CAAA,EAAG;IACR,IAAK,CAAE,IAAI,CAACH,KAAK,CAACP,KAAK,EAAG;MACzB,OAAO,IAAI,CAACW,KAAK,CAAChB,QAAQ;IAC3B;IAEA,oBACCH,IAAA,CAACM,oBAAoB;MACpBC,OAAO,EAAGb,EAAE,CACX,iDACD,CAAG;MACHc,KAAK,EAAG,IAAI,CAACO,KAAK,CAACP;IAAO,CAC1B,CAAC;EAEJ;AACD","ignoreList":[]}
|
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
import { createElement, Fragment } from "react";
|
|
2
1
|
/**
|
|
3
2
|
* WordPress dependencies
|
|
4
3
|
*/
|
|
5
4
|
import { useSelect, useDispatch } from '@wordpress/data';
|
|
6
5
|
import { __, _x } from '@wordpress/i18n';
|
|
7
6
|
import { Button, ToolbarItem } from '@wordpress/components';
|
|
8
|
-
import { NavigableToolbar
|
|
7
|
+
import { NavigableToolbar } from '@wordpress/block-editor';
|
|
9
8
|
import { listView, plus } from '@wordpress/icons';
|
|
10
|
-
import { useCallback
|
|
9
|
+
import { useCallback } from '@wordpress/element';
|
|
11
10
|
import { useViewportMatch } from '@wordpress/compose';
|
|
12
11
|
|
|
13
12
|
/**
|
|
@@ -15,92 +14,75 @@ import { useViewportMatch } from '@wordpress/compose';
|
|
|
15
14
|
*/
|
|
16
15
|
import UndoButton from '../undo-redo/undo';
|
|
17
16
|
import RedoButton from '../undo-redo/redo';
|
|
18
|
-
import useLastSelectedWidgetArea from '../../../hooks/use-last-selected-widget-area';
|
|
19
17
|
import { store as editWidgetsStore } from '../../../store';
|
|
20
18
|
import { unlock } from '../../../lock-unlock';
|
|
19
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
20
|
+
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
21
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
21
22
|
function DocumentTools() {
|
|
22
23
|
const isMediumViewport = useViewportMatch('medium');
|
|
23
|
-
const inserterButton = useRef();
|
|
24
|
-
const widgetAreaClientId = useLastSelectedWidgetArea();
|
|
25
|
-
const isLastSelectedWidgetAreaOpen = useSelect(select => select(editWidgetsStore).getIsWidgetAreaOpen(widgetAreaClientId), [widgetAreaClientId]);
|
|
26
24
|
const {
|
|
27
25
|
isInserterOpen,
|
|
28
26
|
isListViewOpen,
|
|
27
|
+
inserterSidebarToggleRef,
|
|
29
28
|
listViewToggleRef
|
|
30
29
|
} = useSelect(select => {
|
|
31
30
|
const {
|
|
32
31
|
isInserterOpened,
|
|
32
|
+
getInserterSidebarToggleRef,
|
|
33
33
|
isListViewOpened,
|
|
34
34
|
getListViewToggleRef
|
|
35
35
|
} = unlock(select(editWidgetsStore));
|
|
36
36
|
return {
|
|
37
37
|
isInserterOpen: isInserterOpened(),
|
|
38
38
|
isListViewOpen: isListViewOpened(),
|
|
39
|
+
inserterSidebarToggleRef: getInserterSidebarToggleRef(),
|
|
39
40
|
listViewToggleRef: getListViewToggleRef()
|
|
40
41
|
};
|
|
41
42
|
}, []);
|
|
42
43
|
const {
|
|
43
|
-
setIsWidgetAreaOpen,
|
|
44
44
|
setIsInserterOpened,
|
|
45
45
|
setIsListViewOpened
|
|
46
46
|
} = useDispatch(editWidgetsStore);
|
|
47
|
-
const {
|
|
48
|
-
selectBlock
|
|
49
|
-
} = useDispatch(blockEditorStore);
|
|
50
|
-
const handleClick = () => {
|
|
51
|
-
if (isInserterOpen) {
|
|
52
|
-
// Focusing the inserter button closes the inserter popover.
|
|
53
|
-
setIsInserterOpened(false);
|
|
54
|
-
} else {
|
|
55
|
-
if (!isLastSelectedWidgetAreaOpen) {
|
|
56
|
-
// Select the last selected block if hasn't already.
|
|
57
|
-
selectBlock(widgetAreaClientId);
|
|
58
|
-
// Open the last selected widget area when opening the inserter.
|
|
59
|
-
setIsWidgetAreaOpen(widgetAreaClientId, true);
|
|
60
|
-
}
|
|
61
|
-
// The DOM updates resulting from selectBlock() and setIsInserterOpened() calls are applied the
|
|
62
|
-
// same tick and pretty much in a random order. The inserter is closed if any other part of the
|
|
63
|
-
// app receives focus. If selectBlock() happens to take effect after setIsInserterOpened() then
|
|
64
|
-
// the inserter is visible for a brief moment and then gets auto-closed due to focus moving to
|
|
65
|
-
// the selected block.
|
|
66
|
-
window.requestAnimationFrame(() => setIsInserterOpened(true));
|
|
67
|
-
}
|
|
68
|
-
};
|
|
69
47
|
const toggleListView = useCallback(() => setIsListViewOpened(!isListViewOpen), [setIsListViewOpened, isListViewOpen]);
|
|
70
|
-
|
|
48
|
+
const toggleInserterSidebar = useCallback(() => setIsInserterOpened(!isInserterOpen), [setIsInserterOpened, isInserterOpen]);
|
|
49
|
+
return /*#__PURE__*/_jsxs(NavigableToolbar, {
|
|
71
50
|
className: "edit-widgets-header-toolbar",
|
|
72
51
|
"aria-label": __('Document tools'),
|
|
73
|
-
variant: "unstyled"
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
52
|
+
variant: "unstyled",
|
|
53
|
+
children: [/*#__PURE__*/_jsx(ToolbarItem, {
|
|
54
|
+
ref: inserterSidebarToggleRef,
|
|
55
|
+
as: Button,
|
|
56
|
+
className: "edit-widgets-header-toolbar__inserter-toggle",
|
|
57
|
+
variant: "primary",
|
|
58
|
+
isPressed: isInserterOpen,
|
|
59
|
+
onMouseDown: event => {
|
|
60
|
+
event.preventDefault();
|
|
61
|
+
},
|
|
62
|
+
onClick: toggleInserterSidebar,
|
|
63
|
+
icon: plus
|
|
64
|
+
/* translators: button label text should, if possible, be under 16
|
|
65
|
+
characters. */,
|
|
66
|
+
label: _x('Toggle block inserter', 'Generic label for block inserter button'),
|
|
67
|
+
size: "compact"
|
|
68
|
+
}), isMediumViewport && /*#__PURE__*/_jsxs(_Fragment, {
|
|
69
|
+
children: [/*#__PURE__*/_jsx(ToolbarItem, {
|
|
70
|
+
as: UndoButton
|
|
71
|
+
}), /*#__PURE__*/_jsx(ToolbarItem, {
|
|
72
|
+
as: RedoButton
|
|
73
|
+
}), /*#__PURE__*/_jsx(ToolbarItem, {
|
|
74
|
+
as: Button,
|
|
75
|
+
className: "edit-widgets-header-toolbar__list-view-toggle",
|
|
76
|
+
icon: listView,
|
|
77
|
+
isPressed: isListViewOpen
|
|
78
|
+
/* translators: button label text should, if possible, be under 16 characters. */,
|
|
79
|
+
label: __('List View'),
|
|
80
|
+
onClick: toggleListView,
|
|
81
|
+
ref: listViewToggleRef,
|
|
82
|
+
size: "compact"
|
|
83
|
+
})]
|
|
84
|
+
})]
|
|
85
|
+
});
|
|
104
86
|
}
|
|
105
87
|
export default DocumentTools;
|
|
106
88
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useSelect","useDispatch","__","_x","Button","ToolbarItem","NavigableToolbar","
|
|
1
|
+
{"version":3,"names":["useSelect","useDispatch","__","_x","Button","ToolbarItem","NavigableToolbar","listView","plus","useCallback","useViewportMatch","UndoButton","RedoButton","store","editWidgetsStore","unlock","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","DocumentTools","isMediumViewport","isInserterOpen","isListViewOpen","inserterSidebarToggleRef","listViewToggleRef","select","isInserterOpened","getInserterSidebarToggleRef","isListViewOpened","getListViewToggleRef","setIsInserterOpened","setIsListViewOpened","toggleListView","toggleInserterSidebar","className","variant","children","ref","as","isPressed","onMouseDown","event","preventDefault","onClick","icon","label","size"],"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=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AK,EAAG9C,EAAE,CAAE,WAAY,CAAG;QAC3B4C,OAAO,EAAGX,cAAgB;QAC1BK,GAAG,EAAGb,iBAAmB;QACzBsB,IAAI,EAAC;MAAS,CACd,CAAC;IAAA,CACD,CACF;EAAA,CACgB,CAAC;AAErB;AAEA,eAAe3B,aAAa","ignoreList":[]}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { createElement, Fragment } from "react";
|
|
2
1
|
/**
|
|
3
2
|
* WordPress dependencies
|
|
4
3
|
*/
|
|
@@ -17,6 +16,9 @@ import { store as preferencesStore } from '@wordpress/preferences';
|
|
|
17
16
|
import DocumentTools from './document-tools';
|
|
18
17
|
import SaveButton from '../save-button';
|
|
19
18
|
import MoreMenu from '../more-menu';
|
|
19
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
20
|
+
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
21
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
20
22
|
function Header() {
|
|
21
23
|
const isLargeViewport = useViewportMatch('medium');
|
|
22
24
|
const blockToolbarRef = useRef();
|
|
@@ -25,27 +27,37 @@ function Header() {
|
|
|
25
27
|
} = useSelect(select => ({
|
|
26
28
|
hasFixedToolbar: !!select(preferencesStore).get('core/edit-widgets', 'fixedToolbar')
|
|
27
29
|
}), []);
|
|
28
|
-
return
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
30
|
+
return /*#__PURE__*/_jsx(_Fragment, {
|
|
31
|
+
children: /*#__PURE__*/_jsxs("div", {
|
|
32
|
+
className: "edit-widgets-header",
|
|
33
|
+
children: [/*#__PURE__*/_jsxs("div", {
|
|
34
|
+
className: "edit-widgets-header__navigable-toolbar-wrapper",
|
|
35
|
+
children: [isLargeViewport && /*#__PURE__*/_jsx("h1", {
|
|
36
|
+
className: "edit-widgets-header__title",
|
|
37
|
+
children: __('Widgets')
|
|
38
|
+
}), !isLargeViewport && /*#__PURE__*/_jsx(VisuallyHidden, {
|
|
39
|
+
as: "h1",
|
|
40
|
+
className: "edit-widgets-header__title",
|
|
41
|
+
children: __('Widgets')
|
|
42
|
+
}), /*#__PURE__*/_jsx(DocumentTools, {}), hasFixedToolbar && isLargeViewport && /*#__PURE__*/_jsxs(_Fragment, {
|
|
43
|
+
children: [/*#__PURE__*/_jsx("div", {
|
|
44
|
+
className: "selected-block-tools-wrapper",
|
|
45
|
+
children: /*#__PURE__*/_jsx(BlockToolbar, {
|
|
46
|
+
hideDragHandle: true
|
|
47
|
+
})
|
|
48
|
+
}), /*#__PURE__*/_jsx(Popover.Slot, {
|
|
49
|
+
ref: blockToolbarRef,
|
|
50
|
+
name: "block-toolbar"
|
|
51
|
+
})]
|
|
52
|
+
})]
|
|
53
|
+
}), /*#__PURE__*/_jsxs("div", {
|
|
54
|
+
className: "edit-widgets-header__actions",
|
|
55
|
+
children: [/*#__PURE__*/_jsx(SaveButton, {}), /*#__PURE__*/_jsx(PinnedItems.Slot, {
|
|
56
|
+
scope: "core/edit-widgets"
|
|
57
|
+
}), /*#__PURE__*/_jsx(MoreMenu, {})]
|
|
58
|
+
})]
|
|
59
|
+
})
|
|
60
|
+
});
|
|
49
61
|
}
|
|
50
62
|
export default Header;
|
|
51
63
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["BlockToolbar","useSelect","useRef","__","Popover","VisuallyHidden","PinnedItems","useViewportMatch","store","preferencesStore","DocumentTools","SaveButton","MoreMenu","Header","isLargeViewport","blockToolbarRef","hasFixedToolbar","select","get","
|
|
1
|
+
{"version":3,"names":["BlockToolbar","useSelect","useRef","__","Popover","VisuallyHidden","PinnedItems","useViewportMatch","store","preferencesStore","DocumentTools","SaveButton","MoreMenu","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","Header","isLargeViewport","blockToolbarRef","hasFixedToolbar","select","get","children","className","as","hideDragHandle","Slot","ref","name","scope"],"sources":["@wordpress/edit-widgets/src/components/header/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { BlockToolbar } from '@wordpress/block-editor';\nimport { useSelect } from '@wordpress/data';\nimport { useRef } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport { Popover, VisuallyHidden } from '@wordpress/components';\nimport { PinnedItems } from '@wordpress/interface';\nimport { useViewportMatch } from '@wordpress/compose';\nimport { store as preferencesStore } from '@wordpress/preferences';\n\n/**\n * Internal dependencies\n */\nimport DocumentTools from './document-tools';\nimport SaveButton from '../save-button';\nimport MoreMenu from '../more-menu';\n\nfunction Header() {\n\tconst isLargeViewport = useViewportMatch( 'medium' );\n\tconst blockToolbarRef = useRef();\n\tconst { hasFixedToolbar } = useSelect(\n\t\t( select ) => ( {\n\t\t\thasFixedToolbar: !! select( preferencesStore ).get(\n\t\t\t\t'core/edit-widgets',\n\t\t\t\t'fixedToolbar'\n\t\t\t),\n\t\t} ),\n\t\t[]\n\t);\n\n\treturn (\n\t\t<>\n\t\t\t<div className=\"edit-widgets-header\">\n\t\t\t\t<div className=\"edit-widgets-header__navigable-toolbar-wrapper\">\n\t\t\t\t\t{ isLargeViewport && (\n\t\t\t\t\t\t<h1 className=\"edit-widgets-header__title\">\n\t\t\t\t\t\t\t{ __( 'Widgets' ) }\n\t\t\t\t\t\t</h1>\n\t\t\t\t\t) }\n\t\t\t\t\t{ ! isLargeViewport && (\n\t\t\t\t\t\t<VisuallyHidden\n\t\t\t\t\t\t\tas=\"h1\"\n\t\t\t\t\t\t\tclassName=\"edit-widgets-header__title\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Widgets' ) }\n\t\t\t\t\t\t</VisuallyHidden>\n\t\t\t\t\t) }\n\t\t\t\t\t<DocumentTools />\n\t\t\t\t\t{ hasFixedToolbar && isLargeViewport && (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<div className=\"selected-block-tools-wrapper\">\n\t\t\t\t\t\t\t\t<BlockToolbar hideDragHandle />\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t<Popover.Slot\n\t\t\t\t\t\t\t\tref={ blockToolbarRef }\n\t\t\t\t\t\t\t\tname=\"block-toolbar\"\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</>\n\t\t\t\t\t) }\n\t\t\t\t</div>\n\t\t\t\t<div className=\"edit-widgets-header__actions\">\n\t\t\t\t\t<SaveButton />\n\t\t\t\t\t<PinnedItems.Slot scope=\"core/edit-widgets\" />\n\t\t\t\t\t<MoreMenu />\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t</>\n\t);\n}\n\nexport default Header;\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,YAAY,QAAQ,yBAAyB;AACtD,SAASC,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,MAAM,QAAQ,oBAAoB;AAC3C,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SAASC,OAAO,EAAEC,cAAc,QAAQ,uBAAuB;AAC/D,SAASC,WAAW,QAAQ,sBAAsB;AAClD,SAASC,gBAAgB,QAAQ,oBAAoB;AACrD,SAASC,KAAK,IAAIC,gBAAgB,QAAQ,wBAAwB;;AAElE;AACA;AACA;AACA,OAAOC,aAAa,MAAM,kBAAkB;AAC5C,OAAOC,UAAU,MAAM,gBAAgB;AACvC,OAAOC,QAAQ,MAAM,cAAc;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAAA,SAAAC,QAAA,IAAAC,SAAA;AAAA,SAAAC,IAAA,IAAAC,KAAA;AAEpC,SAASC,MAAMA,CAAA,EAAG;EACjB,MAAMC,eAAe,GAAGb,gBAAgB,CAAE,QAAS,CAAC;EACpD,MAAMc,eAAe,GAAGnB,MAAM,CAAC,CAAC;EACh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AC;AAEL;AAEA,eAAeO,MAAM","ignoreList":[]}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { createElement } from "react";
|
|
2
1
|
/**
|
|
3
2
|
* WordPress dependencies
|
|
4
3
|
*/
|
|
@@ -9,13 +8,14 @@ import { redo as redoIcon, undo as undoIcon } from '@wordpress/icons';
|
|
|
9
8
|
import { displayShortcut, isAppleOS } from '@wordpress/keycodes';
|
|
10
9
|
import { store as coreStore } from '@wordpress/core-data';
|
|
11
10
|
import { forwardRef } from '@wordpress/element';
|
|
11
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
12
12
|
function RedoButton(props, ref) {
|
|
13
13
|
const shortcut = isAppleOS() ? displayShortcut.primaryShift('z') : displayShortcut.primary('y');
|
|
14
14
|
const hasRedo = useSelect(select => select(coreStore).hasRedo(), []);
|
|
15
15
|
const {
|
|
16
16
|
redo
|
|
17
17
|
} = useDispatch(coreStore);
|
|
18
|
-
return
|
|
18
|
+
return /*#__PURE__*/_jsx(Button, {
|
|
19
19
|
...props,
|
|
20
20
|
ref: ref,
|
|
21
21
|
icon: !isRTL() ? redoIcon : undoIcon,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["__","isRTL","Button","useSelect","useDispatch","redo","redoIcon","undo","undoIcon","displayShortcut","isAppleOS","store","coreStore","forwardRef","RedoButton","props","ref","shortcut","primaryShift","primary","hasRedo","select","
|
|
1
|
+
{"version":3,"names":["__","isRTL","Button","useSelect","useDispatch","redo","redoIcon","undo","undoIcon","displayShortcut","isAppleOS","store","coreStore","forwardRef","jsx","_jsx","RedoButton","props","ref","shortcut","primaryShift","primary","hasRedo","select","icon","label","onClick","undefined","size"],"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":"AAAA;AACA;AACA;AACA,SAASA,EAAE,EAAEC,KAAK,QAAQ,iBAAiB;AAC3C,SAASC,MAAM,QAAQ,uBAAuB;AAC9C,SAASC,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACxD,SAASC,IAAI,IAAIC,QAAQ,EAAEC,IAAI,IAAIC,QAAQ,QAAQ,kBAAkB;AACrE,SAASC,eAAe,EAAEC,SAAS,QAAQ,qBAAqB;AAChE,SAASC,KAAK,IAAIC,SAAS,QAAQ,sBAAsB;AACzD,SAASC,UAAU,QAAQ,oBAAoB;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAEhD,SAASC,UAAUA,CAAEC,KAAK,EAAEC,GAAG,EAAG;EACjC,MAAMC,QAAQ,GAAGT,SAAS,CAAC,CAAC,GACzBD,eAAe,CAACW,YAAY,CAAE,GAAI,CAAC,GACnCX,eAAe,CAACY,OAAO,CAAE,GAAI,CAAC;EAEjC,MAAMC,OAAO,GAAGnB,SAAS,CACtBoB,MAAM,IAAMA,MAAM,CAAEX,SAAU,CAAC,CAACU,OAAO,CAAC,CAAC,EAC3C,EACD,CAAC;EACD,MAAM;IAAEjB;EAAK,CAAC,GAAGD,WAAW,CAAEQ,SAAU,CAAC;EACzC,oBACCG,IAAA,CAACb,MAAM;IAAA,GACDe,KAAK;IACVC,GAAG,EAAGA,GAAK;IACXM,IAAI,EAAG,CAAEvB,KAAK,CAAC,CAAC,GAAGK,QAAQ,GAAGE,QAAU;IACxCiB,KAAK,EAAGzB,EAAE,CAAE,MAAO,CAAG;IACtBmB,QAAQ,EAAGA;IACX;IACA;IACA;IAAA;IACA,iBAAgB,CAAEG,OAAS;IAC3BI,OAAO,EAAGJ,OAAO,GAAGjB,IAAI,GAAGsB,SAAW;IACtCC,IAAI,EAAC;EAAS,CACd,CAAC;AAEJ;AAEA,eAAef,UAAU,CAAEG,UAAW,CAAC","ignoreList":[]}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { createElement } from "react";
|
|
2
1
|
/**
|
|
3
2
|
* WordPress dependencies
|
|
4
3
|
*/
|
|
@@ -9,12 +8,13 @@ import { undo as undoIcon, redo as redoIcon } from '@wordpress/icons';
|
|
|
9
8
|
import { displayShortcut } from '@wordpress/keycodes';
|
|
10
9
|
import { store as coreStore } from '@wordpress/core-data';
|
|
11
10
|
import { forwardRef } from '@wordpress/element';
|
|
11
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
12
12
|
function UndoButton(props, ref) {
|
|
13
13
|
const hasUndo = useSelect(select => select(coreStore).hasUndo(), []);
|
|
14
14
|
const {
|
|
15
15
|
undo
|
|
16
16
|
} = useDispatch(coreStore);
|
|
17
|
-
return
|
|
17
|
+
return /*#__PURE__*/_jsx(Button, {
|
|
18
18
|
...props,
|
|
19
19
|
ref: ref,
|
|
20
20
|
icon: !isRTL() ? undoIcon : redoIcon,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["__","isRTL","Button","useSelect","useDispatch","undo","undoIcon","redo","redoIcon","displayShortcut","store","coreStore","forwardRef","UndoButton","props","ref","hasUndo","select","
|
|
1
|
+
{"version":3,"names":["__","isRTL","Button","useSelect","useDispatch","undo","undoIcon","redo","redoIcon","displayShortcut","store","coreStore","forwardRef","jsx","_jsx","UndoButton","props","ref","hasUndo","select","icon","label","shortcut","primary","onClick","undefined","size"],"sources":["@wordpress/edit-widgets/src/components/header/undo-redo/undo.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, isRTL } from '@wordpress/i18n';\nimport { Button } from '@wordpress/components';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { undo as undoIcon, redo as redoIcon } from '@wordpress/icons';\nimport { displayShortcut } from '@wordpress/keycodes';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { forwardRef } from '@wordpress/element';\n\nfunction UndoButton( props, ref ) {\n\tconst hasUndo = useSelect(\n\t\t( select ) => select( coreStore ).hasUndo(),\n\t\t[]\n\t);\n\tconst { undo } = useDispatch( coreStore );\n\treturn (\n\t\t<Button\n\t\t\t{ ...props }\n\t\t\tref={ ref }\n\t\t\ticon={ ! isRTL() ? undoIcon : redoIcon }\n\t\t\tlabel={ __( 'Undo' ) }\n\t\t\tshortcut={ displayShortcut.primary( 'z' ) }\n\t\t\t// If there are no undo levels we don't want to actually disable this\n\t\t\t// button, because it will remove focus for keyboard users.\n\t\t\t// See: https://github.com/WordPress/gutenberg/issues/3486\n\t\t\taria-disabled={ ! hasUndo }\n\t\t\tonClick={ hasUndo ? undo : undefined }\n\t\t\tsize=\"compact\"\n\t\t/>\n\t);\n}\n\nexport default forwardRef( UndoButton );\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,EAAE,EAAEC,KAAK,QAAQ,iBAAiB;AAC3C,SAASC,MAAM,QAAQ,uBAAuB;AAC9C,SAASC,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACxD,SAASC,IAAI,IAAIC,QAAQ,EAAEC,IAAI,IAAIC,QAAQ,QAAQ,kBAAkB;AACrE,SAASC,eAAe,QAAQ,qBAAqB;AACrD,SAASC,KAAK,IAAIC,SAAS,QAAQ,sBAAsB;AACzD,SAASC,UAAU,QAAQ,oBAAoB;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAEhD,SAASC,UAAUA,CAAEC,KAAK,EAAEC,GAAG,EAAG;EACjC,MAAMC,OAAO,GAAGf,SAAS,CACtBgB,MAAM,IAAMA,MAAM,CAAER,SAAU,CAAC,CAACO,OAAO,CAAC,CAAC,EAC3C,EACD,CAAC;EACD,MAAM;IAAEb;EAAK,CAAC,GAAGD,WAAW,CAAEO,SAAU,CAAC;EACzC,oBACCG,IAAA,CAACZ,MAAM;IAAA,GACDc,KAAK;IACVC,GAAG,EAAGA,GAAK;IACXG,IAAI,EAAG,CAAEnB,KAAK,CAAC,CAAC,GAAGK,QAAQ,GAAGE,QAAU;IACxCa,KAAK,EAAGrB,EAAE,CAAE,MAAO,CAAG;IACtBsB,QAAQ,EAAGb,eAAe,CAACc,OAAO,CAAE,GAAI;IACxC;IACA;IACA;IAAA;IACA,iBAAgB,CAAEL,OAAS;IAC3BM,OAAO,EAAGN,OAAO,GAAGb,IAAI,GAAGoB,SAAW;IACtCC,IAAI,EAAC;EAAS,CACd,CAAC;AAEJ;AAEA,eAAed,UAAU,CAAEG,UAAW,CAAC","ignoreList":[]}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { createElement } from "react";
|
|
2
1
|
/**
|
|
3
2
|
* WordPress dependencies
|
|
4
3
|
*/
|
|
@@ -9,6 +8,7 @@ import { store as keyboardShortcutsStore } from '@wordpress/keyboard-shortcuts';
|
|
|
9
8
|
* Internal dependencies
|
|
10
9
|
*/
|
|
11
10
|
import Shortcut from './shortcut';
|
|
11
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
12
12
|
function DynamicShortcut({
|
|
13
13
|
name
|
|
14
14
|
}) {
|
|
@@ -31,7 +31,7 @@ function DynamicShortcut({
|
|
|
31
31
|
if (!keyCombination) {
|
|
32
32
|
return null;
|
|
33
33
|
}
|
|
34
|
-
return
|
|
34
|
+
return /*#__PURE__*/_jsx(Shortcut, {
|
|
35
35
|
keyCombination: keyCombination,
|
|
36
36
|
description: description,
|
|
37
37
|
aliases: aliases
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useSelect","store","keyboardShortcutsStore","Shortcut","DynamicShortcut","name","keyCombination","description","aliases","select","getShortcutKeyCombination","getShortcutDescription","getShortcutAliases"
|
|
1
|
+
{"version":3,"names":["useSelect","store","keyboardShortcutsStore","Shortcut","jsx","_jsx","DynamicShortcut","name","keyCombination","description","aliases","select","getShortcutKeyCombination","getShortcutDescription","getShortcutAliases"],"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":"AAAA;AACA;AACA;AACA,SAASA,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,KAAK,IAAIC,sBAAsB,QAAQ,+BAA+B;;AAE/E;AACA;AACA;AACA,OAAOC,QAAQ,MAAM,YAAY;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAElC,SAASC,eAAeA,CAAE;EAAEC;AAAK,CAAC,EAAG;EACpC,MAAM;IAAEC,cAAc;IAAEC,WAAW;IAAEC;EAAQ,CAAC,GAAGV,SAAS,CACvDW,MAAM,IAAM;IACb,MAAM;MACLC,yBAAyB;MACzBC,sBAAsB;MACtBC;IACD,CAAC,GAAGH,MAAM,CAAET,sBAAuB,CAAC;IAEpC,OAAO;MACNM,cAAc,EAAEI,yBAAyB,CAAEL,IAAK,CAAC;MACjDG,OAAO,EAAEI,kBAAkB,CAAEP,IAAK,CAAC;MACnCE,WAAW,EAAEI,sBAAsB,CAAEN,IAAK;IAC3C,CAAC;EACF,CAAC,EACD,CAAEA,IAAI,CACP,CAAC;EAED,IAAK,CAAEC,cAAc,EAAG;IACvB,OAAO,IAAI;EACZ;EAEA,oBACCH,IAAA,CAACF,QAAQ;IACRK,cAAc,EAAGA,cAAgB;IACjCC,WAAW,EAAGA,WAAa;IAC3BC,OAAO,EAAGA;EAAS,CACnB,CAAC;AAEJ;AAEA,eAAeJ,eAAe","ignoreList":[]}
|