@wordpress/edit-post 7.32.0 → 7.34.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (302) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/README.md +17 -223
  3. package/build/components/browser-url/index.js.map +1 -1
  4. package/build/components/editor-initialization/index.js +0 -1
  5. package/build/components/editor-initialization/index.js.map +1 -1
  6. package/build/components/editor-initialization/listener-hooks.js +1 -38
  7. package/build/components/editor-initialization/listener-hooks.js.map +1 -1
  8. package/build/components/header/fullscreen-mode-close/index.js.map +1 -1
  9. package/build/components/header/header-toolbar/index.native.js.map +1 -1
  10. package/build/components/header/index.js +20 -51
  11. package/build/components/header/index.js.map +1 -1
  12. package/build/components/header/index.native.js +1 -1
  13. package/build/components/header/index.native.js.map +1 -1
  14. package/build/components/header/main-dashboard-button/index.js.map +1 -1
  15. package/build/components/header/more-menu/index.js +17 -42
  16. package/build/components/header/more-menu/index.js.map +1 -1
  17. package/build/components/header/more-menu/manage-patterns-menu-item.js +40 -0
  18. package/build/components/header/more-menu/manage-patterns-menu-item.js.map +1 -0
  19. package/build/{plugins/welcome-guide-menu-item/index.js → components/header/more-menu/welcome-guide-menu-item.js} +1 -1
  20. package/build/components/header/more-menu/welcome-guide-menu-item.js.map +1 -0
  21. package/build/components/init-pattern-modal/index.js.map +1 -1
  22. package/build/components/keyboard-shortcuts/index.js +0 -123
  23. package/build/components/keyboard-shortcuts/index.js.map +1 -1
  24. package/build/components/layout/index.js +28 -29
  25. package/build/components/layout/index.js.map +1 -1
  26. package/build/components/layout/index.native.js.map +1 -1
  27. package/build/components/meta-boxes/index.js.map +1 -1
  28. package/build/components/meta-boxes/meta-box-visibility.js.map +1 -1
  29. package/build/components/meta-boxes/meta-boxes-area/index.js.map +1 -1
  30. package/build/components/preferences-modal/enable-custom-fields.js.map +1 -1
  31. package/build/components/preferences-modal/enable-panel.js.map +1 -1
  32. package/build/components/preferences-modal/index.js +3 -32
  33. package/build/components/preferences-modal/index.js.map +1 -1
  34. package/build/components/preferences-modal/meta-boxes-section.js.map +1 -1
  35. package/build/components/sidebar/post-format/index.js.map +1 -1
  36. package/build/components/sidebar/post-pending-status/index.js.map +1 -1
  37. package/build/components/sidebar/post-slug/index.js.map +1 -1
  38. package/build/components/sidebar/post-status/index.js +35 -12
  39. package/build/components/sidebar/post-status/index.js.map +1 -1
  40. package/build/components/sidebar/post-sticky/index.js.map +1 -1
  41. package/build/components/sidebar/post-trash/index.js.map +1 -1
  42. package/build/components/sidebar/post-visibility/index.js.map +1 -1
  43. package/build/components/sidebar/settings-header/index.js.map +1 -1
  44. package/build/components/sidebar/settings-sidebar/index.js +68 -41
  45. package/build/components/sidebar/settings-sidebar/index.js.map +1 -1
  46. package/build/components/text-editor/index.js.map +1 -1
  47. package/build/components/visual-editor/block-inspector-button.js +1 -1
  48. package/build/components/visual-editor/block-inspector-button.js.map +1 -1
  49. package/build/components/visual-editor/header.native.js.map +1 -1
  50. package/build/components/visual-editor/index.js +4 -1
  51. package/build/components/visual-editor/index.js.map +1 -1
  52. package/build/components/visual-editor/index.native.js.map +1 -1
  53. package/build/components/visual-editor/use-padding-appender.js +62 -0
  54. package/build/components/visual-editor/use-padding-appender.js.map +1 -0
  55. package/build/components/welcome-guide/default.js.map +1 -1
  56. package/build/components/welcome-guide/image.js.map +1 -1
  57. package/build/components/welcome-guide/index.js.map +1 -1
  58. package/build/components/welcome-guide/template.js.map +1 -1
  59. package/build/deprecated.js +132 -0
  60. package/build/deprecated.js.map +1 -0
  61. package/build/editor.js +2 -2
  62. package/build/editor.js.map +1 -1
  63. package/build/editor.native.js.map +1 -1
  64. package/build/hooks/commands/use-common-commands.js +5 -22
  65. package/build/hooks/commands/use-common-commands.js.map +1 -1
  66. package/build/hooks/components/index.js.map +1 -1
  67. package/build/hooks/index.js.map +1 -1
  68. package/build/hooks/use-navigate-to-entity-record.js.map +1 -1
  69. package/build/hooks/validate-multiple-use/index.js.map +1 -1
  70. package/build/index.js +19 -62
  71. package/build/index.js.map +1 -1
  72. package/build/index.native.js.map +1 -1
  73. package/build/lock-unlock.js.map +1 -1
  74. package/build/store/actions.js +10 -8
  75. package/build/store/actions.js.map +1 -1
  76. package/build/store/constants.js.map +1 -1
  77. package/build/store/index.js +1 -1
  78. package/build/store/index.js.map +1 -1
  79. package/build/store/reducer.js.map +1 -1
  80. package/build/store/selectors.js +34 -19
  81. package/build/store/selectors.js.map +1 -1
  82. package/build/utils/meta-boxes.js.map +1 -1
  83. package/build-module/components/browser-url/index.js.map +1 -1
  84. package/build-module/components/editor-initialization/index.js +1 -2
  85. package/build-module/components/editor-initialization/index.js.map +1 -1
  86. package/build-module/components/editor-initialization/listener-hooks.js +2 -38
  87. package/build-module/components/editor-initialization/listener-hooks.js.map +1 -1
  88. package/build-module/components/header/fullscreen-mode-close/index.js.map +1 -1
  89. package/build-module/components/header/header-toolbar/index.native.js.map +1 -1
  90. package/build-module/components/header/index.js +22 -53
  91. package/build-module/components/header/index.js.map +1 -1
  92. package/build-module/components/header/index.native.js +1 -1
  93. package/build-module/components/header/index.native.js.map +1 -1
  94. package/build-module/components/header/main-dashboard-button/index.js.map +1 -1
  95. package/build-module/components/header/more-menu/index.js +17 -42
  96. package/build-module/components/header/more-menu/index.js.map +1 -1
  97. package/build-module/components/header/more-menu/manage-patterns-menu-item.js +33 -0
  98. package/build-module/components/header/more-menu/manage-patterns-menu-item.js.map +1 -0
  99. package/build-module/{plugins/welcome-guide-menu-item/index.js → components/header/more-menu/welcome-guide-menu-item.js} +1 -1
  100. package/build-module/components/header/more-menu/welcome-guide-menu-item.js.map +1 -0
  101. package/build-module/components/init-pattern-modal/index.js.map +1 -1
  102. package/build-module/components/keyboard-shortcuts/index.js +1 -124
  103. package/build-module/components/keyboard-shortcuts/index.js.map +1 -1
  104. package/build-module/components/layout/index.js +28 -29
  105. package/build-module/components/layout/index.js.map +1 -1
  106. package/build-module/components/layout/index.native.js.map +1 -1
  107. package/build-module/components/meta-boxes/index.js.map +1 -1
  108. package/build-module/components/meta-boxes/meta-box-visibility.js.map +1 -1
  109. package/build-module/components/meta-boxes/meta-boxes-area/index.js.map +1 -1
  110. package/build-module/components/preferences-modal/enable-custom-fields.js.map +1 -1
  111. package/build-module/components/preferences-modal/enable-panel.js.map +1 -1
  112. package/build-module/components/preferences-modal/index.js +4 -32
  113. package/build-module/components/preferences-modal/index.js.map +1 -1
  114. package/build-module/components/preferences-modal/meta-boxes-section.js.map +1 -1
  115. package/build-module/components/sidebar/post-format/index.js.map +1 -1
  116. package/build-module/components/sidebar/post-pending-status/index.js.map +1 -1
  117. package/build-module/components/sidebar/post-slug/index.js.map +1 -1
  118. package/build-module/components/sidebar/post-status/index.js +36 -14
  119. package/build-module/components/sidebar/post-status/index.js.map +1 -1
  120. package/build-module/components/sidebar/post-sticky/index.js.map +1 -1
  121. package/build-module/components/sidebar/post-trash/index.js.map +1 -1
  122. package/build-module/components/sidebar/post-visibility/index.js.map +1 -1
  123. package/build-module/components/sidebar/settings-header/index.js.map +1 -1
  124. package/build-module/components/sidebar/settings-sidebar/index.js +71 -44
  125. package/build-module/components/sidebar/settings-sidebar/index.js.map +1 -1
  126. package/build-module/components/text-editor/index.js.map +1 -1
  127. package/build-module/components/visual-editor/block-inspector-button.js +1 -1
  128. package/build-module/components/visual-editor/block-inspector-button.js.map +1 -1
  129. package/build-module/components/visual-editor/header.native.js.map +1 -1
  130. package/build-module/components/visual-editor/index.js +4 -1
  131. package/build-module/components/visual-editor/index.js.map +1 -1
  132. package/build-module/components/visual-editor/index.native.js.map +1 -1
  133. package/build-module/components/visual-editor/use-padding-appender.js +55 -0
  134. package/build-module/components/visual-editor/use-padding-appender.js.map +1 -0
  135. package/build-module/components/welcome-guide/default.js.map +1 -1
  136. package/build-module/components/welcome-guide/image.js.map +1 -1
  137. package/build-module/components/welcome-guide/index.js.map +1 -1
  138. package/build-module/components/welcome-guide/template.js.map +1 -1
  139. package/build-module/deprecated.js +116 -0
  140. package/build-module/deprecated.js.map +1 -0
  141. package/build-module/editor.js +2 -2
  142. package/build-module/editor.js.map +1 -1
  143. package/build-module/editor.native.js.map +1 -1
  144. package/build-module/hooks/commands/use-common-commands.js +7 -24
  145. package/build-module/hooks/commands/use-common-commands.js.map +1 -1
  146. package/build-module/hooks/components/index.js.map +1 -1
  147. package/build-module/hooks/index.js.map +1 -1
  148. package/build-module/hooks/use-navigate-to-entity-record.js.map +1 -1
  149. package/build-module/hooks/validate-multiple-use/index.js.map +1 -1
  150. package/build-module/index.js +2 -15
  151. package/build-module/index.js.map +1 -1
  152. package/build-module/index.native.js.map +1 -1
  153. package/build-module/lock-unlock.js.map +1 -1
  154. package/build-module/store/actions.js +8 -7
  155. package/build-module/store/actions.js.map +1 -1
  156. package/build-module/store/constants.js.map +1 -1
  157. package/build-module/store/index.js.map +1 -1
  158. package/build-module/store/reducer.js.map +1 -1
  159. package/build-module/store/selectors.js +33 -18
  160. package/build-module/store/selectors.js.map +1 -1
  161. package/build-module/utils/meta-boxes.js.map +1 -1
  162. package/build-style/classic-rtl.css +2 -2
  163. package/build-style/classic.css +2 -2
  164. package/build-style/style-rtl.css +18 -589
  165. package/build-style/style.css +18 -589
  166. package/package.json +32 -34
  167. package/src/classic.scss +1 -1
  168. package/src/components/editor-initialization/index.js +1 -5
  169. package/src/components/editor-initialization/listener-hooks.js +1 -40
  170. package/src/components/editor-initialization/test/listener-hooks.js +1 -96
  171. package/src/components/header/index.js +25 -71
  172. package/src/components/header/index.native.js +1 -1
  173. package/src/components/header/more-menu/index.js +27 -43
  174. package/src/components/header/more-menu/manage-patterns-menu-item.js +33 -0
  175. package/src/components/header/style.scss +5 -82
  176. package/src/components/keyboard-shortcuts/index.js +2 -148
  177. package/src/components/layout/index.js +26 -47
  178. package/src/components/layout/style.scss +7 -80
  179. package/src/components/preferences-modal/index.js +3 -46
  180. package/src/components/sidebar/post-status/index.js +61 -24
  181. package/src/components/sidebar/settings-sidebar/index.js +113 -73
  182. package/src/components/visual-editor/block-inspector-button.js +1 -1
  183. package/src/components/visual-editor/index.js +4 -0
  184. package/src/components/visual-editor/use-padding-appender.js +66 -0
  185. package/src/deprecated.js +107 -0
  186. package/src/editor.js +2 -2
  187. package/src/hooks/commands/use-common-commands.js +11 -26
  188. package/src/index.js +3 -20
  189. package/src/store/actions.js +10 -12
  190. package/src/store/selectors.js +41 -33
  191. package/src/store/test/actions.js +11 -10
  192. package/src/style.scss +1 -19
  193. package/build/components/header/plugin-more-menu-item/index.js +0 -78
  194. package/build/components/header/plugin-more-menu-item/index.js.map +0 -1
  195. package/build/components/header/plugin-sidebar-more-menu-item/index.js +0 -71
  196. package/build/components/header/plugin-sidebar-more-menu-item/index.js.map +0 -1
  197. package/build/components/header/post-publish-button-or-toggle.js +0 -91
  198. package/build/components/header/post-publish-button-or-toggle.js.map +0 -1
  199. package/build/components/header/preferences-menu-item/index.js +0 -31
  200. package/build/components/header/preferences-menu-item/index.js.map +0 -1
  201. package/build/components/header/tools-more-menu-group/index.js +0 -26
  202. package/build/components/header/tools-more-menu-group/index.js.map +0 -1
  203. package/build/components/header/writing-menu/index.js +0 -71
  204. package/build/components/header/writing-menu/index.js.map +0 -1
  205. package/build/components/keyboard-shortcut-help-modal/config.js +0 -78
  206. package/build/components/keyboard-shortcut-help-modal/config.js.map +0 -1
  207. package/build/components/keyboard-shortcut-help-modal/dynamic-shortcut.js +0 -49
  208. package/build/components/keyboard-shortcut-help-modal/dynamic-shortcut.js.map +0 -1
  209. package/build/components/keyboard-shortcut-help-modal/index.js +0 -132
  210. package/build/components/keyboard-shortcut-help-modal/index.js.map +0 -1
  211. package/build/components/keyboard-shortcut-help-modal/shortcut.js +0 -55
  212. package/build/components/keyboard-shortcut-help-modal/shortcut.js.map +0 -1
  213. package/build/components/layout/actions-panel.js +0 -86
  214. package/build/components/layout/actions-panel.js.map +0 -1
  215. package/build/components/preferences-modal/enable-publish-sidebar.js +0 -38
  216. package/build/components/preferences-modal/enable-publish-sidebar.js.map +0 -1
  217. package/build/components/sidebar/plugin-post-publish-panel/index.js +0 -39
  218. package/build/components/sidebar/plugin-post-publish-panel/index.js.map +0 -1
  219. package/build/components/sidebar/plugin-post-status-info/index.js +0 -73
  220. package/build/components/sidebar/plugin-post-status-info/index.js.map +0 -1
  221. package/build/components/sidebar/plugin-pre-publish-panel/index.js +0 -43
  222. package/build/components/sidebar/plugin-pre-publish-panel/index.js.map +0 -1
  223. package/build/components/sidebar/plugin-sidebar/index.js +0 -104
  224. package/build/components/sidebar/plugin-sidebar/index.js.map +0 -1
  225. package/build/components/start-page-options/index.js +0 -107
  226. package/build/components/start-page-options/index.js.map +0 -1
  227. package/build/plugins/copy-content-menu-item/index.js +0 -39
  228. package/build/plugins/copy-content-menu-item/index.js.map +0 -1
  229. package/build/plugins/index.js +0 -69
  230. package/build/plugins/index.js.map +0 -1
  231. package/build/plugins/keyboard-shortcuts-help-menu-item/index.js +0 -41
  232. package/build/plugins/keyboard-shortcuts-help-menu-item/index.js.map +0 -1
  233. package/build/plugins/welcome-guide-menu-item/index.js.map +0 -1
  234. package/build-module/components/header/plugin-more-menu-item/index.js +0 -73
  235. package/build-module/components/header/plugin-more-menu-item/index.js.map +0 -1
  236. package/build-module/components/header/plugin-sidebar-more-menu-item/index.js +0 -65
  237. package/build-module/components/header/plugin-sidebar-more-menu-item/index.js.map +0 -1
  238. package/build-module/components/header/post-publish-button-or-toggle.js +0 -83
  239. package/build-module/components/header/post-publish-button-or-toggle.js.map +0 -1
  240. package/build-module/components/header/preferences-menu-item/index.js +0 -24
  241. package/build-module/components/header/preferences-menu-item/index.js.map +0 -1
  242. package/build-module/components/header/tools-more-menu-group/index.js +0 -19
  243. package/build-module/components/header/tools-more-menu-group/index.js.map +0 -1
  244. package/build-module/components/header/writing-menu/index.js +0 -64
  245. package/build-module/components/header/writing-menu/index.js.map +0 -1
  246. package/build-module/components/keyboard-shortcut-help-modal/config.js +0 -71
  247. package/build-module/components/keyboard-shortcut-help-modal/config.js.map +0 -1
  248. package/build-module/components/keyboard-shortcut-help-modal/dynamic-shortcut.js +0 -41
  249. package/build-module/components/keyboard-shortcut-help-modal/dynamic-shortcut.js.map +0 -1
  250. package/build-module/components/keyboard-shortcut-help-modal/index.js +0 -122
  251. package/build-module/components/keyboard-shortcut-help-modal/index.js.map +0 -1
  252. package/build-module/components/keyboard-shortcut-help-modal/shortcut.js +0 -48
  253. package/build-module/components/keyboard-shortcut-help-modal/shortcut.js.map +0 -1
  254. package/build-module/components/layout/actions-panel.js +0 -78
  255. package/build-module/components/layout/actions-panel.js.map +0 -1
  256. package/build-module/components/preferences-modal/enable-publish-sidebar.js +0 -31
  257. package/build-module/components/preferences-modal/enable-publish-sidebar.js.map +0 -1
  258. package/build-module/components/sidebar/plugin-post-publish-panel/index.js +0 -32
  259. package/build-module/components/sidebar/plugin-post-publish-panel/index.js.map +0 -1
  260. package/build-module/components/sidebar/plugin-post-status-info/index.js +0 -66
  261. package/build-module/components/sidebar/plugin-post-status-info/index.js.map +0 -1
  262. package/build-module/components/sidebar/plugin-pre-publish-panel/index.js +0 -36
  263. package/build-module/components/sidebar/plugin-pre-publish-panel/index.js.map +0 -1
  264. package/build-module/components/sidebar/plugin-sidebar/index.js +0 -98
  265. package/build-module/components/sidebar/plugin-sidebar/index.js.map +0 -1
  266. package/build-module/components/start-page-options/index.js +0 -100
  267. package/build-module/components/start-page-options/index.js.map +0 -1
  268. package/build-module/plugins/copy-content-menu-item/index.js +0 -32
  269. package/build-module/plugins/copy-content-menu-item/index.js.map +0 -1
  270. package/build-module/plugins/index.js +0 -65
  271. package/build-module/plugins/index.js.map +0 -1
  272. package/build-module/plugins/keyboard-shortcuts-help-menu-item/index.js +0 -33
  273. package/build-module/plugins/keyboard-shortcuts-help-menu-item/index.js.map +0 -1
  274. package/build-module/plugins/welcome-guide-menu-item/index.js.map +0 -1
  275. package/src/components/header/plugin-more-menu-item/index.js +0 -73
  276. package/src/components/header/plugin-sidebar-more-menu-item/index.js +0 -64
  277. package/src/components/header/post-publish-button-or-toggle.js +0 -92
  278. package/src/components/header/preferences-menu-item/index.js +0 -25
  279. package/src/components/header/test/index.js +0 -51
  280. package/src/components/header/tools-more-menu-group/index.js +0 -20
  281. package/src/components/header/writing-menu/index.js +0 -73
  282. package/src/components/keyboard-shortcut-help-modal/config.js +0 -53
  283. package/src/components/keyboard-shortcut-help-modal/dynamic-shortcut.js +0 -43
  284. package/src/components/keyboard-shortcut-help-modal/index.js +0 -163
  285. package/src/components/keyboard-shortcut-help-modal/shortcut.js +0 -67
  286. package/src/components/keyboard-shortcut-help-modal/style.scss +0 -61
  287. package/src/components/keyboard-shortcut-help-modal/test/index.js +0 -36
  288. package/src/components/layout/actions-panel.js +0 -103
  289. package/src/components/preferences-modal/enable-publish-sidebar.js +0 -32
  290. package/src/components/preferences-modal/test/index.js +0 -28
  291. package/src/components/sidebar/plugin-post-publish-panel/index.js +0 -28
  292. package/src/components/sidebar/plugin-post-status-info/index.js +0 -63
  293. package/src/components/sidebar/plugin-post-status-info/test/__snapshots__/index.js.snap +0 -11
  294. package/src/components/sidebar/plugin-post-status-info/test/index.js +0 -29
  295. package/src/components/sidebar/plugin-pre-publish-panel/index.js +0 -32
  296. package/src/components/sidebar/plugin-sidebar/index.js +0 -94
  297. package/src/components/start-page-options/index.js +0 -108
  298. package/src/components/start-page-options/style.scss +0 -26
  299. package/src/plugins/copy-content-menu-item/index.js +0 -29
  300. package/src/plugins/index.js +0 -85
  301. package/src/plugins/keyboard-shortcuts-help-menu-item/index.js +0 -34
  302. /package/src/{plugins/welcome-guide-menu-item/index.js → components/header/more-menu/welcome-guide-menu-item.js} +0 -0
