@wordpress/edit-post 7.16.0 → 7.17.1

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 (428) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/README.md +6 -1
  3. package/build/components/block-manager/category.js +1 -14
  4. package/build/components/block-manager/category.js.map +1 -1
  5. package/build/components/block-manager/checklist.js +1 -5
  6. package/build/components/block-manager/checklist.js.map +1 -1
  7. package/build/components/block-manager/index.js +11 -23
  8. package/build/components/block-manager/index.js.map +1 -1
  9. package/build/components/block-settings-menu/plugin-block-settings-menu-item.js +3 -11
  10. package/build/components/block-settings-menu/plugin-block-settings-menu-item.js.map +1 -1
  11. package/build/components/browser-url/index.js +6 -23
  12. package/build/components/browser-url/index.js.map +1 -1
  13. package/build/components/device-preview/index.js +1 -11
  14. package/build/components/device-preview/index.js.map +1 -1
  15. package/build/components/editor-initialization/index.js +0 -2
  16. package/build/components/editor-initialization/index.js.map +1 -1
  17. package/build/components/editor-initialization/listener-hooks.js +1 -12
  18. package/build/components/editor-initialization/listener-hooks.js.map +1 -1
  19. package/build/components/header/document-actions/index.js +1 -17
  20. package/build/components/header/document-actions/index.js.map +1 -1
  21. package/build/components/header/fullscreen-mode-close/index.js +3 -22
  22. package/build/components/header/fullscreen-mode-close/index.js.map +1 -1
  23. package/build/components/header/header-toolbar/index.js +5 -22
  24. package/build/components/header/header-toolbar/index.js.map +1 -1
  25. package/build/components/header/header-toolbar/index.native.js +2 -24
  26. package/build/components/header/header-toolbar/index.native.js.map +1 -1
  27. package/build/components/header/index.js +3 -20
  28. package/build/components/header/index.js.map +1 -1
  29. package/build/components/header/index.native.js +1 -13
  30. package/build/components/header/index.native.js.map +1 -1
  31. package/build/components/header/main-dashboard-button/index.js +1 -7
  32. package/build/components/header/main-dashboard-button/index.js.map +1 -1
  33. package/build/components/header/mode-switcher/index.js +6 -21
  34. package/build/components/header/mode-switcher/index.js.map +1 -1
  35. package/build/components/header/more-menu/index.js +1 -12
  36. package/build/components/header/more-menu/index.js.map +1 -1
  37. package/build/components/header/plugin-more-menu-item/index.js +0 -8
  38. package/build/components/header/plugin-more-menu-item/index.js.map +1 -1
  39. package/build/components/header/plugin-sidebar-more-menu-item/index.js +3 -4
  40. package/build/components/header/plugin-sidebar-more-menu-item/index.js.map +1 -1
  41. package/build/components/header/post-publish-button-or-toggle.js +2 -11
  42. package/build/components/header/post-publish-button-or-toggle.js.map +1 -1
  43. package/build/components/header/preferences-menu-item/index.js +1 -7
  44. package/build/components/header/preferences-menu-item/index.js.map +1 -1
  45. package/build/components/header/tools-more-menu-group/index.js +1 -6
  46. package/build/components/header/tools-more-menu-group/index.js.map +1 -1
  47. package/build/components/header/writing-menu/index.js +1 -15
  48. package/build/components/header/writing-menu/index.js.map +1 -1
  49. package/build/components/keyboard-shortcut-help-modal/config.js +1 -2
  50. package/build/components/keyboard-shortcut-help-modal/config.js.map +1 -1
  51. package/build/components/keyboard-shortcut-help-modal/dynamic-shortcut.js +1 -9
  52. package/build/components/keyboard-shortcut-help-modal/dynamic-shortcut.js.map +1 -1
  53. package/build/components/keyboard-shortcut-help-modal/index.js +4 -25
  54. package/build/components/keyboard-shortcut-help-modal/index.js.map +1 -1
  55. package/build/components/keyboard-shortcut-help-modal/shortcut.js +1 -6
  56. package/build/components/keyboard-shortcut-help-modal/shortcut.js.map +1 -1
  57. package/build/components/keyboard-shortcuts/index.js +4 -23
  58. package/build/components/keyboard-shortcuts/index.js.map +1 -1
  59. package/build/components/layout/actions-panel.js +7 -17
  60. package/build/components/layout/actions-panel.js.map +1 -1
  61. package/build/components/layout/index.js +47 -82
  62. package/build/components/layout/index.js.map +1 -1
  63. package/build/components/layout/index.native.js +5 -34
  64. package/build/components/layout/index.native.js.map +1 -1
  65. package/build/components/meta-boxes/index.js +4 -12
  66. package/build/components/meta-boxes/index.js.map +1 -1
  67. package/build/components/meta-boxes/meta-box-visibility.js +1 -12
  68. package/build/components/meta-boxes/meta-box-visibility.js.map +1 -1
  69. package/build/components/meta-boxes/meta-boxes-area/index.js +0 -10
  70. package/build/components/meta-boxes/meta-boxes-area/index.js.map +1 -1
  71. package/build/components/preferences-modal/index.js +1 -18
  72. package/build/components/preferences-modal/index.js.map +1 -1
  73. package/build/components/preferences-modal/meta-boxes-section.js +3 -13
  74. package/build/components/preferences-modal/meta-boxes-section.js.map +1 -1
  75. package/build/components/preferences-modal/options/enable-custom-fields.js +10 -11
  76. package/build/components/preferences-modal/options/enable-custom-fields.js.map +1 -1
  77. package/build/components/preferences-modal/options/enable-feature.js +0 -7
  78. package/build/components/preferences-modal/options/enable-feature.js.map +1 -1
  79. package/build/components/preferences-modal/options/enable-panel.js +0 -7
  80. package/build/components/preferences-modal/options/enable-panel.js.map +1 -1
  81. package/build/components/preferences-modal/options/enable-plugin-document-setting-panel.js +1 -6
  82. package/build/components/preferences-modal/options/enable-plugin-document-setting-panel.js.map +1 -1
  83. package/build/components/preferences-modal/options/enable-publish-sidebar.js +2 -8
  84. package/build/components/preferences-modal/options/enable-publish-sidebar.js.map +1 -1
  85. package/build/components/preferences-modal/options/index.js +0 -6
  86. package/build/components/preferences-modal/options/index.js.map +1 -1
  87. package/build/components/secondary-sidebar/inserter-sidebar.js +1 -9
  88. package/build/components/secondary-sidebar/inserter-sidebar.js.map +1 -1
  89. package/build/components/secondary-sidebar/list-view-outline.js +1 -8
  90. package/build/components/secondary-sidebar/list-view-outline.js.map +1 -1
  91. package/build/components/secondary-sidebar/list-view-sidebar.js +32 -44
  92. package/build/components/secondary-sidebar/list-view-sidebar.js.map +1 -1
  93. package/build/components/sidebar/discussion-panel/index.js +0 -11
  94. package/build/components/sidebar/discussion-panel/index.js.map +1 -1
  95. package/build/components/sidebar/featured-image/index.js +0 -15
  96. package/build/components/sidebar/featured-image/index.js.map +1 -1
  97. package/build/components/sidebar/last-revision/index.js +1 -5
  98. package/build/components/sidebar/last-revision/index.js.map +1 -1
  99. package/build/components/sidebar/page-attributes/index.js +0 -14
  100. package/build/components/sidebar/page-attributes/index.js.map +1 -1
  101. package/build/components/sidebar/plugin-document-setting-panel/index.js +44 -61
  102. package/build/components/sidebar/plugin-document-setting-panel/index.js.map +1 -1
  103. package/build/components/sidebar/plugin-post-publish-panel/index.js +19 -25
  104. package/build/components/sidebar/plugin-post-publish-panel/index.js.map +1 -1
  105. package/build/components/sidebar/plugin-post-status-info/index.js +2 -5
  106. package/build/components/sidebar/plugin-post-status-info/index.js.map +1 -1
  107. package/build/components/sidebar/plugin-pre-publish-panel/index.js +19 -25
  108. package/build/components/sidebar/plugin-pre-publish-panel/index.js.map +1 -1
  109. package/build/components/sidebar/plugin-sidebar/index.js +0 -8
  110. package/build/components/sidebar/plugin-sidebar/index.js.map +1 -1
  111. package/build/components/sidebar/post-author/index.js +1 -5
  112. package/build/components/sidebar/post-author/index.js.map +1 -1
  113. package/build/components/sidebar/post-excerpt/index.js +0 -13
  114. package/build/components/sidebar/post-excerpt/index.js.map +1 -1
  115. package/build/components/sidebar/post-format/index.js +1 -5
  116. package/build/components/sidebar/post-format/index.js.map +1 -1
  117. package/build/components/sidebar/post-pending-status/index.js +1 -5
  118. package/build/components/sidebar/post-pending-status/index.js.map +1 -1
  119. package/build/components/sidebar/post-schedule/index.js +5 -9
  120. package/build/components/sidebar/post-schedule/index.js.map +1 -1
  121. package/build/components/sidebar/post-slug/index.js +1 -5
  122. package/build/components/sidebar/post-slug/index.js.map +1 -1
  123. package/build/components/sidebar/post-status/index.js +0 -24
  124. package/build/components/sidebar/post-status/index.js.map +1 -1
  125. package/build/components/sidebar/post-sticky/index.js +1 -5
  126. package/build/components/sidebar/post-sticky/index.js.map +1 -1
  127. package/build/components/sidebar/post-taxonomies/index.js +1 -6
  128. package/build/components/sidebar/post-taxonomies/index.js.map +1 -1
  129. package/build/components/sidebar/post-taxonomies/taxonomy-panel.js +21 -29
  130. package/build/components/sidebar/post-taxonomies/taxonomy-panel.js.map +1 -1
  131. package/build/components/sidebar/post-template/create-modal.js +1 -16
  132. package/build/components/sidebar/post-template/create-modal.js.map +1 -1
  133. package/build/components/sidebar/post-template/form.js +3 -16
  134. package/build/components/sidebar/post-template/form.js.map +1 -1
  135. package/build/components/sidebar/post-template/index.js +5 -24
  136. package/build/components/sidebar/post-template/index.js.map +1 -1
  137. package/build/components/sidebar/post-trash/index.js +1 -3
  138. package/build/components/sidebar/post-trash/index.js.map +1 -1
  139. package/build/components/sidebar/post-url/index.js +5 -9
  140. package/build/components/sidebar/post-url/index.js.map +1 -1
  141. package/build/components/sidebar/post-visibility/index.js +5 -10
  142. package/build/components/sidebar/post-visibility/index.js.map +1 -1
  143. package/build/components/sidebar/settings-header/index.js +12 -17
  144. package/build/components/sidebar/settings-header/index.js.map +1 -1
  145. package/build/components/sidebar/settings-sidebar/index.js +2 -29
  146. package/build/components/sidebar/settings-sidebar/index.js.map +1 -1
  147. package/build/components/sidebar/template-summary/index.js +1 -9
  148. package/build/components/sidebar/template-summary/index.js.map +1 -1
  149. package/build/components/start-page-options/index.js +1 -15
  150. package/build/components/start-page-options/index.js.map +1 -1
  151. package/build/components/text-editor/index.js +1 -8
  152. package/build/components/text-editor/index.js.map +1 -1
  153. package/build/components/view-link/index.js +3 -10
  154. package/build/components/view-link/index.js.map +1 -1
  155. package/build/components/visual-editor/block-inspector-button.js +1 -11
  156. package/build/components/visual-editor/block-inspector-button.js.map +1 -1
  157. package/build/components/visual-editor/header.native.js +1 -12
  158. package/build/components/visual-editor/header.native.js.map +1 -1
  159. package/build/components/visual-editor/index.js +33 -53
  160. package/build/components/visual-editor/index.js.map +1 -1
  161. package/build/components/visual-editor/index.native.js +1 -9
  162. package/build/components/visual-editor/index.native.js.map +1 -1
  163. package/build/components/welcome-guide/default.js +1 -8
  164. package/build/components/welcome-guide/default.js.map +1 -1
  165. package/build/components/welcome-guide/image.js +0 -2
  166. package/build/components/welcome-guide/image.js.map +1 -1
  167. package/build/components/welcome-guide/index.js +1 -11
  168. package/build/components/welcome-guide/index.js.map +1 -1
  169. package/build/components/welcome-guide/template.js +1 -8
  170. package/build/components/welcome-guide/template.js.map +1 -1
  171. package/build/editor.js +7 -29
  172. package/build/editor.js.map +1 -1
  173. package/build/editor.native.js +10 -35
  174. package/build/editor.native.js.map +1 -1
  175. package/build/hooks/commands/use-common-commands.js +10 -24
  176. package/build/hooks/commands/use-common-commands.js.map +1 -1
  177. package/build/hooks/components/index.js +1 -3
  178. package/build/hooks/components/index.js.map +1 -1
  179. package/build/hooks/index.js +0 -1
  180. package/build/hooks/index.js.map +1 -1
  181. package/build/hooks/validate-multiple-use/index.js +10 -18
  182. package/build/hooks/validate-multiple-use/index.js.map +1 -1
  183. package/build/index.js +14 -47
  184. package/build/index.js.map +1 -1
  185. package/build/index.native.js +0 -9
  186. package/build/index.native.js.map +1 -1
  187. package/build/lock-unlock.js +1 -2
  188. package/build/lock-unlock.js.map +1 -1
  189. package/build/plugins/copy-content-menu-item/index.js +1 -10
  190. package/build/plugins/copy-content-menu-item/index.js.map +1 -1
  191. package/build/plugins/index.js +5 -22
  192. package/build/plugins/index.js.map +1 -1
  193. package/build/plugins/keyboard-shortcuts-help-menu-item/index.js +1 -10
  194. package/build/plugins/keyboard-shortcuts-help-menu-item/index.js.map +1 -1
  195. package/build/plugins/welcome-guide-menu-item/index.js +1 -6
  196. package/build/plugins/welcome-guide-menu-item/index.js.map +1 -1
  197. package/build/store/actions.js +53 -120
  198. package/build/store/actions.js.map +1 -1
  199. package/build/store/constants.js +2 -3
  200. package/build/store/constants.js.map +1 -1
  201. package/build/store/index.js +0 -9
  202. package/build/store/index.js.map +1 -1
  203. package/build/store/reducer.js +9 -42
  204. package/build/store/reducer.js.map +1 -1
  205. package/build/store/selectors.js +63 -91
  206. package/build/store/selectors.js.map +1 -1
  207. package/build/utils/meta-boxes.js +0 -4
  208. package/build/utils/meta-boxes.js.map +1 -1
  209. package/build-module/components/block-manager/category.js +1 -8
  210. package/build-module/components/block-manager/category.js.map +1 -1
  211. package/build-module/components/block-manager/checklist.js +0 -3
  212. package/build-module/components/block-manager/checklist.js.map +1 -1
  213. package/build-module/components/block-manager/index.js +11 -14
  214. package/build-module/components/block-manager/index.js.map +1 -1
  215. package/build-module/components/block-settings-menu/plugin-block-settings-menu-item.js +2 -8
  216. package/build-module/components/block-settings-menu/plugin-block-settings-menu-item.js.map +1 -1
  217. package/build-module/components/browser-url/index.js +7 -14
  218. package/build-module/components/browser-url/index.js.map +1 -1
  219. package/build-module/components/device-preview/index.js +1 -3
  220. package/build-module/components/device-preview/index.js.map +1 -1
  221. package/build-module/components/editor-initialization/index.js +1 -1
  222. package/build-module/components/editor-initialization/index.js.map +1 -1
  223. package/build-module/components/editor-initialization/listener-hooks.js +3 -5
  224. package/build-module/components/editor-initialization/listener-hooks.js.map +1 -1
  225. package/build-module/components/header/document-actions/index.js +1 -10
  226. package/build-module/components/header/document-actions/index.js.map +1 -1
  227. package/build-module/components/header/fullscreen-mode-close/index.js +4 -13
  228. package/build-module/components/header/fullscreen-mode-close/index.js.map +1 -1
  229. package/build-module/components/header/header-toolbar/index.js +5 -13
  230. package/build-module/components/header/header-toolbar/index.js.map +1 -1
  231. package/build-module/components/header/header-toolbar/index.native.js +3 -11
  232. package/build-module/components/header/header-toolbar/index.native.js.map +1 -1
  233. package/build-module/components/header/index.js +3 -5
  234. package/build-module/components/header/index.js.map +1 -1
  235. package/build-module/components/header/index.native.js +2 -9
  236. package/build-module/components/header/index.native.js.map +1 -1
  237. package/build-module/components/header/main-dashboard-button/index.js +0 -5
  238. package/build-module/components/header/main-dashboard-button/index.js.map +1 -1
  239. package/build-module/components/header/mode-switcher/index.js +8 -16
  240. package/build-module/components/header/mode-switcher/index.js.map +1 -1
  241. package/build-module/components/header/more-menu/index.js +1 -4
  242. package/build-module/components/header/more-menu/index.js.map +1 -1
  243. package/build-module/components/header/plugin-more-menu-item/index.js +1 -2
  244. package/build-module/components/header/plugin-more-menu-item/index.js.map +1 -1
  245. package/build-module/components/header/plugin-sidebar-more-menu-item/index.js +3 -2
  246. package/build-module/components/header/plugin-sidebar-more-menu-item/index.js.map +1 -1
  247. package/build-module/components/header/post-publish-button-or-toggle.js +2 -5
  248. package/build-module/components/header/post-publish-button-or-toggle.js.map +1 -1
  249. package/build-module/components/header/preferences-menu-item/index.js +1 -2
  250. package/build-module/components/header/preferences-menu-item/index.js.map +1 -1
  251. package/build-module/components/header/tools-more-menu-group/index.js +0 -3
  252. package/build-module/components/header/tools-more-menu-group/index.js.map +1 -1
  253. package/build-module/components/header/writing-menu/index.js +1 -8
  254. package/build-module/components/header/writing-menu/index.js.map +1 -1
  255. package/build-module/components/keyboard-shortcut-help-modal/config.js.map +1 -1
  256. package/build-module/components/keyboard-shortcut-help-modal/dynamic-shortcut.js +1 -6
  257. package/build-module/components/keyboard-shortcut-help-modal/dynamic-shortcut.js.map +1 -1
  258. package/build-module/components/keyboard-shortcut-help-modal/index.js +5 -13
  259. package/build-module/components/keyboard-shortcut-help-modal/index.js.map +1 -1
  260. package/build-module/components/keyboard-shortcut-help-modal/shortcut.js +0 -5
  261. package/build-module/components/keyboard-shortcut-help-modal/shortcut.js.map +1 -1
  262. package/build-module/components/keyboard-shortcuts/index.js +4 -14
  263. package/build-module/components/keyboard-shortcuts/index.js.map +1 -1
  264. package/build-module/components/layout/actions-panel.js +6 -8
  265. package/build-module/components/layout/actions-panel.js.map +1 -1
  266. package/build-module/components/layout/index.js +50 -57
  267. package/build-module/components/layout/index.js.map +1 -1
  268. package/build-module/components/layout/index.native.js +6 -20
  269. package/build-module/components/layout/index.native.js.map +1 -1
  270. package/build-module/components/meta-boxes/index.js +4 -6
  271. package/build-module/components/meta-boxes/index.js.map +1 -1
  272. package/build-module/components/meta-boxes/meta-box-visibility.js +1 -9
  273. package/build-module/components/meta-boxes/meta-box-visibility.js.map +1 -1
  274. package/build-module/components/meta-boxes/meta-boxes-area/index.js +3 -7
  275. package/build-module/components/meta-boxes/meta-boxes-area/index.js.map +1 -1
  276. package/build-module/components/preferences-modal/index.js +2 -5
  277. package/build-module/components/preferences-modal/index.js.map +1 -1
  278. package/build-module/components/preferences-modal/meta-boxes-section.js +3 -5
  279. package/build-module/components/preferences-modal/meta-boxes-section.js.map +1 -1
  280. package/build-module/components/preferences-modal/options/enable-custom-fields.js +9 -2
  281. package/build-module/components/preferences-modal/options/enable-custom-fields.js.map +1 -1
  282. package/build-module/components/preferences-modal/options/enable-feature.js +1 -1
  283. package/build-module/components/preferences-modal/options/enable-feature.js.map +1 -1
  284. package/build-module/components/preferences-modal/options/enable-panel.js +1 -1
  285. package/build-module/components/preferences-modal/options/enable-panel.js.map +1 -1
  286. package/build-module/components/preferences-modal/options/enable-plugin-document-setting-panel.js +1 -4
  287. package/build-module/components/preferences-modal/options/enable-plugin-document-setting-panel.js.map +1 -1
  288. package/build-module/components/preferences-modal/options/enable-publish-sidebar.js +2 -1
  289. package/build-module/components/preferences-modal/options/enable-publish-sidebar.js.map +1 -1
  290. package/build-module/components/preferences-modal/options/index.js.map +1 -1
  291. package/build-module/components/secondary-sidebar/inserter-sidebar.js +1 -2
  292. package/build-module/components/secondary-sidebar/inserter-sidebar.js.map +1 -1
  293. package/build-module/components/secondary-sidebar/list-view-outline.js +0 -3
  294. package/build-module/components/secondary-sidebar/list-view-outline.js.map +1 -1
  295. package/build-module/components/secondary-sidebar/list-view-sidebar.js +32 -30
  296. package/build-module/components/secondary-sidebar/list-view-sidebar.js.map +1 -1
  297. package/build-module/components/sidebar/discussion-panel/index.js +2 -7
  298. package/build-module/components/sidebar/discussion-panel/index.js.map +1 -1
  299. package/build-module/components/sidebar/featured-image/index.js +2 -7
  300. package/build-module/components/sidebar/featured-image/index.js.map +1 -1
  301. package/build-module/components/sidebar/last-revision/index.js +0 -3
  302. package/build-module/components/sidebar/last-revision/index.js.map +1 -1
  303. package/build-module/components/sidebar/page-attributes/index.js +2 -7
  304. package/build-module/components/sidebar/page-attributes/index.js.map +1 -1
  305. package/build-module/components/sidebar/plugin-document-setting-panel/index.js +46 -55
  306. package/build-module/components/sidebar/plugin-document-setting-panel/index.js.map +1 -1
  307. package/build-module/components/sidebar/plugin-post-publish-panel/index.js +19 -22
  308. package/build-module/components/sidebar/plugin-post-publish-panel/index.js.map +1 -1
  309. package/build-module/components/sidebar/plugin-post-status-info/index.js +1 -3
  310. package/build-module/components/sidebar/plugin-post-status-info/index.js.map +1 -1
  311. package/build-module/components/sidebar/plugin-pre-publish-panel/index.js +19 -22
  312. package/build-module/components/sidebar/plugin-pre-publish-panel/index.js.map +1 -1
  313. package/build-module/components/sidebar/plugin-sidebar/index.js +2 -3
  314. package/build-module/components/sidebar/plugin-sidebar/index.js.map +1 -1
  315. package/build-module/components/sidebar/post-author/index.js +0 -1
  316. package/build-module/components/sidebar/post-author/index.js.map +1 -1
  317. package/build-module/components/sidebar/post-excerpt/index.js +2 -7
  318. package/build-module/components/sidebar/post-excerpt/index.js.map +1 -1
  319. package/build-module/components/sidebar/post-format/index.js +0 -1
  320. package/build-module/components/sidebar/post-format/index.js.map +1 -1
  321. package/build-module/components/sidebar/post-pending-status/index.js +0 -1
  322. package/build-module/components/sidebar/post-pending-status/index.js.map +1 -1
  323. package/build-module/components/sidebar/post-schedule/index.js +4 -5
  324. package/build-module/components/sidebar/post-schedule/index.js.map +1 -1
  325. package/build-module/components/sidebar/post-slug/index.js +0 -1
  326. package/build-module/components/sidebar/post-slug/index.js.map +1 -1
  327. package/build-module/components/sidebar/post-status/index.js +2 -6
  328. package/build-module/components/sidebar/post-status/index.js.map +1 -1
  329. package/build-module/components/sidebar/post-sticky/index.js +0 -1
  330. package/build-module/components/sidebar/post-sticky/index.js.map +1 -1
  331. package/build-module/components/sidebar/post-taxonomies/index.js +1 -4
  332. package/build-module/components/sidebar/post-taxonomies/index.js.map +1 -1
  333. package/build-module/components/sidebar/post-taxonomies/taxonomy-panel.js +22 -26
  334. package/build-module/components/sidebar/post-taxonomies/taxonomy-panel.js.map +1 -1
  335. package/build-module/components/sidebar/post-template/create-modal.js +1 -10
  336. package/build-module/components/sidebar/post-template/create-modal.js.map +1 -1
  337. package/build-module/components/sidebar/post-template/form.js +3 -6
  338. package/build-module/components/sidebar/post-template/form.js.map +1 -1
  339. package/build-module/components/sidebar/post-template/index.js +5 -16
  340. package/build-module/components/sidebar/post-template/index.js.map +1 -1
  341. package/build-module/components/sidebar/post-trash/index.js +0 -1
  342. package/build-module/components/sidebar/post-trash/index.js.map +1 -1
  343. package/build-module/components/sidebar/post-url/index.js +4 -5
  344. package/build-module/components/sidebar/post-url/index.js.map +1 -1
  345. package/build-module/components/sidebar/post-visibility/index.js +4 -6
  346. package/build-module/components/sidebar/post-visibility/index.js.map +1 -1
  347. package/build-module/components/sidebar/settings-header/index.js +12 -13
  348. package/build-module/components/sidebar/settings-header/index.js.map +1 -1
  349. package/build-module/components/sidebar/settings-sidebar/index.js +2 -9
  350. package/build-module/components/sidebar/settings-sidebar/index.js.map +1 -1
  351. package/build-module/components/sidebar/template-summary/index.js +1 -6
  352. package/build-module/components/sidebar/template-summary/index.js.map +1 -1
  353. package/build-module/components/start-page-options/index.js +1 -8
  354. package/build-module/components/start-page-options/index.js.map +1 -1
  355. package/build-module/components/text-editor/index.js +1 -2
  356. package/build-module/components/text-editor/index.js.map +1 -1
  357. package/build-module/components/view-link/index.js +2 -3
  358. package/build-module/components/view-link/index.js.map +1 -1
  359. package/build-module/components/visual-editor/block-inspector-button.js +1 -5
  360. package/build-module/components/visual-editor/block-inspector-button.js.map +1 -1
  361. package/build-module/components/visual-editor/header.native.js +1 -4
  362. package/build-module/components/visual-editor/header.native.js.map +1 -1
  363. package/build-module/components/visual-editor/index.js +34 -43
  364. package/build-module/components/visual-editor/index.js.map +1 -1
  365. package/build-module/components/visual-editor/index.native.js +1 -5
  366. package/build-module/components/visual-editor/index.native.js.map +1 -1
  367. package/build-module/components/welcome-guide/default.js +1 -2
  368. package/build-module/components/welcome-guide/default.js.map +1 -1
  369. package/build-module/components/welcome-guide/image.js.map +1 -1
  370. package/build-module/components/welcome-guide/index.js +1 -6
  371. package/build-module/components/welcome-guide/index.js.map +1 -1
  372. package/build-module/components/welcome-guide/template.js +1 -2
  373. package/build-module/components/welcome-guide/template.js.map +1 -1
  374. package/build-module/editor.js +7 -14
  375. package/build-module/editor.js.map +1 -1
  376. package/build-module/editor.native.js +11 -23
  377. package/build-module/editor.native.js.map +1 -1
  378. package/build-module/hooks/commands/use-common-commands.js +11 -14
  379. package/build-module/hooks/commands/use-common-commands.js.map +1 -1
  380. package/build-module/hooks/components/index.js +0 -2
  381. package/build-module/hooks/components/index.js.map +1 -1
  382. package/build-module/hooks/index.js.map +1 -1
  383. package/build-module/hooks/validate-multiple-use/index.js +9 -11
  384. package/build-module/hooks/validate-multiple-use/index.js.map +1 -1
  385. package/build-module/index.js +16 -25
  386. package/build-module/index.js.map +1 -1
  387. package/build-module/index.native.js +2 -3
  388. package/build-module/index.native.js.map +1 -1
  389. package/build-module/lock-unlock.js.map +1 -1
  390. package/build-module/plugins/copy-content-menu-item/index.js +0 -3
  391. package/build-module/plugins/copy-content-menu-item/index.js.map +1 -1
  392. package/build-module/plugins/index.js +5 -11
  393. package/build-module/plugins/index.js.map +1 -1
  394. package/build-module/plugins/keyboard-shortcuts-help-menu-item/index.js +1 -2
  395. package/build-module/plugins/keyboard-shortcuts-help-menu-item/index.js.map +1 -1
  396. package/build-module/plugins/welcome-guide-menu-item/index.js +1 -2
  397. package/build-module/plugins/welcome-guide-menu-item/index.js.map +1 -1
  398. package/build-module/store/actions.js +55 -66
  399. package/build-module/store/actions.js.map +1 -1
  400. package/build-module/store/constants.js +2 -2
  401. package/build-module/store/constants.js.map +1 -1
  402. package/build-module/store/index.js +2 -2
  403. package/build-module/store/index.js.map +1 -1
  404. package/build-module/store/reducer.js +10 -33
  405. package/build-module/store/reducer.js.map +1 -1
  406. package/build-module/store/selectors.js +63 -64
  407. package/build-module/store/selectors.js.map +1 -1
  408. package/build-module/utils/meta-boxes.js +0 -2
  409. package/build-module/utils/meta-boxes.js.map +1 -1
  410. package/build-style/style-rtl.css +21 -10
  411. package/build-style/style.css +21 -10
  412. package/package.json +32 -32
  413. package/src/components/keyboard-shortcut-help-modal/test/__snapshots__/index.js.snap +29 -0
  414. package/src/components/keyboard-shortcuts/index.js +2 -2
  415. package/src/components/layout/index.js +56 -40
  416. package/src/components/preferences-modal/options/enable-custom-fields.js +15 -4
  417. package/src/components/preferences-modal/options/test/enable-custom-fields.js +6 -1
  418. package/src/components/preferences-modal/test/index.js +7 -3
  419. package/src/components/secondary-sidebar/style.scss +2 -1
  420. package/src/components/sidebar/plugin-document-setting-panel/index.js +54 -65
  421. package/src/components/sidebar/plugin-post-publish-panel/index.js +23 -27
  422. package/src/components/sidebar/plugin-pre-publish-panel/index.js +25 -28
  423. package/src/components/sidebar/post-schedule/style.scss +2 -0
  424. package/src/components/sidebar/post-taxonomies/taxonomy-panel.js +19 -32
  425. package/src/components/visual-editor/index.js +9 -8
  426. package/src/components/visual-editor/style.scss +5 -1
  427. package/src/hooks/commands/use-common-commands.js +8 -12
  428. package/src/store/selectors.js +10 -3
