@wordpress/edit-site 6.3.0 → 6.4.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-pattern/index.js +8 -2
- package/build/components/add-new-pattern/index.js.map +1 -1
- package/build/components/add-new-template/index.js +3 -1
- package/build/components/add-new-template/index.js.map +1 -1
- package/build/components/block-editor/use-site-editor-settings.js +1 -82
- package/build/components/block-editor/use-site-editor-settings.js.map +1 -1
- package/build/components/global-styles/block-preview-panel.js +14 -5
- package/build/components/global-styles/block-preview-panel.js.map +1 -1
- package/build/components/global-styles/font-families.js +42 -23
- package/build/components/global-styles/font-families.js.map +1 -1
- package/build/components/global-styles/font-library-modal/index.js +4 -4
- package/build/components/global-styles/font-library-modal/index.js.map +1 -1
- package/build/components/global-styles/font-library-modal/installed-fonts.js +58 -10
- package/build/components/global-styles/font-library-modal/installed-fonts.js.map +1 -1
- package/build/components/global-styles/font-sizes/confirm-delete-font-size-dialog.js +39 -0
- package/build/components/global-styles/font-sizes/confirm-delete-font-size-dialog.js.map +1 -0
- package/build/components/global-styles/font-sizes/confirm-reset-font-sizes-dialog.js +39 -0
- package/build/components/global-styles/font-sizes/confirm-reset-font-sizes-dialog.js.map +1 -0
- package/build/components/global-styles/font-sizes/font-size-preview.js +44 -0
- package/build/components/global-styles/font-sizes/font-size-preview.js.map +1 -0
- package/build/components/global-styles/font-sizes/font-size.js +213 -0
- package/build/components/global-styles/font-sizes/font-size.js.map +1 -0
- package/build/components/global-styles/font-sizes/font-sizes-count.js +50 -0
- package/build/components/global-styles/font-sizes/font-sizes-count.js.map +1 -0
- package/build/components/global-styles/font-sizes/font-sizes.js +163 -0
- package/build/components/global-styles/font-sizes/font-sizes.js.map +1 -0
- package/build/components/global-styles/font-sizes/rename-font-size-dialog.js +67 -0
- package/build/components/global-styles/font-sizes/rename-font-size-dialog.js.map +1 -0
- package/build/components/global-styles/screen-block.js +10 -8
- package/build/components/global-styles/screen-block.js.map +1 -1
- package/build/components/global-styles/screen-style-variations.js +2 -2
- package/build/components/global-styles/screen-style-variations.js.map +1 -1
- package/build/components/global-styles/screen-typography.js +3 -2
- package/build/components/global-styles/screen-typography.js.map +1 -1
- package/build/components/global-styles/size-control/index.js +85 -0
- package/build/components/global-styles/size-control/index.js.map +1 -0
- package/build/components/global-styles/style-variations-container.js +3 -0
- package/build/components/global-styles/style-variations-container.js.map +1 -1
- package/build/components/global-styles/ui.js +8 -0
- package/build/components/global-styles/ui.js.map +1 -1
- package/build/components/global-styles/variations/variations-color.js.map +1 -1
- package/build/components/global-styles/variations/variations-typography.js +1 -1
- package/build/components/global-styles/variations/variations-typography.js.map +1 -1
- package/build/components/layout/index.js +6 -0
- package/build/components/layout/index.js.map +1 -1
- package/build/components/layout/router.js +14 -6
- package/build/components/layout/router.js.map +1 -1
- package/build/components/page-patterns/header.js +1 -1
- package/build/components/page-patterns/header.js.map +1 -1
- package/build/components/page-patterns/index.js +23 -11
- package/build/components/page-patterns/index.js.map +1 -1
- package/build/components/page-templates/index.js +41 -34
- package/build/components/page-templates/index.js.map +1 -1
- package/build/components/post-edit/index.js +105 -0
- package/build/components/post-edit/index.js.map +1 -0
- package/build/components/post-fields/index.js +314 -0
- package/build/components/post-fields/index.js.map +1 -0
- package/build/components/post-list/index.js +281 -0
- package/build/components/post-list/index.js.map +1 -0
- package/build/components/posts-app/router.js +3 -3
- package/build/components/posts-app/router.js.map +1 -1
- package/build/components/sidebar-dataviews/default-views.js +22 -10
- package/build/components/sidebar-dataviews/default-views.js.map +1 -1
- package/build/components/sidebar-dataviews/index.js +40 -1
- package/build/components/sidebar-dataviews/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-global-styles/content.js +64 -0
- package/build/components/sidebar-navigation-screen-global-styles/content.js.map +1 -0
- package/build/components/sidebar-navigation-screen-global-styles/index.js +2 -47
- package/build/components/sidebar-navigation-screen-global-styles/index.js.map +1 -1
- package/build/hooks/push-changes-to-global-styles/index.js +1 -1
- package/build/hooks/push-changes-to-global-styles/index.js.map +1 -1
- package/build/index.js +5 -1
- package/build/index.js.map +1 -1
- package/build/store/selectors.js +34 -6
- package/build/store/selectors.js.map +1 -1
- package/build/utils/get-filtered-template-parts.js +64 -0
- package/build/utils/get-filtered-template-parts.js.map +1 -0
- package/build-module/components/add-new-pattern/index.js +8 -2
- package/build-module/components/add-new-pattern/index.js.map +1 -1
- package/build-module/components/add-new-template/index.js +3 -1
- package/build-module/components/add-new-template/index.js.map +1 -1
- package/build-module/components/block-editor/use-site-editor-settings.js +1 -82
- package/build-module/components/block-editor/use-site-editor-settings.js.map +1 -1
- package/build-module/components/global-styles/block-preview-panel.js +14 -5
- package/build-module/components/global-styles/block-preview-panel.js.map +1 -1
- package/build-module/components/global-styles/font-families.js +44 -25
- package/build-module/components/global-styles/font-families.js.map +1 -1
- package/build-module/components/global-styles/font-library-modal/index.js +4 -4
- package/build-module/components/global-styles/font-library-modal/index.js.map +1 -1
- package/build-module/components/global-styles/font-library-modal/installed-fonts.js +61 -13
- package/build-module/components/global-styles/font-library-modal/installed-fonts.js.map +1 -1
- package/build-module/components/global-styles/font-sizes/confirm-delete-font-size-dialog.js +32 -0
- package/build-module/components/global-styles/font-sizes/confirm-delete-font-size-dialog.js.map +1 -0
- package/build-module/components/global-styles/font-sizes/confirm-reset-font-sizes-dialog.js +32 -0
- package/build-module/components/global-styles/font-sizes/confirm-reset-font-sizes-dialog.js.map +1 -0
- package/build-module/components/global-styles/font-sizes/font-size-preview.js +37 -0
- package/build-module/components/global-styles/font-sizes/font-size-preview.js.map +1 -0
- package/build-module/components/global-styles/font-sizes/font-size.js +207 -0
- package/build-module/components/global-styles/font-sizes/font-size.js.map +1 -0
- package/build-module/components/global-styles/font-sizes/font-sizes-count.js +43 -0
- package/build-module/components/global-styles/font-sizes/font-sizes-count.js.map +1 -0
- package/build-module/components/global-styles/font-sizes/font-sizes.js +157 -0
- package/build-module/components/global-styles/font-sizes/font-sizes.js.map +1 -0
- package/build-module/components/global-styles/font-sizes/rename-font-size-dialog.js +61 -0
- package/build-module/components/global-styles/font-sizes/rename-font-size-dialog.js.map +1 -0
- package/build-module/components/global-styles/screen-block.js +10 -8
- package/build-module/components/global-styles/screen-block.js.map +1 -1
- package/build-module/components/global-styles/screen-style-variations.js +2 -2
- package/build-module/components/global-styles/screen-style-variations.js.map +1 -1
- package/build-module/components/global-styles/screen-typography.js +3 -2
- package/build-module/components/global-styles/screen-typography.js.map +1 -1
- package/build-module/components/global-styles/size-control/index.js +79 -0
- package/build-module/components/global-styles/size-control/index.js.map +1 -0
- package/build-module/components/global-styles/style-variations-container.js +3 -0
- package/build-module/components/global-styles/style-variations-container.js.map +1 -1
- package/build-module/components/global-styles/ui.js +8 -0
- package/build-module/components/global-styles/ui.js.map +1 -1
- package/build-module/components/global-styles/variations/variations-color.js +1 -1
- package/build-module/components/global-styles/variations/variations-color.js.map +1 -1
- package/build-module/components/global-styles/variations/variations-typography.js +1 -2
- package/build-module/components/global-styles/variations/variations-typography.js.map +1 -1
- package/build-module/components/layout/index.js +6 -0
- package/build-module/components/layout/index.js.map +1 -1
- package/build-module/components/layout/router.js +14 -6
- package/build-module/components/layout/router.js.map +1 -1
- package/build-module/components/page-patterns/header.js +1 -1
- package/build-module/components/page-patterns/header.js.map +1 -1
- package/build-module/components/page-patterns/index.js +23 -11
- package/build-module/components/page-patterns/index.js.map +1 -1
- package/build-module/components/page-templates/index.js +43 -37
- package/build-module/components/page-templates/index.js.map +1 -1
- package/build-module/components/post-edit/index.js +98 -0
- package/build-module/components/post-edit/index.js.map +1 -0
- package/build-module/components/post-fields/index.js +306 -0
- package/build-module/components/post-fields/index.js.map +1 -0
- package/build-module/components/post-list/index.js +275 -0
- package/build-module/components/post-list/index.js.map +1 -0
- package/build-module/components/posts-app/router.js +3 -3
- package/build-module/components/posts-app/router.js.map +1 -1
- package/build-module/components/sidebar-dataviews/default-views.js +21 -9
- package/build-module/components/sidebar-dataviews/default-views.js.map +1 -1
- package/build-module/components/sidebar-dataviews/index.js +42 -3
- package/build-module/components/sidebar-dataviews/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-global-styles/content.js +57 -0
- package/build-module/components/sidebar-navigation-screen-global-styles/content.js.map +1 -0
- package/build-module/components/sidebar-navigation-screen-global-styles/index.js +2 -47
- package/build-module/components/sidebar-navigation-screen-global-styles/index.js.map +1 -1
- package/build-module/hooks/push-changes-to-global-styles/index.js +1 -1
- package/build-module/hooks/push-changes-to-global-styles/index.js.map +1 -1
- package/build-module/index.js +5 -1
- package/build-module/index.js.map +1 -1
- package/build-module/store/selectors.js +35 -7
- package/build-module/store/selectors.js.map +1 -1
- package/build-module/utils/get-filtered-template-parts.js +57 -0
- package/build-module/utils/get-filtered-template-parts.js.map +1 -0
- package/build-style/posts-rtl.css +581 -503
- package/build-style/posts.css +581 -503
- package/build-style/style-rtl.css +621 -519
- package/build-style/style.css +621 -519
- package/package.json +41 -41
- package/src/components/add-new-pattern/index.js +8 -2
- package/src/components/add-new-template/index.js +4 -1
- package/src/components/add-new-template/style.scss +4 -6
- package/src/components/block-editor/use-site-editor-settings.js +15 -111
- package/src/components/global-styles/block-preview-panel.js +22 -9
- package/src/components/global-styles/font-families.js +66 -31
- package/src/components/global-styles/font-library-modal/index.js +4 -2
- package/src/components/global-styles/font-library-modal/installed-fonts.js +92 -11
- package/src/components/global-styles/font-library-modal/style.scss +9 -0
- package/src/components/global-styles/font-sizes/confirm-delete-font-size-dialog.js +43 -0
- package/src/components/global-styles/font-sizes/confirm-reset-font-sizes-dialog.js +37 -0
- package/src/components/global-styles/font-sizes/font-size-preview.js +43 -0
- package/src/components/global-styles/font-sizes/font-size.js +250 -0
- package/src/components/global-styles/font-sizes/font-sizes-count.js +40 -0
- package/src/components/global-styles/font-sizes/font-sizes.js +263 -0
- package/src/components/global-styles/font-sizes/rename-font-size-dialog.js +70 -0
- package/src/components/global-styles/screen-block.js +12 -14
- package/src/components/global-styles/screen-style-variations.js +2 -2
- package/src/components/global-styles/screen-typography.js +3 -2
- package/src/components/global-styles/size-control/index.js +86 -0
- package/src/components/global-styles/style-variations-container.js +4 -0
- package/src/components/global-styles/style.scss +13 -3
- package/src/components/global-styles/ui.js +10 -0
- package/src/components/global-styles/variations/variations-color.js +1 -1
- package/src/components/global-styles/variations/variations-typography.js +1 -2
- package/src/components/layout/index.js +11 -0
- package/src/components/layout/router.js +13 -5
- package/src/components/layout/style.scss +26 -8
- package/src/components/page-patterns/header.js +1 -1
- package/src/components/page-patterns/index.js +15 -8
- package/src/components/page-templates/index.js +51 -46
- package/src/components/page-templates/style.scss +5 -3
- package/src/components/post-edit/index.js +96 -0
- package/src/components/post-edit/style.scss +9 -0
- package/src/components/post-fields/index.js +345 -0
- package/src/components/post-list/index.js +326 -0
- package/src/components/{posts-app → post-list}/style.scss +12 -9
- package/src/components/posts-app/router.js +3 -3
- package/src/components/sidebar-dataviews/default-views.js +21 -9
- package/src/components/sidebar-dataviews/index.js +36 -1
- package/src/components/sidebar-navigation-screen-global-styles/content.js +55 -0
- package/src/components/sidebar-navigation-screen-global-styles/index.js +1 -55
- package/src/hooks/push-changes-to-global-styles/index.js +1 -1
- package/src/index.js +7 -1
- package/src/posts.scss +1 -1
- package/src/store/selectors.js +53 -14
- package/src/store/test/selectors.js +1 -26
- package/src/style.scss +2 -1
- package/src/utils/get-filtered-template-parts.js +61 -0
- package/src/utils/test/get-filtered-template-parts.js +127 -0
- package/build/components/global-styles/screen-background.js +0 -36
- package/build/components/global-styles/screen-background.js.map +0 -1
- package/build/components/posts-app/posts-list.js +0 -568
- package/build/components/posts-app/posts-list.js.map +0 -1
- package/build-module/components/global-styles/screen-background.js +0 -30
- package/build-module/components/global-styles/screen-background.js.map +0 -1
- package/build-module/components/posts-app/posts-list.js +0 -560
- package/build-module/components/posts-app/posts-list.js.map +0 -1
- package/src/components/global-styles/screen-background.js +0 -29
- package/src/components/posts-app/posts-list.js +0 -651
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wordpress/edit-site",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.4.0",
|
|
4
4
|
"description": "Edit Site Page module for WordPress.",
|
|
5
5
|
"author": "The WordPress Contributors",
|
|
6
6
|
"license": "GPL-2.0-or-later",
|
|
@@ -29,45 +29,45 @@
|
|
|
29
29
|
"dependencies": {
|
|
30
30
|
"@babel/runtime": "^7.16.0",
|
|
31
31
|
"@react-spring/web": "^9.4.5",
|
|
32
|
-
"@wordpress/a11y": "^4.
|
|
33
|
-
"@wordpress/api-fetch": "^7.
|
|
34
|
-
"@wordpress/blob": "^4.
|
|
35
|
-
"@wordpress/block-editor": "^13.
|
|
36
|
-
"@wordpress/block-library": "^9.
|
|
37
|
-
"@wordpress/blocks": "^13.
|
|
38
|
-
"@wordpress/commands": "^1.
|
|
39
|
-
"@wordpress/components": "^28.
|
|
40
|
-
"@wordpress/compose": "^7.
|
|
41
|
-
"@wordpress/core-commands": "^1.
|
|
42
|
-
"@wordpress/core-data": "^7.
|
|
43
|
-
"@wordpress/data": "^10.
|
|
44
|
-
"@wordpress/dataviews": "^
|
|
45
|
-
"@wordpress/date": "^5.
|
|
46
|
-
"@wordpress/deprecated": "^4.
|
|
47
|
-
"@wordpress/dom": "^4.
|
|
48
|
-
"@wordpress/editor": "^14.
|
|
49
|
-
"@wordpress/element": "^6.
|
|
50
|
-
"@wordpress/escape-html": "^3.
|
|
51
|
-
"@wordpress/hooks": "^4.
|
|
52
|
-
"@wordpress/html-entities": "^4.
|
|
53
|
-
"@wordpress/i18n": "^5.
|
|
54
|
-
"@wordpress/icons": "^10.
|
|
55
|
-
"@wordpress/keyboard-shortcuts": "^5.
|
|
56
|
-
"@wordpress/keycodes": "^4.
|
|
57
|
-
"@wordpress/notices": "^5.
|
|
58
|
-
"@wordpress/patterns": "^2.
|
|
59
|
-
"@wordpress/plugins": "^7.
|
|
60
|
-
"@wordpress/preferences": "^4.
|
|
61
|
-
"@wordpress/primitives": "^4.
|
|
62
|
-
"@wordpress/priority-queue": "^3.
|
|
63
|
-
"@wordpress/private-apis": "^1.
|
|
64
|
-
"@wordpress/reusable-blocks": "^5.
|
|
65
|
-
"@wordpress/router": "^1.
|
|
66
|
-
"@wordpress/style-engine": "^2.
|
|
67
|
-
"@wordpress/url": "^4.
|
|
68
|
-
"@wordpress/viewport": "^6.
|
|
69
|
-
"@wordpress/widgets": "^4.
|
|
70
|
-
"@wordpress/wordcount": "^4.
|
|
32
|
+
"@wordpress/a11y": "^4.4.0",
|
|
33
|
+
"@wordpress/api-fetch": "^7.4.0",
|
|
34
|
+
"@wordpress/blob": "^4.4.0",
|
|
35
|
+
"@wordpress/block-editor": "^13.4.0",
|
|
36
|
+
"@wordpress/block-library": "^9.4.0",
|
|
37
|
+
"@wordpress/blocks": "^13.4.0",
|
|
38
|
+
"@wordpress/commands": "^1.4.0",
|
|
39
|
+
"@wordpress/components": "^28.4.0",
|
|
40
|
+
"@wordpress/compose": "^7.4.0",
|
|
41
|
+
"@wordpress/core-commands": "^1.4.0",
|
|
42
|
+
"@wordpress/core-data": "^7.4.0",
|
|
43
|
+
"@wordpress/data": "^10.4.0",
|
|
44
|
+
"@wordpress/dataviews": "^4.0.0",
|
|
45
|
+
"@wordpress/date": "^5.4.0",
|
|
46
|
+
"@wordpress/deprecated": "^4.4.0",
|
|
47
|
+
"@wordpress/dom": "^4.4.0",
|
|
48
|
+
"@wordpress/editor": "^14.4.0",
|
|
49
|
+
"@wordpress/element": "^6.4.0",
|
|
50
|
+
"@wordpress/escape-html": "^3.4.0",
|
|
51
|
+
"@wordpress/hooks": "^4.4.0",
|
|
52
|
+
"@wordpress/html-entities": "^4.4.0",
|
|
53
|
+
"@wordpress/i18n": "^5.4.0",
|
|
54
|
+
"@wordpress/icons": "^10.4.0",
|
|
55
|
+
"@wordpress/keyboard-shortcuts": "^5.4.0",
|
|
56
|
+
"@wordpress/keycodes": "^4.4.0",
|
|
57
|
+
"@wordpress/notices": "^5.4.0",
|
|
58
|
+
"@wordpress/patterns": "^2.4.0",
|
|
59
|
+
"@wordpress/plugins": "^7.4.0",
|
|
60
|
+
"@wordpress/preferences": "^4.4.0",
|
|
61
|
+
"@wordpress/primitives": "^4.4.0",
|
|
62
|
+
"@wordpress/priority-queue": "^3.4.0",
|
|
63
|
+
"@wordpress/private-apis": "^1.4.0",
|
|
64
|
+
"@wordpress/reusable-blocks": "^5.4.0",
|
|
65
|
+
"@wordpress/router": "^1.4.0",
|
|
66
|
+
"@wordpress/style-engine": "^2.4.0",
|
|
67
|
+
"@wordpress/url": "^4.4.0",
|
|
68
|
+
"@wordpress/viewport": "^6.4.0",
|
|
69
|
+
"@wordpress/widgets": "^4.4.0",
|
|
70
|
+
"@wordpress/wordcount": "^4.4.0",
|
|
71
71
|
"change-case": "^4.1.2",
|
|
72
72
|
"clsx": "^2.1.1",
|
|
73
73
|
"colord": "^2.9.2",
|
|
@@ -82,5 +82,5 @@
|
|
|
82
82
|
"publishConfig": {
|
|
83
83
|
"access": "public"
|
|
84
84
|
},
|
|
85
|
-
"gitHead": "
|
|
85
|
+
"gitHead": "363edb39b8dda8727f652e42cbb8497732693ed2"
|
|
86
86
|
}
|
|
@@ -56,8 +56,14 @@ export default function AddNewPattern() {
|
|
|
56
56
|
addNewTemplatePartLabel: getPostType( TEMPLATE_PART_POST_TYPE )
|
|
57
57
|
?.labels?.add_new_item,
|
|
58
58
|
// Blocks refers to the wp_block post type, this checks the ability to create a post of that type.
|
|
59
|
-
canCreatePattern: canUser( 'create',
|
|
60
|
-
|
|
59
|
+
canCreatePattern: canUser( 'create', {
|
|
60
|
+
kind: 'postType',
|
|
61
|
+
name: PATTERN_TYPES.user,
|
|
62
|
+
} ),
|
|
63
|
+
canCreateTemplatePart: canUser( 'create', {
|
|
64
|
+
kind: 'postType',
|
|
65
|
+
name: TEMPLATE_PART_POST_TYPE,
|
|
66
|
+
} ),
|
|
61
67
|
};
|
|
62
68
|
}, [] );
|
|
63
69
|
|
|
@@ -19,6 +19,7 @@ import { decodeEntities } from '@wordpress/html-entities';
|
|
|
19
19
|
import { useState, memo } from '@wordpress/element';
|
|
20
20
|
import { useSelect, useDispatch } from '@wordpress/data';
|
|
21
21
|
import { store as coreStore } from '@wordpress/core-data';
|
|
22
|
+
import { useViewportMatch } from '@wordpress/compose';
|
|
22
23
|
import {
|
|
23
24
|
archive,
|
|
24
25
|
blockMeta,
|
|
@@ -161,6 +162,8 @@ function NewTemplateModal( { onClose } ) {
|
|
|
161
162
|
const { createErrorNotice, createSuccessNotice } =
|
|
162
163
|
useDispatch( noticesStore );
|
|
163
164
|
|
|
165
|
+
const isMobile = useViewportMatch( 'medium', '<' );
|
|
166
|
+
|
|
164
167
|
const { homeUrl } = useSelect( ( select ) => {
|
|
165
168
|
const {
|
|
166
169
|
getUnstableBase, // Site index.
|
|
@@ -266,7 +269,7 @@ function NewTemplateModal( { onClose } ) {
|
|
|
266
269
|
>
|
|
267
270
|
{ modalContent === modalContentMap.templatesList && (
|
|
268
271
|
<Grid
|
|
269
|
-
columns={ 3 }
|
|
272
|
+
columns={ isMobile ? 2 : 3 }
|
|
270
273
|
gap={ 4 }
|
|
271
274
|
align="flex-start"
|
|
272
275
|
justify="center"
|
|
@@ -97,13 +97,12 @@
|
|
|
97
97
|
}
|
|
98
98
|
|
|
99
99
|
.edit-site-add-new-template__modal {
|
|
100
|
-
max-width: $grid-unit-80 * 13;
|
|
101
|
-
width: calc(100% - #{$grid-unit-80});
|
|
102
|
-
margin-top: $grid-unit-80;
|
|
103
|
-
max-height: calc(100% - #{$grid-unit-80 * 2});
|
|
104
100
|
|
|
105
101
|
@include break-large() {
|
|
102
|
+
max-width: $grid-unit-80 * 13;
|
|
103
|
+
margin-top: $grid-unit-80;
|
|
106
104
|
width: calc(100% - #{$grid-unit-80 * 2});
|
|
105
|
+
max-height: calc(100% - #{$grid-unit-80 * 2});
|
|
107
106
|
}
|
|
108
107
|
|
|
109
108
|
.edit-site-add-new-template__template-button,
|
|
@@ -175,8 +174,7 @@
|
|
|
175
174
|
|
|
176
175
|
.edit-site-add-new-template__custom-template-button,
|
|
177
176
|
.edit-site-add-new-template__template-list__prompt {
|
|
178
|
-
grid-column
|
|
179
|
-
grid-column-end: 4;
|
|
177
|
+
grid-column: 1 / -1;
|
|
180
178
|
}
|
|
181
179
|
}
|
|
182
180
|
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import { useSelect } from '@wordpress/data';
|
|
5
5
|
import { useMemo } from '@wordpress/element';
|
|
6
|
-
import { store as coreStore } from '@wordpress/core-data';
|
|
7
6
|
import { privateApis as editorPrivateApis } from '@wordpress/editor';
|
|
8
7
|
import { privateApis as routerPrivateApis } from '@wordpress/router';
|
|
9
8
|
import { usePrevious } from '@wordpress/compose';
|
|
@@ -19,78 +18,6 @@ import { FOCUSABLE_ENTITIES } from '../../utils/constants';
|
|
|
19
18
|
const { useBlockEditorSettings } = unlock( editorPrivateApis );
|
|
20
19
|
const { useLocation, useHistory } = unlock( routerPrivateApis );
|
|
21
20
|
|
|
22
|
-
function useArchiveLabel( templateSlug ) {
|
|
23
|
-
const taxonomyMatches = templateSlug?.match(
|
|
24
|
-
/^(category|tag|taxonomy-([^-]+))$|^(((category|tag)|taxonomy-([^-]+))-(.+))$/
|
|
25
|
-
);
|
|
26
|
-
let taxonomy;
|
|
27
|
-
let term;
|
|
28
|
-
let isAuthor = false;
|
|
29
|
-
let authorSlug;
|
|
30
|
-
if ( taxonomyMatches ) {
|
|
31
|
-
// If is for a all taxonomies of a type
|
|
32
|
-
if ( taxonomyMatches[ 1 ] ) {
|
|
33
|
-
taxonomy = taxonomyMatches[ 2 ]
|
|
34
|
-
? taxonomyMatches[ 2 ]
|
|
35
|
-
: taxonomyMatches[ 1 ];
|
|
36
|
-
}
|
|
37
|
-
// If is for a all taxonomies of a type
|
|
38
|
-
else if ( taxonomyMatches[ 3 ] ) {
|
|
39
|
-
taxonomy = taxonomyMatches[ 6 ]
|
|
40
|
-
? taxonomyMatches[ 6 ]
|
|
41
|
-
: taxonomyMatches[ 4 ];
|
|
42
|
-
term = taxonomyMatches[ 7 ];
|
|
43
|
-
}
|
|
44
|
-
taxonomy = taxonomy === 'tag' ? 'post_tag' : taxonomy;
|
|
45
|
-
|
|
46
|
-
//getTaxonomy( 'category' );
|
|
47
|
-
//wp.data.select('core').getEntityRecords( 'taxonomy', 'category', {slug: 'newcat'} );
|
|
48
|
-
} else {
|
|
49
|
-
const authorMatches = templateSlug?.match( /^(author)$|^author-(.+)$/ );
|
|
50
|
-
if ( authorMatches ) {
|
|
51
|
-
isAuthor = true;
|
|
52
|
-
if ( authorMatches[ 2 ] ) {
|
|
53
|
-
authorSlug = authorMatches[ 2 ];
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
return useSelect(
|
|
58
|
-
( select ) => {
|
|
59
|
-
const { getEntityRecords, getTaxonomy, getAuthors } =
|
|
60
|
-
select( coreStore );
|
|
61
|
-
let archiveTypeLabel;
|
|
62
|
-
let archiveNameLabel;
|
|
63
|
-
if ( taxonomy ) {
|
|
64
|
-
archiveTypeLabel =
|
|
65
|
-
getTaxonomy( taxonomy )?.labels?.singular_name;
|
|
66
|
-
}
|
|
67
|
-
if ( term ) {
|
|
68
|
-
const records = getEntityRecords( 'taxonomy', taxonomy, {
|
|
69
|
-
slug: term,
|
|
70
|
-
per_page: 1,
|
|
71
|
-
} );
|
|
72
|
-
if ( records && records[ 0 ] ) {
|
|
73
|
-
archiveNameLabel = records[ 0 ].name;
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
if ( isAuthor ) {
|
|
77
|
-
archiveTypeLabel = 'Author';
|
|
78
|
-
if ( authorSlug ) {
|
|
79
|
-
const authorRecords = getAuthors( { slug: authorSlug } );
|
|
80
|
-
if ( authorRecords && authorRecords[ 0 ] ) {
|
|
81
|
-
archiveNameLabel = authorRecords[ 0 ].name;
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
return {
|
|
86
|
-
archiveTypeLabel,
|
|
87
|
-
archiveNameLabel,
|
|
88
|
-
};
|
|
89
|
-
},
|
|
90
|
-
[ authorSlug, isAuthor, taxonomy, term ]
|
|
91
|
-
);
|
|
92
|
-
}
|
|
93
|
-
|
|
94
21
|
function useNavigateToPreviousEntityRecord() {
|
|
95
22
|
const location = useLocation();
|
|
96
23
|
const previousLocation = usePrevious( location );
|
|
@@ -114,39 +41,21 @@ function useNavigateToPreviousEntityRecord() {
|
|
|
114
41
|
|
|
115
42
|
export function useSpecificEditorSettings() {
|
|
116
43
|
const onNavigateToEntityRecord = useNavigateToEntityRecord();
|
|
117
|
-
const {
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
const usedPostId = getEditedPostId();
|
|
133
|
-
const _record = getEditedEntityRecord(
|
|
134
|
-
'postType',
|
|
135
|
-
usedPostType,
|
|
136
|
-
usedPostId
|
|
137
|
-
);
|
|
138
|
-
const _context = getEditedPostContext();
|
|
139
|
-
return {
|
|
140
|
-
templateSlug: _record.slug,
|
|
141
|
-
canvasMode: getCanvasMode(),
|
|
142
|
-
settings: getSettings(),
|
|
143
|
-
// TODO: The `postType` check should be removed when the default rendering mode per post type is merged.
|
|
144
|
-
// @see https://github.com/WordPress/gutenberg/pull/62304/
|
|
145
|
-
shouldUseTemplateAsDefaultRenderingMode:
|
|
146
|
-
_context?.postId && _context?.postType !== 'post',
|
|
147
|
-
};
|
|
148
|
-
}, [] );
|
|
149
|
-
const archiveLabels = useArchiveLabel( templateSlug );
|
|
44
|
+
const { canvasMode, settings, shouldUseTemplateAsDefaultRenderingMode } =
|
|
45
|
+
useSelect( ( select ) => {
|
|
46
|
+
const { getEditedPostContext, getCanvasMode, getSettings } = unlock(
|
|
47
|
+
select( editSiteStore )
|
|
48
|
+
);
|
|
49
|
+
const _context = getEditedPostContext();
|
|
50
|
+
return {
|
|
51
|
+
canvasMode: getCanvasMode(),
|
|
52
|
+
settings: getSettings(),
|
|
53
|
+
// TODO: The `postType` check should be removed when the default rendering mode per post type is merged.
|
|
54
|
+
// @see https://github.com/WordPress/gutenberg/pull/62304/
|
|
55
|
+
shouldUseTemplateAsDefaultRenderingMode:
|
|
56
|
+
_context?.postId && _context?.postType !== 'post',
|
|
57
|
+
};
|
|
58
|
+
}, [] );
|
|
150
59
|
const defaultRenderingMode = shouldUseTemplateAsDefaultRenderingMode
|
|
151
60
|
? 'template-locked'
|
|
152
61
|
: 'post-only';
|
|
@@ -162,9 +71,6 @@ export function useSpecificEditorSettings() {
|
|
|
162
71
|
defaultRenderingMode,
|
|
163
72
|
onNavigateToEntityRecord,
|
|
164
73
|
onNavigateToPreviousEntityRecord,
|
|
165
|
-
// I wonder if they should be set in the post editor too
|
|
166
|
-
__experimentalArchiveTitleTypeLabel: archiveLabels.archiveTypeLabel,
|
|
167
|
-
__experimentalArchiveTitleNameLabel: archiveLabels.archiveNameLabel,
|
|
168
74
|
__unstableIsPreviewMode: canvasMode === 'view',
|
|
169
75
|
};
|
|
170
76
|
}, [
|
|
@@ -173,8 +79,6 @@ export function useSpecificEditorSettings() {
|
|
|
173
79
|
defaultRenderingMode,
|
|
174
80
|
onNavigateToEntityRecord,
|
|
175
81
|
onNavigateToPreviousEntityRecord,
|
|
176
|
-
archiveLabels.archiveTypeLabel,
|
|
177
|
-
archiveLabels.archiveNameLabel,
|
|
178
82
|
] );
|
|
179
83
|
|
|
180
84
|
return defaultEditorSettings;
|
|
@@ -32,8 +32,15 @@ const BlockPreviewPanel = ( { name, variation = '' } ) => {
|
|
|
32
32
|
return getBlockFromExample( name, example );
|
|
33
33
|
}, [ name, blockExample, variation ] );
|
|
34
34
|
|
|
35
|
-
const viewportWidth = blockExample?.viewportWidth ??
|
|
36
|
-
|
|
35
|
+
const viewportWidth = blockExample?.viewportWidth ?? 500;
|
|
36
|
+
// Same as height of InserterPreviewPanel.
|
|
37
|
+
const previewHeight = 144;
|
|
38
|
+
const sidebarWidth = 235;
|
|
39
|
+
const scale = sidebarWidth / viewportWidth;
|
|
40
|
+
const minHeight =
|
|
41
|
+
scale !== 0 && scale < 1 && previewHeight
|
|
42
|
+
? previewHeight / scale
|
|
43
|
+
: previewHeight;
|
|
37
44
|
|
|
38
45
|
if ( ! blockExample ) {
|
|
39
46
|
return null;
|
|
@@ -49,16 +56,22 @@ const BlockPreviewPanel = ( { name, variation = '' } ) => {
|
|
|
49
56
|
blocks={ blocks }
|
|
50
57
|
viewportWidth={ viewportWidth }
|
|
51
58
|
minHeight={ previewHeight }
|
|
52
|
-
additionalStyles={
|
|
53
|
-
|
|
54
|
-
|
|
59
|
+
additionalStyles={
|
|
60
|
+
//We want this CSS to be in sync with the one in InserterPreviewPanel.
|
|
61
|
+
[
|
|
62
|
+
{
|
|
63
|
+
css: `
|
|
55
64
|
body{
|
|
56
|
-
|
|
57
|
-
|
|
65
|
+
padding: 24px;
|
|
66
|
+
min-height:${ Math.round( minHeight ) }px;
|
|
67
|
+
display:flex;
|
|
68
|
+
align-items:center;
|
|
58
69
|
}
|
|
70
|
+
.is-root-container { width: 100%; }
|
|
59
71
|
`,
|
|
60
|
-
|
|
61
|
-
|
|
72
|
+
},
|
|
73
|
+
]
|
|
74
|
+
}
|
|
62
75
|
/>
|
|
63
76
|
</div>
|
|
64
77
|
</Spacer>
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
|
-
import { __ } from '@wordpress/i18n';
|
|
4
|
+
import { __, _x } from '@wordpress/i18n';
|
|
5
5
|
import {
|
|
6
|
+
__experimentalText as Text,
|
|
6
7
|
__experimentalItemGroup as ItemGroup,
|
|
7
8
|
__experimentalVStack as VStack,
|
|
8
9
|
Button,
|
|
@@ -25,8 +26,14 @@ import { unlock } from '../../lock-unlock';
|
|
|
25
26
|
const { useGlobalSetting } = unlock( blockEditorPrivateApis );
|
|
26
27
|
|
|
27
28
|
function FontFamilies() {
|
|
28
|
-
const { modalTabOpen, setModalTabOpen } =
|
|
29
|
+
const { baseCustomFonts, modalTabOpen, setModalTabOpen, setNotice } =
|
|
30
|
+
useContext( FontLibraryContext );
|
|
29
31
|
const [ fontFamilies ] = useGlobalSetting( 'typography.fontFamilies' );
|
|
32
|
+
const [ baseFontFamilies ] = useGlobalSetting(
|
|
33
|
+
'typography.fontFamilies',
|
|
34
|
+
undefined,
|
|
35
|
+
'base'
|
|
36
|
+
);
|
|
30
37
|
const themeFonts = fontFamilies?.theme
|
|
31
38
|
? fontFamilies.theme
|
|
32
39
|
.map( ( f ) => setUIValuesNeeded( f, { source: 'theme' } ) )
|
|
@@ -39,6 +46,11 @@ function FontFamilies() {
|
|
|
39
46
|
: [];
|
|
40
47
|
const hasFonts = 0 < customFonts.length || 0 < themeFonts.length;
|
|
41
48
|
|
|
49
|
+
const hasInstalledFonts =
|
|
50
|
+
hasFonts ||
|
|
51
|
+
baseFontFamilies?.theme?.length > 0 ||
|
|
52
|
+
baseCustomFonts?.length > 0;
|
|
53
|
+
|
|
42
54
|
return (
|
|
43
55
|
<>
|
|
44
56
|
{ !! modalTabOpen && (
|
|
@@ -48,48 +60,71 @@ function FontFamilies() {
|
|
|
48
60
|
/>
|
|
49
61
|
) }
|
|
50
62
|
|
|
51
|
-
<VStack spacing={
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
63
|
+
<VStack spacing={ 4 }>
|
|
64
|
+
{ themeFonts.length > 0 && (
|
|
65
|
+
<VStack>
|
|
66
|
+
<Subtitle level={ 3 }>
|
|
67
|
+
{
|
|
68
|
+
/* translators: Heading for a list of fonts provided by the theme. */
|
|
69
|
+
_x( 'Theme', 'font source' )
|
|
70
|
+
}
|
|
71
|
+
</Subtitle>
|
|
55
72
|
<ItemGroup isBordered isSeparated>
|
|
56
|
-
{
|
|
73
|
+
{ themeFonts.map( ( font ) => (
|
|
57
74
|
<FontFamilyItem
|
|
58
75
|
key={ font.slug }
|
|
59
76
|
font={ font }
|
|
60
77
|
/>
|
|
61
78
|
) ) }
|
|
62
|
-
|
|
79
|
+
</ItemGroup>
|
|
80
|
+
</VStack>
|
|
81
|
+
) }
|
|
82
|
+
{ customFonts.length > 0 && (
|
|
83
|
+
<VStack>
|
|
84
|
+
<Subtitle level={ 3 }>
|
|
85
|
+
{
|
|
86
|
+
/* translators: Heading for a list of fonts installed by the user. */
|
|
87
|
+
_x( 'Custom', 'font source' )
|
|
88
|
+
}
|
|
89
|
+
</Subtitle>
|
|
90
|
+
<ItemGroup isBordered isSeparated>
|
|
91
|
+
{ customFonts.map( ( font ) => (
|
|
63
92
|
<FontFamilyItem
|
|
64
93
|
key={ font.slug }
|
|
65
94
|
font={ font }
|
|
66
95
|
/>
|
|
67
96
|
) ) }
|
|
68
97
|
</ItemGroup>
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
</
|
|
79
|
-
|
|
80
|
-
) : (
|
|
81
|
-
<>
|
|
82
|
-
{ __( 'No fonts installed.' ) }
|
|
83
|
-
<Button
|
|
84
|
-
className="edit-site-global-styles-font-families__add-fonts"
|
|
85
|
-
variant="secondary"
|
|
86
|
-
__next40pxDefaultSize
|
|
87
|
-
onClick={ () => setModalTabOpen( 'upload-fonts' ) }
|
|
88
|
-
>
|
|
89
|
-
{ __( 'Add fonts' ) }
|
|
90
|
-
</Button>
|
|
91
|
-
</>
|
|
98
|
+
</VStack>
|
|
99
|
+
) }
|
|
100
|
+
{ ! hasFonts && (
|
|
101
|
+
<VStack>
|
|
102
|
+
<Subtitle level={ 3 }>{ __( 'Fonts' ) }</Subtitle>
|
|
103
|
+
<Text as="p">
|
|
104
|
+
{ hasInstalledFonts
|
|
105
|
+
? __( 'No fonts activated.' )
|
|
106
|
+
: __( 'No fonts installed.' ) }
|
|
107
|
+
</Text>
|
|
108
|
+
</VStack>
|
|
92
109
|
) }
|
|
110
|
+
<Button
|
|
111
|
+
className="edit-site-global-styles-font-families__manage-fonts"
|
|
112
|
+
variant="secondary"
|
|
113
|
+
__next40pxDefaultSize
|
|
114
|
+
onClick={ () => {
|
|
115
|
+
// Reset notice when opening the modal.
|
|
116
|
+
setNotice( null );
|
|
117
|
+
setModalTabOpen(
|
|
118
|
+
hasInstalledFonts
|
|
119
|
+
? 'installed-fonts'
|
|
120
|
+
: 'upload-fonts'
|
|
121
|
+
);
|
|
122
|
+
} }
|
|
123
|
+
>
|
|
124
|
+
{ hasInstalledFonts
|
|
125
|
+
? __( 'Manage fonts' )
|
|
126
|
+
: __( 'Add fonts' ) }
|
|
127
|
+
</Button>
|
|
93
128
|
</VStack>
|
|
94
129
|
</>
|
|
95
130
|
);
|
|
@@ -46,8 +46,10 @@ function FontLibraryModal( {
|
|
|
46
46
|
} ) {
|
|
47
47
|
const { collections, setNotice } = useContext( FontLibraryContext );
|
|
48
48
|
const canUserCreate = useSelect( ( select ) => {
|
|
49
|
-
|
|
50
|
-
|
|
49
|
+
return select( coreStore ).canUser( 'create', {
|
|
50
|
+
kind: 'postType',
|
|
51
|
+
name: 'wp_font_family',
|
|
52
|
+
} );
|
|
51
53
|
}, [] );
|
|
52
54
|
|
|
53
55
|
const tabs = [ DEFAULT_TAB ];
|