@@ -7,19 +7,14 @@ Object.defineProperty(exports, "__esModule", {
7
7
  exports.default = void 0;
8
8
  var _react = require("react");
9
9
  var _classnames = _interopRequireDefault(require("classnames"));
10
- var _blockEditor = require("@wordpress/block-editor");
11
10
  var _editor = require("@wordpress/editor");
12
- var _element = require("@wordpress/element");
13
11
  var _data = require("@wordpress/data");
14
- var _i18n = require("@wordpress/i18n");
15
- var _icons = require("@wordpress/icons");
16
- var _interface = require("@wordpress/interface");
17
12
  var _compose = require("@wordpress/compose");
18
13
  var _components = require("@wordpress/components");
19
14
  var _preferences = require("@wordpress/preferences");
15
+ var _element = require("@wordpress/element");
20
16
  var _fullscreenModeClose = _interopRequireDefault(require("./fullscreen-mode-close"));
21
17
  var _moreMenu = _interopRequireDefault(require("./more-menu"));
22
- var _postPublishButtonOrToggle = _interopRequireDefault(require("./post-publish-button-or-toggle"));
23
18
  var _mainDashboardButton = _interopRequireDefault(require("./main-dashboard-button"));
24
19
  var _store = require("../../store");
25
20
  var _lockUnlock = require("../../lock-unlock");
@@ -36,12 +31,13 @@ var _lockUnlock = require("../../lock-unlock");
36
31
  */
37
32
 
38
33
  const {
39
- useShowBlockTools
40
- } = (0, _lockUnlock.unlock)(_blockEditor.privateApis);
41
- const {
34
+ CollapsableBlockToolbar,
42
35
  DocumentTools,
43
36
  PostViewLink,
44
- PreviewDropdown
37
+ PreviewDropdown,
38
+ PinnedItems,
39
+ MoreMenu,
40
+ PostPublishButtonOrToggle
45
41
  } = (0, _lockUnlock.unlock)(_editor.privateApis);
46
42
  const slideY = {
47
43
  hidden: {
@@ -79,14 +75,13 @@ function Header({
79
75
  }) {
80
76
  const isWideViewport = (0, _compose.useViewportMatch)('large');
81
77
  const isLargeViewport = (0, _compose.useViewportMatch)('medium');
82
- const blockToolbarRef = (0, _element.useRef)();
83
78
  const {
84
79
  isTextEditor,
85
- blockSelectionStart,
86
80
  hasActiveMetaboxes,
87
81
  isPublishSidebarOpened,
88
82
  showIconLabels,
89
- hasHistory
83
+ hasHistory,
84
+ hasFixedToolbar
90
85
  } = (0, _data.useSelect)(select => {
91
86
  const {
92
87
  get: getPreference
@@ -96,25 +91,15 @@ function Header({
96
91
  } = select(_editor.store);
97
92
  return {
98
93
  isTextEditor: getEditorMode() === 'text',
99
- blockSelectionStart: select(_blockEditor.store).getBlockSelectionStart(),
100
94
  hasActiveMetaboxes: select(_store.store).hasMetaBoxes(),
101
95
  hasHistory: !!select(_editor.store).getEditorSettings().onNavigateToPreviousEntityRecord,
102
96
  isPublishSidebarOpened: select(_editor.store).isPublishSidebarOpened(),
103
- showIconLabels: getPreference('core', 'showIconLabels')
97
+ showIconLabels: getPreference('core', 'showIconLabels'),
98
+ hasFixedToolbar: getPreference('core', 'fixedToolbar')
104
99
  };
105
100
  }, []);
106
- const {
107
- showFixedToolbar
108
- } = useShowBlockTools();
109
- const showTopToolbar = isLargeViewport && showFixedToolbar;
101
+ const hasTopToolbar = isLargeViewport && hasFixedToolbar;
110
102
  const [isBlockToolsCollapsed, setIsBlockToolsCollapsed] = (0, _element.useState)(true);
111
- const hasBlockSelection = !!blockSelectionStart;
112
- (0, _element.useEffect)(() => {
113
- // If we have a new block selection, show the block tools
114
- if (blockSelectionStart) {
115
- setIsBlockToolsCollapsed(false);
116
- }
117
- }, [blockSelectionStart]);
118
103
  return (0, _react.createElement)("div", {
119
104
  className: "edit-post-header"
120
105
  }, (0, _react.createElement)(_mainDashboardButton.default.Slot, null, (0, _react.createElement)(_components.__unstableMotion.div, {
@@ -135,26 +120,12 @@ function Header({
135
120
  className: "edit-post-header__toolbar"
136
121
  }, (0, _react.createElement)(DocumentTools, {
137
122
  disableBlockTools: isTextEditor
138
- }), showTopToolbar && (0, _react.createElement)(_react.Fragment, null, (0, _react.createElement)("div", {
139
- className: (0, _classnames.default)('selected-block-tools-wrapper', {
140
- 'is-collapsed': isBlockToolsCollapsed || !hasBlockSelection
141
- })
142
- }, (0, _react.createElement)(_blockEditor.BlockToolbar, {
143
- hideDragHandle: true
144
- })), (0, _react.createElement)(_components.Popover.Slot, {
145
- ref: blockToolbarRef,
146
- name: "block-toolbar"
147
- }), (0, _react.createElement)(_components.Button, {
148
- className: "edit-post-header__block-tools-toggle",
149
- icon: isBlockToolsCollapsed ? _icons.next : _icons.previous,
150
- onClick: () => {
151
- setIsBlockToolsCollapsed(collapsed => !collapsed);
152
- },
153
- label: isBlockToolsCollapsed ? (0, _i18n.__)('Show block tools') : (0, _i18n.__)('Hide block tools'),
154
- size: "compact"
155
- })), (0, _react.createElement)("div", {
123
+ }), hasTopToolbar && (0, _react.createElement)(CollapsableBlockToolbar, {
124
+ isCollapsed: isBlockToolsCollapsed,
125
+ onToggle: setIsBlockToolsCollapsed
126
+ }), (0, _react.createElement)("div", {
156
127
  className: (0, _classnames.default)('edit-post-header__center', {
157
- 'is-collapsed': hasHistory && !isBlockToolsCollapsed && showTopToolbar
128
+ 'is-collapsed': hasHistory && !isBlockToolsCollapsed && hasTopToolbar
158
129
  })
159
130
  }, hasHistory && (0, _react.createElement)(_editor.DocumentBar, null))), (0, _react.createElement)(_components.__unstableMotion.div, {
160
131
  variants: slideY,
@@ -176,14 +147,12 @@ function Header({
176
147
  }), (0, _react.createElement)(_editor.PostPreviewButton, {
177
148
  className: "edit-post-header__post-preview-button",
178
149
  forceIsAutosaveable: hasActiveMetaboxes
179
- }), (0, _react.createElement)(PostViewLink, null), (0, _react.createElement)(_postPublishButtonOrToggle.default, {
150
+ }), (0, _react.createElement)(PostViewLink, null), (0, _react.createElement)(PostPublishButtonOrToggle, {
180
151
  forceIsDirty: hasActiveMetaboxes,
181
152
  setEntitiesSavedStatesCallback: setEntitiesSavedStatesCallback
182
- }), (isWideViewport || !showIconLabels) && (0, _react.createElement)(_interface.PinnedItems.Slot, {
183
- scope: "core/edit-post"
184
- }), (0, _react.createElement)(_moreMenu.default, {
185
- showIconLabels: showIconLabels
186
- })));
153
+ }), (isWideViewport || !showIconLabels) && (0, _react.createElement)(PinnedItems.Slot, {
154
+ scope: "core"
155
+ }), (0, _react.createElement)(MoreMenu, null), (0, _react.createElement)(_moreMenu.default, null)));
187
156
  }
188
157
  var _default = exports.default = Header;
189
158
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_classnames","_interopRequireDefault","require","_blockEditor","_editor","_element","_data","_i18n","_icons","_interface","_compose","_components","_preferences","_fullscreenModeClose","_moreMenu","_postPublishButtonOrToggle","_mainDashboardButton","_store","_lockUnlock","useShowBlockTools","unlock","blockEditorPrivateApis","DocumentTools","PostViewLink","PreviewDropdown","editorPrivateApis","slideY","hidden","y","distractionFreeInactive","hover","transition","type","delay","slideX","x","Header","setEntitiesSavedStatesCallback","initialPost","isWideViewport","useViewportMatch","isLargeViewport","blockToolbarRef","useRef","isTextEditor","blockSelectionStart","hasActiveMetaboxes","isPublishSidebarOpened","showIconLabels","hasHistory","useSelect","select","get","getPreference","preferencesStore","getEditorMode","editorStore","blockEditorStore","getBlockSelectionStart","editPostStore","hasMetaBoxes","getEditorSettings","onNavigateToPreviousEntityRecord","showFixedToolbar","showTopToolbar","isBlockToolsCollapsed","setIsBlockToolsCollapsed","useState","hasBlockSelection","useEffect","_react","createElement","className","default","Slot","__unstableMotion","div","variants","showTooltip","disableBlockTools","Fragment","classnames","BlockToolbar","hideDragHandle","Popover","ref","name","Button","icon","next","previous","onClick","collapsed","label","__","size","DocumentBar","PostSavedState","forceIsDirty","forceIsAutosaveable","PostPreviewButton","PinnedItems","scope","_default","exports"],"sources":["@wordpress/edit-post/src/components/header/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tBlockToolbar,\n\tprivateApis as blockEditorPrivateApis,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport {\n\tPostSavedState,\n\tPostPreviewButton,\n\tstore as editorStore,\n\tDocumentBar,\n\tprivateApis as editorPrivateApis,\n} from '@wordpress/editor';\nimport { useEffect, useRef, useState } from '@wordpress/element';\nimport { useSelect } from '@wordpress/data';\nimport { __ } from '@wordpress/i18n';\nimport { next, previous } from '@wordpress/icons';\nimport { PinnedItems } from '@wordpress/interface';\nimport { useViewportMatch } from '@wordpress/compose';\nimport {\n\tButton,\n\t__unstableMotion as motion,\n\tPopover,\n} from '@wordpress/components';\nimport { store as preferencesStore } from '@wordpress/preferences';\n\n/**\n * Internal dependencies\n */\nimport FullscreenModeClose from './fullscreen-mode-close';\nimport MoreMenu from './more-menu';\nimport PostPublishButtonOrToggle from './post-publish-button-or-toggle';\nimport MainDashboardButton from './main-dashboard-button';\nimport { store as editPostStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\n\nconst { useShowBlockTools } = unlock( blockEditorPrivateApis );\nconst { DocumentTools, PostViewLink, PreviewDropdown } =\n\tunlock( editorPrivateApis );\n\nconst slideY = {\n\thidden: { y: '-50px' },\n\tdistractionFreeInactive: { y: 0 },\n\thover: { y: 0, transition: { type: 'tween', delay: 0.2 } },\n};\n\nconst slideX = {\n\thidden: { x: '-100%' },\n\tdistractionFreeInactive: { x: 0 },\n\thover: { x: 0, transition: { type: 'tween', delay: 0.2 } },\n};\n\nfunction Header( { setEntitiesSavedStatesCallback, initialPost } ) {\n\tconst isWideViewport = useViewportMatch( 'large' );\n\tconst isLargeViewport = useViewportMatch( 'medium' );\n\tconst blockToolbarRef = useRef();\n\tconst {\n\t\tisTextEditor,\n\t\tblockSelectionStart,\n\t\thasActiveMetaboxes,\n\t\tisPublishSidebarOpened,\n\t\tshowIconLabels,\n\t\thasHistory,\n\t} = useSelect( ( select ) => {\n\t\tconst { get: getPreference } = select( preferencesStore );\n\t\tconst { getEditorMode } = select( editorStore );\n\n\t\treturn {\n\t\t\tisTextEditor: getEditorMode() === 'text',\n\t\t\tblockSelectionStart:\n\t\t\t\tselect( blockEditorStore ).getBlockSelectionStart(),\n\t\t\thasActiveMetaboxes: select( editPostStore ).hasMetaBoxes(),\n\t\t\thasHistory:\n\t\t\t\t!! select( editorStore ).getEditorSettings()\n\t\t\t\t\t.onNavigateToPreviousEntityRecord,\n\t\t\tisPublishSidebarOpened:\n\t\t\t\tselect( editorStore ).isPublishSidebarOpened(),\n\t\t\tshowIconLabels: getPreference( 'core', 'showIconLabels' ),\n\t\t};\n\t}, [] );\n\n\tconst { showFixedToolbar } = useShowBlockTools();\n\tconst showTopToolbar = isLargeViewport && showFixedToolbar;\n\n\tconst [ isBlockToolsCollapsed, setIsBlockToolsCollapsed ] =\n\t\tuseState( true );\n\tconst hasBlockSelection = !! blockSelectionStart;\n\n\tuseEffect( () => {\n\t\t// If we have a new block selection, show the block tools\n\t\tif ( blockSelectionStart ) {\n\t\t\tsetIsBlockToolsCollapsed( false );\n\t\t}\n\t}, [ blockSelectionStart ] );\n\n\treturn (\n\t\t<div className=\"edit-post-header\">\n\t\t\t<MainDashboardButton.Slot>\n\t\t\t\t<motion.div\n\t\t\t\t\tvariants={ slideX }\n\t\t\t\t\ttransition={ { type: 'tween', delay: 0.8 } }\n\t\t\t\t>\n\t\t\t\t\t<FullscreenModeClose\n\t\t\t\t\t\tshowTooltip\n\t\t\t\t\t\tinitialPost={ initialPost }\n\t\t\t\t\t/>\n\t\t\t\t</motion.div>\n\t\t\t</MainDashboardButton.Slot>\n\t\t\t<motion.div\n\t\t\t\tvariants={ slideY }\n\t\t\t\ttransition={ { type: 'tween', delay: 0.8 } }\n\t\t\t\tclassName=\"edit-post-header__toolbar\"\n\t\t\t>\n\t\t\t\t<DocumentTools disableBlockTools={ isTextEditor } />\n\t\t\t\t{ showTopToolbar && (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<div\n\t\t\t\t\t\t\tclassName={ classnames(\n\t\t\t\t\t\t\t\t'selected-block-tools-wrapper',\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t'is-collapsed':\n\t\t\t\t\t\t\t\t\t\tisBlockToolsCollapsed ||\n\t\t\t\t\t\t\t\t\t\t! hasBlockSelection,\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<BlockToolbar hideDragHandle />\n\t\t\t\t\t\t</div>\n\t\t\t\t\t\t<Popover.Slot\n\t\t\t\t\t\t\tref={ blockToolbarRef }\n\t\t\t\t\t\t\tname=\"block-toolbar\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tclassName=\"edit-post-header__block-tools-toggle\"\n\t\t\t\t\t\t\ticon={ isBlockToolsCollapsed ? next : previous }\n\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\tsetIsBlockToolsCollapsed(\n\t\t\t\t\t\t\t\t\t( collapsed ) => ! collapsed\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tlabel={\n\t\t\t\t\t\t\t\tisBlockToolsCollapsed\n\t\t\t\t\t\t\t\t\t? __( 'Show block tools' )\n\t\t\t\t\t\t\t\t\t: __( 'Hide block tools' )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tsize=\"compact\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t</>\n\t\t\t\t) }\n\t\t\t\t<div\n\t\t\t\t\tclassName={ classnames( 'edit-post-header__center', {\n\t\t\t\t\t\t'is-collapsed':\n\t\t\t\t\t\t\thasHistory &&\n\t\t\t\t\t\t\t! isBlockToolsCollapsed &&\n\t\t\t\t\t\t\tshowTopToolbar,\n\t\t\t\t\t} ) }\n\t\t\t\t>\n\t\t\t\t\t{ hasHistory && <DocumentBar /> }\n\t\t\t\t</div>\n\t\t\t</motion.div>\n\t\t\t<motion.div\n\t\t\t\tvariants={ slideY }\n\t\t\t\ttransition={ { type: 'tween', delay: 0.8 } }\n\t\t\t\tclassName=\"edit-post-header__settings\"\n\t\t\t>\n\t\t\t\t{ ! isPublishSidebarOpened && (\n\t\t\t\t\t// This button isn't completely hidden by the publish sidebar.\n\t\t\t\t\t// We can't hide the whole toolbar when the publish sidebar is open because\n\t\t\t\t\t// we want to prevent mounting/unmounting the PostPublishButtonOrToggle DOM node.\n\t\t\t\t\t// We track that DOM node to return focus to the PostPublishButtonOrToggle\n\t\t\t\t\t// when the publish sidebar has been closed.\n\t\t\t\t\t<PostSavedState forceIsDirty={ hasActiveMetaboxes } />\n\t\t\t\t) }\n\t\t\t\t<PreviewDropdown forceIsAutosaveable={ hasActiveMetaboxes } />\n\t\t\t\t<PostPreviewButton\n\t\t\t\t\tclassName=\"edit-post-header__post-preview-button\"\n\t\t\t\t\tforceIsAutosaveable={ hasActiveMetaboxes }\n\t\t\t\t/>\n\t\t\t\t<PostViewLink />\n\t\t\t\t<PostPublishButtonOrToggle\n\t\t\t\t\tforceIsDirty={ hasActiveMetaboxes }\n\t\t\t\t\tsetEntitiesSavedStatesCallback={\n\t\t\t\t\t\tsetEntitiesSavedStatesCallback\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t\t{ ( isWideViewport || ! showIconLabels ) && (\n\t\t\t\t\t<PinnedItems.Slot scope=\"core/edit-post\" />\n\t\t\t\t) }\n\t\t\t\t<MoreMenu showIconLabels={ showIconLabels } />\n\t\t\t</motion.div>\n\t\t</div>\n\t);\n}\n\nexport default Header;\n"],"mappings":";;;;;;;;AAGA,IAAAA,WAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,YAAA,GAAAD,OAAA;AAKA,IAAAE,OAAA,GAAAF,OAAA;AAOA,IAAAG,QAAA,GAAAH,OAAA;AACA,IAAAI,KAAA,GAAAJ,OAAA;AACA,IAAAK,KAAA,GAAAL,OAAA;AACA,IAAAM,MAAA,GAAAN,OAAA;AACA,IAAAO,UAAA,GAAAP,OAAA;AACA,IAAAQ,QAAA,GAAAR,OAAA;AACA,IAAAS,WAAA,GAAAT,OAAA;AAKA,IAAAU,YAAA,GAAAV,OAAA;AAKA,IAAAW,oBAAA,GAAAZ,sBAAA,CAAAC,OAAA;AACA,IAAAY,SAAA,GAAAb,sBAAA,CAAAC,OAAA;AACA,IAAAa,0BAAA,GAAAd,sBAAA,CAAAC,OAAA;AACA,IAAAc,oBAAA,GAAAf,sBAAA,CAAAC,OAAA;AACA,IAAAe,MAAA,GAAAf,OAAA;AACA,IAAAgB,WAAA,GAAAhB,OAAA;AAzCA;AACA;AACA;;AAGA;AACA;AACA;;AA0BA;AACA;AACA;;AAQA,MAAM;EAAEiB;AAAkB,CAAC,GAAG,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cAAc,EAAGA;EAAgB,CAAE,CAClC,CACR,CAAC;AAER;AAAC,IAAAuD,QAAA,GAAAC,OAAA,CAAA/B,OAAA,GAEcrC,MAAM"}
1
+ {"version":3,"names":["_classnames","_interopRequireDefault","require","_editor","_data","_compose","_components","_preferences","_element","_fullscreenModeClose","_moreMenu","_mainDashboardButton","_store","_lockUnlock","CollapsableBlockToolbar","DocumentTools","PostViewLink","PreviewDropdown","PinnedItems","MoreMenu","PostPublishButtonOrToggle","unlock","editorPrivateApis","slideY","hidden","y","distractionFreeInactive","hover","transition","type","delay","slideX","x","Header","setEntitiesSavedStatesCallback","initialPost","isWideViewport","useViewportMatch","isLargeViewport","isTextEditor","hasActiveMetaboxes","isPublishSidebarOpened","showIconLabels","hasHistory","hasFixedToolbar","useSelect","select","get","getPreference","preferencesStore","getEditorMode","editorStore","editPostStore","hasMetaBoxes","getEditorSettings","onNavigateToPreviousEntityRecord","hasTopToolbar","isBlockToolsCollapsed","setIsBlockToolsCollapsed","useState","_react","createElement","className","default","Slot","__unstableMotion","div","variants","showTooltip","disableBlockTools","isCollapsed","onToggle","classnames","DocumentBar","PostSavedState","forceIsDirty","forceIsAutosaveable","PostPreviewButton","scope","_default","exports"],"sources":["@wordpress/edit-post/src/components/header/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tDocumentBar,\n\tPostSavedState,\n\tPostPreviewButton,\n\tstore as editorStore,\n\tprivateApis as editorPrivateApis,\n} from '@wordpress/editor';\nimport { useSelect } from '@wordpress/data';\nimport { useViewportMatch } from '@wordpress/compose';\nimport { __unstableMotion as motion } from '@wordpress/components';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport { useState } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport FullscreenModeClose from './fullscreen-mode-close';\nimport PostEditorMoreMenu from './more-menu';\nimport MainDashboardButton from './main-dashboard-button';\nimport { store as editPostStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\n\nconst {\n\tCollapsableBlockToolbar,\n\tDocumentTools,\n\tPostViewLink,\n\tPreviewDropdown,\n\tPinnedItems,\n\tMoreMenu,\n\tPostPublishButtonOrToggle,\n} = unlock( editorPrivateApis );\n\nconst slideY = {\n\thidden: { y: '-50px' },\n\tdistractionFreeInactive: { y: 0 },\n\thover: { y: 0, transition: { type: 'tween', delay: 0.2 } },\n};\n\nconst slideX = {\n\thidden: { x: '-100%' },\n\tdistractionFreeInactive: { x: 0 },\n\thover: { x: 0, transition: { type: 'tween', delay: 0.2 } },\n};\n\nfunction Header( { setEntitiesSavedStatesCallback, initialPost } ) {\n\tconst isWideViewport = useViewportMatch( 'large' );\n\tconst isLargeViewport = useViewportMatch( 'medium' );\n\tconst {\n\t\tisTextEditor,\n\t\thasActiveMetaboxes,\n\t\tisPublishSidebarOpened,\n\t\tshowIconLabels,\n\t\thasHistory,\n\t\thasFixedToolbar,\n\t} = useSelect( ( select ) => {\n\t\tconst { get: getPreference } = select( preferencesStore );\n\t\tconst { getEditorMode } = select( editorStore );\n\n\t\treturn {\n\t\t\tisTextEditor: getEditorMode() === 'text',\n\t\t\thasActiveMetaboxes: select( editPostStore ).hasMetaBoxes(),\n\t\t\thasHistory:\n\t\t\t\t!! select( editorStore ).getEditorSettings()\n\t\t\t\t\t.onNavigateToPreviousEntityRecord,\n\t\t\tisPublishSidebarOpened:\n\t\t\t\tselect( editorStore ).isPublishSidebarOpened(),\n\t\t\tshowIconLabels: getPreference( 'core', 'showIconLabels' ),\n\t\t\thasFixedToolbar: getPreference( 'core', 'fixedToolbar' ),\n\t\t};\n\t}, [] );\n\n\tconst hasTopToolbar = isLargeViewport && hasFixedToolbar;\n\n\tconst [ isBlockToolsCollapsed, setIsBlockToolsCollapsed ] =\n\t\tuseState( true );\n\n\treturn (\n\t\t<div className=\"edit-post-header\">\n\t\t\t<MainDashboardButton.Slot>\n\t\t\t\t<motion.div\n\t\t\t\t\tvariants={ slideX }\n\t\t\t\t\ttransition={ { type: 'tween', delay: 0.8 } }\n\t\t\t\t>\n\t\t\t\t\t<FullscreenModeClose\n\t\t\t\t\t\tshowTooltip\n\t\t\t\t\t\tinitialPost={ initialPost }\n\t\t\t\t\t/>\n\t\t\t\t</motion.div>\n\t\t\t</MainDashboardButton.Slot>\n\t\t\t<motion.div\n\t\t\t\tvariants={ slideY }\n\t\t\t\ttransition={ { type: 'tween', delay: 0.8 } }\n\t\t\t\tclassName=\"edit-post-header__toolbar\"\n\t\t\t>\n\t\t\t\t<DocumentTools disableBlockTools={ isTextEditor } />\n\t\t\t\t{ hasTopToolbar && (\n\t\t\t\t\t<CollapsableBlockToolbar\n\t\t\t\t\t\tisCollapsed={ isBlockToolsCollapsed }\n\t\t\t\t\t\tonToggle={ setIsBlockToolsCollapsed }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t\t<div\n\t\t\t\t\tclassName={ classnames( 'edit-post-header__center', {\n\t\t\t\t\t\t'is-collapsed':\n\t\t\t\t\t\t\thasHistory &&\n\t\t\t\t\t\t\t! isBlockToolsCollapsed &&\n\t\t\t\t\t\t\thasTopToolbar,\n\t\t\t\t\t} ) }\n\t\t\t\t>\n\t\t\t\t\t{ hasHistory && <DocumentBar /> }\n\t\t\t\t</div>\n\t\t\t</motion.div>\n\t\t\t<motion.div\n\t\t\t\tvariants={ slideY }\n\t\t\t\ttransition={ { type: 'tween', delay: 0.8 } }\n\t\t\t\tclassName=\"edit-post-header__settings\"\n\t\t\t>\n\t\t\t\t{ ! isPublishSidebarOpened && (\n\t\t\t\t\t// This button isn't completely hidden by the publish sidebar.\n\t\t\t\t\t// We can't hide the whole toolbar when the publish sidebar is open because\n\t\t\t\t\t// we want to prevent mounting/unmounting the PostPublishButtonOrToggle DOM node.\n\t\t\t\t\t// We track that DOM node to return focus to the PostPublishButtonOrToggle\n\t\t\t\t\t// when the publish sidebar has been closed.\n\t\t\t\t\t<PostSavedState forceIsDirty={ hasActiveMetaboxes } />\n\t\t\t\t) }\n\t\t\t\t<PreviewDropdown forceIsAutosaveable={ hasActiveMetaboxes } />\n\t\t\t\t<PostPreviewButton\n\t\t\t\t\tclassName=\"edit-post-header__post-preview-button\"\n\t\t\t\t\tforceIsAutosaveable={ hasActiveMetaboxes }\n\t\t\t\t/>\n\t\t\t\t<PostViewLink />\n\t\t\t\t<PostPublishButtonOrToggle\n\t\t\t\t\tforceIsDirty={ hasActiveMetaboxes }\n\t\t\t\t\tsetEntitiesSavedStatesCallback={\n\t\t\t\t\t\tsetEntitiesSavedStatesCallback\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t\t{ ( isWideViewport || ! showIconLabels ) && (\n\t\t\t\t\t<PinnedItems.Slot scope=\"core\" />\n\t\t\t\t) }\n\t\t\t\t<MoreMenu />\n\t\t\t\t<PostEditorMoreMenu />\n\t\t\t</motion.div>\n\t\t</div>\n\t);\n}\n\nexport default Header;\n"],"mappings":";;;;;;;;AAGA,IAAAA,WAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,OAAA,GAAAD,OAAA;AAOA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AACA,IAAAI,WAAA,GAAAJ,OAAA;AACA,IAAAK,YAAA,GAAAL,OAAA;AACA,IAAAM,QAAA,GAAAN,OAAA;AAKA,IAAAO,oBAAA,GAAAR,sBAAA,CAAAC,OAAA;AACA,IAAAQ,SAAA,GAAAT,sBAAA,CAAAC,OAAA;AACA,IAAAS,oBAAA,GAAAV,sBAAA,CAAAC,OAAA;AACA,IAAAU,MAAA,GAAAV,OAAA;AACA,IAAAW,WAAA,GAAAX,OAAA;AA5BA;AACA;AACA;;AAGA;AACA;AACA;;AAcA;AACA;AACA;;AAOA,MAAM;EACLY,uBAAuB;EACvBC,aAAa;EACbC,YAAY;EACZC,eAAe;EACfC,WAAW;EACXC,QAAQ;EACRC;AACD,CAAC,GAAG,IAAAC,kBAAM,EAAEC,mBAAkB,CAAC;AAE/B,MAAMC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,aAAA,EAACnD,SAAA,CAAAqD,OAAkB,MAAE,CACV,CACR,CAAC;AAER;AAAC,IAAAgB,QAAA,GAAAC,OAAA,CAAAjB,OAAA,GAEc9B,MAAM","ignoreList":[]}
@@ -8,7 +8,7 @@ exports.default = void 0;
8
8
  var _react = require("react");
9
9
  var _reactNative = require("react-native");
10
10
  var _element = require("@wordpress/element");
11
- require("@wordpress/interface");
11
+ require("@wordpress/editor");
12
12
  var _headerToolbar = _interopRequireDefault(require("./header-toolbar"));
13
13
  /**
14
14
  * External dependencies
@@ -1 +1 @@
1
- {"version":3,"names":["_reactNative","require","_element","_headerToolbar","_interopRequireDefault","Header","Component","constructor","arguments","keyboardDidShow","bind","keyboardDidHide","state","isKeyboardVisible","componentDidMount","keyboardShowSubscription","Keyboard","addListener","keyboardHideSubscription","componentWillUnmount","remove","setState","render","_react","createElement","default","showKeyboardHideButton","exports"],"sources":["@wordpress/edit-post/src/components/header/index.native.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport { Keyboard } from 'react-native';\n\n/**\n * WordPress dependencies\n */\nimport { Component } from '@wordpress/element';\nimport '@wordpress/interface';\n\n/**\n * Internal dependencies\n */\nimport HeaderToolbar from './header-toolbar';\n\nexport default class Header extends Component {\n\tconstructor() {\n\t\tsuper( ...arguments );\n\n\t\tthis.keyboardDidShow = this.keyboardDidShow.bind( this );\n\t\tthis.keyboardDidHide = this.keyboardDidHide.bind( this );\n\n\t\tthis.state = {\n\t\t\tisKeyboardVisible: false,\n\t\t};\n\t}\n\n\tcomponentDidMount() {\n\t\tthis.keyboardShowSubscription = Keyboard.addListener(\n\t\t\t'keyboardDidShow',\n\t\t\tthis.keyboardDidShow\n\t\t);\n\t\tthis.keyboardHideSubscription = Keyboard.addListener(\n\t\t\t'keyboardDidHide',\n\t\t\tthis.keyboardDidHide\n\t\t);\n\t}\n\n\tcomponentWillUnmount() {\n\t\tthis.keyboardShowSubscription.remove();\n\t\tthis.keyboardHideSubscription.remove();\n\t}\n\n\tkeyboardDidShow() {\n\t\tthis.setState( { isKeyboardVisible: true } );\n\t}\n\n\tkeyboardDidHide() {\n\t\tthis.setState( { isKeyboardVisible: false } );\n\t}\n\n\trender() {\n\t\treturn (\n\t\t\t<HeaderToolbar\n\t\t\t\tshowKeyboardHideButton={ this.state.isKeyboardVisible }\n\t\t\t/>\n\t\t);\n\t}\n}\n"],"mappings":";;;;;;;;AAGA,IAAAA,YAAA,GAAAC,OAAA;AAKA,IAAAC,QAAA,GAAAD,OAAA;AACAA,OAAA;AAKA,IAAAE,cAAA,GAAAC,sBAAA,CAAAH,OAAA;AAdA;AACA;AACA;;AAGA;AACA;AACA;;AAIA;AACA;AACA;;AAGe,MAAMI,MAAM,SAASC,kBAAS,CAAC;EAC7CC,WAAWA,CAAA,EAAG;IACb,KAAK,CAAE,GAAGC,SAAU,CAAC;IAErB,IAAI,CAACC,eAAe,GAAG,IAAI,CAACA,eAAe,CAACC,IAAI,CAAE,IAAK,CAAC;IACxD,IAAI,CAACC,eAAe,GAAG,IAAI,CAACA,eAAe,CAACD,IAAI,CAAE,IAAK,CAAC;IAExD,IAAI,CAACE,KAAK,GAAG;MACZC,iBAAiB,EAAE;IACpB,CAAC;EACF;EAEAC,iBAAiBA,CAAA,EAAG;IACnB,IAAI,CAACC,wBAAwB,GAAGC,qBAAQ,CAACC,WAAW,CACnD,iBAAiB,EACjB,IAAI,CAACR,eACN,CAAC;IACD,IAAI,CAACS,wBAAwB,GAAGF,qBAAQ,CAACC,WAAW,CACnD,iBAAiB,EACjB,IAAI,CAACN,eACN,CAAC;EACF;EAEAQ,oBAAoBA,CAAA,EAAG;IACtB,IAAI,CAACJ,wBAAwB,CAACK,MAAM,CAAC,CAAC;IACtC,IAAI,CAACF,wBAAwB,CAACE,MAAM,CAAC,CAAC;EACvC;EAEAX,eAAeA,CAAA,EAAG;IACjB,IAAI,CAACY,QAAQ,CAAE;MAAER,iBAAiB,EAAE;IAAK,CAAE,CAAC;EAC7C;EAEAF,eAAeA,CAAA,EAAG;IACjB,IAAI,CAACU,QAAQ,CAAE;MAAER,iBAAiB,EAAE;IAAM,CAAE,CAAC;EAC9C;EAEAS,MAAMA,CAAA,EAAG;IACR,OACC,IAAAC,MAAA,CAAAC,aAAA,EAACrB,cAAA,CAAAsB,OAAa;MACbC,sBAAsB,EAAG,IAAI,CAACd,KAAK,CAACC;IAAmB,CACvD,CAAC;EAEJ;AACD;AAACc,OAAA,CAAAF,OAAA,GAAApB,MAAA"}
1
+ {"version":3,"names":["_reactNative","require","_element","_headerToolbar","_interopRequireDefault","Header","Component","constructor","arguments","keyboardDidShow","bind","keyboardDidHide","state","isKeyboardVisible","componentDidMount","keyboardShowSubscription","Keyboard","addListener","keyboardHideSubscription","componentWillUnmount","remove","setState","render","_react","createElement","default","showKeyboardHideButton","exports"],"sources":["@wordpress/edit-post/src/components/header/index.native.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport { Keyboard } from 'react-native';\n\n/**\n * WordPress dependencies\n */\nimport { Component } from '@wordpress/element';\nimport '@wordpress/editor';\n\n/**\n * Internal dependencies\n */\nimport HeaderToolbar from './header-toolbar';\n\nexport default class Header extends Component {\n\tconstructor() {\n\t\tsuper( ...arguments );\n\n\t\tthis.keyboardDidShow = this.keyboardDidShow.bind( this );\n\t\tthis.keyboardDidHide = this.keyboardDidHide.bind( this );\n\n\t\tthis.state = {\n\t\t\tisKeyboardVisible: false,\n\t\t};\n\t}\n\n\tcomponentDidMount() {\n\t\tthis.keyboardShowSubscription = Keyboard.addListener(\n\t\t\t'keyboardDidShow',\n\t\t\tthis.keyboardDidShow\n\t\t);\n\t\tthis.keyboardHideSubscription = Keyboard.addListener(\n\t\t\t'keyboardDidHide',\n\t\t\tthis.keyboardDidHide\n\t\t);\n\t}\n\n\tcomponentWillUnmount() {\n\t\tthis.keyboardShowSubscription.remove();\n\t\tthis.keyboardHideSubscription.remove();\n\t}\n\n\tkeyboardDidShow() {\n\t\tthis.setState( { isKeyboardVisible: true } );\n\t}\n\n\tkeyboardDidHide() {\n\t\tthis.setState( { isKeyboardVisible: false } );\n\t}\n\n\trender() {\n\t\treturn (\n\t\t\t<HeaderToolbar\n\t\t\t\tshowKeyboardHideButton={ this.state.isKeyboardVisible }\n\t\t\t/>\n\t\t);\n\t}\n}\n"],"mappings":";;;;;;;;AAGA,IAAAA,YAAA,GAAAC,OAAA;AAKA,IAAAC,QAAA,GAAAD,OAAA;AACAA,OAAA;AAKA,IAAAE,cAAA,GAAAC,sBAAA,CAAAH,OAAA;AAdA;AACA;AACA;;AAGA;AACA;AACA;;AAIA;AACA;AACA;;AAGe,MAAMI,MAAM,SAASC,kBAAS,CAAC;EAC7CC,WAAWA,CAAA,EAAG;IACb,KAAK,CAAE,GAAGC,SAAU,CAAC;IAErB,IAAI,CAACC,eAAe,GAAG,IAAI,CAACA,eAAe,CAACC,IAAI,CAAE,IAAK,CAAC;IACxD,IAAI,CAACC,eAAe,GAAG,IAAI,CAACA,eAAe,CAACD,IAAI,CAAE,IAAK,CAAC;IAExD,IAAI,CAACE,KAAK,GAAG;MACZC,iBAAiB,EAAE;IACpB,CAAC;EACF;EAEAC,iBAAiBA,CAAA,EAAG;IACnB,IAAI,CAACC,wBAAwB,GAAGC,qBAAQ,CAACC,WAAW,CACnD,iBAAiB,EACjB,IAAI,CAACR,eACN,CAAC;IACD,IAAI,CAACS,wBAAwB,GAAGF,qBAAQ,CAACC,WAAW,CACnD,iBAAiB,EACjB,IAAI,CAACN,eACN,CAAC;EACF;EAEAQ,oBAAoBA,CAAA,EAAG;IACtB,IAAI,CAACJ,wBAAwB,CAACK,MAAM,CAAC,CAAC;IACtC,IAAI,CAACF,wBAAwB,CAACE,MAAM,CAAC,CAAC;EACvC;EAEAX,eAAeA,CAAA,EAAG;IACjB,IAAI,CAACY,QAAQ,CAAE;MAAER,iBAAiB,EAAE;IAAK,CAAE,CAAC;EAC7C;EAEAF,eAAeA,CAAA,EAAG;IACjB,IAAI,CAACU,QAAQ,CAAE;MAAER,iBAAiB,EAAE;IAAM,CAAE,CAAC;EAC9C;EAEAS,MAAMA,CAAA,EAAG;IACR,OACC,IAAAC,MAAA,CAAAC,aAAA,EAACrB,cAAA,CAAAsB,OAAa;MACbC,sBAAsB,EAAG,IAAI,CAACd,KAAK,CAACC;IAAmB,CACvD,CAAC;EAEJ;AACD;AAACc,OAAA,CAAAF,OAAA,GAAApB,MAAA","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":["_components","require","slotName","Fill","Slot","MainDashboardButtonSlot","createSlotFill","MainDashboardButton","children","fills","useSlotFills","hasFills","Boolean","length","_react","createElement","bubblesVirtually","_default","exports","default"],"sources":["@wordpress/edit-post/src/components/header/main-dashboard-button/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalUseSlotFills as useSlotFills,\n\tcreateSlotFill,\n} from '@wordpress/components';\n\nconst slotName = '__experimentalMainDashboardButton';\n\nconst { Fill, Slot: MainDashboardButtonSlot } = createSlotFill( slotName );\n\nconst MainDashboardButton = Fill;\n\nconst Slot = ( { children } ) => {\n\tconst fills = useSlotFills( slotName );\n\tconst hasFills = Boolean( fills && fills.length );\n\n\tif ( ! hasFills ) {\n\t\treturn children;\n\t}\n\n\treturn <MainDashboardButtonSlot bubblesVirtually />;\n};\n\nMainDashboardButton.Slot = Slot;\n\nexport default MainDashboardButton;\n"],"mappings":";;;;;;;AAGA,IAAAA,WAAA,GAAAC,OAAA;AAHA;AACA;AACA;;AAMA,MAAMC,QAAQ,GAAG,mCAAmC;AAEpD,MAAM;EAAEC,IAAI;EAAEC,IAAI,EAAEC;AAAwB,CAAC,GAAG,IAAAC,0BAAc,EAAEJ,QAAS,CAAC;AAE1E,MAAMK,mBAAmB,GAAGJ,IAAI;AAEhC,MAAMC,IAAI,GAAGA,CAAE;EAAEI;AAAS,CAAC,KAAM;EAChC,MAAMC,KAAK,GAAG,IAAAC,sCAAY,EAAER,QAAS,CAAC;EACtC,MAAMS,QAAQ,GAAGC,OAAO,CAAEH,KAAK,IAAIA,KAAK,CAACI,MAAO,CAAC;EAEjD,IAAK,CAAEF,QAAQ,EAAG;IACjB,OAAOH,QAAQ;EAChB;EAEA,OAAO,IAAAM,MAAA,CAAAC,aAAA,EAACV,uBAAuB;IAACW,gBAAgB;EAAA,CAAE,CAAC;AACpD,CAAC;AAEDT,mBAAmB,CAACH,IAAI,GAAGA,IAAI;AAAC,IAAAa,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEjBZ,mBAAmB"}
1
+ {"version":3,"names":["_components","require","slotName","Fill","Slot","MainDashboardButtonSlot","createSlotFill","MainDashboardButton","children","fills","useSlotFills","hasFills","Boolean","length","_react","createElement","bubblesVirtually","_default","exports","default"],"sources":["@wordpress/edit-post/src/components/header/main-dashboard-button/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalUseSlotFills as useSlotFills,\n\tcreateSlotFill,\n} from '@wordpress/components';\n\nconst slotName = '__experimentalMainDashboardButton';\n\nconst { Fill, Slot: MainDashboardButtonSlot } = createSlotFill( slotName );\n\nconst MainDashboardButton = Fill;\n\nconst Slot = ( { children } ) => {\n\tconst fills = useSlotFills( slotName );\n\tconst hasFills = Boolean( fills && fills.length );\n\n\tif ( ! hasFills ) {\n\t\treturn children;\n\t}\n\n\treturn <MainDashboardButtonSlot bubblesVirtually />;\n};\n\nMainDashboardButton.Slot = Slot;\n\nexport default MainDashboardButton;\n"],"mappings":";;;;;;;AAGA,IAAAA,WAAA,GAAAC,OAAA;AAHA;AACA;AACA;;AAMA,MAAMC,QAAQ,GAAG,mCAAmC;AAEpD,MAAM;EAAEC,IAAI;EAAEC,IAAI,EAAEC;AAAwB,CAAC,GAAG,IAAAC,0BAAc,EAAEJ,QAAS,CAAC;AAE1E,MAAMK,mBAAmB,GAAGJ,IAAI;AAEhC,MAAMC,IAAI,GAAGA,CAAE;EAAEI;AAAS,CAAC,KAAM;EAChC,MAAMC,KAAK,GAAG,IAAAC,sCAAY,EAAER,QAAS,CAAC;EACtC,MAAMS,QAAQ,GAAGC,OAAO,CAAEH,KAAK,IAAIA,KAAK,CAACI,MAAO,CAAC;EAEjD,IAAK,CAAEF,QAAQ,EAAG;IACjB,OAAOH,QAAQ;EAChB;EAEA,OAAO,IAAAM,MAAA,CAAAC,aAAA,EAACV,uBAAuB;IAACW,gBAAgB;EAAA,CAAE,CAAC;AACpD,CAAC;AAEDT,mBAAmB,CAACH,IAAI,GAAGA,IAAI;AAAC,IAAAa,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEjBZ,mBAAmB","ignoreList":[]}
@@ -7,15 +7,14 @@ Object.defineProperty(exports, "__esModule", {
7
7
  exports.default = void 0;
8
8
  var _react = require("react");
9
9
  var _i18n = require("@wordpress/i18n");
10
- var _components = require("@wordpress/components");
11
- var _interface = require("@wordpress/interface");
12
10
  var _compose = require("@wordpress/compose");
13
11
  var _editor = require("@wordpress/editor");
14
- var _icons = require("@wordpress/icons");
15
- var _preferencesMenuItem = _interopRequireDefault(require("../preferences-menu-item"));
16
- var _toolsMoreMenuGroup = _interopRequireDefault(require("../tools-more-menu-group"));
17
- var _writingMenu = _interopRequireDefault(require("../writing-menu"));
12
+ var _preferences = require("@wordpress/preferences");
13
+ var _keycodes = require("@wordpress/keycodes");
18
14
  var _lockUnlock = require("../../../lock-unlock");
15
+ var _managePatternsMenuItem = _interopRequireDefault(require("./manage-patterns-menu-item"));
16
+ var _welcomeGuideMenuItem = _interopRequireDefault(require("./welcome-guide-menu-item"));
17
+ var _preferencesModal = _interopRequireDefault(require("../../preferences-modal"));
19
18
  /**
20
19
  * WordPress dependencies
21
20
  */
@@ -25,44 +24,20 @@ var _lockUnlock = require("../../../lock-unlock");
25
24
  */
26
25
 
27
26
  const {
28
- ModeSwitcher
27
+ ToolsMoreMenuGroup,
28
+ ViewMoreMenuGroup
29
29
  } = (0, _lockUnlock.unlock)(_editor.privateApis);
30
- const MoreMenu = ({
31
- showIconLabels
32
- }) => {
30
+ const MoreMenu = () => {
33
31
  const isLargeViewport = (0, _compose.useViewportMatch)('large');
34
- return (0, _react.createElement)(_components.DropdownMenu, {
35
- icon: _icons.moreVertical,
36
- label: (0, _i18n.__)('Options'),
37
- popoverProps: {
38
- placement: 'bottom-end',
39
- className: 'more-menu-dropdown__content'
40
- },
41
- toggleProps: {
42
- ...(showIconLabels && {
43
- variant: 'tertiary'
44
- }),
45
- tooltipPosition: 'bottom',
46
- showTooltip: !showIconLabels,
47
- size: 'compact'
48
- }
49
- }, ({
50
- onClose
51
- }) => (0, _react.createElement)(_react.Fragment, null, showIconLabels && !isLargeViewport && (0, _react.createElement)(_interface.PinnedItems.Slot, {
52
- className: showIconLabels && 'show-icon-labels',
53
- scope: "core/edit-post"
54
- }), (0, _react.createElement)(_writingMenu.default, null), (0, _react.createElement)(ModeSwitcher, null), (0, _react.createElement)(_interface.ActionItem.Slot, {
55
- name: "core/edit-post/plugin-more-menu",
56
- label: (0, _i18n.__)('Plugins'),
57
- as: _components.MenuGroup,
58
- fillProps: {
59
- onClick: onClose
60
- }
61
- }), (0, _react.createElement)(_toolsMoreMenuGroup.default.Slot, {
62
- fillProps: {
63
- onClose
64
- }
65
- }), (0, _react.createElement)(_components.MenuGroup, null, (0, _react.createElement)(_preferencesMenuItem.default, null))));
32
+ return (0, _react.createElement)(_react.Fragment, null, isLargeViewport && (0, _react.createElement)(ViewMoreMenuGroup, null, (0, _react.createElement)(_preferences.PreferenceToggleMenuItem, {
33
+ scope: "core/edit-post",
34
+ name: "fullscreenMode",
35
+ label: (0, _i18n.__)('Fullscreen mode'),
36
+ info: (0, _i18n.__)('Show and hide the admin user interface'),
37
+ messageActivated: (0, _i18n.__)('Fullscreen mode activated'),
38
+ messageDeactivated: (0, _i18n.__)('Fullscreen mode deactivated'),
39
+ shortcut: _keycodes.displayShortcut.secondary('f')
40
+ })), (0, _react.createElement)(ToolsMoreMenuGroup, null, (0, _react.createElement)(_managePatternsMenuItem.default, null), (0, _react.createElement)(_welcomeGuideMenuItem.default, null)), (0, _react.createElement)(_preferencesModal.default, null));
66
41
  };
67
42
  var _default = exports.default = MoreMenu;
68
43
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_i18n","require","_components","_interface","_compose","_editor","_icons","_preferencesMenuItem","_interopRequireDefault","_toolsMoreMenuGroup","_writingMenu","_lockUnlock","ModeSwitcher","unlock","editorPrivateApis","MoreMenu","showIconLabels","isLargeViewport","useViewportMatch","_react","createElement","DropdownMenu","icon","moreVertical","label","__","popoverProps","placement","className","toggleProps","variant","tooltipPosition","showTooltip","size","onClose","Fragment","PinnedItems","Slot","scope","default","ActionItem","name","as","MenuGroup","fillProps","onClick","_default","exports"],"sources":["@wordpress/edit-post/src/components/header/more-menu/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { MenuGroup, DropdownMenu } from '@wordpress/components';\nimport { ActionItem, PinnedItems } from '@wordpress/interface';\nimport { useViewportMatch } from '@wordpress/compose';\nimport { privateApis as editorPrivateApis } from '@wordpress/editor';\nimport { moreVertical } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport PreferencesMenuItem from '../preferences-menu-item';\nimport ToolsMoreMenuGroup from '../tools-more-menu-group';\nimport WritingMenu from '../writing-menu';\nimport { unlock } from '../../../lock-unlock';\n\nconst { ModeSwitcher } = unlock( editorPrivateApis );\n\nconst MoreMenu = ( { showIconLabels } ) => {\n\tconst isLargeViewport = useViewportMatch( 'large' );\n\n\treturn (\n\t\t<DropdownMenu\n\t\t\ticon={ moreVertical }\n\t\t\tlabel={ __( 'Options' ) }\n\t\t\tpopoverProps={ {\n\t\t\t\tplacement: 'bottom-end',\n\t\t\t\tclassName: 'more-menu-dropdown__content',\n\t\t\t} }\n\t\t\ttoggleProps={ {\n\t\t\t\t...( showIconLabels && { variant: 'tertiary' } ),\n\t\t\t\ttooltipPosition: 'bottom',\n\t\t\t\tshowTooltip: ! showIconLabels,\n\t\t\t\tsize: 'compact',\n\t\t\t} }\n\t\t>\n\t\t\t{ ( { onClose } ) => (\n\t\t\t\t<>\n\t\t\t\t\t{ showIconLabels && ! isLargeViewport && (\n\t\t\t\t\t\t<PinnedItems.Slot\n\t\t\t\t\t\t\tclassName={ showIconLabels && 'show-icon-labels' }\n\t\t\t\t\t\t\tscope=\"core/edit-post\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t\t<WritingMenu />\n\t\t\t\t\t<ModeSwitcher />\n\t\t\t\t\t<ActionItem.Slot\n\t\t\t\t\t\tname=\"core/edit-post/plugin-more-menu\"\n\t\t\t\t\t\tlabel={ __( 'Plugins' ) }\n\t\t\t\t\t\tas={ MenuGroup }\n\t\t\t\t\t\tfillProps={ { onClick: onClose } }\n\t\t\t\t\t/>\n\t\t\t\t\t<ToolsMoreMenuGroup.Slot fillProps={ { onClose } } />\n\t\t\t\t\t<MenuGroup>\n\t\t\t\t\t\t<PreferencesMenuItem />\n\t\t\t\t\t</MenuGroup>\n\t\t\t\t</>\n\t\t\t) }\n\t\t</DropdownMenu>\n\t);\n};\n\nexport default MoreMenu;\n"],"mappings":";;;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AACA,IAAAE,UAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AACA,IAAAI,OAAA,GAAAJ,OAAA;AACA,IAAAK,MAAA,GAAAL,OAAA;AAKA,IAAAM,oBAAA,GAAAC,sBAAA,CAAAP,OAAA;AACA,IAAAQ,mBAAA,GAAAD,sBAAA,CAAAP,OAAA;AACA,IAAAS,YAAA,GAAAF,sBAAA,CAAAP,OAAA;AACA,IAAAU,WAAA,GAAAV,OAAA;AAhBA;AACA;AACA;;AAQA;AACA;AACA;;AAMA,MAAM;EAAEW;AAAa,CAAC,GAAG,IAAAC,kBAAM,EAAEC,mBAAkB,CAAC;AAEpD,MAAMC,QAAQ,GAAGA,CAAE;EAAEC;AAAe,CAAC,KAAM;EAC1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A,CAAAC,aAAA,EAAClB,WAAA,CAAAyC,SAAS,QACT,IAAAxB,MAAA,CAAAC,aAAA,EAACb,oBAAA,CAAAgC,OAAmB,MAAE,CACZ,CACV,CAEU,CAAC;AAEjB,CAAC;AAAC,IAAAO,QAAA,GAAAC,OAAA,CAAAR,OAAA,GAEaxB,QAAQ"}
1
+ {"version":3,"names":["_i18n","require","_compose","_editor","_preferences","_keycodes","_lockUnlock","_managePatternsMenuItem","_interopRequireDefault","_welcomeGuideMenuItem","_preferencesModal","ToolsMoreMenuGroup","ViewMoreMenuGroup","unlock","editorPrivateApis","MoreMenu","isLargeViewport","useViewportMatch","_react","createElement","Fragment","PreferenceToggleMenuItem","scope","name","label","__","info","messageActivated","messageDeactivated","shortcut","displayShortcut","secondary","default","_default","exports"],"sources":["@wordpress/edit-post/src/components/header/more-menu/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useViewportMatch } from '@wordpress/compose';\nimport { privateApis as editorPrivateApis } from '@wordpress/editor';\nimport { PreferenceToggleMenuItem } from '@wordpress/preferences';\nimport { displayShortcut } from '@wordpress/keycodes';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../../lock-unlock';\nimport ManagePatternsMenuItem from './manage-patterns-menu-item';\nimport WelcomeGuideMenuItem from './welcome-guide-menu-item';\nimport EditPostPreferencesModal from '../../preferences-modal';\n\nconst { ToolsMoreMenuGroup, ViewMoreMenuGroup } = unlock( editorPrivateApis );\n\nconst MoreMenu = () => {\n\tconst isLargeViewport = useViewportMatch( 'large' );\n\n\treturn (\n\t\t<>\n\t\t\t{ isLargeViewport && (\n\t\t\t\t<ViewMoreMenuGroup>\n\t\t\t\t\t<PreferenceToggleMenuItem\n\t\t\t\t\t\tscope=\"core/edit-post\"\n\t\t\t\t\t\tname=\"fullscreenMode\"\n\t\t\t\t\t\tlabel={ __( 'Fullscreen mode' ) }\n\t\t\t\t\t\tinfo={ __( 'Show and hide the admin user interface' ) }\n\t\t\t\t\t\tmessageActivated={ __( 'Fullscreen mode activated' ) }\n\t\t\t\t\t\tmessageDeactivated={ __(\n\t\t\t\t\t\t\t'Fullscreen mode deactivated'\n\t\t\t\t\t\t) }\n\t\t\t\t\t\tshortcut={ displayShortcut.secondary( 'f' ) }\n\t\t\t\t\t/>\n\t\t\t\t</ViewMoreMenuGroup>\n\t\t\t) }\n\t\t\t<ToolsMoreMenuGroup>\n\t\t\t\t<ManagePatternsMenuItem />\n\t\t\t\t<WelcomeGuideMenuItem />\n\t\t\t</ToolsMoreMenuGroup>\n\t\t\t<EditPostPreferencesModal />\n\t\t</>\n\t);\n};\n\nexport default MoreMenu;\n"],"mappings":";;;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,OAAA,GAAAF,OAAA;AACA,IAAAG,YAAA,GAAAH,OAAA;AACA,IAAAI,SAAA,GAAAJ,OAAA;AAKA,IAAAK,WAAA,GAAAL,OAAA;AACA,IAAAM,uBAAA,GAAAC,sBAAA,CAAAP,OAAA;AACA,IAAAQ,qBAAA,GAAAD,sBAAA,CAAAP,OAAA;AACA,IAAAS,iBAAA,GAAAF,sBAAA,CAAAP,OAAA;AAfA;AACA;AACA;;AAOA;AACA;AACA;;AAMA,MAAM;EAAEU,kBAAkB;EAAEC;AAAkB,CAAC,GAAG,IAAAC,kBAAM,EAAEC,mBAAkB,CAAC;AAE7E,MAAMC,QAAQ,GAAGA,CAAA,KAAM;EACtB,MAAMC,eAAe,GAAG,IAAAC,yBAAgB,EAAE,OAAQ,CAAC;EAEnD,OACC,IAAAC,MAAA,CAAAC,aAAA,EAAAD,MAAA,CAAAE,QAAA,QACGJ,eAAe,IAChB,IAAAE,MAAA,CAAAC,aAAA,EAACP,iBAAiB,QACjB,IAAAM,MAAA,CAAAC,aAAA,EAACf,YAAA,CAAAiB,wBAAwB;IACxBC,KAAK,EAAC,gBAAgB;IACtBC,IAAI,EAAC,gBAAgB;IACrBC,KAAK,EAAG,IAAAC,QAAE,EAAE,iBAAkB,CAAG;IACjCC,IAAI,EAAG,IAAAD,QAAE,EAAE,wCAAyC,CAAG;IACvDE,gBAAgB,EAAG,IAAAF,QAAE,EAAE,2BAA4B,CAAG;IACtDG,kBAAkB,EAAG,IAAAH,QAAE,EACtB,6BACD,CAAG;IACHI,QAAQ,EAAGC,yBAAe,CAACC,SAAS,CAAE,GAAI;EAAG,CAC7C,CACiB,CACnB,EACD,IAAAb,MAAA,CAAAC,aAAA,EAACR,kBAAkB,QAClB,IAAAO,MAAA,CAAAC,aAAA,EAACZ,uBAAA,CAAAyB,OAAsB,MAAE,CAAC,EAC1B,IAAAd,MAAA,CAAAC,aAAA,EAACV,qBAAA,CAAAuB,OAAoB,MAAE,CACJ,CAAC,EACrB,IAAAd,MAAA,CAAAC,aAAA,EAACT,iBAAA,CAAAsB,OAAwB,MAAE,CAC1B,CAAC;AAEL,CAAC;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAF,OAAA,GAEajB,QAAQ","ignoreList":[]}
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _react = require("react");
8
+ var _components = require("@wordpress/components");
9
+ var _coreData = require("@wordpress/core-data");
10
+ var _data = require("@wordpress/data");
11
+ var _i18n = require("@wordpress/i18n");
12
+ var _url = require("@wordpress/url");
13
+ /**
14
+ * WordPress dependencies
15
+ */
16
+
17
+ function ManagePatternsMenuItem() {
18
+ const url = (0, _data.useSelect)(select => {
19
+ const {
20
+ canUser
21
+ } = select(_coreData.store);
22
+ const defaultUrl = (0, _url.addQueryArgs)('edit.php', {
23
+ post_type: 'wp_block'
24
+ });
25
+ const patternsUrl = (0, _url.addQueryArgs)('site-editor.php', {
26
+ path: '/patterns'
27
+ });
28
+
29
+ // The site editor and templates both check whether the user has
30
+ // edit_theme_options capabilities. We can leverage that here and not
31
+ // display the manage patterns link if the user can't access it.
32
+ return canUser('read', 'templates') ? patternsUrl : defaultUrl;
33
+ }, []);
34
+ return (0, _react.createElement)(_components.MenuItem, {
35
+ role: "menuitem",
36
+ href: url
37
+ }, (0, _i18n.__)('Manage patterns'));
38
+ }
39
+ var _default = exports.default = ManagePatternsMenuItem;
40
+ //# sourceMappingURL=manage-patterns-menu-item.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_components","require","_coreData","_data","_i18n","_url","ManagePatternsMenuItem","url","useSelect","select","canUser","coreStore","defaultUrl","addQueryArgs","post_type","patternsUrl","path","_react","createElement","MenuItem","role","href","__","_default","exports","default"],"sources":["@wordpress/edit-post/src/components/header/more-menu/manage-patterns-menu-item.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { MenuItem } from '@wordpress/components';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useSelect } from '@wordpress/data';\nimport { __ } from '@wordpress/i18n';\nimport { addQueryArgs } from '@wordpress/url';\n\nfunction ManagePatternsMenuItem() {\n\tconst url = useSelect( ( select ) => {\n\t\tconst { canUser } = select( coreStore );\n\t\tconst defaultUrl = addQueryArgs( 'edit.php', {\n\t\t\tpost_type: 'wp_block',\n\t\t} );\n\t\tconst patternsUrl = addQueryArgs( 'site-editor.php', {\n\t\t\tpath: '/patterns',\n\t\t} );\n\n\t\t// The site editor and templates both check whether the user has\n\t\t// edit_theme_options capabilities. We can leverage that here and not\n\t\t// display the manage patterns link if the user can't access it.\n\t\treturn canUser( 'read', 'templates' ) ? patternsUrl : defaultUrl;\n\t}, [] );\n\n\treturn (\n\t\t<MenuItem role=\"menuitem\" href={ url }>\n\t\t\t{ __( 'Manage patterns' ) }\n\t\t</MenuItem>\n\t);\n}\n\nexport default ManagePatternsMenuItem;\n"],"mappings":";;;;;;;AAGA,IAAAA,WAAA,GAAAC,OAAA;AACA,IAAAC,SAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,KAAA,GAAAH,OAAA;AACA,IAAAI,IAAA,GAAAJ,OAAA;AAPA;AACA;AACA;;AAOA,SAASK,sBAAsBA,CAAA,EAAG;EACjC,MAAMC,GAAG,GAAG,IAAAC,eAAS,EAAIC,MAAM,IAAM;IACpC,MAAM;MAAEC;IAAQ,CAAC,GAAGD,MAAM,CAAEE,eAAU,CAAC;IACvC,MAAMC,UAAU,GAAG,IAAAC,iBAAY,EAAE,UAAU,EAAE;MAC5CC,SAAS,EAAE;IACZ,CAAE,CAAC;IACH,MAAMC,WAAW,GAAG,IAAAF,iBAAY,EAAE,iBAAiB,EAAE;MACpDG,IAAI,EAAE;IACP,CAAE,CAAC;;IAEH;IACA;IACA;IACA,OAAON,OAAO,CAAE,MAAM,EAAE,WAAY,CAAC,GAAGK,WAAW,GAAGH,UAAU;EACjE,CAAC,EAAE,EAAG,CAAC;EAEP,OACC,IAAAK,MAAA,CAAAC,aAAA,EAAClB,WAAA,CAAAmB,QAAQ;IAACC,IAAI,EAAC,UAAU;IAACC,IAAI,EAAGd;EAAK,GACnC,IAAAe,QAAE,EAAE,iBAAkB,CACf,CAAC;AAEb;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEcnB,sBAAsB","ignoreList":[]}
@@ -21,4 +21,4 @@ function WelcomeGuideMenuItem() {
21
21
  label: (0, _i18n.__)('Welcome Guide')
22
22
  });
23
23
  }
24
- //# sourceMappingURL=index.js.map
24
+ //# sourceMappingURL=welcome-guide-menu-item.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_data","require","_preferences","_i18n","_editor","WelcomeGuideMenuItem","isEditingTemplate","useSelect","select","editorStore","getCurrentPostType","_react","createElement","PreferenceToggleMenuItem","scope","name","label","__"],"sources":["@wordpress/edit-post/src/components/header/more-menu/welcome-guide-menu-item.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { PreferenceToggleMenuItem } from '@wordpress/preferences';\nimport { __ } from '@wordpress/i18n';\nimport { store as editorStore } from '@wordpress/editor';\n\nexport default function WelcomeGuideMenuItem() {\n\tconst isEditingTemplate = useSelect(\n\t\t( select ) =>\n\t\t\tselect( editorStore ).getCurrentPostType() === 'wp_template',\n\t\t[]\n\t);\n\n\treturn (\n\t\t<PreferenceToggleMenuItem\n\t\t\tscope=\"core/edit-post\"\n\t\t\tname={ isEditingTemplate ? 'welcomeGuideTemplate' : 'welcomeGuide' }\n\t\t\tlabel={ __( 'Welcome Guide' ) }\n\t\t/>\n\t);\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,OAAA,GAAAH,OAAA;AANA;AACA;AACA;;AAMe,SAASI,oBAAoBA,CAAA,EAAG;EAC9C,MAAMC,iBAAiB,GAAG,IAAAC,eAAS,EAChCC,MAAM,IACPA,MAAM,CAAEC,aAAY,CAAC,CAACC,kBAAkB,CAAC,CAAC,KAAK,aAAa,EAC7D,EACD,CAAC;EAED,OACC,IAAAC,MAAA,CAAAC,aAAA,EAACV,YAAA,CAAAW,wBAAwB;IACxBC,KAAK,EAAC,gBAAgB;IACtBC,IAAI,EAAGT,iBAAiB,GAAG,sBAAsB,GAAG,cAAgB;IACpEU,KAAK,EAAG,IAAAC,QAAE,EAAE,eAAgB;EAAG,CAC/B,CAAC;AAEJ","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":["_data","require","_i18n","_components","_element","_editor","_blockEditor","_lockUnlock","ReusableBlocksRenameHint","unlock","blockEditorPrivateApis","InitPatternModal","editPost","useDispatch","editorStore","isModalOpen","setIsModalOpen","useState","syncType","setSyncType","undefined","title","setTitle","postType","isNewPost","useSelect","select","getEditedPostAttribute","isCleanNewPost","useEffect","_react","createElement","Fragment","Modal","__","onRequestClose","overlayClassName","onSubmit","event","preventDefault","meta","wp_pattern_sync_status","__experimentalVStack","spacing","TextControl","label","value","onChange","placeholder","className","__nextHasNoMarginBottom","__next40pxDefaultSize","ToggleControl","_x","help","checked","__experimentalHStack","justify","Button","variant","type","disabled","__experimentalIsFocusable"],"sources":["@wordpress/edit-post/src/components/init-pattern-modal/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { __, _x } from '@wordpress/i18n';\nimport {\n\tModal,\n\tButton,\n\t__experimentalHStack as HStack,\n\t__experimentalVStack as VStack,\n\tToggleControl,\n\tTextControl,\n} from '@wordpress/components';\nimport { useEffect, useState } from '@wordpress/element';\nimport { store as editorStore } from '@wordpress/editor';\nimport { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\n\nimport { unlock } from '../../lock-unlock';\n\nconst { ReusableBlocksRenameHint } = unlock( blockEditorPrivateApis );\n\nexport default function InitPatternModal() {\n\tconst { editPost } = useDispatch( editorStore );\n\tconst [ isModalOpen, setIsModalOpen ] = useState( false );\n\tconst [ syncType, setSyncType ] = useState( undefined );\n\tconst [ title, setTitle ] = useState( '' );\n\n\tconst { postType, isNewPost } = useSelect( ( select ) => {\n\t\tconst { getEditedPostAttribute, isCleanNewPost } =\n\t\t\tselect( editorStore );\n\t\treturn {\n\t\t\tpostType: getEditedPostAttribute( 'type' ),\n\t\t\tisNewPost: isCleanNewPost(),\n\t\t};\n\t}, [] );\n\n\tuseEffect( () => {\n\t\tif ( isNewPost && postType === 'wp_block' ) {\n\t\t\tsetIsModalOpen( true );\n\t\t}\n\t\t// We only want the modal to open when the page is first loaded.\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t}, [] );\n\n\tif ( postType !== 'wp_block' || ! isNewPost ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t{ isModalOpen && (\n\t\t\t\t<Modal\n\t\t\t\t\ttitle={ __( 'Create pattern' ) }\n\t\t\t\t\tonRequestClose={ () => {\n\t\t\t\t\t\tsetIsModalOpen( false );\n\t\t\t\t\t} }\n\t\t\t\t\toverlayClassName=\"reusable-blocks-menu-items__convert-modal\"\n\t\t\t\t>\n\t\t\t\t\t<form\n\t\t\t\t\t\tonSubmit={ ( event ) => {\n\t\t\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\t\t\tsetIsModalOpen( false );\n\t\t\t\t\t\t\teditPost( {\n\t\t\t\t\t\t\t\ttitle,\n\t\t\t\t\t\t\t\tmeta: {\n\t\t\t\t\t\t\t\t\twp_pattern_sync_status: syncType,\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t} }\n\t\t\t\t\t>\n\t\t\t\t\t\t<VStack spacing=\"5\">\n\t\t\t\t\t\t\t<TextControl\n\t\t\t\t\t\t\t\tlabel={ __( 'Name' ) }\n\t\t\t\t\t\t\t\tvalue={ title }\n\t\t\t\t\t\t\t\tonChange={ setTitle }\n\t\t\t\t\t\t\t\tplaceholder={ __( 'My pattern' ) }\n\t\t\t\t\t\t\t\tclassName=\"patterns-create-modal__name-input\"\n\t\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<ReusableBlocksRenameHint />\n\t\t\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t\t\tlabel={ _x(\n\t\t\t\t\t\t\t\t\t'Synced',\n\t\t\t\t\t\t\t\t\t'Option that makes an individual pattern synchronized'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\thelp={ __(\n\t\t\t\t\t\t\t\t\t'Sync this pattern across multiple locations.'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\tchecked={ ! syncType }\n\t\t\t\t\t\t\t\tonChange={ () => {\n\t\t\t\t\t\t\t\t\tsetSyncType(\n\t\t\t\t\t\t\t\t\t\t! syncType ? 'unsynced' : undefined\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/>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;IACrB0B,WAAW,EAAG,IAAAd,QAAE,EAAE,YAAa,CAAG;IAClCe,SAAS,EAAC,mCAAmC;IAC7CC,uBAAuB;IACvBC,qBAAqB;EAAA,CACrB,CAAC,EACF,IAAArB,MAAA,CAAAC,aAAA,EAACvB,wBAAwB,MAAE,CAAC,EAC5B,IAAAsB,MAAA,CAAAC,aAAA,EAAC5B,WAAA,CAAAiD,aAAa;IACbP,KAAK,EAAG,IAAAQ,QAAE,EACT,QAAQ,EACR,sDACD,CAAG;IACHC,IAAI,EAAG,IAAApB,QAAE,EACR,8CACD,CAAG;IACHqB,OAAO,EAAG,CAAErC,QAAU;IACtB6B,QAAQ,EAAGA,CAAA,KAAM;MAChB5B,WAAW,CACV,CAAED,QAAQ,GAAG,UAAU,GAAGE,SAC3B,CAAC;IACF;EAAG,CACH,CAAC,EACF,IAAAU,MAAA,CAAAC,aAAA,EAAC5B,WAAA,CAAAqD,oBAAM;IAACC,OAAO,EAAC;EAAO,GACtB,IAAA3B,MAAA,CAAAC,aAAA,EAAC5B,WAAA,CAAAuD,MAAM;IACNC,OAAO,EAAC,SAAS;IACjBC,IAAI,EAAC,QAAQ;IACbC,QAAQ,EAAG,CAAExC,KAAO;IACpByC,yBAAyB;EAAA,GAEvB,IAAA5B,QAAE,EAAE,QAAS,CACR,CACD,CACD,CACH,CACA,CAEP,CAAC;AAEL"}
1
+ {"version":3,"names":["_data","require","_i18n","_components","_element","_editor","_blockEditor","_lockUnlock","ReusableBlocksRenameHint","unlock","blockEditorPrivateApis","InitPatternModal","editPost","useDispatch","editorStore","isModalOpen","setIsModalOpen","useState","syncType","setSyncType","undefined","title","setTitle","postType","isNewPost","useSelect","select","getEditedPostAttribute","isCleanNewPost","useEffect","_react","createElement","Fragment","Modal","__","onRequestClose","overlayClassName","onSubmit","event","preventDefault","meta","wp_pattern_sync_status","__experimentalVStack","spacing","TextControl","label","value","onChange","placeholder","className","__nextHasNoMarginBottom","__next40pxDefaultSize","ToggleControl","_x","help","checked","__experimentalHStack","justify","Button","variant","type","disabled","__experimentalIsFocusable"],"sources":["@wordpress/edit-post/src/components/init-pattern-modal/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { __, _x } from '@wordpress/i18n';\nimport {\n\tModal,\n\tButton,\n\t__experimentalHStack as HStack,\n\t__experimentalVStack as VStack,\n\tToggleControl,\n\tTextControl,\n} from '@wordpress/components';\nimport { useEffect, useState } from '@wordpress/element';\nimport { store as editorStore } from '@wordpress/editor';\nimport { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\n\nimport { unlock } from '../../lock-unlock';\n\nconst { ReusableBlocksRenameHint } = unlock( blockEditorPrivateApis );\n\nexport default function InitPatternModal() {\n\tconst { editPost } = useDispatch( editorStore );\n\tconst [ isModalOpen, setIsModalOpen ] = useState( false );\n\tconst [ syncType, setSyncType ] = useState( undefined );\n\tconst [ title, setTitle ] = useState( '' );\n\n\tconst { postType, isNewPost } = useSelect( ( select ) => {\n\t\tconst { getEditedPostAttribute, isCleanNewPost } =\n\t\t\tselect( editorStore );\n\t\treturn {\n\t\t\tpostType: getEditedPostAttribute( 'type' ),\n\t\t\tisNewPost: isCleanNewPost(),\n\t\t};\n\t}, [] );\n\n\tuseEffect( () => {\n\t\tif ( isNewPost && postType === 'wp_block' ) {\n\t\t\tsetIsModalOpen( true );\n\t\t}\n\t\t// We only want the modal to open when the page is first loaded.\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t}, [] );\n\n\tif ( postType !== 'wp_block' || ! isNewPost ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t{ isModalOpen && (\n\t\t\t\t<Modal\n\t\t\t\t\ttitle={ __( 'Create pattern' ) }\n\t\t\t\t\tonRequestClose={ () => {\n\t\t\t\t\t\tsetIsModalOpen( false );\n\t\t\t\t\t} }\n\t\t\t\t\toverlayClassName=\"reusable-blocks-menu-items__convert-modal\"\n\t\t\t\t>\n\t\t\t\t\t<form\n\t\t\t\t\t\tonSubmit={ ( event ) => {\n\t\t\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\t\t\tsetIsModalOpen( false );\n\t\t\t\t\t\t\teditPost( {\n\t\t\t\t\t\t\t\ttitle,\n\t\t\t\t\t\t\t\tmeta: {\n\t\t\t\t\t\t\t\t\twp_pattern_sync_status: syncType,\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t} }\n\t\t\t\t\t>\n\t\t\t\t\t\t<VStack spacing=\"5\">\n\t\t\t\t\t\t\t<TextControl\n\t\t\t\t\t\t\t\tlabel={ __( 'Name' ) }\n\t\t\t\t\t\t\t\tvalue={ title }\n\t\t\t\t\t\t\t\tonChange={ setTitle }\n\t\t\t\t\t\t\t\tplaceholder={ __( 'My pattern' ) }\n\t\t\t\t\t\t\t\tclassName=\"patterns-create-modal__name-input\"\n\t\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<ReusableBlocksRenameHint />\n\t\t\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t\t\tlabel={ _x(\n\t\t\t\t\t\t\t\t\t'Synced',\n\t\t\t\t\t\t\t\t\t'Option that makes an individual pattern synchronized'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\thelp={ __(\n\t\t\t\t\t\t\t\t\t'Sync this pattern across multiple locations.'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\tchecked={ ! syncType }\n\t\t\t\t\t\t\t\tonChange={ () => {\n\t\t\t\t\t\t\t\t\tsetSyncType(\n\t\t\t\t\t\t\t\t\t\t! syncType ? 'unsynced' : undefined\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/>\n\t\t\t\t\t\t\t<HStack justify=\"right\">\n\t\t\t\t\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CAAG;IAClCe,SAAS,EAAC,mCAAmC;IAC7CC,uBAAuB;IACvBC,qBAAqB;EAAA,CACrB,CAAC,EACF,IAAArB,MAAA,CAAAC,aAAA,EAACvB,wBAAwB,MAAE,CAAC,EAC5B,IAAAsB,MAAA,CAAAC,aAAA,EAAC5B,WAAA,CAAAiD,aAAa;IACbP,KAAK,EAAG,IAAAQ,QAAE,EACT,QAAQ,EACR,sDACD,CAAG;IACHC,IAAI,EAAG,IAAApB,QAAE,EACR,8CACD,CAAG;IACHqB,OAAO,EAAG,CAAErC,QAAU;IACtB6B,QAAQ,EAAGA,CAAA,KAAM;MAChB5B,WAAW,CACV,CAAED,QAAQ,GAAG,UAAU,GAAGE,SAC3B,CAAC;IACF;EAAG,CACH,CAAC,EACF,IAAAU,MAAA,CAAAC,aAAA,EAAC5B,WAAA,CAAAqD,oBAAM;IAACC,OAAO,EAAC;EAAO,GACtB,IAAA3B,MAAA,CAAAC,aAAA,EAAC5B,WAAA,CAAAuD,MAAM;IACNC,OAAO,EAAC,SAAS;IACjBC,IAAI,EAAC,QAAQ;IACbC,QAAQ,EAAG,CAAExC,KAAO;IACpByC,yBAAyB;EAAA,GAEvB,IAAA5B,QAAE,EAAE,QAAS,CACR,CACD,CACD,CACH,CACA,CAEP,CAAC;AAEL","ignoreList":[]}
@@ -8,8 +8,6 @@ var _element = require("@wordpress/element");
8
8
  var _data = require("@wordpress/data");
9
9
  var _keyboardShortcuts = require("@wordpress/keyboard-shortcuts");
10
10
  var _i18n = require("@wordpress/i18n");
11
- var _blockEditor = require("@wordpress/block-editor");
12
- var _blocks = require("@wordpress/blocks");
13
11
  var _store = require("../../store");
14
12
  /**
15
13
  * WordPress dependencies
@@ -21,47 +19,11 @@ var _store = require("../../store");
21
19
 
22
20
  function KeyboardShortcuts() {
23
21
  const {
24
- isEditorSidebarOpened
25
- } = (0, _data.useSelect)(_store.store);
26
- const {
27
- openGeneralSidebar,
28
- closeGeneralSidebar,
29
22
  toggleFeature
30
23
  } = (0, _data.useDispatch)(_store.store);
31
24
  const {
32
25
  registerShortcut
33
26
  } = (0, _data.useDispatch)(_keyboardShortcuts.store);
34
- const {
35
- replaceBlocks
36
- } = (0, _data.useDispatch)(_blockEditor.store);
37
- const {
38
- getBlockName,
39
- getSelectedBlockClientId,
40
- getBlockAttributes,
41
- getBlockSelectionStart
42
- } = (0, _data.useSelect)(_blockEditor.store);
43
- const handleTextLevelShortcut = (event, level) => {
44
- event.preventDefault();
45
- const destinationBlockName = level === 0 ? 'core/paragraph' : 'core/heading';
46
- const currentClientId = getSelectedBlockClientId();
47
- if (currentClientId === null) {
48
- return;
49
- }
50
- const blockName = getBlockName(currentClientId);
51
- if (blockName !== 'core/paragraph' && blockName !== 'core/heading') {
52
- return;
53
- }
54
- const attributes = getBlockAttributes(currentClientId);
55
- const textAlign = blockName === 'core/paragraph' ? 'align' : 'textAlign';
56
- const destinationTextAlign = destinationBlockName === 'core/paragraph' ? 'align' : 'textAlign';
57
- replaceBlocks(currentClientId, (0, _blocks.createBlock)(destinationBlockName, {
58
- level,
59
- content: attributes.content,
60
- ...{
61
- [destinationTextAlign]: attributes[textAlign]
62
- }
63
- }));
64
- };
65
27
  (0, _element.useEffect)(() => {
66
28
  registerShortcut({
67
29
  name: 'core/edit-post/toggle-fullscreen',
@@ -72,95 +34,10 @@ function KeyboardShortcuts() {
72
34
  character: 'f'
73
35
  }
74
36
  });
75
- registerShortcut({
76
- name: 'core/edit-post/toggle-sidebar',
77
- category: 'global',
78
- description: (0, _i18n.__)('Show or hide the Settings sidebar.'),
79
- keyCombination: {
80
- modifier: 'primaryShift',
81
- character: ','
82
- }
83
- });
84
- registerShortcut({
85
- name: 'core/edit-post/next-region',
86
- category: 'global',
87
- description: (0, _i18n.__)('Navigate to the next part of the editor.'),
88
- keyCombination: {
89
- modifier: 'ctrl',
90
- character: '`'
91
- },
92
- aliases: [{
93
- modifier: 'access',
94
- character: 'n'
95
- }]
96
- });
97
- registerShortcut({
98
- name: 'core/edit-post/previous-region',
99
- category: 'global',
100
- description: (0, _i18n.__)('Navigate to the previous part of the editor.'),
101
- keyCombination: {
102
- modifier: 'ctrlShift',
103
- character: '`'
104
- },
105
- aliases: [{
106
- modifier: 'access',
107
- character: 'p'
108
- }, {
109
- modifier: 'ctrlShift',
110
- character: '~'
111
- }]
112
- });
113
- registerShortcut({
114
- name: 'core/edit-post/keyboard-shortcuts',
115
- category: 'main',
116
- description: (0, _i18n.__)('Display these keyboard shortcuts.'),
117
- keyCombination: {
118
- modifier: 'access',
119
- character: 'h'
120
- }
121
- });
122
- registerShortcut({
123
- name: 'core/edit-post/transform-heading-to-paragraph',
124
- category: 'block-library',
125
- description: (0, _i18n.__)('Transform heading to paragraph.'),
126
- keyCombination: {
127
- modifier: 'access',
128
- character: `0`
129
- }
130
- });
131
- [1, 2, 3, 4, 5, 6].forEach(level => {
132
- registerShortcut({
133
- name: `core/edit-post/transform-paragraph-to-heading-${level}`,
134
- category: 'block-library',
135
- description: (0, _i18n.__)('Transform paragraph to heading.'),
136
- keyCombination: {
137
- modifier: 'access',
138
- character: `${level}`
139
- }
140
- });
141
- });
142
37
  }, []);
143
38
  (0, _keyboardShortcuts.useShortcut)('core/edit-post/toggle-fullscreen', () => {
144
39
  toggleFeature('fullscreenMode');
145
40
  });
146
- (0, _keyboardShortcuts.useShortcut)('core/edit-post/toggle-sidebar', event => {
147
- // This shortcut has no known clashes, but use preventDefault to prevent any
148
- // obscure shortcuts from triggering.
149
- event.preventDefault();
150
- if (isEditorSidebarOpened()) {
151
- closeGeneralSidebar();
152
- } else {
153
- const sidebarToOpen = getBlockSelectionStart() ? 'edit-post/block' : 'edit-post/document';
154
- openGeneralSidebar(sidebarToOpen);
155
- }
156
- });
157
- (0, _keyboardShortcuts.useShortcut)('core/edit-post/transform-heading-to-paragraph', event => handleTextLevelShortcut(event, 0));
158
- [1, 2, 3, 4, 5, 6].forEach(level => {
159
- //the loop is based off on a constant therefore
160
- //the hook will execute the same way every time
161
- //eslint-disable-next-line react-hooks/rules-of-hooks
162
- (0, _keyboardShortcuts.useShortcut)(`core/edit-post/transform-paragraph-to-heading-${level}`, event => handleTextLevelShortcut(event, level));
163
- });
164
41
  return null;
165
42
  }
166
43
  var _default = exports.default = KeyboardShortcuts;