@wordpress/edit-site 3.0.26 → 3.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (274) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/LICENSE.md +1 -1
  3. package/build/components/block-editor/resizable-editor.js +1 -0
  4. package/build/components/block-editor/resizable-editor.js.map +1 -1
  5. package/build/components/code-editor/code-editor-text-area.js +95 -0
  6. package/build/components/code-editor/code-editor-text-area.js.map +1 -0
  7. package/build/components/code-editor/index.js +79 -0
  8. package/build/components/code-editor/index.js.map +1 -0
  9. package/build/components/editor/index.js +10 -5
  10. package/build/components/editor/index.js.map +1 -1
  11. package/build/components/global-styles/border-panel.js +81 -22
  12. package/build/components/global-styles/border-panel.js.map +1 -1
  13. package/build/components/global-styles/context-menu.js +4 -6
  14. package/build/components/global-styles/context-menu.js.map +1 -1
  15. package/build/components/global-styles/global-styles-provider.js +1 -0
  16. package/build/components/global-styles/global-styles-provider.js.map +1 -1
  17. package/build/components/global-styles/header.js +2 -7
  18. package/build/components/global-styles/header.js.map +1 -1
  19. package/build/components/global-styles/navigation-button.js +27 -12
  20. package/build/components/global-styles/navigation-button.js.map +1 -1
  21. package/build/components/global-styles/palette.js +2 -2
  22. package/build/components/global-styles/palette.js.map +1 -1
  23. package/build/components/global-styles/preview.js +46 -15
  24. package/build/components/global-styles/preview.js.map +1 -1
  25. package/build/components/global-styles/screen-background-color.js +9 -12
  26. package/build/components/global-styles/screen-background-color.js.map +1 -1
  27. package/build/components/global-styles/screen-block-list.js +2 -3
  28. package/build/components/global-styles/screen-block-list.js.map +1 -1
  29. package/build/components/global-styles/screen-block.js +0 -1
  30. package/build/components/global-styles/screen-block.js.map +1 -1
  31. package/build/components/global-styles/screen-color-palette.js +0 -2
  32. package/build/components/global-styles/screen-color-palette.js.map +1 -1
  33. package/build/components/global-styles/screen-colors.js +5 -6
  34. package/build/components/global-styles/screen-colors.js.map +1 -1
  35. package/build/components/global-styles/screen-layout.js +0 -2
  36. package/build/components/global-styles/screen-layout.js.map +1 -1
  37. package/build/components/global-styles/screen-link-color.js +6 -12
  38. package/build/components/global-styles/screen-link-color.js.map +1 -1
  39. package/build/components/global-styles/screen-root.js +22 -3
  40. package/build/components/global-styles/screen-root.js.map +1 -1
  41. package/build/components/global-styles/screen-style-variations.js +138 -0
  42. package/build/components/global-styles/screen-style-variations.js.map +1 -0
  43. package/build/components/global-styles/screen-text-color.js +6 -12
  44. package/build/components/global-styles/screen-text-color.js.map +1 -1
  45. package/build/components/global-styles/screen-typography-element.js +0 -2
  46. package/build/components/global-styles/screen-typography-element.js.map +1 -1
  47. package/build/components/global-styles/screen-typography.js +2 -3
  48. package/build/components/global-styles/screen-typography.js.map +1 -1
  49. package/build/components/global-styles/ui.js +31 -14
  50. package/build/components/global-styles/ui.js.map +1 -1
  51. package/build/components/header/index.js +12 -4
  52. package/build/components/header/index.js.map +1 -1
  53. package/build/components/header/mode-switcher/index.js +78 -0
  54. package/build/components/header/mode-switcher/index.js.map +1 -0
  55. package/build/components/header/more-menu/copy-content-menu-item.js +74 -0
  56. package/build/components/header/more-menu/copy-content-menu-item.js.map +1 -0
  57. package/build/components/header/more-menu/index.js +72 -39
  58. package/build/components/header/more-menu/index.js.map +1 -1
  59. package/build/{plugins → components/header/more-menu}/site-export.js +0 -0
  60. package/build/components/header/more-menu/site-export.js.map +1 -0
  61. package/build/{plugins → components/header/more-menu}/welcome-guide-menu-item.js +1 -1
  62. package/build/components/header/more-menu/welcome-guide-menu-item.js.map +1 -0
  63. package/build/components/header/tools-more-menu-group/index.js +1 -5
  64. package/build/components/header/tools-more-menu-group/index.js.map +1 -1
  65. package/build/components/keyboard-shortcut-help-modal/config.js +45 -0
  66. package/build/components/keyboard-shortcut-help-modal/config.js.map +1 -0
  67. package/build/components/keyboard-shortcut-help-modal/dynamic-shortcut.js +56 -0
  68. package/build/components/keyboard-shortcut-help-modal/dynamic-shortcut.js.map +1 -0
  69. package/build/components/keyboard-shortcut-help-modal/index.js +137 -0
  70. package/build/components/keyboard-shortcut-help-modal/index.js.map +1 -0
  71. package/build/components/keyboard-shortcut-help-modal/shortcut.js +65 -0
  72. package/build/components/keyboard-shortcut-help-modal/shortcut.js.map +1 -0
  73. package/build/components/keyboard-shortcuts/index.js +26 -1
  74. package/build/components/keyboard-shortcuts/index.js.map +1 -1
  75. package/build/components/list/actions/index.js +5 -4
  76. package/build/components/list/actions/index.js.map +1 -1
  77. package/build/components/list/actions/rename-menu-item.js +3 -3
  78. package/build/components/list/actions/rename-menu-item.js.map +1 -1
  79. package/build/components/list/added-by.js +51 -50
  80. package/build/components/list/added-by.js.map +1 -1
  81. package/build/components/routes/redirect-to-homepage.js +87 -0
  82. package/build/components/routes/redirect-to-homepage.js.map +1 -0
  83. package/build/components/secondary-sidebar/inserter-sidebar.js +13 -3
  84. package/build/components/secondary-sidebar/inserter-sidebar.js.map +1 -1
  85. package/build/components/secondary-sidebar/list-view-sidebar.js +7 -5
  86. package/build/components/secondary-sidebar/list-view-sidebar.js.map +1 -1
  87. package/build/components/sidebar/default-sidebar.js +4 -2
  88. package/build/components/sidebar/default-sidebar.js.map +1 -1
  89. package/build/components/sidebar/global-styles-sidebar.js +1 -0
  90. package/build/components/sidebar/global-styles-sidebar.js.map +1 -1
  91. package/build/components/url-query-controller/index.js +1 -38
  92. package/build/components/url-query-controller/index.js.map +1 -1
  93. package/build/index.js +9 -4
  94. package/build/index.js.map +1 -1
  95. package/build/store/actions.js +26 -25
  96. package/build/store/actions.js.map +1 -1
  97. package/build/store/defaults.js +2 -1
  98. package/build/store/defaults.js.map +1 -1
  99. package/build/store/reducer.js +11 -0
  100. package/build/store/reducer.js.map +1 -1
  101. package/build/store/selectors.js +13 -0
  102. package/build/store/selectors.js.map +1 -1
  103. package/build-module/components/block-editor/resizable-editor.js +1 -0
  104. package/build-module/components/block-editor/resizable-editor.js.map +1 -1
  105. package/build-module/components/code-editor/code-editor-text-area.js +83 -0
  106. package/build-module/components/code-editor/code-editor-text-area.js.map +1 -0
  107. package/build-module/components/code-editor/index.js +62 -0
  108. package/build-module/components/code-editor/index.js.map +1 -0
  109. package/build-module/components/editor/index.js +9 -5
  110. package/build-module/components/editor/index.js.map +1 -1
  111. package/build-module/components/global-styles/border-panel.js +82 -23
  112. package/build-module/components/global-styles/border-panel.js.map +1 -1
  113. package/build-module/components/global-styles/context-menu.js +1 -1
  114. package/build-module/components/global-styles/context-menu.js.map +1 -1
  115. package/build-module/components/global-styles/global-styles-provider.js +1 -1
  116. package/build-module/components/global-styles/global-styles-provider.js.map +1 -1
  117. package/build-module/components/global-styles/header.js +2 -5
  118. package/build-module/components/global-styles/header.js.map +1 -1
  119. package/build-module/components/global-styles/navigation-button.js +27 -10
  120. package/build-module/components/global-styles/navigation-button.js.map +1 -1
  121. package/build-module/components/global-styles/palette.js +1 -1
  122. package/build-module/components/global-styles/palette.js.map +1 -1
  123. package/build-module/components/global-styles/preview.js +45 -15
  124. package/build-module/components/global-styles/preview.js.map +1 -1
  125. package/build-module/components/global-styles/screen-background-color.js +9 -13
  126. package/build-module/components/global-styles/screen-background-color.js.map +1 -1
  127. package/build-module/components/global-styles/screen-block-list.js +1 -2
  128. package/build-module/components/global-styles/screen-block-list.js.map +1 -1
  129. package/build-module/components/global-styles/screen-block.js +0 -1
  130. package/build-module/components/global-styles/screen-block.js.map +1 -1
  131. package/build-module/components/global-styles/screen-color-palette.js +0 -2
  132. package/build-module/components/global-styles/screen-color-palette.js.map +1 -1
  133. package/build-module/components/global-styles/screen-colors.js +2 -3
  134. package/build-module/components/global-styles/screen-colors.js.map +1 -1
  135. package/build-module/components/global-styles/screen-layout.js +0 -2
  136. package/build-module/components/global-styles/screen-layout.js.map +1 -1
  137. package/build-module/components/global-styles/screen-link-color.js +7 -13
  138. package/build-module/components/global-styles/screen-link-color.js.map +1 -1
  139. package/build-module/components/global-styles/screen-root.js +21 -4
  140. package/build-module/components/global-styles/screen-root.js.map +1 -1
  141. package/build-module/components/global-styles/screen-style-variations.js +119 -0
  142. package/build-module/components/global-styles/screen-style-variations.js.map +1 -0
  143. package/build-module/components/global-styles/screen-text-color.js +7 -13
  144. package/build-module/components/global-styles/screen-text-color.js.map +1 -1
  145. package/build-module/components/global-styles/screen-typography-element.js +0 -2
  146. package/build-module/components/global-styles/screen-typography-element.js.map +1 -1
  147. package/build-module/components/global-styles/screen-typography.js +1 -2
  148. package/build-module/components/global-styles/screen-typography.js.map +1 -1
  149. package/build-module/components/global-styles/ui.js +29 -14
  150. package/build-module/components/global-styles/ui.js.map +1 -1
  151. package/build-module/components/header/index.js +13 -5
  152. package/build-module/components/header/index.js.map +1 -1
  153. package/build-module/components/header/mode-switcher/index.js +65 -0
  154. package/build-module/components/header/mode-switcher/index.js.map +1 -0
  155. package/build-module/components/header/more-menu/copy-content-menu-item.js +59 -0
  156. package/build-module/components/header/more-menu/copy-content-menu-item.js.map +1 -0
  157. package/build-module/components/header/more-menu/index.js +67 -40
  158. package/build-module/components/header/more-menu/index.js.map +1 -1
  159. package/build-module/{plugins → components/header/more-menu}/site-export.js +0 -0
  160. package/build-module/components/header/more-menu/site-export.js.map +1 -0
  161. package/build-module/{plugins → components/header/more-menu}/welcome-guide-menu-item.js +1 -1
  162. package/build-module/components/header/more-menu/welcome-guide-menu-item.js.map +1 -0
  163. package/build-module/components/header/tools-more-menu-group/index.js +2 -5
  164. package/build-module/components/header/tools-more-menu-group/index.js.map +1 -1
  165. package/build-module/components/keyboard-shortcut-help-modal/config.js +36 -0
  166. package/build-module/components/keyboard-shortcut-help-modal/config.js.map +1 -0
  167. package/build-module/components/keyboard-shortcut-help-modal/dynamic-shortcut.js +44 -0
  168. package/build-module/components/keyboard-shortcut-help-modal/dynamic-shortcut.js.map +1 -0
  169. package/build-module/components/keyboard-shortcut-help-modal/index.js +120 -0
  170. package/build-module/components/keyboard-shortcut-help-modal/index.js.map +1 -0
  171. package/build-module/components/keyboard-shortcut-help-modal/shortcut.js +58 -0
  172. package/build-module/components/keyboard-shortcut-help-modal/shortcut.js.map +1 -0
  173. package/build-module/components/keyboard-shortcuts/index.js +26 -1
  174. package/build-module/components/keyboard-shortcuts/index.js.map +1 -1
  175. package/build-module/components/list/actions/index.js +5 -4
  176. package/build-module/components/list/actions/index.js.map +1 -1
  177. package/build-module/components/list/actions/rename-menu-item.js +3 -3
  178. package/build-module/components/list/actions/rename-menu-item.js.map +1 -1
  179. package/build-module/components/list/added-by.js +52 -51
  180. package/build-module/components/list/added-by.js.map +1 -1
  181. package/build-module/components/routes/redirect-to-homepage.js +75 -0
  182. package/build-module/components/routes/redirect-to-homepage.js.map +1 -0
  183. package/build-module/components/secondary-sidebar/inserter-sidebar.js +14 -4
  184. package/build-module/components/secondary-sidebar/inserter-sidebar.js.map +1 -1
  185. package/build-module/components/secondary-sidebar/list-view-sidebar.js +7 -5
  186. package/build-module/components/secondary-sidebar/list-view-sidebar.js.map +1 -1
  187. package/build-module/components/sidebar/default-sidebar.js +4 -2
  188. package/build-module/components/sidebar/default-sidebar.js.map +1 -1
  189. package/build-module/components/sidebar/global-styles-sidebar.js +1 -0
  190. package/build-module/components/sidebar/global-styles-sidebar.js.map +1 -1
  191. package/build-module/components/url-query-controller/index.js +3 -40
  192. package/build-module/components/url-query-controller/index.js.map +1 -1
  193. package/build-module/index.js +8 -3
  194. package/build-module/index.js.map +1 -1
  195. package/build-module/store/actions.js +22 -23
  196. package/build-module/store/actions.js.map +1 -1
  197. package/build-module/store/defaults.js +2 -1
  198. package/build-module/store/defaults.js.map +1 -1
  199. package/build-module/store/reducer.js +11 -0
  200. package/build-module/store/reducer.js.map +1 -1
  201. package/build-module/store/selectors.js +11 -0
  202. package/build-module/store/selectors.js.map +1 -1
  203. package/build-style/style-rtl.css +199 -68
  204. package/build-style/style.css +199 -68
  205. package/package.json +29 -28
  206. package/src/components/block-editor/resizable-editor.js +1 -0
  207. package/src/components/block-editor/style.scss +10 -18
  208. package/src/components/code-editor/code-editor-text-area.js +79 -0
  209. package/src/components/code-editor/index.js +65 -0
  210. package/src/components/code-editor/style.scss +100 -0
  211. package/src/components/editor/index.js +16 -7
  212. package/src/components/global-styles/border-panel.js +106 -42
  213. package/src/components/global-styles/context-menu.js +1 -1
  214. package/src/components/global-styles/global-styles-provider.js +1 -2
  215. package/src/components/global-styles/header.js +3 -5
  216. package/src/components/global-styles/navigation-button.js +14 -10
  217. package/src/components/global-styles/palette.js +1 -1
  218. package/src/components/global-styles/preview.js +46 -18
  219. package/src/components/global-styles/screen-background-color.js +7 -12
  220. package/src/components/global-styles/screen-block-list.js +1 -2
  221. package/src/components/global-styles/screen-block.js +1 -1
  222. package/src/components/global-styles/screen-color-palette.js +0 -2
  223. package/src/components/global-styles/screen-colors.js +2 -3
  224. package/src/components/global-styles/screen-layout.js +1 -5
  225. package/src/components/global-styles/screen-link-color.js +6 -16
  226. package/src/components/global-styles/screen-root.js +32 -3
  227. package/src/components/global-styles/screen-style-variations.js +130 -0
  228. package/src/components/global-styles/screen-text-color.js +6 -16
  229. package/src/components/global-styles/screen-typography-element.js +0 -4
  230. package/src/components/global-styles/screen-typography.js +2 -3
  231. package/src/components/global-styles/style.scss +24 -25
  232. package/src/components/global-styles/ui.js +55 -25
  233. package/src/components/header/document-actions/style.scss +1 -9
  234. package/src/components/header/index.js +10 -2
  235. package/src/components/header/mode-switcher/index.js +67 -0
  236. package/src/components/header/more-menu/copy-content-menu-item.js +53 -0
  237. package/src/components/header/more-menu/index.js +107 -44
  238. package/src/{plugins → components/header/more-menu}/site-export.js +0 -0
  239. package/src/{plugins → components/header/more-menu}/welcome-guide-menu-item.js +1 -1
  240. package/src/components/header/style.scss +2 -1
  241. package/src/components/header/tools-more-menu-group/index.js +2 -7
  242. package/src/components/keyboard-shortcut-help-modal/config.js +27 -0
  243. package/src/components/keyboard-shortcut-help-modal/dynamic-shortcut.js +41 -0
  244. package/src/components/keyboard-shortcut-help-modal/index.js +135 -0
  245. package/src/components/keyboard-shortcut-help-modal/shortcut.js +73 -0
  246. package/src/components/keyboard-shortcut-help-modal/style.scss +66 -0
  247. package/src/components/keyboard-shortcuts/index.js +27 -1
  248. package/src/components/list/actions/index.js +5 -4
  249. package/src/components/list/actions/rename-menu-item.js +3 -3
  250. package/src/components/list/added-by.js +57 -63
  251. package/src/components/routes/redirect-to-homepage.js +71 -0
  252. package/src/components/secondary-sidebar/inserter-sidebar.js +14 -3
  253. package/src/components/secondary-sidebar/list-view-sidebar.js +12 -5
  254. package/src/components/secondary-sidebar/style.scss +0 -4
  255. package/src/components/sidebar/default-sidebar.js +2 -0
  256. package/src/components/sidebar/global-styles-sidebar.js +1 -0
  257. package/src/components/sidebar/style.scss +21 -14
  258. package/src/components/url-query-controller/index.js +3 -35
  259. package/src/index.js +9 -2
  260. package/src/store/actions.js +22 -35
  261. package/src/store/defaults.js +1 -0
  262. package/src/store/reducer.js +6 -0
  263. package/src/store/selectors.js +11 -0
  264. package/src/store/test/actions.js +2 -92
  265. package/src/style.scss +2 -0
  266. package/build/plugins/index.js +0 -28
  267. package/build/plugins/index.js.map +0 -1
  268. package/build/plugins/site-export.js.map +0 -1
  269. package/build/plugins/welcome-guide-menu-item.js.map +0 -1
  270. package/build-module/plugins/index.js +0 -20
  271. package/build-module/plugins/index.js.map +0 -1
  272. package/build-module/plugins/site-export.js.map +0 -1
  273. package/build-module/plugins/welcome-guide-menu-item.js.map +0 -1
  274. package/src/plugins/index.js +0 -24
