@wordpress/editor 13.33.0 → 13.35.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 (494) hide show
  1. package/CHANGELOG.md +12 -4
  2. package/README.md +132 -20
  3. package/build/bindings/pattern-overrides.js +70 -1
  4. package/build/bindings/pattern-overrides.js.map +1 -1
  5. package/build/components/autosave-monitor/index.js +15 -12
  6. package/build/components/autosave-monitor/index.js.map +1 -1
  7. package/build/components/block-settings-menu/content-only-settings-menu.js +126 -0
  8. package/build/components/block-settings-menu/content-only-settings-menu.js.map +1 -0
  9. package/build/components/block-settings-menu/content-only-settings-menu.native.js +11 -0
  10. package/build/components/block-settings-menu/content-only-settings-menu.native.js.map +1 -0
  11. package/build/components/character-count/index.js +5 -0
  12. package/build/components/character-count/index.js.map +1 -1
  13. package/build/components/collapsible-block-toolbar/index.js +73 -0
  14. package/build/components/collapsible-block-toolbar/index.js.map +1 -0
  15. package/build/components/document-bar/index.js +2 -2
  16. package/build/components/document-bar/index.js.map +1 -1
  17. package/build/components/document-outline/check.js +8 -0
  18. package/build/components/document-outline/check.js.map +1 -1
  19. package/build/components/document-outline/index.js +11 -0
  20. package/build/components/document-outline/index.js.map +1 -1
  21. package/build/components/document-outline/item.js +2 -2
  22. package/build/components/document-outline/item.js.map +1 -1
  23. package/build/components/document-tools/index.js +15 -25
  24. package/build/components/document-tools/index.js.map +1 -1
  25. package/build/components/editor-canvas/edit-template-blocks-notification.js +1 -1
  26. package/build/components/editor-canvas/edit-template-blocks-notification.js.map +1 -1
  27. package/build/components/editor-canvas/index.js +19 -8
  28. package/build/components/editor-canvas/index.js.map +1 -1
  29. package/build/components/editor-history/redo.js +11 -0
  30. package/build/components/editor-history/redo.js.map +1 -1
  31. package/build/components/editor-history/undo.js +11 -0
  32. package/build/components/editor-history/undo.js.map +1 -1
  33. package/build/components/editor-snackbars/index.js +6 -0
  34. package/build/components/editor-snackbars/index.js.map +1 -1
  35. package/build/components/global-keyboard-shortcuts/index.js +7 -0
  36. package/build/components/global-keyboard-shortcuts/index.js.map +1 -1
  37. package/build/components/global-keyboard-shortcuts/register-shortcuts.js +35 -1
  38. package/build/components/global-keyboard-shortcuts/register-shortcuts.js.map +1 -1
  39. package/build/components/global-styles-provider/index.js +130 -0
  40. package/build/components/global-styles-provider/index.js.map +1 -0
  41. package/build/components/header/index.js +147 -0
  42. package/build/components/header/index.js.map +1 -0
  43. package/build/components/inserter-sidebar/index.js +56 -34
  44. package/build/components/inserter-sidebar/index.js.map +1 -1
  45. package/build/components/keyboard-shortcut-help-modal/config.js +4 -0
  46. package/build/components/keyboard-shortcut-help-modal/config.js.map +1 -1
  47. package/build/components/keyboard-shortcut-help-modal/index.js +2 -2
  48. package/build/components/keyboard-shortcut-help-modal/index.js.map +1 -1
  49. package/build/components/list-view-sidebar/index.js +1 -1
  50. package/build/components/list-view-sidebar/index.js.map +1 -1
  51. package/build/components/more-menu/copy-content-menu-item.js +59 -0
  52. package/build/components/more-menu/copy-content-menu-item.js.map +1 -0
  53. package/build/components/more-menu/index.js +119 -0
  54. package/build/components/more-menu/index.js.map +1 -0
  55. package/build/components/more-menu/tools-more-menu-group.js +23 -0
  56. package/build/components/more-menu/tools-more-menu-group.js.map +1 -0
  57. package/build/components/more-menu/view-more-menu-group.js +24 -0
  58. package/build/components/more-menu/view-more-menu-group.js.map +1 -0
  59. package/build/components/page-attributes/check.js +8 -0
  60. package/build/components/page-attributes/check.js.map +1 -1
  61. package/build/components/page-attributes/order.js +7 -0
  62. package/build/components/page-attributes/order.js.map +1 -1
  63. package/build/components/page-attributes/panel.js +14 -8
  64. package/build/components/page-attributes/panel.js.map +1 -1
  65. package/build/components/page-attributes/parent.js +7 -0
  66. package/build/components/page-attributes/parent.js.map +1 -1
  67. package/build/components/plugin-post-publish-panel/index.js +1 -1
  68. package/build/components/plugin-post-publish-panel/index.js.map +1 -1
  69. package/build/components/plugin-pre-publish-panel/index.js +1 -1
  70. package/build/components/plugin-pre-publish-panel/index.js.map +1 -1
  71. package/build/components/plugin-sidebar/index.js +1 -1
  72. package/build/components/plugin-sidebar/index.js.map +1 -1
  73. package/build/components/post-actions/actions.js +219 -66
  74. package/build/components/post-actions/actions.js.map +1 -1
  75. package/build/components/post-actions/index.js +32 -16
  76. package/build/components/post-actions/index.js.map +1 -1
  77. package/build/components/post-author/check.js +9 -0
  78. package/build/components/post-author/check.js.map +1 -1
  79. package/build/components/post-author/index.js +6 -0
  80. package/build/components/post-author/index.js.map +1 -1
  81. package/build/components/post-author/panel.js +5 -0
  82. package/build/components/post-author/panel.js.map +1 -1
  83. package/build/components/post-card-panel/index.js +7 -66
  84. package/build/components/post-card-panel/index.js.map +1 -1
  85. package/build/components/post-comments/index.js +28 -8
  86. package/build/components/post-comments/index.js.map +1 -1
  87. package/build/components/post-content-information/index.js +72 -0
  88. package/build/components/post-content-information/index.js.map +1 -0
  89. package/build/components/post-discussion/panel.js +104 -20
  90. package/build/components/post-discussion/panel.js.map +1 -1
  91. package/build/components/post-excerpt/check.js +0 -19
  92. package/build/components/post-excerpt/check.js.map +1 -1
  93. package/build/components/post-excerpt/index.js +52 -12
  94. package/build/components/post-excerpt/index.js.map +1 -1
  95. package/build/components/post-excerpt/panel.js +118 -7
  96. package/build/components/post-excerpt/panel.js.map +1 -1
  97. package/build/components/post-excerpt/plugin.js +2 -2
  98. package/build/components/post-excerpt/plugin.js.map +1 -1
  99. package/build/components/post-featured-image/index.js +1 -1
  100. package/build/components/post-featured-image/index.js.map +1 -1
  101. package/build/components/post-format/panel.js +27 -0
  102. package/build/components/post-format/panel.js.map +1 -0
  103. package/build/components/post-last-edited-panel/index.js +33 -0
  104. package/build/components/post-last-edited-panel/index.js.map +1 -0
  105. package/build/components/post-panel-row/index.js +2 -2
  106. package/build/components/post-panel-row/index.js.map +1 -1
  107. package/build/components/post-panel-section/index.js +28 -0
  108. package/build/components/post-panel-section/index.js.map +1 -0
  109. package/build/components/post-pingbacks/index.js +5 -2
  110. package/build/components/post-pingbacks/index.js.map +1 -1
  111. package/build/components/post-publish-button/post-publish-button-or-toggle.js +100 -0
  112. package/build/components/post-publish-button/post-publish-button-or-toggle.js.map +1 -0
  113. package/build/components/post-saved-state/index.js +2 -2
  114. package/build/components/post-saved-state/index.js.map +1 -1
  115. package/build/components/post-schedule/panel.js +1 -1
  116. package/build/components/post-schedule/panel.js.map +1 -1
  117. package/build/components/post-slug/panel.js +27 -0
  118. package/build/components/post-slug/panel.js.map +1 -0
  119. package/build/components/post-status/index.js +13 -13
  120. package/build/components/post-status/index.js.map +1 -1
  121. package/build/components/post-sticky/panel.js +21 -0
  122. package/build/components/post-sticky/panel.js.map +1 -0
  123. package/build/components/post-template/block-theme.js +2 -2
  124. package/build/components/post-template/block-theme.js.map +1 -1
  125. package/build/components/post-template/classic-theme.js +0 -1
  126. package/build/components/post-template/classic-theme.js.map +1 -1
  127. package/build/components/post-template/swap-template-button.js +2 -5
  128. package/build/components/post-template/swap-template-button.js.map +1 -1
  129. package/build/components/post-title/index.js +2 -2
  130. package/build/components/post-title/index.js.map +1 -1
  131. package/build/components/post-title/post-title-raw.js +2 -2
  132. package/build/components/post-title/post-title-raw.js.map +1 -1
  133. package/build/components/post-transform-panel/hooks.js +90 -0
  134. package/build/components/post-transform-panel/hooks.js.map +1 -0
  135. package/build/components/post-transform-panel/index.js +101 -0
  136. package/build/components/post-transform-panel/index.js.map +1 -0
  137. package/build/components/post-trash/panel.js +18 -0
  138. package/build/components/post-trash/panel.js.map +1 -0
  139. package/build/components/post-type-support-check/index.js +1 -1
  140. package/build/components/post-type-support-check/index.js.map +1 -1
  141. package/build/components/post-url/index.js +2 -1
  142. package/build/components/post-url/index.js.map +1 -1
  143. package/build/components/post-url/panel.js +1 -1
  144. package/build/components/post-url/panel.js.map +1 -1
  145. package/build/components/preferences-modal/enable-publish-sidebar.js +34 -0
  146. package/build/components/preferences-modal/enable-publish-sidebar.js.map +1 -0
  147. package/build/components/preferences-modal/index.js +11 -5
  148. package/build/components/preferences-modal/index.js.map +1 -1
  149. package/build/components/preview-dropdown/index.js +3 -1
  150. package/build/components/preview-dropdown/index.js.map +1 -1
  151. package/build/components/provider/disable-non-page-content-blocks.js +23 -16
  152. package/build/components/provider/disable-non-page-content-blocks.js.map +1 -1
  153. package/build/components/provider/index.js +3 -1
  154. package/build/components/provider/index.js.map +1 -1
  155. package/build/components/provider/use-block-editor-settings.js +21 -3
  156. package/build/components/provider/use-block-editor-settings.js.map +1 -1
  157. package/build/components/save-publish-panels/index.js +89 -0
  158. package/build/components/save-publish-panels/index.js.map +1 -0
  159. package/build/components/sidebar/constants.js +11 -0
  160. package/build/components/sidebar/constants.js.map +1 -0
  161. package/build/components/sidebar/header.js +53 -0
  162. package/build/components/sidebar/header.js.map +1 -0
  163. package/build/components/sidebar/index.js +157 -0
  164. package/build/components/sidebar/index.js.map +1 -0
  165. package/build/components/sidebar/post-summary.js +84 -0
  166. package/build/components/sidebar/post-summary.js.map +1 -0
  167. package/build/components/start-page-options/index.js +10 -8
  168. package/build/components/start-page-options/index.js.map +1 -1
  169. package/build/components/start-template-options/index.js +192 -0
  170. package/build/components/start-template-options/index.js.map +1 -0
  171. package/build/components/template-content-panel/index.js +38 -0
  172. package/build/components/template-content-panel/index.js.map +1 -0
  173. package/build/hooks/pattern-overrides.js +10 -5
  174. package/build/hooks/pattern-overrides.js.map +1 -1
  175. package/build/private-apis.js +19 -8
  176. package/build/private-apis.js.map +1 -1
  177. package/build/private-apis.native.js +72 -0
  178. package/build/private-apis.native.js.map +1 -0
  179. package/build/store/private-selectors.js +6 -1
  180. package/build/store/private-selectors.js.map +1 -1
  181. package/build/store/reducer.js +15 -0
  182. package/build/store/reducer.js.map +1 -1
  183. package/build/store/selectors.js +3 -1
  184. package/build/store/selectors.js.map +1 -1
  185. package/build-module/bindings/pattern-overrides.js +69 -1
  186. package/build-module/bindings/pattern-overrides.js.map +1 -1
  187. package/build-module/components/autosave-monitor/index.js +15 -13
  188. package/build-module/components/autosave-monitor/index.js.map +1 -1
  189. package/build-module/components/block-settings-menu/content-only-settings-menu.js +119 -0
  190. package/build-module/components/block-settings-menu/content-only-settings-menu.js.map +1 -0
  191. package/build-module/components/block-settings-menu/content-only-settings-menu.native.js +5 -0
  192. package/build-module/components/block-settings-menu/content-only-settings-menu.native.js.map +1 -0
  193. package/build-module/components/character-count/index.js +6 -0
  194. package/build-module/components/character-count/index.js.map +1 -1
  195. package/build-module/components/collapsible-block-toolbar/index.js +65 -0
  196. package/build-module/components/collapsible-block-toolbar/index.js.map +1 -0
  197. package/build-module/components/document-bar/index.js +2 -2
  198. package/build-module/components/document-bar/index.js.map +1 -1
  199. package/build-module/components/document-outline/check.js +9 -0
  200. package/build-module/components/document-outline/check.js.map +1 -1
  201. package/build-module/components/document-outline/index.js +11 -0
  202. package/build-module/components/document-outline/index.js.map +1 -1
  203. package/build-module/components/document-outline/item.js +2 -2
  204. package/build-module/components/document-outline/item.js.map +1 -1
  205. package/build-module/components/document-tools/index.js +17 -27
  206. package/build-module/components/document-tools/index.js.map +1 -1
  207. package/build-module/components/editor-canvas/edit-template-blocks-notification.js +1 -1
  208. package/build-module/components/editor-canvas/edit-template-blocks-notification.js.map +1 -1
  209. package/build-module/components/editor-canvas/index.js +19 -8
  210. package/build-module/components/editor-canvas/index.js.map +1 -1
  211. package/build-module/components/editor-history/redo.js +11 -0
  212. package/build-module/components/editor-history/redo.js.map +1 -1
  213. package/build-module/components/editor-history/undo.js +11 -0
  214. package/build-module/components/editor-history/undo.js.map +1 -1
  215. package/build-module/components/editor-snackbars/index.js +6 -0
  216. package/build-module/components/editor-snackbars/index.js.map +1 -1
  217. package/build-module/components/global-keyboard-shortcuts/index.js +8 -0
  218. package/build-module/components/global-keyboard-shortcuts/index.js.map +1 -1
  219. package/build-module/components/global-keyboard-shortcuts/register-shortcuts.js +36 -1
  220. package/build-module/components/global-keyboard-shortcuts/register-shortcuts.js.map +1 -1
  221. package/build-module/components/global-styles-provider/index.js +120 -0
  222. package/build-module/components/global-styles-provider/index.js.map +1 -0
  223. package/build-module/components/header/index.js +139 -0
  224. package/build-module/components/header/index.js.map +1 -0
  225. package/build-module/components/inserter-sidebar/index.js +59 -37
  226. package/build-module/components/inserter-sidebar/index.js.map +1 -1
  227. package/build-module/components/keyboard-shortcut-help-modal/config.js +4 -0
  228. package/build-module/components/keyboard-shortcut-help-modal/config.js.map +1 -1
  229. package/build-module/components/keyboard-shortcut-help-modal/index.js +2 -2
  230. package/build-module/components/keyboard-shortcut-help-modal/index.js.map +1 -1
  231. package/build-module/components/list-view-sidebar/index.js +1 -1
  232. package/build-module/components/list-view-sidebar/index.js.map +1 -1
  233. package/build-module/components/more-menu/copy-content-menu-item.js +52 -0
  234. package/build-module/components/more-menu/copy-content-menu-item.js.map +1 -0
  235. package/build-module/components/more-menu/index.js +111 -0
  236. package/build-module/components/more-menu/index.js.map +1 -0
  237. package/build-module/components/more-menu/tools-more-menu-group.js +16 -0
  238. package/build-module/components/more-menu/tools-more-menu-group.js.map +1 -0
  239. package/build-module/components/more-menu/view-more-menu-group.js +17 -0
  240. package/build-module/components/more-menu/view-more-menu-group.js.map +1 -0
  241. package/build-module/components/page-attributes/check.js +9 -0
  242. package/build-module/components/page-attributes/check.js.map +1 -1
  243. package/build-module/components/page-attributes/order.js +7 -0
  244. package/build-module/components/page-attributes/order.js.map +1 -1
  245. package/build-module/components/page-attributes/panel.js +13 -6
  246. package/build-module/components/page-attributes/panel.js.map +1 -1
  247. package/build-module/components/page-attributes/parent.js +7 -0
  248. package/build-module/components/page-attributes/parent.js.map +1 -1
  249. package/build-module/components/plugin-post-publish-panel/index.js +1 -1
  250. package/build-module/components/plugin-post-publish-panel/index.js.map +1 -1
  251. package/build-module/components/plugin-pre-publish-panel/index.js +1 -1
  252. package/build-module/components/plugin-pre-publish-panel/index.js.map +1 -1
  253. package/build-module/components/plugin-sidebar/index.js +1 -1
  254. package/build-module/components/plugin-sidebar/index.js.map +1 -1
  255. package/build-module/components/post-actions/actions.js +223 -70
  256. package/build-module/components/post-actions/actions.js.map +1 -1
  257. package/build-module/components/post-actions/index.js +33 -17
  258. package/build-module/components/post-actions/index.js.map +1 -1
  259. package/build-module/components/post-author/check.js +10 -0
  260. package/build-module/components/post-author/check.js.map +1 -1
  261. package/build-module/components/post-author/index.js +6 -0
  262. package/build-module/components/post-author/index.js.map +1 -1
  263. package/build-module/components/post-author/panel.js +6 -0
  264. package/build-module/components/post-author/panel.js.map +1 -1
  265. package/build-module/components/post-card-panel/index.js +9 -67
  266. package/build-module/components/post-card-panel/index.js.map +1 -1
  267. package/build-module/components/post-comments/index.js +30 -10
  268. package/build-module/components/post-comments/index.js.map +1 -1
  269. package/build-module/components/post-content-information/index.js +66 -0
  270. package/build-module/components/post-content-information/index.js.map +1 -0
  271. package/build-module/components/post-discussion/panel.js +105 -21
  272. package/build-module/components/post-discussion/panel.js.map +1 -1
  273. package/build-module/components/post-excerpt/check.js +0 -19
  274. package/build-module/components/post-excerpt/check.js.map +1 -1
  275. package/build-module/components/post-excerpt/index.js +52 -11
  276. package/build-module/components/post-excerpt/index.js.map +1 -1
  277. package/build-module/components/post-excerpt/panel.js +118 -8
  278. package/build-module/components/post-excerpt/panel.js.map +1 -1
  279. package/build-module/components/post-excerpt/plugin.js +2 -2
  280. package/build-module/components/post-excerpt/plugin.js.map +1 -1
  281. package/build-module/components/post-featured-image/index.js +1 -1
  282. package/build-module/components/post-featured-image/index.js.map +1 -1
  283. package/build-module/components/post-format/panel.js +18 -0
  284. package/build-module/components/post-format/panel.js.map +1 -0
  285. package/build-module/components/post-last-edited-panel/index.js +26 -0
  286. package/build-module/components/post-last-edited-panel/index.js.map +1 -0
  287. package/build-module/components/post-panel-row/index.js +2 -2
  288. package/build-module/components/post-panel-row/index.js.map +1 -1
  289. package/build-module/components/post-panel-section/index.js +20 -0
  290. package/build-module/components/post-panel-section/index.js.map +1 -0
  291. package/build-module/components/post-pingbacks/index.js +6 -3
  292. package/build-module/components/post-pingbacks/index.js.map +1 -1
  293. package/build-module/components/post-publish-button/post-publish-button-or-toggle.js +91 -0
  294. package/build-module/components/post-publish-button/post-publish-button-or-toggle.js.map +1 -0
  295. package/build-module/components/post-saved-state/index.js +2 -2
  296. package/build-module/components/post-saved-state/index.js.map +1 -1
  297. package/build-module/components/post-schedule/panel.js +1 -1
  298. package/build-module/components/post-schedule/panel.js.map +1 -1
  299. package/build-module/components/post-slug/panel.js +18 -0
  300. package/build-module/components/post-slug/panel.js.map +1 -0
  301. package/build-module/components/post-status/index.js +13 -13
  302. package/build-module/components/post-status/index.js.map +1 -1
  303. package/build-module/components/post-sticky/panel.js +12 -0
  304. package/build-module/components/post-sticky/panel.js.map +1 -0
  305. package/build-module/components/post-template/block-theme.js +2 -2
  306. package/build-module/components/post-template/block-theme.js.map +1 -1
  307. package/build-module/components/post-template/classic-theme.js +0 -1
  308. package/build-module/components/post-template/classic-theme.js.map +1 -1
  309. package/build-module/components/post-template/swap-template-button.js +3 -6
  310. package/build-module/components/post-template/swap-template-button.js.map +1 -1
  311. package/build-module/components/post-title/index.js +2 -2
  312. package/build-module/components/post-title/index.js.map +1 -1
  313. package/build-module/components/post-title/post-title-raw.js +2 -2
  314. package/build-module/components/post-title/post-title-raw.js.map +1 -1
  315. package/build-module/components/post-transform-panel/hooks.js +83 -0
  316. package/build-module/components/post-transform-panel/hooks.js.map +1 -0
  317. package/build-module/components/post-transform-panel/index.js +94 -0
  318. package/build-module/components/post-transform-panel/index.js.map +1 -0
  319. package/build-module/components/post-trash/panel.js +10 -0
  320. package/build-module/components/post-trash/panel.js.map +1 -0
  321. package/build-module/components/post-type-support-check/index.js +1 -1
  322. package/build-module/components/post-type-support-check/index.js.map +1 -1
  323. package/build-module/components/post-url/index.js +2 -1
  324. package/build-module/components/post-url/index.js.map +1 -1
  325. package/build-module/components/post-url/panel.js +1 -1
  326. package/build-module/components/post-url/panel.js.map +1 -1
  327. package/build-module/components/preferences-modal/enable-publish-sidebar.js +27 -0
  328. package/build-module/components/preferences-modal/enable-publish-sidebar.js.map +1 -0
  329. package/build-module/components/preferences-modal/index.js +11 -5
  330. package/build-module/components/preferences-modal/index.js.map +1 -1
  331. package/build-module/components/preview-dropdown/index.js +3 -1
  332. package/build-module/components/preview-dropdown/index.js.map +1 -1
  333. package/build-module/components/provider/disable-non-page-content-blocks.js +24 -17
  334. package/build-module/components/provider/disable-non-page-content-blocks.js.map +1 -1
  335. package/build-module/components/provider/index.js +3 -1
  336. package/build-module/components/provider/index.js.map +1 -1
  337. package/build-module/components/provider/use-block-editor-settings.js +21 -3
  338. package/build-module/components/provider/use-block-editor-settings.js.map +1 -1
  339. package/build-module/components/save-publish-panels/index.js +80 -0
  340. package/build-module/components/save-publish-panels/index.js.map +1 -0
  341. package/build-module/components/sidebar/constants.js +5 -0
  342. package/build-module/components/sidebar/constants.js.map +1 -0
  343. package/build-module/components/sidebar/header.js +46 -0
  344. package/build-module/components/sidebar/header.js.map +1 -0
  345. package/build-module/components/sidebar/index.js +149 -0
  346. package/build-module/components/sidebar/index.js.map +1 -0
  347. package/build-module/components/sidebar/post-summary.js +77 -0
  348. package/build-module/components/sidebar/post-summary.js.map +1 -0
  349. package/build-module/components/start-page-options/index.js +10 -8
  350. package/build-module/components/start-page-options/index.js.map +1 -1
  351. package/build-module/components/start-template-options/index.js +185 -0
  352. package/build-module/components/start-template-options/index.js.map +1 -0
  353. package/build-module/components/template-content-panel/index.js +31 -0
  354. package/build-module/components/template-content-panel/index.js.map +1 -0
  355. package/build-module/hooks/pattern-overrides.js +10 -5
  356. package/build-module/hooks/pattern-overrides.js.map +1 -1
  357. package/build-module/private-apis.js +19 -8
  358. package/build-module/private-apis.js.map +1 -1
  359. package/build-module/private-apis.native.js +62 -0
  360. package/build-module/private-apis.native.js.map +1 -0
  361. package/build-module/store/private-selectors.js +3 -0
  362. package/build-module/store/private-selectors.js.map +1 -1
  363. package/build-module/store/reducer.js +14 -0
  364. package/build-module/store/reducer.js.map +1 -1
  365. package/build-module/store/selectors.js +3 -1
  366. package/build-module/store/selectors.js.map +1 -1
  367. package/build-style/style-rtl.css +535 -48
  368. package/build-style/style.css +535 -48
  369. package/package.json +38 -36
  370. package/src/bindings/pattern-overrides.js +83 -1
  371. package/src/components/autocompleters/style.scss +1 -2
  372. package/src/components/autosave-monitor/index.js +15 -12
  373. package/src/components/block-settings-menu/content-only-settings-menu.js +175 -0
  374. package/src/components/block-settings-menu/content-only-settings-menu.native.js +4 -0
  375. package/src/components/block-settings-menu/style.scss +4 -0
  376. package/src/components/character-count/index.js +5 -0
  377. package/src/components/collapsible-block-toolbar/index.js +77 -0
  378. package/src/components/collapsible-block-toolbar/style.scss +80 -0
  379. package/src/components/document-bar/index.js +2 -2
  380. package/src/components/document-outline/check.js +8 -0
  381. package/src/components/document-outline/index.js +10 -0
  382. package/src/components/document-outline/item.js +2 -2
  383. package/src/components/document-tools/index.js +19 -26
  384. package/src/components/editor-canvas/edit-template-blocks-notification.js +1 -1
  385. package/src/components/editor-canvas/index.js +18 -6
  386. package/src/components/editor-history/redo.js +10 -0
  387. package/src/components/editor-history/undo.js +10 -0
  388. package/src/components/editor-snackbars/index.js +5 -0
  389. package/src/components/entities-saved-states/style.scss +7 -0
  390. package/src/components/global-keyboard-shortcuts/index.js +7 -0
  391. package/src/components/global-keyboard-shortcuts/register-shortcuts.js +42 -1
  392. package/src/components/global-styles-provider/index.js +162 -0
  393. package/src/components/header/index.js +154 -0
  394. package/src/components/header/style.scss +231 -0
  395. package/src/components/inserter-sidebar/index.js +52 -32
  396. package/src/components/inserter-sidebar/style.scss +10 -3
  397. package/src/components/keyboard-shortcut-help-modal/config.js +10 -1
  398. package/src/components/keyboard-shortcut-help-modal/index.js +2 -2
  399. package/src/components/list-view-sidebar/index.js +1 -1
  400. package/src/components/list-view-sidebar/style.scss +3 -2
  401. package/src/components/more-menu/copy-content-menu-item.js +51 -0
  402. package/src/components/more-menu/index.js +158 -0
  403. package/src/components/more-menu/tools-more-menu-group.js +11 -0
  404. package/src/components/more-menu/view-more-menu-group.js +13 -0
  405. package/src/components/page-attributes/check.js +8 -0
  406. package/src/components/page-attributes/order.js +6 -0
  407. package/src/components/page-attributes/panel.js +21 -17
  408. package/src/components/page-attributes/parent.js +6 -0
  409. package/src/components/page-attributes/test/order.js +5 -1
  410. package/src/components/plugin-post-publish-panel/index.js +1 -1
  411. package/src/components/plugin-pre-publish-panel/index.js +1 -1
  412. package/src/components/plugin-sidebar/index.js +1 -1
  413. package/src/components/post-actions/actions.js +373 -152
  414. package/src/components/post-actions/index.js +34 -33
  415. package/src/components/post-author/check.js +9 -0
  416. package/src/components/post-author/index.js +5 -0
  417. package/src/components/post-author/panel.js +5 -0
  418. package/src/components/post-card-panel/index.js +40 -141
  419. package/src/components/post-card-panel/style.scss +2 -6
  420. package/src/components/post-comments/index.js +47 -9
  421. package/src/components/post-content-information/index.js +83 -0
  422. package/src/components/post-content-information/style.scss +6 -0
  423. package/src/components/post-discussion/panel.js +108 -27
  424. package/src/components/post-discussion/style.scss +26 -0
  425. package/src/components/post-excerpt/check.js +0 -18
  426. package/src/components/post-excerpt/index.js +66 -15
  427. package/src/components/post-excerpt/panel.js +196 -19
  428. package/src/components/post-excerpt/plugin.js +2 -2
  429. package/src/components/post-excerpt/style.scss +24 -0
  430. package/src/components/post-featured-image/index.js +1 -1
  431. package/src/components/post-featured-image/style.scss +2 -8
  432. package/src/components/post-format/panel.js +22 -0
  433. package/src/components/post-format/style.scss +6 -0
  434. package/src/components/post-last-edited-panel/index.js +35 -0
  435. package/src/components/post-last-edited-panel/style.scss +6 -0
  436. package/src/components/post-last-revision/test/check.js +5 -1
  437. package/src/components/post-panel-row/index.js +2 -2
  438. package/src/components/post-panel-row/style.scss +3 -3
  439. package/src/components/post-panel-section/index.js +19 -0
  440. package/src/components/post-panel-section/style.scss +3 -0
  441. package/src/components/post-pingbacks/index.js +11 -2
  442. package/src/components/post-publish-button/post-publish-button-or-toggle.js +102 -0
  443. package/src/components/post-publish-button/test/post-publish-button-or-toggle.js +63 -0
  444. package/src/components/post-publish-panel/style.scss +48 -0
  445. package/src/components/post-publish-panel/test/__snapshots__/index.js.snap +225 -75
  446. package/src/components/post-saved-state/index.js +2 -2
  447. package/src/components/post-schedule/panel.js +1 -1
  448. package/src/components/post-schedule/style.scss +2 -4
  449. package/src/components/post-slug/panel.js +22 -0
  450. package/src/components/post-slug/style.scss +5 -0
  451. package/src/components/post-slug/test/index.js +5 -1
  452. package/src/components/post-status/index.js +88 -80
  453. package/src/components/post-status/style.scss +0 -1
  454. package/src/components/post-sticky/panel.js +18 -0
  455. package/src/components/post-template/block-theme.js +2 -2
  456. package/src/components/post-template/classic-theme.js +0 -1
  457. package/src/components/post-template/swap-template-button.js +3 -6
  458. package/src/components/post-text-editor/style.scss +1 -1
  459. package/src/components/post-title/index.js +2 -2
  460. package/src/components/post-title/post-title-raw.js +2 -2
  461. package/src/components/post-title/style.scss +1 -1
  462. package/src/components/post-transform-panel/hooks.js +114 -0
  463. package/src/components/post-transform-panel/index.js +99 -0
  464. package/src/components/post-trash/panel.js +13 -0
  465. package/src/components/post-type-support-check/index.js +1 -1
  466. package/src/components/post-type-support-check/test/index.js +2 -2
  467. package/src/components/post-url/index.js +1 -0
  468. package/src/components/post-url/panel.js +1 -1
  469. package/src/components/preferences-modal/enable-publish-sidebar.js +28 -0
  470. package/src/components/preferences-modal/index.js +17 -3
  471. package/src/components/preview-dropdown/index.js +3 -1
  472. package/src/components/provider/disable-non-page-content-blocks.js +23 -21
  473. package/src/components/provider/index.js +4 -0
  474. package/src/components/provider/use-block-editor-settings.js +19 -4
  475. package/src/components/save-publish-panels/index.js +96 -0
  476. package/src/components/save-publish-panels/style.scss +36 -0
  477. package/src/components/sidebar/constants.js +4 -0
  478. package/src/components/sidebar/header.js +49 -0
  479. package/src/components/sidebar/index.js +200 -0
  480. package/src/components/sidebar/post-summary.js +104 -0
  481. package/src/components/sidebar/style.scss +18 -0
  482. package/src/components/start-page-options/index.js +12 -5
  483. package/src/components/start-template-options/index.js +219 -0
  484. package/src/components/start-template-options/style.scss +55 -0
  485. package/src/components/template-areas/style.scss +0 -1
  486. package/src/components/template-content-panel/index.js +36 -0
  487. package/src/hooks/pattern-overrides.js +12 -6
  488. package/src/private-apis.js +22 -8
  489. package/src/private-apis.native.js +61 -0
  490. package/src/store/private-selectors.js +3 -0
  491. package/src/store/reducer.js +12 -0
  492. package/src/store/selectors.js +3 -1
  493. package/src/style.scss +11 -0
  494. package/src/components/post-slug/test/check.js +0 -17
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * External dependencies
3
3
  */