@@ -4,7 +4,6 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.getMetaBoxContainer = void 0;
7
-
8
7
  /**
9
8
  * Function returning the current Meta Boxes DOM Node in the editor
10
9
  * whether the meta box area is opened or not.
@@ -16,13 +15,10 @@ exports.getMetaBoxContainer = void 0;
16
15
  */
17
16
  const getMetaBoxContainer = location => {
18
17
  const area = document.querySelector(`.edit-post-meta-boxes-area.is-${location} .metabox-location-${location}`);
19
-
20
18
  if (area) {
21
19
  return area;
22
20
  }
23
-
24
21
  return document.querySelector('#metaboxes .metabox-location-' + location);
25
22
  };
26
-
27
23
  exports.getMetaBoxContainer = getMetaBoxContainer;
28
24
  //# sourceMappingURL=meta-boxes.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-post/src/utils/meta-boxes.js"],"names":["getMetaBoxContainer","location","area","document","querySelector"],"mappings":";;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMA,mBAAmB,GAAKC,QAAF,IAAgB;AAClD,QAAMC,IAAI,GAAGC,QAAQ,CAACC,aAAT,CACX,iCAAiCH,QAAU,sBAAsBA,QAAU,EADhE,CAAb;;AAGA,MAAKC,IAAL,EAAY;AACX,WAAOA,IAAP;AACA;;AAED,SAAOC,QAAQ,CAACC,aAAT,CAAwB,kCAAkCH,QAA1D,CAAP;AACA,CATM","sourcesContent":["/**\n * Function returning the current Meta Boxes DOM Node in the editor\n * whether the meta box area is opened or not.\n * If the MetaBox Area is visible returns it, and returns the original container instead.\n *\n * @param {string} location Meta Box location.\n *\n * @return {string} HTML content.\n */\nexport const getMetaBoxContainer = ( location ) => {\n\tconst area = document.querySelector(\n\t\t`.edit-post-meta-boxes-area.is-${ location } .metabox-location-${ location }`\n\t);\n\tif ( area ) {\n\t\treturn area;\n\t}\n\n\treturn document.querySelector( '#metaboxes .metabox-location-' + location );\n};\n"]}