@@ -45,67 +45,75 @@ function CustomizedTooltip(_ref) {
45
45
  }, children);
46
46
  }
47
47
 
48
- function AddedByTheme(_ref2) {
49
- var _theme$name;
50
-
48
+ function BaseAddedBy(_ref2) {
51
49
  let {
52
- slug,
50
+ text,
51
+ icon,
52
+ imageUrl,
53
53
  isCustomized
54
54
  } = _ref2;
55
- const theme = (0, _data.useSelect)(select => select(_coreData.store).getTheme(slug), [slug]);
55
+ const [isImageLoaded, setIsImageLoaded] = (0, _element.useState)(false);
56
56
  return (0, _element.createElement)(_components.__experimentalHStack, {
57
57
  alignment: "left"
58
58
  }, (0, _element.createElement)(CustomizedTooltip, {
59
59
  isCustomized: isCustomized
60
- }, (0, _element.createElement)("div", {
60
+ }, imageUrl ? (0, _element.createElement)("div", {
61
+ className: (0, _classnames.default)('edit-site-list-added-by__avatar', {
62
+ 'is-loaded': isImageLoaded
63
+ })
64
+ }, (0, _element.createElement)("img", {
65
+ onLoad: () => setIsImageLoaded(true),
66
+ alt: "",
67
+ src: imageUrl
68
+ })) : (0, _element.createElement)("div", {
61
69
  className: (0, _classnames.default)('edit-site-list-added-by__icon', {
62
70
  'is-customized': isCustomized
63
71
  })
64
72
  }, (0, _element.createElement)(_components.Icon, {
65
- icon: _icons.layout
66
- }))), (0, _element.createElement)("span", null, (theme === null || theme === void 0 ? void 0 : (_theme$name = theme.name) === null || _theme$name === void 0 ? void 0 : _theme$name.rendered) || slug));
73
+ icon: icon
74
+ }))), (0, _element.createElement)("span", null, text));
67
75
  }
68
76
 
69
- function AddedByPlugin(_ref3) {
77
+ function AddedByTheme(_ref3) {
78
+ var _theme$name;
79
+
70
80
  let {
71
81
  slug,
72
82
  isCustomized
73
83
  } = _ref3;
84
+ const theme = (0, _data.useSelect)(select => select(_coreData.store).getTheme(slug), [slug]);
85
+ return (0, _element.createElement)(BaseAddedBy, {
86
+ icon: _icons.layout,
87
+ text: (theme === null || theme === void 0 ? void 0 : (_theme$name = theme.name) === null || _theme$name === void 0 ? void 0 : _theme$name.rendered) || slug,
88
+ isCustomized: isCustomized
89
+ });
90
+ }
91
+
92
+ function AddedByPlugin(_ref4) {
93
+ let {
94
+ slug,
95
+ isCustomized
96
+ } = _ref4;
74
97
  const plugin = (0, _data.useSelect)(select => select(_coreData.store).getPlugin(slug), [slug]);
75
- return (0, _element.createElement)(_components.__experimentalHStack, {
76
- alignment: "left"
77
- }, (0, _element.createElement)(CustomizedTooltip, {
98
+ return (0, _element.createElement)(BaseAddedBy, {
99
+ icon: _icons.plugins,
100
+ text: (plugin === null || plugin === void 0 ? void 0 : plugin.name) || slug,
78
101
  isCustomized: isCustomized
79
- }, (0, _element.createElement)("div", {
80
- className: "edit-site-list-added-by__icon"
81
- }, (0, _element.createElement)(_components.Icon, {
82
- icon: _icons.plugins
83
- }))), (0, _element.createElement)("span", null, (plugin === null || plugin === void 0 ? void 0 : plugin.name) || slug));
102
+ });
84
103
  }
85
104
 
86
- function AddedByAuthor(_ref4) {
105
+ function AddedByAuthor(_ref5) {
87
106
  var _user$avatar_urls;
88
107
 
89
108
  let {
90
109
  id
91
- } = _ref4;
110
+ } = _ref5;
92
111
  const user = (0, _data.useSelect)(select => select(_coreData.store).getUser(id), [id]);
93
- const [isImageLoaded, setIsImageLoaded] = (0, _element.useState)(false);
94
- const avatarURL = user === null || user === void 0 ? void 0 : (_user$avatar_urls = user.avatar_urls) === null || _user$avatar_urls === void 0 ? void 0 : _user$avatar_urls[48];
95
- const hasAvatar = !!avatarURL;
96
- return (0, _element.createElement)(_components.__experimentalHStack, {
97
- alignment: "left"
98
- }, (0, _element.createElement)("div", {
99
- className: (0, _classnames.default)(hasAvatar ? 'edit-site-list-added-by__avatar' : 'edit-site-list-added-by__icon', {
100
- 'is-loaded': isImageLoaded
101
- })
102
- }, hasAvatar ? (0, _element.createElement)("img", {
103
- onLoad: () => setIsImageLoaded(true),
104
- alt: "",
105
- src: avatarURL
106
- }) : (0, _element.createElement)(_components.Icon, {
107
- icon: _icons.commentAuthorAvatar
108
- })), (0, _element.createElement)("span", null, user === null || user === void 0 ? void 0 : user.nickname));
112
+ return (0, _element.createElement)(BaseAddedBy, {
113
+ icon: _icons.commentAuthorAvatar,
114
+ imageUrl: user === null || user === void 0 ? void 0 : (_user$avatar_urls = user.avatar_urls) === null || _user$avatar_urls === void 0 ? void 0 : _user$avatar_urls[48],
115
+ text: user === null || user === void 0 ? void 0 : user.nickname
116
+ });
109
117
  }
110
118
 
111
119
  function AddedBySite() {
@@ -121,29 +129,22 @@ function AddedBySite() {
121
129
  } = select(_coreData.store);
122
130
  const siteData = getEntityRecord('root', '__unstableBase');
123
131
  return {
124
- name: siteData.name,
132
+ name: siteData === null || siteData === void 0 ? void 0 : siteData.name,
125
133
  logoURL: siteData !== null && siteData !== void 0 && siteData.site_logo ? (_getMedia = getMedia(siteData.site_logo)) === null || _getMedia === void 0 ? void 0 : _getMedia.source_url : undefined
126
134
  };
127
135
  }, []);
128
- const [isImageLoaded, setIsImageLoaded] = (0, _element.useState)(false);
129
- return (0, _element.createElement)(_components.__experimentalHStack, {
130
- alignment: "left"
131
- }, (0, _element.createElement)("div", {
132
- className: (0, _classnames.default)('edit-site-list-added-by__avatar', {
133
- 'is-loaded': isImageLoaded
134
- })
135
- }, (0, _element.createElement)("img", {
136
- onLoad: () => setIsImageLoaded(true),
137
- alt: "",
138
- src: logoURL
139
- })), (0, _element.createElement)("span", null, name));
136
+ return (0, _element.createElement)(BaseAddedBy, {
137
+ icon: _icons.globe,
138
+ imageUrl: logoURL,
139
+ text: name
140
+ });
140
141
  }
141
142
 
