@wordpress/block-editor 12.13.0 → 12.14.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 (344) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/build/components/block-heading-level-dropdown/index.js +1 -1
  3. package/build/components/block-heading-level-dropdown/index.js.map +1 -1
  4. package/build/components/block-list/index.js +2 -9
  5. package/build/components/block-list/index.js.map +1 -1
  6. package/build/components/block-list-appender/index.js +16 -3
  7. package/build/components/block-list-appender/index.js.map +1 -1
  8. package/build/components/block-quick-navigation/index.js +6 -4
  9. package/build/components/block-quick-navigation/index.js.map +1 -1
  10. package/build/components/block-styles/index.js +0 -8
  11. package/build/components/block-styles/index.js.map +1 -1
  12. package/build/components/block-switcher/pattern-transformations-menu.js +18 -14
  13. package/build/components/block-switcher/pattern-transformations-menu.js.map +1 -1
  14. package/build/components/block-tools/back-compat.js +2 -2
  15. package/build/components/block-tools/back-compat.js.map +1 -1
  16. package/build/components/block-tools/block-contextual-toolbar.js +11 -81
  17. package/build/components/block-tools/block-contextual-toolbar.js.map +1 -1
  18. package/build/components/block-tools/empty-block-inserter.js +56 -0
  19. package/build/components/block-tools/empty-block-inserter.js.map +1 -0
  20. package/build/components/block-tools/index.js +48 -9
  21. package/build/components/block-tools/index.js.map +1 -1
  22. package/build/components/block-tools/selected-block-tools.js +113 -0
  23. package/build/components/block-tools/selected-block-tools.js.map +1 -0
  24. package/build/components/block-tools/use-selected-block-tool-props.js +56 -0
  25. package/build/components/block-tools/use-selected-block-tool-props.js.map +1 -0
  26. package/build/components/editable-text/index.js +1 -2
  27. package/build/components/editable-text/index.js.map +1 -1
  28. package/build/components/iframe/index.js +4 -3
  29. package/build/components/iframe/index.js.map +1 -1
  30. package/build/components/inserter/block-patterns-explorer/{explorer.js → index.js} +7 -7
  31. package/build/components/inserter/block-patterns-explorer/index.js.map +1 -0
  32. package/build/components/inserter/block-patterns-explorer/{sidebar.js → pattern-explorer-sidebar.js} +1 -1
  33. package/build/components/inserter/block-patterns-explorer/pattern-explorer-sidebar.js.map +1 -0
  34. package/build/components/inserter/block-patterns-explorer/{patterns-list.js → pattern-list.js} +4 -4
  35. package/build/components/inserter/block-patterns-explorer/pattern-list.js.map +1 -0
  36. package/build/components/inserter/block-patterns-tab/index.js +75 -0
  37. package/build/components/inserter/block-patterns-tab/index.js.map +1 -0
  38. package/build/components/inserter/block-patterns-tab/pattern-category-preview-panel.js +48 -0
  39. package/build/components/inserter/block-patterns-tab/pattern-category-preview-panel.js.map +1 -0
  40. package/build/components/inserter/block-patterns-tab/pattern-category-previews.js +108 -0
  41. package/build/components/inserter/block-patterns-tab/pattern-category-previews.js.map +1 -0
  42. package/build/components/inserter/{block-patterns-filter.js → block-patterns-tab/patterns-filter.js} +18 -34
  43. package/build/components/inserter/block-patterns-tab/patterns-filter.js.map +1 -0
  44. package/build/components/inserter/block-patterns-tab/use-pattern-categories.js +55 -0
  45. package/build/components/inserter/block-patterns-tab/use-pattern-categories.js.map +1 -0
  46. package/build/components/inserter/block-patterns-tab/utils.js +70 -0
  47. package/build/components/inserter/block-patterns-tab/utils.js.map +1 -0
  48. package/build/components/inserter/media-tab/media-list.js +9 -5
  49. package/build/components/inserter/media-tab/media-list.js.map +1 -1
  50. package/build/components/inserter/media-tab/media-preview.js +15 -12
  51. package/build/components/inserter/media-tab/media-preview.js.map +1 -1
  52. package/build/components/inserter/menu.js +3 -4
  53. package/build/components/inserter/menu.js.map +1 -1
  54. package/build/components/link-control/index.js +6 -5
  55. package/build/components/link-control/index.js.map +1 -1
  56. package/build/components/list-view/block-select-button.js +39 -0
  57. package/build/components/list-view/block-select-button.js.map +1 -1
  58. package/build/components/list-view/block.js +16 -3
  59. package/build/components/list-view/block.js.map +1 -1
  60. package/build/components/list-view/index.js +3 -2
  61. package/build/components/list-view/index.js.map +1 -1
  62. package/build/components/navigable-toolbar/index.js +69 -18
  63. package/build/components/navigable-toolbar/index.js.map +1 -1
  64. package/build/components/provider/use-block-sync.js +1 -14
  65. package/build/components/provider/use-block-sync.js.map +1 -1
  66. package/build/components/rich-text/index.js +0 -1
  67. package/build/components/rich-text/index.js.map +1 -1
  68. package/build/components/rich-text/index.native.js +3 -1
  69. package/build/components/rich-text/index.native.js.map +1 -1
  70. package/build/components/rich-text/native/format-edit.js +45 -0
  71. package/build/components/rich-text/native/format-edit.js.map +1 -0
  72. package/build/components/rich-text/native/get-format-colors.native.js +41 -0
  73. package/build/components/rich-text/native/get-format-colors.native.js.map +1 -0
  74. package/build/components/rich-text/native/index.js +9 -0
  75. package/build/components/rich-text/native/index.js.map +1 -0
  76. package/build/components/rich-text/native/index.native.js +1158 -0
  77. package/build/components/rich-text/native/index.native.js.map +1 -0
  78. package/build/components/rich-text/native/toolbar-button-with-options.native.js +58 -0
  79. package/build/components/rich-text/native/toolbar-button-with-options.native.js.map +1 -0
  80. package/build/components/rich-text/native/use-format-types.js +111 -0
  81. package/build/components/rich-text/native/use-format-types.js.map +1 -0
  82. package/build/components/rich-text/use-paste-handler.js +2 -5
  83. package/build/components/rich-text/use-paste-handler.js.map +1 -1
  84. package/build/components/url-popover/image-url-input-ui.js +2 -1
  85. package/build/components/url-popover/image-url-input-ui.js.map +1 -1
  86. package/build/components/writing-flow/use-tab-nav.js +7 -3
  87. package/build/components/writing-flow/use-tab-nav.js.map +1 -1
  88. package/build/hooks/align.js +10 -10
  89. package/build/hooks/align.js.map +1 -1
  90. package/build/hooks/align.native.js +2 -2
  91. package/build/hooks/align.native.js.map +1 -1
  92. package/build/hooks/anchor.js +7 -6
  93. package/build/hooks/anchor.js.map +1 -1
  94. package/build/hooks/background.js +16 -4
  95. package/build/hooks/background.js.map +1 -1
  96. package/build/hooks/block-hooks.js +7 -8
  97. package/build/hooks/block-hooks.js.map +1 -1
  98. package/build/hooks/block-rename-ui.js +7 -5
  99. package/build/hooks/block-rename-ui.js.map +1 -1
  100. package/build/hooks/content-lock-ui.js +5 -5
  101. package/build/hooks/content-lock-ui.js.map +1 -1
  102. package/build/hooks/custom-class-name.js +8 -7
  103. package/build/hooks/custom-class-name.js.map +1 -1
  104. package/build/hooks/custom-fields.js +4 -4
  105. package/build/hooks/custom-fields.js.map +1 -1
  106. package/build/hooks/duotone.js +9 -20
  107. package/build/hooks/duotone.js.map +1 -1
  108. package/build/hooks/layout.js +90 -86
  109. package/build/hooks/layout.js.map +1 -1
  110. package/build/hooks/position.js +10 -9
  111. package/build/hooks/position.js.map +1 -1
  112. package/build/hooks/style.js +10 -13
  113. package/build/hooks/style.js.map +1 -1
  114. package/build/hooks/utils.js +30 -0
  115. package/build/hooks/utils.js.map +1 -1
  116. package/build/private-apis.js +3 -0
  117. package/build/private-apis.js.map +1 -1
  118. package/build/store/actions.js +30 -37
  119. package/build/store/actions.js.map +1 -1
  120. package/build/store/reducer.js +18 -0
  121. package/build/store/reducer.js.map +1 -1
  122. package/build/store/selectors.js +16 -13
  123. package/build/store/selectors.js.map +1 -1
  124. package/build-module/components/block-heading-level-dropdown/index.js +1 -1
  125. package/build-module/components/block-heading-level-dropdown/index.js.map +1 -1
  126. package/build-module/components/block-list/index.js +3 -10
  127. package/build-module/components/block-list/index.js.map +1 -1
  128. package/build-module/components/block-list-appender/index.js +16 -3
  129. package/build-module/components/block-list-appender/index.js.map +1 -1
  130. package/build-module/components/block-quick-navigation/index.js +7 -5
  131. package/build-module/components/block-quick-navigation/index.js.map +1 -1
  132. package/build-module/components/block-styles/index.js +0 -8
  133. package/build-module/components/block-styles/index.js.map +1 -1
  134. package/build-module/components/block-switcher/pattern-transformations-menu.js +17 -13
  135. package/build-module/components/block-switcher/pattern-transformations-menu.js.map +1 -1
  136. package/build-module/components/block-tools/back-compat.js +1 -1
  137. package/build-module/components/block-tools/back-compat.js.map +1 -1
  138. package/build-module/components/block-tools/block-contextual-toolbar.js +11 -80
  139. package/build-module/components/block-tools/block-contextual-toolbar.js.map +1 -1
  140. package/build-module/components/block-tools/empty-block-inserter.js +48 -0
  141. package/build-module/components/block-tools/empty-block-inserter.js.map +1 -0
  142. package/build-module/components/block-tools/index.js +48 -9
  143. package/build-module/components/block-tools/index.js.map +1 -1
  144. package/build-module/components/block-tools/selected-block-tools.js +105 -0
  145. package/build-module/components/block-tools/selected-block-tools.js.map +1 -0
  146. package/build-module/components/block-tools/use-selected-block-tool-props.js +50 -0
  147. package/build-module/components/block-tools/use-selected-block-tool-props.js.map +1 -0
  148. package/build-module/components/editable-text/index.js +1 -2
  149. package/build-module/components/editable-text/index.js.map +1 -1
  150. package/build-module/components/iframe/index.js +4 -3
  151. package/build-module/components/iframe/index.js.map +1 -1
  152. package/build-module/components/inserter/block-patterns-explorer/{explorer.js → index.js} +5 -5
  153. package/build-module/components/inserter/block-patterns-explorer/index.js.map +1 -0
  154. package/build-module/components/inserter/block-patterns-explorer/{sidebar.js → pattern-explorer-sidebar.js} +1 -1
  155. package/build-module/components/inserter/block-patterns-explorer/pattern-explorer-sidebar.js.map +1 -0
  156. package/build-module/components/inserter/block-patterns-explorer/{patterns-list.js → pattern-list.js} +2 -2
  157. package/build-module/components/inserter/block-patterns-explorer/pattern-list.js.map +1 -0
  158. package/build-module/components/inserter/block-patterns-tab/index.js +66 -0
  159. package/build-module/components/inserter/block-patterns-tab/index.js.map +1 -0
  160. package/build-module/components/inserter/block-patterns-tab/pattern-category-preview-panel.js +42 -0
  161. package/build-module/components/inserter/block-patterns-tab/pattern-category-preview-panel.js.map +1 -0
  162. package/build-module/components/inserter/block-patterns-tab/pattern-category-previews.js +100 -0
  163. package/build-module/components/inserter/block-patterns-tab/pattern-category-previews.js.map +1 -0
  164. package/build-module/components/inserter/{block-patterns-filter.js → block-patterns-tab/patterns-filter.js} +7 -20
  165. package/build-module/components/inserter/block-patterns-tab/patterns-filter.js.map +1 -0
  166. package/build-module/components/inserter/block-patterns-tab/use-pattern-categories.js +47 -0
  167. package/build-module/components/inserter/block-patterns-tab/use-pattern-categories.js.map +1 -0
  168. package/build-module/components/inserter/block-patterns-tab/utils.js +58 -0
  169. package/build-module/components/inserter/block-patterns-tab/utils.js.map +1 -0
  170. package/build-module/components/inserter/media-tab/media-list.js +9 -5
  171. package/build-module/components/inserter/media-tab/media-list.js.map +1 -1
  172. package/build-module/components/inserter/media-tab/media-preview.js +15 -12
  173. package/build-module/components/inserter/media-tab/media-preview.js.map +1 -1
  174. package/build-module/components/inserter/menu.js +4 -3
  175. package/build-module/components/inserter/menu.js.map +1 -1
  176. package/build-module/components/link-control/index.js +7 -6
  177. package/build-module/components/link-control/index.js.map +1 -1
  178. package/build-module/components/list-view/block-select-button.js +39 -0
  179. package/build-module/components/list-view/block-select-button.js.map +1 -1
  180. package/build-module/components/list-view/block.js +16 -3
  181. package/build-module/components/list-view/block.js.map +1 -1
  182. package/build-module/components/list-view/index.js +3 -2
  183. package/build-module/components/list-view/index.js.map +1 -1
  184. package/build-module/components/navigable-toolbar/index.js +69 -17
  185. package/build-module/components/navigable-toolbar/index.js.map +1 -1
  186. package/build-module/components/provider/use-block-sync.js +1 -14
  187. package/build-module/components/provider/use-block-sync.js.map +1 -1
  188. package/build-module/components/rich-text/index.js +0 -1
  189. package/build-module/components/rich-text/index.js.map +1 -1
  190. package/build-module/components/rich-text/index.native.js +3 -1
  191. package/build-module/components/rich-text/index.native.js.map +1 -1
  192. package/build-module/components/rich-text/native/format-edit.js +38 -0
  193. package/build-module/components/rich-text/native/format-edit.js.map +1 -0
  194. package/build-module/components/rich-text/native/get-format-colors.native.js +34 -0
  195. package/build-module/components/rich-text/native/get-format-colors.native.js.map +1 -0
  196. package/build-module/components/rich-text/native/index.js +2 -0
  197. package/build-module/components/rich-text/native/index.js.map +1 -0
  198. package/build-module/components/rich-text/native/index.native.js +1148 -0
  199. package/build-module/components/rich-text/native/index.native.js.map +1 -0
  200. package/build-module/components/rich-text/native/toolbar-button-with-options.native.js +51 -0
  201. package/build-module/components/rich-text/native/toolbar-button-with-options.native.js.map +1 -0
  202. package/build-module/components/rich-text/native/use-format-types.js +104 -0
  203. package/build-module/components/rich-text/native/use-format-types.js.map +1 -0
  204. package/build-module/components/rich-text/use-paste-handler.js +2 -5
  205. package/build-module/components/rich-text/use-paste-handler.js.map +1 -1
  206. package/build-module/components/url-popover/image-url-input-ui.js +2 -1
  207. package/build-module/components/url-popover/image-url-input-ui.js.map +1 -1
  208. package/build-module/components/writing-flow/use-tab-nav.js +7 -3
  209. package/build-module/components/writing-flow/use-tab-nav.js.map +1 -1
  210. package/build-module/hooks/align.js +8 -8
  211. package/build-module/hooks/align.js.map +1 -1
  212. package/build-module/hooks/align.native.js +2 -2
  213. package/build-module/hooks/align.native.js.map +1 -1
  214. package/build-module/hooks/anchor.js +5 -4
  215. package/build-module/hooks/anchor.js.map +1 -1
  216. package/build-module/hooks/background.js +17 -5
  217. package/build-module/hooks/background.js.map +1 -1
  218. package/build-module/hooks/block-hooks.js +5 -6
  219. package/build-module/hooks/block-hooks.js.map +1 -1
  220. package/build-module/hooks/block-rename-ui.js +5 -3
  221. package/build-module/hooks/block-rename-ui.js.map +1 -1
  222. package/build-module/hooks/content-lock-ui.js +3 -3
  223. package/build-module/hooks/content-lock-ui.js.map +1 -1
  224. package/build-module/hooks/custom-class-name.js +6 -5
  225. package/build-module/hooks/custom-class-name.js.map +1 -1
  226. package/build-module/hooks/custom-fields.js +4 -4
  227. package/build-module/hooks/custom-fields.js.map +1 -1
  228. package/build-module/hooks/duotone.js +10 -21
  229. package/build-module/hooks/duotone.js.map +1 -1
  230. package/build-module/hooks/layout.js +90 -86
  231. package/build-module/hooks/layout.js.map +1 -1
  232. package/build-module/hooks/position.js +11 -10
  233. package/build-module/hooks/position.js.map +1 -1
  234. package/build-module/hooks/style.js +10 -13
  235. package/build-module/hooks/style.js.map +1 -1
  236. package/build-module/hooks/utils.js +30 -1
  237. package/build-module/hooks/utils.js.map +1 -1
  238. package/build-module/private-apis.js +4 -1
  239. package/build-module/private-apis.js.map +1 -1
  240. package/build-module/store/actions.js +29 -37
  241. package/build-module/store/actions.js.map +1 -1
  242. package/build-module/store/reducer.js +17 -0
  243. package/build-module/store/reducer.js.map +1 -1
  244. package/build-module/store/selectors.js +15 -13
  245. package/build-module/store/selectors.js.map +1 -1
  246. package/build-style/style-rtl.css +16 -15
  247. package/build-style/style.css +16 -15
  248. package/package.json +31 -31
  249. package/src/components/block-heading-level-dropdown/index.js +1 -1
  250. package/src/components/block-list/index.js +4 -18
  251. package/src/components/block-list-appender/index.js +20 -4
  252. package/src/components/block-quick-navigation/index.js +11 -5
  253. package/src/components/block-styles/index.js +0 -10
  254. package/src/components/block-switcher/pattern-transformations-menu.js +20 -14
  255. package/src/components/block-toolbar/style.scss +8 -0
  256. package/src/components/block-tools/back-compat.js +1 -1
  257. package/src/components/block-tools/block-contextual-toolbar.js +11 -134
  258. package/src/components/block-tools/empty-block-inserter.js +56 -0
  259. package/src/components/block-tools/index.js +72 -16
  260. package/src/components/block-tools/selected-block-tools.js +127 -0
  261. package/src/components/block-tools/style.scss +0 -10
  262. package/src/components/block-tools/use-selected-block-tool-props.js +66 -0
  263. package/src/components/editable-text/index.js +1 -8
  264. package/src/components/iframe/index.js +4 -3
  265. package/src/components/inserter/block-patterns-explorer/{explorer.js → index.js} +4 -4
  266. package/src/components/inserter/block-patterns-explorer/{patterns-list.js → pattern-list.js} +4 -1
  267. package/src/components/inserter/block-patterns-tab/index.js +118 -0
  268. package/src/components/inserter/block-patterns-tab/pattern-category-preview-panel.js +48 -0
  269. package/src/components/inserter/block-patterns-tab/pattern-category-previews.js +175 -0
  270. package/src/components/inserter/{block-patterns-filter.js → block-patterns-tab/patterns-filter.js} +15 -21
  271. package/src/components/inserter/block-patterns-tab/use-pattern-categories.js +96 -0
  272. package/src/components/inserter/block-patterns-tab/utils.js +76 -0
  273. package/src/components/inserter/media-tab/media-list.js +7 -7
  274. package/src/components/inserter/media-tab/media-preview.js +27 -22
  275. package/src/components/inserter/menu.js +4 -5
  276. package/src/components/link-control/README.md +2 -2
  277. package/src/components/link-control/index.js +15 -6
  278. package/src/components/link-control/style.scss +8 -5
  279. package/src/components/list-view/block-select-button.js +44 -1
  280. package/src/components/list-view/block.js +11 -11
  281. package/src/components/list-view/index.js +2 -0
  282. package/src/components/media-replace-flow/style.scss +2 -2
  283. package/src/components/navigable-toolbar/index.js +71 -25
  284. package/src/components/plain-text/README.md +3 -3
  285. package/src/components/provider/use-block-sync.js +2 -21
  286. package/src/components/rich-text/README.md +9 -8
  287. package/src/components/rich-text/index.js +0 -1
  288. package/src/components/rich-text/index.native.js +3 -1
  289. package/src/components/rich-text/native/format-edit.js +44 -0
  290. package/src/components/rich-text/native/get-format-colors.native.js +54 -0
  291. package/src/components/rich-text/native/index.js +1 -0
  292. package/src/components/rich-text/native/index.native.js +1363 -0
  293. package/src/components/rich-text/native/style.native.scss +28 -0
  294. package/src/components/rich-text/native/test/__snapshots__/index.native.js.snap +79 -0
  295. package/src/components/rich-text/native/test/index.native.js +278 -0
  296. package/src/components/rich-text/native/test/performance/rich-text.native.js +44 -0
  297. package/src/components/rich-text/native/toolbar-button-with-options.native.js +61 -0
  298. package/src/components/rich-text/native/use-format-types.js +146 -0
  299. package/src/components/rich-text/use-paste-handler.js +1 -6
  300. package/src/components/url-popover/image-url-input-ui.js +1 -0
  301. package/src/components/writing-flow/use-tab-nav.js +8 -3
  302. package/src/hooks/align.js +8 -8
  303. package/src/hooks/align.native.js +2 -2
  304. package/src/hooks/anchor.js +21 -23
  305. package/src/hooks/background.js +28 -6
  306. package/src/hooks/block-hooks.js +20 -16
  307. package/src/hooks/block-rename-ui.js +6 -4
  308. package/src/hooks/content-lock-ui.js +3 -3
  309. package/src/hooks/custom-class-name.js +7 -6
  310. package/src/hooks/custom-fields.js +5 -5
  311. package/src/hooks/duotone.js +23 -33
  312. package/src/hooks/layout.js +114 -105
  313. package/src/hooks/position.js +8 -21
  314. package/src/hooks/style.js +17 -31
  315. package/src/hooks/test/align.js +4 -4
  316. package/src/hooks/utils.js +33 -1
  317. package/src/private-apis.js +4 -1
  318. package/src/store/actions.js +26 -72
  319. package/src/store/reducer.js +19 -0
  320. package/src/store/selectors.js +13 -19
  321. package/build/components/block-tools/selected-block-popover.js +0 -221
  322. package/build/components/block-tools/selected-block-popover.js.map +0 -1
  323. package/build/components/inserter/block-patterns-explorer/explorer.js.map +0 -1
  324. package/build/components/inserter/block-patterns-explorer/patterns-list.js.map +0 -1
  325. package/build/components/inserter/block-patterns-explorer/sidebar.js.map +0 -1
  326. package/build/components/inserter/block-patterns-filter.js.map +0 -1
  327. package/build/components/inserter/block-patterns-tab.js +0 -270
  328. package/build/components/inserter/block-patterns-tab.js.map +0 -1
  329. package/build/store/utils.js +0 -22
  330. package/build/store/utils.js.map +0 -1
  331. package/build-module/components/block-tools/selected-block-popover.js +0 -213
  332. package/build-module/components/block-tools/selected-block-popover.js.map +0 -1
  333. package/build-module/components/inserter/block-patterns-explorer/explorer.js.map +0 -1
  334. package/build-module/components/inserter/block-patterns-explorer/patterns-list.js.map +0 -1
  335. package/build-module/components/inserter/block-patterns-explorer/sidebar.js.map +0 -1
  336. package/build-module/components/inserter/block-patterns-filter.js.map +0 -1
  337. package/build-module/components/inserter/block-patterns-tab.js +0 -254
  338. package/build-module/components/inserter/block-patterns-tab.js.map +0 -1
  339. package/build-module/store/utils.js +0 -16
  340. package/build-module/store/utils.js.map +0 -1
  341. package/src/components/block-tools/selected-block-popover.js +0 -265
  342. package/src/components/inserter/block-patterns-tab.js +0 -448
  343. package/src/store/utils.js +0 -12
  344. /package/src/components/inserter/block-patterns-explorer/{sidebar.js → pattern-explorer-sidebar.js} +0 -0
