@wordpress/edit-post 7.31.0 → 7.33.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 (294) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/README.md +9 -323
  3. package/build/components/browser-url/index.js.map +1 -1
  4. package/build/components/editor-initialization/index.js +0 -1
  5. package/build/components/editor-initialization/index.js.map +1 -1
  6. package/build/components/editor-initialization/listener-hooks.js +1 -38
  7. package/build/components/editor-initialization/listener-hooks.js.map +1 -1
  8. package/build/components/header/fullscreen-mode-close/index.js.map +1 -1
  9. package/build/components/header/header-toolbar/index.native.js.map +1 -1
  10. package/build/components/header/index.js +5 -5
  11. package/build/components/header/index.js.map +1 -1
  12. package/build/components/header/index.native.js +1 -1
  13. package/build/components/header/index.native.js.map +1 -1
  14. package/build/components/header/main-dashboard-button/index.js.map +1 -1
  15. package/build/components/header/more-menu/index.js +7 -6
  16. package/build/components/header/more-menu/index.js.map +1 -1
  17. package/build/components/header/post-publish-button-or-toggle.js +11 -13
  18. package/build/components/header/post-publish-button-or-toggle.js.map +1 -1
  19. package/build/components/header/preferences-menu-item/index.js +12 -4
  20. package/build/components/header/preferences-menu-item/index.js.map +1 -1
  21. package/build/components/header/tools-more-menu-group/index.js.map +1 -1
  22. package/build/components/header/writing-menu/index.js.map +1 -1
  23. package/build/components/init-pattern-modal/index.js.map +1 -1
  24. package/build/components/keyboard-shortcuts/index.js +1 -36
  25. package/build/components/keyboard-shortcuts/index.js.map +1 -1
  26. package/build/components/layout/actions-panel.js +4 -7
  27. package/build/components/layout/actions-panel.js.map +1 -1
  28. package/build/components/layout/index.js +16 -21
  29. package/build/components/layout/index.js.map +1 -1
  30. package/build/components/layout/index.native.js.map +1 -1
  31. package/build/components/meta-boxes/index.js.map +1 -1
  32. package/build/components/meta-boxes/meta-box-visibility.js.map +1 -1
  33. package/build/components/meta-boxes/meta-boxes-area/index.js.map +1 -1
  34. package/build/components/preferences-modal/enable-custom-fields.js.map +1 -1
  35. package/build/components/preferences-modal/enable-panel.js.map +1 -1
  36. package/build/components/preferences-modal/enable-publish-sidebar.js.map +1 -1
  37. package/build/components/preferences-modal/index.js +1 -21
  38. package/build/components/preferences-modal/index.js.map +1 -1
  39. package/build/components/preferences-modal/meta-boxes-section.js.map +1 -1
  40. package/build/components/sidebar/plugin-post-publish-panel/index.js +16 -64
  41. package/build/components/sidebar/plugin-post-publish-panel/index.js.map +1 -1
  42. package/build/components/sidebar/plugin-pre-publish-panel/index.js +16 -63
  43. package/build/components/sidebar/plugin-pre-publish-panel/index.js.map +1 -1
  44. package/build/components/sidebar/post-format/index.js.map +1 -1
  45. package/build/components/sidebar/post-pending-status/index.js.map +1 -1
  46. package/build/components/sidebar/post-slug/index.js.map +1 -1
  47. package/build/components/sidebar/post-status/index.js +9 -9
  48. package/build/components/sidebar/post-status/index.js.map +1 -1
  49. package/build/components/sidebar/post-sticky/index.js.map +1 -1
  50. package/build/components/sidebar/post-trash/index.js.map +1 -1
  51. package/build/components/sidebar/post-visibility/index.js.map +1 -1
  52. package/build/components/sidebar/settings-header/index.js.map +1 -1
  53. package/build/components/sidebar/settings-sidebar/index.js +42 -40
  54. package/build/components/sidebar/settings-sidebar/index.js.map +1 -1
  55. package/build/components/text-editor/index.js.map +1 -1
  56. package/build/components/visual-editor/block-inspector-button.js +1 -1
  57. package/build/components/visual-editor/block-inspector-button.js.map +1 -1
  58. package/build/components/visual-editor/header.native.js.map +1 -1
  59. package/build/components/visual-editor/index.js +4 -1
  60. package/build/components/visual-editor/index.js.map +1 -1
  61. package/build/components/visual-editor/index.native.js.map +1 -1
  62. package/build/components/visual-editor/use-padding-appender.js +62 -0
  63. package/build/components/visual-editor/use-padding-appender.js.map +1 -0
  64. package/build/components/welcome-guide/default.js.map +1 -1
  65. package/build/components/welcome-guide/image.js.map +1 -1
  66. package/build/components/welcome-guide/index.js.map +1 -1
  67. package/build/components/welcome-guide/template.js.map +1 -1
  68. package/build/editor.js +9 -4
  69. package/build/editor.js.map +1 -1
  70. package/build/editor.native.js.map +1 -1
  71. package/build/hooks/commands/use-common-commands.js +7 -24
  72. package/build/hooks/commands/use-common-commands.js.map +1 -1
  73. package/build/hooks/components/index.js.map +1 -1
  74. package/build/hooks/index.js.map +1 -1
  75. package/build/hooks/use-navigate-to-entity-record.js +36 -19
  76. package/build/hooks/use-navigate-to-entity-record.js.map +1 -1
  77. package/build/hooks/validate-multiple-use/index.js.map +1 -1
  78. package/build/index.js +7 -12
  79. package/build/index.js.map +1 -1
  80. package/build/index.native.js +2 -4
  81. package/build/index.native.js.map +1 -1
  82. package/build/lock-unlock.js.map +1 -1
  83. package/build/plugins/copy-content-menu-item/index.js.map +1 -1
  84. package/build/plugins/index.js.map +1 -1
  85. package/build/plugins/keyboard-shortcuts-help-menu-item/index.js +7 -4
  86. package/build/plugins/keyboard-shortcuts-help-menu-item/index.js.map +1 -1
  87. package/build/plugins/welcome-guide-menu-item/index.js.map +1 -1
  88. package/build/store/actions.js +46 -31
  89. package/build/store/actions.js.map +1 -1
  90. package/build/store/constants.js.map +1 -1
  91. package/build/store/index.js +1 -1
  92. package/build/store/index.js.map +1 -1
  93. package/build/store/reducer.js +1 -15
  94. package/build/store/reducer.js.map +1 -1
  95. package/build/store/selectors.js +44 -24
  96. package/build/store/selectors.js.map +1 -1
  97. package/build/utils/meta-boxes.js.map +1 -1
  98. package/build-module/components/browser-url/index.js.map +1 -1
  99. package/build-module/components/editor-initialization/index.js +1 -2
  100. package/build-module/components/editor-initialization/index.js.map +1 -1
  101. package/build-module/components/editor-initialization/listener-hooks.js +2 -38
  102. package/build-module/components/editor-initialization/listener-hooks.js.map +1 -1
  103. package/build-module/components/header/fullscreen-mode-close/index.js.map +1 -1
  104. package/build-module/components/header/header-toolbar/index.native.js.map +1 -1
  105. package/build-module/components/header/index.js +4 -4
  106. package/build-module/components/header/index.js.map +1 -1
  107. package/build-module/components/header/index.native.js +1 -1
  108. package/build-module/components/header/index.native.js.map +1 -1
  109. package/build-module/components/header/main-dashboard-button/index.js.map +1 -1
  110. package/build-module/components/header/more-menu/index.js +5 -4
  111. package/build-module/components/header/more-menu/index.js.map +1 -1
  112. package/build-module/components/header/post-publish-button-or-toggle.js +11 -13
  113. package/build-module/components/header/post-publish-button-or-toggle.js.map +1 -1
  114. package/build-module/components/header/preferences-menu-item/index.js +11 -3
  115. package/build-module/components/header/preferences-menu-item/index.js.map +1 -1
  116. package/build-module/components/header/tools-more-menu-group/index.js.map +1 -1
  117. package/build-module/components/header/writing-menu/index.js.map +1 -1
  118. package/build-module/components/init-pattern-modal/index.js.map +1 -1
  119. package/build-module/components/keyboard-shortcuts/index.js +1 -36
  120. package/build-module/components/keyboard-shortcuts/index.js.map +1 -1
  121. package/build-module/components/layout/actions-panel.js +4 -5
  122. package/build-module/components/layout/actions-panel.js.map +1 -1
  123. package/build-module/components/layout/index.js +15 -20
  124. package/build-module/components/layout/index.js.map +1 -1
  125. package/build-module/components/layout/index.native.js.map +1 -1
  126. package/build-module/components/meta-boxes/index.js.map +1 -1
  127. package/build-module/components/meta-boxes/meta-box-visibility.js.map +1 -1
  128. package/build-module/components/meta-boxes/meta-boxes-area/index.js.map +1 -1
  129. package/build-module/components/preferences-modal/enable-custom-fields.js.map +1 -1
  130. package/build-module/components/preferences-modal/enable-panel.js.map +1 -1
  131. package/build-module/components/preferences-modal/enable-publish-sidebar.js.map +1 -1
  132. package/build-module/components/preferences-modal/index.js +1 -20
  133. package/build-module/components/preferences-modal/index.js.map +1 -1
  134. package/build-module/components/preferences-modal/meta-boxes-section.js.map +1 -1
  135. package/build-module/components/sidebar/plugin-post-publish-panel/index.js +14 -62
  136. package/build-module/components/sidebar/plugin-post-publish-panel/index.js.map +1 -1
  137. package/build-module/components/sidebar/plugin-pre-publish-panel/index.js +14 -61
  138. package/build-module/components/sidebar/plugin-pre-publish-panel/index.js.map +1 -1
  139. package/build-module/components/sidebar/post-format/index.js.map +1 -1
  140. package/build-module/components/sidebar/post-pending-status/index.js.map +1 -1
  141. package/build-module/components/sidebar/post-slug/index.js.map +1 -1
  142. package/build-module/components/sidebar/post-status/index.js +9 -10
  143. package/build-module/components/sidebar/post-status/index.js.map +1 -1
  144. package/build-module/components/sidebar/post-sticky/index.js.map +1 -1
  145. package/build-module/components/sidebar/post-trash/index.js.map +1 -1
  146. package/build-module/components/sidebar/post-visibility/index.js.map +1 -1
  147. package/build-module/components/sidebar/settings-header/index.js.map +1 -1
  148. package/build-module/components/sidebar/settings-sidebar/index.js +43 -41
  149. package/build-module/components/sidebar/settings-sidebar/index.js.map +1 -1
  150. package/build-module/components/text-editor/index.js.map +1 -1
  151. package/build-module/components/visual-editor/block-inspector-button.js +1 -1
  152. package/build-module/components/visual-editor/block-inspector-button.js.map +1 -1
  153. package/build-module/components/visual-editor/header.native.js.map +1 -1
  154. package/build-module/components/visual-editor/index.js +4 -1
  155. package/build-module/components/visual-editor/index.js.map +1 -1
  156. package/build-module/components/visual-editor/index.native.js.map +1 -1
  157. package/build-module/components/visual-editor/use-padding-appender.js +55 -0
  158. package/build-module/components/visual-editor/use-padding-appender.js.map +1 -0
  159. package/build-module/components/welcome-guide/default.js.map +1 -1
  160. package/build-module/components/welcome-guide/image.js.map +1 -1
  161. package/build-module/components/welcome-guide/index.js.map +1 -1
  162. package/build-module/components/welcome-guide/template.js.map +1 -1
  163. package/build-module/editor.js +9 -4
  164. package/build-module/editor.js.map +1 -1
  165. package/build-module/editor.native.js.map +1 -1
  166. package/build-module/hooks/commands/use-common-commands.js +9 -26
  167. package/build-module/hooks/commands/use-common-commands.js.map +1 -1
  168. package/build-module/hooks/components/index.js.map +1 -1
  169. package/build-module/hooks/index.js.map +1 -1
  170. package/build-module/hooks/use-navigate-to-entity-record.js +37 -20
  171. package/build-module/hooks/use-navigate-to-entity-record.js.map +1 -1
  172. package/build-module/hooks/validate-multiple-use/index.js.map +1 -1
  173. package/build-module/index.js +8 -8
  174. package/build-module/index.js.map +1 -1
  175. package/build-module/index.native.js +2 -4
  176. package/build-module/index.native.js.map +1 -1
  177. package/build-module/lock-unlock.js.map +1 -1
  178. package/build-module/plugins/copy-content-menu-item/index.js.map +1 -1
  179. package/build-module/plugins/index.js.map +1 -1
  180. package/build-module/plugins/keyboard-shortcuts-help-menu-item/index.js +6 -3
  181. package/build-module/plugins/keyboard-shortcuts-help-menu-item/index.js.map +1 -1
  182. package/build-module/plugins/welcome-guide-menu-item/index.js.map +1 -1
  183. package/build-module/store/actions.js +38 -22
  184. package/build-module/store/actions.js.map +1 -1
  185. package/build-module/store/constants.js.map +1 -1
  186. package/build-module/store/index.js.map +1 -1
  187. package/build-module/store/reducer.js +1 -13
  188. package/build-module/store/reducer.js.map +1 -1
  189. package/build-module/store/selectors.js +42 -21
  190. package/build-module/store/selectors.js.map +1 -1
  191. package/build-module/utils/meta-boxes.js.map +1 -1
  192. package/build-style/classic-rtl.css +2 -2
  193. package/build-style/classic.css +2 -2
  194. package/build-style/style-rtl.css +12 -454
  195. package/build-style/style.css +12 -454
  196. package/package.json +32 -34
  197. package/src/classic.scss +2 -1
  198. package/src/components/editor-initialization/index.js +1 -5
  199. package/src/components/editor-initialization/listener-hooks.js +1 -40
  200. package/src/components/editor-initialization/test/listener-hooks.js +1 -96
  201. package/src/components/header/index.js +3 -4
  202. package/src/components/header/index.native.js +1 -1
  203. package/src/components/header/more-menu/index.js +3 -4
  204. package/src/components/header/post-publish-button-or-toggle.js +10 -11
  205. package/src/components/header/preferences-menu-item/index.js +9 -3
  206. package/src/components/header/style.scss +5 -3
  207. package/src/components/header/test/index.js +13 -1
  208. package/src/components/keyboard-shortcuts/index.js +3 -44
  209. package/src/components/layout/actions-panel.js +5 -4
  210. package/src/components/layout/index.js +20 -42
  211. package/src/components/meta-boxes/meta-boxes-area/style.scss +1 -1
  212. package/src/components/preferences-modal/index.js +1 -24
  213. package/src/components/sidebar/plugin-post-publish-panel/index.js +12 -67
  214. package/src/components/sidebar/plugin-pre-publish-panel/index.js +12 -66
  215. package/src/components/sidebar/post-status/index.js +6 -9
  216. package/src/components/sidebar/settings-sidebar/index.js +64 -56
  217. package/src/components/visual-editor/block-inspector-button.js +1 -1
  218. package/src/components/visual-editor/index.js +4 -0
  219. package/src/components/visual-editor/use-padding-appender.js +66 -0
  220. package/src/editor.js +14 -4
  221. package/src/hooks/commands/use-common-commands.js +13 -28
  222. package/src/hooks/use-navigate-to-entity-record.js +37 -24
  223. package/src/index.js +11 -6
  224. package/src/index.native.js +1 -4
  225. package/src/plugins/keyboard-shortcuts-help-menu-item/index.js +5 -3
  226. package/src/store/actions.js +37 -24
  227. package/src/store/reducer.js +0 -13
  228. package/src/store/selectors.js +52 -36
  229. package/src/store/test/actions.js +11 -10
  230. package/src/style.scss +1 -20
  231. package/build/components/block-settings-menu/plugin-block-settings-menu-item.js +0 -107
  232. package/build/components/block-settings-menu/plugin-block-settings-menu-item.js.map +0 -1
  233. package/build/components/header/plugin-more-menu-item/index.js +0 -78
  234. package/build/components/header/plugin-more-menu-item/index.js.map +0 -1
  235. package/build/components/header/plugin-sidebar-more-menu-item/index.js +0 -71
  236. package/build/components/header/plugin-sidebar-more-menu-item/index.js.map +0 -1
  237. package/build/components/keyboard-shortcut-help-modal/config.js +0 -78
  238. package/build/components/keyboard-shortcut-help-modal/config.js.map +0 -1
  239. package/build/components/keyboard-shortcut-help-modal/dynamic-shortcut.js +0 -49
  240. package/build/components/keyboard-shortcut-help-modal/dynamic-shortcut.js.map +0 -1
  241. package/build/components/keyboard-shortcut-help-modal/index.js +0 -129
  242. package/build/components/keyboard-shortcut-help-modal/index.js.map +0 -1
  243. package/build/components/keyboard-shortcut-help-modal/shortcut.js +0 -55
  244. package/build/components/keyboard-shortcut-help-modal/shortcut.js.map +0 -1
  245. package/build/components/sidebar/plugin-post-status-info/index.js +0 -73
  246. package/build/components/sidebar/plugin-post-status-info/index.js.map +0 -1
  247. package/build/components/sidebar/plugin-sidebar/index.js +0 -104
  248. package/build/components/sidebar/plugin-sidebar/index.js.map +0 -1
  249. package/build/components/sidebar/template-summary/index.js +0 -36
  250. package/build/components/sidebar/template-summary/index.js.map +0 -1
  251. package/build/components/start-page-options/index.js +0 -107
  252. package/build/components/start-page-options/index.js.map +0 -1
  253. package/build-module/components/block-settings-menu/plugin-block-settings-menu-item.js +0 -100
  254. package/build-module/components/block-settings-menu/plugin-block-settings-menu-item.js.map +0 -1
  255. package/build-module/components/header/plugin-more-menu-item/index.js +0 -73
  256. package/build-module/components/header/plugin-more-menu-item/index.js.map +0 -1
  257. package/build-module/components/header/plugin-sidebar-more-menu-item/index.js +0 -65
  258. package/build-module/components/header/plugin-sidebar-more-menu-item/index.js.map +0 -1
  259. package/build-module/components/keyboard-shortcut-help-modal/config.js +0 -71
  260. package/build-module/components/keyboard-shortcut-help-modal/config.js.map +0 -1
  261. package/build-module/components/keyboard-shortcut-help-modal/dynamic-shortcut.js +0 -41
  262. package/build-module/components/keyboard-shortcut-help-modal/dynamic-shortcut.js.map +0 -1
  263. package/build-module/components/keyboard-shortcut-help-modal/index.js +0 -119
  264. package/build-module/components/keyboard-shortcut-help-modal/index.js.map +0 -1
  265. package/build-module/components/keyboard-shortcut-help-modal/shortcut.js +0 -48
  266. package/build-module/components/keyboard-shortcut-help-modal/shortcut.js.map +0 -1
  267. package/build-module/components/sidebar/plugin-post-status-info/index.js +0 -66
  268. package/build-module/components/sidebar/plugin-post-status-info/index.js.map +0 -1
  269. package/build-module/components/sidebar/plugin-sidebar/index.js +0 -98
  270. package/build-module/components/sidebar/plugin-sidebar/index.js.map +0 -1
  271. package/build-module/components/sidebar/template-summary/index.js +0 -29
  272. package/build-module/components/sidebar/template-summary/index.js.map +0 -1
  273. package/build-module/components/start-page-options/index.js +0 -100
  274. package/build-module/components/start-page-options/index.js.map +0 -1
  275. package/src/components/block-settings-menu/plugin-block-settings-menu-item.js +0 -108
  276. package/src/components/header/plugin-more-menu-item/index.js +0 -73
  277. package/src/components/header/plugin-sidebar-more-menu-item/index.js +0 -64
  278. package/src/components/keyboard-shortcut-help-modal/config.js +0 -53
  279. package/src/components/keyboard-shortcut-help-modal/dynamic-shortcut.js +0 -43
  280. package/src/components/keyboard-shortcut-help-modal/index.js +0 -159
  281. package/src/components/keyboard-shortcut-help-modal/shortcut.js +0 -67
  282. package/src/components/keyboard-shortcut-help-modal/style.scss +0 -61
  283. package/src/components/keyboard-shortcut-help-modal/test/index.js +0 -36
  284. package/src/components/sidebar/plugin-post-publish-panel/test/__snapshots__/index.js.snap +0 -39
  285. package/src/components/sidebar/plugin-post-publish-panel/test/index.js +0 -33
  286. package/src/components/sidebar/plugin-post-status-info/index.js +0 -63
  287. package/src/components/sidebar/plugin-post-status-info/test/__snapshots__/index.js.snap +0 -11
  288. package/src/components/sidebar/plugin-post-status-info/test/index.js +0 -29
  289. package/src/components/sidebar/plugin-pre-publish-panel/test/index.js +0 -33
  290. package/src/components/sidebar/plugin-sidebar/index.js +0 -94
  291. package/src/components/sidebar/template-summary/index.js +0 -37
  292. package/src/components/sidebar/template-summary/style.scss +0 -5
  293. package/src/components/start-page-options/index.js +0 -108
  294. package/src/components/start-page-options/style.scss +0 -26
