@wordpress/editor 13.24.1 → 13.26.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 (307) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/LICENSE.md +1 -1
  3. package/build/components/document-bar/index.js +164 -0
  4. package/build/components/document-bar/index.js.map +1 -0
  5. package/build/components/document-outline/index.js +82 -1
  6. package/build/components/document-outline/index.js.map +1 -1
  7. package/build/components/document-tools/index.js +160 -0
  8. package/build/components/document-tools/index.js.map +1 -0
  9. package/build/components/editor-canvas/edit-template-blocks-notification.js +106 -0
  10. package/build/components/editor-canvas/edit-template-blocks-notification.js.map +1 -0
  11. package/build/components/editor-canvas/index.js +298 -0
  12. package/build/components/editor-canvas/index.js.map +1 -0
  13. package/build/components/entities-saved-states/index.js +3 -1
  14. package/build/components/entities-saved-states/index.js.map +1 -1
  15. package/build/components/global-keyboard-shortcuts/index.js +12 -2
  16. package/build/components/global-keyboard-shortcuts/index.js.map +1 -1
  17. package/build/components/global-keyboard-shortcuts/register-shortcuts.js +9 -0
  18. package/build/components/global-keyboard-shortcuts/register-shortcuts.js.map +1 -1
  19. package/build/components/index.js +72 -8
  20. package/build/components/index.js.map +1 -1
  21. package/build/components/index.native.js +9 -1
  22. package/build/components/index.native.js.map +1 -1
  23. package/build/components/inserter-sidebar/index.js +77 -0
  24. package/build/components/inserter-sidebar/index.js.map +1 -0
  25. package/build/components/list-view-sidebar/index.js +150 -0
  26. package/build/components/list-view-sidebar/index.js.map +1 -0
  27. package/build/components/list-view-sidebar/list-view-outline.js +28 -0
  28. package/build/components/list-view-sidebar/list-view-outline.js.map +1 -0
  29. package/build/components/offline-status/index.native.js +85 -0
  30. package/build/components/offline-status/index.native.js.map +1 -0
  31. package/build/components/page-attributes/panel.js +63 -0
  32. package/build/components/page-attributes/panel.js.map +1 -0
  33. package/build/components/post-discussion/panel.js +59 -0
  34. package/build/components/post-discussion/panel.js.map +1 -0
  35. package/build/components/post-excerpt/check.js +19 -0
  36. package/build/components/post-excerpt/check.js.map +1 -1
  37. package/build/components/post-excerpt/panel.js +55 -0
  38. package/build/components/post-excerpt/panel.js.map +1 -0
  39. package/build/components/post-excerpt/plugin.js +72 -0
  40. package/build/components/post-excerpt/plugin.js.map +1 -0
  41. package/build/components/post-featured-image/index.js +5 -8
  42. package/build/components/post-featured-image/index.js.map +1 -1
  43. package/build/components/post-featured-image/panel.js +60 -0
  44. package/build/components/post-featured-image/panel.js.map +1 -0
  45. package/build/components/post-last-revision/panel.js +27 -0
  46. package/build/components/post-last-revision/panel.js.map +1 -0
  47. package/build/components/post-publish-button/index.js +1 -0
  48. package/build/components/post-publish-button/index.js.map +1 -1
  49. package/build/components/post-publish-panel/maybe-upload-media.js +2 -4
  50. package/build/components/post-publish-panel/maybe-upload-media.js.map +1 -1
  51. package/build/components/post-saved-state/index.js +13 -8
  52. package/build/components/post-saved-state/index.js.map +1 -1
  53. package/build/components/post-schedule/panel.js +1 -1
  54. package/build/components/post-schedule/panel.js.map +1 -1
  55. package/build/components/post-taxonomies/panel.js +68 -0
  56. package/build/components/post-taxonomies/panel.js.map +1 -0
  57. package/build/components/post-template/block-theme.js +100 -0
  58. package/build/components/post-template/block-theme.js.map +1 -0
  59. package/build/components/post-template/classic-theme.js +171 -0
  60. package/build/components/post-template/classic-theme.js.map +1 -0
  61. package/build/components/post-template/create-new-template-modal.js +98 -0
  62. package/build/components/post-template/create-new-template-modal.js.map +1 -0
  63. package/build/components/post-template/create-new-template.js +55 -0
  64. package/build/components/post-template/create-new-template.js.map +1 -0
  65. package/build/components/post-template/hooks.js +88 -0
  66. package/build/components/post-template/hooks.js.map +1 -0
  67. package/build/components/post-template/panel.js +70 -0
  68. package/build/components/post-template/panel.js.map +1 -0
  69. package/build/components/post-template/reset-default-template.js +48 -0
  70. package/build/components/post-template/reset-default-template.js.map +1 -0
  71. package/build/components/post-template/swap-template-button.js +86 -0
  72. package/build/components/post-template/swap-template-button.js.map +1 -0
  73. package/build/components/post-title/index.native.js +25 -15
  74. package/build/components/post-title/index.native.js.map +1 -1
  75. package/build/components/post-view-link/index.js +58 -0
  76. package/build/components/post-view-link/index.js.map +1 -0
  77. package/build/components/post-visibility/check.js +5 -17
  78. package/build/components/post-visibility/check.js.map +1 -1
  79. package/build/components/preview-dropdown/index.js +118 -0
  80. package/build/components/preview-dropdown/index.js.map +1 -0
  81. package/build/components/provider/index.js +24 -82
  82. package/build/components/provider/index.js.map +1 -1
  83. package/build/components/provider/index.native.js +36 -8
  84. package/build/components/provider/index.native.js.map +1 -1
  85. package/build/components/provider/navigation-block-editing-mode.js +40 -0
  86. package/build/components/provider/navigation-block-editing-mode.js.map +1 -0
  87. package/build/components/provider/use-block-editor-settings.js +38 -15
  88. package/build/components/provider/use-block-editor-settings.js.map +1 -1
  89. package/build/hooks/index.js +1 -0
  90. package/build/hooks/index.js.map +1 -1
  91. package/build/hooks/pattern-partial-syncing.js +49 -0
  92. package/build/hooks/pattern-partial-syncing.js.map +1 -0
  93. package/build/private-apis.js +14 -0
  94. package/build/private-apis.js.map +1 -1
  95. package/build/store/actions.js +161 -13
  96. package/build/store/actions.js.map +1 -1
  97. package/build/store/defaults.js +2 -1
  98. package/build/store/defaults.js.map +1 -1
  99. package/build/store/index.js +5 -0
  100. package/build/store/index.js.map +1 -1
  101. package/build/store/private-actions.js +52 -0
  102. package/build/store/private-actions.js.map +1 -0
  103. package/build/store/private-selectors.js +52 -0
  104. package/build/store/private-selectors.js.map +1 -0
  105. package/build/store/reducer.js +109 -27
  106. package/build/store/reducer.js.map +1 -1
  107. package/build/store/reducer.native.js +0 -1
  108. package/build/store/reducer.native.js.map +1 -1
  109. package/build/store/selectors.js +104 -9
  110. package/build/store/selectors.js.map +1 -1
  111. package/build/utils/media-upload/index.js +8 -2
  112. package/build/utils/media-upload/index.js.map +1 -1
  113. package/build-module/components/document-bar/index.js +156 -0
  114. package/build-module/components/document-bar/index.js.map +1 -0
  115. package/build-module/components/document-outline/index.js +82 -1
  116. package/build-module/components/document-outline/index.js.map +1 -1
  117. package/build-module/components/document-tools/index.js +151 -0
  118. package/build-module/components/document-tools/index.js.map +1 -0
  119. package/build-module/components/editor-canvas/edit-template-blocks-notification.js +100 -0
  120. package/build-module/components/editor-canvas/edit-template-blocks-notification.js.map +1 -0
  121. package/build-module/components/editor-canvas/index.js +289 -0
  122. package/build-module/components/editor-canvas/index.js.map +1 -0
  123. package/build-module/components/entities-saved-states/index.js +3 -1
  124. package/build-module/components/entities-saved-states/index.js.map +1 -1
  125. package/build-module/components/global-keyboard-shortcuts/index.js +12 -2
  126. package/build-module/components/global-keyboard-shortcuts/index.js.map +1 -1
  127. package/build-module/components/global-keyboard-shortcuts/register-shortcuts.js +9 -0
  128. package/build-module/components/global-keyboard-shortcuts/register-shortcuts.js.map +1 -1
  129. package/build-module/components/index.js +9 -1
  130. package/build-module/components/index.js.map +1 -1
  131. package/build-module/components/index.native.js +1 -0
  132. package/build-module/components/index.native.js.map +1 -1
  133. package/build-module/components/inserter-sidebar/index.js +70 -0
  134. package/build-module/components/inserter-sidebar/index.js.map +1 -0
  135. package/build-module/components/list-view-sidebar/index.js +142 -0
  136. package/build-module/components/list-view-sidebar/index.js.map +1 -0
  137. package/build-module/components/list-view-sidebar/list-view-outline.js +20 -0
  138. package/build-module/components/list-view-sidebar/list-view-outline.js.map +1 -0
  139. package/build-module/components/offline-status/index.native.js +77 -0
  140. package/build-module/components/offline-status/index.native.js.map +1 -0
  141. package/build-module/components/page-attributes/panel.js +53 -0
  142. package/build-module/components/page-attributes/panel.js.map +1 -0
  143. package/build-module/components/post-discussion/panel.js +50 -0
  144. package/build-module/components/post-discussion/panel.js.map +1 -0
  145. package/build-module/components/post-excerpt/check.js +19 -0
  146. package/build-module/components/post-excerpt/check.js.map +1 -1
  147. package/build-module/components/post-excerpt/panel.js +48 -0
  148. package/build-module/components/post-excerpt/panel.js.map +1 -0
  149. package/build-module/components/post-excerpt/plugin.js +64 -0
  150. package/build-module/components/post-excerpt/plugin.js.map +1 -0
  151. package/build-module/components/post-featured-image/index.js +5 -8
  152. package/build-module/components/post-featured-image/index.js.map +1 -1
  153. package/build-module/components/post-featured-image/panel.js +51 -0
  154. package/build-module/components/post-featured-image/panel.js.map +1 -0
  155. package/build-module/components/post-last-revision/panel.js +18 -0
  156. package/build-module/components/post-last-revision/panel.js.map +1 -0
  157. package/build-module/components/post-publish-button/index.js +1 -0
  158. package/build-module/components/post-publish-button/index.js.map +1 -1
  159. package/build-module/components/post-publish-panel/maybe-upload-media.js +2 -4
  160. package/build-module/components/post-publish-panel/maybe-upload-media.js.map +1 -1
  161. package/build-module/components/post-saved-state/index.js +13 -8
  162. package/build-module/components/post-saved-state/index.js.map +1 -1
  163. package/build-module/components/post-schedule/panel.js +1 -1
  164. package/build-module/components/post-schedule/panel.js.map +1 -1
  165. package/build-module/components/post-taxonomies/panel.js +59 -0
  166. package/build-module/components/post-taxonomies/panel.js.map +1 -0
  167. package/build-module/components/post-template/block-theme.js +92 -0
  168. package/build-module/components/post-template/block-theme.js.map +1 -0
  169. package/build-module/components/post-template/classic-theme.js +162 -0
  170. package/build-module/components/post-template/classic-theme.js.map +1 -0
  171. package/build-module/components/post-template/create-new-template-modal.js +91 -0
  172. package/build-module/components/post-template/create-new-template-modal.js.map +1 -0
  173. package/build-module/components/post-template/create-new-template.js +47 -0
  174. package/build-module/components/post-template/create-new-template.js.map +1 -0
  175. package/build-module/components/post-template/hooks.js +78 -0
  176. package/build-module/components/post-template/hooks.js.map +1 -0
  177. package/build-module/components/post-template/panel.js +62 -0
  178. package/build-module/components/post-template/panel.js.map +1 -0
  179. package/build-module/components/post-template/reset-default-template.js +41 -0
  180. package/build-module/components/post-template/reset-default-template.js.map +1 -0
  181. package/build-module/components/post-template/swap-template-button.js +79 -0
  182. package/build-module/components/post-template/swap-template-button.js.map +1 -0
  183. package/build-module/components/post-title/index.native.js +26 -16
  184. package/build-module/components/post-title/index.native.js.map +1 -1
  185. package/build-module/components/post-view-link/index.js +51 -0
  186. package/build-module/components/post-view-link/index.js.map +1 -0
  187. package/build-module/components/post-visibility/check.js +6 -16
  188. package/build-module/components/post-visibility/check.js.map +1 -1
  189. package/build-module/components/preview-dropdown/index.js +110 -0
  190. package/build-module/components/preview-dropdown/index.js.map +1 -0
  191. package/build-module/components/provider/index.js +25 -83
  192. package/build-module/components/provider/index.js.map +1 -1
  193. package/build-module/components/provider/index.native.js +37 -9
  194. package/build-module/components/provider/index.native.js.map +1 -1
  195. package/build-module/components/provider/navigation-block-editing-mode.js +34 -0
  196. package/build-module/components/provider/navigation-block-editing-mode.js.map +1 -0
  197. package/build-module/components/provider/use-block-editor-settings.js +38 -15
  198. package/build-module/components/provider/use-block-editor-settings.js.map +1 -1
  199. package/build-module/hooks/index.js +1 -0
  200. package/build-module/hooks/index.js.map +1 -1
  201. package/build-module/hooks/pattern-partial-syncing.js +46 -0
  202. package/build-module/hooks/pattern-partial-syncing.js.map +1 -0
  203. package/build-module/private-apis.js +14 -0
  204. package/build-module/private-apis.js.map +1 -1
  205. package/build-module/store/actions.js +147 -9
  206. package/build-module/store/actions.js.map +1 -1
  207. package/build-module/store/defaults.js +2 -1
  208. package/build-module/store/defaults.js.map +1 -1
  209. package/build-module/store/index.js +5 -0
  210. package/build-module/store/index.js.map +1 -1
  211. package/build-module/store/private-actions.js +44 -0
  212. package/build-module/store/private-actions.js.map +1 -0
  213. package/build-module/store/private-selectors.js +43 -0
  214. package/build-module/store/private-selectors.js.map +1 -0
  215. package/build-module/store/reducer.js +103 -26
  216. package/build-module/store/reducer.js.map +1 -1
  217. package/build-module/store/reducer.native.js +1 -2
  218. package/build-module/store/reducer.native.js.map +1 -1
  219. package/build-module/store/selectors.js +93 -6
  220. package/build-module/store/selectors.js.map +1 -1
  221. package/build-module/utils/media-upload/index.js +8 -2
  222. package/build-module/utils/media-upload/index.js.map +1 -1
  223. package/build-style/style-rtl.css +433 -0
  224. package/build-style/style.css +433 -0
  225. package/package.json +32 -31
  226. package/src/components/document-bar/index.js +193 -0
  227. package/src/components/document-bar/style.scss +130 -0
  228. package/src/components/document-outline/index.js +48 -1
  229. package/src/components/document-outline/style.scss +12 -0
  230. package/src/components/document-tools/index.js +177 -0
  231. package/src/components/document-tools/style.scss +98 -0
  232. package/src/components/editor-canvas/edit-template-blocks-notification.js +108 -0
  233. package/src/components/editor-canvas/index.js +386 -0
  234. package/src/components/editor-canvas/style.scss +5 -0
  235. package/src/components/entities-saved-states/index.js +3 -1
  236. package/src/components/entities-saved-states/style.scss +4 -0
  237. package/src/components/global-keyboard-shortcuts/index.js +12 -2
  238. package/src/components/global-keyboard-shortcuts/register-shortcuts.js +10 -0
  239. package/src/components/index.js +9 -1
  240. package/src/components/index.native.js +1 -0
  241. package/src/components/inserter-sidebar/index.js +73 -0
  242. package/src/components/inserter-sidebar/style.scss +22 -0
  243. package/src/components/list-view-sidebar/index.js +169 -0
  244. package/src/components/list-view-sidebar/list-view-outline.js +37 -0
  245. package/src/components/list-view-sidebar/style.scss +84 -0
  246. package/src/components/offline-status/index.native.js +101 -0
  247. package/src/components/offline-status/style.native.scss +28 -0
  248. package/src/components/offline-status/test/index.native.js +108 -0
  249. package/src/components/page-attributes/panel.js +62 -0
  250. package/src/components/post-discussion/panel.js +57 -0
  251. package/src/components/post-excerpt/check.js +18 -0
  252. package/src/components/post-excerpt/panel.js +57 -0
  253. package/src/components/post-excerpt/plugin.js +61 -0
  254. package/src/components/post-excerpt/test/plugin.js +36 -0
  255. package/src/components/post-featured-image/index.js +3 -7
  256. package/src/components/post-featured-image/panel.js +55 -0
  257. package/src/components/post-last-revision/panel.js +22 -0
  258. package/src/components/post-last-revision/style.scss +10 -0
  259. package/src/components/post-publish-button/index.js +1 -0
  260. package/src/components/post-publish-panel/maybe-upload-media.js +3 -8
  261. package/src/components/post-saved-state/index.js +9 -8
  262. package/src/components/post-saved-state/test/__snapshots__/index.js.snap +2 -2
  263. package/src/components/post-schedule/panel.js +1 -1
  264. package/src/components/post-taxonomies/panel.js +66 -0
  265. package/src/components/post-template/block-theme.js +110 -0
  266. package/src/components/post-template/classic-theme.js +213 -0
  267. package/src/components/post-template/create-new-template-modal.js +139 -0
  268. package/src/components/post-template/create-new-template.js +50 -0
  269. package/src/components/post-template/hooks.js +95 -0
  270. package/src/components/post-template/panel.js +66 -0
  271. package/src/components/post-template/reset-default-template.js +43 -0
  272. package/src/components/post-template/style.scss +52 -0
  273. package/src/components/post-template/swap-template-button.js +86 -0
  274. package/src/components/post-title/index.native.js +32 -18
  275. package/src/components/post-title/style.scss +1 -0
  276. package/src/components/post-title/test/__snapshots__/index.native.js.snap +25 -0
  277. package/src/components/post-title/test/index.native.js +78 -0
  278. package/src/components/post-view-link/index.js +47 -0
  279. package/src/components/post-visibility/check.js +10 -15
  280. package/src/components/post-visibility/test/check.js +24 -13
  281. package/src/components/preview-dropdown/index.js +133 -0
  282. package/src/components/preview-dropdown/style.scss +5 -0
  283. package/src/components/provider/index.js +28 -118
  284. package/src/components/provider/index.native.js +55 -14
  285. package/src/components/provider/navigation-block-editing-mode.js +37 -0
  286. package/src/components/provider/use-block-editor-settings.js +42 -17
  287. package/src/hooks/index.js +1 -0
  288. package/src/hooks/pattern-partial-syncing.js +73 -0
  289. package/src/private-apis.js +14 -0
  290. package/src/store/actions.js +160 -9
  291. package/src/store/defaults.js +1 -0
  292. package/src/store/index.js +5 -0
  293. package/src/store/private-actions.js +61 -0
  294. package/src/store/private-selectors.js +51 -0
  295. package/src/store/reducer.js +103 -26
  296. package/src/store/reducer.native.js +0 -2
  297. package/src/store/selectors.js +144 -42
  298. package/src/store/test/actions.js +56 -0
  299. package/src/store/test/reducer.js +98 -0
  300. package/src/store/test/selectors.js +137 -147
  301. package/src/style.scss +7 -0
  302. package/src/utils/media-upload/index.js +9 -2
  303. package/build/components/post-template/index.js +0 -66
  304. package/build/components/post-template/index.js.map +0 -1
  305. package/build-module/components/post-template/index.js +0 -57
  306. package/build-module/components/post-template/index.js.map +0 -1
  307. package/src/components/post-template/index.js +0 -64