4
- import classnames from 'classnames';
4
+ import clsx from 'clsx';
5
5
 
6
6
  /**
7
7
  * WordPress dependencies
@@ -13,11 +13,10 @@ import {
13
13
  NavigableToolbar,
14
14
  ToolSelector,
15
15
  store as blockEditorStore,
16
- privateApis as blockEditorPrivateApis,
17
16
  } from '@wordpress/block-editor';
18
17
  import { Button, ToolbarItem } from '@wordpress/components';
19
18
  import { listView, plus } from '@wordpress/icons';
20
- import { useRef, useCallback } from '@wordpress/element';
19
+ import { useCallback } from '@wordpress/element';
21
20
  import { store as keyboardShortcutsStore } from '@wordpress/keyboard-shortcuts';
22
21
  import { store as preferencesStore } from '@wordpress/preferences';
23
22
 
@@ -29,8 +28,6 @@ import { store as editorStore } from '../../store';
29
28
  import EditorHistoryRedo from '../editor-history/redo';
30
29
  import EditorHistoryUndo from '../editor-history/undo';
31
30
 
32
- const { useShowBlockTools } = unlock( blockEditorPrivateApis );
33
-
34
31
  const preventDefault = ( event ) => {
35
32
  event.preventDefault();
36
33
  };
@@ -38,11 +35,9 @@ const preventDefault = ( event ) => {
38
35
  function DocumentTools( {
39
36
  className,
40
37
  disableBlockTools = false,
41
- children,
42
38
  // This is a temporary prop until the list view is fully unified between post and site editors.
43
39
  listViewLabel = __( 'Document Overview' ),
44
40
  } ) {
45
- const inserterButton = useRef();
46
41
  const { setIsInserterOpened, setIsListViewOpened } =
47
42
  useDispatch( editorStore );
48
43
  const {
@@ -50,16 +45,21 @@ function DocumentTools( {
50
45
  isInserterOpened,
51
46
  isListViewOpen,
52
47
  listViewShortcut,
48
+ inserterSidebarToggleRef,
53
49
  listViewToggleRef,
54
50
  hasFixedToolbar,
55
51
  showIconLabels,
56
52
  } = useSelect( ( select ) => {
57
53
  const { getSettings } = select( blockEditorStore );
58
54
  const { get } = select( preferencesStore );
59
- const { isListViewOpened, getListViewToggleRef } = unlock(
60
- select( editorStore )
61
- );
55
+ const {
56
+ isListViewOpened,
57
+ getEditorMode,
58
+ getInserterSidebarToggleRef,
59
+ getListViewToggleRef,
60
+ } = unlock( select( editorStore ) );
62
61
  const { getShortcutRepresentation } = select( keyboardShortcutsStore );
62
+ const { __unstableGetEditorMode } = select( blockEditorStore );
63
63
 
64
64
  return {
65
65
  isInserterOpened: select( editorStore ).isInserterOpened(),
@@ -67,16 +67,18 @@ function DocumentTools( {
67
67
  listViewShortcut: getShortcutRepresentation(
68
68
  'core/editor/toggle-list-view'
69
69
  ),
70
+ inserterSidebarToggleRef: getInserterSidebarToggleRef(),
70
71
  listViewToggleRef: getListViewToggleRef(),
71
72
  hasFixedToolbar: getSettings().hasFixedToolbar,
72
73
  showIconLabels: get( 'core', 'showIconLabels' ),
73
74
  isDistractionFree: get( 'core', 'distractionFree' ),
75
+ isVisualMode: getEditorMode() === 'visual',
76
+ isZoomedOutView: __unstableGetEditorMode() === 'zoom-out',
74
77
  };
75
78
  }, [] );
76
79
 
77
80
  const isLargeViewport = useViewportMatch( 'medium' );
78
81
  const isWideViewport = useViewportMatch( 'wide' );
79
- const { showFixedToolbar } = useShowBlockTools();
80
82
 
81
83
  /* translators: accessibility text for the editor toolbar */
