@wordpress/editor 14.0.2 → 14.0.3

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.
Files changed (47) hide show
  1. package/build/components/editor-interface/index.js +2 -2
  2. package/build/components/editor-interface/index.js.map +1 -1
  3. package/build/components/global-styles-provider/index.js +6 -65
  4. package/build/components/global-styles-provider/index.js.map +1 -1
  5. package/build/components/post-actions/actions.js +61 -12
  6. package/build/components/post-actions/actions.js.map +1 -1
  7. package/build/components/post-actions/index.js +4 -1
  8. package/build/components/post-actions/index.js.map +1 -1
  9. package/build/components/post-excerpt/index.js +2 -1
  10. package/build/components/post-excerpt/index.js.map +1 -1
  11. package/build/components/post-excerpt/panel.js +2 -1
  12. package/build/components/post-excerpt/panel.js.map +1 -1
  13. package/build/hooks/pattern-overrides.js +1 -1
  14. package/build/hooks/pattern-overrides.js.map +1 -1
  15. package/build/store/private-actions.js +9 -5
  16. package/build/store/private-actions.js.map +1 -1
  17. package/build-module/components/editor-interface/index.js +2 -2
  18. package/build-module/components/editor-interface/index.js.map +1 -1
  19. package/build-module/components/global-styles-provider/index.js +7 -66
  20. package/build-module/components/global-styles-provider/index.js.map +1 -1
  21. package/build-module/components/post-actions/actions.js +62 -13
  22. package/build-module/components/post-actions/actions.js.map +1 -1
  23. package/build-module/components/post-actions/index.js +4 -1
  24. package/build-module/components/post-actions/index.js.map +1 -1
  25. package/build-module/components/post-excerpt/index.js +2 -1
  26. package/build-module/components/post-excerpt/index.js.map +1 -1
  27. package/build-module/components/post-excerpt/panel.js +2 -1
  28. package/build-module/components/post-excerpt/panel.js.map +1 -1
  29. package/build-module/hooks/pattern-overrides.js +1 -1
  30. package/build-module/hooks/pattern-overrides.js.map +1 -1
  31. package/build-module/store/private-actions.js +9 -5
  32. package/build-module/store/private-actions.js.map +1 -1
  33. package/build-style/style-rtl.css +7 -1
  34. package/build-style/style.css +7 -1
  35. package/package.json +14 -14
  36. package/src/components/editor-interface/index.js +12 -8
  37. package/src/components/global-styles-provider/index.js +7 -90
  38. package/src/components/post-actions/actions.js +104 -20
  39. package/src/components/post-actions/index.js +1 -1
  40. package/src/components/post-card-panel/style.scss +1 -0
  41. package/src/components/post-excerpt/index.js +4 -1
  42. package/src/components/post-excerpt/panel.js +2 -1
  43. package/src/components/post-publish-panel/style.scss +1 -1
  44. package/src/components/post-url/style.scss +4 -0
  45. package/src/components/visual-editor/style.scss +2 -0
  46. package/src/hooks/pattern-overrides.js +2 -3
  47. package/src/store/private-actions.js +54 -21
@@ -3,7 +3,7 @@
3
3
  */
4
4
  import { external, trash, backup } from '@wordpress/icons';
5
5
  import { addQueryArgs } from '@wordpress/url';
6
- import { useDispatch, useSelect } from '@wordpress/data';
6
+ import { useDispatch, useSelect, useRegistry } from '@wordpress/data';
7
7
  import { decodeEntities } from '@wordpress/html-entities';
8
8
  import { store as coreStore } from '@wordpress/core-data';
9
9
  import { __, _n, sprintf, _x } from '@wordpress/i18n';
@@ -124,6 +124,15 @@ const deletePostAction = {
124
124
  });
125
125
  }
126
126
  };
127
+ function useCanUserEligibilityCheckPostType(capability, resource, action) {
128
+ const registry = useRegistry();
129
+ return useMemo(() => ({
130
+ ...action,
131
+ isEligible(item) {
132
+ return action.isEligible(item) && registry.select(coreStore).canUser(capability, resource, item.id);
133
+ }
134
+ }), [action, registry, capability, resource]);
135
+ }
127
136
  const trashPostAction = {
128
137
  id: 'move-to-trash',
129
138
  label: __('Move to Trash'),
@@ -243,7 +252,10 @@ const trashPostAction = {
243
252
  });
244
253
  }
245
254
  };
