@wordpress/edit-site 3.0.13 → 3.0.17

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 (217) hide show
  1. package/build/components/add-new-template/new-template-part.js +29 -18
  2. package/build/components/add-new-template/new-template-part.js.map +1 -1
  3. package/build/components/add-new-template/new-template.js +30 -23
  4. package/build/components/add-new-template/new-template.js.map +1 -1
  5. package/build/components/app/index.js +51 -0
  6. package/build/components/app/index.js.map +1 -0
  7. package/build/components/block-editor/back-button.js +8 -20
  8. package/build/components/block-editor/back-button.js.map +1 -1
  9. package/build/components/block-editor/index.js +2 -1
  10. package/build/components/block-editor/index.js.map +1 -1
  11. package/build/components/create-template-part-modal/index.js +0 -2
  12. package/build/components/create-template-part-modal/index.js.map +1 -1
  13. package/build/components/edit-template-part-menu-button/index.js +20 -8
  14. package/build/components/edit-template-part-menu-button/index.js.map +1 -1
  15. package/build/components/editor/index.js +11 -30
  16. package/build/components/editor/index.js.map +1 -1
  17. package/build/components/global-styles/gradients-palette-panel.js +10 -10
  18. package/build/components/global-styles/gradients-palette-panel.js.map +1 -1
  19. package/build/components/global-styles/screen-background-color.js +2 -1
  20. package/build/components/global-styles/screen-background-color.js.map +1 -1
  21. package/build/components/global-styles/screen-link-color.js +2 -1
  22. package/build/components/global-styles/screen-link-color.js.map +1 -1
  23. package/build/components/global-styles/screen-root.js +8 -2
  24. package/build/components/global-styles/screen-root.js.map +1 -1
  25. package/build/components/global-styles/screen-text-color.js +2 -1
  26. package/build/components/global-styles/screen-text-color.js.map +1 -1
  27. package/build/components/global-styles/use-global-styles-output.js +1 -2
  28. package/build/components/global-styles/use-global-styles-output.js.map +1 -1
  29. package/build/components/header/document-actions/index.js +3 -6
  30. package/build/components/header/document-actions/index.js.map +1 -1
  31. package/build/components/list/actions/index.js +1 -1
  32. package/build/components/list/actions/index.js.map +1 -1
  33. package/build/components/list/index.js +17 -15
  34. package/build/components/list/index.js.map +1 -1
  35. package/build/components/list/table.js +31 -27
  36. package/build/components/list/table.js.map +1 -1
  37. package/build/components/navigation-sidebar/index.js +12 -13
  38. package/build/components/navigation-sidebar/index.js.map +1 -1
  39. package/build/components/navigation-sidebar/navigation-panel/index.js +26 -24
  40. package/build/components/navigation-sidebar/navigation-panel/index.js.map +1 -1
  41. package/build/components/routes/index.js +60 -0
  42. package/build/components/routes/index.js.map +1 -0
  43. package/build/components/routes/link.js +65 -0
  44. package/build/components/routes/link.js.map +1 -0
  45. package/build/components/routes/use-title.js +57 -0
  46. package/build/components/routes/use-title.js.map +1 -0
  47. package/build/components/sidebar/global-styles-sidebar.js +10 -0
  48. package/build/components/sidebar/global-styles-sidebar.js.map +1 -1
  49. package/build/components/sidebar/template-card/template-areas.js +7 -4
  50. package/build/components/sidebar/template-card/template-areas.js.map +1 -1
  51. package/build/components/template-details/index.js +13 -11
  52. package/build/components/template-details/index.js.map +1 -1
  53. package/build/components/template-details/template-areas.js +28 -11
  54. package/build/components/template-details/template-areas.js.map +1 -1
  55. package/build/components/template-part-converter/convert-to-template-part.js +7 -12
  56. package/build/components/template-part-converter/convert-to-template-part.js.map +1 -1
  57. package/build/components/url-query-controller/index.js +41 -50
  58. package/build/components/url-query-controller/index.js.map +1 -1
  59. package/build/components/welcome-guide/editor.js +6 -0
  60. package/build/components/welcome-guide/editor.js.map +1 -1
  61. package/build/components/welcome-guide/index.js +1 -28
  62. package/build/components/welcome-guide/index.js.map +1 -1
  63. package/build/components/welcome-guide/styles.js +18 -1
  64. package/build/components/welcome-guide/styles.js.map +1 -1
  65. package/build/index.js +29 -35
  66. package/build/index.js.map +1 -1
  67. package/build/plugins/index.js +3 -23
  68. package/build/plugins/index.js.map +1 -1
  69. package/build/plugins/site-export.js +61 -0
  70. package/build/plugins/site-export.js.map +1 -0
  71. package/build/plugins/welcome-guide-menu-item.js +1 -7
  72. package/build/plugins/welcome-guide-menu-item.js.map +1 -1
  73. package/build/store/actions.js +0 -27
  74. package/build/store/actions.js.map +1 -1
  75. package/build/store/constants.js +1 -14
  76. package/build/store/constants.js.map +1 -1
  77. package/build/store/reducer.js +7 -16
  78. package/build/store/reducer.js.map +1 -1
  79. package/build/store/selectors.js +1 -31
  80. package/build/store/selectors.js.map +1 -1
  81. package/build/utils/get-is-list-page.js +23 -0
  82. package/build/utils/get-is-list-page.js.map +1 -0
  83. package/build/utils/history.js +35 -0
  84. package/build/utils/history.js.map +1 -0
  85. package/build-module/components/add-new-template/new-template-part.js +27 -16
  86. package/build-module/components/add-new-template/new-template-part.js.map +1 -1
  87. package/build-module/components/add-new-template/new-template.js +28 -18
  88. package/build-module/components/add-new-template/new-template.js.map +1 -1
  89. package/build-module/components/app/index.js +35 -0
  90. package/build-module/components/app/index.js.map +1 -0
  91. package/build-module/components/block-editor/back-button.js +8 -19
  92. package/build-module/components/block-editor/back-button.js.map +1 -1
  93. package/build-module/components/block-editor/index.js +2 -1
  94. package/build-module/components/block-editor/index.js.map +1 -1
  95. package/build-module/components/create-template-part-modal/index.js +0 -2
  96. package/build-module/components/create-template-part-modal/index.js.map +1 -1
  97. package/build-module/components/edit-template-part-menu-button/index.js +17 -9
  98. package/build-module/components/edit-template-part-menu-button/index.js.map +1 -1
  99. package/build-module/components/editor/index.js +13 -33
  100. package/build-module/components/editor/index.js.map +1 -1
  101. package/build-module/components/global-styles/gradients-palette-panel.js +10 -10
  102. package/build-module/components/global-styles/gradients-palette-panel.js.map +1 -1
  103. package/build-module/components/global-styles/screen-background-color.js +2 -1
  104. package/build-module/components/global-styles/screen-background-color.js.map +1 -1
  105. package/build-module/components/global-styles/screen-link-color.js +2 -1
  106. package/build-module/components/global-styles/screen-link-color.js.map +1 -1
  107. package/build-module/components/global-styles/screen-root.js +9 -4
  108. package/build-module/components/global-styles/screen-root.js.map +1 -1
  109. package/build-module/components/global-styles/screen-text-color.js +2 -1
  110. package/build-module/components/global-styles/screen-text-color.js.map +1 -1
  111. package/build-module/components/global-styles/use-global-styles-output.js +1 -2
  112. package/build-module/components/global-styles/use-global-styles-output.js.map +1 -1
  113. package/build-module/components/header/document-actions/index.js +3 -6
  114. package/build-module/components/header/document-actions/index.js.map +1 -1
  115. package/build-module/components/list/actions/index.js +1 -1
  116. package/build-module/components/list/actions/index.js.map +1 -1
  117. package/build-module/components/list/index.js +15 -15
  118. package/build-module/components/list/index.js.map +1 -1
  119. package/build-module/components/list/table.js +31 -27
  120. package/build-module/components/list/table.js.map +1 -1
  121. package/build-module/components/navigation-sidebar/index.js +13 -13
  122. package/build-module/components/navigation-sidebar/index.js.map +1 -1
  123. package/build-module/components/navigation-sidebar/navigation-panel/index.js +24 -24
  124. package/build-module/components/navigation-sidebar/navigation-panel/index.js.map +1 -1
  125. package/build-module/components/routes/index.js +47 -0
  126. package/build-module/components/routes/index.js.map +1 -0
  127. package/build-module/components/routes/link.js +51 -0
  128. package/build-module/components/routes/link.js.map +1 -0
  129. package/build-module/components/routes/use-title.js +44 -0
  130. package/build-module/components/routes/use-title.js.map +1 -0
  131. package/build-module/components/sidebar/global-styles-sidebar.js +8 -0
  132. package/build-module/components/sidebar/global-styles-sidebar.js.map +1 -1
  133. package/build-module/components/sidebar/template-card/template-areas.js +8 -4
  134. package/build-module/components/sidebar/template-card/template-areas.js.map +1 -1
  135. package/build-module/components/template-details/index.js +11 -10
  136. package/build-module/components/template-details/index.js.map +1 -1
  137. package/build-module/components/template-details/template-areas.js +25 -10
  138. package/build-module/components/template-details/template-areas.js.map +1 -1
  139. package/build-module/components/template-part-converter/convert-to-template-part.js +7 -12
  140. package/build-module/components/template-part-converter/convert-to-template-part.js.map +1 -1
  141. package/build-module/components/url-query-controller/index.js +40 -49
  142. package/build-module/components/url-query-controller/index.js.map +1 -1
  143. package/build-module/components/welcome-guide/editor.js +7 -1
  144. package/build-module/components/welcome-guide/editor.js.map +1 -1
  145. package/build-module/components/welcome-guide/index.js +2 -26
  146. package/build-module/components/welcome-guide/index.js.map +1 -1
  147. package/build-module/components/welcome-guide/styles.js +18 -2
  148. package/build-module/components/welcome-guide/styles.js.map +1 -1
  149. package/build-module/index.js +28 -33
  150. package/build-module/index.js.map +1 -1
  151. package/build-module/plugins/index.js +2 -18
  152. package/build-module/plugins/index.js.map +1 -1
  153. package/build-module/plugins/site-export.js +45 -0
  154. package/build-module/plugins/site-export.js.map +1 -0
  155. package/build-module/plugins/welcome-guide-menu-item.js +2 -7
  156. package/build-module/plugins/welcome-guide-menu-item.js.map +1 -1
  157. package/build-module/store/actions.js +0 -23
  158. package/build-module/store/actions.js.map +1 -1
  159. package/build-module/store/constants.js +0 -11
  160. package/build-module/store/constants.js.map +1 -1
  161. package/build-module/store/reducer.js +7 -16
  162. package/build-module/store/reducer.js.map +1 -1
  163. package/build-module/store/selectors.js +1 -27
  164. package/build-module/store/selectors.js.map +1 -1
  165. package/build-module/utils/get-is-list-page.js +16 -0
  166. package/build-module/utils/get-is-list-page.js.map +1 -0
  167. package/build-module/utils/history.js +25 -0
  168. package/build-module/utils/history.js.map +1 -0
  169. package/build-style/style-rtl.css +2 -9
  170. package/build-style/style.css +2 -9
  171. package/package.json +9 -8
  172. package/src/components/add-new-template/new-template-part.js +29 -11
  173. package/src/components/add-new-template/new-template.js +26 -12
  174. package/src/components/app/index.js +47 -0
  175. package/src/components/block-editor/back-button.js +6 -14
  176. package/src/components/block-editor/index.js +1 -0
  177. package/src/components/create-template-part-modal/index.js +0 -2
  178. package/src/components/edit-template-part-menu-button/index.js +16 -5
  179. package/src/components/editor/index.js +105 -131
  180. package/src/components/global-styles/gradients-palette-panel.js +12 -12
  181. package/src/components/global-styles/screen-background-color.js +1 -0
  182. package/src/components/global-styles/screen-link-color.js +1 -0
  183. package/src/components/global-styles/screen-root.js +17 -7
  184. package/src/components/global-styles/screen-text-color.js +1 -0
  185. package/src/components/global-styles/style.scss +3 -5
  186. package/src/components/global-styles/use-global-styles-output.js +0 -1
  187. package/src/components/header/document-actions/index.js +3 -9
  188. package/src/components/list/actions/index.js +1 -1
  189. package/src/components/list/index.js +11 -12
  190. package/src/components/list/style.scss +6 -11
  191. package/src/components/list/table.js +7 -6
  192. package/src/components/navigation-sidebar/index.js +18 -17
  193. package/src/components/navigation-sidebar/navigation-panel/index.js +16 -22
  194. package/src/components/routes/index.js +53 -0
  195. package/src/components/routes/link.js +44 -0
  196. package/src/components/routes/use-title.js +56 -0
  197. package/src/components/sidebar/global-styles-sidebar.js +8 -0
  198. package/src/components/sidebar/template-card/template-areas.js +16 -4
  199. package/src/components/template-details/index.js +9 -7
  200. package/src/components/template-details/template-areas.js +32 -9
  201. package/src/components/template-part-converter/convert-to-template-part.js +4 -2
  202. package/src/components/url-query-controller/index.js +34 -45
  203. package/src/components/welcome-guide/editor.js +10 -1
  204. package/src/components/welcome-guide/index.js +6 -25
  205. package/src/components/welcome-guide/styles.js +20 -2
  206. package/src/index.js +33 -36
  207. package/src/plugins/index.js +2 -32
  208. package/src/plugins/site-export.js +48 -0
  209. package/src/plugins/welcome-guide-menu-item.js +2 -16
  210. package/src/store/actions.js +0 -23
  211. package/src/store/constants.js +0 -12
  212. package/src/store/reducer.js +12 -26
  213. package/src/store/selectors.js +1 -27
  214. package/src/store/test/reducer.js +22 -39
  215. package/src/store/test/selectors.js +3 -34
  216. package/src/utils/get-is-list-page.js +11 -0
  217. package/src/utils/history.js +35 -0
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-site/src/components/template-details/template-areas.js"],"names":["sprintf","__","DropdownMenu","MenuGroup","MenuItem","useSelect","useDispatch","getTemplatePartIcon","store","blockEditorStore","moreVertical","editSiteStore","TEMPLATE_PART_AREA_TO_NAME","isTemplateRevertable","TemplatePartItemMore","onClose","templatePart","closeTemplateDetailsDropdown","pushTemplatePart","revertTemplate","editTemplatePart","id","clearCustomizations","title","rendered","TemplatePartItem","clientId","selectBlock","toggleBlockHighlight","highlightBlock","cancelHighlightBlock","area","TemplateAreas","templateParts","select","getCurrentTemplateTemplateParts","length","map","block","slug"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,OAAT,EAAkBC,EAAlB,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zE,QAAMgB,aAAa,GAAG5B,SAAS,CAC5B6B,MAAF,IAAcA,MAAM,CAAEvB,aAAF,CAAN,CAAwBwB,+BAAxB,EADgB,EAE9B,EAF8B,CAA/B;;AAKA,MAAK,CAAEF,aAAa,CAACG,MAArB,EAA8B;AAC7B,WAAO,IAAP;AACA;;AAED,SACC,cAAC,SAAD;AACC,IAAA,KAAK,EAAGnC,EAAE,CAAE,OAAF,CADX;AAEC,IAAA,SAAS,EAAC;AAFX,KAIGgC,aAAa,CAACI,GAAd,CAAmB;AAAA,QAAE;AAAErB,MAAAA,YAAF;AAAgBsB,MAAAA;AAAhB,KAAF;AAAA,WACpB,cAAC,gBAAD;AACC,MAAA,GAAG,EAAGtB,YAAY,CAACuB,IADpB;AAEC,MAAA,QAAQ,EAAGD,KAAK,CAACZ,QAFlB;AAGC,MAAA,YAAY,EAAGV,YAHhB;AAIC,MAAA,4BAA4B,EAC3BC;AALF,MADoB;AAAA,GAAnB,CAJH,CADD;AAiBA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { sprintf, __ } from '@wordpress/i18n';\nimport { DropdownMenu, MenuGroup, MenuItem } from '@wordpress/components';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { getTemplatePartIcon } from '@wordpress/editor';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { moreVertical } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport { store as editSiteStore } from '../../store';\nimport { TEMPLATE_PART_AREA_TO_NAME } from '../../store/constants';\nimport isTemplateRevertable from '../../utils/is-template-revertable';\n\nfunction TemplatePartItemMore( {\n\tonClose,\n\ttemplatePart,\n\tcloseTemplateDetailsDropdown,\n} ) {\n\tconst { pushTemplatePart, revertTemplate } = useDispatch( editSiteStore );\n\n\tfunction editTemplatePart() {\n\t\tpushTemplatePart( templatePart.id );\n\t\tonClose();\n\t\tcloseTemplateDetailsDropdown();\n\t}\n\n\tfunction clearCustomizations() {\n\t\trevertTemplate( templatePart );\n\t\tonClose();\n\t\tcloseTemplateDetailsDropdown();\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<MenuGroup>\n\t\t\t\t<MenuItem onClick={ editTemplatePart }>\n\t\t\t\t\t{ sprintf(\n\t\t\t\t\t\t/* translators: %s: template part title */\n\t\t\t\t\t\t__( 'Edit %s' ),\n\t\t\t\t\t\ttemplatePart.title?.rendered\n\t\t\t\t\t) }\n\t\t\t\t</MenuItem>\n\t\t\t</MenuGroup>\n\t\t\t{ isTemplateRevertable( templatePart ) && (\n\t\t\t\t<MenuGroup>\n\t\t\t\t\t<MenuItem\n\t\t\t\t\t\tinfo={ __( 'Restore template to theme default' ) }\n\t\t\t\t\t\tonClick={ clearCustomizations }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Clear customizations' ) }\n\t\t\t\t\t</MenuItem>\n\t\t\t\t</MenuGroup>\n\t\t\t) }\n\t\t</>\n\t);\n}\n\nfunction TemplatePartItem( {\n\ttemplatePart,\n\tclientId,\n\tcloseTemplateDetailsDropdown,\n} ) {\n\tconst { selectBlock, toggleBlockHighlight } = useDispatch(\n\t\tblockEditorStore\n\t);\n\tconst highlightBlock = () => toggleBlockHighlight( clientId, true );\n\tconst cancelHighlightBlock = () => toggleBlockHighlight( clientId, false );\n\n\treturn (\n\t\t<div\n\t\t\trole=\"menuitem\"\n\t\t\tclassName=\"edit-site-template-details__template-areas-item\"\n\t\t>\n\t\t\t<MenuItem\n\t\t\t\trole=\"button\"\n\t\t\t\ticon={ getTemplatePartIcon( templatePart.area ) }\n\t\t\t\ticonPosition=\"left\"\n\t\t\t\tonClick={ () => {\n\t\t\t\t\tselectBlock( clientId );\n\t\t\t\t} }\n\t\t\t\tonMouseOver={ highlightBlock }\n\t\t\t\tonMouseLeave={ cancelHighlightBlock }\n\t\t\t\tonFocus={ highlightBlock }\n\t\t\t\tonBlur={ cancelHighlightBlock }\n\t\t\t>\n\t\t\t\t{ TEMPLATE_PART_AREA_TO_NAME[ templatePart.area ] }\n\t\t\t</MenuItem>\n\n\t\t\t<DropdownMenu\n\t\t\t\ticon={ moreVertical }\n\t\t\t\tlabel={ __( 'More options' ) }\n\t\t\t\tclassName=\"edit-site-template-details__template-areas-item-more\"\n\t\t\t>\n\t\t\t\t{ ( { onClose } ) => (\n\t\t\t\t\t<TemplatePartItemMore\n\t\t\t\t\t\tonClose={ onClose }\n\t\t\t\t\t\ttemplatePart={ templatePart }\n\t\t\t\t\t\tcloseTemplateDetailsDropdown={\n\t\t\t\t\t\t\tcloseTemplateDetailsDropdown\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t</DropdownMenu>\n\t\t</div>\n\t);\n}\n\nexport default function TemplateAreas( { closeTemplateDetailsDropdown } ) {\n\tconst templateParts = useSelect(\n\t\t( select ) => select( editSiteStore ).getCurrentTemplateTemplateParts(),\n\t\t[]\n\t);\n\n\tif ( ! templateParts.length ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<MenuGroup\n\t\t\tlabel={ __( 'Areas' ) }\n\t\t\tclassName=\"edit-site-template-details__group edit-site-template-details__template-areas\"\n\t\t>\n\t\t\t{ templateParts.map( ( { templatePart, block } ) => (\n\t\t\t\t<TemplatePartItem\n\t\t\t\t\tkey={ templatePart.slug }\n\t\t\t\t\tclientId={ block.clientId }\n\t\t\t\t\ttemplatePart={ templatePart }\n\t\t\t\t\tcloseTemplateDetailsDropdown={\n\t\t\t\t\t\tcloseTemplateDetailsDropdown\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t) ) }\n\t\t</MenuGroup>\n\t);\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/edit-site/src/components/template-details/template-areas.js"],"names":["sprintf","__","DropdownMenu","MenuGroup","MenuItem","useSelect","useDispatch","store","editorStore","blockEditorStore","moreVertical","editSiteStore","isTemplateRevertable","useLocation","useLink","TemplatePartItemMore","onClose","templatePart","closeTemplateDetailsDropdown","revertTemplate","params","editLinkProps","postId","id","postType","type","fromTemplateId","editTemplatePart","event","onClick","clearCustomizations","title","rendered","TemplatePartItem","clientId","selectBlock","toggleBlockHighlight","templatePartArea","select","defaultAreas","__experimentalGetDefaultTemplatePartAreas","find","defaultArea","area","highlightBlock","cancelHighlightBlock","icon","label","TemplateAreas","templateParts","getCurrentTemplateTemplateParts","length","map","block","slug"],"mappings":";;;AAAA;AACA;AACA;AACA,SAASA,OAAT,EAAkBC,EAAlB,QAA4B,iBAA5B;AACA,SAASC,YAAT,EAAuBC,SAAvB,EAAkCC,QAAlC,QAAkD,uBAAlD;AACA,SAASC,SAAT,EAAoBC,WAApB,QAAuC,iBAAvC;AACA,SAASC,KAAK,IAAIC,WAAlB,QAAqC,mBAArC;AACA,SAASD,KAAK,IAAIE,gBAAlB,QAA0C,yBAA1C;AACA,SAASC,YAAT,QAA6B,kBAA7B;AAEA;AACA;AACA;;AACA,SAASH,KAAK,IAAII,aAAlB,QAAuC,aAAvC;AACA,OAAOC,oBAAP,MAAiC,oCAAjC;AACA,SAASC,WAAT,QAA4B,WAA5B;AACA,SAASC,OAAT,QAAwB,gBAAxB;;AAEA,SAASC,oBAAT,OAII;AAAA;;AAAA,MAJ2B;AAC9BC,IAAAA,OAD8B;AAE9BC,IAAAA,YAF8B;AAG9BC,IAAAA;AAH8B,GAI3B;AACH,QAAM;AAAEC,IAAAA;AAAF,MAAqBb,WAAW,CAAEK,aAAF,CAAtC;AACA,QAAM;AAAES,IAAAA;AAAF,MAAaP,WAAW,EAA9B;AACA,QAAMQ,aAAa,GAAGP,OAAO,CAC5B;AACCQ,IAAAA,MAAM,EAAEL,YAAY,CAACM,EADtB;AAECC,IAAAA,QAAQ,EAAEP,YAAY,CAACQ;AAFxB,GAD4B,EAK5B;AACCC,IAAAA,cAAc,EAAEN,MAAM,CAACE;AADxB,GAL4B,CAA7B;;AAUA,WAASK,gBAAT,CAA2BC,KAA3B,EAAmC;AAClCP,IAAAA,aAAa,CAACQ,OAAd,CAAuBD,KAAvB;AACAZ,IAAAA,OAAO;AACPE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QAAE;AAAEnC,MAAAA,YAAF;AAAgBoC,MAAAA;AAAhB,KAAF;AAAA,WACpB,cAAC,gBAAD;AACC,MAAA,GAAG,EAAGpC,YAAY,CAACqC,IADpB;AAEC,MAAA,QAAQ,EAAGD,KAAK,CAACnB,QAFlB;AAGC,MAAA,YAAY,EAAGjB,YAHhB;AAIC,MAAA,4BAA4B,EAC3BC;AALF,MADoB;AAAA,GAAnB,CAJH,CADD;AAiBA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { sprintf, __ } from '@wordpress/i18n';\nimport { DropdownMenu, MenuGroup, MenuItem } from '@wordpress/components';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as editorStore } from '@wordpress/editor';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { moreVertical } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport { store as editSiteStore } from '../../store';\nimport isTemplateRevertable from '../../utils/is-template-revertable';\nimport { useLocation } from '../routes';\nimport { useLink } from '../routes/link';\n\nfunction TemplatePartItemMore( {\n\tonClose,\n\ttemplatePart,\n\tcloseTemplateDetailsDropdown,\n} ) {\n\tconst { revertTemplate } = useDispatch( editSiteStore );\n\tconst { params } = useLocation();\n\tconst editLinkProps = useLink(\n\t\t{\n\t\t\tpostId: templatePart.id,\n\t\t\tpostType: templatePart.type,\n\t\t},\n\t\t{\n\t\t\tfromTemplateId: params.postId,\n\t\t}\n\t);\n\n\tfunction editTemplatePart( event ) {\n\t\teditLinkProps.onClick( event );\n\t\tonClose();\n\t\tcloseTemplateDetailsDropdown();\n\t}\n\n\tfunction clearCustomizations() {\n\t\trevertTemplate( templatePart );\n\t\tonClose();\n\t\tcloseTemplateDetailsDropdown();\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<MenuGroup>\n\t\t\t\t<MenuItem { ...editLinkProps } onClick={ editTemplatePart }>\n\t\t\t\t\t{ sprintf(\n\t\t\t\t\t\t/* translators: %s: template part title */\n\t\t\t\t\t\t__( 'Edit %s' ),\n\t\t\t\t\t\ttemplatePart.title?.rendered\n\t\t\t\t\t) }\n\t\t\t\t</MenuItem>\n\t\t\t</MenuGroup>\n\t\t\t{ isTemplateRevertable( templatePart ) && (\n\t\t\t\t<MenuGroup>\n\t\t\t\t\t<MenuItem\n\t\t\t\t\t\tinfo={ __( 'Restore template to default state' ) }\n\t\t\t\t\t\tonClick={ clearCustomizations }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Clear customizations' ) }\n\t\t\t\t\t</MenuItem>\n\t\t\t\t</MenuGroup>\n\t\t\t) }\n\t\t</>\n\t);\n}\n\nfunction TemplatePartItem( {\n\ttemplatePart,\n\tclientId,\n\tcloseTemplateDetailsDropdown,\n} ) {\n\tconst { selectBlock, toggleBlockHighlight } = useDispatch(\n\t\tblockEditorStore\n\t);\n\tconst templatePartArea = useSelect(\n\t\t( select ) => {\n\t\t\tconst defaultAreas = select(\n\t\t\t\teditorStore\n\t\t\t).__experimentalGetDefaultTemplatePartAreas();\n\n\t\t\treturn defaultAreas.find(\n\t\t\t\t( defaultArea ) => defaultArea.area === templatePart.area\n\t\t\t);\n\t\t},\n\t\t[ templatePart.area ]\n\t);\n\tconst highlightBlock = () => toggleBlockHighlight( clientId, true );\n\tconst cancelHighlightBlock = () => toggleBlockHighlight( clientId, false );\n\n\treturn (\n\t\t<div\n\t\t\trole=\"menuitem\"\n\t\t\tclassName=\"edit-site-template-details__template-areas-item\"\n\t\t>\n\t\t\t<MenuItem\n\t\t\t\trole=\"button\"\n\t\t\t\ticon={ templatePartArea?.icon }\n\t\t\t\ticonPosition=\"left\"\n\t\t\t\tonClick={ () => {\n\t\t\t\t\tselectBlock( clientId );\n\t\t\t\t} }\n\t\t\t\tonMouseOver={ highlightBlock }\n\t\t\t\tonMouseLeave={ cancelHighlightBlock }\n\t\t\t\tonFocus={ highlightBlock }\n\t\t\t\tonBlur={ cancelHighlightBlock }\n\t\t\t>\n\t\t\t\t{ templatePartArea?.label }\n\t\t\t</MenuItem>\n\n\t\t\t<DropdownMenu\n\t\t\t\ticon={ moreVertical }\n\t\t\t\tlabel={ __( 'More options' ) }\n\t\t\t\tclassName=\"edit-site-template-details__template-areas-item-more\"\n\t\t\t>\n\t\t\t\t{ ( { onClose } ) => (\n\t\t\t\t\t<TemplatePartItemMore\n\t\t\t\t\t\tonClose={ onClose }\n\t\t\t\t\t\ttemplatePart={ templatePart }\n\t\t\t\t\t\tcloseTemplateDetailsDropdown={\n\t\t\t\t\t\t\tcloseTemplateDetailsDropdown\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t</DropdownMenu>\n\t\t</div>\n\t);\n}\n\nexport default function TemplateAreas( { closeTemplateDetailsDropdown } ) {\n\tconst templateParts = useSelect(\n\t\t( select ) => select( editSiteStore ).getCurrentTemplateTemplateParts(),\n\t\t[]\n\t);\n\n\tif ( ! templateParts.length ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<MenuGroup\n\t\t\tlabel={ __( 'Areas' ) }\n\t\t\tclassName=\"edit-site-template-details__group edit-site-template-details__template-areas\"\n\t\t>\n\t\t\t{ templateParts.map( ( { templatePart, block } ) => (\n\t\t\t\t<TemplatePartItem\n\t\t\t\t\tkey={ templatePart.slug }\n\t\t\t\t\tclientId={ block.clientId }\n\t\t\t\t\ttemplatePart={ templatePart }\n\t\t\t\t\tcloseTemplateDetailsDropdown={\n\t\t\t\t\t\tcloseTemplateDetailsDropdown\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t) ) }\n\t\t</MenuGroup>\n\t);\n}\n"]}
@@ -54,20 +54,15 @@ export default function ConvertToTemplatePart(_ref) {
54
54
  }));