@@ -0,0 +1,57 @@
1
+ /**
2
+ * WordPress dependencies
3
+ */
4
+ import { __ } from '@wordpress/i18n';
5
+ import { PanelBody } from '@wordpress/components';
6
+ import { useDispatch, useSelect } from '@wordpress/data';
7
+
8
+ /**
9
+ * Internal dependencies
10
+ */
11
+ import PostExcerptForm from './index';
12
+ import PostExcerptCheck from './check';
13
+ import PluginPostExcerpt from './plugin';
14
+ import { store as editorStore } from '../../store';
15
+
16
+ /**
17
+ * Module Constants
18
+ */
19
+ const PANEL_NAME = 'post-excerpt';
20
+
21
+ export default function PostExcerptPanel() {
22
+ const { isOpened, isEnabled } = useSelect( ( select ) => {
23
+ const { isEditorPanelOpened, isEditorPanelEnabled } =
24
+ select( editorStore );
25
+
26
+ return {
27
+ isOpened: isEditorPanelOpened( PANEL_NAME ),
28
+ isEnabled: isEditorPanelEnabled( PANEL_NAME ),
29
+ };
30
+ }, [] );
31
+
32
+ const { toggleEditorPanelOpened } = useDispatch( editorStore );
33
+ const toggleExcerptPanel = () => toggleEditorPanelOpened( PANEL_NAME );
34
+
35
+ if ( ! isEnabled ) {
36
+ return null;
37
+ }
38
+
39
+ return (
40
+ <PostExcerptCheck>
41
+ <PanelBody
42
+ title={ __( 'Excerpt' ) }
43
+ opened={ isOpened }
44
+ onToggle={ toggleExcerptPanel }
45
+ >
46
+ <PluginPostExcerpt.Slot>
47
+ { ( fills ) => (
48
+ <>
49
+ <PostExcerptForm />
50
+ { fills }
51
+ </>
52
+ ) }
53
+ </PluginPostExcerpt.Slot>
54
+ </PanelBody>
55
+ </PostExcerptCheck>
56
+ );
57
+ }
@@ -0,0 +1,61 @@
1
+ /**
2
+ * Defines as extensibility slot for the Excerpt panel.
3
+ */
4
+
5
+ /**
6
+ * WordPress dependencies
7
+ */
8
+ import { createSlotFill, PanelRow } from '@wordpress/components';
9
+
10
+ const { Fill, Slot } = createSlotFill( 'PluginPostExcerpt' );
11
+
12
+ /**
13
+ * Renders a post excerpt panel in the post sidebar.
14
+ *
15
+ * @param {Object} props Component properties.
16
+ * @param {string} [props.className] An optional class name added to the row.
17
+ * @param {Element} props.children Children to be rendered.
18
+ *
19
+ * @example
20
+ * ```js
21
+ * // Using ES5 syntax
22
+ * var __ = wp.i18n.__;
23
+ * var PluginPostExcerpt = wp.editPost.PluginPostExcerpt;
24
+ *
25
+ * function MyPluginPostExcerpt() {
26
+ * return React.createElement(
27
+ * PluginPostExcerpt,
28
+ * {
29
+ * className: 'my-plugin-post-excerpt',
30
+ * },
31
+ * __( 'Post excerpt custom content' )
32
+ * )
33
+ * }
34
+ * ```
35
+ *
36
+ * @example
37
+ * ```jsx
38
+ * // Using ESNext syntax
39
+ * import { __ } from '@wordpress/i18n';
40
+ * import { PluginPostExcerpt } from '@wordpress/edit-post';
41
+ *
42
+ * const MyPluginPostExcerpt = () => (
43
+ * <PluginPostExcerpt className="my-plugin-post-excerpt">
44
+ * { __( 'Post excerpt custom content' ) }
45
+ * </PluginPostExcerpt>
46
+ * );
47
+ * ```
48
+ *
49
+ * @return {Component} The component to be rendered.
50
+ */
51
+ const PluginPostExcerpt = ( { children, className } ) => {
52
+ return (
53
+ <Fill>
54
+ <PanelRow className={ className }>{ children }</PanelRow>
55
+ </Fill>
56
+ );
57
+ };
58
+
59
+ PluginPostExcerpt.Slot = Slot;
60
+
61
+ export default PluginPostExcerpt;
@@ -0,0 +1,36 @@
1
+ /**
2
+ * External dependencies
3
+ */
4
+ import { render, screen } from '@testing-library/react';
5
+
6
+ /**
7
+ * WordPress dependencies
8
+ */
9
+ import { SlotFillProvider } from '@wordpress/components';
10
+
11
+ /**
12
+ * Internal dependencies
13
+ */
14
+ import PluginPostExcerptPanel from '../plugin';
15
+
16
+ describe( 'PluginPostExcerptPanel', () => {
17
+ test( 'renders fill properly', () => {
18
+ render(
19
+ <SlotFillProvider>
20
+ <PluginPostExcerptPanel className="my-plugin-post-excerpt-custom-content">
21
+ Post Excerpt - Custom content
22
+ </PluginPostExcerptPanel>
23
+ <div role="tabpanel">
24
+ <PluginPostExcerptPanel.Slot />
25
+ </div>
26
+ </SlotFillProvider>
27
+ );
28
+
29
+ expect( screen.getByRole( 'tabpanel' ) ).toHaveTextContent(
30
+ 'Post Excerpt - Custom content'
31
+ );
32
+ expect(
33
+ screen.getByText( 'Post Excerpt - Custom content' )
34
+ ).toHaveClass( 'my-plugin-post-excerpt-custom-content' );
35
+ } );
36
+ } );
@@ -98,17 +98,15 @@ function PostFeaturedImage( {
98
98
  } ) {
99
99
  const toggleRef = useRef();
100
100
  const [ isLoading, setIsLoading ] = useState( false );
101
- const mediaUpload = useSelect( ( select ) => {
102
- return select( blockEditorStore ).getSettings().mediaUpload;
103
- }, [] );
101
+ const { getSettings } = useSelect( blockEditorStore );
104
102
  const { mediaWidth, mediaHeight, mediaSourceUrl } = getMediaDetails(
105
103
  media,
106
104
  currentPostId
107
105
  );
108
106
 
109
107
  function onDropFiles( filesList ) {
110
- mediaUpload( {
111
- allowedTypes: [ 'image' ],
108
+ getSettings().mediaUpload( {
109
+ allowedTypes: ALLOWED_MEDIA_TYPES,
112
110
  filesList,
113
111
  onFileChange( [ image ] ) {
114
112
  if ( isBlobURL( image?.url ) ) {
@@ -208,8 +206,6 @@ function PostFeaturedImage( {
208
206
  <Button
209
207
  className="editor-post-featured-image__action"
210
208
  onClick={ open }
211
- // Prefer that screen readers use the .editor-post-featured-image__preview button.
212
- aria-hidden="true"
213
209
  >
214
210
  { __( 'Replace' ) }
215
211
  </Button>
@@ -0,0 +1,55 @@
1
+ /**
2
+ * WordPress dependencies
3
+ */
4
+ import { __ } from '@wordpress/i18n';
5
+ import { PanelBody } from '@wordpress/components';
6
+ import { useSelect, useDispatch } from '@wordpress/data';
7
+ import { store as coreStore } from '@wordpress/core-data';
8
+
9
+ /**
10
+ * Internal dependencies
11
+ */
12
+ import { store as editorStore } from '../../store';
13
+ import PostFeaturedImage from './index';
14
+ import PostFeaturedImageCheck from './check';
15
+
16
+ const PANEL_NAME = 'featured-image';
17
+
18
+ function FeaturedImage() {
19
+ const { postType, isEnabled, isOpened } = useSelect( ( select ) => {
20
+ const {
21
+ getEditedPostAttribute,
22
+ isEditorPanelEnabled,
23
+ isEditorPanelOpened,
24
+ } = select( editorStore );
25
+ const { getPostType } = select( coreStore );
26
+
27
+ return {
28
+ postType: getPostType( getEditedPostAttribute( 'type' ) ),
29
+ isEnabled: isEditorPanelEnabled( PANEL_NAME ),
30
+ isOpened: isEditorPanelOpened( PANEL_NAME ),
31
+ };
32
+ }, [] );
33
+
34
+ const { toggleEditorPanelOpened } = useDispatch( editorStore );
35
+
36
+ if ( ! isEnabled ) {
37
+ return null;
38
+ }
39
+
40
+ return (
41
+ <PostFeaturedImageCheck>
42
+ <PanelBody
43
+ title={
44
+ postType?.labels?.featured_image ?? __( 'Featured image' )
45
+ }
46
+ opened={ isOpened }
47
+ onToggle={ () => toggleEditorPanelOpened( PANEL_NAME ) }
48
+ >
49
+ <PostFeaturedImage />
50
+ </PanelBody>
51
+ </PostFeaturedImageCheck>
52
+ );
53
+ }
54
+
55
+ export default FeaturedImage;
@@ -0,0 +1,22 @@
1
+ /**
2
+ * WordPress dependencies
3
+ */
4
+ import { PanelBody } from '@wordpress/components';
5
+
6
+ /**
7
+ * Internal dependencies
8
+ */
9
+ import PostLastRevision from './';
10
+ import PostLastRevisionCheck from './check';
11
+
12
+ function PostLastRevisionPanel() {
13
+ return (
14
+ <PostLastRevisionCheck>
15
+ <PanelBody className="editor-post-last-revision__panel">
16
+ <PostLastRevision />
17
+ </PanelBody>
18
+ </PostLastRevisionCheck>
19
+ );
20
+ }
21
+
22
+ export default PostLastRevisionPanel;
@@ -21,3 +21,13 @@
21
21
  border-radius: 0;
22
22
  }
23
23
  }
24
+
25
+ // Needs specificity, because this panel is just a button
26
+ .components-panel__body.is-opened.editor-post-last-revision__panel {
27
+ padding: 0;
28
+ height: $grid-unit-60;
29
+
30
+ .editor-post-last-revision__title.components-button.components-button {
31
+ padding: $grid-unit-20;
32
+ }
33
+ }
@@ -176,6 +176,7 @@ export class PostPublishButton extends Component {
176
176
  className: 'editor-post-publish-panel__toggle',
177
177
  isBusy: isSaving && isPublished,
178
178
  variant: 'primary',
179
+ size: 'compact',
179
180
  onClick: this.createOnClick( onClickToggle ),
180
181
  };
181
182
 
@@ -10,7 +10,6 @@ import {
10
10
  } from '@wordpress/components';
11
11
  import { useSelect, useDispatch } from '@wordpress/data';
12
12
  import { __ } from '@wordpress/i18n';
13
- import { upload } from '@wordpress/icons';
14
13
  import { store as blockEditorStore } from '@wordpress/block-editor';
15
14
  import { useState } from '@wordpress/element';
16
15
  import { isBlobURL } from '@wordpress/blob';
@@ -135,7 +134,7 @@ export default function PostFormatPanel() {
135
134
  <PanelBody initialOpen={ true } title={ panelBodyTitle }>
136
135
  <p>
137
136
  { __(
138
- 'There are some external images in the post which can be uploaded to the media library. Images coming from different domains may not always display correctly, load slowly for visitors, or be removed unexpectedly.'
137
+ 'Upload external images to the Media Library. Images from different domains may load slowly, display incorrectly, or be removed unexpectedly.'
139
138
  ) }
140
139
  </p>
141
140
  <div
@@ -153,12 +152,8 @@ export default function PostFormatPanel() {
153
152
  { isUploading ? (
154
153
  <Spinner />
155
154
  ) : (
156
- <Button
157
- icon={ upload }
158
- variant="primary"
159
- onClick={ uploadImages }
160
- >
161
- { __( 'Upload all' ) }
155
+ <Button variant="primary" onClick={ uploadImages }>
156
+ { __( 'Upload' ) }
162
157
  </Button>
163
158
  ) }
164
159
  </div>
@@ -17,6 +17,7 @@ import { useEffect, useState } from '@wordpress/element';
17
17
  import { __ } from '@wordpress/i18n';
18
18
  import { Icon, check, cloud, cloudUpload } from '@wordpress/icons';
19
19
  import { displayShortcut } from '@wordpress/keycodes';
20
+ import { store as preferencesStore } from '@wordpress/preferences';
20
21
 
21
22
  /**
22
23
  * Internal dependencies
@@ -27,16 +28,12 @@ import { store as editorStore } from '../../store';
27
28
  * Component showing whether the post is saved or not and providing save
28
29
  * buttons.
29
30
  *
30
- * @param {Object} props Component props.
31
- * @param {?boolean} props.forceIsDirty Whether to force the post to be marked
32
- * as dirty.
33
- * @param {?boolean} props.showIconLabels Whether interface buttons show labels instead of icons
31
+ * @param {Object} props Component props.
32
+ * @param {?boolean} props.forceIsDirty Whether to force the post to be marked
33
+ * as dirty.
34
34
  * @return {import('react').ComponentType} The component.
35
35
  */
36
- export default function PostSavedState( {
37
- forceIsDirty,
38
- showIconLabels = false,
39
- } ) {
36
+ export default function PostSavedState( { forceIsDirty } ) {
40
37
  const [ forceSavedMessage, setForceSavedMessage ] = useState( false );
41
38
  const isLargeViewport = useViewportMatch( 'small' );
42
39
 
@@ -50,6 +47,7 @@ export default function PostSavedState( {
50
47
  isSaving,
51
48
  isScheduled,
52
49
  hasPublishAction,
50
+ showIconLabels,
53
51
  } = useSelect(
54
52
  ( select ) => {
55
53
  const {
@@ -63,6 +61,7 @@ export default function PostSavedState( {
63
61
  isAutosavingPost,
64
62
  getEditedPostAttribute,
65
63
  } = select( editorStore );
64
+ const { get } = select( preferencesStore );
66
65
 
67
66
  return {
68
67
  isAutosaving: isAutosavingPost(),
@@ -75,6 +74,7 @@ export default function PostSavedState( {
75
74
  isScheduled: isCurrentPostScheduled(),
76
75
  hasPublishAction:
77
76
  getCurrentPost()?._links?.[ 'wp:action-publish' ] ?? false,
77
+ showIconLabels: get( 'core', 'showIconLabels' ),
78
78
  };
79
79
  },
80
80
  [ forceIsDirty ]
@@ -168,6 +168,7 @@ export default function PostSavedState( {
168
168
  }
169
169
  onClick={ isDisabled ? undefined : () => savePost() }
170
170
  variant="tertiary"
171
+ size="compact"
171
172
  icon={ isLargeViewport ? undefined : cloudUpload }
172
173
  // Make sure the aria-label has always a value, as the default `text` is undefined on small screens.
173
174
  aria-label={ buttonAccessibleLabel }
@@ -4,7 +4,7 @@ exports[`PostSavedState returns a disabled button if the post is not saveable 1`
4
4
  <button
5
5
  aria-disabled="true"
6
6
  aria-label="Save draft"
7
- class="components-button is-tertiary has-icon"
7
+ class="components-button is-compact is-tertiary has-icon"
8
8
  type="button"
9
9
  >
10
10
  <svg
@@ -26,7 +26,7 @@ exports[`PostSavedState should return Save button if edits to be saved 1`] = `
26
26
  <button
27
27
  aria-disabled="false"
28
28
  aria-label="Save draft"
29
- class="components-button editor-post-save-draft is-tertiary"
29
+ class="components-button editor-post-save-draft is-compact is-tertiary"
30
30
  type="button"
31
31
  >
32
32
  Save draft
@@ -49,7 +49,7 @@ export default function PostSchedulePanel() {
49
49
  label
50
50
  ) }
51
51
  label={ fullLabel }
52
- showTooltip
52
+ showTooltip={ label !== fullLabel }
53
53
  aria-expanded={ isOpen }
54
54
  >
55
55
  { label }
@@ -0,0 +1,66 @@
1
+ /**
2
+ * WordPress dependencies
3
+ */
4
+ import { PanelBody } from '@wordpress/components';
5
+ import { useSelect, useDispatch } from '@wordpress/data';
6
+
7
+ /**
8
+ * Internal dependencies
9
+ */
10
+ import { store as editorStore } from '../../store';
11
+ import PostTaxonomiesForm from './index';
12
+ import PostTaxonomiesCheck from './check';
13
+
14
+ function TaxonomyPanel( { taxonomy, children } ) {
15
+ const slug = taxonomy?.slug;
16
+ const panelName = slug ? `taxonomy-panel-${ slug }` : '';
17
+ const { isEnabled, isOpened } = useSelect(
18
+ ( select ) => {
19
+ const { isEditorPanelEnabled, isEditorPanelOpened } =
20
+ select( editorStore );
21
+ return {
22
+ isEnabled: slug ? isEditorPanelEnabled( panelName ) : false,
23
+ isOpened: slug ? isEditorPanelOpened( panelName ) : false,
24
+ };
25
+ },
26
+ [ panelName, slug ]
27
+ );
28
+ const { toggleEditorPanelOpened } = useDispatch( editorStore );
29
+
30
+ if ( ! isEnabled ) {
31
+ return null;
32
+ }
33
+
34
+ const taxonomyMenuName = taxonomy?.labels?.menu_name;
35
+ if ( ! taxonomyMenuName ) {
36
+ return null;
37
+ }
38
+
39
+ return (
40
+ <PanelBody
41
+ title={ taxonomyMenuName }
42
+ opened={ isOpened }
43
+ onToggle={ () => toggleEditorPanelOpened( panelName ) }
44
+ >
45
+ { children }
46
+ </PanelBody>
47
+ );
48
+ }
49
+
50
+ function PostTaxonomies() {
51
+ return (
52
+ <PostTaxonomiesCheck>
53
+ <PostTaxonomiesForm
54
+ taxonomyWrapper={ ( content, taxonomy ) => {
55
+ return (
56
+ <TaxonomyPanel taxonomy={ taxonomy }>
57
+ { content }
58
+ </TaxonomyPanel>
59
+ );
60
+ } }
61
+ />
62
+ </PostTaxonomiesCheck>
63
+ );
64
+ }
65
+
66
+ export default PostTaxonomies;
@@ -0,0 +1,110 @@
1
+ /**
2
+ * WordPress dependencies
3
+ */
4
+ import { useSelect, useDispatch } from '@wordpress/data';
5
+ import { decodeEntities } from '@wordpress/html-entities';
6
+ import { DropdownMenu, MenuGroup, MenuItem } from '@wordpress/components';
7
+ import { __ } from '@wordpress/i18n';
8
+ import { useEntityRecord } from '@wordpress/core-data';
9
+ import { check } from '@wordpress/icons';
10
+ import { store as noticesStore } from '@wordpress/notices';
11
+
12
+ /**
13
+ * Internal dependencies
14
+ */
15
+ import { store as editorStore } from '../../store';
16
+ import SwapTemplateButton from './swap-template-button';
17
+ import ResetDefaultTemplate from './reset-default-template';
18
+ import { unlock } from '../../lock-unlock';
19
+ import CreateNewTemplate from './create-new-template';
20
+
21
+ const POPOVER_PROPS = {
22
+ className: 'editor-post-template__dropdown',
23
+ placement: 'bottom-start',
24
+ };
25
+
26
+ export default function BlockThemeControl( { id } ) {
27
+ const { isTemplateHidden } = useSelect( ( select ) => {
28
+ const { getRenderingMode } = unlock( select( editorStore ) );
29
+ return {
30
+ isTemplateHidden: getRenderingMode() === 'post-only',
31
+ };
32
+ }, [] );
33
+ const { editedRecord: template, hasResolved } = useEntityRecord(
34
+ 'postType',
35
+ 'wp_template',
36
+ id
37
+ );
38
+ const { getEditorSettings } = useSelect( editorStore );
39
+ const { createSuccessNotice } = useDispatch( noticesStore );
40
+ const { setRenderingMode } = useDispatch( editorStore );
41
+
42
+ if ( ! hasResolved ) {
43
+ return null;
44
+ }
45
+
46
+ return (
47
+ <DropdownMenu
48
+ popoverProps={ POPOVER_PROPS }
49
+ focusOnMount
50
+ toggleProps={ {
51
+ variant: 'tertiary',
52
+ } }
53
+ label={ __( 'Template options' ) }
54
+ text={ decodeEntities( template.title ) }
55
+ icon={ null }
56
+ >
57
+ { ( { onClose } ) => (
58
+ <>
59
+ <MenuGroup>
60
+ <MenuItem
61
+ onClick={ () => {
62
+ setRenderingMode( 'template-only' );
63
+ onClose();
64
+ createSuccessNotice(
65
+ __(
66
+ 'Editing template. Changes made here affect all posts and pages that use the template.'
67
+ ),
68
+ {
69
+ type: 'snackbar',
70
+ actions: [
71
+ {
72
+ label: __( 'Go back' ),
73
+ onClick: () =>
74
+ setRenderingMode(
75
+ getEditorSettings()
76
+ .defaultRenderingMode
77
+ ),
78
+ },
79
+ ],
80
+ }
81
+ );
82
+ } }
83
+ >
84
+ { __( 'Edit template' ) }
85
+ </MenuItem>
86
+ <SwapTemplateButton onClick={ onClose } />
87
+ <ResetDefaultTemplate onClick={ onClose } />
88
+ <CreateNewTemplate onClick={ onClose } />
89
+ </MenuGroup>
90
+ <MenuGroup>
91
+ <MenuItem
92
+ icon={ ! isTemplateHidden ? check : undefined }
93
+ isSelected={ ! isTemplateHidden }
94
+ role="menuitemcheckbox"
95
+ onClick={ () => {
96
+ setRenderingMode(
97
+ isTemplateHidden
98
+ ? 'template-locked'
99
+ : 'post-only'
100
+ );
101
+ } }
102
+ >
103
+ { __( 'Template preview' ) }
104
+ </MenuItem>
105
+ </MenuGroup>
106
+ </>
107
+ ) }
108
+ </DropdownMenu>
109
+ );
110
+ }