@wordpress/editor 13.33.0 → 13.34.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 (303) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/README.md +132 -20
  3. package/build/components/autosave-monitor/index.js +15 -12
  4. package/build/components/autosave-monitor/index.js.map +1 -1
  5. package/build/components/character-count/index.js +5 -0
  6. package/build/components/character-count/index.js.map +1 -1
  7. package/build/components/collapsible-block-toolbar/index.js +73 -0
  8. package/build/components/collapsible-block-toolbar/index.js.map +1 -0
  9. package/build/components/document-outline/check.js +8 -0
  10. package/build/components/document-outline/check.js.map +1 -1
  11. package/build/components/document-outline/index.js +11 -0
  12. package/build/components/document-outline/index.js.map +1 -1
  13. package/build/components/document-tools/index.js +0 -7
  14. package/build/components/document-tools/index.js.map +1 -1
  15. package/build/components/editor-canvas/edit-template-blocks-notification.js +1 -1
  16. package/build/components/editor-canvas/edit-template-blocks-notification.js.map +1 -1
  17. package/build/components/editor-history/redo.js +11 -0
  18. package/build/components/editor-history/redo.js.map +1 -1
  19. package/build/components/editor-history/undo.js +11 -0
  20. package/build/components/editor-history/undo.js.map +1 -1
  21. package/build/components/editor-snackbars/index.js +6 -0
  22. package/build/components/editor-snackbars/index.js.map +1 -1
  23. package/build/components/global-keyboard-shortcuts/index.js +7 -0
  24. package/build/components/global-keyboard-shortcuts/index.js.map +1 -1
  25. package/build/components/global-keyboard-shortcuts/register-shortcuts.js +34 -0
  26. package/build/components/global-keyboard-shortcuts/register-shortcuts.js.map +1 -1
  27. package/build/components/inserter-sidebar/index.js +1 -4
  28. package/build/components/inserter-sidebar/index.js.map +1 -1
  29. package/build/components/keyboard-shortcut-help-modal/config.js +4 -0
  30. package/build/components/keyboard-shortcut-help-modal/config.js.map +1 -1
  31. package/build/components/list-view-sidebar/index.js +1 -1
  32. package/build/components/list-view-sidebar/index.js.map +1 -1
  33. package/build/components/more-menu/copy-content-menu-item.js +59 -0
  34. package/build/components/more-menu/copy-content-menu-item.js.map +1 -0
  35. package/build/components/more-menu/index.js +119 -0
  36. package/build/components/more-menu/index.js.map +1 -0
  37. package/build/components/more-menu/tools-more-menu-group.js +23 -0
  38. package/build/components/more-menu/tools-more-menu-group.js.map +1 -0
  39. package/build/components/more-menu/view-more-menu-group.js +24 -0
  40. package/build/components/more-menu/view-more-menu-group.js.map +1 -0
  41. package/build/components/page-attributes/check.js +8 -0
  42. package/build/components/page-attributes/check.js.map +1 -1
  43. package/build/components/page-attributes/order.js +7 -0
  44. package/build/components/page-attributes/order.js.map +1 -1
  45. package/build/components/page-attributes/panel.js +14 -8
  46. package/build/components/page-attributes/panel.js.map +1 -1
  47. package/build/components/page-attributes/parent.js +7 -0
  48. package/build/components/page-attributes/parent.js.map +1 -1
  49. package/build/components/plugin-post-publish-panel/index.js +1 -1
  50. package/build/components/plugin-post-publish-panel/index.js.map +1 -1
  51. package/build/components/plugin-pre-publish-panel/index.js +1 -1
  52. package/build/components/plugin-pre-publish-panel/index.js.map +1 -1
  53. package/build/components/plugin-sidebar/index.js +1 -1
  54. package/build/components/plugin-sidebar/index.js.map +1 -1
  55. package/build/components/post-actions/actions.js +100 -5
  56. package/build/components/post-actions/actions.js.map +1 -1
  57. package/build/components/post-actions/index.js +30 -7
  58. package/build/components/post-actions/index.js.map +1 -1
  59. package/build/components/post-author/check.js +9 -0
  60. package/build/components/post-author/check.js.map +1 -1
  61. package/build/components/post-author/index.js +6 -0
  62. package/build/components/post-author/index.js.map +1 -1
  63. package/build/components/post-author/panel.js +5 -0
  64. package/build/components/post-author/panel.js.map +1 -1
  65. package/build/components/post-card-panel/index.js +14 -49
  66. package/build/components/post-card-panel/index.js.map +1 -1
  67. package/build/components/post-content-information/index.js +72 -0
  68. package/build/components/post-content-information/index.js.map +1 -0
  69. package/build/components/post-discussion/panel.js +9 -7
  70. package/build/components/post-discussion/panel.js.map +1 -1
  71. package/build/components/post-excerpt/check.js +0 -19
  72. package/build/components/post-excerpt/check.js.map +1 -1
  73. package/build/components/post-excerpt/index.js +52 -12
  74. package/build/components/post-excerpt/index.js.map +1 -1
  75. package/build/components/post-excerpt/panel.js +118 -7
  76. package/build/components/post-excerpt/panel.js.map +1 -1
  77. package/build/components/post-excerpt/plugin.js +2 -2
  78. package/build/components/post-excerpt/plugin.js.map +1 -1
  79. package/build/components/post-featured-image/index.js +1 -1
  80. package/build/components/post-featured-image/index.js.map +1 -1
  81. package/build/components/post-last-edited-panel/index.js +33 -0
  82. package/build/components/post-last-edited-panel/index.js.map +1 -0
  83. package/build/components/post-publish-button/post-publish-button-or-toggle.js +100 -0
  84. package/build/components/post-publish-button/post-publish-button-or-toggle.js.map +1 -0
  85. package/build/components/post-schedule/panel.js +1 -1
  86. package/build/components/post-schedule/panel.js.map +1 -1
  87. package/build/components/post-status/index.js +9 -9
  88. package/build/components/post-status/index.js.map +1 -1
  89. package/build/components/post-template/block-theme.js +2 -2
  90. package/build/components/post-template/block-theme.js.map +1 -1
  91. package/build/components/post-template/classic-theme.js +0 -1
  92. package/build/components/post-template/classic-theme.js.map +1 -1
  93. package/build/components/post-template/swap-template-button.js +2 -5
  94. package/build/components/post-template/swap-template-button.js.map +1 -1
  95. package/build/components/post-url/index.js +2 -1
  96. package/build/components/post-url/index.js.map +1 -1
  97. package/build/components/post-url/panel.js +1 -1
  98. package/build/components/post-url/panel.js.map +1 -1
  99. package/build/components/preferences-modal/enable-publish-sidebar.js +34 -0
  100. package/build/components/preferences-modal/enable-publish-sidebar.js.map +1 -0
  101. package/build/components/preferences-modal/index.js +8 -2
  102. package/build/components/preferences-modal/index.js.map +1 -1
  103. package/build/components/preview-dropdown/index.js +3 -1
  104. package/build/components/preview-dropdown/index.js.map +1 -1
  105. package/build/components/provider/disable-non-page-content-blocks.js +23 -16
  106. package/build/components/provider/disable-non-page-content-blocks.js.map +1 -1
  107. package/build/components/save-publish-panels/index.js +89 -0
  108. package/build/components/save-publish-panels/index.js.map +1 -0
  109. package/build/components/start-page-options/index.js +5 -1
  110. package/build/components/start-page-options/index.js.map +1 -1
  111. package/build/private-apis.js +18 -2
  112. package/build/private-apis.js.map +1 -1
  113. package/build/store/selectors.js +3 -1
  114. package/build/store/selectors.js.map +1 -1
  115. package/build-module/components/autosave-monitor/index.js +15 -13
  116. package/build-module/components/autosave-monitor/index.js.map +1 -1
  117. package/build-module/components/character-count/index.js +6 -0
  118. package/build-module/components/character-count/index.js.map +1 -1
  119. package/build-module/components/collapsible-block-toolbar/index.js +65 -0
  120. package/build-module/components/collapsible-block-toolbar/index.js.map +1 -0
  121. package/build-module/components/document-outline/check.js +9 -0
  122. package/build-module/components/document-outline/check.js.map +1 -1
  123. package/build-module/components/document-outline/index.js +11 -0
  124. package/build-module/components/document-outline/index.js.map +1 -1
  125. package/build-module/components/document-tools/index.js +1 -8
  126. package/build-module/components/document-tools/index.js.map +1 -1
  127. package/build-module/components/editor-canvas/edit-template-blocks-notification.js +1 -1
  128. package/build-module/components/editor-canvas/edit-template-blocks-notification.js.map +1 -1
  129. package/build-module/components/editor-history/redo.js +11 -0
  130. package/build-module/components/editor-history/redo.js.map +1 -1
  131. package/build-module/components/editor-history/undo.js +11 -0
  132. package/build-module/components/editor-history/undo.js.map +1 -1
  133. package/build-module/components/editor-snackbars/index.js +6 -0
  134. package/build-module/components/editor-snackbars/index.js.map +1 -1
  135. package/build-module/components/global-keyboard-shortcuts/index.js +8 -0
  136. package/build-module/components/global-keyboard-shortcuts/index.js.map +1 -1
  137. package/build-module/components/global-keyboard-shortcuts/register-shortcuts.js +35 -0
  138. package/build-module/components/global-keyboard-shortcuts/register-shortcuts.js.map +1 -1
  139. package/build-module/components/inserter-sidebar/index.js +2 -5
  140. package/build-module/components/inserter-sidebar/index.js.map +1 -1
  141. package/build-module/components/keyboard-shortcut-help-modal/config.js +4 -0
  142. package/build-module/components/keyboard-shortcut-help-modal/config.js.map +1 -1
  143. package/build-module/components/list-view-sidebar/index.js +1 -1
  144. package/build-module/components/list-view-sidebar/index.js.map +1 -1
  145. package/build-module/components/more-menu/copy-content-menu-item.js +52 -0
  146. package/build-module/components/more-menu/copy-content-menu-item.js.map +1 -0
  147. package/build-module/components/more-menu/index.js +111 -0
  148. package/build-module/components/more-menu/index.js.map +1 -0
  149. package/build-module/components/more-menu/tools-more-menu-group.js +16 -0
  150. package/build-module/components/more-menu/tools-more-menu-group.js.map +1 -0
  151. package/build-module/components/more-menu/view-more-menu-group.js +17 -0
  152. package/build-module/components/more-menu/view-more-menu-group.js.map +1 -0
  153. package/build-module/components/page-attributes/check.js +9 -0
  154. package/build-module/components/page-attributes/check.js.map +1 -1
  155. package/build-module/components/page-attributes/order.js +7 -0
  156. package/build-module/components/page-attributes/order.js.map +1 -1
  157. package/build-module/components/page-attributes/panel.js +13 -6
  158. package/build-module/components/page-attributes/panel.js.map +1 -1
  159. package/build-module/components/page-attributes/parent.js +7 -0
  160. package/build-module/components/page-attributes/parent.js.map +1 -1
  161. package/build-module/components/plugin-post-publish-panel/index.js +1 -1
  162. package/build-module/components/plugin-post-publish-panel/index.js.map +1 -1
  163. package/build-module/components/plugin-pre-publish-panel/index.js +1 -1
  164. package/build-module/components/plugin-pre-publish-panel/index.js.map +1 -1
  165. package/build-module/components/plugin-sidebar/index.js +1 -1
  166. package/build-module/components/plugin-sidebar/index.js.map +1 -1
  167. package/build-module/components/post-actions/actions.js +100 -6
  168. package/build-module/components/post-actions/actions.js.map +1 -1
  169. package/build-module/components/post-actions/index.js +31 -8
  170. package/build-module/components/post-actions/index.js.map +1 -1
  171. package/build-module/components/post-author/check.js +10 -0
  172. package/build-module/components/post-author/check.js.map +1 -1
  173. package/build-module/components/post-author/index.js +6 -0
  174. package/build-module/components/post-author/index.js.map +1 -1
  175. package/build-module/components/post-author/panel.js +6 -0
  176. package/build-module/components/post-author/panel.js.map +1 -1
  177. package/build-module/components/post-card-panel/index.js +16 -51
  178. package/build-module/components/post-card-panel/index.js.map +1 -1
  179. package/build-module/components/post-content-information/index.js +66 -0
  180. package/build-module/components/post-content-information/index.js.map +1 -0
  181. package/build-module/components/post-discussion/panel.js +8 -6
  182. package/build-module/components/post-discussion/panel.js.map +1 -1
  183. package/build-module/components/post-excerpt/check.js +0 -19
  184. package/build-module/components/post-excerpt/check.js.map +1 -1
  185. package/build-module/components/post-excerpt/index.js +52 -11
  186. package/build-module/components/post-excerpt/index.js.map +1 -1
  187. package/build-module/components/post-excerpt/panel.js +118 -8
  188. package/build-module/components/post-excerpt/panel.js.map +1 -1
  189. package/build-module/components/post-excerpt/plugin.js +2 -2
  190. package/build-module/components/post-excerpt/plugin.js.map +1 -1
  191. package/build-module/components/post-featured-image/index.js +1 -1
  192. package/build-module/components/post-featured-image/index.js.map +1 -1
  193. package/build-module/components/post-last-edited-panel/index.js +26 -0
  194. package/build-module/components/post-last-edited-panel/index.js.map +1 -0
  195. package/build-module/components/post-publish-button/post-publish-button-or-toggle.js +91 -0
  196. package/build-module/components/post-publish-button/post-publish-button-or-toggle.js.map +1 -0
  197. package/build-module/components/post-schedule/panel.js +1 -1
  198. package/build-module/components/post-schedule/panel.js.map +1 -1
  199. package/build-module/components/post-status/index.js +9 -9
  200. package/build-module/components/post-status/index.js.map +1 -1
  201. package/build-module/components/post-template/block-theme.js +2 -2
  202. package/build-module/components/post-template/block-theme.js.map +1 -1
  203. package/build-module/components/post-template/classic-theme.js +0 -1
  204. package/build-module/components/post-template/classic-theme.js.map +1 -1
  205. package/build-module/components/post-template/swap-template-button.js +3 -6
  206. package/build-module/components/post-template/swap-template-button.js.map +1 -1
  207. package/build-module/components/post-url/index.js +2 -1
  208. package/build-module/components/post-url/index.js.map +1 -1
  209. package/build-module/components/post-url/panel.js +1 -1
  210. package/build-module/components/post-url/panel.js.map +1 -1
  211. package/build-module/components/preferences-modal/enable-publish-sidebar.js +27 -0
  212. package/build-module/components/preferences-modal/enable-publish-sidebar.js.map +1 -0
  213. package/build-module/components/preferences-modal/index.js +8 -2
  214. package/build-module/components/preferences-modal/index.js.map +1 -1
  215. package/build-module/components/preview-dropdown/index.js +3 -1
  216. package/build-module/components/preview-dropdown/index.js.map +1 -1
  217. package/build-module/components/provider/disable-non-page-content-blocks.js +24 -17
  218. package/build-module/components/provider/disable-non-page-content-blocks.js.map +1 -1
  219. package/build-module/components/save-publish-panels/index.js +80 -0
  220. package/build-module/components/save-publish-panels/index.js.map +1 -0
  221. package/build-module/components/start-page-options/index.js +5 -1
  222. package/build-module/components/start-page-options/index.js.map +1 -1
  223. package/build-module/private-apis.js +18 -2
  224. package/build-module/private-apis.js.map +1 -1
  225. package/build-module/store/selectors.js +3 -1
  226. package/build-module/store/selectors.js.map +1 -1
  227. package/build-style/style-rtl.css +207 -30
  228. package/build-style/style.css +207 -30
  229. package/package.json +35 -35
  230. package/src/components/autosave-monitor/index.js +15 -12
  231. package/src/components/character-count/index.js +5 -0
  232. package/src/components/collapsible-block-toolbar/index.js +77 -0
  233. package/src/components/collapsible-block-toolbar/style.scss +80 -0
  234. package/src/components/document-outline/check.js +8 -0
  235. package/src/components/document-outline/index.js +10 -0
  236. package/src/components/document-tools/index.js +0 -5
  237. package/src/components/editor-canvas/edit-template-blocks-notification.js +1 -1
  238. package/src/components/editor-history/redo.js +10 -0
  239. package/src/components/editor-history/undo.js +10 -0
  240. package/src/components/editor-snackbars/index.js +5 -0
  241. package/src/components/entities-saved-states/style.scss +7 -0
  242. package/src/components/global-keyboard-shortcuts/index.js +7 -0
  243. package/src/components/global-keyboard-shortcuts/register-shortcuts.js +41 -0
  244. package/src/components/inserter-sidebar/index.js +2 -5
  245. package/src/components/keyboard-shortcut-help-modal/config.js +10 -1
  246. package/src/components/list-view-sidebar/index.js +1 -1
  247. package/src/components/list-view-sidebar/style.scss +2 -2
  248. package/src/components/more-menu/copy-content-menu-item.js +51 -0
  249. package/src/components/more-menu/index.js +158 -0
  250. package/src/components/more-menu/tools-more-menu-group.js +11 -0
  251. package/src/components/more-menu/view-more-menu-group.js +13 -0
  252. package/src/components/page-attributes/check.js +8 -0
  253. package/src/components/page-attributes/order.js +6 -0
  254. package/src/components/page-attributes/panel.js +21 -17
  255. package/src/components/page-attributes/parent.js +6 -0
  256. package/src/components/plugin-post-publish-panel/index.js +1 -1
  257. package/src/components/plugin-pre-publish-panel/index.js +1 -1
  258. package/src/components/plugin-sidebar/index.js +1 -1
  259. package/src/components/post-actions/actions.js +120 -5
  260. package/src/components/post-actions/index.js +41 -7
  261. package/src/components/post-author/check.js +9 -0
  262. package/src/components/post-author/index.js +5 -0
  263. package/src/components/post-author/panel.js +5 -0
  264. package/src/components/post-card-panel/index.js +27 -82
  265. package/src/components/post-card-panel/style.scss +2 -6
  266. package/src/components/post-content-information/index.js +83 -0
  267. package/src/components/post-content-information/style.scss +6 -0
  268. package/src/components/post-discussion/panel.js +24 -20
  269. package/src/components/post-excerpt/check.js +0 -18
  270. package/src/components/post-excerpt/index.js +66 -15
  271. package/src/components/post-excerpt/panel.js +196 -19
  272. package/src/components/post-excerpt/plugin.js +2 -2
  273. package/src/components/post-excerpt/style.scss +24 -0
  274. package/src/components/post-featured-image/index.js +1 -1
  275. package/src/components/post-featured-image/style.scss +2 -8
  276. package/src/components/post-last-edited-panel/index.js +35 -0
  277. package/src/components/post-last-edited-panel/style.scss +6 -0
  278. package/src/components/post-panel-row/style.scss +3 -3
  279. package/src/components/post-publish-button/post-publish-button-or-toggle.js +102 -0
  280. package/src/components/post-publish-button/test/post-publish-button-or-toggle.js +63 -0
  281. package/src/components/post-publish-panel/style.scss +43 -0
  282. package/src/components/post-publish-panel/test/__snapshots__/index.js.snap +225 -75
  283. package/src/components/post-schedule/panel.js +1 -1
  284. package/src/components/post-schedule/style.scss +2 -4
  285. package/src/components/post-status/index.js +84 -76
  286. package/src/components/post-status/style.scss +0 -1
  287. package/src/components/post-template/block-theme.js +2 -2
  288. package/src/components/post-template/classic-theme.js +0 -1
  289. package/src/components/post-template/swap-template-button.js +3 -6
  290. package/src/components/post-text-editor/style.scss +1 -1
  291. package/src/components/post-title/style.scss +1 -1
  292. package/src/components/post-url/index.js +1 -0
  293. package/src/components/post-url/panel.js +1 -1
  294. package/src/components/preferences-modal/enable-publish-sidebar.js +28 -0
  295. package/src/components/preferences-modal/index.js +14 -0
  296. package/src/components/preview-dropdown/index.js +3 -1
  297. package/src/components/provider/disable-non-page-content-blocks.js +23 -21
  298. package/src/components/save-publish-panels/index.js +96 -0
  299. package/src/components/save-publish-panels/style.scss +36 -0
  300. package/src/components/start-page-options/index.js +6 -1
  301. package/src/private-apis.js +18 -2
  302. package/src/store/selectors.js +3 -1
  303. package/src/style.scss +4 -0