55
55
  createSuccessNotice(__('Template part created.'), {
56
56
  type: 'snackbar'
57
- });
57
+ }); // The modal and this component will be unmounted because of `replaceBlocks` above,
58
+ // so no need to call `closeModal` or `onClose`.
58
59
  };
59
60
 
60
- return createElement(Fragment, null, createElement(BlockSettingsMenuControls, null, _ref3 => {
61
- let {
62
- onClose
63
- } = _ref3;
64
- return createElement(MenuItem, {
65
- onClick: () => {
66
- setIsModalOpen(true);
67
- onClose();
68
- }
69
- }, __('Make template part'));
70
- }), isModalOpen && createElement(CreateTemplatePartModal, {
61
+ return createElement(Fragment, null, createElement(BlockSettingsMenuControls, null, () => createElement(MenuItem, {
62
+ onClick: () => {
63
+ setIsModalOpen(true);
64
+ }
65
+ }, __('Make template part'))), isModalOpen && createElement(CreateTemplatePartModal, {
71
66
  closeModal: () => {
72
67
  setIsModalOpen(false);
73
68
  },
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-site/src/components/template-part-converter/convert-to-template-part.js"],"names":["kebabCase","useDispatch","BlockSettingsMenuControls","store","blockEditorStore","MenuItem","createBlock","serialize","__","useState","coreStore","noticesStore","CreateTemplatePartModal","ConvertToTemplatePart","clientIds","blocks","isModalOpen","setIsModalOpen","replaceBlocks","saveEntityRecord","createSuccessNotice","onConvert","title","area","templatePart","slug","content","theme","type","onClose"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,SAAT,QAA0B,QAA1B;AAEA;AACA;AACA;;AACA,SAASC,WAAT,QAA4B,iBAA5B;AACA,SACCC,yBADD,EAECC,KAAK,IAAIC,gBAFV,QAGO,yBAHP;AAIA,SAASC,QAAT,QAAyB,uBAAzB;AACA,SAASC,WAAT,EAAsBC,SAAtB,QAAuC,mBAAvC;AACA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,QAAT,QAAyB,oBAAzB;AACA,SAASN,KAAK,IAAIO,SAAlB,QAAmC,sBAAnC;AACA,SAASP,KAAK,IAAIQ,YAAlB,QAAsC,oBAAtC;AAEA;AACA;AACA;;AACA,OAAOC,uBAAP,MAAoC,+BAApC;AAEA,eAAe,SAASC,qBAAT,OAAwD;AAAA,MAAxB;AAAEC,IAAAA,SAAF;AAAaC,IAAAA;AAAb,GAAwB;AACtE,QAAM,CAAEC,WAAF,EAAeC,cAAf,IAAkCR,QAAQ,CAAE,KAAF,CAAhD;A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AdF,CADD;AAwBA","sourcesContent":["/**\n * External dependencies\n */\nimport { kebabCase } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { useDispatch } from '@wordpress/data';\nimport {\n\tBlockSettingsMenuControls,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { MenuItem } from '@wordpress/components';\nimport { createBlock, serialize } from '@wordpress/blocks';\nimport { __ } from '@wordpress/i18n';\nimport { useState } from '@wordpress/element';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { store as noticesStore } from '@wordpress/notices';\n\n/**\n * Internal dependencies\n */\nimport CreateTemplatePartModal from '../create-template-part-modal';\n\nexport default function ConvertToTemplatePart( { clientIds, blocks } ) {\n\tconst [ isModalOpen, setIsModalOpen ] = useState( false );\n\tconst { replaceBlocks } = useDispatch( blockEditorStore );\n\tconst { saveEntityRecord } = useDispatch( coreStore );\n\tconst { createSuccessNotice } = useDispatch( noticesStore );\n\n\tconst onConvert = async ( { title, area } ) => {\n\t\tconst templatePart = await saveEntityRecord(\n\t\t\t'postType',\n\t\t\t'wp_template_part',\n\t\t\t{\n\t\t\t\tslug: kebabCase( title ),\n\t\t\t\ttitle,\n\t\t\t\tcontent: serialize( blocks ),\n\t\t\t\tarea,\n\t\t\t}\n\t\t);\n\t\treplaceBlocks(\n\t\t\tclientIds,\n\t\t\tcreateBlock( 'core/template-part', {\n\t\t\t\tslug: templatePart.slug,\n\t\t\t\ttheme: templatePart.theme,\n\t\t\t} )\n\t\t);\n\t\tcreateSuccessNotice( __( 'Template part created.' ), {\n\t\t\ttype: 'snackbar',\n\t\t} );\n\t};\n\n\treturn (\n\t\t<>\n\t\t\t<BlockSettingsMenuControls>\n\t\t\t\t{ ( { onClose } ) => (\n\t\t\t\t\t<MenuItem\n\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\tsetIsModalOpen( true );\n\t\t\t\t\t\t\tonClose();\n\t\t\t\t\t\t} }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Make template part' ) }\n\t\t\t\t\t</MenuItem>\n\t\t\t\t) }\n\t\t\t</BlockSettingsMenuControls>\n\t\t\t{ isModalOpen && (\n\t\t\t\t<CreateTemplatePartModal\n\t\t\t\t\tcloseModal={ () => {\n\t\t\t\t\t\tsetIsModalOpen( false );\n\t\t\t\t\t} }\n\t\t\t\t\tonCreate={ onConvert }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</>\n\t);\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/edit-site/src/components/template-part-converter/convert-to-template-part.js"],"names":["kebabCase","useDispatch","BlockSettingsMenuControls","store","blockEditorStore","MenuItem","createBlock","serialize","__","useState","coreStore","noticesStore","CreateTemplatePartModal","ConvertToTemplatePart","clientIds","blocks","isModalOpen","setIsModalOpen","replaceBlocks","saveEntityRecord","createSuccessNotice","onConvert","title","area","templatePart","slug","content","theme","type"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,SAAT,QAA0B,QAA1B;AAEA;AACA;AACA;;AACA,SAASC,WAAT,QAA4B,iBAA5B;AACA,SACCC,yBADD,EAECC,KAAK,IAAIC,gBAFV,QAGO,yBAHP;AAIA,SAASC,QAAT,QAAyB,uBAAzB;AACA,SAASC,WAAT,EAAsBC,SAAtB,QAAuC,mBAAvC;AACA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,QAAT,QAAyB,oBAAzB;AACA,SAASN,KAAK,IAAIO,SAAlB,QAAmC,sBAAnC;AACA,SAASP,KAAK,IAAIQ,YAAlB,QAAsC,oBAAtC;AAEA;AACA;AACA;;AACA,OAAOC,uBAAP,MAAoC,+BAApC;AAEA,eAAe,SAASC,qBAAT,OAAwD;AAAA,MAAxB;AAAEC,IAAAA,SAAF;AAAaC,IAAAA;AAAb,GAAwB;AACtE,QAAM,CAAEC,WAAF,EAAeC,cAAf,IAAkCR,QAAQ,CAAE,KAAF,CAAhD;AACA,QAAM;AAAES,IAAAA;AAAF,MAAoBjB,WAAW,CAAEG,gBAAF,CAArC;AACA,QAAM;AAAEe,IAAAA;AAAF,MAAuBlB,WAAW,CAAES,SAAF,CAAxC;AACA,QAAM;AAAEU,IAAAA;AAAF,MAA0BnB,WAAW,CAAEU,YAAF,CAA3C;;AAEA,QAAMU,SAAS,GAAG,eAA6B;AAAA,QAArB;AAAEC,MAAAA,KAAF;AAASC,MAAAA;AAAT,KAAqB;AAC9C,UAAMC,YAAY,GAAG,MAAML,gBAAgB,CAC1C,UAD0C,EAE1C,kBAF0C,EAG1C;AACCM,MAAAA,IAAI,EAAEzB,SAAS,CAAEsB,KAAF,CADhB;AAECA,MAAAA,KAFD;AAGCI,MAAAA,OAAO,EAAEnB,SAAS,CAAEQ,MAAF,CAHnB;AAICQ,MAAAA;AAJD,KAH0C,CAA3C;AAUAL,IAAAA,aAAa,CACZJ,SADY,EAEZR,WAAW,CAAE,oBAAF,EAAwB;AAClCmB,MAAAA,IAAI,EAAED,YAAY,CAACC,IADe;AAElCE,MAAAA,KAAK,EAAEH,YAAY,CAACG;AAFc,KAAxB,CAFC,CAAb;AAOAP,IAAAA,mBAAmB,CAAEZ,EAAE,CAAE,wBAAF,CAAJ,EAAkC;AACpDoB,MAAAA,IAAI,EAAE;AAD8C,KAAlC,CAAnB,CAlB8C,CAsB9C;AACA;AACA,GAxBD;;AA0BA,SACC,8BACC,cAAC,yBAAD,QACG,MACD,cAAC,QAAD;AACC,IAAA,OAAO,EAAG,MAAM;AACfX,MAAAA,cAAc,CAAE,IAAF,CAAd;AACA;AAHF,KAKGT,EAAE,CAAE,oBAAF,CALL,CAFF,CADD,EAYGQ,WAAW,IACZ,cAAC,uBAAD;AACC,IAAA,UAAU,EAAG,MAAM;AAClBC,MAAAA,cAAc,CAAE,KAAF,CAAd;AACA,KAHF;AAIC,IAAA,QAAQ,EAAGI;AAJZ,IAbF,CADD;AAuBA","sourcesContent":["/**\n * External dependencies\n */\nimport { kebabCase } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { useDispatch } from '@wordpress/data';\nimport {\n\tBlockSettingsMenuControls,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { MenuItem } from '@wordpress/components';\nimport { createBlock, serialize } from '@wordpress/blocks';\nimport { __ } from '@wordpress/i18n';\nimport { useState } from '@wordpress/element';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { store as noticesStore } from '@wordpress/notices';\n\n/**\n * Internal dependencies\n */\nimport CreateTemplatePartModal from '../create-template-part-modal';\n\nexport default function ConvertToTemplatePart( { clientIds, blocks } ) {\n\tconst [ isModalOpen, setIsModalOpen ] = useState( false );\n\tconst { replaceBlocks } = useDispatch( blockEditorStore );\n\tconst { saveEntityRecord } = useDispatch( coreStore );\n\tconst { createSuccessNotice } = useDispatch( noticesStore );\n\n\tconst onConvert = async ( { title, area } ) => {\n\t\tconst templatePart = await saveEntityRecord(\n\t\t\t'postType',\n\t\t\t'wp_template_part',\n\t\t\t{\n\t\t\t\tslug: kebabCase( title ),\n\t\t\t\ttitle,\n\t\t\t\tcontent: serialize( blocks ),\n\t\t\t\tarea,\n\t\t\t}\n\t\t);\n\t\treplaceBlocks(\n\t\t\tclientIds,\n\t\t\tcreateBlock( 'core/template-part', {\n\t\t\t\tslug: templatePart.slug,\n\t\t\t\ttheme: templatePart.theme,\n\t\t\t} )\n\t\t);\n\t\tcreateSuccessNotice( __( 'Template part created.' ), {\n\t\t\ttype: 'snackbar',\n\t\t} );\n\n\t\t// The modal and this component will be unmounted because of `replaceBlocks` above,\n\t\t// so no need to call `closeModal` or `onClose`.\n\t};\n\n\treturn (\n\t\t<>\n\t\t\t<BlockSettingsMenuControls>\n\t\t\t\t{ () => (\n\t\t\t\t\t<MenuItem\n\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\tsetIsModalOpen( true );\n\t\t\t\t\t\t} }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Make template part' ) }\n\t\t\t\t\t</MenuItem>\n\t\t\t\t) }\n\t\t\t</BlockSettingsMenuControls>\n\t\t\t{ isModalOpen && (\n\t\t\t\t<CreateTemplatePartModal\n\t\t\t\t\tcloseModal={ () => {\n\t\t\t\t\t\tsetIsModalOpen( false );\n\t\t\t\t\t} }\n\t\t\t\t\tonCreate={ onConvert }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</>\n\t);\n}\n"]}
@@ -3,11 +3,11 @@
3
3
  */
4
4
  import { useEffect } from '@wordpress/element';
5
5
  import { useDispatch, useSelect } from '@wordpress/data';
6
- import { getQueryArg, addQueryArgs, removeQueryArgs } from '@wordpress/url';
7
6
  /**
8
7
  * Internal dependencies
9
8
  */
10
9
 
10
+ import { useLocation, useHistory } from '../routes';
11
11
  import { store as editSiteStore } from '../../store';
12
12
  export default function URLQueryController() {
13
13
  const {
@@ -15,18 +15,22 @@ export default function URLQueryController() {
15
15
  setTemplatePart,
16
16
  showHomepage,
17
17
  setPage
18
- } = useDispatch(editSiteStore); // Set correct entity on load.
19
-
20
- useEffect(() => {
21
- const url = window.location.href;
22
- const postId = getQueryArg(url, 'postId');
23
-
24
- if (!postId) {
25
- showHomepage();
26
- return;
18
+ } = useDispatch(editSiteStore);
19
+ const history = useHistory();
20
+ const {
21
+ params: {
22
+ postId,
23
+ postType
27
24
  }
25
+ } = useLocation();
26
+ const {
27
+ getPage,
28
+ getEditedPostId,
29
+ getEditedPostType
30
+ } = useSelect(editSiteStore); // Set correct entity on page navigation.
28
31
 
29
- const postType = getQueryArg(url, 'postType');
32
+ useEffect(() => {
33
+ let isMounted = true;
30
34
 
31
35
  if ('page' === postType || 'post' === postType) {
32
36
  setPage({
@@ -40,48 +44,35 @@ export default function URLQueryController() {
40
44
  } else if ('wp_template_part' === postType) {
41
45
  setTemplatePart(postId);
42
46
  } else {
43
- showHomepage();
44
- }
45
- }, []); // Update page URL when context changes.
46
-
47
- const pageContext = useCurrentPageContext();
48
- useEffect(() => {
49
- const newUrl = pageContext ? addQueryArgs(window.location.href, pageContext) : removeQueryArgs(window.location.href, 'postType', 'postId');
50
- window.history.replaceState({}, '', newUrl);
51
- }, [pageContext]);
52
- return null;
53
- }
54
-
55
- function useCurrentPageContext() {
56
- return useSelect(select => {
57
- var _page$context, _page$context2;
58
-
59
- const {
60
- getEditedPostType,
61
- getEditedPostId,
62
- getPage
63
- } = select(editSiteStore);
64
- const page = getPage();
65
-
66
- let _postId = getEditedPostId(),
67
- _postType = getEditedPostType(); // This doesn't seem right to me,
68
- // we shouldn't be using the "page" and the "template" in the same way.
69
- // This need to be investigated.
47
+ showHomepage().then(() => {
48
+ var _page$context, _page$context2;
70
49
 
50
+ if (!isMounted) {
51
+ return;
52
+ }
71
53
 
72
- if (page !== null && page !== void 0 && (_page$context = page.context) !== null && _page$context !== void 0 && _page$context.postId && page !== null && page !== void 0 && (_page$context2 = page.context) !== null && _page$context2 !== void 0 && _page$context2.postType) {
73
- _postId = page.context.postId;
74
- _postType = page.context.postType;
75
- }
54
+ const page = getPage();
55
+ const editedPostId = getEditedPostId();
56
+ const editedPostType = getEditedPostType();
76
57
 
77
- if (_postId && _postType) {
78
- return {
79
- postId: _postId,
80
- postType: _postType
81
- };
58
+ if (page !== null && page !== void 0 && (_page$context = page.context) !== null && _page$context !== void 0 && _page$context.postId && page !== null && page !== void 0 && (_page$context2 = page.context) !== null && _page$context2 !== void 0 && _page$context2.postType) {
59
+ history.replace({
60
+ postId: page.context.postId,
61
+ postType: page.context.postType
62
+ });
63
+ } else if (editedPostId && editedPostType) {
64
+ history.replace({
65
+ postId: editedPostId,
66
+ postType: editedPostType
67
+ });
68
+ }
69
+ });
82
70
  }
83
71
 
84
- return null;
85
- }, []);
72
+ return () => {
73
+ isMounted = false;
74
+ };
75
+ }, [postId, postType]);
76
+ return null;
86
77
  }
87
78
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-site/src/components/url-query-controller/index.js"],"names":["useEffect","useDispatch","useSelect","getQueryArg","addQueryArgs","removeQueryArgs","store","editSiteStore","URLQueryController","setTemplate","setTemplatePart","showHomepage","setPage","url","window","location","href","postId","postType","context","pageContext","useCurrentPageContext","newUrl","history","replaceState","select","getEditedPostType","getEditedPostId","getPage","page","_postId","_postType"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,SAAT,QAA0B,oBAA1B;AACA,SAASC,WAAT,EAAsBC,SAAtB,QAAuC,iBAAvC;AACA,SAASC,WAAT,EAAsBC,YAAtB,EAAoCC,eAApC,QAA2D,gBAA3D;AAEA;AACA;AACA;;AACA,SAASC,KAAK,IAAIC,aAAlB,QAAuC,aAAvC;AAEA,eAAe,SAASC,kBAAT,GAA8B;AAC5C,QAAM;AAAEC,IAAAA,WAAF;AAAeC,IAAAA,eAAf;AAAgCC,IAAAA,YAAhC;AAA8CC,IAAAA;AAA9C,MAA0DX,WAAW,CAC1EM,aAD0E,CAA3E,CAD4C,CAK5C;;AACAP,EAAAA,SAAS,CAAE,MAAM;AAChB,UAAMa,GAAG,GAAGC,MAAM,CAACC,QAAP,CAAgBC,IAA5B;AACA,UAAMC,MAAM,GAAGd,WAAW,CAAEU,GAAF,EAAO,QAAP,CAA1B;;AAEA,QAAK,CAAEI,MAAP,EAAgB;AACfN,MAAAA,YAAY;AACZ;AACA;;AAED,UAAMO,QAAQ,GAAGf,WAAW,CAAEU,GAAF,EAAO,UAAP,CAA5B;;AACA,QAAK,WAAWK,QAAX,IAAuB,WAAWA,QAAvC,EAAkD;AACjDN,MAAAA,OAAO,CAAE;AAAEO,QAAAA,OAAO,EAAE;AAAED,UAAAA,QAAF;AAAYD,UAAAA;AAAZ;AAAX,OAAF,CAAP,CADiD,CACH;AAC9C,KAFD,MAEO,IAAK,kBAAkBC,QAAvB,EAAkC;AACxCT,MAAAA,WAAW,CAAEQ,MAAF,CAAX;AACA,KAFM,MAEA,IAAK,uBAAuBC,QAA5B,EAAuC;AAC7CR,MAAAA,eAAe,CAAEO,MAAF,CAAf;AACA,KAFM,MAEA;AACNN,MAAAA,YAAY;AACZ;AACD,GAnBQ,EAmBN,EAnBM,CAAT,CAN4C,CA2B5C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Be,EAqBb,EArBa,CAAhB;AAsBA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useEffect } from '@wordpress/element';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { getQueryArg, addQueryArgs, removeQueryArgs } from '@wordpress/url';\n\n/**\n * Internal dependencies\n */\nimport { store as editSiteStore } from '../../store';\n\nexport default function URLQueryController() {\n\tconst { setTemplate, setTemplatePart, showHomepage, setPage } = useDispatch(\n\t\teditSiteStore\n\t);\n\n\t// Set correct entity on load.\n\tuseEffect( () => {\n\t\tconst url = window.location.href;\n\t\tconst postId = getQueryArg( url, 'postId' );\n\n\t\tif ( ! postId ) {\n\t\t\tshowHomepage();\n\t\t\treturn;\n\t\t}\n\n\t\tconst postType = getQueryArg( url, 'postType' );\n\t\tif ( 'page' === postType || 'post' === postType ) {\n\t\t\tsetPage( { context: { postType, postId } } ); // Resolves correct template based on ID.\n\t\t} else if ( 'wp_template' === postType ) {\n\t\t\tsetTemplate( postId );\n\t\t} else if ( 'wp_template_part' === postType ) {\n\t\t\tsetTemplatePart( postId );\n\t\t} else {\n\t\t\tshowHomepage();\n\t\t}\n\t}, [] );\n\n\t// Update page URL when context changes.\n\tconst pageContext = useCurrentPageContext();\n\tuseEffect( () => {\n\t\tconst newUrl = pageContext\n\t\t\t? addQueryArgs( window.location.href, pageContext )\n\t\t\t: removeQueryArgs( window.location.href, 'postType', 'postId' );\n\n\t\twindow.history.replaceState( {}, '', newUrl );\n\t}, [ pageContext ] );\n\n\treturn null;\n}\n\nfunction useCurrentPageContext() {\n\treturn useSelect( ( select ) => {\n\t\tconst { getEditedPostType, getEditedPostId, getPage } = select(\n\t\t\teditSiteStore\n\t\t);\n\n\t\tconst page = getPage();\n\t\tlet _postId = getEditedPostId(),\n\t\t\t_postType = getEditedPostType();\n\t\t// This doesn't seem right to me,\n\t\t// we shouldn't be using the \"page\" and the \"template\" in the same way.\n\t\t// This need to be investigated.\n\t\tif ( page?.context?.postId && page?.context?.postType ) {\n\t\t\t_postId = page.context.postId;\n\t\t\t_postType = page.context.postType;\n\t\t}\n\n\t\tif ( _postId && _postType ) {\n\t\t\treturn { postId: _postId, postType: _postType };\n\t\t}\n\n\t\treturn null;\n\t}, [] );\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/edit-site/src/components/url-query-controller/index.js"],"names":["useEffect","useDispatch","useSelect","useLocation","useHistory","store","editSiteStore","URLQueryController","setTemplate","setTemplatePart","showHomepage","setPage","history","params","postId","postType","getPage","getEditedPostId","getEditedPostType","isMounted","context","then","page","editedPostId","editedPostType","replace"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,SAAT,QAA0B,oBAA1B;AACA,SAASC,WAAT,EAAsBC,SAAtB,QAAuC,iBAAvC;AAEA;AACA;AACA;;AACA,SAASC,WAAT,EAAsBC,UAAtB,QAAwC,WAAxC;AACA,SAASC,KAAK,IAAIC,aAAlB,QAAuC,aAAvC;AAEA,eAAe,SAASC,kBAAT,GAA8B;AAC5C,QAAM;AAAEC,IAAAA,WAAF;AAAeC,IAAAA,eAAf;AAAgCC,IAAAA,YAAhC;AAA8CC,IAAAA;AAA9C,MAA0DV,WAAW,CAC1EK,aAD0E,CAA3E;AAGA,QAAMM,OAAO,GAAGR,UAAU,EAA1B;AACA,QAAM;AACLS,IAAAA,MAAM,EAAE;AAAEC,MAAAA,MAAF;AAAUC,MAAAA;AAAV;AADH,MAEFZ,WAAW,EAFf;AAGA,QAAM;AAAEa,IAAAA,OAAF;AAAWC,IAAAA,eAAX;AAA4BC,IAAAA;AAA5B,MAAkDhB,SAAS,CAChEI,aADgE,CAAjE,CAR4C,CAY5C;;AACAN,EAAAA,SAAS,CAAE,MAAM;AAChB,QAAImB,SAAS,GAAG,IAAhB;;AAEA,QAAK,WAAWJ,QAAX,IAAuB,WAAWA,QAAvC,EAAkD;AACjDJ,MAAAA,OAAO,CAAE;AAAES,QAAAA,OAAO,EAAE;AAAEL,UAAAA,QAAF;AAAYD,UAAAA;AAAZ;AAAX,OAAF,CAAP,CADiD,CACH;AAC9C,KAFD,MAEO,IAAK,kBAAkBC,QAAvB,EAAkC;AACxCP,MAAAA,WAAW,CAAEM,MAAF,CAAX;AACA,KAFM,MAEA,IAAK,uBAAuBC,QAA5B,EAAuC;AAC7CN,MAAAA,eAAe,CAAEK,MAAF,CAAf;AACA,KAFM,MAEA;AACNJ,MAAAA,YAAY,GAAGW,IAAf,CAAqB,MAAM;AAAA;;AAC1B,YAAK,CAAEF,SAAP,EAAmB;AAClB;AACA;;AAED,cAAMG,IAAI,GAAGN,OAAO,EAApB;AACA,cAAMO,YAAY,GAAGN,eAAe,EAApC;AACA,cAAMO,cAAc,GAAGN,iBAAiB,EAAxC;;AAEA,YAAKI,IAAI,SAAJ,IAAAA,IAAI,WAAJ,qBAAAA,IAAI,CAAEF,OAAN,wDAAeN,MAAf,IAAyBQ,IAAzB,aAAyBA,IAAzB,iCAAyBA,IAAI,CAAEF,OAA/B,2CAAyB,eAAeL,QAA7C,EAAwD;AACvDH,UAAAA,OAAO,CAACa,OAAR,CAAiB;AAChBX,YAAAA,MAAM,EAAEQ,IAAI,CAACF,OAAL,CAAaN,MADL;AAEhBC,YAAAA,QAAQ,EAAEO,IAAI,CAACF,OAAL,CAAaL;AAFP,WAAjB;AAIA,SALD,MAKO,IAAKQ,YAAY,IAAIC,cAArB,EAAsC;AAC5CZ,UAAAA,OAAO,CAACa,OAAR,CAAiB;AAChBX,YAAAA,MAAM,EAAES,YADQ;AAEhBR,YAAAA,QAAQ,EAAES;AAFM,WAAjB;AAIA;AACD,OApBD;AAqBA;;AAED,WAAO,MAAM;AACZL,MAAAA,SAAS,GAAG,KAAZ;AACA,KAFD;AAGA,GApCQ,EAoCN,CAAEL,MAAF,EAAUC,QAAV,CApCM,CAAT;AAsCA,SAAO,IAAP;AACA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useEffect } from '@wordpress/element';\nimport { useDispatch, useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { useLocation, useHistory } from '../routes';\nimport { store as editSiteStore } from '../../store';\n\nexport default function URLQueryController() {\n\tconst { setTemplate, setTemplatePart, showHomepage, setPage } = useDispatch(\n\t\teditSiteStore\n\t);\n\tconst history = useHistory();\n\tconst {\n\t\tparams: { postId, postType },\n\t} = useLocation();\n\tconst { getPage, getEditedPostId, getEditedPostType } = useSelect(\n\t\teditSiteStore\n\t);\n\n\t// Set correct entity on page navigation.\n\tuseEffect( () => {\n\t\tlet isMounted = true;\n\n\t\tif ( 'page' === postType || 'post' === postType ) {\n\t\t\tsetPage( { context: { postType, postId } } ); // Resolves correct template based on ID.\n\t\t} else if ( 'wp_template' === postType ) {\n\t\t\tsetTemplate( postId );\n\t\t} else if ( 'wp_template_part' === postType ) {\n\t\t\tsetTemplatePart( postId );\n\t\t} else {\n\t\t\tshowHomepage().then( () => {\n\t\t\t\tif ( ! isMounted ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tconst page = getPage();\n\t\t\t\tconst editedPostId = getEditedPostId();\n\t\t\t\tconst editedPostType = getEditedPostType();\n\n\t\t\t\tif ( page?.context?.postId && page?.context?.postType ) {\n\t\t\t\t\thistory.replace( {\n\t\t\t\t\t\tpostId: page.context.postId,\n\t\t\t\t\t\tpostType: page.context.postType,\n\t\t\t\t\t} );\n\t\t\t\t} else if ( editedPostId && editedPostType ) {\n\t\t\t\t\thistory.replace( {\n\t\t\t\t\t\tpostId: editedPostId,\n\t\t\t\t\t\tpostType: editedPostType,\n\t\t\t\t\t} );\n\t\t\t\t}\n\t\t\t} );\n\t\t}\n\n\t\treturn () => {\n\t\t\tisMounted = false;\n\t\t};\n\t}, [ postId, postType ] );\n\n\treturn null;\n}\n"]}
@@ -3,7 +3,7 @@ import { createElement, Fragment } from "@wordpress/element";
3
3
  /**
4
4
  * WordPress dependencies
5
5
  */
6
- import { useDispatch } from '@wordpress/data';
6
+ import { useDispatch, useSelect } from '@wordpress/data';
7
7
  import { Guide } from '@wordpress/components';
8
8
  import { __ } from '@wordpress/i18n';
9
9
  import { createInterpolateElement } from '@wordpress/element';
@@ -17,6 +17,12 @@ export default function WelcomeGuideEditor() {
17
17
  const {
18
18
  toggleFeature
19
19
  } = useDispatch(editSiteStore);
20
+ const isActive = useSelect(select => select(editSiteStore).isFeatureActive('welcomeGuide'), []);
21
+
22
+ if (!isActive) {
23
+ return null;
24
+ }
25
+
20
26
  return createElement(Guide, {
21
27
  className: "edit-site-welcome-guide",
22
28
  contentLabel: __('Welcome to the site editor'),
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-site/src/components/welcome-guide/editor.js"],"names":["useDispatch","Guide","__","createInterpolateElement","WelcomeGuideImage","store","editSiteStore","WelcomeGuideEditor","toggleFeature","image","content","StylesIconImage"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,WAAT,QAA4B,iBAA5B;AACA,SAASC,KAAT,QAAsB,uBAAtB;AACA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,wBAAT,QAAyC,oBAAzC;AAEA;AACA;AACA;;AACA,OAAOC,iBAAP,MAA8B,SAA9B;AACA,SAASC,KAAK,IAAIC,aAAlB,QAAuC,aAAvC;AAEA,eAAe,SAASC,kBAAT,GAA8B;AAC5C,QAAM;AAAEC,IAAAA;AAAF,MAAoBR,WAAW,CAAEM,aAAF,CAArC;AAEA,SACC,cAAC,KAAD;AACC,IAAA,SAAS,EAAC,yBADX;AAEC,IAAA,YAAY,EAAGJ,EAAE,CAAE,4BAAF,CAFlB;AAGC,IAAA,gBAAgB,EAAGA,EAAE,CAAE,aAAF,CAHtB;AAIC,IAAA,QAAQ,EAAG,MAAMM,aAAa,CAAE,cAAF,CAJ/B;AAKC,IAAA,KAAK,EAAG,CACP;AACCC,MAAAA,KAAK,EACJ,cAAC,iBAAD;AACC,QAAA,cAAc,EAAC,0DADhB;AAEC,QAAA,WAAW,EAAC;AAFb,QAFF;AAOCC,MAAAA,OAAO,EACN,8BACC;AAAI,QAAA,SAAS,EAAC;AAAd,SACGR,EAAE,CAAE,gBAAF,CADL,CADD,EAIC;AAAG,QAAA,SAAS,EAAC;AAAb,SACGA,EAAE,CACH,2FADG,CADL,CAJD,EASC;AAAG,QAAA,SAAS,EAAC;AAAb,SACGC,wBAAwB,CACzBD,EAAE,CACD,2GADC,CADuB,EAIzB;AACCS,QAAAA,eAAe,EACd;AACC,UAAA,GAAG,EAAGT,EAAE,CAAE,QAAF,CADT;AAEC,UAAA,GAAG,EAAC;AAFL;AAFF,OAJyB,CAD3B,CATD;AARF,KADO;AALT,IADD;AA6CA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useDispatch } from '@wordpress/data';\nimport { Guide } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { createInterpolateElement } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport WelcomeGuideImage from './image';\nimport { store as editSiteStore } from '../../store';\n\nexport default function WelcomeGuideEditor() {\n\tconst { toggleFeature } = useDispatch( editSiteStore );\n\n\treturn (\n\t\t<Guide\n\t\t\tclassName=\"edit-site-welcome-guide\"\n\t\t\tcontentLabel={ __( 'Welcome to the site editor' ) }\n\t\t\tfinishButtonText={ __( 'Get Started' ) }\n\t\t\tonFinish={ () => toggleFeature( 'welcomeGuide' ) }\n\t\t\tpages={ [\n\t\t\t\t{\n\t\t\t\t\timage: (\n\t\t\t\t\t\t<WelcomeGuideImage\n\t\t\t\t\t\t\tnonAnimatedSrc=\"https://s.w.org/images/block-editor/edit-your-site.svg?1\"\n\t\t\t\t\t\t\tanimatedSrc=\"https://s.w.org/images/block-editor/edit-your-site.gif?1\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t),\n\t\t\t\t\tcontent: (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<h1 className=\"edit-site-welcome-guide__heading\">\n\t\t\t\t\t\t\t\t{ __( 'Edit your site' ) }\n\t\t\t\t\t\t\t</h1>\n\t\t\t\t\t\t\t<p className=\"edit-site-welcome-guide__text\">\n\t\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t\t'Design everything on your site — from the header right down to the footer — using blocks.'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t</p>\n\t\t\t\t\t\t\t<p className=\"edit-site-welcome-guide__text\">\n\t\t\t\t\t\t\t\t{ createInterpolateElement(\n\t\t\t\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t\t\t\t'Click <StylesIconImage /> to start designing your blocks, and choose your typography, layout, and colors.'\n\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tStylesIconImage: (\n\t\t\t\t\t\t\t\t\t\t\t<img\n\t\t\t\t\t\t\t\t\t\t\t\talt={ __( 'styles' ) }\n\t\t\t\t\t\t\t\t\t\t\t\tsrc=\"data:image/svg+xml,%3Csvg width='18' height='18' viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M12 4c-4.4 0-8 3.6-8 8v.1c0 4.1 3.2 7.5 7.2 7.9h.8c4.4 0 8-3.6 8-8s-3.6-8-8-8zm0 15V5c3.9 0 7 3.1 7 7s-3.1 7-7 7z' fill='%231E1E1E'/%3E%3C/svg%3E%0A\"\n\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t</p>\n\t\t\t\t\t\t</>\n\t\t\t\t\t),\n\t\t\t\t},\n\t\t\t] }\n\t\t/>\n\t);\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/edit-site/src/components/welcome-guide/editor.js"],"names":["useDispatch","useSelect","Guide","__","createInterpolateElement","WelcomeGuideImage","store","editSiteStore","WelcomeGuideEditor","toggleFeature","isActive","select","isFeatureActive","image","content","StylesIconImage"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,WAAT,EAAsBC,SAAtB,QAAuC,iBAAvC;AACA,SAASC,KAAT,QAAsB,uBA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WordPress dependencies\n */\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { Guide } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { createInterpolateElement } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport WelcomeGuideImage from './image';\nimport { store as editSiteStore } from '../../store';\n\nexport default function WelcomeGuideEditor() {\n\tconst { toggleFeature } = useDispatch( editSiteStore );\n\n\tconst isActive = useSelect(\n\t\t( select ) => select( editSiteStore ).isFeatureActive( 'welcomeGuide' ),\n\t\t[]\n\t);\n\n\tif ( ! isActive ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<Guide\n\t\t\tclassName=\"edit-site-welcome-guide\"\n\t\t\tcontentLabel={ __( 'Welcome to the site editor' ) }\n\t\t\tfinishButtonText={ __( 'Get Started' ) }\n\t\t\tonFinish={ () => toggleFeature( 'welcomeGuide' ) }\n\t\t\tpages={ [\n\t\t\t\t{\n\t\t\t\t\timage: (\n\t\t\t\t\t\t<WelcomeGuideImage\n\t\t\t\t\t\t\tnonAnimatedSrc=\"https://s.w.org/images/block-editor/edit-your-site.svg?1\"\n\t\t\t\t\t\t\tanimatedSrc=\"https://s.w.org/images/block-editor/edit-your-site.gif?1\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t),\n\t\t\t\t\tcontent: (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<h1 className=\"edit-site-welcome-guide__heading\">\n\t\t\t\t\t\t\t\t{ __( 'Edit your site' ) }\n\t\t\t\t\t\t\t</h1>\n\t\t\t\t\t\t\t<p className=\"edit-site-welcome-guide__text\">\n\t\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t\t'Design everything on your site — from the header right down to the footer — using blocks.'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t</p>\n\t\t\t\t\t\t\t<p className=\"edit-site-welcome-guide__text\">\n\t\t\t\t\t\t\t\t{ createInterpolateElement(\n\t\t\t\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t\t\t\t'Click <StylesIconImage /> to start designing your blocks, and choose your typography, layout, and colors.'\n\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tStylesIconImage: (\n\t\t\t\t\t\t\t\t\t\t\t<img\n\t\t\t\t\t\t\t\t\t\t\t\talt={ __( 'styles' ) }\n\t\t\t\t\t\t\t\t\t\t\t\tsrc=\"data:image/svg+xml,%3Csvg width='18' height='18' viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M12 4c-4.4 0-8 3.6-8 8v.1c0 4.1 3.2 7.5 7.2 7.9h.8c4.4 0 8-3.6 8-8s-3.6-8-8-8zm0 15V5c3.9 0 7 3.1 7 7s-3.1 7-7 7z' fill='%231E1E1E'/%3E%3C/svg%3E%0A\"\n\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t</p>\n\t\t\t\t\t\t</>\n\t\t\t\t\t),\n\t\t\t\t},\n\t\t\t] }\n\t\t/>\n\t);\n}\n"]}
@@ -1,35 +1,11 @@
1
- import { createElement } from "@wordpress/element";
1
+ import { createElement, Fragment } from "@wordpress/element";
2
2
 
3
- /**
4
- * WordPress dependencies
5
- */
6
- import { useSelect } from '@wordpress/data';
7
- import { store as interfaceStore } from '@wordpress/interface';
8
3
  /**
9
4
  * Internal dependencies
10
5
  */
11
-
12
6
  import WelcomeGuideEditor from './editor';
13
7
  import WelcomeGuideStyles from './styles';
14
- import { store as editSiteStore } from '../../store';
15
8
  export default function WelcomeGuide() {
16
- const {
17
- isActive,
18
- isStylesOpen
19
- } = useSelect(select => {
20
- const sidebar = select(interfaceStore).getActiveComplementaryArea(editSiteStore.name);
21
- const isStylesSidebar = sidebar === 'edit-site/global-styles';
22
- const feature = isStylesSidebar ? 'welcomeGuideStyles' : 'welcomeGuide';
23
- return {
24
- isActive: select(editSiteStore).isFeatureActive(feature),
25
- isStylesOpen: isStylesSidebar
26
- };
27
- }, []);
28
-
29
- if (!isActive) {
30
- return null;
31
- }
32
-
33
- return isStylesOpen ? createElement(WelcomeGuideStyles, null) : createElement(WelcomeGuideEditor, null);
9
+ return createElement(Fragment, null, createElement(WelcomeGuideEditor, null), createElement(WelcomeGuideStyles, null));
34
10
  }
35
11
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-site/src/components/welcome-guide/index.js"],"names":["useSelect","store","interfaceStore","WelcomeGuideEditor","WelcomeGuideStyles","editSiteStore","WelcomeGuide","isActive","isStylesOpen","select","sidebar","getActiveComplementaryArea","name","isStylesSidebar","feature","isFeatureActive"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,SAAT,QAA0B,iBAA1B;AACA,SAASC,KAAK,IAAIC,cAAlB,QAAwC,sBAAxC;AAEA;AACA;AACA;;AACA,OAAOC,kBAAP,MAA+B,UAA/B;AACA,OAAOC,kBAAP,MAA+B,UAA/B;AACA,SAASH,KAAK,IAAII,aAAlB,QAAuC,aAAvC;AAEA,eAAe,SAASC,YAAT,GAAwB;AACtC,QAAM;AAAEC,IAAAA,QAAF;AAAYC,IAAAA;AAAZ,MAA6BR,SAAS,CAAIS,MAAF,IAAc;AAC3D,UAAMC,OAAO,GAAGD,MAAM,CAAEP,cAAF,CAAN,CAAyBS,0BAAzB,CACfN,aAAa,CAACO,IADC,CAAhB;AAGA,UAAMC,eAAe,GAAGH,OAAO,KAAK,yBAApC;AACA,UAAMI,OAAO,GAAGD,eAAe,GAAG,oBAAH,GAA0B,cAAzD;AAEA,WAAO;AACNN,MAAAA,QAAQ,EAAEE,MAAM,CAAEJ,aAAF,CAAN,CAAwBU,eAAxB,CAAyCD,OAAzC,CADJ;AAENN,MAAAA,YAAY,EAAEK;AAFR,KAAP;AAIA,GAX2C,EAWzC,EAXyC,CAA5C;;AAaA,MAAK,CAAEN,QAAP,EAAkB;AACjB,WAAO,IAAP;AACA;;AAED,SAAOC,YAAY,GAAG,cAAC,kBAAD,OAAH,GAA4B,cAAC,kBAAD,OAA/C;AACA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { store as interfaceStore } from '@wordpress/interface';\n\n/**\n * Internal dependencies\n */\nimport WelcomeGuideEditor from './editor';\nimport WelcomeGuideStyles from './styles';\nimport { store as editSiteStore } from '../../store';\n\nexport default function WelcomeGuide() {\n\tconst { isActive, isStylesOpen } = useSelect( ( select ) => {\n\t\tconst sidebar = select( interfaceStore ).getActiveComplementaryArea(\n\t\t\teditSiteStore.name\n\t\t);\n\t\tconst isStylesSidebar = sidebar === 'edit-site/global-styles';\n\t\tconst feature = isStylesSidebar ? 'welcomeGuideStyles' : 'welcomeGuide';\n\n\t\treturn {\n\t\t\tisActive: select( editSiteStore ).isFeatureActive( feature ),\n\t\t\tisStylesOpen: isStylesSidebar,\n\t\t};\n\t}, [] );\n\n\tif ( ! isActive ) {\n\t\treturn null;\n\t}\n\n\treturn isStylesOpen ? <WelcomeGuideStyles /> : <WelcomeGuideEditor />;\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/edit-site/src/components/welcome-guide/index.js"],"names":["WelcomeGuideEditor","WelcomeGuideStyles","WelcomeGuide"],"mappings":";;AAAA;AACA;AACA;AACA,OAAOA,kBAAP,MAA+B,UAA/B;AACA,OAAOC,kBAAP,MAA+B,UAA/B;AAEA,eAAe,SAASC,YAAT,GAAwB;AACtC,SACC,8BACC,cAAC,kBAAD,OADD,EAEC,cAAC,kBAAD,OAFD,CADD;AAMA","sourcesContent":["/**\n * Internal dependencies\n */\nimport WelcomeGuideEditor from './editor';\nimport WelcomeGuideStyles from './styles';\n\nexport default function WelcomeGuide() {\n\treturn (\n\t\t<>\n\t\t\t<WelcomeGuideEditor />\n\t\t\t<WelcomeGuideStyles />\n\t\t</>\n\t);\n}\n"]}
@@ -3,9 +3,10 @@ import { createElement, Fragment } from "@wordpress/element";
3
3
  /**
4
4
  * WordPress dependencies
5
5
  */
6
- import { useDispatch } from '@wordpress/data';
6
+ import { useDispatch, useSelect } from '@wordpress/data';
7
7
  import { ExternalLink, Guide } from '@wordpress/components';
8
8
  import { __ } from '@wordpress/i18n';
9
+ import { store as interfaceStore } from '@wordpress/interface';
9
10
  /**
10
11
  * Internal dependencies
11
12
  */
@@ -16,6 +17,21 @@ export default function WelcomeGuideStyles() {
16
17
  const {
17
18
  toggleFeature
18
19
  } = useDispatch(editSiteStore);
20
+ const {
21
+ isActive,
22
+ isStylesOpen
23
+ } = useSelect(select => {
24
+ const sidebar = select(interfaceStore).getActiveComplementaryArea(editSiteStore.name);
25
+ return {
26
+ isActive: select(editSiteStore).isFeatureActive('welcomeGuideStyles'),
27
+ isStylesOpen: sidebar === 'edit-site/global-styles'
28
+ };
29
+ }, []);
30
+
31
+ if (!isActive || !isStylesOpen) {
32
+ return null;
33
+ }
34
+
19
35
  return createElement(Guide, {
20
36
  className: "edit-site-welcome-guide",
21
37
  contentLabel: __('Welcome to styles'),
@@ -61,7 +77,7 @@ export default function WelcomeGuideStyles() {
61
77
  }, __('Learn more')), createElement("p", {
62
78
  className: "edit-site-welcome-guide__text"
63
79
  }, __('New to block themes and styling your site? '), createElement(ExternalLink, {
64
- href: __('https://wordpress.org/support/article/wordpress-editor/')
80
+ href: __('https://wordpress.org/support/article/styles-overview/')
65
81
  }, __('Here’s a detailed guide to learn how to make the most of it.'))))
66
82
  }]
67
83
  });
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-site/src/components/welcome-guide/styles.js"],"names":["useDispatch","ExternalLink","Guide","__","WelcomeGuideImage","store","editSiteStore","WelcomeGuideStyles","toggleFeature","image","content"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,WAAT,QAA4B,iBAA5B;AACA,SAASC,YAAT,EAAuBC,KAAvB,QAAoC,uBAApC;AACA,SAASC,EAAT,QAAmB,iBAAnB;AAEA;AACA;AACA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C;AAAb,SACGA,EAAE,CACH,qLADG,CADL,CAJD;AARF,KAzCO,EA6DP;AACCM,MAAAA,KAAK,EACJ,cAAC,iBAAD;AACC,QAAA,cAAc,EAAC,+DADhB;AAEC,QAAA,WAAW,EAAC;AAFb,QAFF;AAOCC,MAAAA,OAAO,EACN,8BACC;AAAI,QAAA,SAAS,EAAC;AAAd,SACGP,EAAE,CAAE,YAAF,CADL,CADD,EAIC;AAAG,QAAA,SAAS,EAAC;AAAb,SACGA,EAAE,CACH,6CADG,CADL,EAIC,cAAC,YAAD;AACC,QAAA,IAAI,EAAGA,EAAE,CACR,yDADQ;AADV,SAKGA,EAAE,CACH,8DADG,CALL,CAJD,CAJD;AARF,KA7DO;AALT,IADD;AAmGA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useDispatch } from '@wordpress/data';\nimport { ExternalLink, Guide } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport WelcomeGuideImage from './image';\nimport { store as editSiteStore } from '../../store';\n\nexport default function WelcomeGuideStyles() {\n\tconst { toggleFeature } = useDispatch( editSiteStore );\n\n\treturn (\n\t\t<Guide\n\t\t\tclassName=\"edit-site-welcome-guide\"\n\t\t\tcontentLabel={ __( 'Welcome to styles' ) }\n\t\t\tfinishButtonText={ __( 'Get Started' ) }\n\t\t\tonFinish={ () => toggleFeature( 'welcomeGuideStyles' ) }\n\t\t\tpages={ [\n\t\t\t\t{\n\t\t\t\t\timage: (\n\t\t\t\t\t\t<WelcomeGuideImage\n\t\t\t\t\t\t\tnonAnimatedSrc=\"https://s.w.org/images/block-editor/welcome-to-styles.svg?1\"\n\t\t\t\t\t\t\tanimatedSrc=\"https://s.w.org/images/block-editor/welcome-to-styles.gif?1\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t),\n\t\t\t\t\tcontent: (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<h1 className=\"edit-site-welcome-guide__heading\">\n\t\t\t\t\t\t\t\t{ __( 'Welcome to Styles' ) }\n\t\t\t\t\t\t\t</h1>\n\t\t\t\t\t\t\t<p className=\"edit-site-welcome-guide__text\">\n\t\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t\t'Tweak your site, or give it a whole new look! Get creative — how about a new color palette for your buttons, or choosing a new font? Take a look at what you can do here.'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t</p>\n\t\t\t\t\t\t</>\n\t\t\t\t\t),\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\timage: (\n\t\t\t\t\t\t<WelcomeGuideImage\n\t\t\t\t\t\t\tnonAnimatedSrc=\"https://s.w.org/images/block-editor/set-the-design.svg?1\"\n\t\t\t\t\t\t\tanimatedSrc=\"https://s.w.org/images/block-editor/set-the-design.gif?1\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t),\n\t\t\t\t\tcontent: (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<h1 className=\"edit-site-welcome-guide__heading\">\n\t\t\t\t\t\t\t\t{ __( 'Set the design' ) }\n\t\t\t\t\t\t\t</h1>\n\t\t\t\t\t\t\t<p className=\"edit-site-welcome-guide__text\">\n\t\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t\t'You can customize your site as much as you like with different colors, typography, and layouts. Or if you prefer, just leave it up to your theme to handle! '\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t</p>\n\t\t\t\t\t\t</>\n\t\t\t\t\t),\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\timage: (\n\t\t\t\t\t\t<WelcomeGuideImage\n\t\t\t\t\t\t\tnonAnimatedSrc=\"https://s.w.org/images/block-editor/personalize-blocks.svg?1\"\n\t\t\t\t\t\t\tanimatedSrc=\"https://s.w.org/images/block-editor/personalize-blocks.gif?1\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t),\n\t\t\t\t\tcontent: (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<h1 className=\"edit-site-welcome-guide__heading\">\n\t\t\t\t\t\t\t\t{ __( 'Personalize blocks' ) }\n\t\t\t\t\t\t\t</h1>\n\t\t\t\t\t\t\t<p className=\"edit-site-welcome-guide__text\">\n\t\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t\t'You can adjust your blocks to ensure a cohesive experience across your site — add your unique colors to a branded Button block, or adjust the Heading block to your preferred size.'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t</p>\n\t\t\t\t\t\t</>\n\t\t\t\t\t),\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\timage: (\n\t\t\t\t\t\t<WelcomeGuideImage\n\t\t\t\t\t\t\tnonAnimatedSrc=\"https://s.w.org/images/block-editor/welcome-documentation.svg\"\n\t\t\t\t\t\t\tanimatedSrc=\"https://s.w.org/images/block-editor/welcome-documentation.gif\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t),\n\t\t\t\t\tcontent: (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<h1 className=\"edit-site-welcome-guide__heading\">\n\t\t\t\t\t\t\t\t{ __( 'Learn more' ) }\n\t\t\t\t\t\t\t</h1>\n\t\t\t\t\t\t\t<p className=\"edit-site-welcome-guide__text\">\n\t\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t\t'New to block themes and styling your site? '\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t<ExternalLink\n\t\t\t\t\t\t\t\t\thref={ __(\n\t\t\t\t\t\t\t\t\t\t'https://wordpress.org/support/article/wordpress-editor/'\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{ __(\n\t\t\t\t\t\t\t\t\t\t'Here’s a detailed guide to learn how to make the most of it.'\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t</ExternalLink>\n\t\t\t\t\t\t\t</p>\n\t\t\t\t\t\t</>\n\t\t\t\t\t),\n\t\t\t\t},\n\t\t\t] }\n\t\t/>\n\t);\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/edit-site/src/components/welcome-guide/styles.js"],"names":["useDispatch","useSelect","ExternalLink","Guide","__","store","interfaceStore","WelcomeGuideImage","editSiteStore","WelcomeGuideStyles","toggleFeature","isActive","isStylesOpen","select","sidebar","getActiveComplementaryArea","name","isFeatureActive","image","content"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,WAAT,EAAsBC,SAAtB,QAAuC,iBAAvC;AACA,SAASC,YAAT,EAAuBC,KAAvB,QAAoC,uBAApC;AACA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,KAAK,IAAIC,cAAlB,QAAwC,sBAAxC;AAEA;AACA;AACA;;AACA,OAAOC,iBAAP,MAA8B,SAA9B;AACA,SAASF,KAAK,IAAIG,aAAlB,QAAuC,aAAvC;AAEA,eAAe,SAASC,kBAAT,GAA8B;AAC5C,QAAM;AAAEC,IAAAA;AAAF,MAAoBV,WAAW,CAAEQ,aAAF,CAArC;AAEA,QAAM;AAAEG,IAAAA,QAAF;AAAYC,IAAAA;AAAZ,MAA6BX,SAAS,CAAIY,MAAF,IAAc;AAC3D,UAAMC,OAAO,GAAGD,MAAM,CAAEP,cAAF,CAAN,CAAyBS,0BAAzB,CACfP,aAAa,CAACQ,IADC,CAAhB;AAIA,WAAO;AACNL,MAAAA,QAAQ,EAAEE,MAAM,CAAEL,aAAF,CAAN,CAAwBS,eAAxB,CACT,oBADS,CADJ;AAINL,MAAAA,YAAY,EAAEE,OAAO,KAAK;AAJpB,KAAP;AAMA,GAX2C,EAWzC,EAXyC,CAA5C;;AAaA,MAAK,CAAEH,QAAF,IAAc,CAAEC,YAArB,EAAoC;AACnC,WAAO,IAAP;AACA;;AAED,SACC,cAAC,KAAD;AACC,IAAA,SAAS,EAAC,yBADX;AAEC,IAAA,YAAY,EAAGR,EAAE,CAAE,mBAAF,CAFlB;AAGC,IAAA,gBAAgB,EAAGA,EAAE,CAAE,aAAF,CAHtB;AAI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D;AACC,QAAA,IAAI,EAAGA,EAAE,CACR,wDADQ;AADV,SAKGA,EAAE,CACH,8DADG,CALL,CAJD,CAJD;AARF,KA7DO;AALT,IADD;AAmGA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { ExternalLink, Guide } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { store as interfaceStore } from '@wordpress/interface';\n\n/**\n * Internal dependencies\n */\nimport WelcomeGuideImage from './image';\nimport { store as editSiteStore } from '../../store';\n\nexport default function WelcomeGuideStyles() {\n\tconst { toggleFeature } = useDispatch( editSiteStore );\n\n\tconst { isActive, isStylesOpen } = useSelect( ( select ) => {\n\t\tconst sidebar = select( interfaceStore ).getActiveComplementaryArea(\n\t\t\teditSiteStore.name\n\t\t);\n\n\t\treturn {\n\t\t\tisActive: select( editSiteStore ).isFeatureActive(\n\t\t\t\t'welcomeGuideStyles'\n\t\t\t),\n\t\t\tisStylesOpen: sidebar === 'edit-site/global-styles',\n\t\t};\n\t}, [] );\n\n\tif ( ! isActive || ! isStylesOpen ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<Guide\n\t\t\tclassName=\"edit-site-welcome-guide\"\n\t\t\tcontentLabel={ __( 'Welcome to styles' ) }\n\t\t\tfinishButtonText={ __( 'Get Started' ) }\n\t\t\tonFinish={ () => toggleFeature( 'welcomeGuideStyles' ) }\n\t\t\tpages={ [\n\t\t\t\t{\n\t\t\t\t\timage: (\n\t\t\t\t\t\t<WelcomeGuideImage\n\t\t\t\t\t\t\tnonAnimatedSrc=\"https://s.w.org/images/block-editor/welcome-to-styles.svg?1\"\n\t\t\t\t\t\t\tanimatedSrc=\"https://s.w.org/images/block-editor/welcome-to-styles.gif?1\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t),\n\t\t\t\t\tcontent: (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<h1 className=\"edit-site-welcome-guide__heading\">\n\t\t\t\t\t\t\t\t{ __( 'Welcome to Styles' ) }\n\t\t\t\t\t\t\t</h1>\n\t\t\t\t\t\t\t<p className=\"edit-site-welcome-guide__text\">\n\t\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t\t'Tweak your site, or give it a whole new look! Get creative — how about a new color palette for your buttons, or choosing a new font? Take a look at what you can do here.'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t</p>\n\t\t\t\t\t\t</>\n\t\t\t\t\t),\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\timage: (\n\t\t\t\t\t\t<WelcomeGuideImage\n\t\t\t\t\t\t\tnonAnimatedSrc=\"https://s.w.org/images/block-editor/set-the-design.svg?1\"\n\t\t\t\t\t\t\tanimatedSrc=\"https://s.w.org/images/block-editor/set-the-design.gif?1\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t),\n\t\t\t\t\tcontent: (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<h1 className=\"edit-site-welcome-guide__heading\">\n\t\t\t\t\t\t\t\t{ __( 'Set the design' ) }\n\t\t\t\t\t\t\t</h1>\n\t\t\t\t\t\t\t<p className=\"edit-site-welcome-guide__text\">\n\t\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t\t'You can customize your site as much as you like with different colors, typography, and layouts. Or if you prefer, just leave it up to your theme to handle! '\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t</p>\n\t\t\t\t\t\t</>\n\t\t\t\t\t),\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\timage: (\n\t\t\t\t\t\t<WelcomeGuideImage\n\t\t\t\t\t\t\tnonAnimatedSrc=\"https://s.w.org/images/block-editor/personalize-blocks.svg?1\"\n\t\t\t\t\t\t\tanimatedSrc=\"https://s.w.org/images/block-editor/personalize-blocks.gif?1\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t),\n\t\t\t\t\tcontent: (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<h1 className=\"edit-site-welcome-guide__heading\">\n\t\t\t\t\t\t\t\t{ __( 'Personalize blocks' ) }\n\t\t\t\t\t\t\t</h1>\n\t\t\t\t\t\t\t<p className=\"edit-site-welcome-guide__text\">\n\t\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t\t'You can adjust your blocks to ensure a cohesive experience across your site — add your unique colors to a branded Button block, or adjust the Heading block to your preferred size.'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t</p>\n\t\t\t\t\t\t</>\n\t\t\t\t\t),\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\timage: (\n\t\t\t\t\t\t<WelcomeGuideImage\n\t\t\t\t\t\t\tnonAnimatedSrc=\"https://s.w.org/images/block-editor/welcome-documentation.svg\"\n\t\t\t\t\t\t\tanimatedSrc=\"https://s.w.org/images/block-editor/welcome-documentation.gif\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t),\n\t\t\t\t\tcontent: (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<h1 className=\"edit-site-welcome-guide__heading\">\n\t\t\t\t\t\t\t\t{ __( 'Learn more' ) }\n\t\t\t\t\t\t\t</h1>\n\t\t\t\t\t\t\t<p className=\"edit-site-welcome-guide__text\">\n\t\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t\t'New to block themes and styling your site? '\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t<ExternalLink\n\t\t\t\t\t\t\t\t\thref={ __(\n\t\t\t\t\t\t\t\t\t\t'https://wordpress.org/support/article/styles-overview/'\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{ __(\n\t\t\t\t\t\t\t\t\t\t'Here’s a detailed guide to learn how to make the most of it.'\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t</ExternalLink>\n\t\t\t\t\t\t\t</p>\n\t\t\t\t\t\t</>\n\t\t\t\t\t),\n\t\t\t\t},\n\t\t\t] }\n\t\t/>\n\t);\n}\n"]}
@@ -10,6 +10,7 @@ import { render, unmountComponentAtNode } from '@wordpress/element';
10
10
  import { __experimentalFetchLinkSuggestions as fetchLinkSuggestions, __experimentalFetchUrlData as fetchUrlData } from '@wordpress/core-data';
11
11
  import { store as editorStore } from '@wordpress/editor';
12
12
  import { store as viewportStore } from '@wordpress/viewport';
13
+ import { getQueryArgs } from '@wordpress/url';
13
14
  /**
14
15
  * Internal dependencies
15
16
  */
@@ -17,8 +18,8 @@ import { store as viewportStore } from '@wordpress/viewport';
17
18
  import './plugins';
18
19
  import './hooks';
19
20
  import { store as editSiteStore } from './store';
20
- import Editor from './components/editor';
21
- import List from './components/list';
21
+ import EditSiteApp from './components/app';
22
+ import getIsListPage from './utils/get-is-list-page';
22
23
  /**
23
24
  * Reinitializes the editor after the user chooses to reboot the editor after
24
25
  * an unhandled error occurs, replacing previously mounted editor element using
@@ -29,11 +30,31 @@ import List from './components/list';
29
30
  */
30
31
 
31
32
  export function reinitializeEditor(target, settings) {
33
+ // This will be a no-op if the target doesn't have any React nodes.
32
34
  unmountComponentAtNode(target);
33
- const reboot = reinitializeEditor.bind(null, target, settings);
34
- render(createElement(Editor, {
35
- initialSettings: settings,
36
- onError: reboot
35
+ const reboot = reinitializeEditor.bind(null, target, settings); // We dispatch actions and update the store synchronously before rendering
36
+ // so that we won't trigger unnecessary re-renders with useEffect.
37
+
38
+ {
39
+ dispatch(editSiteStore).updateSettings(settings); // Keep the defaultTemplateTypes in the core/editor settings too,
40
+ // so that they can be selected with core/editor selectors in any editor.
41
+ // This is needed because edit-site doesn't initialize with EditorProvider,
42
+ // which internally uses updateEditorSettings as well.
43
+
44
+ dispatch(editorStore).updateEditorSettings({
45
+ defaultTemplateTypes: settings.defaultTemplateTypes,
46
+ defaultTemplatePartAreas: settings.defaultTemplatePartAreas
47
+ });
48
+ const isLandingOnListPage = getIsListPage(getQueryArgs(window.location.href));
49
+
50
+ if (isLandingOnListPage) {
51
+ // Default the navigation panel to be opened when we're in a bigger
52
+ // screen and land in the list screen.
53
+ dispatch(editSiteStore).setIsNavigationPanelOpened(select(viewportStore).isViewportMatch('medium'));
54
+ }
55
+ }
56
+ render(createElement(EditSiteApp, {
57
+ reboot: reboot
37
58
  }), target);
38
59
  }
39
60
  /**
@@ -49,7 +70,6 @@ export function initializeEditor(id, settings) {
49
70
  settings.__experimentalFetchRichUrlData = fetchUrlData;
50
71
  settings.__experimentalSpotlightEntityBlocks = ['core/template-part'];
51
72
  const target = document.getElementById(id);
52
- const reboot = reinitializeEditor.bind(null, target, settings);
53
73
 
54
74
  dispatch(blocksStore).__experimentalReapplyBlockTypeFilters();
55
75
 
@@ -61,32 +81,7 @@ export function initializeEditor(id, settings) {
61
81
  });
62
82
  }
63
83
 
64
- render(createElement(Editor, {
65
- initialSettings: settings,
66
- onError: reboot
67
- }), target);
68
- }
69
- /**
70
- * Initializes the site editor templates list screen.
71
- *
72
- * @param {string} id ID of the root element to render the screen in.
73
- * @param {string} templateType The type of the list. "wp_template" or "wp_template_part".
74
- * @param {Object} settings Editor settings.
75
- */
76
-
77
- export function initializeList(id, templateType, settings) {
78
- const target = document.getElementById(id);
79
- dispatch(editorStore).updateEditorSettings({
80
- defaultTemplateTypes: settings.defaultTemplateTypes,
81
- defaultTemplatePartAreas: settings.defaultTemplatePartAreas
82
- }); // Default the navigation panel to be opened when we're in a bigger screen.
83
- // We update the store synchronously before rendering so that we won't
84
- // trigger an unnecessary re-render with useEffect.
85
-
86
- dispatch(editSiteStore).setIsNavigationPanelOpened(select(viewportStore).isViewportMatch('medium'));
87
- render(createElement(List, {
88
- templateType: templateType
89
- }), target);
84
+ reinitializeEditor(target, settings);
90
85
  }
91
86
  export { default as __experimentalMainDashboardButton } from './components/main-dashboard-button';
92
87
  export { default as __experimentalNavigationToggle } from './components/navigation-sidebar/navigation-toggle';
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-site/src/index.js"],"names":["store","blocksStore","registerCoreBlocks","__experimentalRegisterExperimentalCoreBlocks","dispatch","select","render","unmountComponentAtNode","__experimentalFetchLinkSuggestions","fetchLinkSuggestions","__experimentalFetchUrlData","fetchUrlData","editorStore","viewportStore","editSiteStore","Editor","List","reinitializeEditor","target","settings","reboot","bind","initializeEditor","id","search","searchOptions","__experimentalFetchRichUrlData","__experimentalSpotlightEntityBlocks","document","getElementById","__experimentalReapplyBlockTypeFilters","process","env","GUTENBERG_PHASE","enableFSEBlocks","initializeList","templateType","updateEditorSettings","defaultTemplateTypes","defaultTemplatePartAreas","setIsNavigationPanelOpened","isViewportMatch","default","__experimentalMainDashboardButton","__experimentalNavigationToggle","PluginSidebar","PluginSidebarMoreMenuItem","PluginMoreMenuItem"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,KAAK,IAAIC,WAAlB,QAAqC,mBAArC;AACA,SACCC,kBADD,EAECC,4CAFD,QAGO,0BAHP;AAIA,SAASC,QAAT,EAAmBC,MAAnB,QAAiC,iBAAjC;AACA,SAASC,MAAT,EAAiBC,sBAAjB,QAA+C,oBAA/C;AACA,SACCC,kCAAkC,IAAIC,oBADvC,EAECC,0BAA0B,IAAIC,YAF/B,QAGO,sBAHP;AAIA,SAASX,KAAK,IAAIY,WAAlB,QAAqC,mBAArC;AACA,SAASZ,KAAK,IAAIa,aAAlB,QAAuC,qBAAvC;AAEA;AACA;AACA;;AACA,OAAO,WAAP;AACA,OAAO,SAAP;AACA,SAASb,KAAK,IAAIc,aAAlB,QAAuC,SAAvC;AACA,OAAOC,MAAP,MAAmB,qBAAnB;AACA,OAAOC,IAAP,MAAiB,mBAAjB;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASC,kBAAT,CAA6BC,MAA7B,EAAqCC,QAArC,EAAgD;AACtDZ,EAAAA,sBAAsB,CAAEW,MAAF,CAAtB;AACA,QAAME,MAAM,GAAGH,kBAAkB,CAACI,IAAnB,CAAyB,IAAzB,EAA+BH,MAA/B,EAAuCC,QAAvC,CAAf;A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,WAAF,CAAR,CAAwByB,oBAAxB,CAA8C;AAC7CC,IAAAA,oBAAoB,EAAEnB,QAAQ,CAACmB,oBADc;AAE7CC,IAAAA,wBAAwB,EAAEpB,QAAQ,CAACoB;AAFU,GAA9C,EAH4D,CAQ5D;AACA;AACA;;AACAnC,EAAAA,QAAQ,CAAEU,aAAF,CAAR,CAA0B0B,0BAA1B,CACCnC,MAAM,CAAEQ,aAAF,CAAN,CAAwB4B,eAAxB,CAAyC,QAAzC,CADD;AAIAnC,EAAAA,MAAM,CAAE,cAAC,IAAD;AAAM,IAAA,YAAY,EAAG8B;AAArB,IAAF,EAA0ClB,MAA1C,CAAN;AACA;AAED,SAASwB,OAAO,IAAIC,iCAApB,QAA6D,oCAA7D;AACA,SAASD,OAAO,IAAIE,8BAApB,QAA0D,mDAA1D;AACA,SAASF,OAAO,IAAIG,aAApB,QAAyC,qCAAzC;AACA,SAASH,OAAO,IAAII,yBAApB,QAAqD,mDAArD;AACA,SAASJ,OAAO,IAAIK,kBAApB,QAA8C,2CAA9C","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { store as blocksStore } from '@wordpress/blocks';\nimport {\n\tregisterCoreBlocks,\n\t__experimentalRegisterExperimentalCoreBlocks,\n} from '@wordpress/block-library';\nimport { dispatch, select } from '@wordpress/data';\nimport { render, unmountComponentAtNode } from '@wordpress/element';\nimport {\n\t__experimentalFetchLinkSuggestions as fetchLinkSuggestions,\n\t__experimentalFetchUrlData as fetchUrlData,\n} from '@wordpress/core-data';\nimport { store as editorStore } from '@wordpress/editor';\nimport { store as viewportStore } from '@wordpress/viewport';\n\n/**\n * Internal dependencies\n */\nimport './plugins';\nimport './hooks';\nimport { store as editSiteStore } from './store';\nimport Editor from './components/editor';\nimport List from './components/list';\n\n/**\n * Reinitializes the editor after the user chooses to reboot the editor after\n * an unhandled error occurs, replacing previously mounted editor element using\n * an initial state from prior to the crash.\n *\n * @param {Element} target DOM node in which editor is rendered.\n * @param {?Object} settings Editor settings object.\n */\nexport function reinitializeEditor( target, settings ) {\n\tunmountComponentAtNode( target );\n\tconst reboot = reinitializeEditor.bind( null, target, settings );\n\trender(\n\t\t<Editor initialSettings={ settings } onError={ reboot } />,\n\t\ttarget\n\t);\n}\n\n/**\n * Initializes the site editor screen.\n *\n * @param {string} id ID of the root element to render the screen in.\n * @param {Object} settings Editor settings.\n */\nexport function initializeEditor( id, settings ) {\n\tsettings.__experimentalFetchLinkSuggestions = ( search, searchOptions ) =>\n\t\tfetchLinkSuggestions( search, searchOptions, settings );\n\tsettings.__experimentalFetchRichUrlData = fetchUrlData;\n\tsettings.__experimentalSpotlightEntityBlocks = [ 'core/template-part' ];\n\n\tconst target = document.getElementById( id );\n\tconst reboot = reinitializeEditor.bind( null, target, settings );\n\n\tdispatch( blocksStore ).__experimentalReapplyBlockTypeFilters();\n\tregisterCoreBlocks();\n\tif ( process.env.GUTENBERG_PHASE === 2 ) {\n\t\t__experimentalRegisterExperimentalCoreBlocks( {\n\t\t\tenableFSEBlocks: true,\n\t\t} );\n\t}\n\n\trender(\n\t\t<Editor initialSettings={ settings } onError={ reboot } />,\n\t\ttarget\n\t);\n}\n\n/**\n * Initializes the site editor templates list screen.\n *\n * @param {string} id ID of the root element to render the screen in.\n * @param {string} templateType The type of the list. \"wp_template\" or \"wp_template_part\".\n * @param {Object} settings Editor settings.\n */\nexport function initializeList( id, templateType, settings ) {\n\tconst target = document.getElementById( id );\n\n\tdispatch( editorStore ).updateEditorSettings( {\n\t\tdefaultTemplateTypes: settings.defaultTemplateTypes,\n\t\tdefaultTemplatePartAreas: settings.defaultTemplatePartAreas,\n\t} );\n\n\t// Default the navigation panel to be opened when we're in a bigger screen.\n\t// We update the store synchronously before rendering so that we won't\n\t// trigger an unnecessary re-render with useEffect.\n\tdispatch( editSiteStore ).setIsNavigationPanelOpened(\n\t\tselect( viewportStore ).isViewportMatch( 'medium' )\n\t);\n\n\trender( <List templateType={ templateType } />, target );\n}\n\nexport { default as __experimentalMainDashboardButton } from './components/main-dashboard-button';\nexport { default as __experimentalNavigationToggle } from './components/navigation-sidebar/navigation-toggle';\nexport { default as PluginSidebar } from './components/sidebar/plugin-sidebar';\nexport { default as PluginSidebarMoreMenuItem } from './components/header/plugin-sidebar-more-menu-item';\nexport { default as PluginMoreMenuItem } from './components/header/plugin-more-menu-item';\n"]}
1
+ {"version":3,"sources":["@wordpress/edit-site/src/index.js"],"names":["store","blocksStore","registerCoreBlocks","__experimentalRegisterExperimentalCoreBlocks","dispatch","select","render","unmountComponentAtNode","__experimentalFetchLinkSuggestions","fetchLinkSuggestions","__experimentalFetchUrlData","fetchUrlData","editorStore","viewportStore","getQueryArgs","editSiteStore","EditSiteApp","getIsListPage","reinitializeEditor","target","settings","reboot","bind","updateSettings","updateEditorSettings","defaultTemplateTypes","defaultTemplatePartAreas","isLandingOnListPage","window","location","href","setIsNavigationPanelOpened","isViewportMatch","initializeEditor","id","search","searchOptions","__experimentalFetchRichUrlData","__experimentalSpotlightEntityBlocks","document","getElementById","__experimentalReapplyBlockTypeFilters","process","env","GUTENBERG_PHASE","enableFSEBlocks","default","__experimentalMainDashboardButton","__experimentalNavigationToggle","PluginSidebar","PluginSidebarMoreMenuItem","PluginMoreMenuItem"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,KAAK,IAAIC,WAAlB,QAAqC,mBAArC;AACA,SACCC,kBADD,EAECC,4CAFD,QAGO,0BAHP;AAIA,SAASC,QAAT,EAAmBC,MAAnB,QAAiC,iBAAjC;AACA,SAASC,MAAT,EAAiBC,sBAAjB,QAA+C,oBAA/C;AACA,SACCC,kCAAkC,IAAIC,oBADvC,EAECC,0BAA0B,IAAIC,YAF/B,QAGO,sBAHP;AAIA,SAASX,KAAK,IAAIY,WAAlB,QAAqC,mBAArC;AACA,SAASZ,KAAK,IAAIa,aAAlB,QAAuC,qBAAvC;AACA,SAASC,YAAT,QAA6B,gBAA7B;AAEA;AACA;AACA;;AACA,OAAO,WAAP;AACA,OAAO,SAAP;AACA,SAASd,KAAK,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,aAAV,EAAyBhB,QAAzB,CADrB;;AAEAA,EAAAA,QAAQ,CAACiB,8BAAT,GAA0C1B,YAA1C;AACAS,EAAAA,QAAQ,CAACkB,mCAAT,GAA+C,CAAE,oBAAF,CAA/C;AAEA,QAAMnB,MAAM,GAAGoB,QAAQ,CAACC,cAAT,CAAyBN,EAAzB,CAAf;;AAEA9B,EAAAA,QAAQ,CAAEH,WAAF,CAAR,CAAwBwC,qCAAxB;;AACAvC,EAAAA,kBAAkB;;AAClB,MAAKwC,OAAO,CAACC,GAAR,CAAYC,eAAZ,KAAgC,CAArC,EAAyC;AACxCzC,IAAAA,4CAA4C,CAAE;AAC7C0C,MAAAA,eAAe,EAAE;AAD4B,KAAF,CAA5C;AAGA;;AAED3B,EAAAA,kBAAkB,CAAEC,MAAF,EAAUC,QAAV,CAAlB;AACA;AAED,SAAS0B,OAAO,IAAIC,iCAApB,QAA6D,oCAA7D;AACA,SAASD,OAAO,IAAIE,8BAApB,QAA0D,mDAA1D;AACA,SAASF,OAAO,IAAIG,aAApB,QAAyC,qCAAzC;AACA,SAASH,OAAO,IAAII,yBAApB,QAAqD,mDAArD;AACA,SAASJ,OAAO,IAAIK,kBAApB,QAA8C,2CAA9C","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { store as blocksStore } from '@wordpress/blocks';\nimport {\n\tregisterCoreBlocks,\n\t__experimentalRegisterExperimentalCoreBlocks,\n} from '@wordpress/block-library';\nimport { dispatch, select } from '@wordpress/data';\nimport { render, unmountComponentAtNode } from '@wordpress/element';\nimport {\n\t__experimentalFetchLinkSuggestions as fetchLinkSuggestions,\n\t__experimentalFetchUrlData as fetchUrlData,\n} from '@wordpress/core-data';\nimport { store as editorStore } from '@wordpress/editor';\nimport { store as viewportStore } from '@wordpress/viewport';\nimport { getQueryArgs } from '@wordpress/url';\n\n/**\n * Internal dependencies\n */\nimport './plugins';\nimport './hooks';\nimport { store as editSiteStore } from './store';\nimport EditSiteApp from './components/app';\nimport getIsListPage from './utils/get-is-list-page';\n\n/**\n * Reinitializes the editor after the user chooses to reboot the editor after\n * an unhandled error occurs, replacing previously mounted editor element using\n * an initial state from prior to the crash.\n *\n * @param {Element} target DOM node in which editor is rendered.\n * @param {?Object} settings Editor settings object.\n */\nexport function reinitializeEditor( target, settings ) {\n\t// This will be a no-op if the target doesn't have any React nodes.\n\tunmountComponentAtNode( target );\n\tconst reboot = reinitializeEditor.bind( null, target, settings );\n\n\t// We dispatch actions and update the store synchronously before rendering\n\t// so that we won't trigger unnecessary re-renders with useEffect.\n\t{\n\t\tdispatch( editSiteStore ).updateSettings( settings );\n\t\t// Keep the defaultTemplateTypes in the core/editor settings too,\n\t\t// so that they can be selected with core/editor selectors in any editor.\n\t\t// This is needed because edit-site doesn't initialize with EditorProvider,\n\t\t// which internally uses updateEditorSettings as well.\n\t\tdispatch( editorStore ).updateEditorSettings( {\n\t\t\tdefaultTemplateTypes: settings.defaultTemplateTypes,\n\t\t\tdefaultTemplatePartAreas: settings.defaultTemplatePartAreas,\n\t\t} );\n\n\t\tconst isLandingOnListPage = getIsListPage(\n\t\t\tgetQueryArgs( window.location.href )\n\t\t);\n\n\t\tif ( isLandingOnListPage ) {\n\t\t\t// Default the navigation panel to be opened when we're in a bigger\n\t\t\t// screen and land in the list screen.\n\t\t\tdispatch( editSiteStore ).setIsNavigationPanelOpened(\n\t\t\t\tselect( viewportStore ).isViewportMatch( 'medium' )\n\t\t\t);\n\t\t}\n\t}\n\n\trender( <EditSiteApp reboot={ reboot } />, target );\n}\n\n/**\n * Initializes the site editor screen.\n *\n * @param {string} id ID of the root element to render the screen in.\n * @param {Object} settings Editor settings.\n */\nexport function initializeEditor( id, settings ) {\n\tsettings.__experimentalFetchLinkSuggestions = ( search, searchOptions ) =>\n\t\tfetchLinkSuggestions( search, searchOptions, settings );\n\tsettings.__experimentalFetchRichUrlData = fetchUrlData;\n\tsettings.__experimentalSpotlightEntityBlocks = [ 'core/template-part' ];\n\n\tconst target = document.getElementById( id );\n\n\tdispatch( blocksStore ).__experimentalReapplyBlockTypeFilters();\n\tregisterCoreBlocks();\n\tif ( process.env.GUTENBERG_PHASE === 2 ) {\n\t\t__experimentalRegisterExperimentalCoreBlocks( {\n\t\t\tenableFSEBlocks: true,\n\t\t} );\n\t}\n\n\treinitializeEditor( target, settings );\n}\n\nexport { default as __experimentalMainDashboardButton } from './components/main-dashboard-button';\nexport { default as __experimentalNavigationToggle } from './components/navigation-sidebar/navigation-toggle';\nexport { default as PluginSidebar } from './components/sidebar/plugin-sidebar';\nexport { default as PluginSidebarMoreMenuItem } from './components/header/plugin-sidebar-more-menu-item';\nexport { default as PluginMoreMenuItem } from './components/header/plugin-more-menu-item';\n"]}
@@ -1,35 +1,19 @@
1
1
  import { createElement, Fragment } from "@wordpress/element";
2
2
 
3
- /**
4
- * External dependencies
5
- */
6
- import downloadjs from 'downloadjs';
7
3
  /**
8
4
  * WordPress dependencies
9
5
  */
10
-
11
- import { MenuItem } from '@wordpress/components';
12
- import { __ } from '@wordpress/i18n';
13
6
  import { registerPlugin } from '@wordpress/plugins';
14
- import apiFetch from '@wordpress/api-fetch';
15
- import { download } from '@wordpress/icons';
16
7
  /**
17
8
  * Internal dependencies
18
9
  */
19
10
 
20
11
  import ToolsMoreMenuGroup from '../components/header/tools-more-menu-group';
12
+ import SiteExport from './site-export';
21
13
  import WelcomeGuideMenuItem from './welcome-guide-menu-item';
22
14
  registerPlugin('edit-site', {
23
15
  render() {
24
- return createElement(Fragment, null, createElement(ToolsMoreMenuGroup, null, createElement(MenuItem, {
25
- role: "menuitem",
26
- icon: download,
27
- onClick: () => apiFetch({
28
- path: '/wp-block-editor/v1/export',
29
- parse: false
30
- }).then(res => res.blob()).then(blob => downloadjs(blob, 'edit-site-export.zip', 'application/zip')),
31
- info: __('Download your templates and template parts.')
32
- }, __('Export')), createElement(WelcomeGuideMenuItem, null)));
16
+ return createElement(Fragment, null, createElement(ToolsMoreMenuGroup, null, createElement(SiteExport, null), createElement(WelcomeGuideMenuItem, null)));
33
17
  }
34
18
 
35
19
  });