@wordpress/edit-post 5.0.7 → 5.0.11

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 (247) hide show
  1. package/build/components/block-manager/category.js +13 -11
  2. package/build/components/block-manager/category.js.map +1 -1
  3. package/build/components/block-manager/checklist.js +6 -5
  4. package/build/components/block-manager/checklist.js.map +1 -1
  5. package/build/components/block-manager/index.js +14 -10
  6. package/build/components/block-manager/index.js.map +1 -1
  7. package/build/components/block-manager/show-all.js +5 -4
  8. package/build/components/block-manager/show-all.js.map +1 -1
  9. package/build/components/block-settings-menu/plugin-block-settings-menu-item.js +26 -21
  10. package/build/components/block-settings-menu/plugin-block-settings-menu-item.js.map +1 -1
  11. package/build/components/browser-url/index.js +1 -1
  12. package/build/components/editor-initialization/index.js +4 -3
  13. package/build/components/editor-initialization/index.js.map +1 -1
  14. package/build/components/editor-initialization/utils.js +2 -1
  15. package/build/components/editor-initialization/utils.js.map +1 -1
  16. package/build/components/header/fullscreen-mode-close/index.js +6 -5
  17. package/build/components/header/fullscreen-mode-close/index.js.map +1 -1
  18. package/build/components/header/header-toolbar/index.native.js +12 -11
  19. package/build/components/header/header-toolbar/index.native.js.map +1 -1
  20. package/build/components/header/index.js +4 -3
  21. package/build/components/header/index.js.map +1 -1
  22. package/build/components/header/main-dashboard-button/index.js +4 -3
  23. package/build/components/header/main-dashboard-button/index.js.map +1 -1
  24. package/build/components/header/more-menu/index.js +23 -19
  25. package/build/components/header/more-menu/index.js.map +1 -1
  26. package/build/components/header/post-publish-button-or-toggle.js +14 -13
  27. package/build/components/header/post-publish-button-or-toggle.js.map +1 -1
  28. package/build/components/header/template-title/index.js +13 -10
  29. package/build/components/header/template-title/index.js.map +1 -1
  30. package/build/components/header/tools-more-menu-group/index.js +10 -7
  31. package/build/components/header/tools-more-menu-group/index.js.map +1 -1
  32. package/build/components/keyboard-shortcut-help-modal/dynamic-shortcut.js +4 -3
  33. package/build/components/keyboard-shortcut-help-modal/dynamic-shortcut.js.map +1 -1
  34. package/build/components/keyboard-shortcut-help-modal/index.js +54 -44
  35. package/build/components/keyboard-shortcut-help-modal/index.js.map +1 -1
  36. package/build/components/keyboard-shortcut-help-modal/shortcut.js +12 -10
  37. package/build/components/keyboard-shortcut-help-modal/shortcut.js.map +1 -1
  38. package/build/components/layout/actions-panel.js +7 -6
  39. package/build/components/layout/actions-panel.js.map +1 -1
  40. package/build/components/layout/index.js +4 -3
  41. package/build/components/layout/index.js.map +1 -1
  42. package/build/components/meta-boxes/index.js +13 -9
  43. package/build/components/meta-boxes/index.js.map +1 -1
  44. package/build/components/meta-boxes/meta-box-visibility.js +8 -5
  45. package/build/components/meta-boxes/meta-box-visibility.js.map +1 -1
  46. package/build/components/meta-boxes/meta-boxes-area/index.js +4 -3
  47. package/build/components/meta-boxes/meta-boxes-area/index.js.map +1 -1
  48. package/build/components/preferences-modal/index.js +13 -11
  49. package/build/components/preferences-modal/index.js.map +1 -1
  50. package/build/components/preferences-modal/meta-boxes-section.js +23 -16
  51. package/build/components/preferences-modal/meta-boxes-section.js.map +1 -1
  52. package/build/components/preferences-modal/options/base.js +8 -7
  53. package/build/components/preferences-modal/options/base.js.map +1 -1
  54. package/build/components/preferences-modal/options/enable-custom-fields.js +9 -7
  55. package/build/components/preferences-modal/options/enable-custom-fields.js.map +1 -1
  56. package/build/components/preferences-modal/options/enable-feature.js +12 -8
  57. package/build/components/preferences-modal/options/enable-feature.js.map +1 -1
  58. package/build/components/preferences-modal/options/enable-panel.js +17 -10
  59. package/build/components/preferences-modal/options/enable-panel.js.map +1 -1
  60. package/build/components/preferences-modal/options/enable-plugin-document-setting-panel.js +10 -7
  61. package/build/components/preferences-modal/options/enable-plugin-document-setting-panel.js.map +1 -1
  62. package/build/components/preferences-modal/options/index.js +6 -6
  63. package/build/components/preferences-modal/section.js +14 -11
  64. package/build/components/preferences-modal/section.js.map +1 -1
  65. package/build/components/sidebar/discussion-panel/index.js +7 -5
  66. package/build/components/sidebar/discussion-panel/index.js.map +1 -1
  67. package/build/components/sidebar/featured-image/index.js +8 -6
  68. package/build/components/sidebar/featured-image/index.js.map +1 -1
  69. package/build/components/sidebar/plugin-document-setting-panel/index.js +25 -20
  70. package/build/components/sidebar/plugin-document-setting-panel/index.js.map +1 -1
  71. package/build/components/sidebar/plugin-post-publish-panel/index.js +15 -12
  72. package/build/components/sidebar/plugin-post-publish-panel/index.js.map +1 -1
  73. package/build/components/sidebar/plugin-post-status-info/index.js +9 -6
  74. package/build/components/sidebar/plugin-post-status-info/index.js.map +1 -1
  75. package/build/components/sidebar/plugin-pre-publish-panel/index.js +15 -12
  76. package/build/components/sidebar/plugin-pre-publish-panel/index.js.map +1 -1
  77. package/build/components/sidebar/plugin-sidebar/index.js +5 -4
  78. package/build/components/sidebar/plugin-sidebar/index.js.map +1 -1
  79. package/build/components/sidebar/post-excerpt/index.js +7 -5
  80. package/build/components/sidebar/post-excerpt/index.js.map +1 -1
  81. package/build/components/sidebar/post-link/index.js +19 -17
  82. package/build/components/sidebar/post-link/index.js.map +1 -1
  83. package/build/components/sidebar/post-schedule/index.js +12 -9
  84. package/build/components/sidebar/post-schedule/index.js.map +1 -1
  85. package/build/components/sidebar/post-status/index.js +11 -7
  86. package/build/components/sidebar/post-status/index.js.map +1 -1
  87. package/build/components/sidebar/post-taxonomies/taxonomy-panel.js +9 -7
  88. package/build/components/sidebar/post-taxonomies/taxonomy-panel.js.map +1 -1
  89. package/build/components/sidebar/post-visibility/index.js +24 -18
  90. package/build/components/sidebar/post-visibility/index.js.map +1 -1
  91. package/build/components/sidebar/settings-header/index.js +4 -3
  92. package/build/components/sidebar/settings-header/index.js.map +1 -1
  93. package/build/components/sidebar/template/actions.js +3 -1
  94. package/build/components/sidebar/template/actions.js.map +1 -1
  95. package/build/components/sidebar/template/index.js +7 -4
  96. package/build/components/sidebar/template/index.js.map +1 -1
  97. package/build/components/text-editor/index.js +5 -4
  98. package/build/components/text-editor/index.js.map +1 -1
  99. package/build/components/visual-editor/block-inspector-button.js +5 -4
  100. package/build/components/visual-editor/block-inspector-button.js.map +1 -1
  101. package/build/components/visual-editor/header.native.js +7 -6
  102. package/build/components/visual-editor/header.native.js.map +1 -1
  103. package/build/components/visual-editor/index.js +20 -15
  104. package/build/components/visual-editor/index.js.map +1 -1
  105. package/build/components/welcome-guide/image.js +5 -4
  106. package/build/components/welcome-guide/image.js.map +1 -1
  107. package/build/editor.js +9 -8
  108. package/build/editor.js.map +1 -1
  109. package/build/hooks/validate-multiple-use/index.js +28 -17
  110. package/build/hooks/validate-multiple-use/index.js.map +1 -1
  111. package/build/index.js +2 -2
  112. package/build/plugins/index.js +23 -20
  113. package/build/plugins/index.js.map +1 -1
  114. package/build/plugins/keyboard-shortcuts-help-menu-item/index.js +4 -3
  115. package/build/plugins/keyboard-shortcuts-help-menu-item/index.js.map +1 -1
  116. package/build/store/actions.js +26 -22
  117. package/build/store/actions.js.map +1 -1
  118. package/build/store/index.js +4 -2
  119. package/build/store/index.js.map +1 -1
  120. package/build/store/reducer.js +52 -17
  121. package/build/store/reducer.js.map +1 -1
  122. package/build/store/selectors.js +20 -17
  123. package/build/store/selectors.js.map +1 -1
  124. package/build-module/components/block-manager/category.js +13 -11
  125. package/build-module/components/block-manager/category.js.map +1 -1
  126. package/build-module/components/block-manager/checklist.js +6 -5
  127. package/build-module/components/block-manager/checklist.js.map +1 -1
  128. package/build-module/components/block-manager/index.js +14 -10
  129. package/build-module/components/block-manager/index.js.map +1 -1
  130. package/build-module/components/block-manager/show-all.js +5 -4
  131. package/build-module/components/block-manager/show-all.js.map +1 -1
  132. package/build-module/components/block-settings-menu/plugin-block-settings-menu-item.js +26 -21
  133. package/build-module/components/block-settings-menu/plugin-block-settings-menu-item.js.map +1 -1
  134. package/build-module/components/editor-initialization/index.js +4 -3
  135. package/build-module/components/editor-initialization/index.js.map +1 -1
  136. package/build-module/components/editor-initialization/utils.js +2 -1
  137. package/build-module/components/editor-initialization/utils.js.map +1 -1
  138. package/build-module/components/header/fullscreen-mode-close/index.js +6 -5
  139. package/build-module/components/header/fullscreen-mode-close/index.js.map +1 -1
  140. package/build-module/components/header/header-toolbar/index.native.js +12 -11
  141. package/build-module/components/header/header-toolbar/index.native.js.map +1 -1
  142. package/build-module/components/header/index.js +4 -3
  143. package/build-module/components/header/index.js.map +1 -1
  144. package/build-module/components/header/main-dashboard-button/index.js +4 -3
  145. package/build-module/components/header/main-dashboard-button/index.js.map +1 -1
  146. package/build-module/components/header/more-menu/index.js +23 -19
  147. package/build-module/components/header/more-menu/index.js.map +1 -1
  148. package/build-module/components/header/post-publish-button-or-toggle.js +14 -13
  149. package/build-module/components/header/post-publish-button-or-toggle.js.map +1 -1
  150. package/build-module/components/header/template-title/index.js +13 -10
  151. package/build-module/components/header/template-title/index.js.map +1 -1
  152. package/build-module/components/header/tools-more-menu-group/index.js +10 -7
  153. package/build-module/components/header/tools-more-menu-group/index.js.map +1 -1
  154. package/build-module/components/keyboard-shortcut-help-modal/dynamic-shortcut.js +4 -3
  155. package/build-module/components/keyboard-shortcut-help-modal/dynamic-shortcut.js.map +1 -1
  156. package/build-module/components/keyboard-shortcut-help-modal/index.js +52 -42
  157. package/build-module/components/keyboard-shortcut-help-modal/index.js.map +1 -1
  158. package/build-module/components/keyboard-shortcut-help-modal/shortcut.js +12 -10
  159. package/build-module/components/keyboard-shortcut-help-modal/shortcut.js.map +1 -1
  160. package/build-module/components/layout/actions-panel.js +6 -5
  161. package/build-module/components/layout/actions-panel.js.map +1 -1
  162. package/build-module/components/layout/index.js +4 -3
  163. package/build-module/components/layout/index.js.map +1 -1
  164. package/build-module/components/meta-boxes/index.js +13 -9
  165. package/build-module/components/meta-boxes/index.js.map +1 -1
  166. package/build-module/components/meta-boxes/meta-box-visibility.js +8 -5
  167. package/build-module/components/meta-boxes/meta-box-visibility.js.map +1 -1
  168. package/build-module/components/meta-boxes/meta-boxes-area/index.js +4 -3
  169. package/build-module/components/meta-boxes/meta-boxes-area/index.js.map +1 -1
  170. package/build-module/components/preferences-modal/index.js +13 -11
  171. package/build-module/components/preferences-modal/index.js.map +1 -1
  172. package/build-module/components/preferences-modal/meta-boxes-section.js +23 -16
  173. package/build-module/components/preferences-modal/meta-boxes-section.js.map +1 -1
  174. package/build-module/components/preferences-modal/options/base.js +8 -7
  175. package/build-module/components/preferences-modal/options/base.js.map +1 -1
  176. package/build-module/components/preferences-modal/options/enable-custom-fields.js +9 -7
  177. package/build-module/components/preferences-modal/options/enable-custom-fields.js.map +1 -1
  178. package/build-module/components/preferences-modal/options/enable-feature.js +12 -8
  179. package/build-module/components/preferences-modal/options/enable-feature.js.map +1 -1
  180. package/build-module/components/preferences-modal/options/enable-panel.js +17 -10
  181. package/build-module/components/preferences-modal/options/enable-panel.js.map +1 -1
  182. package/build-module/components/preferences-modal/options/enable-plugin-document-setting-panel.js +10 -7
  183. package/build-module/components/preferences-modal/options/enable-plugin-document-setting-panel.js.map +1 -1
  184. package/build-module/components/preferences-modal/section.js +14 -11
  185. package/build-module/components/preferences-modal/section.js.map +1 -1
  186. package/build-module/components/sidebar/discussion-panel/index.js +7 -5
  187. package/build-module/components/sidebar/discussion-panel/index.js.map +1 -1
  188. package/build-module/components/sidebar/featured-image/index.js +8 -6
  189. package/build-module/components/sidebar/featured-image/index.js.map +1 -1
  190. package/build-module/components/sidebar/plugin-document-setting-panel/index.js +25 -20
  191. package/build-module/components/sidebar/plugin-document-setting-panel/index.js.map +1 -1
  192. package/build-module/components/sidebar/plugin-post-publish-panel/index.js +15 -12
  193. package/build-module/components/sidebar/plugin-post-publish-panel/index.js.map +1 -1
  194. package/build-module/components/sidebar/plugin-post-status-info/index.js +9 -6
  195. package/build-module/components/sidebar/plugin-post-status-info/index.js.map +1 -1
  196. package/build-module/components/sidebar/plugin-pre-publish-panel/index.js +15 -12
  197. package/build-module/components/sidebar/plugin-pre-publish-panel/index.js.map +1 -1
  198. package/build-module/components/sidebar/plugin-sidebar/index.js +5 -4
  199. package/build-module/components/sidebar/plugin-sidebar/index.js.map +1 -1
  200. package/build-module/components/sidebar/post-excerpt/index.js +7 -5
  201. package/build-module/components/sidebar/post-excerpt/index.js.map +1 -1
  202. package/build-module/components/sidebar/post-link/index.js +19 -17
  203. package/build-module/components/sidebar/post-link/index.js.map +1 -1
  204. package/build-module/components/sidebar/post-schedule/index.js +12 -9
  205. package/build-module/components/sidebar/post-schedule/index.js.map +1 -1
  206. package/build-module/components/sidebar/post-status/index.js +11 -7
  207. package/build-module/components/sidebar/post-status/index.js.map +1 -1
  208. package/build-module/components/sidebar/post-taxonomies/taxonomy-panel.js +9 -7
  209. package/build-module/components/sidebar/post-taxonomies/taxonomy-panel.js.map +1 -1
  210. package/build-module/components/sidebar/post-visibility/index.js +24 -18
  211. package/build-module/components/sidebar/post-visibility/index.js.map +1 -1
  212. package/build-module/components/sidebar/settings-header/index.js +4 -3
  213. package/build-module/components/sidebar/settings-header/index.js.map +1 -1
  214. package/build-module/components/sidebar/template/actions.js +4 -2
  215. package/build-module/components/sidebar/template/actions.js.map +1 -1
  216. package/build-module/components/sidebar/template/index.js +7 -4
  217. package/build-module/components/sidebar/template/index.js.map +1 -1
  218. package/build-module/components/text-editor/index.js +5 -4
  219. package/build-module/components/text-editor/index.js.map +1 -1
  220. package/build-module/components/visual-editor/block-inspector-button.js +5 -4
  221. package/build-module/components/visual-editor/block-inspector-button.js.map +1 -1
  222. package/build-module/components/visual-editor/header.native.js +7 -6
  223. package/build-module/components/visual-editor/header.native.js.map +1 -1
  224. package/build-module/components/visual-editor/index.js +20 -15
  225. package/build-module/components/visual-editor/index.js.map +1 -1
  226. package/build-module/components/welcome-guide/image.js +5 -4
  227. package/build-module/components/welcome-guide/image.js.map +1 -1
  228. package/build-module/editor.js +9 -8
  229. package/build-module/editor.js.map +1 -1
  230. package/build-module/hooks/validate-multiple-use/index.js +28 -17
  231. package/build-module/hooks/validate-multiple-use/index.js.map +1 -1
  232. package/build-module/plugins/index.js +23 -20
  233. package/build-module/plugins/index.js.map +1 -1
  234. package/build-module/plugins/keyboard-shortcuts-help-menu-item/index.js +4 -3
  235. package/build-module/plugins/keyboard-shortcuts-help-menu-item/index.js.map +1 -1
  236. package/build-module/store/actions.js +6 -2
  237. package/build-module/store/actions.js.map +1 -1
  238. package/build-module/store/reducer.js +45 -11
  239. package/build-module/store/reducer.js.map +1 -1
  240. package/build-module/store/selectors.js +4 -3
  241. package/build-module/store/selectors.js.map +1 -1
  242. package/build-style/style-rtl.css +6 -11
  243. package/build-style/style.css +6 -11
  244. package/package.json +27 -27
  245. package/src/components/layout/style.scss +0 -8
  246. package/src/components/meta-boxes/meta-boxes-area/style.scss +7 -3
  247. package/src/components/sidebar/template/actions.js +5 -2
@@ -13,9 +13,10 @@ import { store as editorStore } from '@wordpress/editor';
13
13
 
14
14
  import { store as editPostStore } from '../../../store';
15
15
 