@@ -1 +1 @@
1
- {"version":3,"names":["classnames","__","useLayoutEffect","useEffect","useRef","useState","hasBlockSupport","store","blocksStore","useSelect","ToolbarItem","ToolbarButton","ToolbarGroup","next","previous","useViewportMatch","NavigableToolbar","BlockToolbar","blockEditorStore","useHasAnyBlockControls","BlockContextualToolbar","focusOnMount","isFixed","props","isCollapsed","setIsCollapsed","toolbarButtonRef","isLargeViewport","blockType","blockEditingMode","hasParents","showParentSelector","selectedBlockClientId","select","getBlockName","getBlockParents","getSelectedBlockClientIds","getBlockEditingMode","getBlockType","selectedBlockClientIds","_selectedBlockClientId","parents","firstParentClientId","length","parentBlockName","parentBlockType","isLargerThanTabletViewport","isFullscreen","document","body","classList","contains","blockToolbar","querySelector","style","width","pinnedItems","leftHeader","computedToolbarStyle","window","getComputedStyle","computedPinnedItemsStyle","computedLeftHeaderStyle","marginLeft","parseFloat","pinnedItemsWidth","leftHeaderWidth","isToolbarEnabled","hasAnyBlockControls","classes","createElement","className","variant","undefined","hideDragHandle","as","ref","icon","onClick","collapsed","current","focus","label"],"sources":["@wordpress/block-editor/src/components/block-tools/block-contextual-toolbar.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport {\n\tuseLayoutEffect,\n\tuseEffect,\n\tuseRef,\n\tuseState,\n} from '@wordpress/element';\nimport { hasBlockSupport, store as blocksStore } from '@wordpress/blocks';\nimport { useSelect } from '@wordpress/data';\nimport {\n\tToolbarItem,\n\tToolbarButton,\n\tToolbarGroup,\n} from '@wordpress/components';\nimport { next, previous } from '@wordpress/icons';\nimport { useViewportMatch } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport NavigableToolbar from '../navigable-toolbar';\nimport BlockToolbar from '../block-toolbar';\nimport { store as blockEditorStore } from '../../store';\nimport { useHasAnyBlockControls } from '../block-controls/use-has-block-controls';\n\nfunction BlockContextualToolbar( { focusOnMount, isFixed, ...props } ) {\n\t// When the toolbar is fixed it can be collapsed\n\tconst [ isCollapsed, setIsCollapsed ] = useState( false );\n\tconst toolbarButtonRef = useRef();\n\n\tconst isLargeViewport = useViewportMatch( 'medium' );\n\tconst {\n\t\tblockType,\n\t\tblockEditingMode,\n\t\thasParents,\n\t\tshowParentSelector,\n\t\tselectedBlockClientId,\n\t} = useSelect( ( select ) => {\n\t\tconst {\n\t\t\tgetBlockName,\n\t\t\tgetBlockParents,\n\t\t\tgetSelectedBlockClientIds,\n\t\t\tgetBlockEditingMode,\n\t\t} = select( blockEditorStore );\n\t\tconst { getBlockType } = select( blocksStore );\n\t\tconst selectedBlockClientIds = getSelectedBlockClientIds();\n\t\tconst _selectedBlockClientId = selectedBlockClientIds[ 0 ];\n\t\tconst parents = getBlockParents( _selectedBlockClientId );\n\t\tconst firstParentClientId = parents[ parents.length - 1 ];\n\t\tconst parentBlockName = getBlockName( firstParentClientId );\n\t\tconst parentBlockType = getBlockType( parentBlockName );\n\n\t\treturn {\n\t\t\tselectedBlockClientId: _selectedBlockClientId,\n\t\t\tblockType:\n\t\t\t\t_selectedBlockClientId &&\n\t\t\t\tgetBlockType( getBlockName( _selectedBlockClientId ) ),\n\t\t\tblockEditingMode: getBlockEditingMode( _selectedBlockClientId ),\n\t\t\thasParents: parents.length,\n\t\t\tshowParentSelector:\n\t\t\t\tparentBlockType &&\n\t\t\t\tgetBlockEditingMode( firstParentClientId ) === 'default' &&\n\t\t\t\thasBlockSupport(\n\t\t\t\t\tparentBlockType,\n\t\t\t\t\t'__experimentalParentSelector',\n\t\t\t\t\ttrue\n\t\t\t\t) &&\n\t\t\t\tselectedBlockClientIds.length <= 1 &&\n\t\t\t\tgetBlockEditingMode( _selectedBlockClientId ) === 'default',\n\t\t};\n\t}, [] );\n\n\tuseEffect( () => {\n\t\tsetIsCollapsed( false );\n\t}, [ selectedBlockClientId ] );\n\n\tconst isLargerThanTabletViewport = useViewportMatch( 'large', '>=' );\n\tconst isFullscreen =\n\t\tdocument.body.classList.contains( 'is-fullscreen-mode' );\n\n\t/**\n\t * The following code is a workaround to fix the width of the toolbar\n\t * it should be removed when the toolbar will be rendered inline\n\t * FIXME: remove this layout effect when the toolbar is no longer\n\t * \t\t\t\tabsolutely positioned\n\t */\n\tuseLayoutEffect( () => {\n\t\t// don't do anything if not fixed toolbar\n\t\tif ( ! isFixed ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst blockToolbar = document.querySelector(\n\t\t\t'.block-editor-block-contextual-toolbar'\n\t\t);\n\n\t\tif ( ! blockToolbar ) {\n\t\t\treturn;\n\t\t}\n\n\t\tif ( ! blockType ) {\n\t\t\tblockToolbar.style.width = 'initial';\n\t\t\treturn;\n\t\t}\n\n\t\tif ( ! isLargerThanTabletViewport ) {\n\t\t\t// set the width of the toolbar to auto\n\t\t\tblockToolbar.style = {};\n\t\t\treturn;\n\t\t}\n\n\t\tif ( isCollapsed ) {\n\t\t\t// set the width of the toolbar to auto\n\t\t\tblockToolbar.style.width = 'auto';\n\t\t\treturn;\n\t\t}\n\n\t\t// get the width of the pinned items in the post editor or widget editor\n\t\tconst pinnedItems = document.querySelector(\n\t\t\t'.edit-post-header__settings, .edit-widgets-header__actions'\n\t\t);\n\t\t// get the width of the left header in the site editor\n\t\tconst leftHeader = document.querySelector(\n\t\t\t'.edit-site-header-edit-mode__end'\n\t\t);\n\n\t\tconst computedToolbarStyle = window.getComputedStyle( blockToolbar );\n\t\tconst computedPinnedItemsStyle = pinnedItems\n\t\t\t? window.getComputedStyle( pinnedItems )\n\t\t\t: false;\n\t\tconst computedLeftHeaderStyle = leftHeader\n\t\t\t? window.getComputedStyle( leftHeader )\n\t\t\t: false;\n\n\t\tconst marginLeft = parseFloat( computedToolbarStyle.marginLeft );\n\t\tconst pinnedItemsWidth = computedPinnedItemsStyle\n\t\t\t? parseFloat( computedPinnedItemsStyle.width )\n\t\t\t: 0;\n\t\tconst leftHeaderWidth = computedLeftHeaderStyle\n\t\t\t? parseFloat( computedLeftHeaderStyle.width )\n\t\t\t: 0;\n\n\t\t// set the new witdth of the toolbar\n\t\tblockToolbar.style.width = `calc(100% - ${\n\t\t\tleftHeaderWidth +\n\t\t\tpinnedItemsWidth +\n\t\t\tmarginLeft +\n\t\t\t( pinnedItems || leftHeader ? 2 : 0 ) + // Prevents button focus border from being cut off\n\t\t\t( isFullscreen ? 0 : 160 ) // the width of the admin sidebar expanded\n\t\t}px)`;\n\t}, [\n\t\tisFixed,\n\t\tisLargerThanTabletViewport,\n\t\tisCollapsed,\n\t\tisFullscreen,\n\t\tblockType,\n\t] );\n\n\tconst isToolbarEnabled =\n\t\t! blockType ||\n\t\thasBlockSupport( blockType, '__experimentalToolbar', true );\n\tconst hasAnyBlockControls = useHasAnyBlockControls();\n\tif (\n\t\t! isToolbarEnabled ||\n\t\t( blockEditingMode !== 'default' && ! hasAnyBlockControls )\n\t) {\n\t\treturn null;\n\t}\n\n\t// Shifts the toolbar to make room for the parent block selector.\n\tconst classes = classnames( 'block-editor-block-contextual-toolbar', {\n\t\t'has-parent': hasParents && showParentSelector,\n\t\t'is-fixed': isFixed,\n\t\t'is-collapsed': isCollapsed,\n\t} );\n\n\treturn (\n\t\t<NavigableToolbar\n\t\t\tfocusOnMount={ focusOnMount }\n\t\t\tclassName={ classes }\n\t\t\t/* translators: accessibility text for the block toolbar */\n\t\t\taria-label={ __( 'Block tools' ) }\n\t\t\tvariant={ isFixed ? 'unstyled' : undefined }\n\t\t\t{ ...props }\n\t\t>\n\t\t\t{ ! isCollapsed && <BlockToolbar hideDragHandle={ isFixed } /> }\n\t\t\t{ isFixed && isLargeViewport && blockType && (\n\t\t\t\t<ToolbarGroup\n\t\t\t\t\tclassName={\n\t\t\t\t\t\tisCollapsed\n\t\t\t\t\t\t\t? 'block-editor-block-toolbar__group-expand-fixed-toolbar'\n\t\t\t\t\t\t\t: 'block-editor-block-toolbar__group-collapse-fixed-toolbar'\n\t\t\t\t\t}\n\t\t\t\t>\n\t\t\t\t\t<ToolbarItem\n\t\t\t\t\t\tas={ ToolbarButton }\n\t\t\t\t\t\tref={ toolbarButtonRef }\n\t\t\t\t\t\ticon={ isCollapsed ? next : previous }\n\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\tsetIsCollapsed( ( collapsed ) => ! collapsed );\n\t\t\t\t\t\t\ttoolbarButtonRef.current.focus();\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tlabel={\n\t\t\t\t\t\t\tisCollapsed\n\t\t\t\t\t\t\t\t? __( 'Show block tools' )\n\t\t\t\t\t\t\t\t: __( 'Hide block tools' )\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t</ToolbarGroup>\n\t\t\t) }\n\t\t</NavigableToolbar>\n\t);\n}\n\nexport default BlockContextualToolbar;\n"],"mappings":";AAAA;AACA;AACA;AACA,OAAOA,UAAU,MAAM,YAAY;;AAEnC;AACA;AACA;AACA,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SACCC,eAAe,EACfC,SAAS,EACTC,MAAM,EACNC,QAAQ,QACF,oBAAoB;AAC3B,SAASC,eAAe,EAAEC,KAAK,IAAIC,WAAW,QAAQ,mBAAmB;AACzE,SAASC,SAAS,QAAQ,iBAAiB;AAC3C,SACCC,WAAW,EACXC,aAAa,EACbC,YAAY,QACN,uBAAuB;AAC9B,SAASC,IAAI,EAAEC,QAAQ,QAAQ,kBAAkB;AACjD,SAASC,gBAAgB,QAAQ,oBAAoB;;AAErD;AACA;AACA;AACA,OAAOC,gBAAgB,MAAM,sBAAsB;AACnD,OAAOC,YAAY,MAAM,kBAAkB;AAC3C,SAASV,KAAK,IAAIW,gBAAgB,QAAQ,aAAa;AACvD,SAASC,sBAAsB,QAAQ,0CAA0C;AAEjF,SAASC,sBAAsBA,CAAE;EAAEC,YAAY;EAAEC,OAAO;EAAE,GAAGC;AAAM,CAAC,EAAG;EACtE;EACA,MAAM,CAAEC,WAAW,EAAEC,cAAc,CAAE,GAAGpB,QAAQ,CAAE,KAAM,CAAC;EACzD,MAAMqB,gBAAgB,GAAGtB,MAAM,CAAC,CAAC;EAEjC,MAAMuB,eAAe,GAAGZ,gBAAgB,CAAE,QAAS,CAAC;EACpD,MAAM;IACLa,SAAS;IACTC,gBAAgB;IAChBC,UAAU;IACVC,kBAAkB;IAClBC;EACD,CAAC,GAAGvB,SAAS,CAAIwB,MAAM,IAAM;IAC5B,MAAM;MACLC,YAAY;MACZC,eAAe;MACfC,yBAAyB;MACzBC;IACD,CAAC,GAAGJ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IAAM,CAAEA,SAAU,CAAC;MAC9CrD,gBAAgB,CAACsD,OAAO,CAACC,KAAK,CAAC,CAAC;IACjC,CAAG;IACHC,KAAK,EACJ1D,WAAW,GACRvB,EAAE,CAAE,kBAAmB,CAAC,GACxBA,EAAE,CAAE,kBAAmB;EAC1B,CACD,CACY,CAEE,CAAC;AAErB;AAEA,eAAemB,sBAAsB"}
1
+ {"version":3,"names":["classnames","__","hasBlockSupport","store","blocksStore","useSelect","NavigableToolbar","BlockToolbar","blockEditorStore","useHasAnyBlockControls","BlockContextualToolbar","focusOnMount","isFixed","props","blockType","blockEditingMode","hasParents","showParentSelector","selectedBlockClientId","select","getBlockName","getBlockParents","getSelectedBlockClientIds","getBlockEditingMode","getBlockType","selectedBlockClientIds","_selectedBlockClientId","parents","firstParentClientId","length","parentBlockName","parentBlockType","isToolbarEnabled","hasAnyBlockControls","classes","createElement","focusEditorOnEscape","className","variant","undefined","key","hideDragHandle"],"sources":["@wordpress/block-editor/src/components/block-tools/block-contextual-toolbar.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { hasBlockSupport, store as blocksStore } from '@wordpress/blocks';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport NavigableToolbar from '../navigable-toolbar';\nimport BlockToolbar from '../block-toolbar';\nimport { store as blockEditorStore } from '../../store';\nimport { useHasAnyBlockControls } from '../block-controls/use-has-block-controls';\n\nexport default function BlockContextualToolbar( {\n\tfocusOnMount,\n\tisFixed,\n\t...props\n} ) {\n\tconst {\n\t\tblockType,\n\t\tblockEditingMode,\n\t\thasParents,\n\t\tshowParentSelector,\n\t\tselectedBlockClientId,\n\t} = useSelect( ( select ) => {\n\t\tconst {\n\t\t\tgetBlockName,\n\t\t\tgetBlockParents,\n\t\t\tgetSelectedBlockClientIds,\n\t\t\tgetBlockEditingMode,\n\t\t} = select( blockEditorStore );\n\t\tconst { getBlockType } = select( blocksStore );\n\t\tconst selectedBlockClientIds = getSelectedBlockClientIds();\n\t\tconst _selectedBlockClientId = selectedBlockClientIds[ 0 ];\n\t\tconst parents = getBlockParents( _selectedBlockClientId );\n\t\tconst firstParentClientId = parents[ parents.length - 1 ];\n\t\tconst parentBlockName = getBlockName( firstParentClientId );\n\t\tconst parentBlockType = getBlockType( parentBlockName );\n\n\t\treturn {\n\t\t\tselectedBlockClientId: _selectedBlockClientId,\n\t\t\tblockType:\n\t\t\t\t_selectedBlockClientId &&\n\t\t\t\tgetBlockType( getBlockName( _selectedBlockClientId ) ),\n\t\t\tblockEditingMode: getBlockEditingMode( _selectedBlockClientId ),\n\t\t\thasParents: parents.length,\n\t\t\tshowParentSelector:\n\t\t\t\tparentBlockType &&\n\t\t\t\tgetBlockEditingMode( firstParentClientId ) === 'default' &&\n\t\t\t\thasBlockSupport(\n\t\t\t\t\tparentBlockType,\n\t\t\t\t\t'__experimentalParentSelector',\n\t\t\t\t\ttrue\n\t\t\t\t) &&\n\t\t\t\tselectedBlockClientIds.length <= 1 &&\n\t\t\t\tgetBlockEditingMode( _selectedBlockClientId ) === 'default',\n\t\t};\n\t}, [] );\n\n\tconst isToolbarEnabled =\n\t\tblockType &&\n\t\thasBlockSupport( blockType, '__experimentalToolbar', true );\n\tconst hasAnyBlockControls = useHasAnyBlockControls();\n\tif (\n\t\t! isToolbarEnabled ||\n\t\t( blockEditingMode !== 'default' && ! hasAnyBlockControls )\n\t) {\n\t\treturn null;\n\t}\n\n\t// Shifts the toolbar to make room for the parent block selector.\n\tconst classes = classnames( 'block-editor-block-contextual-toolbar', {\n\t\t'has-parent': hasParents && showParentSelector,\n\t\t'is-fixed': isFixed,\n\t} );\n\n\treturn (\n\t\t<NavigableToolbar\n\t\t\tfocusOnMount={ focusOnMount }\n\t\t\tfocusEditorOnEscape\n\t\t\tclassName={ classes }\n\t\t\t/* translators: accessibility text for the block toolbar */\n\t\t\taria-label={ __( 'Block tools' ) }\n\t\t\tvariant={ isFixed ? 'unstyled' : undefined }\n\t\t\t// Resets the index whenever the active block changes so\n\t\t\t// this is not persisted. See https://github.com/WordPress/gutenberg/pull/25760#issuecomment-717906169\n\t\t\tkey={ selectedBlockClientId }\n\t\t\t{ ...props }\n\t\t>\n\t\t\t<BlockToolbar hideDragHandle={ isFixed } />\n\t\t</NavigableToolbar>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,OAAOA,UAAU,MAAM,YAAY;;AAEnC;AACA;AACA;AACA,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SAASC,eAAe,EAAEC,KAAK,IAAIC,WAAW,QAAQ,mBAAmB;AACzE,SAASC,SAAS,QAAQ,iBAAiB;;AAE3C;AACA;AACA;AACA,OAAOC,gBAAgB,MAAM,sBAAsB;AACnD,OAAOC,YAAY,MAAM,kBAAkB;AAC3C,SAASJ,KAAK,IAAIK,gBAAgB,QAAQ,aAAa;AACvD,SAASC,sBAAsB,QAAQ,0CAA0C;AAEjF,eAAe,SAASC,sBAAsBA,CAAE;EAC/CC,YAAY;EACZC,OAAO;EACP,GAAGC;AACJ,CAAC,EAAG;EACH,MAAM;IACLC,SAAS;IACTC,gBAAgB;IAChBC,UAAU;IACVC,kBAAkB;IAClBC;EACD,CAAC,GAAGb,SAAS,CAAIc,MAAM,IAAM;IAC5B,MAAM;MACLC,YAAY;MACZC,eAAe;MACfC,yBAAyB;MACzBC;IACD,CAAC,GAAGJ,MAAM,CAAEX,gBAAiB,CAAC;IAC9B,MAAM;MAAEgB;IAAa,CAAC,GAAGL,MAAM,CAAEf,WAAY,CAAC;IAC9C,MAAMqB,sBAAsB,GAAGH,yBAAyB,CAAC,CAAC;IAC1D,MAAMI,sBAAsB,GAAGD,sBAAsB,CAAE,CAAC,CAAE;IAC1D,MAAME,OAAO,GAAGN,eAAe,CAAEK,sBAAuB,CAAC;IACzD,MAAME,mBAAmB,GAAGD,OAAO,CAAEA,OAAO,CAACE,MAAM,GAAG,CAAC,CAAE;IAC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A,GACxBL;EAAK,GAEVsB,aAAA,CAAC5B,YAAY;IAACkC,cAAc,EAAG7B;EAAS,CAAE,CACzB,CAAC;AAErB"}
@@ -0,0 +1,48 @@
1
+ import { createElement } from "react";
2
+ /**
3
+ * External dependencies
4
+ */
5
+ import classnames from 'classnames';
6
+
7
+ /**
8
+ * Internal dependencies
9
+ */
10
+ import BlockPopover from '../block-popover';
11
+ import useBlockToolbarPopoverProps from './use-block-toolbar-popover-props';
12
+ import Inserter from '../inserter';
13
+ import useSelectedBlockToolProps from './use-selected-block-tool-props';
14
+ export default function EmptyBlockInserter({
15
+ clientId,
16
+ __unstableContentRef
17
+ }) {
18
+ const {
19
+ capturingClientId,
20
+ isInsertionPointVisible,
21
+ lastClientId,
22
+ rootClientId
23
+ } = useSelectedBlockToolProps(clientId);
24
+ const popoverProps = useBlockToolbarPopoverProps({
25
+ contentElement: __unstableContentRef?.current,
26
+ clientId
27
+ });
28
+ return createElement(BlockPopover, {
29
+ clientId: capturingClientId || clientId,
30
+ __unstableCoverTarget: true,
31
+ bottomClientId: lastClientId,
32
+ className: classnames('block-editor-block-list__block-side-inserter-popover', {
33
+ 'is-insertion-point-visible': isInsertionPointVisible
34
+ }),
35
+ __unstableContentRef: __unstableContentRef,
36
+ resize: false,
37
+ shift: false,
38
+ ...popoverProps
39
+ }, createElement("div", {
40
+ className: "block-editor-block-list__empty-block-inserter"
41
+ }, createElement(Inserter, {
42
+ position: "bottom right",
43
+ rootClientId: rootClientId,
44
+ clientId: clientId,
45
+ __experimentalIsQuick: true
46
+ })));
47
+ }
48
+ //# sourceMappingURL=empty-block-inserter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["classnames","BlockPopover","useBlockToolbarPopoverProps","Inserter","useSelectedBlockToolProps","EmptyBlockInserter","clientId","__unstableContentRef","capturingClientId","isInsertionPointVisible","lastClientId","rootClientId","popoverProps","contentElement","current","createElement","__unstableCoverTarget","bottomClientId","className","resize","shift","position","__experimentalIsQuick"],"sources":["@wordpress/block-editor/src/components/block-tools/empty-block-inserter.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * Internal dependencies\n */\nimport BlockPopover from '../block-popover';\nimport useBlockToolbarPopoverProps from './use-block-toolbar-popover-props';\nimport Inserter from '../inserter';\nimport useSelectedBlockToolProps from './use-selected-block-tool-props';\n\nexport default function EmptyBlockInserter( {\n\tclientId,\n\t__unstableContentRef,\n} ) {\n\tconst {\n\t\tcapturingClientId,\n\t\tisInsertionPointVisible,\n\t\tlastClientId,\n\t\trootClientId,\n\t} = useSelectedBlockToolProps( clientId );\n\n\tconst popoverProps = useBlockToolbarPopoverProps( {\n\t\tcontentElement: __unstableContentRef?.current,\n\t\tclientId,\n\t} );\n\n\treturn (\n\t\t<BlockPopover\n\t\t\tclientId={ capturingClientId || clientId }\n\t\t\t__unstableCoverTarget\n\t\t\tbottomClientId={ lastClientId }\n\t\t\tclassName={ classnames(\n\t\t\t\t'block-editor-block-list__block-side-inserter-popover',\n\t\t\t\t{\n\t\t\t\t\t'is-insertion-point-visible': isInsertionPointVisible,\n\t\t\t\t}\n\t\t\t) }\n\t\t\t__unstableContentRef={ __unstableContentRef }\n\t\t\tresize={ false }\n\t\t\tshift={ false }\n\t\t\t{ ...popoverProps }\n\t\t>\n\t\t\t<div className=\"block-editor-block-list__empty-block-inserter\">\n\t\t\t\t<Inserter\n\t\t\t\t\tposition=\"bottom right\"\n\t\t\t\t\trootClientId={ rootClientId }\n\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\t__experimentalIsQuick\n\t\t\t\t/>\n\t\t\t</div>\n\t\t</BlockPopover>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,OAAOA,UAAU,MAAM,YAAY;;AAEnC;AACA;AACA;AACA,OAAOC,YAAY,MAAM,kBAAkB;AAC3C,OAAOC,2BAA2B,MAAM,mCAAmC;AAC3E,OAAOC,QAAQ,MAAM,aAAa;AAClC,OAAOC,yBAAyB,MAAM,iCAAiC;AAEvE,eAAe,SAASC,kBAAkBA,CAAE;EAC3CC,QAAQ;EACRC;AACD,CAAC,EAAG;EACH,MAAM;IACLC,iBAAiB;IACjBC,uBAAuB;IACvBC,YAAY;IACZC;EACD,CAAC,GAAGP,yBAAyB,CAAEE,QAAS,CAAC;EAEzC,MAAMM,YAAY,GAAGV,2BAA2B,CAAE;IACjDW,cAAc,EAAEN,oBAAoB,EAAEO,OAAO;IAC7CR;EACD,CAAE,CAAC;EAEH,OACCS,aAAA,CAACd,YAAY;IACZK,QAAQ,EAAGE,iBAAiB,IAAIF,QAAU;IAC1CU,qBAAqB;IACrBC,cAAc,EAAGP,YAAc;IAC/BQ,SAAS,EAAGlB,UAAU,CACrB,sDAAsD,EACtD;MACC,4BAA4B,EAAES;IAC/B,CACD,CAAG;IACHF,oBAAoB,EAAGA,oBAAsB;IAC7CY,MAAM,EAAG,KAAO;IAChBC,KAAK,EAAG,KAAO;IAAA,GACVR;EAAY,GAEjBG,aAAA;IAAKG,SAAS,EAAC;EAA+C,GAC7DH,aAAA,CAACZ,QAAQ;IACRkB,QAAQ,EAAC,cAAc;IACvBV,YAAY,EAAGA,YAAc;IAC7BL,QAAQ,EAAGA,QAAU;IACrBgB,qBAAqB;EAAA,CACrB,CACG,CACQ,CAAC;AAEjB"}
@@ -7,26 +7,42 @@ import { useViewportMatch } from '@wordpress/compose';
7
7
  import { Popover } from '@wordpress/components';
8
8
  import { __unstableUseShortcutEventMatch as useShortcutEventMatch } from '@wordpress/keyboard-shortcuts';
9
9
  import { useRef } from '@wordpress/element';
10
+ import { isUnmodifiedDefaultBlock } from '@wordpress/blocks';
10
11
 
11
12
  /**
12
13
  * Internal dependencies
13
14
  */
15
+ import EmptyBlockInserter from './empty-block-inserter';
14
16
  import { InsertionPointOpenRef, default as InsertionPoint } from './insertion-point';
15
- import SelectedBlockPopover from './selected-block-popover';
17
+ import SelectedBlockTools from './selected-block-tools';
16
18
  import { store as blockEditorStore } from '../../store';
17
19
  import BlockContextualToolbar from './block-contextual-toolbar';
18
20
  import usePopoverScroll from '../block-popover/use-popover-scroll';
19
21
  import ZoomOutModeInserters from './zoom-out-mode-inserters';
20
22
  function selector(select) {
21
23
  const {
22
- __unstableGetEditorMode,
24
+ getSelectedBlockClientId,
25
+ getFirstMultiSelectedBlockClientId,
26
+ getBlock,
23
27
  getSettings,
28
+ __unstableGetEditorMode,
24
29
  isTyping
25
30
  } = select(blockEditorStore);
31
+ const clientId = getSelectedBlockClientId() || getFirstMultiSelectedBlockClientId();
32
+ const {
33
+ name = '',
34
+ attributes = {}
35
+ } = getBlock(clientId) || {};
26
36
  return {
27
- isZoomOutMode: __unstableGetEditorMode() === 'zoom-out',
37
+ clientId,
28
38
  hasFixedToolbar: getSettings().hasFixedToolbar,
29
- isTyping: isTyping()
39
+ hasSelectedBlock: clientId && name,
40
+ isTyping: isTyping(),
41
+ isZoomOutMode: __unstableGetEditorMode() === 'zoom-out',
42
+ showEmptyBlockSideInserter: clientId && !isTyping() && __unstableGetEditorMode() === 'edit' && isUnmodifiedDefaultBlock({
43
+ name,
44
+ attributes
45
+ })
30
46
  };
31
47
  }
32
48
 
@@ -46,9 +62,12 @@ export default function BlockTools({
46
62
  }) {
47
63
  const isLargeViewport = useViewportMatch('medium');
48
64
  const {
65
+ clientId,
49
66
  hasFixedToolbar,
67
+ hasSelectedBlock,
68
+ isTyping,
50
69
  isZoomOutMode,
51
- isTyping
70
+ showEmptyBlockSideInserter
52
71
  } = useSelect(selector, []);
53
72
  const isMatch = useShortcutEventMatch();
54
73
  const {
@@ -106,6 +125,14 @@ export default function BlockTools({
106
125
  insertBeforeBlock(clientIds[0]);
107
126
  }
108
127
  } else if (isMatch('core/block-editor/unselect', event)) {
128
+ if (event.target.closest('[role=toolbar]')) {
129
+ // This shouldn't be necessary, but we have a combination of a few things all combining to create a situation where:
130
+ // - Because the block toolbar uses createPortal to populate the block toolbar fills, we can't rely on the React event bubbling to hit the onKeyDown listener for the block toolbar
131
+ // - Since we can't use the React tree, we use the DOM tree which _should_ handle the event bubbling correctly from a `createPortal` element.
132
+ // - This bubbles via the React tree, which hits this `unselect` escape keypress before the block toolbar DOM event listener has access to it.
133
+ // An alternative would be to remove the addEventListener on the navigableToolbar and use this event to handle it directly right here. That feels hacky too though.
134
+ return;
135
+ }
109
136
  const clientIds = getSelectedBlockClientIds();
110
137
  if (clientIds.length) {
111
138
  event.preventDefault();
@@ -125,6 +152,12 @@ export default function BlockTools({
125
152
  }
126
153
  const blockToolbarRef = usePopoverScroll(__unstableContentRef);
127
154
  const blockToolbarAfterRef = usePopoverScroll(__unstableContentRef);
155
+
156
+ // Conditions for fixed toolbar
157
+ // 1. Not zoom out mode
158
+ // 2. It's a large viewport. If it's a smaller viewport, let the floating toolbar handle it as it already has styles attached to make it render that way.
159
+ // 3. Fixed toolbar is enabled
160
+ const isTopToolbar = !isZoomOutMode && hasFixedToolbar && isLargeViewport;
128
161
  return (
129
162
  // eslint-disable-next-line jsx-a11y/no-static-element-interactions
130
163
  createElement("div", {
@@ -134,11 +167,17 @@ export default function BlockTools({
134
167
  value: useRef(false)
135
168
  }, !isTyping && createElement(InsertionPoint, {
136
169
  __unstableContentRef: __unstableContentRef
137
- }), !isZoomOutMode && (hasFixedToolbar || !isLargeViewport) && createElement(BlockContextualToolbar, {
170
+ }), !isLargeViewport &&
171
+ // Small viewports always get a fixed toolbar
172
+ createElement(BlockContextualToolbar, {
138
173
  isFixed: true
139
- }), createElement(SelectedBlockPopover, {
140
- __unstableContentRef: __unstableContentRef
141
- }), createElement(Popover.Slot, {
174
+ }), showEmptyBlockSideInserter && createElement(EmptyBlockInserter, {
175
+ __unstableContentRef: __unstableContentRef,
176
+ clientId: clientId
177
+ }), !showEmptyBlockSideInserter && hasSelectedBlock && createElement(SelectedBlockTools, {
178
+ __unstableContentRef: __unstableContentRef,
179
+ clientId: clientId
180
+ }), !isTopToolbar && createElement(Popover.Slot, {
142
181
  name: "block-toolbar",
143
182
  ref: blockToolbarRef
144
183
  }), children, createElement(Popover.Slot, {
@@ -1 +1 @@
1
- {"version":3,"names":["useSelect","useDispatch","useViewportMatch","Popover","__unstableUseShortcutEventMatch","useShortcutEventMatch","useRef","InsertionPointOpenRef","default","InsertionPoint","SelectedBlockPopover","store","blockEditorStore","BlockContextualToolbar","usePopoverScroll","ZoomOutModeInserters","selector","select","__unstableGetEditorMode","getSettings","isTyping","isZoomOutMode","hasFixedToolbar","BlockTools","children","__unstableContentRef","props","isLargeViewport","isMatch","getSelectedBlockClientIds","getBlockRootClientId","duplicateBlocks","removeBlocks","insertAfterBlock","insertBeforeBlock","clearSelectedBlock","selectBlock","moveBlocksUp","moveBlocksDown","onKeyDown","event","defaultPrevented","clientIds","length","preventDefault","rootClientId","target","ownerDocument","defaultView","getSelection","removeAllRanges","current","focus","blockToolbarRef","blockToolbarAfterRef","createElement","Provider","value","isFixed","Slot","name","ref"],"sources":["@wordpress/block-editor/src/components/block-tools/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { useViewportMatch } from '@wordpress/compose';\nimport { Popover } from '@wordpress/components';\nimport { __unstableUseShortcutEventMatch as useShortcutEventMatch } from '@wordpress/keyboard-shortcuts';\nimport { useRef } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport {\n\tInsertionPointOpenRef,\n\tdefault as InsertionPoint,\n} from './insertion-point';\nimport SelectedBlockPopover from './selected-block-popover';\nimport { store as blockEditorStore } from '../../store';\nimport BlockContextualToolbar from './block-contextual-toolbar';\nimport usePopoverScroll from '../block-popover/use-popover-scroll';\nimport ZoomOutModeInserters from './zoom-out-mode-inserters';\n\nfunction selector( select ) {\n\tconst { __unstableGetEditorMode, getSettings, isTyping } =\n\t\tselect( blockEditorStore );\n\n\treturn {\n\t\tisZoomOutMode: __unstableGetEditorMode() === 'zoom-out',\n\t\thasFixedToolbar: getSettings().hasFixedToolbar,\n\t\tisTyping: isTyping(),\n\t};\n}\n\n/**\n * Renders block tools (the block toolbar, select/navigation mode toolbar, the\n * insertion point and a slot for the inline rich text toolbar). Must be wrapped\n * around the block content and editor styles wrapper or iframe.\n *\n * @param {Object} $0 Props.\n * @param {Object} $0.children The block content and style container.\n * @param {Object} $0.__unstableContentRef Ref holding the content scroll container.\n */\nexport default function BlockTools( {\n\tchildren,\n\t__unstableContentRef,\n\t...props\n} ) {\n\tconst isLargeViewport = useViewportMatch( 'medium' );\n\tconst { hasFixedToolbar, isZoomOutMode, isTyping } = useSelect(\n\t\tselector,\n\t\t[]\n\t);\n\tconst isMatch = useShortcutEventMatch();\n\tconst { getSelectedBlockClientIds, getBlockRootClientId } =\n\t\tuseSelect( blockEditorStore );\n\tconst {\n\t\tduplicateBlocks,\n\t\tremoveBlocks,\n\t\tinsertAfterBlock,\n\t\tinsertBeforeBlock,\n\t\tclearSelectedBlock,\n\t\tselectBlock,\n\t\tmoveBlocksUp,\n\t\tmoveBlocksDown,\n\t} = useDispatch( blockEditorStore );\n\n\tfunction onKeyDown( event ) {\n\t\tif ( event.defaultPrevented ) return;\n\n\t\tif ( isMatch( 'core/block-editor/move-up', event ) ) {\n\t\t\tconst clientIds = getSelectedBlockClientIds();\n\t\t\tif ( clientIds.length ) {\n\t\t\t\tevent.preventDefault();\n\t\t\t\tconst rootClientId = getBlockRootClientId( clientIds[ 0 ] );\n\t\t\t\tmoveBlocksUp( clientIds, rootClientId );\n\t\t\t}\n\t\t} else if ( isMatch( 'core/block-editor/move-down', event ) ) {\n\t\t\tconst clientIds = getSelectedBlockClientIds();\n\t\t\tif ( clientIds.length ) {\n\t\t\t\tevent.preventDefault();\n\t\t\t\tconst rootClientId = getBlockRootClientId( clientIds[ 0 ] );\n\t\t\t\tmoveBlocksDown( clientIds, rootClientId );\n\t\t\t}\n\t\t} else if ( isMatch( 'core/block-editor/duplicate', event ) ) {\n\t\t\tconst clientIds = getSelectedBlockClientIds();\n\t\t\tif ( clientIds.length ) {\n\t\t\t\tevent.preventDefault();\n\t\t\t\tduplicateBlocks( clientIds );\n\t\t\t}\n\t\t} else if ( isMatch( 'core/block-editor/remove', event ) ) {\n\t\t\tconst clientIds = getSelectedBlockClientIds();\n\t\t\tif ( clientIds.length ) {\n\t\t\t\tevent.preventDefault();\n\t\t\t\tremoveBlocks( clientIds );\n\t\t\t}\n\t\t} else if ( isMatch( 'core/block-editor/insert-after', event ) ) {\n\t\t\tconst clientIds = getSelectedBlockClientIds();\n\t\t\tif ( clientIds.length ) {\n\t\t\t\tevent.preventDefault();\n\t\t\t\tinsertAfterBlock( clientIds[ clientIds.length - 1 ] );\n\t\t\t}\n\t\t} else if ( isMatch( 'core/block-editor/insert-before', event ) ) {\n\t\t\tconst clientIds = getSelectedBlockClientIds();\n\t\t\tif ( clientIds.length ) {\n\t\t\t\tevent.preventDefault();\n\t\t\t\tinsertBeforeBlock( clientIds[ 0 ] );\n\t\t\t}\n\t\t} else if ( isMatch( 'core/block-editor/unselect', event ) ) {\n\t\t\tconst clientIds = getSelectedBlockClientIds();\n\t\t\tif ( clientIds.length ) {\n\t\t\t\tevent.preventDefault();\n\n\t\t\t\t// If there is more than one block selected, select the first\n\t\t\t\t// block so that focus is directed back to the beginning of the selection.\n\t\t\t\t// In effect, to the user this feels like deselecting the multi-selection.\n\t\t\t\tif ( clientIds.length > 1 ) {\n\t\t\t\t\tselectBlock( clientIds[ 0 ] );\n\t\t\t\t} else {\n\t\t\t\t\tclearSelectedBlock();\n\t\t\t\t}\n\t\t\t\tevent.target.ownerDocument.defaultView\n\t\t\t\t\t.getSelection()\n\t\t\t\t\t.removeAllRanges();\n\t\t\t\t__unstableContentRef?.current.focus();\n\t\t\t}\n\t\t}\n\t}\n\n\tconst blockToolbarRef = usePopoverScroll( __unstableContentRef );\n\tconst blockToolbarAfterRef = usePopoverScroll( __unstableContentRef );\n\n\treturn (\n\t\t// eslint-disable-next-line jsx-a11y/no-static-element-interactions\n\t\t<div { ...props } onKeyDown={ onKeyDown }>\n\t\t\t<InsertionPointOpenRef.Provider value={ useRef( false ) }>\n\t\t\t\t{ ! isTyping && (\n\t\t\t\t\t<InsertionPoint\n\t\t\t\t\t\t__unstableContentRef={ __unstableContentRef }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t\t{ ! isZoomOutMode &&\n\t\t\t\t\t( hasFixedToolbar || ! isLargeViewport ) && (\n\t\t\t\t\t\t<BlockContextualToolbar isFixed />\n\t\t\t\t\t) }\n\t\t\t\t{ /* Even if the toolbar is fixed, the block popover is still\n\t\t\t\t\tneeded for navigation and zoom-out mode. */ }\n\t\t\t\t<SelectedBlockPopover\n\t\t\t\t\t__unstableContentRef={ __unstableContentRef }\n\t\t\t\t/>\n\t\t\t\t{ /* Used for the inline rich text toolbar. */ }\n\t\t\t\t<Popover.Slot name=\"block-toolbar\" ref={ blockToolbarRef } />\n\t\t\t\t{ children }\n\t\t\t\t{ /* Used for inline rich text popovers. */ }\n\t\t\t\t<Popover.Slot\n\t\t\t\t\tname=\"__unstable-block-tools-after\"\n\t\t\t\t\tref={ blockToolbarAfterRef }\n\t\t\t\t/>\n\t\t\t\t{ isZoomOutMode && (\n\t\t\t\t\t<ZoomOutModeInserters\n\t\t\t\t\t\t__unstableContentRef={ __unstableContentRef }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t</InsertionPointOpenRef.Provider>\n\t\t</div>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACxD,SAASC,gBAAgB,QAAQ,oBAAoB;AACrD,SAASC,OAAO,QAAQ,uBAAuB;AAC/C,SAASC,+BAA+B,IAAIC,qBAAqB,QAAQ,+BAA+B;AACxG,SAASC,MAAM,QAAQ,oBAAoB;;AAE3C;AACA;AACA;AACA,SACCC,qBAAqB,EACrBC,OAAO,IAAIC,cAAc,QACnB,mBAAmB;AAC1B,OAAOC,oBAAoB,MAAM,0BAA0B;AAC3D,SAASC,KAAK,IAAIC,gBAAgB,QAAQ,aAAa;AACvD,OAAOC,sBA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AAE,CACjC,EAGFH,aAAA,CAAC7C,oBAAoB;MACpBe,oBAAoB,EAAGA;IAAsB,CAC7C,CAAC,EAEF8B,aAAA,CAACpD,OAAO,CAACwD,IAAI;MAACC,IAAI,EAAC,eAAe;MAACC,GAAG,EAAGR;IAAiB,CAAE,CAAC,EAC3D7B,QAAQ,EAEV+B,aAAA,CAACpD,OAAO,CAACwD,IAAI;MACZC,IAAI,EAAC,8BAA8B;MACnCC,GAAG,EAAGP;IAAsB,CAC5B,CAAC,EACAjC,aAAa,IACdkC,aAAA,CAACxC,oBAAoB;MACpBU,oBAAoB,EAAGA;IAAsB,CAC7C,CAE6B,CAC5B;EAAC;AAER"}
1
+ {"version":3,"names":["useSelect","useDispatch","useViewportMatch","Popover","__unstableUseShortcutEventMatch","useShortcutEventMatch","useRef","isUnmodifiedDefaultBlock","EmptyBlockInserter","InsertionPointOpenRef","default","InsertionPoint","SelectedBlockTools","store","blockEditorStore","BlockContextualToolbar","usePopoverScroll","ZoomOutModeInserters","selector","select","getSelectedBlockClientId","getFirstMultiSelectedBlockClientId","getBlock","getSettings","__unstableGetEditorMode","isTyping","clientId","name","attributes","hasFixedToolbar","hasSelectedBlock","isZoomOutMode","showEmptyBlockSideInserter","BlockTools","children","__unstableContentRef","props","isLargeViewport","isMatch","getSelectedBlockClientIds","getBlockRootClientId","duplicateBlocks","removeBlocks","insertAfterBlock","insertBeforeBlock","clearSelectedBlock","selectBlock","moveBlocksUp","moveBlocksDown","onKeyDown","event","defaultPrevented","clientIds","length","preventDefault","rootClientId","target","closest","ownerDocument","defaultView","getSelection","removeAllRanges","current","focus","blockToolbarRef","blockToolbarAfterRef","isTopToolbar","createElement","Provider","value","isFixed","Slot","ref"],"sources":["@wordpress/block-editor/src/components/block-tools/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { useViewportMatch } from '@wordpress/compose';\nimport { Popover } from '@wordpress/components';\nimport { __unstableUseShortcutEventMatch as useShortcutEventMatch } from '@wordpress/keyboard-shortcuts';\nimport { useRef } from '@wordpress/element';\nimport { isUnmodifiedDefaultBlock } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport EmptyBlockInserter from './empty-block-inserter';\nimport {\n\tInsertionPointOpenRef,\n\tdefault as InsertionPoint,\n} from './insertion-point';\nimport SelectedBlockTools from './selected-block-tools';\nimport { store as blockEditorStore } from '../../store';\nimport BlockContextualToolbar from './block-contextual-toolbar';\nimport usePopoverScroll from '../block-popover/use-popover-scroll';\nimport ZoomOutModeInserters from './zoom-out-mode-inserters';\n\nfunction selector( select ) {\n\tconst {\n\t\tgetSelectedBlockClientId,\n\t\tgetFirstMultiSelectedBlockClientId,\n\t\tgetBlock,\n\t\tgetSettings,\n\t\t__unstableGetEditorMode,\n\t\tisTyping,\n\t} = select( blockEditorStore );\n\n\tconst clientId =\n\t\tgetSelectedBlockClientId() || getFirstMultiSelectedBlockClientId();\n\n\tconst { name = '', attributes = {} } = getBlock( clientId ) || {};\n\n\treturn {\n\t\tclientId,\n\t\thasFixedToolbar: getSettings().hasFixedToolbar,\n\t\thasSelectedBlock: clientId && name,\n\t\tisTyping: isTyping(),\n\t\tisZoomOutMode: __unstableGetEditorMode() === 'zoom-out',\n\t\tshowEmptyBlockSideInserter:\n\t\t\tclientId &&\n\t\t\t! isTyping() &&\n\t\t\t__unstableGetEditorMode() === 'edit' &&\n\t\t\tisUnmodifiedDefaultBlock( { name, attributes } ),\n\t};\n}\n\n/**\n * Renders block tools (the block toolbar, select/navigation mode toolbar, the\n * insertion point and a slot for the inline rich text toolbar). Must be wrapped\n * around the block content and editor styles wrapper or iframe.\n *\n * @param {Object} $0 Props.\n * @param {Object} $0.children The block content and style container.\n * @param {Object} $0.__unstableContentRef Ref holding the content scroll container.\n */\nexport default function BlockTools( {\n\tchildren,\n\t__unstableContentRef,\n\t...props\n} ) {\n\tconst isLargeViewport = useViewportMatch( 'medium' );\n\tconst {\n\t\tclientId,\n\t\thasFixedToolbar,\n\t\thasSelectedBlock,\n\t\tisTyping,\n\t\tisZoomOutMode,\n\t\tshowEmptyBlockSideInserter,\n\t} = useSelect( selector, [] );\n\tconst isMatch = useShortcutEventMatch();\n\tconst { getSelectedBlockClientIds, getBlockRootClientId } =\n\t\tuseSelect( blockEditorStore );\n\tconst {\n\t\tduplicateBlocks,\n\t\tremoveBlocks,\n\t\tinsertAfterBlock,\n\t\tinsertBeforeBlock,\n\t\tclearSelectedBlock,\n\t\tselectBlock,\n\t\tmoveBlocksUp,\n\t\tmoveBlocksDown,\n\t} = useDispatch( blockEditorStore );\n\n\tfunction onKeyDown( event ) {\n\t\tif ( event.defaultPrevented ) return;\n\n\t\tif ( isMatch( 'core/block-editor/move-up', event ) ) {\n\t\t\tconst clientIds = getSelectedBlockClientIds();\n\t\t\tif ( clientIds.length ) {\n\t\t\t\tevent.preventDefault();\n\t\t\t\tconst rootClientId = getBlockRootClientId( clientIds[ 0 ] );\n\t\t\t\tmoveBlocksUp( clientIds, rootClientId );\n\t\t\t}\n\t\t} else if ( isMatch( 'core/block-editor/move-down', event ) ) {\n\t\t\tconst clientIds = getSelectedBlockClientIds();\n\t\t\tif ( clientIds.length ) {\n\t\t\t\tevent.preventDefault();\n\t\t\t\tconst rootClientId = getBlockRootClientId( clientIds[ 0 ] );\n\t\t\t\tmoveBlocksDown( clientIds, rootClientId );\n\t\t\t}\n\t\t} else if ( isMatch( 'core/block-editor/duplicate', event ) ) {\n\t\t\tconst clientIds = getSelectedBlockClientIds();\n\t\t\tif ( clientIds.length ) {\n\t\t\t\tevent.preventDefault();\n\t\t\t\tduplicateBlocks( clientIds );\n\t\t\t}\n\t\t} else if ( isMatch( 'core/block-editor/remove', event ) ) {\n\t\t\tconst clientIds = getSelectedBlockClientIds();\n\t\t\tif ( clientIds.length ) {\n\t\t\t\tevent.preventDefault();\n\t\t\t\tremoveBlocks( clientIds );\n\t\t\t}\n\t\t} else if ( isMatch( 'core/block-editor/insert-after', event ) ) {\n\t\t\tconst clientIds = getSelectedBlockClientIds();\n\t\t\tif ( clientIds.length ) {\n\t\t\t\tevent.preventDefault();\n\t\t\t\tinsertAfterBlock( clientIds[ clientIds.length - 1 ] );\n\t\t\t}\n\t\t} else if ( isMatch( 'core/block-editor/insert-before', event ) ) {\n\t\t\tconst clientIds = getSelectedBlockClientIds();\n\t\t\tif ( clientIds.length ) {\n\t\t\t\tevent.preventDefault();\n\t\t\t\tinsertBeforeBlock( clientIds[ 0 ] );\n\t\t\t}\n\t\t} else if ( isMatch( 'core/block-editor/unselect', event ) ) {\n\t\t\tif ( event.target.closest( '[role=toolbar]' ) ) {\n\t\t\t\t// This shouldn't be necessary, but we have a combination of a few things all combining to create a situation where:\n\t\t\t\t// - Because the block toolbar uses createPortal to populate the block toolbar fills, we can't rely on the React event bubbling to hit the onKeyDown listener for the block toolbar\n\t\t\t\t// - Since we can't use the React tree, we use the DOM tree which _should_ handle the event bubbling correctly from a `createPortal` element.\n\t\t\t\t// - This bubbles via the React tree, which hits this `unselect` escape keypress before the block toolbar DOM event listener has access to it.\n\t\t\t\t// An alternative would be to remove the addEventListener on the navigableToolbar and use this event to handle it directly right here. That feels hacky too though.\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst clientIds = getSelectedBlockClientIds();\n\t\t\tif ( clientIds.length ) {\n\t\t\t\tevent.preventDefault();\n\n\t\t\t\t// If there is more than one block selected, select the first\n\t\t\t\t// block so that focus is directed back to the beginning of the selection.\n\t\t\t\t// In effect, to the user this feels like deselecting the multi-selection.\n\t\t\t\tif ( clientIds.length > 1 ) {\n\t\t\t\t\tselectBlock( clientIds[ 0 ] );\n\t\t\t\t} else {\n\t\t\t\t\tclearSelectedBlock();\n\t\t\t\t}\n\t\t\t\tevent.target.ownerDocument.defaultView\n\t\t\t\t\t.getSelection()\n\t\t\t\t\t.removeAllRanges();\n\t\t\t\t__unstableContentRef?.current.focus();\n\t\t\t}\n\t\t}\n\t}\n\n\tconst blockToolbarRef = usePopoverScroll( __unstableContentRef );\n\tconst blockToolbarAfterRef = usePopoverScroll( __unstableContentRef );\n\n\t// Conditions for fixed toolbar\n\t// 1. Not zoom out mode\n\t// 2. It's a large viewport. If it's a smaller viewport, let the floating toolbar handle it as it already has styles attached to make it render that way.\n\t// 3. Fixed toolbar is enabled\n\tconst isTopToolbar = ! isZoomOutMode && hasFixedToolbar && isLargeViewport;\n\n\treturn (\n\t\t// eslint-disable-next-line jsx-a11y/no-static-element-interactions\n\t\t<div { ...props } onKeyDown={ onKeyDown }>\n\t\t\t<InsertionPointOpenRef.Provider value={ useRef( false ) }>\n\t\t\t\t{ ! isTyping && (\n\t\t\t\t\t<InsertionPoint\n\t\t\t\t\t\t__unstableContentRef={ __unstableContentRef }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t\t{ /* If there is no slot available, such as in the standalone block editor, render within the editor */ }\n\n\t\t\t\t{ ! isLargeViewport && ( // Small viewports always get a fixed toolbar\n\t\t\t\t\t<BlockContextualToolbar isFixed />\n\t\t\t\t) }\n\n\t\t\t\t{ showEmptyBlockSideInserter && (\n\t\t\t\t\t<EmptyBlockInserter\n\t\t\t\t\t\t__unstableContentRef={ __unstableContentRef }\n\t\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t\t{ /* Even if the toolbar is fixed, the block popover is still\n\t\t\t\t\tneeded for navigation and zoom-out mode. */ }\n\t\t\t\t{ ! showEmptyBlockSideInserter && hasSelectedBlock && (\n\t\t\t\t\t<SelectedBlockTools\n\t\t\t\t\t\t__unstableContentRef={ __unstableContentRef }\n\t\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\n\t\t\t\t{ /* Used for the inline rich text toolbar. */ }\n\t\t\t\t{ ! isTopToolbar && (\n\t\t\t\t\t<Popover.Slot\n\t\t\t\t\t\tname=\"block-toolbar\"\n\t\t\t\t\t\tref={ blockToolbarRef }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t\t{ children }\n\t\t\t\t{ /* Used for inline rich text popovers. */ }\n\t\t\t\t<Popover.Slot\n\t\t\t\t\tname=\"__unstable-block-tools-after\"\n\t\t\t\t\tref={ blockToolbarAfterRef }\n\t\t\t\t/>\n\t\t\t\t{ isZoomOutMode && (\n\t\t\t\t\t<ZoomOutModeInserters\n\t\t\t\t\t\t__unstableContentRef={ __unstableContentRef }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t</InsertionPointOpenRef.Provider>\n\t\t</div>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACxD,SAASC,gBAAgB,QAAQ,oBAAoB;AACrD,SAASC,OAAO,QAAQ,uBAAuB;AAC/C,SAASC,+BAA+B,IAAIC,qBAAqB,QAAQ,+BAA+B;AACxG,SAASC,MAAM,QAAQ,oBAAoB;AAC3C,SAASC,wBAAwB,QAAQ,mBAAmB;;AAE5D;AACA;AACA;AACA,OAAOC,kBAAkB,MAAM,wBAAwB;AACvD,SACCC,qBAAqB,EACrBC,OAAO,IAAIC,cAAc,QACnB,mBAAmB;AAC1B,OAAOC,kBAAkB,MAAM,wBAAwB;AACvD,SAASC,KAAK,IAAIC,gBAAgB,QAAQ,aAAa;AACvD,OAAOC,sBAAsB,MAAM,4BAA4B;AAC/D,OAAOC,gBAAgB,MAAM,qCAAqC;AAClE,OAAOC,oBAAoB,MAAM,2BAA2B;AAE5D,SAASC,QAAQA,CAAEC,MAAM,EAAG;EAC3B,MAAM;IACLC,wBAAwB;IACxBC,kCAAkC;IAClCC,QAAQ;IACRC,WAAW;IACXC,uBAAuB;IACvBC;EACD,CAAC,GAAGN,MAAM,CAAEL,gBAAiB,CAAC;EAE9B,MAAMY,QAAQ,GACbN,wBAAwB,CAAC,CAAC,IAAIC,kCAAkC,CAAC,CAAC;EAEnE,MAAM;IAAEM,IAAI,GAAG,EAAE;IAAEC,UAAU,GAAG,CAAC;EAAE,CAAC,G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kB,aAAA,CAAC1D,qBAAqB,CAAC2D,QAAQ;MAACC,KAAK,EAAG/D,MAAM,CAAE,KAAM;IAAG,GACtD,CAAEmB,QAAQ,IACX0C,aAAA,CAACxD,cAAc;MACdwB,oBAAoB,EAAGA;IAAsB,CAC7C,CACD,EAGC,CAAEE,eAAe;IAAM;IACxB8B,aAAA,CAACpD,sBAAsB;MAACuD,OAAO;IAAA,CAAE,CACjC,EAECtC,0BAA0B,IAC3BmC,aAAA,CAAC3D,kBAAkB;MAClB2B,oBAAoB,EAAGA,oBAAsB;MAC7CT,QAAQ,EAAGA;IAAU,CACrB,CACD,EAGC,CAAEM,0BAA0B,IAAIF,gBAAgB,IACjDqC,aAAA,CAACvD,kBAAkB;MAClBuB,oBAAoB,EAAGA,oBAAsB;MAC7CT,QAAQ,EAAGA;IAAU,CACrB,CACD,EAGC,CAAEwC,YAAY,IACfC,aAAA,CAAChE,OAAO,CAACoE,IAAI;MACZ5C,IAAI,EAAC,eAAe;MACpB6C,GAAG,EAAGR;IAAiB,CACvB,CACD,EACC9B,QAAQ,EAEViC,aAAA,CAAChE,OAAO,CAACoE,IAAI;MACZ5C,IAAI,EAAC,8BAA8B;MACnC6C,GAAG,EAAGP;IAAsB,CAC5B,CAAC,EACAlC,aAAa,IACdoC,aAAA,CAAClD,oBAAoB;MACpBkB,oBAAoB,EAAGA;IAAsB,CAC7C,CAE6B,CAC5B;EAAC;AAER"}
@@ -0,0 +1,105 @@
1
+ import { createElement } from "react";
2
+ /**
3
+ * External dependencies
4
+ */
5
+ import classnames from 'classnames';
6
+
7
+ /**
8
+ * WordPress dependencies
9
+ */
10
+ import { useRef, useEffect } from '@wordpress/element';
11
+ import { useDispatch, useSelect } from '@wordpress/data';
12
+ import { useShortcut } from '@wordpress/keyboard-shortcuts';
13
+
14
+ /**
15
+ * Internal dependencies
16
+ */
17
+ import BlockSelectionButton from './block-selection-button';
18
+ import BlockContextualToolbar from './block-contextual-toolbar';
19
+ import { store as blockEditorStore } from '../../store';
20
+ import BlockPopover from '../block-popover';
21
+ import useBlockToolbarPopoverProps from './use-block-toolbar-popover-props';
22
+ import useSelectedBlockToolProps from './use-selected-block-tool-props';
23
+ import { useShouldContextualToolbarShow } from '../../utils/use-should-contextual-toolbar-show';
24
+ export default function SelectedBlockTools({
25
+ clientId,
26
+ showEmptyBlockSideInserter,
27
+ __unstableContentRef
28
+ }) {
29
+ const {
30
+ capturingClientId,
31
+ isInsertionPointVisible,
32
+ lastClientId,
33
+ rootClientId
34
+ } = useSelectedBlockToolProps(clientId);
35
+ const {
36
+ shouldShowBreadcrumb
37
+ } = useSelect(select => {
38
+ const {
39
+ hasMultiSelection,
40
+ __unstableGetEditorMode
41
+ } = select(blockEditorStore);
42
+ const editorMode = __unstableGetEditorMode();
43
+ return {
44
+ shouldShowBreadcrumb: !hasMultiSelection() && (editorMode === 'navigation' || editorMode === 'zoom-out')
45
+ };
46
+ }, []);
47
+ const isToolbarForced = useRef(false);
48
+ const {
49
+ shouldShowContextualToolbar,
50
+ canFocusHiddenToolbar
51
+ } = useShouldContextualToolbarShow();
52
+ const {
53
+ stopTyping
54
+ } = useDispatch(blockEditorStore);
55
+ useShortcut('core/block-editor/focus-toolbar', () => {
56
+ isToolbarForced.current = true;
57
+ stopTyping(true);
58
+ }, {
59
+ isDisabled: !canFocusHiddenToolbar
60
+ });
61
+ useEffect(() => {
62
+ isToolbarForced.current = false;
63
+ });
64
+
65
+ // Stores the active toolbar item index so the block toolbar can return focus
66
+ // to it when re-mounting.
67
+ const initialToolbarItemIndexRef = useRef();
68
+ useEffect(() => {
69
+ // Resets the index whenever the active block changes so this is not
70
+ // persisted. See https://github.com/WordPress/gutenberg/pull/25760#issuecomment-717906169
71
+ initialToolbarItemIndexRef.current = undefined;
72
+ }, [clientId]);
73
+ const popoverProps = useBlockToolbarPopoverProps({
74
+ contentElement: __unstableContentRef?.current,
75
+ clientId
76
+ });
77
+ if (showEmptyBlockSideInserter) {
78
+ return null;
79
+ }
80
+ if (shouldShowBreadcrumb || shouldShowContextualToolbar) {
81
+ return createElement(BlockPopover, {
82
+ clientId: capturingClientId || clientId,
83
+ bottomClientId: lastClientId,
84
+ className: classnames('block-editor-block-list__block-popover', {
85
+ 'is-insertion-point-visible': isInsertionPointVisible
86
+ }),
87
+ resize: false,
88
+ ...popoverProps
89
+ }, shouldShowContextualToolbar && createElement(BlockContextualToolbar
90
+ // If the toolbar is being shown because of being forced
91
+ // it should focus the toolbar right after the mount.
92
+ , {
93
+ focusOnMount: isToolbarForced.current,
94
+ __experimentalInitialIndex: initialToolbarItemIndexRef.current,
95
+ __experimentalOnIndexChange: index => {
96
+ initialToolbarItemIndexRef.current = index;
97
+ }
98
+ }), shouldShowBreadcrumb && createElement(BlockSelectionButton, {
99
+ clientId: clientId,
100
+ rootClientId: rootClientId
101
+ }));
102
+ }
103
+ return null;
104
+ }
105
+ //# sourceMappingURL=selected-block-tools.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["classnames","useRef","useEffect","useDispatch","useSelect","useShortcut","BlockSelectionButton","BlockContextualToolbar","store","blockEditorStore","BlockPopover","useBlockToolbarPopoverProps","useSelectedBlockToolProps","useShouldContextualToolbarShow","SelectedBlockTools","clientId","showEmptyBlockSideInserter","__unstableContentRef","capturingClientId","isInsertionPointVisible","lastClientId","rootClientId","shouldShowBreadcrumb","select","hasMultiSelection","__unstableGetEditorMode","editorMode","isToolbarForced","shouldShowContextualToolbar","canFocusHiddenToolbar","stopTyping","current","isDisabled","initialToolbarItemIndexRef","undefined","popoverProps","contentElement","createElement","bottomClientId","className","resize","focusOnMount","__experimentalInitialIndex","__experimentalOnIndexChange","index"],"sources":["@wordpress/block-editor/src/components/block-tools/selected-block-tools.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { useRef, useEffect } from '@wordpress/element';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { useShortcut } from '@wordpress/keyboard-shortcuts';\n\n/**\n * Internal dependencies\n */\nimport BlockSelectionButton from './block-selection-button';\nimport BlockContextualToolbar from './block-contextual-toolbar';\nimport { store as blockEditorStore } from '../../store';\nimport BlockPopover from '../block-popover';\nimport useBlockToolbarPopoverProps from './use-block-toolbar-popover-props';\nimport useSelectedBlockToolProps from './use-selected-block-tool-props';\nimport { useShouldContextualToolbarShow } from '../../utils/use-should-contextual-toolbar-show';\n\nexport default function SelectedBlockTools( {\n\tclientId,\n\tshowEmptyBlockSideInserter,\n\t__unstableContentRef,\n} ) {\n\tconst {\n\t\tcapturingClientId,\n\t\tisInsertionPointVisible,\n\t\tlastClientId,\n\t\trootClientId,\n\t} = useSelectedBlockToolProps( clientId );\n\n\tconst { shouldShowBreadcrumb } = useSelect( ( select ) => {\n\t\tconst { hasMultiSelection, __unstableGetEditorMode } =\n\t\t\tselect( blockEditorStore );\n\n\t\tconst editorMode = __unstableGetEditorMode();\n\n\t\treturn {\n\t\t\tshouldShowBreadcrumb:\n\t\t\t\t! hasMultiSelection() &&\n\t\t\t\t( editorMode === 'navigation' || editorMode === 'zoom-out' ),\n\t\t};\n\t}, [] );\n\n\tconst isToolbarForced = useRef( false );\n\tconst { shouldShowContextualToolbar, canFocusHiddenToolbar } =\n\t\tuseShouldContextualToolbarShow();\n\n\tconst { stopTyping } = useDispatch( blockEditorStore );\n\n\tuseShortcut(\n\t\t'core/block-editor/focus-toolbar',\n\t\t() => {\n\t\t\tisToolbarForced.current = true;\n\t\t\tstopTyping( true );\n\t\t},\n\t\t{\n\t\t\tisDisabled: ! canFocusHiddenToolbar,\n\t\t}\n\t);\n\n\tuseEffect( () => {\n\t\tisToolbarForced.current = false;\n\t} );\n\n\t// Stores the active toolbar item index so the block toolbar can return focus\n\t// to it when re-mounting.\n\tconst initialToolbarItemIndexRef = useRef();\n\n\tuseEffect( () => {\n\t\t// Resets the index whenever the active block changes so this is not\n\t\t// persisted. See https://github.com/WordPress/gutenberg/pull/25760#issuecomment-717906169\n\t\tinitialToolbarItemIndexRef.current = undefined;\n\t}, [ clientId ] );\n\n\tconst popoverProps = useBlockToolbarPopoverProps( {\n\t\tcontentElement: __unstableContentRef?.current,\n\t\tclientId,\n\t} );\n\n\tif ( showEmptyBlockSideInserter ) {\n\t\treturn null;\n\t}\n\n\tif ( shouldShowBreadcrumb || shouldShowContextualToolbar ) {\n\t\treturn (\n\t\t\t<BlockPopover\n\t\t\t\tclientId={ capturingClientId || clientId }\n\t\t\t\tbottomClientId={ lastClientId }\n\t\t\t\tclassName={ classnames(\n\t\t\t\t\t'block-editor-block-list__block-popover',\n\t\t\t\t\t{\n\t\t\t\t\t\t'is-insertion-point-visible': isInsertionPointVisible,\n\t\t\t\t\t}\n\t\t\t\t) }\n\t\t\t\tresize={ false }\n\t\t\t\t{ ...popoverProps }\n\t\t\t>\n\t\t\t\t{ shouldShowContextualToolbar && (\n\t\t\t\t\t<BlockContextualToolbar\n\t\t\t\t\t\t// If the toolbar is being shown because of being forced\n\t\t\t\t\t\t// it should focus the toolbar right after the mount.\n\t\t\t\t\t\tfocusOnMount={ isToolbarForced.current }\n\t\t\t\t\t\t__experimentalInitialIndex={\n\t\t\t\t\t\t\tinitialToolbarItemIndexRef.current\n\t\t\t\t\t\t}\n\t\t\t\t\t\t__experimentalOnIndexChange={ ( index ) => {\n\t\t\t\t\t\t\tinitialToolbarItemIndexRef.current = index;\n\t\t\t\t\t\t} }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t\t{ shouldShowBreadcrumb && (\n\t\t\t\t\t<BlockSelectionButton\n\t\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\t\trootClientId={ rootClientId }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t</BlockPopover>\n\t\t);\n\t}\n\n\treturn null;\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,OAAOA,UAAU,MAAM,YAAY;;AAEnC;AACA;AACA;AACA,SAASC,MAAM,EAAEC,SAAS,QAAQ,oBAAoB;AACtD,SAASC,WAAW,EAAEC,SAA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
+ */
9
+ import { store as blockEditorStore } from '../../store';
10
+
11
+ /**
12
+ * Returns props for the selected block tools and empty block inserter.
13
+ *
14
+ * @param {string} clientId Selected block client ID.
15
+ */
16
+ export default function useSelectedBlockToolProps(clientId) {
17
+ const selectedBlockProps = useSelect(select => {
18
+ const {
19
+ getBlockRootClientId,
20
+ getBlockParents,
21
+ __experimentalGetBlockListSettingsForBlocks,
22
+ isBlockInsertionPointVisible,
23
+ getBlockInsertionPoint,
24
+ getBlockOrder,
25
+ hasMultiSelection,
26
+ getLastMultiSelectedBlockClientId
27
+ } = select(blockEditorStore);
28
+ const blockParentsClientIds = getBlockParents(clientId);
29
+
30
+ // Get Block List Settings for all ancestors of the current Block clientId.
31
+ const parentBlockListSettings = __experimentalGetBlockListSettingsForBlocks(blockParentsClientIds);
32
+
33
+ // Get the clientId of the topmost parent with the capture toolbars setting.
34
+ const capturingClientId = blockParentsClientIds.find(parentClientId => parentBlockListSettings[parentClientId]?.__experimentalCaptureToolbars);
35
+ let isInsertionPointVisible = false;
36
+ if (isBlockInsertionPointVisible()) {
37
+ const insertionPoint = getBlockInsertionPoint();
38
+ const order = getBlockOrder(insertionPoint.rootClientId);
39
+ isInsertionPointVisible = order[insertionPoint.index] === clientId;
40
+ }
41
+ return {
42
+ capturingClientId,
43
+ isInsertionPointVisible,
44
+ lastClientId: hasMultiSelection() ? getLastMultiSelectedBlockClientId() : null,
45
+ rootClientId: getBlockRootClientId(clientId)
46
+ };
47
+ }, [clientId]);
48
+ return selectedBlockProps;
49
+ }
50
+ //# sourceMappingURL=use-selected-block-tool-props.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["useSelect","store","blockEditorStore","useSelectedBlockToolProps","clientId","selectedBlockProps","select","getBlockRootClientId","getBlockParents","__experimentalGetBlockListSettingsForBlocks","isBlockInsertionPointVisible","getBlockInsertionPoint","getBlockOrder","hasMultiSelection","getLastMultiSelectedBlockClientId","blockParentsClientIds","parentBlockListSettings","capturingClientId","find","parentClientId","__experimentalCaptureToolbars","isInsertionPointVisible","insertionPoint","order","rootClientId","index","lastClientId"],"sources":["@wordpress/block-editor/src/components/block-tools/use-selected-block-tool-props.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../../store';\n\n/**\n * Returns props for the selected block tools and empty block inserter.\n *\n * @param {string} clientId Selected block client ID.\n */\nexport default function useSelectedBlockToolProps( clientId ) {\n\tconst selectedBlockProps = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetBlockRootClientId,\n\t\t\t\tgetBlockParents,\n\t\t\t\t__experimentalGetBlockListSettingsForBlocks,\n\t\t\t\tisBlockInsertionPointVisible,\n\t\t\t\tgetBlockInsertionPoint,\n\t\t\t\tgetBlockOrder,\n\t\t\t\thasMultiSelection,\n\t\t\t\tgetLastMultiSelectedBlockClientId,\n\t\t\t} = select( blockEditorStore );\n\n\t\t\tconst blockParentsClientIds = getBlockParents( clientId );\n\n\t\t\t// Get Block List Settings for all ancestors of the current Block clientId.\n\t\t\tconst parentBlockListSettings =\n\t\t\t\t__experimentalGetBlockListSettingsForBlocks(\n\t\t\t\t\tblockParentsClientIds\n\t\t\t\t);\n\n\t\t\t// Get the clientId of the topmost parent with the capture toolbars setting.\n\t\t\tconst capturingClientId = blockParentsClientIds.find(\n\t\t\t\t( parentClientId ) =>\n\t\t\t\t\tparentBlockListSettings[ parentClientId ]\n\t\t\t\t\t\t?.__experimentalCaptureToolbars\n\t\t\t);\n\n\t\t\tlet isInsertionPointVisible = false;\n\t\t\tif ( isBlockInsertionPointVisible() ) {\n\t\t\t\tconst insertionPoint = getBlockInsertionPoint();\n\t\t\t\tconst order = getBlockOrder( insertionPoint.rootClientId );\n\t\t\t\tisInsertionPointVisible =\n\t\t\t\t\torder[ insertionPoint.index ] === clientId;\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\tcapturingClientId,\n\t\t\t\tisInsertionPointVisible,\n\t\t\t\tlastClientId: hasMultiSelection()\n\t\t\t\t\t? getLastMultiSelectedBlockClientId()\n\t\t\t\t\t: null,\n\t\t\t\trootClientId: getBlockRootClientId( clientId ),\n\t\t\t};\n\t\t},\n\t\t[ clientId ]\n\t);\n\n\treturn selectedBlockProps;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,SAAS,QAAQ,iBAAiB;;AAE3C;AACA;AACA;AACA,SAASC,KAAK,IAAIC,gBAAgB,QAAQ,aAAa;;AAEvD;AACA;AACA;AACA;AACA;AACA,eAAe,SAASC,yBAAyBA,CAAEC,QAAQ,EAAG;EAC7D,MAAMC,kBAAkB,GAAGL,SAAS,CACjCM,MAAM,IAAM;IACb,MAAM;MACLC,oBAAoB;MACpBC,eAAe;MACfC,2CAA2C;MAC3CC,4BAA4B;MAC5BC,sBAAsB;MACtBC,aAAa;MACbC,iBAAiB;MACjBC;IACD,CAAC,GAAGR,MAAM,CAAEJ,gBAAiB,CAAC;IAE9B,MAAMa,qBAAqB,GAAGP,eAAe,CAAEJ,QAAS,CAAC;;IAEzD;IACA,MAAMY,uBAAuB,GAC5BP,2CAA2C,CAC1CM,qBACD,CAAC;;IAEF;IACA,MAAME,iBAAiB,GAAGF,qBAAqB,CAACG,IAAI,CACjDC,cAAc,IACfH,uBAAuB,CAAEG,cAAc,CAAE,EACtCC,6BACL,CAAC;IAED,IAAIC,uBAAuB,GAAG,KAAK;IACnC,IAAKX,4BAA4B,CAAC,CAAC,EAAG;MACrC,MAAMY,cAAc,GAAGX,sBAAsB,CAAC,CAAC;MAC/C,MAAMY,KAAK,GAAGX,aAAa,CAAEU,cAAc,CAACE,YAAa,CAAC;MAC1DH,uBAAuB,GACtBE,KAAK,CAAED,cAAc,CAACG,KAAK,CAAE,KAAKrB,QAAQ;IAC5C;IAEA,OAAO;MACNa,iBAAiB;MACjBI,uBAAuB;MACvBK,YAAY,EAAEb,iBAAiB,CAAC,CAAC,GAC9BC,iCAAiC,CAAC,CAAC,GACnC,IAAI;MACPU,YAAY,EAAEjB,oBAAoB,CAAEH,QAAS;IAC9C,CAAC;EACF,CAAC,EACD,CAAEA,QAAQ,CACX,CAAC;EAED,OAAOC,kBAAkB;AAC1B"}
@@ -12,8 +12,7 @@ const EditableText = forwardRef((props, ref) => {
12
12
  return createElement(RichText, {
13
13
  ref: ref,
14
14
  ...props,
15
- __unstableDisableFormats: true,
16
- preserveWhiteSpace: true
15
+ __unstableDisableFormats: true
17
16
  });
18
17
  });
19
18
  EditableText.Content = ({
@@ -1 +1 @@
1
- {"version":3,"names":["forwardRef","RichText","EditableText","props","ref","createElement","__unstableDisableFormats","preserveWhiteSpace","Content","value","tagName","Tag"],"sources":["@wordpress/block-editor/src/components/editable-text/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { forwardRef } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport RichText from '../rich-text';\n\nconst EditableText = forwardRef( ( props, ref ) => {\n\treturn (\n\t\t<RichText\n\t\t\tref={ ref }\n\t\t\t{ ...props }\n\t\t\t__unstableDisableFormats\n\t\t\tpreserveWhiteSpace\n\t\t/>\n\t);\n} );\n\nEditableText.Content = ( { value = '', tagName: Tag = 'div', ...props } ) => {\n\treturn <Tag { ...props }>{ value }</Tag>;\n};\n\n/**\n * Renders an editable text input in which text formatting is not allowed.\n */\nexport default EditableText;\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,UAAU,QAAQ,oBAAoB;;AAE/C;AACA;AACA;AACA,OAAOC,QAAQ,MAAM,cAAc;AAEnC,MAAMC,YAAY,GAAGF,UAAU,CAAE,CAAEG,KAAK,EAAEC,GAAG,KAAM;EAClD,OACCC,aAAA,CAACJ,QAAQ;IACRG,GAAG,EAAGA,GAAK;IAAA,GACND,KAAK;IACVG,wBAAwB;IACxBC,kBAAkB;EAAA,CAClB,CAAC;AAEJ,CAAE,CAAC;AAEHL,YAAY,CAACM,OAAO,GAAG,CAAE;EAAEC,KAAK,GAAG,EAAE;EAAEC,OAAO,EAAEC,GAAG,GAAG,KAAK;EAAE,GAAGR;AAAM,CAAC,KAAM;EAC5E,OAAOE,aAAA,CAACM,GAAG;IAAA,GAAMR;EAAK,GAAKM,KAAY,CAAC;AACzC,CAAC;;AAED;AACA;AACA;AACA,eAAeP,YAAY"}
1
+ {"version":3,"names":["forwardRef","RichText","EditableText","props","ref","createElement","__unstableDisableFormats","Content","value","tagName","Tag"],"sources":["@wordpress/block-editor/src/components/editable-text/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { forwardRef } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport RichText from '../rich-text';\n\nconst EditableText = forwardRef( ( props, ref ) => {\n\treturn <RichText ref={ ref } { ...props } __unstableDisableFormats />;\n} );\n\nEditableText.Content = ( { value = '', tagName: Tag = 'div', ...props } ) => {\n\treturn <Tag { ...props }>{ value }</Tag>;\n};\n\n/**\n * Renders an editable text input in which text formatting is not allowed.\n */\nexport default EditableText;\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,UAAU,QAAQ,oBAAoB;;AAE/C;AACA;AACA;AACA,OAAOC,QAAQ,MAAM,cAAc;AAEnC,MAAMC,YAAY,GAAGF,UAAU,CAAE,CAAEG,KAAK,EAAEC,GAAG,KAAM;EAClD,OAAOC,aAAA,CAACJ,QAAQ;IAACG,GAAG,EAAGA,GAAK;IAAA,GAAMD,KAAK;IAAGG,wBAAwB;EAAA,CAAE,CAAC;AACtE,CAAE,CAAC;AAEHJ,YAAY,CAACK,OAAO,GAAG,CAAE;EAAEC,KAAK,GAAG,EAAE;EAAEC,OAAO,EAAEC,GAAG,GAAG,KAAK;EAAE,GAAGP;AAAM,CAAC,KAAM;EAC5E,OAAOE,aAAA,CAACK,GAAG;IAAA,GAAMP;EAAK,GAAKK,KAAY,CAAC;AACzC,CAAC;;AAED;AACA;AACA;AACA,eAAeN,YAAY"}
@@ -59,7 +59,7 @@ function bubbleEvent(event, Constructor, frame) {
59
59
  * @param {Document} iframeDocument Document to attach listeners to.
60
60
  */
61
61
  function useBubbleEvents(iframeDocument) {
62
- return useRefEffect(body => {
62
+ return useRefEffect(() => {
63
63
  const {
64
64
  defaultView
65
65
  } = iframeDocument;
@@ -69,6 +69,7 @@ function useBubbleEvents(iframeDocument) {
69
69
  const {
70
70
  frameElement
71
71
  } = defaultView;
72
+ const html = iframeDocument.documentElement;
72
73
  const eventTypes = ['dragover', 'mousemove'];
73
74
  const handlers = {};
74
75
  for (const name of eventTypes) {
@@ -78,11 +79,11 @@ function useBubbleEvents(iframeDocument) {
78
79
  const Constructor = window[constructorName];
79
80
  bubbleEvent(event, Constructor, frameElement);
80
81
  };
81
- body.addEventListener(name, handlers[name]);
82
+ html.addEventListener(name, handlers[name]);
82
83
  }
83
84
  return () => {
84
85
  for (const name of eventTypes) {
85
- body.removeEventListener(name, handlers[name]);
86
+ html.removeEventListener(name, handlers[name]);
86
87
  }
87
88
  };
88
89
  });
@@ -1 +1 @@
1
- {"version":3,"names":["classnames","useState","createPortal","forwardRef","useMemo","useEffect","__","useResizeObserver","useMergeRefs","useRefEffect","useDisabled","__experimentalStyleProvider","StyleProvider","useSelect","useBlockSelectionClearer","useWritingFlow","useCompatibilityStyles","store","blockEditorStore","bubbleEvent","event","Constructor","frame","init","key","contentDocument","defaultView","MouseEvent","rect","getBoundingClientRect","clientX","left","clientY","top","newEvent","type","defaultPrevented","preventDefault","cancelled","dispatchEvent","useBubbleEvents","iframeDocument","body","frameElement","eventTypes","handlers","name","prototype","Object","getPrototypeOf","constructorName","constructor","window","addEventListener","removeEventListener","Iframe","contentRef","children","tabIndex","scale","frameSize","expand","readonly","forwardedRef","ref","props","resolvedAssets","isPreviewMode","select","settings","getSettings","__unstableResolvedAssets","__unstableIsPreviewMode","styles","scripts","setIframeDocument","bodyClasses","setBodyClasses","compatStyles","clearerRef","before","writingFlowRef","after","contentResizeListener","height","contentHeight","setRef","node","_load","iFrameDocument","preventFileDropDefault","onLoad","ownerDocument","documentElement","Array","from","classList","filter","startsWith","dir","compatStyle","getElementById","id","head","appendChild","cloneNode","console","warn","disabledRef","isDisabled","bodyRef","html","src","cleanup","_src","URL","createObjectURL","Blob","revokeObjectURL","marginFromScaling","createElement","Fragment","style","border","marginTop","marginBottom","transform","transition","title","onKeyDown","currentTarget","target","stopPropagation","KeyboardEvent","className","document","IframeIfReady","isInitialised","__internalIsInitialized"],"sources":["@wordpress/block-editor/src/components/iframe/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tuseState,\n\tcreatePortal,\n\tforwardRef,\n\tuseMemo,\n\tuseEffect,\n} from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport {\n\tuseResizeObserver,\n\tuseMergeRefs,\n\tuseRefEffect,\n\tuseDisabled,\n} from '@wordpress/compose';\nimport { __experimentalStyleProvider as StyleProvider } from '@wordpress/components';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { useBlockSelectionClearer } from '../block-selection-clearer';\nimport { useWritingFlow } from '../writing-flow';\nimport { useCompatibilityStyles } from './use-compatibility-styles';\nimport { store as blockEditorStore } from '../../store';\n\nfunction bubbleEvent( event, Constructor, frame ) {\n\tconst init = {};\n\n\tfor ( const key in event ) {\n\t\tinit[ key ] = event[ key ];\n\t}\n\n\t// Check if the event is a MouseEvent generated within the iframe.\n\t// If so, adjust the coordinates to be relative to the position of\n\t// the iframe. This ensures that components such as Draggable\n\t// receive coordinates relative to the window, instead of relative\n\t// to the iframe. Without this, the Draggable event handler would\n\t// result in components \"jumping\" position as soon as the user\n\t// drags over the iframe.\n\tif ( event instanceof frame.contentDocument.defaultView.MouseEvent ) {\n\t\tconst rect = frame.getBoundingClientRect();\n\t\tinit.clientX += rect.left;\n\t\tinit.clientY += rect.top;\n\t}\n\n\tconst newEvent = new Constructor( event.type, init );\n\tif ( init.defaultPrevented ) {\n\t\tnewEvent.preventDefault();\n\t}\n\tconst cancelled = ! frame.dispatchEvent( newEvent );\n\n\tif ( cancelled ) {\n\t\tevent.preventDefault();\n\t}\n}\n\n/**\n * Bubbles some event types (keydown, keypress, and dragover) to parent document\n * document to ensure that the keyboard shortcuts and drag and drop work.\n *\n * Ideally, we should remove event bubbling in the future. Keyboard shortcuts\n * should be context dependent, e.g. actions on blocks like Cmd+A should not\n * work globally outside the block editor.\n *\n * @param {Document} iframeDocument Document to attach listeners to.\n */\nfunction useBubbleEvents( iframeDocument ) {\n\treturn useRefEffect( ( body ) => {\n\t\tconst { defaultView } = iframeDocument;\n\t\tif ( ! defaultView ) {\n\t\t\treturn;\n\t\t}\n\t\tconst { frameElement } = defaultView;\n\t\tconst eventTypes = [ 'dragover', 'mousemove' ];\n\t\tconst handlers = {};\n\t\tfor ( const name of eventTypes ) {\n\t\t\thandlers[ name ] = ( event ) => {\n\t\t\t\tconst prototype = Object.getPrototypeOf( event );\n\t\t\t\tconst constructorName = prototype.constructor.name;\n\t\t\t\tconst Constructor = window[ constructorName ];\n\t\t\t\tbubbleEvent( event, Constructor, frameElement );\n\t\t\t};\n\t\t\tbody.addEventListener( name, handlers[ name ] );\n\t\t}\n\n\t\treturn () => {\n\t\t\tfor ( const name of eventTypes ) {\n\t\t\t\tbody.removeEventListener( name, handlers[ name ] );\n\t\t\t}\n\t\t};\n\t} );\n}\n\nfunction Iframe( {\n\tcontentRef,\n\tchildren,\n\ttabIndex = 0,\n\tscale = 1,\n\tframeSize = 0,\n\texpand = false,\n\treadonly,\n\tforwardedRef: ref,\n\t...props\n} ) {\n\tconst { resolvedAssets, isPreviewMode } = useSelect( ( select ) => {\n\t\tconst settings = select( blockEditorStore ).getSettings();\n\t\treturn {\n\t\t\tresolvedAssets: settings.__unstableResolvedAssets,\n\t\t\tisPreviewMode: settings.__unstableIsPreviewMode,\n\t\t};\n\t}, [] );\n\tconst { styles = '', scripts = '' } = resolvedAssets;\n\tconst [ iframeDocument, setIframeDocument ] = useState();\n\tconst [ bodyClasses, setBodyClasses ] = useState( [] );\n\tconst compatStyles = useCompatibilityStyles();\n\tconst clearerRef = useBlockSelectionClearer();\n\tconst [ before, writingFlowRef, after ] = useWritingFlow();\n\tconst [ contentResizeListener, { height: contentHeight } ] =\n\t\tuseResizeObserver();\n\tconst setRef = useRefEffect( ( node ) => {\n\t\tnode._load = () => {\n\t\t\tsetIframeDocument( node.contentDocument );\n\t\t};\n\t\tlet iFrameDocument;\n\t\t// Prevent the default browser action for files dropped outside of dropzones.\n\t\tfunction preventFileDropDefault( event ) {\n\t\t\tevent.preventDefault();\n\t\t}\n\t\tfunction onLoad() {\n\t\t\tconst { contentDocument, ownerDocument } = node;\n\t\t\tconst { documentElement } = contentDocument;\n\t\t\tiFrameDocument = contentDocument;\n\n\t\t\tclearerRef( documentElement );\n\n\t\t\t// Ideally ALL classes that are added through get_body_class should\n\t\t\t// be added in the editor too, which we'll somehow have to get from\n\t\t\t// the server in the future (which will run the PHP filters).\n\t\t\tsetBodyClasses(\n\t\t\t\tArray.from( ownerDocument.body.classList ).filter(\n\t\t\t\t\t( name ) =>\n\t\t\t\t\t\tname.startsWith( 'admin-color-' ) ||\n\t\t\t\t\t\tname.startsWith( 'post-type-' ) ||\n\t\t\t\t\t\tname === 'wp-embed-responsive'\n\t\t\t\t)\n\t\t\t);\n\n\t\t\tcontentDocument.dir = ownerDocument.dir;\n\n\t\t\tfor ( const compatStyle of compatStyles ) {\n\t\t\t\tif ( contentDocument.getElementById( compatStyle.id ) ) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\tcontentDocument.head.appendChild(\n\t\t\t\t\tcompatStyle.cloneNode( true )\n\t\t\t\t);\n\n\t\t\t\tif ( ! isPreviewMode ) {\n\t\t\t\t\t// eslint-disable-next-line no-console\n\t\t\t\t\tconsole.warn(\n\t\t\t\t\t\t`${ compatStyle.id } was added to the iframe incorrectly. Please use block.json or enqueue_block_assets to add styles to the iframe.`,\n\t\t\t\t\t\tcompatStyle\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tiFrameDocument.addEventListener(\n\t\t\t\t'dragover',\n\t\t\t\tpreventFileDropDefault,\n\t\t\t\tfalse\n\t\t\t);\n\t\t\tiFrameDocument.addEventListener(\n\t\t\t\t'drop',\n\t\t\t\tpreventFileDropDefault,\n\t\t\t\tfalse\n\t\t\t);\n\t\t}\n\n\t\tnode.addEventListener( 'load', onLoad );\n\n\t\treturn () => {\n\t\t\tdelete node._load;\n\t\t\tnode.removeEventListener( 'load', onLoad );\n\t\t\tiFrameDocument?.removeEventListener(\n\t\t\t\t'dragover',\n\t\t\t\tpreventFileDropDefault\n\t\t\t);\n\t\t\tiFrameDocument?.removeEventListener(\n\t\t\t\t'drop',\n\t\t\t\tpreventFileDropDefault\n\t\t\t);\n\t\t};\n\t}, [] );\n\n\tconst disabledRef = useDisabled( { isDisabled: ! readonly } );\n\tconst bodyRef = useMergeRefs( [\n\t\tuseBubbleEvents( iframeDocument ),\n\t\tcontentRef,\n\t\tclearerRef,\n\t\twritingFlowRef,\n\t\tdisabledRef,\n\t] );\n\n\t// Correct doctype is required to enable rendering in standards\n\t// mode. Also preload the styles to avoid a flash of unstyled\n\t// content.\n\tconst html = `<!doctype html>\n<html>\n\t<head>\n\t\t<meta charset=\"utf-8\">\n\t\t<script>window.frameElement._load()</script>\n\t\t<style>html{height:auto!important;min-height:100%;}body{margin:0}</style>\n\t\t${ styles }\n\t\t${ scripts }\n\t</head>\n\t<body>\n\t\t<script>document.currentScript.parentElement.remove()</script>\n\t</body>\n</html>`;\n\n\tconst [ src, cleanup ] = useMemo( () => {\n\t\tconst _src = URL.createObjectURL(\n\t\t\tnew window.Blob( [ html ], { type: 'text/html' } )\n\t\t);\n\t\treturn [ _src, () => URL.revokeObjectURL( _src ) ];\n\t}, [ html ] );\n\n\tuseEffect( () => cleanup, [ cleanup ] );\n\n\t// We need to counter the margin created by scaling the iframe. If the scale\n\t// is e.g. 0.45, then the top + bottom margin is 0.55 (1 - scale). Just the\n\t// top or bottom margin is 0.55 / 2 ((1 - scale) / 2).\n\tconst marginFromScaling = ( contentHeight * ( 1 - scale ) ) / 2;\n\n\treturn (\n\t\t<>\n\t\t\t{ tabIndex >= 0 && before }\n\t\t\t{ /* eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions */ }\n\t\t\t<iframe\n\t\t\t\t{ ...props }\n\t\t\t\tstyle={ {\n\t\t\t\t\tborder: 0,\n\t\t\t\t\t...props.style,\n\t\t\t\t\theight: expand ? contentHeight : props.style?.height,\n\t\t\t\t\tmarginTop:\n\t\t\t\t\t\tscale !== 1\n\t\t\t\t\t\t\t? -marginFromScaling + frameSize\n\t\t\t\t\t\t\t: props.style?.marginTop,\n\t\t\t\t\tmarginBottom:\n\t\t\t\t\t\tscale !== 1\n\t\t\t\t\t\t\t? -marginFromScaling + frameSize\n\t\t\t\t\t\t\t: props.style?.marginBottom,\n\t\t\t\t\ttransform:\n\t\t\t\t\t\tscale !== 1\n\t\t\t\t\t\t\t? `scale( ${ scale } )`\n\t\t\t\t\t\t\t: props.style?.transform,\n\t\t\t\t\ttransition: 'all .3s',\n\t\t\t\t} }\n\t\t\t\tref={ useMergeRefs( [ ref, setRef ] ) }\n\t\t\t\ttabIndex={ tabIndex }\n\t\t\t\t// Correct doctype is required to enable rendering in standards\n\t\t\t\t// mode. Also preload the styles to avoid a flash of unstyled\n\t\t\t\t// content.\n\t\t\t\tsrc={ src }\n\t\t\t\ttitle={ __( 'Editor canvas' ) }\n\t\t\t\tonKeyDown={ ( event ) => {\n\t\t\t\t\t// If the event originates from inside the iframe, it means\n\t\t\t\t\t// it bubbled through the portal, but only with React\n\t\t\t\t\t// events. We need to to bubble native events as well,\n\t\t\t\t\t// though by doing so we also trigger another React event,\n\t\t\t\t\t// so we need to stop the propagation of this event to avoid\n\t\t\t\t\t// duplication.\n\t\t\t\t\tif (\n\t\t\t\t\t\tevent.currentTarget.ownerDocument !==\n\t\t\t\t\t\tevent.target.ownerDocument\n\t\t\t\t\t) {\n\t\t\t\t\t\tevent.stopPropagation();\n\t\t\t\t\t\tbubbleEvent(\n\t\t\t\t\t\t\tevent,\n\t\t\t\t\t\t\twindow.KeyboardEvent,\n\t\t\t\t\t\t\tevent.currentTarget\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t} }\n\t\t\t>\n\t\t\t\t{ iframeDocument &&\n\t\t\t\t\tcreatePortal(\n\t\t\t\t\t\t// We want to prevent React events from bubbling throught the iframe\n\t\t\t\t\t\t// we bubble these manually.\n\t\t\t\t\t\t/* eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions */\n\t\t\t\t\t\t<body\n\t\t\t\t\t\t\tref={ bodyRef }\n\t\t\t\t\t\t\tclassName={ classnames(\n\t\t\t\t\t\t\t\t'block-editor-iframe__body',\n\t\t\t\t\t\t\t\t'editor-styles-wrapper',\n\t\t\t\t\t\t\t\t...bodyClasses\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ contentResizeListener }\n\t\t\t\t\t\t\t<StyleProvider document={ iframeDocument }>\n\t\t\t\t\t\t\t\t{ children }\n\t\t\t\t\t\t\t</StyleProvider>\n\t\t\t\t\t\t</body>,\n\t\t\t\t\t\tiframeDocument.documentElement\n\t\t\t\t\t) }\n\t\t\t</iframe>\n\t\t\t{ tabIndex >= 0 && after }\n\t\t</>\n\t);\n}\n\nfunction IframeIfReady( props, ref ) {\n\tconst isInitialised = useSelect(\n\t\t( select ) =>\n\t\t\tselect( blockEditorStore ).getSettings().__internalIsInitialized,\n\t\t[]\n\t);\n\n\t// We shouldn't render the iframe until the editor settings are initialised.\n\t// The initial settings are needed to get the styles for the srcDoc, which\n\t// cannot be changed after the iframe is mounted. srcDoc is used to to set\n\t// the initial iframe HTML, which is required to avoid a flash of unstyled\n\t// content.\n\tif ( ! isInitialised ) {\n\t\treturn null;\n\t}\n\n\treturn <Iframe { ...props } forwardedRef={ ref } />;\n}\n\nexport default forwardRef( IframeIfReady );\n"],"m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AMyE,aAAa,GAAG5H,SAAS,CAC5BuD,MAAM,IACPA,MAAM,CAAElD,gBAAiB,CAAC,CAACoD,WAAW,CAAC,CAAC,CAACoE,uBAAuB,EACjE,EACD,CAAC;;EAED;EACA;EACA;EACA;EACA;EACA,IAAK,CAAED,aAAa,EAAG;IACtB,OAAO,IAAI;EACZ;EAEA,OAAOjB,aAAA,CAACjE,MAAM;IAAA,GAAMU,KAAK;IAAGF,YAAY,EAAGC;EAAK,CAAE,CAAC;AACpD;AAEA,eAAe7D,UAAU,CAAEqI,aAAc,CAAC"}
1
+ {"version":3,"names":["classnames","useState","createPortal","forwardRef","useMemo","useEffect","__","useResizeObserver","useMergeRefs","useRefEffect","useDisabled","__experimentalStyleProvider","StyleProvider","useSelect","useBlockSelectionClearer","useWritingFlow","useCompatibilityStyles","store","blockEditorStore","bubbleEvent","event","Constructor","frame","init","key","contentDocument","defaultView","MouseEvent","rect","getBoundingClientRect","clientX","left","clientY","top","newEvent","type","defaultPrevented","preventDefault","cancelled","dispatchEvent","useBubbleEvents","iframeDocument","frameElement","html","documentElement","eventTypes","handlers","name","prototype","Object","getPrototypeOf","constructorName","constructor","window","addEventListener","removeEventListener","Iframe","contentRef","children","tabIndex","scale","frameSize","expand","readonly","forwardedRef","ref","props","resolvedAssets","isPreviewMode","select","settings","getSettings","__unstableResolvedAssets","__unstableIsPreviewMode","styles","scripts","setIframeDocument","bodyClasses","setBodyClasses","compatStyles","clearerRef","before","writingFlowRef","after","contentResizeListener","height","contentHeight","setRef","node","_load","iFrameDocument","preventFileDropDefault","onLoad","ownerDocument","Array","from","body","classList","filter","startsWith","dir","compatStyle","getElementById","id","head","appendChild","cloneNode","console","warn","disabledRef","isDisabled","bodyRef","src","cleanup","_src","URL","createObjectURL","Blob","revokeObjectURL","marginFromScaling","createElement","Fragment","style","border","marginTop","marginBottom","transform","transition","title","onKeyDown","currentTarget","target","stopPropagation","KeyboardEvent","className","document","IframeIfReady","isInitialised","__internalIsInitialized"],"sources":["@wordpress/block-editor/src/components/iframe/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tuseState,\n\tcreatePortal,\n\tforwardRef,\n\tuseMemo,\n\tuseEffect,\n} from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport {\n\tuseResizeObserver,\n\tuseMergeRefs,\n\tuseRefEffect,\n\tuseDisabled,\n} from '@wordpress/compose';\nimport { __experimentalStyleProvider as StyleProvider } from '@wordpress/components';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { useBlockSelectionClearer } from '../block-selection-clearer';\nimport { useWritingFlow } from '../writing-flow';\nimport { useCompatibilityStyles } from './use-compatibility-styles';\nimport { store as blockEditorStore } from '../../store';\n\nfunction bubbleEvent( event, Constructor, frame ) {\n\tconst init = {};\n\n\tfor ( const key in event ) {\n\t\tinit[ key ] = event[ key ];\n\t}\n\n\t// Check if the event is a MouseEvent generated within the iframe.\n\t// If so, adjust the coordinates to be relative to the position of\n\t// the iframe. This ensures that components such as Draggable\n\t// receive coordinates relative to the window, instead of relative\n\t// to the iframe. Without this, the Draggable event handler would\n\t// result in components \"jumping\" position as soon as the user\n\t// drags over the iframe.\n\tif ( event instanceof frame.contentDocument.defaultView.MouseEvent ) {\n\t\tconst rect = frame.getBoundingClientRect();\n\t\tinit.clientX += rect.left;\n\t\tinit.clientY += rect.top;\n\t}\n\n\tconst newEvent = new Constructor( event.type, init );\n\tif ( init.defaultPrevented ) {\n\t\tnewEvent.preventDefault();\n\t}\n\tconst cancelled = ! frame.dispatchEvent( newEvent );\n\n\tif ( cancelled ) {\n\t\tevent.preventDefault();\n\t}\n}\n\n/**\n * Bubbles some event types (keydown, keypress, and dragover) to parent document\n * document to ensure that the keyboard shortcuts and drag and drop work.\n *\n * Ideally, we should remove event bubbling in the future. Keyboard shortcuts\n * should be context dependent, e.g. actions on blocks like Cmd+A should not\n * work globally outside the block editor.\n *\n * @param {Document} iframeDocument Document to attach listeners to.\n */\nfunction useBubbleEvents( iframeDocument ) {\n\treturn useRefEffect( () => {\n\t\tconst { defaultView } = iframeDocument;\n\t\tif ( ! defaultView ) {\n\t\t\treturn;\n\t\t}\n\t\tconst { frameElement } = defaultView;\n\t\tconst html = iframeDocument.documentElement;\n\t\tconst eventTypes = [ 'dragover', 'mousemove' ];\n\t\tconst handlers = {};\n\t\tfor ( const name of eventTypes ) {\n\t\t\thandlers[ name ] = ( event ) => {\n\t\t\t\tconst prototype = Object.getPrototypeOf( event );\n\t\t\t\tconst constructorName = prototype.constructor.name;\n\t\t\t\tconst Constructor = window[ constructorName ];\n\t\t\t\tbubbleEvent( event, Constructor, frameElement );\n\t\t\t};\n\t\t\thtml.addEventListener( name, handlers[ name ] );\n\t\t}\n\n\t\treturn () => {\n\t\t\tfor ( const name of eventTypes ) {\n\t\t\t\thtml.removeEventListener( name, handlers[ name ] );\n\t\t\t}\n\t\t};\n\t} );\n}\n\nfunction Iframe( {\n\tcontentRef,\n\tchildren,\n\ttabIndex = 0,\n\tscale = 1,\n\tframeSize = 0,\n\texpand = false,\n\treadonly,\n\tforwardedRef: ref,\n\t...props\n} ) {\n\tconst { resolvedAssets, isPreviewMode } = useSelect( ( select ) => {\n\t\tconst settings = select( blockEditorStore ).getSettings();\n\t\treturn {\n\t\t\tresolvedAssets: settings.__unstableResolvedAssets,\n\t\t\tisPreviewMode: settings.__unstableIsPreviewMode,\n\t\t};\n\t}, [] );\n\tconst { styles = '', scripts = '' } = resolvedAssets;\n\tconst [ iframeDocument, setIframeDocument ] = useState();\n\tconst [ bodyClasses, setBodyClasses ] = useState( [] );\n\tconst compatStyles = useCompatibilityStyles();\n\tconst clearerRef = useBlockSelectionClearer();\n\tconst [ before, writingFlowRef, after ] = useWritingFlow();\n\tconst [ contentResizeListener, { height: contentHeight } ] =\n\t\tuseResizeObserver();\n\tconst setRef = useRefEffect( ( node ) => {\n\t\tnode._load = () => {\n\t\t\tsetIframeDocument( node.contentDocument );\n\t\t};\n\t\tlet iFrameDocument;\n\t\t// Prevent the default browser action for files dropped outside of dropzones.\n\t\tfunction preventFileDropDefault( event ) {\n\t\t\tevent.preventDefault();\n\t\t}\n\t\tfunction onLoad() {\n\t\t\tconst { contentDocument, ownerDocument } = node;\n\t\t\tconst { documentElement } = contentDocument;\n\t\t\tiFrameDocument = contentDocument;\n\n\t\t\tclearerRef( documentElement );\n\n\t\t\t// Ideally ALL classes that are added through get_body_class should\n\t\t\t// be added in the editor too, which we'll somehow have to get from\n\t\t\t// the server in the future (which will run the PHP filters).\n\t\t\tsetBodyClasses(\n\t\t\t\tArray.from( ownerDocument.body.classList ).filter(\n\t\t\t\t\t( name ) =>\n\t\t\t\t\t\tname.startsWith( 'admin-color-' ) ||\n\t\t\t\t\t\tname.startsWith( 'post-type-' ) ||\n\t\t\t\t\t\tname === 'wp-embed-responsive'\n\t\t\t\t)\n\t\t\t);\n\n\t\t\tcontentDocument.dir = ownerDocument.dir;\n\n\t\t\tfor ( const compatStyle of compatStyles ) {\n\t\t\t\tif ( contentDocument.getElementById( compatStyle.id ) ) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\tcontentDocument.head.appendChild(\n\t\t\t\t\tcompatStyle.cloneNode( true )\n\t\t\t\t);\n\n\t\t\t\tif ( ! isPreviewMode ) {\n\t\t\t\t\t// eslint-disable-next-line no-console\n\t\t\t\t\tconsole.warn(\n\t\t\t\t\t\t`${ compatStyle.id } was added to the iframe incorrectly. Please use block.json or enqueue_block_assets to add styles to the iframe.`,\n\t\t\t\t\t\tcompatStyle\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tiFrameDocument.addEventListener(\n\t\t\t\t'dragover',\n\t\t\t\tpreventFileDropDefault,\n\t\t\t\tfalse\n\t\t\t);\n\t\t\tiFrameDocument.addEventListener(\n\t\t\t\t'drop',\n\t\t\t\tpreventFileDropDefault,\n\t\t\t\tfalse\n\t\t\t);\n\t\t}\n\n\t\tnode.addEventListener( 'load', onLoad );\n\n\t\treturn () => {\n\t\t\tdelete node._load;\n\t\t\tnode.removeEventListener( 'load', onLoad );\n\t\t\tiFrameDocument?.removeEventListener(\n\t\t\t\t'dragover',\n\t\t\t\tpreventFileDropDefault\n\t\t\t);\n\t\t\tiFrameDocument?.removeEventListener(\n\t\t\t\t'drop',\n\t\t\t\tpreventFileDropDefault\n\t\t\t);\n\t\t};\n\t}, [] );\n\n\tconst disabledRef = useDisabled( { isDisabled: ! readonly } );\n\tconst bodyRef = useMergeRefs( [\n\t\tuseBubbleEvents( iframeDocument ),\n\t\tcontentRef,\n\t\tclearerRef,\n\t\twritingFlowRef,\n\t\tdisabledRef,\n\t] );\n\n\t// Correct doctype is required to enable rendering in standards\n\t// mode. Also preload the styles to avoid a flash of unstyled\n\t// content.\n\tconst html = `<!doctype html>\n<html>\n\t<head>\n\t\t<meta charset=\"utf-8\">\n\t\t<script>window.frameElement._load()</script>\n\t\t<style>html{height:auto!important;min-height:100%;}body{margin:0}</style>\n\t\t${ styles }\n\t\t${ scripts }\n\t</head>\n\t<body>\n\t\t<script>document.currentScript.parentElement.remove()</script>\n\t</body>\n</html>`;\n\n\tconst [ src, cleanup ] = useMemo( () => {\n\t\tconst _src = URL.createObjectURL(\n\t\t\tnew window.Blob( [ html ], { type: 'text/html' } )\n\t\t);\n\t\treturn [ _src, () => URL.revokeObjectURL( _src ) ];\n\t}, [ html ] );\n\n\tuseEffect( () => cleanup, [ cleanup ] );\n\n\t// We need to counter the margin created by scaling the iframe. If the scale\n\t// is e.g. 0.45, then the top + bottom margin is 0.55 (1 - scale). Just the\n\t// top or bottom margin is 0.55 / 2 ((1 - scale) / 2).\n\tconst marginFromScaling = ( contentHeight * ( 1 - scale ) ) / 2;\n\n\treturn (\n\t\t<>\n\t\t\t{ tabIndex >= 0 && before }\n\t\t\t{ /* eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions */ }\n\t\t\t<iframe\n\t\t\t\t{ ...props }\n\t\t\t\tstyle={ {\n\t\t\t\t\tborder: 0,\n\t\t\t\t\t...props.style,\n\t\t\t\t\theight: expand ? contentHeight : props.style?.height,\n\t\t\t\t\tmarginTop:\n\t\t\t\t\t\tscale !== 1\n\t\t\t\t\t\t\t? -marginFromScaling + frameSize\n\t\t\t\t\t\t\t: props.style?.marginTop,\n\t\t\t\t\tmarginBottom:\n\t\t\t\t\t\tscale !== 1\n\t\t\t\t\t\t\t? -marginFromScaling + frameSize\n\t\t\t\t\t\t\t: props.style?.marginBottom,\n\t\t\t\t\ttransform:\n\t\t\t\t\t\tscale !== 1\n\t\t\t\t\t\t\t? `scale( ${ scale } )`\n\t\t\t\t\t\t\t: props.style?.transform,\n\t\t\t\t\ttransition: 'all .3s',\n\t\t\t\t} }\n\t\t\t\tref={ useMergeRefs( [ ref, setRef ] ) }\n\t\t\t\ttabIndex={ tabIndex }\n\t\t\t\t// Correct doctype is required to enable rendering in standards\n\t\t\t\t// mode. Also preload the styles to avoid a flash of unstyled\n\t\t\t\t// content.\n\t\t\t\tsrc={ src }\n\t\t\t\ttitle={ __( 'Editor canvas' ) }\n\t\t\t\tonKeyDown={ ( event ) => {\n\t\t\t\t\t// If the event originates from inside the iframe, it means\n\t\t\t\t\t// it bubbled through the portal, but only with React\n\t\t\t\t\t// events. We need to to bubble native events as well,\n\t\t\t\t\t// though by doing so we also trigger another React event,\n\t\t\t\t\t// so we need to stop the propagation of this event to avoid\n\t\t\t\t\t// duplication.\n\t\t\t\t\tif (\n\t\t\t\t\t\tevent.currentTarget.ownerDocument !==\n\t\t\t\t\t\tevent.target.ownerDocument\n\t\t\t\t\t) {\n\t\t\t\t\t\tevent.stopPropagation();\n\t\t\t\t\t\tbubbleEvent(\n\t\t\t\t\t\t\tevent,\n\t\t\t\t\t\t\twindow.KeyboardEvent,\n\t\t\t\t\t\t\tevent.currentTarget\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t} }\n\t\t\t>\n\t\t\t\t{ iframeDocument &&\n\t\t\t\t\tcreatePortal(\n\t\t\t\t\t\t// We want to prevent React events from bubbling throught the iframe\n\t\t\t\t\t\t// we bubble these manually.\n\t\t\t\t\t\t/* eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions */\n\t\t\t\t\t\t<body\n\t\t\t\t\t\t\tref={ bodyRef }\n\t\t\t\t\t\t\tclassName={ classnames(\n\t\t\t\t\t\t\t\t'block-editor-iframe__body',\n\t\t\t\t\t\t\t\t'editor-styles-wrapper',\n\t\t\t\t\t\t\t\t...bodyClasses\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ contentResizeListener }\n\t\t\t\t\t\t\t<StyleProvider document={ iframeDocument }>\n\t\t\t\t\t\t\t\t{ children }\n\t\t\t\t\t\t\t</StyleProvider>\n\t\t\t\t\t\t</body>,\n\t\t\t\t\t\tiframeDocument.documentElement\n\t\t\t\t\t) }\n\t\t\t</iframe>\n\t\t\t{ tabIndex >= 0 && after }\n\t\t</>\n\t);\n}\n\nfunction IframeIfReady( props, ref ) {\n\tconst isInitialised = useSelect(\n\t\t( select ) =>\n\t\t\tselect( blockEditorStore ).getSettings().__internalIsInitialized,\n\t\t[]\n\t);\n\n\t// We shouldn't render the iframe until the editor settings are initialised.\n\t// The initial settings are needed to get the styles for the srcDoc, which\n\t// cannot be changed after the iframe is mounted. srcDoc is used to to set\n\t// the initial iframe HTML, which is required to avoid a flash of unstyled\n\t// content.\n\tif ( ! isInitialised ) {\n\t\treturn null;\n\t}\n\n\treturn <Iframe { ...props } forwardedRef={ ref } />;\n}\n\nexport default forwardRef( IframeIfReady );\n"],"mappings":";AAAA;AACA;AACA;AACA,OAAOA,UAAU,MAAM,YAAY;;AAEnC;AACA;AACA;AACA,SACCC,QAAQ,EACRC,YAAY,EACZC,UAAU,EACVC,OAAO,EACPC,SAAS,QACH,oBAAoB;AAC3B,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SACCC,iBAAiB,EACjBC,YAAY,EACZC,Y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