@wordpress/edit-site 6.0.1 → 6.0.3
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 +2 -1
- package/build/components/add-new-page/index.js.map +1 -1
- package/build/components/editor/index.js +2 -1
- package/build/components/editor/index.js.map +1 -1
- package/build/components/global-styles/font-library-modal/installed-fonts.js +1 -0
- package/build/components/global-styles/font-library-modal/installed-fonts.js.map +1 -1
- package/build/components/global-styles/screen-revisions/index.js +4 -23
- package/build/components/global-styles/screen-revisions/index.js.map +1 -1
- package/build/components/global-styles/shadows-edit-panel.js +1 -0
- package/build/components/global-styles/shadows-edit-panel.js.map +1 -1
- package/build/components/global-styles/variations/variation.js +11 -16
- package/build/components/global-styles/variations/variation.js.map +1 -1
- package/build/components/global-styles/variations/variations-color.js +1 -0
- package/build/components/global-styles/variations/variations-color.js.map +1 -1
- package/build/components/global-styles/variations/variations-typography.js +1 -0
- package/build/components/global-styles/variations/variations-typography.js.map +1 -1
- package/build/components/sidebar-navigation-screen-navigation-menu/delete-confirm-dialog.js +1 -0
- package/build/components/sidebar-navigation-screen-navigation-menu/delete-confirm-dialog.js.map +1 -1
- package/build/deprecated.js +11 -0
- package/build/deprecated.js.map +1 -1
- package/build/hooks/push-changes-to-global-styles/index.js +2 -2
- package/build/hooks/push-changes-to-global-styles/index.js.map +1 -1
- package/build/lock-unlock.js +1 -1
- package/build/lock-unlock.js.map +1 -1
- package/build-module/components/add-new-page/index.js +2 -1
- package/build-module/components/add-new-page/index.js.map +1 -1
- package/build-module/components/editor/index.js +2 -1
- package/build-module/components/editor/index.js.map +1 -1
- package/build-module/components/global-styles/font-library-modal/installed-fonts.js +1 -0
- package/build-module/components/global-styles/font-library-modal/installed-fonts.js.map +1 -1
- package/build-module/components/global-styles/screen-revisions/index.js +4 -23
- package/build-module/components/global-styles/screen-revisions/index.js.map +1 -1
- package/build-module/components/global-styles/shadows-edit-panel.js +1 -0
- package/build-module/components/global-styles/shadows-edit-panel.js.map +1 -1
- package/build-module/components/global-styles/variations/variation.js +11 -16
- package/build-module/components/global-styles/variations/variation.js.map +1 -1
- package/build-module/components/global-styles/variations/variations-color.js +1 -0
- package/build-module/components/global-styles/variations/variations-color.js.map +1 -1
- package/build-module/components/global-styles/variations/variations-typography.js +1 -0
- package/build-module/components/global-styles/variations/variations-typography.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menu/delete-confirm-dialog.js +1 -0
- package/build-module/components/sidebar-navigation-screen-navigation-menu/delete-confirm-dialog.js.map +1 -1
- package/build-module/deprecated.js +11 -0
- package/build-module/deprecated.js.map +1 -1
- package/build-module/hooks/push-changes-to-global-styles/index.js +2 -2
- package/build-module/hooks/push-changes-to-global-styles/index.js.map +1 -1
- package/build-module/lock-unlock.js +1 -1
- package/build-module/lock-unlock.js.map +1 -1
- package/package.json +23 -23
- package/src/components/add-new-page/index.js +2 -1
- package/src/components/editor/index.js +2 -1
- package/src/components/global-styles/font-library-modal/installed-fonts.js +1 -0
- package/src/components/global-styles/screen-revisions/index.js +4 -24
- package/src/components/global-styles/shadows-edit-panel.js +1 -0
- package/src/components/global-styles/variations/variation.js +14 -19
- package/src/components/global-styles/variations/variations-color.js +6 -1
- package/src/components/global-styles/variations/variations-typography.js +5 -1
- package/src/components/sidebar-navigation-screen-navigation-menu/delete-confirm-dialog.js +1 -0
- package/src/deprecated.js +14 -0
- package/src/hooks/push-changes-to-global-styles/index.js +2 -2
- package/src/lock-unlock.js +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wordpress/edit-site",
|
|
3
|
-
"version": "6.0.
|
|
3
|
+
"version": "6.0.3",
|
|
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.2",
|
|
36
|
+
"@wordpress/block-library": "^9.0.3",
|
|
37
|
+
"@wordpress/blocks": "^13.0.2",
|
|
38
|
+
"@wordpress/commands": "^1.0.2",
|
|
39
|
+
"@wordpress/components": "^28.0.2",
|
|
40
40
|
"@wordpress/compose": "^7.0.1",
|
|
41
|
-
"@wordpress/core-commands": "^1.0.
|
|
42
|
-
"@wordpress/core-data": "^7.0.
|
|
43
|
-
"@wordpress/data": "^10.0.
|
|
44
|
-
"@wordpress/dataviews": "^2.0.
|
|
41
|
+
"@wordpress/core-commands": "^1.0.2",
|
|
42
|
+
"@wordpress/core-data": "^7.0.2",
|
|
43
|
+
"@wordpress/data": "^10.0.2",
|
|
44
|
+
"@wordpress/dataviews": "^2.0.2",
|
|
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.2",
|
|
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
54
|
"@wordpress/icons": "^10.0.1",
|
|
55
|
-
"@wordpress/keyboard-shortcuts": "^5.0.
|
|
55
|
+
"@wordpress/keyboard-shortcuts": "^5.0.2",
|
|
56
56
|
"@wordpress/keycodes": "^4.0.1",
|
|
57
|
-
"@wordpress/notices": "^5.0.
|
|
58
|
-
"@wordpress/patterns": "^2.0.
|
|
59
|
-
"@wordpress/plugins": "^7.0.
|
|
60
|
-
"@wordpress/preferences": "^4.0.
|
|
57
|
+
"@wordpress/notices": "^5.0.2",
|
|
58
|
+
"@wordpress/patterns": "^2.0.2",
|
|
59
|
+
"@wordpress/plugins": "^7.0.2",
|
|
60
|
+
"@wordpress/preferences": "^4.0.2",
|
|
61
61
|
"@wordpress/primitives": "^4.0.1",
|
|
62
62
|
"@wordpress/priority-queue": "^3.0.1",
|
|
63
|
-
"@wordpress/private-apis": "^1.0.
|
|
64
|
-
"@wordpress/reusable-blocks": "^5.0.
|
|
65
|
-
"@wordpress/router": "^1.0.
|
|
66
|
-
"@wordpress/style-engine": "^2.0.
|
|
63
|
+
"@wordpress/private-apis": "^1.0.2",
|
|
64
|
+
"@wordpress/reusable-blocks": "^5.0.2",
|
|
65
|
+
"@wordpress/router": "^1.0.2",
|
|
66
|
+
"@wordpress/style-engine": "^2.0.2",
|
|
67
67
|
"@wordpress/url": "^4.0.1",
|
|
68
|
-
"@wordpress/viewport": "^6.0.
|
|
69
|
-
"@wordpress/widgets": "^4.0.
|
|
68
|
+
"@wordpress/viewport": "^6.0.2",
|
|
69
|
+
"@wordpress/widgets": "^4.0.2",
|
|
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": "d0d80eabf45745725edbb19ce6667157fc68a6aa"
|
|
86
86
|
}
|
|
@@ -13,6 +13,7 @@ import { useDispatch } 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
|
+
import { decodeEntities } from '@wordpress/html-entities';
|
|
16
17
|
|
|
17
18
|
export default function AddNewPageModal( { onSave, onClose } ) {
|
|
18
19
|
const [ isCreatingPage, setIsCreatingPage ] = useState( false );
|
|
@@ -47,7 +48,7 @@ export default function AddNewPageModal( { onSave, onClose } ) {
|
|
|
47
48
|
sprintf(
|
|
48
49
|
// translators: %s: Title of the created template e.g: "Category".
|
|
49
50
|
__( '"%s" successfully created.' ),
|
|
50
|
-
newPage.title?.rendered || title
|
|
51
|
+
decodeEntities( newPage.title?.rendered || title )
|
|
51
52
|
),
|
|
52
53
|
{
|
|
53
54
|
type: 'snackbar',
|
|
@@ -21,6 +21,7 @@ import { useCallback, useMemo } from '@wordpress/element';
|
|
|
21
21
|
import { store as noticesStore } from '@wordpress/notices';
|
|
22
22
|
import { privateApis as routerPrivateApis } from '@wordpress/router';
|
|
23
23
|
import { store as preferencesStore } from '@wordpress/preferences';
|
|
24
|
+
import { decodeEntities } from '@wordpress/html-entities';
|
|
24
25
|
|
|
25
26
|
/**
|
|
26
27
|
* Internal dependencies
|
|
@@ -152,7 +153,7 @@ export default function EditSiteEditor( { isLoading } ) {
|
|
|
152
153
|
sprintf(
|
|
153
154
|
// translators: %s: Title of the created post e.g: "Post 1".
|
|
154
155
|
__( '"%s" successfully created.' ),
|
|
155
|
-
_title
|
|
156
|
+
decodeEntities( _title )
|
|
156
157
|
),
|
|
157
158
|
{
|
|
158
159
|
type: 'snackbar',
|
|
@@ -81,28 +81,11 @@ function ScreenRevisions() {
|
|
|
81
81
|
};
|
|
82
82
|
|
|
83
83
|
const restoreRevision = ( revision ) => {
|
|
84
|
-
setUserConfig( () =>
|
|
85
|
-
styles: revision?.styles,
|
|
86
|
-
settings: revision?.settings,
|
|
87
|
-
_links: revision?._links,
|
|
88
|
-
} ) );
|
|
84
|
+
setUserConfig( () => revision );
|
|
89
85
|
setIsLoadingRevisionWithUnsavedChanges( false );
|
|
90
86
|
onCloseRevisions();
|
|
91
87
|
};
|
|
92
88
|
|
|
93
|
-
const selectRevision = ( revision ) => {
|
|
94
|
-
setCurrentlySelectedRevision( {
|
|
95
|
-
/*
|
|
96
|
-
* The default must be an empty object so that
|
|
97
|
-
* `mergeBaseAndUserConfigs()` can merge them correctly.
|
|
98
|
-
*/
|
|
99
|
-
styles: revision?.styles || {},
|
|
100
|
-
settings: revision?.settings || {},
|
|
101
|
-
_links: revision?._links || {},
|
|
102
|
-
id: revision?.id,
|
|
103
|
-
} );
|
|
104
|
-
};
|
|
105
|
-
|
|
106
89
|
useEffect( () => {
|
|
107
90
|
if (
|
|
108
91
|
! editorCanvasContainerView ||
|
|
@@ -134,11 +117,7 @@ function ScreenRevisions() {
|
|
|
134
117
|
* See: https://github.com/WordPress/gutenberg/issues/55866
|
|
135
118
|
*/
|
|
136
119
|
if ( shouldSelectFirstItem ) {
|
|
137
|
-
setCurrentlySelectedRevision(
|
|
138
|
-
styles: firstRevision?.styles || {},
|
|
139
|
-
settings: firstRevision?.settings || {},
|
|
140
|
-
id: firstRevision?.id,
|
|
141
|
-
} );
|
|
120
|
+
setCurrentlySelectedRevision( firstRevision );
|
|
142
121
|
}
|
|
143
122
|
}, [ shouldSelectFirstItem, firstRevision ] );
|
|
144
123
|
|
|
@@ -186,7 +165,7 @@ function ScreenRevisions() {
|
|
|
186
165
|
/>
|
|
187
166
|
) ) }
|
|
188
167
|
<RevisionsButtons
|
|
189
|
-
onChange={
|
|
168
|
+
onChange={ setCurrentlySelectedRevision }
|
|
190
169
|
selectedRevisionId={ currentlySelectedRevisionId }
|
|
191
170
|
userRevisions={ currentRevisions }
|
|
192
171
|
canApplyRevision={ isLoadButtonEnabled }
|
|
@@ -219,6 +198,7 @@ function ScreenRevisions() {
|
|
|
219
198
|
onCancel={ () =>
|
|
220
199
|
setIsLoadingRevisionWithUnsavedChanges( false )
|
|
221
200
|
}
|
|
201
|
+
size="medium"
|
|
222
202
|
>
|
|
223
203
|
{ __(
|
|
224
204
|
'Are you sure you want to apply this revision? Any unsaved changes will be lost.'
|
|
@@ -15,6 +15,7 @@ import { privateApis as editorPrivateApis } from '@wordpress/editor';
|
|
|
15
15
|
/**
|
|
16
16
|
* Internal dependencies
|
|
17
17
|
*/
|
|
18
|
+
import { filterObjectByProperty } from '../../../hooks/use-theme-style-variations/use-theme-style-variations-by-property';
|
|
18
19
|
import { unlock } from '../../../lock-unlock';
|
|
19
20
|
|
|
20
21
|
const { mergeBaseAndUserConfigs } = unlock( editorPrivateApis );
|
|
@@ -22,30 +23,24 @@ const { GlobalStylesContext, areGlobalStyleConfigsEqual } = unlock(
|
|
|
22
23
|
blockEditorPrivateApis
|
|
23
24
|
);
|
|
24
25
|
|
|
25
|
-
export default function Variation( { variation, children, isPill } ) {
|
|
26
|
+
export default function Variation( { variation, children, isPill, property } ) {
|
|
26
27
|
const [ isFocused, setIsFocused ] = useState( false );
|
|
27
28
|
const { base, user, setUserConfig } = useContext( GlobalStylesContext );
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
29
|
+
|
|
30
|
+
const context = useMemo( () => {
|
|
31
|
+
let merged = mergeBaseAndUserConfigs( base, variation );
|
|
32
|
+
if ( property ) {
|
|
33
|
+
merged = filterObjectByProperty( merged, property );
|
|
34
|
+
}
|
|
35
|
+
return {
|
|
36
|
+
user: variation,
|
|
35
37
|
base,
|
|
36
|
-
merged
|
|
38
|
+
merged,
|
|
37
39
|
setUserConfig: () => {},
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
);
|
|
40
|
+
};
|
|
41
|
+
}, [ variation, base, property ] );
|
|
41
42
|
|
|
42
|
-
const selectVariation = () =>
|
|
43
|
-
setUserConfig( () => ( {
|
|
44
|
-
settings: variation.settings,
|
|
45
|
-
styles: variation.styles,
|
|
46
|
-
_links: variation._links,
|
|
47
|
-
} ) );
|
|
48
|
-
};
|
|
43
|
+
const selectVariation = () => setUserConfig( variation );
|
|
49
44
|
|
|
50
45
|
const selectOnEnter = ( event ) => {
|
|
51
46
|
if ( event.keyCode === ENTER ) {
|
|
@@ -27,7 +27,12 @@ export default function ColorVariations( { title, gap = 2 } ) {
|
|
|
27
27
|
{ title && <Subtitle level={ 3 }>{ title }</Subtitle> }
|
|
28
28
|
<Grid spacing={ gap }>
|
|
29
29
|
{ colorVariations.map( ( variation, index ) => (
|
|
30
|
-
<Variation
|
|
30
|
+
<Variation
|
|
31
|
+
key={ index }
|
|
32
|
+
variation={ variation }
|
|
33
|
+
isPill
|
|
34
|
+
property="color"
|
|
35
|
+
>
|
|
31
36
|
{ () => <StylesPreviewColors /> }
|
|
32
37
|
</Variation>
|
|
33
38
|
) ) }
|
|
@@ -35,7 +35,11 @@ export default function TypographyVariations( { title, gap = 2 } ) {
|
|
|
35
35
|
{ typographyVariations &&
|
|
36
36
|
typographyVariations.length &&
|
|
37
37
|
typographyVariations.map( ( variation, index ) => (
|
|
38
|
-
<Variation
|
|
38
|
+
<Variation
|
|
39
|
+
key={ index }
|
|
40
|
+
variation={ variation }
|
|
41
|
+
property="typography"
|
|
42
|
+
>
|
|
39
43
|
{ ( isFocused ) => (
|
|
40
44
|
<PreviewIframe
|
|
41
45
|
label={ variation?.title }
|
package/src/deprecated.js
CHANGED
|
@@ -6,8 +6,13 @@ import {
|
|
|
6
6
|
PluginSidebar as EditorPluginSidebar,
|
|
7
7
|
PluginSidebarMoreMenuItem as EditorPluginSidebarMoreMenuItem,
|
|
8
8
|
} from '@wordpress/editor';
|
|
9
|
+
import { getPath } from '@wordpress/url';
|
|
9
10
|
import deprecated from '@wordpress/deprecated';
|
|
10
11
|
|
|
12
|
+
const isSiteEditor = getPath( window.location.href )?.includes(
|
|
13
|
+
'site-editor.php'
|
|
14
|
+
);
|
|
15
|
+
|
|
11
16
|
const deprecateSlot = ( name ) => {
|
|
12
17
|
deprecated( `wp.editPost.${ name }`, {
|
|
13
18
|
since: '6.6',
|
|
@@ -20,6 +25,9 @@ const deprecateSlot = ( name ) => {
|
|
|
20
25
|
* @see PluginMoreMenuItem in @wordpress/editor package.
|
|
21
26
|
*/
|
|
22
27
|
export function PluginMoreMenuItem( props ) {
|
|
28
|
+
if ( ! isSiteEditor ) {
|
|
29
|
+
return null;
|
|
30
|
+
}
|
|
23
31
|
deprecateSlot( 'PluginMoreMenuItem' );
|
|
24
32
|
return <EditorPluginMoreMenuItem { ...props } />;
|
|
25
33
|
}
|
|
@@ -28,6 +36,9 @@ export function PluginMoreMenuItem( props ) {
|
|
|
28
36
|
* @see PluginSidebar in @wordpress/editor package.
|
|
29
37
|
*/
|
|
30
38
|
export function PluginSidebar( props ) {
|
|
39
|
+
if ( ! isSiteEditor ) {
|
|
40
|
+
return null;
|
|
41
|
+
}
|
|
31
42
|
deprecateSlot( 'PluginSidebar' );
|
|
32
43
|
return <EditorPluginSidebar { ...props } />;
|
|
33
44
|
}
|
|
@@ -36,6 +47,9 @@ export function PluginSidebar( props ) {
|
|
|
36
47
|
* @see PluginSidebarMoreMenuItem in @wordpress/editor package.
|
|
37
48
|
*/
|
|
38
49
|
export function PluginSidebarMoreMenuItem( props ) {
|
|
50
|
+
if ( ! isSiteEditor ) {
|
|
51
|
+
return null;
|
|
52
|
+
}
|
|
39
53
|
deprecateSlot( 'PluginSidebarMoreMenuItem' );
|
|
40
54
|
return <EditorPluginSidebarMoreMenuItem { ...props } />;
|
|
41
55
|
}
|
|
@@ -287,7 +287,7 @@ function PushChangesToGlobalStylesControl( {
|
|
|
287
287
|
// notification.
|
|
288
288
|
__unstableMarkNextChangeAsNotPersistent();
|
|
289
289
|
setAttributes( newBlockAttributes );
|
|
290
|
-
setUserConfig(
|
|
290
|
+
setUserConfig( newUserConfig, { undoIgnore: true } );
|
|
291
291
|
createSuccessNotice(
|
|
292
292
|
sprintf(
|
|
293
293
|
// translators: %s: Title of the block e.g. 'Heading'.
|
|
@@ -302,7 +302,7 @@ function PushChangesToGlobalStylesControl( {
|
|
|
302
302
|
onClick() {
|
|
303
303
|
__unstableMarkNextChangeAsNotPersistent();
|
|
304
304
|
setAttributes( attributes );
|
|
305
|
-
setUserConfig(
|
|
305
|
+
setUserConfig( userConfig, {
|
|
306
306
|
undoIgnore: true,
|
|
307
307
|
} );
|
|
308
308
|
},
|
package/src/lock-unlock.js
CHANGED
|
@@ -5,6 +5,6 @@ import { __dangerousOptInToUnstableAPIsOnlyForCoreModules } from '@wordpress/pri
|
|
|
5
5
|
|
|
6
6
|
export const { lock, unlock } =
|
|
7
7
|
__dangerousOptInToUnstableAPIsOnlyForCoreModules(
|
|
8
|
-
'I
|
|
8
|
+
'I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.',
|
|
9
9
|
'@wordpress/edit-site'
|
|
10
10
|
);
|