142
- function AddedBy(_ref5) {
143
+ function AddedBy(_ref6) {
143
144
  let {
144
145
  templateType,
145
146
  template
146
- } = _ref5;
147
+ } = _ref6;
147
148
 
148
149
  if (!template) {
149
150
  return;
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-site/src/components/list/added-by.js"],"names":["TEMPLATE_POST_TYPE_NAMES","CustomizedTooltip","isCustomized","children","AddedByTheme","slug","theme","select","coreStore","getTheme","themeIcon","name","rendered","AddedByPlugin","plugin","getPlugin","pluginIcon","AddedByAuthor","id","user","getUser","isImageLoaded","setIsImageLoaded","avatarURL","avatar_urls","hasAvatar","authorIcon","nickname","AddedBySite","logoURL","getEntityRecord","getMedia","siteData","site_logo","source_url","undefined","AddedBy","templateType","template","includes","has_theme_file","origin","source","author"],"mappings":";;;;;;;;;AAeA;;AAZA;;AAKA;;AAKA;;AACA;;AAEA;;AAKA;;AArBA;AACA;AACA;;AAGA;AACA;AACA;AAgBA,MAAMA,wBAAwB,GAAG,CAAE,aAAF,EAAiB,kBAAjB,CAAjC;;AA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;AAEC,QAAA,YAAY,EAAGgC,QAAQ,CAACI,MAAT,KAAoB;AAFpC,QADD;AAMA,KAjBuD,CAmBxD;;;AACA,QAAKJ,QAAQ,CAACE,cAAT,IAA2BF,QAAQ,CAACG,MAAT,KAAoB,QAApD,EAA+D;AAC9D,aACC,4BAAC,aAAD;AACC,QAAA,IAAI,EAAGH,QAAQ,CAAChC,KADjB;AAEC,QAAA,YAAY,EAAGgC,QAAQ,CAACI,MAAT,KAAoB;AAFpC,QADD;AAMA,KA3BuD,CA6BxD;AACA;AACA;;;AACA,QACC,CAAEJ,QAAQ,CAACE,cAAX,IACAF,QAAQ,CAACI,MAAT,KAAoB,QADpB,IAEA,CAAEJ,QAAQ,CAACK,MAHZ,EAIE;AACD,aAAO,4BAAC,WAAD,OAAP;AACA;AACD,GA5C4D,CA8C7D;AACA;;;AACA,SAAO,4BAAC,aAAD;AAAe,IAAA,EAAE,EAAGL,QAAQ,CAACK;AAA7B,IAAP;AACA","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalHStack as HStack,\n\tIcon,\n\tTooltip,\n} from '@wordpress/components';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useSelect } from '@wordpress/data';\nimport { useState } from '@wordpress/element';\nimport {\n\tcommentAuthorAvatar as authorIcon,\n\tlayout as themeIcon,\n\tplugins as pluginIcon,\n} from '@wordpress/icons';\nimport { __ } from '@wordpress/i18n';\n\nconst TEMPLATE_POST_TYPE_NAMES = [ 'wp_template', 'wp_template_part' ];\n\nfunction CustomizedTooltip( { isCustomized, children } ) {\n\tif ( ! isCustomized ) {\n\t\treturn children;\n\t}\n\n\treturn (\n\t\t<Tooltip text={ __( 'This template has been customized' ) }>\n\t\t\t{ children }\n\t\t</Tooltip>\n\t);\n}\n\nfunction AddedByTheme( { slug, isCustomized } ) {\n\tconst theme = useSelect(\n\t\t( select ) => select( coreStore ).getTheme( slug ),\n\t\t[ slug ]\n\t);\n\n\treturn (\n\t\t<HStack alignment=\"left\">\n\t\t\t<CustomizedTooltip isCustomized={ isCustomized }>\n\t\t\t\t<div\n\t\t\t\t\tclassName={ classnames( 'edit-site-list-added-by__icon', {\n\t\t\t\t\t\t'is-customized': isCustomized,\n\t\t\t\t\t} ) }\n\t\t\t\t>\n\t\t\t\t\t<Icon icon={ themeIcon } />\n\t\t\t\t</div>\n\t\t\t</CustomizedTooltip>\n\t\t\t<span>{ theme?.name?.rendered || slug }</span>\n\t\t</HStack>\n\t);\n}\n\nfunction AddedByPlugin( { slug, isCustomized } ) {\n\tconst plugin = useSelect(\n\t\t( select ) => select( coreStore ).getPlugin( slug ),\n\t\t[ slug ]\n\t);\n\n\treturn (\n\t\t<HStack alignment=\"left\">\n\t\t\t<CustomizedTooltip isCustomized={ isCustomized }>\n\t\t\t\t<div className=\"edit-site-list-added-by__icon\">\n\t\t\t\t\t<Icon icon={ pluginIcon } />\n\t\t\t\t</div>\n\t\t\t</CustomizedTooltip>\n\t\t\t<span>{ plugin?.name || slug }</span>\n\t\t</HStack>\n\t);\n}\n\nfunction AddedByAuthor( { id } ) {\n\tconst user = useSelect( ( select ) => select( coreStore ).getUser( id ), [\n\t\tid,\n\t] );\n\tconst [ isImageLoaded, setIsImageLoaded ] = useState( false );\n\n\tconst avatarURL = user?.avatar_urls?.[ 48 ];\n\tconst hasAvatar = !! avatarURL;\n\n\treturn (\n\t\t<HStack alignment=\"left\">\n\t\t\t<div\n\t\t\t\tclassName={ classnames(\n\t\t\t\t\thasAvatar\n\t\t\t\t\t\t? 'edit-site-list-added-by__avatar'\n\t\t\t\t\t\t: 'edit-site-list-added-by__icon',\n\t\t\t\t\t{\n\t\t\t\t\t\t'is-loaded': isImageLoaded,\n\t\t\t\t\t}\n\t\t\t\t) }\n\t\t\t>\n\t\t\t\t{ hasAvatar ? (\n\t\t\t\t\t<img\n\t\t\t\t\t\tonLoad={ () => setIsImageLoaded( true ) }\n\t\t\t\t\t\talt=\"\"\n\t\t\t\t\t\tsrc={ avatarURL }\n\t\t\t\t\t/>\n\t\t\t\t) : (\n\t\t\t\t\t<Icon icon={ authorIcon } />\n\t\t\t\t) }\n\t\t\t</div>\n\t\t\t<span>{ user?.nickname }</span>\n\t\t</HStack>\n\t);\n}\n\nfunction AddedBySite() {\n\tconst { name, logoURL } = useSelect( ( select ) => {\n\t\tconst { getEntityRecord, getMedia } = select( coreStore );\n\t\tconst siteData = getEntityRecord( 'root', '__unstableBase' );\n\n\t\treturn {\n\t\t\tname: siteData.name,\n\t\t\tlogoURL: siteData?.site_logo\n\t\t\t\t? getMedia( siteData.site_logo )?.source_url\n\t\t\t\t: undefined,\n\t\t};\n\t}, [] );\n\tconst [ isImageLoaded, setIsImageLoaded ] = useState( false );\n\n\treturn (\n\t\t<HStack alignment=\"left\">\n\t\t\t<div\n\t\t\t\tclassName={ classnames( 'edit-site-list-added-by__avatar', {\n\t\t\t\t\t'is-loaded': isImageLoaded,\n\t\t\t\t} ) }\n\t\t\t>\n\t\t\t\t<img\n\t\t\t\t\tonLoad={ () => setIsImageLoaded( true ) }\n\t\t\t\t\talt=\"\"\n\t\t\t\t\tsrc={ logoURL }\n\t\t\t\t/>\n\t\t\t</div>\n\t\t\t<span>{ name }</span>\n\t\t</HStack>\n\t);\n}\n\nexport default function AddedBy( { templateType, template } ) {\n\tif ( ! template ) {\n\t\treturn;\n\t}\n\n\tif ( TEMPLATE_POST_TYPE_NAMES.includes( templateType ) ) {\n\t\t// Template originally provided by a theme, but customized by a user.\n\t\t// Templates originally didn't have the 'origin' field so identify\n\t\t// older customized templates by checking for no origin and a 'theme'\n\t\t// or 'custom' source.\n\t\tif (\n\t\t\ttemplate.has_theme_file &&\n\t\t\t( template.origin === 'theme' ||\n\t\t\t\t( ! template.origin &&\n\t\t\t\t\t[ 'theme', 'custom' ].includes( template.source ) ) )\n\t\t) {\n\t\t\treturn (\n\t\t\t\t<AddedByTheme\n\t\t\t\t\tslug={ template.theme }\n\t\t\t\t\tisCustomized={ template.source === 'custom' }\n\t\t\t\t/>\n\t\t\t);\n\t\t}\n\n\t\t// Template originally provided by a plugin, but customized by a user.\n\t\tif ( template.has_theme_file && template.origin === 'plugin' ) {\n\t\t\treturn (\n\t\t\t\t<AddedByPlugin\n\t\t\t\t\tslug={ template.theme }\n\t\t\t\t\tisCustomized={ template.source === 'custom' }\n\t\t\t\t/>\n\t\t\t);\n\t\t}\n\n\t\t// Template was created from scratch, but has no author. Author support\n\t\t// was only added to templates in WordPress 5.9. Fallback to showing the\n\t\t// site logo and title.\n\t\tif (\n\t\t\t! template.has_theme_file &&\n\t\t\ttemplate.source === 'custom' &&\n\t\t\t! template.author\n\t\t) {\n\t\t\treturn <AddedBySite />;\n\t\t}\n\t}\n\n\t// Simply show the author for templates created from scratch that have an\n\t// author or for any other post type.\n\treturn <AddedByAuthor id={ template.author } />;\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/edit-site/src/components/list/added-by.js"],"names":["TEMPLATE_POST_TYPE_NAMES","CustomizedTooltip","isCustomized","children","BaseAddedBy","text","icon","imageUrl","isImageLoaded","setIsImageLoaded","AddedByTheme","slug","theme","select","coreStore","getTheme","themeIcon","name","rendered","AddedByPlugin","plugin","getPlugin","pluginIcon","AddedByAuthor","id","user","getUser","authorIcon","avatar_urls","nickname","AddedBySite","logoURL","getEntityRecord","getMedia","siteData","site_logo","source_url","undefined","globeIcon","AddedBy","templateType","template","includes","has_theme_file","origin","source","author"],"mappings":";;;;;;;;;AAeA;;AAZA;;AAKA;;AAKA;;AACA;;AAEA;;AAMA;;AAtBA;AACA;AACA;;AAGA;AACA;AACA;AAiBA,MAAMA,wBAAwB,GAAG,CAAE,aAAF,EAAiB,kBAAjB,CAAjC;;AAEA,SAASC,iBAAT,OAAyD;AAAA,MAA7B;AAAEC,IAAAA,YAAF;AAAgBC,IAAAA;AAAhB,GAA6B;;AACxD,MAAK,CAAED,YAAP,EAAsB;AACrB,WAAOC,QAAP;AACA;;AAED,SACC,4BAAC,mBAA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,QAAQ,CAACI,MAAT,KAAoB,QADpB,IAEA,CAAEJ,QAAQ,CAACK,MAHZ,EAIE;AACD,aAAO,4BAAC,WAAD,OAAP;AACA;AACD,GA5C4D,CA8C7D;AACA;;;AACA,SAAO,4BAAC,aAAD;AAAe,IAAA,EAAE,EAAGL,QAAQ,CAACK;AAA7B,IAAP;AACA","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalHStack as HStack,\n\tIcon,\n\tTooltip,\n} from '@wordpress/components';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useSelect } from '@wordpress/data';\nimport { useState } from '@wordpress/element';\nimport {\n\tcommentAuthorAvatar as authorIcon,\n\tlayout as themeIcon,\n\tplugins as pluginIcon,\n\tglobe as globeIcon,\n} from '@wordpress/icons';\nimport { __ } from '@wordpress/i18n';\n\nconst TEMPLATE_POST_TYPE_NAMES = [ 'wp_template', 'wp_template_part' ];\n\nfunction CustomizedTooltip( { isCustomized, children } ) {\n\tif ( ! isCustomized ) {\n\t\treturn children;\n\t}\n\n\treturn (\n\t\t<Tooltip text={ __( 'This template has been customized' ) }>\n\t\t\t{ children }\n\t\t</Tooltip>\n\t);\n}\n\nfunction BaseAddedBy( { text, icon, imageUrl, isCustomized } ) {\n\tconst [ isImageLoaded, setIsImageLoaded ] = useState( false );\n\n\treturn (\n\t\t<HStack alignment=\"left\">\n\t\t\t<CustomizedTooltip isCustomized={ isCustomized }>\n\t\t\t\t{ imageUrl ? (\n\t\t\t\t\t<div\n\t\t\t\t\t\tclassName={ classnames(\n\t\t\t\t\t\t\t'edit-site-list-added-by__avatar',\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t'is-loaded': isImageLoaded,\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t) }\n\t\t\t\t\t>\n\t\t\t\t\t\t<img\n\t\t\t\t\t\t\tonLoad={ () => setIsImageLoaded( true ) }\n\t\t\t\t\t\t\talt=\"\"\n\t\t\t\t\t\t\tsrc={ imageUrl }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</div>\n\t\t\t\t) : (\n\t\t\t\t\t<div\n\t\t\t\t\t\tclassName={ classnames(\n\t\t\t\t\t\t\t'edit-site-list-added-by__icon',\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t'is-customized': isCustomized,\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t) }\n\t\t\t\t\t>\n\t\t\t\t\t\t<Icon icon={ icon } />\n\t\t\t\t\t</div>\n\t\t\t\t) }\n\t\t\t</CustomizedTooltip>\n\t\t\t<span>{ text }</span>\n\t\t</HStack>\n\t);\n}\n\nfunction AddedByTheme( { slug, isCustomized } ) {\n\tconst theme = useSelect(\n\t\t( select ) => select( coreStore ).getTheme( slug ),\n\t\t[ slug ]\n\t);\n\n\treturn (\n\t\t<BaseAddedBy\n\t\t\ticon={ themeIcon }\n\t\t\ttext={ theme?.name?.rendered || slug }\n\t\t\tisCustomized={ isCustomized }\n\t\t/>\n\t);\n}\n\nfunction AddedByPlugin( { slug, isCustomized } ) {\n\tconst plugin = useSelect(\n\t\t( select ) => select( coreStore ).getPlugin( slug ),\n\t\t[ slug ]\n\t);\n\n\treturn (\n\t\t<BaseAddedBy\n\t\t\ticon={ pluginIcon }\n\t\t\ttext={ plugin?.name || slug }\n\t\t\tisCustomized={ isCustomized }\n\t\t/>\n\t);\n}\n\nfunction AddedByAuthor( { id } ) {\n\tconst user = useSelect( ( select ) => select( coreStore ).getUser( id ), [\n\t\tid,\n\t] );\n\n\treturn (\n\t\t<BaseAddedBy\n\t\t\ticon={ authorIcon }\n\t\t\timageUrl={ user?.avatar_urls?.[ 48 ] }\n\t\t\ttext={ user?.nickname }\n\t\t/>\n\t);\n}\n\nfunction AddedBySite() {\n\tconst { name, logoURL } = useSelect( ( select ) => {\n\t\tconst { getEntityRecord, getMedia } = select( coreStore );\n\t\tconst siteData = getEntityRecord( 'root', '__unstableBase' );\n\n\t\treturn {\n\t\t\tname: siteData?.name,\n\t\t\tlogoURL: siteData?.site_logo\n\t\t\t\t? getMedia( siteData.site_logo )?.source_url\n\t\t\t\t: undefined,\n\t\t};\n\t}, [] );\n\n\treturn (\n\t\t<BaseAddedBy icon={ globeIcon } imageUrl={ logoURL } text={ name } />\n\t);\n}\n\nexport default function AddedBy( { templateType, template } ) {\n\tif ( ! template ) {\n\t\treturn;\n\t}\n\n\tif ( TEMPLATE_POST_TYPE_NAMES.includes( templateType ) ) {\n\t\t// Template originally provided by a theme, but customized by a user.\n\t\t// Templates originally didn't have the 'origin' field so identify\n\t\t// older customized templates by checking for no origin and a 'theme'\n\t\t// or 'custom' source.\n\t\tif (\n\t\t\ttemplate.has_theme_file &&\n\t\t\t( template.origin === 'theme' ||\n\t\t\t\t( ! template.origin &&\n\t\t\t\t\t[ 'theme', 'custom' ].includes( template.source ) ) )\n\t\t) {\n\t\t\treturn (\n\t\t\t\t<AddedByTheme\n\t\t\t\t\tslug={ template.theme }\n\t\t\t\t\tisCustomized={ template.source === 'custom' }\n\t\t\t\t/>\n\t\t\t);\n\t\t}\n\n\t\t// Template originally provided by a plugin, but customized by a user.\n\t\tif ( template.has_theme_file && template.origin === 'plugin' ) {\n\t\t\treturn (\n\t\t\t\t<AddedByPlugin\n\t\t\t\t\tslug={ template.theme }\n\t\t\t\t\tisCustomized={ template.source === 'custom' }\n\t\t\t\t/>\n\t\t\t);\n\t\t}\n\n\t\t// Template was created from scratch, but has no author. Author support\n\t\t// was only added to templates in WordPress 5.9. Fallback to showing the\n\t\t// site logo and title.\n\t\tif (\n\t\t\t! template.has_theme_file &&\n\t\t\ttemplate.source === 'custom' &&\n\t\t\t! template.author\n\t\t) {\n\t\t\treturn <AddedBySite />;\n\t\t}\n\t}\n\n\t// Simply show the author for templates created from scratch that have an\n\t// author or for any other post type.\n\treturn <AddedByAuthor id={ template.author } />;\n}\n"]}
@@ -0,0 +1,87 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.default = redirectToHomepage;
9
+
10
+ var _apiFetch = _interopRequireDefault(require("@wordpress/api-fetch"));
11
+
12
+ var _url = require("@wordpress/url");
13
+
14
+ var _history = _interopRequireDefault(require("../../utils/history"));
15
+
16
+ var _getIsListPage = _interopRequireDefault(require("../../utils/get-is-list-page"));
17
+
18
+ /**
19
+ * WordPress dependencies
20
+ */
21
+
22
+ /**
23
+ * Internal dependencies
24
+ */
25
+ function getNeedsHomepageRedirect(params) {
26
+ const {
27
+ postType
28
+ } = params;
29
+ return !(0, _getIsListPage.default)(params) && !['post', 'page', 'wp_template', 'wp_template_part'].includes(postType);
30
+ }
31
+
32
+ async function getHomepageParams(siteUrl) {
33
+ const siteSettings = await (0, _apiFetch.default)({
34
+ path: '/wp/v2/settings'
35
+ });
36
+
37
+ if (!siteSettings) {
38
+ return;
39
+ }
40
+
41
+ const {
42
+ show_on_front: showOnFront,
43
+ page_on_front: frontpageId
44
+ } = siteSettings; // If the user has set a page as the homepage, use those details.
45
+
46
+ if (showOnFront === 'page') {
47
+ return {
48
+ postType: 'page',
49
+ postId: frontpageId
50
+ };
51
+ } // Else get the home template.
52
+ // This matches the logic in `__experimentalGetTemplateForLink`.
53
+ // (packages/core-data/src/resolvers.js)
54
+
55
+
56
+ const template = await window.fetch((0, _url.addQueryArgs)(siteUrl, {
57
+ '_wp-find-template': true
58
+ })).then(res => res.json()).then(_ref => {
59
+ let {
60
+ data
61
+ } = _ref;
62
+ return data;
63
+ });
64
+
65
+ if (!(template !== null && template !== void 0 && template.id)) {
66
+ return;
67
+ }
68
+
69
+ return {
70
+ postType: 'wp_template',
71
+ postId: template.id
72
+ };
73
+ }
74
+
75
+ async function redirectToHomepage(siteUrl) {
76
+ const searchParams = new URLSearchParams(_history.default.location.search);
77
+ const params = Object.fromEntries(searchParams.entries());
78
+
79
+ if (getNeedsHomepageRedirect(params)) {
80
+ const homepageParams = await getHomepageParams(siteUrl);
81
+
82
+ if (homepageParams) {
83
+ _history.default.replace(homepageParams);
84
+ }
85
+ }
86
+ }
87
+ //# sourceMappingURL=redirect-to-homepage.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["@wordpress/edit-site/src/components/routes/redirect-to-homepage.js"],"names":["getNeedsHomepageRedirect","params","postType","includes","getHomepageParams","siteUrl","siteSettings","path","show_on_front","showOnFront","page_on_front","frontpageId","postId","template","window","fetch","then","res","json","data","id","redirectToHomepage","searchParams","URLSearchParams","history","location","search","Object","fromEntries","entries","homepageParams","replace"],"mappings":";;;;;;;;;AAGA;;AACA;;AAKA;;AACA;;AAVA;AACA;AACA;;AAIA;AACA;AACA;AAIA,SAASA,wBAAT,CAAmCC,MAAnC,EAA4C;AAC3C,QAAM;AAAEC,IAAAA;AAAF,MAAeD,MAArB;AACA,SACC,CAAE,4BAAeA,MAAf,CAAF,IACA,CAAE,CAAE,MAAF,EAAU,MAAV,EAAkB,aAAlB,EAAiC,kBAAjC,EAAsDE,QAAtD,CACDD,QADC,CAFH;AAMA;;AAED,eAAeE,iBAAf,CAAkCC,OAAlC,EAA4C;AAC3C,QAAMC,YAAY,GAAG,MAAM,uBAAU;AAAEC,IAAAA,IAAI,EAAE;AAAR,GAAV,CAA3B;;AACA,MAAK,CAAED,YAAP,EAAsB;AACrB;AACA;;AAED,QAAM;AACLE,IAAAA,aAAa,EAAEC,WADV;AAELC,IAAAA,aAAa,EAAEC;AAFV,MAGFL,YAHJ,CAN2C,CAW3C;;AACA,MAAKG,WAAW,KAAK,MAArB,EAA8B;AAC7B,WAAO;AACNP,MAAAA,QAAQ,EAAE,MADJ;AAENU,MAAAA,MAAM,EAAED;AAFF,KAAP;AAIA,GAjB0C,CAmB3C;AACA;AACA;;;AACA,QAAME,QAAQ,GAAG,MAAMC,MAAM,CAC3BC,KADqB,CACd,uBAAcV,OAAd,EAAuB;AAAE,yBAAqB;AAAvB,GAAvB,CADc,EAErBW,IAFqB,CAEbC,GAAF,IAAWA,GAAG,CAACC,IAAJ,EAFI,EAGrBF,IAHqB,CAGf;AAAA,QAAE;AAAEG,MAAAA;AAAF,KAAF;AAAA,WAAgBA,IAAhB;AAAA,GAHe,CAAvB;;AAKA,MAAK,EAAEN,QAAF,aAAEA,QAAF,eAAEA,QAAQ,CAAEO,EAAZ,CAAL,EAAsB;AACrB;AACA;;AAED,SAAO;AACNlB,IAAAA,QAAQ,EAAE,aADJ;AAENU,IAAAA,MAAM,EAAEC,QAAQ,CAACO;AAFX,GAAP;AAIA;;AAEc,eAAeC,kBAAf,CAAmChB,OAAnC,EAA6C;AAC3D,QAAMiB,YAAY,GAAG,IAAIC,eAAJ,CAAqBC,iBAAQC,QAAR,CAAiBC,MAAtC,CAArB;AACA,QAAMzB,MAAM,GAAG0B,MAAM,CAACC,WAAP,CAAoBN,YAAY,CAACO,OAAb,EAApB,CAAf;;AAEA,MAAK7B,wBAAwB,CAAEC,MAAF,CAA7B,EAA0C;AACzC,UAAM6B,cAAc,GAAG,MAAM1B,iBAAiB,CAAEC,OAAF,CAA9C;;AAEA,QAAKyB,cAAL,EAAsB;AACrBN,uBAAQO,OAAR,CAAiBD,cAAjB;AACA;AACD;AACD","sourcesContent":["/**\n * WordPress dependencies\n */\nimport apiFetch from '@wordpress/api-fetch';\nimport { addQueryArgs } from '@wordpress/url';\n\n/**\n * Internal dependencies\n */\nimport history from '../../utils/history';\nimport getIsListPage from '../../utils/get-is-list-page';\n\nfunction getNeedsHomepageRedirect( params ) {\n\tconst { postType } = params;\n\treturn (\n\t\t! getIsListPage( params ) &&\n\t\t! [ 'post', 'page', 'wp_template', 'wp_template_part' ].includes(\n\t\t\tpostType\n\t\t)\n\t);\n}\n\nasync function getHomepageParams( siteUrl ) {\n\tconst siteSettings = await apiFetch( { path: '/wp/v2/settings' } );\n\tif ( ! siteSettings ) {\n\t\treturn;\n\t}\n\n\tconst {\n\t\tshow_on_front: showOnFront,\n\t\tpage_on_front: frontpageId,\n\t} = siteSettings;\n\n\t// If the user has set a page as the homepage, use those details.\n\tif ( showOnFront === 'page' ) {\n\t\treturn {\n\t\t\tpostType: 'page',\n\t\t\tpostId: frontpageId,\n\t\t};\n\t}\n\n\t// Else get the home template.\n\t// This matches the logic in `__experimentalGetTemplateForLink`.\n\t// (packages/core-data/src/resolvers.js)\n\tconst template = await window\n\t\t.fetch( addQueryArgs( siteUrl, { '_wp-find-template': true } ) )\n\t\t.then( ( res ) => res.json() )\n\t\t.then( ( { data } ) => data );\n\n\tif ( ! template?.id ) {\n\t\treturn;\n\t}\n\n\treturn {\n\t\tpostType: 'wp_template',\n\t\tpostId: template.id,\n\t};\n}\n\nexport default async function redirectToHomepage( siteUrl ) {\n\tconst searchParams = new URLSearchParams( history.location.search );\n\tconst params = Object.fromEntries( searchParams.entries() );\n\n\tif ( getNeedsHomepageRedirect( params ) ) {\n\t\tconst homepageParams = await getHomepageParams( siteUrl );\n\n\t\tif ( homepageParams ) {\n\t\t\thistory.replace( homepageParams );\n\t\t}\n\t}\n}\n"]}
@@ -21,6 +21,8 @@ var _icons = require("@wordpress/icons");
21
21
 
