@wordpress/edit-site 5.4.0 → 5.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +2 -0
- package/build/components/add-new-template/add-custom-template-modal.js +12 -3
- package/build/components/add-new-template/add-custom-template-modal.js.map +1 -1
- package/build/components/add-new-template/new-template-part.js +8 -7
- package/build/components/add-new-template/new-template-part.js.map +1 -1
- package/build/components/add-new-template/new-template.js +3 -6
- package/build/components/add-new-template/new-template.js.map +1 -1
- package/build/components/editor/index.js +3 -3
- package/build/components/editor/index.js.map +1 -1
- package/build/components/global-styles/border-panel.js +1 -1
- package/build/components/global-styles/border-panel.js.map +1 -1
- package/build/components/global-styles/context-menu.js +11 -8
- package/build/components/global-styles/context-menu.js.map +1 -1
- package/build/components/global-styles/dimensions-panel.js +41 -487
- package/build/components/global-styles/dimensions-panel.js.map +1 -1
- package/build/components/global-styles/duotone-panel.js +78 -0
- package/build/components/global-styles/duotone-panel.js.map +1 -0
- package/build/components/global-styles/filter-utils.js +17 -0
- package/build/components/global-styles/filter-utils.js.map +1 -0
- package/build/components/global-styles/preview.js +9 -5
- package/build/components/global-styles/preview.js.map +1 -1
- package/build/components/global-styles/screen-block-list.js +4 -8
- package/build/components/global-styles/screen-block-list.js.map +1 -1
- package/build/components/global-styles/screen-border.js +1 -1
- package/build/components/global-styles/screen-border.js.map +1 -1
- package/build/components/global-styles/screen-filters.js +46 -0
- package/build/components/global-styles/screen-filters.js.map +1 -0
- package/build/components/global-styles/screen-layout.js +13 -5
- package/build/components/global-styles/screen-layout.js.map +1 -1
- package/build/components/global-styles/screen-variations.js +1 -1
- package/build/components/global-styles/screen-variations.js.map +1 -1
- package/build/components/global-styles/shadow-panel.js +6 -4
- package/build/components/global-styles/shadow-panel.js.map +1 -1
- package/build/components/global-styles/typography-panel.js +2 -5
- package/build/components/global-styles/typography-panel.js.map +1 -1
- package/build/components/global-styles/ui.js +7 -1
- package/build/components/global-styles/ui.js.map +1 -1
- package/build/components/keyboard-shortcut-help-modal/config.js +12 -0
- package/build/components/keyboard-shortcut-help-modal/config.js.map +1 -1
- package/build/components/keyboard-shortcuts/edit-mode.js +124 -0
- package/build/components/keyboard-shortcuts/edit-mode.js.map +1 -0
- package/build/components/keyboard-shortcuts/global.js +48 -0
- package/build/components/keyboard-shortcuts/global.js.map +1 -0
- package/build/components/keyboard-shortcuts/index.js +67 -0
- package/build/components/keyboard-shortcuts/index.js.map +1 -1
- package/build/components/keyboard-shortcuts/register.js +153 -0
- package/build/components/keyboard-shortcuts/register.js.map +1 -0
- package/build/components/layout/index.js +5 -1
- package/build/components/layout/index.js.map +1 -1
- package/build/components/list/added-by.js +41 -42
- package/build/components/list/added-by.js.map +1 -1
- package/build/components/list/table.js +3 -2
- package/build/components/list/table.js.map +1 -1
- package/build/components/navigation-inspector/navigation-menu.js +22 -5
- package/build/components/navigation-inspector/navigation-menu.js.map +1 -1
- package/build/components/save-button/index.js +5 -2
- package/build/components/save-button/index.js.map +1 -1
- package/build/components/save-panel/index.js +11 -1
- package/build/components/save-panel/index.js.map +1 -1
- package/build/components/sidebar/index.js +28 -16
- package/build/components/sidebar/index.js.map +1 -1
- package/build/components/sidebar-button/index.js +30 -0
- package/build/components/sidebar-button/index.js.map +1 -0
- package/build/components/sidebar-edit-mode/global-styles-sidebar.js +8 -2
- package/build/components/sidebar-edit-mode/global-styles-sidebar.js.map +1 -1
- package/build/components/sidebar-navigation-screen/index.js +10 -10
- package/build/components/sidebar-navigation-screen/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-main/index.js +3 -3
- package/build/components/sidebar-navigation-screen-main/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-navigation-item/index.js +17 -16
- package/build/components/sidebar-navigation-screen-navigation-item/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-navigation-menus/index.js +10 -4
- package/build/components/sidebar-navigation-screen-navigation-menus/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-template/index.js +9 -19
- package/build/components/sidebar-navigation-screen-template/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-templates/index.js +25 -15
- package/build/components/sidebar-navigation-screen-templates/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-templates-browse/index.js +8 -7
- package/build/components/sidebar-navigation-screen-templates-browse/index.js.map +1 -1
- package/build/components/style-book/index.js +17 -2
- package/build/components/style-book/index.js.map +1 -1
- package/build/components/sync-state-with-url/use-init-edited-entity-from-url.js +36 -34
- package/build/components/sync-state-with-url/use-init-edited-entity-from-url.js.map +1 -1
- package/build/components/sync-state-with-url/use-sync-path-with-url.js +65 -18
- package/build/components/sync-state-with-url/use-sync-path-with-url.js.map +1 -1
- package/build/components/template-details/index.js +7 -9
- package/build/components/template-details/index.js.map +1 -1
- package/build/index.js +10 -22
- package/build/index.js.map +1 -1
- package/build/store/actions.js +2 -2
- package/build/store/actions.js.map +1 -1
- package/build/utils/get-is-list-page.js +1 -1
- package/build/utils/get-is-list-page.js.map +1 -1
- package/build-module/components/add-new-template/add-custom-template-modal.js +13 -4
- package/build-module/components/add-new-template/add-custom-template-modal.js.map +1 -1
- package/build-module/components/add-new-template/new-template-part.js +8 -7
- package/build-module/components/add-new-template/new-template-part.js.map +1 -1
- package/build-module/components/add-new-template/new-template.js +3 -6
- package/build-module/components/add-new-template/new-template.js.map +1 -1
- package/build-module/components/editor/index.js +3 -3
- package/build-module/components/editor/index.js.map +1 -1
- package/build-module/components/global-styles/border-panel.js +1 -1
- package/build-module/components/global-styles/border-panel.js.map +1 -1
- package/build-module/components/global-styles/context-menu.js +12 -9
- package/build-module/components/global-styles/context-menu.js.map +1 -1
- package/build-module/components/global-styles/dimensions-panel.js +43 -480
- package/build-module/components/global-styles/dimensions-panel.js.map +1 -1
- package/build-module/components/global-styles/duotone-panel.js +67 -0
- package/build-module/components/global-styles/duotone-panel.js.map +1 -0
- package/build-module/components/global-styles/filter-utils.js +9 -0
- package/build-module/components/global-styles/filter-utils.js.map +1 -0
- package/build-module/components/global-styles/preview.js +10 -6
- package/build-module/components/global-styles/preview.js.map +1 -1
- package/build-module/components/global-styles/screen-block-list.js +4 -6
- package/build-module/components/global-styles/screen-block-list.js.map +1 -1
- package/build-module/components/global-styles/screen-border.js +1 -1
- package/build-module/components/global-styles/screen-border.js.map +1 -1
- package/build-module/components/global-styles/screen-filters.js +33 -0
- package/build-module/components/global-styles/screen-filters.js.map +1 -0
- package/build-module/components/global-styles/screen-layout.js +11 -2
- package/build-module/components/global-styles/screen-layout.js.map +1 -1
- package/build-module/components/global-styles/screen-variations.js +1 -1
- package/build-module/components/global-styles/screen-variations.js.map +1 -1
- package/build-module/components/global-styles/shadow-panel.js +6 -4
- package/build-module/components/global-styles/shadow-panel.js.map +1 -1
- package/build-module/components/global-styles/typography-panel.js +2 -5
- package/build-module/components/global-styles/typography-panel.js.map +1 -1
- package/build-module/components/global-styles/ui.js +6 -1
- package/build-module/components/global-styles/ui.js.map +1 -1
- package/build-module/components/keyboard-shortcut-help-modal/config.js +12 -0
- package/build-module/components/keyboard-shortcut-help-modal/config.js.map +1 -1
- package/build-module/components/keyboard-shortcuts/edit-mode.js +108 -0
- package/build-module/components/keyboard-shortcuts/edit-mode.js.map +1 -0
- package/build-module/components/keyboard-shortcuts/global.js +37 -0
- package/build-module/components/keyboard-shortcuts/global.js.map +1 -0
- package/build-module/components/keyboard-shortcuts/index.js +65 -0
- package/build-module/components/keyboard-shortcuts/index.js.map +1 -1
- package/build-module/components/keyboard-shortcuts/register.js +141 -0
- package/build-module/components/keyboard-shortcuts/register.js.map +1 -0
- package/build-module/components/layout/index.js +3 -1
- package/build-module/components/layout/index.js.map +1 -1
- package/build-module/components/list/added-by.js +43 -44
- package/build-module/components/list/added-by.js.map +1 -1
- package/build-module/components/list/table.js +3 -2
- package/build-module/components/list/table.js.map +1 -1
- package/build-module/components/navigation-inspector/navigation-menu.js +25 -8
- package/build-module/components/navigation-inspector/navigation-menu.js.map +1 -1
- package/build-module/components/save-button/index.js +5 -2
- package/build-module/components/save-button/index.js.map +1 -1
- package/build-module/components/save-panel/index.js +8 -1
- package/build-module/components/save-panel/index.js.map +1 -1
- package/build-module/components/sidebar/index.js +25 -18
- package/build-module/components/sidebar/index.js.map +1 -1
- package/build-module/components/sidebar-button/index.js +18 -0
- package/build-module/components/sidebar-button/index.js.map +1 -0
- package/build-module/components/sidebar-edit-mode/global-styles-sidebar.js +8 -2
- package/build-module/components/sidebar-edit-mode/global-styles-sidebar.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen/index.js +8 -11
- package/build-module/components/sidebar-navigation-screen/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-main/index.js +3 -3
- package/build-module/components/sidebar-navigation-screen-main/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-navigation-item/index.js +16 -17
- package/build-module/components/sidebar-navigation-screen-navigation-item/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menus/index.js +10 -4
- package/build-module/components/sidebar-navigation-screen-navigation-menus/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-template/index.js +8 -18
- package/build-module/components/sidebar-navigation-screen-template/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-templates/index.js +23 -16
- package/build-module/components/sidebar-navigation-screen-templates/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-templates-browse/index.js +7 -7
- package/build-module/components/sidebar-navigation-screen-templates-browse/index.js.map +1 -1
- package/build-module/components/style-book/index.js +17 -3
- package/build-module/components/style-book/index.js.map +1 -1
- package/build-module/components/sync-state-with-url/use-init-edited-entity-from-url.js +36 -34
- package/build-module/components/sync-state-with-url/use-init-edited-entity-from-url.js.map +1 -1
- package/build-module/components/sync-state-with-url/use-sync-path-with-url.js +63 -18
- package/build-module/components/sync-state-with-url/use-sync-path-with-url.js.map +1 -1
- package/build-module/components/template-details/index.js +7 -8
- package/build-module/components/template-details/index.js.map +1 -1
- package/build-module/index.js +12 -22
- package/build-module/index.js.map +1 -1
- package/build-module/store/actions.js +2 -2
- package/build-module/store/actions.js.map +1 -1
- package/build-module/utils/get-is-list-page.js +1 -1
- package/build-module/utils/get-is-list-page.js.map +1 -1
- package/build-style/style-rtl.css +41 -38
- package/build-style/style.css +41 -38
- package/package.json +31 -31
- package/src/components/add-new-template/add-custom-template-modal.js +14 -10
- package/src/components/add-new-template/new-template-part.js +7 -9
- package/src/components/add-new-template/new-template.js +3 -6
- package/src/components/add-new-template/style.scss +0 -5
- package/src/components/block-editor/style.scss +1 -1
- package/src/components/editor/index.js +4 -3
- package/src/components/editor/style.scss +0 -6
- package/src/components/global-styles/border-panel.js +1 -1
- package/src/components/global-styles/context-menu.js +16 -10
- package/src/components/global-styles/dimensions-panel.js +43 -577
- package/src/components/global-styles/duotone-panel.js +82 -0
- package/src/components/global-styles/filter-utils.js +9 -0
- package/src/components/global-styles/preview.js +155 -140
- package/src/components/global-styles/screen-block-list.js +4 -9
- package/src/components/global-styles/screen-border.js +1 -1
- package/src/components/global-styles/screen-filters.js +27 -0
- package/src/components/global-styles/screen-layout.js +9 -2
- package/src/components/global-styles/screen-variations.js +0 -1
- package/src/components/global-styles/shadow-panel.js +4 -3
- package/src/components/global-styles/typography-panel.js +5 -7
- package/src/components/global-styles/ui.js +6 -1
- package/src/components/keyboard-shortcut-help-modal/config.js +10 -0
- package/src/components/keyboard-shortcuts/edit-mode.js +116 -0
- package/src/components/keyboard-shortcuts/global.js +35 -0
- package/src/components/keyboard-shortcuts/index.js +70 -0
- package/src/components/keyboard-shortcuts/register.js +157 -0
- package/src/components/layout/index.js +4 -0
- package/src/components/layout/style.scss +8 -1
- package/src/components/list/added-by.js +48 -55
- package/src/components/list/style.scss +5 -13
- package/src/components/list/table.js +4 -5
- package/src/components/navigation-inspector/navigation-menu.js +24 -6
- package/src/components/save-button/index.js +2 -2
- package/src/components/save-panel/index.js +8 -1
- package/src/components/sidebar/index.js +32 -14
- package/src/components/sidebar-button/index.js +21 -0
- package/src/components/sidebar-button/style.scss +23 -0
- package/src/components/sidebar-edit-mode/global-styles-sidebar.js +3 -7
- package/src/components/sidebar-edit-mode/style.scss +16 -0
- package/src/components/sidebar-navigation-screen/index.js +31 -38
- package/src/components/sidebar-navigation-screen/style.scss +1 -9
- package/src/components/sidebar-navigation-screen-main/index.js +3 -3
- package/src/components/sidebar-navigation-screen-navigation-item/index.js +24 -20
- package/src/components/sidebar-navigation-screen-navigation-menus/index.js +7 -3
- package/src/components/sidebar-navigation-screen-template/index.js +7 -19
- package/src/components/sidebar-navigation-screen-templates/index.js +22 -14
- package/src/components/sidebar-navigation-screen-templates/style.scss +0 -5
- package/src/components/sidebar-navigation-screen-templates-browse/index.js +6 -11
- package/src/components/style-book/index.js +25 -1
- package/src/components/sync-state-with-url/use-init-edited-entity-from-url.js +28 -23
- package/src/components/sync-state-with-url/use-sync-path-with-url.js +72 -17
- package/src/components/template-details/index.js +5 -6
- package/src/index.js +6 -21
- package/src/store/actions.js +2 -2
- package/src/style.scss +1 -0
- package/src/utils/get-is-list-page.js +1 -1
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { useShortcut } from '@wordpress/keyboard-shortcuts';
|
|
5
|
+
import { useDispatch, useSelect } from '@wordpress/data';
|
|
6
|
+
import { store as coreStore } from '@wordpress/core-data';
|
|
7
|
+
import { store as blockEditorStore } from '@wordpress/block-editor';
|
|
8
|
+
import { store as interfaceStore } from '@wordpress/interface';
|
|
9
|
+
import { createBlock } from '@wordpress/blocks';
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Internal dependencies
|
|
13
|
+
*/
|
|
14
|
+
import { store as editSiteStore } from '../../store';
|
|
15
|
+
import { SIDEBAR_BLOCK } from '../sidebar-edit-mode/constants';
|
|
16
|
+
import { STORE_NAME } from '../../store/constants';
|
|
17
|
+
|
|
18
|
+
function KeyboardShortcutsEditMode() {
|
|
19
|
+
const { getEditorMode } = useSelect( editSiteStore );
|
|
20
|
+
const isListViewOpen = useSelect(
|
|
21
|
+
( select ) => select( editSiteStore ).isListViewOpened(),
|
|
22
|
+
[]
|
|
23
|
+
);
|
|
24
|
+
const isBlockInspectorOpen = useSelect(
|
|
25
|
+
( select ) =>
|
|
26
|
+
select( interfaceStore ).getActiveComplementaryArea(
|
|
27
|
+
editSiteStore.name
|
|
28
|
+
) === SIDEBAR_BLOCK,
|
|
29
|
+
[]
|
|
30
|
+
);
|
|
31
|
+
const { redo, undo } = useDispatch( coreStore );
|
|
32
|
+
const { setIsListViewOpened, switchEditorMode } =
|
|
33
|
+
useDispatch( editSiteStore );
|
|
34
|
+
const { enableComplementaryArea, disableComplementaryArea } =
|
|
35
|
+
useDispatch( interfaceStore );
|
|
36
|
+
|
|
37
|
+
const { replaceBlocks } = useDispatch( blockEditorStore );
|
|
38
|
+
const { getBlockName, getSelectedBlockClientId, getBlockAttributes } =
|
|
39
|
+
useSelect( blockEditorStore );
|
|
40
|
+
|
|
41
|
+
const handleTextLevelShortcut = ( event, level ) => {
|
|
42
|
+
event.preventDefault();
|
|
43
|
+
const destinationBlockName =
|
|
44
|
+
level === 0 ? 'core/paragraph' : 'core/heading';
|
|
45
|
+
const currentClientId = getSelectedBlockClientId();
|
|
46
|
+
if ( currentClientId === null ) {
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
const blockName = getBlockName( currentClientId );
|
|
50
|
+
if ( blockName !== 'core/paragraph' && blockName !== 'core/heading' ) {
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
const attributes = getBlockAttributes( currentClientId );
|
|
54
|
+
const textAlign =
|
|
55
|
+
blockName === 'core/paragraph' ? 'align' : 'textAlign';
|
|
56
|
+
const destinationTextAlign =
|
|
57
|
+
destinationBlockName === 'core/paragraph' ? 'align' : 'textAlign';
|
|
58
|
+
|
|
59
|
+
replaceBlocks(
|
|
60
|
+
currentClientId,
|
|
61
|
+
createBlock( destinationBlockName, {
|
|
62
|
+
level,
|
|
63
|
+
content: attributes.content,
|
|
64
|
+
...{ [ destinationTextAlign ]: attributes[ textAlign ] },
|
|
65
|
+
} )
|
|
66
|
+
);
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
useShortcut( 'core/edit-site/undo', ( event ) => {
|
|
70
|
+
undo();
|
|
71
|
+
event.preventDefault();
|
|
72
|
+
} );
|
|
73
|
+
|
|
74
|
+
useShortcut( 'core/edit-site/redo', ( event ) => {
|
|
75
|
+
redo();
|
|
76
|
+
event.preventDefault();
|
|
77
|
+
} );
|
|
78
|
+
|
|
79
|
+
useShortcut( 'core/edit-site/toggle-list-view', () => {
|
|
80
|
+
setIsListViewOpened( ! isListViewOpen );
|
|
81
|
+
} );
|
|
82
|
+
|
|
83
|
+
useShortcut( 'core/edit-site/toggle-block-settings-sidebar', ( event ) => {
|
|
84
|
+
// This shortcut has no known clashes, but use preventDefault to prevent any
|
|
85
|
+
// obscure shortcuts from triggering.
|
|
86
|
+
event.preventDefault();
|
|
87
|
+
|
|
88
|
+
if ( isBlockInspectorOpen ) {
|
|
89
|
+
disableComplementaryArea( STORE_NAME );
|
|
90
|
+
} else {
|
|
91
|
+
enableComplementaryArea( STORE_NAME, SIDEBAR_BLOCK );
|
|
92
|
+
}
|
|
93
|
+
} );
|
|
94
|
+
|
|
95
|
+
useShortcut( 'core/edit-site/toggle-mode', () => {
|
|
96
|
+
switchEditorMode( getEditorMode() === 'visual' ? 'text' : 'visual' );
|
|
97
|
+
} );
|
|
98
|
+
|
|
99
|
+
useShortcut( 'core/edit-site/transform-heading-to-paragraph', ( event ) =>
|
|
100
|
+
handleTextLevelShortcut( event, 0 )
|
|
101
|
+
);
|
|
102
|
+
|
|
103
|
+
[ 1, 2, 3, 4, 5, 6 ].forEach( ( level ) => {
|
|
104
|
+
//the loop is based off on a constant therefore
|
|
105
|
+
//the hook will execute the same way every time
|
|
106
|
+
//eslint-disable-next-line react-hooks/rules-of-hooks
|
|
107
|
+
useShortcut(
|
|
108
|
+
`core/edit-site/transform-paragraph-to-heading-${ level }`,
|
|
109
|
+
( event ) => handleTextLevelShortcut( event, level )
|
|
110
|
+
);
|
|
111
|
+
} );
|
|
112
|
+
|
|
113
|
+
return null;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
export default KeyboardShortcutsEditMode;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { useShortcut } from '@wordpress/keyboard-shortcuts';
|
|
5
|
+
import { useDispatch, useSelect } from '@wordpress/data';
|
|
6
|
+
import { store as coreStore } from '@wordpress/core-data';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Internal dependencies
|
|
10
|
+
*/
|
|
11
|
+
import { store as editSiteStore } from '../../store';
|
|
12
|
+
|
|
13
|
+
function KeyboardShortcutsGlobal() {
|
|
14
|
+
const { __experimentalGetDirtyEntityRecords, isSavingEntityRecord } =
|
|
15
|
+
useSelect( coreStore );
|
|
16
|
+
const { setIsSaveViewOpened } = useDispatch( editSiteStore );
|
|
17
|
+
|
|
18
|
+
useShortcut( 'core/edit-site/save', ( event ) => {
|
|
19
|
+
event.preventDefault();
|
|
20
|
+
|
|
21
|
+
const dirtyEntityRecords = __experimentalGetDirtyEntityRecords();
|
|
22
|
+
const isDirty = !! dirtyEntityRecords.length;
|
|
23
|
+
const isSaving = dirtyEntityRecords.some( ( record ) =>
|
|
24
|
+
isSavingEntityRecord( record.kind, record.name, record.key )
|
|
25
|
+
);
|
|
26
|
+
|
|
27
|
+
if ( ! isSaving && isDirty ) {
|
|
28
|
+
setIsSaveViewOpened( true );
|
|
29
|
+
}
|
|
30
|
+
} );
|
|
31
|
+
|
|
32
|
+
return null;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export default KeyboardShortcutsGlobal;
|
|
@@ -10,7 +10,9 @@ import { isAppleOS } from '@wordpress/keycodes';
|
|
|
10
10
|
import { useDispatch, useSelect } from '@wordpress/data';
|
|
11
11
|
import { __ } from '@wordpress/i18n';
|
|
12
12
|
import { store as coreStore } from '@wordpress/core-data';
|
|
13
|
+
import { store as blockEditorStore } from '@wordpress/block-editor';
|
|
13
14
|
import { store as interfaceStore } from '@wordpress/interface';
|
|
15
|
+
import { createBlock } from '@wordpress/blocks';
|
|
14
16
|
|
|
15
17
|
/**
|
|
16
18
|
* Internal dependencies
|
|
@@ -41,6 +43,38 @@ function KeyboardShortcuts() {
|
|
|
41
43
|
useDispatch( interfaceStore );
|
|
42
44
|
const { setIsSaveViewOpened } = useDispatch( editSiteStore );
|
|
43
45
|
|
|
46
|
+
const { replaceBlocks } = useDispatch( blockEditorStore );
|
|
47
|
+
const { getBlockName, getSelectedBlockClientId, getBlockAttributes } =
|
|
48
|
+
useSelect( blockEditorStore );
|
|
49
|
+
|
|
50
|
+
const handleTextLevelShortcut = ( event, level ) => {
|
|
51
|
+
event.preventDefault();
|
|
52
|
+
const destinationBlockName =
|
|
53
|
+
level === 0 ? 'core/paragraph' : 'core/heading';
|
|
54
|
+
const currentClientId = getSelectedBlockClientId();
|
|
55
|
+
if ( currentClientId === null ) {
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
const blockName = getBlockName( currentClientId );
|
|
59
|
+
if ( blockName !== 'core/paragraph' && blockName !== 'core/heading' ) {
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
const attributes = getBlockAttributes( currentClientId );
|
|
63
|
+
const textAlign =
|
|
64
|
+
blockName === 'core/paragraph' ? 'align' : 'textAlign';
|
|
65
|
+
const destinationTextAlign =
|
|
66
|
+
destinationBlockName === 'core/paragraph' ? 'align' : 'textAlign';
|
|
67
|
+
|
|
68
|
+
replaceBlocks(
|
|
69
|
+
currentClientId,
|
|
70
|
+
createBlock( destinationBlockName, {
|
|
71
|
+
level,
|
|
72
|
+
content: attributes.content,
|
|
73
|
+
...{ [ destinationTextAlign ]: attributes[ textAlign ] },
|
|
74
|
+
} )
|
|
75
|
+
);
|
|
76
|
+
};
|
|
77
|
+
|
|
44
78
|
useShortcut( 'core/edit-site/save', ( event ) => {
|
|
45
79
|
event.preventDefault();
|
|
46
80
|
|
|
@@ -85,6 +119,20 @@ function KeyboardShortcuts() {
|
|
|
85
119
|
switchEditorMode( getEditorMode() === 'visual' ? 'text' : 'visual' );
|
|
86
120
|
} );
|
|
87
121
|
|
|
122
|
+
useShortcut( 'core/edit-site/transform-heading-to-paragraph', ( event ) =>
|
|
123
|
+
handleTextLevelShortcut( event, 0 )
|
|
124
|
+
);
|
|
125
|
+
|
|
126
|
+
[ 1, 2, 3, 4, 5, 6 ].forEach( ( level ) => {
|
|
127
|
+
//the loop is based off on a constant therefore
|
|
128
|
+
//the hook will execute the same way every time
|
|
129
|
+
//eslint-disable-next-line react-hooks/rules-of-hooks
|
|
130
|
+
useShortcut(
|
|
131
|
+
`core/edit-site/transform-paragraph-to-heading-${ level }`,
|
|
132
|
+
( event ) => handleTextLevelShortcut( event, level )
|
|
133
|
+
);
|
|
134
|
+
} );
|
|
135
|
+
|
|
88
136
|
return null;
|
|
89
137
|
}
|
|
90
138
|
|
|
@@ -208,6 +256,28 @@ function KeyboardShortcutsRegister() {
|
|
|
208
256
|
character: 'm',
|
|
209
257
|
},
|
|
210
258
|
} );
|
|
259
|
+
|
|
260
|
+
registerShortcut( {
|
|
261
|
+
name: `core/edit-site/transform-heading-to-paragraph`,
|
|
262
|
+
category: 'block-library',
|
|
263
|
+
description: __( 'Transform heading to paragraph.' ),
|
|
264
|
+
keyCombination: {
|
|
265
|
+
modifier: 'access',
|
|
266
|
+
character: `0`,
|
|
267
|
+
},
|
|
268
|
+
} );
|
|
269
|
+
|
|
270
|
+
[ 1, 2, 3, 4, 5, 6 ].forEach( ( level ) => {
|
|
271
|
+
registerShortcut( {
|
|
272
|
+
name: `core/edit-site/transform-paragraph-to-heading-${ level }`,
|
|
273
|
+
category: 'block-library',
|
|
274
|
+
description: __( 'Transform paragraph to heading.' ),
|
|
275
|
+
keyCombination: {
|
|
276
|
+
modifier: 'access',
|
|
277
|
+
character: `${ level }`,
|
|
278
|
+
},
|
|
279
|
+
} );
|
|
280
|
+
} );
|
|
211
281
|
}, [ registerShortcut ] );
|
|
212
282
|
|
|
213
283
|
return null;
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { useEffect } from '@wordpress/element';
|
|
5
|
+
import { store as keyboardShortcutsStore } from '@wordpress/keyboard-shortcuts';
|
|
6
|
+
import { isAppleOS } from '@wordpress/keycodes';
|
|
7
|
+
import { useDispatch } from '@wordpress/data';
|
|
8
|
+
import { __ } from '@wordpress/i18n';
|
|
9
|
+
|
|
10
|
+
function KeyboardShortcutsRegister() {
|
|
11
|
+
// Registering the shortcuts.
|
|
12
|
+
const { registerShortcut } = useDispatch( keyboardShortcutsStore );
|
|
13
|
+
useEffect( () => {
|
|
14
|
+
registerShortcut( {
|
|
15
|
+
name: 'core/edit-site/save',
|
|
16
|
+
category: 'global',
|
|
17
|
+
description: __( 'Save your changes.' ),
|
|
18
|
+
keyCombination: {
|
|
19
|
+
modifier: 'primary',
|
|
20
|
+
character: 's',
|
|
21
|
+
},
|
|
22
|
+
} );
|
|
23
|
+
|
|
24
|
+
registerShortcut( {
|
|
25
|
+
name: 'core/edit-site/undo',
|
|
26
|
+
category: 'global',
|
|
27
|
+
description: __( 'Undo your last changes.' ),
|
|
28
|
+
keyCombination: {
|
|
29
|
+
modifier: 'primary',
|
|
30
|
+
character: 'z',
|
|
31
|
+
},
|
|
32
|
+
} );
|
|
33
|
+
|
|
34
|
+
registerShortcut( {
|
|
35
|
+
name: 'core/edit-site/redo',
|
|
36
|
+
category: 'global',
|
|
37
|
+
description: __( 'Redo your last undo.' ),
|
|
38
|
+
keyCombination: {
|
|
39
|
+
modifier: 'primaryShift',
|
|
40
|
+
character: 'z',
|
|
41
|
+
},
|
|
42
|
+
// Disable on Apple OS because it conflicts with the browser's
|
|
43
|
+
// history shortcut. It's a fine alias for both Windows and Linux.
|
|
44
|
+
// Since there's no conflict for Ctrl+Shift+Z on both Windows and
|
|
45
|
+
// Linux, we keep it as the default for consistency.
|
|
46
|
+
aliases: isAppleOS()
|
|
47
|
+
? []
|
|
48
|
+
: [
|
|
49
|
+
{
|
|
50
|
+
modifier: 'primary',
|
|
51
|
+
character: 'y',
|
|
52
|
+
},
|
|
53
|
+
],
|
|
54
|
+
} );
|
|
55
|
+
|
|
56
|
+
registerShortcut( {
|
|
57
|
+
name: 'core/edit-site/toggle-list-view',
|
|
58
|
+
category: 'global',
|
|
59
|
+
description: __( 'Open the block list view.' ),
|
|
60
|
+
keyCombination: {
|
|
61
|
+
modifier: 'access',
|
|
62
|
+
character: 'o',
|
|
63
|
+
},
|
|
64
|
+
} );
|
|
65
|
+
|
|
66
|
+
registerShortcut( {
|
|
67
|
+
name: 'core/edit-site/toggle-block-settings-sidebar',
|
|
68
|
+
category: 'global',
|
|
69
|
+
description: __( 'Show or hide the block settings sidebar.' ),
|
|
70
|
+
keyCombination: {
|
|
71
|
+
modifier: 'primaryShift',
|
|
72
|
+
character: ',',
|
|
73
|
+
},
|
|
74
|
+
} );
|
|
75
|
+
|
|
76
|
+
registerShortcut( {
|
|
77
|
+
name: 'core/edit-site/keyboard-shortcuts',
|
|
78
|
+
category: 'main',
|
|
79
|
+
description: __( 'Display these keyboard shortcuts.' ),
|
|
80
|
+
keyCombination: {
|
|
81
|
+
modifier: 'access',
|
|
82
|
+
character: 'h',
|
|
83
|
+
},
|
|
84
|
+
} );
|
|
85
|
+
|
|
86
|
+
registerShortcut( {
|
|
87
|
+
name: 'core/edit-site/next-region',
|
|
88
|
+
category: 'global',
|
|
89
|
+
description: __( 'Navigate to the next part of the editor.' ),
|
|
90
|
+
keyCombination: {
|
|
91
|
+
modifier: 'ctrl',
|
|
92
|
+
character: '`',
|
|
93
|
+
},
|
|
94
|
+
aliases: [
|
|
95
|
+
{
|
|
96
|
+
modifier: 'access',
|
|
97
|
+
character: 'n',
|
|
98
|
+
},
|
|
99
|
+
],
|
|
100
|
+
} );
|
|
101
|
+
|
|
102
|
+
registerShortcut( {
|
|
103
|
+
name: 'core/edit-site/previous-region',
|
|
104
|
+
category: 'global',
|
|
105
|
+
description: __( 'Navigate to the previous part of the editor.' ),
|
|
106
|
+
keyCombination: {
|
|
107
|
+
modifier: 'ctrlShift',
|
|
108
|
+
character: '`',
|
|
109
|
+
},
|
|
110
|
+
aliases: [
|
|
111
|
+
{
|
|
112
|
+
modifier: 'access',
|
|
113
|
+
character: 'p',
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
modifier: 'ctrlShift',
|
|
117
|
+
character: '~',
|
|
118
|
+
},
|
|
119
|
+
],
|
|
120
|
+
} );
|
|
121
|
+
registerShortcut( {
|
|
122
|
+
name: 'core/edit-site/toggle-mode',
|
|
123
|
+
category: 'global',
|
|
124
|
+
description: __( 'Switch between visual editor and code editor.' ),
|
|
125
|
+
keyCombination: {
|
|
126
|
+
modifier: 'secondary',
|
|
127
|
+
character: 'm',
|
|
128
|
+
},
|
|
129
|
+
} );
|
|
130
|
+
|
|
131
|
+
registerShortcut( {
|
|
132
|
+
name: `core/edit-site/transform-heading-to-paragraph`,
|
|
133
|
+
category: 'block-library',
|
|
134
|
+
description: __( 'Transform heading to paragraph.' ),
|
|
135
|
+
keyCombination: {
|
|
136
|
+
modifier: 'access',
|
|
137
|
+
character: `0`,
|
|
138
|
+
},
|
|
139
|
+
} );
|
|
140
|
+
|
|
141
|
+
[ 1, 2, 3, 4, 5, 6 ].forEach( ( level ) => {
|
|
142
|
+
registerShortcut( {
|
|
143
|
+
name: `core/edit-site/transform-paragraph-to-heading-${ level }`,
|
|
144
|
+
category: 'block-library',
|
|
145
|
+
description: __( 'Transform paragraph to heading.' ),
|
|
146
|
+
keyCombination: {
|
|
147
|
+
modifier: 'access',
|
|
148
|
+
character: `${ level }`,
|
|
149
|
+
},
|
|
150
|
+
} );
|
|
151
|
+
} );
|
|
152
|
+
}, [ registerShortcut ] );
|
|
153
|
+
|
|
154
|
+
return null;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
export default KeyboardShortcutsRegister;
|
|
@@ -40,6 +40,8 @@ import ResizeHandle from '../block-editor/resize-handle';
|
|
|
40
40
|
import useSyncCanvasModeWithURL from '../sync-state-with-url/use-sync-canvas-mode-with-url';
|
|
41
41
|
import { unlock } from '../../private-apis';
|
|
42
42
|
import SavePanel from '../save-panel';
|
|
43
|
+
import KeyboardShortcutsRegister from '../keyboard-shortcuts/register';
|
|
44
|
+
import KeyboardShortcutsGlobal from '../keyboard-shortcuts/global';
|
|
43
45
|
|
|
44
46
|
const ANIMATION_DURATION = 0.5;
|
|
45
47
|
const emptyResizeHandleStyles = {
|
|
@@ -121,6 +123,8 @@ export default function Layout() {
|
|
|
121
123
|
|
|
122
124
|
return (
|
|
123
125
|
<>
|
|
126
|
+
<KeyboardShortcutsRegister />
|
|
127
|
+
<KeyboardShortcutsGlobal />
|
|
124
128
|
{ fullResizer }
|
|
125
129
|
<div
|
|
126
130
|
{ ...navigateRegionsProps }
|
|
@@ -207,10 +207,17 @@
|
|
|
207
207
|
|
|
208
208
|
&:focus,
|
|
209
209
|
&:focus-within {
|
|
210
|
-
top:
|
|
210
|
+
top: auto;
|
|
211
211
|
bottom: 0;
|
|
212
212
|
}
|
|
213
213
|
|
|
214
|
+
&.is-entity-save-view-open {
|
|
215
|
+
&:focus,
|
|
216
|
+
&:focus-within {
|
|
217
|
+
top: 0;
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
|
|
214
221
|
@include break-medium {
|
|
215
222
|
border-left: $border-width solid $gray-300;
|
|
216
223
|
}
|
|
@@ -6,11 +6,7 @@ import classnames from 'classnames';
|
|
|
6
6
|
/**
|
|
7
7
|
* WordPress dependencies
|
|
8
8
|
*/
|
|
9
|
-
import {
|
|
10
|
-
__experimentalHStack as HStack,
|
|
11
|
-
Icon,
|
|
12
|
-
Tooltip,
|
|
13
|
-
} from '@wordpress/components';
|
|
9
|
+
import { __experimentalHStack as HStack, Icon } from '@wordpress/components';
|
|
14
10
|
import { store as coreStore } from '@wordpress/core-data';
|
|
15
11
|
import { useSelect } from '@wordpress/data';
|
|
16
12
|
import { useState } from '@wordpress/element';
|
|
@@ -20,62 +16,47 @@ import {
|
|
|
20
16
|
plugins as pluginIcon,
|
|
21
17
|
globe as globeIcon,
|
|
22
18
|
} from '@wordpress/icons';
|
|
23
|
-
import {
|
|
19
|
+
import { _x } from '@wordpress/i18n';
|
|
24
20
|
|
|
25
21
|
const TEMPLATE_POST_TYPE_NAMES = [ 'wp_template', 'wp_template_part' ];
|
|
26
22
|
|
|
27
|
-
function
|
|
28
|
-
if ( ! isCustomized ) {
|
|
29
|
-
return children;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
return (
|
|
33
|
-
<Tooltip text={ __( 'This template has been customized' ) }>
|
|
34
|
-
{ children }
|
|
35
|
-
</Tooltip>
|
|
36
|
-
);
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
function BaseAddedBy( { text, icon, imageUrl, isCustomized } ) {
|
|
23
|
+
function BaseAddedBy( { text, icon, imageUrl, isCustomized, templateType } ) {
|
|
40
24
|
const [ isImageLoaded, setIsImageLoaded ] = useState( false );
|
|
41
25
|
|
|
42
26
|
return (
|
|
43
27
|
<HStack alignment="left">
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
>
|
|
69
|
-
<Icon icon={ icon } />
|
|
70
|
-
</div>
|
|
28
|
+
{ imageUrl ? (
|
|
29
|
+
<div
|
|
30
|
+
className={ classnames( 'edit-site-list-added-by__avatar', {
|
|
31
|
+
'is-loaded': isImageLoaded,
|
|
32
|
+
} ) }
|
|
33
|
+
>
|
|
34
|
+
<img
|
|
35
|
+
onLoad={ () => setIsImageLoaded( true ) }
|
|
36
|
+
alt=""
|
|
37
|
+
src={ imageUrl }
|
|
38
|
+
/>
|
|
39
|
+
</div>
|
|
40
|
+
) : (
|
|
41
|
+
<div className="edit-site-list-added-by__icon">
|
|
42
|
+
<Icon icon={ icon } />
|
|
43
|
+
</div>
|
|
44
|
+
) }
|
|
45
|
+
<span>
|
|
46
|
+
{ text }
|
|
47
|
+
{ isCustomized && (
|
|
48
|
+
<span className="edit-site-list-added-by__customized-info">
|
|
49
|
+
{ templateType === 'wp_template'
|
|
50
|
+
? _x( 'Customized', 'template' )
|
|
51
|
+
: _x( 'Customized', 'template part' ) }
|
|
52
|
+
</span>
|
|
71
53
|
) }
|
|
72
|
-
</
|
|
73
|
-
<span>{ text }</span>
|
|
54
|
+
</span>
|
|
74
55
|
</HStack>
|
|
75
56
|
);
|
|
76
57
|
}
|
|
77
58
|
|
|
78
|
-
function AddedByTheme( { slug, isCustomized } ) {
|
|
59
|
+
function AddedByTheme( { slug, isCustomized, templateType } ) {
|
|
79
60
|
const theme = useSelect(
|
|
80
61
|
( select ) => select( coreStore ).getTheme( slug ),
|
|
81
62
|
[ slug ]
|
|
@@ -86,11 +67,12 @@ function AddedByTheme( { slug, isCustomized } ) {
|
|
|
86
67
|
icon={ themeIcon }
|
|
87
68
|
text={ theme?.name?.rendered || slug }
|
|
88
69
|
isCustomized={ isCustomized }
|
|
70
|
+
templateType={ templateType }
|
|
89
71
|
/>
|
|
90
72
|
);
|
|
91
73
|
}
|
|
92
74
|
|
|
93
|
-
function AddedByPlugin( { slug, isCustomized } ) {
|
|
75
|
+
function AddedByPlugin( { slug, isCustomized, templateType } ) {
|
|
94
76
|
const plugin = useSelect(
|
|
95
77
|
( select ) => select( coreStore ).getPlugin( slug ),
|
|
96
78
|
[ slug ]
|
|
@@ -101,11 +83,12 @@ function AddedByPlugin( { slug, isCustomized } ) {
|
|
|
101
83
|
icon={ pluginIcon }
|
|
102
84
|
text={ plugin?.name || slug }
|
|
103
85
|
isCustomized={ isCustomized }
|
|
86
|
+
templateType={ templateType }
|
|
104
87
|
/>
|
|
105
88
|
);
|
|
106
89
|
}
|
|
107
90
|
|
|
108
|
-
function AddedByAuthor( { id } ) {
|
|
91
|
+
function AddedByAuthor( { id, templateType } ) {
|
|
109
92
|
const user = useSelect(
|
|
110
93
|
( select ) => select( coreStore ).getUser( id ),
|
|
111
94
|
[ id ]
|
|
@@ -116,11 +99,12 @@ function AddedByAuthor( { id } ) {
|
|
|
116
99
|
icon={ authorIcon }
|
|
117
100
|
imageUrl={ user?.avatar_urls?.[ 48 ] }
|
|
118
101
|
text={ user?.nickname }
|
|
102
|
+
templateType={ templateType }
|
|
119
103
|
/>
|
|
120
104
|
);
|
|
121
105
|
}
|
|
122
106
|
|
|
123
|
-
function AddedBySite() {
|
|
107
|
+
function AddedBySite( { templateType } ) {
|
|
124
108
|
const { name, logoURL } = useSelect( ( select ) => {
|
|
125
109
|
const { getEntityRecord, getMedia } = select( coreStore );
|
|
126
110
|
const siteData = getEntityRecord( 'root', '__unstableBase' );
|
|
@@ -134,7 +118,12 @@ function AddedBySite() {
|
|
|
134
118
|
}, [] );
|
|
135
119
|
|
|
136
120
|
return (
|
|
137
|
-
<BaseAddedBy
|
|
121
|
+
<BaseAddedBy
|
|
122
|
+
icon={ globeIcon }
|
|
123
|
+
imageUrl={ logoURL }
|
|
124
|
+
text={ name }
|
|
125
|
+
templateType={ templateType }
|
|
126
|
+
/>
|
|
138
127
|
);
|
|
139
128
|
}
|
|
140
129
|
|
|
@@ -158,6 +147,7 @@ export default function AddedBy( { templateType, template } ) {
|
|
|
158
147
|
<AddedByTheme
|
|
159
148
|
slug={ template.theme }
|
|
160
149
|
isCustomized={ template.source === 'custom' }
|
|
150
|
+
templateType={ templateType }
|
|
161
151
|
/>
|
|
162
152
|
);
|
|
163
153
|
}
|
|
@@ -168,6 +158,7 @@ export default function AddedBy( { templateType, template } ) {
|
|
|
168
158
|
<AddedByPlugin
|
|
169
159
|
slug={ template.theme }
|
|
170
160
|
isCustomized={ template.source === 'custom' }
|
|
161
|
+
templateType={ templateType }
|
|
171
162
|
/>
|
|
172
163
|
);
|
|
173
164
|
}
|
|
@@ -180,11 +171,13 @@ export default function AddedBy( { templateType, template } ) {
|
|
|
180
171
|
template.source === 'custom' &&
|
|
181
172
|
! template.author
|
|
182
173
|
) {
|
|
183
|
-
return <AddedBySite />;
|
|
174
|
+
return <AddedBySite templateType={ templateType } />;
|
|
184
175
|
}
|
|
185
176
|
}
|
|
186
177
|
|
|
187
178
|
// Simply show the author for templates created from scratch that have an
|
|
188
179
|
// author or for any other post type.
|
|
189
|
-
return
|
|
180
|
+
return (
|
|
181
|
+
<AddedByAuthor id={ template.author } templateType={ templateType } />
|
|
182
|
+
);
|
|
190
183
|
}
|
|
@@ -141,7 +141,6 @@
|
|
|
141
141
|
.edit-site-list-added-by__icon {
|
|
142
142
|
display: flex;
|
|
143
143
|
flex-shrink: 0;
|
|
144
|
-
position: relative;
|
|
145
144
|
align-items: center;
|
|
146
145
|
justify-content: center;
|
|
147
146
|
width: $grid-unit-40;
|
|
@@ -152,18 +151,6 @@
|
|
|
152
151
|
svg {
|
|
153
152
|
fill: $white;
|
|
154
153
|
}
|
|
155
|
-
|
|
156
|
-
&.is-customized::after {
|
|
157
|
-
position: absolute;
|
|
158
|
-
content: "";
|
|
159
|
-
background: var(--wp-admin-theme-color);
|
|
160
|
-
height: $grid-unit-10;
|
|
161
|
-
width: $grid-unit-10;
|
|
162
|
-
outline: 2px solid $white;
|
|
163
|
-
border-radius: 100%;
|
|
164
|
-
top: -1px;
|
|
165
|
-
right: -1px;
|
|
166
|
-
}
|
|
167
154
|
}
|
|
168
155
|
|
|
169
156
|
.edit-site-list-added-by__avatar {
|
|
@@ -189,3 +176,8 @@
|
|
|
189
176
|
}
|
|
190
177
|
}
|
|
191
178
|
}
|
|
179
|
+
|
|
180
|
+
.edit-site-list-added-by__customized-info {
|
|
181
|
+
display: block;
|
|
182
|
+
color: $gray-700;
|
|
183
|
+
}
|
|
@@ -46,6 +46,9 @@ export default function Table( { templateType } ) {
|
|
|
46
46
|
);
|
|
47
47
|
}
|
|
48
48
|
|
|
49
|
+
const sortedTemplates = [ ...templates ];
|
|
50
|
+
sortedTemplates.sort( ( a, b ) => a.slug.localeCompare( b.slug ) );
|
|
51
|
+
|
|
49
52
|
return (
|
|
50
53
|
// These explicit aria roles are needed for Safari.
|
|
51
54
|
// See https://developer.mozilla.org/en-US/docs/Web/CSS/display#tables
|
|
@@ -74,7 +77,7 @@ export default function Table( { templateType } ) {
|
|
|
74
77
|
</thead>
|
|
75
78
|
|
|
76
79
|
<tbody>
|
|
77
|
-
{
|
|
80
|
+
{ sortedTemplates.map( ( template ) => (
|
|
78
81
|
<tr
|
|
79
82
|
key={ template.id }
|
|
80
83
|
className="edit-site-list-table-row"
|
|
@@ -84,10 +87,6 @@ export default function Table( { templateType } ) {
|
|
|
84
87
|
<Heading level={ 4 }>
|
|
85
88
|
<Link
|
|
86
89
|
params={ {
|
|
87
|
-
path:
|
|
88
|
-
template.type === 'wp_template'
|
|
89
|
-
? '/templates/single'
|
|
90
|
-
: '/template-parts/single',
|
|
91
90
|
postId: template.id,
|
|
92
91
|
postType: template.type,
|
|
93
92
|
} }
|