@wordpress/edit-site 6.0.3 → 6.0.5
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/components/add-new-page/index.js +7 -1
- package/build/components/add-new-page/index.js.map +1 -1
- package/build/components/add-new-pattern/index.js +30 -16
- package/build/components/add-new-pattern/index.js.map +1 -1
- package/build/components/editor/index.js +2 -0
- package/build/components/editor/index.js.map +1 -1
- package/build/components/layout/index.js +5 -5
- package/build/components/layout/index.js.map +1 -1
- package/build/components/layout/router.js +15 -10
- package/build/components/layout/router.js.map +1 -1
- package/build/components/page-pages/index.js +38 -6
- package/build/components/page-pages/index.js.map +1 -1
- package/build/components/page-patterns/index.js +8 -2
- package/build/components/page-patterns/index.js.map +1 -1
- package/build/components/page-templates/index.js +10 -3
- package/build/components/page-templates/index.js.map +1 -1
- package/build/components/revisions/index.js +10 -7
- package/build/components/revisions/index.js.map +1 -1
- package/build/components/sidebar-dataviews/default-views.js +4 -4
- package/build/components/sidebar-dataviews/default-views.js.map +1 -1
- package/build/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js +20 -88
- package/build/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js.map +1 -1
- package/build/store/private-actions.js +7 -2
- package/build/store/private-actions.js.map +1 -1
- package/build-module/components/add-new-page/index.js +8 -2
- package/build-module/components/add-new-page/index.js.map +1 -1
- package/build-module/components/add-new-pattern/index.js +30 -16
- package/build-module/components/add-new-pattern/index.js.map +1 -1
- package/build-module/components/editor/index.js +2 -0
- package/build-module/components/editor/index.js.map +1 -1
- package/build-module/components/layout/index.js +5 -5
- package/build-module/components/layout/index.js.map +1 -1
- package/build-module/components/layout/router.js +15 -10
- package/build-module/components/layout/router.js.map +1 -1
- package/build-module/components/page-pages/index.js +38 -6
- package/build-module/components/page-pages/index.js.map +1 -1
- package/build-module/components/page-patterns/index.js +8 -2
- package/build-module/components/page-patterns/index.js.map +1 -1
- package/build-module/components/page-templates/index.js +10 -3
- package/build-module/components/page-templates/index.js.map +1 -1
- package/build-module/components/revisions/index.js +10 -7
- package/build-module/components/revisions/index.js.map +1 -1
- package/build-module/components/sidebar-dataviews/default-views.js +5 -5
- package/build-module/components/sidebar-dataviews/default-views.js.map +1 -1
- package/build-module/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js +19 -86
- package/build-module/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js.map +1 -1
- package/build-module/store/private-actions.js +7 -2
- package/build-module/store/private-actions.js.map +1 -1
- package/build-style/style-rtl.css +17 -25
- package/build-style/style.css +17 -25
- package/package.json +17 -17
- package/src/components/add-new-page/index.js +14 -1
- package/src/components/add-new-pattern/index.js +37 -23
- package/src/components/block-editor/style.scss +0 -11
- package/src/components/editor/index.js +2 -0
- package/src/components/layout/index.js +2 -3
- package/src/components/layout/router.js +23 -15
- package/src/components/page-pages/index.js +45 -11
- package/src/components/page-pages/style.scss +1 -1
- package/src/components/page-patterns/index.js +8 -2
- package/src/components/page-patterns/style.scss +1 -8
- package/src/components/page-templates/index.js +9 -2
- package/src/components/page-templates/style.scss +1 -6
- package/src/components/revisions/index.js +9 -1
- package/src/components/sidebar-dataviews/default-views.js +13 -5
- package/src/hooks/use-theme-style-variations/test/use-theme-style-variations-by-property.js +1 -875
- package/src/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js +29 -117
- package/src/store/private-actions.js +7 -3
- package/src/style.scss +13 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wordpress/edit-site",
|
|
3
|
-
"version": "6.0.
|
|
3
|
+
"version": "6.0.5",
|
|
4
4
|
"description": "Edit Site Page module for WordPress.",
|
|
5
5
|
"author": "The WordPress Contributors",
|
|
6
6
|
"license": "GPL-2.0-or-later",
|
|
@@ -32,41 +32,41 @@
|
|
|
32
32
|
"@wordpress/a11y": "^4.0.1",
|
|
33
33
|
"@wordpress/api-fetch": "^7.0.1",
|
|
34
34
|
"@wordpress/blob": "^4.0.1",
|
|
35
|
-
"@wordpress/block-editor": "^13.0.
|
|
36
|
-
"@wordpress/block-library": "^9.0.
|
|
37
|
-
"@wordpress/blocks": "^13.0.
|
|
38
|
-
"@wordpress/commands": "^1.0.
|
|
39
|
-
"@wordpress/components": "^28.0.
|
|
35
|
+
"@wordpress/block-editor": "^13.0.4",
|
|
36
|
+
"@wordpress/block-library": "^9.0.5",
|
|
37
|
+
"@wordpress/blocks": "^13.0.3",
|
|
38
|
+
"@wordpress/commands": "^1.0.3",
|
|
39
|
+
"@wordpress/components": "^28.0.3",
|
|
40
40
|
"@wordpress/compose": "^7.0.1",
|
|
41
|
-
"@wordpress/core-commands": "^1.0.
|
|
42
|
-
"@wordpress/core-data": "^7.0.
|
|
41
|
+
"@wordpress/core-commands": "^1.0.4",
|
|
42
|
+
"@wordpress/core-data": "^7.0.4",
|
|
43
43
|
"@wordpress/data": "^10.0.2",
|
|
44
|
-
"@wordpress/dataviews": "^2.0.
|
|
44
|
+
"@wordpress/dataviews": "^2.0.4",
|
|
45
45
|
"@wordpress/date": "^5.0.1",
|
|
46
46
|
"@wordpress/deprecated": "^4.0.1",
|
|
47
47
|
"@wordpress/dom": "^4.0.1",
|
|
48
|
-
"@wordpress/editor": "^14.0.
|
|
48
|
+
"@wordpress/editor": "^14.0.4",
|
|
49
49
|
"@wordpress/element": "^6.0.1",
|
|
50
50
|
"@wordpress/escape-html": "^3.0.1",
|
|
51
51
|
"@wordpress/hooks": "^4.0.1",
|
|
52
52
|
"@wordpress/html-entities": "^4.0.1",
|
|
53
53
|
"@wordpress/i18n": "^5.0.1",
|
|
54
|
-
"@wordpress/icons": "^10.0.
|
|
54
|
+
"@wordpress/icons": "^10.0.2",
|
|
55
55
|
"@wordpress/keyboard-shortcuts": "^5.0.2",
|
|
56
56
|
"@wordpress/keycodes": "^4.0.1",
|
|
57
57
|
"@wordpress/notices": "^5.0.2",
|
|
58
|
-
"@wordpress/patterns": "^2.0.
|
|
59
|
-
"@wordpress/plugins": "^7.0.
|
|
60
|
-
"@wordpress/preferences": "^4.0.
|
|
58
|
+
"@wordpress/patterns": "^2.0.4",
|
|
59
|
+
"@wordpress/plugins": "^7.0.3",
|
|
60
|
+
"@wordpress/preferences": "^4.0.3",
|
|
61
61
|
"@wordpress/primitives": "^4.0.1",
|
|
62
62
|
"@wordpress/priority-queue": "^3.0.1",
|
|
63
63
|
"@wordpress/private-apis": "^1.0.2",
|
|
64
|
-
"@wordpress/reusable-blocks": "^5.0.
|
|
64
|
+
"@wordpress/reusable-blocks": "^5.0.4",
|
|
65
65
|
"@wordpress/router": "^1.0.2",
|
|
66
66
|
"@wordpress/style-engine": "^2.0.2",
|
|
67
67
|
"@wordpress/url": "^4.0.1",
|
|
68
68
|
"@wordpress/viewport": "^6.0.2",
|
|
69
|
-
"@wordpress/widgets": "^4.0.
|
|
69
|
+
"@wordpress/widgets": "^4.0.4",
|
|
70
70
|
"@wordpress/wordcount": "^4.0.1",
|
|
71
71
|
"change-case": "^4.1.2",
|
|
72
72
|
"clsx": "^2.1.1",
|
|
@@ -82,5 +82,5 @@
|
|
|
82
82
|
"publishConfig": {
|
|
83
83
|
"access": "public"
|
|
84
84
|
},
|
|
85
|
-
"gitHead": "
|
|
85
|
+
"gitHead": "85486692a3e48b7d863226cf895a21d787434921"
|
|
86
86
|
}
|
|
@@ -9,11 +9,12 @@ import {
|
|
|
9
9
|
TextControl,
|
|
10
10
|
} from '@wordpress/components';
|
|
11
11
|
import { __, sprintf } from '@wordpress/i18n';
|
|
12
|
-
import { useDispatch } from '@wordpress/data';
|
|
12
|
+
import { useDispatch, useRegistry } from '@wordpress/data';
|
|
13
13
|
import { useState } from '@wordpress/element';
|
|
14
14
|
import { store as coreStore } from '@wordpress/core-data';
|
|
15
15
|
import { store as noticesStore } from '@wordpress/notices';
|
|
16
16
|
import { decodeEntities } from '@wordpress/html-entities';
|
|
17
|
+
import { serialize, synchronizeBlocksWithTemplate } from '@wordpress/blocks';
|
|
17
18
|
|
|
18
19
|
export default function AddNewPageModal( { onSave, onClose } ) {
|
|
19
20
|
const [ isCreatingPage, setIsCreatingPage ] = useState( false );
|
|
@@ -22,6 +23,7 @@ export default function AddNewPageModal( { onSave, onClose } ) {
|
|
|
22
23
|
const { saveEntityRecord } = useDispatch( coreStore );
|
|
23
24
|
const { createErrorNotice, createSuccessNotice } =
|
|
24
25
|
useDispatch( noticesStore );
|
|
26
|
+
const { resolveSelect } = useRegistry();
|
|
25
27
|
|
|
26
28
|
async function createPage( event ) {
|
|
27
29
|
event.preventDefault();
|
|
@@ -31,6 +33,8 @@ export default function AddNewPageModal( { onSave, onClose } ) {
|
|
|
31
33
|
}
|
|
32
34
|
setIsCreatingPage( true );
|
|
33
35
|
try {
|
|
36
|
+
const pagePostType =
|
|
37
|
+
await resolveSelect( coreStore ).getPostType( 'page' );
|
|
34
38
|
const newPage = await saveEntityRecord(
|
|
35
39
|
'postType',
|
|
36
40
|
'page',
|
|
@@ -38,6 +42,15 @@ export default function AddNewPageModal( { onSave, onClose } ) {
|
|
|
38
42
|
status: 'draft',
|
|
39
43
|
title,
|
|
40
44
|
slug: title || __( 'No title' ),
|
|
45
|
+
content:
|
|
46
|
+
!! pagePostType.template && pagePostType.template.length
|
|
47
|
+
? serialize(
|
|
48
|
+
synchronizeBlocksWithTemplate(
|
|
49
|
+
[],
|
|
50
|
+
pagePostType.template
|
|
51
|
+
)
|
|
52
|
+
)
|
|
53
|
+
: undefined,
|
|
41
54
|
},
|
|
42
55
|
{ throwOnError: true }
|
|
43
56
|
);
|
|
@@ -36,21 +36,29 @@ export default function AddNewPattern() {
|
|
|
36
36
|
const [ showPatternModal, setShowPatternModal ] = useState( false );
|
|
37
37
|
const [ showTemplatePartModal, setShowTemplatePartModal ] =
|
|
38
38
|
useState( false );
|
|
39
|
+
// eslint-disable-next-line @wordpress/no-unused-vars-before-return
|
|
39
40
|
const { createPatternFromFile } = unlock( useDispatch( patternsStore ) );
|
|
40
41
|
const { createSuccessNotice, createErrorNotice } =
|
|
41
42
|
useDispatch( noticesStore );
|
|
42
43
|
const patternUploadInputRef = useRef();
|
|
43
|
-
const {
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
44
|
+
const {
|
|
45
|
+
isBlockBasedTheme,
|
|
46
|
+
addNewPatternLabel,
|
|
47
|
+
addNewTemplatePartLabel,
|
|
48
|
+
canCreatePattern,
|
|
49
|
+
canCreateTemplatePart,
|
|
50
|
+
} = useSelect( ( select ) => {
|
|
51
|
+
const { getCurrentTheme, getPostType, canUser } = select( coreStore );
|
|
52
|
+
return {
|
|
53
|
+
isBlockBasedTheme: getCurrentTheme()?.is_block_theme,
|
|
54
|
+
addNewPatternLabel: getPostType( PATTERN_TYPES.user )?.labels
|
|
55
|
+
?.add_new_item,
|
|
56
|
+
addNewTemplatePartLabel: getPostType( TEMPLATE_PART_POST_TYPE )
|
|
57
|
+
?.labels?.add_new_item,
|
|
58
|
+
canCreatePattern: canUser( 'create', 'blocks' ),
|
|
59
|
+
canCreateTemplatePart: canUser( 'create', 'template-parts' ),
|
|
60
|
+
};
|
|
61
|
+
}, [] );
|
|
54
62
|
|
|
55
63
|
function handleCreatePattern( { pattern } ) {
|
|
56
64
|
setShowPatternModal( false );
|
|
@@ -78,15 +86,16 @@ export default function AddNewPattern() {
|
|
|
78
86
|
setShowTemplatePartModal( false );
|
|
79
87
|
}
|
|
80
88
|
|
|
81
|
-
const controls = [
|
|
82
|
-
|
|
89
|
+
const controls = [];
|
|
90
|
+
if ( canCreatePattern ) {
|
|
91
|
+
controls.push( {
|
|
83
92
|
icon: symbol,
|
|
84
93
|
onClick: () => setShowPatternModal( true ),
|
|
85
94
|
title: addNewPatternLabel,
|
|
86
|
-
}
|
|
87
|
-
|
|
95
|
+
} );
|
|
96
|
+
}
|
|
88
97
|
|
|
89
|
-
if ( isBlockBasedTheme ) {
|
|
98
|
+
if ( isBlockBasedTheme && canCreateTemplatePart ) {
|
|
90
99
|
controls.push( {
|
|
91
100
|
icon: symbolFilled,
|
|
92
101
|
onClick: () => setShowTemplatePartModal( true ),
|
|
@@ -94,15 +103,20 @@ export default function AddNewPattern() {
|
|
|
94
103
|
} );
|
|
95
104
|
}
|
|
96
105
|
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
106
|
+
if ( canCreatePattern ) {
|
|
107
|
+
controls.push( {
|
|
108
|
+
icon: upload,
|
|
109
|
+
onClick: () => {
|
|
110
|
+
patternUploadInputRef.current.click();
|
|
111
|
+
},
|
|
112
|
+
title: __( 'Import pattern from JSON' ),
|
|
113
|
+
} );
|
|
114
|
+
}
|
|
104
115
|
|
|
105
116
|
const { categoryMap, findOrCreateTerm } = useAddPatternCategory();
|
|
117
|
+
if ( controls.length === 0 ) {
|
|
118
|
+
return null;
|
|
119
|
+
}
|
|
106
120
|
return (
|
|
107
121
|
<>
|
|
108
122
|
{ addNewPatternLabel && (
|
|
@@ -1,15 +1,4 @@
|
|
|
1
|
-
/* stylelint-disable -- Disable reason: View Transitions not supported properly by stylelint. */
|
|
2
|
-
::view-transition-old(frame),
|
|
3
|
-
::view-transition-new(frame) {
|
|
4
|
-
animation-duration: 0;
|
|
5
|
-
}
|
|
6
|
-
/* stylelint-enable */
|
|
7
|
-
|
|
8
1
|
.edit-site-visual-editor__editor-canvas {
|
|
9
|
-
/* stylelint-disable -- Disable reason: View Transitions not supported properly by stylelint. */
|
|
10
|
-
view-transition-name: frame;
|
|
11
|
-
/* stylelint-enable */
|
|
12
|
-
|
|
13
2
|
&.is-focused {
|
|
14
3
|
outline: calc(2 * var(--wp-admin-border-width-focus)) solid var(--wp-admin-theme-color);
|
|
15
4
|
outline-offset: calc(-2 * var(--wp-admin-border-width-focus));
|
|
@@ -41,6 +41,7 @@ import {
|
|
|
41
41
|
useHasEditorCanvasContainer,
|
|
42
42
|
} from '../editor-canvas-container';
|
|
43
43
|
import SaveButton from '../save-button';
|
|
44
|
+
import SavePanel from '../save-panel';
|
|
44
45
|
import SiteEditorMoreMenu from '../more-menu';
|
|
45
46
|
import SiteIcon from '../site-icon';
|
|
46
47
|
import useEditorIframeProps from '../block-editor/use-editor-iframe-props';
|
|
@@ -205,6 +206,7 @@ export default function EditSiteEditor( { isLoading } ) {
|
|
|
205
206
|
customSaveButton={
|
|
206
207
|
_isPreviewingTheme && <SaveButton size="compact" />
|
|
207
208
|
}
|
|
209
|
+
customSavePanel={ _isPreviewingTheme && <SavePanel /> }
|
|
208
210
|
forceDisableBlockTools={ ! hasDefaultEditorCanvasView }
|
|
209
211
|
title={
|
|
210
212
|
! hasDefaultEditorCanvasView
|
|
@@ -46,7 +46,6 @@ import SiteHub from '../site-hub';
|
|
|
46
46
|
import ResizableFrame from '../resizable-frame';
|
|
47
47
|
import useSyncCanvasModeWithURL from '../sync-state-with-url/use-sync-canvas-mode-with-url';
|
|
48
48
|
import { unlock } from '../../lock-unlock';
|
|
49
|
-
import SavePanel from '../save-panel';
|
|
50
49
|
import KeyboardShortcutsRegister from '../keyboard-shortcuts/register';
|
|
51
50
|
import KeyboardShortcutsGlobal from '../keyboard-shortcuts/global';
|
|
52
51
|
import { useCommonCommands } from '../../hooks/commands/use-common-commands';
|
|
@@ -56,6 +55,7 @@ import useLayoutAreas from './router';
|
|
|
56
55
|
import useMovingAnimation from './animation';
|
|
57
56
|
import SidebarContent from '../sidebar';
|
|
58
57
|
import SaveHub from '../save-hub';
|
|
58
|
+
import SavePanel from '../save-panel';
|
|
59
59
|
|
|
60
60
|
const { useCommands } = unlock( coreCommandsPrivateApis );
|
|
61
61
|
const { useCommandContext } = unlock( commandsPrivateApis );
|
|
@@ -209,6 +209,7 @@ export default function Layout() {
|
|
|
209
209
|
{ areas.sidebar }
|
|
210
210
|
</SidebarContent>
|
|
211
211
|
<SaveHub />
|
|
212
|
+
<SavePanel />
|
|
212
213
|
</motion.div>
|
|
213
214
|
) }
|
|
214
215
|
</AnimatePresence>
|
|
@@ -282,8 +283,6 @@ export default function Layout() {
|
|
|
282
283
|
</div>
|
|
283
284
|
) }
|
|
284
285
|
</div>
|
|
285
|
-
|
|
286
|
-
<SavePanel />
|
|
287
286
|
</div>
|
|
288
287
|
</>
|
|
289
288
|
);
|
|
@@ -77,6 +77,7 @@ export default function useLayoutAreas() {
|
|
|
77
77
|
const isSiteEditorLoading = useIsSiteEditorLoading();
|
|
78
78
|
const { params } = useLocation();
|
|
79
79
|
const { postType, postId, path, layout, isCustom, canvas } = params;
|
|
80
|
+
const hasEditCanvasMode = canvas === 'edit';
|
|
80
81
|
useRedirectOldPaths();
|
|
81
82
|
|
|
82
83
|
// Page list
|
|
@@ -93,15 +94,14 @@ export default function useLayoutAreas() {
|
|
|
93
94
|
/>
|
|
94
95
|
),
|
|
95
96
|
content: <PagePages />,
|
|
96
|
-
preview: ( isListLayout ||
|
|
97
|
+
preview: ( isListLayout || hasEditCanvasMode ) && (
|
|
97
98
|
<Editor isLoading={ isSiteEditorLoading } />
|
|
98
99
|
),
|
|
99
|
-
mobile:
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
),
|
|
100
|
+
mobile: hasEditCanvasMode ? (
|
|
101
|
+
<Editor isLoading={ isSiteEditorLoading } />
|
|
102
|
+
) : (
|
|
103
|
+
<PagePages />
|
|
104
|
+
),
|
|
105
105
|
},
|
|
106
106
|
widths: {
|
|
107
107
|
content: isListLayout ? 380 : undefined,
|
|
@@ -119,10 +119,14 @@ export default function useLayoutAreas() {
|
|
|
119
119
|
<SidebarNavigationScreenTemplatesBrowse backPath={ {} } />
|
|
120
120
|
),
|
|
121
121
|
content: <PageTemplates />,
|
|
122
|
-
preview: ( isListLayout ||
|
|
122
|
+
preview: ( isListLayout || hasEditCanvasMode ) && (
|
|
123
123
|
<Editor isLoading={ isSiteEditorLoading } />
|
|
124
124
|
),
|
|
125
|
-
mobile:
|
|
125
|
+
mobile: hasEditCanvasMode ? (
|
|
126
|
+
<Editor isLoading={ isSiteEditorLoading } />
|
|
127
|
+
) : (
|
|
128
|
+
<PageTemplates />
|
|
129
|
+
),
|
|
126
130
|
},
|
|
127
131
|
widths: {
|
|
128
132
|
content: isListLayout ? 380 : undefined,
|
|
@@ -139,8 +143,12 @@ export default function useLayoutAreas() {
|
|
|
139
143
|
areas: {
|
|
140
144
|
sidebar: <SidebarNavigationScreenPatterns backPath={ {} } />,
|
|
141
145
|
content: <PagePatterns />,
|
|
142
|
-
mobile:
|
|
143
|
-
|
|
146
|
+
mobile: hasEditCanvasMode ? (
|
|
147
|
+
<Editor isLoading={ isSiteEditorLoading } />
|
|
148
|
+
) : (
|
|
149
|
+
<PagePatterns />
|
|
150
|
+
),
|
|
151
|
+
preview: hasEditCanvasMode && (
|
|
144
152
|
<Editor isLoading={ isSiteEditorLoading } />
|
|
145
153
|
),
|
|
146
154
|
},
|
|
@@ -156,7 +164,7 @@ export default function useLayoutAreas() {
|
|
|
156
164
|
<SidebarNavigationScreenGlobalStyles backPath={ {} } />
|
|
157
165
|
),
|
|
158
166
|
preview: <Editor isLoading={ isSiteEditorLoading } />,
|
|
159
|
-
mobile:
|
|
167
|
+
mobile: hasEditCanvasMode && (
|
|
160
168
|
<Editor isLoading={ isSiteEditorLoading } />
|
|
161
169
|
),
|
|
162
170
|
},
|
|
@@ -175,7 +183,7 @@ export default function useLayoutAreas() {
|
|
|
175
183
|
/>
|
|
176
184
|
),
|
|
177
185
|
preview: <Editor isLoading={ isSiteEditorLoading } />,
|
|
178
|
-
mobile:
|
|
186
|
+
mobile: hasEditCanvasMode && (
|
|
179
187
|
<Editor isLoading={ isSiteEditorLoading } />
|
|
180
188
|
),
|
|
181
189
|
},
|
|
@@ -188,7 +196,7 @@ export default function useLayoutAreas() {
|
|
|
188
196
|
<SidebarNavigationScreenNavigationMenus backPath={ {} } />
|
|
189
197
|
),
|
|
190
198
|
preview: <Editor isLoading={ isSiteEditorLoading } />,
|
|
191
|
-
mobile:
|
|
199
|
+
mobile: hasEditCanvasMode && (
|
|
192
200
|
<Editor isLoading={ isSiteEditorLoading } />
|
|
193
201
|
),
|
|
194
202
|
},
|
|
@@ -201,7 +209,7 @@ export default function useLayoutAreas() {
|
|
|
201
209
|
areas: {
|
|
202
210
|
sidebar: <SidebarNavigationScreenMain />,
|
|
203
211
|
preview: <Editor isLoading={ isSiteEditorLoading } />,
|
|
204
|
-
mobile:
|
|
212
|
+
mobile: hasEditCanvasMode && (
|
|
205
213
|
<Editor isLoading={ isSiteEditorLoading } />
|
|
206
214
|
),
|
|
207
215
|
},
|
|
@@ -39,6 +39,7 @@ import AddNewPageModal from '../add-new-page';
|
|
|
39
39
|
import Media from '../media';
|
|
40
40
|
import { unlock } from '../../lock-unlock';
|
|
41
41
|
import { useEditPostAction } from '../dataviews-actions';
|
|
42
|
+
import { usePrevious } from '@wordpress/compose';
|
|
42
43
|
|
|
43
44
|
const { usePostActions } = unlock( editorPrivateApis );
|
|
44
45
|
const { useLocation, useHistory } = unlock( routerPrivateApis );
|
|
@@ -201,10 +202,18 @@ function FeaturedImage( { item, viewType } ) {
|
|
|
201
202
|
);
|
|
202
203
|
}
|
|
203
204
|
|
|
205
|
+
function getItemId( item ) {
|
|
206
|
+
return item.id.toString();
|
|
207
|
+
}
|
|
208
|
+
|
|
204
209
|
export default function PagePages() {
|
|
205
210
|
const postType = 'page';
|
|
206
211
|
const [ view, setView ] = useView( postType );
|
|
207
212
|
const history = useHistory();
|
|
213
|
+
const {
|
|
214
|
+
params: { postId },
|
|
215
|
+
} = useLocation();
|
|
216
|
+
const [ selection, setSelection ] = useState( [ postId ] );
|
|
208
217
|
|
|
209
218
|
const onSelectionChange = useCallback(
|
|
210
219
|
( items ) => {
|
|
@@ -266,6 +275,20 @@ export default function PagePages() {
|
|
|
266
275
|
totalPages,
|
|
267
276
|
} = useEntityRecords( 'postType', postType, queryArgs );
|
|
268
277
|
|
|
278
|
+
const ids = pages?.map( ( page ) => getItemId( page ) ) ?? [];
|
|
279
|
+
const prevIds = usePrevious( ids ) ?? [];
|
|
280
|
+
const deletedIds = prevIds.filter( ( id ) => ! ids.includes( id ) );
|
|
281
|
+
const postIdWasDeleted = deletedIds.includes( postId );
|
|
282
|
+
|
|
283
|
+
useEffect( () => {
|
|
284
|
+
if ( postIdWasDeleted ) {
|
|
285
|
+
history.push( {
|
|
286
|
+
...history.getLocationWithParams().params,
|
|
287
|
+
postId: undefined,
|
|
288
|
+
} );
|
|
289
|
+
}
|
|
290
|
+
}, [ postIdWasDeleted, history ] );
|
|
291
|
+
|
|
269
292
|
const { records: authors, isResolving: isLoadingAuthors } =
|
|
270
293
|
useEntityRecords( 'root', 'user', { per_page: -1 } );
|
|
271
294
|
|
|
@@ -277,15 +300,19 @@ export default function PagePages() {
|
|
|
277
300
|
[ totalItems, totalPages ]
|
|
278
301
|
);
|
|
279
302
|
|
|
280
|
-
const { frontPageId, postsPageId, addNewLabel } = useSelect(
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
303
|
+
const { frontPageId, postsPageId, addNewLabel, canCreatePage } = useSelect(
|
|
304
|
+
( select ) => {
|
|
305
|
+
const { getEntityRecord, getPostType, canUser } =
|
|
306
|
+
select( coreStore );
|
|
307
|
+
const siteSettings = getEntityRecord( 'root', 'site' );
|
|
308
|
+
return {
|
|
309
|
+
frontPageId: siteSettings?.page_on_front,
|
|
310
|
+
postsPageId: siteSettings?.page_for_posts,
|
|
311
|
+
addNewLabel: getPostType( 'page' )?.labels?.add_new_item,
|
|
312
|
+
canCreatePage: canUser( 'create', 'pages' ),
|
|
313
|
+
};
|
|
314
|
+
}
|
|
315
|
+
);
|
|
289
316
|
|
|
290
317
|
const fields = useMemo(
|
|
291
318
|
() => [
|
|
@@ -456,7 +483,10 @@ export default function PagePages() {
|
|
|
456
483
|
[ authors, view.type, frontPageId, postsPageId ]
|
|
457
484
|
);
|
|
458
485
|
|
|
459
|
-
const postTypeActions = usePostActions(
|
|
486
|
+
const postTypeActions = usePostActions( {
|
|
487
|
+
postType: 'page',
|
|
488
|
+
context: 'list',
|
|
489
|
+
} );
|
|
460
490
|
const editAction = useEditPostAction();
|
|
461
491
|
const actions = useMemo(
|
|
462
492
|
() => [ editAction, ...postTypeActions ],
|
|
@@ -496,7 +526,8 @@ export default function PagePages() {
|
|
|
496
526
|
<Page
|
|
497
527
|
title={ __( 'Pages' ) }
|
|
498
528
|
actions={
|
|
499
|
-
addNewLabel &&
|
|
529
|
+
addNewLabel &&
|
|
530
|
+
canCreatePage && (
|
|
500
531
|
<>
|
|
501
532
|
<Button
|
|
502
533
|
variant="primary"
|
|
@@ -523,7 +554,10 @@ export default function PagePages() {
|
|
|
523
554
|
isLoading={ isLoadingPages || isLoadingAuthors }
|
|
524
555
|
view={ view }
|
|
525
556
|
onChangeView={ onChangeView }
|
|
557
|
+
selection={ selection }
|
|
558
|
+
setSelection={ setSelection }
|
|
526
559
|
onSelectionChange={ onSelectionChange }
|
|
560
|
+
getItemId={ getItemId }
|
|
527
561
|
/>
|
|
528
562
|
</Page>
|
|
529
563
|
);
|
|
@@ -354,8 +354,14 @@ export default function DataviewsPatterns() {
|
|
|
354
354
|
return filterSortAndPaginate( patterns, viewWithoutFilters, fields );
|
|
355
355
|
}, [ patterns, view, fields, type ] );
|
|
356
356
|
|
|
357
|
-
const templatePartActions = usePostActions(
|
|
358
|
-
|
|
357
|
+
const templatePartActions = usePostActions( {
|
|
358
|
+
postType: TEMPLATE_PART_POST_TYPE,
|
|
359
|
+
context: 'list',
|
|
360
|
+
} );
|
|
361
|
+
const patternActions = usePostActions( {
|
|
362
|
+
postType: PATTERN_TYPES.user,
|
|
363
|
+
context: 'list',
|
|
364
|
+
} );
|
|
359
365
|
const editAction = useEditPostAction();
|
|
360
366
|
|
|
361
367
|
const actions = useMemo( () => {
|
|
@@ -35,13 +35,6 @@
|
|
|
35
35
|
display: flex;
|
|
36
36
|
flex-direction: column;
|
|
37
37
|
height: 100%;
|
|
38
|
-
border-radius: 3px 3px 0 0;
|
|
39
|
-
|
|
40
|
-
&.is-viewtype-grid {
|
|
41
|
-
.block-editor-block-preview__container {
|
|
42
|
-
border-radius: 3px 3px 0 0;
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
38
|
|
|
46
39
|
&.is-viewtype-table {
|
|
47
40
|
width: 96px;
|
|
@@ -62,7 +55,7 @@
|
|
|
62
55
|
cursor: pointer;
|
|
63
56
|
overflow: hidden;
|
|
64
57
|
height: 100%;
|
|
65
|
-
border-radius:
|
|
58
|
+
border-radius: $grid-unit-05;
|
|
66
59
|
|
|
67
60
|
&:focus-visible {
|
|
68
61
|
box-shadow: 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color);
|
|
@@ -186,7 +186,9 @@ function Preview( { item, viewType } ) {
|
|
|
186
186
|
|
|
187
187
|
export default function PageTemplates() {
|
|
188
188
|
const { params } = useLocation();
|
|
189
|
-
const { activeView = 'all', layout } = params;
|
|
189
|
+
const { activeView = 'all', layout, postId } = params;
|
|
190
|
+
const [ selection, setSelection ] = useState( [ postId ] );
|
|
191
|
+
|
|
190
192
|
const defaultView = useMemo( () => {
|
|
191
193
|
const usedType = layout ?? DEFAULT_VIEW.type;
|
|
192
194
|
return {
|
|
@@ -323,7 +325,10 @@ export default function PageTemplates() {
|
|
|
323
325
|
return filterSortAndPaginate( records, view, fields );
|
|
324
326
|
}, [ records, view, fields ] );
|
|
325
327
|
|
|
326
|
-
const postTypeActions = usePostActions(
|
|
328
|
+
const postTypeActions = usePostActions( {
|
|
329
|
+
postType: TEMPLATE_POST_TYPE,
|
|
330
|
+
context: 'list',
|
|
331
|
+
} );
|
|
327
332
|
const editAction = useEditPostAction();
|
|
328
333
|
const actions = useMemo(
|
|
329
334
|
() => [ editAction, ...postTypeActions ],
|
|
@@ -366,6 +371,8 @@ export default function PageTemplates() {
|
|
|
366
371
|
view={ view }
|
|
367
372
|
onChangeView={ onChangeView }
|
|
368
373
|
onSelectionChange={ onSelectionChange }
|
|
374
|
+
selection={ selection }
|
|
375
|
+
setSelection={ setSelection }
|
|
369
376
|
/>
|
|
370
377
|
</Page>
|
|
371
378
|
);
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
display: flex;
|
|
3
3
|
flex-direction: column;
|
|
4
4
|
height: 100%;
|
|
5
|
-
border-radius: 3px 3px 0 0;
|
|
6
5
|
|
|
7
6
|
.page-templates-preview-field__button {
|
|
8
7
|
box-shadow: none;
|
|
@@ -13,7 +12,7 @@
|
|
|
13
12
|
cursor: pointer;
|
|
14
13
|
overflow: hidden;
|
|
15
14
|
height: 100%;
|
|
16
|
-
border-radius:
|
|
15
|
+
border-radius: $grid-unit-05;
|
|
17
16
|
|
|
18
17
|
&:focus-visible {
|
|
19
18
|
box-shadow: 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color);
|
|
@@ -32,10 +31,6 @@
|
|
|
32
31
|
.block-editor-block-preview__container {
|
|
33
32
|
height: 100%;
|
|
34
33
|
}
|
|
35
|
-
|
|
36
|
-
.page-templates-preview-field__button {
|
|
37
|
-
border-radius: 3px 3px 0 0;
|
|
38
|
-
}
|
|
39
34
|
}
|
|
40
35
|
|
|
41
36
|
&.is-viewtype-table {
|
|
@@ -25,6 +25,7 @@ const {
|
|
|
25
25
|
ExperimentalBlockEditorProvider,
|
|
26
26
|
GlobalStylesContext,
|
|
27
27
|
useGlobalStylesOutputWithConfig,
|
|
28
|
+
__unstableBlockStyleVariationOverridesWithConfig,
|
|
28
29
|
} = unlock( blockEditorPrivateApis );
|
|
29
30
|
const { mergeBaseAndUserConfigs } = unlock( editorPrivateApis );
|
|
30
31
|
|
|
@@ -74,7 +75,6 @@ function Revisions( { userConfig, blocks } ) {
|
|
|
74
75
|
name="revisions"
|
|
75
76
|
tabIndex={ 0 }
|
|
76
77
|
>
|
|
77
|
-
<EditorStyles styles={ editorStyles } />
|
|
78
78
|
<style>
|
|
79
79
|
{
|
|
80
80
|
// Forming a "block formatting context" to prevent margin collapsing.
|
|
@@ -88,6 +88,14 @@ function Revisions( { userConfig, blocks } ) {
|
|
|
88
88
|
settings={ settings }
|
|
89
89
|
>
|
|
90
90
|
<BlockList renderAppender={ false } />
|
|
91
|
+
{ /*
|
|
92
|
+
* Styles are printed inside the block editor provider,
|
|
93
|
+
* so they can access any registered style overrides.
|
|
94
|
+
*/ }
|
|
95
|
+
<EditorStyles styles={ editorStyles } />
|
|
96
|
+
<__unstableBlockStyleVariationOverridesWithConfig
|
|
97
|
+
config={ mergedConfig }
|
|
98
|
+
/>
|
|
91
99
|
</ExperimentalBlockEditorProvider>
|
|
92
100
|
</Disabled>
|
|
93
101
|
</Iframe>
|
|
@@ -2,7 +2,15 @@
|
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
4
|
import { __ } from '@wordpress/i18n';
|
|
5
|
-
import {
|
|
5
|
+
import {
|
|
6
|
+
trash,
|
|
7
|
+
pages,
|
|
8
|
+
drafts,
|
|
9
|
+
published,
|
|
10
|
+
scheduled,
|
|
11
|
+
pending,
|
|
12
|
+
notAllowed,
|
|
13
|
+
} from '@wordpress/icons';
|
|
6
14
|
|
|
7
15
|
/**
|
|
8
16
|
* Internal dependencies
|
|
@@ -57,7 +65,7 @@ export const DEFAULT_VIEWS = {
|
|
|
57
65
|
{
|
|
58
66
|
title: __( 'Published' ),
|
|
59
67
|
slug: 'published',
|
|
60
|
-
icon:
|
|
68
|
+
icon: published,
|
|
61
69
|
view: {
|
|
62
70
|
...DEFAULT_PAGE_BASE,
|
|
63
71
|
filters: [
|
|
@@ -72,7 +80,7 @@ export const DEFAULT_VIEWS = {
|
|
|
72
80
|
{
|
|
73
81
|
title: __( 'Scheduled' ),
|
|
74
82
|
slug: 'future',
|
|
75
|
-
icon:
|
|
83
|
+
icon: scheduled,
|
|
76
84
|
view: {
|
|
77
85
|
...DEFAULT_PAGE_BASE,
|
|
78
86
|
filters: [
|
|
@@ -102,7 +110,7 @@ export const DEFAULT_VIEWS = {
|
|
|
102
110
|
{
|
|
103
111
|
title: __( 'Pending' ),
|
|
104
112
|
slug: 'pending',
|
|
105
|
-
icon:
|
|
113
|
+
icon: pending,
|
|
106
114
|
view: {
|
|
107
115
|
...DEFAULT_PAGE_BASE,
|
|
108
116
|
filters: [
|
|
@@ -117,7 +125,7 @@ export const DEFAULT_VIEWS = {
|
|
|
117
125
|
{
|
|
118
126
|
title: __( 'Private' ),
|
|
119
127
|
slug: 'private',
|
|
120
|
-
icon:
|
|
128
|
+
icon: notAllowed,
|
|
121
129
|
view: {
|
|
122
130
|
...DEFAULT_PAGE_BASE,
|
|
123
131
|
filters: [
|