@wordpress/editor 14.15.1 → 14.17.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 (215) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/README.md +20 -20
  3. package/build/bindings/pattern-overrides.js +1 -1
  4. package/build/bindings/pattern-overrides.js.map +1 -1
  5. package/build/components/collab-sidebar/index.js +1 -4
  6. package/build/components/collab-sidebar/index.js.map +1 -1
  7. package/build/components/document-outline/check.js +3 -3
  8. package/build/components/document-outline/check.js.map +1 -1
  9. package/build/components/document-outline/index.js +2 -2
  10. package/build/components/document-outline/index.js.map +1 -1
  11. package/build/components/header/index.js +14 -8
  12. package/build/components/header/index.js.map +1 -1
  13. package/build/components/page-attributes/check.js +3 -3
  14. package/build/components/page-attributes/check.js.map +1 -1
  15. package/build/components/post-excerpt/index.js +1 -1
  16. package/build/components/post-excerpt/index.js.map +1 -1
  17. package/build/components/post-pending-status/check.js +3 -3
  18. package/build/components/post-pending-status/check.js.map +1 -1
  19. package/build/components/post-preview-button/index.js +7 -1
  20. package/build/components/post-preview-button/index.js.map +1 -1
  21. package/build/components/post-publish-button/index.js +2 -2
  22. package/build/components/post-publish-button/index.js.map +1 -1
  23. package/build/components/post-publish-button/post-publish-button-or-toggle.js +1 -1
  24. package/build/components/post-publish-button/post-publish-button-or-toggle.js.map +1 -1
  25. package/build/components/post-schedule/check.js +3 -3
  26. package/build/components/post-schedule/check.js.map +1 -1
  27. package/build/components/post-schedule/index.js +1 -1
  28. package/build/components/post-schedule/index.js.map +1 -1
  29. package/build/components/post-sticky/check.js +3 -3
  30. package/build/components/post-sticky/check.js.map +1 -1
  31. package/build/components/post-taxonomies/check.js +1 -1
  32. package/build/components/post-taxonomies/check.js.map +1 -1
  33. package/build/components/post-template/swap-template-button.js +1 -1
  34. package/build/components/post-template/swap-template-button.js.map +1 -1
  35. package/build/components/post-trash/check.js +3 -3
  36. package/build/components/post-trash/check.js.map +1 -1
  37. package/build/components/post-type-support-check/index.js +6 -6
  38. package/build/components/post-type-support-check/index.js.map +1 -1
  39. package/build/components/post-url/check.js +3 -3
  40. package/build/components/post-url/check.js.map +1 -1
  41. package/build/components/preferences-modal/index.js +1 -1
  42. package/build/components/preferences-modal/index.js.map +1 -1
  43. package/build/components/provider/index.js +25 -17
  44. package/build/components/provider/index.js.map +1 -1
  45. package/build/components/sidebar/post-summary.js +1 -1
  46. package/build/components/sidebar/post-summary.js.map +1 -1
  47. package/build/components/start-page-options/index.js +15 -6
  48. package/build/components/start-page-options/index.js.map +1 -1
  49. package/build/components/theme-support-check/index.js +4 -4
  50. package/build/components/theme-support-check/index.js.map +1 -1
  51. package/build/components/visual-editor/edit-template-blocks-notification.js +1 -1
  52. package/build/components/visual-editor/edit-template-blocks-notification.js.map +1 -1
  53. package/build/components/visual-editor/index.js +2 -2
  54. package/build/components/visual-editor/index.js.map +1 -1
  55. package/build/dataviews/fields/content-preview/content-preview-view.js +101 -0
  56. package/build/dataviews/fields/content-preview/content-preview-view.js.map +1 -0
  57. package/build/dataviews/fields/content-preview/index.js +26 -0
  58. package/build/dataviews/fields/content-preview/index.js.map +1 -0
  59. package/build/dataviews/store/private-actions.js +3 -1
  60. package/build/dataviews/store/private-actions.js.map +1 -1
  61. package/build/store/private-actions.js +1 -1
  62. package/build/store/private-actions.js.map +1 -1
  63. package/build/store/private-selectors.js +7 -1
  64. package/build/store/private-selectors.js.map +1 -1
  65. package/build/store/selectors.js +4 -4
  66. package/build/store/selectors.js.map +1 -1
  67. package/build-module/bindings/pattern-overrides.js +1 -1
  68. package/build-module/bindings/pattern-overrides.js.map +1 -1
  69. package/build-module/components/collab-sidebar/index.js +1 -4
  70. package/build-module/components/collab-sidebar/index.js.map +1 -1
  71. package/build-module/components/document-outline/check.js +3 -3
  72. package/build-module/components/document-outline/check.js.map +1 -1
  73. package/build-module/components/document-outline/index.js +2 -2
  74. package/build-module/components/document-outline/index.js.map +1 -1
  75. package/build-module/components/header/index.js +14 -8
  76. package/build-module/components/header/index.js.map +1 -1
  77. package/build-module/components/page-attributes/check.js +3 -3
  78. package/build-module/components/page-attributes/check.js.map +1 -1
  79. package/build-module/components/post-excerpt/index.js +1 -1
  80. package/build-module/components/post-excerpt/index.js.map +1 -1
  81. package/build-module/components/post-pending-status/check.js +3 -3
  82. package/build-module/components/post-pending-status/check.js.map +1 -1
  83. package/build-module/components/post-preview-button/index.js +7 -1
  84. package/build-module/components/post-preview-button/index.js.map +1 -1
  85. package/build-module/components/post-publish-button/index.js +2 -2
  86. package/build-module/components/post-publish-button/index.js.map +1 -1
  87. package/build-module/components/post-publish-button/post-publish-button-or-toggle.js +1 -1
  88. package/build-module/components/post-publish-button/post-publish-button-or-toggle.js.map +1 -1
  89. package/build-module/components/post-schedule/check.js +3 -3
  90. package/build-module/components/post-schedule/check.js.map +1 -1
  91. package/build-module/components/post-schedule/index.js +1 -1
  92. package/build-module/components/post-schedule/index.js.map +1 -1
  93. package/build-module/components/post-sticky/check.js +3 -3
  94. package/build-module/components/post-sticky/check.js.map +1 -1
  95. package/build-module/components/post-taxonomies/check.js +1 -1
  96. package/build-module/components/post-taxonomies/check.js.map +1 -1
  97. package/build-module/components/post-template/swap-template-button.js +1 -1
  98. package/build-module/components/post-template/swap-template-button.js.map +1 -1
  99. package/build-module/components/post-trash/check.js +3 -3
  100. package/build-module/components/post-trash/check.js.map +1 -1
  101. package/build-module/components/post-type-support-check/index.js +6 -6
  102. package/build-module/components/post-type-support-check/index.js.map +1 -1
  103. package/build-module/components/post-url/check.js +3 -3
  104. package/build-module/components/post-url/check.js.map +1 -1
  105. package/build-module/components/preferences-modal/index.js +1 -1
  106. package/build-module/components/preferences-modal/index.js.map +1 -1
  107. package/build-module/components/provider/index.js +25 -17
  108. package/build-module/components/provider/index.js.map +1 -1
  109. package/build-module/components/sidebar/post-summary.js +1 -1
  110. package/build-module/components/sidebar/post-summary.js.map +1 -1
  111. package/build-module/components/start-page-options/index.js +15 -6
  112. package/build-module/components/start-page-options/index.js.map +1 -1
  113. package/build-module/components/theme-support-check/index.js +4 -4
  114. package/build-module/components/theme-support-check/index.js.map +1 -1
  115. package/build-module/components/visual-editor/edit-template-blocks-notification.js +1 -1
  116. package/build-module/components/visual-editor/edit-template-blocks-notification.js.map +1 -1
  117. package/build-module/components/visual-editor/index.js +2 -2
  118. package/build-module/components/visual-editor/index.js.map +1 -1
  119. package/build-module/dataviews/fields/content-preview/content-preview-view.js +95 -0
  120. package/build-module/dataviews/fields/content-preview/content-preview-view.js.map +1 -0
  121. package/build-module/dataviews/fields/content-preview/index.js +19 -0
  122. package/build-module/dataviews/fields/content-preview/index.js.map +1 -0
  123. package/build-module/dataviews/store/private-actions.js +2 -1
  124. package/build-module/dataviews/store/private-actions.js.map +1 -1
  125. package/build-module/store/private-actions.js +1 -1
  126. package/build-module/store/private-actions.js.map +1 -1
  127. package/build-module/store/private-selectors.js +7 -1
  128. package/build-module/store/private-selectors.js.map +1 -1
  129. package/build-module/store/selectors.js +4 -4
  130. package/build-module/store/selectors.js.map +1 -1
  131. package/build-style/style-rtl.css +35 -31
  132. package/build-style/style.css +35 -31
  133. package/build-types/components/autocompleters/user.d.ts +5 -1
  134. package/build-types/components/collab-sidebar/index.d.ts.map +1 -1
  135. package/build-types/components/document-outline/check.d.ts +5 -5
  136. package/build-types/components/document-outline/check.d.ts.map +1 -1
  137. package/build-types/components/header/index.d.ts.map +1 -1
  138. package/build-types/components/page-attributes/check.d.ts +5 -5
  139. package/build-types/components/page-attributes/check.d.ts.map +1 -1
  140. package/build-types/components/post-author/hook.d.ts +1 -1
  141. package/build-types/components/post-pending-status/check.d.ts +5 -5
  142. package/build-types/components/post-pending-status/check.d.ts.map +1 -1
  143. package/build-types/components/post-preview-button/index.d.ts.map +1 -1
  144. package/build-types/components/post-schedule/check.d.ts +5 -5
  145. package/build-types/components/post-schedule/check.d.ts.map +1 -1
  146. package/build-types/components/post-sticky/check.d.ts +5 -5
  147. package/build-types/components/post-sticky/check.d.ts.map +1 -1
  148. package/build-types/components/post-taxonomies/check.d.ts +2 -2
  149. package/build-types/components/post-taxonomies/check.d.ts.map +1 -1
  150. package/build-types/components/post-taxonomies/index.d.ts +1 -1
  151. package/build-types/components/post-taxonomies/index.d.ts.map +1 -1
  152. package/build-types/components/post-template/hooks.d.ts +1 -1
  153. package/build-types/components/post-template/hooks.d.ts.map +1 -1
  154. package/build-types/components/post-trash/check.d.ts +5 -5
  155. package/build-types/components/post-trash/check.d.ts.map +1 -1
  156. package/build-types/components/post-type-support-check/index.d.ts +8 -8
  157. package/build-types/components/post-type-support-check/index.d.ts.map +1 -1
  158. package/build-types/components/post-url/check.d.ts +5 -5
  159. package/build-types/components/post-url/check.d.ts.map +1 -1
  160. package/build-types/components/provider/index.d.ts +9 -9
  161. package/build-types/components/provider/index.d.ts.map +1 -1
  162. package/build-types/components/start-page-options/index.d.ts.map +1 -1
  163. package/build-types/components/theme-support-check/index.d.ts +6 -6
  164. package/build-types/components/theme-support-check/index.d.ts.map +1 -1
  165. package/build-types/components/visual-editor/edit-template-blocks-notification.d.ts +1 -1
  166. package/build-types/dataviews/fields/content-preview/content-preview-view.d.ts +5 -0
  167. package/build-types/dataviews/fields/content-preview/content-preview-view.d.ts.map +1 -0
  168. package/build-types/dataviews/fields/content-preview/index.d.ts +8 -0
  169. package/build-types/dataviews/fields/content-preview/index.d.ts.map +1 -0
  170. package/build-types/dataviews/store/private-actions.d.ts.map +1 -1
  171. package/build-types/store/private-selectors.d.ts.map +1 -1
  172. package/build-types/store/selectors.d.ts +5 -5
  173. package/build-types/store/selectors.d.ts.map +1 -1
  174. package/package.json +37 -37
  175. package/src/bindings/pattern-overrides.js +1 -1
  176. package/src/components/autocompleters/style.scss +1 -1
  177. package/src/components/collab-sidebar/index.js +1 -4
  178. package/src/components/document-bar/style.scss +4 -2
  179. package/src/components/document-outline/check.js +3 -3
  180. package/src/components/document-outline/index.js +2 -2
  181. package/src/components/document-tools/style.scss +3 -2
  182. package/src/components/header/index.js +26 -23
  183. package/src/components/page-attributes/check.js +3 -3
  184. package/src/components/post-excerpt/index.js +1 -1
  185. package/src/components/post-featured-image/style.scss +4 -2
  186. package/src/components/post-pending-status/check.js +3 -3
  187. package/src/components/post-preview-button/index.js +5 -1
  188. package/src/components/post-publish-button/index.js +2 -2
  189. package/src/components/post-publish-button/post-publish-button-or-toggle.js +1 -1
  190. package/src/components/post-publish-panel/style.scss +5 -3
  191. package/src/components/post-schedule/check.js +3 -3
  192. package/src/components/post-schedule/index.js +1 -1
  193. package/src/components/post-sticky/check.js +3 -3
  194. package/src/components/post-taxonomies/check.js +1 -1
  195. package/src/components/post-template/swap-template-button.js +1 -1
  196. package/src/components/post-text-editor/style.scss +4 -2
  197. package/src/components/post-trash/check.js +3 -3
  198. package/src/components/post-type-support-check/index.js +6 -6
  199. package/src/components/post-url/check.js +3 -3
  200. package/src/components/preferences-modal/index.js +1 -1
  201. package/src/components/provider/index.js +32 -20
  202. package/src/components/sidebar/post-summary.js +1 -1
  203. package/src/components/start-page-options/index.js +20 -12
  204. package/src/components/theme-support-check/index.js +4 -4
  205. package/src/components/visual-editor/edit-template-blocks-notification.js +1 -1
  206. package/src/components/visual-editor/index.js +2 -2
  207. package/src/dataviews/fields/content-preview/content-preview-view.tsx +108 -0
  208. package/src/dataviews/fields/content-preview/index.tsx +21 -0
  209. package/src/dataviews/fields/content-preview/style.scss +21 -0
  210. package/src/dataviews/store/private-actions.ts +4 -0
  211. package/src/store/private-actions.js +1 -1
  212. package/src/store/private-selectors.js +15 -8
  213. package/src/store/selectors.js +4 -4
  214. package/src/style.scss +1 -0
  215. package/tsconfig.tsbuildinfo +1 -1
