@wordpress/edit-site 5.12.7 → 5.12.9
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/block-editor/editor-canvas.js +1 -1
- package/build/components/block-editor/editor-canvas.js.map +1 -1
- package/build/components/block-editor/index.js +0 -4
- package/build/components/block-editor/index.js.map +1 -1
- package/build/components/block-editor/use-site-editor-settings.js +12 -6
- package/build/components/block-editor/use-site-editor-settings.js.map +1 -1
- package/build/components/create-pattern-modal/index.js +7 -3
- package/build/components/create-pattern-modal/index.js.map +1 -1
- package/build/components/page-patterns/duplicate-menu-item.js +163 -0
- package/build/components/page-patterns/duplicate-menu-item.js.map +1 -0
- package/build/components/page-patterns/grid-item.js +83 -59
- package/build/components/page-patterns/grid-item.js.map +1 -1
- package/build/components/page-patterns/grid.js +81 -13
- package/build/components/page-patterns/grid.js.map +1 -1
- package/build/components/page-patterns/header.js +69 -0
- package/build/components/page-patterns/header.js.map +1 -0
- package/build/components/page-patterns/index.js +3 -1
- package/build/components/page-patterns/index.js.map +1 -1
- package/build/components/page-patterns/patterns-list.js +66 -27
- package/build/components/page-patterns/patterns-list.js.map +1 -1
- package/build/components/page-patterns/rename-menu-item.js +109 -0
- package/build/components/page-patterns/rename-menu-item.js.map +1 -0
- package/build/components/page-patterns/use-patterns.js +99 -118
- package/build/components/page-patterns/use-patterns.js.map +1 -1
- package/build/components/page-template-parts/add-new-template-part.js +74 -0
- package/build/components/page-template-parts/add-new-template-part.js.map +1 -0
- package/build/components/page-template-parts/index.js +2 -23
- package/build/components/page-template-parts/index.js.map +1 -1
- package/build/components/resizable-frame/index.js +75 -32
- package/build/components/resizable-frame/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen/index.js +14 -8
- package/build/components/sidebar-navigation-screen/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-main/template-part-hint.js +1 -1
- package/build/components/sidebar-navigation-screen-main/template-part-hint.js.map +1 -1
- package/build/components/sidebar-navigation-screen-navigation-menu/more-menu.js +1 -0
- package/build/components/sidebar-navigation-screen-navigation-menu/more-menu.js.map +1 -1
- package/build/components/sidebar-navigation-screen-navigation-menu/single-navigation-menu.js +3 -3
- package/build/components/sidebar-navigation-screen-navigation-menu/single-navigation-menu.js.map +1 -1
- package/build/components/sidebar-navigation-screen-page/status-label.js +1 -34
- package/build/components/sidebar-navigation-screen-page/status-label.js.map +1 -1
- package/build/components/sidebar-navigation-screen-pages/index.js +33 -25
- package/build/components/sidebar-navigation-screen-pages/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-pattern/template-part-navigation-menu.js +3 -2
- package/build/components/sidebar-navigation-screen-pattern/template-part-navigation-menu.js.map +1 -1
- package/build/components/sidebar-navigation-screen-pattern/template-part-navigation-menus.js +3 -2
- package/build/components/sidebar-navigation-screen-pattern/template-part-navigation-menus.js.map +1 -1
- package/build/components/sidebar-navigation-screen-patterns/index.js +5 -6
- package/build/components/sidebar-navigation-screen-patterns/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-patterns/use-my-patterns.js +9 -5
- package/build/components/sidebar-navigation-screen-patterns/use-my-patterns.js.map +1 -1
- package/build/components/site-hub/index.js +4 -2
- package/build/components/site-hub/index.js.map +1 -1
- package/build/components/sync-state-with-url/use-sync-path-with-url.js +15 -12
- package/build/components/sync-state-with-url/use-sync-path-with-url.js.map +1 -1
- package/build/components/template-actions/index.js +3 -1
- package/build/components/template-actions/index.js.map +1 -1
- package/build/components/template-actions/rename-menu-item.js +9 -6
- package/build/components/template-actions/rename-menu-item.js.map +1 -1
- package/build/hooks/push-changes-to-global-styles/index.js +3 -1
- package/build/hooks/push-changes-to-global-styles/index.js.map +1 -1
- package/build/utils/use-activate-theme.js +1 -1
- package/build/utils/use-activate-theme.js.map +1 -1
- package/build-module/components/block-editor/editor-canvas.js +1 -1
- package/build-module/components/block-editor/editor-canvas.js.map +1 -1
- package/build-module/components/block-editor/index.js +0 -4
- package/build-module/components/block-editor/index.js.map +1 -1
- package/build-module/components/block-editor/use-site-editor-settings.js +13 -7
- package/build-module/components/block-editor/use-site-editor-settings.js.map +1 -1
- package/build-module/components/create-pattern-modal/index.js +6 -3
- package/build-module/components/create-pattern-modal/index.js.map +1 -1
- package/build-module/components/page-patterns/duplicate-menu-item.js +147 -0
- package/build-module/components/page-patterns/duplicate-menu-item.js.map +1 -0
- package/build-module/components/page-patterns/grid-item.js +84 -65
- package/build-module/components/page-patterns/grid-item.js.map +1 -1
- package/build-module/components/page-patterns/grid.js +82 -15
- package/build-module/components/page-patterns/grid.js.map +1 -1
- package/build-module/components/page-patterns/header.js +54 -0
- package/build-module/components/page-patterns/header.js.map +1 -0
- package/build-module/components/page-patterns/index.js +3 -1
- package/build-module/components/page-patterns/index.js.map +1 -1
- package/build-module/components/page-patterns/patterns-list.js +68 -30
- package/build-module/components/page-patterns/patterns-list.js.map +1 -1
- package/build-module/components/page-patterns/rename-menu-item.js +97 -0
- package/build-module/components/page-patterns/rename-menu-item.js.map +1 -0
- package/build-module/components/page-patterns/use-patterns.js +100 -119
- package/build-module/components/page-patterns/use-patterns.js.map +1 -1
- package/build-module/components/page-template-parts/add-new-template-part.js +58 -0
- package/build-module/components/page-template-parts/add-new-template-part.js.map +1 -0
- package/build-module/components/page-template-parts/index.js +3 -22
- package/build-module/components/page-template-parts/index.js.map +1 -1
- package/build-module/components/resizable-frame/index.js +76 -35
- package/build-module/components/resizable-frame/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen/index.js +15 -9
- package/build-module/components/sidebar-navigation-screen/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-main/template-part-hint.js +1 -1
- package/build-module/components/sidebar-navigation-screen-main/template-part-hint.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menu/more-menu.js +1 -0
- package/build-module/components/sidebar-navigation-screen-navigation-menu/more-menu.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menu/single-navigation-menu.js +3 -3
- package/build-module/components/sidebar-navigation-screen-navigation-menu/single-navigation-menu.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-page/status-label.js +1 -32
- package/build-module/components/sidebar-navigation-screen-page/status-label.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-pages/index.js +33 -25
- package/build-module/components/sidebar-navigation-screen-pages/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-pattern/template-part-navigation-menu.js +3 -2
- package/build-module/components/sidebar-navigation-screen-pattern/template-part-navigation-menu.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-pattern/template-part-navigation-menus.js +3 -2
- package/build-module/components/sidebar-navigation-screen-pattern/template-part-navigation-menus.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-patterns/index.js +5 -6
- package/build-module/components/sidebar-navigation-screen-patterns/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-patterns/use-my-patterns.js +9 -5
- package/build-module/components/sidebar-navigation-screen-patterns/use-my-patterns.js.map +1 -1
- package/build-module/components/site-hub/index.js +4 -2
- package/build-module/components/site-hub/index.js.map +1 -1
- package/build-module/components/sync-state-with-url/use-sync-path-with-url.js +16 -12
- package/build-module/components/sync-state-with-url/use-sync-path-with-url.js.map +1 -1
- package/build-module/components/template-actions/index.js +2 -1
- package/build-module/components/template-actions/index.js.map +1 -1
- package/build-module/components/template-actions/rename-menu-item.js +8 -6
- package/build-module/components/template-actions/rename-menu-item.js.map +1 -1
- package/build-module/hooks/push-changes-to-global-styles/index.js +4 -2
- package/build-module/hooks/push-changes-to-global-styles/index.js.map +1 -1
- package/build-module/utils/use-activate-theme.js +1 -1
- package/build-module/utils/use-activate-theme.js.map +1 -1
- package/build-style/style-rtl.css +150 -54
- package/build-style/style.css +150 -54
- package/package.json +14 -14
- package/src/components/block-editor/editor-canvas.js +1 -1
- package/src/components/block-editor/index.js +0 -4
- package/src/components/block-editor/use-site-editor-settings.js +16 -11
- package/src/components/create-pattern-modal/index.js +5 -2
- package/src/components/header-edit-mode/document-actions/style.scss +4 -0
- package/src/components/layout/style.scss +1 -0
- package/src/components/page-patterns/duplicate-menu-item.js +196 -0
- package/src/components/page-patterns/grid-item.js +187 -137
- package/src/components/page-patterns/grid.js +118 -20
- package/src/components/page-patterns/header.js +69 -0
- package/src/components/page-patterns/index.js +6 -1
- package/src/components/page-patterns/patterns-list.js +87 -46
- package/src/components/page-patterns/rename-menu-item.js +115 -0
- package/src/components/page-patterns/style.scss +106 -26
- package/src/components/page-patterns/use-patterns.js +96 -167
- package/src/components/page-template-parts/add-new-template-part.js +57 -0
- package/src/components/page-template-parts/index.js +3 -22
- package/src/components/resizable-frame/index.js +100 -31
- package/src/components/resizable-frame/style.scss +26 -9
- package/src/components/sidebar-navigation-item/style.scss +10 -1
- package/src/components/sidebar-navigation-screen/index.js +14 -7
- package/src/components/sidebar-navigation-screen-main/template-part-hint.js +1 -3
- package/src/components/sidebar-navigation-screen-navigation-menu/more-menu.js +1 -0
- package/src/components/sidebar-navigation-screen-navigation-menu/single-navigation-menu.js +1 -1
- package/src/components/sidebar-navigation-screen-page/status-label.js +1 -35
- package/src/components/sidebar-navigation-screen-pages/index.js +39 -29
- package/src/components/sidebar-navigation-screen-pattern/template-part-navigation-menu.js +2 -1
- package/src/components/sidebar-navigation-screen-pattern/template-part-navigation-menus.js +2 -1
- package/src/components/sidebar-navigation-screen-patterns/index.js +20 -24
- package/src/components/sidebar-navigation-screen-patterns/style.scss +0 -3
- package/src/components/sidebar-navigation-screen-patterns/use-my-patterns.js +7 -6
- package/src/components/site-hub/index.js +6 -2
- package/src/components/site-hub/style.scss +5 -0
- package/src/components/sync-state-with-url/use-sync-path-with-url.js +73 -66
- package/src/components/template-actions/index.js +2 -1
- package/src/components/template-actions/rename-menu-item.js +8 -6
- package/src/hooks/push-changes-to-global-styles/index.js +8 -1
- package/src/style.scss +10 -12
- package/src/utils/use-activate-theme.js +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/template-actions/index.js"],"names":["useDispatch","useSelect","store","coreStore","useState","__","sprintf","DropdownMenu","MenuGroup","MenuItem","__experimentalConfirmDialog","ConfirmDialog","moreVertical","noticesStore","editSiteStore","isTemplateRemovable","isTemplateRevertable","RenameMenuItem","TemplateActions","postType","postId","className","toggleProps","onRemove","template","select","getEntityRecord","removeTemplate","revertTemplate","saveEditedEntityRecord","createSuccessNotice","createErrorNotice","isRemovable","isRevertable","revertAndSaveTemplate","allowUndo","type","id","title","rendered","error","errorMessage","message","code","onClose","DeleteMenuItem","isTemplate","isModalOpen","setIsModalOpen"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,WAAT,EAAsBC,SAAtB,QAAuC,iBAAvC;AACA,SAASC,KAAK,IAAIC,SAAlB,QAAmC,sBAAnC;AACA,SAASC,QAAT,QAAyB,oBAAzB;AACA,SAASC,EAAT,EAAaC,OAAb,QAA4B,iBAA5B;AACA,SACCC,YADD,EAECC,SAFD,EAGCC,QAHD,EAICC,2BAA2B,IAAIC,aAJhC,QAKO,uBALP;AAMA,SAASC,YAAT,QAA6B,kBAA7B;AACA,SAASV,KAAK,IAAIW,YAAlB,QAAsC,oBAAtC;AAEA;AACA;AACA;;AACA,
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/template-actions/index.js"],"names":["useDispatch","useSelect","store","coreStore","useState","__","sprintf","DropdownMenu","MenuGroup","MenuItem","__experimentalConfirmDialog","ConfirmDialog","moreVertical","noticesStore","decodeEntities","editSiteStore","isTemplateRemovable","isTemplateRevertable","RenameMenuItem","TemplateActions","postType","postId","className","toggleProps","onRemove","template","select","getEntityRecord","removeTemplate","revertTemplate","saveEditedEntityRecord","createSuccessNotice","createErrorNotice","isRemovable","isRevertable","revertAndSaveTemplate","allowUndo","type","id","title","rendered","error","errorMessage","message","code","onClose","DeleteMenuItem","isTemplate","isModalOpen","setIsModalOpen"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,WAAT,EAAsBC,SAAtB,QAAuC,iBAAvC;AACA,SAASC,KAAK,IAAIC,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AAA,UAAU,EAAGpB,QAAQ,CAACY,IAAT,KAAkB;AANhC,IALD,CAFF,EAiBGH,YAAY,IACb,cAAC,QAAD;AACC,IAAA,IAAI,EAAG7B,EAAE,CACR,4CADQ,CADV;AAIC,IAAA,OAAO,EAAG,MAAM;AACf8B,MAAAA,qBAAqB;AACrBU,MAAAA,OAAO;AACP;AAPF,KASGxC,EAAE,CAAE,sBAAF,CATL,CAlBF,CAPF,CADD;AA0CA;;AAED,SAASyC,cAAT,CAAyB;AAAEtB,EAAAA,QAAF;AAAYuB,EAAAA;AAAZ,CAAzB,EAAoD;AACnD,QAAM,CAAEC,WAAF,EAAeC,cAAf,IAAkC7C,QAAQ,CAAE,KAAF,CAAhD;AACA,SACC,8BACC,cAAC,QAAD;AACC,IAAA,aAAa,MADd;AAEC,IAAA,UAAU,MAFX;AAGC,IAAA,OAAO,EAAG,MAAM6C,cAAc,CAAE,IAAF;AAH/B,KAKG5C,EAAE,CAAE,QAAF,CALL,CADD,EAQC,cAAC,aAAD;AACC,IAAA,MAAM,EAAG2C,WADV;AAEC,IAAA,SAAS,EAAGxB,QAFb;AAGC,IAAA,QAAQ,EAAG,MAAMyB,cAAc,CAAE,KAAF,CAHhC;AAIC,IAAA,iBAAiB,EAAG5C,EAAE,CAAE,QAAF;AAJvB,KAMG0C,UAAU,GACT1C,EAAE,CAAE,gDAAF,CADO,GAETA,EAAE,CACF,qDADE,CARN,CARD,CADD;AAuBA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useState } from '@wordpress/element';\nimport { __, sprintf } from '@wordpress/i18n';\nimport {\n\tDropdownMenu,\n\tMenuGroup,\n\tMenuItem,\n\t__experimentalConfirmDialog as ConfirmDialog,\n} from '@wordpress/components';\nimport { moreVertical } from '@wordpress/icons';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { decodeEntities } from '@wordpress/html-entities';\n\n/**\n * Internal dependencies\n */\nimport { store as editSiteStore } from '../../store';\nimport isTemplateRemovable from '../../utils/is-template-removable';\nimport isTemplateRevertable from '../../utils/is-template-revertable';\nimport RenameMenuItem from './rename-menu-item';\n\nexport default function TemplateActions( {\n\tpostType,\n\tpostId,\n\tclassName,\n\ttoggleProps,\n\tonRemove,\n} ) {\n\tconst template = useSelect(\n\t\t( select ) =>\n\t\t\tselect( coreStore ).getEntityRecord( 'postType', postType, postId ),\n\t\t[ postType, postId ]\n\t);\n\tconst { removeTemplate, revertTemplate } = useDispatch( editSiteStore );\n\tconst { saveEditedEntityRecord } = useDispatch( coreStore );\n\tconst { createSuccessNotice, createErrorNotice } =\n\t\tuseDispatch( noticesStore );\n\tconst isRemovable = isTemplateRemovable( template );\n\tconst isRevertable = isTemplateRevertable( template );\n\n\tif ( ! isRemovable && ! isRevertable ) {\n\t\treturn null;\n\t}\n\n\tasync function revertAndSaveTemplate() {\n\t\ttry {\n\t\t\tawait revertTemplate( template, { allowUndo: false } );\n\t\t\tawait saveEditedEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\ttemplate.type,\n\t\t\t\ttemplate.id\n\t\t\t);\n\n\t\t\tcreateSuccessNotice(\n\t\t\t\tsprintf(\n\t\t\t\t\t/* translators: The template/part's name. */\n\t\t\t\t\t__( '\"%s\" reverted.' ),\n\t\t\t\t\tdecodeEntities( template.title.rendered )\n\t\t\t\t),\n\t\t\t\t{\n\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\tid: 'edit-site-template-reverted',\n\t\t\t\t}\n\t\t\t);\n\t\t} catch ( error ) {\n\t\t\tconst errorMessage =\n\t\t\t\terror.message && error.code !== 'unknown_error'\n\t\t\t\t\t? error.message\n\t\t\t\t\t: __( 'An error occurred while reverting the entity.' );\n\n\t\t\tcreateErrorNotice( errorMessage, { type: 'snackbar' } );\n\t\t}\n\t}\n\n\treturn (\n\t\t<DropdownMenu\n\t\t\ticon={ moreVertical }\n\t\t\tlabel={ __( 'Actions' ) }\n\t\t\tclassName={ className }\n\t\t\ttoggleProps={ toggleProps }\n\t\t>\n\t\t\t{ ( { onClose } ) => (\n\t\t\t\t<MenuGroup>\n\t\t\t\t\t{ isRemovable && (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<RenameMenuItem\n\t\t\t\t\t\t\t\ttemplate={ template }\n\t\t\t\t\t\t\t\tonClose={ onClose }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<DeleteMenuItem\n\t\t\t\t\t\t\t\tonRemove={ () => {\n\t\t\t\t\t\t\t\t\tremoveTemplate( template );\n\t\t\t\t\t\t\t\t\tonRemove?.();\n\t\t\t\t\t\t\t\t\tonClose();\n\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\tisTemplate={ template.type === 'wp_template' }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</>\n\t\t\t\t\t) }\n\t\t\t\t\t{ isRevertable && (\n\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\tinfo={ __(\n\t\t\t\t\t\t\t\t'Use the template as supplied by the theme.'\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\trevertAndSaveTemplate();\n\t\t\t\t\t\t\t\tonClose();\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Clear customizations' ) }\n\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t) }\n\t\t\t\t</MenuGroup>\n\t\t\t) }\n\t\t</DropdownMenu>\n\t);\n}\n\nfunction DeleteMenuItem( { onRemove, isTemplate } ) {\n\tconst [ isModalOpen, setIsModalOpen ] = useState( false );\n\treturn (\n\t\t<>\n\t\t\t<MenuItem\n\t\t\t\tisDestructive\n\t\t\t\tisTertiary\n\t\t\t\tonClick={ () => setIsModalOpen( true ) }\n\t\t\t>\n\t\t\t\t{ __( 'Delete' ) }\n\t\t\t</MenuItem>\n\t\t\t<ConfirmDialog\n\t\t\t\tisOpen={ isModalOpen }\n\t\t\t\tonConfirm={ onRemove }\n\t\t\t\tonCancel={ () => setIsModalOpen( false ) }\n\t\t\t\tconfirmButtonText={ __( 'Delete' ) }\n\t\t\t>\n\t\t\t\t{ isTemplate\n\t\t\t\t\t? __( 'Are you sure you want to delete this template?' )\n\t\t\t\t\t: __(\n\t\t\t\t\t\t\t'Are you sure you want to delete this template part?'\n\t\t\t\t\t ) }\n\t\t\t</ConfirmDialog>\n\t\t</>\n\t);\n}\n"]}
|
|
@@ -9,11 +9,13 @@ import { useDispatch } from '@wordpress/data';
|
|
|
9
9
|
import { Button, MenuItem, Modal, TextControl, __experimentalHStack as HStack, __experimentalVStack as VStack } from '@wordpress/components';
|
|
10
10
|
import { store as coreStore } from '@wordpress/core-data';
|
|
11
11
|
import { store as noticesStore } from '@wordpress/notices';
|
|
12
|
+
import { decodeEntities } from '@wordpress/html-entities';
|
|
12
13
|
export default function RenameMenuItem({
|
|
13
14
|
template,
|
|
14
15
|
onClose
|
|
15
16
|
}) {
|
|
16
|
-
const
|
|
17
|
+
const title = decodeEntities(template.title.rendered);
|
|
18
|
+
const [editedTitle, setEditedTitle] = useState(title);
|
|
17
19
|
const [isModalOpen, setIsModalOpen] = useState(false);
|
|
18
20
|
const {
|
|
19
21
|
editEntityRecord,
|
|
@@ -33,10 +35,10 @@ export default function RenameMenuItem({
|
|
|
33
35
|
|
|
34
36
|
try {
|
|
35
37
|
await editEntityRecord('postType', template.type, template.id, {
|
|
36
|
-
title
|
|
38
|
+
title: editedTitle
|
|
37
39
|
}); // Update state before saving rerenders the list.
|
|
38
40
|
|
|
39
|
-
|
|
41
|
+
setEditedTitle('');
|
|
40
42
|
setIsModalOpen(false);
|
|
41
43
|
onClose(); // Persist edited entity.
|
|
42
44
|
|
|
@@ -57,7 +59,7 @@ export default function RenameMenuItem({
|
|
|
57
59
|
return createElement(Fragment, null, createElement(MenuItem, {
|
|
58
60
|
onClick: () => {
|
|
59
61
|
setIsModalOpen(true);
|
|
60
|
-
|
|
62
|
+
setEditedTitle(title);
|
|
61
63
|
}
|
|
62
64
|
}, __('Rename')), isModalOpen && createElement(Modal, {
|
|
63
65
|
title: __('Rename'),
|
|
@@ -72,8 +74,8 @@ export default function RenameMenuItem({
|
|
|
72
74
|
}, createElement(TextControl, {
|
|
73
75
|
__nextHasNoMarginBottom: true,
|
|
74
76
|
label: __('Name'),
|
|
75
|
-
value:
|
|
76
|
-
onChange:
|
|
77
|
+
value: editedTitle,
|
|
78
|
+
onChange: setEditedTitle,
|
|
77
79
|
required: true
|
|
78
80
|
}), createElement(HStack, {
|
|
79
81
|
justify: "right"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/template-actions/rename-menu-item.js"],"names":["__","useState","useDispatch","Button","MenuItem","Modal","TextControl","__experimentalHStack","HStack","__experimentalVStack","VStack","store","coreStore","noticesStore","RenameMenuItem","template","onClose","title","
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/template-actions/rename-menu-item.js"],"names":["__","useState","useDispatch","Button","MenuItem","Modal","TextControl","__experimentalHStack","HStack","__experimentalVStack","VStack","store","coreStore","noticesStore","decodeEntities","RenameMenuItem","template","onClose","title","rendered","editedTitle","setEditedTitle","isModalOpen","setIsModalOpen","editEntityRecord","saveEditedEntityRecord","createSuccessNotice","createErrorNotice","type","is_custom","onTemplateRename","event","preventDefault","id","throwOnError","error","errorMessage","message","code"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,EAAT,QAAmB,iBAAnB;AACA,SAASC,QAAT,QAAyB,oBAAzB;AACA,SAASC,WAAT,QAA4B,iBAA5B;AACA,SACCC,MADD,EAECC,QAFD,EAGCC,KAHD,EAICC,WAJD,EAKCC,oBAAoB,IAAIC,MALzB,EAMCC,oBAAoB,IAAIC,MANzB,QAOO,uBAPP;AAQA,SAASC,KAAK,IAAIC,SAAlB,QAAmC,sBAAnC;AACA,SAASD,KAAK,IAAIE,YAAlB,QAAsC,oBAAtC;AACA,SAAS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AAI,EAAC;AAA/B,KACGA,EAAE,CAAE,MAAF,CADL,CAVD,CATD,CADD,CAPD,CAVF,CADD;AAgDA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useState } from '@wordpress/element';\nimport { useDispatch } from '@wordpress/data';\nimport {\n\tButton,\n\tMenuItem,\n\tModal,\n\tTextControl,\n\t__experimentalHStack as HStack,\n\t__experimentalVStack as VStack,\n} from '@wordpress/components';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { decodeEntities } from '@wordpress/html-entities';\n\nexport default function RenameMenuItem( { template, onClose } ) {\n\tconst title = decodeEntities( template.title.rendered );\n\tconst [ editedTitle, setEditedTitle ] = useState( title );\n\tconst [ isModalOpen, setIsModalOpen ] = useState( false );\n\n\tconst { editEntityRecord, saveEditedEntityRecord } =\n\t\tuseDispatch( coreStore );\n\tconst { createSuccessNotice, createErrorNotice } =\n\t\tuseDispatch( noticesStore );\n\n\tif ( template.type === 'wp_template' && ! template.is_custom ) {\n\t\treturn null;\n\t}\n\n\tasync function onTemplateRename( event ) {\n\t\tevent.preventDefault();\n\n\t\ttry {\n\t\t\tawait editEntityRecord( 'postType', template.type, template.id, {\n\t\t\t\ttitle: editedTitle,\n\t\t\t} );\n\n\t\t\t// Update state before saving rerenders the list.\n\t\t\tsetEditedTitle( '' );\n\t\t\tsetIsModalOpen( false );\n\t\t\tonClose();\n\n\t\t\t// Persist edited entity.\n\t\t\tawait saveEditedEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\ttemplate.type,\n\t\t\t\ttemplate.id,\n\t\t\t\t{ throwOnError: true }\n\t\t\t);\n\n\t\t\tcreateSuccessNotice( __( 'Entity renamed.' ), {\n\t\t\t\ttype: 'snackbar',\n\t\t\t} );\n\t\t} catch ( error ) {\n\t\t\tconst errorMessage =\n\t\t\t\terror.message && error.code !== 'unknown_error'\n\t\t\t\t\t? error.message\n\t\t\t\t\t: __( 'An error occurred while renaming the entity.' );\n\n\t\t\tcreateErrorNotice( errorMessage, { type: 'snackbar' } );\n\t\t}\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<MenuItem\n\t\t\t\tonClick={ () => {\n\t\t\t\t\tsetIsModalOpen( true );\n\t\t\t\t\tsetEditedTitle( title );\n\t\t\t\t} }\n\t\t\t>\n\t\t\t\t{ __( 'Rename' ) }\n\t\t\t</MenuItem>\n\t\t\t{ isModalOpen && (\n\t\t\t\t<Modal\n\t\t\t\t\ttitle={ __( 'Rename' ) }\n\t\t\t\t\tonRequestClose={ () => {\n\t\t\t\t\t\tsetIsModalOpen( false );\n\t\t\t\t\t} }\n\t\t\t\t\toverlayClassName=\"edit-site-list__rename-modal\"\n\t\t\t\t>\n\t\t\t\t\t<form onSubmit={ onTemplateRename }>\n\t\t\t\t\t\t<VStack spacing=\"5\">\n\t\t\t\t\t\t\t<TextControl\n\t\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\t\tlabel={ __( 'Name' ) }\n\t\t\t\t\t\t\t\tvalue={ editedTitle }\n\t\t\t\t\t\t\t\tonChange={ setEditedTitle }\n\t\t\t\t\t\t\t\trequired\n\t\t\t\t\t\t\t/>\n\n\t\t\t\t\t\t\t<HStack justify=\"right\">\n\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\t\tsetIsModalOpen( false );\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{ __( 'Cancel' ) }\n\t\t\t\t\t\t\t\t</Button>\n\n\t\t\t\t\t\t\t\t<Button variant=\"primary\" type=\"submit\">\n\t\t\t\t\t\t\t\t\t{ __( 'Save' ) }\n\t\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t\t</HStack>\n\t\t\t\t\t\t</VStack>\n\t\t\t\t\t</form>\n\t\t\t\t</Modal>\n\t\t\t) }\n\t\t</>\n\t);\n}\n"]}
|
|
@@ -13,7 +13,7 @@ import { createHigherOrderComponent } from '@wordpress/compose';
|
|
|
13
13
|
import { InspectorAdvancedControls, store as blockEditorStore, privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';
|
|
14
14
|
import { BaseControl, Button } from '@wordpress/components';
|
|
15
15
|
import { __, sprintf } from '@wordpress/i18n';
|
|
16
|
-
import { __EXPERIMENTAL_STYLE_PROPERTY as STYLE_PROPERTY, getBlockType } from '@wordpress/blocks';
|
|
16
|
+
import { __EXPERIMENTAL_STYLE_PROPERTY as STYLE_PROPERTY, getBlockType, hasBlockSupport } from '@wordpress/blocks';
|
|
17
17
|
import { useContext, useMemo, useCallback } from '@wordpress/element';
|
|
18
18
|
import { useDispatch } from '@wordpress/data';
|
|
19
19
|
import { store as noticesStore } from '@wordpress/notices';
|
|
@@ -85,6 +85,7 @@ const STYLE_PATH_TO_PRESET_BLOCK_ATTRIBUTE = {
|
|
|
85
85
|
'typography.fontSize': 'fontSize',
|
|
86
86
|
'typography.fontFamily': 'fontFamily'
|
|
87
87
|
};
|
|
88
|
+
const SUPPORTED_STYLES = ['border', 'color', 'spacing', 'typography'];
|
|
88
89
|
|
|
89
90
|
function useChangesToPush(name, attributes) {
|
|
90
91
|
const supports = useSupportedStyles(name);
|
|
@@ -190,8 +191,9 @@ function PushChangesToGlobalStylesControl({
|
|
|
190
191
|
|
|
191
192
|
const withPushChangesToGlobalStyles = createHigherOrderComponent(BlockEdit => props => {
|
|
192
193
|
const blockEditingMode = useBlockEditingMode();
|
|
194
|
+
const supportsStyles = SUPPORTED_STYLES.some(feature => hasBlockSupport(props.name, feature));
|
|
193
195
|
return createElement(Fragment, null, createElement(BlockEdit, { ...props
|
|
194
|
-
}), blockEditingMode === 'default' && createElement(InspectorAdvancedControls, null, createElement(PushChangesToGlobalStylesControl, { ...props
|
|
196
|
+
}), blockEditingMode === 'default' && supportsStyles && createElement(InspectorAdvancedControls, null, createElement(PushChangesToGlobalStylesControl, { ...props
|
|
195
197
|
})));
|
|
196
198
|
});
|
|
197
199
|
addFilter('editor.BlockEdit', 'core/edit-site/push-changes-to-global-styles', withPushChangesToGlobalStyles);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/hooks/push-changes-to-global-styles/index.js"],"names":["get","set","addFilter","createHigherOrderComponent","InspectorAdvancedControls","store","blockEditorStore","privateApis","blockEditorPrivateApis","BaseControl","Button","__","sprintf","__EXPERIMENTAL_STYLE_PROPERTY","STYLE_PROPERTY","getBlockType","useContext","useMemo","useCallback","useDispatch","noticesStore","useSupportedStyles","unlock","GlobalStylesContext","useBlockEditingMode","STYLE_PATH_TO_CSS_VAR_INFIX","STYLE_PATH_TO_PRESET_BLOCK_ATTRIBUTE","useChangesToPush","name","attributes","supports","flatMap","key","value","path","presetAttributeKey","join","presetAttributeValue","style","cloneDeep","object","JSON","parse","stringify","PushChangesToGlobalStylesControl","setAttributes","changes","user","userConfig","setUserConfig","__unstableMarkNextChangeAsNotPersistent","createSuccessNotice","pushChanges","length","blockStyles","newBlockStyles","newUserConfig","undefined","undoIgnore","title","type","actions","label","onClick","withPushChangesToGlobalStyles","BlockEdit","props","blockEditingMode"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,GAAT,EAAcC,GAAd,QAAyB,QAAzB;AAEA;AACA;AACA;;AACA,SAASC,SAAT,QAA0B,kBAA1B;AACA,SAASC,0BAAT,QAA2C,oBAA3C;AACA,SACCC,yBADD,EAECC,KAAK,IAAIC,gBAFV,EAGCC,WAAW,IAAIC,sBAHhB,QAIO,yBAJP;AAKA,SAASC,WAAT,EAAsBC,MAAtB,QAAoC,uBAApC;AACA,SAASC,EAAT,EAAaC,OAAb,QAA4B,iBAA5B;AACA,SACCC,6BAA6B,IAAIC,cADlC,EAECC,YAFD,QAGO,mBAHP;AAIA,SAASC,UAAT,EAAqBC,OAArB,EAA8BC,WAA9B,QAAiD,oB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,KAAK,SAArB,IACD,cAAC,yBAAD,QACC,cAAC,gCAAD,OAAuCD;AAAvC,IADD,CAHF,CADD;AAUA,CAb8D,CAAhE;AAgBAhE,SAAS,CACR,kBADQ,EAER,8CAFQ,EAGR8D,6BAHQ,CAAT","sourcesContent":["/**\n * External dependencies\n */\nimport { get, set } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { addFilter } from '@wordpress/hooks';\nimport { createHigherOrderComponent } from '@wordpress/compose';\nimport {\n\tInspectorAdvancedControls,\n\tstore as blockEditorStore,\n\tprivateApis as blockEditorPrivateApis,\n} from '@wordpress/block-editor';\nimport { BaseControl, Button } from '@wordpress/components';\nimport { __, sprintf } from '@wordpress/i18n';\nimport {\n\t__EXPERIMENTAL_STYLE_PROPERTY as STYLE_PROPERTY,\n\tgetBlockType,\n} from '@wordpress/blocks';\nimport { useContext, useMemo, useCallback } from '@wordpress/element';\nimport { useDispatch } from '@wordpress/data';\nimport { store as noticesStore } from '@wordpress/notices';\n\n/**\n * Internal dependencies\n */\nimport { useSupportedStyles } from '../../components/global-styles/hooks';\nimport { unlock } from '../../lock-unlock';\n\nconst { GlobalStylesContext, useBlockEditingMode } = unlock(\n\tblockEditorPrivateApis\n);\n\n// TODO: Temporary duplication of constant in @wordpress/block-editor. Can be\n// removed by moving PushChangesToGlobalStylesControl to\n// @wordpress/block-editor.\nconst STYLE_PATH_TO_CSS_VAR_INFIX = {\n\t'color.background': 'color',\n\t'color.text': 'color',\n\t'elements.link.color.text': 'color',\n\t'elements.link.:hover.color.text': 'color',\n\t'elements.link.typography.fontFamily': 'font-family',\n\t'elements.link.typography.fontSize': 'font-size',\n\t'elements.button.color.text': 'color',\n\t'elements.button.color.background': 'color',\n\t'elements.button.typography.fontFamily': 'font-family',\n\t'elements.button.typography.fontSize': 'font-size',\n\t'elements.caption.color.text': 'color',\n\t'elements.heading.color': 'color',\n\t'elements.heading.color.background': 'color',\n\t'elements.heading.typography.fontFamily': 'font-family',\n\t'elements.heading.gradient': 'gradient',\n\t'elements.heading.color.gradient': 'gradient',\n\t'elements.h1.color': 'color',\n\t'elements.h1.color.background': 'color',\n\t'elements.h1.typography.fontFamily': 'font-family',\n\t'elements.h1.color.gradient': 'gradient',\n\t'elements.h2.color': 'color',\n\t'elements.h2.color.background': 'color',\n\t'elements.h2.typography.fontFamily': 'font-family',\n\t'elements.h2.color.gradient': 'gradient',\n\t'elements.h3.color': 'color',\n\t'elements.h3.color.background': 'color',\n\t'elements.h3.typography.fontFamily': 'font-family',\n\t'elements.h3.color.gradient': 'gradient',\n\t'elements.h4.color': 'color',\n\t'elements.h4.color.background': 'color',\n\t'elements.h4.typography.fontFamily': 'font-family',\n\t'elements.h4.color.gradient': 'gradient',\n\t'elements.h5.color': 'color',\n\t'elements.h5.color.background': 'color',\n\t'elements.h5.typography.fontFamily': 'font-family',\n\t'elements.h5.color.gradient': 'gradient',\n\t'elements.h6.color': 'color',\n\t'elements.h6.color.background': 'color',\n\t'elements.h6.typography.fontFamily': 'font-family',\n\t'elements.h6.color.gradient': 'gradient',\n\t'color.gradient': 'gradient',\n\t'typography.fontSize': 'font-size',\n\t'typography.fontFamily': 'font-family',\n};\n\n// TODO: Temporary duplication of constant in @wordpress/block-editor. Can be\n// removed by moving PushChangesToGlobalStylesControl to\n// @wordpress/block-editor.\nconst STYLE_PATH_TO_PRESET_BLOCK_ATTRIBUTE = {\n\t'color.background': 'backgroundColor',\n\t'color.text': 'textColor',\n\t'color.gradient': 'gradient',\n\t'typography.fontSize': 'fontSize',\n\t'typography.fontFamily': 'fontFamily',\n};\n\nfunction useChangesToPush( name, attributes ) {\n\tconst supports = useSupportedStyles( name );\n\n\treturn useMemo(\n\t\t() =>\n\t\t\tsupports.flatMap( ( key ) => {\n\t\t\t\tif ( ! STYLE_PROPERTY[ key ] ) {\n\t\t\t\t\treturn [];\n\t\t\t\t}\n\t\t\t\tconst { value: path } = STYLE_PROPERTY[ key ];\n\t\t\t\tconst presetAttributeKey = path.join( '.' );\n\t\t\t\tconst presetAttributeValue =\n\t\t\t\t\tattributes[\n\t\t\t\t\t\tSTYLE_PATH_TO_PRESET_BLOCK_ATTRIBUTE[\n\t\t\t\t\t\t\tpresetAttributeKey\n\t\t\t\t\t\t]\n\t\t\t\t\t];\n\t\t\t\tconst value = presetAttributeValue\n\t\t\t\t\t? `var:preset|${ STYLE_PATH_TO_CSS_VAR_INFIX[ presetAttributeKey ] }|${ presetAttributeValue }`\n\t\t\t\t\t: get( attributes.style, path );\n\t\t\t\treturn value ? [ { path, value } ] : [];\n\t\t\t} ),\n\t\t[ supports, name, attributes ]\n\t);\n}\n\nfunction cloneDeep( object ) {\n\treturn ! object ? {} : JSON.parse( JSON.stringify( object ) );\n}\n\nfunction PushChangesToGlobalStylesControl( {\n\tname,\n\tattributes,\n\tsetAttributes,\n} ) {\n\tconst changes = useChangesToPush( name, attributes );\n\n\tconst { user: userConfig, setUserConfig } =\n\t\tuseContext( GlobalStylesContext );\n\n\tconst { __unstableMarkNextChangeAsNotPersistent } =\n\t\tuseDispatch( blockEditorStore );\n\tconst { createSuccessNotice } = useDispatch( noticesStore );\n\n\tconst pushChanges = useCallback( () => {\n\t\tif ( changes.length === 0 ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst { style: blockStyles } = attributes;\n\n\t\tconst newBlockStyles = cloneDeep( blockStyles );\n\t\tconst newUserConfig = cloneDeep( userConfig );\n\n\t\tfor ( const { path, value } of changes ) {\n\t\t\tset( newBlockStyles, path, undefined );\n\t\t\tset( newUserConfig, [ 'styles', 'blocks', name, ...path ], value );\n\t\t}\n\n\t\t// @wordpress/core-data doesn't support editing multiple entity types in\n\t\t// a single undo level. So for now, we disable @wordpress/core-data undo\n\t\t// tracking and implement our own Undo button in the snackbar\n\t\t// notification.\n\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\tsetAttributes( { style: newBlockStyles } );\n\t\tsetUserConfig( () => newUserConfig, { undoIgnore: true } );\n\n\t\tcreateSuccessNotice(\n\t\t\tsprintf(\n\t\t\t\t// translators: %s: Title of the block e.g. 'Heading'.\n\t\t\t\t__( '%s styles applied.' ),\n\t\t\t\tgetBlockType( name ).title\n\t\t\t),\n\t\t\t{\n\t\t\t\ttype: 'snackbar',\n\t\t\t\tactions: [\n\t\t\t\t\t{\n\t\t\t\t\t\tlabel: __( 'Undo' ),\n\t\t\t\t\t\tonClick() {\n\t\t\t\t\t\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\t\t\t\t\t\tsetAttributes( { style: blockStyles } );\n\t\t\t\t\t\t\tsetUserConfig( () => userConfig, {\n\t\t\t\t\t\t\t\tundoIgnore: true,\n\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t}\n\t\t);\n\t}, [ changes, attributes, userConfig, name ] );\n\n\treturn (\n\t\t<BaseControl\n\t\t\tclassName=\"edit-site-push-changes-to-global-styles-control\"\n\t\t\thelp={ sprintf(\n\t\t\t\t// translators: %s: Title of the block e.g. 'Heading'.\n\t\t\t\t__(\n\t\t\t\t\t'Apply this block’s typography, spacing, dimensions, and color styles to all %s blocks.'\n\t\t\t\t),\n\t\t\t\tgetBlockType( name ).title\n\t\t\t) }\n\t\t>\n\t\t\t<BaseControl.VisualLabel>\n\t\t\t\t{ __( 'Styles' ) }\n\t\t\t</BaseControl.VisualLabel>\n\t\t\t<Button\n\t\t\t\tvariant=\"primary\"\n\t\t\t\tdisabled={ changes.length === 0 }\n\t\t\t\tonClick={ pushChanges }\n\t\t\t>\n\t\t\t\t{ __( 'Apply globally' ) }\n\t\t\t</Button>\n\t\t</BaseControl>\n\t);\n}\n\nconst withPushChangesToGlobalStyles = createHigherOrderComponent(\n\t( BlockEdit ) => ( props ) => {\n\t\tconst blockEditingMode = useBlockEditingMode();\n\t\treturn (\n\t\t\t<>\n\t\t\t\t<BlockEdit { ...props } />\n\t\t\t\t{ blockEditingMode === 'default' && (\n\t\t\t\t\t<InspectorAdvancedControls>\n\t\t\t\t\t\t<PushChangesToGlobalStylesControl { ...props } />\n\t\t\t\t\t</InspectorAdvancedControls>\n\t\t\t\t) }\n\t\t\t</>\n\t\t);\n\t}\n);\n\naddFilter(\n\t'editor.BlockEdit',\n\t'core/edit-site/push-changes-to-global-styles',\n\twithPushChangesToGlobalStyles\n);\n"]}
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/hooks/push-changes-to-global-styles/index.js"],"names":["get","set","addFilter","createHigherOrderComponent","InspectorAdvancedControls","store","blockEditorStore","privateApis","blockEditorPrivateApis","BaseControl","Button","__","sprintf","__EXPERIMENTAL_STYLE_PROPERTY","STYLE_PROPERTY","getBlockType","hasBlockSupport","useContext","useMemo","useCallback","useDispatch","noticesStore","useSupportedStyles","unlock","GlobalStylesContext","useBlockEditingMode","STYLE_PATH_TO_CSS_VAR_INFIX","STYLE_PATH_TO_PRESET_BLOCK_ATTRIBUTE","SUPPORTED_STYLES","useChangesToPush","name","attributes","supports","flatMap","key","value","path","presetAttributeKey","join","presetAttributeValue","style","cloneDeep","object","JSON","parse","stringify","PushChangesToGlobalStylesControl","setAttributes","changes","user","userConfig","setUserConfig","__unstableMarkNextChangeAsNotPersistent","createSuccessNotice","pushChanges","length","blockStyles","newBlockStyles","newUserConfig","undefined","undoIgnore","title","type","actions","label","onClick","withPushChangesToGlobalStyles","BlockEdit","props","blockEditingMode","supportsStyles","some","feature"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,GAAT,EAAcC,GAAd,QAAyB,QAAzB;AAEA;AACA;AACA;;AACA,SAASC,SAAT,QAA0B,kBAA1B;AACA,SAASC,0BAAT,QAA2C,oBAA3C;AACA,SACCC,yBADD,EAECC,KAAK,IAAIC,gBAFV,EAGCC,WAAW,IAAIC,sBAHhB,QAIO,yBAJP;AAKA,SAASC,WAAT,EAAsBC,MAAtB,QAAoC,uBAApC;AACA,SAASC,EAAT,EAAaC,OAAb,QAA4B,iBAA5B;AACA,SACCC,6BAA6B,IAAIC,cADlC,EAECC,YAFD,EAGC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AA6B,GAAG/D,0BAA0B,CAC7DgE,SAAF,IAAmBC,KAAF,IAAa;AAC7B,QAAMC,gBAAgB,GAAG5C,mBAAmB,EAA5C;AACA,QAAM6C,cAAc,GAAG1C,gBAAgB,CAAC2C,IAAjB,CAAyBC,OAAF,IAC7CxD,eAAe,CAAEoD,KAAK,CAACtC,IAAR,EAAc0C,OAAd,CADO,CAAvB;AAIA,SACC,8BACC,cAAC,SAAD,OAAgBJ;AAAhB,IADD,EAEGC,gBAAgB,KAAK,SAArB,IAAkCC,cAAlC,IACD,cAAC,yBAAD,QACC,cAAC,gCAAD,OAAuCF;AAAvC,IADD,CAHF,CADD;AAUA,CAjB8D,CAAhE;AAoBAlE,SAAS,CACR,kBADQ,EAER,8CAFQ,EAGRgE,6BAHQ,CAAT","sourcesContent":["/**\n * External dependencies\n */\nimport { get, set } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { addFilter } from '@wordpress/hooks';\nimport { createHigherOrderComponent } from '@wordpress/compose';\nimport {\n\tInspectorAdvancedControls,\n\tstore as blockEditorStore,\n\tprivateApis as blockEditorPrivateApis,\n} from '@wordpress/block-editor';\nimport { BaseControl, Button } from '@wordpress/components';\nimport { __, sprintf } from '@wordpress/i18n';\nimport {\n\t__EXPERIMENTAL_STYLE_PROPERTY as STYLE_PROPERTY,\n\tgetBlockType,\n\thasBlockSupport,\n} from '@wordpress/blocks';\nimport { useContext, useMemo, useCallback } from '@wordpress/element';\nimport { useDispatch } from '@wordpress/data';\nimport { store as noticesStore } from '@wordpress/notices';\n\n/**\n * Internal dependencies\n */\nimport { useSupportedStyles } from '../../components/global-styles/hooks';\nimport { unlock } from '../../lock-unlock';\n\nconst { GlobalStylesContext, useBlockEditingMode } = unlock(\n\tblockEditorPrivateApis\n);\n\n// TODO: Temporary duplication of constant in @wordpress/block-editor. Can be\n// removed by moving PushChangesToGlobalStylesControl to\n// @wordpress/block-editor.\nconst STYLE_PATH_TO_CSS_VAR_INFIX = {\n\t'color.background': 'color',\n\t'color.text': 'color',\n\t'elements.link.color.text': 'color',\n\t'elements.link.:hover.color.text': 'color',\n\t'elements.link.typography.fontFamily': 'font-family',\n\t'elements.link.typography.fontSize': 'font-size',\n\t'elements.button.color.text': 'color',\n\t'elements.button.color.background': 'color',\n\t'elements.button.typography.fontFamily': 'font-family',\n\t'elements.button.typography.fontSize': 'font-size',\n\t'elements.caption.color.text': 'color',\n\t'elements.heading.color': 'color',\n\t'elements.heading.color.background': 'color',\n\t'elements.heading.typography.fontFamily': 'font-family',\n\t'elements.heading.gradient': 'gradient',\n\t'elements.heading.color.gradient': 'gradient',\n\t'elements.h1.color': 'color',\n\t'elements.h1.color.background': 'color',\n\t'elements.h1.typography.fontFamily': 'font-family',\n\t'elements.h1.color.gradient': 'gradient',\n\t'elements.h2.color': 'color',\n\t'elements.h2.color.background': 'color',\n\t'elements.h2.typography.fontFamily': 'font-family',\n\t'elements.h2.color.gradient': 'gradient',\n\t'elements.h3.color': 'color',\n\t'elements.h3.color.background': 'color',\n\t'elements.h3.typography.fontFamily': 'font-family',\n\t'elements.h3.color.gradient': 'gradient',\n\t'elements.h4.color': 'color',\n\t'elements.h4.color.background': 'color',\n\t'elements.h4.typography.fontFamily': 'font-family',\n\t'elements.h4.color.gradient': 'gradient',\n\t'elements.h5.color': 'color',\n\t'elements.h5.color.background': 'color',\n\t'elements.h5.typography.fontFamily': 'font-family',\n\t'elements.h5.color.gradient': 'gradient',\n\t'elements.h6.color': 'color',\n\t'elements.h6.color.background': 'color',\n\t'elements.h6.typography.fontFamily': 'font-family',\n\t'elements.h6.color.gradient': 'gradient',\n\t'color.gradient': 'gradient',\n\t'typography.fontSize': 'font-size',\n\t'typography.fontFamily': 'font-family',\n};\n\n// TODO: Temporary duplication of constant in @wordpress/block-editor. Can be\n// removed by moving PushChangesToGlobalStylesControl to\n// @wordpress/block-editor.\nconst STYLE_PATH_TO_PRESET_BLOCK_ATTRIBUTE = {\n\t'color.background': 'backgroundColor',\n\t'color.text': 'textColor',\n\t'color.gradient': 'gradient',\n\t'typography.fontSize': 'fontSize',\n\t'typography.fontFamily': 'fontFamily',\n};\n\nconst SUPPORTED_STYLES = [ 'border', 'color', 'spacing', 'typography' ];\n\nfunction useChangesToPush( name, attributes ) {\n\tconst supports = useSupportedStyles( name );\n\n\treturn useMemo(\n\t\t() =>\n\t\t\tsupports.flatMap( ( key ) => {\n\t\t\t\tif ( ! STYLE_PROPERTY[ key ] ) {\n\t\t\t\t\treturn [];\n\t\t\t\t}\n\t\t\t\tconst { value: path } = STYLE_PROPERTY[ key ];\n\t\t\t\tconst presetAttributeKey = path.join( '.' );\n\t\t\t\tconst presetAttributeValue =\n\t\t\t\t\tattributes[\n\t\t\t\t\t\tSTYLE_PATH_TO_PRESET_BLOCK_ATTRIBUTE[\n\t\t\t\t\t\t\tpresetAttributeKey\n\t\t\t\t\t\t]\n\t\t\t\t\t];\n\t\t\t\tconst value = presetAttributeValue\n\t\t\t\t\t? `var:preset|${ STYLE_PATH_TO_CSS_VAR_INFIX[ presetAttributeKey ] }|${ presetAttributeValue }`\n\t\t\t\t\t: get( attributes.style, path );\n\t\t\t\treturn value ? [ { path, value } ] : [];\n\t\t\t} ),\n\t\t[ supports, name, attributes ]\n\t);\n}\n\nfunction cloneDeep( object ) {\n\treturn ! object ? {} : JSON.parse( JSON.stringify( object ) );\n}\n\nfunction PushChangesToGlobalStylesControl( {\n\tname,\n\tattributes,\n\tsetAttributes,\n} ) {\n\tconst changes = useChangesToPush( name, attributes );\n\n\tconst { user: userConfig, setUserConfig } =\n\t\tuseContext( GlobalStylesContext );\n\n\tconst { __unstableMarkNextChangeAsNotPersistent } =\n\t\tuseDispatch( blockEditorStore );\n\tconst { createSuccessNotice } = useDispatch( noticesStore );\n\n\tconst pushChanges = useCallback( () => {\n\t\tif ( changes.length === 0 ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst { style: blockStyles } = attributes;\n\n\t\tconst newBlockStyles = cloneDeep( blockStyles );\n\t\tconst newUserConfig = cloneDeep( userConfig );\n\n\t\tfor ( const { path, value } of changes ) {\n\t\t\tset( newBlockStyles, path, undefined );\n\t\t\tset( newUserConfig, [ 'styles', 'blocks', name, ...path ], value );\n\t\t}\n\n\t\t// @wordpress/core-data doesn't support editing multiple entity types in\n\t\t// a single undo level. So for now, we disable @wordpress/core-data undo\n\t\t// tracking and implement our own Undo button in the snackbar\n\t\t// notification.\n\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\tsetAttributes( { style: newBlockStyles } );\n\t\tsetUserConfig( () => newUserConfig, { undoIgnore: true } );\n\n\t\tcreateSuccessNotice(\n\t\t\tsprintf(\n\t\t\t\t// translators: %s: Title of the block e.g. 'Heading'.\n\t\t\t\t__( '%s styles applied.' ),\n\t\t\t\tgetBlockType( name ).title\n\t\t\t),\n\t\t\t{\n\t\t\t\ttype: 'snackbar',\n\t\t\t\tactions: [\n\t\t\t\t\t{\n\t\t\t\t\t\tlabel: __( 'Undo' ),\n\t\t\t\t\t\tonClick() {\n\t\t\t\t\t\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\t\t\t\t\t\tsetAttributes( { style: blockStyles } );\n\t\t\t\t\t\t\tsetUserConfig( () => userConfig, {\n\t\t\t\t\t\t\t\tundoIgnore: true,\n\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t}\n\t\t);\n\t}, [ changes, attributes, userConfig, name ] );\n\n\treturn (\n\t\t<BaseControl\n\t\t\tclassName=\"edit-site-push-changes-to-global-styles-control\"\n\t\t\thelp={ sprintf(\n\t\t\t\t// translators: %s: Title of the block e.g. 'Heading'.\n\t\t\t\t__(\n\t\t\t\t\t'Apply this block’s typography, spacing, dimensions, and color styles to all %s blocks.'\n\t\t\t\t),\n\t\t\t\tgetBlockType( name ).title\n\t\t\t) }\n\t\t>\n\t\t\t<BaseControl.VisualLabel>\n\t\t\t\t{ __( 'Styles' ) }\n\t\t\t</BaseControl.VisualLabel>\n\t\t\t<Button\n\t\t\t\tvariant=\"primary\"\n\t\t\t\tdisabled={ changes.length === 0 }\n\t\t\t\tonClick={ pushChanges }\n\t\t\t>\n\t\t\t\t{ __( 'Apply globally' ) }\n\t\t\t</Button>\n\t\t</BaseControl>\n\t);\n}\n\nconst withPushChangesToGlobalStyles = createHigherOrderComponent(\n\t( BlockEdit ) => ( props ) => {\n\t\tconst blockEditingMode = useBlockEditingMode();\n\t\tconst supportsStyles = SUPPORTED_STYLES.some( ( feature ) =>\n\t\t\thasBlockSupport( props.name, feature )\n\t\t);\n\n\t\treturn (\n\t\t\t<>\n\t\t\t\t<BlockEdit { ...props } />\n\t\t\t\t{ blockEditingMode === 'default' && supportsStyles && (\n\t\t\t\t\t<InspectorAdvancedControls>\n\t\t\t\t\t\t<PushChangesToGlobalStylesControl { ...props } />\n\t\t\t\t\t</InspectorAdvancedControls>\n\t\t\t\t) }\n\t\t\t</>\n\t\t);\n\t}\n);\n\naddFilter(\n\t'editor.BlockEdit',\n\t'core/edit-site/push-changes-to-global-styles',\n\twithPushChangesToGlobalStyles\n);\n"]}
|
|
@@ -23,7 +23,7 @@ export function useActivateTheme() {
|
|
|
23
23
|
const location = useLocation();
|
|
24
24
|
return async () => {
|
|
25
25
|
if (isPreviewingTheme()) {
|
|
26
|
-
const activationURL = 'themes.php?action=activate&stylesheet=' + currentlyPreviewingTheme() + '&_wpnonce=' + window.
|
|
26
|
+
const activationURL = 'themes.php?action=activate&stylesheet=' + currentlyPreviewingTheme() + '&_wpnonce=' + window.WP_BLOCK_THEME_ACTIVATE_NONCE;
|
|
27
27
|
await window.fetch(activationURL);
|
|
28
28
|
const {
|
|
29
29
|
wp_theme_preview: themePreview,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/utils/use-activate-theme.js"],"names":["privateApis","routerPrivateApis","unlock","isPreviewingTheme","currentlyPreviewingTheme","useHistory","useLocation","useActivateTheme","history","location","activationURL","window","
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/utils/use-activate-theme.js"],"names":["privateApis","routerPrivateApis","unlock","isPreviewingTheme","currentlyPreviewingTheme","useHistory","useLocation","useActivateTheme","history","location","activationURL","window","WP_BLOCK_THEME_ACTIVATE_NONCE","fetch","wp_theme_preview","themePreview","params","replace"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,WAAW,IAAIC,iBAAxB,QAAiD,mBAAjD;AAEA;AACA;AACA;;AACA,SAASC,MAAT,QAAuB,gBAAvB;AACA,SACCC,iBADD,EAECC,wBAFD,QAGO,uBAHP;AAKA,MAAM;AAAEC,EAAAA,UAAF;AAAcC,EAAAA;AAAd,IAA8BJ,MAAM,CAAED,iBAAF,CAA1C;AAEA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASM,gBAAT,GAA4B;AAClC,QAAMC,OAAO,GAAGH,UAAU,EAA1B;AACA,QAAMI,QAAQ,GAAGH,WAAW,EAA5B;AAEA,SAAO,YAAY;AAClB,QAAKH,iBAAiB,EAAtB,EAA2B;AAC1B,YAAMO,aAAa,GAClB,2CACAN,wBAAwB,EADxB,GAEA,YAFA,GAGAO,MAAM,CAACC,6BAJR;AAKA,YAAMD,MAAM,CAACE,KAAP,CAAcH,aAAd,CAAN;AACA,YAAM;AAAEI,QAAAA,gBAAgB,EAAEC,YAApB;AAAkC,WAAGC;AAArC,UACLP,QAAQ,CAACO,MADV;AAEAR,MAAAA,OAAO,CAACS,OAAR,CAAiBD,MAAjB;AACA;AACD,GAZD;AAaA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../lock-unlock';\nimport {\n\tisPreviewingTheme,\n\tcurrentlyPreviewingTheme,\n} from './is-previewing-theme';\n\nconst { useHistory, useLocation } = unlock( routerPrivateApis );\n\n/**\n * This should be refactored to use the REST API, once the REST API can activate themes.\n *\n * @return {Function} A function that activates the theme.\n */\nexport function useActivateTheme() {\n\tconst history = useHistory();\n\tconst location = useLocation();\n\n\treturn async () => {\n\t\tif ( isPreviewingTheme() ) {\n\t\t\tconst activationURL =\n\t\t\t\t'themes.php?action=activate&stylesheet=' +\n\t\t\t\tcurrentlyPreviewingTheme() +\n\t\t\t\t'&_wpnonce=' +\n\t\t\t\twindow.WP_BLOCK_THEME_ACTIVATE_NONCE;\n\t\t\tawait window.fetch( activationURL );\n\t\t\tconst { wp_theme_preview: themePreview, ...params } =\n\t\t\t\tlocation.params;\n\t\t\thistory.replace( params );\n\t\t}\n\t};\n}\n"]}
|
|
@@ -1483,6 +1483,9 @@ textarea.edit-site-code-editor-text-area.edit-site-code-editor-text-area:-ms-inp
|
|
|
1483
1483
|
overflow: hidden;
|
|
1484
1484
|
grid-column: 2/3;
|
|
1485
1485
|
}
|
|
1486
|
+
.edit-site-document-actions__title .block-editor-block-icon {
|
|
1487
|
+
min-width: 24px;
|
|
1488
|
+
}
|
|
1486
1489
|
.edit-site-document-actions__title h1 {
|
|
1487
1490
|
white-space: nowrap;
|
|
1488
1491
|
overflow: hidden;
|
|
@@ -1781,8 +1784,18 @@ body.is-fullscreen-mode .edit-site-list-header {
|
|
|
1781
1784
|
}
|
|
1782
1785
|
|
|
1783
1786
|
.edit-site-patterns {
|
|
1784
|
-
|
|
1787
|
+
border: 1px solid #2f2f2f;
|
|
1788
|
+
background: none;
|
|
1785
1789
|
margin: 60px 0 0;
|
|
1790
|
+
border-radius: 0;
|
|
1791
|
+
}
|
|
1792
|
+
.edit-site-patterns .components-base-control {
|
|
1793
|
+
width: 100%;
|
|
1794
|
+
}
|
|
1795
|
+
@media (min-width: 782px) {
|
|
1796
|
+
.edit-site-patterns .components-base-control {
|
|
1797
|
+
width: auto;
|
|
1798
|
+
}
|
|
1786
1799
|
}
|
|
1787
1800
|
.edit-site-patterns .components-text {
|
|
1788
1801
|
color: #949494;
|
|
@@ -1795,35 +1808,100 @@ body.is-fullscreen-mode .edit-site-list-header {
|
|
|
1795
1808
|
margin: 0;
|
|
1796
1809
|
}
|
|
1797
1810
|
}
|
|
1811
|
+
.edit-site-patterns .edit-site-patterns__search-block {
|
|
1812
|
+
min-width: -moz-fit-content;
|
|
1813
|
+
min-width: fit-content;
|
|
1814
|
+
flex-grow: 1;
|
|
1815
|
+
}
|
|
1816
|
+
.edit-site-patterns .edit-site-patterns__search input[type=search] {
|
|
1817
|
+
height: 40px;
|
|
1818
|
+
background: #2f2f2f;
|
|
1819
|
+
color: #e0e0e0;
|
|
1820
|
+
}
|
|
1821
|
+
.edit-site-patterns .edit-site-patterns__search input[type=search]:focus {
|
|
1822
|
+
background: #2f2f2f;
|
|
1823
|
+
}
|
|
1824
|
+
.edit-site-patterns .edit-site-patterns__search svg {
|
|
1825
|
+
fill: #949494;
|
|
1826
|
+
}
|
|
1827
|
+
.edit-site-patterns .edit-site-patterns__sync-status-filter {
|
|
1828
|
+
background: #2f2f2f;
|
|
1829
|
+
border: none;
|
|
1830
|
+
height: 40px;
|
|
1831
|
+
min-width: max-content;
|
|
1832
|
+
width: 100%;
|
|
1833
|
+
max-width: 100%;
|
|
1834
|
+
}
|
|
1835
|
+
@media (min-width: 782px) {
|
|
1836
|
+
.edit-site-patterns .edit-site-patterns__sync-status-filter {
|
|
1837
|
+
width: 300px;
|
|
1838
|
+
}
|
|
1839
|
+
}
|
|
1840
|
+
.edit-site-patterns .edit-site-patterns__sync-status-filter-option:active {
|
|
1841
|
+
background: #757575;
|
|
1842
|
+
color: #f0f0f0;
|
|
1843
|
+
}
|
|
1844
|
+
.edit-site-patterns .edit-site-patterns__grid-pagination {
|
|
1845
|
+
width: -moz-fit-content;
|
|
1846
|
+
width: fit-content;
|
|
1847
|
+
}
|
|
1848
|
+
.edit-site-patterns .edit-site-patterns__grid-pagination .components-button.is-tertiary {
|
|
1849
|
+
width: 32px;
|
|
1850
|
+
height: 32px;
|
|
1851
|
+
color: #f0f0f0;
|
|
1852
|
+
background-color: #2f2f2f;
|
|
1853
|
+
}
|
|
1854
|
+
.edit-site-patterns .edit-site-patterns__grid-pagination .components-button.is-tertiary:disabled {
|
|
1855
|
+
color: #949494;
|
|
1856
|
+
background: none;
|
|
1857
|
+
}
|
|
1858
|
+
.edit-site-patterns .edit-site-patterns__grid-pagination .components-button.is-tertiary:hover:not(:disabled) {
|
|
1859
|
+
background-color: #757575;
|
|
1860
|
+
}
|
|
1861
|
+
|
|
1862
|
+
.edit-site-patterns__section-header .screen-reader-shortcut:focus {
|
|
1863
|
+
top: 0;
|
|
1864
|
+
}
|
|
1798
1865
|
|
|
1799
1866
|
.edit-site-patterns__grid {
|
|
1800
|
-
|
|
1867
|
+
display: grid;
|
|
1868
|
+
grid-template-columns: 1fr;
|
|
1869
|
+
gap: 32px;
|
|
1801
1870
|
padding-top: 2px;
|
|
1871
|
+
margin-top: 0;
|
|
1802
1872
|
margin-bottom: 32px;
|
|
1803
1873
|
}
|
|
1804
1874
|
@media (min-width: 960px) {
|
|
1805
1875
|
.edit-site-patterns__grid {
|
|
1806
|
-
|
|
1876
|
+
grid-template-columns: 1fr 1fr;
|
|
1807
1877
|
}
|
|
1808
1878
|
}
|
|
1809
1879
|
.edit-site-patterns__grid .edit-site-patterns__pattern {
|
|
1810
1880
|
break-inside: avoid-column;
|
|
1811
1881
|
display: flex;
|
|
1812
1882
|
flex-direction: column;
|
|
1813
|
-
margin-bottom: 48px;
|
|
1814
1883
|
}
|
|
1815
1884
|
.edit-site-patterns__grid .edit-site-patterns__pattern .edit-site-patterns__preview {
|
|
1816
|
-
|
|
1885
|
+
box-shadow: none;
|
|
1886
|
+
border: none;
|
|
1887
|
+
padding: 0;
|
|
1888
|
+
background-color: unset;
|
|
1889
|
+
box-sizing: border-box;
|
|
1890
|
+
border-radius: 4px;
|
|
1817
1891
|
cursor: pointer;
|
|
1818
1892
|
overflow: hidden;
|
|
1819
1893
|
}
|
|
1820
1894
|
.edit-site-patterns__grid .edit-site-patterns__pattern .edit-site-patterns__preview:focus {
|
|
1821
|
-
box-shadow: inset 0 0 0
|
|
1895
|
+
box-shadow: inset 0 0 0 0 #fff, 0 0 0 2px var(--wp-admin-theme-color);
|
|
1822
1896
|
outline: 2px solid transparent;
|
|
1823
1897
|
}
|
|
1824
1898
|
.edit-site-patterns__grid .edit-site-patterns__pattern .edit-site-patterns__preview.is-inactive {
|
|
1825
1899
|
cursor: default;
|
|
1826
1900
|
}
|
|
1901
|
+
.edit-site-patterns__grid .edit-site-patterns__pattern .edit-site-patterns__preview.is-inactive:focus {
|
|
1902
|
+
box-shadow: 0 0 0 var(--wp-admin-border-width-focus) #2f2f2f;
|
|
1903
|
+
opacity: 0.8;
|
|
1904
|
+
}
|
|
1827
1905
|
.edit-site-patterns__grid .edit-site-patterns__pattern .edit-site-patterns__footer,
|
|
1828
1906
|
.edit-site-patterns__grid .edit-site-patterns__pattern .edit-site-patterns__button {
|
|
1829
1907
|
color: #949494;
|
|
@@ -1840,23 +1918,23 @@ body.is-fullscreen-mode .edit-site-list-header {
|
|
|
1840
1918
|
box-shadow: 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color);
|
|
1841
1919
|
}
|
|
1842
1920
|
.edit-site-patterns__grid .edit-site-patterns__preview {
|
|
1843
|
-
flex: 1;
|
|
1921
|
+
flex: 0 1 auto;
|
|
1844
1922
|
margin-bottom: 16px;
|
|
1845
1923
|
}
|
|
1846
1924
|
|
|
1847
|
-
.edit-site-
|
|
1848
|
-
|
|
1849
|
-
color: #e0e0e0;
|
|
1850
|
-
}
|
|
1851
|
-
.edit-site-patterns__search.edit-site-patterns__search input[type=search]:focus {
|
|
1852
|
-
background: #2f2f2f;
|
|
1853
|
-
}
|
|
1854
|
-
.edit-site-patterns__search svg {
|
|
1855
|
-
fill: #949494;
|
|
1925
|
+
.edit-site-patterns__load-more {
|
|
1926
|
+
align-self: center;
|
|
1856
1927
|
}
|
|
1857
1928
|
|
|
1858
1929
|
.edit-site-patterns__pattern-title {
|
|
1859
|
-
color: #
|
|
1930
|
+
color: #e0e0e0;
|
|
1931
|
+
}
|
|
1932
|
+
.edit-site-patterns__pattern-title .is-link {
|
|
1933
|
+
text-decoration: none;
|
|
1934
|
+
color: #e0e0e0;
|
|
1935
|
+
}
|
|
1936
|
+
.edit-site-patterns__pattern-title .is-link:hover, .edit-site-patterns__pattern-title .is-link:focus {
|
|
1937
|
+
color: #fff;
|
|
1860
1938
|
}
|
|
1861
1939
|
.edit-site-patterns__pattern-title .edit-site-patterns__pattern-icon {
|
|
1862
1940
|
border-radius: 4px;
|
|
@@ -1866,6 +1944,9 @@ body.is-fullscreen-mode .edit-site-list-header {
|
|
|
1866
1944
|
.edit-site-patterns__pattern-title .edit-site-patterns__pattern-lock-icon {
|
|
1867
1945
|
display: inline-flex;
|
|
1868
1946
|
}
|
|
1947
|
+
.edit-site-patterns__pattern-title .edit-site-patterns__pattern-lock-icon svg {
|
|
1948
|
+
fill: currentcolor;
|
|
1949
|
+
}
|
|
1869
1950
|
|
|
1870
1951
|
.edit-site-patterns__no-results {
|
|
1871
1952
|
color: #949494;
|
|
@@ -2597,6 +2678,7 @@ body.is-fullscreen-mode .edit-site .components-editor-notices__snackbar {
|
|
|
2597
2678
|
.edit-site-layout__sidebar {
|
|
2598
2679
|
z-index: 1;
|
|
2599
2680
|
width: 100vw;
|
|
2681
|
+
flex-shrink: 0;
|
|
2600
2682
|
}
|
|
2601
2683
|
@media (min-width: 782px) {
|
|
2602
2684
|
.edit-site-layout__sidebar {
|
|
@@ -2906,12 +2988,15 @@ body.is-fullscreen-mode .edit-site .components-editor-notices__snackbar {
|
|
|
2906
2988
|
color: #e0e0e0;
|
|
2907
2989
|
background: #2f2f2f;
|
|
2908
2990
|
}
|
|
2991
|
+
.edit-site-sidebar-navigation-item.components-item:hover .edit-site-sidebar-navigation-item__drilldown-indicator, .edit-site-sidebar-navigation-item.components-item:focus .edit-site-sidebar-navigation-item__drilldown-indicator, .edit-site-sidebar-navigation-item.components-item[aria-current] .edit-site-sidebar-navigation-item__drilldown-indicator {
|
|
2992
|
+
fill: #e0e0e0;
|
|
2993
|
+
}
|
|
2909
2994
|
.edit-site-sidebar-navigation-item.components-item[aria-current] {
|
|
2910
2995
|
background: var(--wp-admin-theme-color);
|
|
2911
2996
|
color: #fff;
|
|
2912
2997
|
}
|
|
2913
2998
|
.edit-site-sidebar-navigation-item.components-item .edit-site-sidebar-navigation-item__drilldown-indicator {
|
|
2914
|
-
fill: #
|
|
2999
|
+
fill: #949494;
|
|
2915
3000
|
}
|
|
2916
3001
|
.edit-site-sidebar-navigation-item.components-item:is(a) {
|
|
2917
3002
|
text-decoration: none;
|
|
@@ -2922,6 +3007,10 @@ body.is-fullscreen-mode .edit-site .components-editor-notices__snackbar {
|
|
|
2922
3007
|
box-shadow: none;
|
|
2923
3008
|
outline: none;
|
|
2924
3009
|
}
|
|
3010
|
+
.edit-site-sidebar-navigation-item.components-item:is(a):focus-visible {
|
|
3011
|
+
box-shadow: 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color);
|
|
3012
|
+
outline: 2px solid transparent;
|
|
3013
|
+
}
|
|
2925
3014
|
.edit-site-sidebar-navigation-item.components-item.with-suffix {
|
|
2926
3015
|
padding-left: 16px;
|
|
2927
3016
|
}
|
|
@@ -3197,8 +3286,6 @@ body.is-fullscreen-mode .edit-site .components-editor-notices__snackbar {
|
|
|
3197
3286
|
|
|
3198
3287
|
.edit-site-sidebar-navigation-screen-patterns__group {
|
|
3199
3288
|
margin-bottom: 32px;
|
|
3200
|
-
padding-bottom: 24px;
|
|
3201
|
-
border-bottom: 1px solid #2f2f2f;
|
|
3202
3289
|
}
|
|
3203
3290
|
.edit-site-sidebar-navigation-screen-patterns__group:last-of-type, .edit-site-sidebar-navigation-screen-patterns__group:first-of-type {
|
|
3204
3291
|
border-bottom: 0;
|
|
@@ -3273,6 +3360,10 @@ body.is-fullscreen-mode .edit-site .components-editor-notices__snackbar {
|
|
|
3273
3360
|
.edit-site-site-hub .edit-site-site-hub__container {
|
|
3274
3361
|
gap: 0;
|
|
3275
3362
|
}
|
|
3363
|
+
.edit-site-site-hub .edit-site-site-hub__site-title,
|
|
3364
|
+
.edit-site-site-hub .edit-site-site-hub_toggle-command-center {
|
|
3365
|
+
transition: opacity ease 0.1s;
|
|
3366
|
+
}
|
|
3276
3367
|
.edit-site-site-hub .edit-site-site-hub__site-view-link {
|
|
3277
3368
|
flex-grow: 0;
|
|
3278
3369
|
}
|
|
@@ -3472,6 +3563,14 @@ body.is-fullscreen-mode .edit-site .components-editor-notices__snackbar {
|
|
|
3472
3563
|
.edit-site-resizable-frame__inner {
|
|
3473
3564
|
position: relative;
|
|
3474
3565
|
}
|
|
3566
|
+
body:has(.edit-site-resizable-frame__inner.edit-site-layout__resizable-frame-oversized) .edit-site-site-hub .edit-site-site-hub__site-title,
|
|
3567
|
+
body:has(.edit-site-resizable-frame__inner.edit-site-layout__resizable-frame-oversized) .edit-site-site-hub .edit-site-site-hub_toggle-command-center {
|
|
3568
|
+
opacity: 0 !important;
|
|
3569
|
+
}
|
|
3570
|
+
body:has(.edit-site-resizable-frame__inner.edit-site-layout__resizable-frame-oversized) .edit-site-site-hub .edit-site-site-hub__view-mode-toggle-container {
|
|
3571
|
+
background-color: transparent;
|
|
3572
|
+
}
|
|
3573
|
+
|
|
3475
3574
|
body:has(.edit-site-resizable-frame__inner.is-resizing) {
|
|
3476
3575
|
cursor: col-resize;
|
|
3477
3576
|
user-select: none;
|
|
@@ -3494,11 +3593,13 @@ body:has(.edit-site-resizable-frame__inner.is-resizing) {
|
|
|
3494
3593
|
.edit-site-resizable-frame__handle {
|
|
3495
3594
|
align-items: center;
|
|
3496
3595
|
background-color: rgba(117, 117, 117, 0.4);
|
|
3596
|
+
border: 0;
|
|
3497
3597
|
border-radius: 4px;
|
|
3498
3598
|
cursor: col-resize;
|
|
3499
3599
|
display: flex;
|
|
3500
3600
|
height: 64px;
|
|
3501
3601
|
justify-content: flex-end;
|
|
3602
|
+
padding: 0;
|
|
3502
3603
|
position: absolute;
|
|
3503
3604
|
top: calc(50% - 32px);
|
|
3504
3605
|
width: 4px;
|
|
@@ -3518,15 +3619,11 @@ body:has(.edit-site-resizable-frame__inner.is-resizing) {
|
|
|
3518
3619
|
left: 100%;
|
|
3519
3620
|
width: 32px;
|
|
3520
3621
|
}
|
|
3521
|
-
.edit-site-resizable-frame__handle:
|
|
3522
|
-
|
|
3622
|
+
.edit-site-resizable-frame__handle:focus-visible {
|
|
3623
|
+
outline: 2px solid transparent;
|
|
3523
3624
|
}
|
|
3524
|
-
.edit-site-resizable-frame__handle .edit-site-resizable-frame__handle-
|
|
3525
|
-
background: var(--wp-admin-theme-color);
|
|
3526
|
-
border-radius: 2px;
|
|
3527
|
-
color: #fff;
|
|
3528
|
-
margin-left: 8px;
|
|
3529
|
-
padding: 4px 8px;
|
|
3625
|
+
.edit-site-resizable-frame__handle:hover, .edit-site-resizable-frame__handle:focus, .edit-site-resizable-frame__handle.is-resizing {
|
|
3626
|
+
background-color: var(--wp-admin-theme-color);
|
|
3530
3627
|
}
|
|
3531
3628
|
|
|
3532
3629
|
.edit-site-push-changes-to-global-styles-control .components-button {
|
|
@@ -3534,59 +3631,54 @@ body:has(.edit-site-resizable-frame__inner.is-resizing) {
|
|
|
3534
3631
|
width: 100%;
|
|
3535
3632
|
}
|
|
3536
3633
|
|
|
3537
|
-
|
|
3634
|
+
body.js #wpadminbar {
|
|
3538
3635
|
display: none;
|
|
3539
3636
|
}
|
|
3540
3637
|
|
|
3541
|
-
|
|
3542
|
-
padding-top: 0;
|
|
3543
|
-
}
|
|
3544
|
-
|
|
3545
|
-
html.wp-toolbar {
|
|
3546
|
-
background: #fff;
|
|
3638
|
+
body.js #wpbody {
|
|
3547
3639
|
padding-top: 0;
|
|
3548
3640
|
}
|
|
3549
3641
|
|
|
3550
|
-
body.appearance_page_gutenberg-template-parts,
|
|
3551
|
-
body.site-editor-php {
|
|
3642
|
+
body.js.appearance_page_gutenberg-template-parts,
|
|
3643
|
+
body.js.site-editor-php {
|
|
3552
3644
|
background: #fff;
|
|
3553
3645
|
/* We hide legacy notices in Gutenberg Based Pages, because they were not designed in a way that scaled well.
|
|
3554
3646
|
Plugins can use Gutenberg notices if they need to pass on information to the user when they are editing. */
|
|
3555
3647
|
}
|
|
3556
|
-
body.appearance_page_gutenberg-template-parts #wpcontent,
|
|
3557
|
-
body.site-editor-php #wpcontent {
|
|
3648
|
+
body.js.appearance_page_gutenberg-template-parts #wpcontent,
|
|
3649
|
+
body.js.site-editor-php #wpcontent {
|
|
3558
3650
|
padding-right: 0;
|
|
3559
3651
|
}
|
|
3560
|
-
body.appearance_page_gutenberg-template-parts #wpbody-content,
|
|
3561
|
-
body.site-editor-php #wpbody-content {
|
|
3652
|
+
body.js.appearance_page_gutenberg-template-parts #wpbody-content,
|
|
3653
|
+
body.js.site-editor-php #wpbody-content {
|
|
3562
3654
|
padding-bottom: 0;
|
|
3563
3655
|
}
|
|
3564
|
-
body.appearance_page_gutenberg-template-parts #wpbody-content > div:not(.edit-site):not(#screen-meta),
|
|
3565
|
-
body.site-editor-php #wpbody-content > div:not(.edit-site):not(#screen-meta) {
|
|
3656
|
+
body.js.appearance_page_gutenberg-template-parts #wpbody-content > div:not(.edit-site):not(#screen-meta),
|
|
3657
|
+
body.js.site-editor-php #wpbody-content > div:not(.edit-site):not(#screen-meta) {
|
|
3566
3658
|
display: none;
|
|
3567
3659
|
}
|
|
3568
|
-
body.appearance_page_gutenberg-template-parts #wpfooter,
|
|
3569
|
-
body.site-editor-php #wpfooter {
|
|
3660
|
+
body.js.appearance_page_gutenberg-template-parts #wpfooter,
|
|
3661
|
+
body.js.site-editor-php #wpfooter {
|
|
3570
3662
|
display: none;
|
|
3571
3663
|
}
|
|
3572
|
-
body.appearance_page_gutenberg-template-parts .a11y-speak-region,
|
|
3573
|
-
body.site-editor-php .a11y-speak-region {
|
|
3664
|
+
body.js.appearance_page_gutenberg-template-parts .a11y-speak-region,
|
|
3665
|
+
body.js.site-editor-php .a11y-speak-region {
|
|
3574
3666
|
right: -1px;
|
|
3575
3667
|
top: -1px;
|
|
3576
3668
|
}
|
|
3577
|
-
body.appearance_page_gutenberg-template-parts ul#adminmenu a.wp-has-current-submenu::after,
|
|
3578
|
-
body.appearance_page_gutenberg-template-parts ul#adminmenu > li.current > a.current::after,
|
|
3579
|
-
body.site-editor-php ul#adminmenu a.wp-has-current-submenu::after,
|
|
3580
|
-
body.site-editor-php ul#adminmenu > li.current > a.current::after {
|
|
3669
|
+
body.js.appearance_page_gutenberg-template-parts ul#adminmenu a.wp-has-current-submenu::after,
|
|
3670
|
+
body.js.appearance_page_gutenberg-template-parts ul#adminmenu > li.current > a.current::after,
|
|
3671
|
+
body.js.site-editor-php ul#adminmenu a.wp-has-current-submenu::after,
|
|
3672
|
+
body.js.site-editor-php ul#adminmenu > li.current > a.current::after {
|
|
3581
3673
|
border-left-color: #fff;
|
|
3582
3674
|
}
|
|
3583
|
-
body.appearance_page_gutenberg-template-parts .media-frame select.attachment-filters:last-of-type,
|
|
3584
|
-
body.site-editor-php .media-frame select.attachment-filters:last-of-type {
|
|
3675
|
+
body.js.appearance_page_gutenberg-template-parts .media-frame select.attachment-filters:last-of-type,
|
|
3676
|
+
body.js.site-editor-php .media-frame select.attachment-filters:last-of-type {
|
|
3585
3677
|
width: auto;
|
|
3586
3678
|
max-width: 100%;
|
|
3587
3679
|
}
|
|
3588
3680
|
|
|
3589
|
-
body.site-editor-php {
|
|
3681
|
+
body.js.site-editor-php {
|
|
3590
3682
|
background: #1e1e1e;
|
|
3591
3683
|
}
|
|
3592
3684
|
|
|
@@ -3616,6 +3708,10 @@ body.site-editor-php {
|
|
|
3616
3708
|
top: 0;
|
|
3617
3709
|
}
|
|
3618
3710
|
}
|
|
3711
|
+
.no-js .edit-site {
|
|
3712
|
+
min-height: 0;
|
|
3713
|
+
position: static;
|
|
3714
|
+
}
|
|
3619
3715
|
.edit-site .interface-interface-skeleton {
|
|
3620
3716
|
top: 0;
|
|
3621
3717
|
}
|