@wordpress/editor 13.33.0 → 13.34.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (303) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/README.md +132 -20
  3. package/build/components/autosave-monitor/index.js +15 -12
  4. package/build/components/autosave-monitor/index.js.map +1 -1
  5. package/build/components/character-count/index.js +5 -0
  6. package/build/components/character-count/index.js.map +1 -1
  7. package/build/components/collapsible-block-toolbar/index.js +73 -0
  8. package/build/components/collapsible-block-toolbar/index.js.map +1 -0
  9. package/build/components/document-outline/check.js +8 -0
  10. package/build/components/document-outline/check.js.map +1 -1
  11. package/build/components/document-outline/index.js +11 -0
  12. package/build/components/document-outline/index.js.map +1 -1
  13. package/build/components/document-tools/index.js +0 -7
  14. package/build/components/document-tools/index.js.map +1 -1
  15. package/build/components/editor-canvas/edit-template-blocks-notification.js +1 -1
  16. package/build/components/editor-canvas/edit-template-blocks-notification.js.map +1 -1
  17. package/build/components/editor-history/redo.js +11 -0
  18. package/build/components/editor-history/redo.js.map +1 -1
  19. package/build/components/editor-history/undo.js +11 -0
  20. package/build/components/editor-history/undo.js.map +1 -1
  21. package/build/components/editor-snackbars/index.js +6 -0
  22. package/build/components/editor-snackbars/index.js.map +1 -1
  23. package/build/components/global-keyboard-shortcuts/index.js +7 -0
  24. package/build/components/global-keyboard-shortcuts/index.js.map +1 -1
  25. package/build/components/global-keyboard-shortcuts/register-shortcuts.js +34 -0
  26. package/build/components/global-keyboard-shortcuts/register-shortcuts.js.map +1 -1
  27. package/build/components/inserter-sidebar/index.js +1 -4
  28. package/build/components/inserter-sidebar/index.js.map +1 -1
  29. package/build/components/keyboard-shortcut-help-modal/config.js +4 -0
  30. package/build/components/keyboard-shortcut-help-modal/config.js.map +1 -1
  31. package/build/components/list-view-sidebar/index.js +1 -1
  32. package/build/components/list-view-sidebar/index.js.map +1 -1
  33. package/build/components/more-menu/copy-content-menu-item.js +59 -0
  34. package/build/components/more-menu/copy-content-menu-item.js.map +1 -0
  35. package/build/components/more-menu/index.js +119 -0
  36. package/build/components/more-menu/index.js.map +1 -0
  37. package/build/components/more-menu/tools-more-menu-group.js +23 -0
  38. package/build/components/more-menu/tools-more-menu-group.js.map +1 -0
  39. package/build/components/more-menu/view-more-menu-group.js +24 -0
  40. package/build/components/more-menu/view-more-menu-group.js.map +1 -0
  41. package/build/components/page-attributes/check.js +8 -0
  42. package/build/components/page-attributes/check.js.map +1 -1
  43. package/build/components/page-attributes/order.js +7 -0
  44. package/build/components/page-attributes/order.js.map +1 -1
  45. package/build/components/page-attributes/panel.js +14 -8
  46. package/build/components/page-attributes/panel.js.map +1 -1
  47. package/build/components/page-attributes/parent.js +7 -0
  48. package/build/components/page-attributes/parent.js.map +1 -1
  49. package/build/components/plugin-post-publish-panel/index.js +1 -1
  50. package/build/components/plugin-post-publish-panel/index.js.map +1 -1
  51. package/build/components/plugin-pre-publish-panel/index.js +1 -1
  52. package/build/components/plugin-pre-publish-panel/index.js.map +1 -1
  53. package/build/components/plugin-sidebar/index.js +1 -1
  54. package/build/components/plugin-sidebar/index.js.map +1 -1
  55. package/build/components/post-actions/actions.js +100 -5
  56. package/build/components/post-actions/actions.js.map +1 -1
  57. package/build/components/post-actions/index.js +30 -7
  58. package/build/components/post-actions/index.js.map +1 -1
  59. package/build/components/post-author/check.js +9 -0
  60. package/build/components/post-author/check.js.map +1 -1
  61. package/build/components/post-author/index.js +6 -0
  62. package/build/components/post-author/index.js.map +1 -1
  63. package/build/components/post-author/panel.js +5 -0
  64. package/build/components/post-author/panel.js.map +1 -1
  65. package/build/components/post-card-panel/index.js +14 -49
  66. package/build/components/post-card-panel/index.js.map +1 -1
  67. package/build/components/post-content-information/index.js +72 -0
  68. package/build/components/post-content-information/index.js.map +1 -0
  69. package/build/components/post-discussion/panel.js +9 -7
  70. package/build/components/post-discussion/panel.js.map +1 -1
  71. package/build/components/post-excerpt/check.js +0 -19
  72. package/build/components/post-excerpt/check.js.map +1 -1
  73. package/build/components/post-excerpt/index.js +52 -12
  74. package/build/components/post-excerpt/index.js.map +1 -1
  75. package/build/components/post-excerpt/panel.js +118 -7
  76. package/build/components/post-excerpt/panel.js.map +1 -1
  77. package/build/components/post-excerpt/plugin.js +2 -2
  78. package/build/components/post-excerpt/plugin.js.map +1 -1
  79. package/build/components/post-featured-image/index.js +1 -1
  80. package/build/components/post-featured-image/index.js.map +1 -1
  81. package/build/components/post-last-edited-panel/index.js +33 -0
  82. package/build/components/post-last-edited-panel/index.js.map +1 -0
  83. package/build/components/post-publish-button/post-publish-button-or-toggle.js +100 -0
  84. package/build/components/post-publish-button/post-publish-button-or-toggle.js.map +1 -0
  85. package/build/components/post-schedule/panel.js +1 -1
  86. package/build/components/post-schedule/panel.js.map +1 -1
  87. package/build/components/post-status/index.js +9 -9
  88. package/build/components/post-status/index.js.map +1 -1
  89. package/build/components/post-template/block-theme.js +2 -2
  90. package/build/components/post-template/block-theme.js.map +1 -1
  91. package/build/components/post-template/classic-theme.js +0 -1
  92. package/build/components/post-template/classic-theme.js.map +1 -1
  93. package/build/components/post-template/swap-template-button.js +2 -5
  94. package/build/components/post-template/swap-template-button.js.map +1 -1
  95. package/build/components/post-url/index.js +2 -1
  96. package/build/components/post-url/index.js.map +1 -1
  97. package/build/components/post-url/panel.js +1 -1
  98. package/build/components/post-url/panel.js.map +1 -1
  99. package/build/components/preferences-modal/enable-publish-sidebar.js +34 -0
  100. package/build/components/preferences-modal/enable-publish-sidebar.js.map +1 -0
  101. package/build/components/preferences-modal/index.js +8 -2
  102. package/build/components/preferences-modal/index.js.map +1 -1
  103. package/build/components/preview-dropdown/index.js +3 -1
  104. package/build/components/preview-dropdown/index.js.map +1 -1
  105. package/build/components/provider/disable-non-page-content-blocks.js +23 -16
  106. package/build/components/provider/disable-non-page-content-blocks.js.map +1 -1
  107. package/build/components/save-publish-panels/index.js +89 -0
  108. package/build/components/save-publish-panels/index.js.map +1 -0
  109. package/build/components/start-page-options/index.js +5 -1
  110. package/build/components/start-page-options/index.js.map +1 -1
  111. package/build/private-apis.js +18 -2
  112. package/build/private-apis.js.map +1 -1
  113. package/build/store/selectors.js +3 -1
  114. package/build/store/selectors.js.map +1 -1
  115. package/build-module/components/autosave-monitor/index.js +15 -13
  116. package/build-module/components/autosave-monitor/index.js.map +1 -1
  117. package/build-module/components/character-count/index.js +6 -0
  118. package/build-module/components/character-count/index.js.map +1 -1
  119. package/build-module/components/collapsible-block-toolbar/index.js +65 -0
  120. package/build-module/components/collapsible-block-toolbar/index.js.map +1 -0
  121. package/build-module/components/document-outline/check.js +9 -0
  122. package/build-module/components/document-outline/check.js.map +1 -1
  123. package/build-module/components/document-outline/index.js +11 -0
  124. package/build-module/components/document-outline/index.js.map +1 -1
  125. package/build-module/components/document-tools/index.js +1 -8
  126. package/build-module/components/document-tools/index.js.map +1 -1
  127. package/build-module/components/editor-canvas/edit-template-blocks-notification.js +1 -1
  128. package/build-module/components/editor-canvas/edit-template-blocks-notification.js.map +1 -1
  129. package/build-module/components/editor-history/redo.js +11 -0
  130. package/build-module/components/editor-history/redo.js.map +1 -1
  131. package/build-module/components/editor-history/undo.js +11 -0
  132. package/build-module/components/editor-history/undo.js.map +1 -1
  133. package/build-module/components/editor-snackbars/index.js +6 -0
  134. package/build-module/components/editor-snackbars/index.js.map +1 -1
  135. package/build-module/components/global-keyboard-shortcuts/index.js +8 -0
  136. package/build-module/components/global-keyboard-shortcuts/index.js.map +1 -1
  137. package/build-module/components/global-keyboard-shortcuts/register-shortcuts.js +35 -0
  138. package/build-module/components/global-keyboard-shortcuts/register-shortcuts.js.map +1 -1
  139. package/build-module/components/inserter-sidebar/index.js +2 -5
  140. package/build-module/components/inserter-sidebar/index.js.map +1 -1
  141. package/build-module/components/keyboard-shortcut-help-modal/config.js +4 -0
  142. package/build-module/components/keyboard-shortcut-help-modal/config.js.map +1 -1
  143. package/build-module/components/list-view-sidebar/index.js +1 -1
  144. package/build-module/components/list-view-sidebar/index.js.map +1 -1
  145. package/build-module/components/more-menu/copy-content-menu-item.js +52 -0
  146. package/build-module/components/more-menu/copy-content-menu-item.js.map +1 -0
  147. package/build-module/components/more-menu/index.js +111 -0
  148. package/build-module/components/more-menu/index.js.map +1 -0
  149. package/build-module/components/more-menu/tools-more-menu-group.js +16 -0
  150. package/build-module/components/more-menu/tools-more-menu-group.js.map +1 -0
  151. package/build-module/components/more-menu/view-more-menu-group.js +17 -0
  152. package/build-module/components/more-menu/view-more-menu-group.js.map +1 -0
  153. package/build-module/components/page-attributes/check.js +9 -0
  154. package/build-module/components/page-attributes/check.js.map +1 -1
  155. package/build-module/components/page-attributes/order.js +7 -0
  156. package/build-module/components/page-attributes/order.js.map +1 -1
  157. package/build-module/components/page-attributes/panel.js +13 -6
  158. package/build-module/components/page-attributes/panel.js.map +1 -1
  159. package/build-module/components/page-attributes/parent.js +7 -0
  160. package/build-module/components/page-attributes/parent.js.map +1 -1
  161. package/build-module/components/plugin-post-publish-panel/index.js +1 -1
  162. package/build-module/components/plugin-post-publish-panel/index.js.map +1 -1
  163. package/build-module/components/plugin-pre-publish-panel/index.js +1 -1
  164. package/build-module/components/plugin-pre-publish-panel/index.js.map +1 -1
  165. package/build-module/components/plugin-sidebar/index.js +1 -1
  166. package/build-module/components/plugin-sidebar/index.js.map +1 -1
  167. package/build-module/components/post-actions/actions.js +100 -6
  168. package/build-module/components/post-actions/actions.js.map +1 -1
  169. package/build-module/components/post-actions/index.js +31 -8
  170. package/build-module/components/post-actions/index.js.map +1 -1
  171. package/build-module/components/post-author/check.js +10 -0
  172. package/build-module/components/post-author/check.js.map +1 -1
  173. package/build-module/components/post-author/index.js +6 -0
  174. package/build-module/components/post-author/index.js.map +1 -1
  175. package/build-module/components/post-author/panel.js +6 -0
  176. package/build-module/components/post-author/panel.js.map +1 -1
  177. package/build-module/components/post-card-panel/index.js +16 -51
  178. package/build-module/components/post-card-panel/index.js.map +1 -1
  179. package/build-module/components/post-content-information/index.js +66 -0
  180. package/build-module/components/post-content-information/index.js.map +1 -0
  181. package/build-module/components/post-discussion/panel.js +8 -6
  182. package/build-module/components/post-discussion/panel.js.map +1 -1
  183. package/build-module/components/post-excerpt/check.js +0 -19
  184. package/build-module/components/post-excerpt/check.js.map +1 -1
  185. package/build-module/components/post-excerpt/index.js +52 -11
  186. package/build-module/components/post-excerpt/index.js.map +1 -1
  187. package/build-module/components/post-excerpt/panel.js +118 -8
  188. package/build-module/components/post-excerpt/panel.js.map +1 -1
  189. package/build-module/components/post-excerpt/plugin.js +2 -2
  190. package/build-module/components/post-excerpt/plugin.js.map +1 -1
  191. package/build-module/components/post-featured-image/index.js +1 -1
  192. package/build-module/components/post-featured-image/index.js.map +1 -1
  193. package/build-module/components/post-last-edited-panel/index.js +26 -0
  194. package/build-module/components/post-last-edited-panel/index.js.map +1 -0
  195. package/build-module/components/post-publish-button/post-publish-button-or-toggle.js +91 -0
  196. package/build-module/components/post-publish-button/post-publish-button-or-toggle.js.map +1 -0
  197. package/build-module/components/post-schedule/panel.js +1 -1
  198. package/build-module/components/post-schedule/panel.js.map +1 -1
  199. package/build-module/components/post-status/index.js +9 -9
  200. package/build-module/components/post-status/index.js.map +1 -1
  201. package/build-module/components/post-template/block-theme.js +2 -2
  202. package/build-module/components/post-template/block-theme.js.map +1 -1
  203. package/build-module/components/post-template/classic-theme.js +0 -1
  204. package/build-module/components/post-template/classic-theme.js.map +1 -1
  205. package/build-module/components/post-template/swap-template-button.js +3 -6
  206. package/build-module/components/post-template/swap-template-button.js.map +1 -1
  207. package/build-module/components/post-url/index.js +2 -1
  208. package/build-module/components/post-url/index.js.map +1 -1
  209. package/build-module/components/post-url/panel.js +1 -1
  210. package/build-module/components/post-url/panel.js.map +1 -1
  211. package/build-module/components/preferences-modal/enable-publish-sidebar.js +27 -0
  212. package/build-module/components/preferences-modal/enable-publish-sidebar.js.map +1 -0
  213. package/build-module/components/preferences-modal/index.js +8 -2
  214. package/build-module/components/preferences-modal/index.js.map +1 -1
  215. package/build-module/components/preview-dropdown/index.js +3 -1
  216. package/build-module/components/preview-dropdown/index.js.map +1 -1
  217. package/build-module/components/provider/disable-non-page-content-blocks.js +24 -17
  218. package/build-module/components/provider/disable-non-page-content-blocks.js.map +1 -1
  219. package/build-module/components/save-publish-panels/index.js +80 -0
  220. package/build-module/components/save-publish-panels/index.js.map +1 -0
  221. package/build-module/components/start-page-options/index.js +5 -1
  222. package/build-module/components/start-page-options/index.js.map +1 -1
  223. package/build-module/private-apis.js +18 -2
  224. package/build-module/private-apis.js.map +1 -1
  225. package/build-module/store/selectors.js +3 -1
  226. package/build-module/store/selectors.js.map +1 -1
  227. package/build-style/style-rtl.css +207 -30
  228. package/build-style/style.css +207 -30
  229. package/package.json +35 -35
  230. package/src/components/autosave-monitor/index.js +15 -12
  231. package/src/components/character-count/index.js +5 -0
  232. package/src/components/collapsible-block-toolbar/index.js +77 -0
  233. package/src/components/collapsible-block-toolbar/style.scss +80 -0
  234. package/src/components/document-outline/check.js +8 -0
  235. package/src/components/document-outline/index.js +10 -0
  236. package/src/components/document-tools/index.js +0 -5
  237. package/src/components/editor-canvas/edit-template-blocks-notification.js +1 -1
  238. package/src/components/editor-history/redo.js +10 -0
  239. package/src/components/editor-history/undo.js +10 -0
  240. package/src/components/editor-snackbars/index.js +5 -0
  241. package/src/components/entities-saved-states/style.scss +7 -0
  242. package/src/components/global-keyboard-shortcuts/index.js +7 -0
  243. package/src/components/global-keyboard-shortcuts/register-shortcuts.js +41 -0
  244. package/src/components/inserter-sidebar/index.js +2 -5
  245. package/src/components/keyboard-shortcut-help-modal/config.js +10 -1
  246. package/src/components/list-view-sidebar/index.js +1 -1
  247. package/src/components/list-view-sidebar/style.scss +2 -2
  248. package/src/components/more-menu/copy-content-menu-item.js +51 -0
  249. package/src/components/more-menu/index.js +158 -0
  250. package/src/components/more-menu/tools-more-menu-group.js +11 -0
  251. package/src/components/more-menu/view-more-menu-group.js +13 -0
  252. package/src/components/page-attributes/check.js +8 -0
  253. package/src/components/page-attributes/order.js +6 -0
  254. package/src/components/page-attributes/panel.js +21 -17
  255. package/src/components/page-attributes/parent.js +6 -0
  256. package/src/components/plugin-post-publish-panel/index.js +1 -1
  257. package/src/components/plugin-pre-publish-panel/index.js +1 -1
  258. package/src/components/plugin-sidebar/index.js +1 -1
  259. package/src/components/post-actions/actions.js +120 -5
  260. package/src/components/post-actions/index.js +41 -7
  261. package/src/components/post-author/check.js +9 -0
  262. package/src/components/post-author/index.js +5 -0
  263. package/src/components/post-author/panel.js +5 -0
  264. package/src/components/post-card-panel/index.js +27 -82
  265. package/src/components/post-card-panel/style.scss +2 -6
  266. package/src/components/post-content-information/index.js +83 -0
  267. package/src/components/post-content-information/style.scss +6 -0
  268. package/src/components/post-discussion/panel.js +24 -20
  269. package/src/components/post-excerpt/check.js +0 -18
  270. package/src/components/post-excerpt/index.js +66 -15
  271. package/src/components/post-excerpt/panel.js +196 -19
  272. package/src/components/post-excerpt/plugin.js +2 -2
  273. package/src/components/post-excerpt/style.scss +24 -0
  274. package/src/components/post-featured-image/index.js +1 -1
  275. package/src/components/post-featured-image/style.scss +2 -8
  276. package/src/components/post-last-edited-panel/index.js +35 -0
  277. package/src/components/post-last-edited-panel/style.scss +6 -0
  278. package/src/components/post-panel-row/style.scss +3 -3
  279. package/src/components/post-publish-button/post-publish-button-or-toggle.js +102 -0
  280. package/src/components/post-publish-button/test/post-publish-button-or-toggle.js +63 -0
  281. package/src/components/post-publish-panel/style.scss +43 -0
  282. package/src/components/post-publish-panel/test/__snapshots__/index.js.snap +225 -75
  283. package/src/components/post-schedule/panel.js +1 -1
  284. package/src/components/post-schedule/style.scss +2 -4
  285. package/src/components/post-status/index.js +84 -76
  286. package/src/components/post-status/style.scss +0 -1
  287. package/src/components/post-template/block-theme.js +2 -2
  288. package/src/components/post-template/classic-theme.js +0 -1
  289. package/src/components/post-template/swap-template-button.js +3 -6
  290. package/src/components/post-text-editor/style.scss +1 -1
  291. package/src/components/post-title/style.scss +1 -1
  292. package/src/components/post-url/index.js +1 -0
  293. package/src/components/post-url/panel.js +1 -1
  294. package/src/components/preferences-modal/enable-publish-sidebar.js +28 -0
  295. package/src/components/preferences-modal/index.js +14 -0
  296. package/src/components/preview-dropdown/index.js +3 -1
  297. package/src/components/provider/disable-non-page-content-blocks.js +23 -21
  298. package/src/components/save-publish-panels/index.js +96 -0
  299. package/src/components/save-publish-panels/style.scss +36 -0
  300. package/src/components/start-page-options/index.js +6 -1
  301. package/src/private-apis.js +18 -2
  302. package/src/store/selectors.js +3 -1
  303. package/src/style.scss +4 -0