1
+ {"version":3,"names":["getMetaBoxContainer","location","area","document","querySelector","exports"],"sources":["@wordpress/edit-post/src/utils/meta-boxes.js"],"sourcesContent":["/**\n * Function returning the current Meta Boxes DOM Node in the editor\n * whether the meta box area is opened or not.\n * If the MetaBox Area is visible returns it, and returns the original container instead.\n *\n * @param {string} location Meta Box location.\n *\n * @return {string} HTML content.\n */\nexport const getMetaBoxContainer = ( location ) => {\n\tconst area = document.querySelector(\n\t\t`.edit-post-meta-boxes-area.is-${ location } .metabox-location-${ location }`\n\t);\n\tif ( area ) {\n\t\treturn area;\n\t}\n\n\treturn document.querySelector( '#metaboxes .metabox-location-' + location );\n};\n"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMA,mBAAmB,GAAKC,QAAQ,IAAM;EAClD,MAAMC,IAAI,GAAGC,QAAQ,CAACC,aAAa,CACjC,iCAAiCH,QAAU,sBAAsBA,QAAU,EAC7E,CAAC;EACD,IAAKC,IAAI,EAAG;IACX,OAAOA,IAAI;EACZ;EAEA,OAAOC,QAAQ,CAACC,aAAa,CAAE,+BAA+B,GAAGH,QAAS,CAAC;AAC5E,CAAC;AAACI,OAAA,CAAAL,mBAAA,GAAAA,mBAAA"}
@@ -1,5 +1,4 @@
1
1
  import { createElement } from "@wordpress/element";
2
-
3
2
  /**
4
3
  * WordPress dependencies
5
4
  */
@@ -8,13 +7,12 @@ import { useDispatch, useSelect } from '@wordpress/data';
8
7
  import { useInstanceId } from '@wordpress/compose';
9
8
  import { CheckboxControl } from '@wordpress/components';
10
9
  import { store as editorStore } from '@wordpress/editor';
10
+
11
11
  /**
12
12
  * Internal dependencies
13
13
  */
14
-
15
14
  import BlockTypesChecklist from './checklist';
16
15
  import { store as editPostStore } from '../../store';
17
-
18
16
  function BlockManagerCategory({
19
17
  title,
20
18
  blockTypes
@@ -39,7 +37,6 @@ function BlockManagerCategory({
39
37
  if (defaultAllowedBlockTypes === true) {
40
38
  return blockTypes;
41
39
  }
42
-
43
40
  return blockTypes.filter(({
44
41
  name
45
42
  }) => {
@@ -61,18 +58,15 @@ function BlockManagerCategory({
61
58
  const blockNames = blockTypes.map(({
62
59
  name
63
60
  }) => name);
64
-
65
61
  if (nextIsChecked) {
66
62
  showBlockTypes(blockNames);
67
63
  } else {
68
64
  hideBlockTypes(blockNames);
69
65
  }
70
66
  }, [blockTypes]);
71
-
72
67
  if (!filteredBlockTypes.length) {
73
68
  return null;
74
69
  }
75
-
76
70
  const checkedBlockNames = filteredBlockTypes.map(({
77
71
  name
78
72
  }) => name).filter(type => !hiddenBlockTypes.includes(type));
@@ -98,6 +92,5 @@ function BlockManagerCategory({
98
92
  onItemChange: toggleVisible
99
93
  }));
100
94
  }
101
-
102
95
  export default BlockManagerCategory;
103
96
  //# sourceMappingURL=category.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-post/src/components/block-manager/category.js"],"names":["useMemo","useCallback","useDispatch","useSelect","useInstanceId","CheckboxControl","store","editorStore","BlockTypesChecklist","editPostStore","BlockManagerCategory","title","blockTypes","instanceId","defaultAllowedBlockTypes","hiddenBlockTypes","select","getEditorSettings","getHiddenBlockTypes","filteredBlockTypes","filter","name","includes","showBlockTypes","hideBlockTypes","toggleVisible","blockName","nextIsChecked","toggleAllVisible","blockNames","map","length","checkedBlockNames","type","titleId","isAllChecked","isIndeterminate"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,OAAT,EAAkBC,WAAlB,QAAqC,oBAArC;AACA,SAASC,WAAT,EAAsBC,SAAtB,QAAuC,iBAAvC;AACA,SAASC,aAAT,QAA8B,oBAA9B;AACA,SAASC,eAAT,QAAgC,uBAAhC;AACA,SAASC,KAAK,IAAIC,WAAlB,QAAqC,mBAArC;AAEA;AACA;AACA;;AACA,OAAOC,mBAAP,MAAgC,aAAhC;AACA,SAASF,KAAK,IAAIG,aAAlB,QAAuC,aAAvC;;AAEA,SAASC,oBAAT,CAA+B;AAAEC,EAAAA,KAAF;AAASC,EAAAA;AAAT,CAA/B,EAAuD;AACtD,QAAMC,UAAU,GAAGT,aAAa,CAAEM,oBAAF,CAAhC;AACA,QAAM;AAAEI,IAAAA,wBAAF;AAA4BC,IAAAA;AAA5B,MAAiDZ,SAAS,CAC7Da,MAAF,IAAc;AACb,UAAM;AAAEC,MAAAA;AAAF,QAAwBD,MAAM,CAAET,WAAF,CAApC;AACA,UAAM;AAAEW,MAAAA;AAAF,QAA0BF,MAAM,CAAEP,aAAF,CAAtC;AACA,WAAO;AACNK,MAAAA,wBAAwB,EACvBG,iBAAiB,GAAGH,wBAFf;AAGNC,MAAAA,gBAAgB,EAAEG,mBAAmB;AAH/B,KAAP;AAKA,GAT8D,EAU/D,EAV+D,CAAhE;AAYA,QAAMC,kBAAkB,GAAGnB,OAAO,CAAE,MAAM;AACzC,QAAKc,wBAAwB,KAAK,IAAlC,EAAyC;AACxC,aAAOF,UAAP;AACA;;AACD,WAAOA,UAAU,CAACQ,MAAX,CAAmB,CAAE;AAAEC,MAAAA;AAAF,KAAF,KAAgB;AAC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AAiB,CAACD,MAAlB,GAA2B,CAArE;AAEA,SACC;AACC,IAAA,IAAI,EAAC,OADN;AAEC,uBAAkBG,OAFnB;AAGC,IAAA,SAAS,EAAC;AAHX,KAKC,cAAC,eAAD;AACC,IAAA,uBAAuB,MADxB;AAEC,IAAA,OAAO,EAAGC,YAFX;AAGC,IAAA,QAAQ,EAAGP,gBAHZ;AAIC,IAAA,SAAS,EAAC,yCAJX;AAKC,IAAA,aAAa,EAAGQ,eALjB;AAMC,IAAA,KAAK,EAAG;AAAM,MAAA,EAAE,EAAGF;AAAX,OAAuBvB,KAAvB;AANT,IALD,EAaC,cAAC,mBAAD;AACC,IAAA,UAAU,EAAGQ,kBADd;AAEC,IAAA,KAAK,EAAGa,iBAFT;AAGC,IAAA,YAAY,EAAGP;AAHhB,IAbD,CADD;AAqBA;;AAED,eAAef,oBAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useMemo, useCallback } from '@wordpress/element';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { useInstanceId } from '@wordpress/compose';\nimport { CheckboxControl } from '@wordpress/components';\nimport { store as editorStore } from '@wordpress/editor';\n\n/**\n * Internal dependencies\n */\nimport BlockTypesChecklist from './checklist';\nimport { store as editPostStore } from '../../store';\n\nfunction BlockManagerCategory( { title, blockTypes } ) {\n\tconst instanceId = useInstanceId( BlockManagerCategory );\n\tconst { defaultAllowedBlockTypes, hiddenBlockTypes } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEditorSettings } = select( editorStore );\n\t\t\tconst { getHiddenBlockTypes } = select( editPostStore );\n\t\t\treturn {\n\t\t\t\tdefaultAllowedBlockTypes:\n\t\t\t\t\tgetEditorSettings().defaultAllowedBlockTypes,\n\t\t\t\thiddenBlockTypes: getHiddenBlockTypes(),\n\t\t\t};\n\t\t},\n\t\t[]\n\t);\n\tconst filteredBlockTypes = useMemo( () => {\n\t\tif ( defaultAllowedBlockTypes === true ) {\n\t\t\treturn blockTypes;\n\t\t}\n\t\treturn blockTypes.filter( ( { name } ) => {\n\t\t\treturn defaultAllowedBlockTypes?.includes( name );\n\t\t} );\n\t}, [ defaultAllowedBlockTypes, blockTypes ] );\n\tconst { showBlockTypes, hideBlockTypes } = useDispatch( editPostStore );\n\tconst toggleVisible = useCallback( ( blockName, nextIsChecked ) => {\n\t\tif ( nextIsChecked ) {\n\t\t\tshowBlockTypes( blockName );\n\t\t} else {\n\t\t\thideBlockTypes( blockName );\n\t\t}\n\t}, [] );\n\tconst toggleAllVisible = useCallback(\n\t\t( nextIsChecked ) => {\n\t\t\tconst blockNames = blockTypes.map( ( { name } ) => name );\n\t\t\tif ( nextIsChecked ) {\n\t\t\t\tshowBlockTypes( blockNames );\n\t\t\t} else {\n\t\t\t\thideBlockTypes( blockNames );\n\t\t\t}\n\t\t},\n\t\t[ blockTypes ]\n\t);\n\n\tif ( ! filteredBlockTypes.length ) {\n\t\treturn null;\n\t}\n\n\tconst checkedBlockNames = filteredBlockTypes\n\t\t.map( ( { name } ) => name )\n\t\t.filter( ( type ) => ! hiddenBlockTypes.includes( type ) );\n\n\tconst titleId = 'edit-post-block-manager__category-title-' + instanceId;\n\n\tconst isAllChecked = checkedBlockNames.length === filteredBlockTypes.length;\n\tconst isIndeterminate = ! isAllChecked && checkedBlockNames.length > 0;\n\n\treturn (\n\t\t<div\n\t\t\trole=\"group\"\n\t\t\taria-labelledby={ titleId }\n\t\t\tclassName=\"edit-post-block-manager__category\"\n\t\t>\n\t\t\t<CheckboxControl\n\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\tchecked={ isAllChecked }\n\t\t\t\tonChange={ toggleAllVisible }\n\t\t\t\tclassName=\"edit-post-block-manager__category-title\"\n\t\t\t\tindeterminate={ isIndeterminate }\n\t\t\t\tlabel={ <span id={ titleId }>{ title }</span> }\n\t\t\t/>\n\t\t\t<BlockTypesChecklist\n\t\t\t\tblockTypes={ filteredBlockTypes }\n\t\t\t\tvalue={ checkedBlockNames }\n\t\t\t\tonItemChange={ toggleVisible }\n\t\t\t/>\n\t\t</div>\n\t);\n}\n\nexport default BlockManagerCategory;\n"]}
1
+ {"version":3,"names":["useMemo","useCallback","useDispatch","useSelect","useInstanceId","CheckboxControl","store","editorStore","BlockTypesChecklist","editPostStore","BlockManagerCategory","title","blockTypes","instanceId","defaultAllowedBlockTypes","hiddenBlockTypes","select","getEditorSettings","getHiddenBlockTypes","filteredBlockTypes","filter","name","includes","showBlockTypes","hideBlockTypes","toggleVisible","blockName","nextIsChecked","toggleAllVisible","blockNames","map","length","checkedBlockNames","type","titleId","isAllChecked","isIndeterminate","createElement","role","className","__nextHasNoMarginBottom","checked","onChange","indeterminate","label","id","value","onItemChange"],"sources":["@wordpress/edit-post/src/components/block-manager/category.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useMemo, useCallback } from '@wordpress/element';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { useInstanceId } from '@wordpress/compose';\nimport { CheckboxControl } from '@wordpress/components';\nimport { store as editorStore } from '@wordpress/editor';\n\n/**\n * Internal dependencies\n */\nimport BlockTypesChecklist from './checklist';\nimport { store as editPostStore } from '../../store';\n\nfunction BlockManagerCategory( { title, blockTypes } ) {\n\tconst instanceId = useInstanceId( BlockManagerCategory );\n\tconst { defaultAllowedBlockTypes, hiddenBlockTypes } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEditorSettings } = select( editorStore );\n\t\t\tconst { getHiddenBlockTypes } = select( editPostStore );\n\t\t\treturn {\n\t\t\t\tdefaultAllowedBlockTypes:\n\t\t\t\t\tgetEditorSettings().defaultAllowedBlockTypes,\n\t\t\t\thiddenBlockTypes: getHiddenBlockTypes(),\n\t\t\t};\n\t\t},\n\t\t[]\n\t);\n\tconst filteredBlockTypes = useMemo( () => {\n\t\tif ( defaultAllowedBlockTypes === true ) {\n\t\t\treturn blockTypes;\n\t\t}\n\t\treturn blockTypes.filter( ( { name } ) => {\n\t\t\treturn defaultAllowedBlockTypes?.includes( name );\n\t\t} );\n\t}, [ defaultAllowedBlockTypes, blockTypes ] );\n\tconst { showBlockTypes, hideBlockTypes } = useDispatch( editPostStore );\n\tconst toggleVisible = useCallback( ( blockName, nextIsChecked ) => {\n\t\tif ( nextIsChecked ) {\n\t\t\tshowBlockTypes( blockName );\n\t\t} else {\n\t\t\thideBlockTypes( blockName );\n\t\t}\n\t}, [] );\n\tconst toggleAllVisible = useCallback(\n\t\t( nextIsChecked ) => {\n\t\t\tconst blockNames = blockTypes.map( ( { name } ) => name );\n\t\t\tif ( nextIsChecked ) {\n\t\t\t\tshowBlockTypes( blockNames );\n\t\t\t} else {\n\t\t\t\thideBlockTypes( blockNames );\n\t\t\t}\n\t\t},\n\t\t[ blockTypes ]\n\t);\n\n\tif ( ! filteredBlockTypes.length ) {\n\t\treturn null;\n\t}\n\n\tconst checkedBlockNames = filteredBlockTypes\n\t\t.map( ( { name } ) => name )\n\t\t.filter( ( type ) => ! hiddenBlockTypes.includes( type ) );\n\n\tconst titleId = 'edit-post-block-manager__category-title-' + instanceId;\n\n\tconst isAllChecked = checkedBlockNames.length === filteredBlockTypes.length;\n\tconst isIndeterminate = ! isAllChecked && checkedBlockNames.length > 0;\n\n\treturn (\n\t\t<div\n\t\t\trole=\"group\"\n\t\t\taria-labelledby={ titleId }\n\t\t\tclassName=\"edit-post-block-manager__category\"\n\t\t>\n\t\t\t<CheckboxControl\n\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\tchecked={ isAllChecked }\n\t\t\t\tonChange={ toggleAllVisible }\n\t\t\t\tclassName=\"edit-post-block-manager__category-title\"\n\t\t\t\tindeterminate={ isIndeterminate }\n\t\t\t\tlabel={ <span id={ titleId }>{ title }</span> }\n\t\t\t/>\n\t\t\t<BlockTypesChecklist\n\t\t\t\tblockTypes={ filteredBlockTypes }\n\t\t\t\tvalue={ checkedBlockNames }\n\t\t\t\tonItemChange={ toggleVisible }\n\t\t\t/>\n\t\t</div>\n\t);\n}\n\nexport default BlockManagerCategory;\n"],"mappings":";AAAA;AACA;AAC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IAAS,GAAGvB,KAAa;EAAG,CAC/C,CAAC,EACF0B,aAAA,CAAC7B,mBAAmB;IACnBI,UAAU,EAAGO,kBAAoB;IACjC2B,KAAK,EAAGd,iBAAmB;IAC3Be,YAAY,EAAGtB;EAAe,CAC9B,CACG,CAAC;AAER;AAEA,eAAef,oBAAoB"}
@@ -1,11 +1,9 @@
1
1
  import { createElement } from "@wordpress/element";
2
-
3
2
  /**
4
3
  * WordPress dependencies
5
4
  */
6
5
  import { BlockIcon } from '@wordpress/block-editor';
7
6
  import { CheckboxControl } from '@wordpress/components';
8
-
9
7
  function BlockTypesChecklist({
10
8
  blockTypes,
11
9
  value,
@@ -25,6 +23,5 @@ function BlockTypesChecklist({
25
23
  icon: blockType.icon
26
24
  }))));
27
25
  }
28
-
29
26
  export default BlockTypesChecklist;
30
27
  //# sourceMappingURL=checklist.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-post/src/components/block-manager/checklist.js"],"names":["BlockIcon","CheckboxControl","BlockTypesChecklist","blockTypes","value","onItemChange","map","blockType","name","title","includes","args","icon"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,SAAT,QAA0B,yBAA1B;AACA,SAASC,eAAT,QAAgC,uBAAhC;;AAEA,SAASC,mBAAT,CAA8B;AAAEC,EAAAA,UAAF;AAAcC,EAAAA,KAAd;AAAqBC,EAAAA;AAArB,CAA9B,EAAoE;AACnE,SACC;AAAI,IAAA,SAAS,EAAC;AAAd,KACGF,UAAU,CAACG,GAAX,CAAkBC,SAAF,IACjB;AACC,IAAA,GAAG,EAAGA,SAAS,CAACC,IADjB;AAEC,IAAA,SAAS,EAAC;AAFX,KAIC,cAAC,eAAD;AACC,IAAA,uBAAuB,MADxB;AAEC,IAAA,KAAK,EAAGD,SAAS,CAACE,KAFnB;AAGC,IAAA,OAAO,EAAGL,KAAK,CAACM,QAAN,CAAgBH,SAAS,CAACC,IAA1B,CAHX;AAIC,IAAA,QAAQ,EAAG,CAAE,GAAGG,IAAL,KACVN,YAAY,CAAEE,SAAS,CAACC,IAAZ,EAAkB,GAAGG,IAArB;AALd,IAJD,EAYC,cAAC,SAAD;AAAW,IAAA,IAAI,EAAGJ,SAAS,CAACK;AAA5B,IAZD,CADC,CADH,CADD;AAoBA;;AAED,eAAeV,mBAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { BlockIcon } from '@wordpress/block-editor';\nimport { CheckboxControl } from '@wordpress/components';\n\nfunction BlockTypesChecklist( { blockTypes, value, onItemChange } ) {\n\treturn (\n\t\t<ul className=\"edit-post-block-manager__checklist\">\n\t\t\t{ blockTypes.map( ( blockType ) => (\n\t\t\t\t<li\n\t\t\t\t\tkey={ blockType.name }\n\t\t\t\t\tclassName=\"edit-post-block-manager__checklist-item\"\n\t\t\t\t>\n\t\t\t\t\t<CheckboxControl\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\tlabel={ blockType.title }\n\t\t\t\t\t\tchecked={ value.includes( blockType.name ) }\n\t\t\t\t\t\tonChange={ ( ...args ) =>\n\t\t\t\t\t\t\tonItemChange( blockType.name, ...args )\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t\t<BlockIcon icon={ blockType.icon } />\n\t\t\t\t</li>\n\t\t\t) ) }\n\t\t</ul>\n\t);\n}\n\nexport default BlockTypesChecklist;\n"]}
1
+ {"version":3,"names":["BlockIcon","CheckboxControl","BlockTypesChecklist","blockTypes","value","onItemChange","createElement","className","map","blockType","key","name","__nextHasNoMarginBottom","label","title","checked","includes","onChange","args","icon"],"sources":["@wordpress/edit-post/src/components/block-manager/checklist.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { BlockIcon } from '@wordpress/block-editor';\nimport { CheckboxControl } from '@wordpress/components';\n\nfunction BlockTypesChecklist( { blockTypes, value, onItemChange } ) {\n\treturn (\n\t\t<ul className=\"edit-post-block-manager__checklist\">\n\t\t\t{ blockTypes.map( ( blockType ) => (\n\t\t\t\t<li\n\t\t\t\t\tkey={ blockType.name }\n\t\t\t\t\tclassName=\"edit-post-block-manager__checklist-item\"\n\t\t\t\t>\n\t\t\t\t\t<CheckboxControl\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\tlabel={ blockType.title }\n\t\t\t\t\t\tchecked={ value.includes( blockType.name ) }\n\t\t\t\t\t\tonChange={ ( ...args ) =>\n\t\t\t\t\t\t\tonItemChange( blockType.name, ...args )\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t\t<BlockIcon icon={ blockType.icon } />\n\t\t\t\t</li>\n\t\t\t) ) }\n\t\t</ul>\n\t);\n}\n\nexport default BlockTypesChecklist;\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,SAAS,QAAQ,yBAAyB;AACnD,SAASC,eAAe,QAAQ,uBAAuB;AAEvD,SAASC,mBAAmBA,CAAE;EAAEC,UAAU;EAAEC,KAAK;EAAEC;AAAa,CAAC,EAAG;EACnE,OACCC,aAAA;IAAIC,SAAS,EAAC;EAAoC,GAC/CJ,UAAU,CAACK,GAAG,CAAIC,SAAS,IAC5BH,aAAA;IACCI,GAAG,EAAGD,SAAS,CAACE,IAAM;IACtBJ,SAAS,EAAC;EAAyC,GAEnDD,aAAA,CAACL,eAAe;IACfW,uBAAuB;IACvBC,KAAK,EAAGJ,SAAS,CAACK,KAAO;IACzBC,OAAO,EAAGX,KAAK,CAACY,QAAQ,CAAEP,SAAS,CAACE,IAAK,CAAG;IAC5CM,QAAQ,EAAGA,CAAE,GAAGC,IAAI,KACnBb,YAAY,CAAEI,SAAS,CAACE,IAAI,EAAE,GAAGO,IAAK;EACtC,CACD,CAAC,EACFZ,aAAA,CAACN,SAAS;IAACmB,IAAI,EAAGV,SAAS,CAACU;EAAM,CAAE,CACjC,CACH,CACC,CAAC;AAEP;AAEA,eAAejB,mBAAmB"}
@@ -1,5 +1,4 @@
1
1
  import { createElement } from "@wordpress/element";
2
-
3
2
  /**
4
3
  * WordPress dependencies
5
4
  */
@@ -10,13 +9,12 @@ import { __, _n, sprintf } from '@wordpress/i18n';
10
9
  import { useEffect, useState } from '@wordpress/element';
11
10
  import { useDebounce, compose } from '@wordpress/compose';
12
11
  import { speak } from '@wordpress/a11y';
12
+
13
13
  /**
14
14
  * Internal dependencies
15
15
  */
16
-
17
16
  import BlockManagerCategory from './category';
18
17
  import { store as editPostStore } from '../../store';
19
-
20
18
  function BlockManager({
21
19
  blockTypes,
22
20
  categories,
@@ -26,20 +24,20 @@ function BlockManager({
26
24
  enableAllBlockTypes
27
25
  }) {
28
26
  const debouncedSpeak = useDebounce(speak, 500);
29
- const [search, setSearch] = useState(''); // Filtering occurs here (as opposed to `withSelect`) to avoid
27
+ const [search, setSearch] = useState('');
28
+
29
+ // Filtering occurs here (as opposed to `withSelect`) to avoid
30
30
  // wasted renders by consequence of `Array#filter` producing
31
31
  // a new value reference on each call.
32
+ blockTypes = blockTypes.filter(blockType => hasBlockSupport(blockType, 'inserter', true) && (!search || isMatchingSearchTerm(blockType, search)) && (!blockType.parent || blockType.parent.includes('core/post-content')));
32
33
 
33
- blockTypes = blockTypes.filter(blockType => hasBlockSupport(blockType, 'inserter', true) && (!search || isMatchingSearchTerm(blockType, search)) && (!blockType.parent || blockType.parent.includes('core/post-content'))); // Announce search results on change
34
-
34
+ // Announce search results on change
35
35
  useEffect(() => {
36
36
  if (!search) {
37
37
  return;
38
38
  }
39
-
40
39
  const count = blockTypes.length;
41
- const resultsFoundMessage = sprintf(
42
- /* translators: %d: number of results. */
40
+ const resultsFoundMessage = sprintf( /* translators: %d: number of results. */
43
41
  _n('%d result found.', '%d results found.', count), count);
44
42
  debouncedSpeak(resultsFoundMessage);
45
43
  }, [blockTypes.length, search, debouncedSpeak]);
@@ -47,8 +45,7 @@ function BlockManager({
47
45
  className: "edit-post-block-manager__content"
48
46
  }, !!numberOfHiddenBlocks && createElement("div", {
49
47
  className: "edit-post-block-manager__disabled-blocks-count"
50
- }, sprintf(
51
- /* translators: %d: number of blocks. */
48
+ }, sprintf( /* translators: %d: number of blocks. */
52
49
  _n('%d block is hidden.', '%d blocks are hidden.', numberOfHiddenBlocks), numberOfHiddenBlocks), createElement(Button, {
53
50
  variant: "link",
54
51
  onClick: () => enableAllBlockTypes(blockTypes)
@@ -77,7 +74,6 @@ function BlockManager({
77
74
  }) => !category)
78
75
  })));
79
76
  }
80
-
81
77
  export default compose([withSelect(select => {
82
78
  const {
83
79
  getBlockTypes,
@@ -87,12 +83,13 @@ export default compose([withSelect(select => {
87
83
  } = select(blocksStore);
88
84
  const {
89
85
  getHiddenBlockTypes
90
- } = select(editPostStore); // Some hidden blocks become unregistered
86
+ } = select(editPostStore);
87
+
88
+ // Some hidden blocks become unregistered
91
89
  // by removing for instance the plugin that registered them, yet
92
90
  // they're still remain as hidden by the user's action.
93
91
  // We consider "hidden", blocks which were hidden and
94
92
  // are still registered.
95
-
96
93
  const blockTypes = getBlockTypes();
97
94
  const hiddenBlockTypes = getHiddenBlockTypes().filter(hiddenBlock => {
98
95
  return blockTypes.some(registeredBlock => registeredBlock.name === hiddenBlock);
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-post/src/components/block-manager/index.js"],"names":["store","blocksStore","withSelect","withDispatch","SearchControl","Button","__","_n","sprintf","useEffect","useState","useDebounce","compose","speak","BlockManagerCategory","editPostStore","BlockManager","blockTypes","categories","hasBlockSupport","isMatchingSearchTerm","numberOfHiddenBlocks","enableAllBlockTypes","debouncedSpeak","search","setSearch","filter","blockType","parent","includes","count","length","resultsFoundMessage","nextSearch","map","category","slug","title","select","getBlockTypes","getCategories","getHiddenBlockTypes","hiddenBlockTypes","hiddenBlock","some","registeredBlock","name","Array","isArray","dispatch","showBlockTypes","blockNames"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,KAAK,IAAIC,WAAlB,QAAqC,mBAArC;AACA,SAASC,UAAT,EAAqBC,YAArB,QAAyC,iBAAzC;AACA,SAASC,aAAT,EAAwBC,MAAxB,QAAsC,uBAAtC;AACA,SAASC,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CAAEC,UAAF,CAAd;AACA;AAJK,GAAP;AAMA,CARW,CAlCW,CAAF,CAAP,CA2CVnC,YA3CU,CAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { store as blocksStore } from '@wordpress/blocks';\nimport { withSelect, withDispatch } from '@wordpress/data';\nimport { SearchControl, Button } from '@wordpress/components';\nimport { __, _n, sprintf } from '@wordpress/i18n';\nimport { useEffect, useState } from '@wordpress/element';\nimport { useDebounce, compose } from '@wordpress/compose';\nimport { speak } from '@wordpress/a11y';\n\n/**\n * Internal dependencies\n */\nimport BlockManagerCategory from './category';\nimport { store as editPostStore } from '../../store';\n\nfunction BlockManager( {\n\tblockTypes,\n\tcategories,\n\thasBlockSupport,\n\tisMatchingSearchTerm,\n\tnumberOfHiddenBlocks,\n\tenableAllBlockTypes,\n} ) {\n\tconst debouncedSpeak = useDebounce( speak, 500 );\n\tconst [ search, setSearch ] = useState( '' );\n\n\t// Filtering occurs here (as opposed to `withSelect`) to avoid\n\t// wasted renders by consequence of `Array#filter` producing\n\t// a new value reference on each call.\n\tblockTypes = blockTypes.filter(\n\t\t( blockType ) =>\n\t\t\thasBlockSupport( blockType, 'inserter', true ) &&\n\t\t\t( ! search || isMatchingSearchTerm( blockType, search ) ) &&\n\t\t\t( ! blockType.parent ||\n\t\t\t\tblockType.parent.includes( 'core/post-content' ) )\n\t);\n\n\t// Announce search results on change\n\tuseEffect( () => {\n\t\tif ( ! search ) {\n\t\t\treturn;\n\t\t}\n\t\tconst count = blockTypes.length;\n\t\tconst resultsFoundMessage = sprintf(\n\t\t\t/* translators: %d: number of results. */\n\t\t\t_n( '%d result found.', '%d results found.', count ),\n\t\t\tcount\n\t\t);\n\t\tdebouncedSpeak( resultsFoundMessage );\n\t}, [ blockTypes.length, search, debouncedSpeak ] );\n\n\treturn (\n\t\t<div className=\"edit-post-block-manager__content\">\n\t\t\t{ !! numberOfHiddenBlocks && (\n\t\t\t\t<div className=\"edit-post-block-manager__disabled-blocks-count\">\n\t\t\t\t\t{ sprintf(\n\t\t\t\t\t\t/* translators: %d: number of blocks. */\n\t\t\t\t\t\t_n(\n\t\t\t\t\t\t\t'%d block is hidden.',\n\t\t\t\t\t\t\t'%d blocks are hidden.',\n\t\t\t\t\t\t\tnumberOfHiddenBlocks\n\t\t\t\t\t\t),\n\t\t\t\t\t\tnumberOfHiddenBlocks\n\t\t\t\t\t) }\n\t\t\t\t\t<Button\n\t\t\t\t\t\tvariant=\"link\"\n\t\t\t\t\t\tonClick={ () => enableAllBlockTypes( blockTypes ) }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Reset' ) }\n\t\t\t\t\t</Button>\n\t\t\t\t</div>\n\t\t\t) }\n\t\t\t<SearchControl\n\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\tlabel={ __( 'Search for a block' ) }\n\t\t\t\tplaceholder={ __( 'Search for a block' ) }\n\t\t\t\tvalue={ search }\n\t\t\t\tonChange={ ( nextSearch ) => setSearch( nextSearch ) }\n\t\t\t\tclassName=\"edit-post-block-manager__search\"\n\t\t\t/>\n\t\t\t<div\n\t\t\t\ttabIndex=\"0\"\n\t\t\t\trole=\"region\"\n\t\t\t\taria-label={ __( 'Available block types' ) }\n\t\t\t\tclassName=\"edit-post-block-manager__results\"\n\t\t\t>\n\t\t\t\t{ blockTypes.length === 0 && (\n\t\t\t\t\t<p className=\"edit-post-block-manager__no-results\">\n\t\t\t\t\t\t{ __( 'No blocks found.' ) }\n\t\t\t\t\t</p>\n\t\t\t\t) }\n\t\t\t\t{ categories.map( ( category ) => (\n\t\t\t\t\t<BlockManagerCategory\n\t\t\t\t\t\tkey={ category.slug }\n\t\t\t\t\t\ttitle={ category.title }\n\t\t\t\t\t\tblockTypes={ blockTypes.filter(\n\t\t\t\t\t\t\t( blockType ) =>\n\t\t\t\t\t\t\t\tblockType.category === category.slug\n\t\t\t\t\t\t) }\n\t\t\t\t\t/>\n\t\t\t\t) ) }\n\t\t\t\t<BlockManagerCategory\n\t\t\t\t\ttitle={ __( 'Uncategorized' ) }\n\t\t\t\t\tblockTypes={ blockTypes.filter(\n\t\t\t\t\t\t( { category } ) => ! category\n\t\t\t\t\t) }\n\t\t\t\t/>\n\t\t\t</div>\n\t\t</div>\n\t);\n}\n\nexport default compose( [\n\twithSelect( ( select ) => {\n\t\tconst {\n\t\t\tgetBlockTypes,\n\t\t\tgetCategories,\n\t\t\thasBlockSupport,\n\t\t\tisMatchingSearchTerm,\n\t\t} = select( blocksStore );\n\t\tconst { getHiddenBlockTypes } = select( editPostStore );\n\n\t\t// Some hidden blocks become unregistered\n\t\t// by removing for instance the plugin that registered them, yet\n\t\t// they're still remain as hidden by the user's action.\n\t\t// We consider \"hidden\", blocks which were hidden and\n\t\t// are still registered.\n\t\tconst blockTypes = getBlockTypes();\n\t\tconst hiddenBlockTypes = getHiddenBlockTypes().filter(\n\t\t\t( hiddenBlock ) => {\n\t\t\t\treturn blockTypes.some(\n\t\t\t\t\t( registeredBlock ) => registeredBlock.name === hiddenBlock\n\t\t\t\t);\n\t\t\t}\n\t\t);\n\t\tconst numberOfHiddenBlocks =\n\t\t\tArray.isArray( hiddenBlockTypes ) && hiddenBlockTypes.length;\n\n\t\treturn {\n\t\t\tblockTypes,\n\t\t\tcategories: getCategories(),\n\t\t\thasBlockSupport,\n\t\t\tisMatchingSearchTerm,\n\t\t\tnumberOfHiddenBlocks,\n\t\t};\n\t} ),\n\twithDispatch( ( dispatch ) => {\n\t\tconst { showBlockTypes } = dispatch( editPostStore );\n\t\treturn {\n\t\t\tenableAllBlockTypes: ( blockTypes ) => {\n\t\t\t\tconst blockNames = blockTypes.map( ( { name } ) => name );\n\t\t\t\tshowBlockTypes( blockNames );\n\t\t\t},\n\t\t};\n\t} ),\n] )( BlockManager );\n"]}
1
+ {"version":3,"names":["store","blocksStore","withSelect","withDispatch","SearchControl","Button","__","_n","sprintf","useEffect","useState","useDebounce","compose","speak","BlockManagerCategory","editPostStore","BlockManager","blockTypes","categories","hasBlockSupport","isMatchingSearchTerm","numberOfHiddenBlocks","enableAllBlockTypes","debouncedSpeak","search","setSearch","filter","blockType","parent","includes","count","length","resultsFoundMessage","createElement","className","variant","onClick","__nextHasNoMarginBottom","label","placeholder","value","onChange","nextSearch","tabIndex","role","map","category","key","slug","title","select","getBlockTypes","getCategories","getHiddenBlockTypes","hiddenBlockTypes","hiddenBlock","some","registeredBlock","name","Array","isArray","dispatch","showBlockTypes","blockNames"],"sources":["@wordpress/edit-post/src/components/block-manager/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { store as blocksStore } from '@wordpress/blocks';\nimport { withSelect, withDispatch } from '@wordpress/data';\nimport { SearchControl, Button } from '@wordpress/components';\nimport { __, _n, sprintf } from '@wordpress/i18n';\nimport { useEffect, useState } from '@wordpress/element';\nimport { useDebounce, compose } from '@wordpress/compose';\nimport { speak } from '@wordpress/a11y';\n\n/**\n * Internal dependencies\n */\nimport BlockManagerCategory from './category';\nimport { store as editPostStore } from '../../store';\n\nfunction BlockManager( {\n\tblockTypes,\n\tcategories,\n\thasBlockSupport,\n\tisMatchingSearchTerm,\n\tnumberOfHiddenBlocks,\n\tenableAllBlockTypes,\n} ) {\n\tconst debouncedSpeak = useDebounce( speak, 500 );\n\tconst [ search, setSearch ] = useState( '' );\n\n\t// Filtering occurs here (as opposed to `withSelect`) to avoid\n\t// wasted renders by consequence of `Array#filter` producing\n\t// a new value reference on each call.\n\tblockTypes = blockTypes.filter(\n\t\t( blockType ) =>\n\t\t\thasBlockSupport( blockType, 'inserter', true ) &&\n\t\t\t( ! search || isMatchingSearchTerm( blockType, search ) ) &&\n\t\t\t( ! blockType.parent ||\n\t\t\t\tblockType.parent.includes( 'core/post-content' ) )\n\t);\n\n\t// Announce search results on change\n\tuseEffect( () => {\n\t\tif ( ! search ) {\n\t\t\treturn;\n\t\t}\n\t\tconst count = blockTypes.length;\n\t\tconst resultsFoundMessage = sprintf(\n\t\t\t/* translators: %d: number of results. */\n\t\t\t_n( '%d result found.', '%d results found.', count ),\n\t\t\tcount\n\t\t);\n\t\tdebouncedSpeak( resultsFoundMessage );\n\t}, [ blockTypes.length, search, debouncedSpeak ] );\n\n\treturn (\n\t\t<div className=\"edit-post-block-manager__content\">\n\t\t\t{ !! numberOfHiddenBlocks && (\n\t\t\t\t<div className=\"edit-post-block-manager__disabled-blocks-count\">\n\t\t\t\t\t{ sprintf(\n\t\t\t\t\t\t/* translators: %d: number of blocks. */\n\t\t\t\t\t\t_n(\n\t\t\t\t\t\t\t'%d block is hidden.',\n\t\t\t\t\t\t\t'%d blocks are hidden.',\n\t\t\t\t\t\t\tnumberOfHiddenBlocks\n\t\t\t\t\t\t),\n\t\t\t\t\t\tnumberOfHiddenBlocks\n\t\t\t\t\t) }\n\t\t\t\t\t<Button\n\t\t\t\t\t\tvariant=\"link\"\n\t\t\t\t\t\tonClick={ () => enableAllBlockTypes( blockTypes ) }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Reset' ) }\n\t\t\t\t\t</Button>\n\t\t\t\t</div>\n\t\t\t) }\n\t\t\t<SearchControl\n\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\tlabel={ __( 'Search for a block' ) }\n\t\t\t\tplaceholder={ __( 'Search for a block' ) }\n\t\t\t\tvalue={ search }\n\t\t\t\tonChange={ ( nextSearch ) => setSearch( nextSearch ) }\n\t\t\t\tclassName=\"edit-post-block-manager__search\"\n\t\t\t/>\n\t\t\t<div\n\t\t\t\ttabIndex=\"0\"\n\t\t\t\trole=\"region\"\n\t\t\t\taria-label={ __( 'Available block types' ) }\n\t\t\t\tclassName=\"edit-post-block-manager__results\"\n\t\t\t>\n\t\t\t\t{ blockTypes.length === 0 && (\n\t\t\t\t\t<p className=\"edit-post-block-manager__no-results\">\n\t\t\t\t\t\t{ __( 'No blocks found.' ) }\n\t\t\t\t\t</p>\n\t\t\t\t) }\n\t\t\t\t{ categories.map( ( category ) => (\n\t\t\t\t\t<BlockManagerCategory\n\t\t\t\t\t\tkey={ category.slug }\n\t\t\t\t\t\ttitle={ category.title }\n\t\t\t\t\t\tblockTypes={ blockTypes.filter(\n\t\t\t\t\t\t\t( blockType ) =>\n\t\t\t\t\t\t\t\tblockType.category === category.slug\n\t\t\t\t\t\t) }\n\t\t\t\t\t/>\n\t\t\t\t) ) }\n\t\t\t\t<BlockManagerCategory\n\t\t\t\t\ttitle={ __( 'Uncategorized' ) }\n\t\t\t\t\tblockTypes={ blockTypes.filter(\n\t\t\t\t\t\t( { category } ) => ! category\n\t\t\t\t\t) }\n\t\t\t\t/>\n\t\t\t</div>\n\t\t</div>\n\t);\n}\n\nexport default compose( [\n\twithSelect( ( select ) => {\n\t\tconst {\n\t\t\tgetBlockTypes,\n\t\t\tgetCategories,\n\t\t\thasBlockSupport,\n\t\t\tisMatchingSearchTerm,\n\t\t} = select( blocksStore );\n\t\tconst { getHiddenBlockTypes } = select( editPostStore );\n\n\t\t// Some hidden blocks become unregistered\n\t\t// by removing for instance the plugin that registered them, yet\n\t\t// they're still remain as hidden by the user's action.\n\t\t// We consider \"hidden\", blocks which were hidden and\n\t\t// are still registered.\n\t\tconst blockTypes = getBlockTypes();\n\t\tconst hiddenBlockTypes = getHiddenBlockTypes().filter(\n\t\t\t( hiddenBlock ) => {\n\t\t\t\treturn blockTypes.some(\n\t\t\t\t\t( registeredBlock ) => registeredBlock.name === hiddenBlock\n\t\t\t\t);\n\t\t\t}\n\t\t);\n\t\tconst numberOfHiddenBlocks =\n\t\t\tArray.isArray( hiddenBlockTypes ) && hiddenBlockTypes.length;\n\n\t\treturn {\n\t\t\tblockTypes,\n\t\t\tcategories: getCategories(),\n\t\t\thasBlockSupport,\n\t\t\tisMatchingSearchTerm,\n\t\t\tnumberOfHiddenBlocks,\n\t\t};\n\t} ),\n\twithDispatch( ( dispatch ) => {\n\t\tconst { showBlockTypes } = dispatch( editPostStore );\n\t\treturn {\n\t\t\tenableAllBlockTypes: ( blockTypes ) => {\n\t\t\t\tconst blockNames = blockTypes.map( ( { name } ) => name );\n\t\t\t\tshow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CAAC4B,GAAG,CAAE,CAAE;QAAEa;MAAK,CAAC,KAAMA,IAAK,CAAC;MACzDI,cAAc,CAAEC,UAAW,CAAC;IAC7B;EACD,CAAC;AACF,CAAE,CAAC,CACF,CAAC,CAAE/C,YAAa,CAAC"}
@@ -1,13 +1,12 @@
1
1
  import { createElement } from "@wordpress/element";
2
-
3
2
  /**
4
3
  * WordPress dependencies
5
4
  */
6
5
  import { BlockSettingsMenuControls } from '@wordpress/block-editor';
7
6
  import { MenuItem } from '@wordpress/components';
8
7
  import { compose } from '@wordpress/compose';
9
-
10
8
  const isEverySelectedBlockAllowed = (selected, allowed) => selected.filter(id => !allowed.includes(id)).length === 0;
9
+
11
10
  /**
12
11
  * Plugins may want to add an item to the menu either for every block
13
12
  * or only for the specific ones provided in the `allowedBlocks` component property.
@@ -19,9 +18,8 @@ const isEverySelectedBlockAllowed = (selected, allowed) => selected.filter(id =>
19
18
  * @param {string[]} allowedBlocks Array containing the names of the blocks allowed
20
19
  * @return {boolean} Whether the item will be rendered or not.
21
20
  */
22
-
23
-
24
21
  const shouldRenderItem = (selectedBlocks, allowedBlocks) => !Array.isArray(allowedBlocks) || isEverySelectedBlockAllowed(selectedBlocks, allowedBlocks);
22
+
25
23
  /**
26
24
  * Renders a new item in the block settings menu.
27
25
  *
@@ -77,8 +75,6 @@ const shouldRenderItem = (selectedBlocks, allowedBlocks) => !Array.isArray(allow
77
75
  *
78
76
  * @return {WPComponent} The component to be rendered.
79
77
  */
80
-
81
-
82
78
  const PluginBlockSettingsMenuItem = ({
83
79
  allowedBlocks,
84
80
  icon,
@@ -93,7 +89,6 @@ const PluginBlockSettingsMenuItem = ({
93
89
  if (!shouldRenderItem(selectedBlocks, allowedBlocks)) {
94
90
  return null;
95
91
  }
96
-
97
92
  return createElement(MenuItem, {
98
93
  onClick: compose(onClick, onClose),
99
94
  icon: icon,
@@ -101,6 +96,5 @@ const PluginBlockSettingsMenuItem = ({
101
96
  role: role
102
97
  }, !small && label);
103
98
  });
104
-
105
99
  export default PluginBlockSettingsMenuItem;
106
100
  //# sourceMappingURL=plugin-block-settings-menu-item.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-post/src/components/block-settings-menu/plugin-block-settings-menu-item.js"],"names":["BlockSettingsMenuControls","MenuItem","compose","isEverySelectedBlockAllowed","selected","allowed","filter","id","includes","length","shouldRenderItem","selectedBlocks","allowedBlocks","Array","isArray","PluginBlockSettingsMenuItem","icon","label","onClick","small","role","onClose","undefined"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,yBAAT,QAA0C,yBAA1C;AACA,SAASC,QAAT,QAAyB,uBAAzB;AACA,SAASC,OAAT,QAAwB,oBAAxB;;AAEA,MAAMC,2BAA2B,GAAG,CAAEC,QAAF,EAAYC,OAAZ,KACnCD,QAAQ,CAACE,MAAT,CAAmBC,EAAF,IAAU,CAAEF,OAAO,CAACG,QAAR,CAAkBD,EAAlB,CAA7B,EAAsDE,MAAtD,KAAiE,CADlE;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,MAAMC,gBAAgB,GAAG,CAAEC,cAAF,EAAkBC,aAAlB,KACxB,CAAEC,KAAK,CAACC,OAAN,CAAeF,aAAf,CAAF,IACAT,2BAA2B,CAAEQ,cAAF,EAAkBC,aAAlB,CAF5B;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,MAAMG,2BAA2B,GAAG,CAAE;AACrCH,EAAAA,aADqC;AAErCI,EAAAA,IAFqC;AAGrCC,EAAAA,KAHqC;AAIrCC,EAAAA,OAJqC;AAKrCC,EAAAA,KALqC;AAMrCC,EAAAA;AANqC,CAAF,KAQnC,cAAC,yBAAD,QACG,CAAE;AAAET,EAAAA,cAAF;AAAkBU,EAAAA;AAAlB,CAAF,KAAmC;AACpC,MAAK,CAAEX,gBAAgB,CAAEC,cAAF,EAAkBC,aAAlB,CAAvB,EAA2D;AAC1D,WAAO,IAAP;AACA;;AACD,SACC,cAAC,QAAD;AACC,IAAA,OAAO,EAAGV,OAAO,CAAEgB,OAAF,EAAWG,OAAX,CADlB;AAEC,IAAA,IAAI,EAAGL,IAFR;AAGC,IAAA,KAAK,EAAGG,KAAK,GAAGF,KAAH,GAAWK,SAHzB;AAIC,IAAA,IAAI,EAAGF;AAJR,KAMG,CAAED,KAAF,IAAWF,KANd,CADD;AAUA,CAfF,CARD;;AA2BA,eAAeF,2BAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { BlockSettingsMenuControls } from '@wordpress/block-editor';\nimport { MenuItem } from '@wordpress/components';\nimport { compose } from '@wordpress/compose';\n\nconst isEverySelectedBlockAllowed = ( selected, allowed ) =>\n\tselected.filter( ( id ) => ! allowed.includes( id ) ).length === 0;\n\n/**\n * Plugins may want to add an item to the menu either for every block\n * or only for the specific ones provided in the `allowedBlocks` component property.\n *\n * If there are multiple blocks selected the item will be rendered if every block\n * is of one allowed type (not necessarily the same).\n *\n * @param {string[]} selectedBlocks Array containing the names of the blocks selected\n * @param {string[]} allowedBlocks Array containing the names of the blocks allowed\n * @return {boolean} Whether the item will be rendered or not.\n */\nconst shouldRenderItem = ( selectedBlocks, allowedBlocks ) =>\n\t! Array.isArray( allowedBlocks ) ||\n\tisEverySelectedBlockAllowed( selectedBlocks, allowedBlocks );\n\n/**\n * Renders a new item in the block settings menu.\n *\n * @param {Object} props Component props.\n * @param {Array} [props.allowedBlocks] An array containing a list of block names for which the item should be shown. If not present, it'll be rendered for any block. If multiple blocks are selected, it'll be shown if and only if all of them are in the allowed list.\n * @param {WPBlockTypeIconRender} [props.icon] The [Dashicon](https://developer.wordpress.org/resource/dashicons/) icon slug string, or an SVG WP element.\n * @param {string} props.label The menu item text.\n * @param {Function} props.onClick Callback function to be executed when the user click the menu item.\n * @param {boolean} [props.small] Whether to render the label or not.\n * @param {string} [props.role] The ARIA role for the menu item.\n *\n * @example\n * ```js\n * // Using ES5 syntax\n * var __ = wp.i18n.__;\n * var PluginBlockSettingsMenuItem = wp.editPost.PluginBlockSettingsMenuItem;\n *\n * function doOnClick(){\n * \t// To be called when the user clicks the menu item.\n * }\n *\n * function MyPluginBlockSettingsMenuItem() {\n * \treturn wp.element.createElement(\n * \t\tPluginBlockSettingsMenuItem,\n * \t\t{\n * \t\t\tallowedBlocks: [ 'core/paragraph' ],\n * \t\t\ticon: 'dashicon-name',\n * \t\t\tlabel: __( 'Menu item text' ),\n * \t\t\tonClick: doOnClick,\n * \t\t}\n * \t);\n * }\n * ```\n *\n * @example\n * ```jsx\n * // Using ESNext syntax\n * import { __ } from '@wordpress/i18n';\n * import { PluginBlockSettingsMenuItem } from '@wordpress/edit-post';\n *\n * const doOnClick = ( ) => {\n * // To be called when the user clicks the menu item.\n * };\n *\n * const MyPluginBlockSettingsMenuItem = () => (\n * <PluginBlockSettingsMenuItem\n * \t\tallowedBlocks={ [ 'core/paragraph' ] }\n * \t\ticon='dashicon-name'\n * \t\tlabel={ __( 'Menu item text' ) }\n * \t\tonClick={ doOnClick } />\n * );\n * ```\n *\n * @return {WPComponent} The component to be rendered.\n */\nconst PluginBlockSettingsMenuItem = ( {\n\tallowedBlocks,\n\ticon,\n\tlabel,\n\tonClick,\n\tsmall,\n\trole,\n} ) => (\n\t<BlockSettingsMenuControls>\n\t\t{ ( { selectedBlocks, onClose } ) => {\n\t\t\tif ( ! shouldRenderItem( selectedBlocks, allowedBlocks ) ) {\n\t\t\t\treturn null;\n\t\t\t}\n\t\t\treturn (\n\t\t\t\t<MenuItem\n\t\t\t\t\tonClick={ compose( onClick, onClose ) }\n\t\t\t\t\ticon={ icon }\n\t\t\t\t\tlabel={ small ? label : undefined }\n\t\t\t\t\trole={ role }\n\t\t\t\t>\n\t\t\t\t\t{ ! small && label }\n\t\t\t\t</MenuItem>\n\t\t\t);\n\t\t} }\n\t</BlockSettingsMenuControls>\n);\n\nexport default PluginBlockSettingsMenuItem;\n"]}
1
+ {"version":3,"names":["BlockSettingsMenuControls","MenuItem","compose","isEverySelectedBlockAllowed","selected","allowed","filter","id","includes","length","shouldRenderItem","selectedBlocks","allowedBlocks","Array","isArray","PluginBlockSettingsMenuItem","icon","label","onClick","small","role","createElement","onClose","undefined"],"sources":["@wordpress/edit-post/src/components/block-settings-menu/plugin-block-settings-menu-item.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { BlockSettingsMenuControls } from '@wordpress/block-editor';\nimport { MenuItem } from '@wordpress/components';\nimport { compose } from '@wordpress/compose';\n\nconst isEverySelectedBlockAllowed = ( selected, allowed ) =>\n\tselected.filter( ( id ) => ! allowed.includes( id ) ).length === 0;\n\n/**\n * Plugins may want to add an item to the menu either for every block\n * or only for the specific ones provided in the `allowedBlocks` component property.\n *\n * If there are multiple blocks selected the item will be rendered if every block\n * is of one allowed type (not necessarily the same).\n *\n * @param {string[]} selectedBlocks Array containing the names of the blocks selected\n * @param {string[]} allowedBlocks Array containing the names of the blocks allowed\n * @return {boolean} Whether the item will be rendered or not.\n */\nconst shouldRenderItem = ( selectedBlocks, allowedBlocks ) =>\n\t! Array.isArray( allowedBlocks ) ||\n\tisEverySelectedBlockAllowed( selectedBlocks, allowedBlocks );\n\n/**\n * Renders a new item in the block settings menu.\n *\n * @param {Object} props Component props.\n * @param {Array} [props.allowedBlocks] An array containing a list of block names for which the item should be shown. If not present, it'll be rendered for any block. If multiple blocks are selected, it'll be shown if and only if all of them are in the allowed list.\n * @param {WPBlockTypeIconRender} [props.icon] The [Dashicon](https://developer.wordpress.org/resource/dashicons/) icon slug string, or an SVG WP element.\n * @param {string} props.label The menu item text.\n * @param {Function} props.onClick Callback function to be executed when the user click the menu item.\n * @param {boolean} [props.small] Whether to render the label or not.\n * @param {string} [props.role] The ARIA role for the menu item.\n *\n * @example\n * ```js\n * // Using ES5 syntax\n * var __ = wp.i18n.__;\n * var PluginBlockSettingsMenuItem = wp.editPost.PluginBlockSettingsMenuItem;\n *\n * function doOnClick(){\n * \t// To be called when the user clicks the menu item.\n * }\n *\n * function MyPluginBlockSettingsMenuItem() {\n * \treturn wp.element.createElement(\n * \t\tPluginBlockSettingsMenuItem,\n * \t\t{\n * \t\t\tallowedBlocks: [ 'core/paragraph' ],\n * \t\t\ticon: 'dashicon-name',\n * \t\t\tlabel: __( 'Menu item text' ),\n * \t\t\tonClick: doOnClick,\n * \t\t}\n * \t);\n * }\n * ```\n *\n * @example\n * ```jsx\n * // Using ESNext syntax\n * import { __ } from '@wordpress/i18n';\n * import { PluginBlockSettingsMenuItem } from '@wordpress/edit-post';\n *\n * const doOnClick = ( ) => {\n * // To be called when the user clicks the menu item.\n * };\n *\n * const MyPluginBlockSettingsMenuItem = () => (\n * <PluginBlockSettingsMenuItem\n * \t\tallowedBlocks={ [ 'core/paragraph' ] }\n * \t\ticon='dashicon-name'\n * \t\tlabel={ __( 'Menu item text' ) }\n * \t\tonClick={ doOnClick } />\n * );\n * ```\n *\n * @return {WPComponent} The component to be rendered.\n */\nconst PluginBlockSettingsMenuItem = ( {\n\tallowedBlocks,\n\ticon,\n\tlabel,\n\tonClick,\n\tsmall,\n\trole,\n} ) => (\n\t<BlockSettingsMenuControls>\n\t\t{ ( { selectedBlocks, onClose } ) => {\n\t\t\tif ( ! shouldRenderItem( selectedBlocks, allowedBlocks ) ) {\n\t\t\t\treturn null;\n\t\t\t}\n\t\t\treturn (\n\t\t\t\t<MenuItem\n\t\t\t\t\tonClick={ compose( onClick, onClose ) }\n\t\t\t\t\ticon={ icon }\n\t\t\t\t\tlabel={ small ? label : undefined }\n\t\t\t\t\trole={ role }\n\t\t\t\t>\n\t\t\t\t\t{ ! small && label }\n\t\t\t\t</MenuItem>\n\t\t\t);\n\t\t} }\n\t</BlockSettingsMenuControls>\n);\n\nexport default PluginBlockSettingsMenuItem;\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,yBAAyB,QAAQ,yBAAyB;AACnE,SAASC,QAAQ,QAAQ,uBAAuB;AAChD,SAASC,OAAO,QAAQ,oBAAoB;AAE5C,MAAMC,2BAA2B,GAAGA,CAAEC,QAAQ,EAAEC,OAAO,KACtDD,QAAQ,CAACE,MAAM,CAAIC,EAAE,IAAM,CAAEF,OAAO,CAACG,QAAQ,CAAED,EAAG,CAAE,CAAC,CAACE,MAAM,KAAK,CAAC;;AAEnE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMC,gBAAgB,GAAGA,CAAEC,cAAc,EAAEC,aAAa,KACvD,CAAEC,KAAK,CAACC,OAAO,CAAEF,aAAc,CAAC,IAChCT,2BAA2B,CAAEQ,cAAc,EAAEC,aAAc,CAAC;;AAE7D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMG,2BAA2B,GAAGA,CAAE;EACrCH,aAAa;EACbI,IAAI;EACJC,KAAK;EACLC,OAAO;EACPC,KAAK;EACLC;AACD,CAAC,KACAC,aAAA,CAACrB,yBAAyB,QACvB,CAAE;EAAEW,cAAc;EAAEW;AAAQ,CAAC,KAAM;EACpC,IAAK,CAAEZ,gBAAgB,CAAEC,cAAc,EAAEC,aAAc,CAAC,EAAG;IAC1D,OAAO,IAAI;EACZ;EACA,OACCS,aAAA,CAACpB,QAAQ;IACRiB,OAAO,EAAGhB,OAAO,CAAEgB,OAAO,EAAEI,OAAQ,CAAG;IACvCN,IAAI,EAAGA,IAAM;IACbC,KAAK,EAAGE,KAAK,GAAGF,KAAK,GAAGM,SAAW;IACnCH,IAAI,EAAGA;EAAM,GAEX,CAAED,KAAK,IAAIF,KACJ,CAAC;AAEb,CAC0B,CAC3B;AAED,eAAeF,2BAA2B"}
@@ -5,6 +5,7 @@ import { Component } from '@wordpress/element';
5
5
  import { withSelect } from '@wordpress/data';
6
6
  import { addQueryArgs } from '@wordpress/url';
7
7
  import { store as editorStore } from '@wordpress/editor';
8
+
8
9
  /**
9
10
  * Returns the Post's Edit URL.
10
11
  *
@@ -12,13 +13,13 @@ import { store as editorStore } from '@wordpress/editor';
12
13
  *
13
14
  * @return {string} Post edit URL.
14
15
  */
15
-
16
16
  export function getPostEditURL(postId) {
17
17
  return addQueryArgs('post.php', {
18
18
  post: postId,
19
19
  action: 'edit'
20
20
  });
21
21
  }
22
+
22
23
  /**
23
24
  * Returns the Post's Trashed URL.
24
25
  *
@@ -27,7 +28,6 @@ export function getPostEditURL(postId) {
27
28
  *
28
29
  * @return {string} Post trashed URL.
29
30
  */
30
-
31
31
  export function getPostTrashedURL(postId, postType) {
32
32
  return addQueryArgs('edit.php', {
33
33
  trashed: 1,
@@ -42,7 +42,6 @@ export class BrowserURL extends Component {
42
42
  historyId: null
43
43
  };
44
44
  }
45
-
46
45
  componentDidUpdate(prevProps) {
47
46
  const {
48
47
  postId,
@@ -52,29 +51,29 @@ export class BrowserURL extends Component {
52
51
  } = this.props;
53
52
  const {
54
53
  historyId
55
- } = this.state; // Posts are still dirty while saving so wait for saving to finish
56
- // to avoid the unsaved changes warning when trashing posts.
54
+ } = this.state;
57
55
 
56
+ // Posts are still dirty while saving so wait for saving to finish
57
+ // to avoid the unsaved changes warning when trashing posts.
58
58
  if (postStatus === 'trash' && !isSavingPost) {
59
59
  this.setTrashURL(postId, postType);
60
60
  return;
61
61
  }
62
-
63
62
  if ((postId !== prevProps.postId || postId !== historyId) && postStatus !== 'auto-draft' && postId) {
64
63
  this.setBrowserURL(postId);
65
64
  }
66
65
  }
66
+
67
67
  /**
68
68
  * Navigates the browser to the post trashed URL to show a notice about the trashed post.
69
69
  *
70
70
  * @param {number} postId Post ID.
71
71
  * @param {string} postType Post Type.
72
72
  */
73
-
74
-
75
73
  setTrashURL(postId, postType) {
76
74
  window.location.href = getPostTrashedURL(postId, postType);
77
75
  }
76
+
78
77
  /**
79
78
  * Replaces the browser URL with a post editor link for the given post ID.
80
79
  *
@@ -84,8 +83,6 @@ export class BrowserURL extends Component {
84
83
  *
85
84
  * @param {number} postId Post ID for which to generate post editor URL.
86
85
  */
87
-
88
-
89
86
  setBrowserURL(postId) {
90
87
  window.history.replaceState({
91
88
  id: postId
@@ -94,11 +91,9 @@ export class BrowserURL extends Component {
94
91
  historyId: postId
95
92
  }));
96
93
  }
97
-
98
94
  render() {
99
95
  return null;
100
96
  }
101
-
102
97
  }
103
98
  export default withSelect(select => {
104
99
  const {
@@ -112,11 +107,9 @@ export default withSelect(select => {
112
107
  type
113
108
  } = post;
114
109
  const isTemplate = ['wp_template', 'wp_template_part'].includes(type);
115
-
116
110
  if (isTemplate) {
117
111
  id = post.wp_id;
118
112
  }
119
-
120
113
  return {
121
114
  postId: id,
122
115
  postStatus: status,
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-post/src/components/browser-url/index.js"],"names":["Component","withSelect","addQueryArgs","store","editorStore","getPostEditURL","postId","post","action","getPostTrashedURL","postType","trashed","post_type","ids","BrowserURL","constructor","arguments","state","historyId","componentDidUpdate","prevProps","postStatus","isSavingPost","props","setTrashURL","setBrowserURL","window","location","href","history","replaceState","id","setState","render","select","getCurrentPost","status","type","isTemplate","includes","wp_id"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,SAAT,QAA0B,oBAA1B;AACA,SAASC,UAAT,QAA2B,iBAA3B;AACA,SAASC,YAAT,QAA6B,gBAA7B;AACA,SAASC,KAAK,IAAIC,WAAlB,QAAqC,mBAArC;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAC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ACC,QAAP,CAAgBC,IAAhB,GAAuBnB,iBAAiB,CAAEH,MAAF,EAAUI,QAAV,CAAxC;AACA;AAED;AACD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACCe,EAAAA,aAAa,CAAEnB,MAAF,EAAW;AACvBoB,IAAAA,MAAM,CAACG,OAAP,CAAeC,YAAf,CACC;AAAEC,MAAAA,EAAE,EAAEzB;AAAN,KADD,EAEC,UAAUA,MAFX,EAGCD,cAAc,CAAEC,MAAF,CAHf;AAMA,SAAK0B,QAAL,CAAe,OAAQ;AACtBd,MAAAA,SAAS,EAAEZ;AADW,KAAR,CAAf;AAGA;;AAED2B,EAAAA,MAAM,GAAG;AACR,WAAO,IAAP;AACA;;AA9DwC;AAiE1C,eAAehC,UAAU,CAAIiC,MAAF,IAAc;AACxC,QAAM;AAAEC,IAAAA,cAAF;AAAkBb,IAAAA;AAAlB,MAAmCY,MAAM,CAAE9B,WAAF,CAA/C;AACA,QAAMG,IAAI,GAAG4B,cAAc,EAA3B;AACA,MAAI;AAAEJ,IAAAA,EAAF;AAAMK,IAAAA,MAAN;AAAcC,IAAAA;AAAd,MAAuB9B,IAA3B;AACA,QAAM+B,UAAU,GAAG,CAAE,aAAF,EAAiB,kBAAjB,EAAsCC,QAAtC,CAAgDF,IAAhD,CAAnB;;AACA,MAAKC,UAAL,EAAkB;AACjBP,IAAAA,EAAE,GAAGxB,IAAI,CAACiC,KAAV;AACA;;AAED,SAAO;AACNlC,IAAAA,MAAM,EAAEyB,EADF;AAENV,IAAAA,UAAU,EAAEe,MAFN;AAGN1B,IAAAA,QAAQ,EAAE2B,IAHJ;AAINf,IAAAA,YAAY,EAAEA,YAAY;AAJpB,GAAP;AAMA,CAfwB,CAAV,CAeVR,UAfU,CAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { Component } from '@wordpress/element';\nimport { withSelect } from '@wordpress/data';\nimport { addQueryArgs } from '@wordpress/url';\nimport { store as editorStore } from '@wordpress/editor';\n\n/**\n * Returns the Post's Edit URL.\n *\n * @param {number} postId Post ID.\n *\n * @return {string} Post edit URL.\n */\nexport function getPostEditURL( postId ) {\n\treturn addQueryArgs( 'post.php', { post: postId, action: 'edit' } );\n}\n\n/**\n * Returns the Post's Trashed URL.\n *\n * @param {number} postId Post ID.\n * @param {string} postType Post Type.\n *\n * @return {string} Post trashed URL.\n */\nexport function getPostTrashedURL( postId, postType ) {\n\treturn addQueryArgs( 'edit.php', {\n\t\ttrashed: 1,\n\t\tpost_type: postType,\n\t\tids: postId,\n\t} );\n}\n\nexport class BrowserURL extends Component {\n\tconstructor() {\n\t\tsuper( ...arguments );\n\n\t\tthis.state = {\n\t\t\thistoryId: null,\n\t\t};\n\t}\n\n\tcomponentDidUpdate( prevProps ) {\n\t\tconst { postId, postStatus, postType, isSavingPost } = this.props;\n\t\tconst { historyId } = this.state;\n\n\t\t// Posts are still dirty while saving so wait for saving to finish\n\t\t// to avoid the unsaved changes warning when trashing posts.\n\t\tif ( postStatus === 'trash' && ! isSavingPost ) {\n\t\t\tthis.setTrashURL( postId, postType );\n\t\t\treturn;\n\t\t}\n\n\t\tif (\n\t\t\t( postId !== prevProps.postId || postId !== historyId ) &&\n\t\t\tpostStatus !== 'auto-draft' &&\n\t\t\tpostId\n\t\t) {\n\t\t\tthis.setBrowserURL( postId );\n\t\t}\n\t}\n\n\t/**\n\t * Navigates the browser to the post trashed URL to show a notice about the trashed post.\n\t *\n\t * @param {number} postId Post ID.\n\t * @param {string} postType Post Type.\n\t */\n\tsetTrashURL( postId, postType ) {\n\t\twindow.location.href = getPostTrashedURL( postId, postType );\n\t}\n\n\t/**\n\t * Replaces the browser URL with a post editor link for the given post ID.\n\t *\n\t * Note it is important that, since this function may be called when the\n\t * editor first loads, the result generated `getPostEditURL` matches that\n\t * produced by the server. Otherwise, the URL will change unexpectedly.\n\t *\n\t * @param {number} postId Post ID for which to generate post editor URL.\n\t */\n\tsetBrowserURL( postId ) {\n\t\twindow.history.replaceState(\n\t\t\t{ id: postId },\n\t\t\t'Post ' + postId,\n\t\t\tgetPostEditURL( postId )\n\t\t);\n\n\t\tthis.setState( () => ( {\n\t\t\thistoryId: postId,\n\t\t} ) );\n\t}\n\n\trender() {\n\t\treturn null;\n\t}\n}\n\nexport default withSelect( ( select ) => {\n\tconst { getCurrentPost, isSavingPost } = select( editorStore );\n\tconst post = getCurrentPost();\n\tlet { id, status, type } = post;\n\tconst isTemplate = [ 'wp_template', 'wp_template_part' ].includes( type );\n\tif ( isTemplate ) {\n\t\tid = post.wp_id;\n\t}\n\n\treturn {\n\t\tpostId: id,\n\t\tpostStatus: status,\n\t\tpostType: type,\n\t\tisSavingPost: isSavingPost(),\n\t};\n} )( BrowserURL );\n"]}
1
+ {"version":3,"names":["Component","withSelect","addQueryArgs","store","editorStore","getPostEditURL","postId","post","action","getPostTrashedURL","postType","trashed","post_type","ids","BrowserURL","constructor","arguments","state","historyId","componentDidUpdate","prevProps","postStatus","isSavingPost","props","setTrashURL","setBrowserURL","window","location","href","history","replaceState","id","setState","render","select","getCurrentPost","status","type","isTemplate","includes","wp_id"],"sources":["@wordpress/edit-post/src/components/browser-url/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { Component } from '@wordpress/element';\nimport { withSelect } from '@wordpress/data';\nimport { addQueryArgs } from '@wordpress/url';\nimport { store as editorStore } from '@wordpress/editor';\n\n/**\n * Returns the Post's Edit URL.\n *\n * @param {number} postId Post ID.\n *\n * @return {string} Post edit URL.\n */\nexport function getPostEditURL( postId ) {\n\treturn addQueryArgs( 'post.php', { post: postId, action: 'edit' } );\n}\n\n/**\n * Returns the Post's Trashed URL.\n *\n * @param {number} postId Post ID.\n * @param {string} postType Post Type.\n *\n * @return {string} Post trashed URL.\n */\nexport function getPostTrashedURL( postId, postType ) {\n\treturn addQueryArgs( 'edit.php', {\n\t\ttrashed: 1,\n\t\tpost_type: postType,\n\t\tids: postId,\n\t} );\n}\n\nexport class BrowserURL extends Component {\n\tconstructor() {\n\t\tsuper( ...arguments );\n\n\t\tthis.state = {\n\t\t\thistoryId: null,\n\t\t};\n\t}\n\n\tcomponentDidUpdate( prevProps ) {\n\t\tconst { postId, postStatus, postType, isSavingPost } = this.props;\n\t\tconst { historyId } = this.state;\n\n\t\t// Posts are still dirty while saving so wait for saving to finish\n\t\t// to avoid the unsaved changes warning when trashing posts.\n\t\tif ( postStatus === 'trash' && ! isSavingPost ) {\n\t\t\tthis.setTrashURL( postId, postType );\n\t\t\treturn;\n\t\t}\n\n\t\tif (\n\t\t\t( postId !== prevProps.postId || postId !== historyId ) &&\n\t\t\tpostStatus !== 'auto-draft' &&\n\t\t\tpostId\n\t\t) {\n\t\t\tthis.setBrowserURL( postId );\n\t\t}\n\t}\n\n\t/**\n\t * Navigates the browser to the post trashed URL to show a notice about the trashed post.\n\t *\n\t * @param {number} postId Post ID.\n\t * @param {string} postType Post Type.\n\t */\n\tsetTrashURL( postId, postType ) {\n\t\twindow.location.href = getPostTrashedURL( postId, postType );\n\t}\n\n\t/**\n\t * Replaces the browser URL with a post editor link for the given post ID.\n\t *\n\t * Note it is important that, since this function may be called when the\n\t * editor first loads, the result generated `getPostEditURL` matches that\n\t * produced by the server. Otherwise, the URL will change unexpectedly.\n\t *\n\t * @param {number} postId Post ID for which to generate post editor URL.\n\t */\n\tsetBrowserURL( postId ) {\n\t\twindow.history.replaceState(\n\t\t\t{ id: postId },\n\t\t\t'Post ' + postId,\n\t\t\tgetPostEditURL( postId )\n\t\t);\n\n\t\tthis.setState( () => ( {\n\t\t\thistoryId: postId,\n\t\t} ) );\n\t}\n\n\trender() {\n\t\treturn null;\n\t}\n}\n\nexport default withSelect( ( select ) => {\n\tconst { getCurrentPost, isSavingPost } = select( editorStore );\n\tconst post = getCurrentPost();\n\tlet { id, status, type } = post;\n\tconst isTemplate = [ 'wp_template', 'wp_template_part' ].includes( type );\n\tif ( isTemplate ) {\n\t\tid = post.wp_id;\n\t}\n\n\treturn {\n\t\tpostId: id,\n\t\tpostStatus: status,\n\t\tpost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4 @@
1
1
  import { createElement, Fragment } from "@wordpress/element";
2
-
3
2
  /**
4
3
  * WordPress dependencies
5
4
  */
@@ -10,10 +9,10 @@ import { __ } from '@wordpress/i18n';
10
9
  import { __experimentalPreviewOptions as PreviewOptions } from '@wordpress/block-editor';
11
10
  import { useDispatch, useSelect } from '@wordpress/data';
12
11
  import { store as coreStore } from '@wordpress/core-data';
12
+
13
13
  /**
14
14
  * Internal dependencies
15
15
  */
16
-
17
16
  import { store as editPostStore } from '../../store';
18
17
  export default function DevicePreview() {
19
18
  const {
@@ -23,7 +22,6 @@ export default function DevicePreview() {
23
22
  deviceType
24
23
  } = useSelect(select => {
25
24
  var _postType$viewable;
26
-
27
25
  const {
28
26
  getEditedPostAttribute
29
27
  } = select(editorStore);
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-post/src/components/device-preview/index.js"],"names":["Icon","MenuGroup","PostPreviewButton","store","editorStore","external","__","__experimentalPreviewOptions","PreviewOptions","useDispatch","useSelect","coreStore","editPostStore","DevicePreview","hasActiveMetaboxes","isPostSaveable","isViewable","deviceType","select","getEditedPostAttribute","getPostType","postType","hasMetaBoxes","isEditedPostSaveable","viewable","__experimentalGetPreviewDeviceType","__experimentalSetPreviewDeviceType","setPreviewDeviceType","onClose"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,IAAT,EAAeC,SAAf,QAAgC,uBAAhC;AACA,SAASC,iBAAT,EAA4BC,KAAK,IAAIC,WAArC,QAAwD,mBAAxD;AACA,SAASC,QAAT,QAAyB,kBAAzB;AACA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,4BAA4B,IAAIC,cAAzC,QAA+D,yBAA/D;AACA,SAASC,WAAT,EAAsBC,SAAtB,QAAuC,iBAAvC;AACA,SAASP,KAAK,IAAIQ,SAAlB,QAAmC,sBAAnC;AAEA;AACA;AACA;;AACA,SAASR,KAAK,IAAIS,aAAlB,QAAuC,aAAvC;AAEA,eAAe,SAASC,aAAT,GAAyB;AACvC,Q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cAAC,IAAD;AAAM,MAAA,IAAI,EAAGD;AAAb,MAFD,CALF;AAUC,IAAA,SAAS,EAAGuB;AAVb,IADD,CADD,CATH,CADD;AA8BA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { Icon, MenuGroup } from '@wordpress/components';\nimport { PostPreviewButton, store as editorStore } from '@wordpress/editor';\nimport { external } from '@wordpress/icons';\nimport { __ } from '@wordpress/i18n';\nimport { __experimentalPreviewOptions as PreviewOptions } from '@wordpress/block-editor';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { store as editPostStore } from '../../store';\n\nexport default function DevicePreview() {\n\tconst { hasActiveMetaboxes, isPostSaveable, isViewable, deviceType } =\n\t\tuseSelect( ( select ) => {\n\t\t\tconst { getEditedPostAttribute } = select( editorStore );\n\t\t\tconst { getPostType } = select( coreStore );\n\t\t\tconst postType = getPostType( getEditedPostAttribute( 'type' ) );\n\n\t\t\treturn {\n\t\t\t\thasActiveMetaboxes: select( editPostStore ).hasMetaBoxes(),\n\t\t\t\tisPostSaveable: select( editorStore ).isEditedPostSaveable(),\n\t\t\t\tisViewable: postType?.viewable ?? false,\n\t\t\t\tdeviceType:\n\t\t\t\t\tselect(\n\t\t\t\t\t\teditPostStore\n\t\t\t\t\t).__experimentalGetPreviewDeviceType(),\n\t\t\t};\n\t\t}, [] );\n\tconst { __experimentalSetPreviewDeviceType: setPreviewDeviceType } =\n\t\tuseDispatch( editPostStore );\n\n\treturn (\n\t\t<PreviewOptions\n\t\t\tisEnabled={ isPostSaveable }\n\t\t\tclassName=\"edit-post-post-preview-dropdown\"\n\t\t\tdeviceType={ deviceType }\n\t\t\tsetDeviceType={ setPreviewDeviceType }\n\t\t\tlabel={ __( 'Preview' ) }\n\t\t>\n\t\t\t{ ( { onClose } ) =>\n\t\t\t\tisViewable && (\n\t\t\t\t\t<MenuGroup>\n\t\t\t\t\t\t<div className=\"edit-post-header-preview__grouping-external\">\n\t\t\t\t\t\t\t<PostPreviewButton\n\t\t\t\t\t\t\t\tclassName=\"edit-post-header-preview__button-external\"\n\t\t\t\t\t\t\t\trole=\"menuitem\"\n\t\t\t\t\t\t\t\tforceIsAutosaveable={ hasActiveMetaboxes }\n\t\t\t\t\t\t\t\ttextContent={\n\t\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t\t{ __( 'Preview in new tab' ) }\n\t\t\t\t\t\t\t\t\t\t<Icon icon={ external } />\n\t\t\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tonPreview={ onClose }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</MenuGroup>\n\t\t\t\t)\n\t\t\t}\n\t\t</PreviewOptions>\n\t);\n}\n"]}
1
+ {"version":3,"names":["Icon","MenuGroup","PostPreviewButton","store","editorStore","external","__","__experimentalPreviewOptions","PreviewOptions","useDispatch","useSelect","coreStore","editPostStore","DevicePreview","hasActiveMetaboxes","isPostSaveable","isViewable","deviceType","select","_postType$viewable","getEditedPostAttribute","getPostType","postType","hasMetaBoxes","isEditedPostSaveable","viewable","__experimentalGetPreviewDeviceType","__experimentalSetPreviewDeviceType","setPreviewDeviceType","createElement","isEnabled","className","setDeviceType","label","onClose","role","forceIsAutosaveable","textContent","Fragment","icon","onPreview"],"sources":["@wordpress/edit-post/src/components/device-preview/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { Icon, MenuGroup } from '@wordpress/components';\nimport { PostPreviewButton, store as editorStore } from '@wordpress/editor';\nimport { external } from '@wordpress/icons';\nimport { __ } from '@wordpress/i18n';\nimport { __experimentalPreviewOptions as PreviewOptions } from '@wordpress/block-editor';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { store as editPostStore } from '../../store';\n\nexport default function DevicePreview() {\n\tconst { hasActiveMetaboxes, isPostSaveable, isViewable, deviceType } =\n\t\tuseSelect( ( select ) => {\n\t\t\tconst { getEditedPostAttribute } = select( editorStore );\n\t\t\tconst { getPostType } = select( coreStore );\n\t\t\tconst postType = getPostType( getEditedPostAttribute( 'type' ) );\n\n\t\t\treturn {\n\t\t\t\thasActiveMetaboxes: select( editPostStore ).hasMetaBoxes(),\n\t\t\t\tisPostSaveable: select( editorStore ).isEditedPostSaveable(),\n\t\t\t\tisViewable: postType?.viewable ?? false,\n\t\t\t\tdeviceType:\n\t\t\t\t\tselect(\n\t\t\t\t\t\teditPostStore\n\t\t\t\t\t).__experimentalGetPreviewDeviceType(),\n\t\t\t};\n\t\t}, [] );\n\tconst { __experimentalSetPreviewDeviceType: setPreviewDeviceType } =\n\t\tuseDispatch( editPostStore );\n\n\treturn (\n\t\t<PreviewOptions\n\t\t\tisEnabled={ isPostSaveable }\n\t\t\tclassName=\"edit-post-post-preview-dropdown\"\n\t\t\tdeviceType={ deviceType }\n\t\t\tsetDeviceType={ setPreviewDeviceType }\n\t\t\tlabel={ __( 'Preview' ) }\n\t\t>\n\t\t\t{ ( { onClose } ) =>\n\t\t\t\tisViewable && (\n\t\t\t\t\t<MenuGroup>\n\t\t\t\t\t\t<div className=\"edit-post-header-preview__grouping-external\">\n\t\t\t\t\t\t\t<PostPreviewButton\n\t\t\t\t\t\t\t\tclassName=\"edit-post-header-preview__button-external\"\n\t\t\t\t\t\t\t\trole=\"menuitem\"\n\t\t\t\t\t\t\t\tforceIsAutosaveable={ hasActiveMetaboxes }\n\t\t\t\t\t\t\t\ttextContent={\n\t\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t\t{ __( 'Preview in new tab' ) }\n\t\t\t\t\t\t\t\t\t\t<Icon icon={ external } />\n\t\t\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tonPreview={ onClose }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</MenuGroup>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qB,CAAC,GACjEnB,WAAW,CAAEG,aAAc,CAAC;EAE7B,OACCiB,aAAA,CAACrB,cAAc;IACdsB,SAAS,EAAGf,cAAgB;IAC5BgB,SAAS,EAAC,iCAAiC;IAC3Cd,UAAU,EAAGA,UAAY;IACzBe,aAAa,EAAGJ,oBAAsB;IACtCK,KAAK,EAAG3B,EAAE,CAAE,SAAU;EAAG,GAEvB,CAAE;IAAE4B;EAAQ,CAAC,KACdlB,UAAU,IACTa,aAAA,CAAC5B,SAAS,QACT4B,aAAA;IAAKE,SAAS,EAAC;EAA6C,GAC3DF,aAAA,CAAC3B,iBAAiB;IACjB6B,SAAS,EAAC,2CAA2C;IACrDI,IAAI,EAAC,UAAU;IACfC,mBAAmB,EAAGtB,kBAAoB;IAC1CuB,WAAW,EACVR,aAAA,CAAAS,QAAA,QACGhC,EAAE,CAAE,oBAAqB,CAAC,EAC5BuB,aAAA,CAAC7B,IAAI;MAACuC,IAAI,EAAGlC;IAAU,CAAE,CACxB,CACF;IACDmC,SAAS,EAAGN;EAAS,CACrB,CACG,CACK,CAGE,CAAC;AAEnB"}
@@ -2,6 +2,7 @@
2
2
  * Internal dependencies
3
3
  */
4
4
  import { useBlockSelectionListener, useUpdatePostLinkListener } from './listener-hooks';
5
+
5
6
  /**
6
7
  * Data component used for initializing the editor and re-initializes
7
8
  * when postId changes or on unmount.
@@ -9,7 +10,6 @@ import { useBlockSelectionListener, useUpdatePostLinkListener } from './listener
9
10
  * @param {number} postId The id of the post.
10
11
  * @return {null} This is a data component so does not render any ui.
11
12
  */
12
-
13
13
  export default function EditorInitialization({
14
14
  postId
15
15
  }) {
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-post/src/components/editor-initialization/index.js"],"names":["useBlockSelectionListener","useUpdatePostLinkListener","EditorInitialization","postId"],"mappings":"AAAA;AACA;AACA;AACA,SACCA,yBADD,EAECC,yBAFD,QAGO,kBAHP;AAKA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,eAAe,SAASC,oBAAT,CAA+B;AAAEC,EAAAA;AAAF,CAA/B,EAA4C;AAC1DH,EAAAA,yBAAyB,CAAEG,MAAF,CAAzB;AACAF,EAAAA,yBAAyB,CAAEE,MAAF,CAAzB;AACA,SAAO,IAAP;AACA","sourcesContent":["/**\n * Internal dependencies\n */\nimport {\n\tuseBlockSelectionListener,\n\tuseUpdatePostLinkListener,\n} from './listener-hooks';\n\n/**\n * Data component used for initializing the editor and re-initializes\n * when postId changes or on unmount.\n *\n * @param {number} postId The id of the post.\n * @return {null} This is a data component so does not render any ui.\n */\nexport default function EditorInitialization( { postId } ) {\n\tuseBlockSelectionListener( postId );\n\tuseUpdatePostLinkListener( postId );\n\treturn null;\n}\n"]}
1
+ {"version":3,"names":["useBlockSelectionListener","useUpdatePostLinkListener","EditorInitialization","postId"],"sources":["@wordpress/edit-post/src/components/editor-initialization/index.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport {\n\tuseBlockSelectionListener,\n\tuseUpdatePostLinkListener,\n} from './listener-hooks';\n\n/**\n * Data component used for initializing the editor and re-initializes\n * when postId changes or on unmount.\n *\n * @param {number} postId The id of the post.\n * @return {null} This is a data component so does not render any ui.\n */\nexport default function EditorInitialization( { postId } ) {\n\tuseBlockSelectionListener( postId );\n\tuseUpdatePostLinkListener( postId );\n\treturn null;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SACCA,yBAAyB,EACzBC,yBAAyB,QACnB,kBAAkB;;AAEzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,SAASC,oBAAoBA,CAAE;EAAEC;AAAO,CAAC,EAAG;EAC1DH,yBAAyB,CAAEG,MAAO,CAAC;EACnCF,yBAAyB,CAAEE,MAAO,CAAC;EACnC,OAAO,IAAI;AACZ"}
@@ -5,18 +5,18 @@ import { useSelect, useDispatch } from '@wordpress/data';
5
5
  import { useEffect, useRef } from '@wordpress/element';
6
6
  import { store as blockEditorStore } from '@wordpress/block-editor';
7
7
  import { store as editorStore } from '@wordpress/editor';
8
+
8
9
  /**
9
10
  * Internal dependencies
10
11
  */
11
-
12
12
  import { STORE_NAME, VIEW_AS_LINK_SELECTOR, VIEW_AS_PREVIEW_LINK_SELECTOR } from '../../store/constants';
13
+
13
14
  /**
14
15
  * This listener hook monitors for block selection and triggers the appropriate
15
16
  * sidebar state.
16
17
  *
17
18
  * @param {number} postId The current post id.
18
19
  */
19
-
20
20
  export const useBlockSelectionListener = postId => {
21
21
  const {
22
22
  hasBlockSelection,
@@ -32,7 +32,6 @@ export const useBlockSelectionListener = postId => {
32
32
  if (!isEditorSidebarOpened) {
33
33
  return;
34
34
  }
35
-
36
35
  if (hasBlockSelection) {
37
36
  openGeneralSidebar('edit-post/block');
38
37
  } else {
@@ -40,13 +39,13 @@ export const useBlockSelectionListener = postId => {
40
39
  }
41
40
  }, [hasBlockSelection, isEditorSidebarOpened]);
42
41
  };
42
+
43
43
  /**
44
44
  * This listener hook monitors any change in permalink and updates the view
45
45
  * post link in the admin bar.
46
46
  *
47
47
  * @param {number} postId
48
48
  */
49
-
50
49
  export const useUpdatePostLinkListener = postId => {
51
50
  const {
52
51
  newPermalink
@@ -61,7 +60,6 @@ export const useUpdatePostLinkListener = postId => {
61
60
  if (!newPermalink || !nodeToUpdate.current) {
62
61
  return;
63
62
  }
64
-
65
63
  nodeToUpdate.current.setAttribute('href', newPermalink);
66
64
  }, [newPermalink]);
67
65
  };