22
22
  var _compose = require("@wordpress/compose");
23
23
 
24
+ var _i18n = require("@wordpress/i18n");
25
+
24
26
  var _store = require("../../store");
25
27
 
26
28
  /**
@@ -36,17 +38,24 @@ function InserterSidebar() {
36
38
  } = (0, _data.useDispatch)(_store.store);
37
39
  const insertionPoint = (0, _data.useSelect)(select => select(_store.store).__experimentalGetInsertionPoint(), []);
38
40
  const isMobile = (0, _compose.useViewportMatch)('medium', '<');
41
+ const TagName = !isMobile ? _components.VisuallyHidden : 'div';
39
42
  const [inserterDialogRef, inserterDialogProps] = (0, _compose.__experimentalUseDialog)({
40
- onClose: () => setIsInserterOpened(false)
43
+ onClose: () => setIsInserterOpened(false),
44
+ focusOnMount: null
41
45
  });
46
+ const libraryRef = (0, _element.useRef)();
47
+ (0, _element.useEffect)(() => {
48
+ libraryRef.current.focusSearch();
49
+ }, []);
42
50
  return (0, _element.createElement)("div", (0, _extends2.default)({
43
51
  ref: inserterDialogRef
44
52
  }, inserterDialogProps, {
45
53
  className: "edit-site-editor__inserter-panel"
46
- }), (0, _element.createElement)("div", {
54
+ }), (0, _element.createElement)(TagName, {
47
55
  className: "edit-site-editor__inserter-panel-header"
48
56
  }, (0, _element.createElement)(_components.Button, {
49
57
  icon: _icons.close,
58
+ label: (0, _i18n.__)('Close block inserter'),
50
59
  onClick: () => setIsInserterOpened(false)
51
60
  })), (0, _element.createElement)("div", {
52
61
  className: "edit-site-editor__inserter-panel-content"
@@ -55,7 +64,8 @@ function InserterSidebar() {
55
64
  shouldFocusBlock: isMobile,
56
65
  rootClientId: insertionPoint.rootClientId,
57
66
  __experimentalInsertionIndex: insertionPoint.insertionIndex,
58
- __experimentalFilterValue: insertionPoint.filterValue
67
+ __experimentalFilterValue: insertionPoint.filterValue,
68
+ ref: libraryRef
59
69
  })));
60
70
  }
61
71
  //# sourceMappingURL=inserter-sidebar.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-site/src/components/secondary-sidebar/inserter-sidebar.js"],"names":["InserterSidebar","setIsInserterOpened","editSiteStore","insertionPoint","select","__experimentalGetInsertionPoint","isMobile","inserterDialogRef","inserterDialogProps","onClose","close","rootClientId","insertionIndex","filterValue"],"mappings":";;;;;;;;;;;;;AAGA;;AACA;;AACA;;AACA;;AACA;;AAQA;;AAfA;AACA;AACA;;AAUA;AACA;AACA;AAGe,SAASA,eAAT,GAA2B;AACzC,QAAM;AAAEC,IAAAA;AAAF,MAA0B,uBAAaC,YAAb,CAAhC;AACA,QAAMC,cAAc,GAAG,qBACpBC,MAAF,IAAcA,MAAM,CAAEF,YAAF,CAAN,CAAwBG,+BAAxB,EADQ,EAEtB,EAFsB,CAAvB;AAKA,QAAMC,QAAQ,GAAG,+BAAkB,QAAlB,EAA4B,GAA5B,CAAjB;AACA,QAAM,CAAEC,iBAAF,EAAqBC,mBAArB,IAA6C,sCAAW;AAC7DC,IAAAA,OAAO,EAAE,MAAMR,mBAAmB,CAAE,KAAF;AAD2B,GAAX,CAAnD;AAIA,SACC;AACC,IAAA,GAAG,EAAGM;AADP,KAEMC,mBAFN;AAGC,IAAA,SAAS,EAAC;AAHX,MAKC;AAAK,IAAA,SAAS,EAAC;AAAf,KACC,4BAAC,kBAAD;AACC,IAAA,IAAI,EAAGE,YADR;AAEC,IAAA,OAAO,EAAG,MAAMT,mBAAmB,CAAE,KAAF;AAFpC,IADD,CALD,EAWC;AAAK,IAAA,SAAS,EAAC;AAAf,KACC,4BAAC,kCAAD;AACC,IAAA,qBAAqB,MADtB;AAEC,IAAA,gBAAgB,EAAGK,QAFpB;AAGC,IAAA,YAAY,EAAGH,cAAc,CAACQ,YAH/B;AAIC,IAAA,4BAA4B,EAC3BR,cAAc,CAACS,cALjB;AAOC,IAAA,yBAAyB,EAAGT,cAAc,CAACU;AAP5C,IADD,CAXD,CADD;AAyBA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { Button } from '@wordpress/components';\nimport { __experimentalLibrary as Library } from '@wordpress/block-editor';\nimport { close } from '@wordpress/icons';\nimport {\n\tuseViewportMatch,\n\t__experimentalUseDialog as useDialog,\n} from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport { store as editSiteStore } from '../../store';\n\nexport default function InserterSidebar() {\n\tconst { setIsInserterOpened } = useDispatch( editSiteStore );\n\tconst insertionPoint = useSelect(\n\t\t( select ) => select( editSiteStore ).__experimentalGetInsertionPoint(),\n\t\t[]\n\t);\n\n\tconst isMobile = useViewportMatch( 'medium', '<' );\n\tconst [ inserterDialogRef, inserterDialogProps ] = useDialog( {\n\t\tonClose: () => setIsInserterOpened( false ),\n\t} );\n\n\treturn (\n\t\t<div\n\t\t\tref={ inserterDialogRef }\n\t\t\t{ ...inserterDialogProps }\n\t\t\tclassName=\"edit-site-editor__inserter-panel\"\n\t\t>\n\t\t\t<div className=\"edit-site-editor__inserter-panel-header\">\n\t\t\t\t<Button\n\t\t\t\t\ticon={ close }\n\t\t\t\t\tonClick={ () => setIsInserterOpened( false ) }\n\t\t\t\t/>\n\t\t\t</div>\n\t\t\t<div className=\"edit-site-editor__inserter-panel-content\">\n\t\t\t\t<Library\n\t\t\t\t\tshowInserterHelpPanel\n\t\t\t\t\tshouldFocusBlock={ isMobile }\n\t\t\t\t\trootClientId={ insertionPoint.rootClientId }\n\t\t\t\t\t__experimentalInsertionIndex={\n\t\t\t\t\t\tinsertionPoint.insertionIndex\n\t\t\t\t\t}\n\t\t\t\t\t__experimentalFilterValue={ insertionPoint.filterValue }\n\t\t\t\t/>\n\t\t\t</div>\n\t\t</div>\n\t);\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/edit-site/src/components/secondary-sidebar/inserter-sidebar.js"],"names":["InserterSidebar","setIsInserterOpened","editSiteStore","insertionPoint","select","__experimentalGetInsertionPoint","isMobile","TagName","VisuallyHidden","inserterDialogRef","inserterDialogProps","onClose","focusOnMount","libraryRef","current","focusSearch","close","rootClientId","insertionIndex","filterValue"],"mappings":";;;;;;;;;AAYA;;;;AATA;;AACA;;AACA;;AACA;;AACA;;AAIA;;AAMA;;AAjBA;AACA;AACA;;AAYA;AACA;AACA;AAGe,SAASA,eAAT,GAA2B;AACzC,QAAM;AAAEC,IAAAA;AAAF,MAA0B,uBAAaC,YAAb,CAAhC;AACA,QAAMC,cAAc,GAAG,qBACpBC,MAAF,IAAcA,MAAM,CAAEF,YAAF,CAAN,CAAwBG,+BAAxB,EADQ,EAEtB,EAFsB,CAAvB;AAKA,QAAMC,QAAQ,GAAG,+BAAkB,QAAlB,EAA4B,GAA5B,CAAjB;AACA,QAAMC,OAAO,GAAG,CAAED,QAAF,GAAaE,0BAAb,GAA8B,KAA9C;AACA,QAAM,CAAEC,iBAAF,EAAqBC,mBAArB,IAA6C,sCAAW;AAC7DC,IAAAA,OAAO,EAAE,MAAMV,mBAAmB,CAAE,KAAF,CAD2B;AAE7DW,IAAAA,YAAY,EAAE;AAF+C,GAAX,CAAnD;AAKA,QAAMC,UAAU,GAAG,sBAAnB;AACA,0BAAW,MAAM;AAChBA,IAAAA,UAAU,CAACC,OAAX,CAAmBC,WAAnB;AACA,GAFD,EAEG,EAFH;AAIA,SACC;AACC,IAAA,GAAG,EAAGN;AADP,KAEMC,mBAFN;AAGC,IAAA,SAAS,EAAC;AAHX,MAKC,4BAAC,OAAD;AAAS,IAAA,SAAS,EAAC;AAAnB,KACC,4BAAC,kBAAD;AACC,IAAA,IAAI,EAAGM,YADR;AAEC,IAAA,KAAK,EAAG,cAAI,sBAAJ,CAFT;AAGC,IAAA,OAAO,EAAG,MAAMf,mBAAmB,CAAE,KAAF;AAHpC,IADD,CALD,EAYC;AAAK,IAAA,SAAS,EAAC;AAAf,KACC,4BAAC,kCAAD;AACC,IAAA,qBAAqB,MADtB;AAEC,IAAA,gBAAgB,EAAGK,QAFpB;AAGC,IAAA,YAAY,EAAGH,cAAc,CAACc,YAH/B;AAIC,IAAA,4BAA4B,EAC3Bd,cAAc,CAACe,cALjB;AAOC,IAAA,yBAAyB,EAAGf,cAAc,CAACgB,WAP5C;AAQC,IAAA,GAAG,EAAGN;AARP,IADD,CAZD,CADD;AA2BA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { Button, VisuallyHidden } from '@wordpress/components';\nimport { __experimentalLibrary as Library } from '@wordpress/block-editor';\nimport { close } from '@wordpress/icons';\nimport {\n\tuseViewportMatch,\n\t__experimentalUseDialog as useDialog,\n} from '@wordpress/compose';\nimport { __ } from '@wordpress/i18n';\nimport { useEffect, useRef } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { store as editSiteStore } from '../../store';\n\nexport default function InserterSidebar() {\n\tconst { setIsInserterOpened } = useDispatch( editSiteStore );\n\tconst insertionPoint = useSelect(\n\t\t( select ) => select( editSiteStore ).__experimentalGetInsertionPoint(),\n\t\t[]\n\t);\n\n\tconst isMobile = useViewportMatch( 'medium', '<' );\n\tconst TagName = ! isMobile ? VisuallyHidden : 'div';\n\tconst [ inserterDialogRef, inserterDialogProps ] = useDialog( {\n\t\tonClose: () => setIsInserterOpened( false ),\n\t\tfocusOnMount: null,\n\t} );\n\n\tconst libraryRef = useRef();\n\tuseEffect( () => {\n\t\tlibraryRef.current.focusSearch();\n\t}, [] );\n\n\treturn (\n\t\t<div\n\t\t\tref={ inserterDialogRef }\n\t\t\t{ ...inserterDialogProps }\n\t\t\tclassName=\"edit-site-editor__inserter-panel\"\n\t\t>\n\t\t\t<TagName className=\"edit-site-editor__inserter-panel-header\">\n\t\t\t\t<Button\n\t\t\t\t\ticon={ close }\n\t\t\t\t\tlabel={ __( 'Close block inserter' ) }\n\t\t\t\t\tonClick={ () => setIsInserterOpened( false ) }\n\t\t\t\t/>\n\t\t\t</TagName>\n\t\t\t<div className=\"edit-site-editor__inserter-panel-content\">\n\t\t\t\t<Library\n\t\t\t\t\tshowInserterHelpPanel\n\t\t\t\t\tshouldFocusBlock={ isMobile }\n\t\t\t\t\trootClientId={ insertionPoint.rootClientId }\n\t\t\t\t\t__experimentalInsertionIndex={\n\t\t\t\t\t\tinsertionPoint.insertionIndex\n\t\t\t\t\t}\n\t\t\t\t\t__experimentalFilterValue={ insertionPoint.filterValue }\n\t\t\t\t\tref={ libraryRef }\n\t\t\t\t/>\n\t\t\t</div>\n\t\t</div>\n\t);\n}\n"]}
@@ -45,7 +45,8 @@ function ListViewSidebar() {
45
45
  }
46
46
 
47
47
  const focusOnMountRef = (0, _compose.useFocusOnMount)('firstElement');
48
- const focusReturnRef = (0, _compose.useFocusReturn)();
48
+ const headerFocusReturnRef = (0, _compose.useFocusReturn)();
49
+ const contentFocusReturnRef = (0, _compose.useFocusReturn)();
49
50
 
50
51
  function closeOnEscape(event) {
51
52
  if (event.keyCode === _keycodes.ESCAPE && !event.defaultPrevented) {
@@ -61,16 +62,17 @@ function ListViewSidebar() {
61
62
  className: "edit-site-editor__list-view-panel",
62
63
  onKeyDown: closeOnEscape
63
64
  }, (0, _element.createElement)("div", {
64
- className: "edit-site-editor__list-view-panel-header"
65
+ className: "edit-site-editor__list-view-panel-header",
66
+ ref: headerFocusReturnRef
65
67
  }, (0, _element.createElement)("strong", {
66
68
  id: labelId
67
- }, (0, _i18n.__)('List view')), (0, _element.createElement)(_components.Button, {
69
+ }, (0, _i18n.__)('List View')), (0, _element.createElement)(_components.Button, {
68
70
  icon: _icons.closeSmall,
69
- label: (0, _i18n.__)('Close list view sidebar'),
71
+ label: (0, _i18n.__)('Close List View Sidebar'),
70
72
  onClick: () => setIsListViewOpened(false)
71
73
  })), (0, _element.createElement)("div", {
72
74
  className: "edit-site-editor__list-view-panel-content",
73
- ref: (0, _compose.useMergeRefs)([focusReturnRef, focusOnMountRef])
75
+ ref: (0, _compose.useMergeRefs)([contentFocusReturnRef, focusOnMountRef])
74
76
  }, (0, _element.createElement)(_blockEditor.__experimentalListView, {
75
77
  onSelect: selectEditorBlock,
76
78
  showNestedBlocks: true,
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-site/src/components/secondary-sidebar/list-view-sidebar.js"],"names":["ListViewSidebar","setIsListViewOpened","editSiteStore","clearSelectedBlock","selectBlock","blockEditorStore","selectEditorBlock","clientId","focusOnMountRef","focusReturnRef","closeOnEscape","event","keyCode","ESCAPE","defaultPrevented","instanceId","labelId","closeSmall"],"mappings":";;;;;;;;;AAGA;;AAIA;;AACA;;AAMA;;AACA;;AACA;;AACA;;AAKA;;AAtBA;AACA;AACA;;AAiBA;AACA;AACA;AAGe,SAASA,eAAT,GAA2B;AACzC,QAAM;AAAEC,IAAAA;AAAF,MAA0B,uBAAaC,YAAb,CAAhC;AAEA,QAAM;AAAEC,IAAAA,kBAAF;AAAsBC,IAAAA;AAAtB,MAAsC,uBAAaC,kBAAb,CAA5C;;AACA,iBAAeC,iBAAf,CAAkCC,QAAlC,EAA6C;AAC5C,UAAMJ,kBAAkB,EAAxB;AACAC,IAAAA,WAAW,CAAEG,QAAF,EAAY,CAAC,CAAb,CAAX;AACA;;AAED,QAAMC,eAAe,GAAG,8BAAiB,cAAjB,CAAxB;AACA,QAAMC,cAAc,GAAG,8BAAvB;;AACA,WAASC,aAAT,CAAwBC,KAAxB,EAAgC;AAC/B,QAAKA,KAAK,CAACC,OAAN,KAAkBC,gBAAlB,IAA4B,CAAEF,KAAK,CAACG,gBAAzC,EAA4D;AAC3Db,MAAAA,mBAAmB,CAAE,KAAF,CAAnB;AACA;AACD;;AAED,QAAMc,UAAU,GAAG,4BAAef,eAAf,CAAnB;AACA,QAAMgB,OAAO,GAAI,2CAA2CD,UAAY,EAAxE;AAEA,SACC;AACA;AACC,yBAAkBC,OADnB;AAEC,MAAA,SAAS,EAAC,mCAFX;AAGC,MAAA,SAAS,EAAGN;AAHb,OAKC;AAAK,MAAA,SAAS,EAAC;AAAf,OACC;AAAQ,MAAA,EAAE,EAAGM;AAAb,OAAyB,cAAI,WAAJ,CAAzB,CADD,EAEC,4BAAC,kBAAD;AACC,MAAA,IAAI,EAAGC,iBADR;AAEC,MAAA,KAAK,EAAG,cAAI,yBAAJ,CAFT;AAGC,MAAA,OAAO,EAAG,MAAMhB,mBAAmB,CAAE,KAAF;AAHpC,MAFD,CALD,EAaC;AACC,MAAA,SAAS,EAAC,2CADX;AAEC,MAAA,GAAG,EAAG,2BAAc,CAAEQ,cAAF,EAAkBD,eAAlB,CAAd;AAFP,OAIC,4BAAC,mCAAD;AACC,MAAA,QAAQ,EAAGF,iBADZ;AAEC,MAAA,gBAAgB,MAFjB;AAGC,MAAA,sBAAsB,MAHvB;AAIC,MAAA,wCAAwC;AAJzC,MAJD,CAbD;AAFD;AA4BA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalListView as ListView,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { Button } from '@wordpress/components';\nimport {\n\tuseFocusOnMount,\n\tuseFocusReturn,\n\tuseInstanceId,\n\tuseMergeRefs,\n} from '@wordpress/compose';\nimport { useDispatch } from '@wordpress/data';\nimport { __ } from '@wordpress/i18n';\nimport { closeSmall } from '@wordpress/icons';\nimport { ESCAPE } from '@wordpress/keycodes';\n\n/**\n * Internal dependencies\n */\nimport { store as editSiteStore } from '../../store';\n\nexport default function ListViewSidebar() {\n\tconst { setIsListViewOpened } = useDispatch( editSiteStore );\n\n\tconst { clearSelectedBlock, selectBlock } = useDispatch( blockEditorStore );\n\tasync function selectEditorBlock( clientId ) {\n\t\tawait clearSelectedBlock();\n\t\tselectBlock( clientId, -1 );\n\t}\n\n\tconst focusOnMountRef = useFocusOnMount( 'firstElement' );\n\tconst focusReturnRef = useFocusReturn();\n\tfunction closeOnEscape( event ) {\n\t\tif ( event.keyCode === ESCAPE && ! event.defaultPrevented ) {\n\t\t\tsetIsListViewOpened( false );\n\t\t}\n\t}\n\n\tconst instanceId = useInstanceId( ListViewSidebar );\n\tconst labelId = `edit-site-editor__list-view-panel-label-${ instanceId }`;\n\n\treturn (\n\t\t// eslint-disable-next-line jsx-a11y/no-static-element-interactions\n\t\t<div\n\t\t\taria-labelledby={ labelId }\n\t\t\tclassName=\"edit-site-editor__list-view-panel\"\n\t\t\tonKeyDown={ closeOnEscape }\n\t\t>\n\t\t\t<div className=\"edit-site-editor__list-view-panel-header\">\n\t\t\t\t<strong id={ labelId }>{ __( 'List view' ) }</strong>\n\t\t\t\t<Button\n\t\t\t\t\ticon={ closeSmall }\n\t\t\t\t\tlabel={ __( 'Close list view sidebar' ) }\n\t\t\t\t\tonClick={ () => setIsListViewOpened( false ) }\n\t\t\t\t/>\n\t\t\t</div>\n\t\t\t<div\n\t\t\t\tclassName=\"edit-site-editor__list-view-panel-content\"\n\t\t\t\tref={ useMergeRefs( [ focusReturnRef, focusOnMountRef ] ) }\n\t\t\t>\n\t\t\t\t<ListView\n\t\t\t\t\tonSelect={ selectEditorBlock }\n\t\t\t\t\tshowNestedBlocks\n\t\t\t\t\t__experimentalFeatures\n\t\t\t\t\t__experimentalPersistentListViewFeatures\n\t\t\t\t/>\n\t\t\t</div>\n\t\t</div>\n\t);\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/edit-site/src/components/secondary-sidebar/list-view-sidebar.js"],"names":["ListViewSidebar","setIsListViewOpened","editSiteStore","clearSelectedBlock","selectBlock","blockEditorStore","selectEditorBlock","clientId","focusOnMountRef","headerFocusReturnRef","contentFocusReturnRef","closeOnEscape","event","keyCode","ESCAPE","defaultPrevented","instanceId","labelId","closeSmall"],"mappings":";;;;;;;;;AAGA;;AAIA;;AACA;;AAMA;;AACA;;AACA;;AACA;;AAKA;;AAtBA;AACA;AACA;;AAiBA;AACA;AACA;AAGe,SAASA,eAAT,GAA2B;AACzC,QAAM;AAAEC,IAAAA;AAAF,MAA0B,uBAAaC,YAAb,CAAhC;AAEA,QAAM;AAAEC,IAAAA,kBAAF;AAAsBC,IAAAA;AAAtB,MAAsC,uBAAaC,kBAAb,CAA5C;;AACA,iBAAeC,iBAAf,CAAkCC,QAAlC,EAA6C;AAC5C,UAAMJ,kBAAkB,EAAxB;AACAC,IAAAA,WAAW,CAAEG,QAAF,EAAY,CAAC,CAAb,CAAX;AACA;;AAED,QAAMC,eAAe,GAAG,8BAAiB,cAAjB,CAAxB;AACA,QAAMC,oBAAoB,GAAG,8BAA7B;AACA,QAAMC,qBAAqB,GAAG,8BAA9B;;AACA,WAASC,aAAT,CAAwBC,KAAxB,EAAgC;AAC/B,QAAKA,KAAK,CAACC,OAAN,KAAkBC,gBAAlB,IAA4B,CAAEF,KAAK,CAACG,gBAAzC,EAA4D;AAC3Dd,MAAAA,mBAAmB,CAAE,KAAF,CAAnB;AACA;AACD;;AAED,QAAMe,UAAU,GAAG,4BAAehB,eAAf,CAAnB;AACA,QAAMiB,OAAO,GAAI,2CAA2CD,UAAY,EAAxE;AAEA,SACC;AACA;AACC,yBAAkBC,OADnB;AAEC,MAAA,SAAS,EAAC,mCAFX;AAGC,MAAA,SAAS,EAAGN;AAHb,OAKC;AACC,MAAA,SAAS,EAAC,0CADX;AAEC,MAAA,GAAG,EAAGF;AAFP,OAIC;AAAQ,MAAA,EAAE,EAAGQ;AAAb,OAAyB,cAAI,WAAJ,CAAzB,CAJD,EAKC,4BAAC,kBAAD;AACC,MAAA,IAAI,EAAGC,iBADR;AAEC,MAAA,KAAK,EAAG,cAAI,yBAAJ,CAFT;AAGC,MAAA,OAAO,EAAG,MAAMjB,mBAAmB,CAAE,KAAF;AAHpC,MALD,CALD,EAgBC;AACC,MAAA,SAAS,EAAC,2CADX;AAEC,MAAA,GAAG,EAAG,2BAAc,CACnBS,qBADmB,EAEnBF,eAFmB,CAAd;AAFP,OAOC,4BAAC,mCAAD;AACC,MAAA,QAAQ,EAAGF,iBADZ;AAEC,MAAA,gBAAgB,MAFjB;AAGC,MAAA,sBAAsB,MAHvB;AAIC,MAAA,wCAAwC;AAJzC,MAPD,CAhBD;AAFD;AAkCA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalListView as ListView,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { Button } from '@wordpress/components';\nimport {\n\tuseFocusOnMount,\n\tuseFocusReturn,\n\tuseInstanceId,\n\tuseMergeRefs,\n} from '@wordpress/compose';\nimport { useDispatch } from '@wordpress/data';\nimport { __ } from '@wordpress/i18n';\nimport { closeSmall } from '@wordpress/icons';\nimport { ESCAPE } from '@wordpress/keycodes';\n\n/**\n * Internal dependencies\n */\nimport { store as editSiteStore } from '../../store';\n\nexport default function ListViewSidebar() {\n\tconst { setIsListViewOpened } = useDispatch( editSiteStore );\n\n\tconst { clearSelectedBlock, selectBlock } = useDispatch( blockEditorStore );\n\tasync function selectEditorBlock( clientId ) {\n\t\tawait clearSelectedBlock();\n\t\tselectBlock( clientId, -1 );\n\t}\n\n\tconst focusOnMountRef = useFocusOnMount( 'firstElement' );\n\tconst headerFocusReturnRef = useFocusReturn();\n\tconst contentFocusReturnRef = useFocusReturn();\n\tfunction closeOnEscape( event ) {\n\t\tif ( event.keyCode === ESCAPE && ! event.defaultPrevented ) {\n\t\t\tsetIsListViewOpened( false );\n\t\t}\n\t}\n\n\tconst instanceId = useInstanceId( ListViewSidebar );\n\tconst labelId = `edit-site-editor__list-view-panel-label-${ instanceId }`;\n\n\treturn (\n\t\t// eslint-disable-next-line jsx-a11y/no-static-element-interactions\n\t\t<div\n\t\t\taria-labelledby={ labelId }\n\t\t\tclassName=\"edit-site-editor__list-view-panel\"\n\t\t\tonKeyDown={ closeOnEscape }\n\t\t>\n\t\t\t<div\n\t\t\t\tclassName=\"edit-site-editor__list-view-panel-header\"\n\t\t\t\tref={ headerFocusReturnRef }\n\t\t\t>\n\t\t\t\t<strong id={ labelId }>{ __( 'List View' ) }</strong>\n\t\t\t\t<Button\n\t\t\t\t\ticon={ closeSmall }\n\t\t\t\t\tlabel={ __( 'Close List View Sidebar' ) }\n\t\t\t\t\tonClick={ () => setIsListViewOpened( false ) }\n\t\t\t\t/>\n\t\t\t</div>\n\t\t\t<div\n\t\t\t\tclassName=\"edit-site-editor__list-view-panel-content\"\n\t\t\t\tref={ useMergeRefs( [\n\t\t\t\t\tcontentFocusReturnRef,\n\t\t\t\t\tfocusOnMountRef,\n\t\t\t\t] ) }\n\t\t\t>\n\t\t\t\t<ListView\n\t\t\t\t\tonSelect={ selectEditorBlock }\n\t\t\t\t\tshowNestedBlocks\n\t\t\t\t\t__experimentalFeatures\n\t\t\t\t\t__experimentalPersistentListViewFeatures\n\t\t\t\t/>\n\t\t\t</div>\n\t\t</div>\n\t);\n}\n"]}
@@ -21,7 +21,8 @@ function DefaultSidebar(_ref) {
21
21
  children,
22
22
  closeLabel,
23
23
  header,
24
- headerClassName
24
+ headerClassName,
25
+ panelClassName
25
26
  } = _ref;
26
27
  return (0, _element.createElement)(_element.Fragment, null, (0, _element.createElement)(_interface.ComplementaryArea, {
27
28
  className: className,
@@ -31,7 +32,8 @@ function DefaultSidebar(_ref) {
31
32
  icon: icon,
32
33
  closeLabel: closeLabel,
33
34
  header: header,
34
- headerClassName: headerClassName
35
+ headerClassName: headerClassName,
36
+ panelClassName: panelClassName
35
37
  }, children), (0, _element.createElement)(_interface.ComplementaryAreaMoreMenuItem, {
36
38
  scope: "core/edit-site",
37
39
  identifier: identifier,
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-site/src/components/sidebar/default-sidebar.js"],"names":["DefaultSidebar","className","identifier","title","icon","children","closeLabel","header","headerClassName"],"mappings":";;;;;;;;;AAGA;;AAHA;AACA;AACA;AAMe,SAASA,cAAT,OASX;AAAA,MAToC;AACvCC,IAAAA,SADuC;AAEvCC,IAAAA,UAFuC;AAGvCC,IAAAA,KAHuC;AAIvCC,IAAAA,IAJuC;AAKvCC,IAAAA,QALuC;AAMvCC,IAAAA,UANuC;AAOvCC,IAAAA,MAPuC;AAQvCC,IAAAA;AARuC,GASpC;AACH,SACC,qDACC,4BAAC,4BAAD;AACC,IAAA,SAAS,EAAGP,SADb;AAEC,IAAA,KAAK,EAAC,gBAFP;AAGC,IAAA,UAAU,EAAGC,UAHd;AAIC,IAAA,KAAK,EAAGC,KAJT;AAKC,IAAA,IAAI,EAAGC,IALR;AAMC,IAAA,UAAU,EAAGE,UANd;AAOC,IAAA,MAAM,EAAGC,MAPV;AAQC,IAAA,eAAe,EAAGC;AARnB,KAUGH,QAVH,CADD,EAaC,4BAAC,wCAAD;AACC,IAAA,KAAK,EAAC,gBADP;AAEC,IAAA,UAAU,EAAGH,UAFd;AAGC,IAAA,IAAI,EAAGE;AAHR,KAKGD,KALH,CAbD,CADD;AAuBA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tComplementaryArea,\n\tComplementaryAreaMoreMenuItem,\n} from '@wordpress/interface';\n\nexport default function DefaultSidebar( {\n\tclassName,\n\tidentifier,\n\ttitle,\n\ticon,\n\tchildren,\n\tcloseLabel,\n\theader,\n\theaderClassName,\n} ) {\n\treturn (\n\t\t<>\n\t\t\t<ComplementaryArea\n\t\t\t\tclassName={ className }\n\t\t\t\tscope=\"core/edit-site\"\n\t\t\t\tidentifier={ identifier }\n\t\t\t\ttitle={ title }\n\t\t\t\ticon={ icon }\n\t\t\t\tcloseLabel={ closeLabel }\n\t\t\t\theader={ header }\n\t\t\t\theaderClassName={ headerClassName }\n\t\t\t>\n\t\t\t\t{ children }\n\t\t\t</ComplementaryArea>\n\t\t\t<ComplementaryAreaMoreMenuItem\n\t\t\t\tscope=\"core/edit-site\"\n\t\t\t\tidentifier={ identifier }\n\t\t\t\ticon={ icon }\n\t\t\t>\n\t\t\t\t{ title }\n\t\t\t</ComplementaryAreaMoreMenuItem>\n\t\t</>\n\t);\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/edit-site/src/components/sidebar/default-sidebar.js"],"names":["DefaultSidebar","className","identifier","title","icon","children","closeLabel","header","headerClassName","panelClassName"],"mappings":";;;;;;;;;AAGA;;AAHA;AACA;AACA;AAMe,SAASA,cAAT,OAUX;AAAA,MAVoC;AACvCC,IAAAA,SADuC;AAEvCC,IAAAA,UAFuC;AAGvCC,IAAAA,KAHuC;AAIvCC,IAAAA,IAJuC;AAKvCC,IAAAA,QALuC;AAMvCC,IAAAA,UANuC;AAOvCC,IAAAA,MAPuC;AAQvCC,IAAAA,eARuC;AASvCC,IAAAA;AATuC,GAUpC;AACH,SACC,qDACC,4BAAC,4BAAD;AACC,IAAA,SAAS,EAAGR,SADb;AAEC,IAAA,KAAK,EAAC,gBAFP;AAGC,IAAA,UAAU,EAAGC,UAHd;AAIC,IAAA,KAAK,EAAGC,KAJT;AAKC,IAAA,IAAI,EAAGC,IALR;AAMC,IAAA,UAAU,EAAGE,UANd;AAOC,IAAA,MAAM,EAAGC,MAPV;AAQC,IAAA,eAAe,EAAGC,eARnB;AASC,IAAA,cAAc,EAAGC;AATlB,KAWGJ,QAXH,CADD,EAcC,4BAAC,wCAAD;AACC,IAAA,KAAK,EAAC,gBADP;AAEC,IAAA,UAAU,EAAGH,UAFd;AAGC,IAAA,IAAI,EAAGE;AAHR,KAKGD,KALH,CAdD,CADD;AAwBA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tComplementaryArea,\n\tComplementaryAreaMoreMenuItem,\n} from '@wordpress/interface';\n\nexport default function DefaultSidebar( {\n\tclassName,\n\tidentifier,\n\ttitle,\n\ticon,\n\tchildren,\n\tcloseLabel,\n\theader,\n\theaderClassName,\n\tpanelClassName,\n} ) {\n\treturn (\n\t\t<>\n\t\t\t<ComplementaryArea\n\t\t\t\tclassName={ className }\n\t\t\t\tscope=\"core/edit-site\"\n\t\t\t\tidentifier={ identifier }\n\t\t\t\ttitle={ title }\n\t\t\t\ticon={ icon }\n\t\t\t\tcloseLabel={ closeLabel }\n\t\t\t\theader={ header }\n\t\t\t\theaderClassName={ headerClassName }\n\t\t\t\tpanelClassName={ panelClassName }\n\t\t\t>\n\t\t\t\t{ children }\n\t\t\t</ComplementaryArea>\n\t\t\t<ComplementaryAreaMoreMenuItem\n\t\t\t\tscope=\"core/edit-site\"\n\t\t\t\tidentifier={ identifier }\n\t\t\t\ticon={ icon }\n\t\t\t>\n\t\t\t\t{ title }\n\t\t\t</ComplementaryAreaMoreMenuItem>\n\t\t</>\n\t);\n}\n"]}
@@ -41,6 +41,7 @@ function GlobalStylesSidebar() {
41
41
  title: (0, _i18n.__)('Styles'),
42
42
  icon: _icons.styles,
43
43
  closeLabel: (0, _i18n.__)('Close global styles sidebar'),
44
+ panelClassName: "edit-site-global-styles-sidebar__panel",
44
45
  header: (0, _element.createElement)(_components.Flex, null, (0, _element.createElement)(_components.FlexBlock, null, (0, _element.createElement)("strong", null, (0, _i18n.__)('Styles')), (0, _element.createElement)("span", {
45
46
  className: "edit-site-global-styles-sidebar__beta"
46
47
  }, (0, _i18n.__)('Beta'))), (0, _element.createElement)(_components.FlexItem, null, (0, _element.createElement)(_components.DropdownMenu, {
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-site/src/components/sidebar/global-styles-sidebar.js"],"names":["GlobalStylesSidebar","canReset","onReset","toggleFeature","editSiteStore","styles","moreVertical","disabled","title","onClick"],"mappings":";;;;;;;;;;;AAGA;;AACA;;AACA;;AACA;;AAKA;;AACA;;AACA;;AAbA;AACA;AACA;;AAMA;AACA;AACA;AAKe,SAASA,mBAAT,GAA+B;AAC7C,QAAM,CAAEC,QAAF,EAAYC,OAAZ,IAAwB,yCAA9B;AACA,QAAM;AAAEC,IAAAA;AAAF,MAAoB,uBAAaC,YAAb,CAA1B;AAEA,SACC,4BAAC,uBAAD;AACC,IAAA,SAAS,EAAC,iCADX;AAEC,IAAA,UAAU,EAAC,yBAFZ;AAGC,IAAA,KAAK,EAAG,cAAI,QAAJ,CAHT;AAIC,IAAA,IAAI,EAAGC,aAJR;AAKC,IAAA,UAAU,EAAG,cAAI,6BAAJ,CALd;AAMC,IAAA,MAAM,EACL,4BAAC,gBAAD,QACC,4BAAC,qBAAD,QACC,4CAAU,cAAI,QAAJ,CAAV,CADD,EAEC;AAAM,MAAA,SAAS,EAAC;AAAhB,OACG,cAAI,MAAJ,CADH,CAFD,CADD,EAOC,4BAAC,oBAAD,QACC,4BAAC,wBAAD;AACC,MAAA,IAAI,EAAGC,mBADR;AAEC,MAAA,KAAK,EAAG,cAAI,4BAAJ,CAFT;AAGC,MAAA,WAAW,EAAG;AAAEC,QAAAA,QAAQ,EAAE,CAAEN;AAAd,OAHf;AAIC,MAAA,QAAQ,EAAG,CACV;AACCO,QAAAA,KAAK,EAAE,cAAI,mBAAJ,CADR;AAECC,QAAAA,OAAO,EAAEP;AAFV,OADU,EAKV;AACCM,QAAAA,KAAK,EAAE,cAAI,eAAJ,CADR;AAECC,QAAAA,OAAO,EAAE,MACRN,aAAa,CAAE,oBAAF;AAHf,OALU;AAJZ,MADD,CAPD;AAPF,KAmCC,4BAAC,4BAAD,OAnCD,CADD;AAuCA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { DropdownMenu, FlexItem, FlexBlock, Flex } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { styles, moreVertical } from '@wordpress/icons';\nimport { useDispatch } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport DefaultSidebar from './default-sidebar';\nimport { GlobalStylesUI, useGlobalStylesReset } from '../global-styles';\nimport { store as editSiteStore } from '../../store';\n\nexport default function GlobalStylesSidebar() {\n\tconst [ canReset, onReset ] = useGlobalStylesReset();\n\tconst { toggleFeature } = useDispatch( editSiteStore );\n\n\treturn (\n\t\t<DefaultSidebar\n\t\t\tclassName=\"edit-site-global-styles-sidebar\"\n\t\t\tidentifier=\"edit-site/global-styles\"\n\t\t\ttitle={ __( 'Styles' ) }\n\t\t\ticon={ styles }\n\t\t\tcloseLabel={ __( 'Close global styles sidebar' ) }\n\t\t\theader={\n\t\t\t\t<Flex>\n\t\t\t\t\t<FlexBlock>\n\t\t\t\t\t\t<strong>{ __( 'Styles' ) }</strong>\n\t\t\t\t\t\t<span className=\"edit-site-global-styles-sidebar__beta\">\n\t\t\t\t\t\t\t{ __( 'Beta' ) }\n\t\t\t\t\t\t</span>\n\t\t\t\t\t</FlexBlock>\n\t\t\t\t\t<FlexItem>\n\t\t\t\t\t\t<DropdownMenu\n\t\t\t\t\t\t\ticon={ moreVertical }\n\t\t\t\t\t\t\tlabel={ __( 'More Global Styles Actions' ) }\n\t\t\t\t\t\t\ttoggleProps={ { disabled: ! canReset } }\n\t\t\t\t\t\t\tcontrols={ [\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\ttitle: __( 'Reset to defaults' ),\n\t\t\t\t\t\t\t\t\tonClick: onReset,\n\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\ttitle: __( 'Welcome Guide' ),\n\t\t\t\t\t\t\t\t\tonClick: () =>\n\t\t\t\t\t\t\t\t\t\ttoggleFeature( 'welcomeGuideStyles' ),\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t] }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</FlexItem>\n\t\t\t\t</Flex>\n\t\t\t}\n\t\t>\n\t\t\t<GlobalStylesUI />\n\t\t</DefaultSidebar>\n\t);\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/edit-site/src/components/sidebar/global-styles-sidebar.js"],"names":["GlobalStylesSidebar","canReset","onReset","toggleFeature","editSiteStore","styles","moreVertical","disabled","title","onClick"],"mappings":";;;;;;;;;;;AAGA;;AACA;;AACA;;AACA;;AAKA;;AACA;;AACA;;AAbA;AACA;AACA;;AAMA;AACA;AACA;AAKe,SAASA,mBAAT,GAA+B;AAC7C,QAAM,CAAEC,QAAF,EAAYC,OAAZ,IAAwB,yCAA9B;AACA,QAAM;AAAEC,IAAAA;AAAF,MAAoB,uBAAaC,YAAb,CAA1B;AAEA,SACC,4BAAC,uBAAD;AACC,IAAA,SAAS,EAAC,iCADX;AAEC,IAAA,UAAU,EAAC,yBAFZ;AAGC,IAAA,KAAK,EAAG,cAAI,QAAJ,CAHT;AAIC,IAAA,IAAI,EAAGC,aAJR;AAKC,IAAA,UAAU,EAAG,cAAI,6BAAJ,CALd;AAMC,IAAA,cAAc,EAAC,wCANhB;AAOC,IAAA,MAAM,EACL,4BAAC,gBAAD,QACC,4BAAC,qBAAD,QACC,4CAAU,cAAI,QAAJ,CAAV,CADD,EAEC;AAAM,MAAA,SAAS,EAAC;AAAhB,OACG,cAAI,MAAJ,CADH,CAFD,CADD,EAOC,4BAAC,oBAAD,QACC,4BAAC,wBAAD;AACC,MAAA,IAAI,EAAGC,mBADR;AAEC,MAAA,KAAK,EAAG,cAAI,4BAAJ,CAFT;AAGC,MAAA,WAAW,EAAG;AAAEC,QAAAA,QAAQ,EAAE,CAAEN;AAAd,OAHf;AAIC,MAAA,QAAQ,EAAG,CACV;AACCO,QAAAA,KAAK,EAAE,cAAI,mBAAJ,CADR;AAECC,QAAAA,OAAO,EAAEP;AAFV,OADU,EAKV;AACCM,QAAAA,KAAK,EAAE,cAAI,eAAJ,CADR;AAECC,QAAAA,OAAO,EAAE,MACRN,aAAa,CAAE,oBAAF;AAHf,OALU;AAJZ,MADD,CAPD;AARF,KAoCC,4BAAC,4BAAD,OApCD,CADD;AAwCA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { DropdownMenu, FlexItem, FlexBlock, Flex } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { styles, moreVertical } from '@wordpress/icons';\nimport { useDispatch } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport DefaultSidebar from './default-sidebar';\nimport { GlobalStylesUI, useGlobalStylesReset } from '../global-styles';\nimport { store as editSiteStore } from '../../store';\n\nexport default function GlobalStylesSidebar() {\n\tconst [ canReset, onReset ] = useGlobalStylesReset();\n\tconst { toggleFeature } = useDispatch( editSiteStore );\n\n\treturn (\n\t\t<DefaultSidebar\n\t\t\tclassName=\"edit-site-global-styles-sidebar\"\n\t\t\tidentifier=\"edit-site/global-styles\"\n\t\t\ttitle={ __( 'Styles' ) }\n\t\t\ticon={ styles }\n\t\t\tcloseLabel={ __( 'Close global styles sidebar' ) }\n\t\t\tpanelClassName=\"edit-site-global-styles-sidebar__panel\"\n\t\t\theader={\n\t\t\t\t<Flex>\n\t\t\t\t\t<FlexBlock>\n\t\t\t\t\t\t<strong>{ __( 'Styles' ) }</strong>\n\t\t\t\t\t\t<span className=\"edit-site-global-styles-sidebar__beta\">\n\t\t\t\t\t\t\t{ __( 'Beta' ) }\n\t\t\t\t\t\t</span>\n\t\t\t\t\t</FlexBlock>\n\t\t\t\t\t<FlexItem>\n\t\t\t\t\t\t<DropdownMenu\n\t\t\t\t\t\t\ticon={ moreVertical }\n\t\t\t\t\t\t\tlabel={ __( 'More Global Styles Actions' ) }\n\t\t\t\t\t\t\ttoggleProps={ { disabled: ! canReset } }\n\t\t\t\t\t\t\tcontrols={ [\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\ttitle: __( 'Reset to defaults' ),\n\t\t\t\t\t\t\t\t\tonClick: onReset,\n\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\ttitle: __( 'Welcome Guide' ),\n\t\t\t\t\t\t\t\t\tonClick: () =>\n\t\t\t\t\t\t\t\t\t\ttoggleFeature( 'welcomeGuideStyles' ),\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t] }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</FlexItem>\n\t\t\t\t</Flex>\n\t\t\t}\n\t\t>\n\t\t\t<GlobalStylesUI />\n\t\t</DefaultSidebar>\n\t);\n}\n"]}
@@ -24,25 +24,16 @@ function URLQueryController() {
24
24
  const {
25
25
  setTemplate,
26
26
  setTemplatePart,
27
- showHomepage,
28
27
  setPage
29
28
  } = (0, _data.useDispatch)(_store.store);
30
- const history = (0, _routes.useHistory)();
31
29
  const {
32
30
  params: {
33
31
  postId,
34
32
  postType
35
33
  }
36
- } = (0, _routes.useLocation)();
37
- const {
38
- getPage,
39
- getEditedPostId,
40
- getEditedPostType
41
- } = (0, _data.useSelect)(_store.store); // Set correct entity on page navigation.
34
+ } = (0, _routes.useLocation)(); // Set correct entity on page navigation.
42
35
 
43
36
  (0, _element.useEffect)(() => {
44
- let isMounted = true;
45
-
46
37
  if ('page' === postType || 'post' === postType) {
47
38
  setPage({
48
39
  context: {
@@ -54,35 +45,7 @@ function URLQueryController() {
54
45
  setTemplate(postId);
55
46
  } else if ('wp_template_part' === postType) {
56
47
  setTemplatePart(postId);
57
- } else {
58
- showHomepage().then(() => {
59
- var _page$context, _page$context2;
60
-
61
- if (!isMounted) {
62
- return;
63
- }
64
-
65
- const page = getPage();
66
- const editedPostId = getEditedPostId();
67
- const editedPostType = getEditedPostType();
68
-
69
- 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) {
70
- history.replace({
71
- postId: page.context.postId,
72
- postType: page.context.postType
73
- });
74
- } else if (editedPostId && editedPostType) {
75
- history.replace({
76
- postId: editedPostId,
77
- postType: editedPostType
78
- });
79
- }
80
- });
81
48
  }
82
-
83
- return () => {
84
- isMounted = false;
85
- };
86
49
  }, [postId, postType]);
87
50
  return null;
88
51
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-site/src/components/url-query-controller/index.js"],"names":["URLQueryController","setTemplate","setTemplatePart","showHomepage","setPage","editSiteStore","history","params","postId","postType","getPage","getEditedPostId","getEditedPostType","isMounted","context","then","page","editedPostId","editedPostType","replace"],"mappings":";;;;;;;AAGA;;AACA;;AAKA;;AACA;;AAVA;AACA;AACA;;AAIA;AACA;AACA;AAIe,SAASA,kBAAT,GAA8B;AAC5C,QAAM;AAAEC,IAAAA,WAAF;AAAeC,IAAAA,eAAf;AAAgCC,IAAAA,YAAhC;AAA8CC,IAAAA;AAA9C,MAA0D,uBAC/DC,YAD+D,CAAhE;AAGA,QAAMC,OAAO,GAAG,yBAAhB;AACA,QAAM;AACLC,IAAAA,MAAM,EAAE;AAAEC,MAAAA,MAAF;AAAUC,MAAAA;AAAV;AADH,MAEF,0BAFJ;AAGA,QAAM;AAAEC,IAAAA,OAAF;AAAWC,IAAAA,eAAX;AAA4BC,IAAAA;AAA5B,MAAkD,qBACvDP,YADuD,CAAxD,CAR4C,CAY5C;;AACA,0BAAW,MAAM;AAChB,QAAIQ,SAAS,GAAG,IAAhB;;AAEA,QAAK,WAAWJ,QAAX,IAAuB,WAAWA,QAAvC,EAAkD;AACjDL,MAAAA,OAAO,CAAE;AAAEU,QAAAA,OAAO,EAAE;AAAEL,UAAAA,QAAF;AAAYD,UAAAA;AAAZ;AAAX,OAAF,CAAP,CADiD,CACH;AAC9C,KAFD,MAEO,IAAK,kBAAkBC,QAAvB,EAAkC;AACxCR,MAAAA,WAAW,CAAEO,MAAF,CAAX;AACA,KAFM,MAEA,IAAK,uBAAuBC,QAA5B,EAAuC;AAC7CP,MAAAA,eAAe,CAAEM,MAAF,CAAf;AACA,KAFM,MAEA;AACNL,MAAAA,YAAY,GAAGY,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,GApCD,EAoCG,CAAEL,MAAF,EAAUC,QAAV,CApCH;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"]}
1
+ {"version":3,"sources":["@wordpress/edit-site/src/components/url-query-controller/index.js"],"names":["URLQueryController","setTemplate","setTemplatePart","setPage","editSiteStore","params","postId","postType","context"],"mappings":";;;;;;;AAGA;;AACA;;AAKA;;AACA;;AAVA;AACA;AACA;;AAIA;AACA;AACA;AAIe,SAASA,kBAAT,GAA8B;AAC5C,QAAM;AAAEC,IAAAA,WAAF;AAAeC,IAAAA,eAAf;AAAgCC,IAAAA;AAAhC,MAA4C,uBACjDC,YADiD,CAAlD;AAGA,QAAM;AACLC,IAAAA,MAAM,EAAE;AAAEC,MAAAA,MAAF;AAAUC,MAAAA;AAAV;AADH,MAEF,0BAFJ,CAJ4C,CAQ5C;;AACA,0BAAW,MAAM;AAChB,QAAK,WAAWA,QAAX,IAAuB,WAAWA,QAAvC,EAAkD;AACjDJ,MAAAA,OAAO,CAAE;AAAEK,QAAAA,OAAO,EAAE;AAAED,UAAAA,QAAF;AAAYD,UAAAA;AAAZ;AAAX,OAAF,CAAP,CADiD,CACH;AAC9C,KAFD,MAEO,IAAK,kBAAkBC,QAAvB,EAAkC;AACxCN,MAAAA,WAAW,CAAEK,MAAF,CAAX;AACA,KAFM,MAEA,IAAK,uBAAuBC,QAA5B,EAAuC;AAC7CL,MAAAA,eAAe,CAAEI,MAAF,CAAf;AACA;AACD,GARD,EAQG,CAAEA,MAAF,EAAUC,QAAV,CARH;AAUA,SAAO,IAAP;AACA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useEffect } from '@wordpress/element';\nimport { useDispatch } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { useLocation } from '../routes';\nimport { store as editSiteStore } from '../../store';\n\nexport default function URLQueryController() {\n\tconst { setTemplate, setTemplatePart, setPage } = useDispatch(\n\t\teditSiteStore\n\t);\n\tconst {\n\t\tparams: { postId, postType },\n\t} = useLocation();\n\n\t// Set correct entity on page navigation.\n\tuseEffect( () => {\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}\n\t}, [ postId, postType ] );\n\n\treturn null;\n}\n"]}
package/build/index.js CHANGED
@@ -54,8 +54,6 @@ var _viewport = require("@wordpress/viewport");
54
54
 
55
55
  var _url = require("@wordpress/url");
56
56
 
57
- require("./plugins");
58
-
59
57
  require("./hooks");
60
58
 
61
59
  var _store = require("./store");
@@ -64,6 +62,8 @@ var _app = _interopRequireDefault(require("./components/app"));
64
62
 
65
63
  var _getIsListPage = _interopRequireDefault(require("./utils/get-is-list-page"));
66
64
 
65
+ var _redirectToHomepage = _interopRequireDefault(require("./components/routes/redirect-to-homepage"));
66
+
67
67
  var _mainDashboardButton = _interopRequireDefault(require("./components/main-dashboard-button"));
68
68
 
69
69
  var _navigationToggle = _interopRequireDefault(require("./components/navigation-sidebar/navigation-toggle"));
@@ -90,8 +90,13 @@ var _pluginMoreMenuItem = _interopRequireDefault(require("./components/header/pl
90
90
  * @param {Element} target DOM node in which editor is rendered.
91
91
  * @param {?Object} settings Editor settings object.
92
92
  */
93
- function reinitializeEditor(target, settings) {
94
- // This will be a no-op if the target doesn't have any React nodes.
93
+ async function reinitializeEditor(target, settings) {
94
+ // The site editor relies on `postType` and `postId` params in the URL to
95
+ // define what's being edited. When visiting via the dashboard link, these
96
+ // won't be present. Do a client side redirect to the 'homepage' if that's
97
+ // the case.
98
+ await (0, _redirectToHomepage.default)(settings.siteUrl); // This will be a no-op if the target doesn't have any React nodes.
99
+
95
100
  (0, _element.unmountComponentAtNode)(target);
96
101
  const reboot = reinitializeEditor.bind(null, target, settings); // We dispatch actions and update the store synchronously before rendering
97
102
  // so that we won't trigger unnecessary re-renders with useEffect.