@@ -1 +1 @@
1
- {"version":3,"names":["_data","require","_coreData","_store","ThemeSupportCheck","children","supportKeys","postType","themeSupports","useSelect","select","editorStore","getEditedPostAttribute","coreStore","getThemeSupports","isSupported","Array","isArray","some","key","_themeSupports$key","supported","includes"],"sources":["@wordpress/editor/src/components/theme-support-check/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\n\n/**\n * Checks if the current theme supports specific features and renders the children if supported.\n *\n * @param {Object} props The component props.\n * @param {React.ReactElement} props.children The children to render if the theme supports the specified features.\n * @param {string|string[]} props.supportKeys The key(s) of the theme support(s) to check.\n *\n * @return {React.ReactElement} The rendered children if the theme supports the specified features, otherwise null.\n */\nexport default function ThemeSupportCheck( { children, supportKeys } ) {\n\tconst { postType, themeSupports } = useSelect( ( select ) => {\n\t\treturn {\n\t\t\tpostType: select( editorStore ).getEditedPostAttribute( 'type' ),\n\t\t\tthemeSupports: select( coreStore ).getThemeSupports(),\n\t\t};\n\t}, [] );\n\n\tconst isSupported = (\n\t\tArray.isArray( supportKeys ) ? supportKeys : [ supportKeys ]\n\t).some( ( key ) => {\n\t\tconst supported = themeSupports?.[ key ] ?? false;\n\t\t// 'post-thumbnails' can be boolean or an array of post types.\n\t\t// In the latter case, we need to verify `postType` exists\n\t\t// within `supported`. If `postType` isn't passed, then the check\n\t\t// should fail.\n\t\tif ( 'post-thumbnails' === key && Array.isArray( supported ) ) {\n\t\t\treturn supported.includes( postType );\n\t\t}\n\t\treturn supported;\n\t} );\n\n\tif ( ! isSupported ) {\n\t\treturn null;\n\t}\n\n\treturn children;\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,SAAA,GAAAD,OAAA;AAKA,IAAAE,MAAA,GAAAF,OAAA;AATA;AACA;AACA;;AAIA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASG,iBAAiBA,CAAE;EAAEC,QAAQ;EAAEC;AAAY,CAAC,EAAG;EACtE,MAAM;IAAEC,QAAQ;IAAEC;EAAc,CAAC,GAAG,IAAAC,eAAS,EAAIC,MAAM,IAAM;IAC5D,OAAO;MACNH,QAAQ,EAAEG,MAAM,CAAEC,YAAY,CAAC,CAACC,sBAAsB,CAAE,MAAO,CAAC;MAChEJ,aAAa,EAAEE,MAAM,CAAEG,eAAU,CAAC,CAACC,gBAAgB,CAAC;IACrD,CAAC;EACF,CAAC,EAAE,EAAG,CAAC;EAEP,MAAMC,WAAW,GAAG,CACnBC,KAAK,CAACC,OAAO,CAAEX,WAAY,CAAC,GAAGA,WAAW,GAAG,CAAEA,WAAW,CAAE,EAC3DY,IAAI,CAAIC,GAAG,IAAM;IAAA,IAAAC,kBAAA;IAClB,MAAMC,SAAS,IAAAD,kBAAA,GAAGZ,aAAa,GAAIW,GAAG,CAAE,cAAAC,kBAAA,cAAAA,kBAAA,GAAI,KAAK;IACjD;IACA;IACA;IACA;IACA,IAAK,iBAAiB,KAAKD,GAAG,IAAIH,KAAK,CAACC,OAAO,CAAEI,SAAU,CAAC,EAAG;MAC9D,OAAOA,SAAS,CAACC,QAAQ,CAAEf,QAAS,CAAC;IACtC;IACA,OAAOc,SAAS;EACjB,CAAE,CAAC;EAEH,IAAK,CAAEN,WAAW,EAAG;IACpB,OAAO,IAAI;EACZ;EAEA,OAAOV,QAAQ;AAChB","ignoreList":[]}
1
+ {"version":3,"names":["_data","require","_coreData","_store","ThemeSupportCheck","children","supportKeys","postType","themeSupports","useSelect","select","editorStore","getEditedPostAttribute","coreStore","getThemeSupports","isSupported","Array","isArray","some","key","_themeSupports$key","supported","includes"],"sources":["@wordpress/editor/src/components/theme-support-check/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\n\n/**\n * Checks if the current theme supports specific features and renders the children if supported.\n *\n * @param {Object} props The component props.\n * @param {React.ReactNode} props.children The children to render if the theme supports the specified features.\n * @param {string|string[]} props.supportKeys The key(s) of the theme support(s) to check.\n *\n * @return {React.ReactNode} The rendered children if the theme supports the specified features, otherwise null.\n */\nexport default function ThemeSupportCheck( { children, supportKeys } ) {\n\tconst { postType, themeSupports } = useSelect( ( select ) => {\n\t\treturn {\n\t\t\tpostType: select( editorStore ).getEditedPostAttribute( 'type' ),\n\t\t\tthemeSupports: select( coreStore ).getThemeSupports(),\n\t\t};\n\t}, [] );\n\n\tconst isSupported = (\n\t\tArray.isArray( supportKeys ) ? supportKeys : [ supportKeys ]\n\t).some( ( key ) => {\n\t\tconst supported = themeSupports?.[ key ] ?? false;\n\t\t// 'post-thumbnails' can be boolean or an array of post types.\n\t\t// In the latter case, we need to verify `postType` exists\n\t\t// within `supported`. If `postType` isn't passed, then the check\n\t\t// should fail.\n\t\tif ( 'post-thumbnails' === key && Array.isArray( supported ) ) {\n\t\t\treturn supported.includes( postType );\n\t\t}\n\t\treturn supported;\n\t} );\n\n\tif ( ! isSupported ) {\n\t\treturn null;\n\t}\n\n\treturn children;\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,SAAA,GAAAD,OAAA;AAKA,IAAAE,MAAA,GAAAF,OAAA;AATA;AACA;AACA;;AAIA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASG,iBAAiBA,CAAE;EAAEC,QAAQ;EAAEC;AAAY,CAAC,EAAG;EACtE,MAAM;IAAEC,QAAQ;IAAEC;EAAc,CAAC,GAAG,IAAAC,eAAS,EAAIC,MAAM,IAAM;IAC5D,OAAO;MACNH,QAAQ,EAAEG,MAAM,CAAEC,YAAY,CAAC,CAACC,sBAAsB,CAAE,MAAO,CAAC;MAChEJ,aAAa,EAAEE,MAAM,CAAEG,eAAU,CAAC,CAACC,gBAAgB,CAAC;IACrD,CAAC;EACF,CAAC,EAAE,EAAG,CAAC;EAEP,MAAMC,WAAW,GAAG,CACnBC,KAAK,CAACC,OAAO,CAAEX,WAAY,CAAC,GAAGA,WAAW,GAAG,CAAEA,WAAW,CAAE,EAC3DY,IAAI,CAAIC,GAAG,IAAM;IAAA,IAAAC,kBAAA;IAClB,MAAMC,SAAS,IAAAD,kBAAA,GAAGZ,aAAa,GAAIW,GAAG,CAAE,cAAAC,kBAAA,cAAAA,kBAAA,GAAI,KAAK;IACjD;IACA;IACA;IACA;IACA,IAAK,iBAAiB,KAAKD,GAAG,IAAIH,KAAK,CAACC,OAAO,CAAEI,SAAU,CAAC,EAAG;MAC9D,OAAOA,SAAS,CAACC,QAAQ,CAAEf,QAAS,CAAC;IACtC;IACA,OAAOc,SAAS;EACjB,CAAE,CAAC;EAEH,IAAK,CAAEN,WAAW,EAAG;IACpB,OAAO,IAAI;EACZ;EAEA,OAAOV,QAAQ;AAChB","ignoreList":[]}
@@ -26,7 +26,7 @@ var _jsxRuntime = require("react/jsx-runtime");
26
26
  * user is focusing on editing page content and clicks on a disabled template
27
27
  * block.
28
28
  * - Displays a 'Edit your template to edit this block' dialog when the user
29
- * is focusing on editing page conetnt and double clicks on a disabled
29
+ * is focusing on editing page content and double clicks on a disabled
30
30
  * template block.
31
31
  *
32
32
  * @param {Object} props
@@ -1 +1 @@
1
- {"version":3,"names":["_data","require","_coreData","_element","_i18n","_components","_store","_jsxRuntime","EditTemplateBlocksNotification","contentRef","onNavigateToEntityRecord","templateId","useSelect","select","getEditorSettings","getCurrentTemplateId","editorStore","canEditTemplate","coreStore","canUser","kind","name","isDialogOpen","setIsDialogOpen","useState","useEffect","handleDblClick","event","target","classList","contains","dataset","type","defaultPrevented","preventDefault","canvas","current","addEventListener","removeEventListener","jsx","__experimentalConfirmDialog","isOpen","confirmButtonText","__","onConfirm","postId","postType","onCancel","size","children"],"sources":["@wordpress/editor/src/components/visual-editor/edit-template-blocks-notification.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useEffect, useState } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport { __experimentalConfirmDialog as ConfirmDialog } from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\n\n/**\n * Component that:\n *\n * - Displays a 'Edit your template to edit this block' notification when the\n * user is focusing on editing page content and clicks on a disabled template\n * block.\n * - Displays a 'Edit your template to edit this block' dialog when the user\n * is focusing on editing page conetnt and double clicks on a disabled\n * template block.\n *\n * @param {Object} props\n * @param {import('react').RefObject<HTMLElement>} props.contentRef Ref to the block\n * editor iframe canvas.\n */\nexport default function EditTemplateBlocksNotification( { contentRef } ) {\n\tconst { onNavigateToEntityRecord, templateId } = useSelect( ( select ) => {\n\t\tconst { getEditorSettings, getCurrentTemplateId } =\n\t\t\tselect( editorStore );\n\n\t\treturn {\n\t\t\tonNavigateToEntityRecord:\n\t\t\t\tgetEditorSettings().onNavigateToEntityRecord,\n\t\t\ttemplateId: getCurrentTemplateId(),\n\t\t};\n\t}, [] );\n\n\tconst canEditTemplate = useSelect(\n\t\t( select ) =>\n\t\t\t!! select( coreStore ).canUser( 'create', {\n\t\t\t\tkind: 'postType',\n\t\t\t\tname: 'wp_template',\n\t\t\t} ),\n\t\t[]\n\t);\n\n\tconst [ isDialogOpen, setIsDialogOpen ] = useState( false );\n\n\tuseEffect( () => {\n\t\tconst handleDblClick = ( event ) => {\n\t\t\tif ( ! canEditTemplate ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (\n\t\t\t\t! event.target.classList.contains( 'is-root-container' ) ||\n\t\t\t\tevent.target.dataset?.type === 'core/template-part'\n\t\t\t) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif ( ! event.defaultPrevented ) {\n\t\t\t\tevent.preventDefault();\n\t\t\t\tsetIsDialogOpen( true );\n\t\t\t}\n\t\t};\n\n\t\tconst canvas = contentRef.current;\n\t\tcanvas?.addEventListener( 'dblclick', handleDblClick );\n\t\treturn () => {\n\t\t\tcanvas?.removeEventListener( 'dblclick', handleDblClick );\n\t\t};\n\t}, [ contentRef, canEditTemplate ] );\n\n\tif ( ! canEditTemplate ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<ConfirmDialog\n\t\t\tisOpen={ isDialogOpen }\n\t\t\tconfirmButtonText={ __( 'Edit template' ) }\n\t\t\tonConfirm={ () => {\n\t\t\t\tsetIsDialogOpen( false );\n\t\t\t\tonNavigateToEntityRecord( {\n\t\t\t\t\tpostId: templateId,\n\t\t\t\t\tpostType: 'wp_template',\n\t\t\t\t} );\n\t\t\t} }\n\t\t\tonCancel={ () => setIsDialogOpen( false ) }\n\t\t\tsize=\"medium\"\n\t\t>\n\t\t\t{ __(\n\t\t\t\t'You’ve tried to select a block that is part of a template, which may be used on other posts and pages. Would you like to edit the template?'\n\t\t\t) }\n\t\t</ConfirmDialog>\n\t);\n}\n"],"mappings":";;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,SAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,KAAA,GAAAH,OAAA;AACA,IAAAI,WAAA,GAAAJ,OAAA;AAKA,IAAAK,MAAA,GAAAL,OAAA;AAAmD,IAAAM,WAAA,GAAAN,OAAA;AAZnD;AACA;AACA;;AAOA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GACe,SAASO,8BAA8BA,CAAE;EAAEC;AAAW,CAAC,EAAG;EACxE,MAAM;IAAEC,wBAAwB;IAAEC;EAAW,CAAC,GAAG,IAAAC,eAAS,EAAIC,MAAM,IAAM;IACzE,MAAM;MAAEC,iBAAiB;MAAEC;IAAqB,CAAC,GAChDF,MAAM,CAAEG,YAAY,CAAC;IAEtB,OAAO;MACNN,wBAAwB,EACvBI,iBAAiB,CAAC,CAAC,CAACJ,wBAAwB;MAC7CC,UAAU,EAAEI,oBAAoB,CAAC;IAClC,CAAC;EACF,CAAC,EAAE,EAAG,CAAC;EAEP,MAAME,eAAe,GAAG,IAAAL,eAAS,EAC9BC,MAAM,IACP,CAAC,CAAEA,MAAM,CAAEK,eA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,CAAG;IACHC,QAAQ,EAAGA,CAAA,KAAMxB,eAAe,CAAE,KAAM,CAAG;IAC3CyB,IAAI,EAAC,QAAQ;IAAAC,QAAA,EAEX,IAAAN,QAAE,EACH,6IACD;EAAC,CACa,CAAC;AAElB","ignoreList":[]}
1
+ {"version":3,"names":["_data","require","_coreData","_element","_i18n","_components","_store","_jsxRuntime","EditTemplateBlocksNotification","contentRef","onNavigateToEntityRecord","templateId","useSelect","select","getEditorSettings","getCurrentTemplateId","editorStore","canEditTemplate","coreStore","canUser","kind","name","isDialogOpen","setIsDialogOpen","useState","useEffect","handleDblClick","event","target","classList","contains","dataset","type","defaultPrevented","preventDefault","canvas","current","addEventListener","removeEventListener","jsx","__experimentalConfirmDialog","isOpen","confirmButtonText","__","onConfirm","postId","postType","onCancel","size","children"],"sources":["@wordpress/editor/src/components/visual-editor/edit-template-blocks-notification.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useEffect, useState } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport { __experimentalConfirmDialog as ConfirmDialog } from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\n\n/**\n * Component that:\n *\n * - Displays a 'Edit your template to edit this block' notification when the\n * user is focusing on editing page content and clicks on a disabled template\n * block.\n * - Displays a 'Edit your template to edit this block' dialog when the user\n * is focusing on editing page content and double clicks on a disabled\n * template block.\n *\n * @param {Object} props\n * @param {import('react').RefObject<HTMLElement>} props.contentRef Ref to the block\n * editor iframe canvas.\n */\nexport default function EditTemplateBlocksNotification( { contentRef } ) {\n\tconst { onNavigateToEntityRecord, templateId } = useSelect( ( select ) => {\n\t\tconst { getEditorSettings, getCurrentTemplateId } =\n\t\t\tselect( editorStore );\n\n\t\treturn {\n\t\t\tonNavigateToEntityRecord:\n\t\t\t\tgetEditorSettings().onNavigateToEntityRecord,\n\t\t\ttemplateId: getCurrentTemplateId(),\n\t\t};\n\t}, [] );\n\n\tconst canEditTemplate = useSelect(\n\t\t( select ) =>\n\t\t\t!! select( coreStore ).canUser( 'create', {\n\t\t\t\tkind: 'postType',\n\t\t\t\tname: 'wp_template',\n\t\t\t} ),\n\t\t[]\n\t);\n\n\tconst [ isDialogOpen, setIsDialogOpen ] = useState( false );\n\n\tuseEffect( () => {\n\t\tconst handleDblClick = ( event ) => {\n\t\t\tif ( ! canEditTemplate ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (\n\t\t\t\t! event.target.classList.contains( 'is-root-container' ) ||\n\t\t\t\tevent.target.dataset?.type === 'core/template-part'\n\t\t\t) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif ( ! event.defaultPrevented ) {\n\t\t\t\tevent.preventDefault();\n\t\t\t\tsetIsDialogOpen( true );\n\t\t\t}\n\t\t};\n\n\t\tconst canvas = contentRef.current;\n\t\tcanvas?.addEventListener( 'dblclick', handleDblClick );\n\t\treturn () => {\n\t\t\tcanvas?.removeEventListener( 'dblclick', handleDblClick );\n\t\t};\n\t}, [ contentRef, canEditTemplate ] );\n\n\tif ( ! canEditTemplate ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<ConfirmDialog\n\t\t\tisOpen={ isDialogOpen }\n\t\t\tconfirmButtonText={ __( 'Edit template' ) }\n\t\t\tonConfirm={ () => {\n\t\t\t\tsetIsDialogOpen( false );\n\t\t\t\tonNavigateToEntityRecord( {\n\t\t\t\t\tpostId: templateId,\n\t\t\t\t\tpostType: 'wp_template',\n\t\t\t\t} );\n\t\t\t} }\n\t\t\tonCancel={ () => setIsDialogOpen( false ) }\n\t\t\tsize=\"medium\"\n\t\t>\n\t\t\t{ __(\n\t\t\t\t'You’ve tried to select a block that is part of a template, which may be used on other posts and pages. Would you like to edit the template?'\n\t\t\t) }\n\t\t</ConfirmDialog>\n\t);\n}\n"],"mappings":";;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAA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EL,KAAK,CAACM,gBAAgB,EAAG;QAC/BN,KAAK,CAACO,cAAc,CAAC,CAAC;QACtBX,eAAe,CAAE,IAAK,CAAC;MACxB;IACD,CAAC;IAED,MAAMY,MAAM,GAAG1B,UAAU,CAAC2B,OAAO;IACjCD,MAAM,EAAEE,gBAAgB,CAAE,UAAU,EAAEX,cAAe,CAAC;IACtD,OAAO,MAAM;MACZS,MAAM,EAAEG,mBAAmB,CAAE,UAAU,EAAEZ,cAAe,CAAC;IAC1D,CAAC;EACF,CAAC,EAAE,CAAEjB,UAAU,EAAEQ,eAAe,CAAG,CAAC;EAEpC,IAAK,CAAEA,eAAe,EAAG;IACxB,OAAO,IAAI;EACZ;EAEA,oBACC,IAAAV,WAAA,CAAAgC,GAAA,EAAClC,WAAA,CAAAmC,2BAAa;IACbC,MAAM,EAAGnB,YAAc;IACvBoB,iBAAiB,EAAG,IAAAC,QAAE,EAAE,eAAgB,CAAG;IAC3CC,SAAS,EAAGA,CAAA,KAAM;MACjBrB,eAAe,CAAE,KAAM,CAAC;MACxBb,wBAAwB,CAAE;QACzBmC,MAAM,EAAElC,UAAU;QAClBmC,QAAQ,EAAE;MACX,CAAE,CAAC;IACJ,CAAG;IACHC,QAAQ,EAAGA,CAAA,KAAMxB,eAAe,CAAE,KAAM,CAAG;IAC3CyB,IAAI,EAAC,QAAQ;IAAAC,QAAA,EAEX,IAAAN,QAAE,EACH,6IACD;EAAC,CACa,CAAC;AAElB","ignoreList":[]}
@@ -261,7 +261,7 @@ function VisualEditor({
261
261
  !isPreview &&
262
262
  // Disable resizing in mobile viewport.
263
263
  !isMobileViewport &&
264
- // Dsiable resizing in zoomed-out mode.
264
+ // Disable resizing in zoomed-out mode.
265
265
  !isZoomedOut;
266
266
  const iframeStyles = (0, _element.useMemo)(() => {
267
267
  return [...(styles !== null && styles !== void 0 ? styles : []), {
@@ -323,7 +323,7 @@ function VisualEditor({
323
323
  })]
324
324
  }), renderingMode === 'post-only' && !isDesignPostType && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
325
325
  className: (0, _clsx.default)('editor-visual-editor__post-title-wrapper',
326
- // The following class is only here for backward comapatibility
326
+ // The following class is only here for backward compatibility
327
327
  // some themes might be using it to style the post title.
328
328
  'edit-post-visual-editor__post-title-wrapper', {
329
329
  'has-global-padding': hasRootPaddingAwareAlignments
@@ -1 +1 @@
1
- {"version":3,"names":["_clsx","_interopRequireDefault","require","_blockEditor","_element","_data","_blocks","_coreData","_compose","_postTitle","_store","_lockUnlock","_editTemplateBlocksNotification","_resizableEditor","_useSelectNearestEditableBlock","_constants","_useZoomOutModeExit","_jsxRuntime","LayoutStyle","useLayoutClasses","useLayoutStyles","ExperimentalBlockCanvas","BlockCanvas","useFlashEditableBlocks","unlock","blockEditorPrivateApis","DESIGN_POST_TYPES","PATTERN_POST_TYPE","TEMPLATE_POST_TYPE","NAVIGATION_POST_TYPE","TEMPLATE_PART_POST_TYPE","getPostContentAttributes","blocks","i","length","name","attributes","innerBlocks","nestedPostContent","checkForPostContentAtRootLevel","VisualEditor","autoFocus","styles","disableIframe","iframeProps","contentRef","className","contentHeight","setContentHeight","useState","effectContentHeight","useResizeObserver","entry","borderBoxSize","blockSize","isMobileViewport","useViewportMatch","renderingMode","postContentAttributes","editedPostTemplate","wrapperBlockName","wrapperUniqueId","deviceType","isFocusedEntity","isDesignPostType","postType","isPreview","useSelect","select","getCurrentPostId","getCurrentPostType","getCurrentTemplateId","getEditorSettings","getRenderingMode","getDeviceType","editorStore","getPostType","getEditedEntityRecord","coreStore","postTypeSlug","_renderingMode","_wrapperBlockName","editorSettings","supportsTemplateMode","postTypeObject","currentTemplateId","template","undefined","includes","viewable","onNavigateToPreviousEntityRecord","isPreviewMode","isCleanNewPost","hasRootPaddingAwareAlignments","themeHasDisabledLayoutStyles","themeSupportsLayout","isZoomedOut","getSettings","isZoomOut","_isZoomOut","blockEditorStore","_settings","disableLayoutStyles","supportsLayout","__experimentalFeatures","useRootPaddingAwareAlignments","deviceStyles","useResizeCanvas","globalLayoutSettings","useSettings","fallbackLayout","useMemo","type","newestPostContentAttributes","content","parseableContent","parse","hasPostContentAtRootLevel","layout","align","postContentLayoutClasses","blockListLayoutClass","clsx","postContentLayoutStyles","postContentLayout","inherit","contentSize","wideSize","blockListLayout","postEditorLayout","observeTypingRef","useTypingObserver","titleRef","useRef","useEffect","current","focus","alignCSS","forceFullHeight","enableResizing","iframeStyles","css","localRef","typewriterRef","useTypewriter","useMergeRefs","isEnabled","useSelectNearestEditableBlock","useZoomOutModeExit","jsx","children","default","height","jsxs","shouldIframe","style","Fragment","selector","contentEditable","ref","marginTop","RecursionProvider","blockName","uniqueId","BlockList","toLowerCase","dropZoneElement","parentNode","__unstableDisableDropZone","_default","exports"],"sources":["@wordpress/editor/src/components/visual-editor/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tBlockList,\n\tstore as blockEditorStore,\n\t__unstableUseTypewriter as useTypewriter,\n\t__unstableUseTypingObserver as useTypingObserver,\n\tuseSettings,\n\tRecursionProvider,\n\tprivateApis as blockEditorPrivateApis,\n\t__experimentalUseResizeCanvas as useResizeCanvas,\n} from '@wordpress/block-editor';\nimport { useEffect, useRef, useMemo, useState } from '@wordpress/element';\nimport { useSelect } from '@wordpress/data';\nimport { parse } from '@wordpress/blocks';\nimport { store as coreStore } from '@wordpress/core-data';\nimport {\n\tuseMergeRefs,\n\tuseViewportMatch,\n\tuseResizeObserver,\n} from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport PostTitle from '../post-title';\nimport { store as editorStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\nimport EditTemplateBlocksNotification from './edit-template-blocks-notification';\nimport ResizableEditor from '../resizable-editor';\nimport useSelectNearestEditableBlock from './use-select-nearest-editable-block';\nimport {\n\tNAVIGATION_POST_TYPE,\n\tPATTERN_POST_TYPE,\n\tTEMPLATE_PART_POST_TYPE,\n\tTEMPLATE_POST_TYPE,\n} from '../../store/constants';\nimport { useZoomOutModeExit } from './use-zoom-out-mode-exit';\n\nconst {\n\tLayoutStyle,\n\tuseLayoutClasses,\n\tuseLayoutStyles,\n\tExperimentalBlockCanvas: BlockCanvas,\n\tuseFlashEditableBlocks,\n} = unlock( blockEditorPrivateApis );\n\n/**\n * These post types have a special editor where they don't allow you to fill the title\n * and they don't apply the layout styles.\n */\nconst DESIGN_POST_TYPES = [\n\tPATTERN_POST_TYPE,\n\tTEMPLATE_POST_TYPE,\n\tNAVIGATION_POST_TYPE,\n\tTEMPLATE_PART_POST_TYPE,\n];\n\n/**\n * Given an array of nested blocks, find the first Post Content\n * block inside it, recursing through any nesting levels,\n * and return its attributes.\n *\n * @param {Array} blocks A list of blocks.\n *\n * @return {Object | undefined} The Post Content block.\n */\nfunction getPostContentAttributes( blocks ) {\n\tfor ( let i = 0; i < blocks.length; i++ ) {\n\t\tif ( blocks[ i ].name === 'core/post-content' ) {\n\t\t\treturn blocks[ i ].attributes;\n\t\t}\n\t\tif ( blocks[ i ].innerBlocks.length ) {\n\t\t\tconst nestedPostContent = getPostContentAttributes(\n\t\t\t\tblocks[ i ].innerBlocks\n\t\t\t);\n\n\t\t\tif ( nestedPostContent ) {\n\t\t\t\treturn nestedPostContent;\n\t\t\t}\n\t\t}\n\t}\n}\n\nfunction checkForPostContentAtRootLevel( blocks ) {\n\tfor ( let i = 0; i < blocks.length; i++ ) {\n\t\tif ( blocks[ i ].name === 'core/post-content' ) {\n\t\t\treturn true;\n\t\t}\n\t}\n\treturn false;\n}\n\nfunction VisualEditor( {\n\t// Ideally as we unify post and site editors, we won't need these props.\n\tautoFocus,\n\tstyles,\n\tdisableIframe = false,\n\tiframeProps,\n\tcontentRef,\n\tclassName,\n} ) {\n\tconst [ contentHeight, setContentHeight ] = useState( '' );\n\tconst effectContentHeight = useResizeObserver( ( [ entry ] ) => {\n\t\tsetContentHeight( entry.borderBoxSize[ 0 ].blockSize );\n\t} );\n\tconst isMobileViewport = useViewportMatch( 'small', '<' );\n\tconst {\n\t\trenderingMode,\n\t\tpostContentAttributes,\n\t\teditedPostTemplate = {},\n\t\twrapperBlockName,\n\t\twrapperUniqueId,\n\t\tdeviceType,\n\t\tisFocusedEntity,\n\t\tisDesignPostType,\n\t\tpostType,\n\t\tisPreview,\n\t} = useSelect( ( select ) => {\n\t\tconst {\n\t\t\tgetCurrentPostId,\n\t\t\tgetCurrentPostType,\n\t\t\tgetCurrentTemplateId,\n\t\t\tgetEditorSettings,\n\t\t\tgetRenderingMode,\n\t\t\tgetDeviceType,\n\t\t} = select( editorStore );\n\t\tconst { getPostType, getEditedEntityRecord } = select( coreStore );\n\t\tconst postTypeSlug = getCurrentPostType();\n\t\tconst _renderingMode = getRenderingMode();\n\t\tlet _wrapperBlockName;\n\n\t\tif ( postTypeSlug === PATTERN_POST_TYPE ) {\n\t\t\t_wrapperBlockName = 'core/block';\n\t\t} else if ( _renderingMode === 'post-only' ) {\n\t\t\t_wrapperBlockName = 'core/post-content';\n\t\t}\n\n\t\tconst editorSettings = getEditorSettings();\n\t\tconst supportsTemplateMode = editorSettings.supportsTemplateMode;\n\t\tconst postTypeObject = getPostType( postTypeSlug );\n\t\tconst currentTemplateId = getCurrentTemplateId();\n\t\tconst template = currentTemplateId\n\t\t\t? getEditedEntityRecord(\n\t\t\t\t\t'postType',\n\t\t\t\t\tTEMPLATE_POST_TYPE,\n\t\t\t\t\tcurrentTemplateId\n\t\t\t )\n\t\t\t: undefined;\n\n\t\treturn {\n\t\t\trenderingMode: _renderingMode,\n\t\t\tpostContentAttributes: editorSettings.postContentAttributes,\n\t\t\tisDesignPostType: DESIGN_POST_TYPES.includes( postTypeSlug ),\n\t\t\t// Post template fetch returns a 404 on classic themes, which\n\t\t\t// messes with e2e tests, so check it's a block theme first.\n\t\t\teditedPostTemplate:\n\t\t\t\tpostTypeObject?.viewable && supportsTemplateMode\n\t\t\t\t\t? template\n\t\t\t\t\t: undefined,\n\t\t\twrapperBlockName: _wrapperBlockName,\n\t\t\twrapperUniqueId: getCurrentPostId(),\n\t\t\tdeviceType: getDeviceType(),\n\t\t\tisFocusedEntity: !! editorSettings.onNavigateToPreviousEntityRecord,\n\t\t\tpostType: postTypeSlug,\n\t\t\tisPreview: editorSettings.isPreviewMode,\n\t\t};\n\t}, [] );\n\tconst { isCleanNewPost } = useSelect( editorStore );\n\tconst {\n\t\thasRootPaddingAwareAlignments,\n\t\tthemeHasDisabledLayoutStyles,\n\t\tthemeSupportsLayout,\n\t\tisZoomedOut,\n\t} = useSelect( ( select ) => {\n\t\tconst { getSettings, isZoomOut: _isZoomOut } = unlock(\n\t\t\tselect( blockEditorStore )\n\t\t);\n\n\t\tconst _settings = getSettings();\n\t\treturn {\n\t\t\tthemeHasDisabledLayoutStyles: _settings.disableLayoutStyles,\n\t\t\tthemeSupportsLayout: _settings.supportsLayout,\n\t\t\thasRootPaddingAwareAlignments:\n\t\t\t\t_settings.__experimentalFeatures?.useRootPaddingAwareAlignments,\n\t\t\tisZoomedOut: _isZoomOut(),\n\t\t};\n\t}, [] );\n\n\tconst deviceStyles = useResizeCanvas( deviceType );\n\tconst [ globalLayoutSettings ] = useSettings( 'layout' );\n\n\t// fallbackLayout is used if there is no Post Content,\n\t// and for Post Title.\n\tconst fallbackLayout = useMemo( () => {\n\t\tif ( renderingMode !== 'post-only' || isDesignPostType ) {\n\t\t\treturn { type: 'default' };\n\t\t}\n\n\t\tif ( themeSupportsLayout ) {\n\t\t\t// We need to ensure support for wide and full alignments,\n\t\t\t// so we add the constrained type.\n\t\t\treturn { ...globalLayoutSettings, type: 'constrained' };\n\t\t}\n\t\t// Set default layout for classic themes so all alignments are supported.\n\t\treturn { type: 'default' };\n\t}, [\n\t\trenderingMode,\n\t\tthemeSupportsLayout,\n\t\tglobalLayoutSettings,\n\t\tisDesignPostType,\n\t] );\n\n\tconst newestPostContentAttributes = useMemo( () => {\n\t\tif (\n\t\t\t! editedPostTemplate?.content &&\n\t\t\t! editedPostTemplate?.blocks &&\n\t\t\tpostContentAttributes\n\t\t) {\n\t\t\treturn postContentAttributes;\n\t\t}\n\t\t// When in template editing mode, we can access the blocks directly.\n\t\tif ( editedPostTemplate?.blocks ) {\n\t\t\treturn getPostContentAttributes( editedPostTemplate?.blocks );\n\t\t}\n\t\t// If there are no blocks, we have to parse the content string.\n\t\t// Best double-check it's a string otherwise the parse function gets unhappy.\n\t\tconst parseableContent =\n\t\t\ttypeof editedPostTemplate?.content === 'string'\n\t\t\t\t? editedPostTemplate?.content\n\t\t\t\t: '';\n\n\t\treturn getPostContentAttributes( parse( parseableContent ) ) || {};\n\t}, [\n\t\teditedPostTemplate?.content,\n\t\teditedPostTemplate?.blocks,\n\t\tpostContentAttributes,\n\t] );\n\n\tconst hasPostContentAtRootLevel = useMemo( () => {\n\t\tif ( ! editedPostTemplate?.content && ! editedPostTemplate?.blocks ) {\n\t\t\treturn false;\n\t\t}\n\t\t// When in template editing mode, we can access the blocks directly.\n\t\tif ( editedPostTemplate?.blocks ) {\n\t\t\treturn checkForPostContentAtRootLevel( editedPostTemplate?.blocks );\n\t\t}\n\t\t// If there are no blocks, we have to parse the content string.\n\t\t// Best double-check it's a string otherwise the parse function gets unhappy.\n\t\tconst parseableContent =\n\t\t\ttypeof editedPostTemplate?.content === 'string'\n\t\t\t\t? editedPostTemplate?.content\n\t\t\t\t: '';\n\n\t\treturn (\n\t\t\tcheckForPostContentAtRootLevel( parse( parseableContent ) ) || false\n\t\t);\n\t}, [ editedPostTemplate?.content, editedPostTemplate?.blocks ] );\n\n\tconst { layout = {}, align = '' } = newestPostContentAttributes || {};\n\n\tconst postContentLayoutClasses = useLayoutClasses(\n\t\tnewestPostContentAttributes,\n\t\t'core/post-content'\n\t);\n\n\tconst blockListLayoutClass = clsx(\n\t\t{\n\t\t\t'is-layout-flow': ! themeSupportsLayout,\n\t\t},\n\t\tthemeSupportsLayout && postContentLayoutClasses,\n\t\talign && `align${ align }`\n\t);\n\n\tconst postContentLayoutStyles = useLayoutStyles(\n\t\tnewestPostContentAttributes,\n\t\t'core/post-content',\n\t\t'.block-editor-block-list__layout.is-root-container'\n\t);\n\n\t// Update type for blocks using legacy layouts.\n\tconst postContentLayout = useMemo( () => {\n\t\treturn layout &&\n\t\t\t( layout?.type === 'constrained' ||\n\t\t\t\tlayout?.inherit ||\n\t\t\t\tlayout?.contentSize ||\n\t\t\t\tlayout?.wideSize )\n\t\t\t? { ...globalLayoutSettings, ...layout, type: 'constrained' }\n\t\t\t: { ...globalLayoutSettings, ...layout, type: 'default' };\n\t}, [\n\t\tlayout?.type,\n\t\tlayout?.inherit,\n\t\tlayout?.contentSize,\n\t\tlayout?.wideSize,\n\t\tglobalLayoutSettings,\n\t] );\n\n\t// If there is a Post Content block we use its layout for the block list;\n\t// if not, this must be a classic theme, in which case we use the fallback layout.\n\tconst blockListLayout = postContentAttributes\n\t\t? postContentLayout\n\t\t: fallbackLayout;\n\n\tconst postEditorLayout =\n\t\tblockListLayout?.type === 'default' && ! hasPostContentAtRootLevel\n\t\t\t? fallbackLayout\n\t\t\t: blockListLayout;\n\tconst observeTypingRef = useTypingObserver();\n\tconst titleRef = useRef();\n\tuseEffect( () => {\n\t\tif ( ! autoFocus || ! isCleanNewPost() ) {\n\t\t\treturn;\n\t\t}\n\t\ttitleRef?.current?.focus();\n\t}, [ autoFocus, isCleanNewPost ] );\n\n\t// Add some styles for alignwide/alignfull Post Content and its children.\n\tconst alignCSS = `.is-root-container.alignwide { max-width: var(--wp--style--global--wide-size); margin-left: auto; margin-right: auto;}\n\t\t.is-root-container.alignwide:where(.is-layout-flow) > :not(.alignleft):not(.alignright) { max-width: var(--wp--style--global--wide-size);}\n\t\t.is-root-container.alignfull { max-width: none; margin-left: auto; margin-right: auto;}\n\t\t.is-root-container.alignfull:where(.is-layout-flow) > :not(.alignleft):not(.alignright) { max-width: none;}`;\n\n\tconst forceFullHeight = postType === NAVIGATION_POST_TYPE;\n\tconst enableResizing =\n\t\t[\n\t\t\tNAVIGATION_POST_TYPE,\n\t\t\tTEMPLATE_PART_POST_TYPE,\n\t\t\tPATTERN_POST_TYPE,\n\t\t].includes( postType ) &&\n\t\t// Disable in previews / view mode.\n\t\t! isPreview &&\n\t\t// Disable resizing in mobile viewport.\n\t\t! isMobileViewport &&\n\t\t// Dsiable resizing in zoomed-out mode.\n\t\t! isZoomedOut;\n\n\tconst iframeStyles = useMemo( () => {\n\t\treturn [\n\t\t\t...( styles ?? [] ),\n\t\t\t{\n\t\t\t\t// Ensures margins of children are contained so that the body background paints behind them.\n\t\t\t\t// Otherwise, the background of html (when zoomed out) would show there and appear broken. It’s\n\t\t\t\t// important mostly for post-only views yet conceivably an issue in templated views too.\n\t\t\t\tcss: `:where(.block-editor-iframe__body){display:flow-root;}.is-root-container{display:flow-root;${\n\t\t\t\t\t// Some themes will have `min-height: 100vh` for the root container,\n\t\t\t\t\t// which isn't a requirement in auto resize mode.\n\t\t\t\t\tenableResizing ? 'min-height:0!important;' : ''\n\t\t\t\t}}`,\n\t\t\t},\n\t\t];\n\t}, [ styles, enableResizing ] );\n\n\tconst localRef = useRef();\n\tconst typewriterRef = useTypewriter();\n\tcontentRef = useMergeRefs( [\n\t\tlocalRef,\n\t\tcontentRef,\n\t\trenderingMode === 'post-only' ? typewriterRef : null,\n\t\tuseFlashEditableBlocks( {\n\t\t\tisEnabled: renderingMode === 'template-locked',\n\t\t} ),\n\t\tuseSelectNearestEditableBlock( {\n\t\t\tisEnabled: renderingMode === 'template-locked',\n\t\t} ),\n\t\tuseZoomOutModeExit(),\n\t\t// Avoid resize listeners when not needed, these will trigger\n\t\t// unnecessary re-renders when animating the iframe width.\n\t\tenableResizing ? effectContentHeight : null,\n\t] );\n\n\treturn (\n\t\t<div\n\t\t\tclassName={ clsx(\n\t\t\t\t'editor-visual-editor',\n\t\t\t\t// this class is here for backward compatibility reasons.\n\t\t\t\t'edit-post-visual-editor',\n\t\t\t\tclassName,\n\t\t\t\t{\n\t\t\t\t\t'has-padding': isFocusedEntity || enableResizing,\n\t\t\t\t\t'is-resizable': enableResizing,\n\t\t\t\t\t'is-iframed': ! disableIframe,\n\t\t\t\t\t'is-scrollable': disableIframe || deviceType !== 'Desktop',\n\t\t\t\t}\n\t\t\t) }\n\t\t>\n\t\t\t<ResizableEditor\n\t\t\t\tenableResizing={ enableResizing }\n\t\t\t\theight={\n\t\t\t\t\tcontentHeight && ! forceFullHeight ? contentHeight : '100%'\n\t\t\t\t}\n\t\t\t>\n\t\t\t\t<BlockCanvas\n\t\t\t\t\tshouldIframe={ ! disableIframe }\n\t\t\t\t\tcontentRef={ contentRef }\n\t\t\t\t\tstyles={ iframeStyles }\n\t\t\t\t\theight=\"100%\"\n\t\t\t\t\tiframeProps={ {\n\t\t\t\t\t\t...iframeProps,\n\t\t\t\t\t\tstyle: {\n\t\t\t\t\t\t\t...iframeProps?.style,\n\t\t\t\t\t\t\t...deviceStyles,\n\t\t\t\t\t\t},\n\t\t\t\t\t} }\n\t\t\t\t>\n\t\t\t\t\t{ themeSupportsLayout &&\n\t\t\t\t\t\t! themeHasDisabledLayoutStyles &&\n\t\t\t\t\t\trenderingMode === 'post-only' &&\n\t\t\t\t\t\t! isDesignPostType && (\n\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t<LayoutStyle\n\t\t\t\t\t\t\t\t\tselector=\".editor-visual-editor__post-title-wrapper\"\n\t\t\t\t\t\t\t\t\tlayout={ fallbackLayout }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t<LayoutStyle\n\t\t\t\t\t\t\t\t\tselector=\".block-editor-block-list__layout.is-root-container\"\n\t\t\t\t\t\t\t\t\tlayout={ postEditorLayout }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t{ align && <LayoutStyle css={ alignCSS } /> }\n\t\t\t\t\t\t\t\t{ postContentLayoutStyles && (\n\t\t\t\t\t\t\t\t\t<LayoutStyle\n\t\t\t\t\t\t\t\t\t\tlayout={ postContentLayout }\n\t\t\t\t\t\t\t\t\t\tcss={ postContentLayoutStyles }\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{ renderingMode === 'post-only' && ! isDesignPostType && (\n\t\t\t\t\t\t<div\n\t\t\t\t\t\t\tclassName={ clsx(\n\t\t\t\t\t\t\t\t'editor-visual-editor__post-title-wrapper',\n\t\t\t\t\t\t\t\t// The following class is only here for backward comapatibility\n\t\t\t\t\t\t\t\t// some themes might be using it to style the post title.\n\t\t\t\t\t\t\t\t'edit-post-visual-editor__post-title-wrapper',\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t'has-global-padding':\n\t\t\t\t\t\t\t\t\t\thasRootPaddingAwareAlignments,\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\tcontentEditable={ false }\n\t\t\t\t\t\t\tref={ observeTypingRef }\n\t\t\t\t\t\t\tstyle={ {\n\t\t\t\t\t\t\t\t// This is using inline styles\n\t\t\t\t\t\t\t\t// so it's applied for both iframed and non iframed editors.\n\t\t\t\t\t\t\t\tmarginTop: '4rem',\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<PostTitle ref={ titleRef } />\n\t\t\t\t\t\t</div>\n\t\t\t\t\t) }\n\t\t\t\t\t<RecursionProvider\n\t\t\t\t\t\tblockName={ wrapperBlockName }\n\t\t\t\t\t\tuniqueId={ wrapperUniqueId }\n\t\t\t\t\t>\n\t\t\t\t\t\t<BlockList\n\t\t\t\t\t\t\tclassName={ clsx(\n\t\t\t\t\t\t\t\t'is-' + deviceType.toLowerCase() + '-preview',\n\t\t\t\t\t\t\t\trenderingMode !== 'post-only' ||\n\t\t\t\t\t\t\t\t\tisDesignPostType\n\t\t\t\t\t\t\t\t\t? 'wp-site-blocks'\n\t\t\t\t\t\t\t\t\t: `${ blockListLayoutClass } wp-block-post-content`, // Ensure root level blocks receive default/flow blockGap styling rules.\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t'has-global-padding':\n\t\t\t\t\t\t\t\t\t\trenderingMode === 'post-only' &&\n\t\t\t\t\t\t\t\t\t\t! isDesignPostType &&\n\t\t\t\t\t\t\t\t\t\thasRootPaddingAwareAlignments,\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\tlayout={ blockListLayout }\n\t\t\t\t\t\t\tdropZoneElement={\n\t\t\t\t\t\t\t\t// When iframed, pass in the html element of the iframe to\n\t\t\t\t\t\t\t\t// ensure the drop zone extends to the edges of the iframe.\n\t\t\t\t\t\t\t\tdisableIframe\n\t\t\t\t\t\t\t\t\t? localRef.current\n\t\t\t\t\t\t\t\t\t: localRef.current?.parentNode\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t__unstableDisableDropZone={\n\t\t\t\t\t\t\t\t// In template preview mode, disable drop zones at the root of the template.\n\t\t\t\t\t\t\t\trenderingMode === 'template-locked'\n\t\t\t\t\t\t\t\t\t? true\n\t\t\t\t\t\t\t\t\t: false\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t{ renderingMode === 'template-locked' && (\n\t\t\t\t\t\t\t<EditTemplateBlocksNotification\n\t\t\t\t\t\t\t\tcontentRef={ localRef }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) }\n\t\t\t\t\t</RecursionProvider>\n\t\t\t\t</BlockCanvas>\n\t\t\t</ResizableEditor>\n\t\t</div>\n\t);\n}\n\nexport default VisualEditor;\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,YAAA,GAAAD,OAAA;AAUA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,KAAA,GAAAH,OAAA;AACA,IAAAI,OAAA,GAAAJ,OAAA;AACA,IAAAK,SAAA,GAAAL,OAAA;AACA,IAAAM,QAAA,GAAAN,OAAA;AASA,IAAAO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AA,CACR;IAAC,CACE;EAAC,CACd,CAAC;AAER;AAAC,IAAA2B,QAAA,GAAAC,OAAA,CAAAnB,OAAA,GAEc/G,YAAY","ignoreList":[]}
1
+ {"version":3,"names":["_clsx","_interopRequireDefault","require","_blockEditor","_element","_data","_blocks","_coreData","_compose","_postTitle","_store","_lockUnlock","_editTemplateBlocksNotification","_resizableEditor","_useSelectNearestEditableBlock","_constants","_useZoomOutModeExit","_jsxRuntime","LayoutStyle","useLayoutClasses","useLayoutStyles","ExperimentalBlockCanvas","BlockCanvas","useFlashEditableBlocks","unlock","blockEditorPrivateApis","DESIGN_POST_TYPES","PATTERN_POST_TYPE","TEMPLATE_POST_TYPE","NAVIGATION_POST_TYPE","TEMPLATE_PART_POST_TYPE","getPostContentAttributes","blocks","i","length","name","attributes","innerBlocks","nestedPostContent","checkForPostContentAtRootLevel","VisualEditor","autoFocus","styles","disableIframe","iframeProps","contentRef","className","contentHeight","setContentHeight","useState","effectContentHeight","useResizeObserver","entry","borderBoxSize","blockSize","isMobileViewport","useViewportMatch","renderingMode","postContentAttributes","editedPostTemplate","wrapperBlockName","wrapperUniqueId","deviceType","isFocusedEntity","isDesignPostType","postType","isPreview","useSelect","select","getCurrentPostId","getCurrentPostType","getCurrentTemplateId","getEditorSettings","getRenderingMode","getDeviceType","editorStore","getPostType","getEditedEntityRecord","coreStore","postTypeSlug","_renderingMode","_wrapperBlockName","editorSettings","supportsTemplateMode","postTypeObject","currentTemplateId","template","undefined","includes","viewable","onNavigateToPreviousEntityRecord","isPreviewMode","isCleanNewPost","hasRootPaddingAwareAlignments","themeHasDisabledLayoutStyles","themeSupportsLayout","isZoomedOut","getSettings","isZoomOut","_isZoomOut","blockEditorStore","_settings","disableLayoutStyles","supportsLayout","__experimentalFeatures","useRootPaddingAwareAlignments","deviceStyles","useResizeCanvas","globalLayoutSettings","useSettings","fallbackLayout","useMemo","type","newestPostContentAttributes","content","parseableContent","parse","hasPostContentAtRootLevel","layout","align","postContentLayoutClasses","blockListLayoutClass","clsx","postContentLayoutStyles","postContentLayout","inherit","contentSize","wideSize","blockListLayout","postEditorLayout","observeTypingRef","useTypingObserver","titleRef","useRef","useEffect","current","focus","alignCSS","forceFullHeight","enableResizing","iframeStyles","css","localRef","typewriterRef","useTypewriter","useMergeRefs","isEnabled","useSelectNearestEditableBlock","useZoomOutModeExit","jsx","children","default","height","jsxs","shouldIframe","style","Fragment","selector","contentEditable","ref","marginTop","RecursionProvider","blockName","uniqueId","BlockList","toLowerCase","dropZoneElement","parentNode","__unstableDisableDropZone","_default","exports"],"sources":["@wordpress/editor/src/components/visual-editor/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tBlockList,\n\tstore as blockEditorStore,\n\t__unstableUseTypewriter as useTypewriter,\n\t__unstableUseTypingObserver as useTypingObserver,\n\tuseSettings,\n\tRecursionProvider,\n\tprivateApis as blockEditorPrivateApis,\n\t__experimentalUseResizeCanvas as useResizeCanvas,\n} from '@wordpress/block-editor';\nimport { useEffect, useRef, useMemo, useState } from '@wordpress/element';\nimport { useSelect } from '@wordpress/data';\nimport { parse } from '@wordpress/blocks';\nimport { store as coreStore } from '@wordpress/core-data';\nimport {\n\tuseMergeRefs,\n\tuseViewportMatch,\n\tuseResizeObserver,\n} from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport PostTitle from '../post-title';\nimport { store as editorStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\nimport EditTemplateBlocksNotification from './edit-template-blocks-notification';\nimport ResizableEditor from '../resizable-editor';\nimport useSelectNearestEditableBlock from './use-select-nearest-editable-block';\nimport {\n\tNAVIGATION_POST_TYPE,\n\tPATTERN_POST_TYPE,\n\tTEMPLATE_PART_POST_TYPE,\n\tTEMPLATE_POST_TYPE,\n} from '../../store/constants';\nimport { useZoomOutModeExit } from './use-zoom-out-mode-exit';\n\nconst {\n\tLayoutStyle,\n\tuseLayoutClasses,\n\tuseLayoutStyles,\n\tExperimentalBlockCanvas: BlockCanvas,\n\tuseFlashEditableBlocks,\n} = unlock( blockEditorPrivateApis );\n\n/**\n * These post types have a special editor where they don't allow you to fill the title\n * and they don't apply the layout styles.\n */\nconst DESIGN_POST_TYPES = [\n\tPATTERN_POST_TYPE,\n\tTEMPLATE_POST_TYPE,\n\tNAVIGATION_POST_TYPE,\n\tTEMPLATE_PART_POST_TYPE,\n];\n\n/**\n * Given an array of nested blocks, find the first Post Content\n * block inside it, recursing through any nesting levels,\n * and return its attributes.\n *\n * @param {Array} blocks A list of blocks.\n *\n * @return {Object | undefined} The Post Content block.\n */\nfunction getPostContentAttributes( blocks ) {\n\tfor ( let i = 0; i < blocks.length; i++ ) {\n\t\tif ( blocks[ i ].name === 'core/post-content' ) {\n\t\t\treturn blocks[ i ].attributes;\n\t\t}\n\t\tif ( blocks[ i ].innerBlocks.length ) {\n\t\t\tconst nestedPostContent = getPostContentAttributes(\n\t\t\t\tblocks[ i ].innerBlocks\n\t\t\t);\n\n\t\t\tif ( nestedPostContent ) {\n\t\t\t\treturn nestedPostContent;\n\t\t\t}\n\t\t}\n\t}\n}\n\nfunction checkForPostContentAtRootLevel( blocks ) {\n\tfor ( let i = 0; i < blocks.length; i++ ) {\n\t\tif ( blocks[ i ].name === 'core/post-content' ) {\n\t\t\treturn true;\n\t\t}\n\t}\n\treturn false;\n}\n\nfunction VisualEditor( {\n\t// Ideally as we unify post and site editors, we won't need these props.\n\tautoFocus,\n\tstyles,\n\tdisableIframe = false,\n\tiframeProps,\n\tcontentRef,\n\tclassName,\n} ) {\n\tconst [ contentHeight, setContentHeight ] = useState( '' );\n\tconst effectContentHeight = useResizeObserver( ( [ entry ] ) => {\n\t\tsetContentHeight( entry.borderBoxSize[ 0 ].blockSize );\n\t} );\n\tconst isMobileViewport = useViewportMatch( 'small', '<' );\n\tconst {\n\t\trenderingMode,\n\t\tpostContentAttributes,\n\t\teditedPostTemplate = {},\n\t\twrapperBlockName,\n\t\twrapperUniqueId,\n\t\tdeviceType,\n\t\tisFocusedEntity,\n\t\tisDesignPostType,\n\t\tpostType,\n\t\tisPreview,\n\t} = useSelect( ( select ) => {\n\t\tconst {\n\t\t\tgetCurrentPostId,\n\t\t\tgetCurrentPostType,\n\t\t\tgetCurrentTemplateId,\n\t\t\tgetEditorSettings,\n\t\t\tgetRenderingMode,\n\t\t\tgetDeviceType,\n\t\t} = select( editorStore );\n\t\tconst { getPostType, getEditedEntityRecord } = select( coreStore );\n\t\tconst postTypeSlug = getCurrentPostType();\n\t\tconst _renderingMode = getRenderingMode();\n\t\tlet _wrapperBlockName;\n\n\t\tif ( postTypeSlug === PATTERN_POST_TYPE ) {\n\t\t\t_wrapperBlockName = 'core/block';\n\t\t} else if ( _renderingMode === 'post-only' ) {\n\t\t\t_wrapperBlockName = 'core/post-content';\n\t\t}\n\n\t\tconst editorSettings = getEditorSettings();\n\t\tconst supportsTemplateMode = editorSettings.supportsTemplateMode;\n\t\tconst postTypeObject = getPostType( postTypeSlug );\n\t\tconst currentTemplateId = getCurrentTemplateId();\n\t\tconst template = currentTemplateId\n\t\t\t? getEditedEntityRecord(\n\t\t\t\t\t'postType',\n\t\t\t\t\tTEMPLATE_POST_TYPE,\n\t\t\t\t\tcurrentTemplateId\n\t\t\t )\n\t\t\t: undefined;\n\n\t\treturn {\n\t\t\trenderingMode: _renderingMode,\n\t\t\tpostContentAttributes: editorSettings.postContentAttributes,\n\t\t\tisDesignPostType: DESIGN_POST_TYPES.includes( postTypeSlug ),\n\t\t\t// Post template fetch returns a 404 on classic themes, which\n\t\t\t// messes with e2e tests, so check it's a block theme first.\n\t\t\teditedPostTemplate:\n\t\t\t\tpostTypeObject?.viewable && supportsTemplateMode\n\t\t\t\t\t? template\n\t\t\t\t\t: undefined,\n\t\t\twrapperBlockName: _wrapperBlockName,\n\t\t\twrapperUniqueId: getCurrentPostId(),\n\t\t\tdeviceType: getDeviceType(),\n\t\t\tisFocusedEntity: !! editorSettings.onNavigateToPreviousEntityRecord,\n\t\t\tpostType: postTypeSlug,\n\t\t\tisPreview: editorSettings.isPreviewMode,\n\t\t};\n\t}, [] );\n\tconst { isCleanNewPost } = useSelect( editorStore );\n\tconst {\n\t\thasRootPaddingAwareAlignments,\n\t\tthemeHasDisabledLayoutStyles,\n\t\tthemeSupportsLayout,\n\t\tisZoomedOut,\n\t} = useSelect( ( select ) => {\n\t\tconst { getSettings, isZoomOut: _isZoomOut } = unlock(\n\t\t\tselect( blockEditorStore )\n\t\t);\n\n\t\tconst _settings = getSettings();\n\t\treturn {\n\t\t\tthemeHasDisabledLayoutStyles: _settings.disableLayoutStyles,\n\t\t\tthemeSupportsLayout: _settings.supportsLayout,\n\t\t\thasRootPaddingAwareAlignments:\n\t\t\t\t_settings.__experimentalFeatures?.useRootPaddingAwareAlignments,\n\t\t\tisZoomedOut: _isZoomOut(),\n\t\t};\n\t}, [] );\n\n\tconst deviceStyles = useResizeCanvas( deviceType );\n\tconst [ globalLayoutSettings ] = useSettings( 'layout' );\n\n\t// fallbackLayout is used if there is no Post Content,\n\t// and for Post Title.\n\tconst fallbackLayout = useMemo( () => {\n\t\tif ( renderingMode !== 'post-only' || isDesignPostType ) {\n\t\t\treturn { type: 'default' };\n\t\t}\n\n\t\tif ( themeSupportsLayout ) {\n\t\t\t// We need to ensure support for wide and full alignments,\n\t\t\t// so we add the constrained type.\n\t\t\treturn { ...globalLayoutSettings, type: 'constrained' };\n\t\t}\n\t\t// Set default layout for classic themes so all alignments are supported.\n\t\treturn { type: 'default' };\n\t}, [\n\t\trenderingMode,\n\t\tthemeSupportsLayout,\n\t\tglobalLayoutSettings,\n\t\tisDesignPostType,\n\t] );\n\n\tconst newestPostContentAttributes = useMemo( () => {\n\t\tif (\n\t\t\t! editedPostTemplate?.content &&\n\t\t\t! editedPostTemplate?.blocks &&\n\t\t\tpostContentAttributes\n\t\t) {\n\t\t\treturn postContentAttributes;\n\t\t}\n\t\t// When in template editing mode, we can access the blocks directly.\n\t\tif ( editedPostTemplate?.blocks ) {\n\t\t\treturn getPostContentAttributes( editedPostTemplate?.blocks );\n\t\t}\n\t\t// If there are no blocks, we have to parse the content string.\n\t\t// Best double-check it's a string otherwise the parse function gets unhappy.\n\t\tconst parseableContent =\n\t\t\ttypeof editedPostTemplate?.content === 'string'\n\t\t\t\t? editedPostTemplate?.content\n\t\t\t\t: '';\n\n\t\treturn getPostContentAttributes( parse( parseableContent ) ) || {};\n\t}, [\n\t\teditedPostTemplate?.content,\n\t\teditedPostTemplate?.blocks,\n\t\tpostContentAttributes,\n\t] );\n\n\tconst hasPostContentAtRootLevel = useMemo( () => {\n\t\tif ( ! editedPostTemplate?.content && ! editedPostTemplate?.blocks ) {\n\t\t\treturn false;\n\t\t}\n\t\t// When in template editing mode, we can access the blocks directly.\n\t\tif ( editedPostTemplate?.blocks ) {\n\t\t\treturn checkForPostContentAtRootLevel( editedPostTemplate?.blocks );\n\t\t}\n\t\t// If there are no blocks, we have to parse the content string.\n\t\t// Best double-check it's a string otherwise the parse function gets unhappy.\n\t\tconst parseableContent =\n\t\t\ttypeof editedPostTemplate?.content === 'string'\n\t\t\t\t? editedPostTemplate?.content\n\t\t\t\t: '';\n\n\t\treturn (\n\t\t\tcheckForPostContentAtRootLevel( parse( parseableContent ) ) || false\n\t\t);\n\t}, [ editedPostTemplate?.content, editedPostTemplate?.blocks ] );\n\n\tconst { layout = {}, align = '' } = newestPostContentAttributes || {};\n\n\tconst postContentLayoutClasses = useLayoutClasses(\n\t\tnewestPostContentAttributes,\n\t\t'core/post-content'\n\t);\n\n\tconst blockListLayoutClass = clsx(\n\t\t{\n\t\t\t'is-layout-flow': ! themeSupportsLayout,\n\t\t},\n\t\tthemeSupportsLayout && postContentLayoutClasses,\n\t\talign && `align${ align }`\n\t);\n\n\tconst postContentLayoutStyles = useLayoutStyles(\n\t\tnewestPostContentAttributes,\n\t\t'core/post-content',\n\t\t'.block-editor-block-list__layout.is-root-container'\n\t);\n\n\t// Update type for blocks using legacy layouts.\n\tconst postContentLayout = useMemo( () => {\n\t\treturn layout &&\n\t\t\t( layout?.type === 'constrained' ||\n\t\t\t\tlayout?.inherit ||\n\t\t\t\tlayout?.contentSize ||\n\t\t\t\tlayout?.wideSize )\n\t\t\t? { ...globalLayoutSettings, ...layout, type: 'constrained' }\n\t\t\t: { ...globalLayoutSettings, ...layout, type: 'default' };\n\t}, [\n\t\tlayout?.type,\n\t\tlayout?.inherit,\n\t\tlayout?.contentSize,\n\t\tlayout?.wideSize,\n\t\tglobalLayoutSettings,\n\t] );\n\n\t// If there is a Post Content block we use its layout for the block list;\n\t// if not, this must be a classic theme, in which case we use the fallback layout.\n\tconst blockListLayout = postContentAttributes\n\t\t? postContentLayout\n\t\t: fallbackLayout;\n\n\tconst postEditorLayout =\n\t\tblockListLayout?.type === 'default' && ! hasPostContentAtRootLevel\n\t\t\t? fallbackLayout\n\t\t\t: blockListLayout;\n\tconst observeTypingRef = useTypingObserver();\n\tconst titleRef = useRef();\n\tuseEffect( () => {\n\t\tif ( ! autoFocus || ! isCleanNewPost() ) {\n\t\t\treturn;\n\t\t}\n\t\ttitleRef?.current?.focus();\n\t}, [ autoFocus, isCleanNewPost ] );\n\n\t// Add some styles for alignwide/alignfull Post Content and its children.\n\tconst alignCSS = `.is-root-container.alignwide { max-width: var(--wp--style--global--wide-size); margin-left: auto; margin-right: auto;}\n\t\t.is-root-container.alignwide:where(.is-layout-flow) > :not(.alignleft):not(.alignright) { max-width: var(--wp--style--global--wide-size);}\n\t\t.is-root-container.alignfull { max-width: none; margin-left: auto; margin-right: auto;}\n\t\t.is-root-container.alignfull:where(.is-layout-flow) > :not(.alignleft):not(.alignright) { max-width: none;}`;\n\n\tconst forceFullHeight = postType === NAVIGATION_POST_TYPE;\n\tconst enableResizing =\n\t\t[\n\t\t\tNAVIGATION_POST_TYPE,\n\t\t\tTEMPLATE_PART_POST_TYPE,\n\t\t\tPATTERN_POST_TYPE,\n\t\t].includes( postType ) &&\n\t\t// Disable in previews / view mode.\n\t\t! isPreview &&\n\t\t// Disable resizing in mobile viewport.\n\t\t! isMobileViewport &&\n\t\t// Disable resizing in zoomed-out mode.\n\t\t! isZoomedOut;\n\n\tconst iframeStyles = useMemo( () => {\n\t\treturn [\n\t\t\t...( styles ?? [] ),\n\t\t\t{\n\t\t\t\t// Ensures margins of children are contained so that the body background paints behind them.\n\t\t\t\t// Otherwise, the background of html (when zoomed out) would show there and appear broken. It’s\n\t\t\t\t// important mostly for post-only views yet conceivably an issue in templated views too.\n\t\t\t\tcss: `:where(.block-editor-iframe__body){display:flow-root;}.is-root-container{display:flow-root;${\n\t\t\t\t\t// Some themes will have `min-height: 100vh` for the root container,\n\t\t\t\t\t// which isn't a requirement in auto resize mode.\n\t\t\t\t\tenableResizing ? 'min-height:0!important;' : ''\n\t\t\t\t}}`,\n\t\t\t},\n\t\t];\n\t}, [ styles, enableResizing ] );\n\n\tconst localRef = useRef();\n\tconst typewriterRef = useTypewriter();\n\tcontentRef = useMergeRefs( [\n\t\tlocalRef,\n\t\tcontentRef,\n\t\trenderingMode === 'post-only' ? typewriterRef : null,\n\t\tuseFlashEditableBlocks( {\n\t\t\tisEnabled: renderingMode === 'template-locked',\n\t\t} ),\n\t\tuseSelectNearestEditableBlock( {\n\t\t\tisEnabled: renderingMode === 'template-locked',\n\t\t} ),\n\t\tuseZoomOutModeExit(),\n\t\t// Avoid resize listeners when not needed, these will trigger\n\t\t// unnecessary re-renders when animating the iframe width.\n\t\tenableResizing ? effectContentHeight : null,\n\t] );\n\n\treturn (\n\t\t<div\n\t\t\tclassName={ clsx(\n\t\t\t\t'editor-visual-editor',\n\t\t\t\t// this class is here for backward compatibility reasons.\n\t\t\t\t'edit-post-visual-editor',\n\t\t\t\tclassName,\n\t\t\t\t{\n\t\t\t\t\t'has-padding': isFocusedEntity || enableResizing,\n\t\t\t\t\t'is-resizable': enableResizing,\n\t\t\t\t\t'is-iframed': ! disableIframe,\n\t\t\t\t\t'is-scrollable': disableIframe || deviceType !== 'Desktop',\n\t\t\t\t}\n\t\t\t) }\n\t\t>\n\t\t\t<ResizableEditor\n\t\t\t\tenableResizing={ enableResizing }\n\t\t\t\theight={\n\t\t\t\t\tcontentHeight && ! forceFullHeight ? contentHeight : '100%'\n\t\t\t\t}\n\t\t\t>\n\t\t\t\t<BlockCanvas\n\t\t\t\t\tshouldIframe={ ! disableIframe }\n\t\t\t\t\tcontentRef={ contentRef }\n\t\t\t\t\tstyles={ iframeStyles }\n\t\t\t\t\theight=\"100%\"\n\t\t\t\t\tiframeProps={ {\n\t\t\t\t\t\t...iframeProps,\n\t\t\t\t\t\tstyle: {\n\t\t\t\t\t\t\t...iframeProps?.style,\n\t\t\t\t\t\t\t...deviceStyles,\n\t\t\t\t\t\t},\n\t\t\t\t\t} }\n\t\t\t\t>\n\t\t\t\t\t{ themeSupportsLayout &&\n\t\t\t\t\t\t! themeHasDisabledLayoutStyles &&\n\t\t\t\t\t\trenderingMode === 'post-only' &&\n\t\t\t\t\t\t! isDesignPostType && (\n\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t<LayoutStyle\n\t\t\t\t\t\t\t\t\tselector=\".editor-visual-editor__post-title-wrapper\"\n\t\t\t\t\t\t\t\t\tlayout={ fallbackLayout }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t<LayoutStyle\n\t\t\t\t\t\t\t\t\tselector=\".block-editor-block-list__layout.is-root-container\"\n\t\t\t\t\t\t\t\t\tlayout={ postEditorLayout }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t{ align && <LayoutStyle css={ alignCSS } /> }\n\t\t\t\t\t\t\t\t{ postContentLayoutStyles && (\n\t\t\t\t\t\t\t\t\t<LayoutStyle\n\t\t\t\t\t\t\t\t\t\tlayout={ postContentLayout }\n\t\t\t\t\t\t\t\t\t\tcss={ postContentLayoutStyles }\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{ renderingMode === 'post-only' && ! isDesignPostType && (\n\t\t\t\t\t\t<div\n\t\t\t\t\t\t\tclassName={ clsx(\n\t\t\t\t\t\t\t\t'editor-visual-editor__post-title-wrapper',\n\t\t\t\t\t\t\t\t// The following class is only here for backward compatibility\n\t\t\t\t\t\t\t\t// some themes might be using it to style the post title.\n\t\t\t\t\t\t\t\t'edit-post-visual-editor__post-title-wrapper',\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t'has-global-padding':\n\t\t\t\t\t\t\t\t\t\thasRootPaddingAwareAlignments,\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\tcontentEditable={ false }\n\t\t\t\t\t\t\tref={ observeTypingRef }\n\t\t\t\t\t\t\tstyle={ {\n\t\t\t\t\t\t\t\t// This is using inline styles\n\t\t\t\t\t\t\t\t// so it's applied for both iframed and non iframed editors.\n\t\t\t\t\t\t\t\tmarginTop: '4rem',\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<PostTitle ref={ titleRef } />\n\t\t\t\t\t\t</div>\n\t\t\t\t\t) }\n\t\t\t\t\t<RecursionProvider\n\t\t\t\t\t\tblockName={ wrapperBlockName }\n\t\t\t\t\t\tuniqueId={ wrapperUniqueId }\n\t\t\t\t\t>\n\t\t\t\t\t\t<BlockList\n\t\t\t\t\t\t\tclassName={ clsx(\n\t\t\t\t\t\t\t\t'is-' + deviceType.toLowerCase() + '-preview',\n\t\t\t\t\t\t\t\trenderingMode !== 'post-only' ||\n\t\t\t\t\t\t\t\t\tisDesignPostType\n\t\t\t\t\t\t\t\t\t? 'wp-site-blocks'\n\t\t\t\t\t\t\t\t\t: `${ blockListLayoutClass } wp-block-post-content`, // Ensure root level blocks receive default/flow blockGap styling rules.\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t'has-global-padding':\n\t\t\t\t\t\t\t\t\t\trenderingMode === 'post-only' &&\n\t\t\t\t\t\t\t\t\t\t! isDesignPostType &&\n\t\t\t\t\t\t\t\t\t\thasRootPaddingAwareAlignments,\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\tlayout={ blockListLayout }\n\t\t\t\t\t\t\tdropZoneElement={\n\t\t\t\t\t\t\t\t// When iframed, pass in the html element of the iframe to\n\t\t\t\t\t\t\t\t// ensure the drop zone extends to the edges of the iframe.\n\t\t\t\t\t\t\t\tdisableIframe\n\t\t\t\t\t\t\t\t\t? localRef.current\n\t\t\t\t\t\t\t\t\t: localRef.current?.parentNode\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t__unstableDisableDropZone={\n\t\t\t\t\t\t\t\t// In template preview mode, disable drop zones at the root of the template.\n\t\t\t\t\t\t\t\trenderingMode === 'template-locked'\n\t\t\t\t\t\t\t\t\t? true\n\t\t\t\t\t\t\t\t\t: false\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t{ renderingMode === 'template-locked' && (\n\t\t\t\t\t\t\t<EditTemplateBlocksNotification\n\t\t\t\t\t\t\t\tcontentRef={ localRef }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) }\n\t\t\t\t\t</RecursionProvider>\n\t\t\t\t</BlockCanvas>\n\t\t\t</ResizableEditor>\n\t\t</div>\n\t);\n}\n\nexport default VisualEditor;\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,YAAA,GAAAD,OAAA;AAUA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,KAAA,GAAAH,OAAA;AACA,IAAAI,OAAA,GAAAJ,OAAA;AACA,IAAAK,SAAA,GAAAL,OAAA;AACA,IAAAM,QAAA,GAAAN,OAAA;AASA,IAAAO,UAAA,GAAAR,sBAAA,CAAAC,OAAA;AACA,IAAAQ,MAAA,GAAAR,OAAA;AACA,IAAAS,WAAA,GAAAT,OAAA;AACA,IAAAU,+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]}
@@ -0,0 +1,101 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = PostPreviewView;
7
+ var _i18n = require("@wordpress/i18n");
8
+ var _blockEditor = require("@wordpress/block-editor");
9
+ var _data = require("@wordpress/data");
10
+ var _coreData = require("@wordpress/core-data");
11
+ var _provider = require("../../../components/provider");
12
+ var _lockUnlock = require("../../../lock-unlock");
13
+ var _store = require("../../../store");
14
+ var _jsxRuntime = require("react/jsx-runtime");
15
+ /**
16
+ * WordPress dependencies
17
+ */
18
+
19
+ /**
20
+ * Internal dependencies
21
+ */
22
+
23
+ // @ts-ignore
24
+
25
+ const {
26
+ useGlobalStyle
27
+ } = (0, _lockUnlock.unlock)(_blockEditor.privateApis);
28
+ function PostPreviewContainer({
29
+ template,
30
+ post
31
+ }) {
32
+ const [backgroundColor = 'white'] = useGlobalStyle('color.background');
33
+ const [postBlocks] = (0, _coreData.useEntityBlockEditor)('postType', post.type, {
34
+ id: post.id
35
+ });
36
+ const [templateBlocks] = (0, _coreData.useEntityBlockEditor)('postType', template?.type, {
37
+ id: template?.id
38
+ });
39
+ const blocks = template && templateBlocks ? templateBlocks : postBlocks;
40
+ const isEmpty = !blocks?.length;
41
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
42
+ className: "editor-fields-content-preview",
43
+ style: {
44
+ backgroundColor
45
+ },
46
+ children: [isEmpty && /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
47
+ className: "editor-fields-content-preview__empty",
48
+ children: (0, _i18n.__)('Empty content')
49
+ }), !isEmpty && /*#__PURE__*/(0, _jsxRuntime.jsx)(_blockEditor.BlockPreview.Async, {
50
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_blockEditor.BlockPreview, {
51
+ blocks: blocks
52
+ })
53
+ })]
54
+ });
55
+ }
56
+ function PostPreviewView({
57
+ item
58
+ }) {
59
+ const {
60
+ settings,
61
+ template
62
+ } = (0, _data.useSelect)(select => {
63
+ var _getPostType$viewable;
64
+ const {
65
+ canUser,
66
+ getPostType,
67
+ getTemplateId,
68
+ getEntityRecord
69
+ } = (0, _lockUnlock.unlock)(select(_coreData.store));
70
+ const canViewTemplate = canUser('read', {
71
+ kind: 'postType',
72
+ name: 'wp_template'
73
+ });
74
+ const _settings = select(_store.store).getEditorSettings();
75
+ // @ts-ignore
76
+ const supportsTemplateMode = _settings.supportsTemplateMode;
77
+ const isViewable = (_getPostType$viewable = getPostType(item.type)?.viewable) !== null && _getPostType$viewable !== void 0 ? _getPostType$viewable : false;
78
+ const templateId = supportsTemplateMode && isViewable && canViewTemplate ? getTemplateId(item.type, item.id) : null;
79
+ return {
80
+ settings: _settings,
81
+ template: templateId ? getEntityRecord('postType', 'wp_template', templateId) : undefined
82
+ };
83
+ }, [item.type, item.id]);
84
+ // Wrap everything in a block editor provider to ensure 'styles' that are needed
85
+ // for the previews are synced between the site editor store and the block editor store.
86
+ // Additionally we need to have the `__experimentalBlockPatterns` setting in order to
87
+ // render patterns inside the previews.
88
+ // TODO: Same approach is used in the patterns list and it becomes obvious that some of
89
+ // the block editor settings are needed in context where we don't have the block editor.
90
+ // Explore how we can solve this in a better way.
91
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_provider.EditorProvider, {
92
+ post: item,
93
+ settings: settings,
94
+ __unstableTemplate: template,
95
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(PostPreviewContainer, {
96
+ template: template,
97
+ post: item
98
+ })
99
+ });
100
+ }
101
+ //# sourceMappingURL=content-preview-view.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_i18n","require","_blockEditor","_data","_coreData","_provider","_lockUnlock","_store","_jsxRuntime","useGlobalStyle","unlock","blockEditorPrivateApis","PostPreviewContainer","template","post","backgroundColor","postBlocks","useEntityBlockEditor","type","id","templateBlocks","blocks","isEmpty","length","jsxs","className","style","children","jsx","__","BlockPreview","Async","PostPreviewView","item","settings","useSelect","select","_getPostType$viewable","canUser","getPostType","getTemplateId","getEntityRecord","coreStore","canViewTemplate","kind","name","_settings","editorStore","getEditorSettings","supportsTemplateMode","isViewable","viewable","templateId","undefined","EditorProvider","__unstableTemplate"],"sources":["@wordpress/editor/src/dataviews/fields/content-preview/content-preview-view.tsx"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport {\n\tBlockPreview,\n\tprivateApis as blockEditorPrivateApis,\n\t// @ts-ignore\n} from '@wordpress/block-editor';\nimport type { BasePost } from '@wordpress/fields';\nimport { useSelect } from '@wordpress/data';\nimport { useEntityBlockEditor, store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { EditorProvider } from '../../../components/provider';\nimport { unlock } from '../../../lock-unlock';\n// @ts-ignore\nimport { store as editorStore } from '../../../store';\n\nconst { useGlobalStyle } = unlock( blockEditorPrivateApis );\n\nfunction PostPreviewContainer( {\n\ttemplate,\n\tpost,\n}: {\n\ttemplate: any;\n\tpost: any;\n} ) {\n\tconst [ backgroundColor = 'white' ] = useGlobalStyle( 'color.background' );\n\tconst [ postBlocks ] = useEntityBlockEditor( 'postType', post.type, {\n\t\tid: post.id,\n\t} );\n\tconst [ templateBlocks ] = useEntityBlockEditor(\n\t\t'postType',\n\t\ttemplate?.type,\n\t\t{\n\t\t\tid: template?.id,\n\t\t}\n\t);\n\tconst blocks = template && templateBlocks ? templateBlocks : postBlocks;\n\tconst isEmpty = ! blocks?.length;\n\treturn (\n\t\t<div\n\t\t\tclassName=\"editor-fields-content-preview\"\n\t\t\tstyle={ {\n\t\t\t\tbackgroundColor,\n\t\t\t} }\n\t\t>\n\t\t\t{ isEmpty && (\n\t\t\t\t<span className=\"editor-fields-content-preview__empty\">\n\t\t\t\t\t{ __( 'Empty content' ) }\n\t\t\t\t</span>\n\t\t\t) }\n\t\t\t{ ! isEmpty && (\n\t\t\t\t<BlockPreview.Async>\n\t\t\t\t\t<BlockPreview blocks={ blocks } />\n\t\t\t\t</BlockPreview.Async>\n\t\t\t) }\n\t\t</div>\n\t);\n}\n\nexport default function PostPreviewView( { item }: { item: BasePost } ) {\n\tconst { settings, template } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { canUser, getPostType, getTemplateId, getEntityRecord } =\n\t\t\t\tunlock( select( coreStore ) );\n\t\t\tconst canViewTemplate = canUser( 'read', {\n\t\t\t\tkind: 'postType',\n\t\t\t\tname: 'wp_template',\n\t\t\t} );\n\t\t\tconst _settings = select( editorStore ).getEditorSettings();\n\t\t\t// @ts-ignore\n\t\t\tconst supportsTemplateMode = _settings.supportsTemplateMode;\n\t\t\tconst isViewable = getPostType( item.type )?.viewable ?? false;\n\n\t\t\tconst templateId =\n\t\t\t\tsupportsTemplateMode && isViewable && canViewTemplate\n\t\t\t\t\t? getTemplateId( item.type, item.id )\n\t\t\t\t\t: null;\n\t\t\treturn {\n\t\t\t\tsettings: _settings,\n\t\t\t\ttemplate: templateId\n\t\t\t\t\t? getEntityRecord( 'postType', 'wp_template', templateId )\n\t\t\t\t\t: undefined,\n\t\t\t};\n\t\t},\n\t\t[ item.type, item.id ]\n\t);\n\t// Wrap everything in a block editor provider to ensure 'styles' that are needed\n\t// for the previews are synced between the site editor store and the block editor store.\n\t// Additionally we need to have the `__experimentalBlockPatterns` setting in order to\n\t// render patterns inside the previews.\n\t// TODO: Same approach is used in the patterns list and it becomes obvious that some of\n\t// the block editor settings are needed in context where we don't have the block editor.\n\t// Explore how we can solve this in a better way.\n\treturn (\n\t\t<EditorProvider\n\t\t\tpost={ item }\n\t\t\tsettings={ settings }\n\t\t\t__unstableTemplate={ template }\n\t\t>\n\t\t\t<PostPreviewContainer template={ template } post={ item } />\n\t\t</EditorProvider>\n\t);\n}\n"],"mappings":";;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AAMA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,SAAA,GAAAH,OAAA;AAKA,IAAAI,SAAA,GAAAJ,OA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;IACrBqB,kBAAkB,EAAG1C,QAAU;IAAAc,QAAA,eAE/B,IAAAnB,WAAA,CAAAoB,GAAA,EAAChB,oBAAoB;MAACC,QAAQ,EAAGA,QAAU;MAACC,IAAI,EAAGmB;IAAM,CAAE;EAAC,CAC7C,CAAC;AAEnB","ignoreList":[]}
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.default = void 0;
8
+ var _i18n = require("@wordpress/i18n");
9
+ var _contentPreviewView = _interopRequireDefault(require("./content-preview-view"));
10
+ /**
11
+ * WordPress dependencies
12
+ */
13
+
14
+ /**
15
+ * Internal dependencies
16
+ */
17
+
18
+ const postPreviewField = {
19
+ type: 'media',
20
+ id: 'content-preview',
21
+ label: (0, _i18n.__)('Content preview'),
22
+ render: _contentPreviewView.default,
23
+ enableSorting: false
24
+ };
25
+ var _default = exports.default = postPreviewField;
26
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_i18n","require","_contentPreviewView","_interopRequireDefault","postPreviewField","type","id","label","__","render","PostPreviewView","enableSorting","_default","exports","default"],"sources":["@wordpress/editor/src/dataviews/fields/content-preview/index.tsx"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport type { Field } from '@wordpress/dataviews';\nimport type { BasePost } from '@wordpress/fields';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport PostPreviewView from './content-preview-view';\n\nconst postPreviewField: Field< BasePost > = {\n\ttype: 'media',\n\tid: 'content-preview',\n\tlabel: __( 'Content preview' ),\n\trender: PostPreviewView,\n\tenableSorting: false,\n};\n\nexport default postPreviewField;\n"],"mappings":";;;;;;;AAKA,IAAAA,KAAA,GAAAC,OAAA;AAKA,IAAAC,mBAAA,GAAAC,sBAAA,CAAAF,OAAA;AAVA;AACA;AACA;;AAKA;AACA;AACA;;AAGA,MAAMG,gBAAmC,GAAG;EAC3CC,IAAI,EAAE,OAAO;EACbC,EAAE,EAAE,iBAAiB;EACrBC,KAAK,EAAE,IAAAC,QAAE,EAAE,iBAAkB,CAAC;EAC9BC,MAAM,EAAEC,2BAAe;EACvBC,aAAa,EAAE;AAChB,CAAC;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEaV,gBAAgB","ignoreList":[]}
@@ -1,6 +1,7 @@
1
1
  /* wp:polyfill */
2
2
  "use strict";
3
3
 
4
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
5
  Object.defineProperty(exports, "__esModule", {
5
6
  value: true
6
7
  });
@@ -14,6 +15,7 @@ var _coreData = require("@wordpress/core-data");
14
15
  var _hooks = require("@wordpress/hooks");
15
16
  var _fields = require("@wordpress/fields");
16
17
  var _store = require("../../store");
18
+ var _contentPreview = _interopRequireDefault(require("../fields/content-preview"));
17
19
  var _lockUnlock = require("../../lock-unlock");
18
20
  /**
19
21
  * WordPress dependencies
@@ -79,7 +81,7 @@ const registerPostTypeSchema = postType => async ({
79
81
  const actions = [postTypeConfig.viewable ? _fields.viewPost : undefined, !!postTypeConfig.supports?.revisions ? _fields.viewPostRevisions : undefined,
80
82
  // @ts-ignore
81
83
  globalThis.IS_GUTENBERG_PLUGIN ? !['wp_template', 'wp_block', 'wp_template_part'].includes(postTypeConfig.slug) && canCreate && _fields.duplicatePost : undefined, postTypeConfig.slug === 'wp_template_part' && canCreate && currentTheme?.is_block_theme ? _fields.duplicateTemplatePart : undefined, canCreate && postTypeConfig.slug === 'wp_block' ? _fields.duplicatePattern : undefined, postTypeConfig.supports?.title ? _fields.renamePost : undefined, postTypeConfig.supports?.['page-attributes'] ? _fields.reorderPage : undefined, postTypeConfig.slug === 'wp_block' ? _fields.exportPattern : undefined, _fields.restorePost, _fields.resetPost, _fields.deletePost, _fields.trashPost, _fields.permanentlyDeletePost].filter(Boolean);
82
- const fields = [postTypeConfig.supports?.thumbnail && currentTheme?.theme_supports?.['post-thumbnails'] && _fields.featuredImageField, postTypeConfig.supports?.author && _fields.authorField, _fields.statusField, _fields.dateField, _fields.slugField, postTypeConfig.supports?.['page-attributes'] && _fields.parentField, postTypeConfig.supports?.comments && _fields.commentStatusField, _fields.templateField, _fields.passwordField].filter(Boolean);
84
+ const fields = [postTypeConfig.supports?.thumbnail && currentTheme?.theme_supports?.['post-thumbnails'] && _fields.featuredImageField, postTypeConfig.supports?.author && _fields.authorField, _fields.statusField, _fields.dateField, _fields.slugField, postTypeConfig.supports?.['page-attributes'] && _fields.parentField, postTypeConfig.supports?.comments && _fields.commentStatusField, _fields.templateField, _fields.passwordField, postTypeConfig.supports?.editor && postTypeConfig.viewable && _contentPreview.default].filter(Boolean);
83
85
  if (postTypeConfig.supports?.title) {
84
86
  let _titleField;
85
87
  if (postType === 'page') {
@@ -1 +1 @@
1
- {"version":3,"names":["_coreData","require","_hooks","_fields","_store","_lockUnlock","registerEntityAction","kind","name","config","type","unregisterEntityAction","actionId","registerEntityField","unregisterEntityField","fieldId","setIsReady","registerPostTypeSchema","postType","registry","isReady","unlock","select","editorStore","isEntityReady","dispatch","postTypeConfig","resolveSelect","coreStore","getPostType","canCreate","canUser","currentTheme","getCurrentTheme","actions","viewable","viewPost","undefined","supports","revisions","viewPostRevisions","globalThis","IS_GUTENBERG_PLUGIN","includes","slug","duplicatePost","is_block_theme","duplicateTemplatePart","duplicatePattern","title","renamePost","reorderPage","exportPattern","restorePost","resetPost","deletePost","trashPost","permanentlyDeletePost","filter","Boolean","fields","thumbnail","theme_supports","featuredImageField","author","authorField","statusField","dateField","slugField","parentField","comments","commentStatusField","templateField","passwordField","_titleField","pageTitleField","templateTitleField","patternTitleField","titleField","push","batch","forEach","action","field","doAction","exports"],"sources":["@wordpress/editor/src/dataviews/store/private-actions.ts"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { store as coreStore } from '@wordpress/core-data';\nimport type { Action, Field } from '@wordpress/dataviews';\nimport { doAction } from '@wordpress/hooks';\nimport type { PostType } from '@wordpress/fields';\nimport {\n\tviewPost,\n\tviewPostRevisions,\n\tduplicatePost,\n\tduplicatePattern,\n\treorderPage,\n\texportPattern,\n\tpermanentlyDeletePost,\n\trestorePost,\n\ttrashPost,\n\trenamePost,\n\tresetPost,\n\tdeletePost,\n\tduplicateTemplatePart,\n\tfeaturedImageField,\n\tdateField,\n\tparentField,\n\tpasswordField,\n\tcommentStatusField,\n\tslugField,\n\tstatusField,\n\tauthorField,\n\ttitleField,\n\ttemplateField,\n\ttemplateTitleField,\n\tpageTitleField,\n\tpatternTitleField,\n} from '@wordpress/fields';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\n\nexport function registerEntityAction< Item >(\n\tkind: string,\n\tname: string,\n\tconfig: Action< Item >\n) {\n\treturn {\n\t\ttype: 'REGISTER_ENTITY_ACTION' as const,\n\t\tkind,\n\t\tname,\n\t\tconfig,\n\t};\n}\n\nexport function unregisterEntityAction(\n\tkind: string,\n\tname: string,\n\tactionId: string\n) {\n\treturn {\n\t\ttype: 'UNREGISTER_ENTITY_ACTION' as const,\n\t\tkind,\n\t\tname,\n\t\tactionId,\n\t};\n}\n\nexport function registerEntityField< Item >(\n\tkind: string,\n\tname: string,\n\tconfig: Field< Item >\n) {\n\treturn {\n\t\ttype: 'REGISTER_ENTITY_FIELD' as const,\n\t\tkind,\n\t\tname,\n\t\tconfig,\n\t};\n}\n\nexport function unregisterEntityField(\n\tkind: string,\n\tname: string,\n\tfieldId: string\n) {\n\treturn {\n\t\ttype: 'UNREGISTER_ENTITY_FIELD' as const,\n\t\tkind,\n\t\tname,\n\t\tfieldId,\n\t};\n}\n\nexport function setIsReady( kind: string, name: string ) {\n\treturn {\n\t\ttype: 'SET_IS_READY' as const,\n\t\tkind,\n\t\tname,\n\t};\n}\n\nexport const registerPostTypeSchema =\n\t( postType: string ) =>\n\tasync ( { registry }: { registry: any } ) => {\n\t\tconst isReady = unlock( registry.select( editorStore ) ).isEntityReady(\n\t\t\t'postType',\n\t\t\tpostType\n\t\t);\n\t\tif ( isReady ) {\n\t\t\treturn;\n\t\t}\n\n\t\tunlock( registry.dispatch( editorStore ) ).setIsReady(\n\t\t\t'postType',\n\t\t\tpostType\n\t\t);\n\n\t\tconst postTypeConfig = ( await registry\n\t\t\t.resolveSelect( coreStore )\n\t\t\t.getPostType( postType ) ) as PostType;\n\n\t\tconst canCreate = await registry\n\t\t\t.resolveSelect( coreStore )\n\t\t\t.canUser( 'create', {\n\t\t\t\tkind: 'postType',\n\t\t\t\tname: postType,\n\t\t\t} );\n\t\tconst currentTheme = await registry\n\t\t\t.resolveSelect( coreStore )\n\t\t\t.getCurrentTheme();\n\n\t\tconst actions = [\n\t\t\tpostTypeConfig.viewable ? viewPost : undefined,\n\t\t\t!! postTypeConfig.supports?.revisions\n\t\t\t\t? viewPostRevisions\n\t\t\t\t: undefined,\n\t\t\t// @ts-ignore\n\t\t\tglobalThis.IS_GUTENBERG_PLUGIN\n\t\t\t\t? ! [ 'wp_template', 'wp_block', 'wp_template_part' ].includes(\n\t\t\t\t\t\tpostTypeConfig.slug\n\t\t\t\t ) &&\n\t\t\t\t canCreate &&\n\t\t\t\t duplicatePost\n\t\t\t\t: undefined,\n\t\t\tpostTypeConfig.slug === 'wp_template_part' &&\n\t\t\tcanCreate &&\n\t\t\tcurrentTheme?.is_block_theme\n\t\t\t\t? duplicateTemplatePart\n\t\t\t\t: undefined,\n\t\t\tcanCreate && postTypeConfig.slug === 'wp_block'\n\t\t\t\t? duplicatePattern\n\t\t\t\t: undefined,\n\t\t\tpostTypeConfig.supports?.title ? renamePost : undefined,\n\t\t\tpostTypeConfig.supports?.[ 'page-attributes' ]\n\t\t\t\t? reorderPage\n\t\t\t\t: undefined,\n\t\t\tpostTypeConfig.slug === 'wp_block' ? exportPattern : undefined,\n\t\t\trestorePost,\n\t\t\tresetPost,\n\t\t\tdeletePost,\n\t\t\ttrashPost,\n\t\t\tpermanentlyDeletePost,\n\t\t].filter( Boolean );\n\n\t\tconst fields = [\n\t\t\tpostTypeConfig.supports?.thumbnail &&\n\t\t\t\tcurrentTheme?.theme_supports?.[ 'post-thumbnails' ] &&\n\t\t\t\tfeaturedImageField,\n\t\t\tpostTypeConfig.supports?.author && authorField,\n\t\t\tstatusField,\n\t\t\tdateField,\n\t\t\tslugField,\n\t\t\tpostTypeConfig.supports?.[ 'page-attributes' ] && parentField,\n\t\t\tpostTypeConfig.supports?.comments && commentStatusField,\n\t\t\ttemplateField,\n\t\t\tpasswordField,\n\t\t].filter( Boolean );\n\t\tif ( postTypeConfig.supports?.title ) {\n\t\t\tlet _titleField;\n\t\t\tif ( postType === 'page' ) {\n\t\t\t\t_titleField = pageTitleField;\n\t\t\t} else if ( postType === 'wp_template' ) {\n\t\t\t\t_titleField = templateTitleField;\n\t\t\t} else if ( postType === 'wp_block' ) {\n\t\t\t\t_titleField = patternTitleField;\n\t\t\t} else {\n\t\t\t\t_titleField = titleField;\n\t\t\t}\n\t\t\tfields.push( _titleField );\n\t\t}\n\n\t\tregistry.batch( () => {\n\t\t\tactions.forEach( ( action ) => {\n\t\t\t\tunlock( registry.dispatch( editorStore ) ).registerEntityAction(\n\t\t\t\t\t'postType',\n\t\t\t\t\tpostType,\n\t\t\t\t\taction\n\t\t\t\t);\n\t\t\t} );\n\t\t\tfields.forEach( ( field ) => {\n\t\t\t\tunlock( registry.dispatch( editorStore ) ).registerEntityField(\n\t\t\t\t\t'postType',\n\t\t\t\t\tpostType,\n\t\t\t\t\tfield\n\t\t\t\t);\n\t\t\t} );\n\t\t} );\n\n\t\tdoAction( 'core.registerPostTypeSchema', postType );\n\t};\n"],"mappings":";;;;;;;;;;;;AAGA,IAAAA,SAAA,GAAAC,OAAA;AAEA,IAAAC,MAAA,GAAAD,OAAA;AAEA,IAAAE,OAAA,GAAAF,OAAA;AAgCA,IAAAG,MAAA,GAAAH,OAAA;AACA,IAAAI,WAAA,GAAAJ,OAAA;AA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ACmE,OAAA,CAAApE,sBAAA,GAAAA,sBAAA","ignoreList":[]}
1
+ {"version":3,"names":["_coreData","require","_hooks","_fields","_store","_contentPreview","_interopRequireDefault","_lockUnlock","registerEntityAction","kind","name","config","type","unregisterEntityAction","actionId","registerEntityField","unregisterEntityField","fieldId","setIsReady","registerPostTypeSchema","postType","registry","isReady","unlock","select","editorStore","isEntityReady","dispatch","postTypeConfig","resolveSelect","coreStore","getPostType","canCreate","canUser","currentTheme","getCurrentTheme","actions","viewable","viewPost","undefined","supports","revisions","viewPostRevisions","globalThis","IS_GUTENBERG_PLUGIN","includes","slug","duplicatePost","is_block_theme","duplicateTemplatePart","duplicatePattern","title","renamePost","reorderPage","exportPattern","restorePost","resetPost","deletePost","trashPost","permanentlyDeletePost","filter","Boolean","fields","thumbnail","theme_supports","featuredImageField","author","authorField","statusField","dateField","slugField","parentField","comments","commentStatusField","templateField","passwordField","editor","postPreviewField","_titleField","pageTitleField","templateTitleField","patternTitleField","titleField","push","batch","forEach","action","field","doAction","exports"],"sources":["@wordpress/editor/src/dataviews/store/private-actions.ts"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { store as coreStore } from '@wordpress/core-data';\nimport type { Action, Field } from '@wordpress/dataviews';\nimport { doAction } from '@wordpress/hooks';\nimport type { PostType } from '@wordpress/fields';\nimport {\n\tviewPost,\n\tviewPostRevisions,\n\tduplicatePost,\n\tduplicatePattern,\n\treorderPage,\n\texportPattern,\n\tpermanentlyDeletePost,\n\trestorePost,\n\ttrashPost,\n\trenamePost,\n\tresetPost,\n\tdeletePost,\n\tduplicateTemplatePart,\n\tfeaturedImageField,\n\tdateField,\n\tparentField,\n\tpasswordField,\n\tcommentStatusField,\n\tslugField,\n\tstatusField,\n\tauthorField,\n\ttitleField,\n\ttemplateField,\n\ttemplateTitleField,\n\tpageTitleField,\n\tpatternTitleField,\n} from '@wordpress/fields';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\nimport postPreviewField from '../fields/content-preview';\nimport { unlock } from '../../lock-unlock';\n\nexport function registerEntityAction< Item >(\n\tkind: string,\n\tname: string,\n\tconfig: Action< Item >\n) {\n\treturn {\n\t\ttype: 'REGISTER_ENTITY_ACTION' as const,\n\t\tkind,\n\t\tname,\n\t\tconfig,\n\t};\n}\n\nexport function unregisterEntityAction(\n\tkind: string,\n\tname: string,\n\tactionId: string\n) {\n\treturn {\n\t\ttype: 'UNREGISTER_ENTITY_ACTION' as const,\n\t\tkind,\n\t\tname,\n\t\tactionId,\n\t};\n}\n\nexport function registerEntityField< Item >(\n\tkind: string,\n\tname: string,\n\tconfig: Field< Item >\n) {\n\treturn {\n\t\ttype: 'REGISTER_ENTITY_FIELD' as const,\n\t\tkind,\n\t\tname,\n\t\tconfig,\n\t};\n}\n\nexport function unregisterEntityField(\n\tkind: string,\n\tname: string,\n\tfieldId: string\n) {\n\treturn {\n\t\ttype: 'UNREGISTER_ENTITY_FIELD' as const,\n\t\tkind,\n\t\tname,\n\t\tfieldId,\n\t};\n}\n\nexport function setIsReady( kind: string, name: string ) {\n\treturn {\n\t\ttype: 'SET_IS_READY' as const,\n\t\tkind,\n\t\tname,\n\t};\n}\n\nexport const registerPostTypeSchema =\n\t( postType: string ) =>\n\tasync ( { registry }: { registry: any } ) => {\n\t\tconst isReady = unlock( registry.select( editorStore ) ).isEntityReady(\n\t\t\t'postType',\n\t\t\tpostType\n\t\t);\n\t\tif ( isReady ) {\n\t\t\treturn;\n\t\t}\n\n\t\tunlock( registry.dispatch( editorStore ) ).setIsReady(\n\t\t\t'postType',\n\t\t\tpostType\n\t\t);\n\n\t\tconst postTypeConfig = ( await registry\n\t\t\t.resolveSelect( coreStore )\n\t\t\t.getPostType( postType ) ) as PostType;\n\n\t\tconst canCreate = await registry\n\t\t\t.resolveSelect( coreStore )\n\t\t\t.canUser( 'create', {\n\t\t\t\tkind: 'postType',\n\t\t\t\tname: postType,\n\t\t\t} );\n\t\tconst currentTheme = await registry\n\t\t\t.resolveSelect( coreStore )\n\t\t\t.getCurrentTheme();\n\n\t\tconst actions = [\n\t\t\tpostTypeConfig.viewable ? viewPost : undefined,\n\t\t\t!! postTypeConfig.supports?.revisions\n\t\t\t\t? viewPostRevisions\n\t\t\t\t: undefined,\n\t\t\t// @ts-ignore\n\t\t\tglobalThis.IS_GUTENBERG_PLUGIN\n\t\t\t\t? ! [ 'wp_template', 'wp_block', 'wp_template_part' ].includes(\n\t\t\t\t\t\tpostTypeConfig.slug\n\t\t\t\t ) &&\n\t\t\t\t canCreate &&\n\t\t\t\t duplicatePost\n\t\t\t\t: undefined,\n\t\t\tpostTypeConfig.slug === 'wp_template_part' &&\n\t\t\tcanCreate &&\n\t\t\tcurrentTheme?.is_block_theme\n\t\t\t\t? duplicateTemplatePart\n\t\t\t\t: undefined,\n\t\t\tcanCreate && postTypeConfig.slug === 'wp_block'\n\t\t\t\t? duplicatePattern\n\t\t\t\t: undefined,\n\t\t\tpostTypeConfig.supports?.title ? renamePost : undefined,\n\t\t\tpostTypeConfig.supports?.[ 'page-attributes' ]\n\t\t\t\t? reorderPage\n\t\t\t\t: undefined,\n\t\t\tpostTypeConfig.slug === 'wp_block' ? exportPattern : undefined,\n\t\t\trestorePost,\n\t\t\tresetPost,\n\t\t\tdeletePost,\n\t\t\ttrashPost,\n\t\t\tpermanentlyDeletePost,\n\t\t].filter( Boolean );\n\n\t\tconst fields = [\n\t\t\tpostTypeConfig.supports?.thumbnail &&\n\t\t\t\tcurrentTheme?.theme_supports?.[ 'post-thumbnails' ] &&\n\t\t\t\tfeaturedImageField,\n\t\t\tpostTypeConfig.supports?.author && authorField,\n\t\t\tstatusField,\n\t\t\tdateField,\n\t\t\tslugField,\n\t\t\tpostTypeConfig.supports?.[ 'page-attributes' ] && parentField,\n\t\t\tpostTypeConfig.supports?.comments && commentStatusField,\n\t\t\ttemplateField,\n\t\t\tpasswordField,\n\t\t\tpostTypeConfig.supports?.editor &&\n\t\t\t\tpostTypeConfig.viewable &&\n\t\t\t\tpostPreviewField,\n\t\t].filter( Boolean );\n\t\tif ( postTypeConfig.supports?.title ) {\n\t\t\tlet _titleField;\n\t\t\tif ( postType === 'page' ) {\n\t\t\t\t_titleField = pageTitleField;\n\t\t\t} else if ( postType === 'wp_template' ) {\n\t\t\t\t_titleField = templateTitleField;\n\t\t\t} else if ( postType === 'wp_block' ) {\n\t\t\t\t_titleField = patternTitleField;\n\t\t\t} else {\n\t\t\t\t_titleField = titleField;\n\t\t\t}\n\t\t\tfields.push( _titleField );\n\t\t}\n\n\t\tregistry.batch( () => {\n\t\t\tactions.forEach( ( action ) => {\n\t\t\t\tunlock( registry.dispatch( editorStore ) ).registerEntityAction(\n\t\t\t\t\t'postType',\n\t\t\t\t\tpostType,\n\t\t\t\t\taction\n\t\t\t\t);\n\t\t\t} );\n\t\t\tfields.forEach( ( field ) => {\n\t\t\t\tunlock( registry.dispatch( editorStore ) ).registerEntityField(\n\t\t\t\t\t'postType',\n\t\t\t\t\tpostType,\n\t\t\t\t\tfield\n\t\t\t\t);\n\t\t\t} );\n\t\t} );\n\n\t\tdoAction( 'core.registerPostTypeSchema', postType );\n\t};\n"],"mappings":";;;;;;;;;;;;;AAGA,IAAAA,SAAA,GAAAC,OAAA;AAEA,IAAAC,MAAA,GAAAD,OAAA;AAEA,IAAAE,OAAA,GAAAF,OAAA;AAgCA,IAAAG,MAAA,GAAAH,OAAA;AACA,IAAAI,eAAA,GAAAC,sBAAA,CAAAL,OAAA;AACA,IAAAM,WAAA,GAAAN,OAAA;AAzCA;AACA;AACA;;AAkCA;AACA;AACA;;AAKO,SAASO,oBAAoBA,CACnCC,IAAY,EACZC,IAAY,EACZC,MAAsB,EACrB;EACD,OAAO;IACNC,IAAI,EAAE,wBAAiC;IACvCH,IAAI;IACJC,IAAI;IACJC;EACD,CAAC;AACF;AAEO,SAASE,sBAAsBA,CACrCJ,IAAY,EACZC,IAAY,EACZI,QAAgB,EACf;EACD,OAAO;IACNF,IAAI,EAAE,0BAAmC;IACzCH,IAAI;IACJC,I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cAAc,CAACS,QAAQ,IACvBwC,uBAAgB,CACjB,CAACjB,MAAM,CAAEC,OAAQ,CAAC;EACnB,IAAKjC,cAAc,CAACY,QAAQ,EAAEW,KAAK,EAAG;IACrC,IAAI2B,WAAW;IACf,IAAK1D,QAAQ,KAAK,MAAM,EAAG;MAC1B0D,WAAW,GAAGC,sBAAc;IAC7B,CAAC,MAAM,IAAK3D,QAAQ,KAAK,aAAa,EAAG;MACxC0D,WAAW,GAAGE,0BAAkB;IACjC,CAAC,MAAM,IAAK5D,QAAQ,KAAK,UAAU,EAAG;MACrC0D,WAAW,GAAGG,yBAAiB;IAChC,CAAC,MAAM;MACNH,WAAW,GAAGI,kBAAU;IACzB;IACApB,MAAM,CAACqB,IAAI,CAAEL,WAAY,CAAC;EAC3B;EAEAzD,QAAQ,CAAC+D,KAAK,CAAE,MAAM;IACrBhD,OAAO,CAACiD,OAAO,CAAIC,MAAM,IAAM;MAC9B,IAAA/D,kBAAM,EAAEF,QAAQ,CAACM,QAAQ,CAAEF,YAAY,CAAE,CAAC,CAACjB,oBAAoB,CAC9D,UAAU,EACVY,QAAQ,EACRkE,MACD,CAAC;IACF,CAAE,CAAC;IACHxB,MAAM,CAACuB,OAAO,CAAIE,KAAK,IAAM;MAC5B,IAAAhE,kBAAM,EAAEF,QAAQ,CAACM,QAAQ,CAAEF,YAAY,CAAE,CAAC,CAACV,mBAAmB,CAC7D,UAAU,EACVK,QAAQ,EACRmE,KACD,CAAC;IACF,CAAE,CAAC;EACJ,CAAE,CAAC;EAEH,IAAAC,eAAQ,EAAE,6BAA6B,EAAEpE,QAAS,CAAC;AACpD,CAAC;AAACqE,OAAA,CAAAtE,sBAAA,GAAAA,sBAAA","ignoreList":[]}
@@ -298,7 +298,7 @@ const removeTemplates = items => async ({
298
298
  });
299
299
  }));
300
300
 
301
- // If all the promises were fulfilled with sucess.
301
+ // If all the promises were fulfilled with success.
302
302
  if (promiseResult.every(({
303
303
  status
304
304
  }) => status === 'fulfilled')) {