@@ -1,61 +0,0 @@
1
- .edit-post-keyboard-shortcut-help-modal {
2
- &__section {
3
- margin: 0 0 2rem 0;
4
- }
5
-
6
- &__section-title {
7
- font-size: 0.9rem;
8
- font-weight: 600;
9
- }
10
-
11
- &__shortcut {
12
- display: flex;
13
- align-items: baseline;
14
- padding: 0.6rem 0;
15
- border-top: 1px solid $gray-300;
16
- margin-bottom: 0;
17
-
18
- &:last-child {
19
- border-bottom: 1px solid $gray-300;
20
- }
21
-
22
- &:empty {
23
- display: none;
24
- }
25
- }
26
-
27
- &__shortcut-term {
28
- font-weight: 600;
29
- margin: 0 0 0 1rem;
30
- text-align: right;
31
- }
32
-
33
- &__shortcut-description {
34
- flex: 1;
35
- margin: 0;
36
-
37
- // IE 11 flex item fix - ensure the item does not collapse.
38
- flex-basis: auto;
39
- }
40
-
41
- &__shortcut-key-combination {
42
- display: block;
43
- background: none;
44
- margin: 0;
45
- padding: 0;
46
-
47
- & + .edit-post-keyboard-shortcut-help-modal__shortcut-key-combination {
48
- margin-top: 10px;
49
- }
50
- }
51
-
52
- &__shortcut-key {
53
- padding: 0.25rem 0.5rem;
54
- border-radius: 8%;
55
- margin: 0 0.2rem 0 0.2rem;
56
-
57
- &:last-child {
58
- margin: 0 0 0 0.2rem;
59
- }
60
- }
61
- }
@@ -1,36 +0,0 @@
1
- /**
2
- * External dependencies
3
- */
4
- import { render, screen } from '@testing-library/react';
5
-
6
- /**
7
- * WordPress dependencies
8
- */
9
- import { EditorKeyboardShortcutsRegister } from '@wordpress/editor';
10
-
11
- /**
12
- * Internal dependencies
13
- */
14
- import { KeyboardShortcutHelpModal } from '../index';
15
-
16
- const noop = () => {};
17
-
18
- describe( 'KeyboardShortcutHelpModal', () => {
19
- it( 'should not render the modal when inactive', () => {
20
- render(
21
- <>
22
- <EditorKeyboardShortcutsRegister />
23
- <KeyboardShortcutHelpModal
24
- isModalActive={ false }
25
- toggleModal={ noop }
26
- />
27
- </>
28
- );
29
-
30
- expect(
31
- screen.queryByRole( 'dialog', {
32
- name: 'Keyboard shortcuts',
33
- } )
34
- ).not.toBeInTheDocument();
35
- } );
36
- } );
@@ -1,39 +0,0 @@
1
- // Jest Snapshot v1, https://goo.gl/fbAQLP
2
-
3
- exports[`PluginPostPublishPanel renders fill properly 1`] = `
4
- <div>
5
- <div
6
- class="components-panel__body my-plugin-post-publish-panel is-opened"
7
- >
8
- <h2
9
- class="components-panel__body-title"
10
- >
11
- <button
12
- aria-expanded="true"
13
- class="components-button components-panel__body-toggle"
14
- type="button"
15
- >
16
- <span
17
- aria-hidden="true"
18
- >
19
- <svg
20
- aria-hidden="true"
21
- class="components-panel__arrow"
22
- focusable="false"
23
- height="24"
24
- viewBox="0 0 24 24"
25
- width="24"
26
- xmlns="http://www.w3.org/2000/svg"
27
- >
28
- <path
29
- d="M6.5 12.4L12 8l5.5 4.4-.9 1.2L12 10l-4.5 3.6-1-1.2z"
30
- />
31
- </svg>
32
- </span>
33
- My panel title
34
- </button>
35
- </h2>
36
- My panel content
37
- </div>
38
- </div>
39
- `;
@@ -1,33 +0,0 @@
1
- /**
2
- * External dependencies
3
- */
4
- import { render } from '@testing-library/react';
5
-
6
- /**
7
- * WordPress dependencies
8
- */
9
- import { SlotFillProvider } from '@wordpress/components';
10
-
11
- /**
12
- * Internal dependencies
13
- */
14
- import PluginPostPublishPanel from '../';
15
-
16
- describe( 'PluginPostPublishPanel', () => {
17
- test( 'renders fill properly', () => {
18
- const { container } = render(
19
- <SlotFillProvider>
20
- <PluginPostPublishPanel
21
- className="my-plugin-post-publish-panel"
22
- title="My panel title"
23
- initialOpen
24
- >
25
- My panel content
26
- </PluginPostPublishPanel>
27
- <PluginPostPublishPanel.Slot />
28
- </SlotFillProvider>
29
- );
30
-
31
- expect( container ).toMatchSnapshot();
32
- } );
33
- } );
@@ -1,63 +0,0 @@
1
- /**
2
- * Defines as extensibility slot for the Summary panel.
3
- */
4
-
5
- /**
6
- * WordPress dependencies
7
- */
8
- import { createSlotFill, PanelRow } from '@wordpress/components';
9
-
10
- const { Fill, Slot } = createSlotFill( 'PluginPostStatusInfo' );
11
-
12
- /**
13
- * Renders a row in the Summary panel of the Document sidebar.
14
- * It should be noted that this is named and implemented around the function it serves
15
- * and not its location, which may change in future iterations.
16
- *
17
- * @param {Object} props Component properties.
18
- * @param {string} [props.className] An optional class name added to the row.
19
- * @param {Element} props.children Children to be rendered.
20
- *
21
- * @example
22
- * ```js
23
- * // Using ES5 syntax
24
- * var __ = wp.i18n.__;
25
- * var PluginPostStatusInfo = wp.editPost.PluginPostStatusInfo;
26
- *
27
- * function MyPluginPostStatusInfo() {
28
- * return React.createElement(
29
- * PluginPostStatusInfo,
30
- * {
31
- * className: 'my-plugin-post-status-info',
32
- * },
33
- * __( 'My post status info' )
34
- * )
35
- * }
36
- * ```
37
- *
38
- * @example
39
- * ```jsx
40
- * // Using ESNext syntax
41
- * import { __ } from '@wordpress/i18n';
42
- * import { PluginPostStatusInfo } from '@wordpress/edit-post';
43
- *
44
- * const MyPluginPostStatusInfo = () => (
45
- * <PluginPostStatusInfo
46
- * className="my-plugin-post-status-info"
47
- * >
48
- * { __( 'My post status info' ) }
49
- * </PluginPostStatusInfo>
50
- * );
51
- * ```
52
- *
53
- * @return {Component} The component to be rendered.
54
- */
55
- const PluginPostStatusInfo = ( { children, className } ) => (
56
- <Fill>
57
- <PanelRow className={ className }>{ children }</PanelRow>
58
- </Fill>
59
- );
60
-
61
- PluginPostStatusInfo.Slot = Slot;
62
-
63
- export default PluginPostStatusInfo;
@@ -1,11 +0,0 @@
1
- // Jest Snapshot v1, https://goo.gl/fbAQLP
2
-
3
- exports[`PluginPostStatusInfo renders fill properly 1`] = `
4
- <div>
5
- <div
6
- class="components-panel__row my-plugin-post-status-info"
7
- >
8
- My plugin post status info
9
- </div>
10
- </div>
11
- `;
@@ -1,29 +0,0 @@
1
- /**
2
- * External dependencies
3
- */
4
- import { render } from '@testing-library/react';
5
-
6
- /**
7
- * WordPress dependencies
8
- */
9
- import { SlotFillProvider } from '@wordpress/components';
10
-
11
- /**
12
- * Internal dependencies
13
- */
14
- import PluginPostStatusInfo from '../';
15
-
16
- describe( 'PluginPostStatusInfo', () => {
17
- test( 'renders fill properly', () => {
18
- const { container } = render(
19
- <SlotFillProvider>
20
- <PluginPostStatusInfo className="my-plugin-post-status-info">
21
- My plugin post status info
22
- </PluginPostStatusInfo>
23
- <PluginPostStatusInfo.Slot />
24
- </SlotFillProvider>
25
- );
26
-
27
- expect( container ).toMatchSnapshot();
28
- } );
29
- } );
@@ -1,33 +0,0 @@
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 PluginPrePublishPanel from '../';
15
-
16
- describe( 'PluginPrePublishPanel', () => {
17
- test( 'renders fill properly', () => {
18
- render(
19
- <SlotFillProvider>
20
- <PluginPrePublishPanel
21
- className="my-plugin-pre-publish-panel"
22
- title="My panel title"
23
- initialOpen
24
- >
25
- My panel content
26
- </PluginPrePublishPanel>
27
- <PluginPrePublishPanel.Slot />
28
- </SlotFillProvider>
29
- );
30
-
31
- expect( screen.getByText( 'My panel title' ) ).toBeVisible();
32
- } );
33
- } );
@@ -1,94 +0,0 @@
1
- /**
2
- * WordPress dependencies
3
- */
4
- import { ComplementaryArea } from '@wordpress/interface';
5
- import { useSelect } from '@wordpress/data';
6
- import { __ } from '@wordpress/i18n';
7
- import { store as keyboardShortcutsStore } from '@wordpress/keyboard-shortcuts';
8
- import { store as editorStore } from '@wordpress/editor';
9
-
10
- /**
11
- * Renders a sidebar when activated. The contents within the `PluginSidebar` will appear as content within the sidebar.
12
- * It also automatically renders a corresponding `PluginSidebarMenuItem` component when `isPinnable` flag is set to `true`.
13
- * If you wish to display the sidebar, you can with use the `PluginSidebarMoreMenuItem` component or the `wp.data.dispatch` API:
14
- *
15
- * ```js
16
- * wp.data.dispatch( 'core/edit-post' ).openGeneralSidebar( 'plugin-name/sidebar-name' );
17
- * ```
18
- *
19
- * @see PluginSidebarMoreMenuItem
20
- *
21
- * @param {Object} props Element props.
22
- * @param {string} props.name A string identifying the sidebar. Must be unique for every sidebar registered within the scope of your plugin.
23
- * @param {string} [props.className] An optional class name added to the sidebar body.
24
- * @param {string} props.title Title displayed at the top of the sidebar.
25
- * @param {boolean} [props.isPinnable=true] Whether to allow to pin sidebar to the toolbar. When set to `true` it also automatically renders a corresponding menu item.
26
- * @param {WPBlockTypeIconRender} [props.icon=inherits from the plugin] The [Dashicon](https://developer.wordpress.org/resource/dashicons/) icon slug string, or an SVG WP element, to be rendered when the sidebar is pinned to toolbar.
27
- *
28
- * @example
29
- * ```js
30
- * // Using ES5 syntax
31
- * var __ = wp.i18n.__;
32
- * var el = React.createElement;
33
- * var PanelBody = wp.components.PanelBody;
34
- * var PluginSidebar = wp.editPost.PluginSidebar;
35
- * var moreIcon = React.createElement( 'svg' ); //... svg element.
36
- *
37
- * function MyPluginSidebar() {
38
- * return el(
39
- * PluginSidebar,
40
- * {
41
- * name: 'my-sidebar',
42
- * title: 'My sidebar title',
43
- * icon: moreIcon,
44
- * },
45
- * el(
46
- * PanelBody,
47
- * {},
48
- * __( 'My sidebar content' )
49
- * )
50
- * );
51
- * }
52
- * ```
53
- *
54
- * @example
55
- * ```jsx
56
- * // Using ESNext syntax
57
- * import { __ } from '@wordpress/i18n';
58
- * import { PanelBody } from '@wordpress/components';
59
- * import { PluginSidebar } from '@wordpress/edit-post';
60
- * import { more } from '@wordpress/icons';
61
- *
62
- * const MyPluginSidebar = () => (
63
- * <PluginSidebar
64
- * name="my-sidebar"
65
- * title="My sidebar title"
66
- * icon={ more }
67
- * >
68
- * <PanelBody>
69
- * { __( 'My sidebar content' ) }
70
- * </PanelBody>
71
- * </PluginSidebar>
72
- * );
73
- * ```
74
- */
75
- export default function PluginSidebarEditPost( { className, ...props } ) {
76
- const { postTitle, shortcut } = useSelect( ( select ) => {
77
- return {
78
- postTitle: select( editorStore ).getEditedPostAttribute( 'title' ),
79
- shortcut: select(
80
- keyboardShortcutsStore
81
- ).getShortcutRepresentation( 'core/edit-post/toggle-sidebar' ),
82
- };
83
- }, [] );
84
- return (
85
- <ComplementaryArea
86
- panelClassName={ className }
87
- className="edit-post-sidebar"
88
- smallScreenTitle={ postTitle || __( '(no title)' ) }
89
- scope="core/edit-post"
90
- toggleShortcut={ shortcut }
91
- { ...props }
92
- />
93
- );
94
- }
@@ -1,37 +0,0 @@
1
- /**
2
- * WordPress dependencies
3
- */
4
- import { Icon, layout } from '@wordpress/icons';
5
- import { useSelect } from '@wordpress/data';
6
- import { Flex, FlexItem, FlexBlock, PanelBody } from '@wordpress/components';
7
- import { store as editorStore } from '@wordpress/editor';
8
-
9
- function TemplateSummary() {
10
- const template = useSelect( ( select ) => {
11
- const { getCurrentPost } = select( editorStore );
12
- return getCurrentPost();
13
- }, [] );
14
-
15
- if ( ! template ) {
16
- return null;
17
- }
18
-
19
- return (
20
- <PanelBody>
21
- <Flex align="flex-start" gap="3">
22
- <FlexItem>
23
- <Icon icon={ layout } />
24
- </FlexItem>
25
-
26
- <FlexBlock>
27
- <h2 className="edit-post-template-summary__title">
28
- { template?.title || template?.slug }
29
- </h2>
30
- <p>{ template?.description }</p>
31
- </FlexBlock>
32
- </Flex>
33
- </PanelBody>
34
- );
35
- }
36
-
37
- export default TemplateSummary;
@@ -1,5 +0,0 @@
1
- h2.edit-post-template-summary__title {
2
- line-height: $icon-size;
3
- margin: 0 0 $grid-unit-05;
4
- font-weight: 500;
5
- }
@@ -1,108 +0,0 @@
1
- /**
2
- * WordPress dependencies
3
- */
4
- import { Modal } from '@wordpress/components';
5
- import { __ } from '@wordpress/i18n';
6
- import { useState, useMemo } from '@wordpress/element';
7
- import {
8
- store as blockEditorStore,
9
- __experimentalBlockPatternsList as BlockPatternsList,
10
- } from '@wordpress/block-editor';
11
- import { useSelect, useDispatch } from '@wordpress/data';
12
- import { useAsyncList } from '@wordpress/compose';
13
- import { store as editorStore } from '@wordpress/editor';
14
-
15
- /**
16
- * Internal dependencies
17
- */
18
- import { store as editPostStore } from '../../store';
19
-
20
- function useStartPatterns() {
21
- // A pattern is a start pattern if it includes 'core/post-content' in its blockTypes,
22
- // and it has no postTypes declared and the current post type is page or if
23
- // the current post type is part of the postTypes declared.
24
- const { blockPatternsWithPostContentBlockType, postType } = useSelect(
25
- ( select ) => {
26
- const { getPatternsByBlockTypes } = select( blockEditorStore );
27
- const { getCurrentPostType } = select( editorStore );
28
- return {
29
- blockPatternsWithPostContentBlockType:
30
- getPatternsByBlockTypes( 'core/post-content' ),
31
- postType: getCurrentPostType(),
32
- };
33
- },
34
- []
35
- );
36
-
37
- return useMemo( () => {
38
- // filter patterns without postTypes declared if the current postType is page
39
- // or patterns that declare the current postType in its post type array.
40
- return blockPatternsWithPostContentBlockType.filter( ( pattern ) => {
41
- return (
42
- ( postType === 'page' && ! pattern.postTypes ) ||
43
- ( Array.isArray( pattern.postTypes ) &&
44
- pattern.postTypes.includes( postType ) )
45
- );
46
- } );
47
- }, [ postType, blockPatternsWithPostContentBlockType ] );
48
- }
49
-
50
- function PatternSelection( { blockPatterns, onChoosePattern } ) {
51
- const shownBlockPatterns = useAsyncList( blockPatterns );
52
- const { resetEditorBlocks } = useDispatch( editorStore );
53
- return (
54
- <BlockPatternsList
55
- blockPatterns={ blockPatterns }
56
- shownPatterns={ shownBlockPatterns }
57
- onClickPattern={ ( _pattern, blocks ) => {
58
- resetEditorBlocks( blocks );
59
- onChoosePattern();
60
- } }
61
- />
62
- );
63
- }
64
-
65
- function StartPageOptionsModal( { onClose } ) {
66
- const startPatterns = useStartPatterns();
67
- const hasStartPattern = startPatterns.length > 0;
68
-
69
- if ( ! hasStartPattern ) {
70
- return null;
71
- }
72
-
73
- return (
74
- <Modal
75
- className="edit-post-start-page-options__modal"
76
- title={ __( 'Choose a pattern' ) }
77
- isFullScreen
78
- onRequestClose={ onClose }
79
- >
80
- <div className="edit-post-start-page-options__modal-content">
81
- <PatternSelection
82
- blockPatterns={ startPatterns }
83
- onChoosePattern={ onClose }
84
- />
85
- </div>
86
- </Modal>
87
- );
88
- }
89
-
90
- export default function StartPageOptions() {
91
- const [ isClosed, setIsClosed ] = useState( false );
92
- const shouldEnableModal = useSelect( ( select ) => {
93
- const { isCleanNewPost, getRenderingMode } = select( editorStore );
94
- const { isFeatureActive } = select( editPostStore );
95
-
96
- return (
97
- getRenderingMode() === 'post-only' &&
98
- ! isFeatureActive( 'welcomeGuide' ) &&
99
- isCleanNewPost()
100
- );
101
- }, [] );
102
-
103
- if ( ! shouldEnableModal || isClosed ) {
104
- return null;
105
- }
106
-
107
- return <StartPageOptionsModal onClose={ () => setIsClosed( true ) } />;
108
- }
@@ -1,26 +0,0 @@
1
- // 2 column masonry layout.
2
- .edit-post-start-page-options__modal-content .block-editor-block-patterns-list {
3
- column-count: 2;
4
- column-gap: $grid-unit-30;
5
-
6
- @include break-medium() {
7
- column-count: 3;
8
- }
9
-
10
- @include break-wide() {
11
- column-count: 4;
12
- }
13
-
14
- .block-editor-block-patterns-list__list-item {
15
- break-inside: avoid-column;
16
- margin-bottom: $grid-unit-30;
17
-
18
- .block-editor-block-preview__container {
19
- min-height: 100px;
20
- }
21
-
22
- .block-editor-block-preview__content {
23
- width: 100%;
24
- }
25
- }
26
- }