@wordpress/editor 14.4.0 → 14.5.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/bindings/post-meta.js +12 -0
- package/build/bindings/post-meta.js.map +1 -1
- package/build/components/blog-title/index.js +1 -1
- package/build/components/blog-title/index.js.map +1 -1
- package/build/components/commands/index.js +8 -2
- package/build/components/commands/index.js.map +1 -1
- package/build/components/document-bar/index.js +1 -1
- package/build/components/document-bar/index.js.map +1 -1
- package/build/components/header/index.js +2 -3
- package/build/components/header/index.js.map +1 -1
- package/build/components/page-attributes/parent.js +6 -2
- package/build/components/page-attributes/parent.js.map +1 -1
- package/build/components/post-actions/actions.js +38 -344
- package/build/components/post-actions/actions.js.map +1 -1
- package/build/components/post-actions/index.js +16 -6
- package/build/components/post-actions/index.js.map +1 -1
- package/build/components/post-author/hook.js +10 -3
- package/build/components/post-author/hook.js.map +1 -1
- package/build/components/post-author/panel.js +2 -1
- package/build/components/post-author/panel.js.map +1 -1
- package/build/components/post-card-panel/index.js +1 -1
- package/build/components/post-card-panel/index.js.map +1 -1
- package/build/components/post-comments/index.js +6 -20
- package/build/components/post-comments/index.js.map +1 -1
- package/build/components/post-status/index.js +17 -41
- package/build/components/post-status/index.js.map +1 -1
- package/build/components/post-template/create-new-template-modal.js +3 -0
- package/build/components/post-template/create-new-template-modal.js.map +1 -1
- package/build/components/post-url/panel.js +3 -2
- package/build/components/post-url/panel.js.map +1 -1
- package/build/components/preview-dropdown/index.js +82 -17
- package/build/components/preview-dropdown/index.js.map +1 -1
- package/build/components/provider/disable-non-page-content-blocks.js +14 -18
- package/build/components/provider/disable-non-page-content-blocks.js.map +1 -1
- package/build/components/site-discussion/index.js +6 -20
- package/build/components/site-discussion/index.js.map +1 -1
- package/build/components/template-content-panel/index.js +14 -12
- package/build/components/template-content-panel/index.js.map +1 -1
- package/build/components/visual-editor/index.js +2 -1
- package/build/components/visual-editor/index.js.map +1 -1
- package/build/dataviews/actions/export-pattern.native.js +9 -0
- package/build/dataviews/actions/export-pattern.native.js.map +1 -0
- package/build/dataviews/actions/permanently-delete-post.js +107 -0
- package/build/dataviews/actions/permanently-delete-post.js.map +1 -0
- package/build/dataviews/actions/restore-post.js +112 -0
- package/build/dataviews/actions/restore-post.js.map +1 -0
- package/build/dataviews/actions/trash-post.js +142 -0
- package/build/dataviews/actions/trash-post.js.map +1 -0
- package/build/dataviews/store/private-actions.js +45 -0
- package/build/dataviews/store/private-actions.js.map +1 -1
- package/build/dataviews/store/private-selectors.js +10 -10
- package/build/dataviews/store/private-selectors.js.map +1 -1
- package/build/dataviews/store/reducer.js +15 -1
- package/build/dataviews/store/reducer.js.map +1 -1
- package/build/dataviews/types.js.map +1 -1
- package/build/private-apis.js +0 -2
- package/build/private-apis.js.map +1 -1
- package/build/store/actions.js +16 -2
- package/build/store/actions.js.map +1 -1
- package/build/store/private-actions.js +8 -1
- package/build/store/private-actions.js.map +1 -1
- package/build/store/private-selectors.js +33 -2
- package/build/store/private-selectors.js.map +1 -1
- package/build-module/bindings/post-meta.js +12 -0
- package/build-module/bindings/post-meta.js.map +1 -1
- package/build-module/components/blog-title/index.js +1 -1
- package/build-module/components/blog-title/index.js.map +1 -1
- package/build-module/components/commands/index.js +8 -2
- package/build-module/components/commands/index.js.map +1 -1
- package/build-module/components/document-bar/index.js +1 -1
- package/build-module/components/document-bar/index.js.map +1 -1
- package/build-module/components/header/index.js +2 -3
- package/build-module/components/header/index.js.map +1 -1
- package/build-module/components/page-attributes/parent.js +7 -3
- package/build-module/components/page-attributes/parent.js.map +1 -1
- package/build-module/components/post-actions/actions.js +44 -350
- package/build-module/components/post-actions/actions.js.map +1 -1
- package/build-module/components/post-actions/index.js +16 -6
- package/build-module/components/post-actions/index.js.map +1 -1
- package/build-module/components/post-author/hook.js +10 -3
- package/build-module/components/post-author/hook.js.map +1 -1
- package/build-module/components/post-author/panel.js +2 -1
- package/build-module/components/post-author/panel.js.map +1 -1
- package/build-module/components/post-card-panel/index.js +1 -1
- package/build-module/components/post-card-panel/index.js.map +1 -1
- package/build-module/components/post-comments/index.js +7 -23
- package/build-module/components/post-comments/index.js.map +1 -1
- package/build-module/components/post-status/index.js +19 -43
- package/build-module/components/post-status/index.js.map +1 -1
- package/build-module/components/post-template/create-new-template-modal.js +3 -0
- package/build-module/components/post-template/create-new-template-modal.js.map +1 -1
- package/build-module/components/post-url/panel.js +4 -5
- package/build-module/components/post-url/panel.js.map +1 -1
- package/build-module/components/preview-dropdown/index.js +84 -19
- package/build-module/components/preview-dropdown/index.js.map +1 -1
- package/build-module/components/provider/disable-non-page-content-blocks.js +15 -19
- package/build-module/components/provider/disable-non-page-content-blocks.js.map +1 -1
- package/build-module/components/site-discussion/index.js +7 -21
- package/build-module/components/site-discussion/index.js.map +1 -1
- package/build-module/components/template-content-panel/index.js +15 -13
- package/build-module/components/template-content-panel/index.js.map +1 -1
- package/build-module/components/visual-editor/index.js +2 -1
- package/build-module/components/visual-editor/index.js.map +1 -1
- package/build-module/dataviews/actions/export-pattern.native.js +3 -0
- package/build-module/dataviews/actions/export-pattern.native.js.map +1 -0
- package/build-module/dataviews/actions/permanently-delete-post.js +99 -0
- package/build-module/dataviews/actions/permanently-delete-post.js.map +1 -0
- package/build-module/dataviews/actions/restore-post.js +104 -0
- package/build-module/dataviews/actions/restore-post.js.map +1 -0
- package/build-module/dataviews/actions/trash-post.js +135 -0
- package/build-module/dataviews/actions/trash-post.js.map +1 -0
- package/build-module/dataviews/store/private-actions.js +40 -0
- package/build-module/dataviews/store/private-actions.js.map +1 -1
- package/build-module/dataviews/store/private-selectors.js +8 -9
- package/build-module/dataviews/store/private-selectors.js.map +1 -1
- package/build-module/dataviews/store/reducer.js +15 -1
- package/build-module/dataviews/store/reducer.js.map +1 -1
- package/build-module/dataviews/types.js.map +1 -1
- package/build-module/private-apis.js +0 -2
- package/build-module/private-apis.js.map +1 -1
- package/build-module/store/actions.js +16 -2
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/private-actions.js +8 -1
- package/build-module/store/private-actions.js.map +1 -1
- package/build-module/store/private-selectors.js +32 -2
- package/build-module/store/private-selectors.js.map +1 -1
- package/build-style/style-rtl.css +19 -3
- package/build-style/style.css +19 -3
- package/build-types/bindings/post-meta.d.ts +6 -0
- package/build-types/bindings/post-meta.d.ts.map +1 -1
- package/build-types/components/commands/index.d.ts.map +1 -1
- package/build-types/components/header/index.d.ts.map +1 -1
- package/build-types/components/page-attributes/parent.d.ts.map +1 -1
- package/build-types/components/post-actions/actions.d.ts.map +1 -1
- package/build-types/components/post-actions/index.d.ts.map +1 -1
- package/build-types/components/post-author/hook.d.ts +1 -1
- package/build-types/components/post-author/hook.d.ts.map +1 -1
- package/build-types/components/post-author/panel.d.ts.map +1 -1
- package/build-types/components/post-comments/index.d.ts.map +1 -1
- package/build-types/components/post-status/index.d.ts +2 -1
- package/build-types/components/post-status/index.d.ts.map +1 -1
- package/build-types/components/post-template/create-new-template-modal.d.ts.map +1 -1
- package/build-types/components/post-url/panel.d.ts.map +1 -1
- package/build-types/components/preview-dropdown/index.d.ts.map +1 -1
- package/build-types/components/provider/disable-non-page-content-blocks.d.ts.map +1 -1
- package/build-types/components/site-discussion/index.d.ts.map +1 -1
- package/build-types/components/template-content-panel/index.d.ts.map +1 -1
- package/build-types/components/visual-editor/index.d.ts.map +1 -1
- package/build-types/dataviews/actions/export-pattern.native.d.ts +3 -0
- package/build-types/dataviews/actions/export-pattern.native.d.ts.map +1 -0
- package/build-types/dataviews/actions/permanently-delete-post.d.ts +5 -0
- package/build-types/dataviews/actions/permanently-delete-post.d.ts.map +1 -0
- package/build-types/dataviews/actions/restore-post.d.ts +5 -0
- package/build-types/dataviews/actions/restore-post.d.ts.map +1 -0
- package/build-types/dataviews/actions/trash-post.d.ts +5 -0
- package/build-types/dataviews/actions/trash-post.d.ts.map +1 -0
- package/build-types/dataviews/store/private-actions.d.ts +8 -3
- package/build-types/dataviews/store/private-actions.d.ts.map +1 -1
- package/build-types/dataviews/store/private-selectors.d.ts +2 -1
- package/build-types/dataviews/store/private-selectors.d.ts.map +1 -1
- package/build-types/dataviews/store/reducer.d.ts +4 -1
- package/build-types/dataviews/store/reducer.d.ts.map +1 -1
- package/build-types/dataviews/types.d.ts +9 -0
- package/build-types/dataviews/types.d.ts.map +1 -1
- package/build-types/private-apis.d.ts.map +1 -1
- package/build-types/store/actions.d.ts.map +1 -1
- package/build-types/store/private-actions.d.ts.map +1 -1
- package/build-types/store/private-selectors.d.ts +11 -0
- package/build-types/store/private-selectors.d.ts.map +1 -1
- package/build-types/store/reducer.d.ts +1 -0
- package/build-types/store/reducer.d.ts.map +1 -1
- package/package.json +36 -36
- package/src/bindings/post-meta.js +20 -0
- package/src/components/blog-title/index.js +1 -1
- package/src/components/commands/index.js +4 -2
- package/src/components/document-bar/index.js +1 -1
- package/src/components/document-bar/style.scss +1 -1
- package/src/components/editor-interface/style.scss +5 -0
- package/src/components/header/index.js +1 -2
- package/src/components/list-view-sidebar/style.scss +4 -0
- package/src/components/page-attributes/parent.js +25 -7
- package/src/components/post-actions/actions.js +47 -470
- package/src/components/post-actions/index.js +19 -7
- package/src/components/post-author/hook.js +11 -3
- package/src/components/post-author/panel.js +3 -1
- package/src/components/post-card-panel/index.js +1 -1
- package/src/components/post-comments/index.js +7 -20
- package/src/components/post-publish-panel/test/__snapshots__/index.js.snap +2 -2
- package/src/components/post-status/index.js +11 -41
- package/src/components/post-template/create-new-template-modal.js +7 -1
- package/src/components/post-url/panel.js +8 -2
- package/src/components/preview-dropdown/index.js +113 -35
- package/src/components/preview-dropdown/style.scss +5 -0
- package/src/components/provider/disable-non-page-content-blocks.js +27 -24
- package/src/components/site-discussion/index.js +7 -19
- package/src/components/template-content-panel/index.js +36 -21
- package/src/components/visual-editor/index.js +8 -6
- package/src/components/visual-editor/style.scss +1 -3
- package/src/dataviews/actions/export-pattern.native.tsx +3 -0
- package/src/dataviews/actions/permanently-delete-post.tsx +116 -0
- package/src/dataviews/actions/restore-post.tsx +134 -0
- package/src/dataviews/actions/trash-post.tsx +196 -0
- package/src/dataviews/store/private-actions.ts +68 -0
- package/src/dataviews/store/private-selectors.ts +9 -17
- package/src/dataviews/store/reducer.ts +20 -1
- package/src/dataviews/types.ts +11 -0
- package/src/private-apis.js +0 -2
- package/src/store/actions.js +36 -13
- package/src/store/private-actions.js +8 -4
- package/src/store/private-selectors.js +45 -2
- package/src/store/test/private-selectors.js +78 -0
- package/tsconfig.tsbuildinfo +1 -1
- package/build/dataviews/actions/index.js +0 -32
- package/build/dataviews/actions/index.js.map +0 -1
- package/build-module/dataviews/actions/index.js +0 -24
- package/build-module/dataviews/actions/index.js.map +0 -1
- package/build-types/dataviews/actions/index.d.ts +0 -2
- package/build-types/dataviews/actions/index.d.ts.map +0 -1
- package/src/components/document-outline/test/__snapshots__/index.js.snap +0 -111
- package/src/components/document-outline/test/index.js +0 -185
- package/src/dataviews/actions/index.ts +0 -25
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_icons","require","_url","_data","_htmlEntities","_coreData","_i18n","_notices","_element","_patterns","_blocks","_dataviews","_components","_constants","_store","_lockUnlock","_createTemplatePartModal","_utils","_jsxRuntime","PATTERN_TYPES","CreatePatternModalContents","useDuplicatePatternProps","unlock","patternsPrivateApis","fields","type","header","__","id","placeholder","getValue","item","title","form","visibleFields","isTemplateRemovable","template","source","TEMPLATE_ORIGINS","custom","has_theme_file","trashPostAction","label","isPrimary","icon","trash","isEligible","includes","status","supportsBulk","hideModalHeader","RenderModal","items","closeModal","onActionPerformed","isBusy","setIsBusy","useState","createSuccessNotice","createErrorNotice","useDispatch","noticesStore","deleteEntityRecord","coreStore","jsxs","__experimentalVStack","spacing","children","jsx","__experimentalText","length","sprintf","getItemTitle","_n","__experimentalHStack","justify","Button","variant","onClick","disabled","accessibleWhenDisabled","promiseResult","Promise","allSettled","map","throwOnError","every","successMessage","errorMessage","reason","message","errorMessages","Set","failedPromises","filter","failedPromise","add","size","join","useCanUserEligibilityCheckPostType","capability","postType","action","registry","useRegistry","useMemo","select","canUser","kind","name","useTrashPostAction","permanentlyDeletePostAction","callback","posts","dispatch","post","force","usePermanentlyDeletePostAction","restorePostAction","backup","editEntityRecord","saveEditedEntityRecord","useRestorePostAction","viewPostAction","external","window","open","link","postRevisionsAction","context","_items$0$_links$versi","revisionsCount","_links","count","_post$_links$predeces","_post$_links$version","lastRevisionId","href","addQueryArgs","revision","document","location","renamePostAction","TEMPLATE_POST_TYPE","TEMPLATE_PART_POST_TYPE","Object","values","is_custom","isTemplatePart","isUserPattern","user","isCustomPattern","hasThemeFile","setTitle","onRename","event","preventDefault","error","code","onSubmit","TextControl","__nextHasNoMarginBottom","__next40pxDefaultSize","value","onChange","required","useRenamePostAction","ReorderModal","orderInput","setOrderInput","menu_order","onOrder","Number","isInteger","trim","saveIsDisabled","__experimentalNumberControl","help","__experimentalIsFocusable","useReorderPagesAction","supportsPageAttributes","useSelect","getPostType","postTypeObject","supports","useDuplicatePostAction","userCanCreatePost","_x","setItem","isCreatingPage","setIsCreatingPage","saveEntityRecord","createPage","newItemOject","slug","comment_status","content","raw","excerpt","meta","parent","password","format","featured_media","ping_status","assignablePropertiesPrefix","assignableProperties","keys","property","startsWith","slice","forEach","newItem","decodeEntities","rendered","DataForm","data","duplicatePatternAction","exports","modalHeader","duplicatedProps","pattern","onSuccess","onClose","confirmLabel","duplicateTemplatePartAction","blocks","_item$blocks","parse","__unstableSkipMigrationLogs","onTemplatePartSuccess","CreateTemplatePartModalContents","defaultArea","area","defaultTitle","onCreate","onError","usePostActions","defaultActions","userCanCreatePostType","cachedCanUserResolvers","getCachedResolvers","getEntityActions","editorStore","_postTypeObject","duplicatePostAction","trashPostActionForPostType","permanentlyDeletePostActionForPostType","renamePostActionForPostType","restorePostActionForPostType","reorderPagesAction","isTemplateOrTemplatePart","isPattern","PATTERN_POST_TYPE","isLoaded","supportsRevisions","revisions","supportsTitle","actions","viewable","globalThis","IS_GUTENBERG_PLUGIN","Boolean","i","existingCallback","argsObject","_items","ExistingRenderModal","props"],"sources":["@wordpress/editor/src/components/post-actions/actions.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { external, trash, backup } from '@wordpress/icons';\nimport { addQueryArgs } from '@wordpress/url';\nimport { useDispatch, useSelect, useRegistry } from '@wordpress/data';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { __, _n, sprintf, _x } from '@wordpress/i18n';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { useMemo, useState } from '@wordpress/element';\nimport { privateApis as patternsPrivateApis } from '@wordpress/patterns';\nimport { parse } from '@wordpress/blocks';\nimport { DataForm } from '@wordpress/dataviews';\nimport {\n\tButton,\n\tTextControl,\n\t__experimentalText as Text,\n\t__experimentalHStack as HStack,\n\t__experimentalVStack as VStack,\n\t__experimentalNumberControl as NumberControl,\n} from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport {\n\tTEMPLATE_ORIGINS,\n\tTEMPLATE_PART_POST_TYPE,\n\tTEMPLATE_POST_TYPE,\n\tPATTERN_POST_TYPE,\n} from '../../store/constants';\nimport { store as editorStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\nimport { CreateTemplatePartModalContents } from '../create-template-part-modal';\nimport { getItemTitle } from '../../dataviews/actions/utils';\n\n// Patterns.\nconst { PATTERN_TYPES, CreatePatternModalContents, useDuplicatePatternProps } =\n\tunlock( patternsPrivateApis );\n\n// TODO: this should be shared with other components (page-pages).\nconst fields = [\n\t{\n\t\ttype: 'text',\n\t\theader: __( 'Title' ),\n\t\tid: 'title',\n\t\tplaceholder: __( 'No title' ),\n\t\tgetValue: ( { item } ) => item.title,\n\t},\n];\n\nconst form = {\n\tvisibleFields: [ 'title' ],\n};\n\n/**\n * Check if a template is removable.\n *\n * @param {Object} template The template entity to check.\n * @return {boolean} Whether the template is removable.\n */\nfunction isTemplateRemovable( template ) {\n\tif ( ! template ) {\n\t\treturn false;\n\t}\n\t// In patterns list page we map the templates parts to a different object\n\t// than the one returned from the endpoint. This is why we need to check for\n\t// two props whether is custom or has a theme file.\n\treturn (\n\t\ttemplate?.source === TEMPLATE_ORIGINS.custom &&\n\t\t! template?.has_theme_file\n\t);\n}\n\nconst trashPostAction = {\n\tid: 'move-to-trash',\n\tlabel: __( 'Move to Trash' ),\n\tisPrimary: true,\n\ticon: trash,\n\tisEligible( item ) {\n\t\treturn ! [ 'auto-draft', 'trash' ].includes( item.status );\n\t},\n\tsupportsBulk: true,\n\thideModalHeader: true,\n\tRenderModal: ( { items, closeModal, onActionPerformed } ) => {\n\t\tconst [ isBusy, setIsBusy ] = useState( false );\n\t\tconst { createSuccessNotice, createErrorNotice } =\n\t\t\tuseDispatch( noticesStore );\n\t\tconst { deleteEntityRecord } = useDispatch( coreStore );\n\t\treturn (\n\t\t\t<VStack spacing=\"5\">\n\t\t\t\t<Text>\n\t\t\t\t\t{ items.length === 1\n\t\t\t\t\t\t? sprintf(\n\t\t\t\t\t\t\t\t// translators: %s: The item's title.\n\t\t\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t\t\t'Are you sure you want to move to trash \"%s\"?'\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\tgetItemTitle( items[ 0 ] )\n\t\t\t\t\t\t )\n\t\t\t\t\t\t: sprintf(\n\t\t\t\t\t\t\t\t// translators: %d: The number of items (2 or more).\n\t\t\t\t\t\t\t\t_n(\n\t\t\t\t\t\t\t\t\t'Are you sure you want to move to trash %d item?',\n\t\t\t\t\t\t\t\t\t'Are you sure you want to move to trash %d items?',\n\t\t\t\t\t\t\t\t\titems.length\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\titems.length\n\t\t\t\t\t\t ) }\n\t\t\t\t</Text>\n\t\t\t\t<HStack justify=\"right\">\n\t\t\t\t\t<Button\n\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t\tonClick={ closeModal }\n\t\t\t\t\t\tdisabled={ isBusy }\n\t\t\t\t\t\taccessibleWhenDisabled\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Cancel' ) }\n\t\t\t\t\t</Button>\n\t\t\t\t\t<Button\n\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\tonClick={ async () => {\n\t\t\t\t\t\t\tsetIsBusy( true );\n\t\t\t\t\t\t\tconst promiseResult = await Promise.allSettled(\n\t\t\t\t\t\t\t\titems.map( ( item ) =>\n\t\t\t\t\t\t\t\t\tdeleteEntityRecord(\n\t\t\t\t\t\t\t\t\t\t'postType',\n\t\t\t\t\t\t\t\t\t\titem.type,\n\t\t\t\t\t\t\t\t\t\titem.id,\n\t\t\t\t\t\t\t\t\t\t{},\n\t\t\t\t\t\t\t\t\t\t{ throwOnError: true }\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\t// If all the promises were fulfilled with success.\n\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\tpromiseResult.every(\n\t\t\t\t\t\t\t\t\t( { status } ) => status === 'fulfilled'\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\tlet successMessage;\n\t\t\t\t\t\t\t\tif ( promiseResult.length === 1 ) {\n\t\t\t\t\t\t\t\t\tsuccessMessage = sprintf(\n\t\t\t\t\t\t\t\t\t\t/* translators: The item's title. */\n\t\t\t\t\t\t\t\t\t\t__( '\"%s\" moved to trash.' ),\n\t\t\t\t\t\t\t\t\t\tgetItemTitle( items[ 0 ] )\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tsuccessMessage = sprintf(\n\t\t\t\t\t\t\t\t\t\t/* translators: The number of items. */\n\t\t\t\t\t\t\t\t\t\t_n(\n\t\t\t\t\t\t\t\t\t\t\t'%s item moved to trash.',\n\t\t\t\t\t\t\t\t\t\t\t'%s items moved to trash.',\n\t\t\t\t\t\t\t\t\t\t\titems.length\n\t\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\t\titems.length\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\tcreateSuccessNotice( successMessage, {\n\t\t\t\t\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\t\t\t\t\tid: 'move-to-trash-action',\n\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t// If there was at least one failure.\n\t\t\t\t\t\t\t\tlet errorMessage;\n\t\t\t\t\t\t\t\t// If we were trying to delete a single item.\n\t\t\t\t\t\t\t\tif ( promiseResult.length === 1 ) {\n\t\t\t\t\t\t\t\t\tif ( promiseResult[ 0 ].reason?.message ) {\n\t\t\t\t\t\t\t\t\t\terrorMessage =\n\t\t\t\t\t\t\t\t\t\t\tpromiseResult[ 0 ].reason.message;\n\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\terrorMessage = __(\n\t\t\t\t\t\t\t\t\t\t\t'An error occurred while moving to trash the item.'\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\t// If we were trying to delete multiple items.\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tconst errorMessages = new Set();\n\t\t\t\t\t\t\t\t\tconst failedPromises = promiseResult.filter(\n\t\t\t\t\t\t\t\t\t\t( { status } ) => status === 'rejected'\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\tfor ( const failedPromise of failedPromises ) {\n\t\t\t\t\t\t\t\t\t\tif ( failedPromise.reason?.message ) {\n\t\t\t\t\t\t\t\t\t\t\terrorMessages.add(\n\t\t\t\t\t\t\t\t\t\t\t\tfailedPromise.reason.message\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\tif ( errorMessages.size === 0 ) {\n\t\t\t\t\t\t\t\t\t\terrorMessage = __(\n\t\t\t\t\t\t\t\t\t\t\t'An error occurred while moving to trash the items.'\n\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t} else if ( errorMessages.size === 1 ) {\n\t\t\t\t\t\t\t\t\t\terrorMessage = sprintf(\n\t\t\t\t\t\t\t\t\t\t\t/* translators: %s: an error message */\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'An error occurred while moving to trash the item: %s'\n\t\t\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\t\t\t[ ...errorMessages ][ 0 ]\n\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\terrorMessage = sprintf(\n\t\t\t\t\t\t\t\t\t\t\t/* translators: %s: a list of comma separated error messages */\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'Some errors occurred while moving to trash the items: %s'\n\t\t\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\t\t\t[ ...errorMessages ].join( ',' )\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\tcreateErrorNotice( errorMessage, {\n\t\t\t\t\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif ( onActionPerformed ) {\n\t\t\t\t\t\t\t\tonActionPerformed( items );\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tsetIsBusy( false );\n\t\t\t\t\t\t\tcloseModal();\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tisBusy={ isBusy }\n\t\t\t\t\t\tdisabled={ isBusy }\n\t\t\t\t\t\taccessibleWhenDisabled\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Trash' ) }\n\t\t\t\t\t</Button>\n\t\t\t\t</HStack>\n\t\t\t</VStack>\n\t\t);\n\t},\n};\n\nfunction useCanUserEligibilityCheckPostType( capability, postType, action ) {\n\tconst registry = useRegistry();\n\treturn useMemo(\n\t\t() => ( {\n\t\t\t...action,\n\t\t\tisEligible( item ) {\n\t\t\t\treturn (\n\t\t\t\t\taction.isEligible( item ) &&\n\t\t\t\t\tregistry.select( coreStore ).canUser( capability, {\n\t\t\t\t\t\tkind: 'postType',\n\t\t\t\t\t\tname: postType,\n\t\t\t\t\t\tid: item.id,\n\t\t\t\t\t} )\n\t\t\t\t);\n\t\t\t},\n\t\t} ),\n\t\t[ action, registry, capability, postType ]\n\t);\n}\n\nfunction useTrashPostAction( postType ) {\n\treturn useCanUserEligibilityCheckPostType(\n\t\t'delete',\n\t\tpostType,\n\t\ttrashPostAction\n\t);\n}\n\nconst permanentlyDeletePostAction = {\n\tid: 'permanently-delete',\n\tlabel: __( 'Permanently delete' ),\n\tsupportsBulk: true,\n\tisEligible( { status } ) {\n\t\treturn status === 'trash';\n\t},\n\tasync callback( posts, { registry, onActionPerformed } ) {\n\t\tconst { createSuccessNotice, createErrorNotice } =\n\t\t\tregistry.dispatch( noticesStore );\n\t\tconst { deleteEntityRecord } = registry.dispatch( coreStore );\n\t\tconst promiseResult = await Promise.allSettled(\n\t\t\tposts.map( ( post ) => {\n\t\t\t\treturn deleteEntityRecord(\n\t\t\t\t\t'postType',\n\t\t\t\t\tpost.type,\n\t\t\t\t\tpost.id,\n\t\t\t\t\t{ force: true },\n\t\t\t\t\t{ throwOnError: true }\n\t\t\t\t);\n\t\t\t} )\n\t\t);\n\t\t// If all the promises were fulfilled with success.\n\t\tif ( promiseResult.every( ( { status } ) => status === 'fulfilled' ) ) {\n\t\t\tlet successMessage;\n\t\t\tif ( promiseResult.length === 1 ) {\n\t\t\t\tsuccessMessage = sprintf(\n\t\t\t\t\t/* translators: The posts's title. */\n\t\t\t\t\t__( '\"%s\" permanently deleted.' ),\n\t\t\t\t\tgetItemTitle( posts[ 0 ] )\n\t\t\t\t);\n\t\t\t} else {\n\t\t\t\tsuccessMessage = __( 'The posts were permanently deleted.' );\n\t\t\t}\n\t\t\tcreateSuccessNotice( successMessage, {\n\t\t\t\ttype: 'snackbar',\n\t\t\t\tid: 'permanently-delete-post-action',\n\t\t\t} );\n\t\t\tonActionPerformed?.( posts );\n\t\t} else {\n\t\t\t// If there was at lease one failure.\n\t\t\tlet errorMessage;\n\t\t\t// If we were trying to permanently delete a single post.\n\t\t\tif ( promiseResult.length === 1 ) {\n\t\t\t\tif ( promiseResult[ 0 ].reason?.message ) {\n\t\t\t\t\terrorMessage = promiseResult[ 0 ].reason.message;\n\t\t\t\t} else {\n\t\t\t\t\terrorMessage = __(\n\t\t\t\t\t\t'An error occurred while permanently deleting the post.'\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\t// If we were trying to permanently delete multiple posts\n\t\t\t} else {\n\t\t\t\tconst errorMessages = new Set();\n\t\t\t\tconst failedPromises = promiseResult.filter(\n\t\t\t\t\t( { status } ) => status === 'rejected'\n\t\t\t\t);\n\t\t\t\tfor ( const failedPromise of failedPromises ) {\n\t\t\t\t\tif ( failedPromise.reason?.message ) {\n\t\t\t\t\t\terrorMessages.add( failedPromise.reason.message );\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif ( errorMessages.size === 0 ) {\n\t\t\t\t\terrorMessage = __(\n\t\t\t\t\t\t'An error occurred while permanently deleting the posts.'\n\t\t\t\t\t);\n\t\t\t\t} else if ( errorMessages.size === 1 ) {\n\t\t\t\t\terrorMessage = sprintf(\n\t\t\t\t\t\t/* translators: %s: an error message */\n\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t'An error occurred while permanently deleting the posts: %s'\n\t\t\t\t\t\t),\n\t\t\t\t\t\t[ ...errorMessages ][ 0 ]\n\t\t\t\t\t);\n\t\t\t\t} else {\n\t\t\t\t\terrorMessage = sprintf(\n\t\t\t\t\t\t/* translators: %s: a list of comma separated error messages */\n\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t'Some errors occurred while permanently deleting the posts: %s'\n\t\t\t\t\t\t),\n\t\t\t\t\t\t[ ...errorMessages ].join( ',' )\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\t\t\tcreateErrorNotice( errorMessage, {\n\t\t\t\ttype: 'snackbar',\n\t\t\t} );\n\t\t}\n\t},\n};\n\nfunction usePermanentlyDeletePostAction( postType ) {\n\treturn useCanUserEligibilityCheckPostType(\n\t\t'delete',\n\t\tpostType,\n\t\tpermanentlyDeletePostAction\n\t);\n}\n\nconst restorePostAction = {\n\tid: 'restore',\n\tlabel: __( 'Restore' ),\n\tisPrimary: true,\n\ticon: backup,\n\tsupportsBulk: true,\n\tisEligible( { status } ) {\n\t\treturn status === 'trash';\n\t},\n\tasync callback( posts, { registry, onActionPerformed } ) {\n\t\tconst { createSuccessNotice, createErrorNotice } =\n\t\t\tregistry.dispatch( noticesStore );\n\t\tconst { editEntityRecord, saveEditedEntityRecord } =\n\t\t\tregistry.dispatch( coreStore );\n\t\tawait Promise.allSettled(\n\t\t\tposts.map( ( post ) => {\n\t\t\t\treturn editEntityRecord( 'postType', post.type, post.id, {\n\t\t\t\t\tstatus: 'draft',\n\t\t\t\t} );\n\t\t\t} )\n\t\t);\n\t\tconst promiseResult = await Promise.allSettled(\n\t\t\tposts.map( ( post ) => {\n\t\t\t\treturn saveEditedEntityRecord( 'postType', post.type, post.id, {\n\t\t\t\t\tthrowOnError: true,\n\t\t\t\t} );\n\t\t\t} )\n\t\t);\n\n\t\tif ( promiseResult.every( ( { status } ) => status === 'fulfilled' ) ) {\n\t\t\tlet successMessage;\n\t\t\tif ( posts.length === 1 ) {\n\t\t\t\tsuccessMessage = sprintf(\n\t\t\t\t\t/* translators: The number of posts. */\n\t\t\t\t\t__( '\"%s\" has been restored.' ),\n\t\t\t\t\tgetItemTitle( posts[ 0 ] )\n\t\t\t\t);\n\t\t\t} else if ( posts[ 0 ].type === 'page' ) {\n\t\t\t\tsuccessMessage = sprintf(\n\t\t\t\t\t/* translators: The number of posts. */\n\t\t\t\t\t__( '%d pages have been restored.' ),\n\t\t\t\t\tposts.length\n\t\t\t\t);\n\t\t\t} else {\n\t\t\t\tsuccessMessage = sprintf(\n\t\t\t\t\t/* translators: The number of posts. */\n\t\t\t\t\t__( '%d posts have been restored.' ),\n\t\t\t\t\tposts.length\n\t\t\t\t);\n\t\t\t}\n\t\t\tcreateSuccessNotice( successMessage, {\n\t\t\t\ttype: 'snackbar',\n\t\t\t\tid: 'restore-post-action',\n\t\t\t} );\n\t\t\tif ( onActionPerformed ) {\n\t\t\t\tonActionPerformed( posts );\n\t\t\t}\n\t\t} else {\n\t\t\t// If there was at lease one failure.\n\t\t\tlet errorMessage;\n\t\t\t// If we were trying to move a single post to the trash.\n\t\t\tif ( promiseResult.length === 1 ) {\n\t\t\t\tif ( promiseResult[ 0 ].reason?.message ) {\n\t\t\t\t\terrorMessage = promiseResult[ 0 ].reason.message;\n\t\t\t\t} else {\n\t\t\t\t\terrorMessage = __(\n\t\t\t\t\t\t'An error occurred while restoring the post.'\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\t// If we were trying to move multiple posts to the trash\n\t\t\t} else {\n\t\t\t\tconst errorMessages = new Set();\n\t\t\t\tconst failedPromises = promiseResult.filter(\n\t\t\t\t\t( { status } ) => status === 'rejected'\n\t\t\t\t);\n\t\t\t\tfor ( const failedPromise of failedPromises ) {\n\t\t\t\t\tif ( failedPromise.reason?.message ) {\n\t\t\t\t\t\terrorMessages.add( failedPromise.reason.message );\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif ( errorMessages.size === 0 ) {\n\t\t\t\t\terrorMessage = __(\n\t\t\t\t\t\t'An error occurred while restoring the posts.'\n\t\t\t\t\t);\n\t\t\t\t} else if ( errorMessages.size === 1 ) {\n\t\t\t\t\terrorMessage = sprintf(\n\t\t\t\t\t\t/* translators: %s: an error message */\n\t\t\t\t\t\t__( 'An error occurred while restoring the posts: %s' ),\n\t\t\t\t\t\t[ ...errorMessages ][ 0 ]\n\t\t\t\t\t);\n\t\t\t\t} else {\n\t\t\t\t\terrorMessage = sprintf(\n\t\t\t\t\t\t/* translators: %s: a list of comma separated error messages */\n\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t'Some errors occurred while restoring the posts: %s'\n\t\t\t\t\t\t),\n\t\t\t\t\t\t[ ...errorMessages ].join( ',' )\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\t\t\tcreateErrorNotice( errorMessage, {\n\t\t\t\ttype: 'snackbar',\n\t\t\t} );\n\t\t}\n\t},\n};\n\nfunction useRestorePostAction( postType ) {\n\treturn useCanUserEligibilityCheckPostType(\n\t\t'update',\n\t\tpostType,\n\t\trestorePostAction\n\t);\n}\n\nconst viewPostAction = {\n\tid: 'view-post',\n\tlabel: __( 'View' ),\n\tisPrimary: true,\n\ticon: external,\n\tisEligible( post ) {\n\t\treturn post.status !== 'trash';\n\t},\n\tcallback( posts, { onActionPerformed } ) {\n\t\tconst post = posts[ 0 ];\n\t\twindow.open( post.link, '_blank' );\n\t\tif ( onActionPerformed ) {\n\t\t\tonActionPerformed( posts );\n\t\t}\n\t},\n};\n\nconst postRevisionsAction = {\n\tid: 'view-post-revisions',\n\tcontext: 'list',\n\tlabel( items ) {\n\t\tconst revisionsCount =\n\t\t\titems[ 0 ]._links?.[ 'version-history' ]?.[ 0 ]?.count ?? 0;\n\t\treturn sprintf(\n\t\t\t/* translators: %s: number of revisions */\n\t\t\t__( 'View revisions (%s)' ),\n\t\t\trevisionsCount\n\t\t);\n\t},\n\tisEligible: ( post ) => {\n\t\tif ( post.status === 'trash' ) {\n\t\t\treturn false;\n\t\t}\n\t\tconst lastRevisionId =\n\t\t\tpost?._links?.[ 'predecessor-version' ]?.[ 0 ]?.id ?? null;\n\t\tconst revisionsCount =\n\t\t\tpost?._links?.[ 'version-history' ]?.[ 0 ]?.count ?? 0;\n\t\treturn lastRevisionId && revisionsCount > 1;\n\t},\n\tcallback( posts, { onActionPerformed } ) {\n\t\tconst post = posts[ 0 ];\n\t\tconst href = addQueryArgs( 'revision.php', {\n\t\t\trevision: post?._links?.[ 'predecessor-version' ]?.[ 0 ]?.id,\n\t\t} );\n\t\tdocument.location.href = href;\n\t\tif ( onActionPerformed ) {\n\t\t\tonActionPerformed( posts );\n\t\t}\n\t},\n};\n\nconst renamePostAction = {\n\tid: 'rename-post',\n\tlabel: __( 'Rename' ),\n\tisEligible( post ) {\n\t\tif ( post.status === 'trash' ) {\n\t\t\treturn false;\n\t\t}\n\t\t// Templates, template parts and patterns have special checks for renaming.\n\t\tif (\n\t\t\t! [\n\t\t\t\tTEMPLATE_POST_TYPE,\n\t\t\t\tTEMPLATE_PART_POST_TYPE,\n\t\t\t\t...Object.values( PATTERN_TYPES ),\n\t\t\t].includes( post.type )\n\t\t) {\n\t\t\treturn true;\n\t\t}\n\t\t// In the case of templates, we can only rename custom templates.\n\t\tif ( post.type === TEMPLATE_POST_TYPE ) {\n\t\t\treturn isTemplateRemovable( post ) && post.is_custom;\n\t\t}\n\t\t// Make necessary checks for template parts and patterns.\n\t\tconst isTemplatePart = post.type === TEMPLATE_PART_POST_TYPE;\n\t\tconst isUserPattern = post.type === PATTERN_TYPES.user;\n\t\t// In patterns list page we map the templates parts to a different object\n\t\t// than the one returned from the endpoint. This is why we need to check for\n\t\t// two props whether is custom or has a theme file.\n\t\tconst isCustomPattern =\n\t\t\tisUserPattern ||\n\t\t\t( isTemplatePart && post.source === TEMPLATE_ORIGINS.custom );\n\t\tconst hasThemeFile = post?.has_theme_file;\n\t\treturn isCustomPattern && ! hasThemeFile;\n\t},\n\tRenderModal: ( { items, closeModal, onActionPerformed } ) => {\n\t\tconst [ item ] = items;\n\t\tconst [ title, setTitle ] = useState( () => getItemTitle( item ) );\n\t\tconst { editEntityRecord, saveEditedEntityRecord } =\n\t\t\tuseDispatch( coreStore );\n\t\tconst { createSuccessNotice, createErrorNotice } =\n\t\t\tuseDispatch( noticesStore );\n\n\t\tasync function onRename( event ) {\n\t\t\tevent.preventDefault();\n\t\t\ttry {\n\t\t\t\tawait editEntityRecord( 'postType', item.type, item.id, {\n\t\t\t\t\ttitle,\n\t\t\t\t} );\n\t\t\t\t// Update state before saving rerenders the list.\n\t\t\t\tsetTitle( '' );\n\t\t\t\tcloseModal();\n\t\t\t\t// Persist edited entity.\n\t\t\t\tawait saveEditedEntityRecord( 'postType', item.type, item.id, {\n\t\t\t\t\tthrowOnError: true,\n\t\t\t\t} );\n\t\t\t\tcreateSuccessNotice( __( 'Name updated' ), {\n\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t} );\n\t\t\t\tonActionPerformed?.( items );\n\t\t\t} catch ( error ) {\n\t\t\t\tconst errorMessage =\n\t\t\t\t\terror.message && error.code !== 'unknown_error'\n\t\t\t\t\t\t? error.message\n\t\t\t\t\t\t: __( 'An error occurred while updating the name' );\n\t\t\t\tcreateErrorNotice( errorMessage, { type: 'snackbar' } );\n\t\t\t}\n\t\t}\n\n\t\treturn (\n\t\t\t<form onSubmit={ onRename }>\n\t\t\t\t<VStack spacing=\"5\">\n\t\t\t\t\t<TextControl\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\tlabel={ __( 'Name' ) }\n\t\t\t\t\t\tvalue={ title }\n\t\t\t\t\t\tonChange={ setTitle }\n\t\t\t\t\t\trequired\n\t\t\t\t\t/>\n\t\t\t\t\t<HStack justify=\"right\">\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={ () => {\n\t\t\t\t\t\t\t\tcloseModal();\n\t\t\t\t\t\t\t} }\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>\n\t\t\t\t\t\t\t{ __( 'Save' ) }\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);\n\t},\n};\n\nfunction useRenamePostAction( postType ) {\n\treturn useCanUserEligibilityCheckPostType(\n\t\t'update',\n\t\tpostType,\n\t\trenamePostAction\n\t);\n}\n\nfunction ReorderModal( { items, closeModal, onActionPerformed } ) {\n\tconst [ item ] = items;\n\tconst { editEntityRecord, saveEditedEntityRecord } =\n\t\tuseDispatch( coreStore );\n\tconst { createSuccessNotice, createErrorNotice } =\n\t\tuseDispatch( noticesStore );\n\tconst [ orderInput, setOrderInput ] = useState( item.menu_order );\n\n\tasync function onOrder( event ) {\n\t\tevent.preventDefault();\n\t\tif (\n\t\t\t! Number.isInteger( Number( orderInput ) ) ||\n\t\t\torderInput?.trim?.() === ''\n\t\t) {\n\t\t\treturn;\n\t\t}\n\t\ttry {\n\t\t\tawait editEntityRecord( 'postType', item.type, item.id, {\n\t\t\t\tmenu_order: orderInput,\n\t\t\t} );\n\t\t\tcloseModal();\n\t\t\t// Persist edited entity.\n\t\t\tawait saveEditedEntityRecord( 'postType', item.type, item.id, {\n\t\t\t\tthrowOnError: true,\n\t\t\t} );\n\t\t\tcreateSuccessNotice( __( 'Order updated' ), {\n\t\t\t\ttype: 'snackbar',\n\t\t\t} );\n\t\t\tonActionPerformed?.( items );\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 updating the order' );\n\t\t\tcreateErrorNotice( errorMessage, {\n\t\t\t\ttype: 'snackbar',\n\t\t\t} );\n\t\t}\n\t}\n\tconst saveIsDisabled =\n\t\t! Number.isInteger( Number( orderInput ) ) ||\n\t\torderInput?.trim?.() === '';\n\treturn (\n\t\t<form onSubmit={ onOrder }>\n\t\t\t<VStack spacing=\"5\">\n\t\t\t\t<div>\n\t\t\t\t\t{ __(\n\t\t\t\t\t\t'Determines the order of pages. Pages with the same order value are sorted alphabetically. Negative order values are supported.'\n\t\t\t\t\t) }\n\t\t\t\t</div>\n\t\t\t\t<NumberControl\n\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\tlabel={ __( 'Order' ) }\n\t\t\t\t\thelp={ __( 'Set the page order.' ) }\n\t\t\t\t\tvalue={ orderInput }\n\t\t\t\t\tonChange={ setOrderInput }\n\t\t\t\t/>\n\t\t\t\t<HStack justify=\"right\">\n\t\t\t\t\t<Button\n\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\tcloseModal();\n\t\t\t\t\t\t} }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Cancel' ) }\n\t\t\t\t\t</Button>\n\t\t\t\t\t<Button\n\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\ttype=\"submit\"\n\t\t\t\t\t\taccessibleWhenDisabled\n\t\t\t\t\t\tdisabled={ saveIsDisabled }\n\t\t\t\t\t\t__experimentalIsFocusable\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Save' ) }\n\t\t\t\t\t</Button>\n\t\t\t\t</HStack>\n\t\t\t</VStack>\n\t\t</form>\n\t);\n}\n\nfunction useReorderPagesAction( postType ) {\n\tconst supportsPageAttributes = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getPostType } = select( coreStore );\n\t\t\tconst postTypeObject = getPostType( postType );\n\n\t\t\treturn !! postTypeObject?.supports?.[ 'page-attributes' ];\n\t\t},\n\t\t[ postType ]\n\t);\n\n\treturn useMemo(\n\t\t() =>\n\t\t\tsupportsPageAttributes && {\n\t\t\t\tid: 'order-pages',\n\t\t\t\tlabel: __( 'Order' ),\n\t\t\t\tisEligible( { status } ) {\n\t\t\t\t\treturn status !== 'trash';\n\t\t\t\t},\n\t\t\t\tRenderModal: ReorderModal,\n\t\t\t},\n\t\t[ supportsPageAttributes ]\n\t);\n}\n\nconst useDuplicatePostAction = ( postType ) => {\n\tconst userCanCreatePost = useSelect(\n\t\t( select ) => {\n\t\t\treturn select( coreStore ).canUser( 'create', {\n\t\t\t\tkind: 'postType',\n\t\t\t\tname: postType,\n\t\t\t} );\n\t\t},\n\t\t[ postType ]\n\t);\n\treturn useMemo(\n\t\t() =>\n\t\t\tuserCanCreatePost && {\n\t\t\t\tid: 'duplicate-post',\n\t\t\t\tlabel: _x( 'Duplicate', 'action label' ),\n\t\t\t\tisEligible( { status } ) {\n\t\t\t\t\treturn status !== 'trash';\n\t\t\t\t},\n\t\t\t\tRenderModal: ( { items, closeModal, onActionPerformed } ) => {\n\t\t\t\t\tconst [ item, setItem ] = useState( {\n\t\t\t\t\t\t...items[ 0 ],\n\t\t\t\t\t\ttitle: sprintf(\n\t\t\t\t\t\t\t/* translators: %s: Existing template title */\n\t\t\t\t\t\t\t__( '%s (Copy)' ),\n\t\t\t\t\t\t\tgetItemTitle( items[ 0 ] )\n\t\t\t\t\t\t),\n\t\t\t\t\t} );\n\n\t\t\t\t\tconst [ isCreatingPage, setIsCreatingPage ] =\n\t\t\t\t\t\tuseState( false );\n\n\t\t\t\t\tconst { saveEntityRecord } = useDispatch( coreStore );\n\t\t\t\t\tconst { createSuccessNotice, createErrorNotice } =\n\t\t\t\t\t\tuseDispatch( noticesStore );\n\n\t\t\t\t\tasync function createPage( event ) {\n\t\t\t\t\t\tevent.preventDefault();\n\n\t\t\t\t\t\tif ( isCreatingPage ) {\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tconst newItemOject = {\n\t\t\t\t\t\t\tstatus: 'draft',\n\t\t\t\t\t\t\ttitle: item.title,\n\t\t\t\t\t\t\tslug: item.title || __( 'No title' ),\n\t\t\t\t\t\t\tcomment_status: item.comment_status,\n\t\t\t\t\t\t\tcontent:\n\t\t\t\t\t\t\t\ttypeof item.content === 'string'\n\t\t\t\t\t\t\t\t\t? item.content\n\t\t\t\t\t\t\t\t\t: item.content.raw,\n\t\t\t\t\t\t\texcerpt: item.excerpt.raw,\n\t\t\t\t\t\t\tmeta: item.meta,\n\t\t\t\t\t\t\tparent: item.parent,\n\t\t\t\t\t\t\tpassword: item.password,\n\t\t\t\t\t\t\ttemplate: item.template,\n\t\t\t\t\t\t\tformat: item.format,\n\t\t\t\t\t\t\tfeatured_media: item.featured_media,\n\t\t\t\t\t\t\tmenu_order: item.menu_order,\n\t\t\t\t\t\t\tping_status: item.ping_status,\n\t\t\t\t\t\t};\n\t\t\t\t\t\tconst assignablePropertiesPrefix = 'wp:action-assign-';\n\t\t\t\t\t\t// Get all the properties that the current user is able to assign normally author, categories, tags,\n\t\t\t\t\t\t// and custom taxonomies.\n\t\t\t\t\t\tconst assignableProperties = Object.keys(\n\t\t\t\t\t\t\titem?._links || {}\n\t\t\t\t\t\t)\n\t\t\t\t\t\t\t.filter( ( property ) =>\n\t\t\t\t\t\t\t\tproperty.startsWith(\n\t\t\t\t\t\t\t\t\tassignablePropertiesPrefix\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t.map( ( property ) =>\n\t\t\t\t\t\t\t\tproperty.slice(\n\t\t\t\t\t\t\t\t\tassignablePropertiesPrefix.length\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\tassignableProperties.forEach( ( property ) => {\n\t\t\t\t\t\t\tif ( item[ property ] ) {\n\t\t\t\t\t\t\t\tnewItemOject[ property ] = item[ property ];\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} );\n\t\t\t\t\t\tsetIsCreatingPage( true );\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\tconst newItem = await saveEntityRecord(\n\t\t\t\t\t\t\t\t'postType',\n\t\t\t\t\t\t\t\titem.type,\n\t\t\t\t\t\t\t\tnewItemOject,\n\t\t\t\t\t\t\t\t{ throwOnError: true }\n\t\t\t\t\t\t\t);\n\n\t\t\t\t\t\t\tcreateSuccessNotice(\n\t\t\t\t\t\t\t\tsprintf(\n\t\t\t\t\t\t\t\t\t// translators: %s: Title of the created template e.g: \"Category\".\n\t\t\t\t\t\t\t\t\t__( '\"%s\" successfully created.' ),\n\t\t\t\t\t\t\t\t\tdecodeEntities(\n\t\t\t\t\t\t\t\t\t\tnewItem.title?.rendered || item.title\n\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tid: 'duplicate-post-action',\n\t\t\t\t\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t);\n\n\t\t\t\t\t\t\tif ( onActionPerformed ) {\n\t\t\t\t\t\t\t\tonActionPerformed( [ newItem ] );\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} catch ( error ) {\n\t\t\t\t\t\t\tconst errorMessage =\n\t\t\t\t\t\t\t\terror.message && error.code !== 'unknown_error'\n\t\t\t\t\t\t\t\t\t? error.message\n\t\t\t\t\t\t\t\t\t: __(\n\t\t\t\t\t\t\t\t\t\t\t'An error occurred while duplicating the page.'\n\t\t\t\t\t\t\t\t\t );\n\n\t\t\t\t\t\t\tcreateErrorNotice( errorMessage, {\n\t\t\t\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t} finally {\n\t\t\t\t\t\t\tsetIsCreatingPage( false );\n\t\t\t\t\t\t\tcloseModal();\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<form onSubmit={ createPage }>\n\t\t\t\t\t\t\t<VStack spacing={ 3 }>\n\t\t\t\t\t\t\t\t<DataForm\n\t\t\t\t\t\t\t\t\tdata={ item }\n\t\t\t\t\t\t\t\t\tfields={ fields }\n\t\t\t\t\t\t\t\t\tform={ form }\n\t\t\t\t\t\t\t\t\tonChange={ setItem }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t<HStack spacing={ 2 } justify=\"end\">\n\t\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t\t\t\t\t\tonClick={ closeModal }\n\t\t\t\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t{ __( 'Cancel' ) }\n\t\t\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\t\t\t\t\ttype=\"submit\"\n\t\t\t\t\t\t\t\t\t\tisBusy={ isCreatingPage }\n\t\t\t\t\t\t\t\t\t\taria-disabled={ isCreatingPage }\n\t\t\t\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t{ _x( 'Duplicate', 'action label' ) }\n\t\t\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t\t\t</HStack>\n\t\t\t\t\t\t\t</VStack>\n\t\t\t\t\t\t</form>\n\t\t\t\t\t);\n\t\t\t\t},\n\t\t\t},\n\t\t[ userCanCreatePost ]\n\t);\n};\n\nexport const duplicatePatternAction = {\n\tid: 'duplicate-pattern',\n\tlabel: _x( 'Duplicate', 'action label' ),\n\tisEligible: ( item ) => item.type !== TEMPLATE_PART_POST_TYPE,\n\tmodalHeader: _x( 'Duplicate pattern', 'action label' ),\n\tRenderModal: ( { items, closeModal } ) => {\n\t\tconst [ item ] = items;\n\t\tconst duplicatedProps = useDuplicatePatternProps( {\n\t\t\tpattern: item,\n\t\t\tonSuccess: () => closeModal(),\n\t\t} );\n\t\treturn (\n\t\t\t<CreatePatternModalContents\n\t\t\t\tonClose={ closeModal }\n\t\t\t\tconfirmLabel={ _x( 'Duplicate', 'action label' ) }\n\t\t\t\t{ ...duplicatedProps }\n\t\t\t/>\n\t\t);\n\t},\n};\n\nexport const duplicateTemplatePartAction = {\n\tid: 'duplicate-template-part',\n\tlabel: _x( 'Duplicate', 'action label' ),\n\tisEligible: ( item ) => item.type === TEMPLATE_PART_POST_TYPE,\n\tmodalHeader: _x( 'Duplicate template part', 'action label' ),\n\tRenderModal: ( { items, closeModal } ) => {\n\t\tconst [ item ] = items;\n\t\tconst blocks = useMemo( () => {\n\t\t\treturn (\n\t\t\t\titem.blocks ??\n\t\t\t\tparse(\n\t\t\t\t\ttypeof item.content === 'string'\n\t\t\t\t\t\t? item.content\n\t\t\t\t\t\t: item.content.raw,\n\t\t\t\t\t{\n\t\t\t\t\t\t__unstableSkipMigrationLogs: true,\n\t\t\t\t\t}\n\t\t\t\t)\n\t\t\t);\n\t\t}, [ item.content, item.blocks ] );\n\t\tconst { createSuccessNotice } = useDispatch( noticesStore );\n\t\tfunction onTemplatePartSuccess() {\n\t\t\tcreateSuccessNotice(\n\t\t\t\tsprintf(\n\t\t\t\t\t// translators: %s: The new template part's title e.g. 'Call to action (copy)'.\n\t\t\t\t\t__( '\"%s\" duplicated.' ),\n\t\t\t\t\tgetItemTitle( item )\n\t\t\t\t),\n\t\t\t\t{ type: 'snackbar', id: 'edit-site-patterns-success' }\n\t\t\t);\n\t\t\tcloseModal();\n\t\t}\n\t\treturn (\n\t\t\t<CreateTemplatePartModalContents\n\t\t\t\tblocks={ blocks }\n\t\t\t\tdefaultArea={ item.area }\n\t\t\t\tdefaultTitle={ sprintf(\n\t\t\t\t\t/* translators: %s: Existing template part title */\n\t\t\t\t\t__( '%s (Copy)' ),\n\t\t\t\t\tgetItemTitle( item )\n\t\t\t\t) }\n\t\t\t\tonCreate={ onTemplatePartSuccess }\n\t\t\t\tonError={ closeModal }\n\t\t\t\tconfirmLabel={ _x( 'Duplicate', 'action label' ) }\n\t\t\t/>\n\t\t);\n\t},\n};\n\nexport function usePostActions( { postType, onActionPerformed, context } ) {\n\tconst {\n\t\tdefaultActions,\n\t\tpostTypeObject,\n\t\tuserCanCreatePostType,\n\t\tcachedCanUserResolvers,\n\t} = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getPostType, canUser, getCachedResolvers } =\n\t\t\t\tselect( coreStore );\n\t\t\tconst { getEntityActions } = unlock( select( editorStore ) );\n\t\t\tconst _postTypeObject = getPostType( postType );\n\t\t\treturn {\n\t\t\t\tpostTypeObject: _postTypeObject,\n\t\t\t\tdefaultActions: getEntityActions( 'postType', postType ),\n\t\t\t\tuserCanCreatePostType: canUser( 'create', {\n\t\t\t\t\tkind: 'postType',\n\t\t\t\t\tname: postType,\n\t\t\t\t} ),\n\t\t\t\tcachedCanUserResolvers: getCachedResolvers()?.canUser,\n\t\t\t};\n\t\t},\n\t\t[ postType ]\n\t);\n\n\tconst duplicatePostAction = useDuplicatePostAction( postType );\n\tconst trashPostActionForPostType = useTrashPostAction( postType );\n\tconst permanentlyDeletePostActionForPostType =\n\t\tusePermanentlyDeletePostAction( postType );\n\tconst renamePostActionForPostType = useRenamePostAction( postType );\n\tconst restorePostActionForPostType = useRestorePostAction( postType );\n\tconst reorderPagesAction = useReorderPagesAction( postType );\n\tconst isTemplateOrTemplatePart = [\n\t\tTEMPLATE_POST_TYPE,\n\t\tTEMPLATE_PART_POST_TYPE,\n\t].includes( postType );\n\tconst isPattern = postType === PATTERN_POST_TYPE;\n\tconst isLoaded = !! postTypeObject;\n\tconst supportsRevisions = !! postTypeObject?.supports?.revisions;\n\tconst supportsTitle = !! postTypeObject?.supports?.title;\n\treturn useMemo( () => {\n\t\tif ( ! isLoaded ) {\n\t\t\treturn [];\n\t\t}\n\n\t\tlet actions = [\n\t\t\tpostTypeObject?.viewable && viewPostAction,\n\t\t\tsupportsRevisions && postRevisionsAction,\n\t\t\tglobalThis.IS_GUTENBERG_PLUGIN\n\t\t\t\t? ! isTemplateOrTemplatePart &&\n\t\t\t\t ! isPattern &&\n\t\t\t\t duplicatePostAction\n\t\t\t\t: false,\n\t\t\tisTemplateOrTemplatePart &&\n\t\t\t\tuserCanCreatePostType &&\n\t\t\t\tduplicateTemplatePartAction,\n\t\t\tisPattern && userCanCreatePostType && duplicatePatternAction,\n\t\t\tsupportsTitle && renamePostActionForPostType,\n\t\t\treorderPagesAction,\n\t\t\t! isTemplateOrTemplatePart && restorePostActionForPostType,\n\t\t\t! isTemplateOrTemplatePart &&\n\t\t\t\t! isPattern &&\n\t\t\t\ttrashPostActionForPostType,\n\t\t\t! isTemplateOrTemplatePart &&\n\t\t\t\tpermanentlyDeletePostActionForPostType,\n\t\t\t...defaultActions,\n\t\t].filter( Boolean );\n\t\t// Filter actions based on provided context. If not provided\n\t\t// all actions are returned. We'll have a single entry for getting the actions\n\t\t// and the consumer should provide the context to filter the actions, if needed.\n\t\t// Actions should also provide the `context` they support, if it's specific, to\n\t\t// compare with the provided context to get all the actions.\n\t\t// Right now the only supported context is `list`.\n\t\tactions = actions.filter( ( action ) => {\n\t\t\tif ( ! action.context ) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\treturn action.context === context;\n\t\t} );\n\n\t\tif ( onActionPerformed ) {\n\t\t\tfor ( let i = 0; i < actions.length; ++i ) {\n\t\t\t\tif ( actions[ i ].callback ) {\n\t\t\t\t\tconst existingCallback = actions[ i ].callback;\n\t\t\t\t\tactions[ i ] = {\n\t\t\t\t\t\t...actions[ i ],\n\t\t\t\t\t\tcallback: ( items, argsObject ) => {\n\t\t\t\t\t\t\texistingCallback( items, {\n\t\t\t\t\t\t\t\t...argsObject,\n\t\t\t\t\t\t\t\tonActionPerformed: ( _items ) => {\n\t\t\t\t\t\t\t\t\tif ( argsObject?.onActionPerformed ) {\n\t\t\t\t\t\t\t\t\t\targsObject.onActionPerformed( _items );\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tonActionPerformed(\n\t\t\t\t\t\t\t\t\t\tactions[ i ].id,\n\t\t\t\t\t\t\t\t\t\t_items\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}\n\t\t\t\tif ( actions[ i ].RenderModal ) {\n\t\t\t\t\tconst ExistingRenderModal = actions[ i ].RenderModal;\n\t\t\t\t\tactions[ i ] = {\n\t\t\t\t\t\t...actions[ i ],\n\t\t\t\t\t\tRenderModal: ( props ) => {\n\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t<ExistingRenderModal\n\t\t\t\t\t\t\t\t\t{ ...props }\n\t\t\t\t\t\t\t\t\tonActionPerformed={ ( _items ) => {\n\t\t\t\t\t\t\t\t\t\tif ( props.onActionPerformed ) {\n\t\t\t\t\t\t\t\t\t\t\tprops.onActionPerformed( _items );\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tonActionPerformed(\n\t\t\t\t\t\t\t\t\t\t\tactions[ i ].id,\n\t\t\t\t\t\t\t\t\t\t\t_items\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}\n\t\t\t}\n\t\t}\n\n\t\treturn actions;\n\t\t// We are making this use memo depend on cachedCanUserResolvers as a way to make the component using this hook re-render\n\t\t// when user capabilities are resolved. This makes sure the isEligible functions of actions dependent on capabilities are re-evaluated.\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t}, [\n\t\tdefaultActions,\n\t\tuserCanCreatePostType,\n\t\tisTemplateOrTemplatePart,\n\t\tisPattern,\n\t\tpostTypeObject?.viewable,\n\t\tduplicatePostAction,\n\t\treorderPagesAction,\n\t\ttrashPostActionForPostType,\n\t\trestorePostActionForPostType,\n\t\trenamePostActionForPostType,\n\t\tpermanent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C,CAAE,CAAC3O,EAAE,EACf8O,MACD,CAAC;gBACF;cAAG,CACH,CAAC;YAEJ;UACD,CAAC;QACF;MACD;IACD;IAEA,OAAOR,OAAO;IACd;IACA;IACA;EACD,CAAC,EAAE,CACFpB,cAAc,EACdC,qBAAqB,EACrBY,wBAAwB,EACxBC,SAAS,EACTrE,cAAc,EAAE4E,QAAQ,EACxBd,mBAAmB,EACnBK,kBAAkB,EAClBJ,0BAA0B,EAC1BG,4BAA4B,EAC5BD,2BAA2B,EAC3BD,sCAAsC,EACtCjM,iBAAiB,EACjBwM,QAAQ,EACRC,iBAAiB,EACjBE,aAAa,EACbhI,OAAO,EACP+G,sBAAsB,CACrB,CAAC;AACJ","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_icons","require","_url","_data","_htmlEntities","_coreData","_i18n","_notices","_element","_patterns","_blocks","_dataviews","_components","_constants","_store","_lockUnlock","_createTemplatePartModal","_utils","_jsxRuntime","PATTERN_TYPES","CreatePatternModalContents","useDuplicatePatternProps","unlock","patternsPrivateApis","fields","type","id","label","__","placeholder","getValue","item","title","description","formDuplicateAction","formOrderAction","isTemplateRemovable","template","source","TEMPLATE_ORIGINS","custom","has_theme_file","viewPostAction","isPrimary","icon","external","isEligible","post","status","callback","posts","onActionPerformed","window","open","link","postRevisionsAction","context","items","_items$0$_links$versi","revisionsCount","_links","count","sprintf","_post$_links$predeces","_post$_links$version","lastRevisionId","href","addQueryArgs","revision","document","location","renamePostAction","TEMPLATE_POST_TYPE","TEMPLATE_PART_POST_TYPE","Object","values","includes","permissions","update","is_custom","isTemplatePart","isUserPattern","user","isCustomPattern","hasThemeFile","RenderModal","closeModal","setTitle","useState","getItemTitle","editEntityRecord","saveEditedEntityRecord","useDispatch","coreStore","createSuccessNotice","createErrorNotice","noticesStore","onRename","event","preventDefault","throwOnError","error","errorMessage","message","code","jsx","onSubmit","children","jsxs","__experimentalVStack","spacing","TextControl","__nextHasNoMarginBottom","__next40pxDefaultSize","value","onChange","required","__experimentalHStack","justify","Button","variant","onClick","ReorderModal","setItem","orderInput","menu_order","onOrder","isItemValid","isSaveDisabled","DataForm","data","form","accessibleWhenDisabled","disabled","__experimentalIsFocusable","useReorderPagesAction","postType","supportsPageAttributes","useSelect","select","getPostType","postTypeObject","supports","useMemo","useDuplicatePostAction","userCanCreatePost","canUser","kind","name","_x","isCreatingPage","setIsCreatingPage","saveEntityRecord","createPage","newItemOject","slug","comment_status","content","raw","excerpt","meta","parent","password","format","featured_media","ping_status","assignablePropertiesPrefix","assignableProperties","keys","filter","property","startsWith","map","slice","length","forEach","newItem","decodeEntities","rendered","isBusy","duplicatePatternAction","exports","modalHeader","duplicatedProps","pattern","onSuccess","onClose","confirmLabel","duplicateTemplatePartAction","blocks","_item$blocks","parse","__unstableSkipMigrationLogs","onTemplatePartSuccess","CreateTemplatePartModalContents","defaultArea","area","defaultTitle","onCreate","onError","usePostActions","defaultActions","userCanCreatePostType","getEntityActions","editorStore","registerPostTypeActions","useEffect","duplicatePostAction","reorderPagesAction","isTemplateOrTemplatePart","isPattern","PATTERN_POST_TYPE","isLoaded","supportsRevisions","revisions","supportsTitle","actions","viewable","globalThis","IS_GUTENBERG_PLUGIN","Boolean","action","i","existingCallback","argsObject","_items","ExistingRenderModal","props"],"sources":["@wordpress/editor/src/components/post-actions/actions.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { external } from '@wordpress/icons';\nimport { addQueryArgs } from '@wordpress/url';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { __, sprintf, _x } from '@wordpress/i18n';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { useMemo, useState, useEffect } from '@wordpress/element';\nimport { privateApis as patternsPrivateApis } from '@wordpress/patterns';\nimport { parse } from '@wordpress/blocks';\nimport { DataForm, isItemValid } from '@wordpress/dataviews';\nimport {\n\tButton,\n\tTextControl,\n\t__experimentalHStack as HStack,\n\t__experimentalVStack as VStack,\n} from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport {\n\tTEMPLATE_ORIGINS,\n\tTEMPLATE_PART_POST_TYPE,\n\tTEMPLATE_POST_TYPE,\n\tPATTERN_POST_TYPE,\n} from '../../store/constants';\nimport { store as editorStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\nimport { CreateTemplatePartModalContents } from '../create-template-part-modal';\nimport { getItemTitle } from '../../dataviews/actions/utils';\n\n// Patterns.\nconst { PATTERN_TYPES, CreatePatternModalContents, useDuplicatePatternProps } =\n\tunlock( patternsPrivateApis );\n\n// TODO: this should be shared with other components (see post-fields in edit-site).\nconst fields = [\n\t{\n\t\ttype: 'text',\n\t\tid: 'title',\n\t\tlabel: __( 'Title' ),\n\t\tplaceholder: __( 'No title' ),\n\t\tgetValue: ( { item } ) => item.title,\n\t},\n\t{\n\t\ttype: 'integer',\n\t\tid: 'menu_order',\n\t\tlabel: __( 'Order' ),\n\t\tdescription: __( 'Determines the order of pages.' ),\n\t},\n];\n\nconst formDuplicateAction = {\n\tfields: [ 'title' ],\n};\n\nconst formOrderAction = {\n\tfields: [ 'menu_order' ],\n};\n\n/**\n * Check if a template is removable.\n *\n * @param {Object} template The template entity to check.\n * @return {boolean} Whether the template is removable.\n */\nfunction isTemplateRemovable( template ) {\n\tif ( ! template ) {\n\t\treturn false;\n\t}\n\t// In patterns list page we map the templates parts to a different object\n\t// than the one returned from the endpoint. This is why we need to check for\n\t// two props whether is custom or has a theme file.\n\treturn (\n\t\ttemplate?.source === TEMPLATE_ORIGINS.custom &&\n\t\t! template?.has_theme_file\n\t);\n}\n\nconst viewPostAction = {\n\tid: 'view-post',\n\tlabel: __( 'View' ),\n\tisPrimary: true,\n\ticon: external,\n\tisEligible( post ) {\n\t\treturn post.status !== 'trash';\n\t},\n\tcallback( posts, { onActionPerformed } ) {\n\t\tconst post = posts[ 0 ];\n\t\twindow.open( post.link, '_blank' );\n\t\tif ( onActionPerformed ) {\n\t\t\tonActionPerformed( posts );\n\t\t}\n\t},\n};\n\nconst postRevisionsAction = {\n\tid: 'view-post-revisions',\n\tcontext: 'list',\n\tlabel( items ) {\n\t\tconst revisionsCount =\n\t\t\titems[ 0 ]._links?.[ 'version-history' ]?.[ 0 ]?.count ?? 0;\n\t\treturn sprintf(\n\t\t\t/* translators: %s: number of revisions */\n\t\t\t__( 'View revisions (%s)' ),\n\t\t\trevisionsCount\n\t\t);\n\t},\n\tisEligible: ( post ) => {\n\t\tif ( post.status === 'trash' ) {\n\t\t\treturn false;\n\t\t}\n\t\tconst lastRevisionId =\n\t\t\tpost?._links?.[ 'predecessor-version' ]?.[ 0 ]?.id ?? null;\n\t\tconst revisionsCount =\n\t\t\tpost?._links?.[ 'version-history' ]?.[ 0 ]?.count ?? 0;\n\t\treturn lastRevisionId && revisionsCount > 1;\n\t},\n\tcallback( posts, { onActionPerformed } ) {\n\t\tconst post = posts[ 0 ];\n\t\tconst href = addQueryArgs( 'revision.php', {\n\t\t\trevision: post?._links?.[ 'predecessor-version' ]?.[ 0 ]?.id,\n\t\t} );\n\t\tdocument.location.href = href;\n\t\tif ( onActionPerformed ) {\n\t\t\tonActionPerformed( posts );\n\t\t}\n\t},\n};\n\nconst renamePostAction = {\n\tid: 'rename-post',\n\tlabel: __( 'Rename' ),\n\tisEligible( post ) {\n\t\tif ( post.status === 'trash' ) {\n\t\t\treturn false;\n\t\t}\n\t\t// Templates, template parts and patterns have special checks for renaming.\n\t\tif (\n\t\t\t! [\n\t\t\t\tTEMPLATE_POST_TYPE,\n\t\t\t\tTEMPLATE_PART_POST_TYPE,\n\t\t\t\t...Object.values( PATTERN_TYPES ),\n\t\t\t].includes( post.type )\n\t\t) {\n\t\t\treturn post.permissions?.update;\n\t\t}\n\t\t// In the case of templates, we can only rename custom templates.\n\t\tif ( post.type === TEMPLATE_POST_TYPE ) {\n\t\t\treturn (\n\t\t\t\tisTemplateRemovable( post ) &&\n\t\t\t\tpost.is_custom &&\n\t\t\t\tpost.permissions?.update\n\t\t\t);\n\t\t}\n\t\t// Make necessary checks for template parts and patterns.\n\t\tconst isTemplatePart = post.type === TEMPLATE_PART_POST_TYPE;\n\t\tconst isUserPattern = post.type === PATTERN_TYPES.user;\n\t\t// In patterns list page we map the templates parts to a different object\n\t\t// than the one returned from the endpoint. This is why we need to check for\n\t\t// two props whether is custom or has a theme file.\n\t\tconst isCustomPattern =\n\t\t\tisUserPattern ||\n\t\t\t( isTemplatePart && post.source === TEMPLATE_ORIGINS.custom );\n\t\tconst hasThemeFile = post?.has_theme_file;\n\t\treturn isCustomPattern && ! hasThemeFile && post.permissions?.update;\n\t},\n\tRenderModal: ( { items, closeModal, onActionPerformed } ) => {\n\t\tconst [ item ] = items;\n\t\tconst [ title, setTitle ] = useState( () => getItemTitle( item ) );\n\t\tconst { editEntityRecord, saveEditedEntityRecord } =\n\t\t\tuseDispatch( coreStore );\n\t\tconst { createSuccessNotice, createErrorNotice } =\n\t\t\tuseDispatch( noticesStore );\n\n\t\tasync function onRename( event ) {\n\t\t\tevent.preventDefault();\n\t\t\ttry {\n\t\t\t\tawait editEntityRecord( 'postType', item.type, item.id, {\n\t\t\t\t\ttitle,\n\t\t\t\t} );\n\t\t\t\t// Update state before saving rerenders the list.\n\t\t\t\tsetTitle( '' );\n\t\t\t\tcloseModal();\n\t\t\t\t// Persist edited entity.\n\t\t\t\tawait saveEditedEntityRecord( 'postType', item.type, item.id, {\n\t\t\t\t\tthrowOnError: true,\n\t\t\t\t} );\n\t\t\t\tcreateSuccessNotice( __( 'Name updated' ), {\n\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t} );\n\t\t\t\tonActionPerformed?.( items );\n\t\t\t} catch ( error ) {\n\t\t\t\tconst errorMessage =\n\t\t\t\t\terror.message && error.code !== 'unknown_error'\n\t\t\t\t\t\t? error.message\n\t\t\t\t\t\t: __( 'An error occurred while updating the name' );\n\t\t\t\tcreateErrorNotice( errorMessage, { type: 'snackbar' } );\n\t\t\t}\n\t\t}\n\n\t\treturn (\n\t\t\t<form onSubmit={ onRename }>\n\t\t\t\t<VStack spacing=\"5\">\n\t\t\t\t\t<TextControl\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\tlabel={ __( 'Name' ) }\n\t\t\t\t\t\tvalue={ title }\n\t\t\t\t\t\tonChange={ setTitle }\n\t\t\t\t\t\trequired\n\t\t\t\t\t/>\n\t\t\t\t\t<HStack justify=\"right\">\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={ () => {\n\t\t\t\t\t\t\t\tcloseModal();\n\t\t\t\t\t\t\t} }\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>\n\t\t\t\t\t\t\t{ __( 'Save' ) }\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);\n\t},\n};\n\nfunction ReorderModal( { items, closeModal, onActionPerformed } ) {\n\tconst [ item, setItem ] = useState( items[ 0 ] );\n\tconst orderInput = item.menu_order;\n\tconst { editEntityRecord, saveEditedEntityRecord } =\n\t\tuseDispatch( coreStore );\n\tconst { createSuccessNotice, createErrorNotice } =\n\t\tuseDispatch( noticesStore );\n\n\tasync function onOrder( event ) {\n\t\tevent.preventDefault();\n\n\t\tif ( ! isItemValid( item, fields, formOrderAction ) ) {\n\t\t\treturn;\n\t\t}\n\n\t\ttry {\n\t\t\tawait editEntityRecord( 'postType', item.type, item.id, {\n\t\t\t\tmenu_order: orderInput,\n\t\t\t} );\n\t\t\tcloseModal();\n\t\t\t// Persist edited entity.\n\t\t\tawait saveEditedEntityRecord( 'postType', item.type, item.id, {\n\t\t\t\tthrowOnError: true,\n\t\t\t} );\n\t\t\tcreateSuccessNotice( __( 'Order updated' ), {\n\t\t\t\ttype: 'snackbar',\n\t\t\t} );\n\t\t\tonActionPerformed?.( items );\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 updating the order' );\n\t\t\tcreateErrorNotice( errorMessage, {\n\t\t\t\ttype: 'snackbar',\n\t\t\t} );\n\t\t}\n\t}\n\tconst isSaveDisabled = ! isItemValid( item, fields, formOrderAction );\n\treturn (\n\t\t<form onSubmit={ onOrder }>\n\t\t\t<VStack spacing=\"5\">\n\t\t\t\t<div>\n\t\t\t\t\t{ __(\n\t\t\t\t\t\t'Determines the order of pages. Pages with the same order value are sorted alphabetically. Negative order values are supported.'\n\t\t\t\t\t) }\n\t\t\t\t</div>\n\t\t\t\t<DataForm\n\t\t\t\t\tdata={ item }\n\t\t\t\t\tfields={ fields }\n\t\t\t\t\tform={ formOrderAction }\n\t\t\t\t\tonChange={ setItem }\n\t\t\t\t/>\n\t\t\t\t<HStack justify=\"right\">\n\t\t\t\t\t<Button\n\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\tcloseModal();\n\t\t\t\t\t\t} }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Cancel' ) }\n\t\t\t\t\t</Button>\n\t\t\t\t\t<Button\n\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\ttype=\"submit\"\n\t\t\t\t\t\taccessibleWhenDisabled\n\t\t\t\t\t\tdisabled={ isSaveDisabled }\n\t\t\t\t\t\t__experimentalIsFocusable\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Save' ) }\n\t\t\t\t\t</Button>\n\t\t\t\t</HStack>\n\t\t\t</VStack>\n\t\t</form>\n\t);\n}\n\nfunction useReorderPagesAction( postType ) {\n\tconst supportsPageAttributes = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getPostType } = select( coreStore );\n\t\t\tconst postTypeObject = getPostType( postType );\n\n\t\t\treturn !! postTypeObject?.supports?.[ 'page-attributes' ];\n\t\t},\n\t\t[ postType ]\n\t);\n\n\treturn useMemo(\n\t\t() =>\n\t\t\tsupportsPageAttributes && {\n\t\t\t\tid: 'order-pages',\n\t\t\t\tlabel: __( 'Order' ),\n\t\t\t\tisEligible( { status } ) {\n\t\t\t\t\treturn status !== 'trash';\n\t\t\t\t},\n\t\t\t\tRenderModal: ReorderModal,\n\t\t\t},\n\t\t[ supportsPageAttributes ]\n\t);\n}\n\nconst useDuplicatePostAction = ( postType ) => {\n\tconst userCanCreatePost = useSelect(\n\t\t( select ) => {\n\t\t\treturn select( coreStore ).canUser( 'create', {\n\t\t\t\tkind: 'postType',\n\t\t\t\tname: postType,\n\t\t\t} );\n\t\t},\n\t\t[ postType ]\n\t);\n\treturn useMemo(\n\t\t() =>\n\t\t\tuserCanCreatePost && {\n\t\t\t\tid: 'duplicate-post',\n\t\t\t\tlabel: _x( 'Duplicate', 'action label' ),\n\t\t\t\tisEligible( { status } ) {\n\t\t\t\t\treturn status !== 'trash';\n\t\t\t\t},\n\t\t\t\tRenderModal: ( { items, closeModal, onActionPerformed } ) => {\n\t\t\t\t\tconst [ item, setItem ] = useState( {\n\t\t\t\t\t\t...items[ 0 ],\n\t\t\t\t\t\ttitle: sprintf(\n\t\t\t\t\t\t\t/* translators: %s: Existing template title */\n\t\t\t\t\t\t\t__( '%s (Copy)' ),\n\t\t\t\t\t\t\tgetItemTitle( items[ 0 ] )\n\t\t\t\t\t\t),\n\t\t\t\t\t} );\n\n\t\t\t\t\tconst [ isCreatingPage, setIsCreatingPage ] =\n\t\t\t\t\t\tuseState( false );\n\n\t\t\t\t\tconst { saveEntityRecord } = useDispatch( coreStore );\n\t\t\t\t\tconst { createSuccessNotice, createErrorNotice } =\n\t\t\t\t\t\tuseDispatch( noticesStore );\n\n\t\t\t\t\tasync function createPage( event ) {\n\t\t\t\t\t\tevent.preventDefault();\n\n\t\t\t\t\t\tif ( isCreatingPage ) {\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tconst newItemOject = {\n\t\t\t\t\t\t\tstatus: 'draft',\n\t\t\t\t\t\t\ttitle: item.title,\n\t\t\t\t\t\t\tslug: item.title || __( 'No title' ),\n\t\t\t\t\t\t\tcomment_status: item.comment_status,\n\t\t\t\t\t\t\tcontent:\n\t\t\t\t\t\t\t\ttypeof item.content === 'string'\n\t\t\t\t\t\t\t\t\t? item.content\n\t\t\t\t\t\t\t\t\t: item.content.raw,\n\t\t\t\t\t\t\texcerpt: item.excerpt.raw,\n\t\t\t\t\t\t\tmeta: item.meta,\n\t\t\t\t\t\t\tparent: item.parent,\n\t\t\t\t\t\t\tpassword: item.password,\n\t\t\t\t\t\t\ttemplate: item.template,\n\t\t\t\t\t\t\tformat: item.format,\n\t\t\t\t\t\t\tfeatured_media: item.featured_media,\n\t\t\t\t\t\t\tmenu_order: item.menu_order,\n\t\t\t\t\t\t\tping_status: item.ping_status,\n\t\t\t\t\t\t};\n\t\t\t\t\t\tconst assignablePropertiesPrefix = 'wp:action-assign-';\n\t\t\t\t\t\t// Get all the properties that the current user is able to assign normally author, categories, tags,\n\t\t\t\t\t\t// and custom taxonomies.\n\t\t\t\t\t\tconst assignableProperties = Object.keys(\n\t\t\t\t\t\t\titem?._links || {}\n\t\t\t\t\t\t)\n\t\t\t\t\t\t\t.filter( ( property ) =>\n\t\t\t\t\t\t\t\tproperty.startsWith(\n\t\t\t\t\t\t\t\t\tassignablePropertiesPrefix\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t.map( ( property ) =>\n\t\t\t\t\t\t\t\tproperty.slice(\n\t\t\t\t\t\t\t\t\tassignablePropertiesPrefix.length\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\tassignableProperties.forEach( ( property ) => {\n\t\t\t\t\t\t\tif ( item[ property ] ) {\n\t\t\t\t\t\t\t\tnewItemOject[ property ] = item[ property ];\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} );\n\t\t\t\t\t\tsetIsCreatingPage( true );\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\tconst newItem = await saveEntityRecord(\n\t\t\t\t\t\t\t\t'postType',\n\t\t\t\t\t\t\t\titem.type,\n\t\t\t\t\t\t\t\tnewItemOject,\n\t\t\t\t\t\t\t\t{ throwOnError: true }\n\t\t\t\t\t\t\t);\n\n\t\t\t\t\t\t\tcreateSuccessNotice(\n\t\t\t\t\t\t\t\tsprintf(\n\t\t\t\t\t\t\t\t\t// translators: %s: Title of the created template e.g: \"Category\".\n\t\t\t\t\t\t\t\t\t__( '\"%s\" successfully created.' ),\n\t\t\t\t\t\t\t\t\tdecodeEntities(\n\t\t\t\t\t\t\t\t\t\tnewItem.title?.rendered || item.title\n\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tid: 'duplicate-post-action',\n\t\t\t\t\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t);\n\n\t\t\t\t\t\t\tif ( onActionPerformed ) {\n\t\t\t\t\t\t\t\tonActionPerformed( [ newItem ] );\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} catch ( error ) {\n\t\t\t\t\t\t\tconst errorMessage =\n\t\t\t\t\t\t\t\terror.message && error.code !== 'unknown_error'\n\t\t\t\t\t\t\t\t\t? error.message\n\t\t\t\t\t\t\t\t\t: __(\n\t\t\t\t\t\t\t\t\t\t\t'An error occurred while duplicating the page.'\n\t\t\t\t\t\t\t\t\t );\n\n\t\t\t\t\t\t\tcreateErrorNotice( errorMessage, {\n\t\t\t\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t} finally {\n\t\t\t\t\t\t\tsetIsCreatingPage( false );\n\t\t\t\t\t\t\tcloseModal();\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<form onSubmit={ createPage }>\n\t\t\t\t\t\t\t<VStack spacing={ 3 }>\n\t\t\t\t\t\t\t\t<DataForm\n\t\t\t\t\t\t\t\t\tdata={ item }\n\t\t\t\t\t\t\t\t\tfields={ fields }\n\t\t\t\t\t\t\t\t\tform={ formDuplicateAction }\n\t\t\t\t\t\t\t\t\tonChange={ setItem }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t<HStack spacing={ 2 } justify=\"end\">\n\t\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t\t\t\t\t\tonClick={ closeModal }\n\t\t\t\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t{ __( 'Cancel' ) }\n\t\t\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\t\t\t\t\ttype=\"submit\"\n\t\t\t\t\t\t\t\t\t\tisBusy={ isCreatingPage }\n\t\t\t\t\t\t\t\t\t\taria-disabled={ isCreatingPage }\n\t\t\t\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t{ _x( 'Duplicate', 'action label' ) }\n\t\t\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t\t\t</HStack>\n\t\t\t\t\t\t\t</VStack>\n\t\t\t\t\t\t</form>\n\t\t\t\t\t);\n\t\t\t\t},\n\t\t\t},\n\t\t[ userCanCreatePost ]\n\t);\n};\n\nexport const duplicatePatternAction = {\n\tid: 'duplicate-pattern',\n\tlabel: _x( 'Duplicate', 'action label' ),\n\tisEligible: ( item ) => item.type !== TEMPLATE_PART_POST_TYPE,\n\tmodalHeader: _x( 'Duplicate pattern', 'action label' ),\n\tRenderModal: ( { items, closeModal } ) => {\n\t\tconst [ item ] = items;\n\t\tconst duplicatedProps = useDuplicatePatternProps( {\n\t\t\tpattern: item,\n\t\t\tonSuccess: () => closeModal(),\n\t\t} );\n\t\treturn (\n\t\t\t<CreatePatternModalContents\n\t\t\t\tonClose={ closeModal }\n\t\t\t\tconfirmLabel={ _x( 'Duplicate', 'action label' ) }\n\t\t\t\t{ ...duplicatedProps }\n\t\t\t/>\n\t\t);\n\t},\n};\n\nexport const duplicateTemplatePartAction = {\n\tid: 'duplicate-template-part',\n\tlabel: _x( 'Duplicate', 'action label' ),\n\tisEligible: ( item ) => item.type === TEMPLATE_PART_POST_TYPE,\n\tmodalHeader: _x( 'Duplicate template part', 'action label' ),\n\tRenderModal: ( { items, closeModal } ) => {\n\t\tconst [ item ] = items;\n\t\tconst blocks = useMemo( () => {\n\t\t\treturn (\n\t\t\t\titem.blocks ??\n\t\t\t\tparse(\n\t\t\t\t\ttypeof item.content === 'string'\n\t\t\t\t\t\t? item.content\n\t\t\t\t\t\t: item.content.raw,\n\t\t\t\t\t{\n\t\t\t\t\t\t__unstableSkipMigrationLogs: true,\n\t\t\t\t\t}\n\t\t\t\t)\n\t\t\t);\n\t\t}, [ item.content, item.blocks ] );\n\t\tconst { createSuccessNotice } = useDispatch( noticesStore );\n\t\tfunction onTemplatePartSuccess() {\n\t\t\tcreateSuccessNotice(\n\t\t\t\tsprintf(\n\t\t\t\t\t// translators: %s: The new template part's title e.g. 'Call to action (copy)'.\n\t\t\t\t\t__( '\"%s\" duplicated.' ),\n\t\t\t\t\tgetItemTitle( item )\n\t\t\t\t),\n\t\t\t\t{ type: 'snackbar', id: 'edit-site-patterns-success' }\n\t\t\t);\n\t\t\tcloseModal();\n\t\t}\n\t\treturn (\n\t\t\t<CreateTemplatePartModalContents\n\t\t\t\tblocks={ blocks }\n\t\t\t\tdefaultArea={ item.area }\n\t\t\t\tdefaultTitle={ sprintf(\n\t\t\t\t\t/* translators: %s: Existing template part title */\n\t\t\t\t\t__( '%s (Copy)' ),\n\t\t\t\t\tgetItemTitle( item )\n\t\t\t\t) }\n\t\t\t\tonCreate={ onTemplatePartSuccess }\n\t\t\t\tonError={ closeModal }\n\t\t\t\tconfirmLabel={ _x( 'Duplicate', 'action label' ) }\n\t\t\t/>\n\t\t);\n\t},\n};\n\nexport function usePostActions( { postType, onActionPerformed, context } ) {\n\tconst { defaultActions, postTypeObject, userCanCreatePostType } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getPostType, canUser } = select( coreStore );\n\t\t\tconst { getEntityActions } = unlock( select( editorStore ) );\n\t\t\treturn {\n\t\t\t\tpostTypeObject: getPostType( postType ),\n\t\t\t\tdefaultActions: getEntityActions( 'postType', postType ),\n\t\t\t\tuserCanCreatePostType: canUser( 'create', {\n\t\t\t\t\tkind: 'postType',\n\t\t\t\t\tname: postType,\n\t\t\t\t} ),\n\t\t\t};\n\t\t},\n\t\t[ postType ]\n\t);\n\tconst { registerPostTypeActions } = unlock( useDispatch( editorStore ) );\n\tuseEffect( () => {\n\t\tregisterPostTypeActions( postType );\n\t}, [ registerPostTypeActions, postType ] );\n\n\tconst duplicatePostAction = useDuplicatePostAction( postType );\n\tconst reorderPagesAction = useReorderPagesAction( postType );\n\tconst isTemplateOrTemplatePart = [\n\t\tTEMPLATE_POST_TYPE,\n\t\tTEMPLATE_PART_POST_TYPE,\n\t].includes( postType );\n\tconst isPattern = postType === PATTERN_POST_TYPE;\n\tconst isLoaded = !! postTypeObject;\n\tconst supportsRevisions = !! postTypeObject?.supports?.revisions;\n\tconst supportsTitle = !! postTypeObject?.supports?.title;\n\treturn useMemo( () => {\n\t\tif ( ! isLoaded ) {\n\t\t\treturn [];\n\t\t}\n\n\t\tlet actions = [\n\t\t\tpostTypeObject?.viewable && viewPostAction,\n\t\t\tsupportsRevisions && postRevisionsAction,\n\t\t\tglobalThis.IS_GUTENBERG_PLUGIN\n\t\t\t\t? ! isTemplateOrTemplatePart &&\n\t\t\t\t ! isPattern &&\n\t\t\t\t duplicatePostAction\n\t\t\t\t: false,\n\t\t\tisTemplateOrTemplatePart &&\n\t\t\t\tuserCanCreatePostType &&\n\t\t\t\tduplicateTemplatePartAction,\n\t\t\tisPattern && userCanCreatePostType && duplicatePatternAction,\n\t\t\tsupportsTitle && renamePostAction,\n\t\t\treorderPagesAction,\n\t\t\t...defaultActions,\n\t\t].filter( Boolean );\n\t\t// Filter actions based on provided context. If not provided\n\t\t// all actions are returned. We'll have a single entry for getting the actions\n\t\t// and the consumer should provide the context to filter the actions, if needed.\n\t\t// Actions should also provide the `context` they support, if it's specific, to\n\t\t// compare with the provided context to get all the actions.\n\t\t// Right now the only supported context is `list`.\n\t\tactions = actions.filter( ( action ) => {\n\t\t\tif ( ! action.context ) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\treturn action.context === context;\n\t\t} );\n\n\t\tif ( onActionPerformed ) {\n\t\t\tfor ( let i = 0; i < actions.length; ++i ) {\n\t\t\t\tif ( actions[ i ].callback ) {\n\t\t\t\t\tconst existingCallback = actions[ i ].callback;\n\t\t\t\t\tactions[ i ] = {\n\t\t\t\t\t\t...actions[ i ],\n\t\t\t\t\t\tcallback: ( items, argsObject ) => {\n\t\t\t\t\t\t\texistingCallback( items, {\n\t\t\t\t\t\t\t\t...argsObject,\n\t\t\t\t\t\t\t\tonActionPerformed: ( _items ) => {\n\t\t\t\t\t\t\t\t\tif ( argsObject?.onActionPerformed ) {\n\t\t\t\t\t\t\t\t\t\targsObject.onActionPerformed( _items );\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tonActionPerformed(\n\t\t\t\t\t\t\t\t\t\tactions[ i ].id,\n\t\t\t\t\t\t\t\t\t\t_items\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}\n\t\t\t\tif ( actions[ i ].RenderModal ) {\n\t\t\t\t\tconst ExistingRenderModal = actions[ i ].RenderModal;\n\t\t\t\t\tactions[ i ] = {\n\t\t\t\t\t\t...actions[ i ],\n\t\t\t\t\t\tRenderModal: ( props ) => {\n\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t<ExistingRenderModal\n\t\t\t\t\t\t\t\t\t{ ...props }\n\t\t\t\t\t\t\t\t\tonActionPerformed={ ( _items ) => {\n\t\t\t\t\t\t\t\t\t\tif ( props.onActionPerformed ) {\n\t\t\t\t\t\t\t\t\t\t\tprops.onActionPerformed( _items );\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tonActionPerformed(\n\t\t\t\t\t\t\t\t\t\t\tactions[ i ].id,\n\t\t\t\t\t\t\t\t\t\t\t_items\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}\n\t\t\t}\n\t\t}\n\n\t\treturn actions;\n\t}, [\n\t\tdefaultActions,\n\t\tuserCanCreatePostType,\n\t\tisTemplateOrTemplatePart,\n\t\tisPattern,\n\t\tpostTypeObject?.viewable,\n\t\tduplicatePostAction,\n\t\treorderPagesAction,\n\t\tonActionPerformed,\n\t\tisLoaded,\n\t\tsupportsRevisions,\n\t\tsupportsTitle,\n\t\tcontext,\n\t] );\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,IAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,aAAA,GAAAH,OAAA;AACA,IAAAI,SAAA,GAAAJ,OA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AEJ;UACD,CAAC;QACF;MACD;IACD;IAEA,OAAOT,OAAO;EACf,CAAC,EAAE,CACFf,cAAc,EACdC,qBAAqB,EACrBO,wBAAwB,EACxBC,SAAS,EACTrE,cAAc,EAAE4E,QAAQ,EACxBV,mBAAmB,EACnBC,kBAAkB,EAClB7J,iBAAiB,EACjBiK,QAAQ,EACRC,iBAAiB,EACjBE,aAAa,EACb/J,OAAO,CACN,CAAC;AACJ","ignoreList":[]}
|
|
@@ -36,6 +36,7 @@ function PostActions({
|
|
|
36
36
|
const [isActionsMenuOpen, setIsActionsMenuOpen] = (0, _element.useState)(false);
|
|
37
37
|
const {
|
|
38
38
|
item,
|
|
39
|
+
permissions,
|
|
39
40
|
postType
|
|
40
41
|
} = (0, _data.useSelect)(select => {
|
|
41
42
|
const {
|
|
@@ -43,23 +44,32 @@ function PostActions({
|
|
|
43
44
|
getCurrentPostId
|
|
44
45
|
} = select(_store.store);
|
|
45
46
|
const {
|
|
46
|
-
getEditedEntityRecord
|
|
47
|
-
|
|
47
|
+
getEditedEntityRecord,
|
|
48
|
+
getEntityRecordPermissions
|
|
49
|
+
} = (0, _lockUnlock.unlock)(select(_coreData.store));
|
|
48
50
|
const _postType = getCurrentPostType();
|
|
51
|
+
const _id = getCurrentPostId();
|
|
49
52
|
return {
|
|
50
|
-
item: getEditedEntityRecord('postType', _postType,
|
|
53
|
+
item: getEditedEntityRecord('postType', _postType, _id),
|
|
54
|
+
permissions: getEntityRecordPermissions('postType', _postType, _id),
|
|
51
55
|
postType: _postType
|
|
52
56
|
};
|
|
53
57
|
}, []);
|
|
58
|
+
const itemWithPermissions = (0, _element.useMemo)(() => {
|
|
59
|
+
return {
|
|
60
|
+
...item,
|
|
61
|
+
permissions
|
|
62
|
+
};
|
|
63
|
+
}, [item, permissions]);
|
|
54
64
|
const allActions = (0, _actions.usePostActions)({
|
|
55
65
|
postType,
|
|
56
66
|
onActionPerformed
|
|
57
67
|
});
|
|
58
68
|
const actions = (0, _element.useMemo)(() => {
|
|
59
69
|
return allActions.filter(action => {
|
|
60
|
-
return !action.isEligible || action.isEligible(
|
|
70
|
+
return !action.isEligible || action.isEligible(itemWithPermissions);
|
|
61
71
|
});
|
|
62
|
-
}, [allActions,
|
|
72
|
+
}, [allActions, itemWithPermissions]);
|
|
63
73
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(DropdownMenu, {
|
|
64
74
|
open: isActionsMenuOpen,
|
|
65
75
|
trigger: /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Button, {
|
|
@@ -76,7 +86,7 @@ function PostActions({
|
|
|
76
86
|
placement: "bottom-end",
|
|
77
87
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(ActionsDropdownMenuGroup, {
|
|
78
88
|
actions: actions,
|
|
79
|
-
item:
|
|
89
|
+
item: itemWithPermissions,
|
|
80
90
|
onClose: () => {
|
|
81
91
|
setIsActionsMenuOpen(false);
|
|
82
92
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_data","require","_element","_i18n","_components","_icons","_coreData","_lockUnlock","_actions","_store","_jsxRuntime","DropdownMenuV2","DropdownMenu","DropdownMenuGroupV2","DropdownMenuGroup","DropdownMenuItemV2","DropdownMenuItem","DropdownMenuItemLabelV2","DropdownMenuItemLabel","kebabCase","unlock","componentsPrivateApis","PostActions","onActionPerformed","buttonProps","isActionsMenuOpen","setIsActionsMenuOpen","useState","item","postType","useSelect","select","getCurrentPostType","getCurrentPostId","editorStore","getEditedEntityRecord","coreStore","_postType","allActions","usePostActions","actions","useMemo","filter","action","isEligible","jsx","open","trigger","Button","size","icon","moreVertical","label","__","disabled","length","accessibleWhenDisabled","className","onClick","onOpenChange","placement","children","ActionsDropdownMenuGroup","onClose","DropdownMenuItemTrigger","items","hideOnClick","RenderModal","ActionWithModal","ActionTrigger","isModalOpen","setIsModalOpen","actionTriggerProps","hideModalHeader","jsxs","Fragment","Modal","title","modalHeader","__experimentalHideHeader","onRequestClose","overlayClassName","id","focusOnMount","closeModal","map","callback"],"sources":["@wordpress/editor/src/components/post-actions/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { useState, useMemo } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport {\n\tprivateApis as componentsPrivateApis,\n\tButton,\n\tModal,\n} from '@wordpress/components';\nimport { moreVertical } from '@wordpress/icons';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\nimport { usePostActions } from './actions';\nimport { store as editorStore } from '../../store';\n\nconst {\n\tDropdownMenuV2: DropdownMenu,\n\tDropdownMenuGroupV2: DropdownMenuGroup,\n\tDropdownMenuItemV2: DropdownMenuItem,\n\tDropdownMenuItemLabelV2: DropdownMenuItemLabel,\n\tkebabCase,\n} = unlock( componentsPrivateApis );\n\nexport default function PostActions( { onActionPerformed, buttonProps } ) {\n\tconst [ isActionsMenuOpen, setIsActionsMenuOpen ] = useState( false );\n\tconst { item, postType } = useSelect( ( select ) => {\n\t\tconst { getCurrentPostType, getCurrentPostId } = select( editorStore );\n\t\tconst { getEditedEntityRecord } = select( coreStore );\n\t\tconst _postType = getCurrentPostType();\n\t\treturn {\n\t\t\titem: getEditedEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\t_postType,\n\t\t\t\tgetCurrentPostId()\n\t\t\t),\n\t\t\tpostType: _postType,\n\t\t};\n\t}, [] );\n\tconst allActions = usePostActions( { postType, onActionPerformed } );\n\n\tconst actions = useMemo( () => {\n\t\treturn allActions.filter( ( action ) => {\n\t\t\treturn ! action.isEligible || action.isEligible( item );\n\t\t} );\n\t}, [ allActions, item ] );\n\n\treturn (\n\t\t<DropdownMenu\n\t\t\topen={ isActionsMenuOpen }\n\t\t\ttrigger={\n\t\t\t\t<Button\n\t\t\t\t\tsize=\"small\"\n\t\t\t\t\ticon={ moreVertical }\n\t\t\t\t\tlabel={ __( 'Actions' ) }\n\t\t\t\t\tdisabled={ ! actions.length }\n\t\t\t\t\taccessibleWhenDisabled\n\t\t\t\t\tclassName=\"editor-all-actions-button\"\n\t\t\t\t\tonClick={ () =>\n\t\t\t\t\t\tsetIsActionsMenuOpen( ! isActionsMenuOpen )\n\t\t\t\t\t}\n\t\t\t\t\t{ ...buttonProps }\n\t\t\t\t/>\n\t\t\t}\n\t\t\tonOpenChange={ setIsActionsMenuOpen }\n\t\t\tplacement=\"bottom-end\"\n\t\t>\n\t\t\t<ActionsDropdownMenuGroup\n\t\t\t\tactions={ actions }\n\t\t\t\titem={ item }\n\t\t\t\tonClose={ () => {\n\t\t\t\t\tsetIsActionsMenuOpen( false );\n\t\t\t\t} }\n\t\t\t/>\n\t\t</DropdownMenu>\n\t);\n}\n\n// From now on all the functions on this file are copied as from the dataviews packages,\n// The editor packages should not be using the dataviews packages directly,\n// and the dataviews package should not be using the editor packages directly,\n// so duplicating the code here seems like the least bad option.\n\n// Copied as is from packages/dataviews/src/item-actions.js\nfunction DropdownMenuItemTrigger( { action, onClick, items } ) {\n\tconst label =\n\t\ttypeof action.label === 'string' ? action.label : action.label( items );\n\treturn (\n\t\t<DropdownMenuItem\n\t\t\tonClick={ onClick }\n\t\t\thideOnClick={ ! action.RenderModal }\n\t\t>\n\t\t\t<DropdownMenuItemLabel>{ label }</DropdownMenuItemLabel>\n\t\t</DropdownMenuItem>\n\t);\n}\n\n// Copied as is from packages/dataviews/src/item-actions.js\n// With an added onClose prop.\nfunction ActionWithModal( { action, item, ActionTrigger, onClose } ) {\n\tconst [ isModalOpen, setIsModalOpen ] = useState( false );\n\tconst actionTriggerProps = {\n\t\taction,\n\t\tonClick: () => setIsModalOpen( true ),\n\t\titems: [ item ],\n\t};\n\tconst { RenderModal, hideModalHeader } = action;\n\treturn (\n\t\t<>\n\t\t\t<ActionTrigger { ...actionTriggerProps } />\n\t\t\t{ isModalOpen && (\n\t\t\t\t<Modal\n\t\t\t\t\ttitle={ action.modalHeader || action.label }\n\t\t\t\t\t__experimentalHideHeader={ !! hideModalHeader }\n\t\t\t\t\tonRequestClose={ () => {\n\t\t\t\t\t\tsetIsModalOpen( false );\n\t\t\t\t\t} }\n\t\t\t\t\toverlayClassName={ `editor-action-modal editor-action-modal__${ kebabCase(\n\t\t\t\t\t\taction.id\n\t\t\t\t\t) }` }\n\t\t\t\t\tfocusOnMount=\"firstContentElement\"\n\t\t\t\t\tsize=\"small\"\n\t\t\t\t>\n\t\t\t\t\t<RenderModal\n\t\t\t\t\t\titems={ [ item ] }\n\t\t\t\t\t\tcloseModal={ () => {\n\t\t\t\t\t\t\tsetIsModalOpen( false );\n\t\t\t\t\t\t\tonClose();\n\t\t\t\t\t\t} }\n\t\t\t\t\t/>\n\t\t\t\t</Modal>\n\t\t\t) }\n\t\t</>\n\t);\n}\n\n// Copied as is from packages/dataviews/src/item-actions.js\n// With an added onClose prop.\nfunction ActionsDropdownMenuGroup( { actions, item, onClose } ) {\n\treturn (\n\t\t<DropdownMenuGroup>\n\t\t\t{ actions.map( ( action ) => {\n\t\t\t\tif ( action.RenderModal ) {\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<ActionWithModal\n\t\t\t\t\t\t\tkey={ action.id }\n\t\t\t\t\t\t\taction={ action }\n\t\t\t\t\t\t\titem={ item }\n\t\t\t\t\t\t\tActionTrigger={ DropdownMenuItemTrigger }\n\t\t\t\t\t\t\tonClose={ onClose }\n\t\t\t\t\t\t/>\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\treturn (\n\t\t\t\t\t<DropdownMenuItemTrigger\n\t\t\t\t\t\tkey={ action.id }\n\t\t\t\t\t\taction={ action }\n\t\t\t\t\t\tonClick={ () => action.callback( [ item ] ) }\n\t\t\t\t\t\titems={ [ item ] }\n\t\t\t\t\t/>\n\t\t\t\t);\n\t\t\t} ) }\n\t\t</DropdownMenuGroup>\n\t);\n}\n"],"mappings":";;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,KAA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CAAI;QAClBwD,UAAU,EAAGA,CAAA,KAAM;UAClBb,cAAc,CAAE,KAAM,CAAC;UACvBR,OAAO,CAAC,CAAC;QACV;MAAG,CACH;IAAC,CACI,CACP;EAAA,CACA,CAAC;AAEL;;AAEA;AACA;AACA,SAASD,wBAAwBA,CAAE;EAAEtB,OAAO;EAAEZ,IAAI;EAAEmC;AAAQ,CAAC,EAAG;EAC/D,oBACC,IAAArD,WAAA,CAAAmC,GAAA,EAAC/B,iBAAiB;IAAA+C,QAAA,EACfrB,OAAO,CAAC6C,GAAG,CAAI1C,MAAM,IAAM;MAC5B,IAAKA,MAAM,CAACwB,WAAW,EAAG;QACzB,oBACC,IAAAzD,WAAA,CAAAmC,GAAA,EAACuB,eAAe;UAEfzB,MAAM,EAAGA,MAAQ;UACjBf,IAAI,EAAGA,IAAM;UACbyC,aAAa,EAAGL,uBAAyB;UACzCD,OAAO,EAAGA;QAAS,GAJbpB,MAAM,CAACuC,EAKb,CAAC;MAEJ;MACA,oBACC,IAAAxE,WAAA,CAAAmC,GAAA,EAACmB,uBAAuB;QAEvBrB,MAAM,EAAGA,MAAQ;QACjBe,OAAO,EAAGA,CAAA,KAAMf,MAAM,CAAC2C,QAAQ,CAAE,CAAE1D,IAAI,CAAG,CAAG;QAC7CqC,KAAK,EAAG,CAAErC,IAAI;MAAI,GAHZe,MAAM,CAACuC,EAIb,CAAC;IAEJ,CAAE;EAAC,CACe,CAAC;AAEtB","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_data","require","_element","_i18n","_components","_icons","_coreData","_lockUnlock","_actions","_store","_jsxRuntime","DropdownMenuV2","DropdownMenu","DropdownMenuGroupV2","DropdownMenuGroup","DropdownMenuItemV2","DropdownMenuItem","DropdownMenuItemLabelV2","DropdownMenuItemLabel","kebabCase","unlock","componentsPrivateApis","PostActions","onActionPerformed","buttonProps","isActionsMenuOpen","setIsActionsMenuOpen","useState","item","permissions","postType","useSelect","select","getCurrentPostType","getCurrentPostId","editorStore","getEditedEntityRecord","getEntityRecordPermissions","coreStore","_postType","_id","itemWithPermissions","useMemo","allActions","usePostActions","actions","filter","action","isEligible","jsx","open","trigger","Button","size","icon","moreVertical","label","__","disabled","length","accessibleWhenDisabled","className","onClick","onOpenChange","placement","children","ActionsDropdownMenuGroup","onClose","DropdownMenuItemTrigger","items","hideOnClick","RenderModal","ActionWithModal","ActionTrigger","isModalOpen","setIsModalOpen","actionTriggerProps","hideModalHeader","jsxs","Fragment","Modal","title","modalHeader","__experimentalHideHeader","onRequestClose","overlayClassName","id","focusOnMount","closeModal","map","callback"],"sources":["@wordpress/editor/src/components/post-actions/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { useState, useMemo } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport {\n\tprivateApis as componentsPrivateApis,\n\tButton,\n\tModal,\n} from '@wordpress/components';\nimport { moreVertical } from '@wordpress/icons';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\nimport { usePostActions } from './actions';\nimport { store as editorStore } from '../../store';\n\nconst {\n\tDropdownMenuV2: DropdownMenu,\n\tDropdownMenuGroupV2: DropdownMenuGroup,\n\tDropdownMenuItemV2: DropdownMenuItem,\n\tDropdownMenuItemLabelV2: DropdownMenuItemLabel,\n\tkebabCase,\n} = unlock( componentsPrivateApis );\n\nexport default function PostActions( { onActionPerformed, buttonProps } ) {\n\tconst [ isActionsMenuOpen, setIsActionsMenuOpen ] = useState( false );\n\tconst { item, permissions, postType } = useSelect( ( select ) => {\n\t\tconst { getCurrentPostType, getCurrentPostId } = select( editorStore );\n\t\tconst { getEditedEntityRecord, getEntityRecordPermissions } = unlock(\n\t\t\tselect( coreStore )\n\t\t);\n\t\tconst _postType = getCurrentPostType();\n\t\tconst _id = getCurrentPostId();\n\t\treturn {\n\t\t\titem: getEditedEntityRecord( 'postType', _postType, _id ),\n\t\t\tpermissions: getEntityRecordPermissions(\n\t\t\t\t'postType',\n\t\t\t\t_postType,\n\t\t\t\t_id\n\t\t\t),\n\t\t\tpostType: _postType,\n\t\t};\n\t}, [] );\n\tconst itemWithPermissions = useMemo( () => {\n\t\treturn {\n\t\t\t...item,\n\t\t\tpermissions,\n\t\t};\n\t}, [ item, permissions ] );\n\tconst allActions = usePostActions( { postType, onActionPerformed } );\n\n\tconst actions = useMemo( () => {\n\t\treturn allActions.filter( ( action ) => {\n\t\t\treturn (\n\t\t\t\t! action.isEligible || action.isEligible( itemWithPermissions )\n\t\t\t);\n\t\t} );\n\t}, [ allActions, itemWithPermissions ] );\n\n\treturn (\n\t\t<DropdownMenu\n\t\t\topen={ isActionsMenuOpen }\n\t\t\ttrigger={\n\t\t\t\t<Button\n\t\t\t\t\tsize=\"small\"\n\t\t\t\t\ticon={ moreVertical }\n\t\t\t\t\tlabel={ __( 'Actions' ) }\n\t\t\t\t\tdisabled={ ! actions.length }\n\t\t\t\t\taccessibleWhenDisabled\n\t\t\t\t\tclassName=\"editor-all-actions-button\"\n\t\t\t\t\tonClick={ () =>\n\t\t\t\t\t\tsetIsActionsMenuOpen( ! isActionsMenuOpen )\n\t\t\t\t\t}\n\t\t\t\t\t{ ...buttonProps }\n\t\t\t\t/>\n\t\t\t}\n\t\t\tonOpenChange={ setIsActionsMenuOpen }\n\t\t\tplacement=\"bottom-end\"\n\t\t>\n\t\t\t<ActionsDropdownMenuGroup\n\t\t\t\tactions={ actions }\n\t\t\t\titem={ itemWithPermissions }\n\t\t\t\tonClose={ () => {\n\t\t\t\t\tsetIsActionsMenuOpen( false );\n\t\t\t\t} }\n\t\t\t/>\n\t\t</DropdownMenu>\n\t);\n}\n\n// From now on all the functions on this file are copied as from the dataviews packages,\n// The editor packages should not be using the dataviews packages directly,\n// and the dataviews package should not be using the editor packages directly,\n// so duplicating the code here seems like the least bad option.\n\n// Copied as is from packages/dataviews/src/item-actions.js\nfunction DropdownMenuItemTrigger( { action, onClick, items } ) {\n\tconst label =\n\t\ttypeof action.label === 'string' ? action.label : action.label( items );\n\treturn (\n\t\t<DropdownMenuItem\n\t\t\tonClick={ onClick }\n\t\t\thideOnClick={ ! action.RenderModal }\n\t\t>\n\t\t\t<DropdownMenuItemLabel>{ label }</DropdownMenuItemLabel>\n\t\t</DropdownMenuItem>\n\t);\n}\n\n// Copied as is from packages/dataviews/src/item-actions.js\n// With an added onClose prop.\nfunction ActionWithModal( { action, item, ActionTrigger, onClose } ) {\n\tconst [ isModalOpen, setIsModalOpen ] = useState( false );\n\tconst actionTriggerProps = {\n\t\taction,\n\t\tonClick: () => setIsModalOpen( true ),\n\t\titems: [ item ],\n\t};\n\tconst { RenderModal, hideModalHeader } = action;\n\treturn (\n\t\t<>\n\t\t\t<ActionTrigger { ...actionTriggerProps } />\n\t\t\t{ isModalOpen && (\n\t\t\t\t<Modal\n\t\t\t\t\ttitle={ action.modalHeader || action.label }\n\t\t\t\t\t__experimentalHideHeader={ !! hideModalHeader }\n\t\t\t\t\tonRequestClose={ () => {\n\t\t\t\t\t\tsetIsModalOpen( false );\n\t\t\t\t\t} }\n\t\t\t\t\toverlayClassName={ `editor-action-modal editor-action-modal__${ kebabCase(\n\t\t\t\t\t\taction.id\n\t\t\t\t\t) }` }\n\t\t\t\t\tfocusOnMount=\"firstContentElement\"\n\t\t\t\t\tsize=\"small\"\n\t\t\t\t>\n\t\t\t\t\t<RenderModal\n\t\t\t\t\t\titems={ [ item ] }\n\t\t\t\t\t\tcloseModal={ () => {\n\t\t\t\t\t\t\tsetIsModalOpen( false );\n\t\t\t\t\t\t\tonClose();\n\t\t\t\t\t\t} }\n\t\t\t\t\t/>\n\t\t\t\t</Modal>\n\t\t\t) }\n\t\t</>\n\t);\n}\n\n// Copied as is from packages/dataviews/src/item-actions.js\n// With an added onClose prop.\nfunction ActionsDropdownMenuGroup( { actions, item, onClose } ) {\n\treturn (\n\t\t<DropdownMenuGroup>\n\t\t\t{ actions.map( ( action ) => {\n\t\t\t\tif ( action.RenderModal ) {\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<ActionWithModal\n\t\t\t\t\t\t\tkey={ action.id }\n\t\t\t\t\t\t\taction={ action }\n\t\t\t\t\t\t\titem={ item }\n\t\t\t\t\t\t\tActionTrigger={ DropdownMenuItemTrigger }\n\t\t\t\t\t\t\tonClose={ onClose }\n\t\t\t\t\t\t/>\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\treturn (\n\t\t\t\t\t<DropdownMenuItemTrigger\n\t\t\t\t\t\tkey={ action.id }\n\t\t\t\t\t\taction={ action }\n\t\t\t\t\t\tonClick={ () => action.callback( [ item ] ) }\n\t\t\t\t\t\titems={ [ item ] }\n\t\t\t\t\t/>\n\t\t\t\t);\n\t\t\t} ) }\n\t\t</DropdownMenuGroup>\n\t);\n}\n"],"mappings":";;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,WAAA,GAAAH,OAAA;AAKA,IAAAI,MAAA,GAAAJ,OAAA;AACA,IAAAK,SAAA,GAAAL,OAAA;AAKA,IAAAM,WAAA,GAAAN,OAAA;AACA,IAAAO,QAAA,GAAAP,OAAA;AACA,IAAAQ,MAAA,GAAAR,OAAA;AAAmD,IAAAS,WAAA,GAAAT,OAAA;AAnBnD;AACA;AACA;;AAYA;AACA;AACA;;AAKA,MAAM;EACLU,cAAc,EAAEC,YAAY;EAC5BC,mBAAmB,EAAEC,iBAAiB;EACtCC,kBAAkB,EAAEC,gBAAgB;EACpCC,uBAAuB,EAAEC,qBAAqB;EAC9CC;AACD,CAAC,GAAG,IAAAC,kBAAM,EAAEC,uBAAsB,CAAC;AAEpB,SAASC,WAAWA,CAAE;EAAEC,iBAAiB;EAAEC;AAAY,CAAC,EAAG;EACzE,MAAM,CAAEC,iBAAiB,EAAEC,oBAAoB,CAAE,GAAG,IAAAC,iBAAQ,EAAE,KAAM,CAAC;EACrE,MAAM;IAAE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pB,OAAO,CAAC4C,GAAG,CAAI1C,MAAM,IAAM;MAC5B,IAAKA,MAAM,CAACwB,WAAW,EAAG;QACzB,oBACC,IAAA7D,WAAA,CAAAuC,GAAA,EAACuB,eAAe;UAEfzB,MAAM,EAAGA,MAAQ;UACjBnB,IAAI,EAAGA,IAAM;UACb6C,aAAa,EAAGL,uBAAyB;UACzCD,OAAO,EAAGA;QAAS,GAJbpB,MAAM,CAACuC,EAKb,CAAC;MAEJ;MACA,oBACC,IAAA5E,WAAA,CAAAuC,GAAA,EAACmB,uBAAuB;QAEvBrB,MAAM,EAAGA,MAAQ;QACjBe,OAAO,EAAGA,CAAA,KAAMf,MAAM,CAAC2C,QAAQ,CAAE,CAAE9D,IAAI,CAAG,CAAG;QAC7CyC,KAAK,EAAG,CAAEzC,IAAI;MAAI,GAHZmB,MAAM,CAACuC,EAIb,CAAC;IAEJ,CAAE;EAAC,CACe,CAAC;AAEtB","ignoreList":[]}
|
|
@@ -4,6 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.useAuthorsQuery = useAuthorsQuery;
|
|
7
|
+
var _i18n = require("@wordpress/i18n");
|
|
7
8
|
var _element = require("@wordpress/element");
|
|
8
9
|
var _data = require("@wordpress/data");
|
|
9
10
|
var _htmlEntities = require("@wordpress/html-entities");
|
|
@@ -56,13 +57,19 @@ function useAuthorsQuery(search) {
|
|
|
56
57
|
const foundAuthor = fetchedAuthors.findIndex(({
|
|
57
58
|
value
|
|
58
59
|
}) => postAuthor?.id === value);
|
|
60
|
+
let currentAuthor = [];
|
|
59
61
|
if (foundAuthor < 0 && postAuthor) {
|
|
60
|
-
|
|
62
|
+
currentAuthor = [{
|
|
61
63
|
value: postAuthor.id,
|
|
62
64
|
label: (0, _htmlEntities.decodeEntities)(postAuthor.name)
|
|
63
|
-
}
|
|
65
|
+
}];
|
|
66
|
+
} else if (foundAuthor < 0 && !postAuthor) {
|
|
67
|
+
currentAuthor = [{
|
|
68
|
+
value: 0,
|
|
69
|
+
label: (0, _i18n.__)('(No author)')
|
|
70
|
+
}];
|
|
64
71
|
}
|
|
65
|
-
return fetchedAuthors;
|
|
72
|
+
return [...currentAuthor, ...fetchedAuthors];
|
|
66
73
|
}, [authors, postAuthor]);
|
|
67
74
|
return {
|
|
68
75
|
authorId,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["_i18n","require","_element","_data","_htmlEntities","_coreData","_store","_constants","useAuthorsQuery","search","authorId","authors","postAuthor","useSelect","select","getUser","getUsers","coreStore","getEditedPostAttribute","editorStore","_authorId","query","AUTHORS_QUERY","BASE_QUERY","authorOptions","useMemo","fetchedAuthors","map","author","value","id","label","decodeEntities","name","foundAuthor","findIndex","currentAuthor","__"],"sources":["@wordpress/editor/src/components/post-author/hook.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useMemo } from '@wordpress/element';\nimport { useSelect } from '@wordpress/data';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\nimport { AUTHORS_QUERY, BASE_QUERY } from './constants';\n\nexport function useAuthorsQuery( search ) {\n\tconst { authorId, authors, postAuthor } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getUser, getUsers } = select( coreStore );\n\t\t\tconst { getEditedPostAttribute } = select( editorStore );\n\t\t\tconst _authorId = getEditedPostAttribute( 'author' );\n\t\t\tconst query = { ...AUTHORS_QUERY };\n\n\t\t\tif ( search ) {\n\t\t\t\tquery.search = search;\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\tauthorId: _authorId,\n\t\t\t\tauthors: getUsers( query ),\n\t\t\t\tpostAuthor: getUser( _authorId, BASE_QUERY ),\n\t\t\t};\n\t\t},\n\t\t[ search ]\n\t);\n\n\tconst authorOptions = useMemo( () => {\n\t\tconst fetchedAuthors = ( authors ?? [] ).map( ( author ) => {\n\t\t\treturn {\n\t\t\t\tvalue: author.id,\n\t\t\t\tlabel: decodeEntities( author.name ),\n\t\t\t};\n\t\t} );\n\n\t\t// Ensure the current author is included in the dropdown list.\n\t\tconst foundAuthor = fetchedAuthors.findIndex(\n\t\t\t( { value } ) => postAuthor?.id === value\n\t\t);\n\n\t\tlet currentAuthor = [];\n\t\tif ( foundAuthor < 0 && postAuthor ) {\n\t\t\tcurrentAuthor = [\n\t\t\t\t{\n\t\t\t\t\tvalue: postAuthor.id,\n\t\t\t\t\tlabel: decodeEntities( postAuthor.name ),\n\t\t\t\t},\n\t\t\t];\n\t\t} else if ( foundAuthor < 0 && ! postAuthor ) {\n\t\t\tcurrentAuthor = [\n\t\t\t\t{\n\t\t\t\t\tvalue: 0,\n\t\t\t\t\tlabel: __( '(No author)' ),\n\t\t\t\t},\n\t\t\t];\n\t\t}\n\n\t\treturn [ ...currentAuthor, ...fetchedAuthors ];\n\t}, [ authors, postAuthor ] );\n\n\treturn { authorId, authorOptions, postAuthor };\n}\n"],"mappings":";;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,aAAA,GAAAH,OAAA;AACA,IAAAI,SAAA,GAAAJ,OAAA;AAKA,IAAAK,MAAA,GAAAL,OAAA;AACA,IAAAM,UAAA,GAAAN,OAAA;AAbA;AACA;AACA;;AAOA;AACA;AACA;;AAIO,SAASO,eAAeA,CAAEC,MAAM,EAAG;EACzC,MAAM;IAAEC,QAAQ;IAAEC,OAAO;IAAEC;EAAW,CAAC,GAAG,IAAAC,eAAS,EAChDC,MAAM,IAAM;IACb,MAAM;MAAEC,OAAO;MAAEC;IAAS,CAAC,GAAGF,MAAM,CAAEG,eAAU,CAAC;IACjD,MAAM;MAAEC;IAAuB,CAAC,GAAGJ,MAAM,CAAEK,YAAY,CAAC;IACxD,MA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AE,GAAGV,cAAc,CAAE;EAC/C,CAAC,EAAE,CAAEf,OAAO,EAAEC,UAAU,CAAG,CAAC;EAE5B,OAAO;IAAEF,QAAQ;IAAEc,aAAa;IAAEZ;EAAW,CAAC;AAC/C","ignoreList":[]}
|
|
@@ -9,6 +9,7 @@ exports.default = void 0;
|
|
|
9
9
|
var _i18n = require("@wordpress/i18n");
|
|
10
10
|
var _components = require("@wordpress/components");
|
|
11
11
|
var _element = require("@wordpress/element");
|
|
12
|
+
var _htmlEntities = require("@wordpress/html-entities");
|
|
12
13
|
var _blockEditor = require("@wordpress/block-editor");
|
|
13
14
|
var _check = _interopRequireDefault(require("./check"));
|
|
14
15
|
var _index = _interopRequireDefault(require("./index"));
|
|
@@ -30,7 +31,7 @@ function PostAuthorToggle({
|
|
|
30
31
|
const {
|
|
31
32
|
postAuthor
|
|
32
33
|
} = (0, _hook.useAuthorsQuery)();
|
|
33
|
-
const authorName = postAuthor?.name || '';
|
|
34
|
+
const authorName = (0, _htmlEntities.decodeEntities)(postAuthor?.name) || (0, _i18n.__)('(No author)');
|
|
34
35
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Button, {
|
|
35
36
|
size: "compact",
|
|
36
37
|
className: "editor-post-author__panel-toggle",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_i18n","require","_components","_element","_blockEditor","_check","_interopRequireDefault","_index","_postPanelRow","_hook","_jsxRuntime","PostAuthorToggle","isOpen","onClick","postAuthor","useAuthorsQuery","authorName","name","jsx","Button","size","className","variant","sprintf","
|
|
1
|
+
{"version":3,"names":["_i18n","require","_components","_element","_htmlEntities","_blockEditor","_check","_interopRequireDefault","_index","_postPanelRow","_hook","_jsxRuntime","PostAuthorToggle","isOpen","onClick","postAuthor","useAuthorsQuery","authorName","decodeEntities","name","__","jsx","Button","size","className","variant","sprintf","children","PostAuthor","popoverAnchor","setPopoverAnchor","useState","popoverProps","useMemo","anchor","placement","offset","shift","default","label","ref","Dropdown","contentClassName","focusOnMount","renderToggle","onToggle","renderContent","onClose","jsxs","__experimentalInspectorPopoverHeader","title","_default","exports"],"sources":["@wordpress/editor/src/components/post-author/panel.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, sprintf } from '@wordpress/i18n';\nimport { Button, Dropdown } from '@wordpress/components';\nimport { useState, useMemo } from '@wordpress/element';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { __experimentalInspectorPopoverHeader as InspectorPopoverHeader } from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport PostAuthorCheck from './check';\nimport PostAuthorForm from './index';\nimport PostPanelRow from '../post-panel-row';\nimport { useAuthorsQuery } from './hook';\n\nfunction PostAuthorToggle( { isOpen, onClick } ) {\n\tconst { postAuthor } = useAuthorsQuery();\n\tconst authorName =\n\t\tdecodeEntities( postAuthor?.name ) || __( '(No author)' );\n\treturn (\n\t\t<Button\n\t\t\tsize=\"compact\"\n\t\t\tclassName=\"editor-post-author__panel-toggle\"\n\t\t\tvariant=\"tertiary\"\n\t\t\taria-expanded={ isOpen }\n\t\t\t// translators: %s: Current post link.\n\t\t\taria-label={ sprintf( __( 'Change author: %s' ), authorName ) }\n\t\t\tonClick={ onClick }\n\t\t>\n\t\t\t{ authorName }\n\t\t</Button>\n\t);\n}\n\n/**\n * Renders the Post Author Panel component.\n *\n * @return {Component} The component to be rendered.\n */\nexport function PostAuthor() {\n\t// Use internal state instead of a ref to make sure that the component\n\t// re-renders when the popover's anchor updates.\n\tconst [ popoverAnchor, setPopoverAnchor ] = useState( null );\n\t// Memoize popoverProps to avoid returning a new object every time.\n\tconst popoverProps = useMemo(\n\t\t() => ( {\n\t\t\t// Anchor the popover to the middle of the entire row so that it doesn't\n\t\t\t// move around when the label changes.\n\t\t\tanchor: popoverAnchor,\n\t\t\tplacement: 'left-start',\n\t\t\toffset: 36,\n\t\t\tshift: true,\n\t\t} ),\n\t\t[ popoverAnchor ]\n\t);\n\treturn (\n\t\t<PostAuthorCheck>\n\t\t\t<PostPanelRow label={ __( 'Author' ) } ref={ setPopoverAnchor }>\n\t\t\t\t<Dropdown\n\t\t\t\t\tpopoverProps={ popoverProps }\n\t\t\t\t\tcontentClassName=\"editor-post-author__panel-dialog\"\n\t\t\t\t\tfocusOnMount\n\t\t\t\t\trenderToggle={ ( { isOpen, onToggle } ) => (\n\t\t\t\t\t\t<PostAuthorToggle\n\t\t\t\t\t\t\tisOpen={ isOpen }\n\t\t\t\t\t\t\tonClick={ onToggle }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t\trenderContent={ ( { onClose } ) => (\n\t\t\t\t\t\t<div className=\"editor-post-author\">\n\t\t\t\t\t\t\t<InspectorPopoverHeader\n\t\t\t\t\t\t\t\ttitle={ __( 'Author' ) }\n\t\t\t\t\t\t\t\tonClose={ onClose }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<PostAuthorForm onClose={ onClose } />\n\t\t\t\t\t\t</div>\n\t\t\t\t\t) }\n\t\t\t\t/>\n\t\t\t</PostPanelRow>\n\t\t</PostAuthorCheck>\n\t);\n}\n\nexport default PostAuthor;\n"],"mappings":";;;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,aAAA,GAAAH,OAAA;AACA,IAAAI,YAAA,GAAAJ,OAAA;AAKA,IAAAK,MAAA,GAAAC,sBAAA,CAAAN,OAAA;AACA,IAAAO,MAAA,GAAAD,sBAAA,CAAAN,OAAA;AACA,IAAAQ,aAAA,GAAAF,sBAAA,CAAAN,OAAA;AACA,IAAAS,KAAA,GAAAT,OAAA;AAAyC,IAAAU,WAAA,GAAAV,OAAA;AAfzC;AACA;AACA;;AAOA;AACA;AACA;;AAMA,SAASW,gBAAgBA,CAAE;EAAEC,MAAM;EAAEC;AAAQ,CAAC,EAAG;EAChD,MAAM;IAAEC;EAAW,CAAC,GAAG,IAAAC,qBAAe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CAAC,kBACpC,IAAAlC,WAAA,CAAAU,GAAA,EAACT,gBAAgB;UAChBC,MAAM,EAAGA,MAAQ;UACjBC,OAAO,EAAG+B;QAAU,CACpB,CACC;QACHC,aAAa,EAAGA,CAAE;UAAEC;QAAQ,CAAC,kBAC5B,IAAApC,WAAA,CAAAqC,IAAA;UAAKxB,SAAS,EAAC,oBAAoB;UAAAG,QAAA,gBAClC,IAAAhB,WAAA,CAAAU,GAAA,EAAChB,YAAA,CAAA4C,oCAAsB;YACtBC,KAAK,EAAG,IAAA9B,QAAE,EAAE,QAAS,CAAG;YACxB2B,OAAO,EAAGA;UAAS,CACnB,CAAC,eACF,IAAApC,WAAA,CAAAU,GAAA,EAACb,MAAA,CAAA8B,OAAc;YAACS,OAAO,EAAGA;UAAS,CAAE,CAAC;QAAA,CAClC;MACH,CACH;IAAC,CACW;EAAC,CACC,CAAC;AAEpB;AAAC,IAAAI,QAAA,GAAAC,OAAA,CAAAd,OAAA,GAEcV,UAAU","ignoreList":[]}
|
|
@@ -95,7 +95,7 @@ function PostCardPanel({
|
|
|
95
95
|
weight: 500,
|
|
96
96
|
as: "h2",
|
|
97
97
|
lineHeight: "20px",
|
|
98
|
-
children: [title ? (0, _htmlEntities.decodeEntities)(title) : (0, _i18n.__)('No
|
|
98
|
+
children: [title ? (0, _htmlEntities.decodeEntities)(title) : (0, _i18n.__)('No title'), isFrontPage && /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
99
99
|
className: "editor-post-card-panel__title-badge",
|
|
100
100
|
children: (0, _i18n.__)('Homepage')
|
|
101
101
|
}), isPostsPage && /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_clsx","_interopRequireDefault","require","_components","_coreData","_data","_i18n","_htmlEntities","_store","_constants","_lockUnlock","_jsxRuntime","PostCardPanel","actions","isFrontPage","isPostsPage","title","icon","isSync","useSelect","select","getEditedPostAttribute","getCurrentPostType","getCurrentPostId","__experimentalGetTemplateInfo","editorStore","canUser","coreStore","getEditedEntityRecord","siteSettings","kind","name","undefined","_type","_id","_record","_templateInfo","TEMPLATE_POST_TYPE","TEMPLATE_PART_POST_TYPE","includes","_isSync","GLOBAL_POST_TYPES","PATTERN_POST_TYPE","currentSyncStatus","wp_pattern_sync_status","unlock","getPostIcon","area","page_on_front","page_for_posts","jsx","className","children","jsxs","__experimentalHStack","spacing","align","Icon","clsx","__experimentalText","numberOfLines","truncate","weight","as","lineHeight","decodeEntities","__"],"sources":["@wordpress/editor/src/components/post-card-panel/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n/**\n * WordPress dependencies\n */\nimport {\n\tIcon,\n\t__experimentalHStack as HStack,\n\t__experimentalText as Text,\n} from '@wordpress/components';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useSelect } from '@wordpress/data';\nimport { __ } from '@wordpress/i18n';\nimport { decodeEntities } from '@wordpress/html-entities';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\nimport {\n\tTEMPLATE_POST_TYPE,\n\tTEMPLATE_PART_POST_TYPE,\n\tPATTERN_POST_TYPE,\n\tGLOBAL_POST_TYPES,\n} from '../../store/constants';\nimport { unlock } from '../../lock-unlock';\n\nexport default function PostCardPanel( { actions } ) {\n\tconst { isFrontPage, isPostsPage, title, icon, isSync } = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetEditedPostAttribute,\n\t\t\t\tgetCurrentPostType,\n\t\t\t\tgetCurrentPostId,\n\t\t\t\t__experimentalGetTemplateInfo,\n\t\t\t} = select( editorStore );\n\t\t\tconst { canUser } = select( coreStore );\n\t\t\tconst { getEditedEntityRecord } = select( coreStore );\n\t\t\tconst siteSettings = canUser( 'read', {\n\t\t\t\tkind: 'root',\n\t\t\t\tname: 'site',\n\t\t\t} )\n\t\t\t\t? getEditedEntityRecord( 'root', 'site' )\n\t\t\t\t: undefined;\n\t\t\tconst _type = getCurrentPostType();\n\t\t\tconst _id = getCurrentPostId();\n\t\t\tconst _record = getEditedEntityRecord( 'postType', _type, _id );\n\t\t\tconst _templateInfo =\n\t\t\t\t[ TEMPLATE_POST_TYPE, TEMPLATE_PART_POST_TYPE ].includes(\n\t\t\t\t\t_type\n\t\t\t\t) && __experimentalGetTemplateInfo( _record );\n\t\t\tlet _isSync = false;\n\t\t\tif ( GLOBAL_POST_TYPES.includes( _type ) ) {\n\t\t\t\tif ( PATTERN_POST_TYPE === _type ) {\n\t\t\t\t\t// When the post is first created, the top level wp_pattern_sync_status is not set so get meta value instead.\n\t\t\t\t\tconst currentSyncStatus =\n\t\t\t\t\t\tgetEditedPostAttribute( 'meta' )\n\t\t\t\t\t\t\t?.wp_pattern_sync_status === 'unsynced'\n\t\t\t\t\t\t\t? 'unsynced'\n\t\t\t\t\t\t\t: getEditedPostAttribute(\n\t\t\t\t\t\t\t\t\t'wp_pattern_sync_status'\n\t\t\t\t\t\t\t );\n\t\t\t\t\t_isSync = currentSyncStatus !== 'unsynced';\n\t\t\t\t} else {\n\t\t\t\t\t_isSync = true;\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn {\n\t\t\t\ttitle:\n\t\t\t\t\t_templateInfo?.title || getEditedPostAttribute( 'title' ),\n\t\t\t\ticon: unlock( select( editorStore ) ).getPostIcon( _type, {\n\t\t\t\t\tarea: _record?.area,\n\t\t\t\t} ),\n\t\t\t\tisSync: _isSync,\n\t\t\t\tisFrontPage: siteSettings?.page_on_front === _id,\n\t\t\t\tisPostsPage: siteSettings?.page_for_posts === _id,\n\t\t\t};\n\t\t},\n\t\t[]\n\t);\n\treturn (\n\t\t<div className=\"editor-post-card-panel\">\n\t\t\t<HStack\n\t\t\t\tspacing={ 2 }\n\t\t\t\tclassName=\"editor-post-card-panel__header\"\n\t\t\t\talign=\"flex-start\"\n\t\t\t>\n\t\t\t\t<Icon\n\t\t\t\t\tclassName={ clsx( 'editor-post-card-panel__icon', {\n\t\t\t\t\t\t'is-sync': isSync,\n\t\t\t\t\t} ) }\n\t\t\t\t\ticon={ icon }\n\t\t\t\t/>\n\t\t\t\t<Text\n\t\t\t\t\tnumberOfLines={ 2 }\n\t\t\t\t\ttruncate\n\t\t\t\t\tclassName=\"editor-post-card-panel__title\"\n\t\t\t\t\tweight={ 500 }\n\t\t\t\t\tas=\"h2\"\n\t\t\t\t\tlineHeight=\"20px\"\n\t\t\t\t>\n\t\t\t\t\t{ title ? decodeEntities( title ) : __( 'No
|
|
1
|
+
{"version":3,"names":["_clsx","_interopRequireDefault","require","_components","_coreData","_data","_i18n","_htmlEntities","_store","_constants","_lockUnlock","_jsxRuntime","PostCardPanel","actions","isFrontPage","isPostsPage","title","icon","isSync","useSelect","select","getEditedPostAttribute","getCurrentPostType","getCurrentPostId","__experimentalGetTemplateInfo","editorStore","canUser","coreStore","getEditedEntityRecord","siteSettings","kind","name","undefined","_type","_id","_record","_templateInfo","TEMPLATE_POST_TYPE","TEMPLATE_PART_POST_TYPE","includes","_isSync","GLOBAL_POST_TYPES","PATTERN_POST_TYPE","currentSyncStatus","wp_pattern_sync_status","unlock","getPostIcon","area","page_on_front","page_for_posts","jsx","className","children","jsxs","__experimentalHStack","spacing","align","Icon","clsx","__experimentalText","numberOfLines","truncate","weight","as","lineHeight","decodeEntities","__"],"sources":["@wordpress/editor/src/components/post-card-panel/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n/**\n * WordPress dependencies\n */\nimport {\n\tIcon,\n\t__experimentalHStack as HStack,\n\t__experimentalText as Text,\n} from '@wordpress/components';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useSelect } from '@wordpress/data';\nimport { __ } from '@wordpress/i18n';\nimport { decodeEntities } from '@wordpress/html-entities';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\nimport {\n\tTEMPLATE_POST_TYPE,\n\tTEMPLATE_PART_POST_TYPE,\n\tPATTERN_POST_TYPE,\n\tGLOBAL_POST_TYPES,\n} from '../../store/constants';\nimport { unlock } from '../../lock-unlock';\n\nexport default function PostCardPanel( { actions } ) {\n\tconst { isFrontPage, isPostsPage, title, icon, isSync } = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetEditedPostAttribute,\n\t\t\t\tgetCurrentPostType,\n\t\t\t\tgetCurrentPostId,\n\t\t\t\t__experimentalGetTemplateInfo,\n\t\t\t} = select( editorStore );\n\t\t\tconst { canUser } = select( coreStore );\n\t\t\tconst { getEditedEntityRecord } = select( coreStore );\n\t\t\tconst siteSettings = canUser( 'read', {\n\t\t\t\tkind: 'root',\n\t\t\t\tname: 'site',\n\t\t\t} )\n\t\t\t\t? getEditedEntityRecord( 'root', 'site' )\n\t\t\t\t: undefined;\n\t\t\tconst _type = getCurrentPostType();\n\t\t\tconst _id = getCurrentPostId();\n\t\t\tconst _record = getEditedEntityRecord( 'postType', _type, _id );\n\t\t\tconst _templateInfo =\n\t\t\t\t[ TEMPLATE_POST_TYPE, TEMPLATE_PART_POST_TYPE ].includes(\n\t\t\t\t\t_type\n\t\t\t\t) && __experimentalGetTemplateInfo( _record );\n\t\t\tlet _isSync = false;\n\t\t\tif ( GLOBAL_POST_TYPES.includes( _type ) ) {\n\t\t\t\tif ( PATTERN_POST_TYPE === _type ) {\n\t\t\t\t\t// When the post is first created, the top level wp_pattern_sync_status is not set so get meta value instead.\n\t\t\t\t\tconst currentSyncStatus =\n\t\t\t\t\t\tgetEditedPostAttribute( 'meta' )\n\t\t\t\t\t\t\t?.wp_pattern_sync_status === 'unsynced'\n\t\t\t\t\t\t\t? 'unsynced'\n\t\t\t\t\t\t\t: getEditedPostAttribute(\n\t\t\t\t\t\t\t\t\t'wp_pattern_sync_status'\n\t\t\t\t\t\t\t );\n\t\t\t\t\t_isSync = currentSyncStatus !== 'unsynced';\n\t\t\t\t} else {\n\t\t\t\t\t_isSync = true;\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn {\n\t\t\t\ttitle:\n\t\t\t\t\t_templateInfo?.title || getEditedPostAttribute( 'title' ),\n\t\t\t\ticon: unlock( select( editorStore ) ).getPostIcon( _type, {\n\t\t\t\t\tarea: _record?.area,\n\t\t\t\t} ),\n\t\t\t\tisSync: _isSync,\n\t\t\t\tisFrontPage: siteSettings?.page_on_front === _id,\n\t\t\t\tisPostsPage: siteSettings?.page_for_posts === _id,\n\t\t\t};\n\t\t},\n\t\t[]\n\t);\n\treturn (\n\t\t<div className=\"editor-post-card-panel\">\n\t\t\t<HStack\n\t\t\t\tspacing={ 2 }\n\t\t\t\tclassName=\"editor-post-card-panel__header\"\n\t\t\t\talign=\"flex-start\"\n\t\t\t>\n\t\t\t\t<Icon\n\t\t\t\t\tclassName={ clsx( 'editor-post-card-panel__icon', {\n\t\t\t\t\t\t'is-sync': isSync,\n\t\t\t\t\t} ) }\n\t\t\t\t\ticon={ icon }\n\t\t\t\t/>\n\t\t\t\t<Text\n\t\t\t\t\tnumberOfLines={ 2 }\n\t\t\t\t\ttruncate\n\t\t\t\t\tclassName=\"editor-post-card-panel__title\"\n\t\t\t\t\tweight={ 500 }\n\t\t\t\t\tas=\"h2\"\n\t\t\t\t\tlineHeight=\"20px\"\n\t\t\t\t>\n\t\t\t\t\t{ title ? decodeEntities( title ) : __( 'No title' ) }\n\t\t\t\t\t{ isFrontPage && (\n\t\t\t\t\t\t<span className=\"editor-post-card-panel__title-badge\">\n\t\t\t\t\t\t\t{ __( 'Homepage' ) }\n\t\t\t\t\t\t</span>\n\t\t\t\t\t) }\n\t\t\t\t\t{ isPostsPage && (\n\t\t\t\t\t\t<span className=\"editor-post-card-panel__title-badge\">\n\t\t\t\t\t\t\t{ __( 'Posts Page' ) }\n\t\t\t\t\t\t</span>\n\t\t\t\t\t) }\n\t\t\t\t</Text>\n\t\t\t\t{ actions }\n\t\t\t</HStack>\n\t\t</div>\n\t);\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,sBAAA,CAAAC,OAAA;AAIA,IAAAC,WAAA,GAAAD,OAA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,kBAAI;QACJC,aAAa,EAAG,CAAG;QACnBC,QAAQ;QACRV,SAAS,EAAC,+BAA+B;QACzCW,MAAM,EAAG,GAAK;QACdC,EAAE,EAAC,IAAI;QACPC,UAAU,EAAC,MAAM;QAAAZ,QAAA,GAEfpC,KAAK,GAAG,IAAAiD,4BAAc,EAAEjD,KAAM,CAAC,GAAG,IAAAkD,QAAE,EAAE,UAAW,CAAC,EAClDpD,WAAW,iBACZ,IAAAH,WAAA,CAAAuC,GAAA;UAAMC,SAAS,EAAC,qCAAqC;UAAAC,QAAA,EAClD,IAAAc,QAAE,EAAE,UAAW;QAAC,CACb,CACN,EACCnD,WAAW,iBACZ,IAAAJ,WAAA,CAAAuC,GAAA;UAAMC,SAAS,EAAC,qCAAqC;UAAAC,QAAA,EAClD,IAAAc,QAAE,EAAE,YAAa;QAAC,CACf,CACN;MAAA,CACI,CAAC,EACLrD,OAAO;IAAA,CACF;EAAC,CACL,CAAC;AAER","ignoreList":[]}
|
|
@@ -18,27 +18,13 @@ var _jsxRuntime = require("react/jsx-runtime");
|
|
|
18
18
|
*/
|
|
19
19
|
|
|
20
20
|
const COMMENT_OPTIONS = [{
|
|
21
|
-
label:
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
size: 12,
|
|
25
|
-
children: (0, _i18n.__)('Visitors can add new comments and replies.')
|
|
26
|
-
})]
|
|
27
|
-
}),
|
|
28
|
-
value: 'open'
|
|
21
|
+
label: (0, _i18n._x)('Open', 'Adjective: e.g. "Comments are open"'),
|
|
22
|
+
value: 'open',
|
|
23
|
+
description: (0, _i18n.__)('Visitors can add new comments and replies.')
|
|
29
24
|
}, {
|
|
30
|
-
label:
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
size: 12,
|
|
34
|
-
children: (0, _i18n.__)('Visitors cannot add new comments or replies.')
|
|
35
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.__experimentalText, {
|
|
36
|
-
variant: "muted",
|
|
37
|
-
size: 12,
|
|
38
|
-
children: (0, _i18n.__)('Existing comments remain visible.')
|
|
39
|
-
})]
|
|
40
|
-
}),
|
|
41
|
-
value: 'closed'
|
|
25
|
+
label: (0, _i18n.__)('Closed'),
|
|
26
|
+
value: 'closed',
|
|
27
|
+
description: [(0, _i18n.__)('Visitors cannot add new comments or replies.'), (0, _i18n.__)('Existing comments remain visible.')].join(' ')
|
|
42
28
|
}];
|
|
43
29
|
function PostComments() {
|
|
44
30
|
const commentStatus = (0, _data.useSelect)(select => {
|