@wordpress/edit-site 6.31.1-next.233ccab9b.0 → 6.32.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +2 -0
- package/build/components/add-new-post/index.js +1 -1
- package/build/components/add-new-post/index.js.map +1 -1
- package/build/components/add-new-template/index.js +1 -1
- package/build/components/add-new-template/index.js.map +1 -1
- package/build/components/editor/index.js +1 -1
- package/build/components/editor/index.js.map +1 -1
- package/build/components/post-edit/index.js +7 -2
- package/build/components/post-edit/index.js.map +1 -1
- package/build-module/components/add-new-post/index.js +1 -1
- package/build-module/components/add-new-post/index.js.map +1 -1
- package/build-module/components/add-new-template/index.js +1 -1
- package/build-module/components/add-new-template/index.js.map +1 -1
- package/build-module/components/editor/index.js +1 -1
- package/build-module/components/editor/index.js.map +1 -1
- package/build-module/components/post-edit/index.js +7 -2
- package/build-module/components/post-edit/index.js.map +1 -1
- package/package.json +41 -41
- package/src/components/add-new-post/index.js +2 -1
- package/src/components/add-new-template/index.js +2 -1
- package/src/components/editor/index.js +1 -1
- package/src/components/post-edit/index.js +7 -2
package/CHANGELOG.md
CHANGED
|
@@ -54,7 +54,7 @@ function AddNewPostModal({
|
|
|
54
54
|
onSave(newPage);
|
|
55
55
|
createSuccessNotice((0, _i18n.sprintf)(
|
|
56
56
|
// translators: %s: Title of the created post or template, e.g: "Hello world".
|
|
57
|
-
(0, _i18n.__)('"%s" successfully created.'), (0, _htmlEntities.decodeEntities)(newPage.title?.rendered || title)), {
|
|
57
|
+
(0, _i18n.__)('"%s" successfully created.'), (0, _htmlEntities.decodeEntities)(newPage.title?.rendered || title) || (0, _i18n.__)('(no title)')), {
|
|
58
58
|
type: 'snackbar'
|
|
59
59
|
});
|
|
60
60
|
} catch (error) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_components","require","_i18n","_data","_element","_coreData","_notices","_htmlEntities","_blocks","_jsxRuntime","AddNewPostModal","postType","onSave","onClose","labels","useSelect","select","coreStore","getPostType","isCreatingPost","setIsCreatingPost","useState","title","setTitle","saveEntityRecord","useDispatch","createErrorNotice","createSuccessNotice","noticesStore","resolveSelect","useRegistry","createPost","event","preventDefault","postTypeObject","newPage","status","slug","undefined","content","template","length","serialize","synchronizeBlocksWithTemplate","throwOnError","sprintf","__","decodeEntities","rendered","type","error","errorMessage","message","code","jsx","Modal","singular_name","onRequestClose","focusOnMount","size","children","onSubmit","jsxs","__experimentalVStack","spacing","TextControl","__next40pxDefaultSize","__nextHasNoMarginBottom","label","onChange","placeholder","value","__experimentalHStack","justify","Button","variant","onClick","isBusy"],"sources":["@wordpress/edit-site/src/components/add-new-post/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tButton,\n\tModal,\n\t__experimentalHStack as HStack,\n\t__experimentalVStack as VStack,\n\tTextControl,\n} from '@wordpress/components';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { useDispatch, useRegistry, useSelect } from '@wordpress/data';\nimport { useState } from '@wordpress/element';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { serialize, synchronizeBlocksWithTemplate } from '@wordpress/blocks';\n\nexport default function AddNewPostModal( { postType, onSave, onClose } ) {\n\tconst labels = useSelect(\n\t\t( select ) => select( coreStore ).getPostType( postType )?.labels,\n\t\t[ postType ]\n\t);\n\tconst [ isCreatingPost, setIsCreatingPost ] = useState( false );\n\tconst [ title, setTitle ] = useState( '' );\n\n\tconst { saveEntityRecord } = useDispatch( coreStore );\n\tconst { createErrorNotice, createSuccessNotice } =\n\t\tuseDispatch( noticesStore );\n\tconst { resolveSelect } = useRegistry();\n\n\tasync function createPost( event ) {\n\t\tevent.preventDefault();\n\n\t\tif ( isCreatingPost ) {\n\t\t\treturn;\n\t\t}\n\t\tsetIsCreatingPost( true );\n\t\ttry {\n\t\t\tconst postTypeObject =\n\t\t\t\tawait resolveSelect( coreStore ).getPostType( postType );\n\t\t\tconst newPage = await saveEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\tpostType,\n\t\t\t\t{\n\t\t\t\t\tstatus: 'draft',\n\t\t\t\t\ttitle,\n\t\t\t\t\tslug: title ?? undefined,\n\t\t\t\t\tcontent:\n\t\t\t\t\t\t!! postTypeObject.template &&\n\t\t\t\t\t\tpostTypeObject.template.length\n\t\t\t\t\t\t\t? serialize(\n\t\t\t\t\t\t\t\t\tsynchronizeBlocksWithTemplate(\n\t\t\t\t\t\t\t\t\t\t[],\n\t\t\t\t\t\t\t\t\t\tpostTypeObject.template\n\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t )\n\t\t\t\t\t\t\t: undefined,\n\t\t\t\t},\n\t\t\t\t{ throwOnError: true }\n\t\t\t);\n\n\t\t\tonSave( newPage );\n\n\t\t\tcreateSuccessNotice(\n\t\t\t\tsprintf(\n\t\t\t\t\t// translators: %s: Title of the created post or template, e.g: \"Hello world\".\n\t\t\t\t\t__( '\"%s\" successfully created.' ),\n\t\t\t\t\tdecodeEntities( newPage.title?.rendered || title )\n\t\t\t\t),\n\t\t\t\t{ type: '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 creating the item.' );\n\n\t\t\tcreateErrorNotice( errorMessage, {\n\t\t\t\ttype: 'snackbar',\n\t\t\t} );\n\t\t} finally {\n\t\t\tsetIsCreatingPost( false );\n\t\t}\n\t}\n\n\treturn (\n\t\t<Modal\n\t\t\ttitle={\n\t\t\t\t// translators: %s: post type singular_name label e.g: \"Page\".\n\t\t\t\tsprintf( __( 'Draft new: %s' ), labels?.singular_name )\n\t\t\t}\n\t\t\tonRequestClose={ onClose }\n\t\t\tfocusOnMount=\"firstContentElement\"\n\t\t\tsize=\"small\"\n\t\t>\n\t\t\t<form onSubmit={ createPost }>\n\t\t\t\t<VStack spacing={ 4 }>\n\t\t\t\t\t<TextControl\n\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\tlabel={ __( 'Title' ) }\n\t\t\t\t\t\tonChange={ setTitle }\n\t\t\t\t\t\tplaceholder={ __( 'No title' ) }\n\t\t\t\t\t\tvalue={ title }\n\t\t\t\t\t/>\n\t\t\t\t\t<HStack spacing={ 2 } justify=\"end\">\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t\t\tonClick={ onClose }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Cancel' ) }\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\t\ttype=\"submit\"\n\t\t\t\t\t\t\tisBusy={ isCreatingPost }\n\t\t\t\t\t\t\taria-disabled={ isCreatingPost }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Create draft' ) }\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t</HStack>\n\t\t\t\t</VStack>\n\t\t\t</form>\n\t\t</Modal>\n\t);\n}\n"],"mappings":";;;;;;AAGA,IAAAA,WAAA,GAAAC,OAAA;AAOA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AACA,IAAAI,SAAA,GAAAJ,OAAA;AACA,IAAAK,QAAA,GAAAL,OAAA;AACA,IAAAM,aAAA,GAAAN,OAAA;AACA,IAAAO,OAAA,GAAAP,OAAA;AAA6E,IAAAQ,WAAA,GAAAR,OAAA;AAhB7E;AACA;AACA;;AAgBe,SAASS,eAAeA,CAAE;EAAEC,QAAQ;EAAEC,MAAM;EAAEC;AAAQ,CAAC,EAAG;EAC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AAEuB,OAAQ,CAAC;MAEjBR,mBAAmB,CAClB,IAAAkB,aAAO;MACN;MACA,IAAAC,QAAE,EAAE,4BAA6B,CAAC,EAClC,IAAAC,4BAAc,EAAEZ,OAAO,CAACb,KAAK,EAAE0B,QAAQ,IAAI1B,KAAM,
|
|
1
|
+
{"version":3,"names":["_components","require","_i18n","_data","_element","_coreData","_notices","_htmlEntities","_blocks","_jsxRuntime","AddNewPostModal","postType","onSave","onClose","labels","useSelect","select","coreStore","getPostType","isCreatingPost","setIsCreatingPost","useState","title","setTitle","saveEntityRecord","useDispatch","createErrorNotice","createSuccessNotice","noticesStore","resolveSelect","useRegistry","createPost","event","preventDefault","postTypeObject","newPage","status","slug","undefined","content","template","length","serialize","synchronizeBlocksWithTemplate","throwOnError","sprintf","__","decodeEntities","rendered","type","error","errorMessage","message","code","jsx","Modal","singular_name","onRequestClose","focusOnMount","size","children","onSubmit","jsxs","__experimentalVStack","spacing","TextControl","__next40pxDefaultSize","__nextHasNoMarginBottom","label","onChange","placeholder","value","__experimentalHStack","justify","Button","variant","onClick","isBusy"],"sources":["@wordpress/edit-site/src/components/add-new-post/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tButton,\n\tModal,\n\t__experimentalHStack as HStack,\n\t__experimentalVStack as VStack,\n\tTextControl,\n} from '@wordpress/components';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { useDispatch, useRegistry, useSelect } from '@wordpress/data';\nimport { useState } from '@wordpress/element';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { serialize, synchronizeBlocksWithTemplate } from '@wordpress/blocks';\n\nexport default function AddNewPostModal( { postType, onSave, onClose } ) {\n\tconst labels = useSelect(\n\t\t( select ) => select( coreStore ).getPostType( postType )?.labels,\n\t\t[ postType ]\n\t);\n\tconst [ isCreatingPost, setIsCreatingPost ] = useState( false );\n\tconst [ title, setTitle ] = useState( '' );\n\n\tconst { saveEntityRecord } = useDispatch( coreStore );\n\tconst { createErrorNotice, createSuccessNotice } =\n\t\tuseDispatch( noticesStore );\n\tconst { resolveSelect } = useRegistry();\n\n\tasync function createPost( event ) {\n\t\tevent.preventDefault();\n\n\t\tif ( isCreatingPost ) {\n\t\t\treturn;\n\t\t}\n\t\tsetIsCreatingPost( true );\n\t\ttry {\n\t\t\tconst postTypeObject =\n\t\t\t\tawait resolveSelect( coreStore ).getPostType( postType );\n\t\t\tconst newPage = await saveEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\tpostType,\n\t\t\t\t{\n\t\t\t\t\tstatus: 'draft',\n\t\t\t\t\ttitle,\n\t\t\t\t\tslug: title ?? undefined,\n\t\t\t\t\tcontent:\n\t\t\t\t\t\t!! postTypeObject.template &&\n\t\t\t\t\t\tpostTypeObject.template.length\n\t\t\t\t\t\t\t? serialize(\n\t\t\t\t\t\t\t\t\tsynchronizeBlocksWithTemplate(\n\t\t\t\t\t\t\t\t\t\t[],\n\t\t\t\t\t\t\t\t\t\tpostTypeObject.template\n\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t )\n\t\t\t\t\t\t\t: undefined,\n\t\t\t\t},\n\t\t\t\t{ throwOnError: true }\n\t\t\t);\n\n\t\t\tonSave( newPage );\n\n\t\t\tcreateSuccessNotice(\n\t\t\t\tsprintf(\n\t\t\t\t\t// translators: %s: Title of the created post or template, e.g: \"Hello world\".\n\t\t\t\t\t__( '\"%s\" successfully created.' ),\n\t\t\t\t\tdecodeEntities( newPage.title?.rendered || title ) ||\n\t\t\t\t\t\t__( '(no title)' )\n\t\t\t\t),\n\t\t\t\t{ type: '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 creating the item.' );\n\n\t\t\tcreateErrorNotice( errorMessage, {\n\t\t\t\ttype: 'snackbar',\n\t\t\t} );\n\t\t} finally {\n\t\t\tsetIsCreatingPost( false );\n\t\t}\n\t}\n\n\treturn (\n\t\t<Modal\n\t\t\ttitle={\n\t\t\t\t// translators: %s: post type singular_name label e.g: \"Page\".\n\t\t\t\tsprintf( __( 'Draft new: %s' ), labels?.singular_name )\n\t\t\t}\n\t\t\tonRequestClose={ onClose }\n\t\t\tfocusOnMount=\"firstContentElement\"\n\t\t\tsize=\"small\"\n\t\t>\n\t\t\t<form onSubmit={ createPost }>\n\t\t\t\t<VStack spacing={ 4 }>\n\t\t\t\t\t<TextControl\n\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\tlabel={ __( 'Title' ) }\n\t\t\t\t\t\tonChange={ setTitle }\n\t\t\t\t\t\tplaceholder={ __( 'No title' ) }\n\t\t\t\t\t\tvalue={ title }\n\t\t\t\t\t/>\n\t\t\t\t\t<HStack spacing={ 2 } justify=\"end\">\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t\t\tonClick={ onClose }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Cancel' ) }\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\t\ttype=\"submit\"\n\t\t\t\t\t\t\tisBusy={ isCreatingPost }\n\t\t\t\t\t\t\taria-disabled={ isCreatingPost }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Create draft' ) }\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t</HStack>\n\t\t\t\t</VStack>\n\t\t\t</form>\n\t\t</Modal>\n\t);\n}\n"],"mappings":";;;;;;AAGA,IAAAA,WAAA,GAAAC,OAAA;AAOA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,G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UAAY;MAAA6B,QAAA,eAC5B,IAAAnD,WAAA,CAAAqD,IAAA,EAAC9D,WAAA,CAAA+D,oBAAM;QAACC,OAAO,EAAG,CAAG;QAAAJ,QAAA,gBACpB,IAAAnD,WAAA,CAAA6C,GAAA,EAACtD,WAAA,CAAAiE,WAAW;UACXC,qBAAqB;UACrBC,uBAAuB;UACvBC,KAAK,EAAG,IAAAtB,QAAE,EAAE,OAAQ,CAAG;UACvBuB,QAAQ,EAAG9C,QAAU;UACrB+C,WAAW,EAAG,IAAAxB,QAAE,EAAE,UAAW,CAAG;UAChCyB,KAAK,EAAGjD;QAAO,CACf,CAAC,eACF,IAAAb,WAAA,CAAAqD,IAAA,EAAC9D,WAAA,CAAAwE,oBAAM;UAACR,OAAO,EAAG,CAAG;UAACS,OAAO,EAAC,KAAK;UAAAb,QAAA,gBAClC,IAAAnD,WAAA,CAAA6C,GAAA,EAACtD,WAAA,CAAA0E,MAAM;YACNR,qBAAqB;YACrBS,OAAO,EAAC,UAAU;YAClBC,OAAO,EAAG/D,OAAS;YAAA+C,QAAA,EAEjB,IAAAd,QAAE,EAAE,QAAS;UAAC,CACT,CAAC,eACT,IAAArC,WAAA,CAAA6C,GAAA,EAACtD,WAAA,CAAA0E,MAAM;YACNR,qBAAqB;YACrBS,OAAO,EAAC,SAAS;YACjB1B,IAAI,EAAC,QAAQ;YACb4B,MAAM,EAAG1D,cAAgB;YACzB,iBAAgBA,cAAgB;YAAAyC,QAAA,EAE9B,IAAAd,QAAE,EAAE,cAAe;UAAC,CACf,CAAC;QAAA,CACF,CAAC;MAAA,CACF;IAAC,CACJ;EAAC,CACD,CAAC;AAEV","ignoreList":[]}
|
|
@@ -170,7 +170,7 @@ function NewTemplateModal({
|
|
|
170
170
|
history.navigate(`/${_constants.TEMPLATE_POST_TYPE}/${newTemplate.id}?canvas=edit`);
|
|
171
171
|
createSuccessNotice((0, _i18n.sprintf)(
|
|
172
172
|
// translators: %s: Title of the created post or template, e.g: "Hello world".
|
|
173
|
-
(0, _i18n.__)('"%s" successfully created.'), (0, _htmlEntities.decodeEntities)(newTemplate.title?.rendered || title)), {
|
|
173
|
+
(0, _i18n.__)('"%s" successfully created.'), (0, _htmlEntities.decodeEntities)(newTemplate.title?.rendered || title) || (0, _i18n.__)('(no title)')), {
|
|
174
174
|
type: 'snackbar'
|
|
175
175
|
});
|
|
176
176
|
} catch (error) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_clsx","_interopRequireDefault","require","_components","_htmlEntities","_element","_data","_coreData","_compose","_icons","_i18n","_notices","_router","_dom","_constants","_addCustomTemplateModalContent","_utils","_addCustomGenericTemplateModalContent","_lockUnlock","_jsxRuntime","useHistory","unlock","routerPrivateApis","DEFAULT_TEMPLATE_SLUGS","TEMPLATE_ICONS","home","verse","single","pin","page","archive","search","notFound","index","list","category","author","commentAuthorAvatar","taxonomy","blockMeta","date","calendar","tag","attachment","media","TemplateListItem","title","direction","className","description","icon","onClick","children","jsx","Button","__next40pxDefaultSize","label","showTooltip","jsxs","Flex","as","spacing","align","justify","style","width","Icon","__experimentalVStack","alignment","__experimentalText","weight","lineHeight","modalContentMap","templatesList","customTemplate","customGenericTemplate","NewTemplateModal","onClose","modalContent","setModalContent","useState","entityForSuggestions","setEntityForSuggestions","isSubmitting","setIsSubmitting","missingTemplates","useMissingTemplates","history","saveEntityRecord","useDispatch","coreStore","createErrorNotice","createSuccessNotice","noticesStore","containerRef","useRef","isMobile","useViewportMatch","homeUrl","useSelect","select","getEntityRecord","TEMPLATE_SHORT_DESCRIPTIONS","sprintf","__","Date","getFullYear","useEffect","current","firstFocusable","focus","focusable","find","createTemplate","template","isWPSuggestion","slug","newTemplate","TEMPLATE_POST_TYPE","toString","status","is_wp_suggestion","throwOnError","navigate","id","decodeEntities","rendered","type","error","errorMessage","message","code","onModalClose","modalTitle","labels","singular_name","Modal","clsx","onRequestClose","overlayClassName","undefined","ref","__experimentalGrid","columns","gap","map","layout","edit","default","onSelect","onBack","NewTemplate","showModal","setShowModal","postType","getPostType","Fragment","variant","add_new_item","defaultTemplateTypes","useDefaultTemplateTypes","missingDefaultTemplates","filter","includes","onClickMenuItem","_entityForSuggestions","enhancedMissingDefaultTemplateTypes","defaultTaxonomiesMenuItems","taxonomiesMenuItems","useTaxonomiesMenuItems","defaultPostTypesMenuItems","postTypesMenuItems","usePostTypeMenuItems","authorMenuItem","useAuthorMenuItem","forEach","menuItem","matchIndex","findIndex","push","sort","template1","template2","indexOf","usePostTypeArchiveMenuItems","_default","exports","memo"],"sources":["@wordpress/edit-site/src/components/add-new-template/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tButton,\n\tModal,\n\t__experimentalGrid as Grid,\n\t__experimentalText as Text,\n\t__experimentalVStack as VStack,\n\tFlex,\n\tIcon,\n} from '@wordpress/components';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { useState, memo, useRef, useEffect } from '@wordpress/element';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useViewportMatch } from '@wordpress/compose';\nimport {\n\tarchive,\n\tblockMeta,\n\tcalendar,\n\tcategory,\n\tcommentAuthorAvatar,\n\tedit,\n\thome,\n\tlayout,\n\tlist,\n\tmedia,\n\tnotFound,\n\tpage,\n\tpin,\n\tverse,\n\tsearch,\n\ttag,\n} from '@wordpress/icons';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\nimport { focus } from '@wordpress/dom';\n\n/**\n * Internal dependencies\n */\nimport { TEMPLATE_POST_TYPE } from '../../utils/constants';\n\n/**\n * Internal dependencies\n */\nimport AddCustomTemplateModalContent from './add-custom-template-modal-content';\nimport {\n\tuseDefaultTemplateTypes,\n\tuseTaxonomiesMenuItems,\n\tusePostTypeMenuItems,\n\tuseAuthorMenuItem,\n\tusePostTypeArchiveMenuItems,\n} from './utils';\nimport AddCustomGenericTemplateModalContent from './add-custom-generic-template-modal-content';\nimport { unlock } from '../../lock-unlock';\n\nconst { useHistory } = unlock( routerPrivateApis );\n\nconst DEFAULT_TEMPLATE_SLUGS = [\n\t'front-page',\n\t'home',\n\t'single',\n\t'page',\n\t'index',\n\t'archive',\n\t'author',\n\t'category',\n\t'date',\n\t'tag',\n\t'search',\n\t'404',\n];\n\nconst TEMPLATE_ICONS = {\n\t'front-page': home,\n\thome: verse,\n\tsingle: pin,\n\tpage,\n\tarchive,\n\tsearch,\n\t404: notFound,\n\tindex: list,\n\tcategory,\n\tauthor: commentAuthorAvatar,\n\ttaxonomy: blockMeta,\n\tdate: calendar,\n\ttag,\n\tattachment: media,\n};\n\nfunction TemplateListItem( {\n\ttitle,\n\tdirection,\n\tclassName,\n\tdescription,\n\ticon,\n\tonClick,\n\tchildren,\n} ) {\n\treturn (\n\t\t<Button\n\t\t\t__next40pxDefaultSize\n\t\t\tclassName={ className }\n\t\t\tonClick={ onClick }\n\t\t\tlabel={ description }\n\t\t\tshowTooltip={ !! description }\n\t\t>\n\t\t\t<Flex\n\t\t\t\tas=\"span\"\n\t\t\t\tspacing={ 2 }\n\t\t\t\talign=\"center\"\n\t\t\t\tjustify=\"center\"\n\t\t\t\tstyle={ { width: '100%' } }\n\t\t\t\tdirection={ direction }\n\t\t\t>\n\t\t\t\t<div className=\"edit-site-add-new-template__template-icon\">\n\t\t\t\t\t<Icon icon={ icon } />\n\t\t\t\t</div>\n\t\t\t\t<VStack\n\t\t\t\t\tclassName=\"edit-site-add-new-template__template-name\"\n\t\t\t\t\talignment=\"center\"\n\t\t\t\t\tspacing={ 0 }\n\t\t\t\t>\n\t\t\t\t\t<Text\n\t\t\t\t\t\talign=\"center\"\n\t\t\t\t\t\tweight={ 500 }\n\t\t\t\t\t\tlineHeight={ 1.53846153846 } // 20px\n\t\t\t\t\t>\n\t\t\t\t\t\t{ title }\n\t\t\t\t\t</Text>\n\t\t\t\t\t{ children }\n\t\t\t\t</VStack>\n\t\t\t</Flex>\n\t\t</Button>\n\t);\n}\n\nconst modalContentMap = {\n\ttemplatesList: 1,\n\tcustomTemplate: 2,\n\tcustomGenericTemplate: 3,\n};\n\nfunction NewTemplateModal( { onClose } ) {\n\tconst [ modalContent, setModalContent ] = useState(\n\t\tmodalContentMap.templatesList\n\t);\n\tconst [ entityForSuggestions, setEntityForSuggestions ] = useState( {} );\n\tconst [ isSubmitting, setIsSubmitting ] = useState( false );\n\tconst missingTemplates = useMissingTemplates( setEntityForSuggestions, () =>\n\t\tsetModalContent( modalContentMap.customTemplate )\n\t);\n\tconst history = useHistory();\n\tconst { saveEntityRecord } = useDispatch( coreStore );\n\tconst { createErrorNotice, createSuccessNotice } =\n\t\tuseDispatch( noticesStore );\n\tconst containerRef = useRef( null );\n\tconst isMobile = useViewportMatch( 'medium', '<' );\n\n\tconst homeUrl = useSelect( ( select ) => {\n\t\t// Site index.\n\t\treturn select( coreStore ).getEntityRecord( 'root', '__unstableBase' )\n\t\t\t?.home;\n\t}, [] );\n\n\tconst TEMPLATE_SHORT_DESCRIPTIONS = {\n\t\t'front-page': homeUrl,\n\t\tdate: sprintf(\n\t\t\t// translators: %s: The homepage url.\n\t\t\t__( 'E.g. %s' ),\n\t\t\thomeUrl + '/' + new Date().getFullYear()\n\t\t),\n\t};\n\n\tuseEffect( () => {\n\t\t// Focus the first focusable element when component mounts or UI changes\n\t\t// We don't want to focus on the other modals because they have their own focus management.\n\t\tif (\n\t\t\tcontainerRef.current &&\n\t\t\tmodalContent === modalContentMap.templatesList\n\t\t) {\n\t\t\tconst [ firstFocusable ] = focus.focusable.find(\n\t\t\t\tcontainerRef.current\n\t\t\t);\n\t\t\tfirstFocusable?.focus();\n\t\t}\n\t}, [ modalContent ] );\n\n\tasync function createTemplate( template, isWPSuggestion = true ) {\n\t\tif ( isSubmitting ) {\n\t\t\treturn;\n\t\t}\n\t\tsetIsSubmitting( true );\n\t\ttry {\n\t\t\tconst { title, description, slug } = template;\n\t\t\tconst newTemplate = await saveEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\tTEMPLATE_POST_TYPE,\n\t\t\t\t{\n\t\t\t\t\tdescription,\n\t\t\t\t\t// Slugs need to be strings, so this is for template `404`\n\t\t\t\t\tslug: slug.toString(),\n\t\t\t\t\tstatus: 'publish',\n\t\t\t\t\ttitle,\n\t\t\t\t\t// This adds a post meta field in template that is part of `is_custom` value calculation.\n\t\t\t\t\tis_wp_suggestion: isWPSuggestion,\n\t\t\t\t},\n\t\t\t\t{ throwOnError: true }\n\t\t\t);\n\n\t\t\t// Navigate to the created template editor.\n\t\t\thistory.navigate(\n\t\t\t\t`/${ TEMPLATE_POST_TYPE }/${ newTemplate.id }?canvas=edit`\n\t\t\t);\n\n\t\t\tcreateSuccessNotice(\n\t\t\t\tsprintf(\n\t\t\t\t\t// translators: %s: Title of the created post or template, e.g: \"Hello world\".\n\t\t\t\t\t__( '\"%s\" successfully created.' ),\n\t\t\t\t\tdecodeEntities( newTemplate.title?.rendered || title )\n\t\t\t\t),\n\t\t\t\t{\n\t\t\t\t\ttype: 'snackbar',\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 creating the template.' );\n\n\t\t\tcreateErrorNotice( errorMessage, {\n\t\t\t\ttype: 'snackbar',\n\t\t\t} );\n\t\t} finally {\n\t\t\tsetIsSubmitting( false );\n\t\t}\n\t}\n\tconst onModalClose = () => {\n\t\tonClose();\n\t\tsetModalContent( modalContentMap.templatesList );\n\t};\n\n\tlet modalTitle = __( 'Add template' );\n\tif ( modalContent === modalContentMap.customTemplate ) {\n\t\tmodalTitle = sprintf(\n\t\t\t// translators: %s: Name of the post type e.g: \"Post\".\n\t\t\t__( 'Add template: %s' ),\n\t\t\tentityForSuggestions.labels.singular_name\n\t\t);\n\t} else if ( modalContent === modalContentMap.customGenericTemplate ) {\n\t\tmodalTitle = __( 'Create custom template' );\n\t}\n\n\treturn (\n\t\t<Modal\n\t\t\ttitle={ modalTitle }\n\t\t\tclassName={ clsx( 'edit-site-add-new-template__modal', {\n\t\t\t\t'edit-site-add-new-template__modal_template_list':\n\t\t\t\t\tmodalContent === modalContentMap.templatesList,\n\t\t\t\t'edit-site-custom-template-modal':\n\t\t\t\t\tmodalContent === modalContentMap.customTemplate,\n\t\t\t} ) }\n\t\t\tonRequestClose={ onModalClose }\n\t\t\toverlayClassName={\n\t\t\t\tmodalContent === modalContentMap.customGenericTemplate\n\t\t\t\t\t? 'edit-site-custom-generic-template__modal'\n\t\t\t\t\t: undefined\n\t\t\t}\n\t\t\tref={ containerRef }\n\t\t>\n\t\t\t{ modalContent === modalContentMap.templatesList && (\n\t\t\t\t<Grid\n\t\t\t\t\tcolumns={ isMobile ? 2 : 3 }\n\t\t\t\t\tgap={ 4 }\n\t\t\t\t\talign=\"flex-start\"\n\t\t\t\t\tjustify=\"center\"\n\t\t\t\t\tclassName=\"edit-site-add-new-template__template-list__contents\"\n\t\t\t\t>\n\t\t\t\t\t<Flex className=\"edit-site-add-new-template__template-list__prompt\">\n\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t'Select what the new template should apply to:'\n\t\t\t\t\t\t) }\n\t\t\t\t\t</Flex>\n\t\t\t\t\t{ missingTemplates.map( ( template ) => {\n\t\t\t\t\t\tconst { title, slug, onClick } = template;\n\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t<TemplateListItem\n\t\t\t\t\t\t\t\tkey={ slug }\n\t\t\t\t\t\t\t\ttitle={ title }\n\t\t\t\t\t\t\t\tdirection=\"column\"\n\t\t\t\t\t\t\t\tclassName=\"edit-site-add-new-template__template-button\"\n\t\t\t\t\t\t\t\tdescription={\n\t\t\t\t\t\t\t\t\tTEMPLATE_SHORT_DESCRIPTIONS[ slug ]\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\ticon={ TEMPLATE_ICONS[ slug ] || layout }\n\t\t\t\t\t\t\t\tonClick={ () =>\n\t\t\t\t\t\t\t\t\tonClick\n\t\t\t\t\t\t\t\t\t\t? onClick( template )\n\t\t\t\t\t\t\t\t\t\t: createTemplate( template )\n\t\t\t\t\t\t\t\t}\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<TemplateListItem\n\t\t\t\t\t\ttitle={ __( 'Custom template' ) }\n\t\t\t\t\t\tdirection=\"row\"\n\t\t\t\t\t\tclassName=\"edit-site-add-new-template__custom-template-button\"\n\t\t\t\t\t\ticon={ edit }\n\t\t\t\t\t\tonClick={ () =>\n\t\t\t\t\t\t\tsetModalContent(\n\t\t\t\t\t\t\t\tmodalContentMap.customGenericTemplate\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\t<Text\n\t\t\t\t\t\t\tlineHeight={ 1.53846153846 } // 20px\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t'A custom template can be manually applied to any post or page.'\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</Text>\n\t\t\t\t\t</TemplateListItem>\n\t\t\t\t</Grid>\n\t\t\t) }\n\t\t\t{ modalContent === modalContentMap.customTemplate && (\n\t\t\t\t<AddCustomTemplateModalContent\n\t\t\t\t\tonSelect={ createTemplate }\n\t\t\t\t\tentityForSuggestions={ entityForSuggestions }\n\t\t\t\t\tonBack={ () =>\n\t\t\t\t\t\tsetModalContent( modalContentMap.templatesList )\n\t\t\t\t\t}\n\t\t\t\t\tcontainerRef={ containerRef }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ modalContent === modalContentMap.customGenericTemplate && (\n\t\t\t\t<AddCustomGenericTemplateModalContent\n\t\t\t\t\tcreateTemplate={ createTemplate }\n\t\t\t\t\tonBack={ () =>\n\t\t\t\t\t\tsetModalContent( modalContentMap.templatesList )\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t) }\n\t\t</Modal>\n\t);\n}\n\nfunction NewTemplate() {\n\tconst [ showModal, setShowModal ] = useState( false );\n\n\tconst { postType } = useSelect( ( select ) => {\n\t\tconst { getPostType } = select( coreStore );\n\n\t\treturn {\n\t\t\tpostType: getPostType( TEMPLATE_POST_TYPE ),\n\t\t};\n\t}, [] );\n\n\tif ( ! postType ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<Button\n\t\t\t\tvariant=\"primary\"\n\t\t\t\tonClick={ () => setShowModal( true ) }\n\t\t\t\tlabel={ postType.labels.add_new_item }\n\t\t\t\t__next40pxDefaultSize\n\t\t\t>\n\t\t\t\t{ postType.labels.add_new_item }\n\t\t\t</Button>\n\t\t\t{ showModal && (\n\t\t\t\t<NewTemplateModal onClose={ () => setShowModal( false ) } />\n\t\t\t) }\n\t\t</>\n\t);\n}\n\nfunction useMissingTemplates( setEntityForSuggestions, onClick ) {\n\tconst defaultTemplateTypes = useDefaultTemplateTypes();\n\tconst missingDefaultTemplates = ( defaultTemplateTypes || [] ).filter(\n\t\t( template ) => DEFAULT_TEMPLATE_SLUGS.includes( template.slug )\n\t);\n\tconst onClickMenuItem = ( _entityForSuggestions ) => {\n\t\tonClick?.();\n\t\tsetEntityForSuggestions( _entityForSuggestions );\n\t};\n\t// We need to replace existing default template types with\n\t// the create specific template functionality. The original\n\t// info (title, description, etc.) is preserved in the\n\t// used hooks.\n\tconst enhancedMissingDefaultTemplateTypes = [ ...missingDefaultTemplates ];\n\tconst { defaultTaxonomiesMenuItems, taxonomiesMenuItems } =\n\t\tuseTaxonomiesMenuItems( onClickMenuItem );\n\tconst { defaultPostTypesMenuItems, postTypesMenuItems } =\n\t\tusePostTypeMenuItems( onClickMenuItem );\n\n\tconst authorMenuItem = useAuthorMenuItem( onClickMenuItem );\n\t[\n\t\t...defaultTaxonomiesMenuItems,\n\t\t...defaultPostTypesMenuItems,\n\t\tauthorMenuItem,\n\t].forEach( ( menuItem ) => {\n\t\tif ( ! menuItem ) {\n\t\t\treturn;\n\t\t}\n\t\tconst matchIndex = enhancedMissingDefaultTemplateTypes.findIndex(\n\t\t\t( template ) => template.slug === menuItem.slug\n\t\t);\n\t\t// Some default template types might have been filtered above from\n\t\t// `missingDefaultTemplates` because they only check for the general\n\t\t// template. So here we either replace or append the item, augmented\n\t\t// with the check if it has available specific item to create a\n\t\t// template for.\n\t\tif ( matchIndex > -1 ) {\n\t\t\tenhancedMissingDefaultTemplateTypes[ matchIndex ] = menuItem;\n\t\t} else {\n\t\t\tenhancedMissingDefaultTemplateTypes.push( menuItem );\n\t\t}\n\t} );\n\t// Update the sort order to match the DEFAULT_TEMPLATE_SLUGS order.\n\tenhancedMissingDefaultTemplateTypes?.sort( ( template1, template2 ) => {\n\t\treturn (\n\t\t\tDEFAULT_TEMPLATE_SLUGS.indexOf( template1.slug ) -\n\t\t\tDEFAULT_TEMPLATE_SLUGS.indexOf( template2.slug )\n\t\t);\n\t} );\n\tconst missingTemplates = [\n\t\t...enhancedMissingDefaultTemplateTypes,\n\t\t...usePostTypeArchiveMenuItems(),\n\t\t...postTypesMenuItems,\n\t\t...taxonomiesMenuItems,\n\t];\n\treturn missingTemplates;\n}\n\nexport default memo( NewTemplate );\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,WAAA,GAAAD,OAAA;AASA,IAAAE,aAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AACA,IAAAI,KAAA,GAAAJ,OAAA;AACA,IAAAK,SAAA,GAAAL,OAAA;AACA,IAAAM,QAAA,GAAAN,OAAA;AACA,IAAAO,MAAA,GAAAP,OAAA;AAkBA,IAAAQ,KAAA,GAAAR,OAAA;AACA,IAAAS,QAAA,GAAAT,OAAA;AACA,IAAAU,OAAA,GAAAV,OAAA;AACA,IAAAW,IAAA,GAAAX,OAAA;AAKA,IAAAY,UAAA,GAA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EAAEC,SAAS,KAAM;IACtE,OACC/J,sBAAsB,CAACgK,OAAO,CAAEF,SAAS,CAACjE,IAAK,CAAC,GAChD7F,sBAAsB,CAACgK,OAAO,CAAED,SAAS,CAAClE,IAAK,CAAC;EAElD,CAAE,CAAC;EACH,MAAM/B,gBAAgB,GAAG,CACxB,GAAGiF,mCAAmC,EACtC,GAAG,IAAAkB,kCAA2B,EAAC,CAAC,EAChC,GAAGb,kBAAkB,EACrB,GAAGH,mBAAmB,CACtB;EACD,OAAOnF,gBAAgB;AACxB;AAAC,IAAAoG,QAAA,GAAAC,OAAA,CAAAtC,OAAA,GAEc,IAAAuC,aAAI,EAAEpC,WAAY,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_clsx","_interopRequireDefault","require","_components","_htmlEntities","_element","_data","_coreData","_compose","_icons","_i18n","_notices","_router","_dom","_constants","_addCustomTemplateModalContent","_utils","_addCustomGenericTemplateModalContent","_lockUnlock","_jsxRuntime","useHistory","unlock","routerPrivateApis","DEFAULT_TEMPLATE_SLUGS","TEMPLATE_ICONS","home","verse","single","pin","page","archive","search","notFound","index","list","category","author","commentAuthorAvatar","taxonomy","blockMeta","date","calendar","tag","attachment","media","TemplateListItem","title","direction","className","description","icon","onClick","children","jsx","Button","__next40pxDefaultSize","label","showTooltip","jsxs","Flex","as","spacing","align","justify","style","width","Icon","__experimentalVStack","alignment","__experimentalText","weight","lineHeight","modalContentMap","templatesList","customTemplate","customGenericTemplate","NewTemplateModal","onClose","modalContent","setModalContent","useState","entityForSuggestions","setEntityForSuggestions","isSubmitting","setIsSubmitting","missingTemplates","useMissingTemplates","history","saveEntityRecord","useDispatch","coreStore","createErrorNotice","createSuccessNotice","noticesStore","containerRef","useRef","isMobile","useViewportMatch","homeUrl","useSelect","select","getEntityRecord","TEMPLATE_SHORT_DESCRIPTIONS","sprintf","__","Date","getFullYear","useEffect","current","firstFocusable","focus","focusable","find","createTemplate","template","isWPSuggestion","slug","newTemplate","TEMPLATE_POST_TYPE","toString","status","is_wp_suggestion","throwOnError","navigate","id","decodeEntities","rendered","type","error","errorMessage","message","code","onModalClose","modalTitle","labels","singular_name","Modal","clsx","onRequestClose","overlayClassName","undefined","ref","__experimentalGrid","columns","gap","map","layout","edit","default","onSelect","onBack","NewTemplate","showModal","setShowModal","postType","getPostType","Fragment","variant","add_new_item","defaultTemplateTypes","useDefaultTemplateTypes","missingDefaultTemplates","filter","includes","onClickMenuItem","_entityForSuggestions","enhancedMissingDefaultTemplateTypes","defaultTaxonomiesMenuItems","taxonomiesMenuItems","useTaxonomiesMenuItems","defaultPostTypesMenuItems","postTypesMenuItems","usePostTypeMenuItems","authorMenuItem","useAuthorMenuItem","forEach","menuItem","matchIndex","findIndex","push","sort","template1","template2","indexOf","usePostTypeArchiveMenuItems","_default","exports","memo"],"sources":["@wordpress/edit-site/src/components/add-new-template/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tButton,\n\tModal,\n\t__experimentalGrid as Grid,\n\t__experimentalText as Text,\n\t__experimentalVStack as VStack,\n\tFlex,\n\tIcon,\n} from '@wordpress/components';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { useState, memo, useRef, useEffect } from '@wordpress/element';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useViewportMatch } from '@wordpress/compose';\nimport {\n\tarchive,\n\tblockMeta,\n\tcalendar,\n\tcategory,\n\tcommentAuthorAvatar,\n\tedit,\n\thome,\n\tlayout,\n\tlist,\n\tmedia,\n\tnotFound,\n\tpage,\n\tpin,\n\tverse,\n\tsearch,\n\ttag,\n} from '@wordpress/icons';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\nimport { focus } from '@wordpress/dom';\n\n/**\n * Internal dependencies\n */\nimport { TEMPLATE_POST_TYPE } from '../../utils/constants';\n\n/**\n * Internal dependencies\n */\nimport AddCustomTemplateModalContent from './add-custom-template-modal-content';\nimport {\n\tuseDefaultTemplateTypes,\n\tuseTaxonomiesMenuItems,\n\tusePostTypeMenuItems,\n\tuseAuthorMenuItem,\n\tusePostTypeArchiveMenuItems,\n} from './utils';\nimport AddCustomGenericTemplateModalContent from './add-custom-generic-template-modal-content';\nimport { unlock } from '../../lock-unlock';\n\nconst { useHistory } = unlock( routerPrivateApis );\n\nconst DEFAULT_TEMPLATE_SLUGS = [\n\t'front-page',\n\t'home',\n\t'single',\n\t'page',\n\t'index',\n\t'archive',\n\t'author',\n\t'category',\n\t'date',\n\t'tag',\n\t'search',\n\t'404',\n];\n\nconst TEMPLATE_ICONS = {\n\t'front-page': home,\n\thome: verse,\n\tsingle: pin,\n\tpage,\n\tarchive,\n\tsearch,\n\t404: notFound,\n\tindex: list,\n\tcategory,\n\tauthor: commentAuthorAvatar,\n\ttaxonomy: blockMeta,\n\tdate: calendar,\n\ttag,\n\tattachment: media,\n};\n\nfunction TemplateListItem( {\n\ttitle,\n\tdirection,\n\tclassName,\n\tdescription,\n\ticon,\n\tonClick,\n\tchildren,\n} ) {\n\treturn (\n\t\t<Button\n\t\t\t__next40pxDefaultSize\n\t\t\tclassName={ className }\n\t\t\tonClick={ onClick }\n\t\t\tlabel={ description }\n\t\t\tshowTooltip={ !! description }\n\t\t>\n\t\t\t<Flex\n\t\t\t\tas=\"span\"\n\t\t\t\tspacing={ 2 }\n\t\t\t\talign=\"center\"\n\t\t\t\tjustify=\"center\"\n\t\t\t\tstyle={ { width: '100%' } }\n\t\t\t\tdirection={ direction }\n\t\t\t>\n\t\t\t\t<div className=\"edit-site-add-new-template__template-icon\">\n\t\t\t\t\t<Icon icon={ icon } />\n\t\t\t\t</div>\n\t\t\t\t<VStack\n\t\t\t\t\tclassName=\"edit-site-add-new-template__template-name\"\n\t\t\t\t\talignment=\"center\"\n\t\t\t\t\tspacing={ 0 }\n\t\t\t\t>\n\t\t\t\t\t<Text\n\t\t\t\t\t\talign=\"center\"\n\t\t\t\t\t\tweight={ 500 }\n\t\t\t\t\t\tlineHeight={ 1.53846153846 } // 20px\n\t\t\t\t\t>\n\t\t\t\t\t\t{ title }\n\t\t\t\t\t</Text>\n\t\t\t\t\t{ children }\n\t\t\t\t</VStack>\n\t\t\t</Flex>\n\t\t</Button>\n\t);\n}\n\nconst modalContentMap = {\n\ttemplatesList: 1,\n\tcustomTemplate: 2,\n\tcustomGenericTemplate: 3,\n};\n\nfunction NewTemplateModal( { onClose } ) {\n\tconst [ modalContent, setModalContent ] = useState(\n\t\tmodalContentMap.templatesList\n\t);\n\tconst [ entityForSuggestions, setEntityForSuggestions ] = useState( {} );\n\tconst [ isSubmitting, setIsSubmitting ] = useState( false );\n\tconst missingTemplates = useMissingTemplates( setEntityForSuggestions, () =>\n\t\tsetModalContent( modalContentMap.customTemplate )\n\t);\n\tconst history = useHistory();\n\tconst { saveEntityRecord } = useDispatch( coreStore );\n\tconst { createErrorNotice, createSuccessNotice } =\n\t\tuseDispatch( noticesStore );\n\tconst containerRef = useRef( null );\n\tconst isMobile = useViewportMatch( 'medium', '<' );\n\n\tconst homeUrl = useSelect( ( select ) => {\n\t\t// Site index.\n\t\treturn select( coreStore ).getEntityRecord( 'root', '__unstableBase' )\n\t\t\t?.home;\n\t}, [] );\n\n\tconst TEMPLATE_SHORT_DESCRIPTIONS = {\n\t\t'front-page': homeUrl,\n\t\tdate: sprintf(\n\t\t\t// translators: %s: The homepage url.\n\t\t\t__( 'E.g. %s' ),\n\t\t\thomeUrl + '/' + new Date().getFullYear()\n\t\t),\n\t};\n\n\tuseEffect( () => {\n\t\t// Focus the first focusable element when component mounts or UI changes\n\t\t// We don't want to focus on the other modals because they have their own focus management.\n\t\tif (\n\t\t\tcontainerRef.current &&\n\t\t\tmodalContent === modalContentMap.templatesList\n\t\t) {\n\t\t\tconst [ firstFocusable ] = focus.focusable.find(\n\t\t\t\tcontainerRef.current\n\t\t\t);\n\t\t\tfirstFocusable?.focus();\n\t\t}\n\t}, [ modalContent ] );\n\n\tasync function createTemplate( template, isWPSuggestion = true ) {\n\t\tif ( isSubmitting ) {\n\t\t\treturn;\n\t\t}\n\t\tsetIsSubmitting( true );\n\t\ttry {\n\t\t\tconst { title, description, slug } = template;\n\t\t\tconst newTemplate = await saveEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\tTEMPLATE_POST_TYPE,\n\t\t\t\t{\n\t\t\t\t\tdescription,\n\t\t\t\t\t// Slugs need to be strings, so this is for template `404`\n\t\t\t\t\tslug: slug.toString(),\n\t\t\t\t\tstatus: 'publish',\n\t\t\t\t\ttitle,\n\t\t\t\t\t// This adds a post meta field in template that is part of `is_custom` value calculation.\n\t\t\t\t\tis_wp_suggestion: isWPSuggestion,\n\t\t\t\t},\n\t\t\t\t{ throwOnError: true }\n\t\t\t);\n\n\t\t\t// Navigate to the created template editor.\n\t\t\thistory.navigate(\n\t\t\t\t`/${ TEMPLATE_POST_TYPE }/${ newTemplate.id }?canvas=edit`\n\t\t\t);\n\n\t\t\tcreateSuccessNotice(\n\t\t\t\tsprintf(\n\t\t\t\t\t// translators: %s: Title of the created post or template, e.g: \"Hello world\".\n\t\t\t\t\t__( '\"%s\" successfully created.' ),\n\t\t\t\t\tdecodeEntities( newTemplate.title?.rendered || title ) ||\n\t\t\t\t\t\t__( '(no title)' )\n\t\t\t\t),\n\t\t\t\t{\n\t\t\t\t\ttype: 'snackbar',\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 creating the template.' );\n\n\t\t\tcreateErrorNotice( errorMessage, {\n\t\t\t\ttype: 'snackbar',\n\t\t\t} );\n\t\t} finally {\n\t\t\tsetIsSubmitting( false );\n\t\t}\n\t}\n\tconst onModalClose = () => {\n\t\tonClose();\n\t\tsetModalContent( modalContentMap.templatesList );\n\t};\n\n\tlet modalTitle = __( 'Add template' );\n\tif ( modalContent === modalContentMap.customTemplate ) {\n\t\tmodalTitle = sprintf(\n\t\t\t// translators: %s: Name of the post type e.g: \"Post\".\n\t\t\t__( 'Add template: %s' ),\n\t\t\tentityForSuggestions.labels.singular_name\n\t\t);\n\t} else if ( modalContent === modalContentMap.customGenericTemplate ) {\n\t\tmodalTitle = __( 'Create custom template' );\n\t}\n\n\treturn (\n\t\t<Modal\n\t\t\ttitle={ modalTitle }\n\t\t\tclassName={ clsx( 'edit-site-add-new-template__modal', {\n\t\t\t\t'edit-site-add-new-template__modal_template_list':\n\t\t\t\t\tmodalContent === modalContentMap.templatesList,\n\t\t\t\t'edit-site-custom-template-modal':\n\t\t\t\t\tmodalContent === modalContentMap.customTemplate,\n\t\t\t} ) }\n\t\t\tonRequestClose={ onModalClose }\n\t\t\toverlayClassName={\n\t\t\t\tmodalContent === modalContentMap.customGenericTemplate\n\t\t\t\t\t? 'edit-site-custom-generic-template__modal'\n\t\t\t\t\t: undefined\n\t\t\t}\n\t\t\tref={ containerRef }\n\t\t>\n\t\t\t{ modalContent === modalContentMap.templatesList && (\n\t\t\t\t<Grid\n\t\t\t\t\tcolumns={ isMobile ? 2 : 3 }\n\t\t\t\t\tgap={ 4 }\n\t\t\t\t\talign=\"flex-start\"\n\t\t\t\t\tjustify=\"center\"\n\t\t\t\t\tclassName=\"edit-site-add-new-template__template-list__contents\"\n\t\t\t\t>\n\t\t\t\t\t<Flex className=\"edit-site-add-new-template__template-list__prompt\">\n\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t'Select what the new template should apply to:'\n\t\t\t\t\t\t) }\n\t\t\t\t\t</Flex>\n\t\t\t\t\t{ missingTemplates.map( ( template ) => {\n\t\t\t\t\t\tconst { title, slug, onClick } = template;\n\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t<TemplateListItem\n\t\t\t\t\t\t\t\tkey={ slug }\n\t\t\t\t\t\t\t\ttitle={ title }\n\t\t\t\t\t\t\t\tdirection=\"column\"\n\t\t\t\t\t\t\t\tclassName=\"edit-site-add-new-template__template-button\"\n\t\t\t\t\t\t\t\tdescription={\n\t\t\t\t\t\t\t\t\tTEMPLATE_SHORT_DESCRIPTIONS[ slug ]\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\ticon={ TEMPLATE_ICONS[ slug ] || layout }\n\t\t\t\t\t\t\t\tonClick={ () =>\n\t\t\t\t\t\t\t\t\tonClick\n\t\t\t\t\t\t\t\t\t\t? onClick( template )\n\t\t\t\t\t\t\t\t\t\t: createTemplate( template )\n\t\t\t\t\t\t\t\t}\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<TemplateListItem\n\t\t\t\t\t\ttitle={ __( 'Custom template' ) }\n\t\t\t\t\t\tdirection=\"row\"\n\t\t\t\t\t\tclassName=\"edit-site-add-new-template__custom-template-button\"\n\t\t\t\t\t\ticon={ edit }\n\t\t\t\t\t\tonClick={ () =>\n\t\t\t\t\t\t\tsetModalContent(\n\t\t\t\t\t\t\t\tmodalContentMap.customGenericTemplate\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\t<Text\n\t\t\t\t\t\t\tlineHeight={ 1.53846153846 } // 20px\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t'A custom template can be manually applied to any post or page.'\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</Text>\n\t\t\t\t\t</TemplateListItem>\n\t\t\t\t</Grid>\n\t\t\t) }\n\t\t\t{ modalContent === modalContentMap.customTemplate && (\n\t\t\t\t<AddCustomTemplateModalContent\n\t\t\t\t\tonSelect={ createTemplate }\n\t\t\t\t\tentityForSuggestions={ entityForSuggestions }\n\t\t\t\t\tonBack={ () =>\n\t\t\t\t\t\tsetModalContent( modalContentMap.templatesList )\n\t\t\t\t\t}\n\t\t\t\t\tcontainerRef={ containerRef }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ modalContent === modalContentMap.customGenericTemplate && (\n\t\t\t\t<AddCustomGenericTemplateModalContent\n\t\t\t\t\tcreateTemplate={ createTemplate }\n\t\t\t\t\tonBack={ () =>\n\t\t\t\t\t\tsetModalContent( modalContentMap.templatesList )\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t) }\n\t\t</Modal>\n\t);\n}\n\nfunction NewTemplate() {\n\tconst [ showModal, setShowModal ] = useState( false );\n\n\tconst { postType } = useSelect( ( select ) => {\n\t\tconst { getPostType } = select( coreStore );\n\n\t\treturn {\n\t\t\tpostType: getPostType( TEMPLATE_POST_TYPE ),\n\t\t};\n\t}, [] );\n\n\tif ( ! postType ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<Button\n\t\t\t\tvariant=\"primary\"\n\t\t\t\tonClick={ () => setShowModal( true ) }\n\t\t\t\tlabel={ postType.labels.add_new_item }\n\t\t\t\t__next40pxDefaultSize\n\t\t\t>\n\t\t\t\t{ postType.labels.add_new_item }\n\t\t\t</Button>\n\t\t\t{ showModal && (\n\t\t\t\t<NewTemplateModal onClose={ () => setShowModal( false ) } />\n\t\t\t) }\n\t\t</>\n\t);\n}\n\nfunction useMissingTemplates( setEntityForSuggestions, onClick ) {\n\tconst defaultTemplateTypes = useDefaultTemplateTypes();\n\tconst missingDefaultTemplates = ( defaultTemplateTypes || [] ).filter(\n\t\t( template ) => DEFAULT_TEMPLATE_SLUGS.includes( template.slug )\n\t);\n\tconst onClickMenuItem = ( _entityForSuggestions ) => {\n\t\tonClick?.();\n\t\tsetEntityForSuggestions( _entityForSuggestions );\n\t};\n\t// We need to replace existing default template types with\n\t// the create specific template functionality. The original\n\t// info (title, description, etc.) is preserved in the\n\t// used hooks.\n\tconst enhancedMissingDefaultTemplateTypes = [ ...missingDefaultTemplates ];\n\tconst { defaultTaxonomiesMenuItems, taxonomiesMenuItems } =\n\t\tuseTaxonomiesMenuItems( onClickMenuItem );\n\tconst { defaultPostTypesMenuItems, postTypesMenuItems } =\n\t\tusePostTypeMenuItems( onClickMenuItem );\n\n\tconst authorMenuItem = useAuthorMenuItem( onClickMenuItem );\n\t[\n\t\t...defaultTaxonomiesMenuItems,\n\t\t...defaultPostTypesMenuItems,\n\t\tauthorMenuItem,\n\t].forEach( ( menuItem ) => {\n\t\tif ( ! menuItem ) {\n\t\t\treturn;\n\t\t}\n\t\tconst matchIndex = enhancedMissingDefaultTemplateTypes.findIndex(\n\t\t\t( template ) => template.slug === menuItem.slug\n\t\t);\n\t\t// Some default template types might have been filtered above from\n\t\t// `missingDefaultTemplates` because they only check for the general\n\t\t// template. So here we either replace or append the item, augmented\n\t\t// with the check if it has available specific item to create a\n\t\t// template for.\n\t\tif ( matchIndex > -1 ) {\n\t\t\tenhancedMissingDefaultTemplateTypes[ matchIndex ] = menuItem;\n\t\t} else {\n\t\t\tenhancedMissingDefaultTemplateTypes.push( menuItem );\n\t\t}\n\t} );\n\t// Update the sort order to match the DEFAULT_TEMPLATE_SLUGS order.\n\tenhancedMissingDefaultTemplateTypes?.sort( ( template1, template2 ) => {\n\t\treturn (\n\t\t\tDEFAULT_TEMPLATE_SLUGS.indexOf( template1.slug ) -\n\t\t\tDEFAULT_TEMPLATE_SLUGS.indexOf( template2.slug )\n\t\t);\n\t} );\n\tconst missingTemplates = [\n\t\t...enhancedMissingDefaultTemplateTypes,\n\t\t...usePostTypeArchiveMenuItems(),\n\t\t...postTypesMenuItems,\n\t\t...taxonomiesMenuItems,\n\t];\n\treturn missingTemplates;\n}\n\nexport default memo( NewTemplate );\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,WAAA,GAAAD,OAAA;AASA,IAAAE,aAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AACA,IAAAI,KAAA,GAAAJ,OAAA;AACA,IAAAK,SAAA,GAAAL,OAAA;AACA,IAAA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;IACA;IACA;IACA,IAAK6D,UAAU,GAAG,CAAC,CAAC,EAAG;MACtBX,mCAAmC,CAAEW,UAAU,CAAE,GAAGD,QAAQ;IAC7D,CAAC,MAAM;MACNV,mCAAmC,CAACa,IAAI,CAAEH,QAAS,CAAC;IACrD;EACD,CAAE,CAAC;EACH;EACAV,mCAAmC,EAAEc,IAAI,CAAE,CAAEC,SAAS,EAAEC,SAAS,KAAM;IACtE,OACC/J,sBAAsB,CAACgK,OAAO,CAAEF,SAAS,CAACjE,IAAK,CAAC,GAChD7F,sBAAsB,CAACgK,OAAO,CAAED,SAAS,CAAClE,IAAK,CAAC;EAElD,CAAE,CAAC;EACH,MAAM/B,gBAAgB,GAAG,CACxB,GAAGiF,mCAAmC,EACtC,GAAG,IAAAkB,kCAA2B,EAAC,CAAC,EAChC,GAAGb,kBAAkB,EACrB,GAAGH,mBAAmB,CACtB;EACD,OAAOnF,gBAAgB;AACxB;AAAC,IAAAoG,QAAA,GAAAC,OAAA,CAAAtC,OAAA,GAEc,IAAAuC,aAAI,EAAEpC,WAAY,CAAC","ignoreList":[]}
|
|
@@ -190,7 +190,7 @@ function EditSiteEditor({
|
|
|
190
190
|
const _title = typeof newItem.title === 'string' ? newItem.title : newItem.title?.rendered;
|
|
191
191
|
createSuccessNotice((0, _i18n.sprintf)(
|
|
192
192
|
// translators: %s: Title of the created post or template, e.g: "Hello world".
|
|
193
|
-
(0, _i18n.__)('"%s" successfully created.'), (0, _htmlEntities.decodeEntities)(_title)), {
|
|
193
|
+
(0, _i18n.__)('"%s" successfully created.'), (0, _htmlEntities.decodeEntities)(_title) || (0, _i18n.__)('(no title)')), {
|
|
194
194
|
type: 'snackbar',
|
|
195
195
|
id: 'duplicate-post-action',
|
|
196
196
|
actions: [{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_clsx","_interopRequireDefault","require","_data","_components","_compose","_editor","_i18n","_coreData","_blockLibrary","_element","_notices","_router","_htmlEntities","_icons","_blockEditor","_url","_welcomeGuide","_store","_globalStylesRenderer","_canvasLoader","_lockUnlock","_useSiteEditorSettings","_pluginTemplateSettingPanel","_globalStylesSidebar","_isPreviewingTheme2","_editorCanvasContainer","_saveButton","_savePanel","_moreMenu","_siteIcon","_useEditorIframeProps","_useEditorTitle","_hooks","_useAdaptEditorToCanvas","_constants","_useResolveEditedEntity","_sitePreview","_jsxRuntime","Editor","BackButton","unlock","editorPrivateApis","useHistory","useLocation","routerPrivateApis","BlockKeyboardShortcuts","blockLibraryPrivateApis","toggleHomeIconVariants","edit","opacity","scale","hover","clipPath","siteIconVariants","tap","getListPathForPostType","postType","getNavigationPath","location","path","name","includes","addQueryArgs","canvas","undefined","EditSiteEditor","isHomeRoute","isPostsList","disableMotion","useReducedMotion","query","isLoading","useIsSiteEditorLoading","useAdaptEditorToCanvas","entity","useResolveEditedEntity","useSyncDeprecatedEntityIntoState","postId","context","isBlockBasedTheme","editorCanvasView","currentPostIsTrashed","hasSiteIcon","useSelect","select","getEditorCanvasContainerView","editSiteStore","getCurrentTheme","getEntityRecord","coreDataStore","siteData","is_block_theme","editorStore","getCurrentPostAttribute","site_icon_url","postWithTemplate","useEditorTitle","_isPreviewingTheme","isPreviewingTheme","hasDefaultEditorCanvasView","useHasEditorCanvasContainer","iframeProps","useEditorIframeProps","isEditMode","loadingProgressId","useInstanceId","CanvasLoader","settings","useSpecificEditorSettings","styles","useMemo","css","resetZoomLevel","useDispatch","blockEditorStore","createSuccessNotice","noticesStore","history","onActionPerformed","useCallback","actionId","items","navigate","newItem","_title","title","rendered","sprintf","__","decodeEntities","type","id","actions","label","onClick","getEditorCanvasContainerTitle","isReady","transition","duration","jsx","default","jsxs","Fragment","children","GlobalStylesRenderer","disableRootPadding","TEMPLATE_POST_TYPE","EditorKeyboardShortcutsRegister","templateId","className","customSaveButton","size","customSavePanel","forceDisableBlockTools","extraSidebarPanels","Slot","length","__unstableMotion","div","animate","initial","whileHover","whileTap","Button","__next40pxDefaultSize","showTooltip","tooltipPosition","focusMode","variants","clsx","Icon","icon","arrowUpLeft"],"sources":["@wordpress/edit-site/src/components/editor/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { Button, __unstableMotion as motion } from '@wordpress/components';\nimport { useInstanceId, useReducedMotion } from '@wordpress/compose';\nimport {\n\tEditorKeyboardShortcutsRegister,\n\tprivateApis as editorPrivateApis,\n\tstore as editorStore,\n} from '@wordpress/editor';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { store as coreDataStore } from '@wordpress/core-data';\nimport { privateApis as blockLibraryPrivateApis } from '@wordpress/block-library';\nimport { useCallback, useMemo } from '@wordpress/element';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { Icon, arrowUpLeft } from '@wordpress/icons';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { addQueryArgs } from '@wordpress/url';\n\n/**\n * Internal dependencies\n */\nimport WelcomeGuide from '../welcome-guide';\nimport { store as editSiteStore } from '../../store';\nimport { GlobalStylesRenderer } from '../global-styles-renderer';\nimport CanvasLoader from '../canvas-loader';\nimport { unlock } from '../../lock-unlock';\nimport { useSpecificEditorSettings } from '../block-editor/use-site-editor-settings';\nimport PluginTemplateSettingPanel from '../plugin-template-setting-panel';\nimport GlobalStylesSidebar from '../global-styles-sidebar';\nimport { isPreviewingTheme } from '../../utils/is-previewing-theme';\nimport {\n\tgetEditorCanvasContainerTitle,\n\tuseHasEditorCanvasContainer,\n} from '../editor-canvas-container';\nimport SaveButton from '../save-button';\nimport SavePanel from '../save-panel';\nimport SiteEditorMoreMenu from '../more-menu';\nimport SiteIcon from '../site-icon';\nimport useEditorIframeProps from '../block-editor/use-editor-iframe-props';\nimport useEditorTitle from './use-editor-title';\nimport { useIsSiteEditorLoading } from '../layout/hooks';\nimport { useAdaptEditorToCanvas } from './use-adapt-editor-to-canvas';\nimport { TEMPLATE_POST_TYPE } from '../../utils/constants';\nimport {\n\tuseResolveEditedEntity,\n\tuseSyncDeprecatedEntityIntoState,\n} from './use-resolve-edited-entity';\nimport SitePreview from './site-preview';\n\nconst { Editor, BackButton } = unlock( editorPrivateApis );\nconst { useHistory, useLocation } = unlock( routerPrivateApis );\nconst { BlockKeyboardShortcuts } = unlock( blockLibraryPrivateApis );\n\nconst toggleHomeIconVariants = {\n\tedit: {\n\t\topacity: 0,\n\t\tscale: 0.2,\n\t},\n\thover: {\n\t\topacity: 1,\n\t\tscale: 1,\n\t\tclipPath: 'inset( 22% round 2px )',\n\t},\n};\n\nconst siteIconVariants = {\n\tedit: {\n\t\tclipPath: 'inset(0% round 0px)',\n\t},\n\thover: {\n\t\tclipPath: 'inset( 22% round 2px )',\n\t},\n\ttap: {\n\t\tclipPath: 'inset(0% round 0px)',\n\t},\n};\n\nfunction getListPathForPostType( postType ) {\n\tswitch ( postType ) {\n\t\tcase 'navigation':\n\t\t\treturn '/navigation';\n\t\tcase 'wp_block':\n\t\t\treturn '/pattern?postType=wp_block';\n\t\tcase 'wp_template_part':\n\t\t\treturn '/pattern?postType=wp_template_part';\n\t\tcase 'wp_template':\n\t\t\treturn '/template';\n\t\tcase 'page':\n\t\t\treturn '/page';\n\t\tcase 'post':\n\t\t\treturn '/';\n\t}\n\tthrow 'Unknown post type';\n}\n\nfunction getNavigationPath( location, postType ) {\n\tconst { path, name } = location;\n\tif (\n\t\t[\n\t\t\t'pattern-item',\n\t\t\t'template-part-item',\n\t\t\t'page-item',\n\t\t\t'template-item',\n\t\t\t'static-template-item',\n\t\t\t'post-item',\n\t\t].includes( name )\n\t) {\n\t\treturn getListPathForPostType( postType );\n\t}\n\treturn addQueryArgs( path, { canvas: undefined } );\n}\n\nexport default function EditSiteEditor( {\n\tisHomeRoute = false,\n\tisPostsList = false,\n} ) {\n\tconst disableMotion = useReducedMotion();\n\tconst location = useLocation();\n\tconst { canvas = 'view' } = location.query;\n\tconst isLoading = useIsSiteEditorLoading();\n\tuseAdaptEditorToCanvas( canvas );\n\tconst entity = useResolveEditedEntity();\n\t// deprecated sync state with url\n\tuseSyncDeprecatedEntityIntoState( entity );\n\tconst { postType, postId, context } = entity;\n\tconst {\n\t\tisBlockBasedTheme,\n\t\teditorCanvasView,\n\t\tcurrentPostIsTrashed,\n\t\thasSiteIcon,\n\t} = useSelect( ( select ) => {\n\t\tconst { getEditorCanvasContainerView } = unlock(\n\t\t\tselect( editSiteStore )\n\t\t);\n\t\tconst { getCurrentTheme, getEntityRecord } = select( coreDataStore );\n\t\tconst siteData = getEntityRecord( 'root', '__unstableBase', undefined );\n\n\t\treturn {\n\t\t\tisBlockBasedTheme: getCurrentTheme()?.is_block_theme,\n\t\t\teditorCanvasView: getEditorCanvasContainerView(),\n\t\t\tcurrentPostIsTrashed:\n\t\t\t\tselect( editorStore ).getCurrentPostAttribute( 'status' ) ===\n\t\t\t\t'trash',\n\t\t\thasSiteIcon: !! siteData?.site_icon_url,\n\t\t};\n\t}, [] );\n\tconst postWithTemplate = !! context?.postId;\n\tuseEditorTitle(\n\t\tpostWithTemplate ? context.postType : postType,\n\t\tpostWithTemplate ? context.postId : postId\n\t);\n\tconst _isPreviewingTheme = isPreviewingTheme();\n\tconst hasDefaultEditorCanvasView = ! useHasEditorCanvasContainer();\n\tconst iframeProps = useEditorIframeProps();\n\tconst isEditMode = canvas === 'edit';\n\tconst loadingProgressId = useInstanceId(\n\t\tCanvasLoader,\n\t\t'edit-site-editor__loading-progress'\n\t);\n\n\tconst settings = useSpecificEditorSettings();\n\tconst styles = useMemo(\n\t\t() => [\n\t\t\t...settings.styles,\n\t\t\t{\n\t\t\t\t// Forming a \"block formatting context\" to prevent margin collapsing.\n\t\t\t\t// @see https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Block_formatting_context\n\t\t\t\tcss:\n\t\t\t\t\tcanvas === 'view'\n\t\t\t\t\t\t? `body{min-height: 100vh; ${\n\t\t\t\t\t\t\t\tcurrentPostIsTrashed ? '' : 'cursor: pointer;'\n\t\t\t\t\t\t }}`\n\t\t\t\t\t\t: undefined,\n\t\t\t},\n\t\t],\n\t\t[ settings.styles, canvas, currentPostIsTrashed ]\n\t);\n\tconst { resetZoomLevel } = unlock( useDispatch( blockEditorStore ) );\n\tconst { createSuccessNotice } = useDispatch( noticesStore );\n\tconst history = useHistory();\n\tconst onActionPerformed = useCallback(\n\t\t( actionId, items ) => {\n\t\t\tswitch ( actionId ) {\n\t\t\t\tcase 'move-to-trash':\n\t\t\t\tcase 'delete-post':\n\t\t\t\t\t{\n\t\t\t\t\t\thistory.navigate(\n\t\t\t\t\t\t\tgetListPathForPostType(\n\t\t\t\t\t\t\t\tpostWithTemplate ? context.postType : postType\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\tbreak;\n\t\t\t\tcase 'duplicate-post':\n\t\t\t\t\t{\n\t\t\t\t\t\tconst newItem = items[ 0 ];\n\t\t\t\t\t\tconst _title =\n\t\t\t\t\t\t\ttypeof newItem.title === 'string'\n\t\t\t\t\t\t\t\t? newItem.title\n\t\t\t\t\t\t\t\t: newItem.title?.rendered;\n\t\t\t\t\t\tcreateSuccessNotice(\n\t\t\t\t\t\t\tsprintf(\n\t\t\t\t\t\t\t\t// translators: %s: Title of the created post or template, e.g: \"Hello world\".\n\t\t\t\t\t\t\t\t__( '\"%s\" successfully created.' ),\n\t\t\t\t\t\t\t\tdecodeEntities( _title )\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\t\t\t\tid: 'duplicate-post-action',\n\t\t\t\t\t\t\t\tactions: [\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tlabel: __( 'Edit' ),\n\t\t\t\t\t\t\t\t\t\tonClick: () => {\n\t\t\t\t\t\t\t\t\t\t\thistory.navigate(\n\t\t\t\t\t\t\t\t\t\t\t\t`/${ newItem.type }/${ newItem.id }?canvas=edit`\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}\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t},\n\t\t[\n\t\t\tpostType,\n\t\t\tcontext?.postType,\n\t\t\tpostWithTemplate,\n\t\t\thistory,\n\t\t\tcreateSuccessNotice,\n\t\t]\n\t);\n\n\t// Replace the title and icon displayed in the DocumentBar when there's an overlay visible.\n\tconst title = getEditorCanvasContainerTitle( editorCanvasView );\n\n\tconst isReady = ! isLoading;\n\tconst transition = {\n\t\tduration: disableMotion ? 0 : 0.2,\n\t};\n\n\treturn ! isBlockBasedTheme && isHomeRoute ? (\n\t\t<SitePreview />\n\t) : (\n\t\t<>\n\t\t\t<GlobalStylesRenderer\n\t\t\t\tdisableRootPadding={ postType !== TEMPLATE_POST_TYPE }\n\t\t\t/>\n\t\t\t<EditorKeyboardShortcutsRegister />\n\t\t\t{ isEditMode && <BlockKeyboardShortcuts /> }\n\t\t\t{ ! isReady ? <CanvasLoader id={ loadingProgressId } /> : null }\n\t\t\t{ isEditMode && (\n\t\t\t\t<WelcomeGuide\n\t\t\t\t\tpostType={ postWithTemplate ? context.postType : postType }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ isReady && (\n\t\t\t\t<Editor\n\t\t\t\t\tpostType={ postWithTemplate ? context.postType : postType }\n\t\t\t\t\tpostId={ postWithTemplate ? context.postId : postId }\n\t\t\t\t\ttemplateId={ postWithTemplate ? postId : undefined }\n\t\t\t\t\tsettings={ settings }\n\t\t\t\t\tclassName=\"edit-site-editor__editor-interface\"\n\t\t\t\t\tstyles={ styles }\n\t\t\t\t\tcustomSaveButton={\n\t\t\t\t\t\t_isPreviewingTheme && <SaveButton size=\"compact\" />\n\t\t\t\t\t}\n\t\t\t\t\tcustomSavePanel={ _isPreviewingTheme && <SavePanel /> }\n\t\t\t\t\tforceDisableBlockTools={ ! hasDefaultEditorCanvasView }\n\t\t\t\t\ttitle={ title }\n\t\t\t\t\tiframeProps={ iframeProps }\n\t\t\t\t\tonActionPerformed={ onActionPerformed }\n\t\t\t\t\textraSidebarPanels={\n\t\t\t\t\t\t! postWithTemplate && (\n\t\t\t\t\t\t\t<PluginTemplateSettingPanel.Slot />\n\t\t\t\t\t\t)\n\t\t\t\t\t}\n\t\t\t\t>\n\t\t\t\t\t{ isEditMode && (\n\t\t\t\t\t\t<BackButton>\n\t\t\t\t\t\t\t{ ( { length } ) =>\n\t\t\t\t\t\t\t\tlength <= 1 && (\n\t\t\t\t\t\t\t\t\t<motion.div\n\t\t\t\t\t\t\t\t\t\tclassName=\"edit-site-editor__view-mode-toggle\"\n\t\t\t\t\t\t\t\t\t\ttransition={ transition }\n\t\t\t\t\t\t\t\t\t\tanimate=\"edit\"\n\t\t\t\t\t\t\t\t\t\tinitial=\"edit\"\n\t\t\t\t\t\t\t\t\t\twhileHover=\"hover\"\n\t\t\t\t\t\t\t\t\t\twhileTap=\"tap\"\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\t\t\t\t\tlabel={ __( 'Open Navigation' ) }\n\t\t\t\t\t\t\t\t\t\t\tshowTooltip\n\t\t\t\t\t\t\t\t\t\t\ttooltipPosition=\"middle right\"\n\t\t\t\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\t\t\t\tresetZoomLevel();\n\n\t\t\t\t\t\t\t\t\t\t\t\t// TODO: this is a temporary solution to navigate to the posts list if we are\n\t\t\t\t\t\t\t\t\t\t\t\t// come here through `posts list` and are in focus mode editing a template, template part etc..\n\t\t\t\t\t\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\t\t\t\t\t\tisPostsList &&\n\t\t\t\t\t\t\t\t\t\t\t\t\tlocation.query?.focusMode\n\t\t\t\t\t\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\t\t\t\t\t\thistory.navigate( '/', {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\ttransition:\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'canvas-mode-view-transition',\n\t\t\t\t\t\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\t\t\t\thistory.navigate(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tgetNavigationPath(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tlocation,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tpostWithTemplate\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t? context.postType\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t: postType\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\ttransition:\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'canvas-mode-view-transition',\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t\t\t}\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\t\t<motion.div\n\t\t\t\t\t\t\t\t\t\t\t\tvariants={ siteIconVariants }\n\t\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t\t<SiteIcon className=\"edit-site-editor__view-mode-toggle-icon\" />\n\t\t\t\t\t\t\t\t\t\t\t</motion.div>\n\t\t\t\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t\t\t\t\t<motion.div\n\t\t\t\t\t\t\t\t\t\t\tclassName={ clsx(\n\t\t\t\t\t\t\t\t\t\t\t\t'edit-site-editor__back-icon',\n\t\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\t\t'has-site-icon':\n\t\t\t\t\t\t\t\t\t\t\t\t\t\thasSiteIcon,\n\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t\tvariants={ toggleHomeIconVariants }\n\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t<Icon icon={ arrowUpLeft } />\n\t\t\t\t\t\t\t\t\t\t</motion.div>\n\t\t\t\t\t\t\t\t\t</motion.div>\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t</BackButton>\n\t\t\t\t\t) }\n\t\t\t\t\t<SiteEditorMoreMenu />\n\t\t\t\t\t{ isBlockBasedTheme && <GlobalStylesSidebar /> }\n\t\t\t\t</Editor>\n\t\t\t) }\n\t\t</>\n\t);\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AACA,IAAAI,OAAA,GAAAJ,OAAA;AAKA,IAAAK,KAAA,GAAAL,OAAA;AACA,IAAAM,SAAA,GAAAN,OAAA;AACA,IAAAO,aAAA,GAAAP,OAAA;AACA,IAAAQ,QAAA,GAAAR,OAAA;AACA,IAAAS,QAAA,GAAAT,OAAA;AACA,IAAAU,OAAA,GAAAV,OAAA;AACA,IAAAW,aAAA,GAAAX,OAAA;AACA,IAAAY,MAAA,GAAAZ,OAAA;AACA,IAAAa,YAAA,GAAAb,OAAA;AACA,IAAAc,IAAA,GAAAd,OAAA;AAKA,IAAAe,aAAA,GAAAhB,sBAAA,CAAAC,OAAA;AACA,IAAAgB,MAAA,GAAAhB,OA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T,SAAS,EAAG,IAAAoB,aAAI,EACf,6BAA6B,EAC7B;cACC,eAAe,EACdvF;YACF,CACD,CAAG;YACHsF,QAAQ,EAAGzH,sBAAwB;YAAAgG,QAAA,eAEnC,IAAA1G,WAAA,CAAAsG,GAAA,EAAC9H,MAAA,CAAA6J,IAAI;cAACC,IAAI,EAAGC;YAAa,CAAE;UAAC,CAClB,CAAC;QAAA,CACF;MACZ,CAES,CACZ,eACD,IAAAvI,WAAA,CAAAsG,GAAA,EAAC/G,SAAA,CAAAgH,OAAkB,IAAE,CAAC,EACpB7D,iBAAiB,iBAAI,IAAA1C,WAAA,CAAAsG,GAAA,EAACpH,oBAAA,CAAAqH,OAAmB,IAAE,CAAC;IAAA,CACvC,CACR;EAAA,CACA,CACF;AACF","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_clsx","_interopRequireDefault","require","_data","_components","_compose","_editor","_i18n","_coreData","_blockLibrary","_element","_notices","_router","_htmlEntities","_icons","_blockEditor","_url","_welcomeGuide","_store","_globalStylesRenderer","_canvasLoader","_lockUnlock","_useSiteEditorSettings","_pluginTemplateSettingPanel","_globalStylesSidebar","_isPreviewingTheme2","_editorCanvasContainer","_saveButton","_savePanel","_moreMenu","_siteIcon","_useEditorIframeProps","_useEditorTitle","_hooks","_useAdaptEditorToCanvas","_constants","_useResolveEditedEntity","_sitePreview","_jsxRuntime","Editor","BackButton","unlock","editorPrivateApis","useHistory","useLocation","routerPrivateApis","BlockKeyboardShortcuts","blockLibraryPrivateApis","toggleHomeIconVariants","edit","opacity","scale","hover","clipPath","siteIconVariants","tap","getListPathForPostType","postType","getNavigationPath","location","path","name","includes","addQueryArgs","canvas","undefined","EditSiteEditor","isHomeRoute","isPostsList","disableMotion","useReducedMotion","query","isLoading","useIsSiteEditorLoading","useAdaptEditorToCanvas","entity","useResolveEditedEntity","useSyncDeprecatedEntityIntoState","postId","context","isBlockBasedTheme","editorCanvasView","currentPostIsTrashed","hasSiteIcon","useSelect","select","getEditorCanvasContainerView","editSiteStore","getCurrentTheme","getEntityRecord","coreDataStore","siteData","is_block_theme","editorStore","getCurrentPostAttribute","site_icon_url","postWithTemplate","useEditorTitle","_isPreviewingTheme","isPreviewingTheme","hasDefaultEditorCanvasView","useHasEditorCanvasContainer","iframeProps","useEditorIframeProps","isEditMode","loadingProgressId","useInstanceId","CanvasLoader","settings","useSpecificEditorSettings","styles","useMemo","css","resetZoomLevel","useDispatch","blockEditorStore","createSuccessNotice","noticesStore","history","onActionPerformed","useCallback","actionId","items","navigate","newItem","_title","title","rendered","sprintf","__","decodeEntities","type","id","actions","label","onClick","getEditorCanvasContainerTitle","isReady","transition","duration","jsx","default","jsxs","Fragment","children","GlobalStylesRenderer","disableRootPadding","TEMPLATE_POST_TYPE","EditorKeyboardShortcutsRegister","templateId","className","customSaveButton","size","customSavePanel","forceDisableBlockTools","extraSidebarPanels","Slot","length","__unstableMotion","div","animate","initial","whileHover","whileTap","Button","__next40pxDefaultSize","showTooltip","tooltipPosition","focusMode","variants","clsx","Icon","icon","arrowUpLeft"],"sources":["@wordpress/edit-site/src/components/editor/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { Button, __unstableMotion as motion } from '@wordpress/components';\nimport { useInstanceId, useReducedMotion } from '@wordpress/compose';\nimport {\n\tEditorKeyboardShortcutsRegister,\n\tprivateApis as editorPrivateApis,\n\tstore as editorStore,\n} from '@wordpress/editor';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { store as coreDataStore } from '@wordpress/core-data';\nimport { privateApis as blockLibraryPrivateApis } from '@wordpress/block-library';\nimport { useCallback, useMemo } from '@wordpress/element';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { Icon, arrowUpLeft } from '@wordpress/icons';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { addQueryArgs } from '@wordpress/url';\n\n/**\n * Internal dependencies\n */\nimport WelcomeGuide from '../welcome-guide';\nimport { store as editSiteStore } from '../../store';\nimport { GlobalStylesRenderer } from '../global-styles-renderer';\nimport CanvasLoader from '../canvas-loader';\nimport { unlock } from '../../lock-unlock';\nimport { useSpecificEditorSettings } from '../block-editor/use-site-editor-settings';\nimport PluginTemplateSettingPanel from '../plugin-template-setting-panel';\nimport GlobalStylesSidebar from '../global-styles-sidebar';\nimport { isPreviewingTheme } from '../../utils/is-previewing-theme';\nimport {\n\tgetEditorCanvasContainerTitle,\n\tuseHasEditorCanvasContainer,\n} from '../editor-canvas-container';\nimport SaveButton from '../save-button';\nimport SavePanel from '../save-panel';\nimport SiteEditorMoreMenu from '../more-menu';\nimport SiteIcon from '../site-icon';\nimport useEditorIframeProps from '../block-editor/use-editor-iframe-props';\nimport useEditorTitle from './use-editor-title';\nimport { useIsSiteEditorLoading } from '../layout/hooks';\nimport { useAdaptEditorToCanvas } from './use-adapt-editor-to-canvas';\nimport { TEMPLATE_POST_TYPE } from '../../utils/constants';\nimport {\n\tuseResolveEditedEntity,\n\tuseSyncDeprecatedEntityIntoState,\n} from './use-resolve-edited-entity';\nimport SitePreview from './site-preview';\n\nconst { Editor, BackButton } = unlock( editorPrivateApis );\nconst { useHistory, useLocation } = unlock( routerPrivateApis );\nconst { BlockKeyboardShortcuts } = unlock( blockLibraryPrivateApis );\n\nconst toggleHomeIconVariants = {\n\tedit: {\n\t\topacity: 0,\n\t\tscale: 0.2,\n\t},\n\thover: {\n\t\topacity: 1,\n\t\tscale: 1,\n\t\tclipPath: 'inset( 22% round 2px )',\n\t},\n};\n\nconst siteIconVariants = {\n\tedit: {\n\t\tclipPath: 'inset(0% round 0px)',\n\t},\n\thover: {\n\t\tclipPath: 'inset( 22% round 2px )',\n\t},\n\ttap: {\n\t\tclipPath: 'inset(0% round 0px)',\n\t},\n};\n\nfunction getListPathForPostType( postType ) {\n\tswitch ( postType ) {\n\t\tcase 'navigation':\n\t\t\treturn '/navigation';\n\t\tcase 'wp_block':\n\t\t\treturn '/pattern?postType=wp_block';\n\t\tcase 'wp_template_part':\n\t\t\treturn '/pattern?postType=wp_template_part';\n\t\tcase 'wp_template':\n\t\t\treturn '/template';\n\t\tcase 'page':\n\t\t\treturn '/page';\n\t\tcase 'post':\n\t\t\treturn '/';\n\t}\n\tthrow 'Unknown post type';\n}\n\nfunction getNavigationPath( location, postType ) {\n\tconst { path, name } = location;\n\tif (\n\t\t[\n\t\t\t'pattern-item',\n\t\t\t'template-part-item',\n\t\t\t'page-item',\n\t\t\t'template-item',\n\t\t\t'static-template-item',\n\t\t\t'post-item',\n\t\t].includes( name )\n\t) {\n\t\treturn getListPathForPostType( postType );\n\t}\n\treturn addQueryArgs( path, { canvas: undefined } );\n}\n\nexport default function EditSiteEditor( {\n\tisHomeRoute = false,\n\tisPostsList = false,\n} ) {\n\tconst disableMotion = useReducedMotion();\n\tconst location = useLocation();\n\tconst { canvas = 'view' } = location.query;\n\tconst isLoading = useIsSiteEditorLoading();\n\tuseAdaptEditorToCanvas( canvas );\n\tconst entity = useResolveEditedEntity();\n\t// deprecated sync state with url\n\tuseSyncDeprecatedEntityIntoState( entity );\n\tconst { postType, postId, context } = entity;\n\tconst {\n\t\tisBlockBasedTheme,\n\t\teditorCanvasView,\n\t\tcurrentPostIsTrashed,\n\t\thasSiteIcon,\n\t} = useSelect( ( select ) => {\n\t\tconst { getEditorCanvasContainerView } = unlock(\n\t\t\tselect( editSiteStore )\n\t\t);\n\t\tconst { getCurrentTheme, getEntityRecord } = select( coreDataStore );\n\t\tconst siteData = getEntityRecord( 'root', '__unstableBase', undefined );\n\n\t\treturn {\n\t\t\tisBlockBasedTheme: getCurrentTheme()?.is_block_theme,\n\t\t\teditorCanvasView: getEditorCanvasContainerView(),\n\t\t\tcurrentPostIsTrashed:\n\t\t\t\tselect( editorStore ).getCurrentPostAttribute( 'status' ) ===\n\t\t\t\t'trash',\n\t\t\thasSiteIcon: !! siteData?.site_icon_url,\n\t\t};\n\t}, [] );\n\tconst postWithTemplate = !! context?.postId;\n\tuseEditorTitle(\n\t\tpostWithTemplate ? context.postType : postType,\n\t\tpostWithTemplate ? context.postId : postId\n\t);\n\tconst _isPreviewingTheme = isPreviewingTheme();\n\tconst hasDefaultEditorCanvasView = ! useHasEditorCanvasContainer();\n\tconst iframeProps = useEditorIframeProps();\n\tconst isEditMode = canvas === 'edit';\n\tconst loadingProgressId = useInstanceId(\n\t\tCanvasLoader,\n\t\t'edit-site-editor__loading-progress'\n\t);\n\n\tconst settings = useSpecificEditorSettings();\n\tconst styles = useMemo(\n\t\t() => [\n\t\t\t...settings.styles,\n\t\t\t{\n\t\t\t\t// Forming a \"block formatting context\" to prevent margin collapsing.\n\t\t\t\t// @see https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Block_formatting_context\n\t\t\t\tcss:\n\t\t\t\t\tcanvas === 'view'\n\t\t\t\t\t\t? `body{min-height: 100vh; ${\n\t\t\t\t\t\t\t\tcurrentPostIsTrashed ? '' : 'cursor: pointer;'\n\t\t\t\t\t\t }}`\n\t\t\t\t\t\t: undefined,\n\t\t\t},\n\t\t],\n\t\t[ settings.styles, canvas, currentPostIsTrashed ]\n\t);\n\tconst { resetZoomLevel } = unlock( useDispatch( blockEditorStore ) );\n\tconst { createSuccessNotice } = useDispatch( noticesStore );\n\tconst history = useHistory();\n\tconst onActionPerformed = useCallback(\n\t\t( actionId, items ) => {\n\t\t\tswitch ( actionId ) {\n\t\t\t\tcase 'move-to-trash':\n\t\t\t\tcase 'delete-post':\n\t\t\t\t\t{\n\t\t\t\t\t\thistory.navigate(\n\t\t\t\t\t\t\tgetListPathForPostType(\n\t\t\t\t\t\t\t\tpostWithTemplate ? context.postType : postType\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\tbreak;\n\t\t\t\tcase 'duplicate-post':\n\t\t\t\t\t{\n\t\t\t\t\t\tconst newItem = items[ 0 ];\n\t\t\t\t\t\tconst _title =\n\t\t\t\t\t\t\ttypeof newItem.title === 'string'\n\t\t\t\t\t\t\t\t? newItem.title\n\t\t\t\t\t\t\t\t: newItem.title?.rendered;\n\t\t\t\t\t\tcreateSuccessNotice(\n\t\t\t\t\t\t\tsprintf(\n\t\t\t\t\t\t\t\t// translators: %s: Title of the created post or template, e.g: \"Hello world\".\n\t\t\t\t\t\t\t\t__( '\"%s\" successfully created.' ),\n\t\t\t\t\t\t\t\tdecodeEntities( _title ) || __( '(no title)' )\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\t\t\t\tid: 'duplicate-post-action',\n\t\t\t\t\t\t\t\tactions: [\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tlabel: __( 'Edit' ),\n\t\t\t\t\t\t\t\t\t\tonClick: () => {\n\t\t\t\t\t\t\t\t\t\t\thistory.navigate(\n\t\t\t\t\t\t\t\t\t\t\t\t`/${ newItem.type }/${ newItem.id }?canvas=edit`\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}\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t},\n\t\t[\n\t\t\tpostType,\n\t\t\tcontext?.postType,\n\t\t\tpostWithTemplate,\n\t\t\thistory,\n\t\t\tcreateSuccessNotice,\n\t\t]\n\t);\n\n\t// Replace the title and icon displayed in the DocumentBar when there's an overlay visible.\n\tconst title = getEditorCanvasContainerTitle( editorCanvasView );\n\n\tconst isReady = ! isLoading;\n\tconst transition = {\n\t\tduration: disableMotion ? 0 : 0.2,\n\t};\n\n\treturn ! isBlockBasedTheme && isHomeRoute ? (\n\t\t<SitePreview />\n\t) : (\n\t\t<>\n\t\t\t<GlobalStylesRenderer\n\t\t\t\tdisableRootPadding={ postType !== TEMPLATE_POST_TYPE }\n\t\t\t/>\n\t\t\t<EditorKeyboardShortcutsRegister />\n\t\t\t{ isEditMode && <BlockKeyboardShortcuts /> }\n\t\t\t{ ! isReady ? <CanvasLoader id={ loadingProgressId } /> : null }\n\t\t\t{ isEditMode && (\n\t\t\t\t<WelcomeGuide\n\t\t\t\t\tpostType={ postWithTemplate ? context.postType : postType }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ isReady && (\n\t\t\t\t<Editor\n\t\t\t\t\tpostType={ postWithTemplate ? context.postType : postType }\n\t\t\t\t\tpostId={ postWithTemplate ? context.postId : postId }\n\t\t\t\t\ttemplateId={ postWithTemplate ? postId : undefined }\n\t\t\t\t\tsettings={ settings }\n\t\t\t\t\tclassName=\"edit-site-editor__editor-interface\"\n\t\t\t\t\tstyles={ styles }\n\t\t\t\t\tcustomSaveButton={\n\t\t\t\t\t\t_isPreviewingTheme && <SaveButton size=\"compact\" />\n\t\t\t\t\t}\n\t\t\t\t\tcustomSavePanel={ _isPreviewingTheme && <SavePanel /> }\n\t\t\t\t\tforceDisableBlockTools={ ! hasDefaultEditorCanvasView }\n\t\t\t\t\ttitle={ title }\n\t\t\t\t\tiframeProps={ iframeProps }\n\t\t\t\t\tonActionPerformed={ onActionPerformed }\n\t\t\t\t\textraSidebarPanels={\n\t\t\t\t\t\t! postWithTemplate && (\n\t\t\t\t\t\t\t<PluginTemplateSettingPanel.Slot />\n\t\t\t\t\t\t)\n\t\t\t\t\t}\n\t\t\t\t>\n\t\t\t\t\t{ isEditMode && (\n\t\t\t\t\t\t<BackButton>\n\t\t\t\t\t\t\t{ ( { length } ) =>\n\t\t\t\t\t\t\t\tlength <= 1 && (\n\t\t\t\t\t\t\t\t\t<motion.div\n\t\t\t\t\t\t\t\t\t\tclassName=\"edit-site-editor__view-mode-toggle\"\n\t\t\t\t\t\t\t\t\t\ttransition={ transition }\n\t\t\t\t\t\t\t\t\t\tanimate=\"edit\"\n\t\t\t\t\t\t\t\t\t\tinitial=\"edit\"\n\t\t\t\t\t\t\t\t\t\twhileHover=\"hover\"\n\t\t\t\t\t\t\t\t\t\twhileTap=\"tap\"\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\t\t\t\t\tlabel={ __( 'Open Navigation' ) }\n\t\t\t\t\t\t\t\t\t\t\tshowTooltip\n\t\t\t\t\t\t\t\t\t\t\ttooltipPosition=\"middle right\"\n\t\t\t\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\t\t\t\tresetZoomLevel();\n\n\t\t\t\t\t\t\t\t\t\t\t\t// TODO: this is a temporary solution to navigate to the posts list if we are\n\t\t\t\t\t\t\t\t\t\t\t\t// come here through `posts list` and are in focus mode editing a template, template part etc..\n\t\t\t\t\t\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\t\t\t\t\t\tisPostsList &&\n\t\t\t\t\t\t\t\t\t\t\t\t\tlocation.query?.focusMode\n\t\t\t\t\t\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\t\t\t\t\t\thistory.navigate( '/', {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\ttransition:\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'canvas-mode-view-transition',\n\t\t\t\t\t\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\t\t\t\thistory.navigate(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tgetNavigationPath(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tlocation,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tpostWithTemplate\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t? context.postType\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t: postType\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\ttransition:\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'canvas-mode-view-transition',\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t\t\t}\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\t\t<motion.div\n\t\t\t\t\t\t\t\t\t\t\t\tvariants={ siteIconVariants }\n\t\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t\t<SiteIcon className=\"edit-site-editor__view-mode-toggle-icon\" />\n\t\t\t\t\t\t\t\t\t\t\t</motion.div>\n\t\t\t\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t\t\t\t\t<motion.div\n\t\t\t\t\t\t\t\t\t\t\tclassName={ clsx(\n\t\t\t\t\t\t\t\t\t\t\t\t'edit-site-editor__back-icon',\n\t\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\t\t'has-site-icon':\n\t\t\t\t\t\t\t\t\t\t\t\t\t\thasSiteIcon,\n\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t\tvariants={ toggleHomeIconVariants }\n\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t<Icon icon={ arrowUpLeft } />\n\t\t\t\t\t\t\t\t\t\t</motion.div>\n\t\t\t\t\t\t\t\t\t</motion.div>\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t</BackButton>\n\t\t\t\t\t) }\n\t\t\t\t\t<SiteEditorMoreMenu />\n\t\t\t\t\t{ isBlockBasedTheme && <GlobalStylesSidebar /> }\n\t\t\t\t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36
36
|
} = (0, _lockUnlock.unlock)(_editor.privateApis);
|
|
37
|
-
const fieldsWithBulkEditSupport = ['title', 'status', 'date', 'author', '
|
|
37
|
+
const fieldsWithBulkEditSupport = ['title', 'status', 'date', 'author', 'discussion'];
|
|
38
38
|
function PostEditForm({
|
|
39
39
|
postType,
|
|
40
40
|
postId
|
|
@@ -85,7 +85,12 @@ function PostEditForm({
|
|
|
85
85
|
id: 'status',
|
|
86
86
|
label: (0, _i18n.__)('Status & Visibility'),
|
|
87
87
|
children: ['status', 'password']
|
|
88
|
-
}, 'author', 'date', 'slug', 'parent',
|
|
88
|
+
}, 'author', 'date', 'slug', 'parent', {
|
|
89
|
+
id: 'discussion',
|
|
90
|
+
label: (0, _i18n.__)('Discussion'),
|
|
91
|
+
children: ['comment_status', 'ping_status'],
|
|
92
|
+
summary: 'discussion'
|
|
93
|
+
}, {
|
|
89
94
|
label: (0, _i18n.__)('Template'),
|
|
90
95
|
id: 'template',
|
|
91
96
|
layout: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_clsx","_interopRequireDefault","require","_i18n","_dataviews","_data","_coreData","_components","_element","_editor","_page","_lockUnlock","_usePatternSettings","_blockEditor","_jsxRuntime","usePostFields","PostCardPanel","unlock","editorPrivateApis","fieldsWithBulkEditSupport","PostEditForm","postType","postId","ids","useMemo","split","record","hasFinishedResolution","useSelect","select","args","getEditedEntityRecord","hasFinished","coreDataStore","length","multiEdits","setMultiEdits","useState","editEntityRecord","useDispatch","fields","_fields","map","field","id","elements","filter","element","value","form","layout","type","label","__","children","labelPosition","includes","onChange","edits","status","Date","date","password","prev","useEffect","ExperimentalBlockEditorProvider","blockEditorPrivateApis","settings","usePatternSettings","fieldsWithDependency","Edit","data","jsx","jsxs","__experimentalVStack","spacing","DataForm","PostEdit","default","className","clsx"],"sources":["@wordpress/edit-site/src/components/post-edit/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { DataForm } from '@wordpress/dataviews';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { store as coreDataStore } from '@wordpress/core-data';\nimport { __experimentalVStack as VStack } from '@wordpress/components';\nimport { useState, useMemo, useEffect } from '@wordpress/element';\nimport { privateApis as editorPrivateApis } from '@wordpress/editor';\n\n/**\n * Internal dependencies\n */\nimport Page from '../page';\nimport { unlock } from '../../lock-unlock';\nimport usePatternSettings from '../page-patterns/use-pattern-settings';\nimport { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';\n\nconst { usePostFields, PostCardPanel } = unlock( editorPrivateApis );\n\nconst fieldsWithBulkEditSupport = [\n\t'title',\n\t'status',\n\t'date',\n\t'author',\n\t'comment_status',\n];\n\nfunction PostEditForm( { postType, postId } ) {\n\tconst ids = useMemo( () => postId.split( ',' ), [ postId ] );\n\tconst { record, hasFinishedResolution } = useSelect(\n\t\t( select ) => {\n\t\t\tconst args = [ 'postType', postType, ids[ 0 ] ];\n\n\t\t\tconst {\n\t\t\t\tgetEditedEntityRecord,\n\t\t\t\thasFinishedResolution: hasFinished,\n\t\t\t} = select( coreDataStore );\n\n\t\t\treturn {\n\t\t\t\trecord:\n\t\t\t\t\tids.length === 1 ? getEditedEntityRecord( ...args ) : null,\n\t\t\t\thasFinishedResolution: hasFinished(\n\t\t\t\t\t'getEditedEntityRecord',\n\t\t\t\t\targs\n\t\t\t\t),\n\t\t\t};\n\t\t},\n\t\t[ postType, ids ]\n\t);\n\tconst [ multiEdits, setMultiEdits ] = useState( {} );\n\tconst { editEntityRecord } = useDispatch( coreDataStore );\n\tconst { fields: _fields } = usePostFields( { postType } );\n\tconst fields = useMemo(\n\t\t() =>\n\t\t\t_fields?.map( ( field ) => {\n\t\t\t\tif ( field.id === 'status' ) {\n\t\t\t\t\treturn {\n\t\t\t\t\t\t...field,\n\t\t\t\t\t\telements: field.elements.filter(\n\t\t\t\t\t\t\t( element ) => element.value !== 'trash'\n\t\t\t\t\t\t),\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t\treturn field;\n\t\t\t} ),\n\t\t[ _fields ]\n\t);\n\n\tconst form = useMemo(\n\t\t() => ( {\n\t\t\tlayout: {\n\t\t\t\ttype: 'panel',\n\t\t\t},\n\t\t\tfields: [\n\t\t\t\t{\n\t\t\t\t\tid: 'featured_media',\n\t\t\t\t\tlayout: {\n\t\t\t\t\t\ttype: 'regular',\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tid: 'status',\n\t\t\t\t\tlabel: __( 'Status & Visibility' ),\n\t\t\t\t\tchildren: [ 'status', 'password' ],\n\t\t\t\t},\n\t\t\t\t'author',\n\t\t\t\t'date',\n\t\t\t\t'slug',\n\t\t\t\t'parent',\n\t\t\t\t'comment_status',\n\t\t\t\t{\n\t\t\t\t\tlabel: __( 'Template' ),\n\t\t\t\t\tid: 'template',\n\t\t\t\t\tlayout: {\n\t\t\t\t\t\ttype: 'regular',\n\t\t\t\t\t\tlabelPosition: 'side',\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t].filter(\n\t\t\t\t( field ) =>\n\t\t\t\t\tids.length === 1 ||\n\t\t\t\t\tfieldsWithBulkEditSupport.includes( field )\n\t\t\t),\n\t\t} ),\n\t\t[ ids ]\n\t);\n\tconst onChange = ( edits ) => {\n\t\tfor ( const id of ids ) {\n\t\t\tif (\n\t\t\t\tedits.status &&\n\t\t\t\tedits.status !== 'future' &&\n\t\t\t\trecord?.status === 'future' &&\n\t\t\t\tnew Date( record.date ) > new Date()\n\t\t\t) {\n\t\t\t\tedits.date = null;\n\t\t\t}\n\t\t\tif (\n\t\t\t\tedits.status &&\n\t\t\t\tedits.status === 'private' &&\n\t\t\t\trecord.password\n\t\t\t) {\n\t\t\t\tedits.password = '';\n\t\t\t}\n\t\t\teditEntityRecord( 'postType', postType, id, edits );\n\t\t\tif ( ids.length > 1 ) {\n\t\t\t\tsetMultiEdits( ( prev ) => ( {\n\t\t\t\t\t...prev,\n\t\t\t\t\t...edits,\n\t\t\t\t} ) );\n\t\t\t}\n\t\t}\n\t};\n\tuseEffect( () => {\n\t\tsetMultiEdits( {} );\n\t}, [ ids ] );\n\n\tconst { ExperimentalBlockEditorProvider } = unlock(\n\t\tblockEditorPrivateApis\n\t);\n\tconst settings = usePatternSettings();\n\n\t/**\n\t * The template field depends on the block editor settings.\n\t * This is a workaround to ensure that the block editor settings are available.\n\t * For more information, see: https://github.com/WordPress/gutenberg/issues/67521\n\t */\n\tconst fieldsWithDependency = useMemo( () => {\n\t\treturn fields.map( ( field ) => {\n\t\t\tif ( field.id === 'template' ) {\n\t\t\t\treturn {\n\t\t\t\t\t...field,\n\t\t\t\t\tEdit: ( data ) => (\n\t\t\t\t\t\t<ExperimentalBlockEditorProvider settings={ settings }>\n\t\t\t\t\t\t\t<field.Edit { ...data } />\n\t\t\t\t\t\t</ExperimentalBlockEditorProvider>\n\t\t\t\t\t),\n\t\t\t\t};\n\t\t\t}\n\t\t\treturn field;\n\t\t} );\n\t}, [ fields, settings ] );\n\n\treturn (\n\t\t<VStack spacing={ 4 }>\n\t\t\t<PostCardPanel postType={ postType } postId={ ids } />\n\t\t\t{ hasFinishedResolution && (\n\t\t\t\t<DataForm\n\t\t\t\t\tdata={ ids.length === 1 ? record : multiEdits }\n\t\t\t\t\tfields={ fieldsWithDependency }\n\t\t\t\t\tform={ form }\n\t\t\t\t\tonChange={ onChange }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</VStack>\n\t);\n}\n\nexport function PostEdit( { postType, postId } ) {\n\treturn (\n\t\t<Page\n\t\t\tclassName={ clsx( 'edit-site-post-edit', {\n\t\t\t\t'is-empty': ! postId,\n\t\t\t} ) }\n\t\t\tlabel={ __( 'Post Edit' ) }\n\t\t>\n\t\t\t{ postId && (\n\t\t\t\t<PostEditForm postType={ postType } postId={ postId } />\n\t\t\t) }\n\t\t\t{ ! postId && <p>{ __( 'Select a page to edit' ) }</p> }\n\t\t</Page>\n\t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AE;MACxC,UAAU,EAAE,CAAE1D;IACf,CAAE,CAAG;IACL8B,KAAK,EAAG,IAAAC,QAAE,EAAE,WAAY,CAAG;IAAAC,QAAA,GAEzBhC,MAAM,iBACP,IAAAR,WAAA,CAAA0D,GAAA,EAACpD,YAAY;MAACC,QAAQ,EAAGA,QAAU;MAACC,MAAM,EAAGA;IAAQ,CAAE,CACvD,EACC,CAAEA,MAAM,iBAAI,IAAAR,WAAA,CAAA0D,GAAA;MAAAlB,QAAA,EAAK,IAAAD,QAAE,EAAE,uBAAwB;IAAC,CAAK,CAAC;EAAA,CACjD,CAAC;AAET","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_clsx","_interopRequireDefault","require","_i18n","_dataviews","_data","_coreData","_components","_element","_editor","_page","_lockUnlock","_usePatternSettings","_blockEditor","_jsxRuntime","usePostFields","PostCardPanel","unlock","editorPrivateApis","fieldsWithBulkEditSupport","PostEditForm","postType","postId","ids","useMemo","split","record","hasFinishedResolution","useSelect","select","args","getEditedEntityRecord","hasFinished","coreDataStore","length","multiEdits","setMultiEdits","useState","editEntityRecord","useDispatch","fields","_fields","map","field","id","elements","filter","element","value","form","layout","type","label","__","children","summary","labelPosition","includes","onChange","edits","status","Date","date","password","prev","useEffect","ExperimentalBlockEditorProvider","blockEditorPrivateApis","settings","usePatternSettings","fieldsWithDependency","Edit","data","jsx","jsxs","__experimentalVStack","spacing","DataForm","PostEdit","default","className","clsx"],"sources":["@wordpress/edit-site/src/components/post-edit/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { DataForm } from '@wordpress/dataviews';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { store as coreDataStore } from '@wordpress/core-data';\nimport { __experimentalVStack as VStack } from '@wordpress/components';\nimport { useState, useMemo, useEffect } from '@wordpress/element';\nimport { privateApis as editorPrivateApis } from '@wordpress/editor';\n\n/**\n * Internal dependencies\n */\nimport Page from '../page';\nimport { unlock } from '../../lock-unlock';\nimport usePatternSettings from '../page-patterns/use-pattern-settings';\nimport { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';\n\nconst { usePostFields, PostCardPanel } = unlock( editorPrivateApis );\n\nconst fieldsWithBulkEditSupport = [\n\t'title',\n\t'status',\n\t'date',\n\t'author',\n\t'discussion',\n];\n\nfunction PostEditForm( { postType, postId } ) {\n\tconst ids = useMemo( () => postId.split( ',' ), [ postId ] );\n\tconst { record, hasFinishedResolution } = useSelect(\n\t\t( select ) => {\n\t\t\tconst args = [ 'postType', postType, ids[ 0 ] ];\n\n\t\t\tconst {\n\t\t\t\tgetEditedEntityRecord,\n\t\t\t\thasFinishedResolution: hasFinished,\n\t\t\t} = select( coreDataStore );\n\n\t\t\treturn {\n\t\t\t\trecord:\n\t\t\t\t\tids.length === 1 ? getEditedEntityRecord( ...args ) : null,\n\t\t\t\thasFinishedResolution: hasFinished(\n\t\t\t\t\t'getEditedEntityRecord',\n\t\t\t\t\targs\n\t\t\t\t),\n\t\t\t};\n\t\t},\n\t\t[ postType, ids ]\n\t);\n\tconst [ multiEdits, setMultiEdits ] = useState( {} );\n\tconst { editEntityRecord } = useDispatch( coreDataStore );\n\tconst { fields: _fields } = usePostFields( { postType } );\n\tconst fields = useMemo(\n\t\t() =>\n\t\t\t_fields?.map( ( field ) => {\n\t\t\t\tif ( field.id === 'status' ) {\n\t\t\t\t\treturn {\n\t\t\t\t\t\t...field,\n\t\t\t\t\t\telements: field.elements.filter(\n\t\t\t\t\t\t\t( element ) => element.value !== 'trash'\n\t\t\t\t\t\t),\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t\treturn field;\n\t\t\t} ),\n\t\t[ _fields ]\n\t);\n\n\tconst form = useMemo(\n\t\t() => ( {\n\t\t\tlayout: {\n\t\t\t\ttype: 'panel',\n\t\t\t},\n\t\t\tfields: [\n\t\t\t\t{\n\t\t\t\t\tid: 'featured_media',\n\t\t\t\t\tlayout: {\n\t\t\t\t\t\ttype: 'regular',\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tid: 'status',\n\t\t\t\t\tlabel: __( 'Status & Visibility' ),\n\t\t\t\t\tchildren: [ 'status', 'password' ],\n\t\t\t\t},\n\t\t\t\t'author',\n\t\t\t\t'date',\n\t\t\t\t'slug',\n\t\t\t\t'parent',\n\t\t\t\t{\n\t\t\t\t\tid: 'discussion',\n\t\t\t\t\tlabel: __( 'Discussion' ),\n\t\t\t\t\tchildren: [ 'comment_status', 'ping_status' ],\n\t\t\t\t\tsummary: 'discussion',\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tlabel: __( 'Template' ),\n\t\t\t\t\tid: 'template',\n\t\t\t\t\tlayout: {\n\t\t\t\t\t\ttype: 'regular',\n\t\t\t\t\t\tlabelPosition: 'side',\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t].filter(\n\t\t\t\t( field ) =>\n\t\t\t\t\tids.length === 1 ||\n\t\t\t\t\tfieldsWithBulkEditSupport.includes( field )\n\t\t\t),\n\t\t} ),\n\t\t[ ids ]\n\t);\n\tconst onChange = ( edits ) => {\n\t\tfor ( const id of ids ) {\n\t\t\tif (\n\t\t\t\tedits.status &&\n\t\t\t\tedits.status !== 'future' &&\n\t\t\t\trecord?.status === 'future' &&\n\t\t\t\tnew Date( record.date ) > new Date()\n\t\t\t) {\n\t\t\t\tedits.date = null;\n\t\t\t}\n\t\t\tif (\n\t\t\t\tedits.status &&\n\t\t\t\tedits.status === 'private' &&\n\t\t\t\trecord.password\n\t\t\t) {\n\t\t\t\tedits.password = '';\n\t\t\t}\n\t\t\teditEntityRecord( 'postType', postType, id, edits );\n\t\t\tif ( ids.length > 1 ) {\n\t\t\t\tsetMultiEdits( ( prev ) => ( {\n\t\t\t\t\t...prev,\n\t\t\t\t\t...edits,\n\t\t\t\t} ) );\n\t\t\t}\n\t\t}\n\t};\n\tuseEffect( () => {\n\t\tsetMultiEdits( {} );\n\t}, [ ids ] );\n\n\tconst { ExperimentalBlockEditorProvider } = unlock(\n\t\tblockEditorPrivateApis\n\t);\n\tconst settings = usePatternSettings();\n\n\t/**\n\t * The template field depends on the block editor settings.\n\t * This is a workaround to ensure that the block editor settings are available.\n\t * For more information, see: https://github.com/WordPress/gutenberg/issues/67521\n\t */\n\tconst fieldsWithDependency = useMemo( () => {\n\t\treturn fields.map( ( field ) => {\n\t\t\tif ( field.id === 'template' ) {\n\t\t\t\treturn {\n\t\t\t\t\t...field,\n\t\t\t\t\tEdit: ( data ) => (\n\t\t\t\t\t\t<ExperimentalBlockEditorProvider settings={ settings }>\n\t\t\t\t\t\t\t<field.Edit { ...data } />\n\t\t\t\t\t\t</ExperimentalBlockEditorProvider>\n\t\t\t\t\t),\n\t\t\t\t};\n\t\t\t}\n\t\t\treturn field;\n\t\t} );\n\t}, [ fields, settings ] );\n\n\treturn (\n\t\t<VStack spacing={ 4 }>\n\t\t\t<PostCardPanel postType={ postType } postId={ ids } />\n\t\t\t{ hasFinishedResolution && (\n\t\t\t\t<DataForm\n\t\t\t\t\tdata={ ids.length === 1 ? record : multiEdits }\n\t\t\t\t\tfields={ fieldsWithDependency }\n\t\t\t\t\tform={ form }\n\t\t\t\t\tonChange={ onChange }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</VStack>\n\t);\n}\n\nexport function PostEdit( { postType, postId } ) {\n\treturn (\n\t\t<Page\n\t\t\tclassName={ clsx( 'edit-site-post-edit', {\n\t\t\t\t'is-empty': ! postId,\n\t\t\t} ) }\n\t\t\tlabel={ __( 'Post Edit' ) }\n\t\t>\n\t\t\t{ postId && (\n\t\t\t\t<PostEditForm postType={ postType } postId={ postId } />\n\t\t\t) }\n\t\t\t{ ! postId && <p>{ __( 'Select a page to edit' ) }</p> }\n\t\t</Page>\n\t);\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,KAAA,GAAAD,OAAA;AACA,I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AAS,EAAG,IAAAC,aAAI,EAAE,qBAAqB,EAAE;MACxC,UAAU,EAAE,CAAE3D;IACf,CAAE,CAAG;IACL8B,KAAK,EAAG,IAAAC,QAAE,EAAE,WAAY,CAAG;IAAAC,QAAA,GAEzBhC,MAAM,iBACP,IAAAR,WAAA,CAAA2D,GAAA,EAACrD,YAAY;MAACC,QAAQ,EAAGA,QAAU;MAACC,MAAM,EAAGA;IAAQ,CAAE,CACvD,EACC,CAAEA,MAAM,iBAAI,IAAAR,WAAA,CAAA2D,GAAA;MAAAnB,QAAA,EAAK,IAAAD,QAAE,EAAE,uBAAwB;IAAC,CAAK,CAAC;EAAA,CACjD,CAAC;AAET","ignoreList":[]}
|
|
@@ -47,7 +47,7 @@ export default function AddNewPostModal({
|
|
|
47
47
|
onSave(newPage);
|
|
48
48
|
createSuccessNotice(sprintf(
|
|
49
49
|
// translators: %s: Title of the created post or template, e.g: "Hello world".
|
|
50
|
-
__('"%s" successfully created.'), decodeEntities(newPage.title?.rendered || title)), {
|
|
50
|
+
__('"%s" successfully created.'), decodeEntities(newPage.title?.rendered || title) || __('(no title)')), {
|
|
51
51
|
type: 'snackbar'
|
|
52
52
|
});
|
|
53
53
|
} catch (error) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["Button","Modal","__experimentalHStack","HStack","__experimentalVStack","VStack","TextControl","__","sprintf","useDispatch","useRegistry","useSelect","useState","store","coreStore","noticesStore","decodeEntities","serialize","synchronizeBlocksWithTemplate","jsx","_jsx","jsxs","_jsxs","AddNewPostModal","postType","onSave","onClose","labels","select","getPostType","isCreatingPost","setIsCreatingPost","title","setTitle","saveEntityRecord","createErrorNotice","createSuccessNotice","resolveSelect","createPost","event","preventDefault","postTypeObject","newPage","status","slug","undefined","content","template","length","throwOnError","rendered","type","error","errorMessage","message","code","singular_name","onRequestClose","focusOnMount","size","children","onSubmit","spacing","__next40pxDefaultSize","__nextHasNoMarginBottom","label","onChange","placeholder","value","justify","variant","onClick","isBusy"],"sources":["@wordpress/edit-site/src/components/add-new-post/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tButton,\n\tModal,\n\t__experimentalHStack as HStack,\n\t__experimentalVStack as VStack,\n\tTextControl,\n} from '@wordpress/components';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { useDispatch, useRegistry, useSelect } from '@wordpress/data';\nimport { useState } from '@wordpress/element';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { serialize, synchronizeBlocksWithTemplate } from '@wordpress/blocks';\n\nexport default function AddNewPostModal( { postType, onSave, onClose } ) {\n\tconst labels = useSelect(\n\t\t( select ) => select( coreStore ).getPostType( postType )?.labels,\n\t\t[ postType ]\n\t);\n\tconst [ isCreatingPost, setIsCreatingPost ] = useState( false );\n\tconst [ title, setTitle ] = useState( '' );\n\n\tconst { saveEntityRecord } = useDispatch( coreStore );\n\tconst { createErrorNotice, createSuccessNotice } =\n\t\tuseDispatch( noticesStore );\n\tconst { resolveSelect } = useRegistry();\n\n\tasync function createPost( event ) {\n\t\tevent.preventDefault();\n\n\t\tif ( isCreatingPost ) {\n\t\t\treturn;\n\t\t}\n\t\tsetIsCreatingPost( true );\n\t\ttry {\n\t\t\tconst postTypeObject =\n\t\t\t\tawait resolveSelect( coreStore ).getPostType( postType );\n\t\t\tconst newPage = await saveEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\tpostType,\n\t\t\t\t{\n\t\t\t\t\tstatus: 'draft',\n\t\t\t\t\ttitle,\n\t\t\t\t\tslug: title ?? undefined,\n\t\t\t\t\tcontent:\n\t\t\t\t\t\t!! postTypeObject.template &&\n\t\t\t\t\t\tpostTypeObject.template.length\n\t\t\t\t\t\t\t? serialize(\n\t\t\t\t\t\t\t\t\tsynchronizeBlocksWithTemplate(\n\t\t\t\t\t\t\t\t\t\t[],\n\t\t\t\t\t\t\t\t\t\tpostTypeObject.template\n\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t )\n\t\t\t\t\t\t\t: undefined,\n\t\t\t\t},\n\t\t\t\t{ throwOnError: true }\n\t\t\t);\n\n\t\t\tonSave( newPage );\n\n\t\t\tcreateSuccessNotice(\n\t\t\t\tsprintf(\n\t\t\t\t\t// translators: %s: Title of the created post or template, e.g: \"Hello world\".\n\t\t\t\t\t__( '\"%s\" successfully created.' ),\n\t\t\t\t\tdecodeEntities( newPage.title?.rendered || title )\n\t\t\t\t),\n\t\t\t\t{ type: '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 creating the item.' );\n\n\t\t\tcreateErrorNotice( errorMessage, {\n\t\t\t\ttype: 'snackbar',\n\t\t\t} );\n\t\t} finally {\n\t\t\tsetIsCreatingPost( false );\n\t\t}\n\t}\n\n\treturn (\n\t\t<Modal\n\t\t\ttitle={\n\t\t\t\t// translators: %s: post type singular_name label e.g: \"Page\".\n\t\t\t\tsprintf( __( 'Draft new: %s' ), labels?.singular_name )\n\t\t\t}\n\t\t\tonRequestClose={ onClose }\n\t\t\tfocusOnMount=\"firstContentElement\"\n\t\t\tsize=\"small\"\n\t\t>\n\t\t\t<form onSubmit={ createPost }>\n\t\t\t\t<VStack spacing={ 4 }>\n\t\t\t\t\t<TextControl\n\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\tlabel={ __( 'Title' ) }\n\t\t\t\t\t\tonChange={ setTitle }\n\t\t\t\t\t\tplaceholder={ __( 'No title' ) }\n\t\t\t\t\t\tvalue={ title }\n\t\t\t\t\t/>\n\t\t\t\t\t<HStack spacing={ 2 } justify=\"end\">\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t\t\tonClick={ onClose }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Cancel' ) }\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\t\ttype=\"submit\"\n\t\t\t\t\t\t\tisBusy={ isCreatingPost }\n\t\t\t\t\t\t\taria-disabled={ isCreatingPost }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Create draft' ) }\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t</HStack>\n\t\t\t\t</VStack>\n\t\t\t</form>\n\t\t</Modal>\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SACCA,MAAM,EACNC,KAAK,EACLC,oBAAoB,IAAIC,MAAM,EAC9BC,oBAAoB,IAAIC,MAAM,EAC9BC,WAAW,QACL,uBAAuB;AAC9B,SAASC,EAAE,EAAEC,OAAO,QAAQ,iBAAiB;AAC7C,SAASC,WAAW,EAAEC,WAAW,EAAEC,SAAS,QAAQ,iBAAiB;AACrE,SAASC,QAAQ,QAAQ,oBAAoB;AAC7C,SAASC,KAAK,IAAIC,SAAS,QAAQ,sBAAsB;AACzD,SAASD,KAAK,IAAIE,YAAY,QAAQ,oBAAoB;AAC1D,SAASC,cAAc,QAAQ,0BAA0B;AACzD,SAASC,SAAS,EAAEC,6BAA6B,QAAQ,mBAAmB;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAE7E,eAAe,SAASC,eAAeA,CAAE;EAAEC,QAAQ;EAAEC,MAAM;EAAEC;AAAQ,CAAC,EAAG;EACxE,MAAMC,MAAM,GAAGhB,SAAS,CACrBiB,MAAM,IAAMA,MAAM,CAAEd,SAAU,CAAC,CAACe,WAAW,CAAEL,QAAS,CAAC,EAAEG,MAAM,EACjE,CAAEH,QAAQ,CACX,CAAC;EACD,MAAM,CAAEM,cAAc,EAAEC,iB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","TextControl","__","sprintf","useDispatch","useRegistry","useSelect","useState","store","coreStore","noticesStore","decodeEntities","serialize","synchronizeBlocksWithTemplate","jsx","_jsx","jsxs","_jsxs","AddNewPostModal","postType","onSave","onClose","labels","select","getPostType","isCreatingPost","setIsCreatingPost","title","setTitle","saveEntityRecord","createErrorNotice","createSuccessNotice","resolveSelect","createPost","event","preventDefault","postTypeObject","newPage","status","slug","undefined","content","template","length","throwOnError","rendered","type","error","errorMessage","message","code","singular_name","onRequestClose","focusOnMount","size","children","onSubmit","spacing","__next40pxDefaultSize","__nextHasNoMarginBottom","label","onChange","placeholder","value","justify","variant","onClick","isBusy"],"sources":["@wordpress/edit-site/src/components/add-new-post/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tButton,\n\tModal,\n\t__experimentalHStack as HStack,\n\t__experimentalVStack as VStack,\n\tTextControl,\n} from '@wordpress/components';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { useDispatch, useRegistry, useSelect } from '@wordpress/data';\nimport { useState } from '@wordpress/element';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { serialize, synchronizeBlocksWithTemplate } from '@wordpress/blocks';\n\nexport default function AddNewPostModal( { postType, onSave, onClose } ) {\n\tconst labels = useSelect(\n\t\t( select ) => select( coreStore ).getPostType( postType )?.labels,\n\t\t[ postType ]\n\t);\n\tconst [ isCreatingPost, setIsCreatingPost ] = useState( false );\n\tconst [ title, setTitle ] = useState( '' );\n\n\tconst { saveEntityRecord } = useDispatch( coreStore );\n\tconst { createErrorNotice, createSuccessNotice } =\n\t\tuseDispatch( noticesStore );\n\tconst { resolveSelect } = useRegistry();\n\n\tasync function createPost( event ) {\n\t\tevent.preventDefault();\n\n\t\tif ( isCreatingPost ) {\n\t\t\treturn;\n\t\t}\n\t\tsetIsCreatingPost( true );\n\t\ttry {\n\t\t\tconst postTypeObject =\n\t\t\t\tawait resolveSelect( coreStore ).getPostType( postType );\n\t\t\tconst newPage = await saveEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\tpostType,\n\t\t\t\t{\n\t\t\t\t\tstatus: 'draft',\n\t\t\t\t\ttitle,\n\t\t\t\t\tslug: title ?? undefined,\n\t\t\t\t\tcontent:\n\t\t\t\t\t\t!! postTypeObject.template &&\n\t\t\t\t\t\tpostTypeObject.template.length\n\t\t\t\t\t\t\t? serialize(\n\t\t\t\t\t\t\t\t\tsynchronizeBlocksWithTemplate(\n\t\t\t\t\t\t\t\t\t\t[],\n\t\t\t\t\t\t\t\t\t\tpostTypeObject.template\n\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t )\n\t\t\t\t\t\t\t: undefined,\n\t\t\t\t},\n\t\t\t\t{ throwOnError: true }\n\t\t\t);\n\n\t\t\tonSave( newPage );\n\n\t\t\tcreateSuccessNotice(\n\t\t\t\tsprintf(\n\t\t\t\t\t// translators: %s: Title of the created post or template, e.g: \"Hello world\".\n\t\t\t\t\t__( '\"%s\" successfully created.' ),\n\t\t\t\t\tdecodeEntities( newPage.title?.rendered || title ) ||\n\t\t\t\t\t\t__( '(no title)' )\n\t\t\t\t),\n\t\t\t\t{ type: '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 creating the item.' );\n\n\t\t\tcreateErrorNotice( errorMessage, {\n\t\t\t\ttype: 'snackbar',\n\t\t\t} );\n\t\t} finally {\n\t\t\tsetIsCreatingPost( false );\n\t\t}\n\t}\n\n\treturn (\n\t\t<Modal\n\t\t\ttitle={\n\t\t\t\t// translators: %s: post type singular_name label e.g: \"Page\".\n\t\t\t\tsprintf( __( 'Draft new: %s' ), labels?.singular_name )\n\t\t\t}\n\t\t\tonRequestClose={ onClose }\n\t\t\tfocusOnMount=\"firstContentElement\"\n\t\t\tsize=\"small\"\n\t\t>\n\t\t\t<form onSubmit={ createPost }>\n\t\t\t\t<VStack spacing={ 4 }>\n\t\t\t\t\t<TextControl\n\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\tlabel={ __( 'Title' ) }\n\t\t\t\t\t\tonChange={ setTitle }\n\t\t\t\t\t\tplaceholder={ __( 'No title' ) }\n\t\t\t\t\t\tvalue={ title }\n\t\t\t\t\t/>\n\t\t\t\t\t<HStack spacing={ 2 } justify=\"end\">\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t\t\tonClick={ onClose }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Cancel' ) }\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\t\ttype=\"submit\"\n\t\t\t\t\t\t\tisBusy={ isCreatingPost }\n\t\t\t\t\t\t\taria-disabled={ isCreatingPost }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Create draft' ) }\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t</HStack>\n\t\t\t\t</VStack>\n\t\t\t</form>\n\t\t</Modal>\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SACCA,MAAM,EACNC,KAAK,EACLC,oBAAoB,IAAIC,MAAM,EAC9BC,oBAAoB,IAAIC,MAAM,EAC9BC,WAAW,QACL,uBAAuB;AAC9B,SAASC,EAAE,EAAEC,OAAO,QAAQ,iBAAiB;AAC7C,SAASC,WAAW,EAAEC,WAAW,EAAEC,SAAS,QAAQ,iBAAiB;AACrE,SAASC,QAAQ,QAAQ,oBAAoB;AAC7C,SAASC,KAAK,IAAIC,SAAS,QAAQ,sBAAsB;AACzD,SAASD,KAAK,IAAIE,YAAY,QAAQ,oB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,QAAQ,EAAGjC,QAAU;UACrBkC,WAAW,EAAG5D,EAAE,CAAE,UAAW,CAAG;UAChC6D,KAAK,EAAGpC;QAAO,CACf,CAAC,eACFV,KAAA,CAACnB,MAAM;UAAC2D,OAAO,EAAG,CAAG;UAACO,OAAO,EAAC,KAAK;UAAAT,QAAA,gBAClCxC,IAAA,CAACpB,MAAM;YACN+D,qBAAqB;YACrBO,OAAO,EAAC,UAAU;YAClBC,OAAO,EAAG7C,OAAS;YAAAkC,QAAA,EAEjBrD,EAAE,CAAE,QAAS;UAAC,CACT,CAAC,eACTa,IAAA,CAACpB,MAAM;YACN+D,qBAAqB;YACrBO,OAAO,EAAC,SAAS;YACjBnB,IAAI,EAAC,QAAQ;YACbqB,MAAM,EAAG1C,cAAgB;YACzB,iBAAgBA,cAAgB;YAAA8B,QAAA,EAE9BrD,EAAE,CAAE,cAAe;UAAC,CACf,CAAC;QAAA,CACF,CAAC;MAAA,CACF;IAAC,CACJ;EAAC,CACD,CAAC;AAEV","ignoreList":[]}
|
|
@@ -162,7 +162,7 @@ function NewTemplateModal({
|
|
|
162
162
|
history.navigate(`/${TEMPLATE_POST_TYPE}/${newTemplate.id}?canvas=edit`);
|
|
163
163
|
createSuccessNotice(sprintf(
|
|
164
164
|
// translators: %s: Title of the created post or template, e.g: "Hello world".
|
|
165
|
-
__('"%s" successfully created.'), decodeEntities(newTemplate.title?.rendered || title)), {
|
|
165
|
+
__('"%s" successfully created.'), decodeEntities(newTemplate.title?.rendered || title) || __('(no title)')), {
|
|
166
166
|
type: 'snackbar'
|
|
167
167
|
});
|
|
168
168
|
} catch (error) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["clsx","Button","Modal","__experimentalGrid","Grid","__experimentalText","Text","__experimentalVStack","VStack","Flex","Icon","decodeEntities","useState","memo","useRef","useEffect","useSelect","useDispatch","store","coreStore","useViewportMatch","archive","blockMeta","calendar","category","commentAuthorAvatar","edit","home","layout","list","media","notFound","page","pin","verse","search","tag","__","sprintf","noticesStore","privateApis","routerPrivateApis","focus","TEMPLATE_POST_TYPE","AddCustomTemplateModalContent","useDefaultTemplateTypes","useTaxonomiesMenuItems","usePostTypeMenuItems","useAuthorMenuItem","usePostTypeArchiveMenuItems","AddCustomGenericTemplateModalContent","unlock","jsx","_jsx","jsxs","_jsxs","Fragment","_Fragment","useHistory","DEFAULT_TEMPLATE_SLUGS","TEMPLATE_ICONS","single","index","author","taxonomy","date","attachment","TemplateListItem","title","direction","className","description","icon","onClick","children","__next40pxDefaultSize","label","showTooltip","as","spacing","align","justify","style","width","alignment","weight","lineHeight","modalContentMap","templatesList","customTemplate","customGenericTemplate","NewTemplateModal","onClose","modalContent","setModalContent","entityForSuggestions","setEntityForSuggestions","isSubmitting","setIsSubmitting","missingTemplates","useMissingTemplates","history","saveEntityRecord","createErrorNotice","createSuccessNotice","containerRef","isMobile","homeUrl","select","getEntityRecord","TEMPLATE_SHORT_DESCRIPTIONS","Date","getFullYear","current","firstFocusable","focusable","find","createTemplate","template","isWPSuggestion","slug","newTemplate","toString","status","is_wp_suggestion","throwOnError","navigate","id","rendered","type","error","errorMessage","message","code","onModalClose","modalTitle","labels","singular_name","onRequestClose","overlayClassName","undefined","ref","columns","gap","map","onSelect","onBack","NewTemplate","showModal","setShowModal","postType","getPostType","variant","add_new_item","defaultTemplateTypes","missingDefaultTemplates","filter","includes","onClickMenuItem","_entityForSuggestions","enhancedMissingDefaultTemplateTypes","defaultTaxonomiesMenuItems","taxonomiesMenuItems","defaultPostTypesMenuItems","postTypesMenuItems","authorMenuItem","forEach","menuItem","matchIndex","findIndex","push","sort","template1","template2","indexOf"],"sources":["@wordpress/edit-site/src/components/add-new-template/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tButton,\n\tModal,\n\t__experimentalGrid as Grid,\n\t__experimentalText as Text,\n\t__experimentalVStack as VStack,\n\tFlex,\n\tIcon,\n} from '@wordpress/components';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { useState, memo, useRef, useEffect } from '@wordpress/element';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useViewportMatch } from '@wordpress/compose';\nimport {\n\tarchive,\n\tblockMeta,\n\tcalendar,\n\tcategory,\n\tcommentAuthorAvatar,\n\tedit,\n\thome,\n\tlayout,\n\tlist,\n\tmedia,\n\tnotFound,\n\tpage,\n\tpin,\n\tverse,\n\tsearch,\n\ttag,\n} from '@wordpress/icons';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\nimport { focus } from '@wordpress/dom';\n\n/**\n * Internal dependencies\n */\nimport { TEMPLATE_POST_TYPE } from '../../utils/constants';\n\n/**\n * Internal dependencies\n */\nimport AddCustomTemplateModalContent from './add-custom-template-modal-content';\nimport {\n\tuseDefaultTemplateTypes,\n\tuseTaxonomiesMenuItems,\n\tusePostTypeMenuItems,\n\tuseAuthorMenuItem,\n\tusePostTypeArchiveMenuItems,\n} from './utils';\nimport AddCustomGenericTemplateModalContent from './add-custom-generic-template-modal-content';\nimport { unlock } from '../../lock-unlock';\n\nconst { useHistory } = unlock( routerPrivateApis );\n\nconst DEFAULT_TEMPLATE_SLUGS = [\n\t'front-page',\n\t'home',\n\t'single',\n\t'page',\n\t'index',\n\t'archive',\n\t'author',\n\t'category',\n\t'date',\n\t'tag',\n\t'search',\n\t'404',\n];\n\nconst TEMPLATE_ICONS = {\n\t'front-page': home,\n\thome: verse,\n\tsingle: pin,\n\tpage,\n\tarchive,\n\tsearch,\n\t404: notFound,\n\tindex: list,\n\tcategory,\n\tauthor: commentAuthorAvatar,\n\ttaxonomy: blockMeta,\n\tdate: calendar,\n\ttag,\n\tattachment: media,\n};\n\nfunction TemplateListItem( {\n\ttitle,\n\tdirection,\n\tclassName,\n\tdescription,\n\ticon,\n\tonClick,\n\tchildren,\n} ) {\n\treturn (\n\t\t<Button\n\t\t\t__next40pxDefaultSize\n\t\t\tclassName={ className }\n\t\t\tonClick={ onClick }\n\t\t\tlabel={ description }\n\t\t\tshowTooltip={ !! description }\n\t\t>\n\t\t\t<Flex\n\t\t\t\tas=\"span\"\n\t\t\t\tspacing={ 2 }\n\t\t\t\talign=\"center\"\n\t\t\t\tjustify=\"center\"\n\t\t\t\tstyle={ { width: '100%' } }\n\t\t\t\tdirection={ direction }\n\t\t\t>\n\t\t\t\t<div className=\"edit-site-add-new-template__template-icon\">\n\t\t\t\t\t<Icon icon={ icon } />\n\t\t\t\t</div>\n\t\t\t\t<VStack\n\t\t\t\t\tclassName=\"edit-site-add-new-template__template-name\"\n\t\t\t\t\talignment=\"center\"\n\t\t\t\t\tspacing={ 0 }\n\t\t\t\t>\n\t\t\t\t\t<Text\n\t\t\t\t\t\talign=\"center\"\n\t\t\t\t\t\tweight={ 500 }\n\t\t\t\t\t\tlineHeight={ 1.53846153846 } // 20px\n\t\t\t\t\t>\n\t\t\t\t\t\t{ title }\n\t\t\t\t\t</Text>\n\t\t\t\t\t{ children }\n\t\t\t\t</VStack>\n\t\t\t</Flex>\n\t\t</Button>\n\t);\n}\n\nconst modalContentMap = {\n\ttemplatesList: 1,\n\tcustomTemplate: 2,\n\tcustomGenericTemplate: 3,\n};\n\nfunction NewTemplateModal( { onClose } ) {\n\tconst [ modalContent, setModalContent ] = useState(\n\t\tmodalContentMap.templatesList\n\t);\n\tconst [ entityForSuggestions, setEntityForSuggestions ] = useState( {} );\n\tconst [ isSubmitting, setIsSubmitting ] = useState( false );\n\tconst missingTemplates = useMissingTemplates( setEntityForSuggestions, () =>\n\t\tsetModalContent( modalContentMap.customTemplate )\n\t);\n\tconst history = useHistory();\n\tconst { saveEntityRecord } = useDispatch( coreStore );\n\tconst { createErrorNotice, createSuccessNotice } =\n\t\tuseDispatch( noticesStore );\n\tconst containerRef = useRef( null );\n\tconst isMobile = useViewportMatch( 'medium', '<' );\n\n\tconst homeUrl = useSelect( ( select ) => {\n\t\t// Site index.\n\t\treturn select( coreStore ).getEntityRecord( 'root', '__unstableBase' )\n\t\t\t?.home;\n\t}, [] );\n\n\tconst TEMPLATE_SHORT_DESCRIPTIONS = {\n\t\t'front-page': homeUrl,\n\t\tdate: sprintf(\n\t\t\t// translators: %s: The homepage url.\n\t\t\t__( 'E.g. %s' ),\n\t\t\thomeUrl + '/' + new Date().getFullYear()\n\t\t),\n\t};\n\n\tuseEffect( () => {\n\t\t// Focus the first focusable element when component mounts or UI changes\n\t\t// We don't want to focus on the other modals because they have their own focus management.\n\t\tif (\n\t\t\tcontainerRef.current &&\n\t\t\tmodalContent === modalContentMap.templatesList\n\t\t) {\n\t\t\tconst [ firstFocusable ] = focus.focusable.find(\n\t\t\t\tcontainerRef.current\n\t\t\t);\n\t\t\tfirstFocusable?.focus();\n\t\t}\n\t}, [ modalContent ] );\n\n\tasync function createTemplate( template, isWPSuggestion = true ) {\n\t\tif ( isSubmitting ) {\n\t\t\treturn;\n\t\t}\n\t\tsetIsSubmitting( true );\n\t\ttry {\n\t\t\tconst { title, description, slug } = template;\n\t\t\tconst newTemplate = await saveEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\tTEMPLATE_POST_TYPE,\n\t\t\t\t{\n\t\t\t\t\tdescription,\n\t\t\t\t\t// Slugs need to be strings, so this is for template `404`\n\t\t\t\t\tslug: slug.toString(),\n\t\t\t\t\tstatus: 'publish',\n\t\t\t\t\ttitle,\n\t\t\t\t\t// This adds a post meta field in template that is part of `is_custom` value calculation.\n\t\t\t\t\tis_wp_suggestion: isWPSuggestion,\n\t\t\t\t},\n\t\t\t\t{ throwOnError: true }\n\t\t\t);\n\n\t\t\t// Navigate to the created template editor.\n\t\t\thistory.navigate(\n\t\t\t\t`/${ TEMPLATE_POST_TYPE }/${ newTemplate.id }?canvas=edit`\n\t\t\t);\n\n\t\t\tcreateSuccessNotice(\n\t\t\t\tsprintf(\n\t\t\t\t\t// translators: %s: Title of the created post or template, e.g: \"Hello world\".\n\t\t\t\t\t__( '\"%s\" successfully created.' ),\n\t\t\t\t\tdecodeEntities( newTemplate.title?.rendered || title )\n\t\t\t\t),\n\t\t\t\t{\n\t\t\t\t\ttype: 'snackbar',\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 creating the template.' );\n\n\t\t\tcreateErrorNotice( errorMessage, {\n\t\t\t\ttype: 'snackbar',\n\t\t\t} );\n\t\t} finally {\n\t\t\tsetIsSubmitting( false );\n\t\t}\n\t}\n\tconst onModalClose = () => {\n\t\tonClose();\n\t\tsetModalContent( modalContentMap.templatesList );\n\t};\n\n\tlet modalTitle = __( 'Add template' );\n\tif ( modalContent === modalContentMap.customTemplate ) {\n\t\tmodalTitle = sprintf(\n\t\t\t// translators: %s: Name of the post type e.g: \"Post\".\n\t\t\t__( 'Add template: %s' ),\n\t\t\tentityForSuggestions.labels.singular_name\n\t\t);\n\t} else if ( modalContent === modalContentMap.customGenericTemplate ) {\n\t\tmodalTitle = __( 'Create custom template' );\n\t}\n\n\treturn (\n\t\t<Modal\n\t\t\ttitle={ modalTitle }\n\t\t\tclassName={ clsx( 'edit-site-add-new-template__modal', {\n\t\t\t\t'edit-site-add-new-template__modal_template_list':\n\t\t\t\t\tmodalContent === modalContentMap.templatesList,\n\t\t\t\t'edit-site-custom-template-modal':\n\t\t\t\t\tmodalContent === modalContentMap.customTemplate,\n\t\t\t} ) }\n\t\t\tonRequestClose={ onModalClose }\n\t\t\toverlayClassName={\n\t\t\t\tmodalContent === modalContentMap.customGenericTemplate\n\t\t\t\t\t? 'edit-site-custom-generic-template__modal'\n\t\t\t\t\t: undefined\n\t\t\t}\n\t\t\tref={ containerRef }\n\t\t>\n\t\t\t{ modalContent === modalContentMap.templatesList && (\n\t\t\t\t<Grid\n\t\t\t\t\tcolumns={ isMobile ? 2 : 3 }\n\t\t\t\t\tgap={ 4 }\n\t\t\t\t\talign=\"flex-start\"\n\t\t\t\t\tjustify=\"center\"\n\t\t\t\t\tclassName=\"edit-site-add-new-template__template-list__contents\"\n\t\t\t\t>\n\t\t\t\t\t<Flex className=\"edit-site-add-new-template__template-list__prompt\">\n\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t'Select what the new template should apply to:'\n\t\t\t\t\t\t) }\n\t\t\t\t\t</Flex>\n\t\t\t\t\t{ missingTemplates.map( ( template ) => {\n\t\t\t\t\t\tconst { title, slug, onClick } = template;\n\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t<TemplateListItem\n\t\t\t\t\t\t\t\tkey={ slug }\n\t\t\t\t\t\t\t\ttitle={ title }\n\t\t\t\t\t\t\t\tdirection=\"column\"\n\t\t\t\t\t\t\t\tclassName=\"edit-site-add-new-template__template-button\"\n\t\t\t\t\t\t\t\tdescription={\n\t\t\t\t\t\t\t\t\tTEMPLATE_SHORT_DESCRIPTIONS[ slug ]\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\ticon={ TEMPLATE_ICONS[ slug ] || layout }\n\t\t\t\t\t\t\t\tonClick={ () =>\n\t\t\t\t\t\t\t\t\tonClick\n\t\t\t\t\t\t\t\t\t\t? onClick( template )\n\t\t\t\t\t\t\t\t\t\t: createTemplate( template )\n\t\t\t\t\t\t\t\t}\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<TemplateListItem\n\t\t\t\t\t\ttitle={ __( 'Custom template' ) }\n\t\t\t\t\t\tdirection=\"row\"\n\t\t\t\t\t\tclassName=\"edit-site-add-new-template__custom-template-button\"\n\t\t\t\t\t\ticon={ edit }\n\t\t\t\t\t\tonClick={ () =>\n\t\t\t\t\t\t\tsetModalContent(\n\t\t\t\t\t\t\t\tmodalContentMap.customGenericTemplate\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\t<Text\n\t\t\t\t\t\t\tlineHeight={ 1.53846153846 } // 20px\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t'A custom template can be manually applied to any post or page.'\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</Text>\n\t\t\t\t\t</TemplateListItem>\n\t\t\t\t</Grid>\n\t\t\t) }\n\t\t\t{ modalContent === modalContentMap.customTemplate && (\n\t\t\t\t<AddCustomTemplateModalContent\n\t\t\t\t\tonSelect={ createTemplate }\n\t\t\t\t\tentityForSuggestions={ entityForSuggestions }\n\t\t\t\t\tonBack={ () =>\n\t\t\t\t\t\tsetModalContent( modalContentMap.templatesList )\n\t\t\t\t\t}\n\t\t\t\t\tcontainerRef={ containerRef }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ modalContent === modalContentMap.customGenericTemplate && (\n\t\t\t\t<AddCustomGenericTemplateModalContent\n\t\t\t\t\tcreateTemplate={ createTemplate }\n\t\t\t\t\tonBack={ () =>\n\t\t\t\t\t\tsetModalContent( modalContentMap.templatesList )\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t) }\n\t\t</Modal>\n\t);\n}\n\nfunction NewTemplate() {\n\tconst [ showModal, setShowModal ] = useState( false );\n\n\tconst { postType } = useSelect( ( select ) => {\n\t\tconst { getPostType } = select( coreStore );\n\n\t\treturn {\n\t\t\tpostType: getPostType( TEMPLATE_POST_TYPE ),\n\t\t};\n\t}, [] );\n\n\tif ( ! postType ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<Button\n\t\t\t\tvariant=\"primary\"\n\t\t\t\tonClick={ () => setShowModal( true ) }\n\t\t\t\tlabel={ postType.labels.add_new_item }\n\t\t\t\t__next40pxDefaultSize\n\t\t\t>\n\t\t\t\t{ postType.labels.add_new_item }\n\t\t\t</Button>\n\t\t\t{ showModal && (\n\t\t\t\t<NewTemplateModal onClose={ () => setShowModal( false ) } />\n\t\t\t) }\n\t\t</>\n\t);\n}\n\nfunction useMissingTemplates( setEntityForSuggestions, onClick ) {\n\tconst defaultTemplateTypes = useDefaultTemplateTypes();\n\tconst missingDefaultTemplates = ( defaultTemplateTypes || [] ).filter(\n\t\t( template ) => DEFAULT_TEMPLATE_SLUGS.includes( template.slug )\n\t);\n\tconst onClickMenuItem = ( _entityForSuggestions ) => {\n\t\tonClick?.();\n\t\tsetEntityForSuggestions( _entityForSuggestions );\n\t};\n\t// We need to replace existing default template types with\n\t// the create specific template functionality. The original\n\t// info (title, description, etc.) is preserved in the\n\t// used hooks.\n\tconst enhancedMissingDefaultTemplateTypes = [ ...missingDefaultTemplates ];\n\tconst { defaultTaxonomiesMenuItems, taxonomiesMenuItems } =\n\t\tuseTaxonomiesMenuItems( onClickMenuItem );\n\tconst { defaultPostTypesMenuItems, postTypesMenuItems } =\n\t\tusePostTypeMenuItems( onClickMenuItem );\n\n\tconst authorMenuItem = useAuthorMenuItem( onClickMenuItem );\n\t[\n\t\t...defaultTaxonomiesMenuItems,\n\t\t...defaultPostTypesMenuItems,\n\t\tauthorMenuItem,\n\t].forEach( ( menuItem ) => {\n\t\tif ( ! menuItem ) {\n\t\t\treturn;\n\t\t}\n\t\tconst matchIndex = enhancedMissingDefaultTemplateTypes.findIndex(\n\t\t\t( template ) => template.slug === menuItem.slug\n\t\t);\n\t\t// Some default template types might have been filtered above from\n\t\t// `missingDefaultTemplates` because they only check for the general\n\t\t// template. So here we either replace or append the item, augmented\n\t\t// with the check if it has available specific item to create a\n\t\t// template for.\n\t\tif ( matchIndex > -1 ) {\n\t\t\tenhancedMissingDefaultTemplateTypes[ matchIndex ] = menuItem;\n\t\t} else {\n\t\t\tenhancedMissingDefaultTemplateTypes.push( menuItem );\n\t\t}\n\t} );\n\t// Update the sort order to match the DEFAULT_TEMPLATE_SLUGS order.\n\tenhancedMissingDefaultTemplateTypes?.sort( ( template1, template2 ) => {\n\t\treturn (\n\t\t\tDEFAULT_TEMPLATE_SLUGS.indexOf( template1.slug ) -\n\t\t\tDEFAULT_TEMPLATE_SLUGS.indexOf( template2.slug )\n\t\t);\n\t} );\n\tconst missingTemplates = [\n\t\t...enhancedMissingDefaultTemplateTypes,\n\t\t...usePostTypeArchiveMenuItems(),\n\t\t...postTypesMenuItems,\n\t\t...taxonomiesMenuItems,\n\t];\n\treturn missingTemplates;\n}\n\nexport default memo( NewTemplate );\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,IAAI,MAAM,MAAM;;AAEvB;AACA;AACA;AACA,SACCC,MAAM,EACNC,KAAK,EACLC,kBAAkB,IAAIC,IAAI,EAC1BC,kBAAkB,IAAIC,IAAI,EAC1BC,oBAAoB,IAAIC,MAAM,EAC9BC,IAAI,EACJC,IAAI,QACE,uBAAuB;AAC9B,SAASC,cAAc,QAAQ,0BAA0B;AACzD,SAASC,QAAQ,EAAEC,IAAI,EAAEC,MAAM,EAAEC,SAAS,QAAQ,oBAAoB;AACtE,SAASC,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACxD,SAASC,KAAK,IAAIC,SAAS,QAAQ,sBAAsB;AACzD,SAASC,gBAAgB,QAAQ,oBAAoB;AACrD,SACCC,OAAO,EACPC,SAAS,EACTC,QAAQ,EACRC,QAAQ,EACRC,mBAAmB,EACnBC,IAAI,EACJC,IAAI,EACJC,MAAM,EACNC,IAAI,EACJC,KAAK,EACLC,QAAQ,EACRC,IAAI,EACJC,GAAG,EACHC,KAAK,EACLC,MAAM,EACNC,GAAG,QACG,kBAAkB;AACzB,SAASC,EAAE,EAAEC,OAAO,QAAQ,iBAAiB;AAC7C,SAASpB,KAAK,IAAIqB,YAAY,QAAQ,oBAAoB;AAC1D,SAASC,WAAW,IAAIC,iBAAiB,QAAQ,mBAAmB;AACpE,SAASC,KAAK,QAAQ,gBAAgB;;AAEtC;AACA;AACA;AACA,SAASC,kBAAkB,QAAQ,uBAAuB;;AAE1D;AACA;AACA;AACA,OAAOC,6BAA6B,MAAM,qCAAqC;AAC/E,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,EAC5BE,cAAc,CACd,CAACC,OAAO,CAAIC,QAAQ,IAAM;IAC1B,IAAK,CAAEA,QAAQ,EAAG;MACjB;IACD;IACA,MAAMC,UAAU,GAAGR,mCAAmC,CAACS,SAAS,CAC7DnD,QAAQ,IAAMA,QAAQ,CAACE,IAAI,KAAK+C,QAAQ,CAAC/C,IAC5C,CAAC;IACD;IACA;IACA;IACA;IACA;IACA,IAAKgD,UAAU,GAAG,CAAC,CAAC,EAAG;MACtBR,mCAAmC,CAAEQ,UAAU,CAAE,GAAGD,QAAQ;IAC7D,CAAC,MAAM;MACNP,mCAAmC,CAACU,IAAI,CAAEH,QAAS,CAAC;IACrD;EACD,CAAE,CAAC;EACH;EACAP,mCAAmC,EAAEW,IAAI,CAAE,CAAEC,SAAS,EAAEC,SAAS,KAAM;IACtE,OACClH,sBAAsB,CAACmH,OAAO,CAAEF,SAAS,CAACpD,IAAK,CAAC,GAChD7D,sBAAsB,CAACmH,OAAO,CAAED,SAAS,CAACrD,IAAK,CAAC;EAElD,CAAE,CAAC;EACH,MAAMrB,gBAAgB,GAAG,CACxB,GAAG6D,mCAAmC,EACtC,GAAG/G,2BAA2B,CAAC,CAAC,EAChC,GAAGmH,kBAAkB,EACrB,GAAGF,mBAAmB,CACtB;EACD,OAAO/D,gBAAgB;AACxB;AAEA,eAAetF,IAAI,CAAEsI,WAAY,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["clsx","Button","Modal","__experimentalGrid","Grid","__experimentalText","Text","__experimentalVStack","VStack","Flex","Icon","decodeEntities","useState","memo","useRef","useEffect","useSelect","useDispatch","store","coreStore","useViewportMatch","archive","blockMeta","calendar","category","commentAuthorAvatar","edit","home","layout","list","media","notFound","page","pin","verse","search","tag","__","sprintf","noticesStore","privateApis","routerPrivateApis","focus","TEMPLATE_POST_TYPE","AddCustomTemplateModalContent","useDefaultTemplateTypes","useTaxonomiesMenuItems","usePostTypeMenuItems","useAuthorMenuItem","usePostTypeArchiveMenuItems","AddCustomGenericTemplateModalContent","unlock","jsx","_jsx","jsxs","_jsxs","Fragment","_Fragment","useHistory","DEFAULT_TEMPLATE_SLUGS","TEMPLATE_ICONS","single","index","author","taxonomy","date","attachment","TemplateListItem","title","direction","className","description","icon","onClick","children","__next40pxDefaultSize","label","showTooltip","as","spacing","align","justify","style","width","alignment","weight","lineHeight","modalContentMap","templatesList","customTemplate","customGenericTemplate","NewTemplateModal","onClose","modalContent","setModalContent","entityForSuggestions","setEntityForSuggestions","isSubmitting","setIsSubmitting","missingTemplates","useMissingTemplates","history","saveEntityRecord","createErrorNotice","createSuccessNotice","containerRef","isMobile","homeUrl","select","getEntityRecord","TEMPLATE_SHORT_DESCRIPTIONS","Date","getFullYear","current","firstFocusable","focusable","find","createTemplate","template","isWPSuggestion","slug","newTemplate","toString","status","is_wp_suggestion","throwOnError","navigate","id","rendered","type","error","errorMessage","message","code","onModalClose","modalTitle","labels","singular_name","onRequestClose","overlayClassName","undefined","ref","columns","gap","map","onSelect","onBack","NewTemplate","showModal","setShowModal","postType","getPostType","variant","add_new_item","defaultTemplateTypes","missingDefaultTemplates","filter","includes","onClickMenuItem","_entityForSuggestions","enhancedMissingDefaultTemplateTypes","defaultTaxonomiesMenuItems","taxonomiesMenuItems","defaultPostTypesMenuItems","postTypesMenuItems","authorMenuItem","forEach","menuItem","matchIndex","findIndex","push","sort","template1","template2","indexOf"],"sources":["@wordpress/edit-site/src/components/add-new-template/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tButton,\n\tModal,\n\t__experimentalGrid as Grid,\n\t__experimentalText as Text,\n\t__experimentalVStack as VStack,\n\tFlex,\n\tIcon,\n} from '@wordpress/components';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { useState, memo, useRef, useEffect } from '@wordpress/element';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useViewportMatch } from '@wordpress/compose';\nimport {\n\tarchive,\n\tblockMeta,\n\tcalendar,\n\tcategory,\n\tcommentAuthorAvatar,\n\tedit,\n\thome,\n\tlayout,\n\tlist,\n\tmedia,\n\tnotFound,\n\tpage,\n\tpin,\n\tverse,\n\tsearch,\n\ttag,\n} from '@wordpress/icons';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\nimport { focus } from '@wordpress/dom';\n\n/**\n * Internal dependencies\n */\nimport { TEMPLATE_POST_TYPE } from '../../utils/constants';\n\n/**\n * Internal dependencies\n */\nimport AddCustomTemplateModalContent from './add-custom-template-modal-content';\nimport {\n\tuseDefaultTemplateTypes,\n\tuseTaxonomiesMenuItems,\n\tusePostTypeMenuItems,\n\tuseAuthorMenuItem,\n\tusePostTypeArchiveMenuItems,\n} from './utils';\nimport AddCustomGenericTemplateModalContent from './add-custom-generic-template-modal-content';\nimport { unlock } from '../../lock-unlock';\n\nconst { useHistory } = unlock( routerPrivateApis );\n\nconst DEFAULT_TEMPLATE_SLUGS = [\n\t'front-page',\n\t'home',\n\t'single',\n\t'page',\n\t'index',\n\t'archive',\n\t'author',\n\t'category',\n\t'date',\n\t'tag',\n\t'search',\n\t'404',\n];\n\nconst TEMPLATE_ICONS = {\n\t'front-page': home,\n\thome: verse,\n\tsingle: pin,\n\tpage,\n\tarchive,\n\tsearch,\n\t404: notFound,\n\tindex: list,\n\tcategory,\n\tauthor: commentAuthorAvatar,\n\ttaxonomy: blockMeta,\n\tdate: calendar,\n\ttag,\n\tattachment: media,\n};\n\nfunction TemplateListItem( {\n\ttitle,\n\tdirection,\n\tclassName,\n\tdescription,\n\ticon,\n\tonClick,\n\tchildren,\n} ) {\n\treturn (\n\t\t<Button\n\t\t\t__next40pxDefaultSize\n\t\t\tclassName={ className }\n\t\t\tonClick={ onClick }\n\t\t\tlabel={ description }\n\t\t\tshowTooltip={ !! description }\n\t\t>\n\t\t\t<Flex\n\t\t\t\tas=\"span\"\n\t\t\t\tspacing={ 2 }\n\t\t\t\talign=\"center\"\n\t\t\t\tjustify=\"center\"\n\t\t\t\tstyle={ { width: '100%' } }\n\t\t\t\tdirection={ direction }\n\t\t\t>\n\t\t\t\t<div className=\"edit-site-add-new-template__template-icon\">\n\t\t\t\t\t<Icon icon={ icon } />\n\t\t\t\t</div>\n\t\t\t\t<VStack\n\t\t\t\t\tclassName=\"edit-site-add-new-template__template-name\"\n\t\t\t\t\talignment=\"center\"\n\t\t\t\t\tspacing={ 0 }\n\t\t\t\t>\n\t\t\t\t\t<Text\n\t\t\t\t\t\talign=\"center\"\n\t\t\t\t\t\tweight={ 500 }\n\t\t\t\t\t\tlineHeight={ 1.53846153846 } // 20px\n\t\t\t\t\t>\n\t\t\t\t\t\t{ title }\n\t\t\t\t\t</Text>\n\t\t\t\t\t{ children }\n\t\t\t\t</VStack>\n\t\t\t</Flex>\n\t\t</Button>\n\t);\n}\n\nconst modalContentMap = {\n\ttemplatesList: 1,\n\tcustomTemplate: 2,\n\tcustomGenericTemplate: 3,\n};\n\nfunction NewTemplateModal( { onClose } ) {\n\tconst [ modalContent, setModalContent ] = useState(\n\t\tmodalContentMap.templatesList\n\t);\n\tconst [ entityForSuggestions, setEntityForSuggestions ] = useState( {} );\n\tconst [ isSubmitting, setIsSubmitting ] = useState( false );\n\tconst missingTemplates = useMissingTemplates( setEntityForSuggestions, () =>\n\t\tsetModalContent( modalContentMap.customTemplate )\n\t);\n\tconst history = useHistory();\n\tconst { saveEntityRecord } = useDispatch( coreStore );\n\tconst { createErrorNotice, createSuccessNotice } =\n\t\tuseDispatch( noticesStore );\n\tconst containerRef = useRef( null );\n\tconst isMobile = useViewportMatch( 'medium', '<' );\n\n\tconst homeUrl = useSelect( ( select ) => {\n\t\t// Site index.\n\t\treturn select( coreStore ).getEntityRecord( 'root', '__unstableBase' )\n\t\t\t?.home;\n\t}, [] );\n\n\tconst TEMPLATE_SHORT_DESCRIPTIONS = {\n\t\t'front-page': homeUrl,\n\t\tdate: sprintf(\n\t\t\t// translators: %s: The homepage url.\n\t\t\t__( 'E.g. %s' ),\n\t\t\thomeUrl + '/' + new Date().getFullYear()\n\t\t),\n\t};\n\n\tuseEffect( () => {\n\t\t// Focus the first focusable element when component mounts or UI changes\n\t\t// We don't want to focus on the other modals because they have their own focus management.\n\t\tif (\n\t\t\tcontainerRef.current &&\n\t\t\tmodalContent === modalContentMap.templatesList\n\t\t) {\n\t\t\tconst [ firstFocusable ] = focus.focusable.find(\n\t\t\t\tcontainerRef.current\n\t\t\t);\n\t\t\tfirstFocusable?.focus();\n\t\t}\n\t}, [ modalContent ] );\n\n\tasync function createTemplate( template, isWPSuggestion = true ) {\n\t\tif ( isSubmitting ) {\n\t\t\treturn;\n\t\t}\n\t\tsetIsSubmitting( true );\n\t\ttry {\n\t\t\tconst { title, description, slug } = template;\n\t\t\tconst newTemplate = await saveEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\tTEMPLATE_POST_TYPE,\n\t\t\t\t{\n\t\t\t\t\tdescription,\n\t\t\t\t\t// Slugs need to be strings, so this is for template `404`\n\t\t\t\t\tslug: slug.toString(),\n\t\t\t\t\tstatus: 'publish',\n\t\t\t\t\ttitle,\n\t\t\t\t\t// This adds a post meta field in template that is part of `is_custom` value calculation.\n\t\t\t\t\tis_wp_suggestion: isWPSuggestion,\n\t\t\t\t},\n\t\t\t\t{ throwOnError: true }\n\t\t\t);\n\n\t\t\t// Navigate to the created template editor.\n\t\t\thistory.navigate(\n\t\t\t\t`/${ TEMPLATE_POST_TYPE }/${ newTemplate.id }?canvas=edit`\n\t\t\t);\n\n\t\t\tcreateSuccessNotice(\n\t\t\t\tsprintf(\n\t\t\t\t\t// translators: %s: Title of the created post or template, e.g: \"Hello world\".\n\t\t\t\t\t__( '\"%s\" successfully created.' ),\n\t\t\t\t\tdecodeEntities( newTemplate.title?.rendered || title ) ||\n\t\t\t\t\t\t__( '(no title)' )\n\t\t\t\t),\n\t\t\t\t{\n\t\t\t\t\ttype: 'snackbar',\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 creating the template.' );\n\n\t\t\tcreateErrorNotice( errorMessage, {\n\t\t\t\ttype: 'snackbar',\n\t\t\t} );\n\t\t} finally {\n\t\t\tsetIsSubmitting( false );\n\t\t}\n\t}\n\tconst onModalClose = () => {\n\t\tonClose();\n\t\tsetModalContent( modalContentMap.templatesList );\n\t};\n\n\tlet modalTitle = __( 'Add template' );\n\tif ( modalContent === modalContentMap.customTemplate ) {\n\t\tmodalTitle = sprintf(\n\t\t\t// translators: %s: Name of the post type e.g: \"Post\".\n\t\t\t__( 'Add template: %s' ),\n\t\t\tentityForSuggestions.labels.singular_name\n\t\t);\n\t} else if ( modalContent === modalContentMap.customGenericTemplate ) {\n\t\tmodalTitle = __( 'Create custom template' );\n\t}\n\n\treturn (\n\t\t<Modal\n\t\t\ttitle={ modalTitle }\n\t\t\tclassName={ clsx( 'edit-site-add-new-template__modal', {\n\t\t\t\t'edit-site-add-new-template__modal_template_list':\n\t\t\t\t\tmodalContent === modalContentMap.templatesList,\n\t\t\t\t'edit-site-custom-template-modal':\n\t\t\t\t\tmodalContent === modalContentMap.customTemplate,\n\t\t\t} ) }\n\t\t\tonRequestClose={ onModalClose }\n\t\t\toverlayClassName={\n\t\t\t\tmodalContent === modalContentMap.customGenericTemplate\n\t\t\t\t\t? 'edit-site-custom-generic-template__modal'\n\t\t\t\t\t: undefined\n\t\t\t}\n\t\t\tref={ containerRef }\n\t\t>\n\t\t\t{ modalContent === modalContentMap.templatesList && (\n\t\t\t\t<Grid\n\t\t\t\t\tcolumns={ isMobile ? 2 : 3 }\n\t\t\t\t\tgap={ 4 }\n\t\t\t\t\talign=\"flex-start\"\n\t\t\t\t\tjustify=\"center\"\n\t\t\t\t\tclassName=\"edit-site-add-new-template__template-list__contents\"\n\t\t\t\t>\n\t\t\t\t\t<Flex className=\"edit-site-add-new-template__template-list__prompt\">\n\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t'Select what the new template should apply to:'\n\t\t\t\t\t\t) }\n\t\t\t\t\t</Flex>\n\t\t\t\t\t{ missingTemplates.map( ( template ) => {\n\t\t\t\t\t\tconst { title, slug, onClick } = template;\n\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t<TemplateListItem\n\t\t\t\t\t\t\t\tkey={ slug }\n\t\t\t\t\t\t\t\ttitle={ title }\n\t\t\t\t\t\t\t\tdirection=\"column\"\n\t\t\t\t\t\t\t\tclassName=\"edit-site-add-new-template__template-button\"\n\t\t\t\t\t\t\t\tdescription={\n\t\t\t\t\t\t\t\t\tTEMPLATE_SHORT_DESCRIPTIONS[ slug ]\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\ticon={ TEMPLATE_ICONS[ slug ] || layout }\n\t\t\t\t\t\t\t\tonClick={ () =>\n\t\t\t\t\t\t\t\t\tonClick\n\t\t\t\t\t\t\t\t\t\t? onClick( template )\n\t\t\t\t\t\t\t\t\t\t: createTemplate( template )\n\t\t\t\t\t\t\t\t}\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<TemplateListItem\n\t\t\t\t\t\ttitle={ __( 'Custom template' ) }\n\t\t\t\t\t\tdirection=\"row\"\n\t\t\t\t\t\tclassName=\"edit-site-add-new-template__custom-template-button\"\n\t\t\t\t\t\ticon={ edit }\n\t\t\t\t\t\tonClick={ () =>\n\t\t\t\t\t\t\tsetModalContent(\n\t\t\t\t\t\t\t\tmodalContentMap.customGenericTemplate\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\t<Text\n\t\t\t\t\t\t\tlineHeight={ 1.53846153846 } // 20px\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t'A custom template can be manually applied to any post or page.'\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</Text>\n\t\t\t\t\t</TemplateListItem>\n\t\t\t\t</Grid>\n\t\t\t) }\n\t\t\t{ modalContent === modalContentMap.customTemplate && (\n\t\t\t\t<AddCustomTemplateModalContent\n\t\t\t\t\tonSelect={ createTemplate }\n\t\t\t\t\tentityForSuggestions={ entityForSuggestions }\n\t\t\t\t\tonBack={ () =>\n\t\t\t\t\t\tsetModalContent( modalContentMap.templatesList )\n\t\t\t\t\t}\n\t\t\t\t\tcontainerRef={ containerRef }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ modalContent === modalContentMap.customGenericTemplate && (\n\t\t\t\t<AddCustomGenericTemplateModalContent\n\t\t\t\t\tcreateTemplate={ createTemplate }\n\t\t\t\t\tonBack={ () =>\n\t\t\t\t\t\tsetModalContent( modalContentMap.templatesList )\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t) }\n\t\t</Modal>\n\t);\n}\n\nfunction NewTemplate() {\n\tconst [ showModal, setShowModal ] = useState( false );\n\n\tconst { postType } = useSelect( ( select ) => {\n\t\tconst { getPostType } = select( coreStore );\n\n\t\treturn {\n\t\t\tpostType: getPostType( TEMPLATE_POST_TYPE ),\n\t\t};\n\t}, [] );\n\n\tif ( ! postType ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<Button\n\t\t\t\tvariant=\"primary\"\n\t\t\t\tonClick={ () => setShowModal( true ) }\n\t\t\t\tlabel={ postType.labels.add_new_item }\n\t\t\t\t__next40pxDefaultSize\n\t\t\t>\n\t\t\t\t{ postType.labels.add_new_item }\n\t\t\t</Button>\n\t\t\t{ showModal && (\n\t\t\t\t<NewTemplateModal onClose={ () => setShowModal( false ) } />\n\t\t\t) }\n\t\t</>\n\t);\n}\n\nfunction useMissingTemplates( setEntityForSuggestions, onClick ) {\n\tconst defaultTemplateTypes = useDefaultTemplateTypes();\n\tconst missingDefaultTemplates = ( defaultTemplateTypes || [] ).filter(\n\t\t( template ) => DEFAULT_TEMPLATE_SLUGS.includes( template.slug )\n\t);\n\tconst onClickMenuItem = ( _entityForSuggestions ) => {\n\t\tonClick?.();\n\t\tsetEntityForSuggestions( _entityForSuggestions );\n\t};\n\t// We need to replace existing default template types with\n\t// the create specific template functionality. The original\n\t// info (title, description, etc.) is preserved in the\n\t// used hooks.\n\tconst enhancedMissingDefaultTemplateTypes = [ ...missingDefaultTemplates ];\n\tconst { defaultTaxonomiesMenuItems, taxonomiesMenuItems } =\n\t\tuseTaxonomiesMenuItems( onClickMenuItem );\n\tconst { defaultPostTypesMenuItems, postTypesMenuItems } =\n\t\tusePostTypeMenuItems( onClickMenuItem );\n\n\tconst authorMenuItem = useAuthorMenuItem( onClickMenuItem );\n\t[\n\t\t...defaultTaxonomiesMenuItems,\n\t\t...defaultPostTypesMenuItems,\n\t\tauthorMenuItem,\n\t].forEach( ( menuItem ) => {\n\t\tif ( ! menuItem ) {\n\t\t\treturn;\n\t\t}\n\t\tconst matchIndex = enhancedMissingDefaultTemplateTypes.findIndex(\n\t\t\t( template ) => template.slug === menuItem.slug\n\t\t);\n\t\t// Some default template types might have been filtered above from\n\t\t// `missingDefaultTemplates` because they only check for the general\n\t\t// template. So here we either replace or append the item, augmented\n\t\t// with the check if it has available specific item to create a\n\t\t// template for.\n\t\tif ( matchIndex > -1 ) {\n\t\t\tenhancedMissingDefaultTemplateTypes[ matchIndex ] = menuItem;\n\t\t} else {\n\t\t\tenhancedMissingDefaultTemplateTypes.push( menuItem );\n\t\t}\n\t} );\n\t// Update the sort order to match the DEFAULT_TEMPLATE_SLUGS order.\n\tenhancedMissingDefaultTemplateTypes?.sort( ( template1, template2 ) => {\n\t\treturn (\n\t\t\tDEFAULT_TEMPLATE_SLUGS.indexOf( template1.slug ) -\n\t\t\tDEFAULT_TEMPLATE_SLUGS.indexOf( template2.slug )\n\t\t);\n\t} );\n\tconst missingTemplates = [\n\t\t...enhancedMissingDefaultTemplateTypes,\n\t\t...usePostTypeArchiveMenuItems(),\n\t\t...postTypesMenuItems,\n\t\t...taxonomiesMenuItems,\n\t];\n\treturn missingTemplates;\n}\n\nexport default memo( NewTemplate );\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,IAAI,MAAM,MAAM;;AAEvB;AACA;AACA;AACA,SACCC,MAAM,EACNC,KAAK,EACLC,kBAAkB,IAAIC,IAAI,EAC1BC,kBAAkB,IAAIC,IAAI,EAC1BC,oBAAoB,IAAIC,MAAM,EAC9BC,IAAI,EACJC,IAAI,QACE,uBAAuB;AAC9B,SAASC,cAAc,QAAQ,0BAA0B;AACzD,SAASC,QAAQ,EAAEC,IAAI,EAAEC,MAAM,EAAEC,SAAS,QAAQ,oBAAoB;AACtE,SAASC,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACxD,SAASC,KAAK,IAAIC,SAAS,QAAQ,sBAAsB;AACzD,SAASC,gBAAgB,QAAQ,oBAAoB;AACrD,SACCC,OAAO,EACPC,SAAS,EACTC,QAAQ,EACRC,QAAQ,EACRC,mBAAmB,EACnBC,IAAI,EACJC,IAAI,EACJC,MAAM,EACNC,IAAI,EACJC,KAAK,EACLC,QAAQ,EACRC,IAAI,EACJC,GAAG,EACHC,KAAK,EACLC,MAAM,EACNC,GAAG,QACG,kBAAkB;AACzB,SAASC,EAAE,EAAEC,OAAO,QAAQ,iBAAiB;AAC7C,SAASpB,KAAK,IAAIqB,YAAY,QAAQ,oBAAoB;AAC1D,SAASC,WAAW,IAAIC,iBAAiB,QAAQ,mBAAmB;AACpE,SAASC,KAAK,QAAQ,gBAAgB;;AAEtC;AACA;AACA;AACA,SAASC,kBAAkB,QAAQ,uBAAuB;;AAE1D;AACA;AACA;AACA,OAAOC,6BAA6B,MAAM,qCAAqC;AAC/E,SACCC,uBAAuB,EACvBC,sBAAsB,EACtBC,oBAAoB,EACpBC,iBAAiB,EACjBC,2BAA2B,QACrB,SAAS;AAChB,OAAOC,oCAAoC,MAAM,6CAA6C;AAC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;IACA,MAAMC,UAAU,GAAGR,mCAAmC,CAACS,SAAS,CAC7DnD,QAAQ,IAAMA,QAAQ,CAACE,IAAI,KAAK+C,QAAQ,CAAC/C,IAC5C,CAAC;IACD;IACA;IACA;IACA;IACA;IACA,IAAKgD,UAAU,GAAG,CAAC,CAAC,EAAG;MACtBR,mCAAmC,CAAEQ,UAAU,CAAE,GAAGD,QAAQ;IAC7D,CAAC,MAAM;MACNP,mCAAmC,CAACU,IAAI,CAAEH,QAAS,CAAC;IACrD;EACD,CAAE,CAAC;EACH;EACAP,mCAAmC,EAAEW,IAAI,CAAE,CAAEC,SAAS,EAAEC,SAAS,KAAM;IACtE,OACClH,sBAAsB,CAACmH,OAAO,CAAEF,SAAS,CAACpD,IAAK,CAAC,GAChD7D,sBAAsB,CAACmH,OAAO,CAAED,SAAS,CAACrD,IAAK,CAAC;EAElD,CAAE,CAAC;EACH,MAAMrB,gBAAgB,GAAG,CACxB,GAAG6D,mCAAmC,EACtC,GAAG/G,2BAA2B,CAAC,CAAC,EAChC,GAAGmH,kBAAkB,EACrB,GAAGF,mBAAmB,CACtB;EACD,OAAO/D,gBAAgB;AACxB;AAEA,eAAetF,IAAI,CAAEsI,WAAY,CAAC","ignoreList":[]}
|
|
@@ -182,7 +182,7 @@ export default function EditSiteEditor({
|
|
|
182
182
|
const _title = typeof newItem.title === 'string' ? newItem.title : newItem.title?.rendered;
|
|
183
183
|
createSuccessNotice(sprintf(
|
|
184
184
|
// translators: %s: Title of the created post or template, e.g: "Hello world".
|
|
185
|
-
__('"%s" successfully created.'), decodeEntities(_title)), {
|
|
185
|
+
__('"%s" successfully created.'), decodeEntities(_title) || __('(no title)')), {
|
|
186
186
|
type: 'snackbar',
|
|
187
187
|
id: 'duplicate-post-action',
|
|
188
188
|
actions: [{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["clsx","useDispatch","useSelect","Button","__unstableMotion","motion","useInstanceId","useReducedMotion","EditorKeyboardShortcutsRegister","privateApis","editorPrivateApis","store","editorStore","__","sprintf","coreDataStore","blockLibraryPrivateApis","useCallback","useMemo","noticesStore","routerPrivateApis","decodeEntities","Icon","arrowUpLeft","blockEditorStore","addQueryArgs","WelcomeGuide","editSiteStore","GlobalStylesRenderer","CanvasLoader","unlock","useSpecificEditorSettings","PluginTemplateSettingPanel","GlobalStylesSidebar","isPreviewingTheme","getEditorCanvasContainerTitle","useHasEditorCanvasContainer","SaveButton","SavePanel","SiteEditorMoreMenu","SiteIcon","useEditorIframeProps","useEditorTitle","useIsSiteEditorLoading","useAdaptEditorToCanvas","TEMPLATE_POST_TYPE","useResolveEditedEntity","useSyncDeprecatedEntityIntoState","SitePreview","jsx","_jsx","jsxs","_jsxs","Fragment","_Fragment","Editor","BackButton","useHistory","useLocation","BlockKeyboardShortcuts","toggleHomeIconVariants","edit","opacity","scale","hover","clipPath","siteIconVariants","tap","getListPathForPostType","postType","getNavigationPath","location","path","name","includes","canvas","undefined","EditSiteEditor","isHomeRoute","isPostsList","disableMotion","query","isLoading","entity","postId","context","isBlockBasedTheme","editorCanvasView","currentPostIsTrashed","hasSiteIcon","select","getEditorCanvasContainerView","getCurrentTheme","getEntityRecord","siteData","is_block_theme","getCurrentPostAttribute","site_icon_url","postWithTemplate","_isPreviewingTheme","hasDefaultEditorCanvasView","iframeProps","isEditMode","loadingProgressId","settings","styles","css","resetZoomLevel","createSuccessNotice","history","onActionPerformed","actionId","items","navigate","newItem","_title","title","rendered","type","id","actions","label","onClick","isReady","transition","duration","children","disableRootPadding","templateId","className","customSaveButton","size","customSavePanel","forceDisableBlockTools","extraSidebarPanels","Slot","length","div","animate","initial","whileHover","whileTap","__next40pxDefaultSize","showTooltip","tooltipPosition","focusMode","variants","icon"],"sources":["@wordpress/edit-site/src/components/editor/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { Button, __unstableMotion as motion } from '@wordpress/components';\nimport { useInstanceId, useReducedMotion } from '@wordpress/compose';\nimport {\n\tEditorKeyboardShortcutsRegister,\n\tprivateApis as editorPrivateApis,\n\tstore as editorStore,\n} from '@wordpress/editor';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { store as coreDataStore } from '@wordpress/core-data';\nimport { privateApis as blockLibraryPrivateApis } from '@wordpress/block-library';\nimport { useCallback, useMemo } from '@wordpress/element';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { Icon, arrowUpLeft } from '@wordpress/icons';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { addQueryArgs } from '@wordpress/url';\n\n/**\n * Internal dependencies\n */\nimport WelcomeGuide from '../welcome-guide';\nimport { store as editSiteStore } from '../../store';\nimport { GlobalStylesRenderer } from '../global-styles-renderer';\nimport CanvasLoader from '../canvas-loader';\nimport { unlock } from '../../lock-unlock';\nimport { useSpecificEditorSettings } from '../block-editor/use-site-editor-settings';\nimport PluginTemplateSettingPanel from '../plugin-template-setting-panel';\nimport GlobalStylesSidebar from '../global-styles-sidebar';\nimport { isPreviewingTheme } from '../../utils/is-previewing-theme';\nimport {\n\tgetEditorCanvasContainerTitle,\n\tuseHasEditorCanvasContainer,\n} from '../editor-canvas-container';\nimport SaveButton from '../save-button';\nimport SavePanel from '../save-panel';\nimport SiteEditorMoreMenu from '../more-menu';\nimport SiteIcon from '../site-icon';\nimport useEditorIframeProps from '../block-editor/use-editor-iframe-props';\nimport useEditorTitle from './use-editor-title';\nimport { useIsSiteEditorLoading } from '../layout/hooks';\nimport { useAdaptEditorToCanvas } from './use-adapt-editor-to-canvas';\nimport { TEMPLATE_POST_TYPE } from '../../utils/constants';\nimport {\n\tuseResolveEditedEntity,\n\tuseSyncDeprecatedEntityIntoState,\n} from './use-resolve-edited-entity';\nimport SitePreview from './site-preview';\n\nconst { Editor, BackButton } = unlock( editorPrivateApis );\nconst { useHistory, useLocation } = unlock( routerPrivateApis );\nconst { BlockKeyboardShortcuts } = unlock( blockLibraryPrivateApis );\n\nconst toggleHomeIconVariants = {\n\tedit: {\n\t\topacity: 0,\n\t\tscale: 0.2,\n\t},\n\thover: {\n\t\topacity: 1,\n\t\tscale: 1,\n\t\tclipPath: 'inset( 22% round 2px )',\n\t},\n};\n\nconst siteIconVariants = {\n\tedit: {\n\t\tclipPath: 'inset(0% round 0px)',\n\t},\n\thover: {\n\t\tclipPath: 'inset( 22% round 2px )',\n\t},\n\ttap: {\n\t\tclipPath: 'inset(0% round 0px)',\n\t},\n};\n\nfunction getListPathForPostType( postType ) {\n\tswitch ( postType ) {\n\t\tcase 'navigation':\n\t\t\treturn '/navigation';\n\t\tcase 'wp_block':\n\t\t\treturn '/pattern?postType=wp_block';\n\t\tcase 'wp_template_part':\n\t\t\treturn '/pattern?postType=wp_template_part';\n\t\tcase 'wp_template':\n\t\t\treturn '/template';\n\t\tcase 'page':\n\t\t\treturn '/page';\n\t\tcase 'post':\n\t\t\treturn '/';\n\t}\n\tthrow 'Unknown post type';\n}\n\nfunction getNavigationPath( location, postType ) {\n\tconst { path, name } = location;\n\tif (\n\t\t[\n\t\t\t'pattern-item',\n\t\t\t'template-part-item',\n\t\t\t'page-item',\n\t\t\t'template-item',\n\t\t\t'static-template-item',\n\t\t\t'post-item',\n\t\t].includes( name )\n\t) {\n\t\treturn getListPathForPostType( postType );\n\t}\n\treturn addQueryArgs( path, { canvas: undefined } );\n}\n\nexport default function EditSiteEditor( {\n\tisHomeRoute = false,\n\tisPostsList = false,\n} ) {\n\tconst disableMotion = useReducedMotion();\n\tconst location = useLocation();\n\tconst { canvas = 'view' } = location.query;\n\tconst isLoading = useIsSiteEditorLoading();\n\tuseAdaptEditorToCanvas( canvas );\n\tconst entity = useResolveEditedEntity();\n\t// deprecated sync state with url\n\tuseSyncDeprecatedEntityIntoState( entity );\n\tconst { postType, postId, context } = entity;\n\tconst {\n\t\tisBlockBasedTheme,\n\t\teditorCanvasView,\n\t\tcurrentPostIsTrashed,\n\t\thasSiteIcon,\n\t} = useSelect( ( select ) => {\n\t\tconst { getEditorCanvasContainerView } = unlock(\n\t\t\tselect( editSiteStore )\n\t\t);\n\t\tconst { getCurrentTheme, getEntityRecord } = select( coreDataStore );\n\t\tconst siteData = getEntityRecord( 'root', '__unstableBase', undefined );\n\n\t\treturn {\n\t\t\tisBlockBasedTheme: getCurrentTheme()?.is_block_theme,\n\t\t\teditorCanvasView: getEditorCanvasContainerView(),\n\t\t\tcurrentPostIsTrashed:\n\t\t\t\tselect( editorStore ).getCurrentPostAttribute( 'status' ) ===\n\t\t\t\t'trash',\n\t\t\thasSiteIcon: !! siteData?.site_icon_url,\n\t\t};\n\t}, [] );\n\tconst postWithTemplate = !! context?.postId;\n\tuseEditorTitle(\n\t\tpostWithTemplate ? context.postType : postType,\n\t\tpostWithTemplate ? context.postId : postId\n\t);\n\tconst _isPreviewingTheme = isPreviewingTheme();\n\tconst hasDefaultEditorCanvasView = ! useHasEditorCanvasContainer();\n\tconst iframeProps = useEditorIframeProps();\n\tconst isEditMode = canvas === 'edit';\n\tconst loadingProgressId = useInstanceId(\n\t\tCanvasLoader,\n\t\t'edit-site-editor__loading-progress'\n\t);\n\n\tconst settings = useSpecificEditorSettings();\n\tconst styles = useMemo(\n\t\t() => [\n\t\t\t...settings.styles,\n\t\t\t{\n\t\t\t\t// Forming a \"block formatting context\" to prevent margin collapsing.\n\t\t\t\t// @see https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Block_formatting_context\n\t\t\t\tcss:\n\t\t\t\t\tcanvas === 'view'\n\t\t\t\t\t\t? `body{min-height: 100vh; ${\n\t\t\t\t\t\t\t\tcurrentPostIsTrashed ? '' : 'cursor: pointer;'\n\t\t\t\t\t\t }}`\n\t\t\t\t\t\t: undefined,\n\t\t\t},\n\t\t],\n\t\t[ settings.styles, canvas, currentPostIsTrashed ]\n\t);\n\tconst { resetZoomLevel } = unlock( useDispatch( blockEditorStore ) );\n\tconst { createSuccessNotice } = useDispatch( noticesStore );\n\tconst history = useHistory();\n\tconst onActionPerformed = useCallback(\n\t\t( actionId, items ) => {\n\t\t\tswitch ( actionId ) {\n\t\t\t\tcase 'move-to-trash':\n\t\t\t\tcase 'delete-post':\n\t\t\t\t\t{\n\t\t\t\t\t\thistory.navigate(\n\t\t\t\t\t\t\tgetListPathForPostType(\n\t\t\t\t\t\t\t\tpostWithTemplate ? context.postType : postType\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\tbreak;\n\t\t\t\tcase 'duplicate-post':\n\t\t\t\t\t{\n\t\t\t\t\t\tconst newItem = items[ 0 ];\n\t\t\t\t\t\tconst _title =\n\t\t\t\t\t\t\ttypeof newItem.title === 'string'\n\t\t\t\t\t\t\t\t? newItem.title\n\t\t\t\t\t\t\t\t: newItem.title?.rendered;\n\t\t\t\t\t\tcreateSuccessNotice(\n\t\t\t\t\t\t\tsprintf(\n\t\t\t\t\t\t\t\t// translators: %s: Title of the created post or template, e.g: \"Hello world\".\n\t\t\t\t\t\t\t\t__( '\"%s\" successfully created.' ),\n\t\t\t\t\t\t\t\tdecodeEntities( _title )\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\t\t\t\tid: 'duplicate-post-action',\n\t\t\t\t\t\t\t\tactions: [\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tlabel: __( 'Edit' ),\n\t\t\t\t\t\t\t\t\t\tonClick: () => {\n\t\t\t\t\t\t\t\t\t\t\thistory.navigate(\n\t\t\t\t\t\t\t\t\t\t\t\t`/${ newItem.type }/${ newItem.id }?canvas=edit`\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}\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t},\n\t\t[\n\t\t\tpostType,\n\t\t\tcontext?.postType,\n\t\t\tpostWithTemplate,\n\t\t\thistory,\n\t\t\tcreateSuccessNotice,\n\t\t]\n\t);\n\n\t// Replace the title and icon displayed in the DocumentBar when there's an overlay visible.\n\tconst title = getEditorCanvasContainerTitle( editorCanvasView );\n\n\tconst isReady = ! isLoading;\n\tconst transition = {\n\t\tduration: disableMotion ? 0 : 0.2,\n\t};\n\n\treturn ! isBlockBasedTheme && isHomeRoute ? (\n\t\t<SitePreview />\n\t) : (\n\t\t<>\n\t\t\t<GlobalStylesRenderer\n\t\t\t\tdisableRootPadding={ postType !== TEMPLATE_POST_TYPE }\n\t\t\t/>\n\t\t\t<EditorKeyboardShortcutsRegister />\n\t\t\t{ isEditMode && <BlockKeyboardShortcuts /> }\n\t\t\t{ ! isReady ? <CanvasLoader id={ loadingProgressId } /> : null }\n\t\t\t{ isEditMode && (\n\t\t\t\t<WelcomeGuide\n\t\t\t\t\tpostType={ postWithTemplate ? context.postType : postType }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ isReady && (\n\t\t\t\t<Editor\n\t\t\t\t\tpostType={ postWithTemplate ? context.postType : postType }\n\t\t\t\t\tpostId={ postWithTemplate ? context.postId : postId }\n\t\t\t\t\ttemplateId={ postWithTemplate ? postId : undefined }\n\t\t\t\t\tsettings={ settings }\n\t\t\t\t\tclassName=\"edit-site-editor__editor-interface\"\n\t\t\t\t\tstyles={ styles }\n\t\t\t\t\tcustomSaveButton={\n\t\t\t\t\t\t_isPreviewingTheme && <SaveButton size=\"compact\" />\n\t\t\t\t\t}\n\t\t\t\t\tcustomSavePanel={ _isPreviewingTheme && <SavePanel /> }\n\t\t\t\t\tforceDisableBlockTools={ ! hasDefaultEditorCanvasView }\n\t\t\t\t\ttitle={ title }\n\t\t\t\t\tiframeProps={ iframeProps }\n\t\t\t\t\tonActionPerformed={ onActionPerformed }\n\t\t\t\t\textraSidebarPanels={\n\t\t\t\t\t\t! postWithTemplate && (\n\t\t\t\t\t\t\t<PluginTemplateSettingPanel.Slot />\n\t\t\t\t\t\t)\n\t\t\t\t\t}\n\t\t\t\t>\n\t\t\t\t\t{ isEditMode && (\n\t\t\t\t\t\t<BackButton>\n\t\t\t\t\t\t\t{ ( { length } ) =>\n\t\t\t\t\t\t\t\tlength <= 1 && (\n\t\t\t\t\t\t\t\t\t<motion.div\n\t\t\t\t\t\t\t\t\t\tclassName=\"edit-site-editor__view-mode-toggle\"\n\t\t\t\t\t\t\t\t\t\ttransition={ transition }\n\t\t\t\t\t\t\t\t\t\tanimate=\"edit\"\n\t\t\t\t\t\t\t\t\t\tinitial=\"edit\"\n\t\t\t\t\t\t\t\t\t\twhileHover=\"hover\"\n\t\t\t\t\t\t\t\t\t\twhileTap=\"tap\"\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\t\t\t\t\tlabel={ __( 'Open Navigation' ) }\n\t\t\t\t\t\t\t\t\t\t\tshowTooltip\n\t\t\t\t\t\t\t\t\t\t\ttooltipPosition=\"middle right\"\n\t\t\t\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\t\t\t\tresetZoomLevel();\n\n\t\t\t\t\t\t\t\t\t\t\t\t// TODO: this is a temporary solution to navigate to the posts list if we are\n\t\t\t\t\t\t\t\t\t\t\t\t// come here through `posts list` and are in focus mode editing a template, template part etc..\n\t\t\t\t\t\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\t\t\t\t\t\tisPostsList &&\n\t\t\t\t\t\t\t\t\t\t\t\t\tlocation.query?.focusMode\n\t\t\t\t\t\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\t\t\t\t\t\thistory.navigate( '/', {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\ttransition:\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'canvas-mode-view-transition',\n\t\t\t\t\t\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\t\t\t\thistory.navigate(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tgetNavigationPath(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tlocation,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tpostWithTemplate\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t? context.postType\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t: postType\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\ttransition:\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'canvas-mode-view-transition',\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t\t\t}\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\t\t<motion.div\n\t\t\t\t\t\t\t\t\t\t\t\tvariants={ siteIconVariants }\n\t\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t\t<SiteIcon className=\"edit-site-editor__view-mode-toggle-icon\" />\n\t\t\t\t\t\t\t\t\t\t\t</motion.div>\n\t\t\t\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t\t\t\t\t<motion.div\n\t\t\t\t\t\t\t\t\t\t\tclassName={ clsx(\n\t\t\t\t\t\t\t\t\t\t\t\t'edit-site-editor__back-icon',\n\t\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\t\t'has-site-icon':\n\t\t\t\t\t\t\t\t\t\t\t\t\t\thasSiteIcon,\n\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t\tvariants={ toggleHomeIconVariants }\n\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t<Icon icon={ arrowUpLeft } />\n\t\t\t\t\t\t\t\t\t\t</motion.div>\n\t\t\t\t\t\t\t\t\t</motion.div>\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t</BackButton>\n\t\t\t\t\t) }\n\t\t\t\t\t<SiteEditorMoreMenu />\n\t\t\t\t\t{ isBlockBasedTheme && <GlobalStylesSidebar /> }\n\t\t\t\t</Editor>\n\t\t\t) }\n\t\t</>\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,IAAI,MAAM,MAAM;;AAEvB;AACA;AACA;AACA,SAASC,WAAW,EAAEC,SAAS,QAAQ,iBAAiB;AACxD,SAASC,MAAM,EAAEC,gBAAgB,IAAIC,MAAM,QAAQ,uBAAuB;AAC1E,SAASC,aAAa,EAAEC,gBAAgB,QAAQ,oBAAoB;AACpE,SACCC,+BAA+B,EAC/BC,WAAW,IAAIC,iBAAiB,EAChCC,KAAK,IAAIC,WAAW,QACd,mBAAmB;AAC1B,SAASC,EAAE,EAAEC,OAAO,QAAQ,iBAAiB;AAC7C,SAASH,KAAK,IAAII,aAAa,QAAQ,sBAAsB;AAC7D,SAASN,WAAW,IAAIO,uBAAuB,QAAQ,0BAA0B;AACjF,SAASC,WAAW,EAAEC,OAAO,QAAQ,oBAAoB;AACzD,SAASP,KAAK,IAAIQ,YAAY,QAAQ,oBAAoB;AAC1D,SAASV,WAAW,IAAIW,iBAAiB,QAAQ,mBAAmB;AACpE,SAASC,cAAc,QAAQ,0BAA0B;AACzD,SAASC,IAAI,EAAEC,WAAW,QAAQ,kBAAkB;AACpD,SAASZ,KAAK,IAAIa,gBAAgB,QAAQ,yBAAyB;AACnE,SAASC,YAAY,QAAQ,gBAAgB;;AAE7C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EACxB;gBACDpC,OAAO,CAACI,QAAQ,CAAE,GAAG,EAAE;kBACtBW,UAAU,EACT;gBACF,CAAE,CAAC;cACJ,CAAC,MAAM;gBACNf,OAAO,CAACI,QAAQ,CACf3C,iBAAiB,CAChBC,QAAQ,EACR2B,gBAAgB,GACbb,OAAO,CAAChB,QAAQ,GAChBA,QACJ,CAAC,EACD;kBACCuD,UAAU,EACT;gBACF,CACD,CAAC;cACF;YACD,CAAG;YAAAE,QAAA,eAEH5E,IAAA,CAAC7C,MAAM,CAACoI,GAAG;cACVS,QAAQ,EAAGhF,gBAAkB;cAAA4D,QAAA,eAE7B5E,IAAA,CAACV,QAAQ;gBAACyF,SAAS,EAAC;cAAyC,CAAE;YAAC,CACrD;UAAC,CACN,CAAC,eACT/E,IAAA,CAAC7C,MAAM,CAACoI,GAAG;YACVR,SAAS,EAAGjI,IAAI,CACf,6BAA6B,EAC7B;cACC,eAAe,EACdyF;YACF,CACD,CAAG;YACHyD,QAAQ,EAAGtF,sBAAwB;YAAAkE,QAAA,eAEnC5E,IAAA,CAAC5B,IAAI;cAAC6H,IAAI,EAAG5H;YAAa,CAAE;UAAC,CAClB,CAAC;QAAA,CACF;MACZ,CAES,CACZ,eACD2B,IAAA,CAACX,kBAAkB,IAAE,CAAC,EACpB+C,iBAAiB,iBAAIpC,IAAA,CAACjB,mBAAmB,IAAE,CAAC;IAAA,CACvC,CACR;EAAA,CACA,CACF;AACF","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["clsx","useDispatch","useSelect","Button","__unstableMotion","motion","useInstanceId","useReducedMotion","EditorKeyboardShortcutsRegister","privateApis","editorPrivateApis","store","editorStore","__","sprintf","coreDataStore","blockLibraryPrivateApis","useCallback","useMemo","noticesStore","routerPrivateApis","decodeEntities","Icon","arrowUpLeft","blockEditorStore","addQueryArgs","WelcomeGuide","editSiteStore","GlobalStylesRenderer","CanvasLoader","unlock","useSpecificEditorSettings","PluginTemplateSettingPanel","GlobalStylesSidebar","isPreviewingTheme","getEditorCanvasContainerTitle","useHasEditorCanvasContainer","SaveButton","SavePanel","SiteEditorMoreMenu","SiteIcon","useEditorIframeProps","useEditorTitle","useIsSiteEditorLoading","useAdaptEditorToCanvas","TEMPLATE_POST_TYPE","useResolveEditedEntity","useSyncDeprecatedEntityIntoState","SitePreview","jsx","_jsx","jsxs","_jsxs","Fragment","_Fragment","Editor","BackButton","useHistory","useLocation","BlockKeyboardShortcuts","toggleHomeIconVariants","edit","opacity","scale","hover","clipPath","siteIconVariants","tap","getListPathForPostType","postType","getNavigationPath","location","path","name","includes","canvas","undefined","EditSiteEditor","isHomeRoute","isPostsList","disableMotion","query","isLoading","entity","postId","context","isBlockBasedTheme","editorCanvasView","currentPostIsTrashed","hasSiteIcon","select","getEditorCanvasContainerView","getCurrentTheme","getEntityRecord","siteData","is_block_theme","getCurrentPostAttribute","site_icon_url","postWithTemplate","_isPreviewingTheme","hasDefaultEditorCanvasView","iframeProps","isEditMode","loadingProgressId","settings","styles","css","resetZoomLevel","createSuccessNotice","history","onActionPerformed","actionId","items","navigate","newItem","_title","title","rendered","type","id","actions","label","onClick","isReady","transition","duration","children","disableRootPadding","templateId","className","customSaveButton","size","customSavePanel","forceDisableBlockTools","extraSidebarPanels","Slot","length","div","animate","initial","whileHover","whileTap","__next40pxDefaultSize","showTooltip","tooltipPosition","focusMode","variants","icon"],"sources":["@wordpress/edit-site/src/components/editor/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { Button, __unstableMotion as motion } from '@wordpress/components';\nimport { useInstanceId, useReducedMotion } from '@wordpress/compose';\nimport {\n\tEditorKeyboardShortcutsRegister,\n\tprivateApis as editorPrivateApis,\n\tstore as editorStore,\n} from '@wordpress/editor';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { store as coreDataStore } from '@wordpress/core-data';\nimport { privateApis as blockLibraryPrivateApis } from '@wordpress/block-library';\nimport { useCallback, useMemo } from '@wordpress/element';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { Icon, arrowUpLeft } from '@wordpress/icons';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { addQueryArgs } from '@wordpress/url';\n\n/**\n * Internal dependencies\n */\nimport WelcomeGuide from '../welcome-guide';\nimport { store as editSiteStore } from '../../store';\nimport { GlobalStylesRenderer } from '../global-styles-renderer';\nimport CanvasLoader from '../canvas-loader';\nimport { unlock } from '../../lock-unlock';\nimport { useSpecificEditorSettings } from '../block-editor/use-site-editor-settings';\nimport PluginTemplateSettingPanel from '../plugin-template-setting-panel';\nimport GlobalStylesSidebar from '../global-styles-sidebar';\nimport { isPreviewingTheme } from '../../utils/is-previewing-theme';\nimport {\n\tgetEditorCanvasContainerTitle,\n\tuseHasEditorCanvasContainer,\n} from '../editor-canvas-container';\nimport SaveButton from '../save-button';\nimport SavePanel from '../save-panel';\nimport SiteEditorMoreMenu from '../more-menu';\nimport SiteIcon from '../site-icon';\nimport useEditorIframeProps from '../block-editor/use-editor-iframe-props';\nimport useEditorTitle from './use-editor-title';\nimport { useIsSiteEditorLoading } from '../layout/hooks';\nimport { useAdaptEditorToCanvas } from './use-adapt-editor-to-canvas';\nimport { TEMPLATE_POST_TYPE } from '../../utils/constants';\nimport {\n\tuseResolveEditedEntity,\n\tuseSyncDeprecatedEntityIntoState,\n} from './use-resolve-edited-entity';\nimport SitePreview from './site-preview';\n\nconst { Editor, BackButton } = unlock( editorPrivateApis );\nconst { useHistory, useLocation } = unlock( routerPrivateApis );\nconst { BlockKeyboardShortcuts } = unlock( blockLibraryPrivateApis );\n\nconst toggleHomeIconVariants = {\n\tedit: {\n\t\topacity: 0,\n\t\tscale: 0.2,\n\t},\n\thover: {\n\t\topacity: 1,\n\t\tscale: 1,\n\t\tclipPath: 'inset( 22% round 2px )',\n\t},\n};\n\nconst siteIconVariants = {\n\tedit: {\n\t\tclipPath: 'inset(0% round 0px)',\n\t},\n\thover: {\n\t\tclipPath: 'inset( 22% round 2px )',\n\t},\n\ttap: {\n\t\tclipPath: 'inset(0% round 0px)',\n\t},\n};\n\nfunction getListPathForPostType( postType ) {\n\tswitch ( postType ) {\n\t\tcase 'navigation':\n\t\t\treturn '/navigation';\n\t\tcase 'wp_block':\n\t\t\treturn '/pattern?postType=wp_block';\n\t\tcase 'wp_template_part':\n\t\t\treturn '/pattern?postType=wp_template_part';\n\t\tcase 'wp_template':\n\t\t\treturn '/template';\n\t\tcase 'page':\n\t\t\treturn '/page';\n\t\tcase 'post':\n\t\t\treturn '/';\n\t}\n\tthrow 'Unknown post type';\n}\n\nfunction getNavigationPath( location, postType ) {\n\tconst { path, name } = location;\n\tif (\n\t\t[\n\t\t\t'pattern-item',\n\t\t\t'template-part-item',\n\t\t\t'page-item',\n\t\t\t'template-item',\n\t\t\t'static-template-item',\n\t\t\t'post-item',\n\t\t].includes( name )\n\t) {\n\t\treturn getListPathForPostType( postType );\n\t}\n\treturn addQueryArgs( path, { canvas: undefined } );\n}\n\nexport default function EditSiteEditor( {\n\tisHomeRoute = false,\n\tisPostsList = false,\n} ) {\n\tconst disableMotion = useReducedMotion();\n\tconst location = useLocation();\n\tconst { canvas = 'view' } = location.query;\n\tconst isLoading = useIsSiteEditorLoading();\n\tuseAdaptEditorToCanvas( canvas );\n\tconst entity = useResolveEditedEntity();\n\t// deprecated sync state with url\n\tuseSyncDeprecatedEntityIntoState( entity );\n\tconst { postType, postId, context } = entity;\n\tconst {\n\t\tisBlockBasedTheme,\n\t\teditorCanvasView,\n\t\tcurrentPostIsTrashed,\n\t\thasSiteIcon,\n\t} = useSelect( ( select ) => {\n\t\tconst { getEditorCanvasContainerView } = unlock(\n\t\t\tselect( editSiteStore )\n\t\t);\n\t\tconst { getCurrentTheme, getEntityRecord } = select( coreDataStore );\n\t\tconst siteData = getEntityRecord( 'root', '__unstableBase', undefined );\n\n\t\treturn {\n\t\t\tisBlockBasedTheme: getCurrentTheme()?.is_block_theme,\n\t\t\teditorCanvasView: getEditorCanvasContainerView(),\n\t\t\tcurrentPostIsTrashed:\n\t\t\t\tselect( editorStore ).getCurrentPostAttribute( 'status' ) ===\n\t\t\t\t'trash',\n\t\t\thasSiteIcon: !! siteData?.site_icon_url,\n\t\t};\n\t}, [] );\n\tconst postWithTemplate = !! context?.postId;\n\tuseEditorTitle(\n\t\tpostWithTemplate ? context.postType : postType,\n\t\tpostWithTemplate ? context.postId : postId\n\t);\n\tconst _isPreviewingTheme = isPreviewingTheme();\n\tconst hasDefaultEditorCanvasView = ! useHasEditorCanvasContainer();\n\tconst iframeProps = useEditorIframeProps();\n\tconst isEditMode = canvas === 'edit';\n\tconst loadingProgressId = useInstanceId(\n\t\tCanvasLoader,\n\t\t'edit-site-editor__loading-progress'\n\t);\n\n\tconst settings = useSpecificEditorSettings();\n\tconst styles = useMemo(\n\t\t() => [\n\t\t\t...settings.styles,\n\t\t\t{\n\t\t\t\t// Forming a \"block formatting context\" to prevent margin collapsing.\n\t\t\t\t// @see https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Block_formatting_context\n\t\t\t\tcss:\n\t\t\t\t\tcanvas === 'view'\n\t\t\t\t\t\t? `body{min-height: 100vh; ${\n\t\t\t\t\t\t\t\tcurrentPostIsTrashed ? '' : 'cursor: pointer;'\n\t\t\t\t\t\t }}`\n\t\t\t\t\t\t: undefined,\n\t\t\t},\n\t\t],\n\t\t[ settings.styles, canvas, currentPostIsTrashed ]\n\t);\n\tconst { resetZoomLevel } = unlock( useDispatch( blockEditorStore ) );\n\tconst { createSuccessNotice } = useDispatch( noticesStore );\n\tconst history = useHistory();\n\tconst onActionPerformed = useCallback(\n\t\t( actionId, items ) => {\n\t\t\tswitch ( actionId ) {\n\t\t\t\tcase 'move-to-trash':\n\t\t\t\tcase 'delete-post':\n\t\t\t\t\t{\n\t\t\t\t\t\thistory.navigate(\n\t\t\t\t\t\t\tgetListPathForPostType(\n\t\t\t\t\t\t\t\tpostWithTemplate ? context.postType : postType\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\tbreak;\n\t\t\t\tcase 'duplicate-post':\n\t\t\t\t\t{\n\t\t\t\t\t\tconst newItem = items[ 0 ];\n\t\t\t\t\t\tconst _title =\n\t\t\t\t\t\t\ttypeof newItem.title === 'string'\n\t\t\t\t\t\t\t\t? newItem.title\n\t\t\t\t\t\t\t\t: newItem.title?.rendered;\n\t\t\t\t\t\tcreateSuccessNotice(\n\t\t\t\t\t\t\tsprintf(\n\t\t\t\t\t\t\t\t// translators: %s: Title of the created post or template, e.g: \"Hello world\".\n\t\t\t\t\t\t\t\t__( '\"%s\" successfully created.' ),\n\t\t\t\t\t\t\t\tdecodeEntities( _title ) || __( '(no title)' )\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\t\t\t\tid: 'duplicate-post-action',\n\t\t\t\t\t\t\t\tactions: [\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tlabel: __( 'Edit' ),\n\t\t\t\t\t\t\t\t\t\tonClick: () => {\n\t\t\t\t\t\t\t\t\t\t\thistory.navigate(\n\t\t\t\t\t\t\t\t\t\t\t\t`/${ newItem.type }/${ newItem.id }?canvas=edit`\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}\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t},\n\t\t[\n\t\t\tpostType,\n\t\t\tcontext?.postType,\n\t\t\tpostWithTemplate,\n\t\t\thistory,\n\t\t\tcreateSuccessNotice,\n\t\t]\n\t);\n\n\t// Replace the title and icon displayed in the DocumentBar when there's an overlay visible.\n\tconst title = getEditorCanvasContainerTitle( editorCanvasView );\n\n\tconst isReady = ! isLoading;\n\tconst transition = {\n\t\tduration: disableMotion ? 0 : 0.2,\n\t};\n\n\treturn ! isBlockBasedTheme && isHomeRoute ? (\n\t\t<SitePreview />\n\t) : (\n\t\t<>\n\t\t\t<GlobalStylesRenderer\n\t\t\t\tdisableRootPadding={ postType !== TEMPLATE_POST_TYPE }\n\t\t\t/>\n\t\t\t<EditorKeyboardShortcutsRegister />\n\t\t\t{ isEditMode && <BlockKeyboardShortcuts /> }\n\t\t\t{ ! isReady ? <CanvasLoader id={ loadingProgressId } /> : null }\n\t\t\t{ isEditMode && (\n\t\t\t\t<WelcomeGuide\n\t\t\t\t\tpostType={ postWithTemplate ? context.postType : postType }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ isReady && (\n\t\t\t\t<Editor\n\t\t\t\t\tpostType={ postWithTemplate ? context.postType : postType }\n\t\t\t\t\tpostId={ postWithTemplate ? context.postId : postId }\n\t\t\t\t\ttemplateId={ postWithTemplate ? postId : undefined }\n\t\t\t\t\tsettings={ settings }\n\t\t\t\t\tclassName=\"edit-site-editor__editor-interface\"\n\t\t\t\t\tstyles={ styles }\n\t\t\t\t\tcustomSaveButton={\n\t\t\t\t\t\t_isPreviewingTheme && <SaveButton size=\"compact\" />\n\t\t\t\t\t}\n\t\t\t\t\tcustomSavePanel={ _isPreviewingTheme && <SavePanel /> }\n\t\t\t\t\tforceDisableBlockTools={ ! hasDefaultEditorCanvasView }\n\t\t\t\t\ttitle={ title }\n\t\t\t\t\tiframeProps={ iframeProps }\n\t\t\t\t\tonActionPerformed={ onActionPerformed }\n\t\t\t\t\textraSidebarPanels={\n\t\t\t\t\t\t! postWithTemplate && (\n\t\t\t\t\t\t\t<PluginTemplateSettingPanel.Slot />\n\t\t\t\t\t\t)\n\t\t\t\t\t}\n\t\t\t\t>\n\t\t\t\t\t{ isEditMode && (\n\t\t\t\t\t\t<BackButton>\n\t\t\t\t\t\t\t{ ( { length } ) =>\n\t\t\t\t\t\t\t\tlength <= 1 && (\n\t\t\t\t\t\t\t\t\t<motion.div\n\t\t\t\t\t\t\t\t\t\tclassName=\"edit-site-editor__view-mode-toggle\"\n\t\t\t\t\t\t\t\t\t\ttransition={ transition }\n\t\t\t\t\t\t\t\t\t\tanimate=\"edit\"\n\t\t\t\t\t\t\t\t\t\tinitial=\"edit\"\n\t\t\t\t\t\t\t\t\t\twhileHover=\"hover\"\n\t\t\t\t\t\t\t\t\t\twhileTap=\"tap\"\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\t\t\t\t\tlabel={ __( 'Open Navigation' ) }\n\t\t\t\t\t\t\t\t\t\t\tshowTooltip\n\t\t\t\t\t\t\t\t\t\t\ttooltipPosition=\"middle right\"\n\t\t\t\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\t\t\t\tresetZoomLevel();\n\n\t\t\t\t\t\t\t\t\t\t\t\t// TODO: this is a temporary solution to navigate to the posts list if we are\n\t\t\t\t\t\t\t\t\t\t\t\t// come here through `posts list` and are in focus mode editing a template, template part etc..\n\t\t\t\t\t\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\t\t\t\t\t\tisPostsList &&\n\t\t\t\t\t\t\t\t\t\t\t\t\tlocation.query?.focusMode\n\t\t\t\t\t\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\t\t\t\t\t\thistory.navigate( '/', {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\ttransition:\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'canvas-mode-view-transition',\n\t\t\t\t\t\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\t\t\t\thistory.navigate(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tgetNavigationPath(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tlocation,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tpostWithTemplate\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t? context.postType\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t: postType\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\ttransition:\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'canvas-mode-view-transition',\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t\t\t}\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\t\t<motion.div\n\t\t\t\t\t\t\t\t\t\t\t\tvariants={ siteIconVariants }\n\t\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t\t<SiteIcon className=\"edit-site-editor__view-mode-toggle-icon\" />\n\t\t\t\t\t\t\t\t\t\t\t</motion.div>\n\t\t\t\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t\t\t\t\t<motion.div\n\t\t\t\t\t\t\t\t\t\t\tclassName={ clsx(\n\t\t\t\t\t\t\t\t\t\t\t\t'edit-site-editor__back-icon',\n\t\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\t\t'has-site-icon':\n\t\t\t\t\t\t\t\t\t\t\t\t\t\thasSiteIcon,\n\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t\tvariants={ toggleHomeIconVariants }\n\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t<Icon icon={ arrowUpLeft } />\n\t\t\t\t\t\t\t\t\t\t</motion.div>\n\t\t\t\t\t\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bb,OAAO,CAAChB,QAAQ,GAChBA,QACJ,CAAC,EACD;kBACCuD,UAAU,EACT;gBACF,CACD,CAAC;cACF;YACD,CAAG;YAAAE,QAAA,eAEH5E,IAAA,CAAC7C,MAAM,CAACoI,GAAG;cACVS,QAAQ,EAAGhF,gBAAkB;cAAA4D,QAAA,eAE7B5E,IAAA,CAACV,QAAQ;gBAACyF,SAAS,EAAC;cAAyC,CAAE;YAAC,CACrD;UAAC,CACN,CAAC,eACT/E,IAAA,CAAC7C,MAAM,CAACoI,GAAG;YACVR,SAAS,EAAGjI,IAAI,CACf,6BAA6B,EAC7B;cACC,eAAe,EACdyF;YACF,CACD,CAAG;YACHyD,QAAQ,EAAGtF,sBAAwB;YAAAkE,QAAA,eAEnC5E,IAAA,CAAC5B,IAAI;cAAC6H,IAAI,EAAG5H;YAAa,CAAE;UAAC,CAClB,CAAC;QAAA,CACF;MACZ,CAES,CACZ,eACD2B,IAAA,CAACX,kBAAkB,IAAE,CAAC,EACpB+C,iBAAiB,iBAAIpC,IAAA,CAACjB,mBAAmB,IAAE,CAAC;IAAA,CACvC,CACR;EAAA,CACA,CACF;AACF","ignoreList":[]}
|
|
@@ -26,7 +26,7 @@ const {
|
|
|
26
26
|
usePostFields,
|
|
27
27
|
PostCardPanel
|
|
28
28
|
} = unlock(editorPrivateApis);
|
|
29
|
-
const fieldsWithBulkEditSupport = ['title', 'status', 'date', 'author', '
|
|
29
|
+
const fieldsWithBulkEditSupport = ['title', 'status', 'date', 'author', 'discussion'];
|
|
30
30
|
function PostEditForm({
|
|
31
31
|
postType,
|
|
32
32
|
postId
|
|
@@ -77,7 +77,12 @@ function PostEditForm({
|
|
|
77
77
|
id: 'status',
|
|
78
78
|
label: __('Status & Visibility'),
|
|
79
79
|
children: ['status', 'password']
|
|
80
|
-
}, 'author', 'date', 'slug', 'parent',
|
|
80
|
+
}, 'author', 'date', 'slug', 'parent', {
|
|
81
|
+
id: 'discussion',
|
|
82
|
+
label: __('Discussion'),
|
|
83
|
+
children: ['comment_status', 'ping_status'],
|
|
84
|
+
summary: 'discussion'
|
|
85
|
+
}, {
|
|
81
86
|
label: __('Template'),
|
|
82
87
|
id: 'template',
|
|
83
88
|
layout: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["clsx","__","DataForm","useDispatch","useSelect","store","coreDataStore","__experimentalVStack","VStack","useState","useMemo","useEffect","privateApis","editorPrivateApis","Page","unlock","usePatternSettings","blockEditorPrivateApis","jsx","_jsx","jsxs","_jsxs","usePostFields","PostCardPanel","fieldsWithBulkEditSupport","PostEditForm","postType","postId","ids","split","record","hasFinishedResolution","select","args","getEditedEntityRecord","hasFinished","length","multiEdits","setMultiEdits","editEntityRecord","fields","_fields","map","field","id","elements","filter","element","value","form","layout","type","label","children","labelPosition","includes","onChange","edits","status","Date","date","password","prev","ExperimentalBlockEditorProvider","settings","fieldsWithDependency","Edit","data","spacing","PostEdit","className"],"sources":["@wordpress/edit-site/src/components/post-edit/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { DataForm } from '@wordpress/dataviews';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { store as coreDataStore } from '@wordpress/core-data';\nimport { __experimentalVStack as VStack } from '@wordpress/components';\nimport { useState, useMemo, useEffect } from '@wordpress/element';\nimport { privateApis as editorPrivateApis } from '@wordpress/editor';\n\n/**\n * Internal dependencies\n */\nimport Page from '../page';\nimport { unlock } from '../../lock-unlock';\nimport usePatternSettings from '../page-patterns/use-pattern-settings';\nimport { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';\n\nconst { usePostFields, PostCardPanel } = unlock( editorPrivateApis );\n\nconst fieldsWithBulkEditSupport = [\n\t'title',\n\t'status',\n\t'date',\n\t'author',\n\t'comment_status',\n];\n\nfunction PostEditForm( { postType, postId } ) {\n\tconst ids = useMemo( () => postId.split( ',' ), [ postId ] );\n\tconst { record, hasFinishedResolution } = useSelect(\n\t\t( select ) => {\n\t\t\tconst args = [ 'postType', postType, ids[ 0 ] ];\n\n\t\t\tconst {\n\t\t\t\tgetEditedEntityRecord,\n\t\t\t\thasFinishedResolution: hasFinished,\n\t\t\t} = select( coreDataStore );\n\n\t\t\treturn {\n\t\t\t\trecord:\n\t\t\t\t\tids.length === 1 ? getEditedEntityRecord( ...args ) : null,\n\t\t\t\thasFinishedResolution: hasFinished(\n\t\t\t\t\t'getEditedEntityRecord',\n\t\t\t\t\targs\n\t\t\t\t),\n\t\t\t};\n\t\t},\n\t\t[ postType, ids ]\n\t);\n\tconst [ multiEdits, setMultiEdits ] = useState( {} );\n\tconst { editEntityRecord } = useDispatch( coreDataStore );\n\tconst { fields: _fields } = usePostFields( { postType } );\n\tconst fields = useMemo(\n\t\t() =>\n\t\t\t_fields?.map( ( field ) => {\n\t\t\t\tif ( field.id === 'status' ) {\n\t\t\t\t\treturn {\n\t\t\t\t\t\t...field,\n\t\t\t\t\t\telements: field.elements.filter(\n\t\t\t\t\t\t\t( element ) => element.value !== 'trash'\n\t\t\t\t\t\t),\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t\treturn field;\n\t\t\t} ),\n\t\t[ _fields ]\n\t);\n\n\tconst form = useMemo(\n\t\t() => ( {\n\t\t\tlayout: {\n\t\t\t\ttype: 'panel',\n\t\t\t},\n\t\t\tfields: [\n\t\t\t\t{\n\t\t\t\t\tid: 'featured_media',\n\t\t\t\t\tlayout: {\n\t\t\t\t\t\ttype: 'regular',\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tid: 'status',\n\t\t\t\t\tlabel: __( 'Status & Visibility' ),\n\t\t\t\t\tchildren: [ 'status', 'password' ],\n\t\t\t\t},\n\t\t\t\t'author',\n\t\t\t\t'date',\n\t\t\t\t'slug',\n\t\t\t\t'parent',\n\t\t\t\t'comment_status',\n\t\t\t\t{\n\t\t\t\t\tlabel: __( 'Template' ),\n\t\t\t\t\tid: 'template',\n\t\t\t\t\tlayout: {\n\t\t\t\t\t\ttype: 'regular',\n\t\t\t\t\t\tlabelPosition: 'side',\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t].filter(\n\t\t\t\t( field ) =>\n\t\t\t\t\tids.length === 1 ||\n\t\t\t\t\tfieldsWithBulkEditSupport.includes( field )\n\t\t\t),\n\t\t} ),\n\t\t[ ids ]\n\t);\n\tconst onChange = ( edits ) => {\n\t\tfor ( const id of ids ) {\n\t\t\tif (\n\t\t\t\tedits.status &&\n\t\t\t\tedits.status !== 'future' &&\n\t\t\t\trecord?.status === 'future' &&\n\t\t\t\tnew Date( record.date ) > new Date()\n\t\t\t) {\n\t\t\t\tedits.date = null;\n\t\t\t}\n\t\t\tif (\n\t\t\t\tedits.status &&\n\t\t\t\tedits.status === 'private' &&\n\t\t\t\trecord.password\n\t\t\t) {\n\t\t\t\tedits.password = '';\n\t\t\t}\n\t\t\teditEntityRecord( 'postType', postType, id, edits );\n\t\t\tif ( ids.length > 1 ) {\n\t\t\t\tsetMultiEdits( ( prev ) => ( {\n\t\t\t\t\t...prev,\n\t\t\t\t\t...edits,\n\t\t\t\t} ) );\n\t\t\t}\n\t\t}\n\t};\n\tuseEffect( () => {\n\t\tsetMultiEdits( {} );\n\t}, [ ids ] );\n\n\tconst { ExperimentalBlockEditorProvider } = unlock(\n\t\tblockEditorPrivateApis\n\t);\n\tconst settings = usePatternSettings();\n\n\t/**\n\t * The template field depends on the block editor settings.\n\t * This is a workaround to ensure that the block editor settings are available.\n\t * For more information, see: https://github.com/WordPress/gutenberg/issues/67521\n\t */\n\tconst fieldsWithDependency = useMemo( () => {\n\t\treturn fields.map( ( field ) => {\n\t\t\tif ( field.id === 'template' ) {\n\t\t\t\treturn {\n\t\t\t\t\t...field,\n\t\t\t\t\tEdit: ( data ) => (\n\t\t\t\t\t\t<ExperimentalBlockEditorProvider settings={ settings }>\n\t\t\t\t\t\t\t<field.Edit { ...data } />\n\t\t\t\t\t\t</ExperimentalBlockEditorProvider>\n\t\t\t\t\t),\n\t\t\t\t};\n\t\t\t}\n\t\t\treturn field;\n\t\t} );\n\t}, [ fields, settings ] );\n\n\treturn (\n\t\t<VStack spacing={ 4 }>\n\t\t\t<PostCardPanel postType={ postType } postId={ ids } />\n\t\t\t{ hasFinishedResolution && (\n\t\t\t\t<DataForm\n\t\t\t\t\tdata={ ids.length === 1 ? record : multiEdits }\n\t\t\t\t\tfields={ fieldsWithDependency }\n\t\t\t\t\tform={ form }\n\t\t\t\t\tonChange={ onChange }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</VStack>\n\t);\n}\n\nexport function PostEdit( { postType, postId } ) {\n\treturn (\n\t\t<Page\n\t\t\tclassName={ clsx( 'edit-site-post-edit', {\n\t\t\t\t'is-empty': ! postId,\n\t\t\t} ) }\n\t\t\tlabel={ __( 'Post Edit' ) }\n\t\t>\n\t\t\t{ postId && (\n\t\t\t\t<PostEditForm postType={ postType } postId={ postId } />\n\t\t\t) }\n\t\t\t{ ! postId && <p>{ __( 'Select a page to edit' ) }</p> }\n\t\t</Page>\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,IAAI,MAAM,MAAM;;AAEvB;AACA;AACA;AACA,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SAASC,QAAQ,QAAQ,sBAAsB;AAC/C,SAASC,WAAW,EAAEC,SAAS,QAAQ,iBAAiB;AACxD,SAASC,KAAK,IAAIC,aAAa,QAAQ,sBAAsB;AAC7D,SAASC,oBAAoB,IAAIC,MAAM,QAAQ,uBAAuB;AACtE,SAASC,QAAQ,EAAEC,OAAO,EAAEC,SAAS,QAAQ,oBAAoB;AACjE,SAASC,WAAW,IAAIC,iBAAiB,QAAQ,mBAAmB;;AAEpE;AACA;AACA;AACA,OAAOC,IAAI,MAAM,SAAS;AAC1B,SAASC,MAAM,QAAQ,mBAAmB;AAC1C,OAAOC,kBAAkB,MAAM,uCAAuC;AACtE,SAASJ,WAAW,IAAIK,sBA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ACC3C,KAAA,CAACb,MAAM;IAAC4D,OAAO,EAAG,CAAG;IAAAf,QAAA,gBACpBlC,IAAA,CAACI,aAAa;MAACG,QAAQ,EAAGA,QAAU;MAACC,MAAM,EAAGC;IAAK,CAAE,CAAC,EACpDG,qBAAqB,iBACtBZ,IAAA,CAACjB,QAAQ;MACRiE,IAAI,EAAGvC,GAAG,CAACQ,MAAM,KAAK,CAAC,GAAGN,MAAM,GAAGO,UAAY;MAC/CG,MAAM,EAAGyB,oBAAsB;MAC/BhB,IAAI,EAAGA,IAAM;MACbO,QAAQ,EAAGA;IAAU,CACrB,CACD;EAAA,CACM,CAAC;AAEX;AAEA,OAAO,SAASa,QAAQA,CAAE;EAAE3C,QAAQ;EAAEC;AAAO,CAAC,EAAG;EAChD,oBACCN,KAAA,CAACP,IAAI;IACJwD,SAAS,EAAGtE,IAAI,CAAE,qBAAqB,EAAE;MACxC,UAAU,EAAE,CAAE2B;IACf,CAAE,CAAG;IACLyB,KAAK,EAAGnD,EAAE,CAAE,WAAY,CAAG;IAAAoD,QAAA,GAEzB1B,MAAM,iBACPR,IAAA,CAACM,YAAY;MAACC,QAAQ,EAAGA,QAAU;MAACC,MAAM,EAAGA;IAAQ,CAAE,CACvD,EACC,CAAEA,MAAM,iBAAIR,IAAA;MAAAkC,QAAA,EAAKpD,EAAE,CAAE,uBAAwB;IAAC,CAAK,CAAC;EAAA,CACjD,CAAC;AAET","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["clsx","__","DataForm","useDispatch","useSelect","store","coreDataStore","__experimentalVStack","VStack","useState","useMemo","useEffect","privateApis","editorPrivateApis","Page","unlock","usePatternSettings","blockEditorPrivateApis","jsx","_jsx","jsxs","_jsxs","usePostFields","PostCardPanel","fieldsWithBulkEditSupport","PostEditForm","postType","postId","ids","split","record","hasFinishedResolution","select","args","getEditedEntityRecord","hasFinished","length","multiEdits","setMultiEdits","editEntityRecord","fields","_fields","map","field","id","elements","filter","element","value","form","layout","type","label","children","summary","labelPosition","includes","onChange","edits","status","Date","date","password","prev","ExperimentalBlockEditorProvider","settings","fieldsWithDependency","Edit","data","spacing","PostEdit","className"],"sources":["@wordpress/edit-site/src/components/post-edit/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { DataForm } from '@wordpress/dataviews';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { store as coreDataStore } from '@wordpress/core-data';\nimport { __experimentalVStack as VStack } from '@wordpress/components';\nimport { useState, useMemo, useEffect } from '@wordpress/element';\nimport { privateApis as editorPrivateApis } from '@wordpress/editor';\n\n/**\n * Internal dependencies\n */\nimport Page from '../page';\nimport { unlock } from '../../lock-unlock';\nimport usePatternSettings from '../page-patterns/use-pattern-settings';\nimport { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';\n\nconst { usePostFields, PostCardPanel } = unlock( editorPrivateApis );\n\nconst fieldsWithBulkEditSupport = [\n\t'title',\n\t'status',\n\t'date',\n\t'author',\n\t'discussion',\n];\n\nfunction PostEditForm( { postType, postId } ) {\n\tconst ids = useMemo( () => postId.split( ',' ), [ postId ] );\n\tconst { record, hasFinishedResolution } = useSelect(\n\t\t( select ) => {\n\t\t\tconst args = [ 'postType', postType, ids[ 0 ] ];\n\n\t\t\tconst {\n\t\t\t\tgetEditedEntityRecord,\n\t\t\t\thasFinishedResolution: hasFinished,\n\t\t\t} = select( coreDataStore );\n\n\t\t\treturn {\n\t\t\t\trecord:\n\t\t\t\t\tids.length === 1 ? getEditedEntityRecord( ...args ) : null,\n\t\t\t\thasFinishedResolution: hasFinished(\n\t\t\t\t\t'getEditedEntityRecord',\n\t\t\t\t\targs\n\t\t\t\t),\n\t\t\t};\n\t\t},\n\t\t[ postType, ids ]\n\t);\n\tconst [ multiEdits, setMultiEdits ] = useState( {} );\n\tconst { editEntityRecord } = useDispatch( coreDataStore );\n\tconst { fields: _fields } = usePostFields( { postType } );\n\tconst fields = useMemo(\n\t\t() =>\n\t\t\t_fields?.map( ( field ) => {\n\t\t\t\tif ( field.id === 'status' ) {\n\t\t\t\t\treturn {\n\t\t\t\t\t\t...field,\n\t\t\t\t\t\telements: field.elements.filter(\n\t\t\t\t\t\t\t( element ) => element.value !== 'trash'\n\t\t\t\t\t\t),\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t\treturn field;\n\t\t\t} ),\n\t\t[ _fields ]\n\t);\n\n\tconst form = useMemo(\n\t\t() => ( {\n\t\t\tlayout: {\n\t\t\t\ttype: 'panel',\n\t\t\t},\n\t\t\tfields: [\n\t\t\t\t{\n\t\t\t\t\tid: 'featured_media',\n\t\t\t\t\tlayout: {\n\t\t\t\t\t\ttype: 'regular',\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tid: 'status',\n\t\t\t\t\tlabel: __( 'Status & Visibility' ),\n\t\t\t\t\tchildren: [ 'status', 'password' ],\n\t\t\t\t},\n\t\t\t\t'author',\n\t\t\t\t'date',\n\t\t\t\t'slug',\n\t\t\t\t'parent',\n\t\t\t\t{\n\t\t\t\t\tid: 'discussion',\n\t\t\t\t\tlabel: __( 'Discussion' ),\n\t\t\t\t\tchildren: [ 'comment_status', 'ping_status' ],\n\t\t\t\t\tsummary: 'discussion',\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tlabel: __( 'Template' ),\n\t\t\t\t\tid: 'template',\n\t\t\t\t\tlayout: {\n\t\t\t\t\t\ttype: 'regular',\n\t\t\t\t\t\tlabelPosition: 'side',\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t].filter(\n\t\t\t\t( field ) =>\n\t\t\t\t\tids.length === 1 ||\n\t\t\t\t\tfieldsWithBulkEditSupport.includes( field )\n\t\t\t),\n\t\t} ),\n\t\t[ ids ]\n\t);\n\tconst onChange = ( edits ) => {\n\t\tfor ( const id of ids ) {\n\t\t\tif (\n\t\t\t\tedits.status &&\n\t\t\t\tedits.status !== 'future' &&\n\t\t\t\trecord?.status === 'future' &&\n\t\t\t\tnew Date( record.date ) > new Date()\n\t\t\t) {\n\t\t\t\tedits.date = null;\n\t\t\t}\n\t\t\tif (\n\t\t\t\tedits.status &&\n\t\t\t\tedits.status === 'private' &&\n\t\t\t\trecord.password\n\t\t\t) {\n\t\t\t\tedits.password = '';\n\t\t\t}\n\t\t\teditEntityRecord( 'postType', postType, id, edits );\n\t\t\tif ( ids.length > 1 ) {\n\t\t\t\tsetMultiEdits( ( prev ) => ( {\n\t\t\t\t\t...prev,\n\t\t\t\t\t...edits,\n\t\t\t\t} ) );\n\t\t\t}\n\t\t}\n\t};\n\tuseEffect( () => {\n\t\tsetMultiEdits( {} );\n\t}, [ ids ] );\n\n\tconst { ExperimentalBlockEditorProvider } = unlock(\n\t\tblockEditorPrivateApis\n\t);\n\tconst settings = usePatternSettings();\n\n\t/**\n\t * The template field depends on the block editor settings.\n\t * This is a workaround to ensure that the block editor settings are available.\n\t * For more information, see: https://github.com/WordPress/gutenberg/issues/67521\n\t */\n\tconst fieldsWithDependency = useMemo( () => {\n\t\treturn fields.map( ( field ) => {\n\t\t\tif ( field.id === 'template' ) {\n\t\t\t\treturn {\n\t\t\t\t\t...field,\n\t\t\t\t\tEdit: ( data ) => (\n\t\t\t\t\t\t<ExperimentalBlockEditorProvider settings={ settings }>\n\t\t\t\t\t\t\t<field.Edit { ...data } />\n\t\t\t\t\t\t</ExperimentalBlockEditorProvider>\n\t\t\t\t\t),\n\t\t\t\t};\n\t\t\t}\n\t\t\treturn field;\n\t\t} );\n\t}, [ fields, settings ] );\n\n\treturn (\n\t\t<VStack spacing={ 4 }>\n\t\t\t<PostCardPanel postType={ postType } postId={ ids } />\n\t\t\t{ hasFinishedResolution && (\n\t\t\t\t<DataForm\n\t\t\t\t\tdata={ ids.length === 1 ? record : multiEdits }\n\t\t\t\t\tfields={ fieldsWithDependency }\n\t\t\t\t\tform={ form }\n\t\t\t\t\tonChange={ onChange }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</VStack>\n\t);\n}\n\nexport function PostEdit( { postType, postId } ) {\n\treturn (\n\t\t<Page\n\t\t\tclassName={ clsx( 'edit-site-post-edit', {\n\t\t\t\t'is-empty': ! postId,\n\t\t\t} ) }\n\t\t\tlabel={ __( 'Post Edit' ) }\n\t\t>\n\t\t\t{ postId && (\n\t\t\t\t<PostEditForm postType={ postType } postId={ postId } />\n\t\t\t) }\n\t\t\t{ ! postId && <p>{ __( 'Select a page to edit' ) }</p> }\n\t\t</Page>\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,IAAI,MAAM,MAAM;;AAEvB;AACA;AACA;AACA,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SAASC,QAAQ,QAAQ,sBAAsB;AAC/C,SAASC,WAAW,EAAEC,SAAS,QAAQ,iBAAiB;AACxD,SAASC,KAAK,IAAIC,aAAa,QAAQ,sBAAsB;AAC7D,SAASC,oBAAoB,IAAIC,MAAM,QAAQ,uBAAuB;AACtE,SAASC,QAAQ,EAAEC,OAAO,EAAEC,SAAS,QAAQ,oBAAoB;AACjE,SAASC,WAAW,IAAIC,iBAAiB,QAAQ,mBAAmB;;AAEpE;AACA;AACA;AACA,OAAOC,IAAI,MAAM,SAAS;AAC1B,SAASC,MAAM,QAAQ,mBAAmB;AAC1C,OAAOC,kBAAkB,MAAM,uCAAuC;AACtE,SAASJ,WAAW,IAAIK,sBAAsB,QAAQ,yBAAyB;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAEhF,MAAM;EAAEC,aAAa;EAAEC;AAAc,CAAC,GAAGR,MAAM,CAAEF,iBAAkB,CAAC;AAEpE,MAAMW,yBAAyB,GAAG,CACjC,OAAO,EACP,QAAQ,EACR,MAAM,EACN,QAAQ,EACR,YAAY,CACZ;AAED,SAASC,YAAYA,CAAE;EAAEC,QAAQ;EAAEC;AAAO,CAAC,EAAG;EAC7C,MAAMC,GAAG,GAAGlB,OAAO,CAAE,MA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AGxC,GAAG,CAACQ,MAAM,KAAK,CAAC,GAAGN,MAAM,GAAGO,UAAY;MAC/CG,MAAM,EAAG0B,oBAAsB;MAC/BjB,IAAI,EAAGA,IAAM;MACbQ,QAAQ,EAAGA;IAAU,CACrB,CACD;EAAA,CACM,CAAC;AAEX;AAEA,OAAO,SAASa,QAAQA,CAAE;EAAE5C,QAAQ;EAAEC;AAAO,CAAC,EAAG;EAChD,oBACCN,KAAA,CAACP,IAAI;IACJyD,SAAS,EAAGvE,IAAI,CAAE,qBAAqB,EAAE;MACxC,UAAU,EAAE,CAAE2B;IACf,CAAE,CAAG;IACLyB,KAAK,EAAGnD,EAAE,CAAE,WAAY,CAAG;IAAAoD,QAAA,GAEzB1B,MAAM,iBACPR,IAAA,CAACM,YAAY;MAACC,QAAQ,EAAGA,QAAU;MAACC,MAAM,EAAGA;IAAQ,CAAE,CACvD,EACC,CAAEA,MAAM,iBAAIR,IAAA;MAAAkC,QAAA,EAAKpD,EAAE,CAAE,uBAAwB;IAAC,CAAK,CAAC;EAAA,CACjD,CAAC;AAET","ignoreList":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wordpress/edit-site",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.32.0",
|
|
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.
|
|
34
|
-
"@wordpress/api-fetch": "^7.
|
|
35
|
-
"@wordpress/blob": "^4.
|
|
36
|
-
"@wordpress/block-editor": "^15.
|
|
37
|
-
"@wordpress/block-library": "^9.
|
|
38
|
-
"@wordpress/blocks": "^15.
|
|
39
|
-
"@wordpress/commands": "^1.
|
|
40
|
-
"@wordpress/components": "^30.5.
|
|
41
|
-
"@wordpress/compose": "^7.
|
|
42
|
-
"@wordpress/core-data": "^7.
|
|
43
|
-
"@wordpress/data": "^10.
|
|
44
|
-
"@wordpress/dataviews": "^9.1.
|
|
45
|
-
"@wordpress/date": "^5.
|
|
46
|
-
"@wordpress/deprecated": "^4.
|
|
47
|
-
"@wordpress/dom": "^4.
|
|
48
|
-
"@wordpress/editor": "^14.
|
|
49
|
-
"@wordpress/element": "^6.
|
|
50
|
-
"@wordpress/escape-html": "^3.
|
|
51
|
-
"@wordpress/fields": "^0.
|
|
52
|
-
"@wordpress/hooks": "^4.
|
|
53
|
-
"@wordpress/html-entities": "^4.
|
|
54
|
-
"@wordpress/i18n": "^6.
|
|
55
|
-
"@wordpress/icons": "^10.
|
|
56
|
-
"@wordpress/keyboard-shortcuts": "^5.
|
|
57
|
-
"@wordpress/keycodes": "^4.
|
|
58
|
-
"@wordpress/media-utils": "^5.
|
|
59
|
-
"@wordpress/notices": "^5.
|
|
60
|
-
"@wordpress/patterns": "^2.
|
|
61
|
-
"@wordpress/plugins": "^7.
|
|
62
|
-
"@wordpress/preferences": "^4.
|
|
63
|
-
"@wordpress/primitives": "^4.
|
|
64
|
-
"@wordpress/private-apis": "^1.
|
|
65
|
-
"@wordpress/reusable-blocks": "^5.
|
|
66
|
-
"@wordpress/router": "^1.
|
|
67
|
-
"@wordpress/style-engine": "^2.
|
|
68
|
-
"@wordpress/url": "^4.
|
|
69
|
-
"@wordpress/viewport": "^6.
|
|
70
|
-
"@wordpress/widgets": "^4.
|
|
71
|
-
"@wordpress/wordcount": "^4.
|
|
33
|
+
"@wordpress/a11y": "^4.32.0",
|
|
34
|
+
"@wordpress/api-fetch": "^7.32.0",
|
|
35
|
+
"@wordpress/blob": "^4.32.0",
|
|
36
|
+
"@wordpress/block-editor": "^15.5.0",
|
|
37
|
+
"@wordpress/block-library": "^9.32.0",
|
|
38
|
+
"@wordpress/blocks": "^15.5.0",
|
|
39
|
+
"@wordpress/commands": "^1.32.0",
|
|
40
|
+
"@wordpress/components": "^30.5.0",
|
|
41
|
+
"@wordpress/compose": "^7.32.0",
|
|
42
|
+
"@wordpress/core-data": "^7.32.0",
|
|
43
|
+
"@wordpress/data": "^10.32.0",
|
|
44
|
+
"@wordpress/dataviews": "^9.1.0",
|
|
45
|
+
"@wordpress/date": "^5.32.0",
|
|
46
|
+
"@wordpress/deprecated": "^4.32.0",
|
|
47
|
+
"@wordpress/dom": "^4.32.0",
|
|
48
|
+
"@wordpress/editor": "^14.32.0",
|
|
49
|
+
"@wordpress/element": "^6.32.0",
|
|
50
|
+
"@wordpress/escape-html": "^3.32.0",
|
|
51
|
+
"@wordpress/fields": "^0.24.0",
|
|
52
|
+
"@wordpress/hooks": "^4.32.0",
|
|
53
|
+
"@wordpress/html-entities": "^4.32.0",
|
|
54
|
+
"@wordpress/i18n": "^6.5.0",
|
|
55
|
+
"@wordpress/icons": "^10.32.0",
|
|
56
|
+
"@wordpress/keyboard-shortcuts": "^5.32.0",
|
|
57
|
+
"@wordpress/keycodes": "^4.32.0",
|
|
58
|
+
"@wordpress/media-utils": "^5.32.0",
|
|
59
|
+
"@wordpress/notices": "^5.32.0",
|
|
60
|
+
"@wordpress/patterns": "^2.32.0",
|
|
61
|
+
"@wordpress/plugins": "^7.32.0",
|
|
62
|
+
"@wordpress/preferences": "^4.32.0",
|
|
63
|
+
"@wordpress/primitives": "^4.32.0",
|
|
64
|
+
"@wordpress/private-apis": "^1.32.0",
|
|
65
|
+
"@wordpress/reusable-blocks": "^5.32.0",
|
|
66
|
+
"@wordpress/router": "^1.32.0",
|
|
67
|
+
"@wordpress/style-engine": "^2.32.0",
|
|
68
|
+
"@wordpress/url": "^4.32.0",
|
|
69
|
+
"@wordpress/viewport": "^6.32.0",
|
|
70
|
+
"@wordpress/widgets": "^4.32.0",
|
|
71
|
+
"@wordpress/wordcount": "^4.32.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": "a030b4c0e0695239b942c7dc18511782b64f10ed"
|
|
87
87
|
}
|
|
@@ -66,7 +66,8 @@ export default function AddNewPostModal( { postType, onSave, onClose } ) {
|
|
|
66
66
|
sprintf(
|
|
67
67
|
// translators: %s: Title of the created post or template, e.g: "Hello world".
|
|
68
68
|
__( '"%s" successfully created.' ),
|
|
69
|
-
decodeEntities( newPage.title?.rendered || title )
|
|
69
|
+
decodeEntities( newPage.title?.rendered || title ) ||
|
|
70
|
+
__( '(no title)' )
|
|
70
71
|
),
|
|
71
72
|
{ type: 'snackbar' }
|
|
72
73
|
);
|
|
@@ -225,7 +225,8 @@ function NewTemplateModal( { onClose } ) {
|
|
|
225
225
|
sprintf(
|
|
226
226
|
// translators: %s: Title of the created post or template, e.g: "Hello world".
|
|
227
227
|
__( '"%s" successfully created.' ),
|
|
228
|
-
decodeEntities( newTemplate.title?.rendered || title )
|
|
228
|
+
decodeEntities( newTemplate.title?.rendered || title ) ||
|
|
229
|
+
__( '(no title)' )
|
|
229
230
|
),
|
|
230
231
|
{
|
|
231
232
|
type: 'snackbar',
|
|
@@ -211,7 +211,7 @@ export default function EditSiteEditor( {
|
|
|
211
211
|
sprintf(
|
|
212
212
|
// translators: %s: Title of the created post or template, e.g: "Hello world".
|
|
213
213
|
__( '"%s" successfully created.' ),
|
|
214
|
-
decodeEntities( _title )
|
|
214
|
+
decodeEntities( _title ) || __( '(no title)' )
|
|
215
215
|
),
|
|
216
216
|
{
|
|
217
217
|
type: 'snackbar',
|
|
@@ -29,7 +29,7 @@ const fieldsWithBulkEditSupport = [
|
|
|
29
29
|
'status',
|
|
30
30
|
'date',
|
|
31
31
|
'author',
|
|
32
|
-
'
|
|
32
|
+
'discussion',
|
|
33
33
|
];
|
|
34
34
|
|
|
35
35
|
function PostEditForm( { postType, postId } ) {
|
|
@@ -94,7 +94,12 @@ function PostEditForm( { postType, postId } ) {
|
|
|
94
94
|
'date',
|
|
95
95
|
'slug',
|
|
96
96
|
'parent',
|
|
97
|
-
|
|
97
|
+
{
|
|
98
|
+
id: 'discussion',
|
|
99
|
+
label: __( 'Discussion' ),
|
|
100
|
+
children: [ 'comment_status', 'ping_status' ],
|
|
101
|
+
summary: 'discussion',
|
|
102
|
+
},
|
|
98
103
|
{
|
|
99
104
|
label: __( 'Template' ),
|
|
100
105
|
id: 'template',
|