@wordpress/edit-site 6.31.0 → 6.31.1-next.233ccab9b.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/build/components/add-new-template/add-custom-template-modal-content.js +2 -1
- package/build/components/add-new-template/add-custom-template-modal-content.js.map +1 -1
- package/build/components/add-new-template/utils.js +18 -3
- package/build/components/add-new-template/utils.js.map +1 -1
- package/build/components/global-styles/screen-css.js +2 -3
- package/build/components/global-styles/screen-css.js.map +1 -1
- package/build/components/global-styles/screen-root.js +3 -35
- package/build/components/global-styles/screen-root.js.map +1 -1
- package/build/components/sidebar-global-styles-wrapper/index.js +45 -13
- package/build/components/sidebar-global-styles-wrapper/index.js.map +1 -1
- package/build-module/components/add-new-template/add-custom-template-modal-content.js +2 -1
- package/build-module/components/add-new-template/add-custom-template-modal-content.js.map +1 -1
- package/build-module/components/add-new-template/utils.js +18 -3
- package/build-module/components/add-new-template/utils.js.map +1 -1
- package/build-module/components/global-styles/screen-css.js +2 -3
- package/build-module/components/global-styles/screen-css.js.map +1 -1
- package/build-module/components/global-styles/screen-root.js +4 -36
- package/build-module/components/global-styles/screen-root.js.map +1 -1
- package/build-module/components/sidebar-global-styles-wrapper/index.js +48 -16
- package/build-module/components/sidebar-global-styles-wrapper/index.js.map +1 -1
- package/package.json +41 -41
- package/src/components/add-new-template/add-custom-template-modal-content.js +2 -1
- package/src/components/add-new-template/utils.js +27 -3
- package/src/components/global-styles/screen-css.js +4 -5
- package/src/components/global-styles/screen-root.js +5 -51
- package/src/components/sidebar-global-styles-wrapper/index.js +62 -16
|
@@ -2,12 +2,14 @@
|
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
4
|
import { __ } from '@wordpress/i18n';
|
|
5
|
+
import { useSelect } from '@wordpress/data';
|
|
6
|
+
import { store as coreStore } from '@wordpress/core-data';
|
|
5
7
|
import { useMemo, useState } from '@wordpress/element';
|
|
6
8
|
import { privateApis as routerPrivateApis } from '@wordpress/router';
|
|
7
9
|
import { useViewportMatch } from '@wordpress/compose';
|
|
8
|
-
import { Button } from '@wordpress/components';
|
|
10
|
+
import { Button, __experimentalHStack as HStack, DropdownMenu, MenuGroup, MenuItem } from '@wordpress/components';
|
|
9
11
|
import { addQueryArgs, removeQueryArgs } from '@wordpress/url';
|
|
10
|
-
import { seen } from '@wordpress/icons';
|
|
12
|
+
import { seen, moreVertical } from '@wordpress/icons';
|
|
11
13
|
|
|
12
14
|
/**
|
|
13
15
|
* Internal dependencies
|
|
@@ -15,7 +17,7 @@ import { seen } from '@wordpress/icons';
|
|
|
15
17
|
import GlobalStylesUI from '../global-styles/ui';
|
|
16
18
|
import Page from '../page';
|
|
17
19
|
import { unlock } from '../../lock-unlock';
|
|
18
|
-
import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
|
|
20
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
19
21
|
const {
|
|
20
22
|
useLocation,
|
|
21
23
|
useHistory
|
|
@@ -26,19 +28,49 @@ const GlobalStylesPageActions = ({
|
|
|
26
28
|
path
|
|
27
29
|
}) => {
|
|
28
30
|
const history = useHistory();
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
31
|
+
const canEditCSS = useSelect(select => {
|
|
32
|
+
const {
|
|
33
|
+
getEntityRecord,
|
|
34
|
+
__experimentalGetCurrentGlobalStylesId
|
|
35
|
+
} = select(coreStore);
|
|
36
|
+
const globalStylesId = __experimentalGetCurrentGlobalStylesId();
|
|
37
|
+
const globalStyles = globalStylesId ? getEntityRecord('root', 'globalStyles', globalStylesId) : undefined;
|
|
38
|
+
return !!globalStyles?._links?.['wp:action-edit-css'];
|
|
39
|
+
}, []);
|
|
40
|
+
return /*#__PURE__*/_jsxs(HStack, {
|
|
41
|
+
children: [/*#__PURE__*/_jsx(Button, {
|
|
42
|
+
isPressed: isStyleBookOpened,
|
|
43
|
+
icon: seen,
|
|
44
|
+
label: __('Style Book'),
|
|
45
|
+
onClick: () => {
|
|
46
|
+
setIsStyleBookOpened(!isStyleBookOpened);
|
|
47
|
+
const updatedPath = !isStyleBookOpened ? addQueryArgs(path, {
|
|
48
|
+
preview: 'stylebook'
|
|
49
|
+
}) : removeQueryArgs(path, 'preview');
|
|
50
|
+
// Navigate to the updated path.
|
|
51
|
+
history.navigate(updatedPath);
|
|
52
|
+
},
|
|
53
|
+
size: "compact"
|
|
54
|
+
}), canEditCSS && /*#__PURE__*/_jsx(DropdownMenu, {
|
|
55
|
+
icon: moreVertical,
|
|
56
|
+
label: __('More'),
|
|
57
|
+
toggleProps: {
|
|
58
|
+
size: 'compact'
|
|
59
|
+
},
|
|
60
|
+
children: ({
|
|
61
|
+
onClose
|
|
62
|
+
}) => /*#__PURE__*/_jsx(MenuGroup, {
|
|
63
|
+
children: canEditCSS && /*#__PURE__*/_jsx(MenuItem, {
|
|
64
|
+
onClick: () => {
|
|
65
|
+
onClose();
|
|
66
|
+
history.navigate(addQueryArgs(path, {
|
|
67
|
+
section: '/css'
|
|
68
|
+
}));
|
|
69
|
+
},
|
|
70
|
+
children: __('Additional CSS')
|
|
71
|
+
})
|
|
72
|
+
})
|
|
73
|
+
})]
|
|
42
74
|
});
|
|
43
75
|
};
|
|
44
76
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["__","useMemo","useState","privateApis","routerPrivateApis","useViewportMatch","Button","addQueryArgs","removeQueryArgs","seen","GlobalStylesUI","Page","unlock","jsx","_jsx","Fragment","_Fragment","useLocation","useHistory","GlobalStylesPageActions","isStyleBookOpened","setIsStyleBookOpened","path","history","isPressed","icon","label","onClick","updatedPath","preview","navigate","size","useSection","query","_query$section","
|
|
1
|
+
{"version":3,"names":["__","useSelect","store","coreStore","useMemo","useState","privateApis","routerPrivateApis","useViewportMatch","Button","__experimentalHStack","HStack","DropdownMenu","MenuGroup","MenuItem","addQueryArgs","removeQueryArgs","seen","moreVertical","GlobalStylesUI","Page","unlock","jsx","_jsx","jsxs","_jsxs","Fragment","_Fragment","useLocation","useHistory","GlobalStylesPageActions","isStyleBookOpened","setIsStyleBookOpened","path","history","canEditCSS","select","getEntityRecord","__experimentalGetCurrentGlobalStylesId","globalStylesId","globalStyles","undefined","_links","children","isPressed","icon","label","onClick","updatedPath","preview","navigate","size","toggleProps","onClose","section","useSection","query","_query$section","updatedSection","GlobalStylesUIWrapper","includes","isMobileViewport","onChangeSection","actions","className","title","onPathChange"],"sources":["@wordpress/edit-site/src/components/sidebar-global-styles-wrapper/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useMemo, useState } from '@wordpress/element';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\nimport { useViewportMatch } from '@wordpress/compose';\nimport {\n\tButton,\n\t__experimentalHStack as HStack,\n\tDropdownMenu,\n\tMenuGroup,\n\tMenuItem,\n} from '@wordpress/components';\nimport { addQueryArgs, removeQueryArgs } from '@wordpress/url';\nimport { seen, moreVertical } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport GlobalStylesUI from '../global-styles/ui';\nimport Page from '../page';\nimport { unlock } from '../../lock-unlock';\n\nconst { useLocation, useHistory } = unlock( routerPrivateApis );\n\nconst GlobalStylesPageActions = ( {\n\tisStyleBookOpened,\n\tsetIsStyleBookOpened,\n\tpath,\n} ) => {\n\tconst history = useHistory();\n\tconst canEditCSS = useSelect( ( select ) => {\n\t\tconst { getEntityRecord, __experimentalGetCurrentGlobalStylesId } =\n\t\t\tselect( coreStore );\n\t\tconst globalStylesId = __experimentalGetCurrentGlobalStylesId();\n\t\tconst globalStyles = globalStylesId\n\t\t\t? getEntityRecord( 'root', 'globalStyles', globalStylesId )\n\t\t\t: undefined;\n\t\treturn !! globalStyles?._links?.[ 'wp:action-edit-css' ];\n\t}, [] );\n\n\treturn (\n\t\t<HStack>\n\t\t\t<Button\n\t\t\t\tisPressed={ isStyleBookOpened }\n\t\t\t\ticon={ seen }\n\t\t\t\tlabel={ __( 'Style Book' ) }\n\t\t\t\tonClick={ () => {\n\t\t\t\t\tsetIsStyleBookOpened( ! isStyleBookOpened );\n\t\t\t\t\tconst updatedPath = ! isStyleBookOpened\n\t\t\t\t\t\t? addQueryArgs( path, { preview: 'stylebook' } )\n\t\t\t\t\t\t: removeQueryArgs( path, 'preview' );\n\t\t\t\t\t// Navigate to the updated path.\n\t\t\t\t\thistory.navigate( updatedPath );\n\t\t\t\t} }\n\t\t\t\tsize=\"compact\"\n\t\t\t/>\n\t\t\t{ canEditCSS && (\n\t\t\t\t<DropdownMenu\n\t\t\t\t\ticon={ moreVertical }\n\t\t\t\t\tlabel={ __( 'More' ) }\n\t\t\t\t\ttoggleProps={ { size: 'compact' } }\n\t\t\t\t>\n\t\t\t\t\t{ ( { onClose } ) => (\n\t\t\t\t\t\t<MenuGroup>\n\t\t\t\t\t\t\t{ canEditCSS && (\n\t\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\t\tonClose();\n\t\t\t\t\t\t\t\t\t\thistory.navigate(\n\t\t\t\t\t\t\t\t\t\t\taddQueryArgs( path, {\n\t\t\t\t\t\t\t\t\t\t\t\tsection: '/css',\n\t\t\t\t\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{ __( 'Additional CSS' ) }\n\t\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</MenuGroup>\n\t\t\t\t\t) }\n\t\t\t\t</DropdownMenu>\n\t\t\t) }\n\t\t</HStack>\n\t);\n};\n\n/**\n * Hook to deal with navigation and location state.\n *\n * @return {Array} The current section and a function to update it.\n */\nexport const useSection = () => {\n\tconst { path, query } = useLocation();\n\tconst history = useHistory();\n\treturn useMemo( () => {\n\t\treturn [\n\t\t\tquery.section ?? '/',\n\t\t\t( updatedSection ) => {\n\t\t\t\thistory.navigate(\n\t\t\t\t\taddQueryArgs( path, {\n\t\t\t\t\t\tsection: updatedSection,\n\t\t\t\t\t} )\n\t\t\t\t);\n\t\t\t},\n\t\t];\n\t}, [ path, query.section, history ] );\n};\n\nexport default function GlobalStylesUIWrapper() {\n\tconst { path } = useLocation();\n\n\tconst [ isStyleBookOpened, setIsStyleBookOpened ] = useState(\n\t\tpath.includes( 'preview=stylebook' )\n\t);\n\tconst isMobileViewport = useViewportMatch( 'medium', '<' );\n\tconst [ section, onChangeSection ] = useSection();\n\n\treturn (\n\t\t<>\n\t\t\t<Page\n\t\t\t\tactions={\n\t\t\t\t\t! isMobileViewport ? (\n\t\t\t\t\t\t<GlobalStylesPageActions\n\t\t\t\t\t\t\tisStyleBookOpened={ isStyleBookOpened }\n\t\t\t\t\t\t\tsetIsStyleBookOpened={ setIsStyleBookOpened }\n\t\t\t\t\t\t\tpath={ path }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) : null\n\t\t\t\t}\n\t\t\t\tclassName=\"edit-site-styles\"\n\t\t\t\ttitle={ __( 'Styles' ) }\n\t\t\t>\n\t\t\t\t<GlobalStylesUI\n\t\t\t\t\tpath={ section }\n\t\t\t\t\tonPathChange={ onChangeSection }\n\t\t\t\t/>\n\t\t\t</Page>\n\t\t</>\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,EAAE,QAAQ,iBAAiB;AACpC,SAASC,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,KAAK,IAAIC,SAAS,QAAQ,sBAAsB;AACzD,SAASC,OAAO,EAAEC,QAAQ,QAAQ,oBAAoB;AACtD,SAASC,WAAW,IAAIC,i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4
4
|
"description": "Edit Site Page module for WordPress.",
|
|
5
5
|
"author": "The WordPress Contributors",
|
|
6
6
|
"license": "GPL-2.0-or-later",
|
|
@@ -30,45 +30,45 @@
|
|
|
30
30
|
"dependencies": {
|
|
31
31
|
"@babel/runtime": "7.25.7",
|
|
32
32
|
"@react-spring/web": "^9.4.5",
|
|
33
|
-
"@wordpress/a11y": "^4.31.0",
|
|
34
|
-
"@wordpress/api-fetch": "^7.31.0",
|
|
35
|
-
"@wordpress/blob": "^4.31.0",
|
|
36
|
-
"@wordpress/block-editor": "^15.4.0",
|
|
37
|
-
"@wordpress/block-library": "^9.31.0",
|
|
38
|
-
"@wordpress/blocks": "^15.4.0",
|
|
39
|
-
"@wordpress/commands": "^1.31.0",
|
|
40
|
-
"@wordpress/components": "^30.
|
|
41
|
-
"@wordpress/compose": "^7.31.0",
|
|
42
|
-
"@wordpress/core-data": "^7.31.0",
|
|
43
|
-
"@wordpress/data": "^10.31.0",
|
|
44
|
-
"@wordpress/dataviews": "^9.
|
|
45
|
-
"@wordpress/date": "^5.31.0",
|
|
46
|
-
"@wordpress/deprecated": "^4.31.0",
|
|
47
|
-
"@wordpress/dom": "^4.31.0",
|
|
48
|
-
"@wordpress/editor": "^14.31.0",
|
|
49
|
-
"@wordpress/element": "^6.31.0",
|
|
50
|
-
"@wordpress/escape-html": "^3.31.0",
|
|
51
|
-
"@wordpress/fields": "^0.23.0",
|
|
52
|
-
"@wordpress/hooks": "^4.31.0",
|
|
53
|
-
"@wordpress/html-entities": "^4.31.0",
|
|
54
|
-
"@wordpress/i18n": "^6.4.0",
|
|
55
|
-
"@wordpress/icons": "^10.31.0",
|
|
56
|
-
"@wordpress/keyboard-shortcuts": "^5.31.0",
|
|
57
|
-
"@wordpress/keycodes": "^4.31.0",
|
|
58
|
-
"@wordpress/media-utils": "^5.31.0",
|
|
59
|
-
"@wordpress/notices": "^5.31.0",
|
|
60
|
-
"@wordpress/patterns": "^2.31.0",
|
|
61
|
-
"@wordpress/plugins": "^7.31.0",
|
|
62
|
-
"@wordpress/preferences": "^4.31.0",
|
|
63
|
-
"@wordpress/primitives": "^4.31.0",
|
|
64
|
-
"@wordpress/private-apis": "^1.31.0",
|
|
65
|
-
"@wordpress/reusable-blocks": "^5.31.0",
|
|
66
|
-
"@wordpress/router": "^1.31.0",
|
|
67
|
-
"@wordpress/style-engine": "^2.31.0",
|
|
68
|
-
"@wordpress/url": "^4.31.0",
|
|
69
|
-
"@wordpress/viewport": "^6.31.0",
|
|
70
|
-
"@wordpress/widgets": "^4.31.0",
|
|
71
|
-
"@wordpress/wordcount": "^4.31.0",
|
|
33
|
+
"@wordpress/a11y": "^4.31.1-next.233ccab9b.0",
|
|
34
|
+
"@wordpress/api-fetch": "^7.31.1-next.233ccab9b.0",
|
|
35
|
+
"@wordpress/blob": "^4.31.1-next.233ccab9b.0",
|
|
36
|
+
"@wordpress/block-editor": "^15.4.1-next.233ccab9b.0",
|
|
37
|
+
"@wordpress/block-library": "^9.31.1-next.233ccab9b.0",
|
|
38
|
+
"@wordpress/blocks": "^15.4.1-next.233ccab9b.0",
|
|
39
|
+
"@wordpress/commands": "^1.31.1-next.233ccab9b.0",
|
|
40
|
+
"@wordpress/components": "^30.5.1-next.233ccab9b.0",
|
|
41
|
+
"@wordpress/compose": "^7.31.1-next.233ccab9b.0",
|
|
42
|
+
"@wordpress/core-data": "^7.31.1-next.233ccab9b.0",
|
|
43
|
+
"@wordpress/data": "^10.31.1-next.233ccab9b.0",
|
|
44
|
+
"@wordpress/dataviews": "^9.1.1-next.233ccab9b.0",
|
|
45
|
+
"@wordpress/date": "^5.31.1-next.233ccab9b.0",
|
|
46
|
+
"@wordpress/deprecated": "^4.31.1-next.233ccab9b.0",
|
|
47
|
+
"@wordpress/dom": "^4.31.1-next.233ccab9b.0",
|
|
48
|
+
"@wordpress/editor": "^14.31.1-next.233ccab9b.0",
|
|
49
|
+
"@wordpress/element": "^6.31.1-next.233ccab9b.0",
|
|
50
|
+
"@wordpress/escape-html": "^3.31.1-next.233ccab9b.0",
|
|
51
|
+
"@wordpress/fields": "^0.23.1-next.233ccab9b.0",
|
|
52
|
+
"@wordpress/hooks": "^4.31.1-next.233ccab9b.0",
|
|
53
|
+
"@wordpress/html-entities": "^4.31.1-next.233ccab9b.0",
|
|
54
|
+
"@wordpress/i18n": "^6.4.1-next.233ccab9b.0",
|
|
55
|
+
"@wordpress/icons": "^10.31.1-next.233ccab9b.0",
|
|
56
|
+
"@wordpress/keyboard-shortcuts": "^5.31.1-next.233ccab9b.0",
|
|
57
|
+
"@wordpress/keycodes": "^4.31.1-next.233ccab9b.0",
|
|
58
|
+
"@wordpress/media-utils": "^5.31.1-next.233ccab9b.0",
|
|
59
|
+
"@wordpress/notices": "^5.31.1-next.233ccab9b.0",
|
|
60
|
+
"@wordpress/patterns": "^2.31.1-next.233ccab9b.0",
|
|
61
|
+
"@wordpress/plugins": "^7.31.1-next.233ccab9b.0",
|
|
62
|
+
"@wordpress/preferences": "^4.31.1-next.233ccab9b.0",
|
|
63
|
+
"@wordpress/primitives": "^4.31.1-next.233ccab9b.0",
|
|
64
|
+
"@wordpress/private-apis": "^1.31.1-next.233ccab9b.0",
|
|
65
|
+
"@wordpress/reusable-blocks": "^5.31.1-next.233ccab9b.0",
|
|
66
|
+
"@wordpress/router": "^1.31.1-next.233ccab9b.0",
|
|
67
|
+
"@wordpress/style-engine": "^2.31.1-next.233ccab9b.0",
|
|
68
|
+
"@wordpress/url": "^4.31.1-next.233ccab9b.0",
|
|
69
|
+
"@wordpress/viewport": "^6.31.1-next.233ccab9b.0",
|
|
70
|
+
"@wordpress/widgets": "^4.31.1-next.233ccab9b.0",
|
|
71
|
+
"@wordpress/wordcount": "^4.31.1-next.233ccab9b.0",
|
|
72
72
|
"change-case": "^4.1.2",
|
|
73
73
|
"clsx": "^2.1.1",
|
|
74
74
|
"colord": "^2.9.2",
|
|
@@ -83,5 +83,5 @@
|
|
|
83
83
|
"publishConfig": {
|
|
84
84
|
"access": "public"
|
|
85
85
|
},
|
|
86
|
-
"gitHead": "
|
|
86
|
+
"gitHead": "d11f971521e4b39b07124d5c5516890ff98b0e31"
|
|
87
87
|
}
|
|
@@ -17,6 +17,7 @@ import { useEntityRecords } from '@wordpress/core-data';
|
|
|
17
17
|
import { decodeEntities } from '@wordpress/html-entities';
|
|
18
18
|
import { useDebouncedInput } from '@wordpress/compose';
|
|
19
19
|
import { focus } from '@wordpress/dom';
|
|
20
|
+
import { safeDecodeURI } from '@wordpress/url';
|
|
20
21
|
|
|
21
22
|
/**
|
|
22
23
|
* Internal dependencies
|
|
@@ -67,7 +68,7 @@ function SuggestionListItem( {
|
|
|
67
68
|
lineHeight={ 1.53846153846 } // 20px
|
|
68
69
|
className={ `${ baseCssClass }__info` }
|
|
69
70
|
>
|
|
70
|
-
{ suggestion.link }
|
|
71
|
+
{ safeDecodeURI( suggestion.link ) }
|
|
71
72
|
</Text>
|
|
72
73
|
) }
|
|
73
74
|
</Composite.Item>
|
|
@@ -7,6 +7,7 @@ import { decodeEntities } from '@wordpress/html-entities';
|
|
|
7
7
|
import { useMemo, useCallback } from '@wordpress/element';
|
|
8
8
|
import { __, _x, sprintf } from '@wordpress/i18n';
|
|
9
9
|
import { blockMeta, post, archive } from '@wordpress/icons';
|
|
10
|
+
import { safeDecodeURI } from '@wordpress/url';
|
|
10
11
|
|
|
11
12
|
/**
|
|
12
13
|
* Internal dependencies
|
|
@@ -29,6 +30,20 @@ const getValueFromObjectPath = ( object, path ) => {
|
|
|
29
30
|
return value;
|
|
30
31
|
};
|
|
31
32
|
|
|
33
|
+
/**
|
|
34
|
+
* Helper that adds a prefix to a post slug. The slug needs to be URL-decoded first,
|
|
35
|
+
* so that we have raw Unicode characters there. The server will truncate the slug to
|
|
36
|
+
* 200 characters, respecing Unicode char boundary. On the other hand, the server
|
|
37
|
+
* doesn't detect urlencoded octet boundary and can possibly construct slugs that
|
|
38
|
+
* are not valid urlencoded strings.
|
|
39
|
+
* @param {string} prefix The prefix to add to the slug.
|
|
40
|
+
* @param {string} slug The slug to add the prefix to.
|
|
41
|
+
* @return {string} The slug with the prefix.
|
|
42
|
+
*/
|
|
43
|
+
function prefixSlug( prefix, slug ) {
|
|
44
|
+
return `${ prefix }-${ safeDecodeURI( slug ) }`;
|
|
45
|
+
}
|
|
46
|
+
|
|
32
47
|
/**
|
|
33
48
|
* Helper util to map records to add a `name` prop from a
|
|
34
49
|
* provided path, in order to handle all entities in the same
|
|
@@ -306,7 +321,10 @@ export const usePostTypeMenuItems = ( onClickMenuItem ) => {
|
|
|
306
321
|
};
|
|
307
322
|
},
|
|
308
323
|
getSpecificTemplate: ( suggestion ) => {
|
|
309
|
-
const templateSlug =
|
|
324
|
+
const templateSlug = prefixSlug(
|
|
325
|
+
templatePrefixes[ slug ],
|
|
326
|
+
suggestion.slug
|
|
327
|
+
);
|
|
310
328
|
return {
|
|
311
329
|
title: templateSlug,
|
|
312
330
|
slug: templateSlug,
|
|
@@ -460,7 +478,10 @@ export const useTaxonomiesMenuItems = ( onClickMenuItem ) => {
|
|
|
460
478
|
};
|
|
461
479
|
},
|
|
462
480
|
getSpecificTemplate: ( suggestion ) => {
|
|
463
|
-
const templateSlug =
|
|
481
|
+
const templateSlug = prefixSlug(
|
|
482
|
+
templatePrefixes[ slug ],
|
|
483
|
+
suggestion.slug
|
|
484
|
+
);
|
|
464
485
|
return {
|
|
465
486
|
title: templateSlug,
|
|
466
487
|
slug: templateSlug,
|
|
@@ -545,7 +566,10 @@ export function useAuthorMenuItem( onClickMenuItem ) {
|
|
|
545
566
|
};
|
|
546
567
|
},
|
|
547
568
|
getSpecificTemplate: ( suggestion ) => {
|
|
548
|
-
const templateSlug =
|
|
569
|
+
const templateSlug = prefixSlug(
|
|
570
|
+
'author',
|
|
571
|
+
suggestion.slug
|
|
572
|
+
);
|
|
549
573
|
return {
|
|
550
574
|
title: sprintf(
|
|
551
575
|
// translators: %s: Name of the author e.g: "Admin".
|
|
@@ -18,9 +18,6 @@ const { useGlobalStyle, AdvancedPanel: StylesAdvancedPanel } = unlock(
|
|
|
18
18
|
);
|
|
19
19
|
|
|
20
20
|
function ScreenCSS() {
|
|
21
|
-
const description = __(
|
|
22
|
-
'Add your own CSS to customize the appearance and layout of your site.'
|
|
23
|
-
);
|
|
24
21
|
const [ style ] = useGlobalStyle( '', undefined, 'user', {
|
|
25
22
|
shouldDecodeEncode: false,
|
|
26
23
|
} );
|
|
@@ -35,10 +32,12 @@ function ScreenCSS() {
|
|
|
35
32
|
return (
|
|
36
33
|
<>
|
|
37
34
|
<ScreenHeader
|
|
38
|
-
title={ __( 'CSS' ) }
|
|
35
|
+
title={ __( 'Additional CSS' ) }
|
|
39
36
|
description={
|
|
40
37
|
<>
|
|
41
|
-
{
|
|
38
|
+
{ __(
|
|
39
|
+
'You can add custom CSS to further customize the appearance and layout of your site.'
|
|
40
|
+
) }
|
|
42
41
|
<br />
|
|
43
42
|
<ExternalLink
|
|
44
43
|
href={ __(
|
|
@@ -26,24 +26,10 @@ import RootMenu from './root-menu';
|
|
|
26
26
|
import PreviewStyles from './preview-styles';
|
|
27
27
|
|
|
28
28
|
function ScreenRoot() {
|
|
29
|
-
const
|
|
30
|
-
const {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
__experimentalGetCurrentThemeGlobalStylesVariations,
|
|
34
|
-
} = select( coreStore );
|
|
35
|
-
|
|
36
|
-
const globalStylesId = __experimentalGetCurrentGlobalStylesId();
|
|
37
|
-
const globalStyles = globalStylesId
|
|
38
|
-
? getEntityRecord( 'root', 'globalStyles', globalStylesId )
|
|
39
|
-
: undefined;
|
|
40
|
-
|
|
41
|
-
return {
|
|
42
|
-
hasVariations:
|
|
43
|
-
!! __experimentalGetCurrentThemeGlobalStylesVariations()
|
|
44
|
-
?.length,
|
|
45
|
-
canEditCSS: !! globalStyles?._links?.[ 'wp:action-edit-css' ],
|
|
46
|
-
};
|
|
29
|
+
const hasVariations = useSelect( ( select ) => {
|
|
30
|
+
const { __experimentalGetCurrentThemeGlobalStylesVariations } =
|
|
31
|
+
select( coreStore );
|
|
32
|
+
return !! __experimentalGetCurrentThemeGlobalStylesVariations()?.length;
|
|
47
33
|
}, [] );
|
|
48
34
|
|
|
49
35
|
return (
|
|
@@ -92,7 +78,7 @@ function ScreenRoot() {
|
|
|
92
78
|
* the nav button inset should be looked at before reusing further.
|
|
93
79
|
*/
|
|
94
80
|
paddingX="13px"
|
|
95
|
-
marginBottom={
|
|
81
|
+
marginBottom={ 2 }
|
|
96
82
|
>
|
|
97
83
|
{ __(
|
|
98
84
|
'Customize the appearance of specific blocks for the whole site.'
|
|
@@ -109,38 +95,6 @@ function ScreenRoot() {
|
|
|
109
95
|
</NavigationButtonAsItem>
|
|
110
96
|
</ItemGroup>
|
|
111
97
|
</CardBody>
|
|
112
|
-
|
|
113
|
-
{ canEditCSS && (
|
|
114
|
-
<>
|
|
115
|
-
<CardDivider />
|
|
116
|
-
<CardBody>
|
|
117
|
-
<Spacer
|
|
118
|
-
as="p"
|
|
119
|
-
paddingTop={ 2 }
|
|
120
|
-
paddingX="13px"
|
|
121
|
-
marginBottom={ 4 }
|
|
122
|
-
>
|
|
123
|
-
{ __(
|
|
124
|
-
'Add your own CSS to customize the appearance and layout of your site.'
|
|
125
|
-
) }
|
|
126
|
-
</Spacer>
|
|
127
|
-
<ItemGroup>
|
|
128
|
-
<NavigationButtonAsItem path="/css">
|
|
129
|
-
<HStack justify="space-between">
|
|
130
|
-
<FlexItem>
|
|
131
|
-
{ __( 'Additional CSS' ) }
|
|
132
|
-
</FlexItem>
|
|
133
|
-
<IconWithCurrentColor
|
|
134
|
-
icon={
|
|
135
|
-
isRTL() ? chevronLeft : chevronRight
|
|
136
|
-
}
|
|
137
|
-
/>
|
|
138
|
-
</HStack>
|
|
139
|
-
</NavigationButtonAsItem>
|
|
140
|
-
</ItemGroup>
|
|
141
|
-
</CardBody>
|
|
142
|
-
</>
|
|
143
|
-
) }
|
|
144
98
|
</Card>
|
|
145
99
|
);
|
|
146
100
|
}
|
|
@@ -2,12 +2,20 @@
|
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
4
|
import { __ } from '@wordpress/i18n';
|
|
5
|
+
import { useSelect } from '@wordpress/data';
|
|
6
|
+
import { store as coreStore } from '@wordpress/core-data';
|
|
5
7
|
import { useMemo, useState } from '@wordpress/element';
|
|
6
8
|
import { privateApis as routerPrivateApis } from '@wordpress/router';
|
|
7
9
|
import { useViewportMatch } from '@wordpress/compose';
|
|
8
|
-
import {
|
|
10
|
+
import {
|
|
11
|
+
Button,
|
|
12
|
+
__experimentalHStack as HStack,
|
|
13
|
+
DropdownMenu,
|
|
14
|
+
MenuGroup,
|
|
15
|
+
MenuItem,
|
|
16
|
+
} from '@wordpress/components';
|
|
9
17
|
import { addQueryArgs, removeQueryArgs } from '@wordpress/url';
|
|
10
|
-
import { seen } from '@wordpress/icons';
|
|
18
|
+
import { seen, moreVertical } from '@wordpress/icons';
|
|
11
19
|
|
|
12
20
|
/**
|
|
13
21
|
* Internal dependencies
|
|
@@ -24,21 +32,59 @@ const GlobalStylesPageActions = ( {
|
|
|
24
32
|
path,
|
|
25
33
|
} ) => {
|
|
26
34
|
const history = useHistory();
|
|
35
|
+
const canEditCSS = useSelect( ( select ) => {
|
|
36
|
+
const { getEntityRecord, __experimentalGetCurrentGlobalStylesId } =
|
|
37
|
+
select( coreStore );
|
|
38
|
+
const globalStylesId = __experimentalGetCurrentGlobalStylesId();
|
|
39
|
+
const globalStyles = globalStylesId
|
|
40
|
+
? getEntityRecord( 'root', 'globalStyles', globalStylesId )
|
|
41
|
+
: undefined;
|
|
42
|
+
return !! globalStyles?._links?.[ 'wp:action-edit-css' ];
|
|
43
|
+
}, [] );
|
|
44
|
+
|
|
27
45
|
return (
|
|
28
|
-
<
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
46
|
+
<HStack>
|
|
47
|
+
<Button
|
|
48
|
+
isPressed={ isStyleBookOpened }
|
|
49
|
+
icon={ seen }
|
|
50
|
+
label={ __( 'Style Book' ) }
|
|
51
|
+
onClick={ () => {
|
|
52
|
+
setIsStyleBookOpened( ! isStyleBookOpened );
|
|
53
|
+
const updatedPath = ! isStyleBookOpened
|
|
54
|
+
? addQueryArgs( path, { preview: 'stylebook' } )
|
|
55
|
+
: removeQueryArgs( path, 'preview' );
|
|
56
|
+
// Navigate to the updated path.
|
|
57
|
+
history.navigate( updatedPath );
|
|
58
|
+
} }
|
|
59
|
+
size="compact"
|
|
60
|
+
/>
|
|
61
|
+
{ canEditCSS && (
|
|
62
|
+
<DropdownMenu
|
|
63
|
+
icon={ moreVertical }
|
|
64
|
+
label={ __( 'More' ) }
|
|
65
|
+
toggleProps={ { size: 'compact' } }
|
|
66
|
+
>
|
|
67
|
+
{ ( { onClose } ) => (
|
|
68
|
+
<MenuGroup>
|
|
69
|
+
{ canEditCSS && (
|
|
70
|
+
<MenuItem
|
|
71
|
+
onClick={ () => {
|
|
72
|
+
onClose();
|
|
73
|
+
history.navigate(
|
|
74
|
+
addQueryArgs( path, {
|
|
75
|
+
section: '/css',
|
|
76
|
+
} )
|
|
77
|
+
);
|
|
78
|
+
} }
|
|
79
|
+
>
|
|
80
|
+
{ __( 'Additional CSS' ) }
|
|
81
|
+
</MenuItem>
|
|
82
|
+
) }
|
|
83
|
+
</MenuGroup>
|
|
84
|
+
) }
|
|
85
|
+
</DropdownMenu>
|
|
86
|
+
) }
|
|
87
|
+
</HStack>
|
|
42
88
|
);
|
|
43
89
|
};
|
|
44
90
|
|