@wordpress/editor 14.0.0 → 14.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/components/block-settings-menu/content-only-settings-menu.js +14 -5
- package/build/components/block-settings-menu/content-only-settings-menu.js.map +1 -1
- package/build/components/document-tools/index.js +12 -3
- package/build/components/document-tools/index.js.map +1 -1
- package/build/components/editor/index.js +83 -0
- package/build/components/editor/index.js.map +1 -0
- package/build/components/editor-interface/index.js +6 -8
- package/build/components/editor-interface/index.js.map +1 -1
- package/build/components/entities-saved-states/entity-record-item.js +4 -12
- package/build/components/entities-saved-states/entity-record-item.js.map +1 -1
- package/build/components/global-styles-provider/index.js +9 -2
- package/build/components/global-styles-provider/index.js.map +1 -1
- package/build/components/header/back-button.js +4 -1
- package/build/components/header/back-button.js.map +1 -1
- package/build/components/header/index.js +1 -5
- package/build/components/header/index.js.map +1 -1
- package/build/components/media-categories/index.js +1 -1
- package/build/components/media-categories/index.js.map +1 -1
- package/build/components/post-actions/actions.js +4 -3
- package/build/components/post-actions/actions.js.map +1 -1
- package/build/components/post-last-revision/index.js +35 -9
- package/build/components/post-last-revision/index.js.map +1 -1
- package/build/components/post-preview-button/index.js +1 -0
- package/build/components/post-preview-button/index.js.map +1 -1
- package/build/components/post-publish-panel/index.js +1 -0
- package/build/components/post-publish-panel/index.js.map +1 -1
- package/build/components/post-sync-status/index.js +1 -1
- package/build/components/post-sync-status/index.js.map +1 -1
- package/build/components/post-trash/index.js +1 -0
- package/build/components/post-trash/index.js.map +1 -1
- package/build/components/post-url/panel.js +25 -3
- package/build/components/post-url/panel.js.map +1 -1
- package/build/components/post-visibility/index.js +1 -0
- package/build/components/post-visibility/index.js.map +1 -1
- package/build/components/provider/disable-non-page-content-blocks.js +5 -3
- package/build/components/provider/disable-non-page-content-blocks.js.map +1 -1
- package/build/components/sidebar/post-summary.js +2 -1
- package/build/components/sidebar/post-summary.js.map +1 -1
- package/build/components/template-validation-notice/index.js +1 -0
- package/build/components/template-validation-notice/index.js.map +1 -1
- package/build/components/visual-editor/edit-template-blocks-notification.js +1 -0
- package/build/components/visual-editor/edit-template-blocks-notification.js.map +1 -1
- package/build/hooks/pattern-overrides.js +2 -1
- package/build/hooks/pattern-overrides.js.map +1 -1
- package/build/lock-unlock.js +1 -1
- package/build/lock-unlock.js.map +1 -1
- package/build/private-apis.js +3 -1
- package/build/private-apis.js.map +1 -1
- package/build-module/components/block-settings-menu/content-only-settings-menu.js +14 -5
- package/build-module/components/block-settings-menu/content-only-settings-menu.js.map +1 -1
- package/build-module/components/document-tools/index.js +12 -3
- package/build-module/components/document-tools/index.js.map +1 -1
- package/build-module/components/editor/index.js +76 -0
- package/build-module/components/editor/index.js.map +1 -0
- package/build-module/components/editor-interface/index.js +6 -8
- package/build-module/components/editor-interface/index.js.map +1 -1
- package/build-module/components/entities-saved-states/entity-record-item.js +6 -14
- package/build-module/components/entities-saved-states/entity-record-item.js.map +1 -1
- package/build-module/components/global-styles-provider/index.js +9 -2
- package/build-module/components/global-styles-provider/index.js.map +1 -1
- package/build-module/components/header/back-button.js +4 -1
- package/build-module/components/header/back-button.js.map +1 -1
- package/build-module/components/header/index.js +1 -5
- package/build-module/components/header/index.js.map +1 -1
- package/build-module/components/media-categories/index.js +1 -1
- package/build-module/components/media-categories/index.js.map +1 -1
- package/build-module/components/post-actions/actions.js +4 -3
- package/build-module/components/post-actions/actions.js.map +1 -1
- package/build-module/components/post-last-revision/index.js +34 -11
- package/build-module/components/post-last-revision/index.js.map +1 -1
- package/build-module/components/post-preview-button/index.js +1 -0
- package/build-module/components/post-preview-button/index.js.map +1 -1
- package/build-module/components/post-publish-panel/index.js +1 -0
- package/build-module/components/post-publish-panel/index.js.map +1 -1
- package/build-module/components/post-sync-status/index.js +1 -1
- package/build-module/components/post-sync-status/index.js.map +1 -1
- package/build-module/components/post-trash/index.js +1 -0
- package/build-module/components/post-trash/index.js.map +1 -1
- package/build-module/components/post-url/panel.js +26 -3
- package/build-module/components/post-url/panel.js.map +1 -1
- package/build-module/components/post-visibility/index.js +1 -0
- package/build-module/components/post-visibility/index.js.map +1 -1
- package/build-module/components/provider/disable-non-page-content-blocks.js +5 -3
- package/build-module/components/provider/disable-non-page-content-blocks.js.map +1 -1
- package/build-module/components/sidebar/post-summary.js +2 -1
- package/build-module/components/sidebar/post-summary.js.map +1 -1
- package/build-module/components/template-validation-notice/index.js +1 -0
- package/build-module/components/template-validation-notice/index.js.map +1 -1
- package/build-module/components/visual-editor/edit-template-blocks-notification.js +1 -0
- package/build-module/components/visual-editor/edit-template-blocks-notification.js.map +1 -1
- package/build-module/hooks/pattern-overrides.js +2 -1
- package/build-module/hooks/pattern-overrides.js.map +1 -1
- package/build-module/lock-unlock.js +1 -1
- package/build-module/lock-unlock.js.map +1 -1
- package/build-module/private-apis.js +3 -1
- package/build-module/private-apis.js.map +1 -1
- package/build-style/style-rtl.css +29 -56
- package/build-style/style.css +29 -56
- package/package.json +35 -35
- package/src/components/block-settings-menu/content-only-settings-menu.js +26 -12
- package/src/components/collapsible-block-toolbar/style.scss +3 -1
- package/src/components/document-tools/index.js +13 -4
- package/src/components/editor/index.js +93 -0
- package/src/components/editor-interface/index.js +5 -5
- package/src/components/editor-interface/style.scss +3 -0
- package/src/components/entities-saved-states/entity-record-item.js +4 -14
- package/src/components/entities-saved-states/style.scss +0 -20
- package/src/components/global-styles-provider/index.js +12 -2
- package/src/components/header/back-button.js +6 -1
- package/src/components/header/index.js +1 -8
- package/src/components/header/style.scss +1 -1
- package/src/components/media-categories/index.js +1 -3
- package/src/components/post-actions/actions.js +4 -2
- package/src/components/post-last-revision/index.js +30 -7
- package/src/components/post-last-revision/style.scss +4 -0
- package/src/components/post-panel-row/style.scss +1 -0
- package/src/components/post-preview-button/index.js +1 -0
- package/src/components/post-preview-button/test/index.js +10 -2
- package/src/components/post-publish-panel/index.js +1 -0
- package/src/components/post-publish-panel/style.scss +28 -36
- package/src/components/post-sync-status/index.js +2 -8
- package/src/components/post-trash/index.js +1 -0
- package/src/components/post-url/panel.js +13 -5
- package/src/components/post-visibility/index.js +1 -0
- package/src/components/provider/disable-non-page-content-blocks.js +9 -4
- package/src/components/save-publish-panels/style.scss +0 -8
- package/src/components/sidebar/post-summary.js +2 -0
- package/src/components/template-validation-notice/index.js +1 -0
- package/src/components/visual-editor/edit-template-blocks-notification.js +1 -0
- package/src/hooks/pattern-overrides.js +2 -0
- package/src/lock-unlock.js +1 -1
- package/src/private-apis.js +3 -1
- package/src/style.scss +1 -0
|
@@ -21,7 +21,6 @@ var _moreMenu = _interopRequireDefault(require("../more-menu"));
|
|
|
21
21
|
var _postPreviewButton = _interopRequireDefault(require("../post-preview-button"));
|
|
22
22
|
var _postPublishButtonOrToggle = _interopRequireDefault(require("../post-publish-button/post-publish-button-or-toggle"));
|
|
23
23
|
var _postSavedState = _interopRequireDefault(require("../post-saved-state"));
|
|
24
|
-
var _postTypeSupportCheck = _interopRequireDefault(require("../post-type-support-check"));
|
|
25
24
|
var _postViewLink = _interopRequireDefault(require("../post-view-link"));
|
|
26
25
|
var _previewDropdown = _interopRequireDefault(require("../preview-dropdown"));
|
|
27
26
|
var _store = require("../../store");
|
|
@@ -137,10 +136,7 @@ function Header({
|
|
|
137
136
|
className: (0, _clsx.default)('editor-header__center', {
|
|
138
137
|
'is-collapsed': !isBlockToolsCollapsed && hasTopToolbar
|
|
139
138
|
}),
|
|
140
|
-
children: !title ? /*#__PURE__*/(0, _jsxRuntime.jsx)(
|
|
141
|
-
supportKeys: "title",
|
|
142
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_documentBar.default, {})
|
|
143
|
-
}) : title
|
|
139
|
+
children: !title ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_documentBar.default, {}) : title
|
|
144
140
|
})]
|
|
145
141
|
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_components.__unstableMotion.div, {
|
|
146
142
|
variants: toolbarVariations,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_clsx","_interopRequireDefault","require","_data","_compose","_components","_preferences","_element","_interface","_blockEditor","_backButton","_collapsibleBlockToolbar","_documentBar","_documentTools","_moreMenu","_postPreviewButton","_postPublishButtonOrToggle","_postSavedState","_postTypeSupportCheck","_postViewLink","_previewDropdown","_store","_jsxRuntime","toolbarVariations","distractionFreeDisabled","y","distractionFreeHover","distractionFreeHidden","visible","hidden","backButtonVariations","x","Header","customSaveButton","forceIsDirty","forceDisableBlockTools","setEntitiesSavedStatesCallback","title","isWideViewport","useViewportMatch","isLargeViewport","isTextEditor","isPublishSidebarOpened","showIconLabels","hasFixedToolbar","isNestedEntity","isZoomedOutView","useSelect","select","get","getPreference","preferencesStore","getEditorMode","getEditorSettings","_isPublishSidebarOpened","editorStore","__unstableGetEditorMode","blockEditorStore","onNavigateToPreviousEntityRecord","hasTopToolbar","isBlockToolsCollapsed","setIsBlockToolsCollapsed","useState","jsxs","className","children","jsx","__unstableMotion","div","variants","transition","type","default","Slot","disableBlockTools","isCollapsed","onToggle","clsx","supportKeys","forceIsAutosaveable","disabled","PinnedItems","scope","_default","exports"],"sources":["@wordpress/editor/src/components/header/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { useViewportMatch } from '@wordpress/compose';\nimport { __unstableMotion as motion } from '@wordpress/components';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport { useState } from '@wordpress/element';\nimport { PinnedItems } from '@wordpress/interface';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport BackButton from './back-button';\nimport CollapsableBlockToolbar from '../collapsible-block-toolbar';\nimport DocumentBar from '../document-bar';\nimport DocumentTools from '../document-tools';\nimport MoreMenu from '../more-menu';\nimport PostPreviewButton from '../post-preview-button';\nimport PostPublishButtonOrToggle from '../post-publish-button/post-publish-button-or-toggle';\nimport PostSavedState from '../post-saved-state';\nimport PostTypeSupportCheck from '../post-type-support-check';\nimport PostViewLink from '../post-view-link';\nimport PreviewDropdown from '../preview-dropdown';\nimport { store as editorStore } from '../../store';\n\nconst toolbarVariations = {\n\tdistractionFreeDisabled: { y: '-50px' },\n\tdistractionFreeHover: { y: 0 },\n\tdistractionFreeHidden: { y: '-50px' },\n\tvisible: { y: 0 },\n\thidden: { y: 0 },\n};\n\nconst backButtonVariations = {\n\tdistractionFreeDisabled: { x: '-100%' },\n\tdistractionFreeHover: { x: 0 },\n\tdistractionFreeHidden: { x: '-100%' },\n\tvisible: { x: 0 },\n\thidden: { x: 0 },\n};\n\nfunction Header( {\n\tcustomSaveButton,\n\tforceIsDirty,\n\tforceDisableBlockTools,\n\tsetEntitiesSavedStatesCallback,\n\ttitle,\n} ) {\n\tconst isWideViewport = useViewportMatch( 'large' );\n\tconst isLargeViewport = useViewportMatch( 'medium' );\n\tconst {\n\t\tisTextEditor,\n\t\tisPublishSidebarOpened,\n\t\tshowIconLabels,\n\t\thasFixedToolbar,\n\t\tisNestedEntity,\n\t\tisZoomedOutView,\n\t} = useSelect( ( select ) => {\n\t\tconst { get: getPreference } = select( preferencesStore );\n\t\tconst {\n\t\t\tgetEditorMode,\n\t\t\tgetEditorSettings,\n\t\t\tisPublishSidebarOpened: _isPublishSidebarOpened,\n\t\t} = select( editorStore );\n\t\tconst { __unstableGetEditorMode } = select( blockEditorStore );\n\n\t\treturn {\n\t\t\tisTextEditor: getEditorMode() === 'text',\n\t\t\tisPublishSidebarOpened: _isPublishSidebarOpened(),\n\t\t\tshowIconLabels: getPreference( 'core', 'showIconLabels' ),\n\t\t\thasFixedToolbar: getPreference( 'core', 'fixedToolbar' ),\n\t\t\tisNestedEntity:\n\t\t\t\t!! getEditorSettings().onNavigateToPreviousEntityRecord,\n\t\t\tisZoomedOutView: __unstableGetEditorMode() === 'zoom-out',\n\t\t};\n\t}, [] );\n\n\tconst hasTopToolbar = isLargeViewport && hasFixedToolbar;\n\n\tconst [ isBlockToolsCollapsed, setIsBlockToolsCollapsed ] =\n\t\tuseState( true );\n\n\t// The edit-post-header classname is only kept for backward compatibilty\n\t// as some plugins might be relying on its presence.\n\treturn (\n\t\t<div className=\"editor-header edit-post-header\">\n\t\t\t<motion.div\n\t\t\t\tvariants={ backButtonVariations }\n\t\t\t\ttransition={ { type: 'tween' } }\n\t\t\t>\n\t\t\t\t<BackButton.Slot />\n\t\t\t</motion.div>\n\t\t\t<motion.div\n\t\t\t\tvariants={ toolbarVariations }\n\t\t\t\tclassName=\"editor-header__toolbar\"\n\t\t\t\ttransition={ { type: 'tween' } }\n\t\t\t>\n\t\t\t\t<DocumentTools\n\t\t\t\t\tdisableBlockTools={ forceDisableBlockTools || isTextEditor }\n\t\t\t\t/>\n\t\t\t\t{ hasTopToolbar && (\n\t\t\t\t\t<CollapsableBlockToolbar\n\t\t\t\t\t\tisCollapsed={ isBlockToolsCollapsed }\n\t\t\t\t\t\tonToggle={ setIsBlockToolsCollapsed }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t\t<div\n\t\t\t\t\tclassName={ clsx( 'editor-header__center', {\n\t\t\t\t\t\t'is-collapsed':\n\t\t\t\t\t\t\t! isBlockToolsCollapsed && hasTopToolbar,\n\t\t\t\t\t} ) }\n\t\t\t\t>\n\t\t\t\t\t{ ! title ? (\n\t\t\t\t\t\t<PostTypeSupportCheck supportKeys=\"title\">\n\t\t\t\t\t\t\t<DocumentBar />\n\t\t\t\t\t\t</PostTypeSupportCheck>\n\t\t\t\t\t) : (\n\t\t\t\t\t\ttitle\n\t\t\t\t\t) }\n\t\t\t\t</div>\n\t\t\t</motion.div>\n\t\t\t<motion.div\n\t\t\t\tvariants={ toolbarVariations }\n\t\t\t\ttransition={ { type: 'tween' } }\n\t\t\t\tclassName=\"editor-header__settings\"\n\t\t\t>\n\t\t\t\t{ ! customSaveButton && ! isPublishSidebarOpened && (\n\t\t\t\t\t// This button isn't completely hidden by the publish sidebar.\n\t\t\t\t\t// We can't hide the whole toolbar when the publish sidebar is open because\n\t\t\t\t\t// we want to prevent mounting/unmounting the PostPublishButtonOrToggle DOM node.\n\t\t\t\t\t// We track that DOM node to return focus to the PostPublishButtonOrToggle\n\t\t\t\t\t// when the publish sidebar has been closed.\n\t\t\t\t\t<PostSavedState forceIsDirty={ forceIsDirty } />\n\t\t\t\t) }\n\t\t\t\t<PreviewDropdown\n\t\t\t\t\tforceIsAutosaveable={ forceIsDirty }\n\t\t\t\t\tdisabled={ isNestedEntity || isZoomedOutView }\n\t\t\t\t/>\n\t\t\t\t<PostPreviewButton\n\t\t\t\t\tclassName=\"editor-header__post-preview-button\"\n\t\t\t\t\tforceIsAutosaveable={ forceIsDirty }\n\t\t\t\t/>\n\t\t\t\t<PostViewLink />\n\t\t\t\t{ ! customSaveButton && (\n\t\t\t\t\t<PostPublishButtonOrToggle\n\t\t\t\t\t\tforceIsDirty={ forceIsDirty }\n\t\t\t\t\t\tsetEntitiesSavedStatesCallback={\n\t\t\t\t\t\t\tsetEntitiesSavedStatesCallback\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t\t{ customSaveButton }\n\t\t\t\t{ ( isWideViewport || ! showIconLabels ) && (\n\t\t\t\t\t<PinnedItems.Slot scope=\"core\" />\n\t\t\t\t) }\n\t\t\t\t<MoreMenu />\n\t\t\t</motion.div>\n\t\t</div>\n\t);\n}\n\nexport default Header;\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,WAAA,GAAAH,OAAA;AACA,IAAAI,YAAA,GAAAJ,OAAA;AACA,IAAAK,QAAA,GAAAL,OAAA;AACA,IAAAM,UAAA,GAAAN,OAAA;AACA,IAAAO,YAAA,GAAAP,OAAA;AAKA,IAAAQ,WAAA,GAAAT,sBAAA,CAAAC,OAAA;AACA,IAAAS,wBAAA,GAAAV,sBAA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SAAS,EAAC,yBAAyB;MAAAC,QAAA,GAEjC,CAAEhC,gBAAgB,IAAI,CAAES,sBAAsB;MAAA;MAC/C;MACA;MACA;MACA;MACA;MACA,IAAApB,WAAA,CAAA4C,GAAA,EAACjD,eAAA,CAAAuD,OAAc;QAACtC,YAAY,EAAGA;MAAc,CAAE,CAC/C,eACD,IAAAZ,WAAA,CAAA4C,GAAA,EAAC9C,gBAAA,CAAAoD,OAAe;QACfO,mBAAmB,EAAG7C,YAAc;QACpC8C,QAAQ,EAAGnC,cAAc,IAAIC;MAAiB,CAC9C,CAAC,eACF,IAAAxB,WAAA,CAAA4C,GAAA,EAACnD,kBAAA,CAAAyD,OAAiB;QACjBR,SAAS,EAAC,oCAAoC;QAC9Ce,mBAAmB,EAAG7C;MAAc,CACpC,CAAC,eACF,IAAAZ,WAAA,CAAA4C,GAAA,EAAC/C,aAAA,CAAAqD,OAAY,IAAE,CAAC,EACd,CAAEvC,gBAAgB,iBACnB,IAAAX,WAAA,CAAA4C,GAAA,EAAClD,0BAAA,CAAAwD,OAAyB;QACzBtC,YAAY,EAAGA,YAAc;QAC7BE,8BAA8B,EAC7BA;MACA,CACD,CACD,EACCH,gBAAgB,EAChB,CAAEK,cAAc,IAAI,CAAEK,cAAc,kBACrC,IAAArB,WAAA,CAAA4C,GAAA,EAAC1D,UAAA,CAAAyE,WAAW,CAACR,IAAI;QAACS,KAAK,EAAC;MAAM,CAAE,CAChC,eACD,IAAA5D,WAAA,CAAA4C,GAAA,EAACpD,SAAA,CAAA0D,OAAQ,IAAE,CAAC;IAAA,CACD,CAAC;EAAA,CACT,CAAC;AAER;AAAC,IAAAW,QAAA,GAAAC,OAAA,CAAAZ,OAAA,GAEcxC,MAAM","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_clsx","_interopRequireDefault","require","_data","_compose","_components","_preferences","_element","_interface","_blockEditor","_backButton","_collapsibleBlockToolbar","_documentBar","_documentTools","_moreMenu","_postPreviewButton","_postPublishButtonOrToggle","_postSavedState","_postViewLink","_previewDropdown","_store","_jsxRuntime","toolbarVariations","distractionFreeDisabled","y","distractionFreeHover","distractionFreeHidden","visible","hidden","backButtonVariations","x","Header","customSaveButton","forceIsDirty","forceDisableBlockTools","setEntitiesSavedStatesCallback","title","isWideViewport","useViewportMatch","isLargeViewport","isTextEditor","isPublishSidebarOpened","showIconLabels","hasFixedToolbar","isNestedEntity","isZoomedOutView","useSelect","select","get","getPreference","preferencesStore","getEditorMode","getEditorSettings","_isPublishSidebarOpened","editorStore","__unstableGetEditorMode","blockEditorStore","onNavigateToPreviousEntityRecord","hasTopToolbar","isBlockToolsCollapsed","setIsBlockToolsCollapsed","useState","jsxs","className","children","jsx","__unstableMotion","div","variants","transition","type","default","Slot","disableBlockTools","isCollapsed","onToggle","clsx","forceIsAutosaveable","disabled","PinnedItems","scope","_default","exports"],"sources":["@wordpress/editor/src/components/header/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { useViewportMatch } from '@wordpress/compose';\nimport { __unstableMotion as motion } from '@wordpress/components';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport { useState } from '@wordpress/element';\nimport { PinnedItems } from '@wordpress/interface';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport BackButton from './back-button';\nimport CollapsableBlockToolbar from '../collapsible-block-toolbar';\nimport DocumentBar from '../document-bar';\nimport DocumentTools from '../document-tools';\nimport MoreMenu from '../more-menu';\nimport PostPreviewButton from '../post-preview-button';\nimport PostPublishButtonOrToggle from '../post-publish-button/post-publish-button-or-toggle';\nimport PostSavedState from '../post-saved-state';\nimport PostViewLink from '../post-view-link';\nimport PreviewDropdown from '../preview-dropdown';\nimport { store as editorStore } from '../../store';\n\nconst toolbarVariations = {\n\tdistractionFreeDisabled: { y: '-50px' },\n\tdistractionFreeHover: { y: 0 },\n\tdistractionFreeHidden: { y: '-50px' },\n\tvisible: { y: 0 },\n\thidden: { y: 0 },\n};\n\nconst backButtonVariations = {\n\tdistractionFreeDisabled: { x: '-100%' },\n\tdistractionFreeHover: { x: 0 },\n\tdistractionFreeHidden: { x: '-100%' },\n\tvisible: { x: 0 },\n\thidden: { x: 0 },\n};\n\nfunction Header( {\n\tcustomSaveButton,\n\tforceIsDirty,\n\tforceDisableBlockTools,\n\tsetEntitiesSavedStatesCallback,\n\ttitle,\n} ) {\n\tconst isWideViewport = useViewportMatch( 'large' );\n\tconst isLargeViewport = useViewportMatch( 'medium' );\n\tconst {\n\t\tisTextEditor,\n\t\tisPublishSidebarOpened,\n\t\tshowIconLabels,\n\t\thasFixedToolbar,\n\t\tisNestedEntity,\n\t\tisZoomedOutView,\n\t} = useSelect( ( select ) => {\n\t\tconst { get: getPreference } = select( preferencesStore );\n\t\tconst {\n\t\t\tgetEditorMode,\n\t\t\tgetEditorSettings,\n\t\t\tisPublishSidebarOpened: _isPublishSidebarOpened,\n\t\t} = select( editorStore );\n\t\tconst { __unstableGetEditorMode } = select( blockEditorStore );\n\n\t\treturn {\n\t\t\tisTextEditor: getEditorMode() === 'text',\n\t\t\tisPublishSidebarOpened: _isPublishSidebarOpened(),\n\t\t\tshowIconLabels: getPreference( 'core', 'showIconLabels' ),\n\t\t\thasFixedToolbar: getPreference( 'core', 'fixedToolbar' ),\n\t\t\tisNestedEntity:\n\t\t\t\t!! getEditorSettings().onNavigateToPreviousEntityRecord,\n\t\t\tisZoomedOutView: __unstableGetEditorMode() === 'zoom-out',\n\t\t};\n\t}, [] );\n\n\tconst hasTopToolbar = isLargeViewport && hasFixedToolbar;\n\n\tconst [ isBlockToolsCollapsed, setIsBlockToolsCollapsed ] =\n\t\tuseState( true );\n\n\t// The edit-post-header classname is only kept for backward compatibilty\n\t// as some plugins might be relying on its presence.\n\treturn (\n\t\t<div className=\"editor-header edit-post-header\">\n\t\t\t<motion.div\n\t\t\t\tvariants={ backButtonVariations }\n\t\t\t\ttransition={ { type: 'tween' } }\n\t\t\t>\n\t\t\t\t<BackButton.Slot />\n\t\t\t</motion.div>\n\t\t\t<motion.div\n\t\t\t\tvariants={ toolbarVariations }\n\t\t\t\tclassName=\"editor-header__toolbar\"\n\t\t\t\ttransition={ { type: 'tween' } }\n\t\t\t>\n\t\t\t\t<DocumentTools\n\t\t\t\t\tdisableBlockTools={ forceDisableBlockTools || isTextEditor }\n\t\t\t\t/>\n\t\t\t\t{ hasTopToolbar && (\n\t\t\t\t\t<CollapsableBlockToolbar\n\t\t\t\t\t\tisCollapsed={ isBlockToolsCollapsed }\n\t\t\t\t\t\tonToggle={ setIsBlockToolsCollapsed }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t\t<div\n\t\t\t\t\tclassName={ clsx( 'editor-header__center', {\n\t\t\t\t\t\t'is-collapsed':\n\t\t\t\t\t\t\t! isBlockToolsCollapsed && hasTopToolbar,\n\t\t\t\t\t} ) }\n\t\t\t\t>\n\t\t\t\t\t{ ! title ? <DocumentBar /> : title }\n\t\t\t\t</div>\n\t\t\t</motion.div>\n\t\t\t<motion.div\n\t\t\t\tvariants={ toolbarVariations }\n\t\t\t\ttransition={ { type: 'tween' } }\n\t\t\t\tclassName=\"editor-header__settings\"\n\t\t\t>\n\t\t\t\t{ ! customSaveButton && ! isPublishSidebarOpened && (\n\t\t\t\t\t// This button isn't completely hidden by the publish sidebar.\n\t\t\t\t\t// We can't hide the whole toolbar when the publish sidebar is open because\n\t\t\t\t\t// we want to prevent mounting/unmounting the PostPublishButtonOrToggle DOM node.\n\t\t\t\t\t// We track that DOM node to return focus to the PostPublishButtonOrToggle\n\t\t\t\t\t// when the publish sidebar has been closed.\n\t\t\t\t\t<PostSavedState forceIsDirty={ forceIsDirty } />\n\t\t\t\t) }\n\t\t\t\t<PreviewDropdown\n\t\t\t\t\tforceIsAutosaveable={ forceIsDirty }\n\t\t\t\t\tdisabled={ isNestedEntity || isZoomedOutView }\n\t\t\t\t/>\n\t\t\t\t<PostPreviewButton\n\t\t\t\t\tclassName=\"editor-header__post-preview-button\"\n\t\t\t\t\tforceIsAutosaveable={ forceIsDirty }\n\t\t\t\t/>\n\t\t\t\t<PostViewLink />\n\t\t\t\t{ ! customSaveButton && (\n\t\t\t\t\t<PostPublishButtonOrToggle\n\t\t\t\t\t\tforceIsDirty={ forceIsDirty }\n\t\t\t\t\t\tsetEntitiesSavedStatesCallback={\n\t\t\t\t\t\t\tsetEntitiesSavedStatesCallback\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t\t{ customSaveButton }\n\t\t\t\t{ ( isWideViewport || ! showIconLabels ) && (\n\t\t\t\t\t<PinnedItems.Slot scope=\"core\" />\n\t\t\t\t) }\n\t\t\t\t<MoreMenu />\n\t\t\t</motion.div>\n\t\t</div>\n\t);\n}\n\nexport default Header;\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,WAAA,GAAAH,OAAA;AACA,IAAAI,YAAA,GAAAJ,OAAA;AACA,IAAAK,QAAA,GAAAL,OAAA;AACA,IAAAM,UAAA,GAAAN,OAAA;AACA,IAAAO,YAAA,GAAAP,OAAA;AAKA,IAAAQ,WAAA,GAAAT,sBAAA,CAAAC,OAAA;AACA,IAAAS,wBAAA,GAAAV,sBAAA,CAAAC,OAAA;AACA,IAAAU,YAAA,GAAAX,sBAAA,CAAAC,OAAA;AACA,IAAAW,cAAA,GAAAZ,sBAAA,CAAAC,OAAA;AACA,IAAAY,SAAA,GAAAb,sBAAA,CAAAC,OAAA;AACA,IAAAa,kBAAA,GAAAd,sBAAA,CAAAC,OAAA;AACA,IAAAc,0BAAA,GAAAf,sBAAA,CAAAC,OAAA;AACA,IAAAe,eAAA,GAAAhB,sBAAA,CAAAC,OAAA;AACA,IAAAgB,aAAA,GAAAjB,sBAAA,CAAAC,OAAA;A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AAZ,WAAA,CAAA4C,GAAA,EAAC/C,aAAA,CAAAqD,OAAY,IAAE,CAAC,EACd,CAAEvC,gBAAgB,iBACnB,IAAAX,WAAA,CAAA4C,GAAA,EAACjD,0BAAA,CAAAuD,OAAyB;QACzBtC,YAAY,EAAGA,YAAc;QAC7BE,8BAA8B,EAC7BA;MACA,CACD,CACD,EACCH,gBAAgB,EAChB,CAAEK,cAAc,IAAI,CAAEK,cAAc,kBACrC,IAAArB,WAAA,CAAA4C,GAAA,EAACzD,UAAA,CAAAuE,WAAW,CAACP,IAAI;QAACQ,KAAK,EAAC;MAAM,CAAE,CAChC,eACD,IAAA3D,WAAA,CAAA4C,GAAA,EAACnD,SAAA,CAAAyD,OAAQ,IAAE,CAAC;IAAA,CACD,CAAC;EAAA,CACT,CAAC;AAER;AAAC,IAAAU,QAAA,GAAAC,OAAA,CAAAX,OAAA,GAEcxC,MAAM","ignoreList":[]}
|
|
@@ -151,7 +151,7 @@ const inserterMediaCategories = [{
|
|
|
151
151
|
per_page: 'page_size',
|
|
152
152
|
search: 'q'
|
|
153
153
|
};
|
|
154
|
-
const url = new URL('https://api.openverse.
|
|
154
|
+
const url = new URL('https://api.openverse.org/v1/images/');
|
|
155
155
|
Object.entries(finalQuery).forEach(([key, value]) => {
|
|
156
156
|
const queryKey = mapFromInserterMediaRequest[key] || key;
|
|
157
157
|
url.searchParams.set(queryKey, value);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_i18n","require","_data","_htmlEntities","_coreData","getExternalLink","url","text","getExternalLinkAttributes","getOpenverseLicense","license","licenseVersion","licenseName","trim","toUpperCase","replace","includes","getOpenverseCaption","item","title","foreign_landing_url","foreignLandingUrl","creator","creator_url","creatorUrl","license_version","license_url","licenseUrl","fullLicense","_creator","decodeEntities","_caption","sprintf","_x","coreMediaFetch","query","mediaItems","resolveSelect","coreStore","getMediaItems","orderBy","search","map","mediaItem","alt","alt_text","source_url","previewUrl","media_details","sizes","medium","caption","raw","inserterMediaCategories","name","labels","__","search_items","mediaType","fetch","media_type","defaultArgs","mature","excluded_source","finalQuery","mapFromInserterMediaRequest","per_page","URL","Object","entries","forEach","key","value","queryKey","searchParams","set","response","window","headers","jsonResponse","json","results","result","toLowerCase","startsWith","slice","sourceId","id","undefined","thumbnail","getReportUrl","isExternalResource","_default","exports","default"],"sources":["@wordpress/editor/src/components/media-categories/index.js"],"sourcesContent":["/**\n * The `editor` settings here need to be in sync with the corresponding ones in `editor` package.\n * See `packages/editor/src/components/media-categories/index.js`.\n *\n * In the future we could consider creating an Openvese package that can be used in both `editor` and `site-editor`.\n * The rest of the settings would still need to be in sync though.\n */\n\n/**\n * WordPress dependencies\n */\nimport { __, sprintf, _x } from '@wordpress/i18n';\nimport { resolveSelect } from '@wordpress/data';\nimport { decodeEntities } from '@wordpress/html-entities';\n\n/**\n * Internal dependencies\n */\nimport { store as coreStore } from '@wordpress/core-data';\n\n/** @typedef {import('@wordpress/block-editor').InserterMediaRequest} InserterMediaRequest */\n/** @typedef {import('@wordpress/block-editor').InserterMediaItem} InserterMediaItem */\n/** @typedef {import('@wordpress/block-editor').InserterMediaCategory} InserterMediaCategory */\n\nconst getExternalLink = ( url, text ) =>\n\t`<a ${ getExternalLinkAttributes( url ) }>${ text }</a>`;\n\nconst getExternalLinkAttributes = ( url ) =>\n\t`href=\"${ url }\" target=\"_blank\" rel=\"noreferrer noopener\"`;\n\nconst getOpenverseLicense = ( license, licenseVersion ) => {\n\tlet licenseName = license.trim();\n\t// PDM has no abbreviation\n\tif ( license !== 'pdm' ) {\n\t\tlicenseName = license.toUpperCase().replace( 'SAMPLING', 'Sampling' );\n\t}\n\t// If version is known, append version to the name.\n\t// The license has to have a version to be valid. Only\n\t// PDM (public domain mark) doesn't have a version.\n\tif ( licenseVersion ) {\n\t\tlicenseName += ` ${ licenseVersion }`;\n\t}\n\t// For licenses other than public-domain marks, prepend 'CC' to the name.\n\tif ( ! [ 'pdm', 'cc0' ].includes( license ) ) {\n\t\tlicenseName = `CC ${ licenseName }`;\n\t}\n\treturn licenseName;\n};\n\nconst getOpenverseCaption = ( item ) => {\n\tconst {\n\t\ttitle,\n\t\tforeign_landing_url: foreignLandingUrl,\n\t\tcreator,\n\t\tcreator_url: creatorUrl,\n\t\tlicense,\n\t\tlicense_version: licenseVersion,\n\t\tlicense_url: licenseUrl,\n\t} = item;\n\tconst fullLicense = getOpenverseLicense( license, licenseVersion );\n\tconst _creator = decodeEntities( creator );\n\tlet _caption;\n\tif ( _creator ) {\n\t\t_caption = title\n\t\t\t? sprintf(\n\t\t\t\t\t// translators: %1s: Title of a media work from Openverse; %2s: Name of the work's creator; %3s: Work's licence e.g: \"CC0 1.0\".\n\t\t\t\t\t_x( '\"%1$s\" by %2$s/ %3$s', 'caption' ),\n\t\t\t\t\tgetExternalLink(\n\t\t\t\t\t\tforeignLandingUrl,\n\t\t\t\t\t\tdecodeEntities( title )\n\t\t\t\t\t),\n\t\t\t\t\tcreatorUrl\n\t\t\t\t\t\t? getExternalLink( creatorUrl, _creator )\n\t\t\t\t\t\t: _creator,\n\t\t\t\t\tlicenseUrl\n\t\t\t\t\t\t? getExternalLink(\n\t\t\t\t\t\t\t\t`${ licenseUrl }?ref=openverse`,\n\t\t\t\t\t\t\t\tfullLicense\n\t\t\t\t\t\t )\n\t\t\t\t\t\t: fullLicense\n\t\t\t )\n\t\t\t: sprintf(\n\t\t\t\t\t// translators: %1s: Link attributes for a given Openverse media work; %2s: Name of the work's creator; %3s: Works's licence e.g: \"CC0 1.0\".\n\t\t\t\t\t_x( '<a %1$s>Work</a> by %2$s/ %3$s', 'caption' ),\n\t\t\t\t\tgetExternalLinkAttributes( foreignLandingUrl ),\n\t\t\t\t\tcreatorUrl\n\t\t\t\t\t\t? getExternalLink( creatorUrl, _creator )\n\t\t\t\t\t\t: _creator,\n\t\t\t\t\tlicenseUrl\n\t\t\t\t\t\t? getExternalLink(\n\t\t\t\t\t\t\t\t`${ licenseUrl }?ref=openverse`,\n\t\t\t\t\t\t\t\tfullLicense\n\t\t\t\t\t\t )\n\t\t\t\t\t\t: fullLicense\n\t\t\t );\n\t} else {\n\t\t_caption = title\n\t\t\t? sprintf(\n\t\t\t\t\t// translators: %1s: Title of a media work from Openverse; %2s: Work's licence e.g: \"CC0 1.0\".\n\t\t\t\t\t_x( '\"%1$s\"/ %2$s', 'caption' ),\n\t\t\t\t\tgetExternalLink(\n\t\t\t\t\t\tforeignLandingUrl,\n\t\t\t\t\t\tdecodeEntities( title )\n\t\t\t\t\t),\n\t\t\t\t\tlicenseUrl\n\t\t\t\t\t\t? getExternalLink(\n\t\t\t\t\t\t\t\t`${ licenseUrl }?ref=openverse`,\n\t\t\t\t\t\t\t\tfullLicense\n\t\t\t\t\t\t )\n\t\t\t\t\t\t: fullLicense\n\t\t\t )\n\t\t\t: sprintf(\n\t\t\t\t\t// translators: %1s: Link attributes for a given Openverse media work; %2s: Works's licence e.g: \"CC0 1.0\".\n\t\t\t\t\t_x( '<a %1$s>Work</a>/ %2$s', 'caption' ),\n\t\t\t\t\tgetExternalLinkAttributes( foreignLandingUrl ),\n\t\t\t\t\tlicenseUrl\n\t\t\t\t\t\t? getExternalLink(\n\t\t\t\t\t\t\t\t`${ licenseUrl }?ref=openverse`,\n\t\t\t\t\t\t\t\tfullLicense\n\t\t\t\t\t\t )\n\t\t\t\t\t\t: fullLicense\n\t\t\t );\n\t}\n\treturn _caption.replace( /\\s{2}/g, ' ' );\n};\n\nconst coreMediaFetch = async ( query = {} ) => {\n\tconst mediaItems = await resolveSelect( coreStore ).getMediaItems( {\n\t\t...query,\n\t\torderBy: !! query?.search ? 'relevance' : 'date',\n\t} );\n\treturn mediaItems.map( ( mediaItem ) => ( {\n\t\t...mediaItem,\n\t\talt: mediaItem.alt_text,\n\t\turl: mediaItem.source_url,\n\t\tpreviewUrl: mediaItem.media_details?.sizes?.medium?.source_url,\n\t\tcaption: mediaItem.caption?.raw,\n\t} ) );\n};\n\n/** @type {InserterMediaCategory[]} */\nconst inserterMediaCategories = [\n\t{\n\t\tname: 'images',\n\t\tlabels: {\n\t\t\tname: __( 'Images' ),\n\t\t\tsearch_items: __( 'Search images' ),\n\t\t},\n\t\tmediaType: 'image',\n\t\tasync fetch( query = {} ) {\n\t\t\treturn coreMediaFetch( { ...query, media_type: 'image' } );\n\t\t},\n\t},\n\t{\n\t\tname: 'videos',\n\t\tlabels: {\n\t\t\tname: __( 'Videos' ),\n\t\t\tsearch_items: __( 'Search videos' ),\n\t\t},\n\t\tmediaType: 'video',\n\t\tasync fetch( query = {} ) {\n\t\t\treturn coreMediaFetch( { ...query, media_type: 'video' } );\n\t\t},\n\t},\n\t{\n\t\tname: 'audio',\n\t\tlabels: {\n\t\t\tname: __( 'Audio' ),\n\t\t\tsearch_items: __( 'Search audio' ),\n\t\t},\n\t\tmediaType: 'audio',\n\t\tasync fetch( query = {} ) {\n\t\t\treturn coreMediaFetch( { ...query, media_type: 'audio' } );\n\t\t},\n\t},\n\t{\n\t\tname: 'openverse',\n\t\tlabels: {\n\t\t\tname: __( 'Openverse' ),\n\t\t\tsearch_items: __( 'Search Openverse' ),\n\t\t},\n\t\tmediaType: 'image',\n\t\tasync fetch( query = {} ) {\n\t\t\tconst defaultArgs = {\n\t\t\t\tmature: false,\n\t\t\t\texcluded_source: 'flickr,inaturalist,wikimedia',\n\t\t\t\tlicense: 'pdm,cc0',\n\t\t\t};\n\t\t\tconst finalQuery = { ...query, ...defaultArgs };\n\t\t\tconst mapFromInserterMediaRequest = {\n\t\t\t\tper_page: 'page_size',\n\t\t\t\tsearch: 'q',\n\t\t\t};\n\t\t\tconst url = new URL(\n\t\t\t\t'https://api.openverse.engineering/v1/images/'\n\t\t\t);\n\t\t\tObject.entries( finalQuery ).forEach( ( [ key, value ] ) => {\n\t\t\t\tconst queryKey = mapFromInserterMediaRequest[ key ] || key;\n\t\t\t\turl.searchParams.set( queryKey, value );\n\t\t\t} );\n\t\t\tconst response = await window.fetch( url, {\n\t\t\t\theaders: {\n\t\t\t\t\t'User-Agent': 'WordPress/inserter-media-fetch',\n\t\t\t\t},\n\t\t\t} );\n\t\t\tconst jsonResponse = await response.json();\n\t\t\tconst results = jsonResponse.results;\n\t\t\treturn results.map( ( result ) => ( {\n\t\t\t\t...result,\n\t\t\t\t// This is a temp solution for better titles, until Openverse API\n\t\t\t\t// completes the cleaning up of some titles of their upstream data.\n\t\t\t\ttitle: result.title?.toLowerCase().startsWith( 'file:' )\n\t\t\t\t\t? result.title.slice( 5 )\n\t\t\t\t\t: result.title,\n\t\t\t\tsourceId: result.id,\n\t\t\t\tid: undefined,\n\t\t\t\tcaption: getOpenverseCaption( result ),\n\t\t\t\tpreviewUrl: result.thumbnail,\n\t\t\t} ) );\n\t\t},\n\t\tgetReportUrl: ( { sourceId } ) =>\n\t\t\t`https://wordpress.org/openverse/image/${ sourceId }/report/`,\n\t\tisExternalResource: true,\n\t},\n];\n\nexport default inserterMediaCategories;\n"],"mappings":";;;;;;AAWA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,aAAA,GAAAF,OAAA;AAKA,IAAAG,SAAA,GAAAH,OAAA;AAlBA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAKA;AACA;AACA;;AAGA;AACA;AACA;;AAEA,MAAMI,eAAe,GAAGA,CAAEC,GAAG,EAAEC,IAAI,KACjC,MAAMC,yBAAyB,CAAEF,GAAI,CAAG,IAAIC,IAAM,MAAK;AAEzD,MAAMC,yBAAyB,GAAKF,GAAG,IACrC,SAASA,GAAK,6CAA4C;AAE5D,MAAMG,mBAAmB,GAAGA,CAAEC,OAAO,EAAEC,cAAc,KAAM;EAC1D,IAAIC,WAAW,GAAGF,OAAO,CAACG,IAAI,CAAC,CAAC;EAChC;EACA,IAAKH,OAAO,KAAK,KAAK,EAAG;IACxBE,WAAW,GAAGF,OAAO,CAACI,WAAW,CAAC,CAAC,CAACC,OAAO,CAAE,UAAU,EAAE,UAAW,CAAC;EACtE;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MAAM,CAACO;IACpB,CAAC,CAAG,CAAC;EACN,CAAC;EACDC,YAAY,EAAEA,CAAE;IAAEJ;EAAS,CAAC,KAC1B,yCAAyCA,QAAU,UAAS;EAC9DK,kBAAkB,EAAE;AACrB,CAAC,CACD;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEazC,uBAAuB","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_i18n","require","_data","_htmlEntities","_coreData","getExternalLink","url","text","getExternalLinkAttributes","getOpenverseLicense","license","licenseVersion","licenseName","trim","toUpperCase","replace","includes","getOpenverseCaption","item","title","foreign_landing_url","foreignLandingUrl","creator","creator_url","creatorUrl","license_version","license_url","licenseUrl","fullLicense","_creator","decodeEntities","_caption","sprintf","_x","coreMediaFetch","query","mediaItems","resolveSelect","coreStore","getMediaItems","orderBy","search","map","mediaItem","alt","alt_text","source_url","previewUrl","media_details","sizes","medium","caption","raw","inserterMediaCategories","name","labels","__","search_items","mediaType","fetch","media_type","defaultArgs","mature","excluded_source","finalQuery","mapFromInserterMediaRequest","per_page","URL","Object","entries","forEach","key","value","queryKey","searchParams","set","response","window","headers","jsonResponse","json","results","result","toLowerCase","startsWith","slice","sourceId","id","undefined","thumbnail","getReportUrl","isExternalResource","_default","exports","default"],"sources":["@wordpress/editor/src/components/media-categories/index.js"],"sourcesContent":["/**\n * The `editor` settings here need to be in sync with the corresponding ones in `editor` package.\n * See `packages/editor/src/components/media-categories/index.js`.\n *\n * In the future we could consider creating an Openvese package that can be used in both `editor` and `site-editor`.\n * The rest of the settings would still need to be in sync though.\n */\n\n/**\n * WordPress dependencies\n */\nimport { __, sprintf, _x } from '@wordpress/i18n';\nimport { resolveSelect } from '@wordpress/data';\nimport { decodeEntities } from '@wordpress/html-entities';\n\n/**\n * Internal dependencies\n */\nimport { store as coreStore } from '@wordpress/core-data';\n\n/** @typedef {import('@wordpress/block-editor').InserterMediaRequest} InserterMediaRequest */\n/** @typedef {import('@wordpress/block-editor').InserterMediaItem} InserterMediaItem */\n/** @typedef {import('@wordpress/block-editor').InserterMediaCategory} InserterMediaCategory */\n\nconst getExternalLink = ( url, text ) =>\n\t`<a ${ getExternalLinkAttributes( url ) }>${ text }</a>`;\n\nconst getExternalLinkAttributes = ( url ) =>\n\t`href=\"${ url }\" target=\"_blank\" rel=\"noreferrer noopener\"`;\n\nconst getOpenverseLicense = ( license, licenseVersion ) => {\n\tlet licenseName = license.trim();\n\t// PDM has no abbreviation\n\tif ( license !== 'pdm' ) {\n\t\tlicenseName = license.toUpperCase().replace( 'SAMPLING', 'Sampling' );\n\t}\n\t// If version is known, append version to the name.\n\t// The license has to have a version to be valid. Only\n\t// PDM (public domain mark) doesn't have a version.\n\tif ( licenseVersion ) {\n\t\tlicenseName += ` ${ licenseVersion }`;\n\t}\n\t// For licenses other than public-domain marks, prepend 'CC' to the name.\n\tif ( ! [ 'pdm', 'cc0' ].includes( license ) ) {\n\t\tlicenseName = `CC ${ licenseName }`;\n\t}\n\treturn licenseName;\n};\n\nconst getOpenverseCaption = ( item ) => {\n\tconst {\n\t\ttitle,\n\t\tforeign_landing_url: foreignLandingUrl,\n\t\tcreator,\n\t\tcreator_url: creatorUrl,\n\t\tlicense,\n\t\tlicense_version: licenseVersion,\n\t\tlicense_url: licenseUrl,\n\t} = item;\n\tconst fullLicense = getOpenverseLicense( license, licenseVersion );\n\tconst _creator = decodeEntities( creator );\n\tlet _caption;\n\tif ( _creator ) {\n\t\t_caption = title\n\t\t\t? sprintf(\n\t\t\t\t\t// translators: %1s: Title of a media work from Openverse; %2s: Name of the work's creator; %3s: Work's licence e.g: \"CC0 1.0\".\n\t\t\t\t\t_x( '\"%1$s\" by %2$s/ %3$s', 'caption' ),\n\t\t\t\t\tgetExternalLink(\n\t\t\t\t\t\tforeignLandingUrl,\n\t\t\t\t\t\tdecodeEntities( title )\n\t\t\t\t\t),\n\t\t\t\t\tcreatorUrl\n\t\t\t\t\t\t? getExternalLink( creatorUrl, _creator )\n\t\t\t\t\t\t: _creator,\n\t\t\t\t\tlicenseUrl\n\t\t\t\t\t\t? getExternalLink(\n\t\t\t\t\t\t\t\t`${ licenseUrl }?ref=openverse`,\n\t\t\t\t\t\t\t\tfullLicense\n\t\t\t\t\t\t )\n\t\t\t\t\t\t: fullLicense\n\t\t\t )\n\t\t\t: sprintf(\n\t\t\t\t\t// translators: %1s: Link attributes for a given Openverse media work; %2s: Name of the work's creator; %3s: Works's licence e.g: \"CC0 1.0\".\n\t\t\t\t\t_x( '<a %1$s>Work</a> by %2$s/ %3$s', 'caption' ),\n\t\t\t\t\tgetExternalLinkAttributes( foreignLandingUrl ),\n\t\t\t\t\tcreatorUrl\n\t\t\t\t\t\t? getExternalLink( creatorUrl, _creator )\n\t\t\t\t\t\t: _creator,\n\t\t\t\t\tlicenseUrl\n\t\t\t\t\t\t? getExternalLink(\n\t\t\t\t\t\t\t\t`${ licenseUrl }?ref=openverse`,\n\t\t\t\t\t\t\t\tfullLicense\n\t\t\t\t\t\t )\n\t\t\t\t\t\t: fullLicense\n\t\t\t );\n\t} else {\n\t\t_caption = title\n\t\t\t? sprintf(\n\t\t\t\t\t// translators: %1s: Title of a media work from Openverse; %2s: Work's licence e.g: \"CC0 1.0\".\n\t\t\t\t\t_x( '\"%1$s\"/ %2$s', 'caption' ),\n\t\t\t\t\tgetExternalLink(\n\t\t\t\t\t\tforeignLandingUrl,\n\t\t\t\t\t\tdecodeEntities( title )\n\t\t\t\t\t),\n\t\t\t\t\tlicenseUrl\n\t\t\t\t\t\t? getExternalLink(\n\t\t\t\t\t\t\t\t`${ licenseUrl }?ref=openverse`,\n\t\t\t\t\t\t\t\tfullLicense\n\t\t\t\t\t\t )\n\t\t\t\t\t\t: fullLicense\n\t\t\t )\n\t\t\t: sprintf(\n\t\t\t\t\t// translators: %1s: Link attributes for a given Openverse media work; %2s: Works's licence e.g: \"CC0 1.0\".\n\t\t\t\t\t_x( '<a %1$s>Work</a>/ %2$s', 'caption' ),\n\t\t\t\t\tgetExternalLinkAttributes( foreignLandingUrl ),\n\t\t\t\t\tlicenseUrl\n\t\t\t\t\t\t? getExternalLink(\n\t\t\t\t\t\t\t\t`${ licenseUrl }?ref=openverse`,\n\t\t\t\t\t\t\t\tfullLicense\n\t\t\t\t\t\t )\n\t\t\t\t\t\t: fullLicense\n\t\t\t );\n\t}\n\treturn _caption.replace( /\\s{2}/g, ' ' );\n};\n\nconst coreMediaFetch = async ( query = {} ) => {\n\tconst mediaItems = await resolveSelect( coreStore ).getMediaItems( {\n\t\t...query,\n\t\torderBy: !! query?.search ? 'relevance' : 'date',\n\t} );\n\treturn mediaItems.map( ( mediaItem ) => ( {\n\t\t...mediaItem,\n\t\talt: mediaItem.alt_text,\n\t\turl: mediaItem.source_url,\n\t\tpreviewUrl: mediaItem.media_details?.sizes?.medium?.source_url,\n\t\tcaption: mediaItem.caption?.raw,\n\t} ) );\n};\n\n/** @type {InserterMediaCategory[]} */\nconst inserterMediaCategories = [\n\t{\n\t\tname: 'images',\n\t\tlabels: {\n\t\t\tname: __( 'Images' ),\n\t\t\tsearch_items: __( 'Search images' ),\n\t\t},\n\t\tmediaType: 'image',\n\t\tasync fetch( query = {} ) {\n\t\t\treturn coreMediaFetch( { ...query, media_type: 'image' } );\n\t\t},\n\t},\n\t{\n\t\tname: 'videos',\n\t\tlabels: {\n\t\t\tname: __( 'Videos' ),\n\t\t\tsearch_items: __( 'Search videos' ),\n\t\t},\n\t\tmediaType: 'video',\n\t\tasync fetch( query = {} ) {\n\t\t\treturn coreMediaFetch( { ...query, media_type: 'video' } );\n\t\t},\n\t},\n\t{\n\t\tname: 'audio',\n\t\tlabels: {\n\t\t\tname: __( 'Audio' ),\n\t\t\tsearch_items: __( 'Search audio' ),\n\t\t},\n\t\tmediaType: 'audio',\n\t\tasync fetch( query = {} ) {\n\t\t\treturn coreMediaFetch( { ...query, media_type: 'audio' } );\n\t\t},\n\t},\n\t{\n\t\tname: 'openverse',\n\t\tlabels: {\n\t\t\tname: __( 'Openverse' ),\n\t\t\tsearch_items: __( 'Search Openverse' ),\n\t\t},\n\t\tmediaType: 'image',\n\t\tasync fetch( query = {} ) {\n\t\t\tconst defaultArgs = {\n\t\t\t\tmature: false,\n\t\t\t\texcluded_source: 'flickr,inaturalist,wikimedia',\n\t\t\t\tlicense: 'pdm,cc0',\n\t\t\t};\n\t\t\tconst finalQuery = { ...query, ...defaultArgs };\n\t\t\tconst mapFromInserterMediaRequest = {\n\t\t\t\tper_page: 'page_size',\n\t\t\t\tsearch: 'q',\n\t\t\t};\n\t\t\tconst url = new URL( 'https://api.openverse.org/v1/images/' );\n\t\t\tObject.entries( finalQuery ).forEach( ( [ key, value ] ) => {\n\t\t\t\tconst queryKey = mapFromInserterMediaRequest[ key ] || key;\n\t\t\t\turl.searchParams.set( queryKey, value );\n\t\t\t} );\n\t\t\tconst response = await window.fetch( url, {\n\t\t\t\theaders: {\n\t\t\t\t\t'User-Agent': 'WordPress/inserter-media-fetch',\n\t\t\t\t},\n\t\t\t} );\n\t\t\tconst jsonResponse = await response.json();\n\t\t\tconst results = jsonResponse.results;\n\t\t\treturn results.map( ( result ) => ( {\n\t\t\t\t...result,\n\t\t\t\t// This is a temp solution for better titles, until Openverse API\n\t\t\t\t// completes the cleaning up of some titles of their upstream data.\n\t\t\t\ttitle: result.title?.toLowerCase().startsWith( 'file:' )\n\t\t\t\t\t? result.title.slice( 5 )\n\t\t\t\t\t: result.title,\n\t\t\t\tsourceId: result.id,\n\t\t\t\tid: undefined,\n\t\t\t\tcaption: getOpenverseCaption( result ),\n\t\t\t\tpreviewUrl: result.thumbnail,\n\t\t\t} ) );\n\t\t},\n\t\tgetReportUrl: ( { sourceId } ) =>\n\t\t\t`https://wordpress.org/openverse/image/${ sourceId }/report/`,\n\t\tisExternalResource: true,\n\t},\n];\n\nexport default inserterMediaCategories;\n"],"mappings":";;;;;;AAWA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,aAAA,GAAAF,OAAA;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EAAE;QACR,YAAY,EAAE;MACf;IACD,CAAE,CAAC;IACH,MAAMC,YAAY,GAAG,MAAMH,QAAQ,CAACI,IAAI,CAAC,CAAC;IAC1C,MAAMC,OAAO,GAAGF,YAAY,CAACE,OAAO;IACpC,OAAOA,OAAO,CAACvC,GAAG,CAAIwC,MAAM,KAAQ;MACnC,GAAGA,MAAM;MACT;MACA;MACA/D,KAAK,EAAE+D,MAAM,CAAC/D,KAAK,EAAEgE,WAAW,CAAC,CAAC,CAACC,UAAU,CAAE,OAAQ,CAAC,GACrDF,MAAM,CAAC/D,KAAK,CAACkE,KAAK,CAAE,CAAE,CAAC,GACvBH,MAAM,CAAC/D,KAAK;MACfmE,QAAQ,EAAEJ,MAAM,CAACK,EAAE;MACnBA,EAAE,EAAEC,SAAS;MACbrC,OAAO,EAAElC,mBAAmB,CAAEiE,MAAO,CAAC;MACtCnC,UAAU,EAAEmC,MAAM,CAACO;IACpB,CAAC,CAAG,CAAC;EACN,CAAC;EACDC,YAAY,EAAEA,CAAE;IAAEJ;EAAS,CAAC,KAC1B,yCAAyCA,QAAU,UAAS;EAC9DK,kBAAkB,EAAE;AACrB,CAAC,CACD;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEazC,uBAAuB","ignoreList":[]}
|
|
@@ -615,7 +615,7 @@ const duplicatePostAction = {
|
|
|
615
615
|
});
|
|
616
616
|
createSuccessNotice((0, _i18n.sprintf)(
|
|
617
617
|
// translators: %s: Title of the created template e.g: "Category".
|
|
618
|
-
(0, _i18n.__)('"%s" successfully created.'), newItem.title?.rendered || title), {
|
|
618
|
+
(0, _i18n.__)('"%s" successfully created.'), (0, _htmlEntities.decodeEntities)(newItem.title?.rendered || title)), {
|
|
619
619
|
id: 'duplicate-post-action',
|
|
620
620
|
type: 'snackbar'
|
|
621
621
|
});
|
|
@@ -832,11 +832,12 @@ function usePostActions(postType, onActionPerformed) {
|
|
|
832
832
|
const isPattern = postType === _constants.PATTERN_POST_TYPE;
|
|
833
833
|
const isLoaded = !!postTypeObject;
|
|
834
834
|
const supportsRevisions = !!postTypeObject?.supports?.revisions;
|
|
835
|
+
const supportsTitle = !!postTypeObject?.supports?.title;
|
|
835
836
|
return (0, _element.useMemo)(() => {
|
|
836
837
|
if (!isLoaded) {
|
|
837
838
|
return [];
|
|
838
839
|
}
|
|
839
|
-
const actions = [postTypeObject?.viewable && viewPostAction, supportsRevisions && postRevisionsAction, globalThis.IS_GUTENBERG_PLUGIN ? !isTemplateOrTemplatePart && !isPattern && duplicatePostAction : false, isTemplateOrTemplatePart && duplicateTemplatePartAction, isPattern && duplicatePatternAction, renamePostAction, isPattern && _exportPatternAction.exportPatternAsJSONAction, isTemplateOrTemplatePart ? resetTemplateAction : restorePostAction, isTemplateOrTemplatePart || isPattern ? deletePostAction : trashPostAction, !isTemplateOrTemplatePart && permanentlyDeletePostAction].filter(Boolean);
|
|
840
|
+
const actions = [postTypeObject?.viewable && viewPostAction, supportsRevisions && postRevisionsAction, globalThis.IS_GUTENBERG_PLUGIN ? !isTemplateOrTemplatePart && !isPattern && duplicatePostAction : false, isTemplateOrTemplatePart && duplicateTemplatePartAction, isPattern && duplicatePatternAction, supportsTitle && renamePostAction, isPattern && _exportPatternAction.exportPatternAsJSONAction, isTemplateOrTemplatePart ? resetTemplateAction : restorePostAction, isTemplateOrTemplatePart || isPattern ? deletePostAction : trashPostAction, !isTemplateOrTemplatePart && permanentlyDeletePostAction].filter(Boolean);
|
|
840
841
|
if (onActionPerformed) {
|
|
841
842
|
for (let i = 0; i < actions.length; ++i) {
|
|
842
843
|
if (actions[i].callback) {
|
|
@@ -873,6 +874,6 @@ function usePostActions(postType, onActionPerformed) {
|
|
|
873
874
|
}
|
|
874
875
|
}
|
|
875
876
|
return actions;
|
|
876
|
-
}, [isTemplateOrTemplatePart, isPattern, postTypeObject?.viewable, permanentlyDeletePostAction, restorePostAction, onActionPerformed, isLoaded, supportsRevisions]);
|
|
877
|
+
}, [isTemplateOrTemplatePart, isPattern, postTypeObject?.viewable, permanentlyDeletePostAction, restorePostAction, onActionPerformed, isLoaded, supportsRevisions, supportsTitle]);
|
|
877
878
|
}
|
|
878
879
|
//# sourceMappingURL=actions.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_icons","require","_url","_data","_htmlEntities","_coreData","_i18n","_notices","_element","_patterns","_components","_constants","_store","_lockUnlock","_isTemplateRevertable","_interopRequireDefault","_exportPatternAction","_createTemplatePartModal","_jsxRuntime","PATTERN_TYPES","CreatePatternModalContents","useDuplicatePatternProps","unlock","patternsPrivateApis","isTemplateRemovable","template","source","templatePart","includes","TEMPLATE_ORIGINS","custom","has_theme_file","canDeleteOrReset","item","isTemplatePart","type","TEMPLATE_PART_POST_TYPE","isUserPattern","user","isCustom","getItemTitle","title","decodeEntities","rendered","deletePostAction","id","label","__","isPrimary","icon","trash","isEligible","post","TEMPLATE_POST_TYPE","supportsBulk","hideModalHeader","RenderModal","items","closeModal","onActionStart","onActionPerformed","isBusy","setIsBusy","useState","removeTemplates","useDispatch","editorStore","jsxs","__experimentalVStack","spacing","children","jsx","__experimentalText","length","sprintf","_n","__experimentalHStack","justify","Button","variant","onClick","disabled","__experimentalIsFocusable","allowUndo","trashPostAction","status","createSuccessNotice","createErrorNotice","noticesStore","deleteEntityRecord","coreStore","promiseResult","Promise","allSettled","map","throwOnError","every","successMessage","errorMessage","reason","message","errorMessages","Set","failedPromises","filter","failedPromise","add","size","join","usePermanentlyDeletePostAction","useMemo","callback","posts","force","useRestorePostAction","editEntityRecord","saveEditedEntityRecord","backup","viewPostAction","external","window","open","link","postRevisionsAction","_items$0$_links$versi","revisionsCount","_links","count","_post$_links$predeces","_post$_links$version","lastRevisionId","href","addQueryArgs","revision","document","location","renamePostAction","Object","values","is_custom","isCustomPattern","hasThemeFile","originalTitle","setTitle","onRename","event","preventDefault","error","code","onSubmit","TextControl","__nextHasNoMarginBottom","__next40pxDefaultSize","value","onChange","required","duplicatePostAction","_x","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","isTemplateRevertable","revertTemplate","onConfirm","fallbackErrorMessage","duplicatePatternAction","exports","modalHeader","isThemePattern","theme","duplicatedProps","pattern","patternPost","onSuccess","onClose","confirmLabel","duplicateTemplatePartAction","onTemplatePartSuccess","CreateTemplatePartModalContents","blocks","defaultArea","area","defaultTitle","onCreate","onError","usePostActions","postType","postTypeObject","useSelect","select","getPostType","permanentlyDeletePostAction","restorePostAction","isTemplateOrTemplatePart","isPattern","PATTERN_POST_TYPE","isLoaded","supportsRevisions","supports","revisions","actions","viewable","globalThis","IS_GUTENBERG_PLUGIN","exportPatternAsJSONAction","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\tnewItem.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\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\trenamePostAction,\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\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AEJ;UACD,CAAC;QACF;MACD;IACD;IAEA,OAAOT,OAAO;EACf,CAAC,EAAE,CACFP,wBAAwB,EACxBC,SAAS,EACTP,cAAc,EAAEc,QAAQ,EACxBV,2BAA2B,EAC3BC,iBAAiB,EACjBxJ,iBAAiB,EACjB4J,QAAQ,EACRC,iBAAiB,CAChB,CAAC;AACJ","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_icons","require","_url","_data","_htmlEntities","_coreData","_i18n","_notices","_element","_patterns","_components","_constants","_store","_lockUnlock","_isTemplateRevertable","_interopRequireDefault","_exportPatternAction","_createTemplatePartModal","_jsxRuntime","PATTERN_TYPES","CreatePatternModalContents","useDuplicatePatternProps","unlock","patternsPrivateApis","isTemplateRemovable","template","source","templatePart","includes","TEMPLATE_ORIGINS","custom","has_theme_file","canDeleteOrReset","item","isTemplatePart","type","TEMPLATE_PART_POST_TYPE","isUserPattern","user","isCustom","getItemTitle","title","decodeEntities","rendered","deletePostAction","id","label","__","isPrimary","icon","trash","isEligible","post","TEMPLATE_POST_TYPE","supportsBulk","hideModalHeader","RenderModal","items","closeModal","onActionStart","onActionPerformed","isBusy","setIsBusy","useState","removeTemplates","useDispatch","editorStore","jsxs","__experimentalVStack","spacing","children","jsx","__experimentalText","length","sprintf","_n","__experimentalHStack","justify","Button","variant","onClick","disabled","__experimentalIsFocusable","allowUndo","trashPostAction","status","createSuccessNotice","createErrorNotice","noticesStore","deleteEntityRecord","coreStore","promiseResult","Promise","allSettled","map","throwOnError","every","successMessage","errorMessage","reason","message","errorMessages","Set","failedPromises","filter","failedPromise","add","size","join","usePermanentlyDeletePostAction","useMemo","callback","posts","force","useRestorePostAction","editEntityRecord","saveEditedEntityRecord","backup","viewPostAction","external","window","open","link","postRevisionsAction","_items$0$_links$versi","revisionsCount","_links","count","_post$_links$predeces","_post$_links$version","lastRevisionId","href","addQueryArgs","revision","document","location","renamePostAction","Object","values","is_custom","isCustomPattern","hasThemeFile","originalTitle","setTitle","onRename","event","preventDefault","error","code","onSubmit","TextControl","__nextHasNoMarginBottom","__next40pxDefaultSize","value","onChange","required","duplicatePostAction","_x","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","isTemplateRevertable","revertTemplate","onConfirm","fallbackErrorMessage","duplicatePatternAction","exports","modalHeader","isThemePattern","theme","duplicatedProps","pattern","patternPost","onSuccess","onClose","confirmLabel","duplicateTemplatePartAction","onTemplatePartSuccess","CreateTemplatePartModalContents","blocks","defaultArea","area","defaultTitle","onCreate","onError","usePostActions","postType","postTypeObject","useSelect","select","getPostType","permanentlyDeletePostAction","restorePostAction","isTemplateOrTemplatePart","isPattern","PATTERN_POST_TYPE","isLoaded","supportsRevisions","supports","revisions","supportsTitle","actions","viewable","globalThis","IS_GUTENBERG_PLUGIN","exportPatternAsJSONAction","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":";;;;;;;;AAGA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,IAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,aAAA,GAAAH,OAAA;AACA,IAAAI,SAAA,GAAAJ,OAAA;AACA,IAAAK,KAAA,GAAAL,OAAA;AACA,IAAAM,QAAA,GAAAN,OAAA;AACA,IAAAO,QAAA,GAAAP,OAAA;AACA,IAAAQ,SAAA,GAAAR,OAAA;AAEA,IAAAS,WAAA,GAAAT,OAAA;AAWA,IAAAU,UAAA,GAAAV,OAAA;AAMA,IAAAW,MAAA,GAAAX,OAAA;AACA,IAAAY,WAAA,GAAAZ,OAAA;AACA,IAAAa,qBAAA,GAAAC,sBAAA,CAAAd,OAAA;AACA,IAAAe,oBAAA,GAAAf,OAAA;AACA,IAAAgB,wBAAA,GAAAhB,OAAA;AAAgF,IAAAiB,WAAA,GAAAjB,OAAA;AAlChF;AACA;AACA;;AAmBA;AACA;AACA;;AAaA;AACA,MAAM;EAAEkB,aAAa;EAAEC,0BAA0B;EAAEC;AAAyB,CAAC,GAC5E,IAAAC,kBAAM,EAAEC,qBAAoB,CAAC;;AAE9B;AACA;AACA;AACA;AACA;AACA;AACA,SAASC,mBAAmBA,CAAEC,QAAQ,EAAG;EACxC,IAAK,CAAEA,QAAQ,EAAG;IACjB,OAAO,KAAK;EACb;EACA;EACA;EACA;EACA,OACC,CAAEA,QAAQ,CAACC,MAAM,EAAED,QAAQ,CAACE,YAAY,EAAED,MAAM,CAAE,CAACE,QAAQ,CAC1DC,2BAAgB,CAACC,MAClB,CAAC,IACD,CAAEL,QAAQ,CAACM,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