@wordpress/editor 14.14.0 → 14.15.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (180) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/LICENSE.md +1 -1
  3. package/README.md +1 -0
  4. package/build/components/commands/index.js +28 -0
  5. package/build/components/commands/index.js.map +1 -1
  6. package/build/components/document-bar/index.js +2 -1
  7. package/build/components/document-bar/index.js.map +1 -1
  8. package/build/components/document-tools/index.js +3 -6
  9. package/build/components/document-tools/index.js.map +1 -1
  10. package/build/components/editor-help/intro-to-blocks.native.js +1 -1
  11. package/build/components/editor-help/intro-to-blocks.native.js.map +1 -1
  12. package/build/components/entities-saved-states/index.js +2 -1
  13. package/build/components/entities-saved-states/index.js.map +1 -1
  14. package/build/components/error-boundary/index.native.js +1 -1
  15. package/build/components/error-boundary/index.native.js.map +1 -1
  16. package/build/components/more-menu/index.js +0 -1
  17. package/build/components/more-menu/index.js.map +1 -1
  18. package/build/components/post-actions/actions.js +9 -4
  19. package/build/components/post-actions/actions.js.map +1 -1
  20. package/build/components/post-actions/index.js +17 -14
  21. package/build/components/post-actions/index.js.map +1 -1
  22. package/build/components/post-actions/set-as-homepage.js +23 -34
  23. package/build/components/post-actions/set-as-homepage.js.map +1 -1
  24. package/build/components/post-actions/set-as-posts-page.js +154 -0
  25. package/build/components/post-actions/set-as-posts-page.js.map +1 -0
  26. package/build/components/post-card-panel/index.js +12 -5
  27. package/build/components/post-card-panel/index.js.map +1 -1
  28. package/build/components/post-publish-panel/maybe-upload-media.js +1 -1
  29. package/build/components/post-publish-panel/maybe-upload-media.js.map +1 -1
  30. package/build/components/preferences-modal/index.js +2 -4
  31. package/build/components/preferences-modal/index.js.map +1 -1
  32. package/build/components/preview-dropdown/index.js +0 -1
  33. package/build/components/preview-dropdown/index.js.map +1 -1
  34. package/build/components/provider/disable-non-page-content-blocks.js +65 -13
  35. package/build/components/provider/disable-non-page-content-blocks.js.map +1 -1
  36. package/build/components/provider/index.js +9 -13
  37. package/build/components/provider/index.js.map +1 -1
  38. package/build/components/provider/use-block-editor-settings.js +3 -1
  39. package/build/components/provider/use-block-editor-settings.js.map +1 -1
  40. package/build/components/start-page-options/index.js +20 -107
  41. package/build/components/start-page-options/index.js.map +1 -1
  42. package/build/components/template-part-menu-items/index.js +2 -10
  43. package/build/components/template-part-menu-items/index.js.map +1 -1
  44. package/build/store/actions.js +0 -2
  45. package/build/store/actions.js.map +1 -1
  46. package/build/store/constants.js +1 -3
  47. package/build/store/constants.js.map +1 -1
  48. package/build/store/private-actions.js +1 -1
  49. package/build/store/private-actions.js.map +1 -1
  50. package/build/store/utils/notice-builder.js +3 -8
  51. package/build/store/utils/notice-builder.js.map +1 -1
  52. package/build/utils/get-item-title.js +32 -0
  53. package/build/utils/get-item-title.js.map +1 -0
  54. package/build/utils/media-sideload/index.js +21 -0
  55. package/build/utils/media-sideload/index.js.map +1 -0
  56. package/build/utils/media-sideload/index.native.js +8 -0
  57. package/build/utils/media-sideload/index.native.js.map +1 -0
  58. package/build/utils/media-upload/index.js +5 -2
  59. package/build/utils/media-upload/index.js.map +1 -1
  60. package/build-module/components/commands/index.js +28 -0
  61. package/build-module/components/commands/index.js.map +1 -1
  62. package/build-module/components/document-bar/index.js +2 -1
  63. package/build-module/components/document-bar/index.js.map +1 -1
  64. package/build-module/components/document-tools/index.js +4 -7
  65. package/build-module/components/document-tools/index.js.map +1 -1
  66. package/build-module/components/editor-help/intro-to-blocks.native.js +1 -1
  67. package/build-module/components/editor-help/intro-to-blocks.native.js.map +1 -1
  68. package/build-module/components/entities-saved-states/index.js +2 -1
  69. package/build-module/components/entities-saved-states/index.js.map +1 -1
  70. package/build-module/components/error-boundary/index.native.js +2 -2
  71. package/build-module/components/error-boundary/index.native.js.map +1 -1
  72. package/build-module/components/more-menu/index.js +0 -1
  73. package/build-module/components/more-menu/index.js.map +1 -1
  74. package/build-module/components/post-actions/actions.js +9 -4
  75. package/build-module/components/post-actions/actions.js.map +1 -1
  76. package/build-module/components/post-actions/index.js +18 -15
  77. package/build-module/components/post-actions/index.js.map +1 -1
  78. package/build-module/components/post-actions/set-as-homepage.js +22 -33
  79. package/build-module/components/post-actions/set-as-homepage.js.map +1 -1
  80. package/build-module/components/post-actions/set-as-posts-page.js +146 -0
  81. package/build-module/components/post-actions/set-as-posts-page.js.map +1 -0
  82. package/build-module/components/post-card-panel/index.js +11 -6
  83. package/build-module/components/post-card-panel/index.js.map +1 -1
  84. package/build-module/components/post-publish-panel/maybe-upload-media.js +2 -2
  85. package/build-module/components/post-publish-panel/maybe-upload-media.js.map +1 -1
  86. package/build-module/components/preferences-modal/index.js +2 -4
  87. package/build-module/components/preferences-modal/index.js.map +1 -1
  88. package/build-module/components/preview-dropdown/index.js +0 -1
  89. package/build-module/components/preview-dropdown/index.js.map +1 -1
  90. package/build-module/components/provider/disable-non-page-content-blocks.js +65 -13
  91. package/build-module/components/provider/disable-non-page-content-blocks.js.map +1 -1
  92. package/build-module/components/provider/index.js +10 -14
  93. package/build-module/components/provider/index.js.map +1 -1
  94. package/build-module/components/provider/use-block-editor-settings.js +3 -1
  95. package/build-module/components/provider/use-block-editor-settings.js.map +1 -1
  96. package/build-module/components/start-page-options/index.js +21 -107
  97. package/build-module/components/start-page-options/index.js.map +1 -1
  98. package/build-module/components/template-part-menu-items/index.js +2 -10
  99. package/build-module/components/template-part-menu-items/index.js.map +1 -1
  100. package/build-module/store/actions.js +0 -2
  101. package/build-module/store/actions.js.map +1 -1
  102. package/build-module/store/constants.js +0 -2
  103. package/build-module/store/constants.js.map +1 -1
  104. package/build-module/store/private-actions.js +1 -1
  105. package/build-module/store/private-actions.js.map +1 -1
  106. package/build-module/store/utils/notice-builder.js +3 -8
  107. package/build-module/store/utils/notice-builder.js.map +1 -1
  108. package/build-module/utils/get-item-title.js +26 -0
  109. package/build-module/utils/get-item-title.js.map +1 -0
  110. package/build-module/utils/media-sideload/index.js +14 -0
  111. package/build-module/utils/media-sideload/index.js.map +1 -0
  112. package/build-module/utils/media-sideload/index.native.js +2 -0
  113. package/build-module/utils/media-sideload/index.native.js.map +1 -0
  114. package/build-module/utils/media-upload/index.js +5 -2
  115. package/build-module/utils/media-upload/index.js.map +1 -1
  116. package/build-style/style-rtl.css +5 -25
  117. package/build-style/style.css +5 -25
  118. package/build-types/components/commands/index.d.ts.map +1 -1
  119. package/build-types/components/document-bar/index.d.ts.map +1 -1
  120. package/build-types/components/document-tools/index.d.ts.map +1 -1
  121. package/build-types/components/entities-saved-states/index.d.ts.map +1 -1
  122. package/build-types/components/more-menu/index.d.ts.map +1 -1
  123. package/build-types/components/post-actions/actions.d.ts.map +1 -1
  124. package/build-types/components/post-actions/index.d.ts.map +1 -1
  125. package/build-types/components/post-actions/set-as-homepage.d.ts.map +1 -1
  126. package/build-types/components/post-actions/set-as-posts-page.d.ts +10 -0
  127. package/build-types/components/post-actions/set-as-posts-page.d.ts.map +1 -0
  128. package/build-types/components/post-card-panel/index.d.ts.map +1 -1
  129. package/build-types/components/preferences-modal/index.d.ts.map +1 -1
  130. package/build-types/components/preview-dropdown/index.d.ts.map +1 -1
  131. package/build-types/components/provider/disable-non-page-content-blocks.d.ts.map +1 -1
  132. package/build-types/components/provider/index.d.ts.map +1 -1
  133. package/build-types/components/provider/use-block-editor-settings.d.ts.map +1 -1
  134. package/build-types/components/start-page-options/index.d.ts +1 -2
  135. package/build-types/components/start-page-options/index.d.ts.map +1 -1
  136. package/build-types/store/actions.d.ts.map +1 -1
  137. package/build-types/store/constants.d.ts +0 -2
  138. package/build-types/store/constants.d.ts.map +1 -1
  139. package/build-types/store/private-actions.d.ts.map +1 -1
  140. package/build-types/store/utils/notice-builder.d.ts.map +1 -1
  141. package/build-types/utils/get-item-title.d.ts +10 -0
  142. package/build-types/utils/get-item-title.d.ts.map +1 -0
  143. package/build-types/utils/media-sideload/index.d.ts +3 -0
  144. package/build-types/utils/media-sideload/index.d.ts.map +1 -0
  145. package/build-types/utils/media-upload/index.d.ts +3 -1
  146. package/build-types/utils/media-upload/index.d.ts.map +1 -1
  147. package/package.json +37 -37
  148. package/src/components/commands/index.js +29 -0
  149. package/src/components/document-bar/index.js +2 -1
  150. package/src/components/document-tools/index.js +3 -6
  151. package/src/components/document-tools/style.scss +0 -6
  152. package/src/components/editor-help/intro-to-blocks.native.js +1 -1
  153. package/src/components/entities-saved-states/index.js +5 -1
  154. package/src/components/error-boundary/index.native.js +2 -2
  155. package/src/components/more-menu/index.js +0 -1
  156. package/src/components/post-actions/actions.js +12 -4
  157. package/src/components/post-actions/index.js +19 -17
  158. package/src/components/post-actions/set-as-homepage.js +29 -45
  159. package/src/components/post-actions/set-as-posts-page.js +164 -0
  160. package/src/components/post-card-panel/index.js +8 -6
  161. package/src/components/post-card-panel/style.scss +4 -13
  162. package/src/components/post-publish-panel/maybe-upload-media.js +2 -2
  163. package/src/components/preferences-modal/index.js +8 -13
  164. package/src/components/preview-dropdown/index.js +0 -1
  165. package/src/components/provider/disable-non-page-content-blocks.js +64 -13
  166. package/src/components/provider/index.js +13 -27
  167. package/src/components/provider/use-block-editor-settings.js +3 -0
  168. package/src/components/start-page-options/index.js +28 -119
  169. package/src/components/template-part-menu-items/index.js +2 -11
  170. package/src/store/actions.js +0 -2
  171. package/src/store/constants.ts +0 -2
  172. package/src/store/private-actions.js +1 -1
  173. package/src/store/utils/notice-builder.js +3 -8
  174. package/src/store/utils/test/notice-builder.js +3 -4
  175. package/src/utils/get-item-title.js +25 -0
  176. package/src/utils/media-sideload/index.js +13 -0
  177. package/src/utils/media-sideload/index.native.js +1 -0
  178. package/src/utils/media-upload/index.js +4 -1
  179. package/tsconfig.json +1 -4
  180. package/tsconfig.tsbuildinfo +1 -1