16
- const SettingsHeader = ({
17
- sidebarName
18
- }) => {
16
+ const SettingsHeader = _ref => {
17
+ let {
18
+ sidebarName
19
+ } = _ref;
19
20
  const {
20
21
  openGeneralSidebar
21
22
  } = useDispatch(editPostStore);
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-post/src/components/sidebar/settings-header/index.js"],"names":["Button","__","_x","sprintf","useDispatch","useSelect","store","editorStore","editPostStore","SettingsHeader","sidebarName","openGeneralSidebar","openDocumentSettings","openBlockSettings","documentLabel","isTemplateMode","select","postTypeLabel","getPostTypeLabel","isEditingTemplate","documentAriaLabel","documentActiveClass","blockAriaLabel","blockActiveClass","templateAriaLabel","templateActiveClass"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,MAAT,QAAuB,uBAAvB;AACA,SAASC,EAAT,EAAaC,EAAb,EAAiBC,OAAjB,QAAgC,iBAAhC;AACA,SAASC,WAAT,EAAsBC,SAAtB,QAAuC,iBAAvC;AACA,SAASC,KAAK,IAAIC,WAAlB,QAAqC,mBAArC;AAEA;AACA;AACA;;AACA,SAASD,KAAK,IAAIE,aAAlB,QAAuC,gBAAvC;;AAEA,MAAMC,cAAc,G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cAAF,IACD,0BACC,cAAC,MAAD;AACC,IAAA,OAAO,EAAGH,oBADX;AAEC,IAAA,SAAS,EAAI,gCAAgCS,mBAAqB,EAFnE;AAGC,kBAAaD,iBAHd;AAIC,kBAAaN;AAJd,KAMGA,aANH,CADD,CAFF,EAaGC,cAAc,IACf,0BACC,cAAC,MAAD;AACC,IAAA,OAAO,EAAGH,oBADX;AAEC,IAAA,SAAS,EAAI,gCAAgCa,mBAAqB,EAFnE;AAGC,kBAAaD,iBAHd;AAIC,kBAAavB,EAAE,CAAE,UAAF;AAJhB,KAMGA,EAAE,CAAE,UAAF,CANL,CADD,CAdF,EAyBC,0BACC,cAAC,MAAD;AACC,IAAA,OAAO,EAAGY,iBADX;AAEC,IAAA,SAAS,EAAI,gCAAgCU,gBAAkB,EAFhE;AAGC,kBAAaD,cAHd,CAIC;AAJD;AAKC,kBAAarB,EAAE,CAAE,OAAF;AALhB,KAQE;AACAA,EAAAA,EAAE,CAAE,OAAF,CATJ,CADD,CAzBD,CADD;AA0CA,CA7ED;;AA+EA,eAAeQ,cAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { Button } from '@wordpress/components';\nimport { __, _x, sprintf } from '@wordpress/i18n';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { store as editorStore } from '@wordpress/editor';\n\n/**\n * Internal dependencies\n */\nimport { store as editPostStore } from '../../../store';\n\nconst SettingsHeader = ( { sidebarName } ) => {\n\tconst { openGeneralSidebar } = useDispatch( editPostStore );\n\tconst openDocumentSettings = () =>\n\t\topenGeneralSidebar( 'edit-post/document' );\n\tconst openBlockSettings = () => openGeneralSidebar( 'edit-post/block' );\n\n\tconst { documentLabel, isTemplateMode } = useSelect( ( select ) => {\n\t\tconst postTypeLabel = select( editorStore ).getPostTypeLabel();\n\n\t\treturn {\n\t\t\t// translators: Default label for the Document sidebar tab, not selected.\n\t\t\tdocumentLabel: postTypeLabel || _x( 'Document', 'noun' ),\n\t\t\tisTemplateMode: select( editPostStore ).isEditingTemplate(),\n\t\t};\n\t}, [] );\n\n\tconst [ documentAriaLabel, documentActiveClass ] =\n\t\tsidebarName === 'edit-post/document'\n\t\t\t? // translators: ARIA label for the Document sidebar tab, selected. %s: Document label.\n\t\t\t [ sprintf( __( '%s (selected)' ), documentLabel ), 'is-active' ]\n\t\t\t: [ documentLabel, '' ];\n\n\tconst [ blockAriaLabel, blockActiveClass ] =\n\t\tsidebarName === 'edit-post/block'\n\t\t\t? // translators: ARIA label for the Block Settings Sidebar tab, selected.\n\t\t\t [ __( 'Block (selected)' ), 'is-active' ]\n\t\t\t: // translators: ARIA label for the Block Settings Sidebar tab, not selected.\n\t\t\t [ __( 'Block' ), '' ];\n\n\tconst [ templateAriaLabel, templateActiveClass ] =\n\t\tsidebarName === 'edit-post/document'\n\t\t\t? [ __( 'Template (selected)' ), 'is-active' ]\n\t\t\t: [ __( 'Template' ), '' ];\n\n\t/* Use a list so screen readers will announce how many tabs there are. */\n\treturn (\n\t\t<ul>\n\t\t\t{ ! isTemplateMode && (\n\t\t\t\t<li>\n\t\t\t\t\t<Button\n\t\t\t\t\t\tonClick={ openDocumentSettings }\n\t\t\t\t\t\tclassName={ `edit-post-sidebar__panel-tab ${ documentActiveClass }` }\n\t\t\t\t\t\taria-label={ documentAriaLabel }\n\t\t\t\t\t\tdata-label={ documentLabel }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ documentLabel }\n\t\t\t\t\t</Button>\n\t\t\t\t</li>\n\t\t\t) }\n\t\t\t{ isTemplateMode && (\n\t\t\t\t<li>\n\t\t\t\t\t<Button\n\t\t\t\t\t\tonClick={ openDocumentSettings }\n\t\t\t\t\t\tclassName={ `edit-post-sidebar__panel-tab ${ templateActiveClass }` }\n\t\t\t\t\t\taria-label={ templateAriaLabel }\n\t\t\t\t\t\tdata-label={ __( 'Template' ) }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Template' ) }\n\t\t\t\t\t</Button>\n\t\t\t\t</li>\n\t\t\t) }\n\t\t\t<li>\n\t\t\t\t<Button\n\t\t\t\t\tonClick={ openBlockSettings }\n\t\t\t\t\tclassName={ `edit-post-sidebar__panel-tab ${ blockActiveClass }` }\n\t\t\t\t\taria-label={ blockAriaLabel }\n\t\t\t\t\t// translators: Data label for the Block Settings Sidebar tab.\n\t\t\t\t\tdata-label={ __( 'Block' ) }\n\t\t\t\t>\n\t\t\t\t\t{\n\t\t\t\t\t\t// translators: Text label for the Block Settings Sidebar tab.\n\t\t\t\t\t\t__( 'Block' )\n\t\t\t\t\t}\n\t\t\t\t</Button>\n\t\t\t</li>\n\t\t</ul>\n\t);\n};\n\nexport default SettingsHeader;\n"]}
1
+ {"version":3,"sources":["@wordpress/edit-post/src/components/sidebar/settings-header/index.js"],"names":["Button","__","_x","sprintf","useDispatch","useSelect","store","editorStore","editPostStore","SettingsHeader","sidebarName","openGeneralSidebar","openDocumentSettings","openBlockSettings","documentLabel","isTemplateMode","select","postTypeLabel","getPostTypeLabel","isEditingTemplate","documentAriaLabel","documentActiveClass","blockAriaLabel","blockActiveClass","templateAriaLabel","templateActiveClass"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,MAAT,QAAuB,uBAAvB;AACA,SAASC,EAAT,EAAaC,EAAb,EAAiBC,OAAjB,QAAgC,iBAAhC;AACA,SAASC,WAAT,EAAsBC,SAAtB,QAAuC,iBAAvC;AACA,SAASC,KAAK,IAAIC,WAAlB,QAAqC,mBAArC;AAEA;AACA;AACA;;AACA,SAASD,KAAK,IAAIE,aAAlB,QAAuC,gBAAvC;;AAEA,MAAMC,cAAc,GAAG,QAAuB;AAAA,MAArB;AAAEC,IAAAA;AAAF,GAAqB;AAC7C,QAAM;AAAEC,IAAAA;AAAF,MAAyBP,WAAW,CAAEI,aAAF,CAA1C;;AACA,QAAMI,oBAAoB,GAAG,MAC5BD,kBAAkB,CAAE,oBAAF,CADnB;;AAEA,QAAME,iBAAiB,GAAG,MAAMF,kBAAkB,CAAE,iBAAF,CAAlD;;AAEA,QAAM;AAAE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AAI,gCAAgCa,mBAAqB,EAFnE;AAGC,kBAAaD,iBAHd;AAIC,kBAAavB,EAAE,CAAE,UAAF;AAJhB,KAMGA,EAAE,CAAE,UAAF,CANL,CADD,CAdF,EAyBC,0BACC,cAAC,MAAD;AACC,IAAA,OAAO,EAAGY,iBADX;AAEC,IAAA,SAAS,EAAI,gCAAgCU,gBAAkB,EAFhE;AAGC,kBAAaD,cAHd,CAIC;AAJD;AAKC,kBAAarB,EAAE,CAAE,OAAF;AALhB,KAQE;AACAA,EAAAA,EAAE,CAAE,OAAF,CATJ,CADD,CAzBD,CADD;AA0CA,CA7ED;;AA+EA,eAAeQ,cAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { Button } from '@wordpress/components';\nimport { __, _x, sprintf } from '@wordpress/i18n';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { store as editorStore } from '@wordpress/editor';\n\n/**\n * Internal dependencies\n */\nimport { store as editPostStore } from '../../../store';\n\nconst SettingsHeader = ( { sidebarName } ) => {\n\tconst { openGeneralSidebar } = useDispatch( editPostStore );\n\tconst openDocumentSettings = () =>\n\t\topenGeneralSidebar( 'edit-post/document' );\n\tconst openBlockSettings = () => openGeneralSidebar( 'edit-post/block' );\n\n\tconst { documentLabel, isTemplateMode } = useSelect( ( select ) => {\n\t\tconst postTypeLabel = select( editorStore ).getPostTypeLabel();\n\n\t\treturn {\n\t\t\t// translators: Default label for the Document sidebar tab, not selected.\n\t\t\tdocumentLabel: postTypeLabel || _x( 'Document', 'noun' ),\n\t\t\tisTemplateMode: select( editPostStore ).isEditingTemplate(),\n\t\t};\n\t}, [] );\n\n\tconst [ documentAriaLabel, documentActiveClass ] =\n\t\tsidebarName === 'edit-post/document'\n\t\t\t? // translators: ARIA label for the Document sidebar tab, selected. %s: Document label.\n\t\t\t [ sprintf( __( '%s (selected)' ), documentLabel ), 'is-active' ]\n\t\t\t: [ documentLabel, '' ];\n\n\tconst [ blockAriaLabel, blockActiveClass ] =\n\t\tsidebarName === 'edit-post/block'\n\t\t\t? // translators: ARIA label for the Block Settings Sidebar tab, selected.\n\t\t\t [ __( 'Block (selected)' ), 'is-active' ]\n\t\t\t: // translators: ARIA label for the Block Settings Sidebar tab, not selected.\n\t\t\t [ __( 'Block' ), '' ];\n\n\tconst [ templateAriaLabel, templateActiveClass ] =\n\t\tsidebarName === 'edit-post/document'\n\t\t\t? [ __( 'Template (selected)' ), 'is-active' ]\n\t\t\t: [ __( 'Template' ), '' ];\n\n\t/* Use a list so screen readers will announce how many tabs there are. */\n\treturn (\n\t\t<ul>\n\t\t\t{ ! isTemplateMode && (\n\t\t\t\t<li>\n\t\t\t\t\t<Button\n\t\t\t\t\t\tonClick={ openDocumentSettings }\n\t\t\t\t\t\tclassName={ `edit-post-sidebar__panel-tab ${ documentActiveClass }` }\n\t\t\t\t\t\taria-label={ documentAriaLabel }\n\t\t\t\t\t\tdata-label={ documentLabel }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ documentLabel }\n\t\t\t\t\t</Button>\n\t\t\t\t</li>\n\t\t\t) }\n\t\t\t{ isTemplateMode && (\n\t\t\t\t<li>\n\t\t\t\t\t<Button\n\t\t\t\t\t\tonClick={ openDocumentSettings }\n\t\t\t\t\t\tclassName={ `edit-post-sidebar__panel-tab ${ templateActiveClass }` }\n\t\t\t\t\t\taria-label={ templateAriaLabel }\n\t\t\t\t\t\tdata-label={ __( 'Template' ) }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Template' ) }\n\t\t\t\t\t</Button>\n\t\t\t\t</li>\n\t\t\t) }\n\t\t\t<li>\n\t\t\t\t<Button\n\t\t\t\t\tonClick={ openBlockSettings }\n\t\t\t\t\tclassName={ `edit-post-sidebar__panel-tab ${ blockActiveClass }` }\n\t\t\t\t\taria-label={ blockAriaLabel }\n\t\t\t\t\t// translators: Data label for the Block Settings Sidebar tab.\n\t\t\t\t\tdata-label={ __( 'Block' ) }\n\t\t\t\t>\n\t\t\t\t\t{\n\t\t\t\t\t\t// translators: Text label for the Block Settings Sidebar tab.\n\t\t\t\t\t\t__( 'Block' )\n\t\t\t\t\t}\n\t\t\t\t</Button>\n\t\t\t</li>\n\t\t</ul>\n\t);\n};\n\nexport default SettingsHeader;\n"]}
@@ -8,7 +8,7 @@ import { kebabCase } from 'lodash';
8
8
  * WordPress dependencies
9
9
  */
10
10
 
11
- import { __ } from '@wordpress/i18n';
11
+ import { __, _x } from '@wordpress/i18n';
12
12
  import { Button, Modal, TextControl, Flex, FlexItem } from '@wordpress/components';
13
13
  import { useSelect, useDispatch } from '@wordpress/data';
14
14
  import { useState } from '@wordpress/element';
@@ -106,7 +106,9 @@ function PostTemplateActions() {
106
106
  }, __('Edit')), createElement(Button, {
107
107
  variant: "link",
108
108
  onClick: () => setIsModalOpen(true)
109
- }, __('New'))), isModalOpen && createElement(Modal, {
109
+ },
110
+ /* translators: button to create a new template */
111
+ _x('New', 'action'))), isModalOpen && createElement(Modal, {
110
112
  title: __('Create custom template'),
111
113
  closeLabel: __('Close'),
112
114
  onRequestClose: () => {
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-post/src/components/sidebar/template/actions.js"],"names":["kebabCase","__","Button","Modal","TextControl","Flex","FlexItem","useSelect","useDispatch","useState","store","editorStore","coreStore","editPostStore","createBlock","serialize","PostTemplateActions","isModalOpen","setIsModalOpen","isBusy","setIsBusy","title","setTitle","template","supportsTemplateMode","defaultTemplate","select","getCurrentPostType","getEditorSettings","getPostType","getEditedPostTemplate","isViewable","viewable","_supportsTemplateMode","defaultBlockTemplate","__unstableCreateTemplate","__unstableSwitchToTemplateMode","defaultTitle","onCreateTemplate","event","preventDefault","newTemplateContent","tagName","layout","inherit","slug","content"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,SAAT,QAA0B,QAA1B;AAEA;AACA;AACA;;AACA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SACCC,MADD,EAECC,KAFD,EAGCC,WAHD,EAICC,IAJD,EAKCC,QALD,QAMO,uBANP;AAO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AAA,OAAO,EAAC,UAFT;AAGC,IAAA,QAAQ,EAAG;AAHZ,KAKC,cAAC,QAAD,QACC,cAAC,MAAD;AACC,IAAA,OAAO,EAAC,UADT;AAEC,IAAA,OAAO,EAAG,MAAM;AACfiB,MAAAA,cAAc,CAAE,KAAF,CAAd;AACAI,MAAAA,QAAQ,CAAE,EAAF,CAAR;AACA;AALF,KAOGrB,EAAE,CAAE,QAAF,CAPL,CADD,CALD,EAgBC,cAAC,QAAD,QACC,cAAC,MAAD;AACC,IAAA,OAAO,EAAC,SADT;AAEC,IAAA,IAAI,EAAC,QAFN;AAGC,IAAA,MAAM,EAAGkB,MAHV;AAIC,qBAAgBA;AAJjB,KAMGlB,EAAE,CAAE,QAAF,CANL,CADD,CAhBD,CAhBD,CATD,CAfF,CADD;AAyEA;;AAED,eAAee,mBAAf","sourcesContent":["/**\n * External dependencies\n */\nimport { kebabCase } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport {\n\tButton,\n\tModal,\n\tTextControl,\n\tFlex,\n\tFlexItem,\n} from '@wordpress/components';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { useState } from '@wordpress/element';\nimport { store as editorStore } from '@wordpress/editor';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { store as editPostStore } from '../../../store';\nimport { createBlock, serialize } from '@wordpress/blocks';\n\nfunction PostTemplateActions() {\n\tconst [ isModalOpen, setIsModalOpen ] = useState( false );\n\tconst [ isBusy, setIsBusy ] = useState( false );\n\tconst [ title, setTitle ] = useState( '' );\n\tconst { template, supportsTemplateMode, defaultTemplate } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getCurrentPostType, getEditorSettings } = select(\n\t\t\t\teditorStore\n\t\t\t);\n\t\t\tconst { getPostType } = select( coreStore );\n\t\t\tconst { getEditedPostTemplate } = select( editPostStore );\n\n\t\t\tconst isViewable =\n\t\t\t\tgetPostType( getCurrentPostType() )?.viewable ?? false;\n\t\t\tconst _supportsTemplateMode =\n\t\t\t\tgetEditorSettings().supportsTemplateMode && isViewable;\n\n\t\t\treturn {\n\t\t\t\ttemplate: _supportsTemplateMode && getEditedPostTemplate(),\n\t\t\t\tsupportsTemplateMode: _supportsTemplateMode,\n\t\t\t\tdefaultTemplate: getEditorSettings().defaultBlockTemplate,\n\t\t\t};\n\t\t},\n\t\t[]\n\t);\n\tconst {\n\t\t__unstableCreateTemplate,\n\t\t__unstableSwitchToTemplateMode,\n\t} = useDispatch( editPostStore );\n\n\tif ( ! supportsTemplateMode ) {\n\t\treturn null;\n\t}\n\n\tconst defaultTitle = __( 'Custom Template' );\n\n\tasync function onCreateTemplate( event ) {\n\t\tevent.preventDefault();\n\n\t\tif ( isBusy ) {\n\t\t\treturn;\n\t\t}\n\n\t\tsetIsBusy( true );\n\n\t\tconst newTemplateContent =\n\t\t\tdefaultTemplate ??\n\t\t\tserialize( [\n\t\t\t\tcreateBlock(\n\t\t\t\t\t'core/group',\n\t\t\t\t\t{\n\t\t\t\t\t\ttagName: 'header',\n\t\t\t\t\t\tlayout: { inherit: true },\n\t\t\t\t\t},\n\t\t\t\t\t[\n\t\t\t\t\t\tcreateBlock( 'core/site-title' ),\n\t\t\t\t\t\tcreateBlock( 'core/site-tagline' ),\n\t\t\t\t\t]\n\t\t\t\t),\n\t\t\t\tcreateBlock( 'core/separator' ),\n\t\t\t\tcreateBlock(\n\t\t\t\t\t'core/group',\n\t\t\t\t\t{\n\t\t\t\t\t\ttagName: 'main',\n\t\t\t\t\t},\n\t\t\t\t\t[\n\t\t\t\t\t\tcreateBlock(\n\t\t\t\t\t\t\t'core/group',\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tlayout: { inherit: true },\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t[ createBlock( 'core/post-title' ) ]\n\t\t\t\t\t\t),\n\t\t\t\t\t\tcreateBlock( 'core/post-content', {\n\t\t\t\t\t\t\tlayout: { inherit: true },\n\t\t\t\t\t\t} ),\n\t\t\t\t\t]\n\t\t\t\t),\n\t\t\t] );\n\n\t\tawait __unstableCreateTemplate( {\n\t\t\tslug: 'wp-custom-template-' + kebabCase( title || defaultTitle ),\n\t\t\tcontent: newTemplateContent,\n\t\t\ttitle: title || defaultTitle,\n\t\t} );\n\n\t\tsetIsBusy( false );\n\t\tsetIsModalOpen( false );\n\n\t\t__unstableSwitchToTemplateMode( true );\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<div className=\"edit-post-template__actions\">\n\t\t\t\t{ !! template && (\n\t\t\t\t\t<Button\n\t\t\t\t\t\tvariant=\"link\"\n\t\t\t\t\t\tonClick={ () => __unstableSwitchToTemplateMode() }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Edit' ) }\n\t\t\t\t\t</Button>\n\t\t\t\t) }\n\t\t\t\t<Button variant=\"link\" onClick={ () => setIsModalOpen( true ) }>\n\t\t\t\t\t{ __( 'New' ) }\n\t\t\t\t</Button>\n\t\t\t</div>\n\t\t\t{ isModalOpen && (\n\t\t\t\t<Modal\n\t\t\t\t\ttitle={ __( 'Create custom template' ) }\n\t\t\t\t\tcloseLabel={ __( 'Close' ) }\n\t\t\t\t\tonRequestClose={ () => {\n\t\t\t\t\t\tsetIsModalOpen( false );\n\t\t\t\t\t\tsetTitle( '' );\n\t\t\t\t\t} }\n\t\t\t\t\toverlayClassName=\"edit-post-template__modal\"\n\t\t\t\t>\n\t\t\t\t\t<form onSubmit={ onCreateTemplate }>\n\t\t\t\t\t\t<Flex align=\"flex-start\" gap={ 8 }>\n\t\t\t\t\t\t\t<FlexItem>\n\t\t\t\t\t\t\t\t<TextControl\n\t\t\t\t\t\t\t\t\tlabel={ __( 'Name' ) }\n\t\t\t\t\t\t\t\t\tvalue={ title }\n\t\t\t\t\t\t\t\t\tonChange={ setTitle }\n\t\t\t\t\t\t\t\t\tplaceholder={ defaultTitle }\n\t\t\t\t\t\t\t\t\tdisabled={ isBusy }\n\t\t\t\t\t\t\t\t\thelp={ __(\n\t\t\t\t\t\t\t\t\t\t'Describe the purpose of the template, e.g. \"Full Width\". Custom templates can be applied to any post or page.'\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</FlexItem>\n\t\t\t\t\t\t</Flex>\n\n\t\t\t\t\t\t<Flex\n\t\t\t\t\t\t\tclassName=\"edit-post-template__modal-actions\"\n\t\t\t\t\t\t\tjustify=\"flex-end\"\n\t\t\t\t\t\t\texpanded={ false }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<FlexItem>\n\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\t\tsetIsModalOpen( false );\n\t\t\t\t\t\t\t\t\t\tsetTitle( '' );\n\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{ __( 'Cancel' ) }\n\t\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t\t</FlexItem>\n\t\t\t\t\t\t\t<FlexItem>\n\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\t\t\t\ttype=\"submit\"\n\t\t\t\t\t\t\t\t\tisBusy={ isBusy }\n\t\t\t\t\t\t\t\t\taria-disabled={ isBusy }\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{ __( 'Create' ) }\n\t\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t\t</FlexItem>\n\t\t\t\t\t\t</Flex>\n\t\t\t\t\t</form>\n\t\t\t\t</Modal>\n\t\t\t) }\n\t\t</>\n\t);\n}\n\nexport default PostTemplateActions;\n"]}
1
+ {"version":3,"sources":["@wordpress/edit-post/src/components/sidebar/template/actions.js"],"names":["kebabCase","__","_x","Button","Modal","TextControl","Flex","FlexItem","useSelect","useDispatch","useState","store","editorStore","coreStore","editPostStore","createBlock","serialize","PostTemplateActions","isModalOpen","setIsModalOpen","isBusy","setIsBusy","title","setTitle","template","supportsTemplateMode","defaultTemplate","select","getCurrentPostType","getEditorSettings","getPostType","getEditedPostTemplate","isViewable","viewable","_supportsTemplateMode","defaultBlockTemplate","__unstableCreateTemplate","__unstableSwitchToTemplateMode","defaultTitle","onCreateTemplate","event","preventDefault","newTemplateContent","tagName","layout","inherit","slug","content"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,SAAT,QAA0B,QAA1B;AAEA;AACA;AACA;;AACA,SAASC,EAAT,EAAaC,EAAb,QAAuB,iBAAvB;AACA,SACCC,MADD,EAECC,KAFD,EAGCC,WAHD,EAICC,IAJD,EAKCC,QALD,QAMO,uBANP;AAOA,SAASC,SAAT,EAAoBC,WAApB,QAAuC,iBAAvC;AACA,SAASC,QAAT,QAAyB,oBAAzB;AACA,SAASC,KAAK,IAAIC,WAAlB,QAAqC,mBAArC;AACA,SAASD,KAAK,IAAIE,SAAlB,QAAmC,sBAAnC;AAEA;AACA;AACA;;AACA,SAASF,KAAK,IAAIG,aAAlB,QAAuC,gBAAvC;AACA,SAASC,WAAT,EAAsBC,SAAtB,QAAuC,mBAAvC;;AAEA,SAASC,mBAAT,GAA+B;AAC9B,QAAM,CAAEC,WAAF,EAAeC,cAAf,IAAkCT,QAAQ,CAAE,KAAF,CAAhD;AACA,QAAM,CAAEU,MAAF,EAAUC,SAAV,IAAwBX,QAAQ,CAAE,KAAF,CAAtC;AACA,QAAM,CAAEY,KAAF,EAASC,QAAT,IAAsBb,QAAQ,CAAE,EAAF,CAApC;AACA,QAAM;AAAEc,IAAAA,QAAF;AAAYC,IAAAA,oBAAZ;AAAkCC,IAAAA;AAAlC,MAAsDlB,SAAS,CAClEmB,MAAF,IAAc;AAAA;;AACb,UAAM;AAAEC,MAAAA,kBAAF;AAAsBC,MAAAA;AAAtB,QAA4CF,MAAM,CACvDf,WADuD,CAAxD;AAGA,UAAM;AAAE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AAF,CAAR;AACA,KANF;AAOC,IAAA,gBAAgB,EAAC;AAPlB,KASC;AAAM,IAAA,QAAQ,EAAGgB;AAAjB,KACC,cAAC,IAAD;AAAM,IAAA,KAAK,EAAC,YAAZ;AAAyB,IAAA,GAAG,EAAG;AAA/B,KACC,cAAC,QAAD,QACC,cAAC,WAAD;AACC,IAAA,KAAK,EAAGtC,EAAE,CAAE,MAAF,CADX;AAEC,IAAA,KAAK,EAAGqB,KAFT;AAGC,IAAA,QAAQ,EAAGC,QAHZ;AAIC,IAAA,WAAW,EAAGe,YAJf;AAKC,IAAA,QAAQ,EAAGlB,MALZ;AAMC,IAAA,IAAI,EAAGnB,EAAE,CACR,+GADQ;AANV,IADD,CADD,CADD,EAgBC,cAAC,IAAD;AACC,IAAA,SAAS,EAAC,mCADX;AAEC,IAAA,OAAO,EAAC,UAFT;AAGC,IAAA,QAAQ,EAAG;AAHZ,KAKC,cAAC,QAAD,QACC,cAAC,MAAD;AACC,IAAA,OAAO,EAAC,UADT;AAEC,IAAA,OAAO,EAAG,MAAM;AACfkB,MAAAA,cAAc,CAAE,KAAF,CAAd;AACAI,MAAAA,QAAQ,CAAE,EAAF,CAAR;AACA;AALF,KAOGtB,EAAE,CAAE,QAAF,CAPL,CADD,CALD,EAgBC,cAAC,QAAD,QACC,cAAC,MAAD;AACC,IAAA,OAAO,EAAC,SADT;AAEC,IAAA,IAAI,EAAC,QAFN;AAGC,IAAA,MAAM,EAAGmB,MAHV;AAIC,qBAAgBA;AAJjB,KAMGnB,EAAE,CAAE,QAAF,CANL,CADD,CAhBD,CAhBD,CATD,CAlBF,CADD;AA4EA;;AAED,eAAegB,mBAAf","sourcesContent":["/**\n * External dependencies\n */\nimport { kebabCase } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { __, _x } from '@wordpress/i18n';\nimport {\n\tButton,\n\tModal,\n\tTextControl,\n\tFlex,\n\tFlexItem,\n} from '@wordpress/components';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { useState } from '@wordpress/element';\nimport { store as editorStore } from '@wordpress/editor';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { store as editPostStore } from '../../../store';\nimport { createBlock, serialize } from '@wordpress/blocks';\n\nfunction PostTemplateActions() {\n\tconst [ isModalOpen, setIsModalOpen ] = useState( false );\n\tconst [ isBusy, setIsBusy ] = useState( false );\n\tconst [ title, setTitle ] = useState( '' );\n\tconst { template, supportsTemplateMode, defaultTemplate } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getCurrentPostType, getEditorSettings } = select(\n\t\t\t\teditorStore\n\t\t\t);\n\t\t\tconst { getPostType } = select( coreStore );\n\t\t\tconst { getEditedPostTemplate } = select( editPostStore );\n\n\t\t\tconst isViewable =\n\t\t\t\tgetPostType( getCurrentPostType() )?.viewable ?? false;\n\t\t\tconst _supportsTemplateMode =\n\t\t\t\tgetEditorSettings().supportsTemplateMode && isViewable;\n\n\t\t\treturn {\n\t\t\t\ttemplate: _supportsTemplateMode && getEditedPostTemplate(),\n\t\t\t\tsupportsTemplateMode: _supportsTemplateMode,\n\t\t\t\tdefaultTemplate: getEditorSettings().defaultBlockTemplate,\n\t\t\t};\n\t\t},\n\t\t[]\n\t);\n\tconst {\n\t\t__unstableCreateTemplate,\n\t\t__unstableSwitchToTemplateMode,\n\t} = useDispatch( editPostStore );\n\n\tif ( ! supportsTemplateMode ) {\n\t\treturn null;\n\t}\n\n\tconst defaultTitle = __( 'Custom Template' );\n\n\tasync function onCreateTemplate( event ) {\n\t\tevent.preventDefault();\n\n\t\tif ( isBusy ) {\n\t\t\treturn;\n\t\t}\n\n\t\tsetIsBusy( true );\n\n\t\tconst newTemplateContent =\n\t\t\tdefaultTemplate ??\n\t\t\tserialize( [\n\t\t\t\tcreateBlock(\n\t\t\t\t\t'core/group',\n\t\t\t\t\t{\n\t\t\t\t\t\ttagName: 'header',\n\t\t\t\t\t\tlayout: { inherit: true },\n\t\t\t\t\t},\n\t\t\t\t\t[\n\t\t\t\t\t\tcreateBlock( 'core/site-title' ),\n\t\t\t\t\t\tcreateBlock( 'core/site-tagline' ),\n\t\t\t\t\t]\n\t\t\t\t),\n\t\t\t\tcreateBlock( 'core/separator' ),\n\t\t\t\tcreateBlock(\n\t\t\t\t\t'core/group',\n\t\t\t\t\t{\n\t\t\t\t\t\ttagName: 'main',\n\t\t\t\t\t},\n\t\t\t\t\t[\n\t\t\t\t\t\tcreateBlock(\n\t\t\t\t\t\t\t'core/group',\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tlayout: { inherit: true },\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t[ createBlock( 'core/post-title' ) ]\n\t\t\t\t\t\t),\n\t\t\t\t\t\tcreateBlock( 'core/post-content', {\n\t\t\t\t\t\t\tlayout: { inherit: true },\n\t\t\t\t\t\t} ),\n\t\t\t\t\t]\n\t\t\t\t),\n\t\t\t] );\n\n\t\tawait __unstableCreateTemplate( {\n\t\t\tslug: 'wp-custom-template-' + kebabCase( title || defaultTitle ),\n\t\t\tcontent: newTemplateContent,\n\t\t\ttitle: title || defaultTitle,\n\t\t} );\n\n\t\tsetIsBusy( false );\n\t\tsetIsModalOpen( false );\n\n\t\t__unstableSwitchToTemplateMode( true );\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<div className=\"edit-post-template__actions\">\n\t\t\t\t{ !! template && (\n\t\t\t\t\t<Button\n\t\t\t\t\t\tvariant=\"link\"\n\t\t\t\t\t\tonClick={ () => __unstableSwitchToTemplateMode() }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Edit' ) }\n\t\t\t\t\t</Button>\n\t\t\t\t) }\n\t\t\t\t<Button variant=\"link\" onClick={ () => setIsModalOpen( true ) }>\n\t\t\t\t\t{\n\t\t\t\t\t\t/* translators: button to create a new template */\n\t\t\t\t\t\t_x( 'New', 'action' )\n\t\t\t\t\t}\n\t\t\t\t</Button>\n\t\t\t</div>\n\t\t\t{ isModalOpen && (\n\t\t\t\t<Modal\n\t\t\t\t\ttitle={ __( 'Create custom template' ) }\n\t\t\t\t\tcloseLabel={ __( 'Close' ) }\n\t\t\t\t\tonRequestClose={ () => {\n\t\t\t\t\t\tsetIsModalOpen( false );\n\t\t\t\t\t\tsetTitle( '' );\n\t\t\t\t\t} }\n\t\t\t\t\toverlayClassName=\"edit-post-template__modal\"\n\t\t\t\t>\n\t\t\t\t\t<form onSubmit={ onCreateTemplate }>\n\t\t\t\t\t\t<Flex align=\"flex-start\" gap={ 8 }>\n\t\t\t\t\t\t\t<FlexItem>\n\t\t\t\t\t\t\t\t<TextControl\n\t\t\t\t\t\t\t\t\tlabel={ __( 'Name' ) }\n\t\t\t\t\t\t\t\t\tvalue={ title }\n\t\t\t\t\t\t\t\t\tonChange={ setTitle }\n\t\t\t\t\t\t\t\t\tplaceholder={ defaultTitle }\n\t\t\t\t\t\t\t\t\tdisabled={ isBusy }\n\t\t\t\t\t\t\t\t\thelp={ __(\n\t\t\t\t\t\t\t\t\t\t'Describe the purpose of the template, e.g. \"Full Width\". Custom templates can be applied to any post or page.'\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</FlexItem>\n\t\t\t\t\t\t</Flex>\n\n\t\t\t\t\t\t<Flex\n\t\t\t\t\t\t\tclassName=\"edit-post-template__modal-actions\"\n\t\t\t\t\t\t\tjustify=\"flex-end\"\n\t\t\t\t\t\t\texpanded={ false }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<FlexItem>\n\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\t\tsetIsModalOpen( false );\n\t\t\t\t\t\t\t\t\t\tsetTitle( '' );\n\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{ __( 'Cancel' ) }\n\t\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t\t</FlexItem>\n\t\t\t\t\t\t\t<FlexItem>\n\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\t\t\t\ttype=\"submit\"\n\t\t\t\t\t\t\t\t\tisBusy={ isBusy }\n\t\t\t\t\t\t\t\t\taria-disabled={ isBusy }\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{ __( 'Create' ) }\n\t\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t\t</FlexItem>\n\t\t\t\t\t\t</Flex>\n\t\t\t\t\t</form>\n\t\t\t\t</Modal>\n\t\t\t) }\n\t\t</>\n\t);\n}\n\nexport default PostTemplateActions;\n"]}
@@ -63,10 +63,13 @@ export function TemplatePanel() {
63
63
  const wpTemplates = getEntityRecords('postType', 'wp_template', {
64
64
  post_type: currentPostType
65
65
  });
66
- const newAvailableTemplates = fromPairs((wpTemplates || []).map(({
67
- slug,
68
- title
69
- }) => [slug, title.rendered]));
66
+ const newAvailableTemplates = fromPairs((wpTemplates || []).map(_ref => {
67
+ let {
68
+ slug,
69
+ title
70
+ } = _ref;
71
+ return [slug, title.rendered];
72
+ }));
70
73
  return {
71
74
  isEnabled: isEditorPanelEnabled(PANEL_NAME),
72
75
  isOpened: isEditorPanelOpened(PANEL_NAME),
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-post/src/components/sidebar/template/index.js"],"names":["partial","isEmpty","map","fromPairs","__","sprintf","useMemo","PanelBody","SelectControl","store","editorStore","useSelect","useDispatch","coreStore","PostTemplateActions","editPostStore","PANEL_NAME","TemplatePanel","isEnabled","isOpened","selectedTemplate","availableTemplates","fetchedTemplates","isViewable","template","supportsTemplateMode","canUserCreate","select","isEditorPanelEnabled","isEditorPanelOpened","getEditedPostTemplate","getEditedPostAttribute","getEditorSettings","getCurrentPostType","getPostType","getEntityRecords","canUser","currentPostType","_isViewable","viewable","_supportsTemplateMode","wpTemplates","post_type","newAvailableTemplates","slug","title","rendered","templates","toggleEditorPanelOpened","editPost","onTogglePanel","panelTitle","Object","keys","includes","templateSlug","templateName","value","label"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,OAAT,EAAkBC,OAAlB,EAA2BC,GAA3B,EAAgCC,SAAhC,QAAiD,QAAjD;AAEA;AACA;AACA;;AACA,SAASC,EAAT,EAAaC,OAAb,QAA4B,iBAA5B;AACA,SAASC,OAAT,QAAwB,oBAAxB;AACA,SAASC,SAAT,EAAoBC,aAApB,QAAyC,uBAAzC;AACA,SAASC,KAAK,IAAIC,WAAlB,QAAqC,mBAArC;AACA,SAASC,SAAT,EAAoBC,WAApB,QAAuC,iBAAvC;AACA,SAASH,KAAK,IAAII,SAAlB,QAAmC,sBAAnC;AAEA;AACA;AACA;;AACA,OAAOC,mBAAP,MAAgC,WAAhC;AACA,SAASL,KAAK,IAAIM,aAAlB,QAAuC,gBAAvC;AAEA;AACA;AACA;;AACA,MAAMC,UAAU,GAAG,UAAnB;AAEA,OAAO,SAASC,aAAT,GAAyB;AAC/B,QAAM;AACLC,IAAAA,SADK;AAELC,IAAAA,QAFK;AAGLC,IAAAA,gBAHK;AAILC,IAAAA,kBAJK;AAKLC,IAAAA,gBALK;AAMLC,IAAAA,UANK;AAOLC,IAAAA,QAPK;AAQLC,IAAAA,oBARK;AASLC,IAAAA;AATK,MAUFf,SAAS,CAAIgB,MAAF,IAAc;AAAA;;AAC5B,UAAM;AACLC,MAAAA,oBADK;AAELC,MAAAA,mBAFK;AAGLC,MAAAA;AAHK,QAIFH,MAAM,CAAEZ,aAAF,CAJV;AAKA,UAAM;AACLgB,MAAAA,sBADK;AAELC,MAAAA,iBAFK;AAGLC,MAAAA;AAHK,QAIFN,MAAM,CAAEjB,WAAF,CAJV;AAKA,UAAM;AAAEwB,MAAAA,WAAF;AAAeC,MAAAA,gBAAf;AAAiCC,MAAAA;AAAjC,QAA6CT,MAAM,CAAEd,SAAF,CAAzD;AACA,UAAMwB,eAA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YADsD;AAE7DG,MAAAA,KAAK,EAAEF;AAFsD,KAApC,CAAb;AAbd,IALD,EAuBG9B,aAAa,IAAI,cAAC,mBAAD,OAvBpB,CADD;AA2BA;AAED,eAAeT,aAAf","sourcesContent":["/**\n * External dependencies\n */\nimport { partial, isEmpty, map, fromPairs } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { __, sprintf } from '@wordpress/i18n';\nimport { useMemo } from '@wordpress/element';\nimport { PanelBody, SelectControl } from '@wordpress/components';\nimport { store as editorStore } from '@wordpress/editor';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport PostTemplateActions from './actions';\nimport { store as editPostStore } from '../../../store';\n\n/**\n * Module Constants\n */\nconst PANEL_NAME = 'template';\n\nexport function TemplatePanel() {\n\tconst {\n\t\tisEnabled,\n\t\tisOpened,\n\t\tselectedTemplate,\n\t\tavailableTemplates,\n\t\tfetchedTemplates,\n\t\tisViewable,\n\t\ttemplate,\n\t\tsupportsTemplateMode,\n\t\tcanUserCreate,\n\t} = useSelect( ( select ) => {\n\t\tconst {\n\t\t\tisEditorPanelEnabled,\n\t\t\tisEditorPanelOpened,\n\t\t\tgetEditedPostTemplate,\n\t\t} = select( editPostStore );\n\t\tconst {\n\t\t\tgetEditedPostAttribute,\n\t\t\tgetEditorSettings,\n\t\t\tgetCurrentPostType,\n\t\t} = select( editorStore );\n\t\tconst { getPostType, getEntityRecords, canUser } = select( coreStore );\n\t\tconst currentPostType = getCurrentPostType();\n\t\tconst _isViewable = getPostType( currentPostType )?.viewable ?? false;\n\t\tconst _supportsTemplateMode =\n\t\t\tselect( editorStore ).getEditorSettings().supportsTemplateMode &&\n\t\t\t_isViewable;\n\n\t\tconst wpTemplates = getEntityRecords( 'postType', 'wp_template', {\n\t\t\tpost_type: currentPostType,\n\t\t} );\n\n\t\tconst newAvailableTemplates = fromPairs(\n\t\t\t( wpTemplates || [] ).map( ( { slug, title } ) => [\n\t\t\t\tslug,\n\t\t\t\ttitle.rendered,\n\t\t\t] )\n\t\t);\n\n\t\treturn {\n\t\t\tisEnabled: isEditorPanelEnabled( PANEL_NAME ),\n\t\t\tisOpened: isEditorPanelOpened( PANEL_NAME ),\n\t\t\tselectedTemplate: getEditedPostAttribute( 'template' ),\n\t\t\tavailableTemplates: getEditorSettings().availableTemplates,\n\t\t\tfetchedTemplates: newAvailableTemplates,\n\t\t\ttemplate: _supportsTemplateMode && getEditedPostTemplate(),\n\t\t\tisViewable: _isViewable,\n\t\t\tsupportsTemplateMode: _supportsTemplateMode,\n\t\t\tcanUserCreate: canUser( 'create', 'templates' ),\n\t\t};\n\t}, [] );\n\n\tconst templates = useMemo( () => {\n\t\treturn {\n\t\t\t...availableTemplates,\n\t\t\t...fetchedTemplates,\n\t\t};\n\t}, [ availableTemplates, fetchedTemplates ] );\n\n\tconst { toggleEditorPanelOpened } = useDispatch( editPostStore );\n\tconst { editPost } = useDispatch( editorStore );\n\n\tif (\n\t\t! isEnabled ||\n\t\t! isViewable ||\n\t\t( isEmpty( availableTemplates ) &&\n\t\t\t( ! supportsTemplateMode || ! canUserCreate ) )\n\t) {\n\t\treturn null;\n\t}\n\n\tconst onTogglePanel = partial( toggleEditorPanelOpened, PANEL_NAME );\n\n\tlet panelTitle = __( 'Template' );\n\tif ( !! template ) {\n\t\tpanelTitle = sprintf(\n\t\t\t/* translators: %s: template title */\n\t\t\t__( 'Template: %s' ),\n\t\t\ttemplate?.title ?? template.slug\n\t\t);\n\t}\n\n\treturn (\n\t\t<PanelBody\n\t\t\ttitle={ panelTitle }\n\t\t\topened={ isOpened }\n\t\t\tonToggle={ onTogglePanel }\n\t\t>\n\t\t\t<SelectControl\n\t\t\t\thideLabelFromVision\n\t\t\t\tlabel={ __( 'Template:' ) }\n\t\t\t\tvalue={\n\t\t\t\t\tObject.keys( templates ).includes( selectedTemplate )\n\t\t\t\t\t\t? selectedTemplate\n\t\t\t\t\t\t: ''\n\t\t\t\t}\n\t\t\t\tonChange={ ( templateSlug ) => {\n\t\t\t\t\teditPost( {\n\t\t\t\t\t\ttemplate: templateSlug || '',\n\t\t\t\t\t} );\n\t\t\t\t} }\n\t\t\t\toptions={ map( templates, ( templateName, templateSlug ) => ( {\n\t\t\t\t\tvalue: templateSlug,\n\t\t\t\t\tlabel: templateName,\n\t\t\t\t} ) ) }\n\t\t\t/>\n\t\t\t{ canUserCreate && <PostTemplateActions /> }\n\t\t</PanelBody>\n\t);\n}\n\nexport default TemplatePanel;\n"]}
1
+ {"version":3,"sources":["@wordpress/edit-post/src/components/sidebar/template/index.js"],"names":["partial","isEmpty","map","fromPairs","__","sprintf","useMemo","PanelBody","SelectControl","store","editorStore","useSelect","useDispatch","coreStore","PostTemplateActions","editPostStore","PANEL_NAME","TemplatePanel","isEnabled","isOpened","selectedTemplate","availableTemplates","fetchedTemplates","isViewable","template","supportsTemplateMode","canUserCreate","select","isEditorPanelEnabled","isEditorPanelOpened","getEditedPostTemplate","getEditedPostAttribute","getEditorSettings","getCurrentPostType","getPostType","getEntityRecords","canUser","currentPostType","_isViewable","viewable","_supportsTemplateMode","wpTemplates","post_type","newAvailableTemplates","slug","title","rendered","templates","toggleEditorPanelOpened","editPost","onTogglePanel","panelTitle","Object","keys","includes","templateSlug","templateName","value","label"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,OAAT,EAAkBC,OAAlB,EAA2BC,GAA3B,EAAgCC,SAAhC,QAAiD,QAAjD;AAEA;AACA;AACA;;AACA,SAASC,EAAT,EAAaC,OAAb,QAA4B,iBAA5B;AACA,SAASC,OAAT,QAAwB,oBAAxB;AACA,SAASC,SAAT,EAAoBC,aAApB,QAAyC,uBAAzC;AACA,SAASC,KAAK,IAAIC,WAAlB,QAAqC,mBAArC;AACA,SAASC,SAAT,EAAoBC,WAApB,QAAuC,iBAAvC;AACA,SAASH,KAAK,IAAII,SAAlB,QAAmC,sBAAnC;AAEA;AACA;AACA;;AACA,OAAOC,mBAAP,MAAgC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O;AACnB;AACAD,IAAAA,EAAE,CAAE,cAAF,CAFiB,qBAGnBoB,QAHmB,aAGnBA,QAHmB,uBAGnBA,QAAQ,CAAEqB,KAHS,6DAGArB,QAAQ,CAACoB,IAHT,CAApB;AAKA;;AAED,SACC,cAAC,SAAD;AACC,IAAA,KAAK,EAAGO,UADT;AAEC,IAAA,MAAM,EAAGhC,QAFV;AAGC,IAAA,QAAQ,EAAG+B;AAHZ,KAKC,cAAC,aAAD;AACC,IAAA,mBAAmB,MADpB;AAEC,IAAA,KAAK,EAAG9C,EAAE,CAAE,WAAF,CAFX;AAGC,IAAA,KAAK,EACJgD,MAAM,CAACC,IAAP,CAAaN,SAAb,EAAyBO,QAAzB,CAAmClC,gBAAnC,IACGA,gBADH,GAEG,EANL;AAQC,IAAA,QAAQ,EAAKmC,YAAF,IAAoB;AAC9BN,MAAAA,QAAQ,CAAE;AACTzB,QAAAA,QAAQ,EAAE+B,YAAY,IAAI;AADjB,OAAF,CAAR;AAGA,KAZF;AAaC,IAAA,OAAO,EAAGrD,GAAG,CAAE6C,SAAF,EAAa,CAAES,YAAF,EAAgBD,YAAhB,MAAoC;AAC7DE,MAAAA,KAAK,EAAEF,YADsD;AAE7DG,MAAAA,KAAK,EAAEF;AAFsD,KAApC,CAAb;AAbd,IALD,EAuBG9B,aAAa,IAAI,cAAC,mBAAD,OAvBpB,CADD;AA2BA;AAED,eAAeT,aAAf","sourcesContent":["/**\n * External dependencies\n */\nimport { partial, isEmpty, map, fromPairs } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { __, sprintf } from '@wordpress/i18n';\nimport { useMemo } from '@wordpress/element';\nimport { PanelBody, SelectControl } from '@wordpress/components';\nimport { store as editorStore } from '@wordpress/editor';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport PostTemplateActions from './actions';\nimport { store as editPostStore } from '../../../store';\n\n/**\n * Module Constants\n */\nconst PANEL_NAME = 'template';\n\nexport function TemplatePanel() {\n\tconst {\n\t\tisEnabled,\n\t\tisOpened,\n\t\tselectedTemplate,\n\t\tavailableTemplates,\n\t\tfetchedTemplates,\n\t\tisViewable,\n\t\ttemplate,\n\t\tsupportsTemplateMode,\n\t\tcanUserCreate,\n\t} = useSelect( ( select ) => {\n\t\tconst {\n\t\t\tisEditorPanelEnabled,\n\t\t\tisEditorPanelOpened,\n\t\t\tgetEditedPostTemplate,\n\t\t} = select( editPostStore );\n\t\tconst {\n\t\t\tgetEditedPostAttribute,\n\t\t\tgetEditorSettings,\n\t\t\tgetCurrentPostType,\n\t\t} = select( editorStore );\n\t\tconst { getPostType, getEntityRecords, canUser } = select( coreStore );\n\t\tconst currentPostType = getCurrentPostType();\n\t\tconst _isViewable = getPostType( currentPostType )?.viewable ?? false;\n\t\tconst _supportsTemplateMode =\n\t\t\tselect( editorStore ).getEditorSettings().supportsTemplateMode &&\n\t\t\t_isViewable;\n\n\t\tconst wpTemplates = getEntityRecords( 'postType', 'wp_template', {\n\t\t\tpost_type: currentPostType,\n\t\t} );\n\n\t\tconst newAvailableTemplates = fromPairs(\n\t\t\t( wpTemplates || [] ).map( ( { slug, title } ) => [\n\t\t\t\tslug,\n\t\t\t\ttitle.rendered,\n\t\t\t] )\n\t\t);\n\n\t\treturn {\n\t\t\tisEnabled: isEditorPanelEnabled( PANEL_NAME ),\n\t\t\tisOpened: isEditorPanelOpened( PANEL_NAME ),\n\t\t\tselectedTemplate: getEditedPostAttribute( 'template' ),\n\t\t\tavailableTemplates: getEditorSettings().availableTemplates,\n\t\t\tfetchedTemplates: newAvailableTemplates,\n\t\t\ttemplate: _supportsTemplateMode && getEditedPostTemplate(),\n\t\t\tisViewable: _isViewable,\n\t\t\tsupportsTemplateMode: _supportsTemplateMode,\n\t\t\tcanUserCreate: canUser( 'create', 'templates' ),\n\t\t};\n\t}, [] );\n\n\tconst templates = useMemo( () => {\n\t\treturn {\n\t\t\t...availableTemplates,\n\t\t\t...fetchedTemplates,\n\t\t};\n\t}, [ availableTemplates, fetchedTemplates ] );\n\n\tconst { toggleEditorPanelOpened } = useDispatch( editPostStore );\n\tconst { editPost } = useDispatch( editorStore );\n\n\tif (\n\t\t! isEnabled ||\n\t\t! isViewable ||\n\t\t( isEmpty( availableTemplates ) &&\n\t\t\t( ! supportsTemplateMode || ! canUserCreate ) )\n\t) {\n\t\treturn null;\n\t}\n\n\tconst onTogglePanel = partial( toggleEditorPanelOpened, PANEL_NAME );\n\n\tlet panelTitle = __( 'Template' );\n\tif ( !! template ) {\n\t\tpanelTitle = sprintf(\n\t\t\t/* translators: %s: template title */\n\t\t\t__( 'Template: %s' ),\n\t\t\ttemplate?.title ?? template.slug\n\t\t);\n\t}\n\n\treturn (\n\t\t<PanelBody\n\t\t\ttitle={ panelTitle }\n\t\t\topened={ isOpened }\n\t\t\tonToggle={ onTogglePanel }\n\t\t>\n\t\t\t<SelectControl\n\t\t\t\thideLabelFromVision\n\t\t\t\tlabel={ __( 'Template:' ) }\n\t\t\t\tvalue={\n\t\t\t\t\tObject.keys( templates ).includes( selectedTemplate )\n\t\t\t\t\t\t? selectedTemplate\n\t\t\t\t\t\t: ''\n\t\t\t\t}\n\t\t\t\tonChange={ ( templateSlug ) => {\n\t\t\t\t\teditPost( {\n\t\t\t\t\t\ttemplate: templateSlug || '',\n\t\t\t\t\t} );\n\t\t\t\t} }\n\t\t\t\toptions={ map( templates, ( templateName, templateSlug ) => ( {\n\t\t\t\t\tvalue: templateSlug,\n\t\t\t\t\tlabel: templateName,\n\t\t\t\t} ) ) }\n\t\t\t/>\n\t\t\t{ canUserCreate && <PostTemplateActions /> }\n\t\t</PanelBody>\n\t);\n}\n\nexport default TemplatePanel;\n"]}
@@ -15,10 +15,11 @@ import { compose } from '@wordpress/compose';
15
15
 
16
16
  import { store as editPostStore } from '../../store';
17
17
 
18
- function TextEditor({
19
- onExit,
20
- isRichEditingEnabled
21
- }) {
18
+ function TextEditor(_ref) {
19
+ let {
20
+ onExit,
21
+ isRichEditingEnabled
22
+ } = _ref;
22
23
  return createElement("div", {
23
24
  className: "edit-post-text-editor"
24
25
  }, isRichEditingEnabled && createElement("div", {
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-post/src/components/text-editor/index.js"],"names":["PostTextEditor","PostTitle","TextEditorGlobalKeyboardShortcuts","store","editorStore","Button","withDispatch","withSelect","__","displayShortcut","compose","editPostStore","TextEditor","onExit","isRichEditingEnabled","secondary","select","getEditorSettings","richEditingEnabled","dispatch","switchEditorMode"],"mappings":";;AAAA;AACA;AACA;AACA,SACCA,cADD,EAECC,SAFD,EAGCC,iCAHD,EAICC,KAAK,IAAIC,WAJV,QAKO,mBALP;AAMA,SAASC,MAAT,QAAuB,uBAAvB;AACA,SAASC,YAAT,EAAuBC,UAAvB,QAAyC,iBAAzC;AACA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,eAAT,QAAgC,qBAAhC;AACA,SAASC,OAAT,QAAwB,oBAAxB;AAEA;AACA;AACA;;AACA,SAASP,KAAK,IAAIQ,aAAlB,QAAuC,aAAvC;;AAEA,SAASC,UAAT,CAAqB;AAAEC,EAAAA,MAAF;AAAUC,EAAAA;AAAV,CAArB,EAAwD;AACvD,SACC;AAAK,IAAA,SAAS,EAAC;AAAf,KACGA,oBAAoB,IACrB;AAAK,IAAA,SAAS,EAAC;AAAf,KACC,0BAAMN,EAAE,CAAE,cAAF,CAAR,CADD,EAEC,cAAC,MAAD;AACC,IAAA,OAAO,EAAC,UADT;AAEC,IAAA,OAAO,EAAGK,MAFX;AAGC,IAAA,QAAQ,EAAGJ,eAAe,CAACM,SAAhB,CAA2B,GAA3B;AAHZ,KAKGP,EAAE,CAAE,kBAAF,CALL,CAFD,EASC,cAAC,iCAAD,OATD,CAFF,EAcC;AAAK,IAAA,SAAS,EAAC;AAAf,KACC,cAAC,SAAD,OADD,EAEC,cAAC,cAAD,OAFD,CAdD,CADD;AAqBA;;AAED,eAAeE,OAAO,CACrBH,UAAU,CAAIS,MAAF,KAAgB;AAC3BF,EAAAA,oBAAoB,EAAEE,MAAM,CAAEZ,WAAF,CAAN,CAAsBa,iBAAtB,GACpBC;AAFyB,CAAhB,CAAF,CADW,EAKrBZ,YAAY,CAAIa,QAAF,IAAgB;AAC7B,SAAO;AACNN,IAAAA,MAAM,GAAG;AACRM,MAAAA,QAAQ,CAAER,aAAF,CAAR,CAA0BS,gBAA1B,CAA4C,QAA5C;AACA;;AAHK,GAAP;AAKA,CANW,CALS,CAAP,CAYZR,UAZY,CAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tPostTextEditor,\n\tPostTitle,\n\tTextEditorGlobalKeyboardShortcuts,\n\tstore as editorStore,\n} from '@wordpress/editor';\nimport { Button } from '@wordpress/components';\nimport { withDispatch, withSelect } from '@wordpress/data';\nimport { __ } from '@wordpress/i18n';\nimport { displayShortcut } from '@wordpress/keycodes';\nimport { compose } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport { store as editPostStore } from '../../store';\n\nfunction TextEditor( { onExit, isRichEditingEnabled } ) {\n\treturn (\n\t\t<div className=\"edit-post-text-editor\">\n\t\t\t{ isRichEditingEnabled && (\n\t\t\t\t<div className=\"edit-post-text-editor__toolbar\">\n\t\t\t\t\t<h2>{ __( 'Editing code' ) }</h2>\n\t\t\t\t\t<Button\n\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t\tonClick={ onExit }\n\t\t\t\t\t\tshortcut={ displayShortcut.secondary( 'm' ) }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Exit code editor' ) }\n\t\t\t\t\t</Button>\n\t\t\t\t\t<TextEditorGlobalKeyboardShortcuts />\n\t\t\t\t</div>\n\t\t\t) }\n\t\t\t<div className=\"edit-post-text-editor__body\">\n\t\t\t\t<PostTitle />\n\t\t\t\t<PostTextEditor />\n\t\t\t</div>\n\t\t</div>\n\t);\n}\n\nexport default compose(\n\twithSelect( ( select ) => ( {\n\t\tisRichEditingEnabled: select( editorStore ).getEditorSettings()\n\t\t\t.richEditingEnabled,\n\t} ) ),\n\twithDispatch( ( dispatch ) => {\n\t\treturn {\n\t\t\tonExit() {\n\t\t\t\tdispatch( editPostStore ).switchEditorMode( 'visual' );\n\t\t\t},\n\t\t};\n\t} )\n)( TextEditor );\n"]}
1
+ {"version":3,"sources":["@wordpress/edit-post/src/components/text-editor/index.js"],"names":["PostTextEditor","PostTitle","TextEditorGlobalKeyboardShortcuts","store","editorStore","Button","withDispatch","withSelect","__","displayShortcut","compose","editPostStore","TextEditor","onExit","isRichEditingEnabled","secondary","select","getEditorSettings","richEditingEnabled","dispatch","switchEditorMode"],"mappings":";;AAAA;AACA;AACA;AACA,SACCA,cADD,EAECC,SAFD,EAGCC,iCAHD,EAICC,KAAK,IAAIC,WAJV,QAKO,mBALP;AAMA,SAASC,MAAT,QAAuB,uBAAvB;AACA,SAASC,YAAT,EAAuBC,UAAvB,QAAyC,iBAAzC;AACA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,eAAT,QAAgC,qBAAhC;AACA,SAASC,OAAT,QAAwB,oBAAxB;AAEA;AACA;AACA;;AACA,SAASP,KAAK,IAAIQ,aAAlB,QAAuC,aAAvC;;AAEA,SAASC,UAAT,OAAwD;AAAA,MAAnC;AAAEC,IAAAA,MAAF;AAAUC,IAAAA;AAAV,GAAmC;AACvD,SACC;AAAK,IAAA,SAAS,EAAC;AAAf,KACGA,oBAAoB,IACrB;AAAK,IAAA,SAAS,EAAC;AAAf,KACC,0BAAMN,EAAE,CAAE,cAAF,CAAR,CADD,EAEC,cAAC,MAAD;AACC,IAAA,OAAO,EAAC,UADT;AAEC,IAAA,OAAO,EAAGK,MAFX;AAGC,IAAA,QAAQ,EAAGJ,eAAe,CAACM,SAAhB,CAA2B,GAA3B;AAHZ,KAKGP,EAAE,CAAE,kBAAF,CALL,CAFD,EASC,cAAC,iCAAD,OATD,CAFF,EAcC;AAAK,IAAA,SAAS,EAAC;AAAf,KACC,cAAC,SAAD,OADD,EAEC,cAAC,cAAD,OAFD,CAdD,CADD;AAqBA;;AAED,eAAeE,OAAO,CACrBH,UAAU,CAAIS,MAAF,KAAgB;AAC3BF,EAAAA,oBAAoB,EAAEE,MAAM,CAAEZ,WAAF,CAAN,CAAsBa,iBAAtB,GACpBC;AAFyB,CAAhB,CAAF,CADW,EAKrBZ,YAAY,CAAIa,QAAF,IAAgB;AAC7B,SAAO;AACNN,IAAAA,MAAM,GAAG;AACRM,MAAAA,QAAQ,CAAER,aAAF,CAAR,CAA0BS,gBAA1B,CAA4C,QAA5C;AACA;;AAHK,GAAP;AAKA,CANW,CALS,CAAP,CAYZR,UAZY,CAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tPostTextEditor,\n\tPostTitle,\n\tTextEditorGlobalKeyboardShortcuts,\n\tstore as editorStore,\n} from '@wordpress/editor';\nimport { Button } from '@wordpress/components';\nimport { withDispatch, withSelect } from '@wordpress/data';\nimport { __ } from '@wordpress/i18n';\nimport { displayShortcut } from '@wordpress/keycodes';\nimport { compose } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport { store as editPostStore } from '../../store';\n\nfunction TextEditor( { onExit, isRichEditingEnabled } ) {\n\treturn (\n\t\t<div className=\"edit-post-text-editor\">\n\t\t\t{ isRichEditingEnabled && (\n\t\t\t\t<div className=\"edit-post-text-editor__toolbar\">\n\t\t\t\t\t<h2>{ __( 'Editing code' ) }</h2>\n\t\t\t\t\t<Button\n\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t\tonClick={ onExit }\n\t\t\t\t\t\tshortcut={ displayShortcut.secondary( 'm' ) }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Exit code editor' ) }\n\t\t\t\t\t</Button>\n\t\t\t\t\t<TextEditorGlobalKeyboardShortcuts />\n\t\t\t\t</div>\n\t\t\t) }\n\t\t\t<div className=\"edit-post-text-editor__body\">\n\t\t\t\t<PostTitle />\n\t\t\t\t<PostTextEditor />\n\t\t\t</div>\n\t\t</div>\n\t);\n}\n\nexport default compose(\n\twithSelect( ( select ) => ( {\n\t\tisRichEditingEnabled: select( editorStore ).getEditorSettings()\n\t\t\t.richEditingEnabled,\n\t} ) ),\n\twithDispatch( ( dispatch ) => {\n\t\treturn {\n\t\t\tonExit() {\n\t\t\t\tdispatch( editPostStore ).switchEditorMode( 'visual' );\n\t\t\t},\n\t\t};\n\t} )\n)( TextEditor );\n"]}
@@ -18,10 +18,11 @@ import { store as keyboardShortcutsStore } from '@wordpress/keyboard-shortcuts';
18
18
  */
19
19
 
20
20
  import { store as editPostStore } from '../../store';
21
- export function BlockInspectorButton({
22
- onClick = noop,
23
- small = false
24
- }) {
21
+ export function BlockInspectorButton(_ref) {
22
+ let {
23
+ onClick = noop,
24
+ small = false
25
+ } = _ref;
25
26
  const {
26
27
  shortcut,
27
28
  areAdvancedSettingsOpened
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-post/src/components/visual-editor/block-inspector-button.js"],"names":["noop","__","MenuItem","useSelect","useDispatch","speak","store","keyboardShortcutsStore","editPostStore","BlockInspectorButton","onClick","small","shortcut","areAdvancedSettingsOpened","select","getShortcutRepresentation","getActiveGeneralSidebarName","openGeneralSidebar","closeGeneralSidebar","label"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,IAAT,QAAqB,QAArB;AAEA;AACA;AACA;;AACA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,QAAT,QAAyB,uBAAzB;AACA,SAASC,SAAT,EAAoBC,WAApB,QAAuC,iBAAvC;AACA,SAASC,KAAT,QAAsB,iBAAtB;AACA,SAASC,KAAK,IAAIC,sBAAlB,QAAgD,+BAAhD;AAEA;AACA;AACA;;AACA,SAASD,KAAK,IAAIE,aAAlB,QAAuC,aAAvC;AAEA,OAAO,SAASC,oBAAT,CAA+B;AAAEC,EAAAA,OAAO,GAAGV,IAAZ;AAAkBW,EAAAA,KAAK,GAAG;AAA1B,CAA/B,EAAmE;AACzE,QAAM;AAAEC,IAAAA,QAAF;AAAYC,IAAAA;AAAZ,MAA0CV,SAAS,CACtDW,MAAF,KAAgB;AACfF,IAAAA,QAAQ,EAAEE,MAAM,CACfP,sBADe,CAAN,CAERQ,yBAFQ,CAEmB,+BAFnB,CADK;AAIfF,IAAAA,yBAAyB,EACxBC,MAAM,CAAEN,aAAF,CAAN,CAAwBQ,2BAAxB,OACA;AANc,GAAhB,CADwD,EASxD,EATwD,CAAzD;AAWA,QAAM;AAAEC,IAAAA,kBAAF;AAAsBC,IAAAA;AAAtB,MAA8Cd,WAAW,CAC9DI,aAD8D,CAA/D;AAIA,QAAMW,KAAK,GAAGN,yBAAyB,GACpCZ,EAAE,CAAE,oBAAF,CADkC,GAEpCA,EAAE,CAAE,oBAAF,CAFL;AAIA,SACC,cAAC,QAAD;AACC,IAAA,OAAO,EAAG,MAAM;AACf,UAAKY,yBAAL,EAAiC;AAChCK,QAAAA,mBAAmB;AACnBb,QAAAA,KAAK,CAAEJ,EAAE,CAAE,uBAAF,CAAJ,CAAL;AACA,OAHD,MAGO;AACNgB,QAAAA,kBAAkB,CAAE,iBAAF,CAAlB;AACAZ,QAAAA,KAAK,CACJJ,EAAE,CACD,4EADC,CADE,CAAL;AAKA;;AACDS,MAAAA,OAAO;AACP,KAdF;AAeC,IAAA,QAAQ,EAAGE;AAfZ,KAiBG,CAAED,KAAF,IAAWQ,KAjBd,CADD;AAqBA;AAED,eAAeV,oBAAf","sourcesContent":["/**\n * External dependencies\n */\nimport { noop } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { MenuItem } from '@wordpress/components';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { speak } from '@wordpress/a11y';\nimport { store as keyboardShortcutsStore } from '@wordpress/keyboard-shortcuts';\n\n/**\n * Internal dependencies\n */\nimport { store as editPostStore } from '../../store';\n\nexport function BlockInspectorButton( { onClick = noop, small = false } ) {\n\tconst { shortcut, areAdvancedSettingsOpened } = useSelect(\n\t\t( select ) => ( {\n\t\t\tshortcut: select(\n\t\t\t\tkeyboardShortcutsStore\n\t\t\t).getShortcutRepresentation( 'core/edit-post/toggle-sidebar' ),\n\t\t\tareAdvancedSettingsOpened:\n\t\t\t\tselect( editPostStore ).getActiveGeneralSidebarName() ===\n\t\t\t\t'edit-post/block',\n\t\t} ),\n\t\t[]\n\t);\n\tconst { openGeneralSidebar, closeGeneralSidebar } = useDispatch(\n\t\teditPostStore\n\t);\n\n\tconst label = areAdvancedSettingsOpened\n\t\t? __( 'Hide more settings' )\n\t\t: __( 'Show more settings' );\n\n\treturn (\n\t\t<MenuItem\n\t\t\tonClick={ () => {\n\t\t\t\tif ( areAdvancedSettingsOpened ) {\n\t\t\t\t\tcloseGeneralSidebar();\n\t\t\t\t\tspeak( __( 'Block settings closed' ) );\n\t\t\t\t} else {\n\t\t\t\t\topenGeneralSidebar( 'edit-post/block' );\n\t\t\t\t\tspeak(\n\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t'Additional settings are now available in the Editor block settings sidebar'\n\t\t\t\t\t\t)\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\tonClick();\n\t\t\t} }\n\t\t\tshortcut={ shortcut }\n\t\t>\n\t\t\t{ ! small && label }\n\t\t</MenuItem>\n\t);\n}\n\nexport default BlockInspectorButton;\n"]}
1
+ {"version":3,"sources":["@wordpress/edit-post/src/components/visual-editor/block-inspector-button.js"],"names":["noop","__","MenuItem","useSelect","useDispatch","speak","store","keyboardShortcutsStore","editPostStore","BlockInspectorButton","onClick","small","shortcut","areAdvancedSettingsOpened","select","getShortcutRepresentation","getActiveGeneralSidebarName","openGeneralSidebar","closeGeneralSidebar","label"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,IAAT,QAAqB,QAArB;AAEA;AACA;AACA;;AACA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,QAAT,QAAyB,uBAAzB;AACA,SAASC,SAAT,EAAoBC,WAApB,QAAuC,iBAAvC;AAC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n */\nimport { __ } from '@wordpress/i18n';\nimport { MenuItem } from '@wordpress/components';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { speak } from '@wordpress/a11y';\nimport { store as keyboardShortcutsStore } from '@wordpress/keyboard-shortcuts';\n\n/**\n * Internal dependencies\n */\nimport { store as editPostStore } from '../../store';\n\nexport function BlockInspectorButton( { onClick = noop, small = false } ) {\n\tconst { shortcut, areAdvancedSettingsOpened } = useSelect(\n\t\t( select ) => ( {\n\t\t\tshortcut: select(\n\t\t\t\tkeyboardShortcutsStore\n\t\t\t).getShortcutRepresentation( 'core/edit-post/toggle-sidebar' ),\n\t\t\tareAdvancedSettingsOpened:\n\t\t\t\tselect( editPostStore ).getActiveGeneralSidebarName() ===\n\t\t\t\t'edit-post/block',\n\t\t} ),\n\t\t[]\n\t);\n\tconst { openGeneralSidebar, closeGeneralSidebar } = useDispatch(\n\t\teditPostStore\n\t);\n\n\tconst label = areAdvancedSettingsOpened\n\t\t? __( 'Hide more settings' )\n\t\t: __( 'Show more settings' );\n\n\treturn (\n\t\t<MenuItem\n\t\t\tonClick={ () => {\n\t\t\t\tif ( areAdvancedSettingsOpened ) {\n\t\t\t\t\tcloseGeneralSidebar();\n\t\t\t\t\tspeak( __( 'Block settings closed' ) );\n\t\t\t\t} else {\n\t\t\t\t\topenGeneralSidebar( 'edit-post/block' );\n\t\t\t\t\tspeak(\n\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t'Additional settings are now available in the Editor block settings sidebar'\n\t\t\t\t\t\t)\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\tonClick();\n\t\t\t} }\n\t\t\tshortcut={ shortcut }\n\t\t>\n\t\t\t{ ! small && label }\n\t\t</MenuItem>\n\t);\n}\n\nexport default BlockInspectorButton;\n"]}
@@ -15,12 +15,13 @@ import { store as blockEditorStore } from '@wordpress/block-editor';
15
15
  */
16
16
 
17
17
  import styles from './style.scss';
18
- const Header = memo(function EditorHeader({
19
- editTitle,
20
- setTitleRef,
21
- title,
22
- getStylesFromColorScheme
23
- }) {
18
+ const Header = memo(function EditorHeader(_ref) {
19
+ let {
20
+ editTitle,
21
+ setTitleRef,
22
+ title,
23
+ getStylesFromColorScheme
24
+ } = _ref;
24
25
  const blockHolderFocusedStyle = getStylesFromColorScheme(styles.blockHolderFocused, styles.blockHolderFocusedDark);
25
26
  return createElement(ReadableContentView, null, createElement(PostTitle, {
26
27
  innerRef: setTitleRef,
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-post/src/components/visual-editor/header.native.js"],"names":["memo","__","withDispatch","withSelect","compose","withPreferredColorScheme","PostTitle","ReadableContentView","store","blockEditorStore","styles","Header","EditorHeader","editTitle","setTitleRef","title","getStylesFromColorScheme","blockHolderFocusedStyle","blockHolderFocused","blockHolderFocusedDark","blockHolderFullBordered","borderColor","prevProps","nextProps","select","getEditedPostAttribute","dispatch","editPost","clearSelectedBlock"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,IAAT,QAAqB,oBAArB;AACA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,YAAT,EAAuBC,UAAvB,QAAyC,iBAAzC;AACA,SAASC,OAAT,EAAkBC,wBAAlB,QAAkD,oBAAlD;AACA,SAASC,SAAT,QAA0B,mBAA1B;AACA,SAASC,mBAAT,QAAoC,uBAApC;AACA,SAASC,KAAK,IAAIC,gBAAlB,QAA0C,yBAA1C;AAEA;AACA;AACA;;AACA,OAAOC,MAAP,MAAmB,cAAnB;AAEA,MAAMC,MAAM,GAAGX,IAAI,CAClB,SAASY,YAAT,CAAuB;AACtBC,EAAAA,SADsB;AAEtBC,EAAAA,WAFsB;AAGtBC,EAAAA,KAHsB;AAItBC,EAAAA;AAJsB,CAAvB,EAKI;AACH,QAAMC,uBAAuB,GAAGD,wBAAwB,CACvDN,MAAM,CAACQ,kBADgD,EAEvDR,MAAM,CAACS,sBAFgD,CAAxD;AAIA,SACC,cAAC,mBAAD,QACC,cAAC,SAAD;AACC,IAAA,QAAQ,EAAGL,WADZ;AAEC,IAAA,KAAK,EAAGC,KAFT;AAGC,IAAA,QAAQ,EAAGF,SAHZ;AAIC,IAAA,WAAW,EAAGZ,EAAE,CAAE,WAAF,CAJjB;AAKC,IAAA,WAAW,EAAGS,MAAM,CAACU,uBALtB;AAMC,IAAA,kBAAkB,EAAGH,uBAAuB,CAACI,WAN9C;AAOC,IAAA,kBAAkB,EAAC;AAPpB,IADD,CADD;AAaA,CAxBiB,EAyBlB,CAAEC,SAAF,EAAaC,SAAb,KAA4BD,SAAS,CAACP,KAAV,KAAoBQ,SAAS,CAACR,KAzBxC,CAAnB;AA4BA,eAAeX,OAAO,CAAE,CACvBD,UAAU,CAAIqB,MAAF,IAAc;AACzB,QAAM;AAAEC,IAAAA;AAAF,MAA6BD,MAAM,CAAE,aAAF,CAAzC;AAEA,SAAO;AACNT,IAAAA,KAAK,EAAEU,sBAAsB,CAAE,OAAF;AADvB,GAAP;AAGA,CANS,CADa,EAQvBvB,YAAY,CAAIwB,QAAF,IAAgB;AAC7B,QAAM;AAAEC,IAAAA;AAAF,MAAeD,QAAQ,CAAE,aAAF,CAA7B;AAEA,QAAM;AAAEE,IAAAA;AAAF,MAAyBF,QAAQ,CAAEjB,gBAAF,CAAvC;AAEA,SAAO;AACNmB,IAAAA,kBADM;;AAENf,IAAAA,SAAS,CAAEE,KAAF,EAAU;AAClBY,MAAAA,QAAQ,CAAE;AAAEZ,QAAAA;AAAF,OAAF,CAAR;AACA;;AAJK,GAAP;AAMA,CAXW,CARW,EAoBvBV,wBApBuB,CAAF,CAAP,CAqBVM,MArBU,CAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { memo } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport { withDispatch, withSelect } from '@wordpress/data';\nimport { compose, withPreferredColorScheme } from '@wordpress/compose';\nimport { PostTitle } from '@wordpress/editor';\nimport { ReadableContentView } from '@wordpress/components';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport styles from './style.scss';\n\nconst Header = memo(\n\tfunction EditorHeader( {\n\t\teditTitle,\n\t\tsetTitleRef,\n\t\ttitle,\n\t\tgetStylesFromColorScheme,\n\t} ) {\n\t\tconst blockHolderFocusedStyle = getStylesFromColorScheme(\n\t\t\tstyles.blockHolderFocused,\n\t\t\tstyles.blockHolderFocusedDark\n\t\t);\n\t\treturn (\n\t\t\t<ReadableContentView>\n\t\t\t\t<PostTitle\n\t\t\t\t\tinnerRef={ setTitleRef }\n\t\t\t\t\ttitle={ title }\n\t\t\t\t\tonUpdate={ editTitle }\n\t\t\t\t\tplaceholder={ __( 'Add title' ) }\n\t\t\t\t\tborderStyle={ styles.blockHolderFullBordered }\n\t\t\t\t\tfocusedBorderColor={ blockHolderFocusedStyle.borderColor }\n\t\t\t\t\taccessibilityLabel=\"post-title\"\n\t\t\t\t/>\n\t\t\t</ReadableContentView>\n\t\t);\n\t},\n\t( prevProps, nextProps ) => prevProps.title === nextProps.title\n);\n\nexport default compose( [\n\twithSelect( ( select ) => {\n\t\tconst { getEditedPostAttribute } = select( 'core/editor' );\n\n\t\treturn {\n\t\t\ttitle: getEditedPostAttribute( 'title' ),\n\t\t};\n\t} ),\n\twithDispatch( ( dispatch ) => {\n\t\tconst { editPost } = dispatch( 'core/editor' );\n\n\t\tconst { clearSelectedBlock } = dispatch( blockEditorStore );\n\n\t\treturn {\n\t\t\tclearSelectedBlock,\n\t\t\teditTitle( title ) {\n\t\t\t\teditPost( { title } );\n\t\t\t},\n\t\t};\n\t} ),\n\twithPreferredColorScheme,\n] )( Header );\n"]}
1
+ {"version":3,"sources":["@wordpress/edit-post/src/components/visual-editor/header.native.js"],"names":["memo","__","withDispatch","withSelect","compose","withPreferredColorScheme","PostTitle","ReadableContentView","store","blockEditorStore","styles","Header","EditorHeader","editTitle","setTitleRef","title","getStylesFromColorScheme","blockHolderFocusedStyle","blockHolderFocused","blockHolderFocusedDark","blockHolderFullBordered","borderColor","prevProps","nextProps","select","getEditedP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,KAAK,EAAEU,sBAAsB,CAAE,OAAF;AADvB,GAAP;AAGA,CANS,CADa,EAQvBvB,YAAY,CAAIwB,QAAF,IAAgB;AAC7B,QAAM;AAAEC,IAAAA;AAAF,MAAeD,QAAQ,CAAE,aAAF,CAA7B;AAEA,QAAM;AAAEE,IAAAA;AAAF,MAAyBF,QAAQ,CAAEjB,gBAAF,CAAvC;AAEA,SAAO;AACNmB,IAAAA,kBADM;;AAENf,IAAAA,SAAS,CAAEE,KAAF,EAAU;AAClBY,MAAAA,QAAQ,CAAE;AAAEZ,QAAAA;AAAF,OAAF,CAAR;AACA;;AAJK,GAAP;AAMA,CAXW,CARW,EAoBvBV,wBApBuB,CAAF,CAAP,CAqBVM,MArBU,CAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { memo } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport { withDispatch, withSelect } from '@wordpress/data';\nimport { compose, withPreferredColorScheme } from '@wordpress/compose';\nimport { PostTitle } from '@wordpress/editor';\nimport { ReadableContentView } from '@wordpress/components';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport styles from './style.scss';\n\nconst Header = memo(\n\tfunction EditorHeader( {\n\t\teditTitle,\n\t\tsetTitleRef,\n\t\ttitle,\n\t\tgetStylesFromColorScheme,\n\t} ) {\n\t\tconst blockHolderFocusedStyle = getStylesFromColorScheme(\n\t\t\tstyles.blockHolderFocused,\n\t\t\tstyles.blockHolderFocusedDark\n\t\t);\n\t\treturn (\n\t\t\t<ReadableContentView>\n\t\t\t\t<PostTitle\n\t\t\t\t\tinnerRef={ setTitleRef }\n\t\t\t\t\ttitle={ title }\n\t\t\t\t\tonUpdate={ editTitle }\n\t\t\t\t\tplaceholder={ __( 'Add title' ) }\n\t\t\t\t\tborderStyle={ styles.blockHolderFullBordered }\n\t\t\t\t\tfocusedBorderColor={ blockHolderFocusedStyle.borderColor }\n\t\t\t\t\taccessibilityLabel=\"post-title\"\n\t\t\t\t/>\n\t\t\t</ReadableContentView>\n\t\t);\n\t},\n\t( prevProps, nextProps ) => prevProps.title === nextProps.title\n);\n\nexport default compose( [\n\twithSelect( ( select ) => {\n\t\tconst { getEditedPostAttribute } = select( 'core/editor' );\n\n\t\treturn {\n\t\t\ttitle: getEditedPostAttribute( 'title' ),\n\t\t};\n\t} ),\n\twithDispatch( ( dispatch ) => {\n\t\tconst { editPost } = dispatch( 'core/editor' );\n\n\t\tconst { clearSelectedBlock } = dispatch( blockEditorStore );\n\n\t\treturn {\n\t\t\tclearSelectedBlock,\n\t\t\teditTitle( title ) {\n\t\t\t\teditPost( { title } );\n\t\t\t},\n\t\t};\n\t} ),\n\twithPreferredColorScheme,\n] )( Header );\n"]}
@@ -23,13 +23,14 @@ import { __ } from '@wordpress/i18n';
23
23
  import BlockInspectorButton from './block-inspector-button';
24
24
  import { store as editPostStore } from '../../store';
25
25
 
26
- function MaybeIframe({
27
- children,
28
- contentRef,
29
- shouldIframe,
30
- styles,
31
- style
32
- }) {
26
+ function MaybeIframe(_ref) {
27
+ let {
28
+ children,
29
+ contentRef,
30
+ shouldIframe,
31
+ styles,
32
+ style
33
+ } = _ref;
33
34
  const ref = useMouseMoveTypingReset();
34
35
 
35
36
  if (!shouldIframe) {
@@ -61,9 +62,10 @@ function MaybeIframe({
61
62
  }, children);
62
63
  }
63
64
 
64
- export default function VisualEditor({
65
- styles
66
- }) {
65
+ export default function VisualEditor(_ref2) {
66
+ let {
67
+ styles
68
+ } = _ref2;
67
69
  const {
68
70
  deviceType,
69
71
  isTemplateMode,
@@ -195,10 +197,13 @@ export default function VisualEditor({
195
197
  }, createElement(PostTitle, null)), createElement(RecursionProvider, null, createElement(BlockList, {
196
198
  className: isTemplateMode ? 'wp-site-blocks' : undefined,
197
199
  __experimentalLayout: layout
198
- }))))), createElement(__unstableBlockSettingsMenuFirstItem, null, ({
199
- onClose
200
- }) => createElement(BlockInspectorButton, {
201
- onClick: onClose
202
- })));
200
+ }))))), createElement(__unstableBlockSettingsMenuFirstItem, null, _ref3 => {
201
+ let {
202
+ onClose
203
+ } = _ref3;
204
+ return createElement(BlockInspectorButton, {
205
+ onClick: onClose
206
+ });
207
+ }));
203
208
  }
204
209
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-post/src/components/visual-editor/index.js"],"names":["classnames","VisualEditorGlobalKeyboardShortcuts","PostTitle","store","editorStore","WritingFlow","BlockList","BlockTools","blockEditorStore","__unstableUseBlockSelectionClearer","useBlockSelectionClearer","__unstableUseTypewriter","useTypewriter","__unstableUseClipboardHandler","useClipboardHandler","__unstableUseTypingObserver","useTypingObserver","__unstableBlockSettingsMenuFirstItem","__experimentalUseResizeCanvas","useResizeCanvas","__unstableUseCanvasClickRedirect","useCanvasClickRedirect","__unstableEditorStyles","EditorStyles","useSetting","__experimentalLayoutStyle","LayoutStyle","__unstableUseMouseMoveTypingReset","useMouseMoveTypingReset","__unstableIframe","Iframe","__experimentalUseNoRecursiveRenders","useNoRecursiveRenders","useRef","useMemo","Button","__unstableMotion","motion","useSelect","useDispatch","useMergeRefs","arrowLeft","__","BlockInspectorButton","editPostStore","MaybeIframe","children","contentRef","shouldIframe","styles","style","ref","flex","width","height","display","VisualEditor","deviceType","isTemplateMode","wrapperBlockName","wrapperUniqueId","select","isEditingTemplate","__experimentalGetPreviewDeviceType","getCurrentPostId","getCurrentPostType","_isTemplateMode","_wrapperBlockName","hasMetaBoxes","themeSupportsLayout","getSettings","supportsLayout","clearSelectedBlock","setIsEditingTemplate","desktopCanvasStyles","margin","flexFlow","background","templateModeStyles","borderRadius","border","borderBottom","resizedCanvasStyles","defaultLayout","previewMode","toLowerCase","animatedStyles","paddingBottom","blockSelectionClearerRef","RecursionProvider","layout","type","undefined","padding","onClose"],"mappings":";;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AAEA;AACA;AACA;;AACA,SACCC,mCADD,EAECC,SAFD,EAGCC,KAAK,IAAIC,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AAGC,IAAA,OAAO,EAAG,MAAM;AACf+B,MAAAA,kBAAkB;AAClBC,MAAAA,oBAAoB,CAAE,KAAF,CAApB;AACA;AANF,KAQG/B,EAAE,CAAE,MAAF,CARL,CARF,EAmBC,cAAC,MAAD,CAAQ,GAAR;AACC,IAAA,OAAO,EAAG4C,cADX;AAEC,IAAA,OAAO,EAAGZ,mBAFX;AAGC,IAAA,SAAS,EAAGU;AAHb,KAKC,cAAC,WAAD;AACC,IAAA,YAAY,EACX1B,cAAc,IACdD,UAAU,KAAK,QADf,IAEAA,UAAU,KAAK,QAJjB;AAMC,IAAA,UAAU,EAAGV,UANd;AAOC,IAAA,MAAM,EAAGE,MAPV;AAQC,IAAA,KAAK,EAAG;AAAEsC,MAAAA;AAAF;AART,KAUGlB,mBAAmB,IAAI,CAAEX,cAAzB,IACD,cAAC,WAAD;AACC,IAAA,QAAQ,EAAC,kGADV;AAEC,IAAA,MAAM,EAAGyB;AAFV,IAXF,EAgBG,CAAEzB,cAAF,IACD;AAAK,IAAA,SAAS,EAAC;AAAf,KACC,cAAC,SAAD,OADD,CAjBF,EAqBC,cAAC,iBAAD,QACC,cAAC,SAAD;AACC,IAAA,SAAS,EACRA,cAAc,GACX,gBADW,GAEXkC,SAJL;AAMC,IAAA,oBAAoB,EAAGF;AANxB,IADD,CArBD,CALD,CAnBD,CAPD,EAiEC,cAAC,oCAAD,QACG,CAAE;AAAEI,IAAAA;AAAF,GAAF,KACD,cAAC,oBAAD;AAAsB,IAAA,OAAO,EAAGA;AAAhC,IAFF,CAjED,CADD;AAyEA","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tVisualEditorGlobalKeyboardShortcuts,\n\tPostTitle,\n\tstore as editorStore,\n} from '@wordpress/editor';\nimport {\n\tWritingFlow,\n\tBlockList,\n\tBlockTools,\n\tstore as blockEditorStore,\n\t__unstableUseBlockSelectionClearer as useBlockSelectionClearer,\n\t__unstableUseTypewriter as useTypewriter,\n\t__unstableUseClipboardHandler as useClipboardHandler,\n\t__unstableUseTypingObserver as useTypingObserver,\n\t__unstableBlockSettingsMenuFirstItem,\n\t__experimentalUseResizeCanvas as useResizeCanvas,\n\t__unstableUseCanvasClickRedirect as useCanvasClickRedirect,\n\t__unstableEditorStyles as EditorStyles,\n\tuseSetting,\n\t__experimentalLayoutStyle as LayoutStyle,\n\t__unstableUseMouseMoveTypingReset as useMouseMoveTypingReset,\n\t__unstableIframe as Iframe,\n\t__experimentalUseNoRecursiveRenders as useNoRecursiveRenders,\n} from '@wordpress/block-editor';\nimport { useRef, useMemo } from '@wordpress/element';\nimport { Button, __unstableMotion as motion } from '@wordpress/components';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { useMergeRefs } from '@wordpress/compose';\nimport { arrowLeft } from '@wordpress/icons';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport BlockInspectorButton from './block-inspector-button';\nimport { store as editPostStore } from '../../store';\n\nfunction MaybeIframe( { children, contentRef, shouldIframe, styles, style } ) {\n\tconst ref = useMouseMoveTypingReset();\n\n\tif ( ! shouldIframe ) {\n\t\treturn (\n\t\t\t<>\n\t\t\t\t<EditorStyles styles={ styles } />\n\t\t\t\t<WritingFlow\n\t\t\t\t\tref={ contentRef }\n\t\t\t\t\tclassName=\"editor-styles-wrapper\"\n\t\t\t\t\tstyle={ { flex: '1', ...style } }\n\t\t\t\t\ttabIndex={ -1 }\n\t\t\t\t>\n\t\t\t\t\t{ children }\n\t\t\t\t</WritingFlow>\n\t\t\t</>\n\t\t);\n\t}\n\n\treturn (\n\t\t<Iframe\n\t\t\thead={ <EditorStyles styles={ styles } /> }\n\t\t\tref={ ref }\n\t\t\tcontentRef={ contentRef }\n\t\t\tstyle={ { width: '100%', height: '100%', display: 'block' } }\n\t\t\tname=\"editor-canvas\"\n\t\t>\n\t\t\t{ children }\n\t\t</Iframe>\n\t);\n}\n\nexport default function VisualEditor( { styles } ) {\n\tconst {\n\t\tdeviceType,\n\t\tisTemplateMode,\n\t\twrapperBlockName,\n\t\twrapperUniqueId,\n\t} = useSelect( ( select ) => {\n\t\tconst {\n\t\t\tisEditingTemplate,\n\t\t\t__experimentalGetPreviewDeviceType,\n\t\t} = select( editPostStore );\n\t\tconst { getCurrentPostId, getCurrentPostType } = select( editorStore );\n\t\tconst _isTemplateMode = isEditingTemplate();\n\t\tlet _wrapperBlockName;\n\n\t\tif ( getCurrentPostType() === 'wp_block' ) {\n\t\t\t_wrapperBlockName = 'core/block';\n\t\t} else if ( ! _isTemplateMode ) {\n\t\t\t_wrapperBlockName = 'core/post-content';\n\t\t}\n\n\t\treturn {\n\t\t\tdeviceType: __experimentalGetPreviewDeviceType(),\n\t\t\tisTemplateMode: _isTemplateMode,\n\t\t\twrapperBlockName: _wrapperBlockName,\n\t\t\twrapperUniqueId: getCurrentPostId(),\n\t\t};\n\t}, [] );\n\tconst hasMetaBoxes = useSelect(\n\t\t( select ) => select( editPostStore ).hasMetaBoxes(),\n\t\t[]\n\t);\n\tconst themeSupportsLayout = useSelect( ( select ) => {\n\t\tconst { getSettings } = select( blockEditorStore );\n\t\treturn getSettings().supportsLayout;\n\t}, [] );\n\tconst { clearSelectedBlock } = useDispatch( blockEditorStore );\n\tconst { setIsEditingTemplate } = useDispatch( editPostStore );\n\tconst desktopCanvasStyles = {\n\t\t// We intentionally omit a 100% height here. The container is a flex item, so the 100% height is granted by default.\n\t\t// If a percentage height is present, older browsers such as Safari 13 apply that, but do so incorrectly as the inheritance is buggy.\n\t\twidth: '100%',\n\t\tmargin: 0,\n\t\tdisplay: 'flex',\n\t\tflexFlow: 'column',\n\t\t// Default background color so that grey\n\t\t// .edit-post-editor-regions__content color doesn't show through.\n\t\tbackground: 'white',\n\t};\n\tconst templateModeStyles = {\n\t\t...desktopCanvasStyles,\n\t\tborderRadius: '2px 2px 0 0',\n\t\tborder: '1px solid #ddd',\n\t\tborderBottom: 0,\n\t};\n\tconst resizedCanvasStyles = useResizeCanvas( deviceType, isTemplateMode );\n\tconst defaultLayout = useSetting( 'layout' );\n\tconst previewMode = 'is-' + deviceType.toLowerCase() + '-preview';\n\n\tlet animatedStyles = isTemplateMode\n\t\t? templateModeStyles\n\t\t: desktopCanvasStyles;\n\tif ( resizedCanvasStyles ) {\n\t\tanimatedStyles = resizedCanvasStyles;\n\t}\n\n\tlet paddingBottom;\n\n\t// Add a constant padding for the typewritter effect. When typing at the\n\t// bottom, there needs to be room to scroll up.\n\tif ( ! hasMetaBoxes && ! resizedCanvasStyles && ! isTemplateMode ) {\n\t\tpaddingBottom = '40vh';\n\t}\n\n\tconst ref = useRef();\n\tconst contentRef = useMergeRefs( [\n\t\tref,\n\t\tuseClipboardHandler(),\n\t\tuseCanvasClickRedirect(),\n\t\tuseTypewriter(),\n\t\tuseTypingObserver(),\n\t\tuseBlockSelectionClearer(),\n\t] );\n\n\tconst blockSelectionClearerRef = useBlockSelectionClearer();\n\n\tconst [ , RecursionProvider ] = useNoRecursiveRenders(\n\t\twrapperUniqueId,\n\t\twrapperBlockName\n\t);\n\n\tconst layout = useMemo( () => {\n\t\tif ( isTemplateMode ) {\n\t\t\treturn { type: 'default' };\n\t\t}\n\n\t\tif ( themeSupportsLayout ) {\n\t\t\treturn defaultLayout;\n\t\t}\n\n\t\treturn undefined;\n\t}, [ isTemplateMode, themeSupportsLayout, defaultLayout ] );\n\n\treturn (\n\t\t<BlockTools\n\t\t\t__unstableContentRef={ ref }\n\t\t\tclassName={ classnames( 'edit-post-visual-editor', {\n\t\t\t\t'is-template-mode': isTemplateMode,\n\t\t\t} ) }\n\t\t>\n\t\t\t<VisualEditorGlobalKeyboardShortcuts />\n\t\t\t<motion.div\n\t\t\t\tclassName=\"edit-post-visual-editor__content-area\"\n\t\t\t\tanimate={ {\n\t\t\t\t\tpadding: isTemplateMode ? '48px 48px 0' : '0',\n\t\t\t\t} }\n\t\t\t\tref={ blockSelectionClearerRef }\n\t\t\t>\n\t\t\t\t{ isTemplateMode && (\n\t\t\t\t\t<Button\n\t\t\t\t\t\tclassName=\"edit-post-visual-editor__exit-template-mode\"\n\t\t\t\t\t\ticon={ arrowLeft }\n\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\tclearSelectedBlock();\n\t\t\t\t\t\t\tsetIsEditingTemplate( false );\n\t\t\t\t\t\t} }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Back' ) }\n\t\t\t\t\t</Button>\n\t\t\t\t) }\n\t\t\t\t<motion.div\n\t\t\t\t\tanimate={ animatedStyles }\n\t\t\t\t\tinitial={ desktopCanvasStyles }\n\t\t\t\t\tclassName={ previewMode }\n\t\t\t\t>\n\t\t\t\t\t<MaybeIframe\n\t\t\t\t\t\tshouldIframe={\n\t\t\t\t\t\t\tisTemplateMode ||\n\t\t\t\t\t\t\tdeviceType === 'Tablet' ||\n\t\t\t\t\t\t\tdeviceType === 'Mobile'\n\t\t\t\t\t\t}\n\t\t\t\t\t\tcontentRef={ contentRef }\n\t\t\t\t\t\tstyles={ styles }\n\t\t\t\t\t\tstyle={ { paddingBottom } }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ themeSupportsLayout && ! isTemplateMode && (\n\t\t\t\t\t\t\t<LayoutStyle\n\t\t\t\t\t\t\t\tselector=\".edit-post-visual-editor__post-title-wrapper, .block-editor-block-list__layout.is-root-container\"\n\t\t\t\t\t\t\t\tlayout={ defaultLayout }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t{ ! isTemplateMode && (\n\t\t\t\t\t\t\t<div className=\"edit-post-visual-editor__post-title-wrapper\">\n\t\t\t\t\t\t\t\t<PostTitle />\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t<RecursionProvider>\n\t\t\t\t\t\t\t<BlockList\n\t\t\t\t\t\t\t\tclassName={\n\t\t\t\t\t\t\t\t\tisTemplateMode\n\t\t\t\t\t\t\t\t\t\t? 'wp-site-blocks'\n\t\t\t\t\t\t\t\t\t\t: undefined\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t__experimentalLayout={ layout }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</RecursionProvider>\n\t\t\t\t\t</MaybeIframe>\n\t\t\t\t</motion.div>\n\t\t\t</motion.div>\n\t\t\t<__unstableBlockSettingsMenuFirstItem>\n\t\t\t\t{ ( { onClose } ) => (\n\t\t\t\t\t<BlockInspectorButton onClick={ onClose } />\n\t\t\t\t) }\n\t\t\t</__unstableBlockSettingsMenuFirstItem>\n\t\t</BlockTools>\n\t);\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/edit-post/src/components/visual-editor/index.js"],"names":["classnames","VisualEditorGlobalKeyboardShortcuts","PostTitle","store","editorStore","WritingFlow","BlockList","BlockTools","blockEditorStore","__unstableUseBlockSelectionClearer","useBlockSelectionClearer","__unstableUseTypewriter","useTypewriter","__unstableUseClipboardHandler","useClipboardHandler","__unstableUseTypingObserver","useTypingObserver","__unstableBlockSettingsMenuFirstItem","__experimentalUseResizeCanvas","useResizeCanvas","__unstableUseCanvasClickRedirect","useCanvasClickRedirect","__unstableEditorStyles","EditorStyles","useSetting","__experimentalLayoutStyle","LayoutStyle","__unstableUseMouseMoveTypingReset","useMouseMoveTypingReset","__unstableIframe","Iframe","__experimentalUseNoRecursiveRenders","useNoRecursiveRenders","useRef","useMemo","Button","__unstableMotion","motion","useSelect","useDispatch","useMergeRefs","arrowLeft","__","BlockInspectorButton","editPostStore","MaybeIframe","children","contentRef","shouldIframe","styles","style","ref","flex","width","height","display","VisualEditor","deviceType","isTemplateMode","wrapperBlockName","wrapperUniqueId","select","isEditingTemplate","__experimentalGetPreviewDeviceType","getCurrentPostId","getCurrentPostType","_isTemplateMode","_wrapperBlockName","hasMetaBoxes","themeSupportsLayout","getSettings","supportsLayout","clearSelectedBlock","setIsEditingTemplate","desktopCanvasStyles","margin","flexFlow","background","templateModeStyles","borderRadius","border","borderBottom","resizedCanvasStyles","defaultLayout","previewMode","toLowerCase","animatedStyles","paddingBottom","blockSelectionClearerRef","RecursionProvider","layout","type","undefined","padding","onClose"],"mappings":";;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AAEA;AACA;AACA;;AACA,SACCC,mCADD,EAECC,SAFD,EAGCC,KAAK,IAAIC,WAHV,QAIO,mBAJP;AAKA,SACCC,WADD,EAECC,SAFD,EAGCC,UAHD,EAICJ,KAAK,IAAIK,gBAJV,EAKCC,kCAAkC,IAAIC,wBALvC,EAMCC,uBAAuB,IAAIC,aAN5B,EAOCC,6BAA6B,IAAIC,mBAPlC,EAQCC,2BAA2B,IAAIC,iBARhC,EASCC,oCATD,EAUCC,6BAA6B,IAAIC,eAVlC,EAWCC,gCAAgC,IAAIC,sBAXrC,EAYCC,sBAAsB,IAAIC,YAZ3B,EAaCC,UAbD,EAcCC,yBAAyB,IAAIC,WAd9B,EAeCC,iCAAiC,IAAIC,uBAftC,EAgBCC,gBAAgB,IAAIC,MAhBrB,EAiBCC,mCAAmC,IAAIC,qBAjBxC,QAkBO,yBAlBP;AAmBA,SAASC,MAAT,EAAiBC,OAAjB,QAAgC,oBAAhC;AACA,SAASC,MAAT,EAAiBC,gBAAgB,IAAIC,MAArC,QAAmD,uBAAnD;AACA,SAASC,SAAT,EAAoBC,WAApB,QAAuC,iBAAvC;AACA,SAASC,YAAT,QAA6B,oBAA7B;AACA,SAASC,SAAT,QAA0B,kBAA1B;AACA,SAASC,EAAT,QAAmB,iBAAnB;AAEA;AACA;AACA;;AACA,OAAOC,oBAAP,MAAiC,0BAAjC;AACA,SAASxC,KAAK,IAAIyC,aAAlB,QAAuC,aAAvC;;AAEA,SAASC,WAAT,OAA8E;AAAA,MAAxD;AAAEC,IAAAA,QAAF;AAAYC,IAAAA,UAAZ;AAAwBC,IAAAA,YAAxB;AAAsCC,IAAAA,MAAtC;AAA8CC,IAAAA;AAA9C,GAAwD;AAC7E,QAAMC,GAAG,GAAGvB,uBAAuB,EAAn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\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tVisualEditorGlobalKeyboardShortcuts,\n\tPostTitle,\n\tstore as editorStore,\n} from '@wordpress/editor';\nimport {\n\tWritingFlow,\n\tBlockList,\n\tBlockTools,\n\tstore as blockEditorStore,\n\t__unstableUseBlockSelectionClearer as useBlockSelectionClearer,\n\t__unstableUseTypewriter as useTypewriter,\n\t__unstableUseClipboardHandler as useClipboardHandler,\n\t__unstableUseTypingObserver as useTypingObserver,\n\t__unstableBlockSettingsMenuFirstItem,\n\t__experimentalUseResizeCanvas as useResizeCanvas,\n\t__unstableUseCanvasClickRedirect as useCanvasClickRedirect,\n\t__unstableEditorStyles as EditorStyles,\n\tuseSetting,\n\t__experimentalLayoutStyle as LayoutStyle,\n\t__unstableUseMouseMoveTypingReset as useMouseMoveTypingReset,\n\t__unstableIframe as Iframe,\n\t__experimentalUseNoRecursiveRenders as useNoRecursiveRenders,\n} from '@wordpress/block-editor';\nimport { useRef, useMemo } from '@wordpress/element';\nimport { Button, __unstableMotion as motion } from '@wordpress/components';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { useMergeRefs } from '@wordpress/compose';\nimport { arrowLeft } from '@wordpress/icons';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport BlockInspectorButton from './block-inspector-button';\nimport { store as editPostStore } from '../../store';\n\nfunction MaybeIframe( { children, contentRef, shouldIframe, styles, style } ) {\n\tconst ref = useMouseMoveTypingReset();\n\n\tif ( ! shouldIframe ) {\n\t\treturn (\n\t\t\t<>\n\t\t\t\t<EditorStyles styles={ styles } />\n\t\t\t\t<WritingFlow\n\t\t\t\t\tref={ contentRef }\n\t\t\t\t\tclassName=\"editor-styles-wrapper\"\n\t\t\t\t\tstyle={ { flex: '1', ...style } }\n\t\t\t\t\ttabIndex={ -1 }\n\t\t\t\t>\n\t\t\t\t\t{ children }\n\t\t\t\t</WritingFlow>\n\t\t\t</>\n\t\t);\n\t}\n\n\treturn (\n\t\t<Iframe\n\t\t\thead={ <EditorStyles styles={ styles } /> }\n\t\t\tref={ ref }\n\t\t\tcontentRef={ contentRef }\n\t\t\tstyle={ { width: '100%', height: '100%', display: 'block' } }\n\t\t\tname=\"editor-canvas\"\n\t\t>\n\t\t\t{ children }\n\t\t</Iframe>\n\t);\n}\n\nexport default function VisualEditor( { styles } ) {\n\tconst {\n\t\tdeviceType,\n\t\tisTemplateMode,\n\t\twrapperBlockName,\n\t\twrapperUniqueId,\n\t} = useSelect( ( select ) => {\n\t\tconst {\n\t\t\tisEditingTemplate,\n\t\t\t__experimentalGetPreviewDeviceType,\n\t\t} = select( editPostStore );\n\t\tconst { getCurrentPostId, getCurrentPostType } = select( editorStore );\n\t\tconst _isTemplateMode = isEditingTemplate();\n\t\tlet _wrapperBlockName;\n\n\t\tif ( getCurrentPostType() === 'wp_block' ) {\n\t\t\t_wrapperBlockName = 'core/block';\n\t\t} else if ( ! _isTemplateMode ) {\n\t\t\t_wrapperBlockName = 'core/post-content';\n\t\t}\n\n\t\treturn {\n\t\t\tdeviceType: __experimentalGetPreviewDeviceType(),\n\t\t\tisTemplateMode: _isTemplateMode,\n\t\t\twrapperBlockName: _wrapperBlockName,\n\t\t\twrapperUniqueId: getCurrentPostId(),\n\t\t};\n\t}, [] );\n\tconst hasMetaBoxes = useSelect(\n\t\t( select ) => select( editPostStore ).hasMetaBoxes(),\n\t\t[]\n\t);\n\tconst themeSupportsLayout = useSelect( ( select ) => {\n\t\tconst { getSettings } = select( blockEditorStore );\n\t\treturn getSettings().supportsLayout;\n\t}, [] );\n\tconst { clearSelectedBlock } = useDispatch( blockEditorStore );\n\tconst { setIsEditingTemplate } = useDispatch( editPostStore );\n\tconst desktopCanvasStyles = {\n\t\t// We intentionally omit a 100% height here. The container is a flex item, so the 100% height is granted by default.\n\t\t// If a percentage height is present, older browsers such as Safari 13 apply that, but do so incorrectly as the inheritance is buggy.\n\t\twidth: '100%',\n\t\tmargin: 0,\n\t\tdisplay: 'flex',\n\t\tflexFlow: 'column',\n\t\t// Default background color so that grey\n\t\t// .edit-post-editor-regions__content color doesn't show through.\n\t\tbackground: 'white',\n\t};\n\tconst templateModeStyles = {\n\t\t...desktopCanvasStyles,\n\t\tborderRadius: '2px 2px 0 0',\n\t\tborder: '1px solid #ddd',\n\t\tborderBottom: 0,\n\t};\n\tconst resizedCanvasStyles = useResizeCanvas( deviceType, isTemplateMode );\n\tconst defaultLayout = useSetting( 'layout' );\n\tconst previewMode = 'is-' + deviceType.toLowerCase() + '-preview';\n\n\tlet animatedStyles = isTemplateMode\n\t\t? templateModeStyles\n\t\t: desktopCanvasStyles;\n\tif ( resizedCanvasStyles ) {\n\t\tanimatedStyles = resizedCanvasStyles;\n\t}\n\n\tlet paddingBottom;\n\n\t// Add a constant padding for the typewritter effect. When typing at the\n\t// bottom, there needs to be room to scroll up.\n\tif ( ! hasMetaBoxes && ! resizedCanvasStyles && ! isTemplateMode ) {\n\t\tpaddingBottom = '40vh';\n\t}\n\n\tconst ref = useRef();\n\tconst contentRef = useMergeRefs( [\n\t\tref,\n\t\tuseClipboardHandler(),\n\t\tuseCanvasClickRedirect(),\n\t\tuseTypewriter(),\n\t\tuseTypingObserver(),\n\t\tuseBlockSelectionClearer(),\n\t] );\n\n\tconst blockSelectionClearerRef = useBlockSelectionClearer();\n\n\tconst [ , RecursionProvider ] = useNoRecursiveRenders(\n\t\twrapperUniqueId,\n\t\twrapperBlockName\n\t);\n\n\tconst layout = useMemo( () => {\n\t\tif ( isTemplateMode ) {\n\t\t\treturn { type: 'default' };\n\t\t}\n\n\t\tif ( themeSupportsLayout ) {\n\t\t\treturn defaultLayout;\n\t\t}\n\n\t\treturn undefined;\n\t}, [ isTemplateMode, themeSupportsLayout, defaultLayout ] );\n\n\treturn (\n\t\t<BlockTools\n\t\t\t__unstableContentRef={ ref }\n\t\t\tclassName={ classnames( 'edit-post-visual-editor', {\n\t\t\t\t'is-template-mode': isTemplateMode,\n\t\t\t} ) }\n\t\t>\n\t\t\t<VisualEditorGlobalKeyboardShortcuts />\n\t\t\t<motion.div\n\t\t\t\tclassName=\"edit-post-visual-editor__content-area\"\n\t\t\t\tanimate={ {\n\t\t\t\t\tpadding: isTemplateMode ? '48px 48px 0' : '0',\n\t\t\t\t} }\n\t\t\t\tref={ blockSelectionClearerRef }\n\t\t\t>\n\t\t\t\t{ isTemplateMode && (\n\t\t\t\t\t<Button\n\t\t\t\t\t\tclassName=\"edit-post-visual-editor__exit-template-mode\"\n\t\t\t\t\t\ticon={ arrowLeft }\n\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\tclearSelectedBlock();\n\t\t\t\t\t\t\tsetIsEditingTemplate( false );\n\t\t\t\t\t\t} }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Back' ) }\n\t\t\t\t\t</Button>\n\t\t\t\t) }\n\t\t\t\t<motion.div\n\t\t\t\t\tanimate={ animatedStyles }\n\t\t\t\t\tinitial={ desktopCanvasStyles }\n\t\t\t\t\tclassName={ previewMode }\n\t\t\t\t>\n\t\t\t\t\t<MaybeIframe\n\t\t\t\t\t\tshouldIframe={\n\t\t\t\t\t\t\tisTemplateMode ||\n\t\t\t\t\t\t\tdeviceType === 'Tablet' ||\n\t\t\t\t\t\t\tdeviceType === 'Mobile'\n\t\t\t\t\t\t}\n\t\t\t\t\t\tcontentRef={ contentRef }\n\t\t\t\t\t\tstyles={ styles }\n\t\t\t\t\t\tstyle={ { paddingBottom } }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ themeSupportsLayout && ! isTemplateMode && (\n\t\t\t\t\t\t\t<LayoutStyle\n\t\t\t\t\t\t\t\tselector=\".edit-post-visual-editor__post-title-wrapper, .block-editor-block-list__layout.is-root-container\"\n\t\t\t\t\t\t\t\tlayout={ defaultLayout }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t{ ! isTemplateMode && (\n\t\t\t\t\t\t\t<div className=\"edit-post-visual-editor__post-title-wrapper\">\n\t\t\t\t\t\t\t\t<PostTitle />\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t<RecursionProvider>\n\t\t\t\t\t\t\t<BlockList\n\t\t\t\t\t\t\t\tclassName={\n\t\t\t\t\t\t\t\t\tisTemplateMode\n\t\t\t\t\t\t\t\t\t\t? 'wp-site-blocks'\n\t\t\t\t\t\t\t\t\t\t: undefined\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t__experimentalLayout={ layout }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</RecursionProvider>\n\t\t\t\t\t</MaybeIframe>\n\t\t\t\t</motion.div>\n\t\t\t</motion.div>\n\t\t\t<__unstableBlockSettingsMenuFirstItem>\n\t\t\t\t{ ( { onClose } ) => (\n\t\t\t\t\t<BlockInspectorButton onClick={ onClose } />\n\t\t\t\t) }\n\t\t\t</__unstableBlockSettingsMenuFirstItem>\n\t\t</BlockTools>\n\t);\n}\n"]}
@@ -1,8 +1,9 @@
1
1
  import { createElement } from "@wordpress/element";
2
- export default function WelcomeGuideImage({
3
- nonAnimatedSrc,
4
- animatedSrc
5
- }) {
2
+ export default function WelcomeGuideImage(_ref) {
3
+ let {
4
+ nonAnimatedSrc,
5
+ animatedSrc
6
+ } = _ref;
6
7
  return createElement("picture", {
7
8
  className: "edit-post-welcome-guide__image"
8
9
  }, createElement("source", {
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-post/src/components/welcome-guide/image.js"],"names":["WelcomeGuideImage","nonAnimatedSrc","animatedSrc"],"mappings":";AAAA,eAAe,SAASA,iBAAT,CAA4B;AAAEC,EAAAA,cAAF;AAAkBC,EAAAA;AAAlB,CAA5B,EAA8D;AAC5E,SACC;AAAS,IAAA,SAAS,EAAC;AAAnB,KACC;AACC,IAAA,MAAM,EAAGD,cADV;AAEC,IAAA,KAAK,EAAC;AAFP,IADD,EAKC;AAAK,IAAA,GAAG,EAAGC,WAAX;AAAyB,IAAA,KAAK,EAAC,KAA/B;AAAqC,IAAA,MAAM,EAAC,KAA5C;AAAkD,IAAA,GAAG,EAAC;AAAtD,IALD,CADD;AASA","sourcesContent":["export default function WelcomeGuideImage( { nonAnimatedSrc, animatedSrc } ) {\n\treturn (\n\t\t<picture className=\"edit-post-welcome-guide__image\">\n\t\t\t<source\n\t\t\t\tsrcSet={ nonAnimatedSrc }\n\t\t\t\tmedia=\"(prefers-reduced-motion: reduce)\"\n\t\t\t/>\n\t\t\t<img src={ animatedSrc } width=\"312\" height=\"240\" alt=\"\" />\n\t\t</picture>\n\t);\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/edit-post/src/components/welcome-guide/image.js"],"names":["WelcomeGuideImage","nonAnimatedSrc","animatedSrc"],"mappings":";AAAA,eAAe,SAASA,iBAAT,OAA8D;AAAA,MAAlC;AAAEC,IAAAA,cAAF;AAAkBC,IAAAA;AAAlB,GAAkC;AAC5E,SACC;AAAS,IAAA,SAAS,EAAC;AAAnB,KACC;AACC,IAAA,MAAM,EAAGD,cADV;AAEC,IAAA,KAAK,EAAC;AAFP,IADD,EAKC;AAAK,IAAA,GAAG,EAAGC,WAAX;AAAyB,IAAA,KAAK,EAAC,KAA/B;AAAqC,IAAA,MAAM,EAAC,KAA5C;AAAkD,IAAA,GAAG,EAAC;AAAtD,IALD,CADD;AASA","sourcesContent":["export default function WelcomeGuideImage( { nonAnimatedSrc, animatedSrc } ) {\n\treturn (\n\t\t<picture className=\"edit-post-welcome-guide__image\">\n\t\t\t<source\n\t\t\t\tsrcSet={ nonAnimatedSrc }\n\t\t\t\tmedia=\"(prefers-reduced-motion: reduce)\"\n\t\t\t/>\n\t\t\t<img src={ animatedSrc } width=\"312\" height=\"240\" alt=\"\" />\n\t\t</picture>\n\t);\n}\n"]}
@@ -26,14 +26,15 @@ import EditorInitialization from './components/editor-initialization';
26
26
  import EditPostSettings from './components/edit-post-settings';
27
27
  import { store as editPostStore } from './store';
28
28
 
29
- function Editor({
30
- postId,
31
- postType,
32
- settings,
33
- initialEdits,
34
- onError,
35
- ...props
36
- }) {
29
+ function Editor(_ref) {
30
+ let {
31
+ postId,
32
+ postType,
33
+ settings,
34
+ initialEdits,
35
+ onError,
36
+ ...props
37
+ } = _ref;
37
38
  const {
38
39
  hasFixedToolbar,
39
40
  focusMode,
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-post/src/editor.js"],"names":["size","map","without","store","blocksStore","useSelect","useDispatch","EditorProvider","ErrorBoundary","PostLockedModal","editorStore","StrictMode","useMemo","KeyboardShortcuts","SlotFillProvider","coreStore","ShortcutProvider","preventEventDiscovery","Layout","EditorInitialization","EditPostSettings","editPostStore","Editor","postId","postType","settings","initialEdits","onError","props","hasFixedToolbar","focusMode","hasReducedUI","hasThemeStyles","post","preferredStyleVariations","hiddenBlockTypes","blockTypes","__experimentalLocalAutosaveInterval","keepCaretInsideBlock","isTemplateMode","template","select","isFeatureActive","getPreference","__experimentalGetPreviewDeviceType","isEditingTemplate","getEditedPostTemplate","getEntityRecord","getPostType","getEntityRecords","getEditorSettings","getBlockTypes","isTemplate","includes","postObject","posts","wp_id","supportsTemplateMode","isViewable","viewable","updatePreferredStyleVariations","setIsInserterOpened","editorSettings","result","__experimentalPreferredStyleVariations","value","onChange","__experimentalSetIsInserterOpened","defaultAllowedBlockTypes","allowedBlockTypes","styles","themeStyles","presetStyles","forEach","style","__unstableType","push","defaultEditorStyles","length","undefined"],"mappings":";;;AAAA;AACA;AACA;AACA,SAASA,IAAT,EAAeC,GAAf,EAAoBC,OAApB,QAAmC,QAAnC;AAEA;AACA;AACA;;AACA,SAASC,KAAK,IAAIC,WAAlB,QAAqC,mBAArC;AACA,SAASC,SAAT,EAAoBC,WAApB,QAAuC,iBAAvC;AACA,SACCC,cADD,EAECC,aAFD,EAGCC,eAHD,EAICN,KAAK,IAAIO,WAJV,QAKO,mBALP;AAMA,SAASC,UAAT,EAAqBC,OAArB,QAAoC,oBAApC;AACA,SAASC,iBAAT,EAA4BC,gBAA5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ordPress dependencies\n */\nimport { store as blocksStore } from '@wordpress/blocks';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport {\n\tEditorProvider,\n\tErrorBoundary,\n\tPostLockedModal,\n\tstore as editorStore,\n} from '@wordpress/editor';\nimport { StrictMode, useMemo } from '@wordpress/element';\nimport { KeyboardShortcuts, SlotFillProvider } from '@wordpress/components';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { ShortcutProvider } from '@wordpress/keyboard-shortcuts';\n\n/**\n * Internal dependencies\n */\nimport preventEventDiscovery from './prevent-event-discovery';\nimport Layout from './components/layout';\nimport EditorInitialization from './components/editor-initialization';\nimport EditPostSettings from './components/edit-post-settings';\nimport { store as editPostStore } from './store';\n\nfunction Editor( {\n\tpostId,\n\tpostType,\n\tsettings,\n\tinitialEdits,\n\tonError,\n\t...props\n} ) {\n\tconst {\n\t\thasFixedToolbar,\n\t\tfocusMode,\n\t\thasReducedUI,\n\t\thasThemeStyles,\n\t\tpost,\n\t\tpreferredStyleVariations,\n\t\thiddenBlockTypes,\n\t\tblockTypes,\n\t\t__experimentalLocalAutosaveInterval,\n\t\tkeepCaretInsideBlock,\n\t\tisTemplateMode,\n\t\ttemplate,\n\t} = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tisFeatureActive,\n\t\t\t\tgetPreference,\n\t\t\t\t__experimentalGetPreviewDeviceType,\n\t\t\t\tisEditingTemplate,\n\t\t\t\tgetEditedPostTemplate,\n\t\t\t} = select( editPostStore );\n\t\t\tconst { getEntityRecord, getPostType, getEntityRecords } = select(\n\t\t\t\tcoreStore\n\t\t\t);\n\t\t\tconst { getEditorSettings } = select( editorStore );\n\t\t\tconst { getBlockTypes } = select( blocksStore );\n\t\t\tconst isTemplate = [ 'wp_template', 'wp_template_part' ].includes(\n\t\t\t\tpostType\n\t\t\t);\n\t\t\t// Ideally the initializeEditor function should be called using the ID of the REST endpoint.\n\t\t\t// to avoid the special case.\n\t\t\tlet postObject;\n\t\t\tif ( isTemplate ) {\n\t\t\t\tconst posts = getEntityRecords( 'postType', postType, {\n\t\t\t\t\twp_id: postId,\n\t\t\t\t} );\n\t\t\t\tpostObject = posts?.[ 0 ];\n\t\t\t} else {\n\t\t\t\tpostObject = getEntityRecord( 'postType', postType, postId );\n\t\t\t}\n\t\t\tconst supportsTemplateMode = getEditorSettings()\n\t\t\t\t.supportsTemplateMode;\n\t\t\tconst isViewable = getPostType( postType )?.viewable ?? false;\n\n\t\t\treturn {\n\t\t\t\thasFixedToolbar:\n\t\t\t\t\tisFeatureActive( 'fixedToolbar' ) ||\n\t\t\t\t\t__experimentalGetPreviewDeviceType() !== 'Desktop',\n\t\t\t\tfocusMode: isFeatureActive( 'focusMode' ),\n\t\t\t\thasReducedUI: isFeatureActive( 'reducedUI' ),\n\t\t\t\thasThemeStyles: isFeatureActive( 'themeStyles' ),\n\t\t\t\tpreferredStyleVariations: getPreference(\n\t\t\t\t\t'preferredStyleVariations'\n\t\t\t\t),\n\t\t\t\thiddenBlockTypes: getPreference( 'hiddenBlockTypes' ),\n\t\t\t\tblockTypes: getBlockTypes(),\n\t\t\t\t__experimentalLocalAutosaveInterval: getPreference(\n\t\t\t\t\t'localAutosaveInterval'\n\t\t\t\t),\n\t\t\t\tkeepCaretInsideBlock: isFeatureActive( 'keepCaretInsideBlock' ),\n\t\t\t\tisTemplateMode: isEditingTemplate(),\n\t\t\t\ttemplate:\n\t\t\t\t\tsupportsTemplateMode && isViewable\n\t\t\t\t\t\t? getEditedPostTemplate()\n\t\t\t\t\t\t: null,\n\t\t\t\tpost: postObject,\n\t\t\t};\n\t\t},\n\t\t[ postType, postId ]\n\t);\n\n\tconst { updatePreferredStyleVariations, setIsInserterOpened } = useDispatch(\n\t\teditPostStore\n\t);\n\n\tconst editorSettings = useMemo( () => {\n\t\tconst result = {\n\t\t\t...settings,\n\t\t\t__experimentalPreferredStyleVariations: {\n\t\t\t\tvalue: preferredStyleVariations,\n\t\t\t\tonChange: updatePreferredStyleVariations,\n\t\t\t},\n\t\t\thasFixedToolbar,\n\t\t\tfocusMode,\n\t\t\thasReducedUI,\n\t\t\t__experimentalLocalAutosaveInterval,\n\n\t\t\t// This is marked as experimental to give time for the quick inserter to mature.\n\t\t\t__experimentalSetIsInserterOpened: setIsInserterOpened,\n\t\t\tkeepCaretInsideBlock,\n\t\t};\n\n\t\t// Omit hidden block types if exists and non-empty.\n\t\tif ( size( hiddenBlockTypes ) > 0 ) {\n\t\t\t// Defer to passed setting for `allowedBlockTypes` if provided as\n\t\t\t// anything other than `true` (where `true` is equivalent to allow\n\t\t\t// all block types).\n\t\t\tconst defaultAllowedBlockTypes =\n\t\t\t\ttrue === settings.allowedBlockTypes\n\t\t\t\t\t? map( blockTypes, 'name' )\n\t\t\t\t\t: settings.allowedBlockTypes || [];\n\n\t\t\tresult.allowedBlockTypes = without(\n\t\t\t\tdefaultAllowedBlockTypes,\n\t\t\t\t...hiddenBlockTypes\n\t\t\t);\n\t\t}\n\n\t\treturn result;\n\t}, [\n\t\tsettings,\n\t\thasFixedToolbar,\n\t\tfocusMode,\n\t\thasReducedUI,\n\t\thiddenBlockTypes,\n\t\tblockTypes,\n\t\tpreferredStyleVariations,\n\t\t__experimentalLocalAutosaveInterval,\n\t\tsetIsInserterOpened,\n\t\tupdatePreferredStyleVariations,\n\t\tkeepCaretInsideBlock,\n\t] );\n\n\tconst styles = useMemo( () => {\n\t\tconst themeStyles = [];\n\t\tconst presetStyles = [];\n\t\tsettings.styles.forEach( ( style ) => {\n\t\t\tif ( ! style.__unstableType || style.__unstableType === 'theme' ) {\n\t\t\t\tthemeStyles.push( style );\n\t\t\t} else {\n\t\t\t\tpresetStyles.push( style );\n\t\t\t}\n\t\t} );\n\t\tconst defaultEditorStyles = [\n\t\t\t...settings.defaultEditorStyles,\n\t\t\t...presetStyles,\n\t\t];\n\t\treturn hasThemeStyles && themeStyles.length\n\t\t\t? settings.styles\n\t\t\t: defaultEditorStyles;\n\t}, [ settings, hasThemeStyles ] );\n\n\tif ( ! post ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<StrictMode>\n\t\t\t<ShortcutProvider>\n\t\t\t\t<EditPostSettings.Provider value={ settings }>\n\t\t\t\t\t<SlotFillProvider>\n\t\t\t\t\t\t<EditorProvider\n\t\t\t\t\t\t\tsettings={ editorSettings }\n\t\t\t\t\t\t\tpost={ post }\n\t\t\t\t\t\t\tinitialEdits={ initialEdits }\n\t\t\t\t\t\t\tuseSubRegistry={ false }\n\t\t\t\t\t\t\t__unstableTemplate={\n\t\t\t\t\t\t\t\tisTemplateMode ? template : undefined\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t{ ...props }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<ErrorBoundary onError={ onError }>\n\t\t\t\t\t\t\t\t<EditorInitialization postId={ postId } />\n\t\t\t\t\t\t\t\t<Layout styles={ styles } />\n\t\t\t\t\t\t\t\t<KeyboardShortcuts\n\t\t\t\t\t\t\t\t\tshortcuts={ preventEventDiscovery }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</ErrorBoundary>\n\t\t\t\t\t\t\t<PostLockedModal />\n\t\t\t\t\t\t</EditorProvider>\n\t\t\t\t\t</SlotFillProvider>\n\t\t\t\t</EditPostSettings.Provider>\n\t\t\t</ShortcutProvider>\n\t\t</StrictMode>\n\t);\n}\n\nexport default Editor;\n"]}
1
+ {"version":3,"sources":["@wordpress/edit-post/src/editor.js"],"names":["size","map","without","store","blocksStore","useSelect","useDispatch","EditorProvider","ErrorBoundary","PostLockedModal","editorStore","StrictMode","useMemo","KeyboardShortcuts","SlotFillProvider","coreStore","ShortcutProvider","preventEventDiscovery","Layout","EditorInitialization","EditPostSettings","editPostStore","Editor","postId","postType","settings","initialEdits","onError","props","hasFixedToolbar","focusMode","hasReducedUI","hasThemeStyles","post","preferredStyleVariations","hiddenBlockTypes","blockTypes","__experimentalLocalAutosaveInterval","keepCaretInsideBlock","isTemplateMode","template","select","isFeatureActive","getPreference","__experimentalGetPreviewDeviceType","isEditingTemplate","getEditedPostTemplate","getEntityRecord","getPostType","getEntityRecords","getEditorSettings","getBlockTypes","isTemplate","includes","postObject","posts","wp_id","supportsTemplateMode","isViewable","viewable","updatePreferredStyleVariations","setIsInserterOpened","editorSettings","result","__experimentalPreferredStyleVariations","value","onChange","__experimentalSetIsInserterOpened","defaultAllowedBlockTypes","allowedBlockTypes","styles","themeStyles","presetStyles","forEach","style","__unstableType","push","defaultEditorStyles","length","undefined"],"mappings":";;;AAAA;AACA;AACA;AACA,SAASA,IAAT,EAAeC,GAAf,EAAoBC,OAApB,QAAmC,QAAnC;AAEA;AACA;AACA;;AACA,SAASC,KAAK,IAAIC,WAAlB,QAAqC,mBAArC;AACA,SAASC,SAAT,EAAoBC,WAApB,QAAuC,iBAAvC;AACA,SACCC,cADD,EAECC,aAFD,EAGCC,eAHD,EAICN,KAAK,IAAIO,WAJV,QAKO,mBALP;AAMA,SAASC,UAAT,EAAqBC,OAArB,QAAoC,oBAApC;AACA,SAASC,iBAAT,EAA4BC,gBAA5B,QAAoD,uBAApD;AACA,SAASX,KAAK,IAAIY,SAAlB,QAAmC,sBAAnC;AACA,SAASC,gBAAT,QAAiC,+BAAjC;AAEA;AACA;AACA;;AACA,OAAOC,qBAAP,MAAkC,2BAAlC;AACA,OAAOC,MAAP,MAAmB,qBAAnB;AACA,OAAOC,oBAAP,MAAiC,oCAAjC;AACA,OAAOC,gBAAP,MAA6B,iCAA7B;AACA,SAASjB,KAAK,IAAIkB,aAAlB,QAAuC,SAAvC;;AAEA,SAASC,MAAT,OAOI;AAAA,MAPa;AAChBC,IAAAA,MADgB;AAEhBC,IAAAA,QAFgB;AAGhBC,IAAAA,QAHgB;AAIhBC,IAAAA,YAJgB;AAKhBC,IAAAA,OALgB;AAMhB,OAAGC;AANa,GAOb;AACH,QAAM;AACLC,IAAAA,eADK;AAELC,IAAAA,SAFK;AAGLC,IAAAA,YAHK;AAILC,IAAAA,cAJK;AAKLC,IAAAA,IALK;A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,CAAkB,QAAlB;AAA2B,IAAA,KAAK,EAAGR;AAAnC,KACC,cAAC,gBAAD,QACC,cAAC,cAAD;AACC,IAAA,QAAQ,EAAGqC,cADZ;AAEC,IAAA,IAAI,EAAG7B,IAFR;AAGC,IAAA,YAAY,EAAGP,YAHhB;AAIC,IAAA,cAAc,EAAG,KAJlB;AAKC,IAAA,kBAAkB,EACjBa,cAAc,GAAGC,QAAH,GAAcuC;AAN9B,KAQMnD,KARN,GAUC,cAAC,aAAD;AAAe,IAAA,OAAO,EAAGD;AAAzB,KACC,cAAC,oBAAD;AAAsB,IAAA,MAAM,EAAGJ;AAA/B,IADD,EAEC,cAAC,MAAD;AAAQ,IAAA,MAAM,EAAG+C;AAAjB,IAFD,EAGC,cAAC,iBAAD;AACC,IAAA,SAAS,EAAGrD;AADb,IAHD,CAVD,EAiBC,cAAC,eAAD,OAjBD,CADD,CADD,CADD,CADD,CADD;AA6BA;;AAED,eAAeK,MAAf","sourcesContent":["/**\n * External dependencies\n */\nimport { size, map, without } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { store as blocksStore } from '@wordpress/blocks';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport {\n\tEditorProvider,\n\tErrorBoundary,\n\tPostLockedModal,\n\tstore as editorStore,\n} from '@wordpress/editor';\nimport { StrictMode, useMemo } from '@wordpress/element';\nimport { KeyboardShortcuts, SlotFillProvider } from '@wordpress/components';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { ShortcutProvider } from '@wordpress/keyboard-shortcuts';\n\n/**\n * Internal dependencies\n */\nimport preventEventDiscovery from './prevent-event-discovery';\nimport Layout from './components/layout';\nimport EditorInitialization from './components/editor-initialization';\nimport EditPostSettings from './components/edit-post-settings';\nimport { store as editPostStore } from './store';\n\nfunction Editor( {\n\tpostId,\n\tpostType,\n\tsettings,\n\tinitialEdits,\n\tonError,\n\t...props\n} ) {\n\tconst {\n\t\thasFixedToolbar,\n\t\tfocusMode,\n\t\thasReducedUI,\n\t\thasThemeStyles,\n\t\tpost,\n\t\tpreferredStyleVariations,\n\t\thiddenBlockTypes,\n\t\tblockTypes,\n\t\t__experimentalLocalAutosaveInterval,\n\t\tkeepCaretInsideBlock,\n\t\tisTemplateMode,\n\t\ttemplate,\n\t} = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tisFeatureActive,\n\t\t\t\tgetPreference,\n\t\t\t\t__experimentalGetPreviewDeviceType,\n\t\t\t\tisEditingTemplate,\n\t\t\t\tgetEditedPostTemplate,\n\t\t\t} = select( editPostStore );\n\t\t\tconst { getEntityRecord, getPostType, getEntityRecords } = select(\n\t\t\t\tcoreStore\n\t\t\t);\n\t\t\tconst { getEditorSettings } = select( editorStore );\n\t\t\tconst { getBlockTypes } = select( blocksStore );\n\t\t\tconst isTemplate = [ 'wp_template', 'wp_template_part' ].includes(\n\t\t\t\tpostType\n\t\t\t);\n\t\t\t// Ideally the initializeEditor function should be called using the ID of the REST endpoint.\n\t\t\t// to avoid the special case.\n\t\t\tlet postObject;\n\t\t\tif ( isTemplate ) {\n\t\t\t\tconst posts = getEntityRecords( 'postType', postType, {\n\t\t\t\t\twp_id: postId,\n\t\t\t\t} );\n\t\t\t\tpostObject = posts?.[ 0 ];\n\t\t\t} else {\n\t\t\t\tpostObject = getEntityRecord( 'postType', postType, postId );\n\t\t\t}\n\t\t\tconst supportsTemplateMode = getEditorSettings()\n\t\t\t\t.supportsTemplateMode;\n\t\t\tconst isViewable = getPostType( postType )?.viewable ?? false;\n\n\t\t\treturn {\n\t\t\t\thasFixedToolbar:\n\t\t\t\t\tisFeatureActive( 'fixedToolbar' ) ||\n\t\t\t\t\t__experimentalGetPreviewDeviceType() !== 'Desktop',\n\t\t\t\tfocusMode: isFeatureActive( 'focusMode' ),\n\t\t\t\thasReducedUI: isFeatureActive( 'reducedUI' ),\n\t\t\t\thasThemeStyles: isFeatureActive( 'themeStyles' ),\n\t\t\t\tpreferredStyleVariations: getPreference(\n\t\t\t\t\t'preferredStyleVariations'\n\t\t\t\t),\n\t\t\t\thiddenBlockTypes: getPreference( 'hiddenBlockTypes' ),\n\t\t\t\tblockTypes: getBlockTypes(),\n\t\t\t\t__experimentalLocalAutosaveInterval: getPreference(\n\t\t\t\t\t'localAutosaveInterval'\n\t\t\t\t),\n\t\t\t\tkeepCaretInsideBlock: isFeatureActive( 'keepCaretInsideBlock' ),\n\t\t\t\tisTemplateMode: isEditingTemplate(),\n\t\t\t\ttemplate:\n\t\t\t\t\tsupportsTemplateMode && isViewable\n\t\t\t\t\t\t? getEditedPostTemplate()\n\t\t\t\t\t\t: null,\n\t\t\t\tpost: postObject,\n\t\t\t};\n\t\t},\n\t\t[ postType, postId ]\n\t);\n\n\tconst { updatePreferredStyleVariations, setIsInserterOpened } = useDispatch(\n\t\teditPostStore\n\t);\n\n\tconst editorSettings = useMemo( () => {\n\t\tconst result = {\n\t\t\t...settings,\n\t\t\t__experimentalPreferredStyleVariations: {\n\t\t\t\tvalue: preferredStyleVariations,\n\t\t\t\tonChange: updatePreferredStyleVariations,\n\t\t\t},\n\t\t\thasFixedToolbar,\n\t\t\tfocusMode,\n\t\t\thasReducedUI,\n\t\t\t__experimentalLocalAutosaveInterval,\n\n\t\t\t// This is marked as experimental to give time for the quick inserter to mature.\n\t\t\t__experimentalSetIsInserterOpened: setIsInserterOpened,\n\t\t\tkeepCaretInsideBlock,\n\t\t};\n\n\t\t// Omit hidden block types if exists and non-empty.\n\t\tif ( size( hiddenBlockTypes ) > 0 ) {\n\t\t\t// Defer to passed setting for `allowedBlockTypes` if provided as\n\t\t\t// anything other than `true` (where `true` is equivalent to allow\n\t\t\t// all block types).\n\t\t\tconst defaultAllowedBlockTypes =\n\t\t\t\ttrue === settings.allowedBlockTypes\n\t\t\t\t\t? map( blockTypes, 'name' )\n\t\t\t\t\t: settings.allowedBlockTypes || [];\n\n\t\t\tresult.allowedBlockTypes = without(\n\t\t\t\tdefaultAllowedBlockTypes,\n\t\t\t\t...hiddenBlockTypes\n\t\t\t);\n\t\t}\n\n\t\treturn result;\n\t}, [\n\t\tsettings,\n\t\thasFixedToolbar,\n\t\tfocusMode,\n\t\thasReducedUI,\n\t\thiddenBlockTypes,\n\t\tblockTypes,\n\t\tpreferredStyleVariations,\n\t\t__experimentalLocalAutosaveInterval,\n\t\tsetIsInserterOpened,\n\t\tupdatePreferredStyleVariations,\n\t\tkeepCaretInsideBlock,\n\t] );\n\n\tconst styles = useMemo( () => {\n\t\tconst themeStyles = [];\n\t\tconst presetStyles = [];\n\t\tsettings.styles.forEach( ( style ) => {\n\t\t\tif ( ! style.__unstableType || style.__unstableType === 'theme' ) {\n\t\t\t\tthemeStyles.push( style );\n\t\t\t} else {\n\t\t\t\tpresetStyles.push( style );\n\t\t\t}\n\t\t} );\n\t\tconst defaultEditorStyles = [\n\t\t\t...settings.defaultEditorStyles,\n\t\t\t...presetStyles,\n\t\t];\n\t\treturn hasThemeStyles && themeStyles.length\n\t\t\t? settings.styles\n\t\t\t: defaultEditorStyles;\n\t}, [ settings, hasThemeStyles ] );\n\n\tif ( ! post ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<StrictMode>\n\t\t\t<ShortcutProvider>\n\t\t\t\t<EditPostSettings.Provider value={ settings }>\n\t\t\t\t\t<SlotFillProvider>\n\t\t\t\t\t\t<EditorProvider\n\t\t\t\t\t\t\tsettings={ editorSettings }\n\t\t\t\t\t\t\tpost={ post }\n\t\t\t\t\t\t\tinitialEdits={ initialEdits }\n\t\t\t\t\t\t\tuseSubRegistry={ false }\n\t\t\t\t\t\t\t__unstableTemplate={\n\t\t\t\t\t\t\t\tisTemplateMode ? template : undefined\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t{ ...props }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<ErrorBoundary onError={ onError }>\n\t\t\t\t\t\t\t\t<EditorInitialization postId={ postId } />\n\t\t\t\t\t\t\t\t<Layout styles={ styles } />\n\t\t\t\t\t\t\t\t<KeyboardShortcuts\n\t\t\t\t\t\t\t\t\tshortcuts={ preventEventDiscovery }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</ErrorBoundary>\n\t\t\t\t\t\t\t<PostLockedModal />\n\t\t\t\t\t\t</EditorProvider>\n\t\t\t\t\t</SlotFillProvider>\n\t\t\t\t</EditPostSettings.Provider>\n\t\t\t</ShortcutProvider>\n\t\t</StrictMode>\n\t);\n}\n\nexport default Editor;\n"]}