@wordpress/edit-widgets 5.11.0 → 5.12.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +2 -0
- package/build/blocks/widget-area/edit/index.js +24 -29
- package/build/blocks/widget-area/edit/index.js.map +1 -1
- package/build/blocks/widget-area/edit/inner-blocks.js +5 -5
- package/build/blocks/widget-area/edit/inner-blocks.js.map +1 -1
- package/build/blocks/widget-area/index.js +3 -6
- package/build/blocks/widget-area/index.js.map +1 -1
- package/build/components/error-boundary/index.js +8 -10
- package/build/components/error-boundary/index.js.map +1 -1
- package/build/components/header/index.js +2 -2
- package/build/components/header/index.js.map +1 -1
- package/build/components/keyboard-shortcut-help-modal/dynamic-shortcut.js +3 -4
- package/build/components/keyboard-shortcut-help-modal/dynamic-shortcut.js.map +1 -1
- package/build/components/keyboard-shortcut-help-modal/index.js +42 -50
- package/build/components/keyboard-shortcut-help-modal/index.js.map +1 -1
- package/build/components/keyboard-shortcut-help-modal/shortcut.js +10 -12
- package/build/components/keyboard-shortcut-help-modal/shortcut.js.map +1 -1
- package/build/components/keyboard-shortcuts/index.js +4 -4
- package/build/components/keyboard-shortcuts/index.js.map +1 -1
- package/build/components/layout/index.js +3 -4
- package/build/components/layout/index.js.map +1 -1
- package/build/components/layout/interface.js +3 -4
- 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/tools-more-menu-group.js +5 -8
- package/build/components/more-menu/tools-more-menu-group.js.map +1 -1
- package/build/components/notices/index.js +11 -20
- package/build/components/notices/index.js.map +1 -1
- package/build/components/save-button/index.js +1 -3
- package/build/components/save-button/index.js.map +1 -1
- package/build/components/secondary-sidebar/inserter-sidebar.js +4 -6
- package/build/components/secondary-sidebar/inserter-sidebar.js.map +1 -1
- package/build/components/secondary-sidebar/list-view-sidebar.js +8 -3
- package/build/components/secondary-sidebar/list-view-sidebar.js.map +1 -1
- package/build/components/sidebar/index.js +7 -8
- package/build/components/sidebar/index.js.map +1 -1
- package/build/components/sidebar/widget-areas.js +5 -6
- package/build/components/sidebar/widget-areas.js.map +1 -1
- package/build/components/welcome-guide/index.js +6 -7
- package/build/components/welcome-guide/index.js.map +1 -1
- package/build/components/widget-areas-block-editor-content/index.js +3 -4
- package/build/components/widget-areas-block-editor-content/index.js.map +1 -1
- package/build/components/widget-areas-block-editor-provider/index.js +18 -24
- package/build/components/widget-areas-block-editor-provider/index.js.map +1 -1
- package/build/filters/move-to-widget-area.js +4 -5
- package/build/filters/move-to-widget-area.js.map +1 -1
- package/build/hooks/use-last-selected-widget-area.js +2 -4
- package/build/hooks/use-last-selected-widget-area.js.map +1 -1
- package/build/hooks/use-widget-library-insertion-point.js +1 -3
- package/build/hooks/use-widget-library-insertion-point.js.map +1 -1
- package/build/{private-apis.js → lock-unlock.js} +1 -1
- package/build/lock-unlock.js.map +1 -0
- package/build/store/actions.js +49 -74
- package/build/store/actions.js.map +1 -1
- package/build/store/index.js +1 -3
- package/build/store/index.js.map +1 -1
- package/build/store/reducer.js +3 -11
- package/build/store/reducer.js.map +1 -1
- package/build/store/resolvers.js +8 -10
- package/build/store/resolvers.js.map +1 -1
- package/build/store/selectors.js +15 -32
- package/build/store/selectors.js.map +1 -1
- package/build/store/transformers.js +1 -2
- package/build/store/transformers.js.map +1 -1
- package/build-module/blocks/widget-area/edit/index.js +24 -29
- package/build-module/blocks/widget-area/edit/index.js.map +1 -1
- package/build-module/blocks/widget-area/edit/inner-blocks.js +5 -5
- package/build-module/blocks/widget-area/edit/inner-blocks.js.map +1 -1
- package/build-module/blocks/widget-area/index.js +3 -6
- package/build-module/blocks/widget-area/index.js.map +1 -1
- package/build-module/components/error-boundary/index.js +8 -10
- package/build-module/components/error-boundary/index.js.map +1 -1
- package/build-module/components/header/index.js +1 -1
- package/build-module/components/header/index.js.map +1 -1
- package/build-module/components/keyboard-shortcut-help-modal/dynamic-shortcut.js +3 -4
- package/build-module/components/keyboard-shortcut-help-modal/dynamic-shortcut.js.map +1 -1
- package/build-module/components/keyboard-shortcut-help-modal/index.js +40 -48
- package/build-module/components/keyboard-shortcut-help-modal/index.js.map +1 -1
- package/build-module/components/keyboard-shortcut-help-modal/shortcut.js +10 -12
- package/build-module/components/keyboard-shortcut-help-modal/shortcut.js.map +1 -1
- package/build-module/components/keyboard-shortcuts/index.js +4 -4
- package/build-module/components/keyboard-shortcuts/index.js.map +1 -1
- package/build-module/components/layout/index.js +3 -4
- package/build-module/components/layout/index.js.map +1 -1
- package/build-module/components/layout/interface.js +3 -4
- package/build-module/components/layout/interface.js.map +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/tools-more-menu-group.js +5 -8
- package/build-module/components/more-menu/tools-more-menu-group.js.map +1 -1
- package/build-module/components/notices/index.js +11 -20
- package/build-module/components/notices/index.js.map +1 -1
- package/build-module/components/save-button/index.js +1 -3
- package/build-module/components/save-button/index.js.map +1 -1
- package/build-module/components/secondary-sidebar/inserter-sidebar.js +4 -5
- package/build-module/components/secondary-sidebar/inserter-sidebar.js.map +1 -1
- package/build-module/components/secondary-sidebar/list-view-sidebar.js +9 -3
- package/build-module/components/secondary-sidebar/list-view-sidebar.js.map +1 -1
- package/build-module/components/sidebar/index.js +9 -10
- package/build-module/components/sidebar/index.js.map +1 -1
- package/build-module/components/sidebar/widget-areas.js +5 -6
- package/build-module/components/sidebar/widget-areas.js.map +1 -1
- package/build-module/components/welcome-guide/index.js +6 -7
- package/build-module/components/welcome-guide/index.js.map +1 -1
- package/build-module/components/widget-areas-block-editor-content/index.js +3 -4
- 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 +17 -22
- package/build-module/components/widget-areas-block-editor-provider/index.js.map +1 -1
- package/build-module/filters/move-to-widget-area.js +4 -5
- package/build-module/filters/move-to-widget-area.js.map +1 -1
- package/build-module/hooks/use-last-selected-widget-area.js +2 -4
- package/build-module/hooks/use-last-selected-widget-area.js.map +1 -1
- package/build-module/hooks/use-widget-library-insertion-point.js +1 -3
- package/build-module/hooks/use-widget-library-insertion-point.js.map +1 -1
- package/build-module/{private-apis.js → lock-unlock.js} +1 -1
- package/build-module/lock-unlock.js.map +1 -0
- package/build-module/store/actions.js +49 -74
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/index.js +1 -3
- package/build-module/store/index.js.map +1 -1
- package/build-module/store/reducer.js +3 -11
- package/build-module/store/reducer.js.map +1 -1
- package/build-module/store/resolvers.js +8 -10
- package/build-module/store/resolvers.js.map +1 -1
- package/build-module/store/selectors.js +15 -32
- package/build-module/store/selectors.js.map +1 -1
- package/build-module/store/transformers.js +1 -2
- package/build-module/store/transformers.js.map +1 -1
- package/package.json +27 -27
- package/src/components/header/index.js +1 -1
- package/src/components/keyboard-shortcuts/index.js +4 -4
- package/src/components/secondary-sidebar/list-view-sidebar.js +8 -1
- package/src/components/sidebar/index.js +3 -3
- package/src/components/widget-areas-block-editor-provider/index.js +1 -1
- package/build/private-apis.js.map +0 -1
- package/build-module/private-apis.js.map +0 -1
- /package/src/{private-apis.js → lock-unlock.js} +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -30,15 +30,14 @@ var _useIsDraggingWithin = _interopRequireDefault(require("./use-is-dragging-wit
|
|
|
30
30
|
*/
|
|
31
31
|
|
|
32
32
|
/** @typedef {import('@wordpress/element').RefObject} RefObject */
|
|
33
|
-
function WidgetAreaEdit(
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
} = _ref;
|
|
33
|
+
function WidgetAreaEdit({
|
|
34
|
+
clientId,
|
|
35
|
+
className,
|
|
36
|
+
attributes: {
|
|
37
|
+
id,
|
|
38
|
+
name
|
|
39
|
+
}
|
|
40
|
+
}) {
|
|
42
41
|
const isOpen = (0, _data.useSelect)(select => select(_store.store).getIsWidgetAreaOpen(clientId), [clientId]);
|
|
43
42
|
const {
|
|
44
43
|
setIsWidgetAreaOpen
|
|
@@ -71,26 +70,22 @@ function WidgetAreaEdit(_ref) {
|
|
|
71
70
|
setIsWidgetAreaOpen(clientId, !isOpen);
|
|
72
71
|
},
|
|
73
72
|
scrollAfterOpen: !isDragging
|
|
74
|
-
},
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
id: id
|
|
91
|
-
})))
|
|
92
|
-
);
|
|
93
|
-
}));
|
|
73
|
+
}, ({
|
|
74
|
+
opened
|
|
75
|
+
}) => // This is required to ensure LegacyWidget blocks are not
|
|
76
|
+
// unmounted when the panel is collapsed. Unmounting legacy
|
|
77
|
+
// widgets may have unintended consequences (e.g. TinyMCE
|
|
78
|
+
// not being properly reinitialized)
|
|
79
|
+
(0, _element.createElement)(_components.__unstableDisclosureContent, {
|
|
80
|
+
className: "wp-block-widget-area__panel-body-content",
|
|
81
|
+
visible: opened
|
|
82
|
+
}, (0, _element.createElement)(_coreData.EntityProvider, {
|
|
83
|
+
kind: "root",
|
|
84
|
+
type: "postType",
|
|
85
|
+
id: `widget-area-${id}`
|
|
86
|
+
}, (0, _element.createElement)(_innerBlocks.default, {
|
|
87
|
+
id: id
|
|
88
|
+
})))));
|
|
94
89
|
}
|
|
95
90
|
/**
|
|
96
91
|
* A React hook to determine if dragging is active.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-widgets/src/blocks/widget-area/edit/index.js"],"names":["WidgetAreaEdit","clientId","className","attributes","id","name","isOpen","select","editWidgetsStore","getIsWidgetAreaOpen","setIsWidgetAreaOpen","wrapper","setOpen","openState","isDragging","useIsDragging","isDraggingWithin","openedWhileDragging","setOpenedWhileDragging","opened","elementRef","setIsDragging","ownerDocument","current","handleDragStart","handleDragEnd","addEventListener","removeEventListener"],"mappings":";;;;;;;;;AAGA;;AACA;;AACA;;AACA;;AASA;;AACA;;AACA;;AAjBA;AACA;AACA;;AAUA;AACA;AACA;;AAKA;AAEe,SAASA,cAAT,
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-widgets/src/blocks/widget-area/edit/index.js"],"names":["WidgetAreaEdit","clientId","className","attributes","id","name","isOpen","select","editWidgetsStore","getIsWidgetAreaOpen","setIsWidgetAreaOpen","wrapper","setOpen","openState","isDragging","useIsDragging","isDraggingWithin","openedWhileDragging","setOpenedWhileDragging","opened","elementRef","setIsDragging","ownerDocument","current","handleDragStart","handleDragEnd","addEventListener","removeEventListener"],"mappings":"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","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"]}
|
|
@@ -28,10 +28,9 @@ var _useIsDraggingWithin = _interopRequireDefault(require("./use-is-dragging-wit
|
|
|
28
28
|
/**
|
|
29
29
|
* Internal dependencies
|
|
30
30
|
*/
|
|
31
|
-
function WidgetAreaInnerBlocks(
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
} = _ref;
|
|
31
|
+
function WidgetAreaInnerBlocks({
|
|
32
|
+
id
|
|
33
|
+
}) {
|
|
35
34
|
const [blocks, onInput, onChange] = (0, _coreData.useEntityBlockEditor)('root', 'postType');
|
|
36
35
|
const innerBlocksRef = (0, _element.useRef)();
|
|
37
36
|
const isDraggingWithinInnerBlocks = (0, _useIsDraggingWithin.default)(innerBlocksRef);
|
|
@@ -51,6 +50,7 @@ function WidgetAreaInnerBlocks(_ref) {
|
|
|
51
50
|
className: (0, _classnames.default)('wp-block-widget-area__inner-blocks block-editor-inner-blocks editor-styles-wrapper', {
|
|
52
51
|
'wp-block-widget-area__highlight-drop-zone': shouldHighlightDropZone
|
|
53
52
|
})
|
|
54
|
-
}, (0, _element.createElement)("div", innerBlocksProps
|
|
53
|
+
}, (0, _element.createElement)("div", { ...innerBlocksProps
|
|
54
|
+
}));
|
|
55
55
|
}
|
|
56
56
|
//# sourceMappingURL=inner-blocks.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-widgets/src/blocks/widget-area/edit/inner-blocks.js"],"names":["WidgetAreaInnerBlocks","id","blocks","onInput","onChange","innerBlocksRef","isDraggingWithinInnerBlocks","shouldHighlightDropZone","innerBlocksProps","ref","value","templateLock","renderAppender","InnerBlocks","ButtonBlockAppender"],"mappings":";;;;;;;;;AAUA;;AAPA;;AAKA;;AACA;;AAMA;;AAfA;AACA;AACA;;AAGA;AACA;AACA;;AAKA;AACA;AACA;AAGe,SAASA,qBAAT,
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-widgets/src/blocks/widget-area/edit/inner-blocks.js"],"names":["WidgetAreaInnerBlocks","id","blocks","onInput","onChange","innerBlocksRef","isDraggingWithinInnerBlocks","shouldHighlightDropZone","innerBlocksProps","ref","value","templateLock","renderAppender","InnerBlocks","ButtonBlockAppender"],"mappings":";;;;;;;;;AAUA;;AAPA;;AAKA;;AACA;;AAMA;;AAfA;AACA;AACA;;AAGA;AACA;AACA;;AAKA;AACA;AACA;AAGe,SAASA,qBAAT,CAAgC;AAAEC,EAAAA;AAAF,CAAhC,EAAyC;AACvD,QAAM,CAAEC,MAAF,EAAUC,OAAV,EAAmBC,QAAnB,IAAgC,oCACrC,MADqC,EAErC,UAFqC,CAAtC;AAIA,QAAMC,cAAc,GAAG,sBAAvB;AACA,QAAMC,2BAA2B,GAAG,kCAAqBD,cAArB,CAApC;AACA,QAAME,uBAAuB,GAAGD,2BAAhC,CAPuD,CAQvD;;AACA,QAAME,gBAAgB,GAAG,sCACxB;AAAEC,IAAAA,GAAG,EAAEJ;AAAP,GADwB,EAExB;AACCK,IAAAA,KAAK,EAAER,MADR;AAECC,IAAAA,OAFD;AAGCC,IAAAA,QAHD;AAICO,IAAAA,YAAY,EAAE,KAJf;AAKCC,IAAAA,cAAc,EAAEC,yBAAYC;AAL7B,GAFwB,CAAzB;AAWA,SACC;AACC,2BAAsBb,EADvB;AAEC,IAAA,SAAS,EAAG,yBACX,oFADW,EAEX;AACC,mDACCM;AAFF,KAFW;AAFb,KAUC,wCAAUC;AAAV,IAVD,CADD;AAcA","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"]}
|
|
@@ -49,12 +49,9 @@ exports.name = name;
|
|
|
49
49
|
const settings = {
|
|
50
50
|
title: (0, _i18n.__)('Widget Area'),
|
|
51
51
|
description: (0, _i18n.__)('A widget area container.'),
|
|
52
|
-
__experimentalLabel:
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
} = _ref;
|
|
56
|
-
return label;
|
|
57
|
-
},
|
|
52
|
+
__experimentalLabel: ({
|
|
53
|
+
name: label
|
|
54
|
+
}) => label,
|
|
58
55
|
edit: _edit.default
|
|
59
56
|
};
|
|
60
57
|
exports.settings = settings;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-widgets/src/blocks/widget-area/index.js"],"names":["name","metadata","settings","title","description","__experimentalLabel","label","edit"],"mappings":";;;;;;;;;AAGA;;AAMA;;AATA;AACA;AACA;;AAGA;AACA;AACA;;;;;;;;;;;;;;;;;;;;;;;;;AAIA,MAAM;AAAEA,EAAAA;AAAF,IAAWC,QAAjB;;AAGO,MAAMC,QAAQ,GAAG;AACvBC,EAAAA,KAAK,EAAE,cAAI,aAAJ,CADgB;AAEvBC,EAAAA,WAAW,EAAE,cAAI,0BAAJ,CAFU;AAGvBC,EAAAA,mBAAmB,EAAE
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-widgets/src/blocks/widget-area/index.js"],"names":["name","metadata","settings","title","description","__experimentalLabel","label","edit"],"mappings":";;;;;;;;;AAGA;;AAMA;;AATA;AACA;AACA;;AAGA;AACA;AACA;;;;;;;;;;;;;;;;;;;;;;;;;AAIA,MAAM;AAAEA,EAAAA;AAAF,IAAWC,QAAjB;;AAGO,MAAMC,QAAQ,GAAG;AACvBC,EAAAA,KAAK,EAAE,cAAI,aAAJ,CADgB;AAEvBC,EAAAA,WAAW,EAAE,cAAI,0BAAJ,CAFU;AAGvBC,EAAAA,mBAAmB,EAAE,CAAE;AAAEL,IAAAA,IAAI,EAAEM;AAAR,GAAF,KAAuBA,KAHrB;AAIvBC,EAAAA,IAAI,EAAJA;AAJuB,CAAjB","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport metadata from './block.json';\nimport edit from './edit';\n\nconst { name } = metadata;\nexport { metadata, name };\n\nexport const settings = {\n\ttitle: __( 'Widget Area' ),\n\tdescription: __( 'A widget area container.' ),\n\t__experimentalLabel: ( { name: label } ) => label,\n\tedit,\n};\n"]}
|
|
@@ -20,11 +20,10 @@ var _hooks = require("@wordpress/hooks");
|
|
|
20
20
|
/**
|
|
21
21
|
* WordPress dependencies
|
|
22
22
|
*/
|
|
23
|
-
function CopyButton(
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
} = _ref;
|
|
23
|
+
function CopyButton({
|
|
24
|
+
text,
|
|
25
|
+
children
|
|
26
|
+
}) {
|
|
28
27
|
const ref = (0, _compose.useCopyToClipboard)(text);
|
|
29
28
|
return (0, _element.createElement)(_components.Button, {
|
|
30
29
|
variant: "secondary",
|
|
@@ -32,11 +31,10 @@ function CopyButton(_ref) {
|
|
|
32
31
|
}, children);
|
|
33
32
|
}
|
|
34
33
|
|
|
35
|
-
function ErrorBoundaryWarning(
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
} = _ref2;
|
|
34
|
+
function ErrorBoundaryWarning({
|
|
35
|
+
message,
|
|
36
|
+
error
|
|
37
|
+
}) {
|
|
40
38
|
const actions = [(0, _element.createElement)(CopyButton, {
|
|
41
39
|
key: "copy-error",
|
|
42
40
|
text: error.stack
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-widgets/src/components/error-boundary/index.js"],"names":["CopyButton","text","children","ref","ErrorBoundaryWarning","message","error","actions","stack","ErrorBoundary","Component","constructor","arguments","state","componentDidCatch","getDerivedStateFromError","render","props"],"mappings":";;;;;;;AAGA;;AACA;;AACA;;AACA;;AACA;;AACA;;AARA;AACA;AACA;AAQA,SAASA,UAAT,
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-widgets/src/components/error-boundary/index.js"],"names":["CopyButton","text","children","ref","ErrorBoundaryWarning","message","error","actions","stack","ErrorBoundary","Component","constructor","arguments","state","componentDidCatch","getDerivedStateFromError","render","props"],"mappings":";;;;;;;AAGA;;AACA;;AACA;;AACA;;AACA;;AACA;;AARA;AACA;AACA;AAQA,SAASA,UAAT,CAAqB;AAAEC,EAAAA,IAAF;AAAQC,EAAAA;AAAR,CAArB,EAA0C;AACzC,QAAMC,GAAG,GAAG,iCAAoBF,IAApB,CAAZ;AACA,SACC,4BAAC,kBAAD;AAAQ,IAAA,OAAO,EAAC,WAAhB;AAA4B,IAAA,GAAG,EAAGE;AAAlC,KACGD,QADH,CADD;AAKA;;AAED,SAASE,oBAAT,CAA+B;AAAEC,EAAAA,OAAF;AAAWC,EAAAA;AAAX,CAA/B,EAAoD;AACnD,QAAMC,OAAO,GAAG,CACf,4BAAC,UAAD;AAAY,IAAA,GAAG,EAAC,YAAhB;AAA6B,IAAA,IAAI,EAAGD,KAAK,CAACE;AAA1C,KACG,cAAI,YAAJ,CADH,CADe,CAAhB;AAMA,SACC,4BAAC,oBAAD;AAAS,IAAA,SAAS,EAAC,6BAAnB;AAAiD,IAAA,OAAO,EAAGD;AAA3D,KACGF,OADH,CADD;AAKA;;AAEc,MAAMI,aAAN,SAA4BC,kBAA5B,CAAsC;AACpDC,EAAAA,WAAW,GAAG;AACb,UAAO,GAAGC,SAAV;AAEA,SAAKC,KAAL,GAAa;AACZP,MAAAA,KAAK,EAAE;AADK,KAAb;AAGA;;AAEDQ,EAAAA,iBAAiB,CAAER,KAAF,EAAU;AAC1B,yBAAU,kCAAV,EAA8CA,KAA9C;AACA;;AAE8B,SAAxBS,wBAAwB,CAAET,KAAF,EAAU;AACxC,WAAO;AAAEA,MAAAA;AAAF,KAAP;AACA;;AAEDU,EAAAA,MAAM,GAAG;AACR,QAAK,CAAE,KAAKH,KAAL,CAAWP,KAAlB,EAA0B;AACzB,aAAO,KAAKW,KAAL,CAAWf,QAAlB;AACA;;AAED,WACC,4BAAC,oBAAD;AACC,MAAA,OAAO,EAAG,cACT,iDADS,CADX;AAIC,MAAA,KAAK,EAAG,KAAKW,KAAL,CAAWP;AAJpB,MADD;AAQA;;AA9BmD","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"]}
|
|
@@ -35,7 +35,7 @@ var _useLastSelectedWidgetArea = _interopRequireDefault(require("../../hooks/use
|
|
|
35
35
|
|
|
36
36
|
var _store = require("../../store");
|
|
37
37
|
|
|
38
|
-
var
|
|
38
|
+
var _lockUnlock = require("../../lock-unlock");
|
|
39
39
|
|
|
40
40
|
/**
|
|
41
41
|
* WordPress dependencies
|
|
@@ -46,7 +46,7 @@ var _privateApis = require("../../private-apis");
|
|
|
46
46
|
*/
|
|
47
47
|
const {
|
|
48
48
|
useShouldContextualToolbarShow
|
|
49
|
-
} = (0,
|
|
49
|
+
} = (0, _lockUnlock.unlock)(_blockEditor.privateApis);
|
|
50
50
|
|
|
51
51
|
function Header() {
|
|
52
52
|
const isMediumViewport = (0, _compose.useViewportMatch)('medium');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-widgets/src/components/header/index.js"],"names":["useShouldContextualToolbarShow","blockEditorPrivateApis","Header","isMediumViewport","inserterButton","widgetAreaClientId","isLastSelectedWidgetAreaOpen","select","editWidgetsStore","getIsWidgetAreaOpen","isInserterOpen","isListViewOpen","isInserterOpened","isListViewOpened","setIsWidgetAreaOpen","setIsInserterOpened","setIsListViewOpened","selectBlock","blockEditorStore","handleClick","window","requestAnimationFrame","toggleListView","shouldShowContextualToolbar","canFocusHiddenToolbar","fixedToolbarCanBeFocused","blockToolbarCanBeFocused","Button","event","preventDefault","plus","listView"],"mappings":";;;;;;;;;AAaA;;AAVA;;AACA;;AACA;;AACA;;AAKA;;AACA;;AAEA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAzBA;AACA;AACA;;AAcA;AACA;AACA;AASA,MAAM;AAAEA,EAAAA;AAAF,IAAqC,
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-widgets/src/components/header/index.js"],"names":["useShouldContextualToolbarShow","blockEditorPrivateApis","Header","isMediumViewport","inserterButton","widgetAreaClientId","isLastSelectedWidgetAreaOpen","select","editWidgetsStore","getIsWidgetAreaOpen","isInserterOpen","isListViewOpen","isInserterOpened","isListViewOpened","setIsWidgetAreaOpen","setIsInserterOpened","setIsListViewOpened","selectBlock","blockEditorStore","handleClick","window","requestAnimationFrame","toggleListView","shouldShowContextualToolbar","canFocusHiddenToolbar","fixedToolbarCanBeFocused","blockToolbarCanBeFocused","Button","event","preventDefault","plus","listView"],"mappings":"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","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { __, _x } from '@wordpress/i18n';\nimport { Button, ToolbarItem, VisuallyHidden } from '@wordpress/components';\nimport {\n\tNavigableToolbar,\n\tstore as blockEditorStore,\n\tprivateApis as blockEditorPrivateApis,\n} from '@wordpress/block-editor';\nimport { PinnedItems } from '@wordpress/interface';\nimport { listView, plus } from '@wordpress/icons';\nimport { useCallback, useRef } from '@wordpress/element';\nimport { useViewportMatch } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport SaveButton from '../save-button';\nimport UndoButton from './undo-redo/undo';\nimport RedoButton from './undo-redo/redo';\nimport MoreMenu from '../more-menu';\nimport useLastSelectedWidgetArea from '../../hooks/use-last-selected-widget-area';\nimport { store as editWidgetsStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\n\nconst { useShouldContextualToolbarShow } = unlock( blockEditorPrivateApis );\n\nfunction Header() {\n\tconst isMediumViewport = useViewportMatch( 'medium' );\n\tconst inserterButton = useRef();\n\tconst widgetAreaClientId = useLastSelectedWidgetArea();\n\tconst isLastSelectedWidgetAreaOpen = useSelect(\n\t\t( select ) =>\n\t\t\tselect( editWidgetsStore ).getIsWidgetAreaOpen(\n\t\t\t\twidgetAreaClientId\n\t\t\t),\n\t\t[ widgetAreaClientId ]\n\t);\n\tconst { isInserterOpen, isListViewOpen } = useSelect( ( select ) => {\n\t\tconst { isInserterOpened, isListViewOpened } =\n\t\t\tselect( editWidgetsStore );\n\t\treturn {\n\t\t\tisInserterOpen: isInserterOpened(),\n\t\t\tisListViewOpen: isListViewOpened(),\n\t\t};\n\t}, [] );\n\tconst { setIsWidgetAreaOpen, setIsInserterOpened, setIsListViewOpened } =\n\t\tuseDispatch( editWidgetsStore );\n\tconst { selectBlock } = useDispatch( blockEditorStore );\n\tconst handleClick = () => {\n\t\tif ( isInserterOpen ) {\n\t\t\t// Focusing the inserter button closes the inserter popover.\n\t\t\tsetIsInserterOpened( false );\n\t\t} else {\n\t\t\tif ( ! isLastSelectedWidgetAreaOpen ) {\n\t\t\t\t// Select the last selected block if hasn't already.\n\t\t\t\tselectBlock( widgetAreaClientId );\n\t\t\t\t// Open the last selected widget area when opening the inserter.\n\t\t\t\tsetIsWidgetAreaOpen( widgetAreaClientId, true );\n\t\t\t}\n\t\t\t// The DOM updates resulting from selectBlock() and setIsInserterOpened() calls are applied the\n\t\t\t// same tick and pretty much in a random order. The inserter is closed if any other part of the\n\t\t\t// app receives focus. If selectBlock() happens to take effect after setIsInserterOpened() then\n\t\t\t// the inserter is visible for a brief moment and then gets auto-closed due to focus moving to\n\t\t\t// the selected block.\n\t\t\twindow.requestAnimationFrame( () => setIsInserterOpened( true ) );\n\t\t}\n\t};\n\n\tconst toggleListView = useCallback(\n\t\t() => setIsListViewOpened( ! isListViewOpen ),\n\t\t[ setIsListViewOpened, isListViewOpen ]\n\t);\n\n\tconst {\n\t\tshouldShowContextualToolbar,\n\t\tcanFocusHiddenToolbar,\n\t\tfixedToolbarCanBeFocused,\n\t} = useShouldContextualToolbarShow();\n\t// If there's a block toolbar to be focused, disable the focus shortcut for the document toolbar.\n\t// There's a fixed block toolbar when the fixed toolbar option is enabled or when the browser width is less than the large viewport.\n\tconst blockToolbarCanBeFocused =\n\t\tshouldShowContextualToolbar ||\n\t\tcanFocusHiddenToolbar ||\n\t\tfixedToolbarCanBeFocused;\n\n\treturn (\n\t\t<>\n\t\t\t<div className=\"edit-widgets-header\">\n\t\t\t\t<div className=\"edit-widgets-header__navigable-toolbar-wrapper\">\n\t\t\t\t\t{ isMediumViewport && (\n\t\t\t\t\t\t<h1 className=\"edit-widgets-header__title\">\n\t\t\t\t\t\t\t{ __( 'Widgets' ) }\n\t\t\t\t\t\t</h1>\n\t\t\t\t\t) }\n\t\t\t\t\t{ ! isMediumViewport && (\n\t\t\t\t\t\t<VisuallyHidden\n\t\t\t\t\t\t\tas=\"h1\"\n\t\t\t\t\t\t\tclassName=\"edit-widgets-header__title\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Widgets' ) }\n\t\t\t\t\t\t</VisuallyHidden>\n\t\t\t\t\t) }\n\t\t\t\t\t<NavigableToolbar\n\t\t\t\t\t\tclassName=\"edit-widgets-header-toolbar\"\n\t\t\t\t\t\taria-label={ __( 'Document tools' ) }\n\t\t\t\t\t\tshouldUseKeyboardFocusShortcut={\n\t\t\t\t\t\t\t! blockToolbarCanBeFocused\n\t\t\t\t\t\t}\n\t\t\t\t\t>\n\t\t\t\t\t\t<ToolbarItem\n\t\t\t\t\t\t\tref={ inserterButton }\n\t\t\t\t\t\t\tas={ Button }\n\t\t\t\t\t\t\tclassName=\"edit-widgets-header-toolbar__inserter-toggle\"\n\t\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\t\tisPressed={ isInserterOpen }\n\t\t\t\t\t\t\tonMouseDown={ ( event ) => {\n\t\t\t\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tonClick={ handleClick }\n\t\t\t\t\t\t\ticon={ plus }\n\t\t\t\t\t\t\t/* translators: button label text should, if possible, be under 16\n\t\t\t\t\tcharacters. */\n\t\t\t\t\t\t\tlabel={ _x(\n\t\t\t\t\t\t\t\t'Toggle block inserter',\n\t\t\t\t\t\t\t\t'Generic label for block inserter button'\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t{ isMediumViewport && (\n\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t<UndoButton />\n\t\t\t\t\t\t\t\t<RedoButton />\n\t\t\t\t\t\t\t\t<ToolbarItem\n\t\t\t\t\t\t\t\t\tas={ Button }\n\t\t\t\t\t\t\t\t\tclassName=\"edit-widgets-header-toolbar__list-view-toggle\"\n\t\t\t\t\t\t\t\t\ticon={ listView }\n\t\t\t\t\t\t\t\t\tisPressed={ isListViewOpen }\n\t\t\t\t\t\t\t\t\t/* translators: button label text should, if possible, be under 16 characters. */\n\t\t\t\t\t\t\t\t\tlabel={ __( 'List View' ) }\n\t\t\t\t\t\t\t\t\tonClick={ toggleListView }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t) }\n\t\t\t\t\t</NavigableToolbar>\n\t\t\t\t</div>\n\t\t\t\t<div className=\"edit-widgets-header__actions\">\n\t\t\t\t\t<SaveButton />\n\t\t\t\t\t<PinnedItems.Slot scope=\"core/edit-widgets\" />\n\t\t\t\t\t<MoreMenu />\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t</>\n\t);\n}\n\nexport default Header;\n"]}
|
|
@@ -22,10 +22,9 @@ var _shortcut = _interopRequireDefault(require("./shortcut"));
|
|
|
22
22
|
/**
|
|
23
23
|
* Internal dependencies
|
|
24
24
|
*/
|
|
25
|
-
function DynamicShortcut(
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
} = _ref;
|
|
25
|
+
function DynamicShortcut({
|
|
26
|
+
name
|
|
27
|
+
}) {
|
|
29
28
|
const {
|
|
30
29
|
keyCombination,
|
|
31
30
|
description,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-widgets/src/components/keyboard-shortcut-help-modal/dynamic-shortcut.js"],"names":["DynamicShortcut","name","keyCombination","description","aliases","select","getShortcutKeyCombination","getShortcutDescription","getShortcutAliases","keyboardShortcutsStore"],"mappings":";;;;;;;;;;;AAGA;;AACA;;AAKA;;AATA;AACA;AACA;;AAIA;AACA;AACA;AAGA,SAASA,eAAT,
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-widgets/src/components/keyboard-shortcut-help-modal/dynamic-shortcut.js"],"names":["DynamicShortcut","name","keyCombination","description","aliases","select","getShortcutKeyCombination","getShortcutDescription","getShortcutAliases","keyboardShortcutsStore"],"mappings":";;;;;;;;;;;AAGA;;AACA;;AAKA;;AATA;AACA;AACA;;AAIA;AACA;AACA;AAGA,SAASA,eAAT,CAA0B;AAAEC,EAAAA;AAAF,CAA1B,EAAqC;AACpC,QAAM;AAAEC,IAAAA,cAAF;AAAkBC,IAAAA,WAAlB;AAA+BC,IAAAA;AAA/B,MAA2C,qBAC9CC,MAAF,IAAc;AACb,UAAM;AACLC,MAAAA,yBADK;AAELC,MAAAA,sBAFK;AAGLC,MAAAA;AAHK,QAIFH,MAAM,CAAEI,wBAAF,CAJV;AAMA,WAAO;AACNP,MAAAA,cAAc,EAAEI,yBAAyB,CAAEL,IAAF,CADnC;AAENG,MAAAA,OAAO,EAAEI,kBAAkB,CAAEP,IAAF,CAFrB;AAGNE,MAAAA,WAAW,EAAEI,sBAAsB,CAAEN,IAAF;AAH7B,KAAP;AAKA,GAb+C,EAchD,CAAEA,IAAF,CAdgD,CAAjD;;AAiBA,MAAK,CAAEC,cAAP,EAAwB;AACvB,WAAO,IAAP;AACA;;AAED,SACC,4BAAC,iBAAD;AACC,IAAA,cAAc,EAAGA,cADlB;AAEC,IAAA,WAAW,EAAGC,WAFf;AAGC,IAAA,OAAO,EAAGC;AAHX,IADD;AAOA;;eAEcJ,e","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"]}
|
|
@@ -36,52 +36,45 @@ var _dynamicShortcut = _interopRequireDefault(require("./dynamic-shortcut"));
|
|
|
36
36
|
/**
|
|
37
37
|
* Internal dependencies
|
|
38
38
|
*/
|
|
39
|
-
const ShortcutList =
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
* Safari+VoiceOver won't announce the list otherwise.
|
|
47
|
-
*/
|
|
48
|
-
|
|
49
|
-
/* eslint-disable jsx-a11y/no-redundant-roles */
|
|
50
|
-
(0, _element.createElement)("ul", {
|
|
51
|
-
className: "edit-widgets-keyboard-shortcut-help-modal__shortcut-list",
|
|
52
|
-
role: "list"
|
|
53
|
-
}, shortcuts.map((shortcut, index) => (0, _element.createElement)("li", {
|
|
54
|
-
className: "edit-widgets-keyboard-shortcut-help-modal__shortcut",
|
|
55
|
-
key: index
|
|
56
|
-
}, typeof shortcut === 'string' ? (0, _element.createElement)(_dynamicShortcut.default, {
|
|
57
|
-
name: shortcut
|
|
58
|
-
}) : (0, _element.createElement)(_shortcut.default, shortcut))))
|
|
59
|
-
/* eslint-enable jsx-a11y/no-redundant-roles */
|
|
60
|
-
|
|
61
|
-
);
|
|
62
|
-
};
|
|
63
|
-
|
|
64
|
-
const ShortcutSection = _ref2 => {
|
|
65
|
-
let {
|
|
66
|
-
title,
|
|
67
|
-
shortcuts,
|
|
68
|
-
className
|
|
69
|
-
} = _ref2;
|
|
70
|
-
return (0, _element.createElement)("section", {
|
|
71
|
-
className: (0, _classnames.default)('edit-widgets-keyboard-shortcut-help-modal__section', className)
|
|
72
|
-
}, !!title && (0, _element.createElement)("h2", {
|
|
73
|
-
className: "edit-widgets-keyboard-shortcut-help-modal__section-title"
|
|
74
|
-
}, title), (0, _element.createElement)(ShortcutList, {
|
|
75
|
-
shortcuts: shortcuts
|
|
76
|
-
}));
|
|
77
|
-
};
|
|
39
|
+
const ShortcutList = ({
|
|
40
|
+
shortcuts
|
|
41
|
+
}) =>
|
|
42
|
+
/*
|
|
43
|
+
* Disable reason: The `list` ARIA role is redundant but
|
|
44
|
+
* Safari+VoiceOver won't announce the list otherwise.
|
|
45
|
+
*/
|
|
78
46
|
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
47
|
+
/* eslint-disable jsx-a11y/no-redundant-roles */
|
|
48
|
+
(0, _element.createElement)("ul", {
|
|
49
|
+
className: "edit-widgets-keyboard-shortcut-help-modal__shortcut-list",
|
|
50
|
+
role: "list"
|
|
51
|
+
}, shortcuts.map((shortcut, index) => (0, _element.createElement)("li", {
|
|
52
|
+
className: "edit-widgets-keyboard-shortcut-help-modal__shortcut",
|
|
53
|
+
key: index
|
|
54
|
+
}, typeof shortcut === 'string' ? (0, _element.createElement)(_dynamicShortcut.default, {
|
|
55
|
+
name: shortcut
|
|
56
|
+
}) : (0, _element.createElement)(_shortcut.default, { ...shortcut
|
|
57
|
+
}))))
|
|
58
|
+
/* eslint-enable jsx-a11y/no-redundant-roles */
|
|
59
|
+
;
|
|
60
|
+
|
|
61
|
+
const ShortcutSection = ({
|
|
62
|
+
title,
|
|
63
|
+
shortcuts,
|
|
64
|
+
className
|
|
65
|
+
}) => (0, _element.createElement)("section", {
|
|
66
|
+
className: (0, _classnames.default)('edit-widgets-keyboard-shortcut-help-modal__section', className)
|
|
67
|
+
}, !!title && (0, _element.createElement)("h2", {
|
|
68
|
+
className: "edit-widgets-keyboard-shortcut-help-modal__section-title"
|
|
69
|
+
}, title), (0, _element.createElement)(ShortcutList, {
|
|
70
|
+
shortcuts: shortcuts
|
|
71
|
+
}));
|
|
72
|
+
|
|
73
|
+
const ShortcutCategorySection = ({
|
|
74
|
+
title,
|
|
75
|
+
categoryName,
|
|
76
|
+
additionalShortcuts = []
|
|
77
|
+
}) => {
|
|
85
78
|
const categoryShortcuts = (0, _data.useSelect)(select => {
|
|
86
79
|
return select(_keyboardShortcuts.store).getCategoryShortcuts(categoryName);
|
|
87
80
|
}, [categoryName]);
|
|
@@ -91,11 +84,10 @@ const ShortcutCategorySection = _ref3 => {
|
|
|
91
84
|
});
|
|
92
85
|
};
|
|
93
86
|
|
|
94
|
-
function KeyboardShortcutHelpModal(
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
} = _ref4;
|
|
87
|
+
function KeyboardShortcutHelpModal({
|
|
88
|
+
isModalActive,
|
|
89
|
+
toggleModal
|
|
90
|
+
}) {
|
|
99
91
|
(0, _keyboardShortcuts.useShortcut)('core/edit-widgets/keyboard-shortcuts', toggleModal, {
|
|
100
92
|
bindGlobal: true
|
|
101
93
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-widgets/src/components/keyboard-shortcut-help-modal/index.js"],"names":["ShortcutList","shortcuts","map","shortcut","index","ShortcutSection","title","className","ShortcutCategorySection","categoryName","additionalShortcuts","categoryShortcuts","select","keyboardShortcutsStore","getCategoryShortcuts","concat","KeyboardShortcutHelpModal","isModalActive","toggleModal","bindGlobal","keyCombination","character","description","ariaLabel","textFormattingShortcuts"],"mappings":";;;;;;;;;;;AAGA;;AAKA;;AACA;;AACA;;AAIA;;AAKA;;AACA;;AACA;;AArBA;AACA;AACA;;AAGA;AACA;AACA;;AASA;AACA;AACA;AAKA,MAAMA,YAAY,GAAG
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-widgets/src/components/keyboard-shortcut-help-modal/index.js"],"names":["ShortcutList","shortcuts","map","shortcut","index","ShortcutSection","title","className","ShortcutCategorySection","categoryName","additionalShortcuts","categoryShortcuts","select","keyboardShortcutsStore","getCategoryShortcuts","concat","KeyboardShortcutHelpModal","isModalActive","toggleModal","bindGlobal","keyCombination","character","description","ariaLabel","textFormattingShortcuts"],"mappings":"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","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"]}
|
|
@@ -12,11 +12,10 @@ var _keycodes = require("@wordpress/keycodes");
|
|
|
12
12
|
/**
|
|
13
13
|
* WordPress dependencies
|
|
14
14
|
*/
|
|
15
|
-
function KeyCombination(
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
} = _ref;
|
|
15
|
+
function KeyCombination({
|
|
16
|
+
keyCombination,
|
|
17
|
+
forceAriaLabel
|
|
18
|
+
}) {
|
|
20
19
|
const shortcut = keyCombination.modifier ? _keycodes.displayShortcutList[keyCombination.modifier](keyCombination.character) : keyCombination.character;
|
|
21
20
|
const ariaLabel = keyCombination.modifier ? _keycodes.shortcutAriaLabel[keyCombination.modifier](keyCombination.character) : keyCombination.character;
|
|
22
21
|
const shortcuts = Array.isArray(shortcut) ? shortcut : [shortcut];
|
|
@@ -37,13 +36,12 @@ function KeyCombination(_ref) {
|
|
|
37
36
|
}));
|
|
38
37
|
}
|
|
39
38
|
|
|
40
|
-
function Shortcut(
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
} = _ref2;
|
|
39
|
+
function Shortcut({
|
|
40
|
+
description,
|
|
41
|
+
keyCombination,
|
|
42
|
+
aliases = [],
|
|
43
|
+
ariaLabel
|
|
44
|
+
}) {
|
|
47
45
|
return (0, _element.createElement)(_element.Fragment, null, (0, _element.createElement)("div", {
|
|
48
46
|
className: "edit-widgets-keyboard-shortcut-help-modal__shortcut-description"
|
|
49
47
|
}, description), (0, _element.createElement)("div", {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-widgets/src/components/keyboard-shortcut-help-modal/shortcut.js"],"names":["KeyCombination","keyCombination","forceAriaLabel","shortcut","modifier","displayShortcutList","character","ariaLabel","shortcutAriaLabel","shortcuts","Array","isArray","map","index","Shortcut","description","aliases","alias"],"mappings":";;;;;;;AAGA;;AACA;;AAJA;AACA;AACA;AAIA,SAASA,cAAT,
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-widgets/src/components/keyboard-shortcut-help-modal/shortcut.js"],"names":["KeyCombination","keyCombination","forceAriaLabel","shortcut","modifier","displayShortcutList","character","ariaLabel","shortcutAriaLabel","shortcuts","Array","isArray","map","index","Shortcut","description","aliases","alias"],"mappings":";;;;;;;AAGA;;AACA;;AAJA;AACA;AACA;AAIA,SAASA,cAAT,CAAyB;AAAEC,EAAAA,cAAF;AAAkBC,EAAAA;AAAlB,CAAzB,EAA8D;AAC7D,QAAMC,QAAQ,GAAGF,cAAc,CAACG,QAAf,GACdC,8BAAqBJ,cAAc,CAACG,QAApC,EACAH,cAAc,CAACK,SADf,CADc,GAIdL,cAAc,CAACK,SAJlB;AAKA,QAAMC,SAAS,GAAGN,cAAc,CAACG,QAAf,GACfI,4BAAmBP,cAAc,CAACG,QAAlC,EACAH,cAAc,CAACK,SADf,CADe,GAIfL,cAAc,CAACK,SAJlB;AAKA,QAAMG,SAAS,GAAGC,KAAK,CAACC,OAAN,CAAeR,QAAf,IAA4BA,QAA5B,GAAuC,CAAEA,QAAF,CAAzD;AAEA,SACC;AACC,IAAA,SAAS,EAAC,qEADX;AAEC,kBAAaD,cAAc,IAAIK;AAFhC,KAIGE,SAAS,CAACG,GAAV,CAAe,CAAEN,SAAF,EAAaO,KAAb,KAAwB;AACxC,QAAKP,SAAS,KAAK,GAAnB,EAAyB;AACxB,aAAO,4BAAC,iBAAD;AAAU,QAAA,GAAG,EAAGO;AAAhB,SAA0BP,SAA1B,CAAP;AACA;;AAED,WACC;AACC,MAAA,GAAG,EAAGO,KADP;AAEC,MAAA,SAAS,EAAC;AAFX,OAIGP,SAJH,CADD;AAQA,GAbC,CAJH,CADD;AAqBA;;AAED,SAASQ,QAAT,CAAmB;AAAEC,EAAAA,WAAF;AAAed,EAAAA,cAAf;AAA+Be,EAAAA,OAAO,GAAG,EAAzC;AAA6CT,EAAAA;AAA7C,CAAnB,EAA8E;AAC7E,SACC,qDACC;AAAK,IAAA,SAAS,EAAC;AAAf,KACGQ,WADH,CADD,EAIC;AAAK,IAAA,SAAS,EAAC;AAAf,KACC,4BAAC,cAAD;AACC,IAAA,cAAc,EAAGd,cADlB;AAEC,IAAA,cAAc,EAAGM;AAFlB,IADD,EAKGS,OAAO,CAACJ,GAAR,CAAa,CAAEK,KAAF,EAASJ,KAAT,KACd,4BAAC,cAAD;AACC,IAAA,cAAc,EAAGI,KADlB;AAEC,IAAA,cAAc,EAAGV,SAFlB;AAGC,IAAA,GAAG,EAAGM;AAHP,IADC,CALH,CAJD,CADD;AAoBA;;eAEcC,Q","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { Fragment } from '@wordpress/element';\nimport { displayShortcutList, shortcutAriaLabel } from '@wordpress/keycodes';\n\nfunction KeyCombination( { keyCombination, forceAriaLabel } ) {\n\tconst shortcut = keyCombination.modifier\n\t\t? displayShortcutList[ keyCombination.modifier ](\n\t\t\t\tkeyCombination.character\n\t\t )\n\t\t: keyCombination.character;\n\tconst ariaLabel = keyCombination.modifier\n\t\t? shortcutAriaLabel[ keyCombination.modifier ](\n\t\t\t\tkeyCombination.character\n\t\t )\n\t\t: keyCombination.character;\n\tconst shortcuts = Array.isArray( shortcut ) ? shortcut : [ shortcut ];\n\n\treturn (\n\t\t<kbd\n\t\t\tclassName=\"edit-widgets-keyboard-shortcut-help-modal__shortcut-key-combination\"\n\t\t\taria-label={ forceAriaLabel || ariaLabel }\n\t\t>\n\t\t\t{ shortcuts.map( ( character, index ) => {\n\t\t\t\tif ( character === '+' ) {\n\t\t\t\t\treturn <Fragment key={ index }>{ character }</Fragment>;\n\t\t\t\t}\n\n\t\t\t\treturn (\n\t\t\t\t\t<kbd\n\t\t\t\t\t\tkey={ index }\n\t\t\t\t\t\tclassName=\"edit-widgets-keyboard-shortcut-help-modal__shortcut-key\"\n\t\t\t\t\t>\n\t\t\t\t\t\t{ character }\n\t\t\t\t\t</kbd>\n\t\t\t\t);\n\t\t\t} ) }\n\t\t</kbd>\n\t);\n}\n\nfunction Shortcut( { description, keyCombination, aliases = [], ariaLabel } ) {\n\treturn (\n\t\t<>\n\t\t\t<div className=\"edit-widgets-keyboard-shortcut-help-modal__shortcut-description\">\n\t\t\t\t{ description }\n\t\t\t</div>\n\t\t\t<div className=\"edit-widgets-keyboard-shortcut-help-modal__shortcut-term\">\n\t\t\t\t<KeyCombination\n\t\t\t\t\tkeyCombination={ keyCombination }\n\t\t\t\t\tforceAriaLabel={ ariaLabel }\n\t\t\t\t/>\n\t\t\t\t{ aliases.map( ( alias, index ) => (\n\t\t\t\t\t<KeyCombination\n\t\t\t\t\t\tkeyCombination={ alias }\n\t\t\t\t\t\tforceAriaLabel={ ariaLabel }\n\t\t\t\t\t\tkey={ index }\n\t\t\t\t\t/>\n\t\t\t\t) ) }\n\t\t\t</div>\n\t\t</>\n\t);\n}\n\nexport default Shortcut;\n"]}
|
|
@@ -86,12 +86,12 @@ function KeyboardShortcuts() {
|
|
|
86
86
|
event.preventDefault();
|
|
87
87
|
saveEditedWidgetAreas();
|
|
88
88
|
});
|
|
89
|
-
(0, _keyboardShortcuts.useShortcut)('core/edit-widgets
|
|
89
|
+
(0, _keyboardShortcuts.useShortcut)('core/edit-widgets/transform-heading-to-paragraph', event => handleTextLevelShortcut(event, 0));
|
|
90
90
|
[1, 2, 3, 4, 5, 6].forEach(level => {
|
|
91
91
|
//the loop is based off on a constant therefore
|
|
92
92
|
//the hook will execute the same way every time
|
|
93
93
|
//eslint-disable-next-line react-hooks/rules-of-hooks
|
|
94
|
-
(0, _keyboardShortcuts.useShortcut)(`core/edit-widgets
|
|
94
|
+
(0, _keyboardShortcuts.useShortcut)(`core/edit-widgets/transform-paragraph-to-heading-${level}`, event => handleTextLevelShortcut(event, level));
|
|
95
95
|
});
|
|
96
96
|
return null;
|
|
97
97
|
}
|
|
@@ -176,7 +176,7 @@ function KeyboardShortcutsRegister() {
|
|
|
176
176
|
}]
|
|
177
177
|
});
|
|
178
178
|
registerShortcut({
|
|
179
|
-
name:
|
|
179
|
+
name: 'core/edit-widgets/transform-heading-to-paragraph',
|
|
180
180
|
category: 'block-library',
|
|
181
181
|
description: (0, _i18n.__)('Transform heading to paragraph.'),
|
|
182
182
|
keyCombination: {
|
|
@@ -186,7 +186,7 @@ function KeyboardShortcutsRegister() {
|
|
|
186
186
|
});
|
|
187
187
|
[1, 2, 3, 4, 5, 6].forEach(level => {
|
|
188
188
|
registerShortcut({
|
|
189
|
-
name: `core/edit-widgets
|
|
189
|
+
name: `core/edit-widgets/transform-paragraph-to-heading-${level}`,
|
|
190
190
|
category: 'block-library',
|
|
191
191
|
description: (0, _i18n.__)('Transform paragraph to heading.'),
|
|
192
192
|
keyCombination: {
|