@@ -0,0 +1,80 @@
1
+ .editor-collapsible-block-toolbar {
2
+ overflow: hidden;
3
+ display: flex;
4
+ align-items: center;
5
+ height: $header-height;
6
+
7
+ .block-editor-block-contextual-toolbar {
8
+ border-bottom: 0;
9
+ height: 100%;
10
+ }
11
+
12
+ // These rules ensure that icons are always positioned in a way that lines up with the rest of the icons in the toolbar.
13
+ .block-editor-block-toolbar {
14
+ height: 100%;
15
+ // Push down so that buttons are centered vertically.
16
+ // It should be 14px (60px header height - 32px compact button height = 28 / 2),
17
+ // but there is a -1px top-margin down the stack that affects this.
18
+ padding-top: math.div($header-height - $button-size-compact, 2) + 1;
19
+
20
+ // Match the height of other buttons in the header toolbar.
21
+ .components-button:not(.block-editor-block-mover-button) {
22
+ height: $button-size-compact;
23
+ }
24
+ }
25
+
26
+ &::after {
27
+ content: "";
28
+ width: $border-width;
29
+ height: $grid-unit-30;
30
+ background-color: $gray-300;
31
+ margin-right: $grid-unit - $border-width;
32
+ }
33
+
34
+ // Modified group borders.
35
+ .components-toolbar-group,
36
+ .components-toolbar {
37
+ border-right: none;
38
+ position: relative;
39
+
40
+ &::after {
41
+ content: "";
42
+ width: $border-width;
43
+ height: $grid-unit-30;
44
+ background-color: $gray-300;
45
+ top: $grid-unit-05;
46
+ position: absolute;
47
+ right: -$border-width;
48
+ }
49
+
50
+ & .components-toolbar-group.components-toolbar-group {
51
+ &::after {
52
+ display: none;
53
+ }
54
+ }
55
+ }
56
+
57
+ .block-editor-block-mover {
58
+ // Match the height of other buttons in the header toolbar.
59
+ &.is-horizontal .block-editor-block-mover-button {
60
+ height: $button-size-compact;
61
+ overflow: visible;
62
+ }
63
+
64
+ // Move up a little to prevent the toolbar shift when focus is on the vertical movers.
65
+ @include break-small() {
66
+ &:not(.is-horizontal) .block-editor-block-mover__move-button-container {
67
+ position: relative;
68
+ top: -10px;
69
+ }
70
+ }
71
+ }
72
+
73
+ &.is-collapsed {
74
+ display: none;
75
+ }
76
+ }
77
+
78
+ .editor-collapsible-block-toolbar__toggle {
79
+ margin-left: 2px; // Allow focus ring to be fully visible
80
+ }
@@ -4,6 +4,14 @@
4
4
  import { useSelect } from '@wordpress/data';