@@ -1 +1 @@
1
- {"version":3,"names":["useMemo","useCallback","useDispatch","useSelect","store","coreStore","__experimentalFetchLinkSuggestions","fetchLinkSuggestions","__experimentalFetchUrlData","fetchUrlData","privateApis","coreDataPrivateApis","__","preferencesStore","useViewportMatch","blocksStore","blockEditorStore","inserterMediaCategories","mediaUpload","editorStore","unlock","useGlobalStylesContext","EMPTY_OBJECT","__experimentalReusableBlocksSelect","select","RECEIVE_INTERMEDIATE_RESULTS","getEntityRecords","per_page","BLOCK_EDITOR_SETTINGS","globalStylesDataKey","globalStylesLinksDataKey","selectBlockPatternsKey","reusableBlocksSelectKey","sectionRootClientIdKey","useBlockEditorSettings","settings","postType","postId","renderingMode","_mergedGlobalStyles$s","_mergedGlobalStyles$_","_settings$__experimen","_settings$__experimen2","isLargeViewport","allowRightClickOverrides","blockTypes","focusMode","hasFixedToolbar","isDistractionFree","keepCaretInsideBlock","hasUploadPermissions","hiddenBlockTypes","canUseUnfilteredHTML","userCanCreatePages","pageOnFront","pageForPosts","userPatternCategories","restBlockPatternCategories","sectionRootClientId","_canUser","canUser","getRawEntityRecord","getEntityRecord","getUserPatternCategories","getBlockPatternCategories","get","getBlockTypes","getBlocksByName","getBlockAttributes","siteSettings","kind","name","undefined","getSectionRootBlock","_getBlocksByName$find","_getBlocksByName$","find","clientId","tagName","_links","hasOwnProperty","page_on_front","page_for_posts","merged","mergedGlobalStyles","globalStylesData","styles","globalStylesLinksData","settingsBlockPatterns","__experimentalAdditionalBlockPatterns","__experimentalBlockPatterns","settingsBlockPatternCategories","__experimentalAdditionalBlockPatternCategories","__experimentalBlockPatternCategories","blockPatterns","filter","postTypes","Array","isArray","includes","blockPatternCategories","x","index","arr","findIndex","y","undo","setIsInserterOpened","saveEntityRecord","createPageEntity","options","Promise","reject","message","allowedBlockTypes","length","defaultAllowedBlockTypes","map","type","forceDisableFocusMode","blockEditorSettings","Object","fromEntries","entries","key","hasFinishedResolution","getBlockPatternsForPostType","patterns","__experimentalUserPatternCategories","search","searchOptions","__experimentalFetchRichUrlData","__experimentalCanUserUseUnfilteredHTML","__experimentalUndo","outlineMode","__experimentalCreatePageEntity","__experimentalUserCanCreatePages","__experimentalPreferPatternsOnRoot","templateLock","template","__experimentalSetIsInserterOpened","editorTool"],"sources":["@wordpress/editor/src/components/provider/use-block-editor-settings.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useMemo, useCallback } from '@wordpress/element';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport {\n\tstore as coreStore,\n\t__experimentalFetchLinkSuggestions as fetchLinkSuggestions,\n\t__experimentalFetchUrlData as fetchUrlData,\n\tprivateApis as coreDataPrivateApis,\n} from '@wordpress/core-data';\nimport { __ } from '@wordpress/i18n';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport { useViewportMatch } from '@wordpress/compose';\nimport { store as blocksStore } from '@wordpress/blocks';\nimport {\n\tprivateApis,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport inserterMediaCategories from '../media-categories';\nimport { mediaUpload } from '../../utils';\nimport { store as editorStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\nimport { useGlobalStylesContext } from '../global-styles-provider';\n\nconst EMPTY_OBJECT = {};\n\nfunction __experimentalReusableBlocksSelect( select ) {\n\tconst { RECEIVE_INTERMEDIATE_RESULTS } = unlock( coreDataPrivateApis );\n\tconst { getEntityRecords } = select( coreStore );\n\treturn getEntityRecords( 'postType', 'wp_block', {\n\t\tper_page: -1,\n\t\t[ RECEIVE_INTERMEDIATE_RESULTS ]: true,\n\t} );\n}\n\nconst BLOCK_EDITOR_SETTINGS = [\n\t'__experimentalBlockDirectory',\n\t'__experimentalDiscussionSettings',\n\t'__experimentalFeatures',\n\t'__experimentalGlobalStylesBaseStyles',\n\t'alignWide',\n\t'blockInspectorTabs',\n\t'allowedMimeTypes',\n\t'bodyPlaceholder',\n\t'canLockBlocks',\n\t'canUpdateBlockBindings',\n\t'capabilities',\n\t'clearBlockSelection',\n\t'codeEditingEnabled',\n\t'colors',\n\t'disableCustomColors',\n\t'disableCustomFontSizes',\n\t'disableCustomSpacingSizes',\n\t'disableCustomGradients',\n\t'disableLayoutStyles',\n\t'enableCustomLineHeight',\n\t'enableCustomSpacing',\n\t'enableCustomUnits',\n\t'enableOpenverseMediaCategory',\n\t'fontSizes',\n\t'gradients',\n\t'generateAnchors',\n\t'onNavigateToEntityRecord',\n\t'imageDefaultSize',\n\t'imageDimensions',\n\t'imageEditing',\n\t'imageSizes',\n\t'isPreviewMode',\n\t'isRTL',\n\t'locale',\n\t'maxWidth',\n\t'postContentAttributes',\n\t'postsPerPage',\n\t'readOnly',\n\t'styles',\n\t'titlePlaceholder',\n\t'supportsLayout',\n\t'widgetTypesToHideFromLegacyWidgetBlock',\n\t'__unstableHasCustomAppender',\n\t'__unstableResolvedAssets',\n\t'__unstableIsBlockBasedTheme',\n];\n\nconst {\n\tglobalStylesDataKey,\n\tglobalStylesLinksDataKey,\n\tselectBlockPatternsKey,\n\treusableBlocksSelectKey,\n\tsectionRootClientIdKey,\n} = unlock( privateApis );\n\n/**\n * React hook used to compute the block editor settings to use for the post editor.\n *\n * @param {Object} settings EditorProvider settings prop.\n * @param {string} postType Editor root level post type.\n * @param {string} postId Editor root level post ID.\n * @param {string} renderingMode Editor rendering mode.\n *\n * @return {Object} Block Editor Settings.\n */\nfunction useBlockEditorSettings( settings, postType, postId, renderingMode ) {\n\tconst isLargeViewport = useViewportMatch( 'medium' );\n\tconst {\n\t\tallowRightClickOverrides,\n\t\tblockTypes,\n\t\tfocusMode,\n\t\thasFixedToolbar,\n\t\tisDistractionFree,\n\t\tkeepCaretInsideBlock,\n\t\thasUploadPermissions,\n\t\thiddenBlockTypes,\n\t\tcanUseUnfilteredHTML,\n\t\tuserCanCreatePages,\n\t\tpageOnFront,\n\t\tpageForPosts,\n\t\tuserPatternCategories,\n\t\trestBlockPatternCategories,\n\t\tsectionRootClientId,\n\t} = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tcanUser,\n\t\t\t\tgetRawEntityRecord,\n\t\t\t\tgetEntityRecord,\n\t\t\t\tgetUserPatternCategories,\n\t\t\t\tgetBlockPatternCategories,\n\t\t\t} = select( coreStore );\n\t\t\tconst { get } = select( preferencesStore );\n\t\t\tconst { getBlockTypes } = select( blocksStore );\n\t\t\tconst { getBlocksByName, getBlockAttributes } =\n\t\t\t\tselect( blockEditorStore );\n\t\t\tconst siteSettings = canUser( 'read', {\n\t\t\t\tkind: 'root',\n\t\t\t\tname: 'site',\n\t\t\t} )\n\t\t\t\t? getEntityRecord( 'root', 'site' )\n\t\t\t\t: undefined;\n\n\t\t\tfunction getSectionRootBlock() {\n\t\t\t\tif ( renderingMode === 'template-locked' ) {\n\t\t\t\t\treturn getBlocksByName( 'core/post-content' )?.[ 0 ] ?? '';\n\t\t\t\t}\n\n\t\t\t\treturn (\n\t\t\t\t\tgetBlocksByName( 'core/group' ).find(\n\t\t\t\t\t\t( clientId ) =>\n\t\t\t\t\t\t\tgetBlockAttributes( clientId )?.tagName === 'main'\n\t\t\t\t\t) ?? ''\n\t\t\t\t);\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\tallowRightClickOverrides: get(\n\t\t\t\t\t'core',\n\t\t\t\t\t'allowRightClickOverrides'\n\t\t\t\t),\n\t\t\t\tblockTypes: getBlockTypes(),\n\t\t\t\tcanUseUnfilteredHTML: getRawEntityRecord(\n\t\t\t\t\t'postType',\n\t\t\t\t\tpostType,\n\t\t\t\t\tpostId\n\t\t\t\t)?._links?.hasOwnProperty( 'wp:action-unfiltered-html' ),\n\t\t\t\tfocusMode: get( 'core', 'focusMode' ),\n\t\t\t\thasFixedToolbar:\n\t\t\t\t\tget( 'core', 'fixedToolbar' ) || ! isLargeViewport,\n\t\t\t\thiddenBlockTypes: get( 'core', 'hiddenBlockTypes' ),\n\t\t\t\tisDistractionFree: get( 'core', 'distractionFree' ),\n\t\t\t\tkeepCaretInsideBlock: get( 'core', 'keepCaretInsideBlock' ),\n\t\t\t\thasUploadPermissions:\n\t\t\t\t\tcanUser( 'create', {\n\t\t\t\t\t\tkind: 'root',\n\t\t\t\t\t\tname: 'media',\n\t\t\t\t\t} ) ?? true,\n\t\t\t\tuserCanCreatePages: canUser( 'create', {\n\t\t\t\t\tkind: 'postType',\n\t\t\t\t\tname: 'page',\n\t\t\t\t} ),\n\t\t\t\tpageOnFront: siteSettings?.page_on_front,\n\t\t\t\tpageForPosts: siteSettings?.page_for_posts,\n\t\t\t\tuserPatternCategories: getUserPatternCategories(),\n\t\t\t\trestBlockPatternCategories: getBlockPatternCategories(),\n\t\t\t\tsectionRootClientId: getSectionRootBlock(),\n\t\t\t};\n\t\t},\n\t\t[ postType, postId, isLargeViewport, renderingMode ]\n\t);\n\n\tconst { merged: mergedGlobalStyles } = useGlobalStylesContext();\n\tconst globalStylesData = mergedGlobalStyles.styles ?? EMPTY_OBJECT;\n\tconst globalStylesLinksData = mergedGlobalStyles._links ?? EMPTY_OBJECT;\n\n\tconst settingsBlockPatterns =\n\t\tsettings.__experimentalAdditionalBlockPatterns ?? // WP 6.0\n\t\tsettings.__experimentalBlockPatterns; // WP 5.9\n\tconst settingsBlockPatternCategories =\n\t\tsettings.__experimentalAdditionalBlockPatternCategories ?? // WP 6.0\n\t\tsettings.__experimentalBlockPatternCategories; // WP 5.9\n\n\tconst blockPatterns = useMemo(\n\t\t() =>\n\t\t\t[ ...( settingsBlockPatterns || [] ) ].filter(\n\t\t\t\t( { postTypes } ) => {\n\t\t\t\t\treturn (\n\t\t\t\t\t\t! postTypes ||\n\t\t\t\t\t\t( Array.isArray( postTypes ) &&\n\t\t\t\t\t\t\tpostTypes.includes( postType ) )\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t),\n\t\t[ settingsBlockPatterns, postType ]\n\t);\n\n\tconst blockPatternCategories = useMemo(\n\t\t() =>\n\t\t\t[\n\t\t\t\t...( settingsBlockPatternCategories || [] ),\n\t\t\t\t...( restBlockPatternCategories || [] ),\n\t\t\t].filter(\n\t\t\t\t( x, index, arr ) =>\n\t\t\t\t\tindex === arr.findIndex( ( y ) => x.name === y.name )\n\t\t\t),\n\t\t[ settingsBlockPatternCategories, restBlockPatternCategories ]\n\t);\n\n\tconst { undo, setIsInserterOpened } = useDispatch( editorStore );\n\n\tconst { saveEntityRecord } = useDispatch( coreStore );\n\n\t/**\n\t * Creates a Post entity.\n\t * This is utilised by the Link UI to allow for on-the-fly creation of Posts/Pages.\n\t *\n\t * @param {Object} options parameters for the post being created. These mirror those used on 3rd param of saveEntityRecord.\n\t * @return {Object} the post type object that was created.\n\t */\n\tconst createPageEntity = useCallback(\n\t\t( options ) => {\n\t\t\tif ( ! userCanCreatePages ) {\n\t\t\t\treturn Promise.reject( {\n\t\t\t\t\tmessage: __(\n\t\t\t\t\t\t'You do not have permission to create Pages.'\n\t\t\t\t\t),\n\t\t\t\t} );\n\t\t\t}\n\t\t\treturn saveEntityRecord( 'postType', 'page', options );\n\t\t},\n\t\t[ saveEntityRecord, userCanCreatePages ]\n\t);\n\n\tconst allowedBlockTypes = useMemo( () => {\n\t\t// Omit hidden block types if exists and non-empty.\n\t\tif ( hiddenBlockTypes && hiddenBlockTypes.length > 0 ) {\n\t\t\t// Defer to passed setting for `allowedBlockTypes` if provided as\n\t\t\t// anything other than `true` (where `true` is equivalent to allow\n\t\t\t// all block types).\n\t\t\tconst defaultAllowedBlockTypes =\n\t\t\t\ttrue === settings.allowedBlockTypes\n\t\t\t\t\t? blockTypes.map( ( { name } ) => name )\n\t\t\t\t\t: settings.allowedBlockTypes || [];\n\n\t\t\treturn defaultAllowedBlockTypes.filter(\n\t\t\t\t( type ) => ! hiddenBlockTypes.includes( type )\n\t\t\t);\n\t\t}\n\n\t\treturn settings.allowedBlockTypes;\n\t}, [ settings.allowedBlockTypes, hiddenBlockTypes, blockTypes ] );\n\n\tconst forceDisableFocusMode = settings.focusMode === false;\n\n\treturn useMemo( () => {\n\t\tconst blockEditorSettings = {\n\t\t\t...Object.fromEntries(\n\t\t\t\tObject.entries( settings ).filter( ( [ key ] ) =>\n\t\t\t\t\tBLOCK_EDITOR_SETTINGS.includes( key )\n\t\t\t\t)\n\t\t\t),\n\t\t\t[ globalStylesDataKey ]: globalStylesData,\n\t\t\t[ globalStylesLinksDataKey ]: globalStylesLinksData,\n\t\t\tallowedBlockTypes,\n\t\t\tallowRightClickOverrides,\n\t\t\tfocusMode: focusMode && ! forceDisableFocusMode,\n\t\t\thasFixedToolbar,\n\t\t\tisDistractionFree,\n\t\t\tkeepCaretInsideBlock,\n\t\t\tmediaUpload: hasUploadPermissions ? mediaUpload : undefined,\n\t\t\t__experimentalBlockPatterns: blockPatterns,\n\t\t\t[ selectBlockPatternsKey ]: ( select ) => {\n\t\t\t\tconst { hasFinishedResolution, getBlockPatternsForPostType } =\n\t\t\t\t\tunlock( select( coreStore ) );\n\t\t\t\tconst patterns = getBlockPatternsForPostType( postType );\n\t\t\t\treturn hasFinishedResolution( 'getBlockPatterns' )\n\t\t\t\t\t? patterns\n\t\t\t\t\t: undefined;\n\t\t\t},\n\t\t\t[ reusableBlocksSelectKey ]: __experimentalReusableBlocksSelect,\n\t\t\t__experimentalBlockPatternCategories: blockPatternCategories,\n\t\t\t__experimentalUserPatternCategories: userPatternCategories,\n\t\t\t__experimentalFetchLinkSuggestions: ( search, searchOptions ) =>\n\t\t\t\tfetchLinkSuggestions( search, searchOptions, settings ),\n\t\t\tinserterMediaCategories,\n\t\t\t__experimentalFetchRichUrlData: fetchUrlData,\n\t\t\t// Todo: This only checks the top level post, not the post within a template or any other entity that can be edited.\n\t\t\t// This might be better as a generic \"canUser\" selector.\n\t\t\t__experimentalCanUserUseUnfilteredHTML: canUseUnfilteredHTML,\n\t\t\t//Todo: this is only needed for native and should probably be removed.\n\t\t\t__experimentalUndo: undo,\n\t\t\t// Check whether we want all site editor frames to have outlines\n\t\t\t// including the navigation / pattern / parts editors.\n\t\t\toutlineMode: ! isDistractionFree && postType === 'wp_template',\n\t\t\t// Check these two properties: they were not present in the site editor.\n\t\t\t__experimentalCreatePageEntity: createPageEntity,\n\t\t\t__experimentalUserCanCreatePages: userCanCreatePages,\n\t\t\tpageOnFront,\n\t\t\tpageForPosts,\n\t\t\t__experimentalPreferPatternsOnRoot: postType === 'wp_template',\n\t\t\ttemplateLock:\n\t\t\t\tpostType === 'wp_navigation' ? 'insert' : settings.templateLock,\n\t\t\ttemplate:\n\t\t\t\tpostType === 'wp_navigation'\n\t\t\t\t\t? [ [ 'core/navigation', {}, [] ] ]\n\t\t\t\t\t: settings.template,\n\t\t\t__experimentalSetIsInserterOpened: setIsInserterOpened,\n\t\t\t[ sectionRootClientIdKey ]: sectionRootClientId,\n\t\t\teditorTool:\n\t\t\t\trenderingMode === 'post-only' && postType !== 'wp_template'\n\t\t\t\t\t? 'edit'\n\t\t\t\t\t: undefined,\n\t\t};\n\n\t\treturn blockEditorSettings;\n\t}, [\n\t\tallowedBlockTypes,\n\t\tallowRightClickOverrides,\n\t\tfocusMode,\n\t\tforceDisableFocusMode,\n\t\thasFixedToolbar,\n\t\tisDistractionFree,\n\t\tkeepCaretInsideBlock,\n\t\tsettings,\n\t\thasUploadPermissions,\n\t\tuserPatternCategories,\n\t\tblockPatterns,\n\t\tblockPatternCategories,\n\t\tcanUseUnfilteredHTML,\n\t\tundo,\n\t\tcreatePageEntity,\n\t\tuserCanCreatePages,\n\t\tpageOnFront,\n\t\tpageForPosts,\n\t\tpostType,\n\t\tsetIsInserterOpened,\n\t\tsectionRootClientId,\n\t\tglobalStylesData,\n\t\tglobalStylesLinksData,\n\t\trenderingMode,\n\t] );\n}\n\nexport default useBlockEditorSettings;\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,OAAO,EAAEC,WAAW,QAAQ,oBAAoB;AACzD,SAASC,WAAW,EAAEC,SAAS,QAAQ,iBAAiB;AACxD,SACCC,KAAK,IAAIC,SAAS,EAClBC,kCAAkC,IAAIC,oBAAoB,EAC1DC,0BAA0B,IAAIC,YAAY,EAC1CC,WAAW,IAAIC,mBAAmB,QAC5B,sBAAsB;AAC7B,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SAASR,KAAK,IAAIS,gBAAgB,QAAQ,wBAAwB;AAClE,SAASC,gBAAgB,QAAQ,oBAAoB;AACrD,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AgB,EAChBE,qBAAqB,EACrBjD,aAAa,CACZ,CAAC;AACJ;AAEA,eAAeJ,sBAAsB","ignoreList":[]}
1
+ {"version":3,"names":["useMemo","useCallback","useDispatch","useSelect","store","coreStore","__experimentalFetchLinkSuggestions","fetchLinkSuggestions","__experimentalFetchUrlData","fetchUrlData","privateApis","coreDataPrivateApis","__","preferencesStore","useViewportMatch","blocksStore","blockEditorStore","inserterMediaCategories","mediaUpload","default","mediaSideload","editorStore","unlock","useGlobalStylesContext","EMPTY_OBJECT","__experimentalReusableBlocksSelect","select","RECEIVE_INTERMEDIATE_RESULTS","getEntityRecords","per_page","BLOCK_EDITOR_SETTINGS","globalStylesDataKey","globalStylesLinksDataKey","selectBlockPatternsKey","reusableBlocksSelectKey","sectionRootClientIdKey","useBlockEditorSettings","settings","postType","postId","renderingMode","_mergedGlobalStyles$s","_mergedGlobalStyles$_","_settings$__experimen","_settings$__experimen2","isLargeViewport","allowRightClickOverrides","blockTypes","focusMode","hasFixedToolbar","isDistractionFree","keepCaretInsideBlock","hasUploadPermissions","hiddenBlockTypes","canUseUnfilteredHTML","userCanCreatePages","pageOnFront","pageForPosts","userPatternCategories","restBlockPatternCategories","sectionRootClientId","_canUser","canUser","getRawEntityRecord","getEntityRecord","getUserPatternCategories","getBlockPatternCategories","get","getBlockTypes","getBlocksByName","getBlockAttributes","siteSettings","kind","name","undefined","getSectionRootBlock","_getBlocksByName$find","_getBlocksByName$","find","clientId","tagName","_links","hasOwnProperty","page_on_front","page_for_posts","merged","mergedGlobalStyles","globalStylesData","styles","globalStylesLinksData","settingsBlockPatterns","__experimentalAdditionalBlockPatterns","__experimentalBlockPatterns","settingsBlockPatternCategories","__experimentalAdditionalBlockPatternCategories","__experimentalBlockPatternCategories","blockPatterns","filter","postTypes","Array","isArray","includes","blockPatternCategories","x","index","arr","findIndex","y","undo","setIsInserterOpened","saveEntityRecord","createPageEntity","options","Promise","reject","message","allowedBlockTypes","length","defaultAllowedBlockTypes","map","type","forceDisableFocusMode","blockEditorSettings","Object","fromEntries","entries","key","hasFinishedResolution","getBlockPatternsForPostType","patterns","__experimentalUserPatternCategories","search","searchOptions","__experimentalFetchRichUrlData","__experimentalCanUserUseUnfilteredHTML","__experimentalUndo","outlineMode","__experimentalCreatePageEntity","__experimentalUserCanCreatePages","__experimentalPreferPatternsOnRoot","templateLock","template","__experimentalSetIsInserterOpened","editorTool"],"sources":["@wordpress/editor/src/components/provider/use-block-editor-settings.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useMemo, useCallback } from '@wordpress/element';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport {\n\tstore as coreStore,\n\t__experimentalFetchLinkSuggestions as fetchLinkSuggestions,\n\t__experimentalFetchUrlData as fetchUrlData,\n\tprivateApis as coreDataPrivateApis,\n} from '@wordpress/core-data';\nimport { __ } from '@wordpress/i18n';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport { useViewportMatch } from '@wordpress/compose';\nimport { store as blocksStore } from '@wordpress/blocks';\nimport {\n\tprivateApis,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport inserterMediaCategories from '../media-categories';\nimport { mediaUpload } from '../../utils';\nimport { default as mediaSideload } from '../../utils/media-sideload';\nimport { store as editorStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\nimport { useGlobalStylesContext } from '../global-styles-provider';\n\nconst EMPTY_OBJECT = {};\n\nfunction __experimentalReusableBlocksSelect( select ) {\n\tconst { RECEIVE_INTERMEDIATE_RESULTS } = unlock( coreDataPrivateApis );\n\tconst { getEntityRecords } = select( coreStore );\n\treturn getEntityRecords( 'postType', 'wp_block', {\n\t\tper_page: -1,\n\t\t[ RECEIVE_INTERMEDIATE_RESULTS ]: true,\n\t} );\n}\n\nconst BLOCK_EDITOR_SETTINGS = [\n\t'__experimentalBlockDirectory',\n\t'__experimentalDiscussionSettings',\n\t'__experimentalFeatures',\n\t'__experimentalGlobalStylesBaseStyles',\n\t'alignWide',\n\t'blockInspectorTabs',\n\t'maxUploadFileSize',\n\t'allowedMimeTypes',\n\t'bodyPlaceholder',\n\t'canLockBlocks',\n\t'canUpdateBlockBindings',\n\t'capabilities',\n\t'clearBlockSelection',\n\t'codeEditingEnabled',\n\t'colors',\n\t'disableCustomColors',\n\t'disableCustomFontSizes',\n\t'disableCustomSpacingSizes',\n\t'disableCustomGradients',\n\t'disableLayoutStyles',\n\t'enableCustomLineHeight',\n\t'enableCustomSpacing',\n\t'enableCustomUnits',\n\t'enableOpenverseMediaCategory',\n\t'fontSizes',\n\t'gradients',\n\t'generateAnchors',\n\t'onNavigateToEntityRecord',\n\t'imageDefaultSize',\n\t'imageDimensions',\n\t'imageEditing',\n\t'imageSizes',\n\t'isPreviewMode',\n\t'isRTL',\n\t'locale',\n\t'maxWidth',\n\t'postContentAttributes',\n\t'postsPerPage',\n\t'readOnly',\n\t'styles',\n\t'titlePlaceholder',\n\t'supportsLayout',\n\t'widgetTypesToHideFromLegacyWidgetBlock',\n\t'__unstableHasCustomAppender',\n\t'__unstableResolvedAssets',\n\t'__unstableIsBlockBasedTheme',\n];\n\nconst {\n\tglobalStylesDataKey,\n\tglobalStylesLinksDataKey,\n\tselectBlockPatternsKey,\n\treusableBlocksSelectKey,\n\tsectionRootClientIdKey,\n} = unlock( privateApis );\n\n/**\n * React hook used to compute the block editor settings to use for the post editor.\n *\n * @param {Object} settings EditorProvider settings prop.\n * @param {string} postType Editor root level post type.\n * @param {string} postId Editor root level post ID.\n * @param {string} renderingMode Editor rendering mode.\n *\n * @return {Object} Block Editor Settings.\n */\nfunction useBlockEditorSettings( settings, postType, postId, renderingMode ) {\n\tconst isLargeViewport = useViewportMatch( 'medium' );\n\tconst {\n\t\tallowRightClickOverrides,\n\t\tblockTypes,\n\t\tfocusMode,\n\t\thasFixedToolbar,\n\t\tisDistractionFree,\n\t\tkeepCaretInsideBlock,\n\t\thasUploadPermissions,\n\t\thiddenBlockTypes,\n\t\tcanUseUnfilteredHTML,\n\t\tuserCanCreatePages,\n\t\tpageOnFront,\n\t\tpageForPosts,\n\t\tuserPatternCategories,\n\t\trestBlockPatternCategories,\n\t\tsectionRootClientId,\n\t} = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tcanUser,\n\t\t\t\tgetRawEntityRecord,\n\t\t\t\tgetEntityRecord,\n\t\t\t\tgetUserPatternCategories,\n\t\t\t\tgetBlockPatternCategories,\n\t\t\t} = select( coreStore );\n\t\t\tconst { get } = select( preferencesStore );\n\t\t\tconst { getBlockTypes } = select( blocksStore );\n\t\t\tconst { getBlocksByName, getBlockAttributes } =\n\t\t\t\tselect( blockEditorStore );\n\t\t\tconst siteSettings = canUser( 'read', {\n\t\t\t\tkind: 'root',\n\t\t\t\tname: 'site',\n\t\t\t} )\n\t\t\t\t? getEntityRecord( 'root', 'site' )\n\t\t\t\t: undefined;\n\n\t\t\tfunction getSectionRootBlock() {\n\t\t\t\tif ( renderingMode === 'template-locked' ) {\n\t\t\t\t\treturn getBlocksByName( 'core/post-content' )?.[ 0 ] ?? '';\n\t\t\t\t}\n\n\t\t\t\treturn (\n\t\t\t\t\tgetBlocksByName( 'core/group' ).find(\n\t\t\t\t\t\t( clientId ) =>\n\t\t\t\t\t\t\tgetBlockAttributes( clientId )?.tagName === 'main'\n\t\t\t\t\t) ?? ''\n\t\t\t\t);\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\tallowRightClickOverrides: get(\n\t\t\t\t\t'core',\n\t\t\t\t\t'allowRightClickOverrides'\n\t\t\t\t),\n\t\t\t\tblockTypes: getBlockTypes(),\n\t\t\t\tcanUseUnfilteredHTML: getRawEntityRecord(\n\t\t\t\t\t'postType',\n\t\t\t\t\tpostType,\n\t\t\t\t\tpostId\n\t\t\t\t)?._links?.hasOwnProperty( 'wp:action-unfiltered-html' ),\n\t\t\t\tfocusMode: get( 'core', 'focusMode' ),\n\t\t\t\thasFixedToolbar:\n\t\t\t\t\tget( 'core', 'fixedToolbar' ) || ! isLargeViewport,\n\t\t\t\thiddenBlockTypes: get( 'core', 'hiddenBlockTypes' ),\n\t\t\t\tisDistractionFree: get( 'core', 'distractionFree' ),\n\t\t\t\tkeepCaretInsideBlock: get( 'core', 'keepCaretInsideBlock' ),\n\t\t\t\thasUploadPermissions:\n\t\t\t\t\tcanUser( 'create', {\n\t\t\t\t\t\tkind: 'root',\n\t\t\t\t\t\tname: 'media',\n\t\t\t\t\t} ) ?? true,\n\t\t\t\tuserCanCreatePages: canUser( 'create', {\n\t\t\t\t\tkind: 'postType',\n\t\t\t\t\tname: 'page',\n\t\t\t\t} ),\n\t\t\t\tpageOnFront: siteSettings?.page_on_front,\n\t\t\t\tpageForPosts: siteSettings?.page_for_posts,\n\t\t\t\tuserPatternCategories: getUserPatternCategories(),\n\t\t\t\trestBlockPatternCategories: getBlockPatternCategories(),\n\t\t\t\tsectionRootClientId: getSectionRootBlock(),\n\t\t\t};\n\t\t},\n\t\t[ postType, postId, isLargeViewport, renderingMode ]\n\t);\n\n\tconst { merged: mergedGlobalStyles } = useGlobalStylesContext();\n\tconst globalStylesData = mergedGlobalStyles.styles ?? EMPTY_OBJECT;\n\tconst globalStylesLinksData = mergedGlobalStyles._links ?? EMPTY_OBJECT;\n\n\tconst settingsBlockPatterns =\n\t\tsettings.__experimentalAdditionalBlockPatterns ?? // WP 6.0\n\t\tsettings.__experimentalBlockPatterns; // WP 5.9\n\tconst settingsBlockPatternCategories =\n\t\tsettings.__experimentalAdditionalBlockPatternCategories ?? // WP 6.0\n\t\tsettings.__experimentalBlockPatternCategories; // WP 5.9\n\n\tconst blockPatterns = useMemo(\n\t\t() =>\n\t\t\t[ ...( settingsBlockPatterns || [] ) ].filter(\n\t\t\t\t( { postTypes } ) => {\n\t\t\t\t\treturn (\n\t\t\t\t\t\t! postTypes ||\n\t\t\t\t\t\t( Array.isArray( postTypes ) &&\n\t\t\t\t\t\t\tpostTypes.includes( postType ) )\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t),\n\t\t[ settingsBlockPatterns, postType ]\n\t);\n\n\tconst blockPatternCategories = useMemo(\n\t\t() =>\n\t\t\t[\n\t\t\t\t...( settingsBlockPatternCategories || [] ),\n\t\t\t\t...( restBlockPatternCategories || [] ),\n\t\t\t].filter(\n\t\t\t\t( x, index, arr ) =>\n\t\t\t\t\tindex === arr.findIndex( ( y ) => x.name === y.name )\n\t\t\t),\n\t\t[ settingsBlockPatternCategories, restBlockPatternCategories ]\n\t);\n\n\tconst { undo, setIsInserterOpened } = useDispatch( editorStore );\n\n\tconst { saveEntityRecord } = useDispatch( coreStore );\n\n\t/**\n\t * Creates a Post entity.\n\t * This is utilised by the Link UI to allow for on-the-fly creation of Posts/Pages.\n\t *\n\t * @param {Object} options parameters for the post being created. These mirror those used on 3rd param of saveEntityRecord.\n\t * @return {Object} the post type object that was created.\n\t */\n\tconst createPageEntity = useCallback(\n\t\t( options ) => {\n\t\t\tif ( ! userCanCreatePages ) {\n\t\t\t\treturn Promise.reject( {\n\t\t\t\t\tmessage: __(\n\t\t\t\t\t\t'You do not have permission to create Pages.'\n\t\t\t\t\t),\n\t\t\t\t} );\n\t\t\t}\n\t\t\treturn saveEntityRecord( 'postType', 'page', options );\n\t\t},\n\t\t[ saveEntityRecord, userCanCreatePages ]\n\t);\n\n\tconst allowedBlockTypes = useMemo( () => {\n\t\t// Omit hidden block types if exists and non-empty.\n\t\tif ( hiddenBlockTypes && hiddenBlockTypes.length > 0 ) {\n\t\t\t// Defer to passed setting for `allowedBlockTypes` if provided as\n\t\t\t// anything other than `true` (where `true` is equivalent to allow\n\t\t\t// all block types).\n\t\t\tconst defaultAllowedBlockTypes =\n\t\t\t\ttrue === settings.allowedBlockTypes\n\t\t\t\t\t? blockTypes.map( ( { name } ) => name )\n\t\t\t\t\t: settings.allowedBlockTypes || [];\n\n\t\t\treturn defaultAllowedBlockTypes.filter(\n\t\t\t\t( type ) => ! hiddenBlockTypes.includes( type )\n\t\t\t);\n\t\t}\n\n\t\treturn settings.allowedBlockTypes;\n\t}, [ settings.allowedBlockTypes, hiddenBlockTypes, blockTypes ] );\n\n\tconst forceDisableFocusMode = settings.focusMode === false;\n\n\treturn useMemo( () => {\n\t\tconst blockEditorSettings = {\n\t\t\t...Object.fromEntries(\n\t\t\t\tObject.entries( settings ).filter( ( [ key ] ) =>\n\t\t\t\t\tBLOCK_EDITOR_SETTINGS.includes( key )\n\t\t\t\t)\n\t\t\t),\n\t\t\t[ globalStylesDataKey ]: globalStylesData,\n\t\t\t[ globalStylesLinksDataKey ]: globalStylesLinksData,\n\t\t\tallowedBlockTypes,\n\t\t\tallowRightClickOverrides,\n\t\t\tfocusMode: focusMode && ! forceDisableFocusMode,\n\t\t\thasFixedToolbar,\n\t\t\tisDistractionFree,\n\t\t\tkeepCaretInsideBlock,\n\t\t\tmediaUpload: hasUploadPermissions ? mediaUpload : undefined,\n\t\t\tmediaSideload: hasUploadPermissions ? mediaSideload : undefined,\n\t\t\t__experimentalBlockPatterns: blockPatterns,\n\t\t\t[ selectBlockPatternsKey ]: ( select ) => {\n\t\t\t\tconst { hasFinishedResolution, getBlockPatternsForPostType } =\n\t\t\t\t\tunlock( select( coreStore ) );\n\t\t\t\tconst patterns = getBlockPatternsForPostType( postType );\n\t\t\t\treturn hasFinishedResolution( 'getBlockPatterns' )\n\t\t\t\t\t? patterns\n\t\t\t\t\t: undefined;\n\t\t\t},\n\t\t\t[ reusableBlocksSelectKey ]: __experimentalReusableBlocksSelect,\n\t\t\t__experimentalBlockPatternCategories: blockPatternCategories,\n\t\t\t__experimentalUserPatternCategories: userPatternCategories,\n\t\t\t__experimentalFetchLinkSuggestions: ( search, searchOptions ) =>\n\t\t\t\tfetchLinkSuggestions( search, searchOptions, settings ),\n\t\t\tinserterMediaCategories,\n\t\t\t__experimentalFetchRichUrlData: fetchUrlData,\n\t\t\t// Todo: This only checks the top level post, not the post within a template or any other entity that can be edited.\n\t\t\t// This might be better as a generic \"canUser\" selector.\n\t\t\t__experimentalCanUserUseUnfilteredHTML: canUseUnfilteredHTML,\n\t\t\t//Todo: this is only needed for native and should probably be removed.\n\t\t\t__experimentalUndo: undo,\n\t\t\t// Check whether we want all site editor frames to have outlines\n\t\t\t// including the navigation / pattern / parts editors.\n\t\t\toutlineMode: ! isDistractionFree && postType === 'wp_template',\n\t\t\t// Check these two properties: they were not present in the site editor.\n\t\t\t__experimentalCreatePageEntity: createPageEntity,\n\t\t\t__experimentalUserCanCreatePages: userCanCreatePages,\n\t\t\tpageOnFront,\n\t\t\tpageForPosts,\n\t\t\t__experimentalPreferPatternsOnRoot: postType === 'wp_template',\n\t\t\ttemplateLock:\n\t\t\t\tpostType === 'wp_navigation' ? 'insert' : settings.templateLock,\n\t\t\ttemplate:\n\t\t\t\tpostType === 'wp_navigation'\n\t\t\t\t\t? [ [ 'core/navigation', {}, [] ] ]\n\t\t\t\t\t: settings.template,\n\t\t\t__experimentalSetIsInserterOpened: setIsInserterOpened,\n\t\t\t[ sectionRootClientIdKey ]: sectionRootClientId,\n\t\t\teditorTool:\n\t\t\t\trenderingMode === 'post-only' && postType !== 'wp_template'\n\t\t\t\t\t? 'edit'\n\t\t\t\t\t: undefined,\n\t\t};\n\n\t\treturn blockEditorSettings;\n\t}, [\n\t\tallowedBlockTypes,\n\t\tallowRightClickOverrides,\n\t\tfocusMode,\n\t\tforceDisableFocusMode,\n\t\thasFixedToolbar,\n\t\tisDistractionFree,\n\t\tkeepCaretInsideBlock,\n\t\tsettings,\n\t\thasUploadPermissions,\n\t\tuserPatternCategories,\n\t\tblockPatterns,\n\t\tblockPatternCategories,\n\t\tcanUseUnfilteredHTML,\n\t\tundo,\n\t\tcreatePageEntity,\n\t\tuserCanCreatePages,\n\t\tpageOnFront,\n\t\tpageForPosts,\n\t\tpostType,\n\t\tsetIsInserterOpened,\n\t\tsectionRootClientId,\n\t\tglobalStylesData,\n\t\tglobalStylesLinksData,\n\t\trenderingMode,\n\t] );\n}\n\nexport default useBlockEditorSettings;\n"],"mappings":";AAAA;AACA;AACA;AAC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AsB,GAAIyB,mBAAmB;MAC/CmF,UAAU,EACTvG,aAAa,KAAK,WAAW,IAAIF,QAAQ,KAAK,aAAa,GACxD,MAAM,GACNoC;IACL,CAAC;IAED,OAAOgD,mBAAmB;EAC3B,CAAC,EAAE,CACFN,iBAAiB,EACjBtE,wBAAwB,EACxBE,SAAS,EACTyE,qBAAqB,EACrBxE,eAAe,EACfC,iBAAiB,EACjBC,oBAAoB,EACpBd,QAAQ,EACRe,oBAAoB,EACpBM,qBAAqB,EACrBsC,aAAa,EACbM,sBAAsB,EACtBhD,oBAAoB,EACpBsD,IAAI,EACJG,gBAAgB,EAChBxD,kBAAkB,EAClBC,WAAW,EACXC,YAAY,EACZnB,QAAQ,EACRuE,mBAAmB,EACnBjD,mBAAmB,EACnB2B,gBAAgB,EAChBE,qBAAqB,EACrBjD,aAAa,CACZ,CAAC;AACJ;AAEA,eAAeJ,sBAAsB","ignoreList":[]}
@@ -1,14 +1,8 @@
1
- /* wp:polyfill */
2
1
  /**
3
2
  * WordPress dependencies
4
3
  */
5
- import { Modal } from '@wordpress/components';
6
- import { __ } from '@wordpress/i18n';
7
- import { useState, useMemo } from '@wordpress/element';
8
- import { store as blockEditorStore, __experimentalBlockPatternsList as BlockPatternsList } from '@wordpress/block-editor';
4
+ import { useEffect } from '@wordpress/element';
9
5
  import { useSelect, useDispatch } from '@wordpress/data';
10
- import { store as coreStore } from '@wordpress/core-data';
11
- import { __unstableSerializeAndClean } from '@wordpress/blocks';
12
6
  import { store as preferencesStore } from '@wordpress/preferences';
13
7
  import { store as interfaceStore } from '@wordpress/interface';
14
8
 
@@ -16,115 +10,35 @@ import { store as interfaceStore } from '@wordpress/interface';
16
10
  * Internal dependencies
17
11
  */
18
12
  import { store as editorStore } from '../../store';
19
- import { TEMPLATE_POST_TYPE } from '../../store/constants';
20
- import { jsx as _jsx } from "react/jsx-runtime";
21
- export function useStartPatterns() {
22
- // A pattern is a start pattern if it includes 'core/post-content' in its blockTypes,
23
- // and it has no postTypes declared and the current post type is page or if
24
- // the current post type is part of the postTypes declared.
25
- const {
26
- blockPatternsWithPostContentBlockType,
27
- postType
28
- } = useSelect(select => {
29
- const {
30
- getPatternsByBlockTypes,
31
- getBlocksByName
32
- } = select(blockEditorStore);
33
- const {
34
- getCurrentPostType,
35
- getRenderingMode
36
- } = select(editorStore);
37
- const rootClientId = getRenderingMode() === 'post-only' ? '' : getBlocksByName('core/post-content')?.[0];
38
- return {
39
- blockPatternsWithPostContentBlockType: getPatternsByBlockTypes('core/post-content', rootClientId),
40
- postType: getCurrentPostType()
41
- };
42
- }, []);
43
- return useMemo(() => {
44
- if (!blockPatternsWithPostContentBlockType?.length) {
45
- return [];
46
- }
47
-
48
- /*
49
- * Filter patterns without postTypes declared if the current postType is page
50
- * or patterns that declare the current postType in its post type array.
51
- */
52
- return blockPatternsWithPostContentBlockType.filter(pattern => {
53
- return postType === 'page' && !pattern.postTypes || Array.isArray(pattern.postTypes) && pattern.postTypes.includes(postType);
54
- });
55
- }, [postType, blockPatternsWithPostContentBlockType]);
56
- }
57
- function PatternSelection({
58
- blockPatterns,
59
- onChoosePattern
60
- }) {
61
- const {
62
- editEntityRecord
63
- } = useDispatch(coreStore);
13
+ export default function StartPageOptions() {
64
14
  const {
65
- postType,
66
- postId
15
+ postId,
16
+ shouldEnable
67
17
  } = useSelect(select => {
68
- const {
69
- getCurrentPostType,
70
- getCurrentPostId
71
- } = select(editorStore);
72
- return {
73
- postType: getCurrentPostType(),
74
- postId: getCurrentPostId()
75
- };
76
- }, []);
77
- return /*#__PURE__*/_jsx(BlockPatternsList, {
78
- blockPatterns: blockPatterns,
79
- onClickPattern: (_pattern, blocks) => {
80
- editEntityRecord('postType', postType, postId, {
81
- blocks,
82
- content: ({
83
- blocks: blocksForSerialization = []
84
- }) => __unstableSerializeAndClean(blocksForSerialization)
85
- });
86
- onChoosePattern();
87
- }
88
- });
89
- }
90
- function StartPageOptionsModal({
91
- onClose
92
- }) {
93
- const startPatterns = useStartPatterns();
94
- const hasStartPattern = startPatterns.length > 0;
95
- if (!hasStartPattern) {
96
- return null;
97
- }
98
- return /*#__PURE__*/_jsx(Modal, {
99
- title: __('Choose a pattern'),
100
- isFullScreen: true,
101
- onRequestClose: onClose,
102
- children: /*#__PURE__*/_jsx("div", {
103
- className: "editor-start-page-options__modal-content",
104
- children: /*#__PURE__*/_jsx(PatternSelection, {
105
- blockPatterns: startPatterns,
106
- onChoosePattern: onClose
107
- })
108
- })
109
- });
110
- }
111
- export default function StartPageOptions() {
112
- const [isClosed, setIsClosed] = useState(false);
113
- const shouldEnableModal = useSelect(select => {
114
18
  const {
115
19
  isEditedPostDirty,
116
20
  isEditedPostEmpty,
21
+ getCurrentPostId,
117
22
  getCurrentPostType
118
23
  } = select(editorStore);
119
24
  const preferencesModalActive = select(interfaceStore).isModalActive('editor/preferences');
120
25
  const choosePatternModalEnabled = select(preferencesStore).get('core', 'enableChoosePatternModal');
121
- return choosePatternModalEnabled && !preferencesModalActive && !isEditedPostDirty() && isEditedPostEmpty() && TEMPLATE_POST_TYPE !== getCurrentPostType();
26
+ return {
27
+ postId: getCurrentPostId(),
28
+ shouldEnable: choosePatternModalEnabled && !preferencesModalActive && !isEditedPostDirty() && isEditedPostEmpty() && 'page' === getCurrentPostType()
29
+ };
122
30
  }, []);
123
- if (!shouldEnableModal || isClosed) {
124
- return null;
125
- }
126
- return /*#__PURE__*/_jsx(StartPageOptionsModal, {
127
- onClose: () => setIsClosed(true)
128
- });
31
+ const {
32
+ setIsInserterOpened
33
+ } = useDispatch(editorStore);
34
+ useEffect(() => {
35
+ if (shouldEnable) {
36
+ setIsInserterOpened({
37
+ tab: 'patterns',
38
+ category: 'core/starter-content'
39
+ });
40
+ }
41
+ }, [postId, shouldEnable, setIsInserterOpened]);
42
+ return null;
129
43
  }
130
44
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["Modal","__","useState","useMemo","store","blockEditorStore","__experimentalBlockPatternsList","BlockPatternsList","useSelect","useDispatch","coreStore","__unstableSerializeAndClean","preferencesStore","interfaceStore","editorStore","TEMPLATE_POST_TYPE","jsx","_jsx","useStartPatterns","blockPatternsWithPostContentBlockType","postType","select","getPatternsByBlockTypes","getBlocksByName","getCurrentPostType","getRenderingMode","rootClientId","length","filter","pattern","postTypes","Array","isArray","includes","PatternSelection","blockPatterns","onChoosePattern","editEntityRecord","postId","getCurrentPostId","onClickPattern","_pattern","blocks","content","blocksForSerialization","StartPageOptionsModal","onClose","startPatterns","hasStartPattern","title","isFullScreen","onRequestClose","children","className","StartPageOptions","isClosed","setIsClosed","shouldEnableModal","isEditedPostDirty","isEditedPostEmpty","preferencesModalActive","isModalActive","choosePatternModalEnabled","get"],"sources":["@wordpress/editor/src/components/start-page-options/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { Modal } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { useState, useMemo } from '@wordpress/element';\nimport {\n\tstore as blockEditorStore,\n\t__experimentalBlockPatternsList as BlockPatternsList,\n} from '@wordpress/block-editor';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { __unstableSerializeAndClean } from '@wordpress/blocks';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport { store as interfaceStore } from '@wordpress/interface';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\nimport { TEMPLATE_POST_TYPE } from '../../store/constants';\n\nexport function useStartPatterns() {\n\t// A pattern is a start pattern if it includes 'core/post-content' in its blockTypes,\n\t// and it has no postTypes declared and the current post type is page or if\n\t// the current post type is part of the postTypes declared.\n\tconst { blockPatternsWithPostContentBlockType, postType } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getPatternsByBlockTypes, getBlocksByName } =\n\t\t\t\tselect( blockEditorStore );\n\t\t\tconst { getCurrentPostType, getRenderingMode } =\n\t\t\t\tselect( editorStore );\n\t\t\tconst rootClientId =\n\t\t\t\tgetRenderingMode() === 'post-only'\n\t\t\t\t\t? ''\n\t\t\t\t\t: getBlocksByName( 'core/post-content' )?.[ 0 ];\n\t\t\treturn {\n\t\t\t\tblockPatternsWithPostContentBlockType: getPatternsByBlockTypes(\n\t\t\t\t\t'core/post-content',\n\t\t\t\t\trootClientId\n\t\t\t\t),\n\t\t\t\tpostType: getCurrentPostType(),\n\t\t\t};\n\t\t},\n\t\t[]\n\t);\n\n\treturn useMemo( () => {\n\t\tif ( ! blockPatternsWithPostContentBlockType?.length ) {\n\t\t\treturn [];\n\t\t}\n\n\t\t/*\n\t\t * Filter patterns without postTypes declared if the current postType is page\n\t\t * or patterns that declare the current postType in its post type array.\n\t\t */\n\t\treturn blockPatternsWithPostContentBlockType.filter( ( pattern ) => {\n\t\t\treturn (\n\t\t\t\t( postType === 'page' && ! pattern.postTypes ) ||\n\t\t\t\t( Array.isArray( pattern.postTypes ) &&\n\t\t\t\t\tpattern.postTypes.includes( postType ) )\n\t\t\t);\n\t\t} );\n\t}, [ postType, blockPatternsWithPostContentBlockType ] );\n}\n\nfunction PatternSelection( { blockPatterns, onChoosePattern } ) {\n\tconst { editEntityRecord } = useDispatch( coreStore );\n\tconst { postType, postId } = useSelect( ( select ) => {\n\t\tconst { getCurrentPostType, getCurrentPostId } = select( editorStore );\n\n\t\treturn {\n\t\t\tpostType: getCurrentPostType(),\n\t\t\tpostId: getCurrentPostId(),\n\t\t};\n\t}, [] );\n\treturn (\n\t\t<BlockPatternsList\n\t\t\tblockPatterns={ blockPatterns }\n\t\t\tonClickPattern={ ( _pattern, blocks ) => {\n\t\t\t\teditEntityRecord( 'postType', postType, postId, {\n\t\t\t\t\tblocks,\n\t\t\t\t\tcontent: ( { blocks: blocksForSerialization = [] } ) =>\n\t\t\t\t\t\t__unstableSerializeAndClean( blocksForSerialization ),\n\t\t\t\t} );\n\t\t\t\tonChoosePattern();\n\t\t\t} }\n\t\t/>\n\t);\n}\n\nfunction StartPageOptionsModal( { onClose } ) {\n\tconst startPatterns = useStartPatterns();\n\tconst hasStartPattern = startPatterns.length > 0;\n\n\tif ( ! hasStartPattern ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<Modal\n\t\t\ttitle={ __( 'Choose a pattern' ) }\n\t\t\tisFullScreen\n\t\t\tonRequestClose={ onClose }\n\t\t>\n\t\t\t<div className=\"editor-start-page-options__modal-content\">\n\t\t\t\t<PatternSelection\n\t\t\t\t\tblockPatterns={ startPatterns }\n\t\t\t\t\tonChoosePattern={ onClose }\n\t\t\t\t/>\n\t\t\t</div>\n\t\t</Modal>\n\t);\n}\n\nexport default function StartPageOptions() {\n\tconst [ isClosed, setIsClosed ] = useState( false );\n\tconst shouldEnableModal = useSelect( ( select ) => {\n\t\tconst { isEditedPostDirty, isEditedPostEmpty, getCurrentPostType } =\n\t\t\tselect( editorStore );\n\t\tconst preferencesModalActive =\n\t\t\tselect( interfaceStore ).isModalActive( 'editor/preferences' );\n\t\tconst choosePatternModalEnabled = select( preferencesStore ).get(\n\t\t\t'core',\n\t\t\t'enableChoosePatternModal'\n\t\t);\n\t\treturn (\n\t\t\tchoosePatternModalEnabled &&\n\t\t\t! preferencesModalActive &&\n\t\t\t! isEditedPostDirty() &&\n\t\t\tisEditedPostEmpty() &&\n\t\t\tTEMPLATE_POST_TYPE !== getCurrentPostType()\n\t\t);\n\t}, [] );\n\n\tif ( ! shouldEnableModal || isClosed ) {\n\t\treturn null;\n\t}\n\n\treturn <StartPageOptionsModal onClose={ () => setIsClosed( true ) } />;\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,KAAK,QAAQ,uBAAuB;AAC7C,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SAASC,QAAQ,EAAEC,OAAO,QAAQ,oBAAoB;AACtD,SACCC,KAAK,IAAIC,gBAAgB,EACzBC,+BAA+B,IAAIC,iBAAiB,QAC9C,yBAAyB;AAChC,SAASC,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACxD,SAASL,KAAK,IAAIM,SAAS,QAAQ,sBAAsB;AAC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S,EAAC,0CAA0C;MAAAD,QAAA,eACxDnC,IAAA,CAACiB,gBAAgB;QAChBC,aAAa,EAAGY,aAAe;QAC/BX,eAAe,EAAGU;MAAS,CAC3B;IAAC,CACE;EAAC,CACA,CAAC;AAEV;AAEA,eAAe,SAASQ,gBAAgBA,CAAA,EAAG;EAC1C,MAAM,CAAEC,QAAQ,EAAEC,WAAW,CAAE,GAAGtD,QAAQ,CAAE,KAAM,CAAC;EACnD,MAAMuD,iBAAiB,GAAGjD,SAAS,CAAIa,MAAM,IAAM;IAClD,MAAM;MAAEqC,iBAAiB;MAAEC,iBAAiB;MAAEnC;IAAmB,CAAC,GACjEH,MAAM,CAAEP,WAAY,CAAC;IACtB,MAAM8C,sBAAsB,GAC3BvC,MAAM,CAAER,cAAe,CAAC,CAACgD,aAAa,CAAE,oBAAqB,CAAC;IAC/D,MAAMC,yBAAyB,GAAGzC,MAAM,CAAET,gBAAiB,CAAC,CAACmD,GAAG,CAC/D,MAAM,EACN,0BACD,CAAC;IACD,OACCD,yBAAyB,IACzB,CAAEF,sBAAsB,IACxB,CAAEF,iBAAiB,CAAC,CAAC,IACrBC,iBAAiB,CAAC,CAAC,IACnB5C,kBAAkB,KAAKS,kBAAkB,CAAC,CAAC;EAE7C,CAAC,EAAE,EAAG,CAAC;EAEP,IAAK,CAAEiC,iBAAiB,IAAIF,QAAQ,EAAG;IACtC,OAAO,IAAI;EACZ;EAEA,oBAAOtC,IAAA,CAAC4B,qBAAqB;IAACC,OAAO,EAAGA,CAAA,KAAMU,WAAW,CAAE,IAAK;EAAG,CAAE,CAAC;AACvE","ignoreList":[]}
1
+ {"version":3,"names":["useEffect","useSelect","useDispatch","store","preferencesStore","interfaceStore","editorStore","StartPageOptions","postId","shouldEnable","select","isEditedPostDirty","isEditedPostEmpty","getCurrentPostId","getCurrentPostType","preferencesModalActive","isModalActive","choosePatternModalEnabled","get","setIsInserterOpened","tab","category"],"sources":["@wordpress/editor/src/components/start-page-options/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useEffect } from '@wordpress/element';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport { store as interfaceStore } from '@wordpress/interface';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\n\nexport default function StartPageOptions() {\n\tconst { postId, shouldEnable } = useSelect( ( select ) => {\n\t\tconst {\n\t\t\tisEditedPostDirty,\n\t\t\tisEditedPostEmpty,\n\t\t\tgetCurrentPostId,\n\t\t\tgetCurrentPostType,\n\t\t} = select( editorStore );\n\t\tconst preferencesModalActive =\n\t\t\tselect( interfaceStore ).isModalActive( 'editor/preferences' );\n\t\tconst choosePatternModalEnabled = select( preferencesStore ).get(\n\t\t\t'core',\n\t\t\t'enableChoosePatternModal'\n\t\t);\n\t\treturn {\n\t\t\tpostId: getCurrentPostId(),\n\t\t\tshouldEnable:\n\t\t\t\tchoosePatternModalEnabled &&\n\t\t\t\t! preferencesModalActive &&\n\t\t\t\t! isEditedPostDirty() &&\n\t\t\t\tisEditedPostEmpty() &&\n\t\t\t\t'page' === getCurrentPostType(),\n\t\t};\n\t}, [] );\n\tconst { setIsInserterOpened } = useDispatch( editorStore );\n\n\tuseEffect( () => {\n\t\tif ( shouldEnable ) {\n\t\t\tsetIsInserterOpened( {\n\t\t\t\ttab: 'patterns',\n\t\t\t\tcategory: 'core/starter-content',\n\t\t\t} );\n\t\t}\n\t}, [ postId, shouldEnable, setIsInserterOpened ] );\n\n\treturn null;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,SAAS,QAAQ,oBAAoB;AAC9C,SAASC,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACxD,SAASC,KAAK,IAAIC,gBAAgB,QAAQ,wBAAwB;AAClE,SAASD,KAAK,IAAIE,cAAc,QAAQ,sBAAsB;;AAE9D;AACA;AACA;AACA,SAASF,KAAK,IAAIG,WAAW,QAAQ,aAAa;AAElD,eAAe,SAASC,gBAAgBA,CAAA,EAAG;EAC1C,MAAM;IAAEC,MAAM;IAAEC;EAAa,CAAC,GAAGR,SAAS,CAAIS,MAAM,IAAM;IACzD,MAAM;MACLC,iBAAiB;MACjBC,iBAAiB;MACjBC,gBAAgB;MAChBC;IACD,CAAC,GAAGJ,MAAM,CAAEJ,WAAY,CAAC;IACzB,MAAMS,sBAAsB,GAC3BL,MAAM,CAAEL,cAAe,CAAC,CAACW,aAAa,CAAE,oBAAqB,CAAC;IAC/D,MAAMC,yBAAyB,GAAGP,MAAM,CAAEN,gBAAiB,CAAC,CAACc,GAAG,CAC/D,MAAM,EACN,0BACD,CAAC;IACD,OAAO;MACNV,MAAM,EAAEK,gBAAgB,CAAC,CAAC;MAC1BJ,YAAY,EACXQ,yBAAyB,IACzB,CAAEF,sBAAsB,IACxB,CAAEJ,iBAAiB,CAAC,CAAC,IACrBC,iBAAiB,CAAC,CAAC,IACnB,MAAM,KAAKE,kBAAkB,CAAC;IAChC,CAAC;EACF,CAAC,EAAE,EAAG,CAAC;EACP,MAAM;IAAEK;EAAoB,CAAC,GAAGjB,WAAW,CAAEI,WAAY,CAAC;EAE1DN,SAAS,CAAE,MAAM;IAChB,IAAKS,YAAY,EAAG;MACnBU,mBAAmB,CAAE;QACpBC,GAAG,EAAE,UAAU;QACfC,QAAQ,EAAE;MACX,CAAE,CAAC;IACJ;EACD,CAAC,EAAE,CAAEb,MAAM,EAAEC,YAAY,EAAEU,mBAAmB,CAAG,CAAC;EAElD,OAAO,IAAI;AACZ","ignoreList":[]}
@@ -26,24 +26,16 @@ function TemplatePartConverterMenuItem({
26
26
  onClose
27
27
  }) {
28
28
  const {
29
- isContentOnly,
30
29
  blocks
31
30
  } = useSelect(select => {
32
31
  const {
33
- getBlocksByClientId,
34
- getBlockEditingMode
32
+ getBlocksByClientId
35
33
  } = select(blockEditorStore);
36
34
  return {
37
- blocks: getBlocksByClientId(clientIds),
38
- isContentOnly: clientIds.length === 1 && getBlockEditingMode(clientIds[0]) === 'contentOnly'
35
+ blocks: getBlocksByClientId(clientIds)
39
36
  };
40
37
  }, [clientIds]);
41
38
 
42
- // Do not show the convert button if the block is in content-only mode.
43
- if (isContentOnly) {
44
- return null;
45
- }
46
-
47
39
  // Allow converting a single template part to standard blocks.
48
40
  if (blocks.length === 1 && blocks[0]?.name === 'core/template-part') {
49
41
  return /*#__PURE__*/_jsx(ConvertToRegularBlocks, {
@@ -1 +1 @@
1
- {"version":3,"names":["useSelect","BlockSettingsMenuControls","store","blockEditorStore","ConvertToRegularBlocks","ConvertToTemplatePart","jsx","_jsx","TemplatePartMenuItems","children","selectedClientIds","onClose","TemplatePartConverterMenuItem","clientIds","isContentOnly","blocks","select","getBlocksByClientId","getBlockEditingMode","length","name","clientId"],"sources":["@wordpress/editor/src/components/template-part-menu-items/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport {\n\tBlockSettingsMenuControls,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport ConvertToRegularBlocks from './convert-to-regular';\nimport ConvertToTemplatePart from './convert-to-template-part';\n\nexport default function TemplatePartMenuItems() {\n\treturn (\n\t\t<BlockSettingsMenuControls>\n\t\t\t{ ( { selectedClientIds, onClose } ) => (\n\t\t\t\t<TemplatePartConverterMenuItem\n\t\t\t\t\tclientIds={ selectedClientIds }\n\t\t\t\t\tonClose={ onClose }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</BlockSettingsMenuControls>\n\t);\n}\n\nfunction TemplatePartConverterMenuItem( { clientIds, onClose } ) {\n\tconst { isContentOnly, blocks } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getBlocksByClientId, getBlockEditingMode } =\n\t\t\t\tselect( blockEditorStore );\n\t\t\treturn {\n\t\t\t\tblocks: getBlocksByClientId( clientIds ),\n\t\t\t\tisContentOnly:\n\t\t\t\t\tclientIds.length === 1 &&\n\t\t\t\t\tgetBlockEditingMode( clientIds[ 0 ] ) === 'contentOnly',\n\t\t\t};\n\t\t},\n\t\t[ clientIds ]\n\t);\n\n\t// Do not show the convert button if the block is in content-only mode.\n\tif ( isContentOnly ) {\n\t\treturn null;\n\t}\n\n\t// Allow converting a single template part to standard blocks.\n\tif ( blocks.length === 1 && blocks[ 0 ]?.name === 'core/template-part' ) {\n\t\treturn (\n\t\t\t<ConvertToRegularBlocks\n\t\t\t\tclientId={ clientIds[ 0 ] }\n\t\t\t\tonClose={ onClose }\n\t\t\t/>\n\t\t);\n\t}\n\treturn <ConvertToTemplatePart clientIds={ clientIds } blocks={ blocks } />;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,SAAS,QAAQ,iBAAiB;AAC3C,SACCC,yBAAyB,EACzBC,KAAK,IAAIC,gBAAgB,QACnB,yBAAyB;;AAEhC;AACA;AACA;AACA,OAAOC,sBAAsB,MAAM,sBAAsB;AACzD,OAAOC,qBAAqB,MAAM,4BAA4B;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAE/D,eAAe,SAASC,qBAAqBA,CAAA,EAAG;EAC/C,oBACCD,IAAA,CAACN,yBAAyB;IAAAQ,QAAA,EACvBA,CAAE;MAAEC,iBAAiB;MAAEC;IAAQ,CAAC,kBACjCJ,IAAA,CAACK,6BAA6B;MAC7BC,SAAS,EAAGH,iBAAmB;MAC/BC,OAAO,EAAGA;IAAS,CACnB;EACD,CACyB,CAAC;AAE9B;AAEA,SAASC,6BAA6BA,CAAE;EAAEC,SAAS;EAAEF;AAAQ,CAAC,EAAG;EAChE,MAAM;IAAEG,aAAa;IAAEC;EAAO,CAAC,GAAGf,SAAS,CACxCgB,MAAM,IAAM;IACb,MAAM;MAAEC,mBAAmB;MAAEC;IAAoB,CAAC,GACjDF,MAAM,CAAEb,gBAAiB,CAAC;IAC3B,OAAO;MACNY,MAAM,EAAEE,mBAAmB,CAAEJ,SAAU,CAAC;MACxCC,aAAa,EACZD,SAAS,CAACM,MAAM,KAAK,CAAC,IACtBD,mBAAmB,CAAEL,SAAS,CAAE,CAAC,CAAG,CAAC,KAAK;IAC5C,CAAC;EACF,CAAC,EACD,CAAEA,SAAS,CACZ,CAAC;;EAED;EACA,IAAKC,aAAa,EAAG;IACpB,OAAO,IAAI;EACZ;;EAEA;EACA,IAAKC,MAAM,CAACI,MAAM,KAAK,CAAC,IAAIJ,MAAM,CAAE,CAAC,CAAE,EAAEK,IAAI,KAAK,oBAAoB,EAAG;IACxE,oBACCb,IAAA,CAACH,sBAAsB;MACtBiB,QAAQ,EAAGR,SAAS,CAAE,CAAC,CAAI;MAC3BF,OAAO,EAAGA;IAAS,CACnB,CAAC;EAEJ;EACA,oBAAOJ,IAAA,CAACF,qBAAqB;IAACQ,SAAS,EAAGA,SAAW;IAACE,MAAM,EAAGA;EAAQ,CAAE,CAAC;AAC3E","ignoreList":[]}
1
+ {"version":3,"names":["useSelect","BlockSettingsMenuControls","store","blockEditorStore","ConvertToRegularBlocks","ConvertToTemplatePart","jsx","_jsx","TemplatePartMenuItems","children","selectedClientIds","onClose","TemplatePartConverterMenuItem","clientIds","blocks","select","getBlocksByClientId","length","name","clientId"],"sources":["@wordpress/editor/src/components/template-part-menu-items/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport {\n\tBlockSettingsMenuControls,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport ConvertToRegularBlocks from './convert-to-regular';\nimport ConvertToTemplatePart from './convert-to-template-part';\n\nexport default function TemplatePartMenuItems() {\n\treturn (\n\t\t<BlockSettingsMenuControls>\n\t\t\t{ ( { selectedClientIds, onClose } ) => (\n\t\t\t\t<TemplatePartConverterMenuItem\n\t\t\t\t\tclientIds={ selectedClientIds }\n\t\t\t\t\tonClose={ onClose }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</BlockSettingsMenuControls>\n\t);\n}\n\nfunction TemplatePartConverterMenuItem( { clientIds, onClose } ) {\n\tconst { blocks } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getBlocksByClientId } = select( blockEditorStore );\n\t\t\treturn {\n\t\t\t\tblocks: getBlocksByClientId( clientIds ),\n\t\t\t};\n\t\t},\n\t\t[ clientIds ]\n\t);\n\n\t// Allow converting a single template part to standard blocks.\n\tif ( blocks.length === 1 && blocks[ 0 ]?.name === 'core/template-part' ) {\n\t\treturn (\n\t\t\t<ConvertToRegularBlocks\n\t\t\t\tclientId={ clientIds[ 0 ] }\n\t\t\t\tonClose={ onClose }\n\t\t\t/>\n\t\t);\n\t}\n\treturn <ConvertToTemplatePart clientIds={ clientIds } blocks={ blocks } />;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,SAAS,QAAQ,iBAAiB;AAC3C,SACCC,yBAAyB,EACzBC,KAAK,IAAIC,gBAAgB,QACnB,yBAAyB;;AAEhC;AACA;AACA;AACA,OAAOC,sBAAsB,MAAM,sBAAsB;AACzD,OAAOC,qBAAqB,MAAM,4BAA4B;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAE/D,eAAe,SAASC,qBAAqBA,CAAA,EAAG;EAC/C,oBACCD,IAAA,CAACN,yBAAyB;IAAAQ,QAAA,EACvBA,CAAE;MAAEC,iBAAiB;MAAEC;IAAQ,CAAC,kBACjCJ,IAAA,CAACK,6BAA6B;MAC7BC,SAAS,EAAGH,iBAAmB;MAC/BC,OAAO,EAAGA;IAAS,CACnB;EACD,CACyB,CAAC;AAE9B;AAEA,SAASC,6BAA6BA,CAAE;EAAEC,SAAS;EAAEF;AAAQ,CAAC,EAAG;EAChE,MAAM;IAAEG;EAAO,CAAC,GAAGd,SAAS,CACzBe,MAAM,IAAM;IACb,MAAM;MAAEC;IAAoB,CAAC,GAAGD,MAAM,CAAEZ,gBAAiB,CAAC;IAC1D,OAAO;MACNW,MAAM,EAAEE,mBAAmB,CAAEH,SAAU;IACxC,CAAC;EACF,CAAC,EACD,CAAEA,SAAS,CACZ,CAAC;;EAED;EACA,IAAKC,MAAM,CAACG,MAAM,KAAK,CAAC,IAAIH,MAAM,CAAE,CAAC,CAAE,EAAEI,IAAI,KAAK,oBAAoB,EAAG;IACxE,oBACCX,IAAA,CAACH,sBAAsB;MACtBe,QAAQ,EAAGN,SAAS,CAAE,CAAC,CAAI;MAC3BF,OAAO,EAAGA;IAAS,CACnB,CAAC;EAEJ;EACA,oBAAOJ,IAAA,CAACF,qBAAqB;IAACQ,SAAS,EAAGA,SAAW;IAACC,MAAM,EAAGA;EAAQ,CAAE,CAAC;AAC3E","ignoreList":[]}
@@ -16,7 +16,6 @@ import { __ } from '@wordpress/i18n';
16
16
  /**
17
17
  * Internal dependencies
18
18
  */
19
- import { TRASH_POST_NOTICE_ID } from './constants';
20
19
  import { localAutosaveSet } from './local-autosave';
21
20
  import { getNotificationArgumentsForSaveSuccess, getNotificationArgumentsForSaveFail, getNotificationArgumentsForTrashFail } from './utils/notice-builder';
22
21
  import { unlock } from '../lock-unlock';
@@ -304,7 +303,6 @@ export const trashPost = () => async ({
304
303
  }) => {
305
304
  const postTypeSlug = select.getCurrentPostType();
306
305
  const postType = await registry.resolveSelect(coreStore).getPostType(postTypeSlug);
307
- registry.dispatch(noticesStore).removeNotice(TRASH_POST_NOTICE_ID);
308
306
  const {
309
307
  rest_base: restBase,
310
308
  rest_namespace: restNamespace = 'wp/v2'