@wordpress/edit-widgets 7.1.0 → 7.3.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/build/blocks/widget-area/edit/index.cjs +10 -8
- package/build/blocks/widget-area/edit/index.cjs.map +1 -1
- package/build/blocks/widget-area/edit/inner-blocks.cjs +10 -8
- package/build/blocks/widget-area/edit/inner-blocks.cjs.map +1 -1
- package/build/blocks/widget-area/edit/use-is-dragging-within.cjs.map +1 -1
- package/build/blocks/widget-area/index.cjs +9 -7
- package/build/blocks/widget-area/index.cjs.map +1 -1
- package/build/components/error-boundary/index.cjs +1 -1
- package/build/components/error-boundary/index.cjs.map +1 -1
- package/build/components/header/document-tools/index.cjs +20 -10
- package/build/components/header/document-tools/index.cjs.map +1 -1
- package/build/components/header/index.cjs +18 -11
- package/build/components/header/index.cjs.map +1 -1
- package/build/components/keyboard-shortcut-help-modal/config.cjs +5 -0
- package/build/components/keyboard-shortcut-help-modal/config.cjs.map +1 -1
- package/build/components/keyboard-shortcut-help-modal/dynamic-shortcut.cjs +9 -7
- package/build/components/keyboard-shortcut-help-modal/dynamic-shortcut.cjs.map +1 -1
- package/build/components/keyboard-shortcut-help-modal/index.cjs +12 -11
- package/build/components/keyboard-shortcut-help-modal/index.cjs.map +1 -1
- package/build/components/keyboard-shortcut-help-modal/shortcut.cjs +35 -13
- package/build/components/keyboard-shortcut-help-modal/shortcut.cjs.map +1 -1
- package/build/components/keyboard-shortcuts/index.cjs.map +1 -1
- package/build/components/layout/index.cjs +19 -13
- package/build/components/layout/index.cjs.map +1 -1
- package/build/components/layout/interface.cjs +27 -13
- package/build/components/layout/interface.cjs.map +1 -1
- package/build/components/layout/unsaved-changes-warning.cjs +3 -6
- package/build/components/layout/unsaved-changes-warning.cjs.map +1 -1
- package/build/components/more-menu/index.cjs +14 -10
- package/build/components/more-menu/index.cjs.map +1 -1
- package/build/components/secondary-sidebar/index.cjs +10 -8
- package/build/components/secondary-sidebar/index.cjs.map +1 -1
- package/build/components/secondary-sidebar/inserter-sidebar.cjs +9 -7
- package/build/components/secondary-sidebar/inserter-sidebar.cjs.map +1 -1
- package/build/components/sidebar/index.cjs +23 -15
- package/build/components/sidebar/index.cjs.map +1 -1
- package/build/components/welcome-guide/index.cjs +5 -1
- package/build/components/welcome-guide/index.cjs.map +1 -1
- package/build/components/widget-areas-block-editor-content/index.cjs +10 -8
- package/build/components/widget-areas-block-editor-content/index.cjs.map +1 -1
- package/build/components/widget-areas-block-editor-provider/index.cjs +10 -8
- package/build/components/widget-areas-block-editor-provider/index.cjs.map +1 -1
- package/build/constants.cjs +0 -2
- package/build/constants.cjs.map +1 -1
- package/build/index.cjs +12 -10
- package/build/index.cjs.map +1 -1
- package/build/store/actions.cjs +20 -9
- package/build/store/actions.cjs.map +1 -1
- package/build/store/index.cjs +14 -12
- package/build/store/index.cjs.map +1 -1
- package/build/store/selectors.cjs +3 -1
- package/build/store/selectors.cjs.map +1 -1
- package/build-module/blocks/widget-area/index.mjs.map +1 -1
- package/build-module/components/error-boundary/index.mjs +2 -2
- package/build-module/components/error-boundary/index.mjs.map +1 -1
- package/build-module/components/header/document-tools/index.mjs +10 -2
- package/build-module/components/header/document-tools/index.mjs.map +1 -1
- package/build-module/components/header/index.mjs +6 -2
- package/build-module/components/header/index.mjs.map +1 -1
- package/build-module/components/header/undo-redo/redo.mjs.map +1 -1
- package/build-module/components/header/undo-redo/undo.mjs.map +1 -1
- package/build-module/components/keyboard-shortcut-help-modal/config.mjs +5 -0
- package/build-module/components/keyboard-shortcut-help-modal/config.mjs.map +1 -1
- package/build-module/components/keyboard-shortcut-help-modal/index.mjs +1 -2
- package/build-module/components/keyboard-shortcut-help-modal/index.mjs.map +1 -1
- package/build-module/components/keyboard-shortcut-help-modal/shortcut.mjs +35 -13
- package/build-module/components/keyboard-shortcut-help-modal/shortcut.mjs.map +1 -1
- package/build-module/components/layout/index.mjs +5 -1
- package/build-module/components/layout/index.mjs.map +1 -1
- package/build-module/components/layout/interface.mjs +16 -4
- package/build-module/components/layout/interface.mjs.map +1 -1
- package/build-module/components/layout/unsaved-changes-warning.mjs +3 -6
- package/build-module/components/layout/unsaved-changes-warning.mjs.map +1 -1
- package/build-module/components/more-menu/index.mjs +4 -2
- package/build-module/components/more-menu/index.mjs.map +1 -1
- package/build-module/components/sidebar/index.mjs +14 -8
- package/build-module/components/sidebar/index.mjs.map +1 -1
- package/build-module/components/welcome-guide/index.mjs +5 -1
- package/build-module/components/welcome-guide/index.mjs.map +1 -1
- package/build-module/constants.mjs +1 -2
- package/build-module/constants.mjs.map +1 -1
- package/build-module/index.mjs +2 -2
- package/build-module/index.mjs.map +1 -1
- package/build-module/store/actions.mjs +20 -9
- package/build-module/store/actions.mjs.map +1 -1
- package/build-module/store/selectors.mjs +3 -1
- package/build-module/store/selectors.mjs.map +1 -1
- package/build-style/style-rtl.css +72 -46
- package/build-style/style.css +72 -46
- package/build-types/blocks/widget-area/edit/index.d.ts +10 -0
- package/build-types/blocks/widget-area/edit/index.d.ts.map +1 -0
- package/build-types/blocks/widget-area/edit/inner-blocks.d.ts +4 -0
- package/build-types/blocks/widget-area/edit/inner-blocks.d.ts.map +1 -0
- package/build-types/blocks/widget-area/edit/use-is-dragging-within.d.ts +12 -0
- package/build-types/blocks/widget-area/edit/use-is-dragging-within.d.ts.map +1 -0
- package/build-types/blocks/widget-area/index.d.ts +14 -0
- package/build-types/blocks/widget-area/index.d.ts.map +1 -0
- package/build-types/components/error-boundary/index.d.ts +14 -0
- package/build-types/components/error-boundary/index.d.ts.map +1 -0
- package/build-types/components/header/document-tools/index.d.ts +3 -0
- package/build-types/components/header/document-tools/index.d.ts.map +1 -0
- package/build-types/components/header/index.d.ts +3 -0
- package/build-types/components/header/index.d.ts.map +1 -0
- package/build-types/components/header/undo-redo/redo.d.ts +3 -0
- package/build-types/components/header/undo-redo/redo.d.ts.map +1 -0
- package/build-types/components/header/undo-redo/undo.d.ts +3 -0
- package/build-types/components/header/undo-redo/undo.d.ts.map +1 -0
- package/build-types/components/keyboard-shortcut-help-modal/config.d.ts +3 -0
- package/build-types/components/keyboard-shortcut-help-modal/config.d.ts.map +1 -0
- package/build-types/components/keyboard-shortcut-help-modal/dynamic-shortcut.d.ts +5 -0
- package/build-types/components/keyboard-shortcut-help-modal/dynamic-shortcut.d.ts.map +1 -0
- package/build-types/components/keyboard-shortcut-help-modal/index.d.ts +5 -0
- package/build-types/components/keyboard-shortcut-help-modal/index.d.ts.map +1 -0
- package/build-types/components/keyboard-shortcut-help-modal/shortcut.d.ts +25 -0
- package/build-types/components/keyboard-shortcut-help-modal/shortcut.d.ts.map +1 -0
- package/build-types/components/keyboard-shortcuts/index.d.ts +7 -0
- package/build-types/components/keyboard-shortcuts/index.d.ts.map +1 -0
- package/build-types/components/layout/index.d.ts +5 -0
- package/build-types/components/layout/index.d.ts.map +1 -0
- package/build-types/components/layout/interface.d.ts +5 -0
- package/build-types/components/layout/interface.d.ts.map +1 -0
- package/build-types/components/layout/unsaved-changes-warning.d.ts +10 -0
- package/build-types/components/layout/unsaved-changes-warning.d.ts.map +1 -0
- package/build-types/components/more-menu/index.d.ts +2 -0
- package/build-types/components/more-menu/index.d.ts.map +1 -0
- package/build-types/components/more-menu/tools-more-menu-group.d.ts +6 -0
- package/build-types/components/more-menu/tools-more-menu-group.d.ts.map +1 -0
- package/build-types/components/notices/index.d.ts +3 -0
- package/build-types/components/notices/index.d.ts.map +1 -0
- package/build-types/components/save-button/index.d.ts +3 -0
- package/build-types/components/save-button/index.d.ts.map +1 -0
- package/build-types/components/secondary-sidebar/index.d.ts +2 -0
- package/build-types/components/secondary-sidebar/index.d.ts.map +1 -0
- package/build-types/components/secondary-sidebar/inserter-sidebar.d.ts +2 -0
- package/build-types/components/secondary-sidebar/inserter-sidebar.d.ts.map +1 -0
- package/build-types/components/secondary-sidebar/list-view-sidebar.d.ts +2 -0
- package/build-types/components/secondary-sidebar/list-view-sidebar.d.ts.map +1 -0
- package/build-types/components/sidebar/index.d.ts +2 -0
- package/build-types/components/sidebar/index.d.ts.map +1 -0
- package/build-types/components/sidebar/widget-areas.d.ts +4 -0
- package/build-types/components/sidebar/widget-areas.d.ts.map +1 -0
- package/build-types/components/welcome-guide/index.d.ts +2 -0
- package/build-types/components/welcome-guide/index.d.ts.map +1 -0
- package/build-types/components/widget-areas-block-editor-content/index.d.ts +4 -0
- package/build-types/components/widget-areas-block-editor-content/index.d.ts.map +1 -0
- package/build-types/components/widget-areas-block-editor-provider/index.d.ts +6 -0
- package/build-types/components/widget-areas-block-editor-provider/index.d.ts.map +1 -0
- package/build-types/constants.d.ts +2 -0
- package/build-types/constants.d.ts.map +1 -0
- package/build-types/filters/index.d.ts +3 -0
- package/build-types/filters/index.d.ts.map +1 -0
- package/build-types/filters/move-to-widget-area.d.ts +2 -0
- package/build-types/filters/move-to-widget-area.d.ts.map +1 -0
- package/build-types/filters/replace-media-upload.d.ts +2 -0
- package/build-types/filters/replace-media-upload.d.ts.map +1 -0
- package/build-types/hooks/use-last-selected-widget-area.d.ts +9 -0
- package/build-types/hooks/use-last-selected-widget-area.d.ts.map +1 -0
- package/build-types/hooks/use-widget-library-insertion-point.d.ts +3 -0
- package/build-types/hooks/use-widget-library-insertion-point.d.ts.map +1 -0
- package/build-types/index.d.ts +16 -0
- package/build-types/index.d.ts.map +1 -0
- package/build-types/lock-unlock.d.ts +2 -0
- package/build-types/lock-unlock.d.ts.map +1 -0
- package/build-types/store/actions.d.ts +144 -0
- package/build-types/store/actions.d.ts.map +1 -0
- package/build-types/store/constants.d.ts +5 -0
- package/build-types/store/constants.d.ts.map +1 -0
- package/build-types/store/index.d.ts +9 -0
- package/build-types/store/index.d.ts.map +1 -0
- package/build-types/store/private-selectors.d.ts +3 -0
- package/build-types/store/private-selectors.d.ts.map +1 -0
- package/build-types/store/reducer.d.ts +73 -0
- package/build-types/store/reducer.d.ts.map +1 -0
- package/build-types/store/resolvers.d.ts +17 -0
- package/build-types/store/resolvers.d.ts.map +1 -0
- package/build-types/store/selectors.d.ts +159 -0
- package/build-types/store/selectors.d.ts.map +1 -0
- package/build-types/store/transformers.d.ts +16 -0
- package/build-types/store/transformers.d.ts.map +1 -0
- package/build-types/store/utils.d.ts +53 -0
- package/build-types/store/utils.d.ts.map +1 -0
- package/package.json +33 -33
- package/src/components/error-boundary/index.jsx +2 -2
- package/src/components/header/index.jsx +11 -2
- package/src/components/header/style.scss +30 -3
- package/src/components/keyboard-shortcut-help-modal/config.js +3 -0
- package/src/components/keyboard-shortcut-help-modal/index.jsx +0 -2
- package/src/components/keyboard-shortcut-help-modal/shortcut.jsx +44 -29
- package/src/components/keyboard-shortcut-help-modal/style.scss +1 -1
- package/src/components/layout/style.scss +5 -9
- package/src/components/layout/unsaved-changes-warning.js +4 -9
- package/src/components/more-menu/index.jsx +0 -1
- package/src/components/sidebar/index.jsx +1 -1
- package/src/components/sidebar/style.scss +6 -0
- package/src/components/welcome-guide/style.scss +1 -1
- package/src/components/widget-areas-block-editor-content/style.scss +1 -1
- package/src/constants.js +0 -1
- package/src/index.jsx +2 -7
- package/src/store/actions.js +33 -14
- package/src/store/selectors.js +4 -1
- package/src/store/test/actions.jsdom.test.js +275 -0
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
export type Block = import('@wordpress/blocks').Block;
|
|
2
|
+
/**
|
|
3
|
+
* Returns all API widgets.
|
|
4
|
+
*
|
|
5
|
+
* @return {Object[]} API List of widgets.
|
|
6
|
+
*/
|
|
7
|
+
export declare const getWidgets: {
|
|
8
|
+
(): Partial<import("@wordpress/core-data").UnstableBase<any>> | Partial<import("@wordpress/core-data").Block<any>> | Partial<import("@wordpress/core-data").Comment<any>> | Partial<import("@wordpress/core-data").FontCollection<any>> | Partial<import("@wordpress/core-data").GlobalStyles<any>> | Partial<import("@wordpress/core-data").GlobalStylesRevision<any>> | Partial<import("@wordpress/core-data").Icon<any>> | Partial<import("@wordpress/core-data").IconCollection<any>> | Partial<import("@wordpress/core-data").MenuLocation<any>> | Partial<import("@wordpress/core-data").NavMenu<any>> | Partial<import("@wordpress/core-data").NavMenuItem<any>> | Partial<import("@wordpress/core-data").Navigation<any>> | Partial<import("@wordpress/core-data").Plugin<any>> | Partial<import("@wordpress/core-data").PostRevision<any>> | Partial<import("@wordpress/core-data").PostStatusObject<any>> | Partial<import("@wordpress/core-data").Settings<any>> | Partial<import("@wordpress/core-data").Sidebar<any>> | Partial<import("@wordpress/core-data").Taxonomy<any>> | Partial<import("@wordpress/core-data").Term<any>> | Partial<import("@wordpress/core-data").Theme<any>> | Partial<import("@wordpress/core-data").Type<any>> | Partial<import("@wordpress/core-data").User<any>> | Partial<import("@wordpress/core-data").Widget<any>> | Partial<import("@wordpress/core-data").WidgetType<any>> | Partial<import("@wordpress/core-data").WpFontFamily<any>> | Partial<import("@wordpress/core-data").WpTemplate<any>> | Partial<import("@wordpress/core-data").WpTemplatePart<any>> | Partial<import("@wordpress/core-data").OmitNevers<import("@wordpress/core-data").BaseEntityRecords.Attachment<any>> & Record<never, never>>;
|
|
9
|
+
isRegistrySelector?: boolean;
|
|
10
|
+
registry?: any;
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* Returns API widget data for a particular widget ID.
|
|
14
|
+
*
|
|
15
|
+
* @param {number} id Widget ID.
|
|
16
|
+
*
|
|
17
|
+
* @return {Object} API widget data for a particular widget ID.
|
|
18
|
+
*/
|
|
19
|
+
export declare const getWidget: {
|
|
20
|
+
(state: any, id: any): any;
|
|
21
|
+
isRegistrySelector?: boolean;
|
|
22
|
+
registry?: any;
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* Returns all API widget areas.
|
|
26
|
+
*
|
|
27
|
+
* @return {Object[]} API List of widget areas.
|
|
28
|
+
*/
|
|
29
|
+
export declare const getWidgetAreas: {
|
|
30
|
+
(): (import("@wordpress/core-data").UnstableBase<any> | import("@wordpress/core-data").Block<any> | import("@wordpress/core-data").Comment<any> | import("@wordpress/core-data").FontCollection<any> | import("@wordpress/core-data").GlobalStyles<any> | import("@wordpress/core-data").GlobalStylesRevision<any> | import("@wordpress/core-data").Icon<any> | import("@wordpress/core-data").IconCollection<any> | import("@wordpress/core-data").MenuLocation<any> | import("@wordpress/core-data").NavMenu<any> | import("@wordpress/core-data").NavMenuItem<any> | import("@wordpress/core-data").Navigation<any> | import("@wordpress/core-data").Page<any> | import("@wordpress/core-data").Plugin<any> | import("@wordpress/core-data").Post<any> | import("@wordpress/core-data").PostRevision<any> | import("@wordpress/core-data").PostStatusObject<any> | import("@wordpress/core-data").Settings<any> | import("@wordpress/core-data").Sidebar<any> | import("@wordpress/core-data").Taxonomy<any> | import("@wordpress/core-data").Term<any> | import("@wordpress/core-data").Theme<any> | import("@wordpress/core-data").Type<any> | import("@wordpress/core-data").User<any> | import("@wordpress/core-data").Widget<any> | import("@wordpress/core-data").WidgetType<any> | import("@wordpress/core-data").WpFontFamily<any> | import("@wordpress/core-data").WpTemplate<any> | import("@wordpress/core-data").WpTemplatePart<any> | import("@wordpress/core-data").Attachment<any> | Partial<import("@wordpress/core-data").UnstableBase<any> | import("@wordpress/core-data").Block<any> | import("@wordpress/core-data").Comment<any> | import("@wordpress/core-data").FontCollection<any> | import("@wordpress/core-data").GlobalStyles<any> | import("@wordpress/core-data").GlobalStylesRevision<any> | import("@wordpress/core-data").Icon<any> | import("@wordpress/core-data").IconCollection<any> | import("@wordpress/core-data").MenuLocation<any> | import("@wordpress/core-data").NavMenu<any> | import("@wordpress/core-data").NavMenuItem<any> | import("@wordpress/core-data").Navigation<any> | import("@wordpress/core-data").Page<any> | import("@wordpress/core-data").Plugin<any> | import("@wordpress/core-data").Post<any> | import("@wordpress/core-data").PostRevision<any> | import("@wordpress/core-data").PostStatusObject<any> | import("@wordpress/core-data").Settings<any> | import("@wordpress/core-data").Sidebar<any> | import("@wordpress/core-data").Taxonomy<any> | import("@wordpress/core-data").Term<any> | import("@wordpress/core-data").Theme<any> | import("@wordpress/core-data").Type<any> | import("@wordpress/core-data").User<any> | import("@wordpress/core-data").Widget<any> | import("@wordpress/core-data").WidgetType<any> | import("@wordpress/core-data").WpFontFamily<any> | import("@wordpress/core-data").WpTemplate<any> | import("@wordpress/core-data").WpTemplatePart<any> | import("@wordpress/core-data").Attachment<any>>)[] | null;
|
|
31
|
+
isRegistrySelector?: boolean;
|
|
32
|
+
registry?: any;
|
|
33
|
+
};
|
|
34
|
+
/**
|
|
35
|
+
* Returns widgetArea containing a block identify by given widgetId
|
|
36
|
+
*
|
|
37
|
+
* @param {string} widgetId The ID of the widget.
|
|
38
|
+
* @return {Object} Containing widget area.
|
|
39
|
+
*/
|
|
40
|
+
export declare const getWidgetAreaForWidgetId: {
|
|
41
|
+
(state: any, widgetId: any): any;
|
|
42
|
+
isRegistrySelector?: boolean;
|
|
43
|
+
registry?: any;
|
|
44
|
+
};
|
|
45
|
+
/**
|
|
46
|
+
* Given a child client id, returns the parent widget area block.
|
|
47
|
+
*
|
|
48
|
+
* @param {string} clientId The client id of a block in a widget area.
|
|
49
|
+
*
|
|
50
|
+
* @return {Block | null} The widget area block.
|
|
51
|
+
* @type {(state: Record<string, unknown>, clientId: string) => Block | null}
|
|
52
|
+
*/
|
|
53
|
+
export declare const getParentWidgetAreaBlock: (state: Record<string, unknown>, clientId: string) => Block | null;
|
|
54
|
+
/**
|
|
55
|
+
* Returns all edited widget area entity records.
|
|
56
|
+
*
|
|
57
|
+
* @return {Object[]} List of edited widget area entity records.
|
|
58
|
+
*/
|
|
59
|
+
export declare const getEditedWidgetAreas: {
|
|
60
|
+
(state: any, ids: any): any;
|
|
61
|
+
isRegistrySelector?: boolean;
|
|
62
|
+
registry?: any;
|
|
63
|
+
};
|
|
64
|
+
/**
|
|
65
|
+
* Returns all blocks representing reference widgets.
|
|
66
|
+
*
|
|
67
|
+
* @param {string} referenceWidgetName Optional. If given, only reference widgets with this name will be returned.
|
|
68
|
+
* @return {Array} List of all blocks representing reference widgets
|
|
69
|
+
*/
|
|
70
|
+
export declare const getReferenceWidgetBlocks: {
|
|
71
|
+
(state: any, referenceWidgetName?: any): any[];
|
|
72
|
+
isRegistrySelector?: boolean;
|
|
73
|
+
registry?: any;
|
|
74
|
+
};
|
|
75
|
+
/**
|
|
76
|
+
* Returns true if any widget area is currently being saved.
|
|
77
|
+
*
|
|
78
|
+
* @return {boolean} True if any widget area is currently being saved. False otherwise.
|
|
79
|
+
*/
|
|
80
|
+
export declare const isSavingWidgetAreas: {
|
|
81
|
+
(): boolean;
|
|
82
|
+
isRegistrySelector?: boolean;
|
|
83
|
+
registry?: any;
|
|
84
|
+
};
|
|
85
|
+
/**
|
|
86
|
+
* Gets whether the widget area is opened.
|
|
87
|
+
*
|
|
88
|
+
* @param {Array} state The open state of the widget areas.
|
|
89
|
+
* @param {string} clientId The clientId of the widget area.
|
|
90
|
+
*
|
|
91
|
+
* @return {boolean} True if the widget area is open.
|
|
92
|
+
*/
|
|
93
|
+
export declare const getIsWidgetAreaOpen: (state: any[], clientId: string) => boolean;
|
|
94
|
+
/**
|
|
95
|
+
* Returns true if the inserter is opened.
|
|
96
|
+
*
|
|
97
|
+
* @param {Object} state Global application state.
|
|
98
|
+
*
|
|
99
|
+
* @return {boolean} Whether the inserter is opened.
|
|
100
|
+
*/
|
|
101
|
+
export declare function isInserterOpened(state: Object): boolean;
|
|
102
|
+
/**
|
|
103
|
+
* Get the insertion point for the inserter.
|
|
104
|
+
*
|
|
105
|
+
* @param {Object} state Global application state.
|
|
106
|
+
*
|
|
107
|
+
* @return {Object} The root client ID and index to insert at.
|
|
108
|
+
*/
|
|
109
|
+
export declare function __experimentalGetInsertionPoint(state: Object): Object;
|
|
110
|
+
/**
|
|
111
|
+
* Returns true if a block can be inserted into a widget area.
|
|
112
|
+
*
|
|
113
|
+
* @param {Array} state The open state of the widget areas.
|
|
114
|
+
* @param {string} blockName The name of the block being inserted.
|
|
115
|
+
*
|
|
116
|
+
* @return {boolean} True if the block can be inserted in a widget area.
|
|
117
|
+
*/
|
|
118
|
+
export declare const canInsertBlockInWidgetArea: {
|
|
119
|
+
(state: any, blockName: any): boolean;
|
|
120
|
+
isRegistrySelector?: boolean;
|
|
121
|
+
registry?: any;
|
|
122
|
+
};
|
|
123
|
+
/**
|
|
124
|
+
* Returns true if the list view is opened.
|
|
125
|
+
*
|
|
126
|
+
* @param {Object} state Global application state.
|
|
127
|
+
*
|
|
128
|
+
* @return {boolean} Whether the list view is opened.
|
|
129
|
+
*/
|
|
130
|
+
export declare function isListViewOpened(state: Object): boolean;
|
|
131
|
+
/**
|
|
132
|
+
* Returns whether widget saving is locked.
|
|
133
|
+
*
|
|
134
|
+
* @param {Object} state Global application state.
|
|
135
|
+
*
|
|
136
|
+
* @example
|
|
137
|
+
* ```jsx
|
|
138
|
+
* import { __ } from '@wordpress/i18n';
|
|
139
|
+
* import { store as widgetStore } from '@wordpress/edit-widgets';
|
|
140
|
+
* import { useSelect } from '@wordpress/data';
|
|
141
|
+
*
|
|
142
|
+
* const ExampleComponent = () => {
|
|
143
|
+
* const isSavingLocked = useSelect(
|
|
144
|
+
* ( select ) => select( widgetStore ).isWidgetSavingLocked(),
|
|
145
|
+
* []
|
|
146
|
+
* );
|
|
147
|
+
*
|
|
148
|
+
* return isSavingLocked ? (
|
|
149
|
+
* <p>{ __( 'Widget saving is locked' ) }</p>
|
|
150
|
+
* ) : (
|
|
151
|
+
* <p>{ __( 'Widget saving is not locked' ) }</p>
|
|
152
|
+
* );
|
|
153
|
+
* };
|
|
154
|
+
* ```
|
|
155
|
+
*
|
|
156
|
+
* @return {boolean} Is locked.
|
|
157
|
+
*/
|
|
158
|
+
export declare function isWidgetSavingLocked(state: Object): boolean;
|
|
159
|
+
//# sourceMappingURL=selectors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"selectors.d.ts","sourceRoot":"","sources":["../../src/store/selectors.js"],"names":[],"mappings":"AAcI,YAA6C,KAAK,GAAxC,OAAO,mBAAmB,EAAE,KAAK,CAAO;AAOtD;;;;GAIG;AACH,eAAO,MAAM,UAAU;;;;CA4BtB,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,SAAS;;;;CAKrB,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,cAAc;;;;CAOxB,CAAC;AAEJ;;;;;GAKG;AACH,eAAO,MAAM,wBAAwB;;;;CAepC,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,wBAAwB,EAF3B,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,QAAQ,EAAE,MAAM,KAAK,KAAK,GAAG,IAavE,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,oBAAoB;;;;CA2BhC,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,wBAAwB;;;;CAwBpC,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,mBAAmB;;;;CAmC7B,CAAC;AAEJ;;;;;;;GAOG;AACH,eAAO,MAAM,mBAAmB,2BAJrB,MAAM,KAEL,OAKX,CAAC;AAEF;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAE,KAAK,EAJ5B,MAI4B,GAF3B,OAAO,CAIlB;AAED;;;;;;GAMG;AACH,wBAAgB,+BAA+B,CAAE,KAAK,EAJ3C,MAI2C,GAF1C,MAAM,CAQjB;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,0BAA0B;;;;CAkBtC,CAAC;AAEF;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAE,KAAK,EAJ5B,MAI4B,GAF3B,OAAO,CAIlB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,wBAAgB,oBAAoB,CAAE,KAAK,EAxBhC,MAwBgC,GAF/B,OAAO,CAIlB"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Converts a widget entity record into a block.
|
|
3
|
+
*
|
|
4
|
+
* @param {Object} widget The widget entity record.
|
|
5
|
+
* @return {Object} a block (converted from the entity record).
|
|
6
|
+
*/
|
|
7
|
+
export declare function transformWidgetToBlock(widget: Object): Object;
|
|
8
|
+
/**
|
|
9
|
+
* Converts a block to a widget entity record.
|
|
10
|
+
*
|
|
11
|
+
* @param {Object} block The block.
|
|
12
|
+
* @param {?Object} relatedWidget A related widget entity record from the API (optional).
|
|
13
|
+
* @return {Object} the widget object (converted from block).
|
|
14
|
+
*/
|
|
15
|
+
export declare function transformBlockToWidget(block: Object, relatedWidget?: Object | null): Object;
|
|
16
|
+
//# sourceMappingURL=transformers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transformers.d.ts","sourceRoot":"","sources":["../../src/store/transformers.js"],"names":[],"mappings":"AAGA;;;;;GAKG;AACH,wBAAgB,sBAAsB,CAAE,MAAM,EAHnC,MAGmC,GAFlC,MAAM,CAgCjB;AAED;;;;;;GAMG;AACH,wBAAgB,sBAAsB,CAAE,KAAK,EAJlC,MAIkC,EAAE,aAAa,GAHhD,MAAM,OAG+C,GAFrD,MAAM,CAiCjB"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* "Kind" of the navigation post.
|
|
3
|
+
*
|
|
4
|
+
* @type {string}
|
|
5
|
+
*/
|
|
6
|
+
export declare const KIND: string;
|
|
7
|
+
/**
|
|
8
|
+
* "post type" of the navigation post.
|
|
9
|
+
*
|
|
10
|
+
* @type {string}
|
|
11
|
+
*/
|
|
12
|
+
export declare const WIDGET_AREA_ENTITY_TYPE: string;
|
|
13
|
+
/**
|
|
14
|
+
* "post type" of the widget area post.
|
|
15
|
+
*
|
|
16
|
+
* @type {string}
|
|
17
|
+
*/
|
|
18
|
+
export declare const POST_TYPE: string;
|
|
19
|
+
/**
|
|
20
|
+
* Builds an ID for a new widget area post.
|
|
21
|
+
*
|
|
22
|
+
* @param {number} widgetAreaId Widget area id.
|
|
23
|
+
* @return {string} An ID.
|
|
24
|
+
*/
|
|
25
|
+
export declare const buildWidgetAreaPostId: (widgetAreaId: number) => string;
|
|
26
|
+
/**
|
|
27
|
+
* Builds an ID for a global widget areas post.
|
|
28
|
+
*
|
|
29
|
+
* @return {string} An ID.
|
|
30
|
+
*/
|
|
31
|
+
export declare const buildWidgetAreasPostId: () => string;
|
|
32
|
+
/**
|
|
33
|
+
* Builds a query to resolve sidebars.
|
|
34
|
+
*
|
|
35
|
+
* @return {Object} Query.
|
|
36
|
+
*/
|
|
37
|
+
export declare function buildWidgetAreasQuery(): Object;
|
|
38
|
+
/**
|
|
39
|
+
* Builds a query to resolve widgets.
|
|
40
|
+
*
|
|
41
|
+
* @return {Object} Query.
|
|
42
|
+
*/
|
|
43
|
+
export declare function buildWidgetsQuery(): Object;
|
|
44
|
+
/**
|
|
45
|
+
* Creates a stub post with given id and set of blocks. Used as a governing entity records
|
|
46
|
+
* for all widget areas.
|
|
47
|
+
*
|
|
48
|
+
* @param {string} id Post ID.
|
|
49
|
+
* @param {Array} blocks The list of blocks.
|
|
50
|
+
* @return {Object} A stub post object formatted in compliance with the data layer.
|
|
51
|
+
*/
|
|
52
|
+
export declare const createStubPost: (id: string, blocks: any[]) => Object;
|
|
53
|
+
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/store/utils.js"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,eAAO,MAAM,IAAI,EAFP,MAEgB,CAAC;AAE3B;;;;GAIG;AACH,eAAO,MAAM,uBAAuB,EAF1B,MAEsC,CAAC;AAEjD;;;;GAIG;AACH,eAAO,MAAM,SAAS,EAFZ,MAEyB,CAAC;AAEpC;;;;;GAKG;AACH,eAAO,MAAM,qBAAqB,iBAHvB,MAAM,KACL,MAGoB,CAAC;AAEjC;;;;GAIG;AACH,eAAO,MAAM,sBAAsB,QAFvB,MAE8C,CAAC;AAE3D;;;;GAIG;AACH,wBAAgB,qBAAqB,IAFzB,MAAM,CAMjB;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,IAFrB,MAAM,CAOjB;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,cAAc,OAJhB,MAAM,oBAEL,MAWT,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wordpress/edit-widgets",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.3.0",
|
|
4
4
|
"description": "Widgets Page module for WordPress..",
|
|
5
5
|
"author": "The WordPress Contributors",
|
|
6
6
|
"license": "GPL-2.0-or-later",
|
|
@@ -45,43 +45,43 @@
|
|
|
45
45
|
]
|
|
46
46
|
},
|
|
47
47
|
"dependencies": {
|
|
48
|
-
"@wordpress/a11y": "^5.
|
|
49
|
-
"@wordpress/admin-ui": "^3.
|
|
50
|
-
"@wordpress/api-fetch": "^8.
|
|
51
|
-
"@wordpress/base-styles": "^15.
|
|
52
|
-
"@wordpress/block-editor": "^20.
|
|
53
|
-
"@wordpress/block-library": "^12.
|
|
54
|
-
"@wordpress/blocks": "^17.
|
|
55
|
-
"@wordpress/components": "^
|
|
56
|
-
"@wordpress/compose": "^9.
|
|
57
|
-
"@wordpress/core-data": "^9.
|
|
58
|
-
"@wordpress/data": "^11.
|
|
59
|
-
"@wordpress/deprecated": "^5.
|
|
60
|
-
"@wordpress/dom": "^5.
|
|
61
|
-
"@wordpress/element": "^10.
|
|
62
|
-
"@wordpress/hooks": "^5.
|
|
63
|
-
"@wordpress/i18n": "^7.
|
|
64
|
-
"@wordpress/icons": "^
|
|
65
|
-
"@wordpress/interface": "^11.
|
|
66
|
-
"@wordpress/keyboard-shortcuts": "^6.
|
|
67
|
-
"@wordpress/keycodes": "^5.
|
|
68
|
-
"@wordpress/media-utils": "^6.
|
|
69
|
-
"@wordpress/notices": "^6.
|
|
70
|
-
"@wordpress/patterns": "^3.
|
|
71
|
-
"@wordpress/plugins": "^8.
|
|
72
|
-
"@wordpress/preferences": "^5.
|
|
73
|
-
"@wordpress/private-apis": "^3.
|
|
74
|
-
"@wordpress/theme": "^
|
|
75
|
-
"@wordpress/ui": "^0.
|
|
76
|
-
"@wordpress/url": "^5.
|
|
77
|
-
"@wordpress/widgets": "^5.
|
|
48
|
+
"@wordpress/a11y": "^5.3.0",
|
|
49
|
+
"@wordpress/admin-ui": "^3.3.0",
|
|
50
|
+
"@wordpress/api-fetch": "^8.3.0",
|
|
51
|
+
"@wordpress/base-styles": "^15.2.0",
|
|
52
|
+
"@wordpress/block-editor": "^20.2.0",
|
|
53
|
+
"@wordpress/block-library": "^12.3.0",
|
|
54
|
+
"@wordpress/blocks": "^17.3.0",
|
|
55
|
+
"@wordpress/components": "^45.1.0",
|
|
56
|
+
"@wordpress/compose": "^9.3.0",
|
|
57
|
+
"@wordpress/core-data": "^9.3.0",
|
|
58
|
+
"@wordpress/data": "^11.3.0",
|
|
59
|
+
"@wordpress/deprecated": "^5.3.0",
|
|
60
|
+
"@wordpress/dom": "^5.3.0",
|
|
61
|
+
"@wordpress/element": "^10.3.0",
|
|
62
|
+
"@wordpress/hooks": "^5.3.0",
|
|
63
|
+
"@wordpress/i18n": "^7.3.0",
|
|
64
|
+
"@wordpress/icons": "^21.1.0",
|
|
65
|
+
"@wordpress/interface": "^11.3.0",
|
|
66
|
+
"@wordpress/keyboard-shortcuts": "^6.3.0",
|
|
67
|
+
"@wordpress/keycodes": "^5.3.0",
|
|
68
|
+
"@wordpress/media-utils": "^6.3.0",
|
|
69
|
+
"@wordpress/notices": "^6.3.0",
|
|
70
|
+
"@wordpress/patterns": "^3.3.0",
|
|
71
|
+
"@wordpress/plugins": "^8.3.0",
|
|
72
|
+
"@wordpress/preferences": "^5.3.0",
|
|
73
|
+
"@wordpress/private-apis": "^3.3.0",
|
|
74
|
+
"@wordpress/theme": "^5.1.0",
|
|
75
|
+
"@wordpress/ui": "^0.28.0",
|
|
76
|
+
"@wordpress/url": "^5.3.0",
|
|
77
|
+
"@wordpress/widgets": "^5.3.0",
|
|
78
78
|
"clsx": "^2.1.1"
|
|
79
79
|
},
|
|
80
80
|
"devDependencies": {
|
|
81
81
|
"@testing-library/dom": "^10.4.2",
|
|
82
82
|
"@testing-library/react": "^16.3.3",
|
|
83
83
|
"deep-freeze": "^0.0.1",
|
|
84
|
-
"vitest": "^5.
|
|
84
|
+
"vitest": "^5.1.1"
|
|
85
85
|
},
|
|
86
86
|
"peerDependencies": {
|
|
87
87
|
"react": "^18 || ^19",
|
|
@@ -90,5 +90,5 @@
|
|
|
90
90
|
"publishConfig": {
|
|
91
91
|
"access": "public"
|
|
92
92
|
},
|
|
93
|
-
"gitHead": "
|
|
93
|
+
"gitHead": "7f19202f61aeba8f4bdce892a1a0df485ad76e2b"
|
|
94
94
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Component } from '@wordpress/element';
|
|
2
2
|
import { speak } from '@wordpress/a11y';
|
|
3
|
-
import { __ } from '@wordpress/i18n';
|
|
3
|
+
import { __, _x } from '@wordpress/i18n';
|
|
4
4
|
import { Card, CollapsibleCard, Notice, Stack, Text } from '@wordpress/ui';
|
|
5
5
|
import { useCopyToClipboard } from '@wordpress/compose';
|
|
6
6
|
import { doAction } from '@wordpress/hooks';
|
|
@@ -168,7 +168,7 @@ export default class ErrorBoundary extends Component {
|
|
|
168
168
|
getErrorReport( error, componentStack )
|
|
169
169
|
}
|
|
170
170
|
>
|
|
171
|
-
{
|
|
171
|
+
{ _x( 'Copy error', 'button label' ) }
|
|
172
172
|
</CopyButton>
|
|
173
173
|
</Notice.Actions>
|
|
174
174
|
</Notice.Root>
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import clsx from 'clsx';
|
|
1
2
|
import { BlockToolbar } from '@wordpress/block-editor';
|
|
2
3
|
import { useSelect } from '@wordpress/data';
|
|
3
4
|
import { useRef } from '@wordpress/element';
|
|
@@ -14,19 +15,27 @@ import MoreMenu from '../more-menu';
|
|
|
14
15
|
function Header() {
|
|
15
16
|
const isLargeViewport = useViewportMatch( 'medium' );
|
|
16
17
|
const blockToolbarRef = useRef();
|
|
17
|
-
const { hasFixedToolbar } = useSelect(
|
|
18
|
+
const { hasFixedToolbar, showIconLabels } = useSelect(
|
|
18
19
|
( select ) => ( {
|
|
19
20
|
hasFixedToolbar: !! select( preferencesStore ).get(
|
|
20
21
|
'core/edit-widgets',
|
|
21
22
|
'fixedToolbar'
|
|
22
23
|
),
|
|
24
|
+
showIconLabels: select( preferencesStore ).get(
|
|
25
|
+
'core',
|
|
26
|
+
'showIconLabels'
|
|
27
|
+
),
|
|
23
28
|
} ),
|
|
24
29
|
[]
|
|
25
30
|
);
|
|
26
31
|
|
|
27
32
|
return (
|
|
28
33
|
<>
|
|
29
|
-
<div
|
|
34
|
+
<div
|
|
35
|
+
className={ clsx( 'edit-widgets-header', {
|
|
36
|
+
'has-icon-labels': showIconLabels,
|
|
37
|
+
} ) }
|
|
38
|
+
>
|
|
30
39
|
<div className="edit-widgets-header__navigable-toolbar-wrapper">
|
|
31
40
|
{ isLargeViewport && (
|
|
32
41
|
<h1 className="edit-widgets-header__title">
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
justify-content: space-between;
|
|
10
10
|
height: $header-height;
|
|
11
11
|
overflow: auto;
|
|
12
|
-
background:
|
|
12
|
+
background: var(--wpds-color-background-surface-neutral-strong);
|
|
13
13
|
|
|
14
14
|
@include break-small {
|
|
15
15
|
overflow: visible;
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
content: "";
|
|
50
50
|
width: $border-width;
|
|
51
51
|
height: $grid-unit-30;
|
|
52
|
-
background-color:
|
|
52
|
+
background-color: var(--wpds-color-stroke-surface-neutral);
|
|
53
53
|
margin-top: $grid-unit-05;
|
|
54
54
|
margin-left: $grid-unit;
|
|
55
55
|
}
|
|
@@ -108,6 +108,20 @@
|
|
|
108
108
|
gap: $grid-unit-10;
|
|
109
109
|
}
|
|
110
110
|
|
|
111
|
+
// With "Show button text labels" on, pinned items show their label (the aria-label) in place of the icon.
|
|
112
|
+
.edit-widgets-header.has-icon-labels .interface-pinned-items .components-button.has-icon {
|
|
113
|
+
padding: 0 $grid-unit-15;
|
|
114
|
+
|
|
115
|
+
svg {
|
|
116
|
+
display: none;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
&::after {
|
|
120
|
+
content: attr(aria-label);
|
|
121
|
+
white-space: nowrap;
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
|
|
111
125
|
.edit-widgets-header-toolbar {
|
|
112
126
|
gap: $grid-unit-10;
|
|
113
127
|
// Some plugins add buttons here despite best practices.
|
|
@@ -124,7 +138,20 @@
|
|
|
124
138
|
padding: 4px;
|
|
125
139
|
|
|
126
140
|
&.is-pressed {
|
|
127
|
-
background:
|
|
141
|
+
background: var(--wpds-color-background-interactive-neutral-strong-active);
|
|
142
|
+
|
|
143
|
+
&:is(:disabled, [aria-disabled="true"]) {
|
|
144
|
+
background: var(--wpds-color-background-interactive-neutral-strong-disabled);
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
@media (forced-colors: active) {
|
|
148
|
+
background: Highlight !important;
|
|
149
|
+
|
|
150
|
+
&:disabled,
|
|
151
|
+
&[aria-disabled="true"] {
|
|
152
|
+
background: GrayText !important;
|
|
153
|
+
}
|
|
154
|
+
}
|
|
128
155
|
}
|
|
129
156
|
|
|
130
157
|
&:focus:not(:active) {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { __ } from '@wordpress/i18n';
|
|
2
2
|
|
|
3
|
+
/** @type {Array<import('react').ComponentProps<typeof import('./shortcut').default>>} */
|
|
3
4
|
export const textFormattingShortcuts = [
|
|
4
5
|
{
|
|
5
6
|
keyCombination: { modifier: 'primary', character: 'b' },
|
|
@@ -19,6 +20,8 @@ export const textFormattingShortcuts = [
|
|
|
19
20
|
},
|
|
20
21
|
{
|
|
21
22
|
keyCombination: { character: '[[' },
|
|
23
|
+
/* translators: The keyboard sequence [[, pressing the left bracket key twice. */
|
|
24
|
+
ariaLabel: __( 'Left bracket twice' ),
|
|
22
25
|
description: __( 'Insert a link to a post or page.' ),
|
|
23
26
|
},
|
|
24
27
|
{
|
|
@@ -115,8 +115,6 @@ export default function KeyboardShortcutHelpModal( {
|
|
|
115
115
|
description: __(
|
|
116
116
|
'Change the block type after adding a new paragraph.'
|
|
117
117
|
),
|
|
118
|
-
/* translators: The forward-slash character. e.g. '/'. */
|
|
119
|
-
ariaLabel: __( 'Forward-slash' ),
|
|
120
118
|
},
|
|
121
119
|
] }
|
|
122
120
|
/>
|
|
@@ -1,42 +1,57 @@
|
|
|
1
1
|
import { Fragment } from '@wordpress/element';
|
|
2
2
|
import { displayShortcutList, shortcutAriaLabel } from '@wordpress/keycodes';
|
|
3
|
+
import { VisuallyHidden } from '@wordpress/ui';
|
|
3
4
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
5
|
+
/**
|
|
6
|
+
* @typedef {Object} ShortcutKeyCombination
|
|
7
|
+
* @property {string} character Shortcut key.
|
|
8
|
+
* @property {import('@wordpress/keycodes').WPKeycodeModifier | null} [modifier] Optional shortcut modifier.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* @param {Object} props Component props.
|
|
13
|
+
* @param {ShortcutKeyCombination} props.keyCombination Shortcut to display.
|
|
14
|
+
* @param {string} [props.ariaLabel] Custom readable shortcut label.
|
|
15
|
+
*/
|
|
16
|
+
function KeyCombination( { keyCombination, ariaLabel } ) {
|
|
17
|
+
const { character, modifier } = keyCombination;
|
|
18
|
+
const normalizedModifier = modifier ?? 'undefined';
|
|
19
|
+
const keys = displayShortcutList[ normalizedModifier ]( character );
|
|
16
20
|
|
|
17
21
|
return (
|
|
18
22
|
<kbd
|
|
19
23
|
className="edit-widgets-keyboard-shortcut-help-modal__shortcut-key-combination"
|
|
20
|
-
|
|
24
|
+
dir="ltr"
|
|
21
25
|
>
|
|
22
|
-
{
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
<
|
|
29
|
-
key={ index }
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
26
|
+
<VisuallyHidden render={ <span /> }>
|
|
27
|
+
{ ariaLabel ||
|
|
28
|
+
shortcutAriaLabel[ normalizedModifier ]( character ) }
|
|
29
|
+
</VisuallyHidden>
|
|
30
|
+
<span aria-hidden="true">
|
|
31
|
+
{ keys.map( ( key, index ) =>
|
|
32
|
+
key === '+' && index < keys.length - 1 ? (
|
|
33
|
+
<Fragment key={ index }>{ key }</Fragment>
|
|
34
|
+
) : (
|
|
35
|
+
<kbd
|
|
36
|
+
key={ index }
|
|
37
|
+
className="edit-widgets-keyboard-shortcut-help-modal__shortcut-key"
|
|
38
|
+
>
|
|
39
|
+
{ key }
|
|
40
|
+
</kbd>
|
|
41
|
+
)
|
|
42
|
+
) }
|
|
43
|
+
</span>
|
|
36
44
|
</kbd>
|
|
37
45
|
);
|
|
38
46
|
}
|
|
39
47
|
|
|
48
|
+
/**
|
|
49
|
+
* @param {Object} props Component props.
|
|
50
|
+
* @param {string} props.description Description of the shortcut action.
|
|
51
|
+
* @param {ShortcutKeyCombination} props.keyCombination Primary shortcut.
|
|
52
|
+
* @param {ShortcutKeyCombination[]} [props.aliases] Alternative shortcuts.
|
|
53
|
+
* @param {string} [props.ariaLabel] Custom readable shortcut label.
|
|
54
|
+
*/
|
|
40
55
|
function Shortcut( { description, keyCombination, aliases = [], ariaLabel } ) {
|
|
41
56
|
return (
|
|
42
57
|
<>
|
|
@@ -46,12 +61,12 @@ function Shortcut( { description, keyCombination, aliases = [], ariaLabel } ) {
|
|
|
46
61
|
<div className="edit-widgets-keyboard-shortcut-help-modal__shortcut-term">
|
|
47
62
|
<KeyCombination
|
|
48
63
|
keyCombination={ keyCombination }
|
|
49
|
-
|
|
64
|
+
ariaLabel={ ariaLabel }
|
|
50
65
|
/>
|
|
51
66
|
{ aliases.map( ( alias, index ) => (
|
|
52
67
|
<KeyCombination
|
|
53
68
|
keyCombination={ alias }
|
|
54
|
-
|
|
69
|
+
ariaLabel={ ariaLabel }
|
|
55
70
|
key={ index }
|
|
56
71
|
/>
|
|
57
72
|
) ) }
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
@use "@wordpress/base-styles/mixins" as *;
|
|
2
1
|
@use "@wordpress/base-styles/variables" as *;
|
|
3
2
|
|
|
4
3
|
.edit-widgets-layout__footer {
|
|
@@ -22,14 +21,11 @@
|
|
|
22
21
|
}
|
|
23
22
|
|
|
24
23
|
.edit-widgets-layout__inserter-panel-content {
|
|
25
|
-
|
|
26
|
-
height: calc(100% - #{$button-size} - #{$grid-unit-10});
|
|
27
|
-
|
|
28
|
-
.block-editor-inserter__tablist-and-close {
|
|
29
|
-
display: none;
|
|
30
|
-
}
|
|
24
|
+
height: 100%;
|
|
31
25
|
|
|
32
|
-
|
|
33
|
-
|
|
26
|
+
.block-editor-inserter__menu.has-single-tab {
|
|
27
|
+
.block-editor-tabbed-sidebar__tablist-and-close-button {
|
|
28
|
+
display: none;
|
|
29
|
+
}
|
|
34
30
|
}
|
|
35
31
|
}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { __ } from '@wordpress/i18n';
|
|
2
1
|
import { useEffect } from '@wordpress/element';
|
|
3
2
|
import { useSelect } from '@wordpress/data';
|
|
4
3
|
import { store as editWidgetsStore } from '../../store';
|
|
@@ -23,21 +22,17 @@ export default function UnsavedChangesWarning() {
|
|
|
23
22
|
/**
|
|
24
23
|
* Warns the user if there are unsaved changes before leaving the editor.
|
|
25
24
|
*
|
|
26
|
-
* @param {
|
|
27
|
-
*
|
|
28
|
-
* @return {string | undefined} Warning prompt message, if unsaved changes exist.
|
|
25
|
+
* @param {BeforeUnloadEvent} event `beforeunload` event.
|
|
29
26
|
*/
|
|
30
27
|
const warnIfUnsavedChanges = ( event ) => {
|
|
31
28
|
if ( isDirty ) {
|
|
32
|
-
event.
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
return event.returnValue;
|
|
29
|
+
event.preventDefault();
|
|
30
|
+
// Chrome before 119 ignores `preventDefault()`.
|
|
31
|
+
event.returnValue = true;
|
|
36
32
|
}
|
|
37
33
|
};
|
|
38
34
|
|
|
39
35
|
window.addEventListener( 'beforeunload', warnIfUnsavedChanges );
|
|
40
|
-
|
|
41
36
|
return () => {
|
|
42
37
|
window.removeEventListener( 'beforeunload', warnIfUnsavedChanges );
|
|
43
38
|
};
|