5
5
  import { store as blockEditorStore } from '@wordpress/block-editor';
6
6
 
7
+ /**
8
+ * Component check if there are any headings (core/heading blocks) present in the document.
9
+ *
10
+ * @param {Object} props Props.
11
+ * @param {Element} props.children Children to be rendered.
12
+ *
13
+ * @return {Component|null} The component to be rendered or null if there are headings.
14
+ */
7
15
  export default function DocumentOutlineCheck( { children } ) {
8
16
  const hasHeadings = useSelect( ( select ) => {
9
17
  const { getGlobalBlockCount } = select( blockEditorStore );
@@ -98,6 +98,16 @@ const isEmptyHeading = ( heading ) =>
98
98
  ! heading.attributes.content ||
99
99
  heading.attributes.content.trim().length === 0;
100
100
 
101
+ /**
102
+ * Renders a document outline component.
103
+ *
104
+ * @param {Object} props Props.
105
+ * @param {Function} props.onSelect Function to be called when an outline item is selected.
106
+ * @param {boolean} props.isTitleSupported Indicates whether the title is supported.
107
+ * @param {boolean} props.hasOutlineItemsDisabled Indicates whether the outline items are disabled.
108
+ *
109
+ * @return {Component} The component to be rendered.
110
+ */
101
111
  export default function DocumentOutline( {
102
112
  onSelect,
103
113
  isTitleSupported,
@@ -13,7 +13,6 @@ 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';
@@ -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
  };
@@ -76,7 +73,6 @@ function DocumentTools( {
76
73
 
77
74
  const isLargeViewport = useViewportMatch( 'medium' );
78
75
  const isWideViewport = useViewportMatch( 'wide' );
79
- const { showFixedToolbar } = useShowBlockTools();
80
76
 
81
77
  /* translators: accessibility text for the editor toolbar */
82
78
  const toolbarAriaLabel = __( 'Document tools' );
@@ -117,7 +113,6 @@ function DocumentTools( {
117
113
  className
118
114
  ) }
119
115
  aria-label={ toolbarAriaLabel }
120
- shouldUseKeyboardFocusShortcut={ ! showFixedToolbar }
121
116
  variant="unstyled"
122
117
  >
123
118
  <div className="editor-document-tools__left">
@@ -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
  );
@@ -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 );
@@ -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 />;
@@ -10,7 +10,7 @@ import {
10
10
  __experimentalUseDialog as useDialog,
11
11
  } from '@wordpress/compose';
12
12
  import { __ } from '@wordpress/i18n';
13
- import { useEffect, useRef } from '@wordpress/element';
13
+ import { useRef } from '@wordpress/element';
14
14
  import { store as preferencesStore } from '@wordpress/preferences';
15
15
 
16
16
  /**
@@ -37,13 +37,10 @@ export default function InserterSidebar( {
37
37
  const TagName = ! isMobileViewport ? VisuallyHidden : 'div';
38
38
  const [ inserterDialogRef, inserterDialogProps ] = useDialog( {
39
39
  onClose: () => setIsInserterOpened( false ),
40
- focusOnMount: null,
40
+ focusOnMount: true,
41
41
  } );
42
42
 
43
43
  const libraryRef = useRef();
44
- useEffect( () => {
45
- libraryRef.current.focusSearch();
46
- }, [] );
47
44
 
48
45
  return (
49
46
  <div
@@ -37,7 +37,16 @@ export const textFormattingShortcuts = [
37
37
  description: __( 'Make the selected text inline code.' ),
38
38
  },
39
39
  {
40
- keyCombination: { modifier: 'access', character: '0' },
40
+ keyCombination: {
41
+ modifier: 'access',
42
+ character: '0',
43
+ },
44
+ aliases: [
45
+ {
46
+ modifier: 'access',
47
+ character: '7',
48
+ },
49
+ ],
41
50
  description: __( 'Convert the current heading to a paragraph.' ),
42
51
  },
43
52
  {
@@ -129,7 +129,7 @@ export default function ListViewSidebar() {
129
129
  // can be rendered internally.
130
130
  defaultTabId="list-view"
131
131
  >
132
- <div className="edit-post-editor__document-overview-panel__header">
132
+ <div className="editor-list-view-sidebar__header">
133
133
  <Button
134
134
  className="editor-list-view-sidebar__close-button"
135
135
  icon={ closeSmall }
@@ -8,7 +8,7 @@
8
8
  // @see packages/block-editor/src/components/inserter/style.scss
9
9
  width: 350px;
10
10
  }
11
- .edit-post-editor__document-overview-panel__header {
11
+ .editor-list-view-sidebar__header {
12
12
  display: flex;
13
13
  border-bottom: $border-width solid $gray-300;
14
14
  }
@@ -49,7 +49,7 @@
49
49
  scrollbar-gutter: auto;
50
50
 
51
51
  // The table cells use an extra pixels of space left and right. We compensate for that here.
52
- padding: $grid-unit-10 ($grid-unit-10 - $border-width - $border-width);
52
+ padding: $grid-unit-05;
53
53
  }
54
54
 
55
55
  .editor-list-view-sidebar__list-view-container {
@@ -0,0 +1,51 @@
1
+ /**
2
+ * WordPress dependencies
3
+ */
4
+ import { MenuItem } from '@wordpress/components';
5
+ import { useSelect, useDispatch } from '@wordpress/data';
6
+ import { __ } from '@wordpress/i18n';
7
+ import { useCopyToClipboard } from '@wordpress/compose';
8
+ import { store as noticesStore } from '@wordpress/notices';
9
+ import { store as coreStore } from '@wordpress/core-data';
10
+ import { __unstableSerializeAndClean } from '@wordpress/blocks';
11
+
12
+ /**
13
+ * Internal dependencies
14
+ */
15
+ import { store as editorStore } from '../../store';
16
+
17
+ export default function CopyContentMenuItem() {
18
+ const { createNotice } = useDispatch( noticesStore );
19
+ const { getCurrentPostId, getCurrentPostType } = useSelect( editorStore );
20
+ const { getEditedEntityRecord } = useSelect( coreStore );
21
+
22
+ function getText() {
23
+ const record = getEditedEntityRecord(
24
+ 'postType',
25
+ getCurrentPostType(),
26
+ getCurrentPostId()
27
+ );
28
+ if ( ! record ) {
29
+ return '';
30
+ }
31
+
32
+ if ( typeof record.content === 'function' ) {
33
+ return record.content( record );
34
+ } else if ( record.blocks ) {
35
+ return __unstableSerializeAndClean( record.blocks );
36
+ } else if ( record.content ) {
37
+ return record.content;
38
+ }
39
+ }
40
+
41
+ function onSuccess() {
42
+ createNotice( 'info', __( 'All content copied.' ), {
43
+ isDismissible: true,
44
+ type: 'snackbar',
45
+ } );
46
+ }
47
+
48
+ const ref = useCopyToClipboard( getText, onSuccess );
49
+
50
+ return <MenuItem ref={ ref }>{ __( 'Copy all blocks' ) }</MenuItem>;
51
+ }
@@ -0,0 +1,158 @@
1
+ /**
2
+ * WordPress dependencies
3
+ */
4
+ import { __, _x } from '@wordpress/i18n';
5
+ import { useSelect, useDispatch } from '@wordpress/data';
6
+ import { displayShortcut } from '@wordpress/keycodes';
7
+ import { external, moreVertical } from '@wordpress/icons';
8
+ import {
9
+ MenuGroup,
10
+ MenuItem,
11
+ VisuallyHidden,
12
+ DropdownMenu,
13
+ } from '@wordpress/components';
14
+ import {
15
+ PreferenceToggleMenuItem,
16
+ store as preferencesStore,
17
+ } from '@wordpress/preferences';
18
+ import { store as interfaceStore, ActionItem } from '@wordpress/interface';
19
+
20
+ /**
21
+ * Internal dependencies
22
+ */
23
+ import CopyContentMenuItem from './copy-content-menu-item';
24
+ import ModeSwitcher from '../mode-switcher';
25
+ import ToolsMoreMenuGroup from './tools-more-menu-group';
26
+ import ViewMoreMenuGroup from './view-more-menu-group';
27
+ import { store as editorStore } from '../../store';
28
+
29
+ export default function MoreMenu() {
30
+ const { openModal } = useDispatch( interfaceStore );
31
+ const { set: setPreference } = useDispatch( preferencesStore );
32
+ const { toggleDistractionFree } = useDispatch( editorStore );
33
+ const showIconLabels = useSelect(
34
+ ( select ) =>
35
+ select( preferencesStore ).get( 'core', 'showIconLabels' ),
36
+ []
37
+ );
38
+ const turnOffDistractionFree = () => {
39
+ setPreference( 'core', 'distractionFree', false );
40
+ };
41
+
42
+ return (
43
+ <>
44
+ <DropdownMenu
45
+ icon={ moreVertical }
46
+ label={ __( 'Options' ) }
47
+ popoverProps={ {
48
+ placement: 'bottom-end',
49
+ className: 'more-menu-dropdown__content',
50
+ } }
51
+ toggleProps={ {
52
+ showTooltip: ! showIconLabels,
53
+ ...( showIconLabels && { variant: 'tertiary' } ),
54
+ tooltipPosition: 'bottom',
55
+ size: 'compact',
56
+ } }
57
+ >
58
+ { ( { onClose } ) => (
59
+ <>
60
+ <MenuGroup label={ _x( 'View', 'noun' ) }>
61
+ <PreferenceToggleMenuItem
62
+ scope="core"
63
+ name="fixedToolbar"
64
+ onToggle={ turnOffDistractionFree }
65
+ label={ __( 'Top toolbar' ) }
66
+ info={ __(
67
+ 'Access all block and document tools in a single place'
68
+ ) }
69
+ messageActivated={ __(
70
+ 'Top toolbar activated'
71
+ ) }
72
+ messageDeactivated={ __(
73
+ 'Top toolbar deactivated'
74
+ ) }
75
+ />
76
+ <PreferenceToggleMenuItem
77
+ scope="core"
78
+ name="distractionFree"
79
+ label={ __( 'Distraction free' ) }
80
+ info={ __( 'Write with calmness' ) }
81
+ handleToggling={ false }
82
+ onToggle={ toggleDistractionFree }
83
+ messageActivated={ __(
84
+ 'Distraction free mode activated'
85
+ ) }
86
+ messageDeactivated={ __(
87
+ 'Distraction free mode deactivated'
88
+ ) }
89
+ shortcut={ displayShortcut.primaryShift(
90
+ '\\'
91
+ ) }
92
+ />
93
+ <PreferenceToggleMenuItem
94
+ scope="core"
95
+ name="focusMode"
96
+ label={ __( 'Spotlight mode' ) }
97
+ info={ __( 'Focus on one block at a time' ) }
98
+ messageActivated={ __(
99
+ 'Spotlight mode activated'
100
+ ) }
101
+ messageDeactivated={ __(
102
+ 'Spotlight mode deactivated'
103
+ ) }
104
+ />
105
+ <ViewMoreMenuGroup.Slot fillProps={ { onClose } } />
106
+ </MenuGroup>
107
+ <ModeSwitcher />
108
+ <ActionItem.Slot
109
+ name="core/plugin-more-menu"
110
+ label={ __( 'Plugins' ) }
111
+ as={ MenuGroup }
112
+ fillProps={ { onClick: onClose } }
113
+ />
114
+ <MenuGroup label={ __( 'Tools' ) }>
115
+ <MenuItem
116
+ onClick={ () =>
117
+ openModal( 'editor/keyboard-shortcut-help' )
118
+ }
119
+ shortcut={ displayShortcut.access( 'h' ) }
120
+ >
121
+ { __( 'Keyboard shortcuts' ) }
122
+ </MenuItem>
123
+ <CopyContentMenuItem />
124
+ <MenuItem
125
+ icon={ external }
126
+ href={ __(
127
+ 'https://wordpress.org/documentation/article/wordpress-block-editor/'
128
+ ) }
129
+ target="_blank"
130
+ rel="noopener noreferrer"
131
+ >
132
+ { __( 'Help' ) }
133
+ <VisuallyHidden as="span">
134
+ {
135
+ /* translators: accessibility text */
136
+ __( '(opens in a new tab)' )
137
+ }
138
+ </VisuallyHidden>
139
+ </MenuItem>
140
+ <ToolsMoreMenuGroup.Slot
141
+ fillProps={ { onClose } }
142
+ />
143
+ </MenuGroup>
144
+ <MenuGroup>
145
+ <MenuItem
146
+ onClick={ () =>
147
+ openModal( 'editor/preferences' )
148
+ }
149
+ >
150
+ { __( 'Preferences' ) }
151
+ </MenuItem>
152
+ </MenuGroup>
153
+ </>
154
+ ) }
155
+ </DropdownMenu>
156
+ </>
157
+ );
158
+ }
@@ -0,0 +1,11 @@
1
+ /**
2
+ * WordPress dependencies
3
+ */
4
+ import { createSlotFill } from '@wordpress/components';
5
+
6
+ const { Fill: ToolsMoreMenuGroup, Slot } =
7
+ createSlotFill( 'ToolsMoreMenuGroup' );
8
+
9
+ ToolsMoreMenuGroup.Slot = ( { fillProps } ) => <Slot fillProps={ fillProps } />;
10
+
11
+ export default ToolsMoreMenuGroup;
@@ -0,0 +1,13 @@
1
+ /**
2
+ * WordPress dependencies
3
+ */
4
+ import { createSlotFill } from '@wordpress/components';
5
+ import { Platform } from '@wordpress/element';
6
+
7
+ const { Fill: ViewMoreMenuGroup, Slot } = createSlotFill(
8
+ Platform.OS === 'web' ? Symbol( 'ViewMoreMenuGroup' ) : 'ViewMoreMenuGroup'
9
+ );
10
+
11
+ ViewMoreMenuGroup.Slot = ( { fillProps } ) => <Slot fillProps={ fillProps } />;
12
+
13
+ export default ViewMoreMenuGroup;
@@ -9,6 +9,14 @@ import { store as coreStore } from '@wordpress/core-data';
9
9
  */
10
10
  import { store as editorStore } from '../../store';
11
11
 
12
+ /**
13
+ * Wrapper component that renders its children only if the post type supports page attributes.
14
+ *
15
+ * @param {Object} props - The component props.
16
+ * @param {Element} props.children - The child components to render.
17
+ *
18
+ * @return {Component|null} The rendered child components or null if page attributes are not supported.
19
+ */
12
20
  export function PageAttributesCheck( { children } ) {
13
21
  const supportsPageAttributes = useSelect( ( select ) => {
14
22
  const { getEditedPostAttribute } = select( editorStore );
@@ -53,6 +53,12 @@ function PageAttributesOrder() {
53
53
  );
54
54
  }
55
55
 
56
+ /**
57
+ * Renders the Page Attributes Order component. A number input in an editor interface
58
+ * for setting the order of a given page.
59
+ *
60
+ * @return {Component} The component to be rendered.
61
+ */
56
62
  export default function PageAttributesOrderWithChecks() {
57
63
  return (
58
64
  <PostTypeSupportCheck supportKeys="page-attributes">
@@ -17,7 +17,7 @@ import PageAttributesParent from './parent';
17
17
 
18
18
  const PANEL_NAME = 'page-attributes';
19
19
 
20
- export function PageAttributesPanel() {
20
+ function AttributesPanel() {
21
21
  const { isEnabled, isOpened, postType } = useSelect( ( select ) => {
22
22
  const {
23
23
  getEditedPostAttribute,
@@ -38,25 +38,29 @@ export function PageAttributesPanel() {
38
38
  return null;
39
39
  }
40
40
 
41
- const onTogglePanel = ( ...args ) =>
42
- toggleEditorPanelOpened( PANEL_NAME, ...args );
41
+ return (
42
+ <PanelBody
43
+ title={ postType?.labels?.attributes ?? __( 'Page attributes' ) }
44
+ opened={ isOpened }
45
+ onToggle={ () => toggleEditorPanelOpened( PANEL_NAME ) }
46
+ >
47
+ <PageAttributesParent />
48
+ <PanelRow>
49
+ <PageAttributesOrder />
50
+ </PanelRow>
51
+ </PanelBody>
52
+ );
53
+ }
43
54
 
55
+ /**
56
+ * Renders the Page Attributes Panel component.
57
+ *
58
+ * @return {Component} The component to be rendered.
59
+ */
60
+ export default function PageAttributesPanel() {
44
61
  return (
45
62
  <PageAttributesCheck>
46
- <PanelBody
47
- title={
48
- postType?.labels?.attributes ?? __( 'Page attributes' )
49
- }
50
- opened={ isOpened }
51
- onToggle={ onTogglePanel }
52
- >
53
- <PageAttributesParent />
54
- <PanelRow>
55
- <PageAttributesOrder />
56
- </PanelRow>
57
- </PanelBody>
63
+ <AttributesPanel />
58
64
  </PageAttributesCheck>
59
65
  );
60
66
  }
61
-
62
- export default PageAttributesPanel;