246
- function usePermanentlyDeletePostAction() {
255
+ function useTrashPostAction(resource) {
256
+ return useCanUserEligibilityCheckPostType('delete', resource, trashPostAction);
257
+ }
258
+ function usePermanentlyDeletePostAction(resource) {
247
259
  const {
248
260
  createSuccessNotice,
249
261
  createErrorNotice
@@ -251,7 +263,7 @@ function usePermanentlyDeletePostAction() {
251
263
  const {
252
264
  deleteEntityRecord
253
265
  } = useDispatch(coreStore);
254
- return useMemo(() => ({
266
+ const permanentlyDeletePostAction = useMemo(() => ({
255
267
  id: 'permanently-delete',
256
268
  label: __('Permanently delete'),
257
269
  supportsBulk: true,
@@ -323,8 +335,9 @@ function usePermanentlyDeletePostAction() {
323
335
  }
324
336
  }
325
337
  }), [createSuccessNotice, createErrorNotice, deleteEntityRecord]);
338
+ return useCanUserEligibilityCheckPostType('delete', resource, permanentlyDeletePostAction);
326
339
  }
327
- function useRestorePostAction() {
340
+ function useRestorePostAction(resource) {
328
341
  const {
329
342
  createSuccessNotice,
330
343
  createErrorNotice
@@ -333,7 +346,7 @@ function useRestorePostAction() {
333
346
  editEntityRecord,
334
347
  saveEditedEntityRecord
335
348
  } = useDispatch(coreStore);
336
- return useMemo(() => ({
349
+ const restorePostAction = useMemo(() => ({
337
350
  id: 'restore',
338
351
  label: __('Restore'),
339
352
  isPrimary: true,
@@ -413,6 +426,7 @@ function useRestorePostAction() {
413
426
  }
414
427
  }
415
428
  }), [createSuccessNotice, createErrorNotice, editEntityRecord, saveEditedEntityRecord]);
429
+ return useCanUserEligibilityCheckPostType('update', resource, restorePostAction);
416
430
  }
417
431
  const viewPostAction = {
418
432
  id: 'view-post',
@@ -432,6 +446,7 @@ const viewPostAction = {
432
446
  };
433
447
  const postRevisionsAction = {
434
448
  id: 'view-post-revisions',
449
+ context: 'list',
435
450
  label(items) {
436
451
  var _items$0$_links$versi;
437
452
  const revisionsCount = (_items$0$_links$versi = items[0]._links?.['version-history']?.[0]?.count) !== null && _items$0$_links$versi !== void 0 ? _items$0$_links$versi : 0;
@@ -554,6 +569,9 @@ const renamePostAction = {
554
569
  });
555
570
  }
556
571
  };
572
+ function useRenamePostAction(resource) {
573
+ return useCanUserEligibilityCheckPostType('update', resource, renamePostAction);
574
+ }
557
575
  const duplicatePostAction = {
558
576
  id: 'duplicate-post',
559
577
  label: _x('Duplicate', 'action label'),
@@ -808,19 +826,35 @@ export const duplicateTemplatePartAction = {
808
826
  });
809
827
  }
810
828
  };
811
- export function usePostActions(postType, onActionPerformed) {
829
+ export function usePostActions({
830
+ postType,
831
+ onActionPerformed,
832
+ context
833
+ }) {
812
834
  const {
813
- postTypeObject
835
+ postTypeObject,
836
+ resource,
837
+ cachedCanUserResolvers,
838
+ userCanCreatePostType
814
839
  } = useSelect(select => {
815
840
  const {
816
- getPostType
841
+ getPostType,
842
+ getCachedResolvers,
843
+ canUser
817
844
  } = select(coreStore);
845
+ const _postTypeObject = getPostType(postType);
846
+ const _resource = _postTypeObject?.rest_base || '';
818
847
  return {
819
- postTypeObject: getPostType(postType)
848
+ postTypeObject: _postTypeObject,
849
+ resource: _resource,
850
+ cachedCanUserResolvers: getCachedResolvers()?.canUser,
851
+ userCanCreatePostType: canUser('create', _resource)
820
852
  };
821
853
  }, [postType]);
822
- const permanentlyDeletePostAction = usePermanentlyDeletePostAction();
823
- const restorePostAction = useRestorePostAction();
854
+ const trashPostActionForPostType = useTrashPostAction(resource);
855
+ const permanentlyDeletePostActionForPostType = usePermanentlyDeletePostAction(resource);
856
+ const renamePostActionForPostType = useRenamePostAction(resource);
857
+ const restorePostActionForPostType = useRestorePostAction(resource);
824
858
  const isTemplateOrTemplatePart = [TEMPLATE_POST_TYPE, TEMPLATE_PART_POST_TYPE].includes(postType);
825
859
  const isPattern = postType === PATTERN_POST_TYPE;
826
860
  const isLoaded = !!postTypeObject;
@@ -830,7 +864,19 @@ export function usePostActions(postType, onActionPerformed) {
830
864
  if (!isLoaded) {
831
865
  return [];
832
866
  }
833
- const actions = [postTypeObject?.viewable && viewPostAction, supportsRevisions && postRevisionsAction, globalThis.IS_GUTENBERG_PLUGIN ? !isTemplateOrTemplatePart && !isPattern && duplicatePostAction : false, isTemplateOrTemplatePart && duplicateTemplatePartAction, isPattern && duplicatePatternAction, supportsTitle && renamePostAction, isPattern && exportPatternAsJSONAction, isTemplateOrTemplatePart ? resetTemplateAction : restorePostAction, isTemplateOrTemplatePart || isPattern ? deletePostAction : trashPostAction, !isTemplateOrTemplatePart && permanentlyDeletePostAction].filter(Boolean);
867
+ let actions = [postTypeObject?.viewable && viewPostAction, supportsRevisions && postRevisionsAction, globalThis.IS_GUTENBERG_PLUGIN ? !isTemplateOrTemplatePart && !isPattern && duplicatePostAction : false, isTemplateOrTemplatePart && userCanCreatePostType && duplicateTemplatePartAction, isPattern && userCanCreatePostType && duplicatePatternAction, supportsTitle && renamePostActionForPostType, isPattern && exportPatternAsJSONAction, isTemplateOrTemplatePart ? resetTemplateAction : restorePostActionForPostType, isTemplateOrTemplatePart || isPattern ? deletePostAction : trashPostActionForPostType, !isTemplateOrTemplatePart && permanentlyDeletePostActionForPostType].filter(Boolean);
868
+ // Filter actions based on provided context. If not provided
869
+ // all actions are returned. We'll have a single entry for getting the actions
870
+ // and the consumer should provide the context to filter the actions, if needed.
871
+ // Actions should also provide the `context` they support, if it's specific, to
872
+ // compare with the provided context to get all the actions.
873
+ // Right now the only supported context is `list`.
874
+ actions = actions.filter(action => {
875
+ if (!action.context) {
876
+ return true;
877
+ }
878
+ return action.context === context;
879
+ });
834
880
  if (onActionPerformed) {
835
881
  for (let i = 0; i < actions.length; ++i) {
836
882
  if (actions[i].callback) {
@@ -867,6 +913,9 @@ export function usePostActions(postType, onActionPerformed) {
867
913
  }
868
914
  }
869
915
  return actions;
870
- }, [isTemplateOrTemplatePart, isPattern, postTypeObject?.viewable, permanentlyDeletePostAction, restorePostAction, onActionPerformed, isLoaded, supportsRevisions, supportsTitle]);
916
+ // We are making this use memo depend on cachedCanUserResolvers as a way to make the component using this hook re-render
917
+ // when user capabilities are resolved. This makes sure the isEligible functions of actions dependent on capabilities are re-evaluated.
918
+ // eslint-disable-next-line react-hooks/exhaustive-deps
919
+ }, [isTemplateOrTemplatePart, isPattern, postTypeObject?.viewable, permanentlyDeletePostActionForPostType, restorePostActionForPostType, renamePostActionForPostType, trashPostActionForPostType, onActionPerformed, isLoaded, supportsRevisions, supportsTitle, context, userCanCreatePostType, cachedCanUserResolvers]);
871
920
  }
872
921
  //# sourceMappingURL=actions.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["external","trash","backup","addQueryArgs","useDispatch","useSelect","decodeEntities","store","coreStore","__","_n","sprintf","_x","noticesStore","useMemo","useState","privateApis","patternsPrivateApis","Button","TextControl","__experimentalText","Text","__experimentalHStack","HStack","__experimentalVStack","VStack","TEMPLATE_ORIGINS","TEMPLATE_PART_POST_TYPE","TEMPLATE_POST_TYPE","PATTERN_POST_TYPE","editorStore","unlock","isTemplateRevertable","exportPatternAsJSONAction","CreateTemplatePartModalContents","jsx","_jsx","jsxs","_jsxs","PATTERN_TYPES","CreatePatternModalContents","useDuplicatePatternProps","isTemplateRemovable","template","source","templatePart","includes","custom","has_theme_file","canDeleteOrReset","item","isTemplatePart","type","isUserPattern","user","isCustom","getItemTitle","title","rendered","deletePostAction","id","label","isPrimary","icon","isEligible","post","supportsBulk","hideModalHeader","RenderModal","items","closeModal","onActionStart","onActionPerformed","isBusy","setIsBusy","removeTemplates","spacing","children","length","justify","variant","onClick","disabled","__experimentalIsFocusable","allowUndo","trashPostAction","status","createSuccessNotice","createErrorNotice","deleteEntityRecord","promiseResult","Promise","allSettled","map","throwOnError","every","successMessage","errorMessage","reason","message","errorMessages","Set","failedPromises","filter","failedPromise","add","size","join","usePermanentlyDeletePostAction","callback","posts","force","useRestorePostAction","editEntityRecord","saveEditedEntityRecord","viewPostAction","window","open","link","postRevisionsAction","_items$0$_links$versi","revisionsCount","_links","count","_post$_links$predeces","_post$_links$version","lastRevisionId","href","revision","document","location","renamePostAction","Object","values","is_custom","isCustomPattern","hasThemeFile","originalTitle","setTitle","onRename","event","preventDefault","error","code","onSubmit","__nextHasNoMarginBottom","__next40pxDefaultSize","value","onChange","required","duplicatePostAction","isCreatingPage","setIsCreatingPage","saveEntityRecord","createPage","newItem","slug","author","comment_status","content","raw","excerpt","meta","parent","password","format","featured_media","menu_order","ping_status","categories","tags","placeholder","isTemplatePartRevertable","resetTemplateAction","revertTemplate","onConfirm","fallbackErrorMessage","duplicatePatternAction","modalHeader","isThemePattern","theme","duplicatedProps","pattern","patternPost","onSuccess","onClose","confirmLabel","duplicateTemplatePartAction","onTemplatePartSuccess","blocks","defaultArea","area","defaultTitle","onCreate","onError","usePostActions","postType","postTypeObject","select","getPostType","permanentlyDeletePostAction","restorePostAction","isTemplateOrTemplatePart","isPattern","isLoaded","supportsRevisions","supports","revisions","supportsTitle","actions","viewable","globalThis","IS_GUTENBERG_PLUGIN","Boolean","i","existingCallback","_onActionPerformed","_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 } 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';\n\nimport {\n\tButton,\n\tTextControl,\n\t__experimentalText as Text,\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 isTemplateRevertable from '../../store/utils/is-template-revertable';\nimport { exportPatternAsJSONAction } from './export-pattern-action';\nimport { CreateTemplatePartModalContents } from '../create-template-part-modal';\n\n// Patterns.\nconst { PATTERN_TYPES, CreatePatternModalContents, useDuplicatePatternProps } =\n\tunlock( patternsPrivateApis );\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\t[ template.source, template.templatePart?.source ].includes(\n\t\t\tTEMPLATE_ORIGINS.custom\n\t\t) &&\n\t\t! template.has_theme_file &&\n\t\t! template.templatePart?.has_theme_file\n\t);\n}\nconst canDeleteOrReset = ( item ) => {\n\tconst isTemplatePart = item.type === TEMPLATE_PART_POST_TYPE;\n\tconst isUserPattern = item.type === PATTERN_TYPES.user;\n\treturn isUserPattern || ( isTemplatePart && item.isCustom );\n};\n\nfunction getItemTitle( item ) {\n\tif ( typeof item.title === 'string' ) {\n\t\treturn decodeEntities( item.title );\n\t}\n\treturn decodeEntities( item.title?.rendered || '' );\n}\n\n// This action is used for templates, patterns and template parts.\n// Every other post type uses the similar `trashPostAction` which\n// moves the post to trash.\nconst deletePostAction = {\n\tid: 'delete-post',\n\tlabel: __( 'Delete' ),\n\tisPrimary: true,\n\ticon: trash,\n\tisEligible( post ) {\n\t\tif (\n\t\t\t[ TEMPLATE_POST_TYPE, TEMPLATE_PART_POST_TYPE ].includes(\n\t\t\t\tpost.type\n\t\t\t)\n\t\t) {\n\t\t\treturn isTemplateRemovable( post );\n\t\t}\n\t\t// We can only remove user patterns.\n\t\treturn post.type === PATTERN_TYPES.user;\n\t},\n\tsupportsBulk: true,\n\thideModalHeader: true,\n\tRenderModal: ( {\n\t\titems,\n\t\tcloseModal,\n\t\tonActionStart,\n\t\tonActionPerformed,\n\t} ) => {\n\t\tconst [ isBusy, setIsBusy ] = useState( false );\n\t\tconst { removeTemplates } = unlock( useDispatch( editorStore ) );\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: %d: number of items to delete.\n\t\t\t\t\t\t\t\t_n(\n\t\t\t\t\t\t\t\t\t'Delete %d item?',\n\t\t\t\t\t\t\t\t\t'Delete %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\t\t: sprintf(\n\t\t\t\t\t\t\t\t// translators: %s: The template or template part's titles\n\t\t\t\t\t\t\t\t__( 'Delete \"%s\"?' ),\n\t\t\t\t\t\t\t\tgetItemTitle( items[ 0 ] )\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\t__experimentalIsFocusable\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\tif ( onActionStart ) {\n\t\t\t\t\t\t\t\tonActionStart( items );\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tawait removeTemplates( items, {\n\t\t\t\t\t\t\t\tallowUndo: false,\n\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\tonActionPerformed?.( items );\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\t__experimentalIsFocusable\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Delete' ) }\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\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: ( {\n\t\titems,\n\t\tcloseModal,\n\t\tonActionStart,\n\t\tonActionPerformed,\n\t} ) => {\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\t__experimentalIsFocusable\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\tif ( onActionStart ) {\n\t\t\t\t\t\t\t\tonActionStart( items );\n\t\t\t\t\t\t\t}\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 if ( items[ 0 ].type === 'page' ) {\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__( '%s items moved to trash.' ),\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} 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 posts. */\n\t\t\t\t\t\t\t\t\t\t__( '%s items move to trash.' ),\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\t__experimentalIsFocusable\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 usePermanentlyDeletePostAction() {\n\tconst { createSuccessNotice, createErrorNotice } =\n\t\tuseDispatch( noticesStore );\n\tconst { deleteEntityRecord } = useDispatch( coreStore );\n\n\treturn useMemo(\n\t\t() => ( {\n\t\t\tid: 'permanently-delete',\n\t\t\tlabel: __( 'Permanently delete' ),\n\t\t\tsupportsBulk: true,\n\t\t\tisEligible( { status } ) {\n\t\t\t\treturn status === 'trash';\n\t\t\t},\n\t\t\tasync callback( posts, onActionPerformed ) {\n\t\t\t\tconst promiseResult = await Promise.allSettled(\n\t\t\t\t\tposts.map( ( post ) => {\n\t\t\t\t\t\treturn deleteEntityRecord(\n\t\t\t\t\t\t\t'postType',\n\t\t\t\t\t\t\tpost.type,\n\t\t\t\t\t\t\tpost.id,\n\t\t\t\t\t\t\t{ force: true },\n\t\t\t\t\t\t\t{ throwOnError: true }\n\t\t\t\t\t\t);\n\t\t\t\t\t} )\n\t\t\t\t);\n\t\t\t\t// If all the promises were fulfilled with success.\n\t\t\t\tif (\n\t\t\t\t\tpromiseResult.every(\n\t\t\t\t\t\t( { status } ) => status === 'fulfilled'\n\t\t\t\t\t)\n\t\t\t\t) {\n\t\t\t\t\tlet successMessage;\n\t\t\t\t\tif ( promiseResult.length === 1 ) {\n\t\t\t\t\t\tsuccessMessage = sprintf(\n\t\t\t\t\t\t\t/* translators: The posts's title. */\n\t\t\t\t\t\t\t__( '\"%s\" permanently deleted.' ),\n\t\t\t\t\t\t\tgetItemTitle( posts[ 0 ] )\n\t\t\t\t\t\t);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tsuccessMessage = __(\n\t\t\t\t\t\t\t'The posts were permanently deleted.'\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t\tcreateSuccessNotice( successMessage, {\n\t\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\t\tid: 'permanently-delete-post-action',\n\t\t\t\t\t} );\n\t\t\t\t\tif ( onActionPerformed ) {\n\t\t\t\t\t\tonActionPerformed( posts );\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\t// If there was at lease one failure.\n\t\t\t\t\tlet errorMessage;\n\t\t\t\t\t// If we were trying to permanently delete a single post.\n\t\t\t\t\tif ( promiseResult.length === 1 ) {\n\t\t\t\t\t\tif ( promiseResult[ 0 ].reason?.message ) {\n\t\t\t\t\t\t\terrorMessage = promiseResult[ 0 ].reason.message;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\terrorMessage = __(\n\t\t\t\t\t\t\t\t'An error occurred while permanently deleting the post.'\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\t\t\t\t\t\t// If we were trying to permanently delete multiple posts\n\t\t\t\t\t} else {\n\t\t\t\t\t\tconst errorMessages = new Set();\n\t\t\t\t\t\tconst failedPromises = promiseResult.filter(\n\t\t\t\t\t\t\t( { status } ) => status === 'rejected'\n\t\t\t\t\t\t);\n\t\t\t\t\t\tfor ( const failedPromise of failedPromises ) {\n\t\t\t\t\t\t\tif ( failedPromise.reason?.message ) {\n\t\t\t\t\t\t\t\terrorMessages.add(\n\t\t\t\t\t\t\t\t\tfailedPromise.reason.message\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\tif ( errorMessages.size === 0 ) {\n\t\t\t\t\t\t\terrorMessage = __(\n\t\t\t\t\t\t\t\t'An error occurred while permanently deleting the posts.'\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t} else if ( errorMessages.size === 1 ) {\n\t\t\t\t\t\t\terrorMessage = sprintf(\n\t\t\t\t\t\t\t\t/* translators: %s: an error message */\n\t\t\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t\t\t'An error occurred while permanently deleting the posts: %s'\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t[ ...errorMessages ][ 0 ]\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\terrorMessage = sprintf(\n\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__(\n\t\t\t\t\t\t\t\t\t'Some errors occurred while permanently deleting the posts: %s'\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t[ ...errorMessages ].join( ',' )\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\tcreateErrorNotice( errorMessage, {\n\t\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\t} );\n\t\t\t\t}\n\t\t\t},\n\t\t} ),\n\t\t[ createSuccessNotice, createErrorNotice, deleteEntityRecord ]\n\t);\n}\n\nfunction useRestorePostAction() {\n\tconst { createSuccessNotice, createErrorNotice } =\n\t\tuseDispatch( noticesStore );\n\tconst { editEntityRecord, saveEditedEntityRecord } =\n\t\tuseDispatch( coreStore );\n\n\treturn useMemo(\n\t\t() => ( {\n\t\t\tid: 'restore',\n\t\t\tlabel: __( 'Restore' ),\n\t\t\tisPrimary: true,\n\t\t\ticon: backup,\n\t\t\tsupportsBulk: true,\n\t\t\tisEligible( { status } ) {\n\t\t\t\treturn status === 'trash';\n\t\t\t},\n\t\t\tasync callback( posts, onActionPerformed ) {\n\t\t\t\tawait Promise.allSettled(\n\t\t\t\t\tposts.map( ( post ) => {\n\t\t\t\t\t\treturn editEntityRecord(\n\t\t\t\t\t\t\t'postType',\n\t\t\t\t\t\t\tpost.type,\n\t\t\t\t\t\t\tpost.id,\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tstatus: 'draft',\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\tconst promiseResult = await Promise.allSettled(\n\t\t\t\t\tposts.map( ( post ) => {\n\t\t\t\t\t\treturn saveEditedEntityRecord(\n\t\t\t\t\t\t\t'postType',\n\t\t\t\t\t\t\tpost.type,\n\t\t\t\t\t\t\tpost.id,\n\t\t\t\t\t\t\t{ throwOnError: true }\n\t\t\t\t\t\t);\n\t\t\t\t\t} )\n\t\t\t\t);\n\n\t\t\t\tif (\n\t\t\t\t\tpromiseResult.every(\n\t\t\t\t\t\t( { status } ) => status === 'fulfilled'\n\t\t\t\t\t)\n\t\t\t\t) {\n\t\t\t\t\tlet successMessage;\n\t\t\t\t\tif ( posts.length === 1 ) {\n\t\t\t\t\t\tsuccessMessage = sprintf(\n\t\t\t\t\t\t\t/* translators: The number of posts. */\n\t\t\t\t\t\t\t__( '\"%s\" has been restored.' ),\n\t\t\t\t\t\t\tgetItemTitle( posts[ 0 ] )\n\t\t\t\t\t\t);\n\t\t\t\t\t} else if ( posts[ 0 ].type === 'page' ) {\n\t\t\t\t\t\tsuccessMessage = sprintf(\n\t\t\t\t\t\t\t/* translators: The number of posts. */\n\t\t\t\t\t\t\t__( '%d pages have been restored.' ),\n\t\t\t\t\t\t\tposts.length\n\t\t\t\t\t\t);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tsuccessMessage = sprintf(\n\t\t\t\t\t\t\t/* translators: The number of posts. */\n\t\t\t\t\t\t\t__( '%d posts have been restored.' ),\n\t\t\t\t\t\t\tposts.length\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t\tcreateSuccessNotice( successMessage, {\n\t\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\t\tid: 'restore-post-action',\n\t\t\t\t\t} );\n\t\t\t\t\tif ( onActionPerformed ) {\n\t\t\t\t\t\tonActionPerformed( posts );\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\t// If there was at lease one failure.\n\t\t\t\t\tlet errorMessage;\n\t\t\t\t\t// If we were trying to move a single post to the trash.\n\t\t\t\t\tif ( promiseResult.length === 1 ) {\n\t\t\t\t\t\tif ( promiseResult[ 0 ].reason?.message ) {\n\t\t\t\t\t\t\terrorMessage = promiseResult[ 0 ].reason.message;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\terrorMessage = __(\n\t\t\t\t\t\t\t\t'An error occurred while restoring the post.'\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\t\t\t\t\t\t// If we were trying to move multiple posts to the trash\n\t\t\t\t\t} else {\n\t\t\t\t\t\tconst errorMessages = new Set();\n\t\t\t\t\t\tconst failedPromises = promiseResult.filter(\n\t\t\t\t\t\t\t( { status } ) => status === 'rejected'\n\t\t\t\t\t\t);\n\t\t\t\t\t\tfor ( const failedPromise of failedPromises ) {\n\t\t\t\t\t\t\tif ( failedPromise.reason?.message ) {\n\t\t\t\t\t\t\t\terrorMessages.add(\n\t\t\t\t\t\t\t\t\tfailedPromise.reason.message\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\tif ( errorMessages.size === 0 ) {\n\t\t\t\t\t\t\terrorMessage = __(\n\t\t\t\t\t\t\t\t'An error occurred while restoring the posts.'\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t} else if ( errorMessages.size === 1 ) {\n\t\t\t\t\t\t\terrorMessage = sprintf(\n\t\t\t\t\t\t\t\t/* translators: %s: an error message */\n\t\t\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t\t\t'An error occurred while restoring the posts: %s'\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t[ ...errorMessages ][ 0 ]\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\terrorMessage = sprintf(\n\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__(\n\t\t\t\t\t\t\t\t\t'Some errors occurred while restoring the posts: %s'\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t[ ...errorMessages ].join( ',' )\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\tcreateErrorNotice( errorMessage, {\n\t\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\t} );\n\t\t\t\t}\n\t\t\t},\n\t\t} ),\n\t\t[\n\t\t\tcreateSuccessNotice,\n\t\t\tcreateErrorNotice,\n\t\t\teditEntityRecord,\n\t\t\tsaveEditedEntityRecord,\n\t\t]\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\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 &&\n\t\t\t\t( post.isCustom || post.source === TEMPLATE_ORIGINS.custom ) );\n\t\tconst hasThemeFile =\n\t\t\tisTemplatePart &&\n\t\t\t( post.templatePart?.has_theme_file || post.has_theme_file );\n\t\treturn isCustomPattern && ! hasThemeFile;\n\t},\n\tRenderModal: ( { items, closeModal, onActionPerformed } ) => {\n\t\tconst [ item ] = items;\n\t\tconst originalTitle = decodeEntities(\n\t\t\ttypeof item.title === 'string' ? item.title : item.title.rendered\n\t\t);\n\t\tconst [ title, setTitle ] = useState( () => originalTitle );\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\nconst duplicatePostAction = {\n\tid: 'duplicate-post',\n\tlabel: _x( 'Duplicate', 'action label' ),\n\tisEligible( { status } ) {\n\t\treturn status !== 'trash';\n\t},\n\tRenderModal: ( { items, closeModal, onActionPerformed } ) => {\n\t\tconst [ item ] = items;\n\t\tconst [ isCreatingPage, setIsCreatingPage ] = useState( false );\n\t\tconst [ title, setTitle ] = useState(\n\t\t\tsprintf(\n\t\t\t\t/* translators: %s: Existing item title */\n\t\t\t\t__( '%s (Copy)' ),\n\t\t\t\tgetItemTitle( item )\n\t\t\t)\n\t\t);\n\n\t\tconst { saveEntityRecord } = useDispatch( coreStore );\n\t\tconst { createSuccessNotice, createErrorNotice } =\n\t\t\tuseDispatch( noticesStore );\n\n\t\tasync function createPage( event ) {\n\t\t\tevent.preventDefault();\n\n\t\t\tif ( isCreatingPage ) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tsetIsCreatingPage( true );\n\t\t\ttry {\n\t\t\t\tconst newItem = await saveEntityRecord(\n\t\t\t\t\t'postType',\n\t\t\t\t\titem.type,\n\t\t\t\t\t{\n\t\t\t\t\t\tstatus: 'draft',\n\t\t\t\t\t\ttitle,\n\t\t\t\t\t\tslug: title || __( 'No title' ),\n\t\t\t\t\t\tauthor: item.author,\n\t\t\t\t\t\tcomment_status: item.comment_status,\n\t\t\t\t\t\tcontent:\n\t\t\t\t\t\t\ttypeof item.content === 'string'\n\t\t\t\t\t\t\t\t? item.content\n\t\t\t\t\t\t\t\t: item.content.raw,\n\t\t\t\t\t\texcerpt: item.excerpt.raw,\n\t\t\t\t\t\tmeta: item.meta,\n\t\t\t\t\t\tparent: item.parent,\n\t\t\t\t\t\tpassword: item.password,\n\t\t\t\t\t\ttemplate: item.template,\n\t\t\t\t\t\tformat: item.format,\n\t\t\t\t\t\tfeatured_media: item.featured_media,\n\t\t\t\t\t\tmenu_order: item.menu_order,\n\t\t\t\t\t\tping_status: item.ping_status,\n\t\t\t\t\t\tcategories: item.categories,\n\t\t\t\t\t\ttags: item.tags,\n\t\t\t\t\t},\n\t\t\t\t\t{ throwOnError: true }\n\t\t\t\t);\n\n\t\t\t\tcreateSuccessNotice(\n\t\t\t\t\tsprintf(\n\t\t\t\t\t\t// translators: %s: Title of the created template e.g: \"Category\".\n\t\t\t\t\t\t__( '\"%s\" successfully created.' ),\n\t\t\t\t\t\tdecodeEntities( newItem.title?.rendered || title )\n\t\t\t\t\t),\n\t\t\t\t\t{\n\t\t\t\t\t\tid: 'duplicate-post-action',\n\t\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\t}\n\t\t\t\t);\n\n\t\t\t\tif ( onActionPerformed ) {\n\t\t\t\t\tonActionPerformed( [ newItem ] );\n\t\t\t\t}\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 duplicating the page.' );\n\n\t\t\t\tcreateErrorNotice( errorMessage, {\n\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t} );\n\t\t\t} finally {\n\t\t\t\tsetIsCreatingPage( false );\n\t\t\t\tcloseModal();\n\t\t\t}\n\t\t}\n\t\treturn (\n\t\t\t<form onSubmit={ createPage }>\n\t\t\t\t<VStack spacing={ 3 }>\n\t\t\t\t\t<TextControl\n\t\t\t\t\t\tlabel={ __( 'Title' ) }\n\t\t\t\t\t\tonChange={ setTitle }\n\t\t\t\t\t\tplaceholder={ __( 'No title' ) }\n\t\t\t\t\t\tvalue={ title }\n\t\t\t\t\t/>\n\t\t\t\t\t<HStack spacing={ 2 } justify=\"end\">\n\t\t\t\t\t\t<Button variant=\"tertiary\" onClick={ closeModal }>\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\tvariant=\"primary\"\n\t\t\t\t\t\t\ttype=\"submit\"\n\t\t\t\t\t\t\tisBusy={ isCreatingPage }\n\t\t\t\t\t\t\taria-disabled={ isCreatingPage }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ _x( 'Duplicate', 'action label' ) }\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\nconst isTemplatePartRevertable = ( item ) => {\n\tif ( ! item ) {\n\t\treturn false;\n\t}\n\tconst hasThemeFile = item.templatePart?.has_theme_file;\n\treturn canDeleteOrReset( item ) && hasThemeFile;\n};\n\nconst resetTemplateAction = {\n\tid: 'reset-template',\n\tlabel: __( 'Reset' ),\n\tisEligible: ( item ) => {\n\t\treturn item.type === TEMPLATE_PART_POST_TYPE\n\t\t\t? isTemplatePartRevertable( item )\n\t\t\t: isTemplateRevertable( item );\n\t},\n\ticon: backup,\n\tsupportsBulk: true,\n\thideModalHeader: true,\n\tRenderModal: ( {\n\t\titems,\n\t\tcloseModal,\n\t\tonActionStart,\n\t\tonActionPerformed,\n\t} ) => {\n\t\tconst [ isBusy, setIsBusy ] = useState( false );\n\t\tconst { revertTemplate, removeTemplates } = unlock(\n\t\t\tuseDispatch( editorStore )\n\t\t);\n\t\tconst { saveEditedEntityRecord } = useDispatch( coreStore );\n\t\tconst { createSuccessNotice, createErrorNotice } =\n\t\t\tuseDispatch( noticesStore );\n\t\tconst onConfirm = async () => {\n\t\t\ttry {\n\t\t\t\tif ( items[ 0 ].type === TEMPLATE_PART_POST_TYPE ) {\n\t\t\t\t\tawait removeTemplates( items );\n\t\t\t\t} else {\n\t\t\t\t\tfor ( const template of items ) {\n\t\t\t\t\t\tif ( template.type === TEMPLATE_POST_TYPE ) {\n\t\t\t\t\t\t\tawait revertTemplate( template, {\n\t\t\t\t\t\t\t\tallowUndo: false,\n\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\tawait saveEditedEntityRecord(\n\t\t\t\t\t\t\t\t'postType',\n\t\t\t\t\t\t\t\ttemplate.type,\n\t\t\t\t\t\t\t\ttemplate.id\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\tcreateSuccessNotice(\n\t\t\t\t\t\titems.length > 1\n\t\t\t\t\t\t\t? sprintf(\n\t\t\t\t\t\t\t\t\t/* translators: The number of items. */\n\t\t\t\t\t\t\t\t\t__( '%s items reset.' ),\n\t\t\t\t\t\t\t\t\titems.length\n\t\t\t\t\t\t\t )\n\t\t\t\t\t\t\t: sprintf(\n\t\t\t\t\t\t\t\t\t/* translators: The template/part's name. */\n\t\t\t\t\t\t\t\t\t__( '\"%s\" reset.' ),\n\t\t\t\t\t\t\t\t\tdecodeEntities( getItemTitle( items[ 0 ] ) )\n\t\t\t\t\t\t\t ),\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\t\t\tid: 'revert-template-action',\n\t\t\t\t\t\t}\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t} catch ( error ) {\n\t\t\t\tlet fallbackErrorMessage;\n\t\t\t\tif ( items[ 0 ].type === TEMPLATE_POST_TYPE ) {\n\t\t\t\t\tfallbackErrorMessage =\n\t\t\t\t\t\titems.length === 1\n\t\t\t\t\t\t\t? __(\n\t\t\t\t\t\t\t\t\t'An error occurred while reverting the template.'\n\t\t\t\t\t\t\t )\n\t\t\t\t\t\t\t: __(\n\t\t\t\t\t\t\t\t\t'An error occurred while reverting the templates.'\n\t\t\t\t\t\t\t );\n\t\t\t\t} else {\n\t\t\t\t\tfallbackErrorMessage =\n\t\t\t\t\t\titems.length === 1\n\t\t\t\t\t\t\t? __(\n\t\t\t\t\t\t\t\t\t'An error occurred while reverting the template part.'\n\t\t\t\t\t\t\t )\n\t\t\t\t\t\t\t: __(\n\t\t\t\t\t\t\t\t\t'An error occurred while reverting the template parts.'\n\t\t\t\t\t\t\t );\n\t\t\t\t}\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: fallbackErrorMessage;\n\n\t\t\t\tcreateErrorNotice( errorMessage, { type: 'snackbar' } );\n\t\t\t}\n\t\t};\n\t\treturn (\n\t\t\t<VStack spacing=\"5\">\n\t\t\t\t<Text>\n\t\t\t\t\t{ __( 'Reset to default and clear all customizations?' ) }\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\t__experimentalIsFocusable\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\tif ( onActionStart ) {\n\t\t\t\t\t\t\t\tonActionStart( items );\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tawait onConfirm( items );\n\t\t\t\t\t\t\tonActionPerformed?.( items );\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\t__experimentalIsFocusable\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Reset' ) }\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\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 isThemePattern = item.type === PATTERN_TYPES.theme;\n\t\tconst duplicatedProps = useDuplicatePatternProps( {\n\t\t\tpattern:\n\t\t\t\tisThemePattern || ! item.patternPost ? item : item.patternPost,\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 { 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\titem.title\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={ item.blocks }\n\t\t\t\tdefaultArea={ item.templatePart?.area || 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\titem.title\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 ) {\n\tconst { postTypeObject } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getPostType } = select( coreStore );\n\t\t\treturn {\n\t\t\t\tpostTypeObject: getPostType( postType ),\n\t\t\t};\n\t\t},\n\t\t[ postType ]\n\t);\n\n\tconst permanentlyDeletePostAction = usePermanentlyDeletePostAction();\n\tconst restorePostAction = useRestorePostAction();\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\tconst 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 && duplicateTemplatePartAction,\n\t\t\tisPattern && duplicatePatternAction,\n\t\t\tsupportsTitle && renamePostAction,\n\t\t\tisPattern && exportPatternAsJSONAction,\n\t\t\tisTemplateOrTemplatePart ? resetTemplateAction : restorePostAction,\n\t\t\tisTemplateOrTemplatePart || isPattern\n\t\t\t\t? deletePostAction\n\t\t\t\t: trashPostAction,\n\t\t\t! isTemplateOrTemplatePart && permanentlyDeletePostAction,\n\t\t].filter( Boolean );\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, _onActionPerformed ) => {\n\t\t\t\t\t\t\texistingCallback( items, ( _items ) => {\n\t\t\t\t\t\t\t\tif ( _onActionPerformed ) {\n\t\t\t\t\t\t\t\t\t_onActionPerformed( _items );\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tonActionPerformed( actions[ i ].id, _items );\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\tisTemplateOrTemplatePart,\n\t\tisPattern,\n\t\tpostTypeObject?.viewable,\n\t\tpermanentlyDeletePostAction,\n\t\trestorePostAction,\n\t\tonActionPerformed,\n\t\tisLoaded,\n\t\tsupportsRevisions,\n\t\tsupportsTitle,\n\t] );\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,QAAQ,EAAEC,KAAK,EAAEC,MAAM,QAAQ,kBAAkB;AAC1D,SAASC,YAAY,QAAQ,gBA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AK,EAAEmJ,kBAAkB,KAAM;cAC1CD,gBAAgB,CAAElJ,KAAK,EAAIoJ,MAAM,IAAM;gBACtC,IAAKD,kBAAkB,EAAG;kBACzBA,kBAAkB,CAAEC,MAAO,CAAC;gBAC7B;gBACAjJ,iBAAiB,CAAEyI,OAAO,CAAEK,CAAC,CAAE,CAAC1J,EAAE,EAAE6J,MAAO,CAAC;cAC7C,CAAE,CAAC;YACJ;UACD,CAAC;QACF;QACA,IAAKR,OAAO,CAAEK,CAAC,CAAE,CAAClJ,WAAW,EAAG;UAC/B,MAAMsJ,mBAAmB,GAAGT,OAAO,CAAEK,CAAC,CAAE,CAAClJ,WAAW;UACpD6I,OAAO,CAAEK,CAAC,CAAE,GAAG;YACd,GAAGL,OAAO,CAAEK,CAAC,CAAE;YACflJ,WAAW,EAAIuJ,KAAK,IAAM;cACzB,oBACCvL,IAAA,CAACsL,mBAAmB;gBAAA,GACdC,KAAK;gBACVnJ,iBAAiB,EAAKiJ,MAAM,IAAM;kBACjC,IAAKE,KAAK,CAACnJ,iBAAiB,EAAG;oBAC9BmJ,KAAK,CAACnJ,iBAAiB,CAAEiJ,MAAO,CAAC;kBAClC;kBACAjJ,iBAAiB,CAChByI,OAAO,CAAEK,CAAC,CAAE,CAAC1J,EAAE,EACf6J,MACD,CAAC;gBACF;cAAG,CACH,CAAC;YAEJ;UACD,CAAC;QACF;MACD;IACD;IAEA,OAAOR,OAAO;EACf,CAAC,EAAE,CACFP,wBAAwB,EACxBC,SAAS,EACTN,cAAc,EAAEa,QAAQ,EACxBV,2BAA2B,EAC3BC,iBAAiB,EACjBjI,iBAAiB,EACjBoI,QAAQ,EACRC,iBAAiB,EACjBG,aAAa,CACZ,CAAC;AACJ","ignoreList":[]}
1
+ {"version":3,"names":["external","trash","backup","addQueryArgs","useDispatch","useSelect","useRegistry","decodeEntities","store","coreStore","__","_n","sprintf","_x","noticesStore","useMemo","useState","privateApis","patternsPrivateApis","Button","TextControl","__experimentalText","Text","__experimentalHStack","HStack","__experimentalVStack","VStack","TEMPLATE_ORIGINS","TEMPLATE_PART_POST_TYPE","TEMPLATE_POST_TYPE","PATTERN_POST_TYPE","editorStore","unlock","isTemplateRevertable","exportPatternAsJSONAction","CreateTemplatePartModalContents","jsx","_jsx","jsxs","_jsxs","PATTERN_TYPES","CreatePatternModalContents","useDuplicatePatternProps","isTemplateRemovable","template","source","templatePart","includes","custom","has_theme_file","canDeleteOrReset","item","isTemplatePart","type","isUserPattern","user","isCustom","getItemTitle","title","rendered","deletePostAction","id","label","isPrimary","icon","isEligible","post","supportsBulk","hideModalHeader","RenderModal","items","closeModal","onActionStart","onActionPerformed","isBusy","setIsBusy","removeTemplates","spacing","children","length","justify","variant","onClick","disabled","__experimentalIsFocusable","allowUndo","useCanUserEligibilityCheckPostType","capability","resource","action","registry","select","canUser","trashPostAction","status","createSuccessNotice","createErrorNotice","deleteEntityRecord","promiseResult","Promise","allSettled","map","throwOnError","every","successMessage","errorMessage","reason","message","errorMessages","Set","failedPromises","filter","failedPromise","add","size","join","useTrashPostAction","usePermanentlyDeletePostAction","permanentlyDeletePostAction","callback","posts","force","useRestorePostAction","editEntityRecord","saveEditedEntityRecord","restorePostAction","viewPostAction","window","open","link","postRevisionsAction","context","_items$0$_links$versi","revisionsCount","_links","count","_post$_links$predeces","_post$_links$version","lastRevisionId","href","revision","document","location","renamePostAction","Object","values","is_custom","isCustomPattern","hasThemeFile","originalTitle","setTitle","onRename","event","preventDefault","error","code","onSubmit","__nextHasNoMarginBottom","__next40pxDefaultSize","value","onChange","required","useRenamePostAction","duplicatePostAction","isCreatingPage","setIsCreatingPage","saveEntityRecord","createPage","newItem","slug","author","comment_status","content","raw","excerpt","meta","parent","password","format","featured_media","menu_order","ping_status","categories","tags","placeholder","isTemplatePartRevertable","resetTemplateAction","revertTemplate","onConfirm","fallbackErrorMessage","duplicatePatternAction","modalHeader","isThemePattern","theme","duplicatedProps","pattern","patternPost","onSuccess","onClose","confirmLabel","duplicateTemplatePartAction","onTemplatePartSuccess","blocks","defaultArea","area","defaultTitle","onCreate","onError","usePostActions","postType","postTypeObject","cachedCanUserResolvers","userCanCreatePostType","getPostType","getCachedResolvers","_postTypeObject","_resource","rest_base","trashPostActionForPostType","permanentlyDeletePostActionForPostType","renamePostActionForPostType","restorePostActionForPostType","isTemplateOrTemplatePart","isPattern","isLoaded","supportsRevisions","supports","revisions","supportsTitle","actions","viewable","globalThis","IS_GUTENBERG_PLUGIN","Boolean","i","existingCallback","_onActionPerformed","_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';\n\nimport {\n\tButton,\n\tTextControl,\n\t__experimentalText as Text,\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 isTemplateRevertable from '../../store/utils/is-template-revertable';\nimport { exportPatternAsJSONAction } from './export-pattern-action';\nimport { CreateTemplatePartModalContents } from '../create-template-part-modal';\n\n// Patterns.\nconst { PATTERN_TYPES, CreatePatternModalContents, useDuplicatePatternProps } =\n\tunlock( patternsPrivateApis );\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\t[ template.source, template.templatePart?.source ].includes(\n\t\t\tTEMPLATE_ORIGINS.custom\n\t\t) &&\n\t\t! template.has_theme_file &&\n\t\t! template.templatePart?.has_theme_file\n\t);\n}\nconst canDeleteOrReset = ( item ) => {\n\tconst isTemplatePart = item.type === TEMPLATE_PART_POST_TYPE;\n\tconst isUserPattern = item.type === PATTERN_TYPES.user;\n\treturn isUserPattern || ( isTemplatePart && item.isCustom );\n};\n\nfunction getItemTitle( item ) {\n\tif ( typeof item.title === 'string' ) {\n\t\treturn decodeEntities( item.title );\n\t}\n\treturn decodeEntities( item.title?.rendered || '' );\n}\n\n// This action is used for templates, patterns and template parts.\n// Every other post type uses the similar `trashPostAction` which\n// moves the post to trash.\nconst deletePostAction = {\n\tid: 'delete-post',\n\tlabel: __( 'Delete' ),\n\tisPrimary: true,\n\ticon: trash,\n\tisEligible( post ) {\n\t\tif (\n\t\t\t[ TEMPLATE_POST_TYPE, TEMPLATE_PART_POST_TYPE ].includes(\n\t\t\t\tpost.type\n\t\t\t)\n\t\t) {\n\t\t\treturn isTemplateRemovable( post );\n\t\t}\n\t\t// We can only remove user patterns.\n\t\treturn post.type === PATTERN_TYPES.user;\n\t},\n\tsupportsBulk: true,\n\thideModalHeader: true,\n\tRenderModal: ( {\n\t\titems,\n\t\tcloseModal,\n\t\tonActionStart,\n\t\tonActionPerformed,\n\t} ) => {\n\t\tconst [ isBusy, setIsBusy ] = useState( false );\n\t\tconst { removeTemplates } = unlock( useDispatch( editorStore ) );\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: %d: number of items to delete.\n\t\t\t\t\t\t\t\t_n(\n\t\t\t\t\t\t\t\t\t'Delete %d item?',\n\t\t\t\t\t\t\t\t\t'Delete %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\t\t: sprintf(\n\t\t\t\t\t\t\t\t// translators: %s: The template or template part's titles\n\t\t\t\t\t\t\t\t__( 'Delete \"%s\"?' ),\n\t\t\t\t\t\t\t\tgetItemTitle( items[ 0 ] )\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\t__experimentalIsFocusable\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\tif ( onActionStart ) {\n\t\t\t\t\t\t\t\tonActionStart( items );\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tawait removeTemplates( items, {\n\t\t\t\t\t\t\t\tallowUndo: false,\n\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\tonActionPerformed?.( items );\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\t__experimentalIsFocusable\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Delete' ) }\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, resource, 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\n\t\t\t\t\t\t.select( coreStore )\n\t\t\t\t\t\t.canUser( capability, resource, item.id )\n\t\t\t\t);\n\t\t\t},\n\t\t} ),\n\t\t[ action, registry, capability, resource ]\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: ( {\n\t\titems,\n\t\tcloseModal,\n\t\tonActionStart,\n\t\tonActionPerformed,\n\t} ) => {\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\t__experimentalIsFocusable\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\tif ( onActionStart ) {\n\t\t\t\t\t\t\t\tonActionStart( items );\n\t\t\t\t\t\t\t}\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 if ( items[ 0 ].type === 'page' ) {\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__( '%s items moved to trash.' ),\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} 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 posts. */\n\t\t\t\t\t\t\t\t\t\t__( '%s items move to trash.' ),\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\t__experimentalIsFocusable\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 useTrashPostAction( resource ) {\n\treturn useCanUserEligibilityCheckPostType(\n\t\t'delete',\n\t\tresource,\n\t\ttrashPostAction\n\t);\n}\n\nfunction usePermanentlyDeletePostAction( resource ) {\n\tconst { createSuccessNotice, createErrorNotice } =\n\t\tuseDispatch( noticesStore );\n\tconst { deleteEntityRecord } = useDispatch( coreStore );\n\n\tconst permanentlyDeletePostAction = useMemo(\n\t\t() => ( {\n\t\t\tid: 'permanently-delete',\n\t\t\tlabel: __( 'Permanently delete' ),\n\t\t\tsupportsBulk: true,\n\t\t\tisEligible( { status } ) {\n\t\t\t\treturn status === 'trash';\n\t\t\t},\n\t\t\tasync callback( posts, onActionPerformed ) {\n\t\t\t\tconst promiseResult = await Promise.allSettled(\n\t\t\t\t\tposts.map( ( post ) => {\n\t\t\t\t\t\treturn deleteEntityRecord(\n\t\t\t\t\t\t\t'postType',\n\t\t\t\t\t\t\tpost.type,\n\t\t\t\t\t\t\tpost.id,\n\t\t\t\t\t\t\t{ force: true },\n\t\t\t\t\t\t\t{ throwOnError: true }\n\t\t\t\t\t\t);\n\t\t\t\t\t} )\n\t\t\t\t);\n\t\t\t\t// If all the promises were fulfilled with success.\n\t\t\t\tif (\n\t\t\t\t\tpromiseResult.every(\n\t\t\t\t\t\t( { status } ) => status === 'fulfilled'\n\t\t\t\t\t)\n\t\t\t\t) {\n\t\t\t\t\tlet successMessage;\n\t\t\t\t\tif ( promiseResult.length === 1 ) {\n\t\t\t\t\t\tsuccessMessage = sprintf(\n\t\t\t\t\t\t\t/* translators: The posts's title. */\n\t\t\t\t\t\t\t__( '\"%s\" permanently deleted.' ),\n\t\t\t\t\t\t\tgetItemTitle( posts[ 0 ] )\n\t\t\t\t\t\t);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tsuccessMessage = __(\n\t\t\t\t\t\t\t'The posts were permanently deleted.'\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t\tcreateSuccessNotice( successMessage, {\n\t\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\t\tid: 'permanently-delete-post-action',\n\t\t\t\t\t} );\n\t\t\t\t\tif ( onActionPerformed ) {\n\t\t\t\t\t\tonActionPerformed( posts );\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\t// If there was at lease one failure.\n\t\t\t\t\tlet errorMessage;\n\t\t\t\t\t// If we were trying to permanently delete a single post.\n\t\t\t\t\tif ( promiseResult.length === 1 ) {\n\t\t\t\t\t\tif ( promiseResult[ 0 ].reason?.message ) {\n\t\t\t\t\t\t\terrorMessage = promiseResult[ 0 ].reason.message;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\terrorMessage = __(\n\t\t\t\t\t\t\t\t'An error occurred while permanently deleting the post.'\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\t\t\t\t\t\t// If we were trying to permanently delete multiple posts\n\t\t\t\t\t} else {\n\t\t\t\t\t\tconst errorMessages = new Set();\n\t\t\t\t\t\tconst failedPromises = promiseResult.filter(\n\t\t\t\t\t\t\t( { status } ) => status === 'rejected'\n\t\t\t\t\t\t);\n\t\t\t\t\t\tfor ( const failedPromise of failedPromises ) {\n\t\t\t\t\t\t\tif ( failedPromise.reason?.message ) {\n\t\t\t\t\t\t\t\terrorMessages.add(\n\t\t\t\t\t\t\t\t\tfailedPromise.reason.message\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\tif ( errorMessages.size === 0 ) {\n\t\t\t\t\t\t\terrorMessage = __(\n\t\t\t\t\t\t\t\t'An error occurred while permanently deleting the posts.'\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t} else if ( errorMessages.size === 1 ) {\n\t\t\t\t\t\t\terrorMessage = sprintf(\n\t\t\t\t\t\t\t\t/* translators: %s: an error message */\n\t\t\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t\t\t'An error occurred while permanently deleting the posts: %s'\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t[ ...errorMessages ][ 0 ]\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\terrorMessage = sprintf(\n\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__(\n\t\t\t\t\t\t\t\t\t'Some errors occurred while permanently deleting the posts: %s'\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t[ ...errorMessages ].join( ',' )\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\tcreateErrorNotice( errorMessage, {\n\t\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\t} );\n\t\t\t\t}\n\t\t\t},\n\t\t} ),\n\t\t[ createSuccessNotice, createErrorNotice, deleteEntityRecord ]\n\t);\n\treturn useCanUserEligibilityCheckPostType(\n\t\t'delete',\n\t\tresource,\n\t\tpermanentlyDeletePostAction\n\t);\n}\n\nfunction useRestorePostAction( resource ) {\n\tconst { createSuccessNotice, createErrorNotice } =\n\t\tuseDispatch( noticesStore );\n\tconst { editEntityRecord, saveEditedEntityRecord } =\n\t\tuseDispatch( coreStore );\n\n\tconst restorePostAction = useMemo(\n\t\t() => ( {\n\t\t\tid: 'restore',\n\t\t\tlabel: __( 'Restore' ),\n\t\t\tisPrimary: true,\n\t\t\ticon: backup,\n\t\t\tsupportsBulk: true,\n\t\t\tisEligible( { status } ) {\n\t\t\t\treturn status === 'trash';\n\t\t\t},\n\t\t\tasync callback( posts, onActionPerformed ) {\n\t\t\t\tawait Promise.allSettled(\n\t\t\t\t\tposts.map( ( post ) => {\n\t\t\t\t\t\treturn editEntityRecord(\n\t\t\t\t\t\t\t'postType',\n\t\t\t\t\t\t\tpost.type,\n\t\t\t\t\t\t\tpost.id,\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tstatus: 'draft',\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\tconst promiseResult = await Promise.allSettled(\n\t\t\t\t\tposts.map( ( post ) => {\n\t\t\t\t\t\treturn saveEditedEntityRecord(\n\t\t\t\t\t\t\t'postType',\n\t\t\t\t\t\t\tpost.type,\n\t\t\t\t\t\t\tpost.id,\n\t\t\t\t\t\t\t{ throwOnError: true }\n\t\t\t\t\t\t);\n\t\t\t\t\t} )\n\t\t\t\t);\n\n\t\t\t\tif (\n\t\t\t\t\tpromiseResult.every(\n\t\t\t\t\t\t( { status } ) => status === 'fulfilled'\n\t\t\t\t\t)\n\t\t\t\t) {\n\t\t\t\t\tlet successMessage;\n\t\t\t\t\tif ( posts.length === 1 ) {\n\t\t\t\t\t\tsuccessMessage = sprintf(\n\t\t\t\t\t\t\t/* translators: The number of posts. */\n\t\t\t\t\t\t\t__( '\"%s\" has been restored.' ),\n\t\t\t\t\t\t\tgetItemTitle( posts[ 0 ] )\n\t\t\t\t\t\t);\n\t\t\t\t\t} else if ( posts[ 0 ].type === 'page' ) {\n\t\t\t\t\t\tsuccessMessage = sprintf(\n\t\t\t\t\t\t\t/* translators: The number of posts. */\n\t\t\t\t\t\t\t__( '%d pages have been restored.' ),\n\t\t\t\t\t\t\tposts.length\n\t\t\t\t\t\t);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tsuccessMessage = sprintf(\n\t\t\t\t\t\t\t/* translators: The number of posts. */\n\t\t\t\t\t\t\t__( '%d posts have been restored.' ),\n\t\t\t\t\t\t\tposts.length\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t\tcreateSuccessNotice( successMessage, {\n\t\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\t\tid: 'restore-post-action',\n\t\t\t\t\t} );\n\t\t\t\t\tif ( onActionPerformed ) {\n\t\t\t\t\t\tonActionPerformed( posts );\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\t// If there was at lease one failure.\n\t\t\t\t\tlet errorMessage;\n\t\t\t\t\t// If we were trying to move a single post to the trash.\n\t\t\t\t\tif ( promiseResult.length === 1 ) {\n\t\t\t\t\t\tif ( promiseResult[ 0 ].reason?.message ) {\n\t\t\t\t\t\t\terrorMessage = promiseResult[ 0 ].reason.message;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\terrorMessage = __(\n\t\t\t\t\t\t\t\t'An error occurred while restoring the post.'\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\t\t\t\t\t\t// If we were trying to move multiple posts to the trash\n\t\t\t\t\t} else {\n\t\t\t\t\t\tconst errorMessages = new Set();\n\t\t\t\t\t\tconst failedPromises = promiseResult.filter(\n\t\t\t\t\t\t\t( { status } ) => status === 'rejected'\n\t\t\t\t\t\t);\n\t\t\t\t\t\tfor ( const failedPromise of failedPromises ) {\n\t\t\t\t\t\t\tif ( failedPromise.reason?.message ) {\n\t\t\t\t\t\t\t\terrorMessages.add(\n\t\t\t\t\t\t\t\t\tfailedPromise.reason.message\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\tif ( errorMessages.size === 0 ) {\n\t\t\t\t\t\t\terrorMessage = __(\n\t\t\t\t\t\t\t\t'An error occurred while restoring the posts.'\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t} else if ( errorMessages.size === 1 ) {\n\t\t\t\t\t\t\terrorMessage = sprintf(\n\t\t\t\t\t\t\t\t/* translators: %s: an error message */\n\t\t\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t\t\t'An error occurred while restoring the posts: %s'\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t[ ...errorMessages ][ 0 ]\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\terrorMessage = sprintf(\n\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__(\n\t\t\t\t\t\t\t\t\t'Some errors occurred while restoring the posts: %s'\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t[ ...errorMessages ].join( ',' )\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\tcreateErrorNotice( errorMessage, {\n\t\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\t} );\n\t\t\t\t}\n\t\t\t},\n\t\t} ),\n\t\t[\n\t\t\tcreateSuccessNotice,\n\t\t\tcreateErrorNotice,\n\t\t\teditEntityRecord,\n\t\t\tsaveEditedEntityRecord,\n\t\t]\n\t);\n\treturn useCanUserEligibilityCheckPostType(\n\t\t'update',\n\t\tresource,\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 &&\n\t\t\t\t( post.isCustom || post.source === TEMPLATE_ORIGINS.custom ) );\n\t\tconst hasThemeFile =\n\t\t\tisTemplatePart &&\n\t\t\t( post.templatePart?.has_theme_file || post.has_theme_file );\n\t\treturn isCustomPattern && ! hasThemeFile;\n\t},\n\tRenderModal: ( { items, closeModal, onActionPerformed } ) => {\n\t\tconst [ item ] = items;\n\t\tconst originalTitle = decodeEntities(\n\t\t\ttypeof item.title === 'string' ? item.title : item.title.rendered\n\t\t);\n\t\tconst [ title, setTitle ] = useState( () => originalTitle );\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( resource ) {\n\treturn useCanUserEligibilityCheckPostType(\n\t\t'update',\n\t\tresource,\n\t\trenamePostAction\n\t);\n}\n\nconst duplicatePostAction = {\n\tid: 'duplicate-post',\n\tlabel: _x( 'Duplicate', 'action label' ),\n\tisEligible( { status } ) {\n\t\treturn status !== 'trash';\n\t},\n\tRenderModal: ( { items, closeModal, onActionPerformed } ) => {\n\t\tconst [ item ] = items;\n\t\tconst [ isCreatingPage, setIsCreatingPage ] = useState( false );\n\t\tconst [ title, setTitle ] = useState(\n\t\t\tsprintf(\n\t\t\t\t/* translators: %s: Existing item title */\n\t\t\t\t__( '%s (Copy)' ),\n\t\t\t\tgetItemTitle( item )\n\t\t\t)\n\t\t);\n\n\t\tconst { saveEntityRecord } = useDispatch( coreStore );\n\t\tconst { createSuccessNotice, createErrorNotice } =\n\t\t\tuseDispatch( noticesStore );\n\n\t\tasync function createPage( event ) {\n\t\t\tevent.preventDefault();\n\n\t\t\tif ( isCreatingPage ) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tsetIsCreatingPage( true );\n\t\t\ttry {\n\t\t\t\tconst newItem = await saveEntityRecord(\n\t\t\t\t\t'postType',\n\t\t\t\t\titem.type,\n\t\t\t\t\t{\n\t\t\t\t\t\tstatus: 'draft',\n\t\t\t\t\t\ttitle,\n\t\t\t\t\t\tslug: title || __( 'No title' ),\n\t\t\t\t\t\tauthor: item.author,\n\t\t\t\t\t\tcomment_status: item.comment_status,\n\t\t\t\t\t\tcontent:\n\t\t\t\t\t\t\ttypeof item.content === 'string'\n\t\t\t\t\t\t\t\t? item.content\n\t\t\t\t\t\t\t\t: item.content.raw,\n\t\t\t\t\t\texcerpt: item.excerpt.raw,\n\t\t\t\t\t\tmeta: item.meta,\n\t\t\t\t\t\tparent: item.parent,\n\t\t\t\t\t\tpassword: item.password,\n\t\t\t\t\t\ttemplate: item.template,\n\t\t\t\t\t\tformat: item.format,\n\t\t\t\t\t\tfeatured_media: item.featured_media,\n\t\t\t\t\t\tmenu_order: item.menu_order,\n\t\t\t\t\t\tping_status: item.ping_status,\n\t\t\t\t\t\tcategories: item.categories,\n\t\t\t\t\t\ttags: item.tags,\n\t\t\t\t\t},\n\t\t\t\t\t{ throwOnError: true }\n\t\t\t\t);\n\n\t\t\t\tcreateSuccessNotice(\n\t\t\t\t\tsprintf(\n\t\t\t\t\t\t// translators: %s: Title of the created template e.g: \"Category\".\n\t\t\t\t\t\t__( '\"%s\" successfully created.' ),\n\t\t\t\t\t\tdecodeEntities( newItem.title?.rendered || title )\n\t\t\t\t\t),\n\t\t\t\t\t{\n\t\t\t\t\t\tid: 'duplicate-post-action',\n\t\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\t}\n\t\t\t\t);\n\n\t\t\t\tif ( onActionPerformed ) {\n\t\t\t\t\tonActionPerformed( [ newItem ] );\n\t\t\t\t}\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 duplicating the page.' );\n\n\t\t\t\tcreateErrorNotice( errorMessage, {\n\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t} );\n\t\t\t} finally {\n\t\t\t\tsetIsCreatingPage( false );\n\t\t\t\tcloseModal();\n\t\t\t}\n\t\t}\n\t\treturn (\n\t\t\t<form onSubmit={ createPage }>\n\t\t\t\t<VStack spacing={ 3 }>\n\t\t\t\t\t<TextControl\n\t\t\t\t\t\tlabel={ __( 'Title' ) }\n\t\t\t\t\t\tonChange={ setTitle }\n\t\t\t\t\t\tplaceholder={ __( 'No title' ) }\n\t\t\t\t\t\tvalue={ title }\n\t\t\t\t\t/>\n\t\t\t\t\t<HStack spacing={ 2 } justify=\"end\">\n\t\t\t\t\t\t<Button variant=\"tertiary\" onClick={ closeModal }>\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\tvariant=\"primary\"\n\t\t\t\t\t\t\ttype=\"submit\"\n\t\t\t\t\t\t\tisBusy={ isCreatingPage }\n\t\t\t\t\t\t\taria-disabled={ isCreatingPage }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ _x( 'Duplicate', 'action label' ) }\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\nconst isTemplatePartRevertable = ( item ) => {\n\tif ( ! item ) {\n\t\treturn false;\n\t}\n\tconst hasThemeFile = item.templatePart?.has_theme_file;\n\treturn canDeleteOrReset( item ) && hasThemeFile;\n};\n\nconst resetTemplateAction = {\n\tid: 'reset-template',\n\tlabel: __( 'Reset' ),\n\tisEligible: ( item ) => {\n\t\treturn item.type === TEMPLATE_PART_POST_TYPE\n\t\t\t? isTemplatePartRevertable( item )\n\t\t\t: isTemplateRevertable( item );\n\t},\n\ticon: backup,\n\tsupportsBulk: true,\n\thideModalHeader: true,\n\tRenderModal: ( {\n\t\titems,\n\t\tcloseModal,\n\t\tonActionStart,\n\t\tonActionPerformed,\n\t} ) => {\n\t\tconst [ isBusy, setIsBusy ] = useState( false );\n\t\tconst { revertTemplate, removeTemplates } = unlock(\n\t\t\tuseDispatch( editorStore )\n\t\t);\n\t\tconst { saveEditedEntityRecord } = useDispatch( coreStore );\n\t\tconst { createSuccessNotice, createErrorNotice } =\n\t\t\tuseDispatch( noticesStore );\n\t\tconst onConfirm = async () => {\n\t\t\ttry {\n\t\t\t\tif ( items[ 0 ].type === TEMPLATE_PART_POST_TYPE ) {\n\t\t\t\t\tawait removeTemplates( items );\n\t\t\t\t} else {\n\t\t\t\t\tfor ( const template of items ) {\n\t\t\t\t\t\tif ( template.type === TEMPLATE_POST_TYPE ) {\n\t\t\t\t\t\t\tawait revertTemplate( template, {\n\t\t\t\t\t\t\t\tallowUndo: false,\n\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\tawait saveEditedEntityRecord(\n\t\t\t\t\t\t\t\t'postType',\n\t\t\t\t\t\t\t\ttemplate.type,\n\t\t\t\t\t\t\t\ttemplate.id\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\tcreateSuccessNotice(\n\t\t\t\t\t\titems.length > 1\n\t\t\t\t\t\t\t? sprintf(\n\t\t\t\t\t\t\t\t\t/* translators: The number of items. */\n\t\t\t\t\t\t\t\t\t__( '%s items reset.' ),\n\t\t\t\t\t\t\t\t\titems.length\n\t\t\t\t\t\t\t )\n\t\t\t\t\t\t\t: sprintf(\n\t\t\t\t\t\t\t\t\t/* translators: The template/part's name. */\n\t\t\t\t\t\t\t\t\t__( '\"%s\" reset.' ),\n\t\t\t\t\t\t\t\t\tdecodeEntities( getItemTitle( items[ 0 ] ) )\n\t\t\t\t\t\t\t ),\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\t\t\tid: 'revert-template-action',\n\t\t\t\t\t\t}\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t} catch ( error ) {\n\t\t\t\tlet fallbackErrorMessage;\n\t\t\t\tif ( items[ 0 ].type === TEMPLATE_POST_TYPE ) {\n\t\t\t\t\tfallbackErrorMessage =\n\t\t\t\t\t\titems.length === 1\n\t\t\t\t\t\t\t? __(\n\t\t\t\t\t\t\t\t\t'An error occurred while reverting the template.'\n\t\t\t\t\t\t\t )\n\t\t\t\t\t\t\t: __(\n\t\t\t\t\t\t\t\t\t'An error occurred while reverting the templates.'\n\t\t\t\t\t\t\t );\n\t\t\t\t} else {\n\t\t\t\t\tfallbackErrorMessage =\n\t\t\t\t\t\titems.length === 1\n\t\t\t\t\t\t\t? __(\n\t\t\t\t\t\t\t\t\t'An error occurred while reverting the template part.'\n\t\t\t\t\t\t\t )\n\t\t\t\t\t\t\t: __(\n\t\t\t\t\t\t\t\t\t'An error occurred while reverting the template parts.'\n\t\t\t\t\t\t\t );\n\t\t\t\t}\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: fallbackErrorMessage;\n\n\t\t\t\tcreateErrorNotice( errorMessage, { type: 'snackbar' } );\n\t\t\t}\n\t\t};\n\t\treturn (\n\t\t\t<VStack spacing=\"5\">\n\t\t\t\t<Text>\n\t\t\t\t\t{ __( 'Reset to default and clear all customizations?' ) }\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\t__experimentalIsFocusable\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\tif ( onActionStart ) {\n\t\t\t\t\t\t\t\tonActionStart( items );\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tawait onConfirm( items );\n\t\t\t\t\t\t\tonActionPerformed?.( items );\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\t__experimentalIsFocusable\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Reset' ) }\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\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 isThemePattern = item.type === PATTERN_TYPES.theme;\n\t\tconst duplicatedProps = useDuplicatePatternProps( {\n\t\t\tpattern:\n\t\t\t\tisThemePattern || ! item.patternPost ? item : item.patternPost,\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 { 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\titem.title\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={ item.blocks }\n\t\t\t\tdefaultArea={ item.templatePart?.area || 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\titem.title\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\tpostTypeObject,\n\t\tresource,\n\t\tcachedCanUserResolvers,\n\t\tuserCanCreatePostType,\n\t} = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getPostType, getCachedResolvers, canUser } =\n\t\t\t\tselect( coreStore );\n\t\t\tconst _postTypeObject = getPostType( postType );\n\t\t\tconst _resource = _postTypeObject?.rest_base || '';\n\t\t\treturn {\n\t\t\t\tpostTypeObject: _postTypeObject,\n\t\t\t\tresource: _resource,\n\t\t\t\tcachedCanUserResolvers: getCachedResolvers()?.canUser,\n\t\t\t\tuserCanCreatePostType: canUser( 'create', _resource ),\n\t\t\t};\n\t\t},\n\t\t[ postType ]\n\t);\n\n\tconst trashPostActionForPostType = useTrashPostAction( resource );\n\tconst permanentlyDeletePostActionForPostType =\n\t\tusePermanentlyDeletePostAction( resource );\n\tconst renamePostActionForPostType = useRenamePostAction( resource );\n\tconst restorePostActionForPostType = useRestorePostAction( resource );\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\tisPattern && exportPatternAsJSONAction,\n\t\t\tisTemplateOrTemplatePart\n\t\t\t\t? resetTemplateAction\n\t\t\t\t: restorePostActionForPostType,\n\t\t\tisTemplateOrTemplatePart || isPattern\n\t\t\t\t? deletePostAction\n\t\t\t\t: trashPostActionForPostType,\n\t\t\t! isTemplateOrTemplatePart &&\n\t\t\t\tpermanentlyDeletePostActionForPostType,\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, _onActionPerformed ) => {\n\t\t\t\t\t\t\texistingCallback( items, ( _items ) => {\n\t\t\t\t\t\t\t\tif ( _onActionPerformed ) {\n\t\t\t\t\t\t\t\t\t_onActionPerformed( _items );\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tonActionPerformed( actions[ i ].id, _items );\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\tisTemplateOrTemplatePart,\n\t\tisPattern,\n\t\tpostTypeObject?.viewable,\n\t\tpermanentlyDeletePostActionForPostType,\n\t\trestorePostActionForPostType,\n\t\trenamePostActionForPostType,\n\t\ttrashPostActionForPostType,\n\t\tonActionPerformed,\n\t\tisLoaded,\n\t\tsupportsRevisions,\n\t\tsupportsTitle,\n\t\tcontext,\n\t\tuserCanCreatePostType,\n\t\tcachedCanUserResolvers,\n\t] );\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,QAAQ,EAAEC,KAAK,EAAEC,MAAM,QAAQ,kBAAkB;AAC1D,SAASC,YAAY,QAAQ,gBAAgB;AAC7C,SAASC,WAAW,EAAEC,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACrE,SAASC,cAAc,QAAQ,0BAA0B;AACzD,SAASC,KAAK,IAAIC,SAAS,QAAQ,sBAAsB;AACzD,SAASC,EAAE,EAAEC,EAAE,EAAEC,OAAO,EAAEC,EAAE,QAAQ,iBAAiB;AACrD,SAASL,KAAK,IAAIM,YAAY,QAAQ,oBAAoB;AAC1D,SAASC,OAAO,EAAEC,QAAQ,QAAQ,oBAAoB;AACtD,SAASC,WAAW,IAAIC,mBAAmB,QAAQ,qBAAqB;AAExE,SACCC,MAAM,EACNC,WAAW,EACXC,kBAAkB,IAAIC,IAAI,EAC1BC,oBAAoB,IAAIC,MAAM,EAC9BC,oBAAoB,IAAIC,MAAM,QACxB,uBAAuB;;AAE9B;AACA;AACA;AACA,SACCC,gBAAgB,EAChBC,uBAAuB,EACvBC,kBAAkB,EAClBC,iBAAiB,QACX,uBAAuB;AAC9B,SAAStB,KAAK,IAAIuB,WAAW,QAAQ,aAAa;AAClD,SAASC,MAAM,QAAQ,mBAAmB;AAC1C,OAAOC,oBAAoB,MAAM,0CAA0C;AAC3E,SA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AC;YACJ;UACD,CAAC;QACF;QACA,IAAKR,OAAO,CAAEK,CAAC,CAAE,CAACrK,WAAW,EAAG;UAC/B,MAAMyK,mBAAmB,GAAGT,OAAO,CAAEK,CAAC,CAAE,CAACrK,WAAW;UACpDgK,OAAO,CAAEK,CAAC,CAAE,GAAG;YACd,GAAGL,OAAO,CAAEK,CAAC,CAAE;YACfrK,WAAW,EAAI0K,KAAK,IAAM;cACzB,oBACC1M,IAAA,CAACyM,mBAAmB;gBAAA,GACdC,KAAK;gBACVtK,iBAAiB,EAAKoK,MAAM,IAAM;kBACjC,IAAKE,KAAK,CAACtK,iBAAiB,EAAG;oBAC9BsK,KAAK,CAACtK,iBAAiB,CAAEoK,MAAO,CAAC;kBAClC;kBACApK,iBAAiB,CAChB4J,OAAO,CAAEK,CAAC,CAAE,CAAC7K,EAAE,EACfgL,MACD,CAAC;gBACF;cAAG,CACH,CAAC;YAEJ;UACD,CAAC;QACF;MACD;IACD;IAEA,OAAOR,OAAO;IACd;IACA;IACA;EACD,CAAC,EAAE,CACFP,wBAAwB,EACxBC,SAAS,EACTb,cAAc,EAAEoB,QAAQ,EACxBX,sCAAsC,EACtCE,4BAA4B,EAC5BD,2BAA2B,EAC3BF,0BAA0B,EAC1BjJ,iBAAiB,EACjBuJ,QAAQ,EACRC,iBAAiB,EACjBG,aAAa,EACbjG,OAAO,EACPiF,qBAAqB,EACrBD,sBAAsB,CACrB,CAAC;AACJ","ignoreList":[]}
@@ -46,7 +46,10 @@ export default function PostActions({
46
46
  postType: _postType
47
47
  };
48
48
  }, []);
49
- const allActions = usePostActions(postType, onActionPerformed);
49
+ const allActions = usePostActions({
50
+ postType,
51
+ onActionPerformed
52
+ });
50
53
  const actions = useMemo(() => {
51
54
  return allActions.filter(action => {
52
55
  return !action.isEligible || action.isEligible(item);
@@ -1 +1 @@
1
- {"version":3,"names":["useSelect","useState","useMemo","__","privateApis","componentsPrivateApis","Button","Modal","moreVertical","store","coreStore","unlock","usePostActions","editorStore","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","DropdownMenuV2","DropdownMenu","DropdownMenuGroupV2","DropdownMenuGroup","DropdownMenuItemV2","DropdownMenuItem","DropdownMenuItemLabelV2","DropdownMenuItemLabel","kebabCase","PostActions","onActionPerformed","buttonProps","isActionsMenuOpen","setIsActionsMenuOpen","item","postType","select","getCurrentPostType","getCurrentPostId","getEditedEntityRecord","_postType","allActions","actions","filter","action","isEligible","open","trigger","size","icon","label","disabled","length","__experimentalIsFocusable","className","onClick","onOpenChange","placement","children","ActionsDropdownMenuGroup","onClose","DropdownMenuItemTrigger","items","hideOnClick","RenderModal","ActionWithModal","ActionTrigger","isModalOpen","setIsModalOpen","actionTriggerProps","hideModalHeader","title","modalHeader","__experimentalHideHeader","onRequestClose","overlayClassName","id","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\t__experimentalIsFocusable\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>\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":"AAAA;AACA;AACA;AACA,SAASA,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,QAAQ,EAAEC,OAAO,QAAQ,oBAAoB;AACtD,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SACCC,WAAW,IAAIC,qBAAqB,EACpCC,MAAM,EACNC,KAAK,QACC,uBAAuB;AAC9B,SAASC,YAAY,QAAQ,kBAAkB;AAC/C,SAASC,KAAK,IAAIC,SAAS,QAAQ,sBAAsB;;AAEzD;AACA;AACA;AACA,SAASC,MAAM,QAAQ,mBAAmB;AAC1C,SAASC,cAAc,QAAQ,WAAW;AAC1C,SAASH,KAAK,IAAII,WAAW,QAAQ,aAAa;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAAA,SAAAC,QAAA,IAAAC,SAAA;AAAA,SAAAC,IAAA,IAAAC,KAAA;AAEnD,MAAM;EACLC,cAAc,EAAEC,YAAY;EAC5BC,mBAAmB,EAAEC,iBAAiB;EACtCC,kBAAkB,EAAEC,gBAAgB;EACpCC,uBAAuB,EAAEC,qBAAqB;EAC9CC;AACD,CAAC,GAAGjB,MAAM,CAAEN,qBAAsB,CAAC;AAEnC,eAAe,SAASwB,WAAWA,CAAE;EAAEC,iBAAiB;EAAEC;AAAY,CAAC,EAAG;EACzE,MAAM,CAAEC,iBAAiB,EAAEC,oBAAoB,CAAE,GAAGhC,QAAQ,CAAE,KAAM,CAAC;EACrE,MAAM;IAAEiC,IAAI;IAAEC;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AG,CAAC,CAAEH,eAAiB;MAC/CI,cAAc,EAAGA,CAAA,KAAM;QACtBN,cAAc,CAAE,KAAM,CAAC;MACxB,CAAG;MACHO,gBAAgB,EAAI,4CAA4C/C,SAAS,CACxEgB,MAAM,CAACgC,EACR,CAAG,EAAG;MAAAlB,QAAA,eAEN3C,IAAA,CAACiD,WAAW;QACXF,KAAK,EAAG,CAAE5B,IAAI,CAAI;QAClB2C,UAAU,EAAGA,CAAA,KAAM;UAClBT,cAAc,CAAE,KAAM,CAAC;UACvBR,OAAO,CAAC,CAAC;QACV;MAAG,CACH;IAAC,CACI,CACP;EAAA,CACA,CAAC;AAEL;;AAEA;AACA;AACA,SAASD,wBAAwBA,CAAE;EAAEjB,OAAO;EAAER,IAAI;EAAE0B;AAAQ,CAAC,EAAG;EAC/D,oBACC7C,IAAA,CAACQ,iBAAiB;IAAAmC,QAAA,EACfhB,OAAO,CAACoC,GAAG,CAAIlC,MAAM,IAAM;MAC5B,IAAKA,MAAM,CAACoB,WAAW,EAAG;QACzB,oBACCjD,IAAA,CAACkD,eAAe;UAEfrB,MAAM,EAAGA,MAAQ;UACjBV,IAAI,EAAGA,IAAM;UACbgC,aAAa,EAAGL,uBAAyB;UACzCD,OAAO,EAAGA;QAAS,GAJbhB,MAAM,CAACgC,EAKb,CAAC;MAEJ;MACA,oBACC7D,IAAA,CAAC8C,uBAAuB;QAEvBjB,MAAM,EAAGA,MAAQ;QACjBW,OAAO,EAAGA,CAAA,KAAMX,MAAM,CAACmC,QAAQ,CAAE,CAAE7C,IAAI,CAAG,CAAG;QAC7C4B,KAAK,EAAG,CAAE5B,IAAI;MAAI,GAHZU,MAAM,CAACgC,EAIb,CAAC;IAEJ,CAAE;EAAC,CACe,CAAC;AAEtB","ignoreList":[]}
1
+ {"version":3,"names":["useSelect","useState","useMemo","__","privateApis","componentsPrivateApis","Button","Modal","moreVertical","store","coreStore","unlock","usePostActions","editorStore","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","DropdownMenuV2","DropdownMenu","DropdownMenuGroupV2","DropdownMenuGroup","DropdownMenuItemV2","DropdownMenuItem","DropdownMenuItemLabelV2","DropdownMenuItemLabel","kebabCase","PostActions","onActionPerformed","buttonProps","isActionsMenuOpen","setIsActionsMenuOpen","item","postType","select","getCurrentPostType","getCurrentPostId","getEditedEntityRecord","_postType","allActions","actions","filter","action","isEligible","open","trigger","size","icon","label","disabled","length","__experimentalIsFocusable","className","onClick","onOpenChange","placement","children","ActionsDropdownMenuGroup","onClose","DropdownMenuItemTrigger","items","hideOnClick","RenderModal","ActionWithModal","ActionTrigger","isModalOpen","setIsModalOpen","actionTriggerProps","hideModalHeader","title","modalHeader","__experimentalHideHeader","onRequestClose","overlayClassName","id","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\t__experimentalIsFocusable\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>\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":"AAAA;AACA;AACA;AACA,SAASA,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,QAAQ,EAAEC,OAAO,QAAQ,oBAAoB;AACtD,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SACCC,WAAW,IAAIC,qBAAqB,EACpCC,MAAM,EACNC,KAAK,QACC,uBAAuB;AAC9B,SAASC,YAAY,QAAQ,kBAAkB;AAC/C,SAASC,KAAK,IAAIC,SAAS,QAAQ,sBAAsB;;AAEzD;AACA;AACA;AACA,SAASC,MAAM,QAAQ,mBAAmB;AAC1C,SAASC,cAAc,QAAQ,WAAW;AAC1C,SAASH,KAAK,IAAII,WAAW,QAAQ,aAAa;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAAA,SAAAC,QAAA,IAAAC,SAAA;AAAA,SAAAC,IAAA,IAAAC,KAAA;AAEnD,MAAM;EACLC,cAAc,EAAEC,YAAY;EAC5BC,mBAAmB,EAAEC,iBAAiB;EACtCC,kBAAkB,EAAEC,gBAAgB;EACpCC,uBAAuB,EAAEC,qBAAqB;EAC9CC;AACD,CAAC,GAAGjB,MAAM,CAAEN,qBAAsB,CAAC;AAEnC,eAAe,SAASwB,WAAWA,CAAE;EAAEC,iBAAiB;EAAEC;AAAY,CAAC,EAAG;EACzE,MAAM,CAAEC,iBAAiB,EAAEC,oBAAoB,CAAE,GAAGhC,QAAQ,CAAE,KAAM,CAAC;EACrE,MAAM;IAAEiC,IAAI;IAAEC;EAAS,CAAC,GAAGnC,SAAS,CAAIoC,MA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C/CI,cAAc,EAAGA,CAAA,KAAM;QACtBN,cAAc,CAAE,KAAM,CAAC;MACxB,CAAG;MACHO,gBAAgB,EAAI,4CAA4C/C,SAAS,CACxEgB,MAAM,CAACgC,EACR,CAAG,EAAG;MAAAlB,QAAA,eAEN3C,IAAA,CAACiD,WAAW;QACXF,KAAK,EAAG,CAAE5B,IAAI,CAAI;QAClB2C,UAAU,EAAGA,CAAA,KAAM;UAClBT,cAAc,CAAE,KAAM,CAAC;UACvBR,OAAO,CAAC,CAAC;QACV;MAAG,CACH;IAAC,CACI,CACP;EAAA,CACA,CAAC;AAEL;;AAEA;AACA;AACA,SAASD,wBAAwBA,CAAE;EAAEjB,OAAO;EAAER,IAAI;EAAE0B;AAAQ,CAAC,EAAG;EAC/D,oBACC7C,IAAA,CAACQ,iBAAiB;IAAAmC,QAAA,EACfhB,OAAO,CAACoC,GAAG,CAAIlC,MAAM,IAAM;MAC5B,IAAKA,MAAM,CAACoB,WAAW,EAAG;QACzB,oBACCjD,IAAA,CAACkD,eAAe;UAEfrB,MAAM,EAAGA,MAAQ;UACjBV,IAAI,EAAGA,IAAM;UACbgC,aAAa,EAAGL,uBAAyB;UACzCD,OAAO,EAAGA;QAAS,GAJbhB,MAAM,CAACgC,EAKb,CAAC;MAEJ;MACA,oBACC7D,IAAA,CAAC8C,uBAAuB;QAEvBjB,MAAM,EAAGA,MAAQ;QACjBW,OAAO,EAAGA,CAAA,KAAMX,MAAM,CAACmC,QAAQ,CAAE,CAAE7C,IAAI,CAAG,CAAG;QAC7C4B,KAAK,EAAG,CAAE5B,IAAI;MAAI,GAHZU,MAAM,CAACgC,EAIb,CAAC;IAEJ,CAAE;EAAC,CACe,CAAC;AAEtB","ignoreList":[]}
@@ -5,6 +5,7 @@ import { __ } from '@wordpress/i18n';
5
5
  import { ExternalLink, TextareaControl } from '@wordpress/components';
6
6
  import { useDispatch, useSelect } from '@wordpress/data';
7
7
  import { useState } from '@wordpress/element';
8
+ import { decodeEntities } from '@wordpress/html-entities';
8
9
 
9
10
  /**
10
11
  * Internal dependencies
@@ -49,7 +50,7 @@ export default function PostExcerpt({
49
50
  const {
50
51
  editPost
51
52
  } = useDispatch(editorStore);
52
- const [localExcerpt, setLocalExcerpt] = useState(excerpt);
53
+ const [localExcerpt, setLocalExcerpt] = useState(decodeEntities(excerpt));
53
54
  const updatePost = value => {
54
55
  editPost({
55
56
  [usedAttribute]: value