@@ -0,0 +1 @@
1
+ {"version":3,"names":["classnames","BlockToolbar","store","blockEditorStore","privateApis","blockEditorPrivateApis","useEffect","Button","Popover","__","next","previous","useSelect","unlock","useHasBlockToolbar","CollapsableBlockToolbar","isCollapsed","onToggle","blockSelectionStart","select","getBlockSelectionStart","hasBlockToolbar","hasBlockSelection","createElement","Fragment","className","hideDragHandle","Slot","name","icon","onClick","label","size"],"sources":["@wordpress/editor/src/components/collapsible-block-toolbar/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tBlockToolbar,\n\tstore as blockEditorStore,\n\tprivateApis as blockEditorPrivateApis,\n} from '@wordpress/block-editor';\nimport { useEffect } from '@wordpress/element';\nimport { Button, Popover } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { next, previous } from '@wordpress/icons';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\n\nconst { useHasBlockToolbar } = unlock( blockEditorPrivateApis );\n\nfunction CollapsableBlockToolbar( { isCollapsed, onToggle } ) {\n\tconst { blockSelectionStart } = useSelect( ( select ) => {\n\t\treturn {\n\t\t\tblockSelectionStart:\n\t\t\t\tselect( blockEditorStore ).getBlockSelectionStart(),\n\t\t};\n\t}, [] );\n\tconst hasBlockToolbar = useHasBlockToolbar();\n\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\tonToggle( false );\n\t\t}\n\t}, [ blockSelectionStart, onToggle ] );\n\n\tif ( ! hasBlockToolbar ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<div\n\t\t\t\tclassName={ classnames( 'editor-collapsible-block-toolbar', {\n\t\t\t\t\t'is-collapsed': isCollapsed || ! hasBlockSelection,\n\t\t\t\t} ) }\n\t\t\t>\n\t\t\t\t<BlockToolbar hideDragHandle />\n\t\t\t</div>\n\t\t\t<Popover.Slot name=\"block-toolbar\" />\n\n\t\t\t<Button\n\t\t\t\tclassName=\"editor-collapsible-block-toolbar__toggle\"\n\t\t\t\ticon={ isCollapsed ? next : previous }\n\t\t\t\tonClick={ () => {\n\t\t\t\t\tonToggle( ! isCollapsed );\n\t\t\t\t} }\n\t\t\t\tlabel={\n\t\t\t\t\tisCollapsed\n\t\t\t\t\t\t? __( 'Show block tools' )\n\t\t\t\t\t\t: __( 'Hide block tools' )\n\t\t\t\t}\n\t\t\t\tsize=\"compact\"\n\t\t\t/>\n\t\t</>\n\t);\n}\n\nexport default CollapsableBlockToolbar;\n"],"mappings":";AAAA;AACA;AACA;AACA,OAAOA,UAAU,MAAM,YAAY;;AAEnC;AACA;AACA;AACA,SACCC,YAAY,EACZC,KAAK,IAAIC,gBAAgB,EACzBC,WAAW,IAAIC,sBAAsB,QAC/B,yBAAyB;AAChC,SAASC,SAAS,QAAQ,oBAAoB;AAC9C,SAASC,MAAM,EAAEC,OAAO,QAAQ,uBAAuB;AACvD,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SAASC,IAAI,EAAEC,QAAQ,QAAQ,kBAAkB;AACjD,SAASC,SAAS,QAAQ,iBAAiB;;AAE3C;AACA;AACA;AACA,SAASC,MAAM,QAAQ,mBAAmB;AAE1C,MAAM;EAAEC;AAAmB,CAAC,GAAGD,MAAM,CAAER,sBAAuB,CAAC;AAE/D,S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
3
  */
4
4
  import { useSelect } from '@wordpress/data';
5
5
  import { store as blockEditorStore } from '@wordpress/block-editor';
6
+
7
+ /**
8
+ * Component check if there are any headings (core/heading blocks) present in the document.
9
+ *
10
+ * @param {Object} props Props.
11
+ * @param {Element} props.children Children to be rendered.
12
+ *
13
+ * @return {Component|null} The component to be rendered or null if there are headings.
14
+ */
6
15
  export default function DocumentOutlineCheck({
7
16
  children
8
17
  }) {
@@ -1 +1 @@
1
- {"version":3,"names":["useSelect","store","blockEditorStore","DocumentOutlineCheck","children","hasHeadings","select","getGlobalBlockCount"],"sources":["@wordpress/editor/src/components/document-outline/check.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\n\nexport default function DocumentOutlineCheck( { children } ) {\n\tconst hasHeadings = useSelect( ( select ) => {\n\t\tconst { getGlobalBlockCount } = select( blockEditorStore );\n\n\t\treturn getGlobalBlockCount( 'core/heading' ) > 0;\n\t} );\n\n\tif ( hasHeadings ) {\n\t\treturn null;\n\t}\n\n\treturn children;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,KAAK,IAAIC,gBAAgB,QAAQ,yBAAyB;AAEnE,eAAe,SAASC,oBAAoBA,CAAE;EAAEC;AAAS,CAAC,EAAG;EAC5D,MAAMC,WAAW,GAAGL,SAAS,CAAIM,MAAM,IAAM;IAC5C,MAAM;MAAEC;IAAoB,CAAC,GAAGD,MAAM,CAAEJ,gBAAiB,CAAC;IAE1D,OAAOK,mBAAmB,CAAE,cAAe,CAAC,GAAG,CAAC;EACjD,CAAE,CAAC;EAEH,IAAKF,WAAW,EAAG;IAClB,OAAO,IAAI;EACZ;EAEA,OAAOD,QAAQ;AAChB","ignoreList":[]}
1
+ {"version":3,"names":["useSelect","store","blockEditorStore","DocumentOutlineCheck","children","hasHeadings","select","getGlobalBlockCount"],"sources":["@wordpress/editor/src/components/document-outline/check.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\n\n/**\n * Component check if there are any headings (core/heading blocks) present in the document.\n *\n * @param {Object} props Props.\n * @param {Element} props.children Children to be rendered.\n *\n * @return {Component|null} The component to be rendered or null if there are headings.\n */\nexport default function DocumentOutlineCheck( { children } ) {\n\tconst hasHeadings = useSelect( ( select ) => {\n\t\tconst { getGlobalBlockCount } = select( blockEditorStore );\n\n\t\treturn getGlobalBlockCount( 'core/heading' ) > 0;\n\t} );\n\n\tif ( hasHeadings ) {\n\t\treturn null;\n\t}\n\n\treturn children;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,KAAK,IAAIC,gBAAgB,QAAQ,yBAAyB;;AAEnE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,SAASC,oBAAoBA,CAAE;EAAEC;AAAS,CAAC,EAAG;EAC5D,MAAMC,WAAW,GAAGL,SAAS,CAAIM,MAAM,IAAM;IAC5C,MAAM;MAAEC;IAAoB,CAAC,GAAGD,MAAM,CAAEJ,gBAAiB,CAAC;IAE1D,OAAOK,mBAAmB,CAAE,cAAe,CAAC,GAAG,CAAC;EACjD,CAAE,CAAC;EAEH,IAAKF,WAAW,EAAG;IAClB,OAAO,IAAI;EACZ;EAEA,OAAOD,QAAQ;AAChB","ignoreList":[]}
@@ -135,6 +135,17 @@ const computeOutlineHeadings = (blocks = []) => {
135
135
  });
136
136
  };
137
137
  const isEmptyHeading = heading => !heading.attributes.content || heading.attributes.content.trim().length === 0;
138
+
139
+ /**
140
+ * Renders a document outline component.
141
+ *
142
+ * @param {Object} props Props.
143
+ * @param {Function} props.onSelect Function to be called when an outline item is selected.
144
+ * @param {boolean} props.isTitleSupported Indicates whether the title is supported.
145
+ * @param {boolean} props.hasOutlineItemsDisabled Indicates whether the outline items are disabled.
146
+ *
147
+ * @return {Component} The component to be rendered.
148
+ */
138
149
  export default function DocumentOutline({
139
150
  onSelect,
140
151
  isTitleSupported,
@@ -1 +1 @@
1
- {"version":3,"names":["__","useDispatch","useSelect","create","getTextContent","store","blockEditorStore","coreStore","Path","SVG","Line","Rect","DocumentOutlineItem","editorStore","emptyHeadingContent","createElement","incorrectLevelContent","key","singleH1Headings","multipleH1Headings","EmptyOutlineIllustration","width","height","viewBox","fill","xmlns","rx","x1","y1","x2","y2","stroke","x","y","d","computeOutlineHeadings","blocks","flatMap","block","name","level","attributes","isEmpty","isEmptyHeading","innerBlocks","heading","content","trim","length","DocumentOutline","onSelect","isTitleSupported","hasOutlineItemsDisabled","selectBlock","title","select","_postType$supports$ti","getBlocks","getEditedPostAttribute","getPostType","postType","supports","headings","className","prevHeadingLevel","titleNode","document","querySelector","hasTitle","countByLevel","reduce","acc","hasMultipleH1","isValid","href","id","isDisabled","map","item","index","isIncorrectLevel","clientId","html"],"sources":["@wordpress/editor/src/components/document-outline/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { create, getTextContent } from '@wordpress/rich-text';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { Path, SVG, Line, Rect } from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport DocumentOutlineItem from './item';\nimport { store as editorStore } from '../../store';\n\n/**\n * Module constants\n */\nconst emptyHeadingContent = <em>{ __( '(Empty heading)' ) }</em>;\nconst incorrectLevelContent = [\n\t<br key=\"incorrect-break\" />,\n\t<em key=\"incorrect-message\">{ __( '(Incorrect heading level)' ) }</em>,\n];\nconst singleH1Headings = [\n\t<br key=\"incorrect-break-h1\" />,\n\t<em key=\"incorrect-message-h1\">\n\t\t{ __( '(Your theme may already use a H1 for the post title)' ) }\n\t</em>,\n];\nconst multipleH1Headings = [\n\t<br key=\"incorrect-break-multiple-h1\" />,\n\t<em key=\"incorrect-message-multiple-h1\">\n\t\t{ __( '(Multiple H1 headings are not recommended)' ) }\n\t</em>,\n];\nfunction EmptyOutlineIllustration() {\n\treturn (\n\t\t<SVG\n\t\t\twidth=\"138\"\n\t\t\theight=\"148\"\n\t\t\tviewBox=\"0 0 138 148\"\n\t\t\tfill=\"none\"\n\t\t\txmlns=\"http://www.w3.org/2000/svg\"\n\t\t>\n\t\t\t<Rect width=\"138\" height=\"148\" rx=\"4\" fill=\"#F0F6FC\" />\n\t\t\t<Line x1=\"44\" y1=\"28\" x2=\"24\" y2=\"28\" stroke=\"#DDDDDD\" />\n\t\t\t<Rect x=\"48\" y=\"16\" width=\"27\" height=\"23\" rx=\"4\" fill=\"#DDDDDD\" />\n\t\t\t<Path\n\t\t\t\td=\"M54.7585 32V23.2727H56.6037V26.8736H60.3494V23.2727H62.1903V32H60.3494V28.3949H56.6037V32H54.7585ZM67.4574 23.2727V32H65.6122V25.0241H65.5611L63.5625 26.277V24.6406L65.723 23.2727H67.4574Z\"\n\t\t\t\tfill=\"black\"\n\t\t\t/>\n\t\t\t<Line x1=\"55\" y1=\"59\" x2=\"24\" y2=\"59\" stroke=\"#DDDDDD\" />\n\t\t\t<Rect x=\"59\" y=\"47\" width=\"29\" height=\"23\" rx=\"4\" fill=\"#DDDDDD\" />\n\t\t\t<Path\n\t\t\t\td=\"M65.7585 63V54.2727H67.6037V57.8736H71.3494V54.2727H73.1903V63H71.3494V59.3949H67.6037V63H65.7585ZM74.6605 63V61.6705L77.767 58.794C78.0313 58.5384 78.2528 58.3082 78.4318 58.1037C78.6136 57.8991 78.7514 57.6989 78.8452 57.5028C78.9389 57.304 78.9858 57.0895 78.9858 56.8594C78.9858 56.6037 78.9276 56.3835 78.8111 56.1989C78.6946 56.0114 78.5355 55.8679 78.3338 55.7685C78.1321 55.6662 77.9034 55.6151 77.6477 55.6151C77.3807 55.6151 77.1477 55.669 76.9489 55.777C76.75 55.8849 76.5966 56.0398 76.4886 56.2415C76.3807 56.4432 76.3267 56.6832 76.3267 56.9616H74.5753C74.5753 56.3906 74.7045 55.8949 74.9631 55.4744C75.2216 55.054 75.5838 54.7287 76.0497 54.4986C76.5156 54.2685 77.0526 54.1534 77.6605 54.1534C78.2855 54.1534 78.8295 54.2642 79.2926 54.4858C79.7585 54.7045 80.1207 55.0085 80.3793 55.3977C80.6378 55.7869 80.767 56.233 80.767 56.7358C80.767 57.0653 80.7017 57.3906 80.571 57.7116C80.4432 58.0327 80.2145 58.3892 79.8849 58.7812C79.5554 59.1705 79.0909 59.6378 78.4915 60.1832L77.2173 61.4318V61.4915H80.8821V63H74.6605Z\"\n\t\t\t\tfill=\"black\"\n\t\t\t/>\n\t\t\t<Line x1=\"80\" y1=\"90\" x2=\"24\" y2=\"90\" stroke=\"#DDDDDD\" />\n\t\t\t<Rect x=\"84\" y=\"78\" width=\"30\" height=\"23\" rx=\"4\" fill=\"#F0B849\" />\n\t\t\t<Path\n\t\t\t\td=\"M90.7585 94V85.2727H92.6037V88.8736H96.3494V85.2727H98.1903V94H96.3494V90.3949H92.6037V94H90.7585ZM99.5284 92.4659V91.0128L103.172 85.2727H104.425V87.2841H103.683L101.386 90.919V90.9872H106.564V92.4659H99.5284ZM103.717 94V92.0227L103.751 91.3793V85.2727H105.482V94H103.717Z\"\n\t\t\t\tfill=\"black\"\n\t\t\t/>\n\t\t\t<Line x1=\"66\" y1=\"121\" x2=\"24\" y2=\"121\" stroke=\"#DDDDDD\" />\n\t\t\t<Rect x=\"70\" y=\"109\" width=\"29\" height=\"23\" rx=\"4\" fill=\"#DDDDDD\" />\n\t\t\t<Path\n\t\t\t\td=\"M76.7585 125V116.273H78.6037V119.874H82.3494V116.273H84.1903V125H82.3494V121.395H78.6037V125H76.7585ZM88.8864 125.119C88.25 125.119 87.6832 125.01 87.1861 124.791C86.6918 124.57 86.3011 124.266 86.0142 123.879C85.7301 123.49 85.5838 123.041 85.5753 122.533H87.4332C87.4446 122.746 87.5142 122.933 87.642 123.095C87.7727 123.254 87.946 123.378 88.1619 123.466C88.3778 123.554 88.6207 123.598 88.8906 123.598C89.1719 123.598 89.4205 123.548 89.6364 123.449C89.8523 123.349 90.0213 123.212 90.1435 123.036C90.2656 122.859 90.3267 122.656 90.3267 122.426C90.3267 122.193 90.2614 121.987 90.1307 121.808C90.0028 121.626 89.8182 121.484 89.5767 121.382C89.3381 121.28 89.054 121.229 88.7244 121.229H87.9105V119.874H88.7244C89.0028 119.874 89.2486 119.825 89.4616 119.729C89.6776 119.632 89.8452 119.499 89.9645 119.328C90.0838 119.155 90.1435 118.953 90.1435 118.723C90.1435 118.504 90.0909 118.312 89.9858 118.148C89.8835 117.98 89.7386 117.849 89.5511 117.756C89.3665 117.662 89.1506 117.615 88.9034 117.615C88.6534 117.615 88.4247 117.661 88.2173 117.751C88.0099 117.839 87.8438 117.966 87.7188 118.131C87.5938 118.295 87.527 118.489 87.5185 118.71H85.75C85.7585 118.207 85.902 117.764 86.1804 117.381C86.4588 116.997 86.8338 116.697 87.3054 116.482C87.7798 116.263 88.3153 116.153 88.9119 116.153C89.5142 116.153 90.0412 116.263 90.4929 116.482C90.9446 116.7 91.2955 116.996 91.5455 117.368C91.7983 117.737 91.9233 118.152 91.9205 118.612C91.9233 119.101 91.7713 119.509 91.4645 119.835C91.1605 120.162 90.7642 120.369 90.2756 120.457V120.526C90.9176 120.608 91.4063 120.831 91.7415 121.195C92.0795 121.555 92.2472 122.007 92.2443 122.55C92.2472 123.047 92.1037 123.489 91.8139 123.875C91.527 124.261 91.1307 124.565 90.625 124.787C90.1193 125.009 89.5398 125.119 88.8864 125.119Z\"\n\t\t\t\tfill=\"black\"\n\t\t\t/>\n\t\t</SVG>\n\t);\n}\n\n/**\n * Returns an array of heading blocks enhanced with the following properties:\n * level - An integer with the heading level.\n * isEmpty - Flag indicating if the heading has no content.\n *\n * @param {?Array} blocks An array of blocks.\n *\n * @return {Array} An array of heading blocks enhanced with the properties described above.\n */\nconst computeOutlineHeadings = ( blocks = [] ) => {\n\treturn blocks.flatMap( ( block = {} ) => {\n\t\tif ( block.name === 'core/heading' ) {\n\t\t\treturn {\n\t\t\t\t...block,\n\t\t\t\tlevel: block.attributes.level,\n\t\t\t\tisEmpty: isEmptyHeading( block ),\n\t\t\t};\n\t\t}\n\t\treturn computeOutlineHeadings( block.innerBlocks );\n\t} );\n};\n\nconst isEmptyHeading = ( heading ) =>\n\t! heading.attributes.content ||\n\theading.attributes.content.trim().length === 0;\n\nexport default function DocumentOutline( {\n\tonSelect,\n\tisTitleSupported,\n\thasOutlineItemsDisabled,\n} ) {\n\tconst { selectBlock } = useDispatch( blockEditorStore );\n\tconst { blocks, title } = useSelect( ( select ) => {\n\t\tconst { getBlocks } = select( blockEditorStore );\n\t\tconst { getEditedPostAttribute } = select( editorStore );\n\t\tconst { getPostType } = select( coreStore );\n\t\tconst postType = getPostType( getEditedPostAttribute( 'type' ) );\n\n\t\treturn {\n\t\t\ttitle: getEditedPostAttribute( 'title' ),\n\t\t\tblocks: getBlocks(),\n\t\t\tisTitleSupported: postType?.supports?.title ?? false,\n\t\t};\n\t} );\n\n\tconst headings = computeOutlineHeadings( blocks );\n\tif ( headings.length < 1 ) {\n\t\treturn (\n\t\t\t<div className=\"editor-document-outline has-no-headings\">\n\t\t\t\t<EmptyOutlineIllustration />\n\t\t\t\t<p>\n\t\t\t\t\t{ __(\n\t\t\t\t\t\t'Navigate the structure of your document and address issues like empty or incorrect heading levels.'\n\t\t\t\t\t) }\n\t\t\t\t</p>\n\t\t\t</div>\n\t\t);\n\t}\n\n\tlet prevHeadingLevel = 1;\n\n\t// Not great but it's the simplest way to locate the title right now.\n\tconst titleNode = document.querySelector( '.editor-post-title__input' );\n\tconst hasTitle = isTitleSupported && title && titleNode;\n\tconst countByLevel = headings.reduce(\n\t\t( acc, heading ) => ( {\n\t\t\t...acc,\n\t\t\t[ heading.level ]: ( acc[ heading.level ] || 0 ) + 1,\n\t\t} ),\n\t\t{}\n\t);\n\tconst hasMultipleH1 = countByLevel[ 1 ] > 1;\n\n\treturn (\n\t\t<div className=\"document-outline\">\n\t\t\t<ul>\n\t\t\t\t{ hasTitle && (\n\t\t\t\t\t<DocumentOutlineItem\n\t\t\t\t\t\tlevel={ __( 'Title' ) }\n\t\t\t\t\t\tisValid\n\t\t\t\t\t\tonSelect={ onSelect }\n\t\t\t\t\t\thref={ `#${ titleNode.id }` }\n\t\t\t\t\t\tisDisabled={ hasOutlineItemsDisabled }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ title }\n\t\t\t\t\t</DocumentOutlineItem>\n\t\t\t\t) }\n\t\t\t\t{ headings.map( ( item, index ) => {\n\t\t\t\t\t// Headings remain the same, go up by one, or down by any amount.\n\t\t\t\t\t// Otherwise there are missing levels.\n\t\t\t\t\tconst isIncorrectLevel = item.level > prevHeadingLevel + 1;\n\n\t\t\t\t\tconst isValid =\n\t\t\t\t\t\t! item.isEmpty &&\n\t\t\t\t\t\t! isIncorrectLevel &&\n\t\t\t\t\t\t!! item.level &&\n\t\t\t\t\t\t( item.level !== 1 ||\n\t\t\t\t\t\t\t( ! hasMultipleH1 && ! hasTitle ) );\n\t\t\t\t\tprevHeadingLevel = item.level;\n\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<DocumentOutlineItem\n\t\t\t\t\t\t\tkey={ index }\n\t\t\t\t\t\t\tlevel={ `H${ item.level }` }\n\t\t\t\t\t\t\tisValid={ isValid }\n\t\t\t\t\t\t\tisDisabled={ hasOutlineItemsDisabled }\n\t\t\t\t\t\t\thref={ `#block-${ item.clientId }` }\n\t\t\t\t\t\t\tonSelect={ () => {\n\t\t\t\t\t\t\t\tselectBlock( item.clientId );\n\t\t\t\t\t\t\t\tonSelect?.();\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ item.isEmpty\n\t\t\t\t\t\t\t\t? emptyHeadingContent\n\t\t\t\t\t\t\t\t: getTextContent(\n\t\t\t\t\t\t\t\t\t\tcreate( {\n\t\t\t\t\t\t\t\t\t\t\thtml: item.attributes.content,\n\t\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{ isIncorrectLevel && incorrectLevelContent }\n\t\t\t\t\t\t\t{ item.level === 1 &&\n\t\t\t\t\t\t\t\thasMultipleH1 &&\n\t\t\t\t\t\t\t\tmultipleH1Headings }\n\t\t\t\t\t\t\t{ hasTitle &&\n\t\t\t\t\t\t\t\titem.level === 1 &&\n\t\t\t\t\t\t\t\t! hasMultipleH1 &&\n\t\t\t\t\t\t\t\tsingleH1Headings }\n\t\t\t\t\t\t</DocumentOutlineItem>\n\t\t\t\t\t);\n\t\t\t\t} ) }\n\t\t\t</ul>\n\t\t</div>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,EAAE,QAAQ,iBAAiB;AACpC,SAASC,WAAW,EAAEC,SAAS,QAAQ,iBAAiB;AACxD,SAASC,MAAM,EAAEC,cAAc,QAAQ,sBAAsB;AAC7D,SAASC,KAAK,IAAIC,gBAAgB,QAAQ,yBAAyB;AACnE,SAASD,KAAK,IAAIE,SAAS,QAAQ,sBAAsB;AACzD,SAASC,IAAI,EAAEC,GAAG,EAAEC,IAAI,EAAEC,IAAI,QAAQ,uBAAuB;;AAE7D;AACA;AACA;AACA,OAAOC,mBAAmB,MAAM,QAAQ;AACxC,SAASP,KAAK,IAAIQ,WAAW,QAAQ,aAAa;;AAElD;AACA;AACA;AACA,MAAMC,mBAAmB,GAAGC,aAAA,aAAMf,EAAE,CAAE,iBAAkB,CAAO,CAAC;AAChE,MAAMgB,qBAAqB,GAAG,CAC7BD,aAAA;EAAIE,GAAG,EAAC;AAAiB,CAAE,CAAC,EAC5BF,aAAA;EAAIE,GAAG,EAAC;AAAmB,GAAGjB,EAAE,CAAE,2BAA4B,CAAO,CAAC,CACtE;AACD,MAAMkB,gBAAgB,GAAG,CACxBH,aAAA;EAAIE,GAAG,EAAC;AAAoB,CAAE,CAAC,EAC/BF,aAAA;EAA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OAAO,IACd,CAAEsC,gBAAgB,IAClB,CAAC,CAAEF,IAAI,CAACtC,KAAK,KACXsC,IAAI,CAACtC,KAAK,KAAK,CAAC,IACf,CAAEgC,aAAa,IAAI,CAAEJ,QAAU,CAAE;IACrCJ,gBAAgB,GAAGc,IAAI,CAACtC,KAAK;IAE7B,OACCzB,aAAA,CAACH,mBAAmB;MACnBK,GAAG,EAAG8D,KAAO;MACbvC,KAAK,EAAI,IAAIsC,IAAI,CAACtC,KAAO,EAAG;MAC5BiC,OAAO,EAAGA,OAAS;MACnBG,UAAU,EAAGxB,uBAAyB;MACtCsB,IAAI,EAAI,UAAUI,IAAI,CAACG,QAAU,EAAG;MACpC/B,QAAQ,EAAGA,CAAA,KAAM;QAChBG,WAAW,CAAEyB,IAAI,CAACG,QAAS,CAAC;QAC5B/B,QAAQ,GAAG,CAAC;MACb;IAAG,GAED4B,IAAI,CAACpC,OAAO,GACX5B,mBAAmB,GACnBV,cAAc,CACdD,MAAM,CAAE;MACP+E,IAAI,EAAEJ,IAAI,CAACrC,UAAU,CAACK;IACvB,CAAE,CACF,CAAC,EACFkC,gBAAgB,IAAIhE,qBAAqB,EACzC8D,IAAI,CAACtC,KAAK,KAAK,CAAC,IACjBgC,aAAa,IACbrD,kBAAkB,EACjBiD,QAAQ,IACTU,IAAI,CAACtC,KAAK,KAAK,CAAC,IAChB,CAAEgC,aAAa,IACftD,gBACmB,CAAC;EAExB,CAAE,CACC,CACA,CAAC;AAER","ignoreList":[]}
1
+ {"version":3,"names":["__","useDispatch","useSelect","create","getTextContent","store","blockEditorStore","coreStore","Path","SVG","Line","Rect","DocumentOutlineItem","editorStore","emptyHeadingContent","createElement","incorrectLevelContent","key","singleH1Headings","multipleH1Headings","EmptyOutlineIllustration","width","height","viewBox","fill","xmlns","rx","x1","y1","x2","y2","stroke","x","y","d","computeOutlineHeadings","blocks","flatMap","block","name","level","attributes","isEmpty","isEmptyHeading","innerBlocks","heading","content","trim","length","DocumentOutline","onSelect","isTitleSupported","hasOutlineItemsDisabled","selectBlock","title","select","_postType$supports$ti","getBlocks","getEditedPostAttribute","getPostType","postType","supports","headings","className","prevHeadingLevel","titleNode","document","querySelector","hasTitle","countByLevel","reduce","acc","hasMultipleH1","isValid","href","id","isDisabled","map","item","index","isIncorrectLevel","clientId","html"],"sources":["@wordpress/editor/src/components/document-outline/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { create, getTextContent } from '@wordpress/rich-text';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { Path, SVG, Line, Rect } from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport DocumentOutlineItem from './item';\nimport { store as editorStore } from '../../store';\n\n/**\n * Module constants\n */\nconst emptyHeadingContent = <em>{ __( '(Empty heading)' ) }</em>;\nconst incorrectLevelContent = [\n\t<br key=\"incorrect-break\" />,\n\t<em key=\"incorrect-message\">{ __( '(Incorrect heading level)' ) }</em>,\n];\nconst singleH1Headings = [\n\t<br key=\"incorrect-break-h1\" />,\n\t<em key=\"incorrect-message-h1\">\n\t\t{ __( '(Your theme may already use a H1 for the post title)' ) }\n\t</em>,\n];\nconst multipleH1Headings = [\n\t<br key=\"incorrect-break-multiple-h1\" />,\n\t<em key=\"incorrect-message-multiple-h1\">\n\t\t{ __( '(Multiple H1 headings are not recommended)' ) }\n\t</em>,\n];\nfunction EmptyOutlineIllustration() {\n\treturn (\n\t\t<SVG\n\t\t\twidth=\"138\"\n\t\t\theight=\"148\"\n\t\t\tviewBox=\"0 0 138 148\"\n\t\t\tfill=\"none\"\n\t\t\txmlns=\"http://www.w3.org/2000/svg\"\n\t\t>\n\t\t\t<Rect width=\"138\" height=\"148\" rx=\"4\" fill=\"#F0F6FC\" />\n\t\t\t<Line x1=\"44\" y1=\"28\" x2=\"24\" y2=\"28\" stroke=\"#DDDDDD\" />\n\t\t\t<Rect x=\"48\" y=\"16\" width=\"27\" height=\"23\" rx=\"4\" fill=\"#DDDDDD\" />\n\t\t\t<Path\n\t\t\t\td=\"M54.7585 32V23.2727H56.6037V26.8736H60.3494V23.2727H62.1903V32H60.3494V28.3949H56.6037V32H54.7585ZM67.4574 23.2727V32H65.6122V25.0241H65.5611L63.5625 26.277V24.6406L65.723 23.2727H67.4574Z\"\n\t\t\t\tfill=\"black\"\n\t\t\t/>\n\t\t\t<Line x1=\"55\" y1=\"59\" x2=\"24\" y2=\"59\" stroke=\"#DDDDDD\" />\n\t\t\t<Rect x=\"59\" y=\"47\" width=\"29\" height=\"23\" rx=\"4\" fill=\"#DDDDDD\" />\n\t\t\t<Path\n\t\t\t\td=\"M65.7585 63V54.2727H67.6037V57.8736H71.3494V54.2727H73.1903V63H71.3494V59.3949H67.6037V63H65.7585ZM74.6605 63V61.6705L77.767 58.794C78.0313 58.5384 78.2528 58.3082 78.4318 58.1037C78.6136 57.8991 78.7514 57.6989 78.8452 57.5028C78.9389 57.304 78.9858 57.0895 78.9858 56.8594C78.9858 56.6037 78.9276 56.3835 78.8111 56.1989C78.6946 56.0114 78.5355 55.8679 78.3338 55.7685C78.1321 55.6662 77.9034 55.6151 77.6477 55.6151C77.3807 55.6151 77.1477 55.669 76.9489 55.777C76.75 55.8849 76.5966 56.0398 76.4886 56.2415C76.3807 56.4432 76.3267 56.6832 76.3267 56.9616H74.5753C74.5753 56.3906 74.7045 55.8949 74.9631 55.4744C75.2216 55.054 75.5838 54.7287 76.0497 54.4986C76.5156 54.2685 77.0526 54.1534 77.6605 54.1534C78.2855 54.1534 78.8295 54.2642 79.2926 54.4858C79.7585 54.7045 80.1207 55.0085 80.3793 55.3977C80.6378 55.7869 80.767 56.233 80.767 56.7358C80.767 57.0653 80.7017 57.3906 80.571 57.7116C80.4432 58.0327 80.2145 58.3892 79.8849 58.7812C79.5554 59.1705 79.0909 59.6378 78.4915 60.1832L77.2173 61.4318V61.4915H80.8821V63H74.6605Z\"\n\t\t\t\tfill=\"black\"\n\t\t\t/>\n\t\t\t<Line x1=\"80\" y1=\"90\" x2=\"24\" y2=\"90\" stroke=\"#DDDDDD\" />\n\t\t\t<Rect x=\"84\" y=\"78\" width=\"30\" height=\"23\" rx=\"4\" fill=\"#F0B849\" />\n\t\t\t<Path\n\t\t\t\td=\"M90.7585 94V85.2727H92.6037V88.8736H96.3494V85.2727H98.1903V94H96.3494V90.3949H92.6037V94H90.7585ZM99.5284 92.4659V91.0128L103.172 85.2727H104.425V87.2841H103.683L101.386 90.919V90.9872H106.564V92.4659H99.5284ZM103.717 94V92.0227L103.751 91.3793V85.2727H105.482V94H103.717Z\"\n\t\t\t\tfill=\"black\"\n\t\t\t/>\n\t\t\t<Line x1=\"66\" y1=\"121\" x2=\"24\" y2=\"121\" stroke=\"#DDDDDD\" />\n\t\t\t<Rect x=\"70\" y=\"109\" width=\"29\" height=\"23\" rx=\"4\" fill=\"#DDDDDD\" />\n\t\t\t<Path\n\t\t\t\td=\"M76.7585 125V116.273H78.6037V119.874H82.3494V116.273H84.1903V125H82.3494V121.395H78.6037V125H76.7585ZM88.8864 125.119C88.25 125.119 87.6832 125.01 87.1861 124.791C86.6918 124.57 86.3011 124.266 86.0142 123.879C85.7301 123.49 85.5838 123.041 85.5753 122.533H87.4332C87.4446 122.746 87.5142 122.933 87.642 123.095C87.7727 123.254 87.946 123.378 88.1619 123.466C88.3778 123.554 88.6207 123.598 88.8906 123.598C89.1719 123.598 89.4205 123.548 89.6364 123.449C89.8523 123.349 90.0213 123.212 90.1435 123.036C90.2656 122.859 90.3267 122.656 90.3267 122.426C90.3267 122.193 90.2614 121.987 90.1307 121.808C90.0028 121.626 89.8182 121.484 89.5767 121.382C89.3381 121.28 89.054 121.229 88.7244 121.229H87.9105V119.874H88.7244C89.0028 119.874 89.2486 119.825 89.4616 119.729C89.6776 119.632 89.8452 119.499 89.9645 119.328C90.0838 119.155 90.1435 118.953 90.1435 118.723C90.1435 118.504 90.0909 118.312 89.9858 118.148C89.8835 117.98 89.7386 117.849 89.5511 117.756C89.3665 117.662 89.1506 117.615 88.9034 117.615C88.6534 117.615 88.4247 117.661 88.2173 117.751C88.0099 117.839 87.8438 117.966 87.7188 118.131C87.5938 118.295 87.527 118.489 87.5185 118.71H85.75C85.7585 118.207 85.902 117.764 86.1804 117.381C86.4588 116.997 86.8338 116.697 87.3054 116.482C87.7798 116.263 88.3153 116.153 88.9119 116.153C89.5142 116.153 90.0412 116.263 90.4929 116.482C90.9446 116.7 91.2955 116.996 91.5455 117.368C91.7983 117.737 91.9233 118.152 91.9205 118.612C91.9233 119.101 91.7713 119.509 91.4645 119.835C91.1605 120.162 90.7642 120.369 90.2756 120.457V120.526C90.9176 120.608 91.4063 120.831 91.7415 121.195C92.0795 121.555 92.2472 122.007 92.2443 122.55C92.2472 123.047 92.1037 123.489 91.8139 123.875C91.527 124.261 91.1307 124.565 90.625 124.787C90.1193 125.009 89.5398 125.119 88.8864 125.119Z\"\n\t\t\t\tfill=\"black\"\n\t\t\t/>\n\t\t</SVG>\n\t);\n}\n\n/**\n * Returns an array of heading blocks enhanced with the following properties:\n * level - An integer with the heading level.\n * isEmpty - Flag indicating if the heading has no content.\n *\n * @param {?Array} blocks An array of blocks.\n *\n * @return {Array} An array of heading blocks enhanced with the properties described above.\n */\nconst computeOutlineHeadings = ( blocks = [] ) => {\n\treturn blocks.flatMap( ( block = {} ) => {\n\t\tif ( block.name === 'core/heading' ) {\n\t\t\treturn {\n\t\t\t\t...block,\n\t\t\t\tlevel: block.attributes.level,\n\t\t\t\tisEmpty: isEmptyHeading( block ),\n\t\t\t};\n\t\t}\n\t\treturn computeOutlineHeadings( block.innerBlocks );\n\t} );\n};\n\nconst isEmptyHeading = ( heading ) =>\n\t! heading.attributes.content ||\n\theading.attributes.content.trim().length === 0;\n\n/**\n * Renders a document outline component.\n *\n * @param {Object} props Props.\n * @param {Function} props.onSelect Function to be called when an outline item is selected.\n * @param {boolean} props.isTitleSupported Indicates whether the title is supported.\n * @param {boolean} props.hasOutlineItemsDisabled Indicates whether the outline items are disabled.\n *\n * @return {Component} The component to be rendered.\n */\nexport default function DocumentOutline( {\n\tonSelect,\n\tisTitleSupported,\n\thasOutlineItemsDisabled,\n} ) {\n\tconst { selectBlock } = useDispatch( blockEditorStore );\n\tconst { blocks, title } = useSelect( ( select ) => {\n\t\tconst { getBlocks } = select( blockEditorStore );\n\t\tconst { getEditedPostAttribute } = select( editorStore );\n\t\tconst { getPostType } = select( coreStore );\n\t\tconst postType = getPostType( getEditedPostAttribute( 'type' ) );\n\n\t\treturn {\n\t\t\ttitle: getEditedPostAttribute( 'title' ),\n\t\t\tblocks: getBlocks(),\n\t\t\tisTitleSupported: postType?.supports?.title ?? false,\n\t\t};\n\t} );\n\n\tconst headings = computeOutlineHeadings( blocks );\n\tif ( headings.length < 1 ) {\n\t\treturn (\n\t\t\t<div className=\"editor-document-outline has-no-headings\">\n\t\t\t\t<EmptyOutlineIllustration />\n\t\t\t\t<p>\n\t\t\t\t\t{ __(\n\t\t\t\t\t\t'Navigate the structure of your document and address issues like empty or incorrect heading levels.'\n\t\t\t\t\t) }\n\t\t\t\t</p>\n\t\t\t</div>\n\t\t);\n\t}\n\n\tlet prevHeadingLevel = 1;\n\n\t// Not great but it's the simplest way to locate the title right now.\n\tconst titleNode = document.querySelector( '.editor-post-title__input' );\n\tconst hasTitle = isTitleSupported && title && titleNode;\n\tconst countByLevel = headings.reduce(\n\t\t( acc, heading ) => ( {\n\t\t\t...acc,\n\t\t\t[ heading.level ]: ( acc[ heading.level ] || 0 ) + 1,\n\t\t} ),\n\t\t{}\n\t);\n\tconst hasMultipleH1 = countByLevel[ 1 ] > 1;\n\n\treturn (\n\t\t<div className=\"document-outline\">\n\t\t\t<ul>\n\t\t\t\t{ hasTitle && (\n\t\t\t\t\t<DocumentOutlineItem\n\t\t\t\t\t\tlevel={ __( 'Title' ) }\n\t\t\t\t\t\tisValid\n\t\t\t\t\t\tonSelect={ onSelect }\n\t\t\t\t\t\thref={ `#${ titleNode.id }` }\n\t\t\t\t\t\tisDisabled={ hasOutlineItemsDisabled }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ title }\n\t\t\t\t\t</DocumentOutlineItem>\n\t\t\t\t) }\n\t\t\t\t{ headings.map( ( item, index ) => {\n\t\t\t\t\t// Headings remain the same, go up by one, or down by any amount.\n\t\t\t\t\t// Otherwise there are missing levels.\n\t\t\t\t\tconst isIncorrectLevel = item.level > prevHeadingLevel + 1;\n\n\t\t\t\t\tconst isValid =\n\t\t\t\t\t\t! item.isEmpty &&\n\t\t\t\t\t\t! isIncorrectLevel &&\n\t\t\t\t\t\t!! item.level &&\n\t\t\t\t\t\t( item.level !== 1 ||\n\t\t\t\t\t\t\t( ! hasMultipleH1 && ! hasTitle ) );\n\t\t\t\t\tprevHeadingLevel = item.level;\n\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<DocumentOutlineItem\n\t\t\t\t\t\t\tkey={ index }\n\t\t\t\t\t\t\tlevel={ `H${ item.level }` }\n\t\t\t\t\t\t\tisValid={ isValid }\n\t\t\t\t\t\t\tisDisabled={ hasOutlineItemsDisabled }\n\t\t\t\t\t\t\thref={ `#block-${ item.clientId }` }\n\t\t\t\t\t\t\tonSelect={ () => {\n\t\t\t\t\t\t\t\tselectBlock( item.clientId );\n\t\t\t\t\t\t\t\tonSelect?.();\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ item.isEmpty\n\t\t\t\t\t\t\t\t? emptyHeadingContent\n\t\t\t\t\t\t\t\t: getTextContent(\n\t\t\t\t\t\t\t\t\t\tcreate( {\n\t\t\t\t\t\t\t\t\t\t\thtml: item.attributes.content,\n\t\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{ isIncorrectLevel && incorrectLevelContent }\n\t\t\t\t\t\t\t{ item.level === 1 &&\n\t\t\t\t\t\t\t\thasMultipleH1 &&\n\t\t\t\t\t\t\t\tmult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gB,GAAGc,IAAI,CAACtC,KAAK;IAE7B,OACCzB,aAAA,CAACH,mBAAmB;MACnBK,GAAG,EAAG8D,KAAO;MACbvC,KAAK,EAAI,IAAIsC,IAAI,CAACtC,KAAO,EAAG;MAC5BiC,OAAO,EAAGA,OAAS;MACnBG,UAAU,EAAGxB,uBAAyB;MACtCsB,IAAI,EAAI,UAAUI,IAAI,CAACG,QAAU,EAAG;MACpC/B,QAAQ,EAAGA,CAAA,KAAM;QAChBG,WAAW,CAAEyB,IAAI,CAACG,QAAS,CAAC;QAC5B/B,QAAQ,GAAG,CAAC;MACb;IAAG,GAED4B,IAAI,CAACpC,OAAO,GACX5B,mBAAmB,GACnBV,cAAc,CACdD,MAAM,CAAE;MACP+E,IAAI,EAAEJ,IAAI,CAACrC,UAAU,CAACK;IACvB,CAAE,CACF,CAAC,EACFkC,gBAAgB,IAAIhE,qBAAqB,EACzC8D,IAAI,CAACtC,KAAK,KAAK,CAAC,IACjBgC,aAAa,IACbrD,kBAAkB,EACjBiD,QAAQ,IACTU,IAAI,CAACtC,KAAK,KAAK,CAAC,IAChB,CAAEgC,aAAa,IACftD,gBACmB,CAAC;EAExB,CAAE,CACC,CACA,CAAC;AAER","ignoreList":[]}
@@ -10,7 +10,7 @@ import classnames from 'classnames';
10
10
  import { useViewportMatch } from '@wordpress/compose';
11
11
  import { useSelect, useDispatch } from '@wordpress/data';
12
12
  import { __, _x } from '@wordpress/i18n';
13
- import { NavigableToolbar, ToolSelector, store as blockEditorStore, privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';
13
+ import { NavigableToolbar, ToolSelector, store as blockEditorStore } from '@wordpress/block-editor';
14
14
  import { Button, ToolbarItem } from '@wordpress/components';
15
15
  import { listView, plus } from '@wordpress/icons';
16
16
  import { useRef, useCallback } from '@wordpress/element';
@@ -24,9 +24,6 @@ import { unlock } from '../../lock-unlock';
24
24
  import { store as editorStore } from '../../store';
25
25
  import EditorHistoryRedo from '../editor-history/redo';
26
26
  import EditorHistoryUndo from '../editor-history/undo';
27
- const {
28
- useShowBlockTools
29
- } = unlock(blockEditorPrivateApis);
30
27
  const preventDefault = event => {
31
28
  event.preventDefault();
32
29
  };
@@ -76,9 +73,6 @@ function DocumentTools({
76
73
  }, []);
77
74
  const isLargeViewport = useViewportMatch('medium');
78
75
  const isWideViewport = useViewportMatch('wide');
79
- const {
80
- showFixedToolbar
81
- } = useShowBlockTools();
82
76
 
83
77
  /* translators: accessibility text for the editor toolbar */
84
78
  const toolbarAriaLabel = __('Document tools');
@@ -106,7 +100,6 @@ function DocumentTools({
106
100
  createElement(NavigableToolbar, {
107
101
  className: classnames('editor-document-tools', 'edit-post-header-toolbar', className),
108
102
  "aria-label": toolbarAriaLabel,
109
- shouldUseKeyboardFocusShortcut: !showFixedToolbar,
110
103
  variant: "unstyled"
111
104
  }, createElement("div", {
112
105
  className: "editor-document-tools__left"
@@ -1 +1 @@
1
- {"version":3,"names":["classnames","useViewportMatch","useSelect","useDispatch","__","_x","NavigableToolbar","ToolSelector","store","blockEditorStore","privateApis","blockEditorPrivateApis","Button","ToolbarItem","listView","plus","useRef","useCallback","keyboardShortcutsStore","preferencesStore","unlock","editorStore","EditorHistoryRedo","EditorHistoryUndo","useShowBlockTools","preventDefault","event","DocumentTools","className","disableBlockTools","children","listViewLabel","inserterButton","setIsInserterOpened","setIsListViewOpened","isDistractionFree","isInserterOpened","isListViewOpen","listViewShortcut","listViewToggleRef","hasFixedToolbar","showIconLabels","select","getSettings","get","isListViewOpened","getListViewToggleRef","getShortcutRepresentation","isLargeViewport","isWideViewport","showFixedToolbar","toolbarAriaLabel","toggleListView","toggleInserter","current","focus","longLabel","shortLabel","createElement","shouldUseKeyboardFocusShortcut","variant","ref","as","isPressed","onMouseDown","onClick","disabled","icon","label","showTooltip","Fragment","undefined","size","shortcut"],"sources":["@wordpress/editor/src/components/document-tools/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { useViewportMatch } from '@wordpress/compose';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { __, _x } from '@wordpress/i18n';\nimport {\n\tNavigableToolbar,\n\tToolSelector,\n\tstore as blockEditorStore,\n\tprivateApis as blockEditorPrivateApis,\n} from '@wordpress/block-editor';\nimport { Button, ToolbarItem } from '@wordpress/components';\nimport { listView, plus } from '@wordpress/icons';\nimport { useRef, useCallback } from '@wordpress/element';\nimport { store as keyboardShortcutsStore } from '@wordpress/keyboard-shortcuts';\nimport { store as preferencesStore } from '@wordpress/preferences';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\nimport { store as editorStore } from '../../store';\nimport EditorHistoryRedo from '../editor-history/redo';\nimport EditorHistoryUndo from '../editor-history/undo';\n\nconst { useShowBlockTools } = unlock( blockEditorPrivateApis );\n\nconst preventDefault = ( event ) => {\n\tevent.preventDefault();\n};\n\nfunction DocumentTools( {\n\tclassName,\n\tdisableBlockTools = false,\n\tchildren,\n\t// This is a temporary prop until the list view is fully unified between post and site editors.\n\tlistViewLabel = __( 'Document Overview' ),\n} ) {\n\tconst inserterButton = useRef();\n\tconst { setIsInserterOpened, setIsListViewOpened } =\n\t\tuseDispatch( editorStore );\n\tconst {\n\t\tisDistractionFree,\n\t\tisInserterOpened,\n\t\tisListViewOpen,\n\t\tlistViewShortcut,\n\t\tlistViewToggleRef,\n\t\thasFixedToolbar,\n\t\tshowIconLabels,\n\t} = useSelect( ( select ) => {\n\t\tconst { getSettings } = select( blockEditorStore );\n\t\tconst { get } = select( preferencesStore );\n\t\tconst { isListViewOpened, getListViewToggleRef } = unlock(\n\t\t\tselect( editorStore )\n\t\t);\n\t\tconst { getShortcutRepresentation } = select( keyboardShortcutsStore );\n\n\t\treturn {\n\t\t\tisInserterOpened: select( editorStore ).isInserterOpened(),\n\t\t\tisListViewOpen: isListViewOpened(),\n\t\t\tlistViewShortcut: getShortcutRepresentation(\n\t\t\t\t'core/editor/toggle-list-view'\n\t\t\t),\n\t\t\tlistViewToggleRef: getListViewToggleRef(),\n\t\t\thasFixedToolbar: getSettings().hasFixedToolbar,\n\t\t\tshowIconLabels: get( 'core', 'showIconLabels' ),\n\t\t\tisDistractionFree: get( 'core', 'distractionFree' ),\n\t\t};\n\t}, [] );\n\n\tconst isLargeViewport = useViewportMatch( 'medium' );\n\tconst isWideViewport = useViewportMatch( 'wide' );\n\tconst { showFixedToolbar } = useShowBlockTools();\n\n\t/* translators: accessibility text for the editor toolbar */\n\tconst toolbarAriaLabel = __( 'Document tools' );\n\n\tconst toggleListView = useCallback(\n\t\t() => setIsListViewOpened( ! isListViewOpen ),\n\t\t[ setIsListViewOpened, isListViewOpen ]\n\t);\n\n\tconst toggleInserter = useCallback( () => {\n\t\tif ( isInserterOpened ) {\n\t\t\t// Focusing the inserter button should close the inserter popover.\n\t\t\t// However, there are some cases it won't close when the focus is lost.\n\t\t\t// See https://github.com/WordPress/gutenberg/issues/43090 for more details.\n\t\t\tinserterButton.current.focus();\n\t\t\tsetIsInserterOpened( false );\n\t\t} else {\n\t\t\tsetIsInserterOpened( true );\n\t\t}\n\t}, [ isInserterOpened, setIsInserterOpened ] );\n\n\t/* translators: button label text should, if possible, be under 16 characters. */\n\tconst longLabel = _x(\n\t\t'Toggle block inserter',\n\t\t'Generic label for block inserter button'\n\t);\n\tconst shortLabel = ! isInserterOpened ? __( 'Add' ) : __( 'Close' );\n\n\treturn (\n\t\t// Some plugins expect and use the `edit-post-header-toolbar` CSS class to\n\t\t// find the toolbar and inject UI elements into it. This is not officially\n\t\t// supported, but we're keeping it in the list of class names for backwards\n\t\t// compatibility.\n\t\t<NavigableToolbar\n\t\t\tclassName={ classnames(\n\t\t\t\t'editor-document-tools',\n\t\t\t\t'edit-post-header-toolbar',\n\t\t\t\tclassName\n\t\t\t) }\n\t\t\taria-label={ toolbarAriaLabel }\n\t\t\tshouldUseKeyboardFocusShortcut={ ! showFixedToolbar }\n\t\t\tvariant=\"unstyled\"\n\t\t>\n\t\t\t<div className=\"editor-document-tools__left\">\n\t\t\t\t{ ! isDistractionFree && (\n\t\t\t\t\t<ToolbarItem\n\t\t\t\t\t\tref={ inserterButton }\n\t\t\t\t\t\tas={ Button }\n\t\t\t\t\t\tclassName=\"editor-document-tools__inserter-toggle\"\n\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\tisPressed={ isInserterOpened }\n\t\t\t\t\t\tonMouseDown={ preventDefault }\n\t\t\t\t\t\tonClick={ toggleInserter }\n\t\t\t\t\t\tdisabled={ disableBlockTools }\n\t\t\t\t\t\ticon={ plus }\n\t\t\t\t\t\tlabel={ showIconLabels ? shortLabel : longLabel }\n\t\t\t\t\t\tshowTooltip={ ! showIconLabels }\n\t\t\t\t\t\taria-expanded={ isInserterOpened }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t\t{ ( isWideViewport || ! showIconLabels ) && (\n\t\t\t\t\t<>\n\t\t\t\t\t\t{ isLargeViewport && ! hasFixedToolbar && (\n\t\t\t\t\t\t\t<ToolbarItem\n\t\t\t\t\t\t\t\tas={ ToolSelector }\n\t\t\t\t\t\t\t\tshowTooltip={ ! showIconLabels }\n\t\t\t\t\t\t\t\tvariant={\n\t\t\t\t\t\t\t\t\tshowIconLabels ? 'tertiary' : undefined\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tdisabled={ disableBlockTools }\n\t\t\t\t\t\t\t\tsize=\"compact\"\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t<ToolbarItem\n\t\t\t\t\t\t\tas={ EditorHistoryUndo }\n\t\t\t\t\t\t\tshowTooltip={ ! showIconLabels }\n\t\t\t\t\t\t\tvariant={ showIconLabels ? 'tertiary' : undefined }\n\t\t\t\t\t\t\tsize=\"compact\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<ToolbarItem\n\t\t\t\t\t\t\tas={ EditorHistoryRedo }\n\t\t\t\t\t\t\tshowTooltip={ ! showIconLabels }\n\t\t\t\t\t\t\tvariant={ showIconLabels ? 'tertiary' : undefined }\n\t\t\t\t\t\t\tsize=\"compact\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t{ ! isDistractionFree && (\n\t\t\t\t\t\t\t<ToolbarItem\n\t\t\t\t\t\t\t\tas={ Button }\n\t\t\t\t\t\t\t\tclassName=\"editor-document-tools__document-overview-toggle\"\n\t\t\t\t\t\t\t\ticon={ listView }\n\t\t\t\t\t\t\t\tdisabled={ disableBlockTools }\n\t\t\t\t\t\t\t\tisPressed={ isListViewOpen }\n\t\t\t\t\t\t\t\t/* translators: button label text should, if possible, be under 16 characters. */\n\t\t\t\t\t\t\t\tlabel={ listViewLabel }\n\t\t\t\t\t\t\t\tonClick={ toggleListView }\n\t\t\t\t\t\t\t\tshortcut={ listViewShortcut }\n\t\t\t\t\t\t\t\tshowTooltip={ ! showIconLabels }\n\t\t\t\t\t\t\t\tvariant={\n\t\t\t\t\t\t\t\t\tshowIconLabels ? 'tertiary' : undefined\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\taria-expanded={ isListViewOpen }\n\t\t\t\t\t\t\t\tref={ listViewToggleRef }\n\t\t\t\t\t\t\t\tsize=\"compact\"\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) }\n\t\t\t\t{ children }\n\t\t\t</div>\n\t\t</NavigableToolbar>\n\t);\n}\n\nexport default DocumentTools;\n"],"mappings":";AAAA;AACA;AACA;AACA,OAAOA,UAAU,MAAM,YAAY;;AAEnC;AACA;AACA;AACA,SAASC,gBAAgB,QAAQ,oBAAoB;AACrD,SAASC,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACxD,SAASC,EAAE,EAAEC,EAAE,QAAQ,iBAAiB;AACxC,SACCC,gBAAgB,EAChBC,YAAY,EACZC,KAAK,IAAIC,gBAAgB,EACzBC,WAAW,IAAIC,sBAAsB,QAC/B,yBAAyB;AAChC,SAASC,MAAM,EAAEC,WAAW,QAAQ,u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AW;MACnDC,IAAI,EAAC;IAAS,CACd,CAAC,EACFd,aAAA,CAAC7C,WAAW;MACXiD,EAAE,EAAGxC,iBAAmB;MACxB+C,WAAW,EAAG,CAAE5B,cAAgB;MAChCmB,OAAO,EAAGnB,cAAc,GAAG,UAAU,GAAG8B,SAAW;MACnDC,IAAI,EAAC;IAAS,CACd,CAAC,EACA,CAAErC,iBAAiB,IACpBuB,aAAA,CAAC7C,WAAW;MACXiD,EAAE,EAAGlD,MAAQ;MACbgB,SAAS,EAAC,iDAAiD;MAC3DuC,IAAI,EAAGrD,QAAU;MACjBoD,QAAQ,EAAGrC,iBAAmB;MAC9BkC,SAAS,EAAG1B;MACZ;MACA+B,KAAK,EAAGrC,aAAe;MACvBkC,OAAO,EAAGb,cAAgB;MAC1BqB,QAAQ,EAAGnC,gBAAkB;MAC7B+B,WAAW,EAAG,CAAE5B,cAAgB;MAChCmB,OAAO,EACNnB,cAAc,GAAG,UAAU,GAAG8B,SAC9B;MACD,iBAAgBlC,cAAgB;MAChCwB,GAAG,EAAGtB,iBAAmB;MACzBiC,IAAI,EAAC;IAAS,CACd,CAED,CACF,EACC1C,QACE,CACY;EAAC;AAErB;AAEA,eAAeH,aAAa","ignoreList":[]}
1
+ {"version":3,"names":["classnames","useViewportMatch","useSelect","useDispatch","__","_x","NavigableToolbar","ToolSelector","store","blockEditorStore","Button","ToolbarItem","listView","plus","useRef","useCallback","keyboardShortcutsStore","preferencesStore","unlock","editorStore","EditorHistoryRedo","EditorHistoryUndo","preventDefault","event","DocumentTools","className","disableBlockTools","children","listViewLabel","inserterButton","setIsInserterOpened","setIsListViewOpened","isDistractionFree","isInserterOpened","isListViewOpen","listViewShortcut","listViewToggleRef","hasFixedToolbar","showIconLabels","select","getSettings","get","isListViewOpened","getListViewToggleRef","getShortcutRepresentation","isLargeViewport","isWideViewport","toolbarAriaLabel","toggleListView","toggleInserter","current","focus","longLabel","shortLabel","createElement","variant","ref","as","isPressed","onMouseDown","onClick","disabled","icon","label","showTooltip","Fragment","undefined","size","shortcut"],"sources":["@wordpress/editor/src/components/document-tools/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { useViewportMatch } from '@wordpress/compose';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { __, _x } from '@wordpress/i18n';\nimport {\n\tNavigableToolbar,\n\tToolSelector,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { Button, ToolbarItem } from '@wordpress/components';\nimport { listView, plus } from '@wordpress/icons';\nimport { useRef, useCallback } from '@wordpress/element';\nimport { store as keyboardShortcutsStore } from '@wordpress/keyboard-shortcuts';\nimport { store as preferencesStore } from '@wordpress/preferences';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\nimport { store as editorStore } from '../../store';\nimport EditorHistoryRedo from '../editor-history/redo';\nimport EditorHistoryUndo from '../editor-history/undo';\n\nconst preventDefault = ( event ) => {\n\tevent.preventDefault();\n};\n\nfunction DocumentTools( {\n\tclassName,\n\tdisableBlockTools = false,\n\tchildren,\n\t// This is a temporary prop until the list view is fully unified between post and site editors.\n\tlistViewLabel = __( 'Document Overview' ),\n} ) {\n\tconst inserterButton = useRef();\n\tconst { setIsInserterOpened, setIsListViewOpened } =\n\t\tuseDispatch( editorStore );\n\tconst {\n\t\tisDistractionFree,\n\t\tisInserterOpened,\n\t\tisListViewOpen,\n\t\tlistViewShortcut,\n\t\tlistViewToggleRef,\n\t\thasFixedToolbar,\n\t\tshowIconLabels,\n\t} = useSelect( ( select ) => {\n\t\tconst { getSettings } = select( blockEditorStore );\n\t\tconst { get } = select( preferencesStore );\n\t\tconst { isListViewOpened, getListViewToggleRef } = unlock(\n\t\t\tselect( editorStore )\n\t\t);\n\t\tconst { getShortcutRepresentation } = select( keyboardShortcutsStore );\n\n\t\treturn {\n\t\t\tisInserterOpened: select( editorStore ).isInserterOpened(),\n\t\t\tisListViewOpen: isListViewOpened(),\n\t\t\tlistViewShortcut: getShortcutRepresentation(\n\t\t\t\t'core/editor/toggle-list-view'\n\t\t\t),\n\t\t\tlistViewToggleRef: getListViewToggleRef(),\n\t\t\thasFixedToolbar: getSettings().hasFixedToolbar,\n\t\t\tshowIconLabels: get( 'core', 'showIconLabels' ),\n\t\t\tisDistractionFree: get( 'core', 'distractionFree' ),\n\t\t};\n\t}, [] );\n\n\tconst isLargeViewport = useViewportMatch( 'medium' );\n\tconst isWideViewport = useViewportMatch( 'wide' );\n\n\t/* translators: accessibility text for the editor toolbar */\n\tconst toolbarAriaLabel = __( 'Document tools' );\n\n\tconst toggleListView = useCallback(\n\t\t() => setIsListViewOpened( ! isListViewOpen ),\n\t\t[ setIsListViewOpened, isListViewOpen ]\n\t);\n\n\tconst toggleInserter = useCallback( () => {\n\t\tif ( isInserterOpened ) {\n\t\t\t// Focusing the inserter button should close the inserter popover.\n\t\t\t// However, there are some cases it won't close when the focus is lost.\n\t\t\t// See https://github.com/WordPress/gutenberg/issues/43090 for more details.\n\t\t\tinserterButton.current.focus();\n\t\t\tsetIsInserterOpened( false );\n\t\t} else {\n\t\t\tsetIsInserterOpened( true );\n\t\t}\n\t}, [ isInserterOpened, setIsInserterOpened ] );\n\n\t/* translators: button label text should, if possible, be under 16 characters. */\n\tconst longLabel = _x(\n\t\t'Toggle block inserter',\n\t\t'Generic label for block inserter button'\n\t);\n\tconst shortLabel = ! isInserterOpened ? __( 'Add' ) : __( 'Close' );\n\n\treturn (\n\t\t// Some plugins expect and use the `edit-post-header-toolbar` CSS class to\n\t\t// find the toolbar and inject UI elements into it. This is not officially\n\t\t// supported, but we're keeping it in the list of class names for backwards\n\t\t// compatibility.\n\t\t<NavigableToolbar\n\t\t\tclassName={ classnames(\n\t\t\t\t'editor-document-tools',\n\t\t\t\t'edit-post-header-toolbar',\n\t\t\t\tclassName\n\t\t\t) }\n\t\t\taria-label={ toolbarAriaLabel }\n\t\t\tvariant=\"unstyled\"\n\t\t>\n\t\t\t<div className=\"editor-document-tools__left\">\n\t\t\t\t{ ! isDistractionFree && (\n\t\t\t\t\t<ToolbarItem\n\t\t\t\t\t\tref={ inserterButton }\n\t\t\t\t\t\tas={ Button }\n\t\t\t\t\t\tclassName=\"editor-document-tools__inserter-toggle\"\n\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\tisPressed={ isInserterOpened }\n\t\t\t\t\t\tonMouseDown={ preventDefault }\n\t\t\t\t\t\tonClick={ toggleInserter }\n\t\t\t\t\t\tdisabled={ disableBlockTools }\n\t\t\t\t\t\ticon={ plus }\n\t\t\t\t\t\tlabel={ showIconLabels ? shortLabel : longLabel }\n\t\t\t\t\t\tshowTooltip={ ! showIconLabels }\n\t\t\t\t\t\taria-expanded={ isInserterOpened }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t\t{ ( isWideViewport || ! showIconLabels ) && (\n\t\t\t\t\t<>\n\t\t\t\t\t\t{ isLargeViewport && ! hasFixedToolbar && (\n\t\t\t\t\t\t\t<ToolbarItem\n\t\t\t\t\t\t\t\tas={ ToolSelector }\n\t\t\t\t\t\t\t\tshowTooltip={ ! showIconLabels }\n\t\t\t\t\t\t\t\tvariant={\n\t\t\t\t\t\t\t\t\tshowIconLabels ? 'tertiary' : undefined\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tdisabled={ disableBlockTools }\n\t\t\t\t\t\t\t\tsize=\"compact\"\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t<ToolbarItem\n\t\t\t\t\t\t\tas={ EditorHistoryUndo }\n\t\t\t\t\t\t\tshowTooltip={ ! showIconLabels }\n\t\t\t\t\t\t\tvariant={ showIconLabels ? 'tertiary' : undefined }\n\t\t\t\t\t\t\tsize=\"compact\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<ToolbarItem\n\t\t\t\t\t\t\tas={ EditorHistoryRedo }\n\t\t\t\t\t\t\tshowTooltip={ ! showIconLabels }\n\t\t\t\t\t\t\tvariant={ showIconLabels ? 'tertiary' : undefined }\n\t\t\t\t\t\t\tsize=\"compact\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t{ ! isDistractionFree && (\n\t\t\t\t\t\t\t<ToolbarItem\n\t\t\t\t\t\t\t\tas={ Button }\n\t\t\t\t\t\t\t\tclassName=\"editor-document-tools__document-overview-toggle\"\n\t\t\t\t\t\t\t\ticon={ listView }\n\t\t\t\t\t\t\t\tdisabled={ disableBlockTools }\n\t\t\t\t\t\t\t\tisPressed={ isListViewOpen }\n\t\t\t\t\t\t\t\t/* translators: button label text should, if possible, be under 16 characters. */\n\t\t\t\t\t\t\t\tlabel={ listViewLabel }\n\t\t\t\t\t\t\t\tonClick={ toggleListView }\n\t\t\t\t\t\t\t\tshortcut={ listViewShortcut }\n\t\t\t\t\t\t\t\tshowTooltip={ ! showIconLabels }\n\t\t\t\t\t\t\t\tvariant={\n\t\t\t\t\t\t\t\t\tshowIconLabels ? 'tertiary' : undefined\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\taria-expanded={ isListViewOpen }\n\t\t\t\t\t\t\t\tref={ listViewToggleRef }\n\t\t\t\t\t\t\t\tsize=\"compact\"\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) }\n\t\t\t\t{ children }\n\t\t\t</div>\n\t\t</NavigableToolbar>\n\t);\n}\n\nexport default DocumentTools;\n"],"mappings":";AAAA;AACA;AACA;AACA,OAAOA,UAAU,MAAM,YAAY;;AAEnC;AACA;AACA;AACA,SAASC,gBAAgB,QAAQ,oBAAoB;AACrD,SAASC,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACxD,SAASC,EAAE,EAAEC,EAAE,QAAQ,iBAAiB;AACxC,SACCC,gBAAgB,EAChBC,YAAY,EACZC,KAAK,IAAIC,gBAAgB,QACnB,yBAAyB;AAChC,SAASC,MAAM,EAAEC,WAAW,QAAQ,uBAAuB;AAC3D,SAASC,QAAQ,EAAEC,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;IAAS,CACd,CAAC,EACA,CAAEnC,iBAAiB,IACpBsB,aAAA,CAAC3C,WAAW;MACX8C,EAAE,EAAG/C,MAAQ;MACbe,SAAS,EAAC,iDAAiD;MAC3DqC,IAAI,EAAGlD,QAAU;MACjBiD,QAAQ,EAAGnC,iBAAmB;MAC9BgC,SAAS,EAAGxB;MACZ;MACA6B,KAAK,EAAGnC,aAAe;MACvBgC,OAAO,EAAGZ,cAAgB;MAC1BoB,QAAQ,EAAGjC,gBAAkB;MAC7B6B,WAAW,EAAG,CAAE1B,cAAgB;MAChCiB,OAAO,EACNjB,cAAc,GAAG,UAAU,GAAG4B,SAC9B;MACD,iBAAgBhC,cAAgB;MAChCsB,GAAG,EAAGpB,iBAAmB;MACzB+B,IAAI,EAAC;IAAS,CACd,CAED,CACF,EACCxC,QACE,CACY;EAAC;AAErB;AAEA,eAAeH,aAAa","ignoreList":[]}
@@ -78,6 +78,6 @@ export default function EditTemplateBlocksNotification({
78
78
  });
79
79
  },
80
80
  onCancel: () => setIsDialogOpen(false)
81
- }, __('You’ve tried to select a block that is part of a template, which may be used on other posts and pages. Would you like to edit the template?.'));
81
+ }, __('You’ve tried to select a block that is part of a template, which may be used on other posts and pages. Would you like to edit the template?'));
82
82
  }
83
83
  //# sourceMappingURL=edit-template-blocks-notification.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["useSelect","store","coreStore","useEffect","useState","__","__experimentalConfirmDialog","ConfirmDialog","editorStore","EditTemplateBlocksNotification","contentRef","onNavigateToEntityRecord","templateId","select","getEditorSettings","getCurrentTemplateId","canEditTemplate","_select$canUser","canUser","isDialogOpen","setIsDialogOpen","handleDblClick","event","target","classList","contains","canvas","current","addEventListener","removeEventListener","createElement","isOpen","confirmButtonText","onConfirm","postId","postType","onCancel"],"sources":["@wordpress/editor/src/components/editor-canvas/edit-template-blocks-notification.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useEffect, useState } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport { __experimentalConfirmDialog as ConfirmDialog } from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\n\n/**\n * Component that:\n *\n * - Displays a 'Edit your template to edit this block' notification when the\n * user is focusing on editing page content and clicks on a disabled template\n * block.\n * - Displays a 'Edit your template to edit this block' dialog when the user\n * is focusing on editing page conetnt and double clicks on a disabled\n * template block.\n *\n * @param {Object} props\n * @param {import('react').RefObject<HTMLElement>} props.contentRef Ref to the block\n * editor iframe canvas.\n */\nexport default function EditTemplateBlocksNotification( { contentRef } ) {\n\tconst { onNavigateToEntityRecord, templateId } = useSelect( ( select ) => {\n\t\tconst { getEditorSettings, getCurrentTemplateId } =\n\t\t\tselect( editorStore );\n\n\t\treturn {\n\t\t\tonNavigateToEntityRecord:\n\t\t\t\tgetEditorSettings().onNavigateToEntityRecord,\n\t\t\ttemplateId: getCurrentTemplateId(),\n\t\t};\n\t}, [] );\n\n\tconst canEditTemplate = useSelect(\n\t\t( select ) =>\n\t\t\tselect( coreStore ).canUser( 'create', 'templates' ) ?? false\n\t);\n\n\tconst [ isDialogOpen, setIsDialogOpen ] = useState( false );\n\n\tuseEffect( () => {\n\t\tconst handleDblClick = ( event ) => {\n\t\t\tif ( ! canEditTemplate ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif ( ! event.target.classList.contains( 'is-root-container' ) ) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tsetIsDialogOpen( true );\n\t\t};\n\n\t\tconst canvas = contentRef.current;\n\t\tcanvas?.addEventListener( 'dblclick', handleDblClick );\n\t\treturn () => {\n\t\t\tcanvas?.removeEventListener( 'dblclick', handleDblClick );\n\t\t};\n\t}, [ contentRef, canEditTemplate ] );\n\n\tif ( ! canEditTemplate ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<ConfirmDialog\n\t\t\tisOpen={ isDialogOpen }\n\t\t\tconfirmButtonText={ __( 'Edit template' ) }\n\t\t\tonConfirm={ () => {\n\t\t\t\tsetIsDialogOpen( false );\n\t\t\t\tonNavigateToEntityRecord( {\n\t\t\t\t\tpostId: templateId,\n\t\t\t\t\tpostType: 'wp_template',\n\t\t\t\t} );\n\t\t\t} }\n\t\t\tonCancel={ () => setIsDialogOpen( false ) }\n\t\t>\n\t\t\t{ __(\n\t\t\t\t'You’ve tried to select a block that is part of a template, which may be used on other posts and pages. Would you like to edit the template?.'\n\t\t\t) }\n\t\t</ConfirmDialog>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,KAAK,IAAIC,SAAS,QAAQ,sBAAsB;AACzD,SAASC,SAAS,EAAEC,QAAQ,QAAQ,oBAAoB;AACxD,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SAASC,2BAA2B,IAAIC,aAAa,QAAQ,uBAAuB;;AAEpF;AACA;AACA;AACA,SAASN,KAAK,IAAIO,WAAW,QAAQ,aAAa;;AAElD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,SAASC,8BAA8BA,CAAE;EAAEC;AAAW,CAAC,EAAG;EACxE,MAAM;IAAEC,wBAAwB;IAAEC;EAAW,CAAC,GAAGZ,SAAS,CAAIa,MAAM,IAAM;IACzE,MAAM;MAAEC,iBAAiB;MAAEC;IAAqB,CAAC,GAChDF,MAAM,CAAEL,WAAY,CAAC;IAEtB,OAAO;MACNG,wBAAwB,EACvBG,iBAAiB,CAAC,CAAC,CAACH,wBAAwB;MAC7CC,UAAU,EAAEG,oBAAoB,CAAC;IAClC,CAAC;EACF,CAAC,EAAE,EAAG,CAAC;EAEP,MAAMC,eAAe,GAAGhB,SAAS,CAC9Ba,MAAM;IAAA,IAAAI,eAAA;IAAA,QAAAA,eAAA,GACPJ,MAAM,CAAEX,SAAU,CAAC,CAACgB,OAAO,CAAE,QAAQ,EAAE,WAAY,CAAC,cAAAD,eAAA,cAAAA,eAAA,GAAI,KAAK;EAAA,CAC/D,CAAC;EAED,MAAM,CAAEE,YAAY,EAAEC,eAAe,CAAE,GAAGhB,QAAQ,CAAE,KAAM,CAAC;EAE3DD,SAAS,CAAE,MAAM;IAChB,MAAMkB,cAAc,GAAKC,KAAK,IAAM;MACnC,IAAK,CAAEN,eAAe,EAAG;QACxB;MACD;MAEA,IAAK,CAAEM,KAAK,CAACC,MAAM,CAACC,SAAS,CAACC,QAAQ,CAAE,mBAAoB,CAAC,EAAG;QAC/D;MACD;MACAL,eAAe,CAAE,IAAK,CAAC;IACxB,CAAC;IAED,MAAMM,MAAM,GAAGhB,UAAU,CAACiB,OAAO;IACjCD,MAAM,EAAEE,gBAAgB,CAAE,UAAU,EAAEP,cAAe,CAAC;IACtD,OAAO,MAAM;MACZK,MAAM,EAAEG,mBAAmB,CAAE,UAAU,EAAER,cAAe,CAAC;IAC1D,CAAC;EACF,CAAC,EAAE,CAAEX,UAAU,EAAEM,eAAe,CAAG,CAAC;EAEpC,IAAK,CAAEA,eAAe,EAAG;IACxB,OAAO,IAAI;EACZ;EAEA,OACCc,aAAA,CAACvB,aAAa;IACbwB,MAAM,EAAGZ,YAAc;IACvBa,iBAAiB,EAAG3B,EAAE,CAAE,eAAgB,CAAG;IAC3C4B,SAAS,EAAGA,CAAA,KAAM;MACjBb,eAAe,CAAE,KAAM,CAAC;MACxBT,wBAAwB,CAAE;QACzBuB,MAAM,EAAEtB,UAAU;QAClBuB,QAAQ,EAAE;MACX,CAAE,CAAC;IACJ,CAAG;IACHC,QAAQ,EAAGA,CAAA,KAAMhB,eAAe,CAAE,KAAM;EAAG,GAEzCf,EAAE,CACH,8IACD,CACc,CAAC;AAElB","ignoreList":[]}
1
+ {"version":3,"names":["useSelect","store","coreStore","useEffect","useState","__","__experimentalConfirmDialog","ConfirmDialog","editorStore","EditTemplateBlocksNotification","contentRef","onNavigateToEntityRecord","templateId","select","getEditorSettings","getCurrentTemplateId","canEditTemplate","_select$canUser","canUser","isDialogOpen","setIsDialogOpen","handleDblClick","event","target","classList","contains","canvas","current","addEventListener","removeEventListener","createElement","isOpen","confirmButtonText","onConfirm","postId","postType","onCancel"],"sources":["@wordpress/editor/src/components/editor-canvas/edit-template-blocks-notification.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useEffect, useState } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport { __experimentalConfirmDialog as ConfirmDialog } from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\n\n/**\n * Component that:\n *\n * - Displays a 'Edit your template to edit this block' notification when the\n * user is focusing on editing page content and clicks on a disabled template\n * block.\n * - Displays a 'Edit your template to edit this block' dialog when the user\n * is focusing on editing page conetnt and double clicks on a disabled\n * template block.\n *\n * @param {Object} props\n * @param {import('react').RefObject<HTMLElement>} props.contentRef Ref to the block\n * editor iframe canvas.\n */\nexport default function EditTemplateBlocksNotification( { contentRef } ) {\n\tconst { onNavigateToEntityRecord, templateId } = useSelect( ( select ) => {\n\t\tconst { getEditorSettings, getCurrentTemplateId } =\n\t\t\tselect( editorStore );\n\n\t\treturn {\n\t\t\tonNavigateToEntityRecord:\n\t\t\t\tgetEditorSettings().onNavigateToEntityRecord,\n\t\t\ttemplateId: getCurrentTemplateId(),\n\t\t};\n\t}, [] );\n\n\tconst canEditTemplate = useSelect(\n\t\t( select ) =>\n\t\t\tselect( coreStore ).canUser( 'create', 'templates' ) ?? false\n\t);\n\n\tconst [ isDialogOpen, setIsDialogOpen ] = useState( false );\n\n\tuseEffect( () => {\n\t\tconst handleDblClick = ( event ) => {\n\t\t\tif ( ! canEditTemplate ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif ( ! event.target.classList.contains( 'is-root-container' ) ) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tsetIsDialogOpen( true );\n\t\t};\n\n\t\tconst canvas = contentRef.current;\n\t\tcanvas?.addEventListener( 'dblclick', handleDblClick );\n\t\treturn () => {\n\t\t\tcanvas?.removeEventListener( 'dblclick', handleDblClick );\n\t\t};\n\t}, [ contentRef, canEditTemplate ] );\n\n\tif ( ! canEditTemplate ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<ConfirmDialog\n\t\t\tisOpen={ isDialogOpen }\n\t\t\tconfirmButtonText={ __( 'Edit template' ) }\n\t\t\tonConfirm={ () => {\n\t\t\t\tsetIsDialogOpen( false );\n\t\t\t\tonNavigateToEntityRecord( {\n\t\t\t\t\tpostId: templateId,\n\t\t\t\t\tpostType: 'wp_template',\n\t\t\t\t} );\n\t\t\t} }\n\t\t\tonCancel={ () => setIsDialogOpen( false ) }\n\t\t>\n\t\t\t{ __(\n\t\t\t\t'You’ve tried to select a block that is part of a template, which may be used on other posts and pages. Would you like to edit the template?'\n\t\t\t) }\n\t\t</ConfirmDialog>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,KAAK,IAAIC,SAAS,QAAQ,sBAAsB;AACzD,SAASC,SAAS,EAAEC,QAAQ,QAAQ,oBAAoB;AACxD,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SAASC,2BAA2B,IAAIC,aAAa,QAAQ,uBAAuB;;AAEpF;AACA;AACA;AACA,SAASN,KAAK,IAAIO,WAAW,QAAQ,aAAa;;AAElD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,SAASC,8BAA8BA,CAAE;EAAEC;AAAW,CAAC,EAAG;EACxE,MAAM;IAAEC,wBAAwB;IAAEC;EAAW,CAAC,GAAGZ,SAAS,CAAIa,MAAM,IAAM;IACzE,MAAM;MAAEC,iBAAiB;MAAEC;IAAqB,CAAC,GAChDF,MAAM,CAAEL,WAAY,CAAC;IAEtB,OAAO;MACNG,wBAAwB,EACvBG,i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IACJ,CAAG;IACHC,QAAQ,EAAGA,CAAA,KAAMhB,eAAe,CAAE,KAAM;EAAG,GAEzCf,EAAE,CACH,6IACD,CACc,CAAC;AAElB","ignoreList":[]}
@@ -35,5 +35,16 @@ function EditorHistoryRedo(props, ref) {
35
35
  className: "editor-history__redo"
36
36
  });
37
37
  }
38
+
39
+ /** @typedef {import('react').Ref<HTMLElement>} Ref */
40
+
41
+ /**
42
+ * Renders the redo button for the editor history.
43
+ *
44
+ * @param {Object} props - Props.
45
+ * @param {Ref} ref - Forwarded ref.
46
+ *
47
+ * @return {Component} The component to be rendered.
48
+ */
38
49
  export default forwardRef(EditorHistoryRedo);
39
50
  //# sourceMappingURL=redo.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["__","isRTL","Button","useSelect","useDispatch","displayShortcut","isAppleOS","redo","redoIcon","undo","undoIcon","forwardRef","store","editorStore","EditorHistoryRedo","props","ref","shortcut","primaryShift","primary","hasRedo","select","hasEditorRedo","createElement","icon","label","onClick","undefined","className"],"sources":["@wordpress/editor/src/components/editor-history/redo.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, isRTL } from '@wordpress/i18n';\nimport { Button } from '@wordpress/components';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { displayShortcut, isAppleOS } from '@wordpress/keycodes';\nimport { redo as redoIcon, undo as undoIcon } from '@wordpress/icons';\nimport { forwardRef } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\n\nfunction EditorHistoryRedo( props, ref ) {\n\tconst shortcut = isAppleOS()\n\t\t? displayShortcut.primaryShift( 'z' )\n\t\t: displayShortcut.primary( 'y' );\n\n\tconst hasRedo = useSelect(\n\t\t( select ) => select( editorStore ).hasEditorRedo(),\n\t\t[]\n\t);\n\tconst { redo } = useDispatch( editorStore );\n\treturn (\n\t\t<Button\n\t\t\t{ ...props }\n\t\t\tref={ ref }\n\t\t\ticon={ ! isRTL() ? redoIcon : undoIcon }\n\t\t\t/* translators: button label text should, if possible, be under 16 characters. */\n\t\t\tlabel={ __( 'Redo' ) }\n\t\t\tshortcut={ shortcut }\n\t\t\t// If there are no redo levels we don't want to actually disable this\n\t\t\t// button, because it will remove focus for keyboard users.\n\t\t\t// See: https://github.com/WordPress/gutenberg/issues/3486\n\t\t\taria-disabled={ ! hasRedo }\n\t\t\tonClick={ hasRedo ? redo : undefined }\n\t\t\tclassName=\"editor-history__redo\"\n\t\t/>\n\t);\n}\n\nexport default forwardRef( EditorHistoryRedo );\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,EAAE,EAAEC,KAAK,QAAQ,iBAAiB;AAC3C,SAASC,MAAM,QAAQ,uBAAuB;AAC9C,SAASC,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACxD,SAASC,eAAe,EAAEC,SAAS,QAAQ,qBAAqB;AAChE,SAASC,IAAI,IAAIC,QAAQ,EAAEC,IAAI,IAAIC,QAAQ,QAAQ,kBAAkB;AACrE,SAASC,UAAU,QAAQ,oBAAoB;;AAE/C;AACA;AACA;AACA,SAASC,KAAK,IAAIC,WAAW,QAAQ,aAAa;AAElD,SAASC,iBAAiBA,CAAEC,KAAK,EAAEC,GAAG,EAAG;EACxC,MAAMC,QAAQ,GAAGX,SAAS,CAAC,CAAC,GACzBD,eAAe,CAACa,YAAY,CAAE,GAAI,CAAC,GACnCb,eAAe,CAACc,OAAO,CAAE,GAAI,CAAC;EAEjC,MAAMC,OAAO,GAAGjB,SAAS,CACtBkB,MAAM,IAAMA,MAAM,CAAER,WAAY,CAAC,CAACS,aAAa,CAAC,CAAC,EACnD,EACD,CAAC;EACD,MAAM;IAAEf;EAAK,CAAC,GAAGH,WAAW,CAAES,WAAY,CAAC;EAC3C,OACCU,aAAA,CAACrB,MAAM;IAAA,GACDa,KAAK;IACVC,GAAG,EAAGA,GAAK;IACXQ,IAAI,EAAG,CAAEvB,KAAK,CAAC,CAAC,GAAGO,QAAQ,GAAGE;IAC9B;IACAe,KAAK,EAAGzB,EAAE,CAAE,MAAO,CAAG;IACtBiB,QAAQ,EAAGA;IACX;IACA;IACA;IAAA;IACA,iBAAgB,CAAEG,OAAS;IAC3BM,OAAO,EAAGN,OAAO,GAAGb,IAAI,GAAGoB,SAAW;IACtCC,SAAS,EAAC;EAAsB,CAChC,CAAC;AAEJ;AAEA,eAAejB,UAAU,CAAEG,iBAAkB,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["__","isRTL","Button","useSelect","useDispatch","displayShortcut","isAppleOS","redo","redoIcon","undo","undoIcon","forwardRef","store","editorStore","EditorHistoryRedo","props","ref","shortcut","primaryShift","primary","hasRedo","select","hasEditorRedo","createElement","icon","label","onClick","undefined","className"],"sources":["@wordpress/editor/src/components/editor-history/redo.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, isRTL } from '@wordpress/i18n';\nimport { Button } from '@wordpress/components';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { displayShortcut, isAppleOS } from '@wordpress/keycodes';\nimport { redo as redoIcon, undo as undoIcon } from '@wordpress/icons';\nimport { forwardRef } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\n\nfunction EditorHistoryRedo( props, ref ) {\n\tconst shortcut = isAppleOS()\n\t\t? displayShortcut.primaryShift( 'z' )\n\t\t: displayShortcut.primary( 'y' );\n\n\tconst hasRedo = useSelect(\n\t\t( select ) => select( editorStore ).hasEditorRedo(),\n\t\t[]\n\t);\n\tconst { redo } = useDispatch( editorStore );\n\treturn (\n\t\t<Button\n\t\t\t{ ...props }\n\t\t\tref={ ref }\n\t\t\ticon={ ! isRTL() ? redoIcon : undoIcon }\n\t\t\t/* translators: button label text should, if possible, be under 16 characters. */\n\t\t\tlabel={ __( 'Redo' ) }\n\t\t\tshortcut={ shortcut }\n\t\t\t// If there are no redo levels we don't want to actually disable this\n\t\t\t// button, because it will remove focus for keyboard users.\n\t\t\t// See: https://github.com/WordPress/gutenberg/issues/3486\n\t\t\taria-disabled={ ! hasRedo }\n\t\t\tonClick={ hasRedo ? redo : undefined }\n\t\t\tclassName=\"editor-history__redo\"\n\t\t/>\n\t);\n}\n\n/** @typedef {import('react').Ref<HTMLElement>} Ref */\n\n/**\n * Renders the redo button for the editor history.\n *\n * @param {Object} props - Props.\n * @param {Ref} ref - Forwarded ref.\n *\n * @return {Component} The component to be rendered.\n */\nexport default forwardRef( EditorHistoryRedo );\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,EAAE,EAAEC,KAAK,QAAQ,iBAAiB;AAC3C,SAASC,MAAM,QAAQ,uBAAuB;AAC9C,SAASC,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACxD,SAASC,eAAe,EAAEC,SAAS,QAAQ,qBAAqB;AAChE,SAASC,IAAI,IAAIC,QAAQ,EAAEC,IAAI,IAAIC,QAAQ,QAAQ,kBAAkB;AACrE,SAASC,UAAU,QAAQ,oBAAoB;;AAE/C;AACA;AACA;AACA,SAASC,KAAK,IAAIC,WAAW,QAAQ,aAAa;AAElD,SAASC,iBAAiBA,CAAEC,KAAK,EAAEC,GAAG,EAAG;EACxC,MAAMC,QAAQ,GAAGX,SAAS,CAAC,CAAC,GACzBD,eAAe,CAACa,YAAY,CAAE,GAAI,CAAC,GACnCb,eAAe,CAACc,OAAO,CAAE,GAAI,CAAC;EAEjC,MAAMC,OAAO,GAAGjB,SAAS,CACtBkB,MAAM,IAAMA,MAAM,CAAER,WAAY,CAAC,CAACS,aAAa,CAAC,CAAC,EACnD,EACD,CAAC;EACD,MAAM;IAAEf;EAAK,CAAC,GAAGH,WAAW,CAAES,WAAY,CAAC;EAC3C,OACCU,aAAA,CAACrB,MAAM;IAAA,GACDa,KAAK;IACVC,GAAG,EAAGA,GAAK;IACXQ,IAAI,EAAG,CAAEvB,KAAK,CAAC,CAAC,GAAGO,QAAQ,GAAGE;IAC9B;IACAe,KAAK,EAAGzB,EAAE,CAAE,MAAO,CAAG;IACtBiB,QAAQ,EAAGA;IACX;IACA;IACA;IAAA;IACA,iBAAgB,CAAEG,OAAS;IAC3BM,OAAO,EAAGN,OAAO,GAAGb,IAAI,GAAGoB,SAAW;IACtCC,SAAS,EAAC;EAAsB,CAChC,CAAC;AAEJ;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAejB,UAAU,CAAEG,iBAAkB,CAAC","ignoreList":[]}
@@ -34,5 +34,16 @@ function EditorHistoryUndo(props, ref) {
34
34
  className: "editor-history__undo"
35
35
  });
36
36
  }
37
+
38
+ /** @typedef {import('react').Ref<HTMLElement>} Ref */
39
+
40
+ /**
41
+ * Renders the undo button for the editor history.
42
+ *
43
+ * @param {Object} props - Props.
44
+ * @param {Ref} ref - Forwarded ref.
45
+ *
46
+ * @return {Component} The component to be rendered.
47
+ */
37
48
  export default forwardRef(EditorHistoryUndo);
38
49
  //# sourceMappingURL=undo.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["__","isRTL","Button","useSelect","useDispatch","displayShortcut","undo","undoIcon","redo","redoIcon","forwardRef","store","editorStore","EditorHistoryUndo","props","ref","hasUndo","select","hasEditorUndo","createElement","icon","label","shortcut","primary","onClick","undefined","className"],"sources":["@wordpress/editor/src/components/editor-history/undo.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, isRTL } from '@wordpress/i18n';\nimport { Button } from '@wordpress/components';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { displayShortcut } from '@wordpress/keycodes';\nimport { undo as undoIcon, redo as redoIcon } from '@wordpress/icons';\nimport { forwardRef } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\n\nfunction EditorHistoryUndo( props, ref ) {\n\tconst hasUndo = useSelect(\n\t\t( select ) => select( editorStore ).hasEditorUndo(),\n\t\t[]\n\t);\n\tconst { undo } = useDispatch( editorStore );\n\treturn (\n\t\t<Button\n\t\t\t{ ...props }\n\t\t\tref={ ref }\n\t\t\ticon={ ! isRTL() ? undoIcon : redoIcon }\n\t\t\t/* translators: button label text should, if possible, be under 16 characters. */\n\t\t\tlabel={ __( 'Undo' ) }\n\t\t\tshortcut={ displayShortcut.primary( 'z' ) }\n\t\t\t// If there are no undo levels we don't want to actually disable this\n\t\t\t// button, because it will remove focus for keyboard users.\n\t\t\t// See: https://github.com/WordPress/gutenberg/issues/3486\n\t\t\taria-disabled={ ! hasUndo }\n\t\t\tonClick={ hasUndo ? undo : undefined }\n\t\t\tclassName=\"editor-history__undo\"\n\t\t/>\n\t);\n}\n\nexport default forwardRef( EditorHistoryUndo );\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,EAAE,EAAEC,KAAK,QAAQ,iBAAiB;AAC3C,SAASC,MAAM,QAAQ,uBAAuB;AAC9C,SAASC,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACxD,SAASC,eAAe,QAAQ,qBAAqB;AACrD,SAASC,IAAI,IAAIC,QAAQ,EAAEC,IAAI,IAAIC,QAAQ,QAAQ,kBAAkB;AACrE,SAASC,UAAU,QAAQ,oBAAoB;;AAE/C;AACA;AACA;AACA,SAASC,KAAK,IAAIC,WAAW,QAAQ,aAAa;AAElD,SAASC,iBAAiBA,CAAEC,KAAK,EAAEC,GAAG,EAAG;EACxC,MAAMC,OAAO,GAAGb,SAAS,CACtBc,MAAM,IAAMA,MAAM,CAAEL,WAAY,CAAC,CAACM,aAAa,CAAC,CAAC,EACnD,EACD,CAAC;EACD,MAAM;IAAEZ;EAAK,CAAC,GAAGF,WAAW,CAAEQ,WAAY,CAAC;EAC3C,OACCO,aAAA,CAACjB,MAAM;IAAA,GACDY,KAAK;IACVC,GAAG,EAAGA,GAAK;IACXK,IAAI,EAAG,CAAEnB,KAAK,CAAC,CAAC,GAAGM,QAAQ,GAAGE;IAC9B;IACAY,KAAK,EAAGrB,EAAE,CAAE,MAAO,CAAG;IACtBsB,QAAQ,EAAGjB,eAAe,CAACkB,OAAO,CAAE,GAAI;IACxC;IACA;IACA;IAAA;IACA,iBAAgB,CAAEP,OAAS;IAC3BQ,OAAO,EAAGR,OAAO,GAAGV,IAAI,GAAGmB,SAAW;IACtCC,SAAS,EAAC;EAAsB,CAChC,CAAC;AAEJ;AAEA,eAAehB,UAAU,CAAEG,iBAAkB,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["__","isRTL","Button","useSelect","useDispatch","displayShortcut","undo","undoIcon","redo","redoIcon","forwardRef","store","editorStore","EditorHistoryUndo","props","ref","hasUndo","select","hasEditorUndo","createElement","icon","label","shortcut","primary","onClick","undefined","className"],"sources":["@wordpress/editor/src/components/editor-history/undo.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, isRTL } from '@wordpress/i18n';\nimport { Button } from '@wordpress/components';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { displayShortcut } from '@wordpress/keycodes';\nimport { undo as undoIcon, redo as redoIcon } from '@wordpress/icons';\nimport { forwardRef } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\n\nfunction EditorHistoryUndo( props, ref ) {\n\tconst hasUndo = useSelect(\n\t\t( select ) => select( editorStore ).hasEditorUndo(),\n\t\t[]\n\t);\n\tconst { undo } = useDispatch( editorStore );\n\treturn (\n\t\t<Button\n\t\t\t{ ...props }\n\t\t\tref={ ref }\n\t\t\ticon={ ! isRTL() ? undoIcon : redoIcon }\n\t\t\t/* translators: button label text should, if possible, be under 16 characters. */\n\t\t\tlabel={ __( 'Undo' ) }\n\t\t\tshortcut={ displayShortcut.primary( 'z' ) }\n\t\t\t// If there are no undo levels we don't want to actually disable this\n\t\t\t// button, because it will remove focus for keyboard users.\n\t\t\t// See: https://github.com/WordPress/gutenberg/issues/3486\n\t\t\taria-disabled={ ! hasUndo }\n\t\t\tonClick={ hasUndo ? undo : undefined }\n\t\t\tclassName=\"editor-history__undo\"\n\t\t/>\n\t);\n}\n\n/** @typedef {import('react').Ref<HTMLElement>} Ref */\n\n/**\n * Renders the undo button for the editor history.\n *\n * @param {Object} props - Props.\n * @param {Ref} ref - Forwarded ref.\n *\n * @return {Component} The component to be rendered.\n */\nexport default forwardRef( EditorHistoryUndo );\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,EAAE,EAAEC,KAAK,QAAQ,iBAAiB;AAC3C,SAASC,MAAM,QAAQ,uBAAuB;AAC9C,SAASC,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACxD,SAASC,eAAe,QAAQ,qBAAqB;AACrD,SAASC,IAAI,IAAIC,QAAQ,EAAEC,IAAI,IAAIC,QAAQ,QAAQ,kBAAkB;AACrE,SAASC,UAAU,QAAQ,oBAAoB;;AAE/C;AACA;AACA;AACA,SAASC,KAAK,IAAIC,WAAW,QAAQ,aAAa;AAElD,SAASC,iBAAiBA,CAAEC,KAAK,EAAEC,GAAG,EAAG;EACxC,MAAMC,OAAO,GAAGb,SAAS,CACtBc,MAAM,IAAMA,MAAM,CAAEL,WAAY,CAAC,CAACM,aAAa,CAAC,CAAC,EACnD,EACD,CAAC;EACD,MAAM;IAAEZ;EAAK,CAAC,GAAGF,WAAW,CAAEQ,WAAY,CAAC;EAC3C,OACCO,aAAA,CAACjB,MAAM;IAAA,GACDY,KAAK;IACVC,GAAG,EAAGA,GAAK;IACXK,IAAI,EAAG,CAAEnB,KAAK,CAAC,CAAC,GAAGM,QAAQ,GAAGE;IAC9B;IACAY,KAAK,EAAGrB,EAAE,CAAE,MAAO,CAAG;IACtBsB,QAAQ,EAAGjB,eAAe,CAACkB,OAAO,CAAE,GAAI;IACxC;IACA;IACA;IAAA;IACA,iBAAgB,CAAEP,OAAS;IAC3BQ,OAAO,EAAGR,OAAO,GAAGV,IAAI,GAAGmB,SAAW;IACtCC,SAAS,EAAC;EAAsB,CAChC,CAAC;AAEJ;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAehB,UAAU,CAAEG,iBAAkB,CAAC","ignoreList":[]}
@@ -8,6 +8,12 @@ import { store as noticesStore } from '@wordpress/notices';
8
8
 
9
9
  // Last three notices. Slices from the tail end of the list.
10
10
  const MAX_VISIBLE_NOTICES = -3;
11
+
12
+ /**
13
+ * Renders the editor snackbars component.
14
+ *
15
+ * @return {JSX.Element} The rendered component.
16
+ */
11
17
  export default function EditorSnackbars() {
12
18
  const notices = useSelect(select => select(noticesStore).getNotices(), []);
13
19
  const {
@@ -1 +1 @@
1
- {"version":3,"names":["SnackbarList","useSelect","useDispatch","store","noticesStore","MAX_VISIBLE_NOTICES","EditorSnackbars","notices","select","getNotices","removeNotice","snackbarNotices","filter","type","slice","createElement","className","onRemove"],"sources":["@wordpress/editor/src/components/editor-snackbars/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { SnackbarList } from '@wordpress/components';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as noticesStore } from '@wordpress/notices';\n\n// Last three notices. Slices from the tail end of the list.\nconst MAX_VISIBLE_NOTICES = -3;\n\nexport default function EditorSnackbars() {\n\tconst notices = useSelect(\n\t\t( select ) => select( noticesStore ).getNotices(),\n\t\t[]\n\t);\n\tconst { removeNotice } = useDispatch( noticesStore );\n\tconst snackbarNotices = notices\n\t\t.filter( ( { type } ) => type === 'snackbar' )\n\t\t.slice( MAX_VISIBLE_NOTICES );\n\n\treturn (\n\t\t<SnackbarList\n\t\t\tnotices={ snackbarNotices }\n\t\t\tclassName=\"components-editor-notices__snackbar\"\n\t\t\tonRemove={ removeNotice }\n\t\t/>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,YAAY,QAAQ,uBAAuB;AACpD,SAASC,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACxD,SAASC,KAAK,IAAIC,YAAY,QAAQ,oBAAoB;;AAE1D;AACA,MAAMC,mBAAmB,GAAG,CAAC,CAAC;AAE9B,eAAe,SAASC,eAAeA,CAAA,EAAG;EACzC,MAAMC,OAAO,GAAGN,SAAS,CACtBO,MAAM,IAAMA,MAAM,CAAEJ,YAAa,CAAC,CAACK,UAAU,CAAC,CAAC,EACjD,EACD,CAAC;EACD,MAAM;IAAEC;EAAa,CAAC,GAAGR,WAAW,CAAEE,YAAa,CAAC;EACpD,MAAMO,eAAe,GAAGJ,OAAO,CAC7BK,MAAM,CAAE,CAAE;IAAEC;EAAK,CAAC,KAAMA,IAAI,KAAK,UAAW,CAAC,CAC7CC,KAAK,CAAET,mBAAoB,CAAC;EAE9B,OACCU,aAAA,CAACf,YAAY;IACZO,OAAO,EAAGI,eAAiB;IAC3BK,SAAS,EAAC,qCAAqC;IAC/CC,QAAQ,EAAGP;EAAc,CACzB,CAAC;AAEJ","ignoreList":[]}
1
+ {"version":3,"names":["SnackbarList","useSelect","useDispatch","store","noticesStore","MAX_VISIBLE_NOTICES","EditorSnackbars","notices","select","getNotices","removeNotice","snackbarNotices","filter","type","slice","createElement","className","onRemove"],"sources":["@wordpress/editor/src/components/editor-snackbars/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { SnackbarList } from '@wordpress/components';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as noticesStore } from '@wordpress/notices';\n\n// Last three notices. Slices from the tail end of the list.\nconst MAX_VISIBLE_NOTICES = -3;\n\n/**\n * Renders the editor snackbars component.\n *\n * @return {JSX.Element} The rendered component.\n */\nexport default function EditorSnackbars() {\n\tconst notices = useSelect(\n\t\t( select ) => select( noticesStore ).getNotices(),\n\t\t[]\n\t);\n\tconst { removeNotice } = useDispatch( noticesStore );\n\tconst snackbarNotices = notices\n\t\t.filter( ( { type } ) => type === 'snackbar' )\n\t\t.slice( MAX_VISIBLE_NOTICES );\n\n\treturn (\n\t\t<SnackbarList\n\t\t\tnotices={ snackbarNotices }\n\t\t\tclassName=\"components-editor-notices__snackbar\"\n\t\t\tonRemove={ removeNotice }\n\t\t/>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,YAAY,QAAQ,uBAAuB;AACpD,SAASC,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACxD,SAASC,KAAK,IAAIC,YAAY,QAAQ,oBAAoB;;AAE1D;AACA,MAAMC,mBAAmB,GAAG,CAAC,CAAC;;AAE9B;AACA;AACA;AACA;AACA;AACA,eAAe,SAASC,eAAeA,CAAA,EAAG;EACzC,MAAMC,OAAO,GAAGN,SAAS,CACtBO,MAAM,IAAMA,MAAM,CAAEJ,YAAa,CAAC,CAACK,UAAU,CAAC,CAAC,EACjD,EACD,CAAC;EACD,MAAM;IAAEC;EAAa,CAAC,GAAGR,WAAW,CAAEE,YAAa,CAAC;EACpD,MAAMO,eAAe,GAAGJ,OAAO,CAC7BK,MAAM,CAAE,CAAE;IAAEC;EAAK,CAAC,KAAMA,IAAI,KAAK,UAAW,CAAC,CAC7CC,KAAK,CAAET,mBAAoB,CAAC;EAE9B,OACCU,aAAA,CAACf,YAAY;IACZO,OAAO,EAAGI,eAAiB;IAC3BK,SAAS,EAAC,qCAAqC;IAC/CC,QAAQ,EAAGP;EAAc,CACzB,CAAC;AAEJ","ignoreList":[]}
@@ -10,6 +10,14 @@ import { store as blockEditorStore } from '@wordpress/block-editor';
10
10
  * Internal dependencies
11
11
  */
12
12
  import { store as editorStore } from '../../store';
13
+
14
+ /**
15
+ * Component handles the keyboard shortcuts for the editor.
16
+ *
17
+ * It provides functionality for various keyboard shortcuts such as toggling editor mode,
18
+ * toggling distraction-free mode, undo/redo, saving the post, toggling list view,
19
+ * and toggling the sidebar.
20
+ */
13
21
  export default function EditorKeyboardShortcuts() {
14
22
  const isModeToggleDisabled = useSelect(select => {
15
23
  const {
@@ -1 +1 @@
1
- {"version":3,"names":["useShortcut","useDispatch","useSelect","store","interfaceStore","blockEditorStore","editorStore","EditorKeyboardShortcuts","isModeToggleDisabled","select","richEditingEnabled","codeEditingEnabled","getEditorSettings","getBlockSelectionStart","getActiveComplementaryArea","enableComplementaryArea","disableComplementaryArea","redo","undo","savePost","setIsListViewOpened","switchEditorMode","toggleDistractionFree","isEditedPostDirty","isPostSavingLocked","isListViewOpened","getEditorMode","isDisabled","event","preventDefault","isEditorSidebarOpened","includes","sidebarToOpen"],"sources":["@wordpress/editor/src/components/global-keyboard-shortcuts/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useShortcut } from '@wordpress/keyboard-shortcuts';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { store as interfaceStore } from '@wordpress/interface';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\n\nexport default function EditorKeyboardShortcuts() {\n\tconst isModeToggleDisabled = useSelect( ( select ) => {\n\t\tconst { richEditingEnabled, codeEditingEnabled } =\n\t\t\tselect( editorStore ).getEditorSettings();\n\t\treturn ! richEditingEnabled || ! codeEditingEnabled;\n\t}, [] );\n\tconst { getBlockSelectionStart } = useSelect( blockEditorStore );\n\tconst { getActiveComplementaryArea } = useSelect( interfaceStore );\n\tconst { enableComplementaryArea, disableComplementaryArea } =\n\t\tuseDispatch( interfaceStore );\n\tconst {\n\t\tredo,\n\t\tundo,\n\t\tsavePost,\n\t\tsetIsListViewOpened,\n\t\tswitchEditorMode,\n\t\ttoggleDistractionFree,\n\t} = useDispatch( editorStore );\n\tconst {\n\t\tisEditedPostDirty,\n\t\tisPostSavingLocked,\n\t\tisListViewOpened,\n\t\tgetEditorMode,\n\t} = useSelect( editorStore );\n\n\tuseShortcut(\n\t\t'core/editor/toggle-mode',\n\t\t() => {\n\t\t\tswitchEditorMode(\n\t\t\t\tgetEditorMode() === 'visual' ? 'text' : 'visual'\n\t\t\t);\n\t\t},\n\t\t{\n\t\t\tisDisabled: isModeToggleDisabled,\n\t\t}\n\t);\n\n\tuseShortcut( 'core/editor/toggle-distraction-free', () => {\n\t\ttoggleDistractionFree();\n\t} );\n\n\tuseShortcut( 'core/editor/undo', ( event ) => {\n\t\tundo();\n\t\tevent.preventDefault();\n\t} );\n\n\tuseShortcut( 'core/editor/redo', ( event ) => {\n\t\tredo();\n\t\tevent.preventDefault();\n\t} );\n\n\tuseShortcut( 'core/editor/save', ( event ) => {\n\t\tevent.preventDefault();\n\n\t\t/**\n\t\t * Do not save the post if post saving is locked.\n\t\t */\n\t\tif ( isPostSavingLocked() ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// TODO: This should be handled in the `savePost` effect in\n\t\t// considering `isSaveable`. See note on `isEditedPostSaveable`\n\t\t// selector about dirtiness and meta-boxes.\n\t\t//\n\t\t// See: `isEditedPostSaveable`\n\t\tif ( ! isEditedPostDirty() ) {\n\t\t\treturn;\n\t\t}\n\n\t\tsavePost();\n\t} );\n\n\t// Only opens the list view. Other functionality for this shortcut happens in the rendered sidebar.\n\tuseShortcut( 'core/editor/toggle-list-view', ( event ) => {\n\t\tif ( ! isListViewOpened() ) {\n\t\t\tevent.preventDefault();\n\t\t\tsetIsListViewOpened( true );\n\t\t}\n\t} );\n\n\tuseShortcut( 'core/editor/toggle-sidebar', ( event ) => {\n\t\t// This shortcut has no known clashes, but use preventDefault to prevent any\n\t\t// obscure shortcuts from triggering.\n\t\tevent.preventDefault();\n\t\tconst isEditorSidebarOpened = [\n\t\t\t'edit-post/document',\n\t\t\t'edit-post/block',\n\t\t].includes( getActiveComplementaryArea( 'core' ) );\n\n\t\tif ( isEditorSidebarOpened ) {\n\t\t\tdisableComplementaryArea( 'core' );\n\t\t} else {\n\t\t\tconst sidebarToOpen = getBlockSelectionStart()\n\t\t\t\t? 'edit-post/block'\n\t\t\t\t: 'edit-post/document';\n\t\t\tenableComplementaryArea( 'core', sidebarToOpen );\n\t\t}\n\t} );\n\n\treturn null;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,WAAW,QAAQ,+BAA+B;AAC3D,SAASC,WAAW,EAAEC,SAAS,QAAQ,iBAAiB;AACxD,SAASC,KAAK,IAAIC,cAAc,QAAQ,sBAAsB;AAC9D,SAASD,KAAK,IAAIE,gBAAgB,QAAQ,yBAAyB;;AAEnE;AACA;AACA;AACA,SAASF,KAAK,IAAIG,WAAW,QAAQ,aAAa;AAElD,eAAe,SAASC,uBA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,CAAC;EAEH7B,WAAW,CAAE,kBAAkB,EAAI4B,KAAK,IAAM;IAC7CA,KAAK,CAACC,cAAc,CAAC,CAAC;;IAEtB;AACF;AACA;IACE,IAAKL,kBAAkB,CAAC,CAAC,EAAG;MAC3B;IACD;;IAEA;IACA;IACA;IACA;IACA;IACA,IAAK,CAAED,iBAAiB,CAAC,CAAC,EAAG;MAC5B;IACD;IAEAJ,QAAQ,CAAC,CAAC;EACX,CAAE,CAAC;;EAEH;EACAnB,WAAW,CAAE,8BAA8B,EAAI4B,KAAK,IAAM;IACzD,IAAK,CAAEH,gBAAgB,CAAC,CAAC,EAAG;MAC3BG,KAAK,CAACC,cAAc,CAAC,CAAC;MACtBT,mBAAmB,CAAE,IAAK,CAAC;IAC5B;EACD,CAAE,CAAC;EAEHpB,WAAW,CAAE,4BAA4B,EAAI4B,KAAK,IAAM;IACvD;IACA;IACAA,KAAK,CAACC,cAAc,CAAC,CAAC;IACtB,MAAMC,qBAAqB,GAAG,CAC7B,oBAAoB,EACpB,iBAAiB,CACjB,CAACC,QAAQ,CAAEjB,0BAA0B,CAAE,MAAO,CAAE,CAAC;IAElD,IAAKgB,qBAAqB,EAAG;MAC5Bd,wBAAwB,CAAE,MAAO,CAAC;IACnC,CAAC,MAAM;MACN,MAAMgB,aAAa,GAAGnB,sBAAsB,CAAC,CAAC,GAC3C,iBAAiB,GACjB,oBAAoB;MACvBE,uBAAuB,CAAE,MAAM,EAAEiB,aAAc,CAAC;IACjD;EACD,CAAE,CAAC;EAEH,OAAO,IAAI;AACZ","ignoreList":[]}
1
+ {"version":3,"names":["useShortcut","useDispatch","useSelect","store","interfaceStore","blockEditorStore","editorStore","EditorKeyboardShortcuts","isModeToggleDisabled","select","richEditingEnabled","codeEditingEnabled","getEditorSettings","getBlockSelectionStart","getActiveComplementaryArea","enableComplementaryArea","disableComplementaryArea","redo","undo","savePost","setIsListViewOpened","switchEditorMode","toggleDistractionFree","isEditedPostDirty","isPostSavingLocked","isListViewOpened","getEditorMode","isDisabled","event","preventDefault","isEditorSidebarOpened","includes","sidebarToOpen"],"sources":["@wordpress/editor/src/components/global-keyboard-shortcuts/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useShortcut } from '@wordpress/keyboard-shortcuts';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { store as interfaceStore } from '@wordpress/interface';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\n\n/**\n * Component handles the keyboard shortcuts for the editor.\n *\n * It provides functionality for various keyboard shortcuts such as toggling editor mode,\n * toggling distraction-free mode, undo/redo, saving the post, toggling list view,\n * and toggling the sidebar.\n */\nexport default function EditorKeyboardShortcuts() {\n\tconst isModeToggleDisabled = useSelect( ( select ) => {\n\t\tconst { richEditingEnabled, codeEditingEnabled } =\n\t\t\tselect( editorStore ).getEditorSettings();\n\t\treturn ! richEditingEnabled || ! codeEditingEnabled;\n\t}, [] );\n\tconst { getBlockSelectionStart } = useSelect( blockEditorStore );\n\tconst { getActiveComplementaryArea } = useSelect( interfaceStore );\n\tconst { enableComplementaryArea, disableComplementaryArea } =\n\t\tuseDispatch( interfaceStore );\n\tconst {\n\t\tredo,\n\t\tundo,\n\t\tsavePost,\n\t\tsetIsListViewOpened,\n\t\tswitchEditorMode,\n\t\ttoggleDistractionFree,\n\t} = useDispatch( editorStore );\n\tconst {\n\t\tisEditedPostDirty,\n\t\tisPostSavingLocked,\n\t\tisListViewOpened,\n\t\tgetEditorMode,\n\t} = useSelect( editorStore );\n\n\tuseShortcut(\n\t\t'core/editor/toggle-mode',\n\t\t() => {\n\t\t\tswitchEditorMode(\n\t\t\t\tgetEditorMode() === 'visual' ? 'text' : 'visual'\n\t\t\t);\n\t\t},\n\t\t{\n\t\t\tisDisabled: isModeToggleDisabled,\n\t\t}\n\t);\n\n\tuseShortcut( 'core/editor/toggle-distraction-free', () => {\n\t\ttoggleDistractionFree();\n\t} );\n\n\tuseShortcut( 'core/editor/undo', ( event ) => {\n\t\tundo();\n\t\tevent.preventDefault();\n\t} );\n\n\tuseShortcut( 'core/editor/redo', ( event ) => {\n\t\tredo();\n\t\tevent.preventDefault();\n\t} );\n\n\tuseShortcut( 'core/editor/save', ( event ) => {\n\t\tevent.preventDefault();\n\n\t\t/**\n\t\t * Do not save the post if post saving is locked.\n\t\t */\n\t\tif ( isPostSavingLocked() ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// TODO: This should be handled in the `savePost` effect in\n\t\t// considering `isSaveable`. See note on `isEditedPostSaveable`\n\t\t// selector about dirtiness and meta-boxes.\n\t\t//\n\t\t// See: `isEditedPostSaveable`\n\t\tif ( ! isEditedPostDirty() ) {\n\t\t\treturn;\n\t\t}\n\n\t\tsavePost();\n\t} );\n\n\t// Only opens the list view. Other functionality for this shortcut happens in the rendered sidebar.\n\tuseShortcut( 'core/editor/toggle-list-view', ( event ) => {\n\t\tif ( ! isListViewOpened() ) {\n\t\t\tevent.preventDefault();\n\t\t\tsetIsListViewOpened( true );\n\t\t}\n\t} );\n\n\tuseShortcut( 'core/editor/toggle-sidebar', ( event ) => {\n\t\t// This shortcut has no known clashes, but use preventDefault to prevent any\n\t\t// obscure shortcuts from triggering.\n\t\tevent.preventDefault();\n\t\tconst isEditorSidebarOpened = [\n\t\t\t'edit-post/document',\n\t\t\t'edit-post/block',\n\t\t].includes( getActiveComplementaryArea( 'core' ) );\n\n\t\tif ( isEditorSidebarOpened ) {\n\t\t\tdisableComplementaryArea( 'core' );\n\t\t} else {\n\t\t\tconst sidebarToOpen = getBlockSelectionStart()\n\t\t\t\t? 'edit-post/block'\n\t\t\t\t: 'edit-post/document';\n\t\t\tenableComplementaryArea( 'core', sidebarToOpen );\n\t\t}\n\t} );\n\n\treturn null;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,WAAW,QAAQ,+BAA+B;AAC3D,SAASC,WAAW,EAAEC,SAAS,QAAQ,iBAAiB;AACxD,SAASC,KAAK,IAAIC,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@wordpress/block-editor';
9
9
  import { store as keyboardShortcutsStore } from '@wordpress/keyboard-shortcuts';
10
10
  import { isAppleOS } from '@wordpress/keycodes';
11
+
12
+ /**
13
+ * Component for registering editor keyboard shortcuts.
14
+ *
15
+ * @return {Element} The component to be rendered.
16
+ */
11
17
  function EditorKeyboardShortcutsRegister() {
12
18
  // Registering the shortcuts.
13
19
  const {
@@ -94,6 +100,35 @@ function EditorKeyboardShortcutsRegister() {
94
100
  character: 'h'
95
101
  }
96
102
  });
103
+ registerShortcut({
104
+ name: 'core/editor/next-region',
105
+ category: 'global',
106
+ description: __('Navigate to the next part of the editor.'),
107
+ keyCombination: {
108
+ modifier: 'ctrl',
109
+ character: '`'
110
+ },
111
+ aliases: [{
112
+ modifier: 'access',
113
+ character: 'n'
114
+ }]
115
+ });
116
+ registerShortcut({
117
+ name: 'core/editor/previous-region',
118
+ category: 'global',
119
+ description: __('Navigate to the previous part of the editor.'),
120
+ keyCombination: {
121
+ modifier: 'ctrlShift',
122
+ character: '`'
123
+ },
124
+ aliases: [{
125
+ modifier: 'access',
126
+ character: 'p'
127
+ }, {
128
+ modifier: 'ctrlShift',
129
+ character: '~'
130
+ }]
131
+ });
97
132
  }, [registerShortcut]);
98
133
  return createElement(BlockEditorKeyboardShortcuts.Register, null);
99
134
  }
@@ -1 +1 @@
1
- {"version":3,"names":["useEffect","useDispatch","__","BlockEditorKeyboardShortcuts","store","keyboardShortcutsStore","isAppleOS","EditorKeyboardShortcutsRegister","registerShortcut","name","category","description","keyCombination","modifier","character","aliases","createElement","Register"],"sources":["@wordpress/editor/src/components/global-keyboard-shortcuts/register-shortcuts.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useEffect } from '@wordpress/element';\nimport { useDispatch } from '@wordpress/data';\nimport { __ } from '@wordpress/i18n';\nimport { BlockEditorKeyboardShortcuts } from '@wordpress/block-editor';\nimport { store as keyboardShortcutsStore } from '@wordpress/keyboard-shortcuts';\nimport { isAppleOS } from '@wordpress/keycodes';\n\nfunction EditorKeyboardShortcutsRegister() {\n\t// Registering the shortcuts.\n\tconst { registerShortcut } = useDispatch( keyboardShortcutsStore );\n\tuseEffect( () => {\n\t\tregisterShortcut( {\n\t\t\tname: 'core/editor/toggle-mode',\n\t\t\tcategory: 'global',\n\t\t\tdescription: __( 'Switch between visual editor and code editor.' ),\n\t\t\tkeyCombination: {\n\t\t\t\tmodifier: 'secondary',\n\t\t\t\tcharacter: 'm',\n\t\t\t},\n\t\t} );\n\n\t\tregisterShortcut( {\n\t\t\tname: 'core/editor/save',\n\t\t\tcategory: 'global',\n\t\t\tdescription: __( 'Save your changes.' ),\n\t\t\tkeyCombination: {\n\t\t\t\tmodifier: 'primary',\n\t\t\t\tcharacter: 's',\n\t\t\t},\n\t\t} );\n\n\t\tregisterShortcut( {\n\t\t\tname: 'core/editor/undo',\n\t\t\tcategory: 'global',\n\t\t\tdescription: __( 'Undo your last changes.' ),\n\t\t\tkeyCombination: {\n\t\t\t\tmodifier: 'primary',\n\t\t\t\tcharacter: 'z',\n\t\t\t},\n\t\t} );\n\n\t\tregisterShortcut( {\n\t\t\tname: 'core/editor/redo',\n\t\t\tcategory: 'global',\n\t\t\tdescription: __( 'Redo your last undo.' ),\n\t\t\tkeyCombination: {\n\t\t\t\tmodifier: 'primaryShift',\n\t\t\t\tcharacter: 'z',\n\t\t\t},\n\t\t\t// Disable on Apple OS because it conflicts with the browser's\n\t\t\t// history shortcut. It's a fine alias for both Windows and Linux.\n\t\t\t// Since there's no conflict for Ctrl+Shift+Z on both Windows and\n\t\t\t// Linux, we keep it as the default for consistency.\n\t\t\taliases: isAppleOS()\n\t\t\t\t? []\n\t\t\t\t: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tmodifier: 'primary',\n\t\t\t\t\t\t\tcharacter: 'y',\n\t\t\t\t\t\t},\n\t\t\t\t ],\n\t\t} );\n\n\t\tregisterShortcut( {\n\t\t\tname: 'core/editor/toggle-list-view',\n\t\t\tcategory: 'global',\n\t\t\tdescription: __( 'Open the block list view.' ),\n\t\t\tkeyCombination: {\n\t\t\t\tmodifier: 'access',\n\t\t\t\tcharacter: 'o',\n\t\t\t},\n\t\t} );\n\n\t\tregisterShortcut( {\n\t\t\tname: 'core/editor/toggle-distraction-free',\n\t\t\tcategory: 'global',\n\t\t\tdescription: __( 'Toggle distraction free mode.' ),\n\t\t\tkeyCombination: {\n\t\t\t\tmodifier: 'primaryShift',\n\t\t\t\tcharacter: '\\\\',\n\t\t\t},\n\t\t} );\n\n\t\tregisterShortcut( {\n\t\t\tname: 'core/editor/toggle-sidebar',\n\t\t\tcategory: 'global',\n\t\t\tdescription: __( 'Show or hide the Settings sidebar.' ),\n\t\t\tkeyCombination: {\n\t\t\t\tmodifier: 'primaryShift',\n\t\t\t\tcharacter: ',',\n\t\t\t},\n\t\t} );\n\n\t\tregisterShortcut( {\n\t\t\tname: 'core/editor/keyboard-shortcuts',\n\t\t\tcategory: 'main',\n\t\t\tdescription: __( 'Display these keyboard shortcuts.' ),\n\t\t\tkeyCombination: {\n\t\t\t\tmodifier: 'access',\n\t\t\t\tcharacter: 'h',\n\t\t\t},\n\t\t} );\n\t}, [ registerShortcut ] );\n\n\treturn <BlockEditorKeyboardShortcuts.Register />;\n}\n\nexport default EditorKeyboardShortcutsRegister;\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,SAAS,QAAQ,oBAAoB;AAC9C,SAASC,WAAW,QAAQ,iBAAiB;AAC7C,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SAASC,4BAA4B,QAAQ,yBAAyB;AACtE,SAASC,KAAK,IAAIC,sBAAsB,QAAQ,+BAA+B;AAC/E,SAASC,SAAS,QAAQ,qBAAqB;AAE/C,SAASC,+BAA+BA,CAAA,EAAG;EAC1C;EACA,MAAM;IAAEC;EAAiB,CAAC,GAAGP,WAAW,CAAEI,sBAAuB,CAAC;EAClEL,SAAS,CAAE,MAAM;IAChBQ,gBAAgB,CAAE;MACjBC,IAAI,EAAE,yBAAyB;M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,EAAET,EAAE,CAAE,+BAAgC,CAAC;MAClDU,cAAc,EAAE;QACfC,QAAQ,EAAE,cAAc;QACxBC,SAAS,EAAE;MACZ;IACD,CAAE,CAAC;IAEHN,gBAAgB,CAAE;MACjBC,IAAI,EAAE,4BAA4B;MAClCC,QAAQ,EAAE,QAAQ;MAClBC,WAAW,EAAET,EAAE,CAAE,oCAAqC,CAAC;MACvDU,cAAc,EAAE;QACfC,QAAQ,EAAE,cAAc;QACxBC,SAAS,EAAE;MACZ;IACD,CAAE,CAAC;IAEHN,gBAAgB,CAAE;MACjBC,IAAI,EAAE,gCAAgC;MACtCC,QAAQ,EAAE,MAAM;MAChBC,WAAW,EAAET,EAAE,CAAE,mCAAoC,CAAC;MACtDU,cAAc,EAAE;QACfC,QAAQ,EAAE,QAAQ;QAClBC,SAAS,EAAE;MACZ;IACD,CAAE,CAAC;EACJ,CAAC,EAAE,CAAEN,gBAAgB,CAAG,CAAC;EAEzB,OAAOQ,aAAA,CAACb,4BAA4B,CAACc,QAAQ,MAAE,CAAC;AACjD;AAEA,eAAeV,+BAA+B","ignoreList":[]}
1
+ {"version":3,"names":["useEffect","useDispatch","__","BlockEditorKeyboardShortcuts","store","keyboardShortcutsStore","isAppleOS","EditorKeyboardShortcutsRegister","registerShortcut","name","category","description","keyCombination","modifier","character","aliases","createElement","Register"],"sources":["@wordpress/editor/src/components/global-keyboard-shortcuts/register-shortcuts.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useEffect } from '@wordpress/element';\nimport { useDispatch } from '@wordpress/data';\nimport { __ } from '@wordpress/i18n';\nimport { BlockEditorKeyboardShortcuts } from '@wordpress/block-editor';\nimport { store as keyboardShortcutsStore } from '@wordpress/keyboard-shortcuts';\nimport { isAppleOS } from '@wordpress/keycodes';\n\n/**\n * Component for registering editor keyboard shortcuts.\n *\n * @return {Element} The component to be rendered.\n */\nfunction EditorKeyboardShortcutsRegister() {\n\t// Registering the shortcuts.\n\tconst { registerShortcut } = useDispatch( keyboardShortcutsStore );\n\tuseEffect( () => {\n\t\tregisterShortcut( {\n\t\t\tname: 'core/editor/toggle-mode',\n\t\t\tcategory: 'global',\n\t\t\tdescription: __( 'Switch between visual editor and code editor.' ),\n\t\t\tkeyCombination: {\n\t\t\t\tmodifier: 'secondary',\n\t\t\t\tcharacter: 'm',\n\t\t\t},\n\t\t} );\n\n\t\tregisterShortcut( {\n\t\t\tname: 'core/editor/save',\n\t\t\tcategory: 'global',\n\t\t\tdescription: __( 'Save your changes.' ),\n\t\t\tkeyCombination: {\n\t\t\t\tmodifier: 'primary',\n\t\t\t\tcharacter: 's',\n\t\t\t},\n\t\t} );\n\n\t\tregisterShortcut( {\n\t\t\tname: 'core/editor/undo',\n\t\t\tcategory: 'global',\n\t\t\tdescription: __( 'Undo your last changes.' ),\n\t\t\tkeyCombination: {\n\t\t\t\tmodifier: 'primary',\n\t\t\t\tcharacter: 'z',\n\t\t\t},\n\t\t} );\n\n\t\tregisterShortcut( {\n\t\t\tname: 'core/editor/redo',\n\t\t\tcategory: 'global',\n\t\t\tdescription: __( 'Redo your last undo.' ),\n\t\t\tkeyCombination: {\n\t\t\t\tmodifier: 'primaryShift',\n\t\t\t\tcharacter: 'z',\n\t\t\t},\n\t\t\t// Disable on Apple OS because it conflicts with the browser's\n\t\t\t// history shortcut. It's a fine alias for both Windows and Linux.\n\t\t\t// Since there's no conflict for Ctrl+Shift+Z on both Windows and\n\t\t\t// Linux, we keep it as the default for consistency.\n\t\t\taliases: isAppleOS()\n\t\t\t\t? []\n\t\t\t\t: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tmodifier: 'primary',\n\t\t\t\t\t\t\tcharacter: 'y',\n\t\t\t\t\t\t},\n\t\t\t\t ],\n\t\t} );\n\n\t\tregisterShortcut( {\n\t\t\tname: 'core/editor/toggle-list-view',\n\t\t\tcategory: 'global',\n\t\t\tdescription: __( 'Open the block list view.' ),\n\t\t\tkeyCombination: {\n\t\t\t\tmodifier: 'access',\n\t\t\t\tcharacter: 'o',\n\t\t\t},\n\t\t} );\n\n\t\tregisterShortcut( {\n\t\t\tname: 'core/editor/toggle-distraction-free',\n\t\t\tcategory: 'global',\n\t\t\tdescription: __( 'Toggle distraction free mode.' ),\n\t\t\tkeyCombination: {\n\t\t\t\tmodifier: 'primaryShift',\n\t\t\t\tcharacter: '\\\\',\n\t\t\t},\n\t\t} );\n\n\t\tregisterShortcut( {\n\t\t\tname: 'core/editor/toggle-sidebar',\n\t\t\tcategory: 'global',\n\t\t\tdescription: __( 'Show or hide the Settings sidebar.' ),\n\t\t\tkeyCombination: {\n\t\t\t\tmodifier: 'primaryShift',\n\t\t\t\tcharacter: ',',\n\t\t\t},\n\t\t} );\n\n\t\tregisterShortcut( {\n\t\t\tname: 'core/editor/keyboard-shortcuts',\n\t\t\tcategory: 'main',\n\t\t\tdescription: __( 'Display these keyboard shortcuts.' ),\n\t\t\tkeyCombination: {\n\t\t\t\tmodifier: 'access',\n\t\t\t\tcharacter: 'h',\n\t\t\t},\n\t\t} );\n\n\t\tregisterShortcut( {\n\t\t\tname: 'core/editor/next-region',\n\t\t\tcategory: 'global',\n\t\t\tdescription: __( 'Navigate to the next part of the editor.' ),\n\t\t\tkeyCombination: {\n\t\t\t\tmodifier: 'ctrl',\n\t\t\t\tcharacter: '`',\n\t\t\t},\n\t\t\taliases: [\n\t\t\t\t{\n\t\t\t\t\tmodifier: 'access',\n\t\t\t\t\tcharacter: 'n',\n\t\t\t\t},\n\t\t\t],\n\t\t} );\n\n\t\tregisterShortcut( {\n\t\t\tname: 'core/editor/previous-region',\n\t\t\tcategory: 'global',\n\t\t\tdescription: __( 'Navigate to the previous part of the editor.' ),\n\t\t\tkeyCombination: {\n\t\t\t\tmodifier: 'ctrlShift',\n\t\t\t\tcharacter: '`',\n\t\t\t},\n\t\t\taliases: [\n\t\t\t\t{\n\t\t\t\t\tmodifier: 'access',\n\t\t\t\t\tcharacter: 'p',\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tmodifier: 'ctrlShift',\n\t\t\t\t\tcharacter: '~',\n\t\t\t\t},\n\t\t\t],\n\t\t} );\n\t}, [ registerShortcut ] );\n\n\treturn <BlockEditorKeyboardShortcuts.Register />;\n}\n\nexport default EditorKeyboardShortcutsRegister;\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,SAAS,QAAQ,oBAAoB;AAC9C,SAASC,WAAW,QAAQ,iBAAiB;AAC7C,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SAASC,4BAA4B,QAAQ,yBAAyB;AACtE,SAASC,KAAK,IAAIC,sBAAsB,QAAQ,+BAA+B;AAC/E,SAASC,SAAS,QAAQ,qBAAqB;;AAE/C;AACA;AACA;AACA;AACA;AACA,SAASC,+BAA+BA,CAAA,EAAG;EAC1C;EACA,MAAM;IAAEC;EAAiB,CAAC,GAAGP,WAAW,CAAEI,sBAAuB,CAAC;EAClEL,SAAS,CAAE,MAAM;IAChBQ,gBAAgB,CAAE;MACjBC,IAAI,EAAE,yBAAyB;MAC/BC,QAAQ,EAAE,QAAQ;MAClBC,WAAW,EAAET,EAAE,CAAE,+CAAgD,CAAC;MAClEU,cAAc,EAAE;QACfC,QAAQ,EAAE,WAAW;QACrBC,SAAS,EAAE;MACZ;IACD,CAAE,CAAC;IAEHN,gBAAgB,CAAE;MACjBC,IAAI,EAAE,kBAAkB;MACxBC,QAAQ,EAAE,QAAQ;MAClBC,WAAW,EAAET,EAAE,CAAE,oBAAqB,CAAC;MACvCU,cAAc,EAAE;QACfC,QAAQ,EAAE,SAAS;QACnBC,SAAS,EAAE;MACZ;IACD,CAAE,CAAC;IAEHN,gBAAgB,CAAE;MACjBC,IAAI,EAAE,kBAAkB;MACxBC,QAAQ,EAAE,QAAQ;MAClBC,WAAW,EAAET,EAAE,CAAE,yBAA0B,CAAC;MAC5CU,cAAc,EAAE;QACfC,QAAQ,EAAE,SAAS;QACnBC,SAAS,EAAE;MACZ;IACD,CAAE,CAAC;IAEHN,gBAAgB,CAAE;MACjBC,I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QAAQ;MAClBC,WAAW,EAAET,EAAE,CAAE,0CAA2C,CAAC;MAC7DU,cAAc,EAAE;QACfC,QAAQ,EAAE,MAAM;QAChBC,SAAS,EAAE;MACZ,CAAC;MACDC,OAAO,EAAE,CACR;QACCF,QAAQ,EAAE,QAAQ;QAClBC,SAAS,EAAE;MACZ,CAAC;IAEH,CAAE,CAAC;IAEHN,gBAAgB,CAAE;MACjBC,IAAI,EAAE,6BAA6B;MACnCC,QAAQ,EAAE,QAAQ;MAClBC,WAAW,EAAET,EAAE,CAAE,8CAA+C,CAAC;MACjEU,cAAc,EAAE;QACfC,QAAQ,EAAE,WAAW;QACrBC,SAAS,EAAE;MACZ,CAAC;MACDC,OAAO,EAAE,CACR;QACCF,QAAQ,EAAE,QAAQ;QAClBC,SAAS,EAAE;MACZ,CAAC,EACD;QACCD,QAAQ,EAAE,WAAW;QACrBC,SAAS,EAAE;MACZ,CAAC;IAEH,CAAE,CAAC;EACJ,CAAC,EAAE,CAAEN,gBAAgB,CAAG,CAAC;EAEzB,OAAOQ,aAAA,CAACb,4BAA4B,CAACc,QAAQ,MAAE,CAAC;AACjD;AAEA,eAAeV,+BAA+B","ignoreList":[]}
@@ -8,7 +8,7 @@ import { __experimentalLibrary as Library } from '@wordpress/block-editor';
8
8
  import { close } from '@wordpress/icons';
9
9
  import { useViewportMatch, __experimentalUseDialog as useDialog } from '@wordpress/compose';
10
10
  import { __ } from '@wordpress/i18n';
11
- import { useEffect, useRef } from '@wordpress/element';
11
+ import { useRef } from '@wordpress/element';
12
12
  import { store as preferencesStore } from '@wordpress/preferences';
13
13
 
14
14
  /**
@@ -42,12 +42,9 @@ export default function InserterSidebar({
42
42
  const TagName = !isMobileViewport ? VisuallyHidden : 'div';
43
43
  const [inserterDialogRef, inserterDialogProps] = useDialog({
44
44
  onClose: () => setIsInserterOpened(false),
45
- focusOnMount: null
45
+ focusOnMount: true
46
46
  });
47
47
  const libraryRef = useRef();
48
- useEffect(() => {
49
- libraryRef.current.focusSearch();
50
- }, []);
51
48
  return createElement("div", {
52
49
  ref: inserterDialogRef,
53
50
  ...inserterDialogProps,
@@ -1 +1 @@
1
- {"version":3,"names":["useDispatch","useSelect","Button","VisuallyHidden","__experimentalLibrary","Library","close","useViewportMatch","__experimentalUseDialog","useDialog","__","useEffect","useRef","store","preferencesStore","unlock","editorStore","InserterSidebar","closeGeneralSidebar","isRightSidebarOpen","insertionPoint","showMostUsedBlocks","select","getInsertionPoint","get","setIsInserterOpened","isMobileViewport","TagName","inserterDialogRef","inserterDialogProps","onClose","focusOnMount","libraryRef","current","focusSearch","createElement","ref","className","icon","label","onClick","showInserterHelpPanel","shouldFocusBlock","rootClientId","__experimentalInsertionIndex","insertionIndex","__experimentalFilterValue","filterValue","__experimentalOnPatternCategorySelection","undefined"],"sources":["@wordpress/editor/src/components/inserter-sidebar/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { Button, VisuallyHidden } from '@wordpress/components';\nimport { __experimentalLibrary as Library } from '@wordpress/block-editor';\nimport { close } from '@wordpress/icons';\nimport {\n\tuseViewportMatch,\n\t__experimentalUseDialog as useDialog,\n} from '@wordpress/compose';\nimport { __ } from '@wordpress/i18n';\nimport { useEffect, useRef } from '@wordpress/element';\nimport { store as preferencesStore } from '@wordpress/preferences';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\nimport { store as editorStore } from '../../store';\n\nexport default function InserterSidebar( {\n\tcloseGeneralSidebar,\n\tisRightSidebarOpen,\n} ) {\n\tconst { insertionPoint, showMostUsedBlocks } = useSelect( ( select ) => {\n\t\tconst { getInsertionPoint } = unlock( select( editorStore ) );\n\t\tconst { get } = select( preferencesStore );\n\t\treturn {\n\t\t\tinsertionPoint: getInsertionPoint(),\n\t\t\tshowMostUsedBlocks: get( 'core', 'mostUsedBlocks' ),\n\t\t};\n\t}, [] );\n\tconst { setIsInserterOpened } = useDispatch( editorStore );\n\n\tconst isMobileViewport = useViewportMatch( 'medium', '<' );\n\tconst TagName = ! isMobileViewport ? VisuallyHidden : 'div';\n\tconst [ inserterDialogRef, inserterDialogProps ] = useDialog( {\n\t\tonClose: () => setIsInserterOpened( false ),\n\t\tfocusOnMount: null,\n\t} );\n\n\tconst libraryRef = useRef();\n\tuseEffect( () => {\n\t\tlibraryRef.current.focusSearch();\n\t}, [] );\n\n\treturn (\n\t\t<div\n\t\t\tref={ inserterDialogRef }\n\t\t\t{ ...inserterDialogProps }\n\t\t\tclassName=\"editor-inserter-sidebar\"\n\t\t>\n\t\t\t<TagName className=\"editor-inserter-sidebar__header\">\n\t\t\t\t<Button\n\t\t\t\t\ticon={ close }\n\t\t\t\t\tlabel={ __( 'Close block inserter' ) }\n\t\t\t\t\tonClick={ () => setIsInserterOpened( false ) }\n\t\t\t\t/>\n\t\t\t</TagName>\n\t\t\t<div className=\"editor-inserter-sidebar__content\">\n\t\t\t\t<Library\n\t\t\t\t\tshowMostUsedBlocks={ showMostUsedBlocks }\n\t\t\t\t\tshowInserterHelpPanel\n\t\t\t\t\tshouldFocusBlock={ isMobileViewport }\n\t\t\t\t\trootClientId={ insertionPoint.rootClientId }\n\t\t\t\t\t__experimentalInsertionIndex={\n\t\t\t\t\t\tinsertionPoint.insertionIndex\n\t\t\t\t\t}\n\t\t\t\t\t__experimentalFilterValue={ insertionPoint.filterValue }\n\t\t\t\t\t__experimentalOnPatternCategorySelection={\n\t\t\t\t\t\tisRightSidebarOpen ? closeGeneralSidebar : undefined\n\t\t\t\t\t}\n\t\t\t\t\tref={ libraryRef }\n\t\t\t\t/>\n\t\t\t</div>\n\t\t</div>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,WAAW,EAAEC,SAAS,QAAQ,iBAAiB;AACxD,SAASC,MAAM,EAAEC,cAAc,QAAQ,uBAAuB;AAC9D,SAASC,qBAAqB,IAAIC,OAAO,QAAQ,yBAAyB;AAC1E,SAASC,KAAK,QAAQ,kBAAkB;AACxC,SACC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EACjC,CAAC,EAAE,EAAG,CAAC;EAEP,OACCC,aAAA;IACCC,GAAG,EAAGR,iBAAmB;IAAA,GACpBC,mBAAmB;IACxBQ,SAAS,EAAC;EAAyB,GAEnCF,aAAA,CAACR,OAAO;IAACU,SAAS,EAAC;EAAiC,GACnDF,aAAA,CAACjC,MAAM;IACNoC,IAAI,EAAGhC,KAAO;IACdiC,KAAK,EAAG7B,EAAE,CAAE,sBAAuB,CAAG;IACtC8B,OAAO,EAAGA,CAAA,KAAMf,mBAAmB,CAAE,KAAM;EAAG,CAC9C,CACO,CAAC,EACVU,aAAA;IAAKE,SAAS,EAAC;EAAkC,GAChDF,aAAA,CAAC9B,OAAO;IACPgB,kBAAkB,EAAGA,kBAAoB;IACzCoB,qBAAqB;IACrBC,gBAAgB,EAAGhB,gBAAkB;IACrCiB,YAAY,EAAGvB,cAAc,CAACuB,YAAc;IAC5CC,4BAA4B,EAC3BxB,cAAc,CAACyB,cACf;IACDC,yBAAyB,EAAG1B,cAAc,CAAC2B,WAAa;IACxDC,wCAAwC,EACvC7B,kBAAkB,GAAGD,mBAAmB,GAAG+B,SAC3C;IACDb,GAAG,EAAGJ;EAAY,CAClB,CACG,CACD,CAAC;AAER","ignoreList":[]}
1
+ {"version":3,"names":["useDispatch","useSelect","Button","VisuallyHidden","__experimentalLibrary","Library","close","useViewportMatch","__experimentalUseDialog","useDialog","__","useRef","store","preferencesStore","unlock","editorStore","InserterSidebar","closeGeneralSidebar","isRightSidebarOpen","insertionPoint","showMostUsedBlocks","select","getInsertionPoint","get","setIsInserterOpened","isMobileViewport","TagName","inserterDialogRef","inserterDialogProps","onClose","focusOnMount","libraryRef","createElement","ref","className","icon","label","onClick","showInserterHelpPanel","shouldFocusBlock","rootClientId","__experimentalInsertionIndex","insertionIndex","__experimentalFilterValue","filterValue","__experimentalOnPatternCategorySelection","undefined"],"sources":["@wordpress/editor/src/components/inserter-sidebar/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { Button, VisuallyHidden } from '@wordpress/components';\nimport { __experimentalLibrary as Library } from '@wordpress/block-editor';\nimport { close } from '@wordpress/icons';\nimport {\n\tuseViewportMatch,\n\t__experimentalUseDialog as useDialog,\n} from '@wordpress/compose';\nimport { __ } from '@wordpress/i18n';\nimport { useRef } from '@wordpress/element';\nimport { store as preferencesStore } from '@wordpress/preferences';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\nimport { store as editorStore } from '../../store';\n\nexport default function InserterSidebar( {\n\tcloseGeneralSidebar,\n\tisRightSidebarOpen,\n} ) {\n\tconst { insertionPoint, showMostUsedBlocks } = useSelect( ( select ) => {\n\t\tconst { getInsertionPoint } = unlock( select( editorStore ) );\n\t\tconst { get } = select( preferencesStore );\n\t\treturn {\n\t\t\tinsertionPoint: getInsertionPoint(),\n\t\t\tshowMostUsedBlocks: get( 'core', 'mostUsedBlocks' ),\n\t\t};\n\t}, [] );\n\tconst { setIsInserterOpened } = useDispatch( editorStore );\n\n\tconst isMobileViewport = useViewportMatch( 'medium', '<' );\n\tconst TagName = ! isMobileViewport ? VisuallyHidden : 'div';\n\tconst [ inserterDialogRef, inserterDialogProps ] = useDialog( {\n\t\tonClose: () => setIsInserterOpened( false ),\n\t\tfocusOnMount: true,\n\t} );\n\n\tconst libraryRef = useRef();\n\n\treturn (\n\t\t<div\n\t\t\tref={ inserterDialogRef }\n\t\t\t{ ...inserterDialogProps }\n\t\t\tclassName=\"editor-inserter-sidebar\"\n\t\t>\n\t\t\t<TagName className=\"editor-inserter-sidebar__header\">\n\t\t\t\t<Button\n\t\t\t\t\ticon={ close }\n\t\t\t\t\tlabel={ __( 'Close block inserter' ) }\n\t\t\t\t\tonClick={ () => setIsInserterOpened( false ) }\n\t\t\t\t/>\n\t\t\t</TagName>\n\t\t\t<div className=\"editor-inserter-sidebar__content\">\n\t\t\t\t<Library\n\t\t\t\t\tshowMostUsedBlocks={ showMostUsedBlocks }\n\t\t\t\t\tshowInserterHelpPanel\n\t\t\t\t\tshouldFocusBlock={ isMobileViewport }\n\t\t\t\t\trootClientId={ insertionPoint.rootClientId }\n\t\t\t\t\t__experimentalInsertionIndex={\n\t\t\t\t\t\tinsertionPoint.insertionIndex\n\t\t\t\t\t}\n\t\t\t\t\t__experimentalFilterValue={ insertionPoint.filterValue }\n\t\t\t\t\t__experimentalOnPatternCategorySelection={\n\t\t\t\t\t\tisRightSidebarOpen ? closeGeneralSidebar : undefined\n\t\t\t\t\t}\n\t\t\t\t\tref={ libraryRef }\n\t\t\t\t/>\n\t\t\t</div>\n\t\t</div>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,WAAW,EAAEC,SAAS,QAAQ,iBAAiB;AACxD,SAASC,MAAM,EAAEC,cAAc,QAAQ,uBAAuB;AAC9D,SAASC,qBAAqB,IAAIC,OAAO,QAAQ,yBAAyB;AAC1E,SAASC,KAAK,QAAQ,kBAAkB;AACxC,SACCC,gBAAgB,EAChBC,uBAAuB,IAAIC,SAAS,QAC9B,oBAAoB;AAC3B,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SAASC,MAAM,QAAQ,oBAAoB;AAC3C,SAASC,KAAK,IAAIC,gBAAgB,QAAQ,wBAAwB;;AAElE;AACA;AACA;AACA,SAASC,MAAM,QAAQ,mBAAmB;AAC1C,SAASF,KAAK,IAAIG,WAAW,QAAQ,aAAa;AAElD,eAAe,SAASC,eAAeA,CAAE;EACxCC,mBAAmB;EACnBC;AACD,CAAC,EAAG;EACH,MAAM;IAAEC,cAAc;IAAEC;EAAmB,CAAC,GAAGnB,SAAS,CAAIoB,MAAM,IAAM;IACvE,MAAM;MAAEC;IAAkB,CAAC,GAAGR,MAAM,CAAEO,MAAM,CAAEN,WAAY,CAAE,CAAC;IAC7D,MAAM;MAAEQ;IAAI,CAAC,GAAGF,MAAM,CAAER,gBAAiB,CAAC;IAC1C,OAAO;MACNM,cAAc,EAAEG,iBAAiB,CAAC,CAAC;MACn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ER","ignoreList":[]}
@@ -54,6 +54,10 @@ export const textFormattingShortcuts = [{
54
54
  modifier: 'access',
55
55
  character: '0'
56
56
  },
57
+ aliases: [{
58
+ modifier: 'access',
59
+ character: '7'
60
+ }],
57
61
  description: __('Convert the current heading to a paragraph.')
58
62
  }, {
59
63
  keyCombination: {