@wordpress/edit-site 4.13.1-next.957ca95e4c.0 → 4.14.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/block-editor/index.js +20 -10
- package/build/components/block-editor/index.js.map +1 -1
- package/build/components/block-editor/resizable-editor.js +8 -1
- package/build/components/block-editor/resizable-editor.js.map +1 -1
- package/build/components/editor/index.js +9 -4
- package/build/components/editor/index.js.map +1 -1
- package/build/components/global-styles/gradients-palette-panel.js +6 -2
- package/build/components/global-styles/gradients-palette-panel.js.map +1 -1
- package/build/components/global-styles/hooks.js +4 -2
- package/build/components/global-styles/hooks.js.map +1 -1
- package/build/components/global-styles/use-global-styles-output.js +41 -29
- package/build/components/global-styles/use-global-styles-output.js.map +1 -1
- package/build/components/header/index.js +41 -5
- package/build/components/header/index.js.map +1 -1
- package/build/components/list/header.js +15 -2
- package/build/components/list/header.js.map +1 -1
- package/build/components/navigation-sidebar/navigation-panel/index.js +10 -4
- package/build/components/navigation-sidebar/navigation-panel/index.js.map +1 -1
- package/build/components/sidebar/index.js +8 -3
- package/build/components/sidebar/index.js.map +1 -1
- package/build/components/template-part-converter/convert-to-template-part.js +16 -0
- package/build/components/template-part-converter/convert-to-template-part.js.map +1 -1
- package/build/index.js +4 -1
- package/build/index.js.map +1 -1
- package/build-module/components/block-editor/index.js +20 -9
- package/build-module/components/block-editor/index.js.map +1 -1
- package/build-module/components/block-editor/resizable-editor.js +9 -2
- package/build-module/components/block-editor/resizable-editor.js.map +1 -1
- package/build-module/components/editor/index.js +10 -5
- package/build-module/components/editor/index.js.map +1 -1
- package/build-module/components/global-styles/gradients-palette-panel.js +6 -2
- package/build-module/components/global-styles/gradients-palette-panel.js.map +1 -1
- package/build-module/components/global-styles/hooks.js +5 -3
- package/build-module/components/global-styles/hooks.js.map +1 -1
- package/build-module/components/global-styles/use-global-styles-output.js +42 -30
- package/build-module/components/global-styles/use-global-styles-output.js.map +1 -1
- package/build-module/components/header/index.js +42 -7
- package/build-module/components/header/index.js.map +1 -1
- package/build-module/components/list/header.js +14 -2
- package/build-module/components/list/header.js.map +1 -1
- package/build-module/components/navigation-sidebar/navigation-panel/index.js +11 -5
- package/build-module/components/navigation-sidebar/navigation-panel/index.js.map +1 -1
- package/build-module/components/sidebar/index.js +7 -3
- package/build-module/components/sidebar/index.js.map +1 -1
- package/build-module/components/template-part-converter/convert-to-template-part.js +16 -1
- package/build-module/components/template-part-converter/convert-to-template-part.js.map +1 -1
- package/build-module/index.js +4 -1
- package/build-module/index.js.map +1 -1
- package/build-style/style-rtl.css +28 -16
- package/build-style/style.css +28 -16
- package/package.json +29 -29
- package/src/components/block-editor/index.js +34 -16
- package/src/components/block-editor/resizable-editor.js +10 -3
- package/src/components/code-editor/style.scss +2 -3
- package/src/components/editor/index.js +12 -5
- package/src/components/global-styles/gradients-palette-panel.js +25 -12
- package/src/components/global-styles/hooks.js +5 -3
- package/src/components/global-styles/use-global-styles-output.js +66 -57
- package/src/components/header/index.js +61 -21
- package/src/components/header/style.scss +9 -0
- package/src/components/list/header.js +15 -5
- package/src/components/navigation-sidebar/navigation-panel/index.js +30 -24
- package/src/components/sidebar/index.js +23 -20
- package/src/components/template-part-converter/convert-to-template-part.js +14 -1
- package/src/index.js +4 -0
- package/src/style.scss +1 -0
|
@@ -40,22 +40,23 @@ function NavLink( { params, replace, ...props } ) {
|
|
|
40
40
|
}
|
|
41
41
|
|
|
42
42
|
const NavigationPanel = ( { activeItem = SITE_EDITOR_KEY } ) => {
|
|
43
|
-
const { homeTemplate, isNavigationOpen, siteTitle } =
|
|
44
|
-
( select ) => {
|
|
43
|
+
const { homeTemplate, isNavigationOpen, isTemplatePartsMode, siteTitle } =
|
|
44
|
+
useSelect( ( select ) => {
|
|
45
45
|
const { getEntityRecord } = select( coreDataStore );
|
|
46
46
|
const { getSettings, isNavigationOpened } = select( editSiteStore );
|
|
47
47
|
|
|
48
48
|
const siteData =
|
|
49
49
|
getEntityRecord( 'root', '__unstableBase', undefined ) || {};
|
|
50
|
+
const { supportsTemplatePartsMode, __unstableHomeTemplate } =
|
|
51
|
+
getSettings();
|
|
50
52
|
|
|
51
53
|
return {
|
|
52
54
|
siteTitle: siteData.name,
|
|
53
|
-
homeTemplate:
|
|
55
|
+
homeTemplate: __unstableHomeTemplate,
|
|
54
56
|
isNavigationOpen: isNavigationOpened(),
|
|
57
|
+
isTemplatePartsMode: !! supportsTemplatePartsMode,
|
|
55
58
|
};
|
|
56
|
-
},
|
|
57
|
-
[]
|
|
58
|
-
);
|
|
59
|
+
}, [] );
|
|
59
60
|
const { setIsNavigationPanelOpened } = useDispatch( editSiteStore );
|
|
60
61
|
|
|
61
62
|
const closeOnEscape = ( event ) => {
|
|
@@ -91,24 +92,29 @@ const NavigationPanel = ( { activeItem = SITE_EDITOR_KEY } ) => {
|
|
|
91
92
|
|
|
92
93
|
<NavigationMenu>
|
|
93
94
|
<NavigationGroup title={ __( 'Editor' ) }>
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
95
|
+
{ ! isTemplatePartsMode && (
|
|
96
|
+
<>
|
|
97
|
+
<NavLink
|
|
98
|
+
icon={ siteIcon }
|
|
99
|
+
title={ __( 'Site' ) }
|
|
100
|
+
item={ SITE_EDITOR_KEY }
|
|
101
|
+
params={ {
|
|
102
|
+
postId: homeTemplate?.postId,
|
|
103
|
+
postType:
|
|
104
|
+
homeTemplate?.postType,
|
|
105
|
+
} }
|
|
106
|
+
/>
|
|
107
|
+
<NavLink
|
|
108
|
+
icon={ templateIcon }
|
|
109
|
+
title={ __( 'Templates' ) }
|
|
110
|
+
item="wp_template"
|
|
111
|
+
params={ {
|
|
112
|
+
postId: undefined,
|
|
113
|
+
postType: 'wp_template',
|
|
114
|
+
} }
|
|
115
|
+
/>
|
|
116
|
+
</>
|
|
117
|
+
) }
|
|
112
118
|
<NavLink
|
|
113
119
|
icon={ templatePartIcon }
|
|
114
120
|
title={ __( 'Template Parts' ) }
|
|
@@ -19,6 +19,7 @@ import { STORE_NAME } from '../../store/constants';
|
|
|
19
19
|
import SettingsHeader from './settings-header';
|
|
20
20
|
import TemplateCard from './template-card';
|
|
21
21
|
import { SIDEBAR_BLOCK, SIDEBAR_TEMPLATE } from './constants';
|
|
22
|
+
import { store as editSiteStore } from '../../store';
|
|
22
23
|
|
|
23
24
|
const { Slot: InspectorSlot, Fill: InspectorFill } = createSlotFill(
|
|
24
25
|
'EditSiteSidebarInspector'
|
|
@@ -26,25 +27,27 @@ const { Slot: InspectorSlot, Fill: InspectorFill } = createSlotFill(
|
|
|
26
27
|
export const SidebarInspectorFill = InspectorFill;
|
|
27
28
|
|
|
28
29
|
export function SidebarComplementaryAreaFills() {
|
|
29
|
-
const {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
30
|
+
const {
|
|
31
|
+
sidebar,
|
|
32
|
+
isEditorSidebarOpened,
|
|
33
|
+
hasBlockSelection,
|
|
34
|
+
supportsGlobalStyles,
|
|
35
|
+
} = useSelect( ( select ) => {
|
|
36
|
+
const _sidebar =
|
|
37
|
+
select( interfaceStore ).getActiveComplementaryArea( STORE_NAME );
|
|
38
|
+
const _isEditorSidebarOpened = [
|
|
39
|
+
SIDEBAR_BLOCK,
|
|
40
|
+
SIDEBAR_TEMPLATE,
|
|
41
|
+
].includes( _sidebar );
|
|
42
|
+
const settings = select( editSiteStore ).getSettings();
|
|
43
|
+
return {
|
|
44
|
+
sidebar: _sidebar,
|
|
45
|
+
isEditorSidebarOpened: _isEditorSidebarOpened,
|
|
46
|
+
hasBlockSelection:
|
|
47
|
+
!! select( blockEditorStore ).getBlockSelectionStart(),
|
|
48
|
+
supportsGlobalStyles: ! settings?.supportsTemplatePartsMode,
|
|
49
|
+
};
|
|
50
|
+
}, [] );
|
|
48
51
|
const { enableComplementaryArea } = useDispatch( interfaceStore );
|
|
49
52
|
|
|
50
53
|
useEffect( () => {
|
|
@@ -89,7 +92,7 @@ export function SidebarComplementaryAreaFills() {
|
|
|
89
92
|
<InspectorSlot bubblesVirtually />
|
|
90
93
|
) }
|
|
91
94
|
</DefaultSidebar>
|
|
92
|
-
<GlobalStylesSidebar />
|
|
95
|
+
{ supportsGlobalStyles && <GlobalStylesSidebar /> }
|
|
93
96
|
<MaybeNavigationMenuSidebar />
|
|
94
97
|
</>
|
|
95
98
|
);
|
|
@@ -6,7 +6,7 @@ import { kebabCase } from 'lodash';
|
|
|
6
6
|
/**
|
|
7
7
|
* WordPress dependencies
|
|
8
8
|
*/
|
|
9
|
-
import { useDispatch } from '@wordpress/data';
|
|
9
|
+
import { useDispatch, useSelect } from '@wordpress/data';
|
|
10
10
|
import {
|
|
11
11
|
BlockSettingsMenuControls,
|
|
12
12
|
store as blockEditorStore,
|
|
@@ -23,6 +23,7 @@ import { symbolFilled } from '@wordpress/icons';
|
|
|
23
23
|
* Internal dependencies
|
|
24
24
|
*/
|
|
25
25
|
import CreateTemplatePartModal from '../create-template-part-modal';
|
|
26
|
+
import { store as editSiteStore } from '../../store';
|
|
26
27
|
|
|
27
28
|
export default function ConvertToTemplatePart( { clientIds, blocks } ) {
|
|
28
29
|
const [ isModalOpen, setIsModalOpen ] = useState( false );
|
|
@@ -30,6 +31,18 @@ export default function ConvertToTemplatePart( { clientIds, blocks } ) {
|
|
|
30
31
|
const { saveEntityRecord } = useDispatch( coreStore );
|
|
31
32
|
const { createSuccessNotice } = useDispatch( noticesStore );
|
|
32
33
|
|
|
34
|
+
const { canCreate } = useSelect( ( select ) => {
|
|
35
|
+
const { supportsTemplatePartsMode } =
|
|
36
|
+
select( editSiteStore ).getSettings();
|
|
37
|
+
return {
|
|
38
|
+
canCreate: ! supportsTemplatePartsMode,
|
|
39
|
+
};
|
|
40
|
+
}, [] );
|
|
41
|
+
|
|
42
|
+
if ( ! canCreate ) {
|
|
43
|
+
return null;
|
|
44
|
+
}
|
|
45
|
+
|
|
33
46
|
const onConvert = async ( { title, area } ) => {
|
|
34
47
|
// Currently template parts only allow latin chars.
|
|
35
48
|
// Fallback slug will receive suffix by default.
|
package/src/index.js
CHANGED
|
@@ -107,6 +107,10 @@ export function reinitializeEditor( target, settings ) {
|
|
|
107
107
|
}
|
|
108
108
|
}
|
|
109
109
|
|
|
110
|
+
// Prevent the default browser action for files dropped outside of dropzones.
|
|
111
|
+
window.addEventListener( 'dragover', ( e ) => e.preventDefault(), false );
|
|
112
|
+
window.addEventListener( 'drop', ( e ) => e.preventDefault(), false );
|
|
113
|
+
|
|
110
114
|
render( <EditSiteApp reboot={ reboot } />, target );
|
|
111
115
|
}
|
|
112
116
|
|