82
84
  const toolbarAriaLabel = __( 'Document tools' );
@@ -86,17 +88,10 @@ function DocumentTools( {
86
88
  [ setIsListViewOpened, isListViewOpen ]
87
89
  );
88
90
 
89
- const toggleInserter = useCallback( () => {
90
- if ( isInserterOpened ) {
91
- // Focusing the inserter button should close the inserter popover.
92
- // However, there are some cases it won't close when the focus is lost.
93
- // See https://github.com/WordPress/gutenberg/issues/43090 for more details.
94
- inserterButton.current.focus();
95
- setIsInserterOpened( false );
96
- } else {
97
- setIsInserterOpened( true );
98
- }
99
- }, [ isInserterOpened, setIsInserterOpened ] );
91
+ const toggleInserter = useCallback(
92
+ () => setIsInserterOpened( ! isInserterOpened ),
93
+ [ isInserterOpened, setIsInserterOpened ]
94
+ );
100
95
 
101
96
  /* translators: button label text should, if possible, be under 16 characters. */
102
97
  const longLabel = _x(
@@ -111,19 +106,18 @@ function DocumentTools( {
111
106
  // supported, but we're keeping it in the list of class names for backwards
112
107
  // compatibility.
113
108
  <NavigableToolbar
114
- className={ classnames(
109
+ className={ clsx(
115
110
  'editor-document-tools',
116
111
  'edit-post-header-toolbar',
117
112
  className
118
113
  ) }
119
114
  aria-label={ toolbarAriaLabel }
120
- shouldUseKeyboardFocusShortcut={ ! showFixedToolbar }
121
115
  variant="unstyled"
122
116
  >
123
117
  <div className="editor-document-tools__left">
124
118
  { ! isDistractionFree && (
125
119
  <ToolbarItem
126
- ref={ inserterButton }
120
+ ref={ inserterSidebarToggleRef }
127
121
  as={ Button }
128
122
  className="editor-document-tools__inserter-toggle"
129
123
  variant="primary"
@@ -184,7 +178,6 @@ function DocumentTools( {
184
178
  ) }
185
179
  </>
186
180
  ) }
187
- { children }
188
181
  </div>
189
182
  </NavigableToolbar>
190
183
  );
@@ -82,7 +82,7 @@ export default function EditTemplateBlocksNotification( { contentRef } ) {
82
82
  onCancel={ () => setIsDialogOpen( false ) }
83
83
  >
84
84
  { __(
85
- 'You’ve tried to select a block that is part of a template, which may be used on other posts and pages. Would you like to edit the template?.'
85
+ 'You’ve tried to select a block that is part of a template, which may be used on other posts and pages. Would you like to edit the template?'
86
86
  ) }
87
87
  </ConfirmDialog>
88
88
  );
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * External dependencies
3
3
  */
4
- import classnames from 'classnames';
4
+ import clsx from 'clsx';
5
5
 
6
6
  /**
7
7
  * WordPress dependencies
@@ -161,13 +161,17 @@ function EditorCanvas( {
161
161
  hasRootPaddingAwareAlignments,
162
162
  themeHasDisabledLayoutStyles,
163
163
  themeSupportsLayout,
164
+ isZoomOutMode,
164
165
  } = useSelect( ( select ) => {
165
- const _settings = select( blockEditorStore ).getSettings();
166
+ const { getSettings, __unstableGetEditorMode } =
167
+ select( blockEditorStore );
168
+ const _settings = getSettings();
166
169
  return {
167
170
  themeHasDisabledLayoutStyles: _settings.disableLayoutStyles,
168
171
  themeSupportsLayout: _settings.supportsLayout,
169
172
  hasRootPaddingAwareAlignments:
170
173
  _settings.__experimentalFeatures?.useRootPaddingAwareAlignments,
174
+ isZoomOutMode: __unstableGetEditorMode() === 'zoom-out',
171
175
  };
172
176
  }, [] );
173
177
 
@@ -248,7 +252,7 @@ function EditorCanvas( {
248
252
  'core/post-content'
249
253
  );
250
254
 
251
- const blockListLayoutClass = classnames(
255
+ const blockListLayoutClass = clsx(
252
256
  {
253
257
  'is-layout-flow': ! themeSupportsLayout,
254
258
  },
@@ -319,6 +323,13 @@ function EditorCanvas( {
319
323
  } ),
320
324
  ] );
321
325
 
326
+ const zoomOutProps = isZoomOutMode
327
+ ? {
328
+ scale: 'default',
329
+ frameSize: '20px',
330
+ }
331
+ : {};
332
+
322
333
  return (
323
334
  <BlockCanvas
324
335
  shouldIframe={
@@ -328,10 +339,11 @@ function EditorCanvas( {
328
339
  styles={ styles }
329
340
  height="100%"
330
341
  iframeProps={ {
331
- className: classnames( 'editor-canvas__iframe', {
342
+ className: clsx( 'editor-canvas__iframe', {
332
343
  'has-editor-padding': showEditorPadding,
333
344
  } ),
334
345
  ...iframeProps,
346
+ ...zoomOutProps,
335
347
  style: {
336
348
  ...iframeProps?.style,
337
349
  ...deviceStyles,
@@ -362,7 +374,7 @@ function EditorCanvas( {
362
374
  ) }
363
375
  { renderingMode === 'post-only' && ! isDesignPostType && (
364
376
  <div
365
- className={ classnames(
377
+ className={ clsx(
366
378
  'editor-editor-canvas__post-title-wrapper',
367
379
  // The following class is only here for backward comapatibility
368
380
  // some themes might be using it to style the post title.
@@ -387,7 +399,7 @@ function EditorCanvas( {
387
399
  uniqueId={ wrapperUniqueId }
388
400
  >
389
401
  <BlockList
390
- className={ classnames(
402
+ className={ clsx(
391
403
  className,
392
404
  'is-' + deviceType.toLowerCase() + '-preview',
393
405
  renderingMode !== 'post-only' || isDesignPostType
@@ -41,4 +41,14 @@ function EditorHistoryRedo( props, ref ) {
41
41
  );
42
42
  }
43
43
 
44
+ /** @typedef {import('react').Ref<HTMLElement>} Ref */
45
+
46
+ /**
47
+ * Renders the redo button for the editor history.
48
+ *
49
+ * @param {Object} props - Props.
50
+ * @param {Ref} ref - Forwarded ref.
51
+ *
52
+ * @return {Component} The component to be rendered.
53
+ */
44
54
  export default forwardRef( EditorHistoryRedo );
@@ -37,4 +37,14 @@ function EditorHistoryUndo( props, ref ) {
37
37
  );
38
38
  }
39
39
 
40
+ /** @typedef {import('react').Ref<HTMLElement>} Ref */
41
+
42
+ /**
43
+ * Renders the undo button for the editor history.
44
+ *
45
+ * @param {Object} props - Props.
46
+ * @param {Ref} ref - Forwarded ref.
47
+ *
48
+ * @return {Component} The component to be rendered.
49
+ */
40
50
  export default forwardRef( EditorHistoryUndo );
@@ -8,6 +8,11 @@ import { store as noticesStore } from '@wordpress/notices';
8
8
  // Last three notices. Slices from the tail end of the list.
9
9
  const MAX_VISIBLE_NOTICES = -3;
10
10
 
11
+ /**
12
+ * Renders the editor snackbars component.
13
+ *
14
+ * @return {JSX.Element} The rendered component.
15
+ */
11
16
  export default function EditorSnackbars() {
12
17
  const notices = useSelect(
13
18
  ( select ) => select( noticesStore ).getNotices(),
@@ -30,3 +30,10 @@
30
30
  margin-bottom: $grid-unit-05;
31
31
  }
32
32
  }
33
+
34
+ .edit-post-layout,
35
+ .edit-site-editor__interface-skeleton {
36
+ .entities-saved-states__panel-header {
37
+ height: $header-height + $border-width;
38
+ }
39
+ }
@@ -11,6 +11,13 @@ import { store as blockEditorStore } from '@wordpress/block-editor';
11
11
  */
12
12
  import { store as editorStore } from '../../store';
13
13
 
14
+ /**
15
+ * Component handles the keyboard shortcuts for the editor.
16
+ *
17
+ * It provides functionality for various keyboard shortcuts such as toggling editor mode,
18
+ * toggling distraction-free mode, undo/redo, saving the post, toggling list view,
19
+ * and toggling the sidebar.
20
+ */
14
21
  export default function EditorKeyboardShortcuts() {
15
22
  const isModeToggleDisabled = useSelect( ( select ) => {
16
23
  const { richEditingEnabled, codeEditingEnabled } =
@@ -8,6 +8,11 @@ import { BlockEditorKeyboardShortcuts } from '@wordpress/block-editor';
8
8
  import { store as keyboardShortcutsStore } from '@wordpress/keyboard-shortcuts';
9
9
  import { isAppleOS } from '@wordpress/keycodes';
10
10
 
11
+ /**
12
+ * Component for registering editor keyboard shortcuts.
13
+ *
14
+ * @return {Element} The component to be rendered.
15
+ */
11
16
  function EditorKeyboardShortcutsRegister() {
12
17
  // Registering the shortcuts.
13
18
  const { registerShortcut } = useDispatch( keyboardShortcutsStore );
@@ -67,7 +72,7 @@ function EditorKeyboardShortcutsRegister() {
67
72
  registerShortcut( {
68
73
  name: 'core/editor/toggle-list-view',
69
74
  category: 'global',
70
- description: __( 'Open the block list view.' ),
75
+ description: __( 'Open the List View.' ),
71
76
  keyCombination: {
72
77
  modifier: 'access',
73
78
  character: 'o',
@@ -103,6 +108,42 @@ function EditorKeyboardShortcutsRegister() {
103
108
  character: 'h',
104
109
  },
105
110
  } );
111
+
112
+ registerShortcut( {
113
+ name: 'core/editor/next-region',
114
+ category: 'global',
115
+ description: __( 'Navigate to the next part of the editor.' ),
116
+ keyCombination: {
117
+ modifier: 'ctrl',
118
+ character: '`',
119
+ },
120
+ aliases: [
121
+ {
122
+ modifier: 'access',
123
+ character: 'n',
124
+ },
125
+ ],
126
+ } );
127
+
128
+ registerShortcut( {
129
+ name: 'core/editor/previous-region',
130
+ category: 'global',
131
+ description: __( 'Navigate to the previous part of the editor.' ),
132
+ keyCombination: {
133
+ modifier: 'ctrlShift',
134
+ character: '`',
135
+ },
136
+ aliases: [
137
+ {
138
+ modifier: 'access',
139
+ character: 'p',
140
+ },
141
+ {
142
+ modifier: 'ctrlShift',
143
+ character: '~',
144
+ },
145
+ ],
146
+ } );
106
147
  }, [ registerShortcut ] );
107
148
 
108
149
  return <BlockEditorKeyboardShortcuts.Register />;
@@ -0,0 +1,162 @@
1
+ /**
2
+ * External dependencies
3
+ */
4
+ import deepmerge from 'deepmerge';
5
+ import { isPlainObject } from 'is-plain-object';
6
+
7
+ /**
8
+ * WordPress dependencies
9
+ */
10
+ import { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';
11
+ import { store as coreStore } from '@wordpress/core-data';
12
+ import { useSelect, useDispatch } from '@wordpress/data';
13
+ import { useMemo, useCallback } from '@wordpress/element';
14
+
15
+ /**
16
+ * Internal dependencies
17
+ */
18
+ import { unlock } from '../../lock-unlock';
19
+
20
+ const { GlobalStylesContext, cleanEmptyObject } = unlock(
21
+ blockEditorPrivateApis
22
+ );
23
+
24
+ export function mergeBaseAndUserConfigs( base, user ) {
25
+ return deepmerge( base, user, {
26
+ // We only pass as arrays the presets,
27
+ // in which case we want the new array of values
28
+ // to override the old array (no merging).
29
+ isMergeableObject: isPlainObject,
30
+ } );
31
+ }
32
+
33
+ function useGlobalStylesUserConfig() {
34
+ const { globalStylesId, isReady, settings, styles } = useSelect(
35
+ ( select ) => {
36
+ const { getEditedEntityRecord, hasFinishedResolution } =
37
+ select( coreStore );
38
+ const _globalStylesId =
39
+ select( coreStore ).__experimentalGetCurrentGlobalStylesId();
40
+ const record = _globalStylesId
41
+ ? getEditedEntityRecord(
42
+ 'root',
43
+ 'globalStyles',
44
+ _globalStylesId
45
+ )
46
+ : undefined;
47
+
48
+ let hasResolved = false;
49
+ if (
50
+ hasFinishedResolution(
51
+ '__experimentalGetCurrentGlobalStylesId'
52
+ )
53
+ ) {
54
+ hasResolved = _globalStylesId
55
+ ? hasFinishedResolution( 'getEditedEntityRecord', [
56
+ 'root',
57
+ 'globalStyles',
58
+ _globalStylesId,
59
+ ] )
60
+ : true;
61
+ }
62
+
63
+ return {
64
+ globalStylesId: _globalStylesId,
65
+ isReady: hasResolved,
66
+ settings: record?.settings,
67
+ styles: record?.styles,
68
+ };
69
+ },
70
+ []
71
+ );
72
+
73
+ const { getEditedEntityRecord } = useSelect( coreStore );
74
+ const { editEntityRecord } = useDispatch( coreStore );
75
+ const config = useMemo( () => {
76
+ return {
77
+ settings: settings ?? {},
78
+ styles: styles ?? {},
79
+ };
80
+ }, [ settings, styles ] );
81
+
82
+ const setConfig = useCallback(
83
+ ( callback, options = {} ) => {
84
+ const record = getEditedEntityRecord(
85
+ 'root',
86
+ 'globalStyles',
87
+ globalStylesId
88
+ );
89
+ const currentConfig = {
90
+ styles: record?.styles ?? {},
91
+ settings: record?.settings ?? {},
92
+ };
93
+ const updatedConfig = callback( currentConfig );
94
+ editEntityRecord(
95
+ 'root',
96
+ 'globalStyles',
97
+ globalStylesId,
98
+ {
99
+ styles: cleanEmptyObject( updatedConfig.styles ) || {},
100
+ settings: cleanEmptyObject( updatedConfig.settings ) || {},
101
+ },
102
+ options
103
+ );
104
+ },
105
+ [ globalStylesId ]
106
+ );
107
+
108
+ return [ isReady, config, setConfig ];
109
+ }
110
+
111
+ function useGlobalStylesBaseConfig() {
112
+ const baseConfig = useSelect( ( select ) => {
113
+ return select(
114
+ coreStore
115
+ ).__experimentalGetCurrentThemeBaseGlobalStyles();
116
+ }, [] );
117
+
118
+ return [ !! baseConfig, baseConfig ];
119
+ }
120
+
121
+ export function useGlobalStylesContext() {
122
+ const [ isUserConfigReady, userConfig, setUserConfig ] =
123
+ useGlobalStylesUserConfig();
124
+ const [ isBaseConfigReady, baseConfig ] = useGlobalStylesBaseConfig();
125
+ const mergedConfig = useMemo( () => {
126
+ if ( ! baseConfig || ! userConfig ) {
127
+ return {};
128
+ }
129
+ return mergeBaseAndUserConfigs( baseConfig, userConfig );
130
+ }, [ userConfig, baseConfig ] );
131
+ const context = useMemo( () => {
132
+ return {
133
+ isReady: isUserConfigReady && isBaseConfigReady,
134
+ user: userConfig,
135
+ base: baseConfig,
136
+ merged: mergedConfig,
137
+ setUserConfig,
138
+ };
139
+ }, [
140
+ mergedConfig,
141
+ userConfig,
142
+ baseConfig,
143
+ setUserConfig,
144
+ isUserConfigReady,
145
+ isBaseConfigReady,
146
+ ] );
147
+
148
+ return context;
149
+ }
150
+
151
+ export function GlobalStylesProvider( { children } ) {
152
+ const context = useGlobalStylesContext();
153
+ if ( ! context.isReady ) {
154
+ return null;
155
+ }
156
+
157
+ return (
158
+ <GlobalStylesContext.Provider value={ context }>
159
+ { children }
160
+ </GlobalStylesContext.Provider>
161
+ );
162
+ }
@@ -0,0 +1,154 @@
1
+ /**
2
+ * External dependencies
3
+ */
4
+ import clsx from 'clsx';
5
+
6
+ /**
7
+ * WordPress dependencies
8
+ */
9
+ import { useSelect } from '@wordpress/data';
10
+ import { useViewportMatch } from '@wordpress/compose';
11
+ import { __unstableMotion as motion } from '@wordpress/components';
12
+ import { store as preferencesStore } from '@wordpress/preferences';
13
+ import { useState } from '@wordpress/element';
14
+ import { PinnedItems } from '@wordpress/interface';
15
+ import { store as blockEditorStore } from '@wordpress/block-editor';
16
+
17
+ /**
18
+ * Internal dependencies
19
+ */
20
+ import CollapsableBlockToolbar from '../collapsible-block-toolbar';
21
+ import DocumentBar from '../document-bar';
22
+ import DocumentTools from '../document-tools';
23
+ import MoreMenu from '../more-menu';
24
+ import PostPreviewButton from '../post-preview-button';
25
+ import PostPublishButtonOrToggle from '../post-publish-button/post-publish-button-or-toggle';
26
+ import PostSavedState from '../post-saved-state';
27
+ import PostTypeSupportCheck from '../post-type-support-check';
28
+ import PostViewLink from '../post-view-link';
29
+ import PreviewDropdown from '../preview-dropdown';
30
+ import { store as editorStore } from '../../store';
31
+
32
+ const slideY = {
33
+ hidden: { y: '-50px' },
34
+ distractionFreeInactive: { y: 0 },
35
+ hover: { y: 0, transition: { type: 'tween', delay: 0.2 } },
36
+ };
37
+
38
+ function Header( {
39
+ customSaveButton,
40
+ forceIsDirty,
41
+ forceDisableBlockTools,
42
+ setEntitiesSavedStatesCallback,
43
+ title,
44
+ children,
45
+ } ) {
46
+ const isWideViewport = useViewportMatch( 'large' );
47
+ const isLargeViewport = useViewportMatch( 'medium' );
48
+ const {
49
+ isTextEditor,
50
+ isPublishSidebarOpened,
51
+ showIconLabels,
52
+ hasFixedToolbar,
53
+ isNestedEntity,
54
+ isZoomedOutView,
55
+ } = useSelect( ( select ) => {
56
+ const { get: getPreference } = select( preferencesStore );
57
+ const {
58
+ getEditorMode,
59
+ getEditorSettings,
60
+ isPublishSidebarOpened: _isPublishSidebarOpened,
61
+ } = select( editorStore );
62
+ const { __unstableGetEditorMode } = select( blockEditorStore );
63
+
64
+ return {
65
+ isTextEditor: getEditorMode() === 'text',
66
+ isPublishSidebarOpened: _isPublishSidebarOpened(),
67
+ showIconLabels: getPreference( 'core', 'showIconLabels' ),
68
+ hasFixedToolbar: getPreference( 'core', 'fixedToolbar' ),
69
+ isNestedEntity:
70
+ !! getEditorSettings().onNavigateToPreviousEntityRecord,
71
+ isZoomedOutView: __unstableGetEditorMode() === 'zoom-out',
72
+ };
73
+ }, [] );
74
+
75
+ const hasTopToolbar = isLargeViewport && hasFixedToolbar;
76
+
77
+ const [ isBlockToolsCollapsed, setIsBlockToolsCollapsed ] =
78
+ useState( true );
79
+
80
+ // The edit-post-header classname is only kept for backward compatibilty
81
+ // as some plugins might be relying on its presence.
82
+ return (
83
+ <div className="editor-header edit-post-header">
84
+ { children }
85
+ <motion.div
86
+ variants={ slideY }
87
+ transition={ { type: 'tween', delay: 0.8 } }
88
+ className="editor-header__toolbar"
89
+ >
90
+ <DocumentTools
91
+ disableBlockTools={ forceDisableBlockTools || isTextEditor }
92
+ />
93
+ { hasTopToolbar && (
94
+ <CollapsableBlockToolbar
95
+ isCollapsed={ isBlockToolsCollapsed }
96
+ onToggle={ setIsBlockToolsCollapsed }
97
+ />
98
+ ) }
99
+ <div
100
+ className={ clsx( 'editor-header__center', {
101
+ 'is-collapsed':
102
+ ! isBlockToolsCollapsed && hasTopToolbar,
103
+ } ) }
104
+ >
105
+ { ! title ? (
106
+ <PostTypeSupportCheck supportKeys="title">
107
+ <DocumentBar />
108
+ </PostTypeSupportCheck>
109
+ ) : (
110
+ title
111
+ ) }
112
+ </div>
113
+ </motion.div>
114
+ <motion.div
115
+ variants={ slideY }
116
+ transition={ { type: 'tween', delay: 0.8 } }
117
+ className="editor-header__settings"
118
+ >
119
+ { ! customSaveButton && ! isPublishSidebarOpened && (
120
+ // This button isn't completely hidden by the publish sidebar.
121
+ // We can't hide the whole toolbar when the publish sidebar is open because
122
+ // we want to prevent mounting/unmounting the PostPublishButtonOrToggle DOM node.
123
+ // We track that DOM node to return focus to the PostPublishButtonOrToggle
124
+ // when the publish sidebar has been closed.
125
+ <PostSavedState forceIsDirty={ forceIsDirty } />
126
+ ) }
127
+ <PreviewDropdown
128
+ forceIsAutosaveable={ forceIsDirty }
129
+ disabled={ isNestedEntity || isZoomedOutView }
130
+ />
131
+ <PostPreviewButton
132
+ className="editor-header__post-preview-button"
133
+ forceIsAutosaveable={ forceIsDirty }
134
+ />
135
+ <PostViewLink />
136
+ { ! customSaveButton && (
137
+ <PostPublishButtonOrToggle
138
+ forceIsDirty={ forceIsDirty }
139
+ setEntitiesSavedStatesCallback={
140
+ setEntitiesSavedStatesCallback
141
+ }
142
+ />
143
+ ) }
144
+ { customSaveButton }
145
+ { ( isWideViewport || ! showIconLabels ) && (
146
+ <PinnedItems.Slot scope="core" />
147
+ ) }
148
+ <MoreMenu />
149
+ </motion.div>
150
+ </div>
151
+ );
152
+ }
153
+
154
+ export default Header;