@wordpress/block-editor 12.21.0 → 12.23.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 (408) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/README.md +4 -0
  3. package/build/components/block-actions/index.js +2 -4
  4. package/build/components/block-actions/index.js.map +1 -1
  5. package/build/components/block-heading-level-dropdown/index.js +5 -5
  6. package/build/components/block-heading-level-dropdown/index.js.map +1 -1
  7. package/build/components/block-heading-level-dropdown/index.native.js +5 -4
  8. package/build/components/block-heading-level-dropdown/index.native.js.map +1 -1
  9. package/build/components/block-list/block-crash-boundary.native.js +49 -0
  10. package/build/components/block-list/block-crash-boundary.native.js.map +1 -0
  11. package/build/components/block-list/block-crash-warning.native.js +24 -0
  12. package/build/components/block-list/block-crash-warning.native.js.map +1 -0
  13. package/build/components/block-list/block.js +11 -3
  14. package/build/components/block-list/block.js.map +1 -1
  15. package/build/components/block-list/block.native.js +7 -2
  16. package/build/components/block-list/block.native.js.map +1 -1
  17. package/build/components/block-mover/button.js +4 -1
  18. package/build/components/block-mover/button.js.map +1 -1
  19. package/build/components/block-mover/index.js +5 -1
  20. package/build/components/block-mover/index.js.map +1 -1
  21. package/build/components/block-patterns-list/index.js +4 -1
  22. package/build/components/block-patterns-list/index.js.map +1 -1
  23. package/build/components/block-settings/container.native.js +2 -1
  24. package/build/components/block-settings/container.native.js.map +1 -1
  25. package/build/components/block-settings-menu/block-settings-dropdown.js +36 -32
  26. package/build/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
  27. package/build/components/block-settings-menu-controls/index.js +1 -3
  28. package/build/components/block-settings-menu-controls/index.js.map +1 -1
  29. package/build/components/block-switcher/index.js +4 -3
  30. package/build/components/block-switcher/index.js.map +1 -1
  31. package/build/components/block-toolbar/index.js +8 -5
  32. package/build/components/block-toolbar/index.js.map +1 -1
  33. package/build/components/block-toolbar/shuffle.js +19 -10
  34. package/build/components/block-toolbar/shuffle.js.map +1 -1
  35. package/build/components/block-tools/block-selection-button.js +48 -8
  36. package/build/components/block-tools/block-selection-button.js.map +1 -1
  37. package/build/components/block-tools/index.js +14 -2
  38. package/build/components/block-tools/index.js.map +1 -1
  39. package/build/components/child-layout-control/index.js +108 -11
  40. package/build/components/child-layout-control/index.js.map +1 -1
  41. package/build/components/convert-to-group-buttons/toolbar.js +11 -0
  42. package/build/components/convert-to-group-buttons/toolbar.js.map +1 -1
  43. package/build/components/global-styles/advanced-panel.js +9 -2
  44. package/build/components/global-styles/advanced-panel.js.map +1 -1
  45. package/build/components/global-styles/background-panel.js +444 -0
  46. package/build/components/global-styles/background-panel.js.map +1 -0
  47. package/build/components/global-styles/color-panel.js +2 -1
  48. package/build/components/global-styles/color-panel.js.map +1 -1
  49. package/build/components/global-styles/dimensions-panel.js +8 -33
  50. package/build/components/global-styles/dimensions-panel.js.map +1 -1
  51. package/build/components/global-styles/get-global-styles-changes.js +3 -0
  52. package/build/components/global-styles/get-global-styles-changes.js.map +1 -1
  53. package/build/components/global-styles/hooks.js +1 -1
  54. package/build/components/global-styles/hooks.js.map +1 -1
  55. package/build/components/global-styles/index.js +13 -0
  56. package/build/components/global-styles/index.js.map +1 -1
  57. package/build/components/global-styles/use-global-styles-output.js +16 -15
  58. package/build/components/global-styles/use-global-styles-output.js.map +1 -1
  59. package/build/components/global-styles/utils.js +2 -3
  60. package/build/components/global-styles/utils.js.map +1 -1
  61. package/build/components/iframe/index.js +43 -34
  62. package/build/components/iframe/index.js.map +1 -1
  63. package/build/components/inserter/block-patterns-explorer/index.js +3 -6
  64. package/build/components/inserter/block-patterns-explorer/index.js.map +1 -1
  65. package/build/components/inserter/block-patterns-explorer/pattern-list.js +3 -1
  66. package/build/components/inserter/block-patterns-explorer/pattern-list.js.map +1 -1
  67. package/build/components/inserter/block-patterns-tab/index.js.map +1 -1
  68. package/build/components/inserter/block-patterns-tab/pattern-category-preview-panel.js +5 -0
  69. package/build/components/inserter/block-patterns-tab/pattern-category-preview-panel.js.map +1 -1
  70. package/build/components/inserter/library.js +2 -0
  71. package/build/components/inserter/library.js.map +1 -1
  72. package/build/components/inserter/menu.js +11 -11
  73. package/build/components/inserter/menu.js.map +1 -1
  74. package/build/components/inserter/mobile-tab-navigation.js +1 -1
  75. package/build/components/inserter/mobile-tab-navigation.js.map +1 -1
  76. package/build/components/inserter/search-items.js +36 -15
  77. package/build/components/inserter/search-items.js.map +1 -1
  78. package/build/components/inserter/search-results.js +2 -3
  79. package/build/components/inserter/search-results.js.map +1 -1
  80. package/build/components/inserter/tabs.js +1 -2
  81. package/build/components/inserter/tabs.js.map +1 -1
  82. package/build/components/inspector-controls-tabs/advanced-controls-panel.native.js +36 -0
  83. package/build/components/inspector-controls-tabs/advanced-controls-panel.native.js.map +1 -0
  84. package/build/components/keyboard-shortcuts/index.js +11 -0
  85. package/build/components/keyboard-shortcuts/index.js.map +1 -1
  86. package/build/components/list-view/block-select-button.js +18 -12
  87. package/build/components/list-view/block-select-button.js.map +1 -1
  88. package/build/components/list-view/block.js +4 -11
  89. package/build/components/list-view/block.js.map +1 -1
  90. package/build/components/list-view/index.js +17 -2
  91. package/build/components/list-view/index.js.map +1 -1
  92. package/build/components/list-view/use-list-view-collapse-items.js +47 -0
  93. package/build/components/list-view/use-list-view-collapse-items.js.map +1 -0
  94. package/build/components/list-view/utils.js +5 -3
  95. package/build/components/list-view/utils.js.map +1 -1
  96. package/build/components/rich-text/index.js +14 -11
  97. package/build/components/rich-text/index.js.map +1 -1
  98. package/build/components/rich-text/index.native.js +17 -11
  99. package/build/components/rich-text/index.native.js.map +1 -1
  100. package/build/components/rich-text/native/get-format-colors.native.js +1 -1
  101. package/build/components/rich-text/native/get-format-colors.native.js.map +1 -1
  102. package/build/components/rich-text/native/index.native.js +2 -2
  103. package/build/components/rich-text/native/index.native.js.map +1 -1
  104. package/build/components/rich-text/with-deprecations.js +0 -3
  105. package/build/components/rich-text/with-deprecations.js.map +1 -1
  106. package/build/components/spacing-sizes-control/sides-dropdown/index.js +1 -1
  107. package/build/components/spacing-sizes-control/sides-dropdown/index.js.map +1 -1
  108. package/build/components/url-popover/image-url-input-ui.js +50 -36
  109. package/build/components/url-popover/image-url-input-ui.js.map +1 -1
  110. package/build/components/use-block-display-information/index.js +4 -6
  111. package/build/components/use-block-display-information/index.js.map +1 -1
  112. package/build/components/use-moving-animation/index.js +4 -0
  113. package/build/components/use-moving-animation/index.js.map +1 -1
  114. package/build/components/warning/index.native.js +9 -4
  115. package/build/components/warning/index.native.js.map +1 -1
  116. package/build/hooks/anchor.js +9 -10
  117. package/build/hooks/anchor.js.map +1 -1
  118. package/build/hooks/background.js +85 -402
  119. package/build/hooks/background.js.map +1 -1
  120. package/build/hooks/index.js +9 -1
  121. package/build/hooks/index.js.map +1 -1
  122. package/build/hooks/layout-child.js +28 -6
  123. package/build/hooks/layout-child.js.map +1 -1
  124. package/build/hooks/layout.js +21 -10
  125. package/build/hooks/layout.js.map +1 -1
  126. package/build/hooks/position.js +1 -1
  127. package/build/hooks/position.js.map +1 -1
  128. package/build/hooks/use-zoom-out.js +47 -0
  129. package/build/hooks/use-zoom-out.js.map +1 -0
  130. package/build/index.js +7 -0
  131. package/build/index.js.map +1 -1
  132. package/build/private-apis.js +6 -1
  133. package/build/private-apis.js.map +1 -1
  134. package/build/private-apis.native.js +5 -1
  135. package/build/private-apis.native.js.map +1 -1
  136. package/build/store/private-actions.js +13 -0
  137. package/build/store/private-actions.js.map +1 -1
  138. package/build/store/private-keys.js +2 -1
  139. package/build/store/private-keys.js.map +1 -1
  140. package/build/store/private-selectors.js +24 -3
  141. package/build/store/private-selectors.js.map +1 -1
  142. package/build/store/reducer.js +53 -26
  143. package/build/store/reducer.js.map +1 -1
  144. package/build/store/selectors.js +34 -32
  145. package/build/store/selectors.js.map +1 -1
  146. package/build/store/utils.js +7 -1
  147. package/build/store/utils.js.map +1 -1
  148. package/build/utils/transform-styles/index.js +2 -1
  149. package/build/utils/transform-styles/index.js.map +1 -1
  150. package/build-module/components/block-actions/index.js +2 -4
  151. package/build-module/components/block-actions/index.js.map +1 -1
  152. package/build-module/components/block-heading-level-dropdown/index.js +5 -5
  153. package/build-module/components/block-heading-level-dropdown/index.js.map +1 -1
  154. package/build-module/components/block-heading-level-dropdown/index.native.js +5 -4
  155. package/build-module/components/block-heading-level-dropdown/index.native.js.map +1 -1
  156. package/build-module/components/block-list/block-crash-boundary.native.js +42 -0
  157. package/build-module/components/block-list/block-crash-boundary.native.js.map +1 -0
  158. package/build-module/components/block-list/block-crash-warning.native.js +15 -0
  159. package/build-module/components/block-list/block-crash-warning.native.js.map +1 -0
  160. package/build-module/components/block-list/block.js +11 -3
  161. package/build-module/components/block-list/block.js.map +1 -1
  162. package/build-module/components/block-list/block.native.js +7 -2
  163. package/build-module/components/block-list/block.native.js.map +1 -1
  164. package/build-module/components/block-mover/button.js +4 -1
  165. package/build-module/components/block-mover/button.js.map +1 -1
  166. package/build-module/components/block-mover/index.js +5 -1
  167. package/build-module/components/block-mover/index.js.map +1 -1
  168. package/build-module/components/block-patterns-list/index.js +4 -1
  169. package/build-module/components/block-patterns-list/index.js.map +1 -1
  170. package/build-module/components/block-settings/container.native.js +3 -2
  171. package/build-module/components/block-settings/container.native.js.map +1 -1
  172. package/build-module/components/block-settings-menu/block-settings-dropdown.js +37 -33
  173. package/build-module/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
  174. package/build-module/components/block-settings-menu-controls/index.js +1 -3
  175. package/build-module/components/block-settings-menu-controls/index.js.map +1 -1
  176. package/build-module/components/block-switcher/index.js +4 -3
  177. package/build-module/components/block-switcher/index.js.map +1 -1
  178. package/build-module/components/block-toolbar/index.js +8 -5
  179. package/build-module/components/block-toolbar/index.js.map +1 -1
  180. package/build-module/components/block-toolbar/shuffle.js +19 -10
  181. package/build-module/components/block-toolbar/shuffle.js.map +1 -1
  182. package/build-module/components/block-tools/block-selection-button.js +50 -10
  183. package/build-module/components/block-tools/block-selection-button.js.map +1 -1
  184. package/build-module/components/block-tools/index.js +14 -2
  185. package/build-module/components/block-tools/index.js.map +1 -1
  186. package/build-module/components/child-layout-control/index.js +109 -12
  187. package/build-module/components/child-layout-control/index.js.map +1 -1
  188. package/build-module/components/convert-to-group-buttons/toolbar.js +12 -1
  189. package/build-module/components/convert-to-group-buttons/toolbar.js.map +1 -1
  190. package/build-module/components/global-styles/advanced-panel.js +9 -2
  191. package/build-module/components/global-styles/advanced-panel.js.map +1 -1
  192. package/build-module/components/global-styles/background-panel.js +430 -0
  193. package/build-module/components/global-styles/background-panel.js.map +1 -0
  194. package/build-module/components/global-styles/color-panel.js +2 -1
  195. package/build-module/components/global-styles/color-panel.js.map +1 -1
  196. package/build-module/components/global-styles/dimensions-panel.js +9 -34
  197. package/build-module/components/global-styles/dimensions-panel.js.map +1 -1
  198. package/build-module/components/global-styles/get-global-styles-changes.js +3 -0
  199. package/build-module/components/global-styles/get-global-styles-changes.js.map +1 -1
  200. package/build-module/components/global-styles/hooks.js +1 -1
  201. package/build-module/components/global-styles/hooks.js.map +1 -1
  202. package/build-module/components/global-styles/index.js +1 -0
  203. package/build-module/components/global-styles/index.js.map +1 -1
  204. package/build-module/components/global-styles/use-global-styles-output.js +17 -16
  205. package/build-module/components/global-styles/use-global-styles-output.js.map +1 -1
  206. package/build-module/components/global-styles/utils.js +1 -2
  207. package/build-module/components/global-styles/utils.js.map +1 -1
  208. package/build-module/components/iframe/index.js +43 -34
  209. package/build-module/components/iframe/index.js.map +1 -1
  210. package/build-module/components/inserter/block-patterns-explorer/index.js +3 -6
  211. package/build-module/components/inserter/block-patterns-explorer/index.js.map +1 -1
  212. package/build-module/components/inserter/block-patterns-explorer/pattern-list.js +3 -1
  213. package/build-module/components/inserter/block-patterns-explorer/pattern-list.js.map +1 -1
  214. package/build-module/components/inserter/block-patterns-tab/index.js.map +1 -1
  215. package/build-module/components/inserter/block-patterns-tab/pattern-category-preview-panel.js +5 -0
  216. package/build-module/components/inserter/block-patterns-tab/pattern-category-preview-panel.js.map +1 -1
  217. package/build-module/components/inserter/library.js +2 -0
  218. package/build-module/components/inserter/library.js.map +1 -1
  219. package/build-module/components/inserter/menu.js +11 -11
  220. package/build-module/components/inserter/menu.js.map +1 -1
  221. package/build-module/components/inserter/mobile-tab-navigation.js +1 -1
  222. package/build-module/components/inserter/mobile-tab-navigation.js.map +1 -1
  223. package/build-module/components/inserter/search-items.js +33 -15
  224. package/build-module/components/inserter/search-items.js.map +1 -1
  225. package/build-module/components/inserter/search-results.js +2 -3
  226. package/build-module/components/inserter/search-results.js.map +1 -1
  227. package/build-module/components/inserter/tabs.js +1 -2
  228. package/build-module/components/inserter/tabs.js.map +1 -1
  229. package/build-module/components/inspector-controls-tabs/advanced-controls-panel.native.js +28 -0
  230. package/build-module/components/inspector-controls-tabs/advanced-controls-panel.native.js.map +1 -0
  231. package/build-module/components/keyboard-shortcuts/index.js +11 -0
  232. package/build-module/components/keyboard-shortcuts/index.js.map +1 -1
  233. package/build-module/components/list-view/block-select-button.js +19 -13
  234. package/build-module/components/list-view/block-select-button.js.map +1 -1
  235. package/build-module/components/list-view/block.js +6 -13
  236. package/build-module/components/list-view/block.js.map +1 -1
  237. package/build-module/components/list-view/index.js +17 -2
  238. package/build-module/components/list-view/index.js.map +1 -1
  239. package/build-module/components/list-view/use-list-view-collapse-items.js +40 -0
  240. package/build-module/components/list-view/use-list-view-collapse-items.js.map +1 -0
  241. package/build-module/components/list-view/utils.js +2 -1
  242. package/build-module/components/list-view/utils.js.map +1 -1
  243. package/build-module/components/rich-text/index.js +15 -12
  244. package/build-module/components/rich-text/index.js.map +1 -1
  245. package/build-module/components/rich-text/index.native.js +16 -11
  246. package/build-module/components/rich-text/index.native.js.map +1 -1
  247. package/build-module/components/rich-text/native/get-format-colors.native.js +1 -1
  248. package/build-module/components/rich-text/native/get-format-colors.native.js.map +1 -1
  249. package/build-module/components/rich-text/native/index.native.js +2 -2
  250. package/build-module/components/rich-text/native/index.native.js.map +1 -1
  251. package/build-module/components/rich-text/with-deprecations.js +0 -3
  252. package/build-module/components/rich-text/with-deprecations.js.map +1 -1
  253. package/build-module/components/spacing-sizes-control/sides-dropdown/index.js +1 -1
  254. package/build-module/components/spacing-sizes-control/sides-dropdown/index.js.map +1 -1
  255. package/build-module/components/url-popover/image-url-input-ui.js +50 -36
  256. package/build-module/components/url-popover/image-url-input-ui.js.map +1 -1
  257. package/build-module/components/use-block-display-information/index.js +5 -7
  258. package/build-module/components/use-block-display-information/index.js.map +1 -1
  259. package/build-module/components/use-moving-animation/index.js +4 -0
  260. package/build-module/components/use-moving-animation/index.js.map +1 -1
  261. package/build-module/components/warning/index.native.js +9 -4
  262. package/build-module/components/warning/index.native.js.map +1 -1
  263. package/build-module/hooks/anchor.js +10 -11
  264. package/build-module/hooks/anchor.js.map +1 -1
  265. package/build-module/hooks/background.js +82 -397
  266. package/build-module/hooks/background.js.map +1 -1
  267. package/build-module/hooks/index.js +3 -1
  268. package/build-module/hooks/index.js.map +1 -1
  269. package/build-module/hooks/layout-child.js +28 -6
  270. package/build-module/hooks/layout-child.js.map +1 -1
  271. package/build-module/hooks/layout.js +21 -10
  272. package/build-module/hooks/layout.js.map +1 -1
  273. package/build-module/hooks/position.js +1 -1
  274. package/build-module/hooks/position.js.map +1 -1
  275. package/build-module/hooks/use-zoom-out.js +41 -0
  276. package/build-module/hooks/use-zoom-out.js.map +1 -0
  277. package/build-module/index.js +1 -1
  278. package/build-module/index.js.map +1 -1
  279. package/build-module/private-apis.js +7 -2
  280. package/build-module/private-apis.js.map +1 -1
  281. package/build-module/private-apis.native.js +5 -1
  282. package/build-module/private-apis.native.js.map +1 -1
  283. package/build-module/store/private-actions.js +12 -0
  284. package/build-module/store/private-actions.js.map +1 -1
  285. package/build-module/store/private-keys.js +1 -0
  286. package/build-module/store/private-keys.js.map +1 -1
  287. package/build-module/store/private-selectors.js +22 -4
  288. package/build-module/store/private-selectors.js.map +1 -1
  289. package/build-module/store/reducer.js +52 -26
  290. package/build-module/store/reducer.js.map +1 -1
  291. package/build-module/store/selectors.js +35 -33
  292. package/build-module/store/selectors.js.map +1 -1
  293. package/build-module/store/utils.js +6 -1
  294. package/build-module/store/utils.js.map +1 -1
  295. package/build-module/utils/transform-styles/index.js +2 -1
  296. package/build-module/utils/transform-styles/index.js.map +1 -1
  297. package/build-style/content-rtl.css +18 -1
  298. package/build-style/content.css +18 -1
  299. package/build-style/style-rtl.css +92 -99
  300. package/build-style/style.css +92 -99
  301. package/package.json +31 -31
  302. package/src/components/block-actions/index.js +2 -8
  303. package/src/components/block-bindings-toolbar-indicator/style.scss +10 -8
  304. package/src/components/block-heading-level-dropdown/README.md +5 -5
  305. package/src/components/block-heading-level-dropdown/index.js +5 -5
  306. package/src/components/block-heading-level-dropdown/index.native.js +5 -4
  307. package/src/components/block-list/block-crash-boundary.native.js +43 -0
  308. package/src/components/block-list/block-crash-warning.native.js +19 -0
  309. package/src/components/block-list/block.js +19 -3
  310. package/src/components/block-list/block.native.js +14 -7
  311. package/src/components/block-list/content.scss +16 -0
  312. package/src/components/block-mover/button.js +4 -1
  313. package/src/components/block-mover/index.js +8 -1
  314. package/src/components/block-patterns-list/index.js +22 -17
  315. package/src/components/block-preview/style.scss +28 -0
  316. package/src/components/block-settings/container.native.js +5 -1
  317. package/src/components/block-settings-menu/block-settings-dropdown.js +49 -58
  318. package/src/components/block-settings-menu-controls/README.md +0 -9
  319. package/src/components/block-settings-menu-controls/index.js +1 -6
  320. package/src/components/block-switcher/index.js +5 -3
  321. package/src/components/block-switcher/style.scss +1 -1
  322. package/src/components/block-toolbar/index.js +25 -20
  323. package/src/components/block-toolbar/shuffle.js +20 -14
  324. package/src/components/block-toolbar/style.scss +1 -1
  325. package/src/components/block-toolbar/test/index.native.js +1 -7
  326. package/src/components/block-tools/block-selection-button.js +66 -9
  327. package/src/components/block-tools/index.js +18 -1
  328. package/src/components/button-block-appender/content.scss +5 -1
  329. package/src/components/child-layout-control/index.js +147 -35
  330. package/src/components/convert-to-group-buttons/toolbar.js +13 -1
  331. package/src/components/default-block-appender/content.scss +2 -2
  332. package/src/components/global-styles/advanced-panel.js +8 -2
  333. package/src/components/global-styles/background-panel.js +591 -0
  334. package/src/components/global-styles/color-panel.js +2 -1
  335. package/src/components/global-styles/dimensions-panel.js +9 -34
  336. package/src/components/global-styles/get-global-styles-changes.js +3 -0
  337. package/src/components/global-styles/hooks.js +1 -0
  338. package/src/components/global-styles/index.js +4 -0
  339. package/src/components/global-styles/style.scss +78 -1
  340. package/src/{hooks/test/background.js → components/global-styles/test/background-panel.js} +36 -1
  341. package/src/components/global-styles/test/get-global-styles-changes.js +22 -3
  342. package/src/components/global-styles/test/use-global-styles-output.js +40 -9
  343. package/src/components/global-styles/use-global-styles-output.js +30 -17
  344. package/src/components/global-styles/utils.js +1 -18
  345. package/src/components/iframe/index.js +79 -53
  346. package/src/components/inserter/block-patterns-explorer/index.js +2 -9
  347. package/src/components/inserter/block-patterns-explorer/pattern-list.js +7 -1
  348. package/src/components/inserter/block-patterns-tab/index.js +1 -0
  349. package/src/components/inserter/block-patterns-tab/pattern-category-preview-panel.js +5 -0
  350. package/src/components/inserter/library.js +4 -0
  351. package/src/components/inserter/menu.js +12 -11
  352. package/src/components/inserter/mobile-tab-navigation.js +1 -1
  353. package/src/components/inserter/search-items.js +37 -15
  354. package/src/components/inserter/search-results.js +1 -2
  355. package/src/components/inserter/style.scss +6 -12
  356. package/src/components/inserter/tabs.js +1 -2
  357. package/src/components/inspector-controls-tabs/advanced-controls-panel.native.js +31 -0
  358. package/src/components/keyboard-shortcuts/index.js +11 -0
  359. package/src/components/link-control/style.scss +0 -5
  360. package/src/components/list-view/block-select-button.js +15 -19
  361. package/src/components/list-view/block.js +12 -21
  362. package/src/components/list-view/index.js +18 -1
  363. package/src/components/list-view/style.scss +38 -28
  364. package/src/components/list-view/use-list-view-collapse-items.js +33 -0
  365. package/src/components/list-view/utils.js +4 -1
  366. package/src/components/rich-text/README.md +6 -0
  367. package/src/components/rich-text/index.js +30 -13
  368. package/src/components/rich-text/index.native.js +14 -11
  369. package/src/components/rich-text/native/get-format-colors.native.js +1 -1
  370. package/src/components/rich-text/native/index.native.js +2 -2
  371. package/src/components/rich-text/with-deprecations.js +0 -3
  372. package/src/components/spacing-sizes-control/sides-dropdown/index.js +1 -1
  373. package/src/components/url-popover/image-url-input-ui.js +68 -51
  374. package/src/components/use-block-display-information/index.js +8 -10
  375. package/src/components/use-moving-animation/index.js +1 -0
  376. package/src/components/warning/index.native.js +19 -15
  377. package/src/hooks/anchor.js +43 -61
  378. package/src/hooks/background.js +100 -516
  379. package/src/hooks/index.js +3 -0
  380. package/src/hooks/layout-child.js +44 -8
  381. package/src/hooks/layout.js +22 -18
  382. package/src/hooks/position.js +1 -1
  383. package/src/hooks/test/__snapshots__/anchor.native.js.snap +7 -0
  384. package/src/hooks/test/anchor.native.js +32 -0
  385. package/src/hooks/use-zoom-out.js +36 -0
  386. package/src/index.js +1 -0
  387. package/src/private-apis.js +13 -1
  388. package/src/private-apis.native.js +4 -0
  389. package/src/store/private-actions.js +12 -0
  390. package/src/store/private-keys.js +1 -0
  391. package/src/store/private-selectors.js +54 -27
  392. package/src/store/reducer.js +63 -41
  393. package/src/store/selectors.js +195 -180
  394. package/src/store/test/private-actions.js +10 -0
  395. package/src/store/test/private-selectors.js +13 -0
  396. package/src/store/test/reducer.js +26 -0
  397. package/src/store/test/selectors.js +90 -199
  398. package/src/store/utils.js +13 -0
  399. package/src/style.scss +0 -2
  400. package/src/utils/transform-styles/index.js +2 -1
  401. package/tsconfig.json +1 -0
  402. package/build/utils/calculate-scale.js +0 -17
  403. package/build/utils/calculate-scale.js.map +0 -1
  404. package/build-module/utils/calculate-scale.js +0 -11
  405. package/build-module/utils/calculate-scale.js.map +0 -1
  406. package/src/hooks/anchor.scss +0 -4
  407. package/src/hooks/background.scss +0 -75
  408. package/src/utils/calculate-scale.js +0 -20
@@ -14,12 +14,7 @@ import {
14
14
  Tooltip,
15
15
  } from '@wordpress/components';
16
16
  import { forwardRef } from '@wordpress/element';
17
- import {
18
- Icon,
19
- connection,
20
- lockSmall as lock,
21
- pinSmall,
22
- } from '@wordpress/icons';
17
+ import { Icon, lockSmall as lock, pinSmall } from '@wordpress/icons';
23
18
  import { SPACE, ENTER, BACKSPACE, DELETE } from '@wordpress/keycodes';
24
19
  import { useSelect, useDispatch } from '@wordpress/data';
25
20
  import { __unstableUseShortcutEventMatch as useShortcutEventMatch } from '@wordpress/keyboard-shortcuts';
@@ -37,12 +32,11 @@ import { useBlockLock } from '../block-lock';
37
32
  import { store as blockEditorStore } from '../../store';
38
33
  import useListViewImages from './use-list-view-images';
39
34
  import { useListViewContext } from './context';
40
- import { canBindBlock } from '../../hooks/use-bindings-attributes';
41
35
 
42
36
  function ListViewBlockSelectButton(
43
37
  {
44
38
  className,
45
- block: { clientId, name: blockName },
39
+ block: { clientId },
46
40
  onClick,
47
41
  onContextMenu,
48
42
  onMouseDown,
@@ -53,7 +47,6 @@ function ListViewBlockSelectButton(
53
47
  onDragEnd,
54
48
  draggable,
55
49
  isExpanded,
56
- ariaLabel,
57
50
  ariaDescribedBy,
58
51
  updateFocusAndSelection,
59
52
  },
@@ -71,8 +64,8 @@ function ListViewBlockSelectButton(
71
64
  getPreviousBlockClientId,
72
65
  getBlockRootClientId,
73
66
  getBlockOrder,
67
+ getBlockParents,
74
68
  getBlocksByClientId,
75
- getBlockAttributes,
76
69
  canRemoveBlocks,
77
70
  } = useSelect( blockEditorStore );
78
71
  const { duplicateBlocks, multiSelect, removeBlocks } =
@@ -80,9 +73,7 @@ function ListViewBlockSelectButton(
80
73
  const isMatch = useShortcutEventMatch();
81
74
  const isSticky = blockInformation?.positionType === 'sticky';
82
75
  const images = useListViewImages( { clientId, isExpanded } );
83
- const { rootClientId } = useListViewContext();
84
-
85
- const isConnected = getBlockAttributes( clientId )?.metadata?.bindings;
76
+ const { collapseAll, expand, rootClientId } = useListViewContext();
86
77
 
87
78
  const positionLabel = blockInformation?.positionLabel
88
79
  ? sprintf(
@@ -237,6 +228,17 @@ function ListViewBlockSelectButton(
237
228
  blockClientIds[ blockClientIds.length - 1 ],
238
229
  null
239
230
  );
231
+ } else if ( isMatch( 'core/block-editor/collapse-list-view', event ) ) {
232
+ if ( event.defaultPrevented ) {
233
+ return;
234
+ }
235
+ event.preventDefault();
236
+ const { firstBlockClientId } = getBlocksToUpdate();
237
+ const blockParents = getBlockParents( firstBlockClientId, false );
238
+ // Collapse all blocks.
239
+ collapseAll();
240
+ // Expand all parents of the current block.
241
+ expand( blockParents );
240
242
  }
241
243
  }
242
244
 
@@ -258,7 +260,6 @@ function ListViewBlockSelectButton(
258
260
  onDragEnd={ onDragEnd }
259
261
  draggable={ draggable }
260
262
  href={ `#block-${ clientId }` }
261
- aria-label={ ariaLabel }
262
263
  aria-describedby={ ariaDescribedBy }
263
264
  aria-expanded={ isExpanded }
264
265
  >
@@ -287,11 +288,6 @@ function ListViewBlockSelectButton(
287
288
  </Truncate>
288
289
  </span>
289
290
  ) }
290
- { isConnected && canBindBlock( blockName ) && (
291
- <span className="block-editor-list-view-block-select-button__bindings">
292
- <Icon icon={ connection } />
293
- </span>
294
- ) }
295
291
  { positionLabel && isSticky && (
296
292
  <Tooltip text={ positionLabel }>
297
293
  <Icon icon={ pinSmall } />
@@ -21,7 +21,7 @@ import {
21
21
  memo,
22
22
  } from '@wordpress/element';
23
23
  import { useDispatch, useSelect } from '@wordpress/data';
24
- import { sprintf, __ } from '@wordpress/i18n';
24
+ import { __ } from '@wordpress/i18n';
25
25
  import { ESCAPE } from '@wordpress/keycodes';
26
26
 
27
27
  /**
@@ -35,7 +35,11 @@ import {
35
35
  } from '../block-mover/button';
36
36
  import ListViewBlockContents from './block-contents';
37
37
  import { useListViewContext } from './context';
38
- import { getBlockPositionDescription, focusListItem } from './utils';
38
+ import {
39
+ getBlockPositionDescription,
40
+ getBlockPropertiesDescription,
41
+ focusListItem,
42
+ } from './utils';
39
43
  import { store as blockEditorStore } from '../../store';
40
44
  import useBlockDisplayInformation from '../use-block-display-information';
41
45
  import { useBlockLock } from '../block-lock';
@@ -77,8 +81,6 @@ function ListViewBlock( {
77
81
  const { toggleBlockHighlight } = useDispatch( blockEditorStore );
78
82
 
79
83
  const blockInformation = useBlockDisplayInformation( clientId );
80
- const blockTitle =
81
- blockInformation?.name || blockInformation?.title || __( 'Untitled' );
82
84
 
83
85
  const { block, blockName, blockEditingMode } = useSelect(
84
86
  ( select ) => {
@@ -93,6 +95,7 @@ function ListViewBlock( {
93
95
  },
94
96
  [ clientId ]
95
97
  );
98
+
96
99
  const allowRightClickOverrides = useSelect(
97
100
  ( select ) =>
98
101
  select( blockEditorStore ).getSettings().allowRightClickOverrides,
@@ -107,7 +110,7 @@ function ListViewBlock( {
107
110
  // Don't show the settings menu if block is disabled or content only.
108
111
  blockEditingMode === 'default';
109
112
  const instanceId = useInstanceId( ListViewBlock );
110
- const descriptionId = `list-view-block-select-button__${ instanceId }`;
113
+ const descriptionId = `list-view-block-select-button__description-${ instanceId }`;
111
114
 
112
115
  const {
113
116
  expand,
@@ -247,19 +250,8 @@ function ListViewBlock( {
247
250
  level
248
251
  );
249
252
 
250
- const blockAriaLabel = isLocked
251
- ? sprintf(
252
- // translators: %s: The title of the block. This string indicates a link to select the locked block.
253
- __( '%s (locked)' ),
254
- blockTitle
255
- )
256
- : blockTitle;
257
-
258
- const settingsAriaLabel = sprintf(
259
- // translators: %s: The title of the block.
260
- __( 'Options for %s' ),
261
- blockTitle
262
- );
253
+ const blockPropertiesDescription =
254
+ getBlockPropertiesDescription( isLocked );
263
255
 
264
256
  const hasSiblings = siblingBlockCount > 0;
265
257
  const hasRenderedMovers = showBlockMovers && hasSiblings;
@@ -352,12 +344,11 @@ function ListViewBlock( {
352
344
  onFocus={ onFocus }
353
345
  isExpanded={ canEdit ? isExpanded : undefined }
354
346
  selectedClientIds={ selectedClientIds }
355
- ariaLabel={ blockAriaLabel }
356
347
  ariaDescribedBy={ descriptionId }
357
348
  updateFocusAndSelection={ updateFocusAndSelection }
358
349
  />
359
350
  <AriaReferencedText id={ descriptionId }>
360
- { blockPositionDescription }
351
+ { `${ blockPositionDescription } ${ blockPropertiesDescription }` }
361
352
  </AriaReferencedText>
362
353
  </div>
363
354
  ) }
@@ -405,7 +396,7 @@ function ListViewBlock( {
405
396
  clientIds={ dropdownClientIds }
406
397
  block={ block }
407
398
  icon={ moreVertical }
408
- label={ settingsAriaLabel }
399
+ label={ __( 'Options' ) }
409
400
  popoverProps={ {
410
401
  anchor: settingsPopoverAnchor, // Used to position the settings at the cursor on right-click.
411
402
  } }
@@ -37,6 +37,7 @@ import ListViewDropIndicatorPreview from './drop-indicator';
37
37
  import useBlockSelection from './use-block-selection';
38
38
  import useListViewBlockIndexes from './use-list-view-block-indexes';
39
39
  import useListViewClientIds from './use-list-view-client-ids';
40
+ import useListViewCollapseItems from './use-list-view-collapse-items';
40
41
  import useListViewDropZone from './use-list-view-drop-zone';
41
42
  import useListViewExpandSelectedItem from './use-list-view-expand-selected-item';
42
43
  import { store as blockEditorStore } from '../../store';
@@ -45,6 +46,9 @@ import { focusListItem } from './utils';
45
46
  import useClipboardHandler from './use-clipboard-handler';
46
47
 
47
48
  const expanded = ( state, action ) => {
49
+ if ( action.type === 'clear' ) {
50
+ return {};
51
+ }
48
52
  if ( Array.isArray( action.clientIds ) ) {
49
53
  return {
50
54
  ...state,
@@ -194,7 +198,10 @@ function ListViewComponent(
194
198
  if ( ! clientId ) {
195
199
  return;
196
200
  }
197
- setExpandedState( { type: 'expand', clientIds: [ clientId ] } );
201
+ const clientIds = Array.isArray( clientId )
202
+ ? clientId
203
+ : [ clientId ];
204
+ setExpandedState( { type: 'expand', clientIds } );
198
205
  },
199
206
  [ setExpandedState ]
200
207
  );
@@ -207,6 +214,9 @@ function ListViewComponent(
207
214
  },
208
215
  [ setExpandedState ]
209
216
  );
217
+ const collapseAll = useCallback( () => {
218
+ setExpandedState( { type: 'clear' } );
219
+ }, [ setExpandedState ] );
210
220
  const expandRow = useCallback(
211
221
  ( row ) => {
212
222
  expand( row?.dataset?.block );
@@ -232,6 +242,11 @@ function ListViewComponent(
232
242
  [ updateBlockSelection ]
233
243
  );
234
244
 
245
+ useListViewCollapseItems( {
246
+ collapseAll,
247
+ expand,
248
+ } );
249
+
235
250
  const firstDraggedBlockClientId = draggedClientIds?.[ 0 ];
236
251
 
237
252
  // Convert a blockDropTarget into indexes relative to the blocks in the list view.
@@ -282,6 +297,7 @@ function ListViewComponent(
282
297
  expand,
283
298
  firstDraggedBlockIndex,
284
299
  collapse,
300
+ collapseAll,
285
301
  BlockSettingsMenu,
286
302
  listViewInstanceId: instanceId,
287
303
  AdditionalBlockContent,
@@ -299,6 +315,7 @@ function ListViewComponent(
299
315
  expand,
300
316
  firstDraggedBlockIndex,
301
317
  collapse,
318
+ collapseAll,
302
319
  BlockSettingsMenu,
303
320
  instanceId,
304
321
  AdditionalBlockContent,
@@ -7,7 +7,7 @@
7
7
  // Move upwards when in modal.
8
8
  .components-modal__content & {
9
9
  margin: (-$grid-unit-15) (-$grid-unit-15 * 0.5) 0;
10
- width: calc(100% + #{ $grid-unit-15 });
10
+ width: calc(100% + #{$grid-unit-15});
11
11
  }
12
12
 
13
13
  // Without setting `pointer-events: none`, when dragging over list view items,
@@ -71,7 +71,8 @@
71
71
  &:focus::after {
72
72
  box-shadow:
73
73
  inset 0 0 0 1px $white,
74
- 0 0 0 var(--wp-admin-border-width-focus) var(--wp-block-synced-color);
74
+ 0 0 0 var(--wp-admin-border-width-focus)
75
+ var(--wp-block-synced-color);
75
76
  }
76
77
  }
77
78
  &.is-selected .block-editor-list-view-block-contents,
@@ -82,14 +83,16 @@
82
83
  &::after {
83
84
  box-shadow:
84
85
  inset 0 0 0 1px $white,
85
- 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color);
86
+ 0 0 0 var(--wp-admin-border-width-focus)
87
+ var(--wp-admin-theme-color);
86
88
  }
87
89
  }
88
90
  &.is-selected.is-synced .block-editor-list-view-block-contents:focus {
89
91
  &::after {
90
92
  box-shadow:
91
93
  inset 0 0 0 1px $white,
92
- 0 0 0 var(--wp-admin-border-width-focus) var(--wp-block-synced-color);
94
+ 0 0 0 var(--wp-admin-border-width-focus)
95
+ var(--wp-block-synced-color);
93
96
  }
94
97
  }
95
98
  &.is-selected .block-editor-list-view-block__menu:focus {
@@ -181,7 +184,9 @@
181
184
 
182
185
  &.is-after-dragged-blocks.is-displacement-down {
183
186
  transition: transform 0.2s;
184
- transform: translateY(calc(36px + var(--wp-admin--list-view-dragged-items-height, 36px) * -1));
187
+ transform:
188
+ translateY(calc(36px + var(--wp-admin--list-view-dragged-items-height, 36px) *
189
+ -1));
185
190
  @include reduce-motion("transition");
186
191
  }
187
192
 
@@ -207,7 +212,7 @@
207
212
  align-items: center;
208
213
  width: 100%;
209
214
  height: auto;
210
- padding: ($grid-unit-15 * 0.5) $grid-unit-05 ($grid-unit-15 * 0.5) 0;
215
+ padding: ($grid-unit-15 * 0.5) ($grid-unit-15 * 0.5) ($grid-unit-15 * 0.5) 0;
211
216
  text-align: left;
212
217
  border-radius: $radius-block-ui;
213
218
  position: relative;
@@ -217,7 +222,10 @@
217
222
  content: "";
218
223
  position: absolute;
219
224
  pointer-events: none;
220
- transition: border-color 0.1s linear, border-style 0.1s linear, box-shadow 0.1s linear;
225
+ transition:
226
+ border-color 0.1s linear,
227
+ border-style 0.1s linear,
228
+ box-shadow 0.1s linear;
221
229
  top: -2px;
222
230
  right: 0;
223
231
  left: 0;
@@ -242,7 +250,9 @@
242
250
  bottom: 0;
243
251
  left: 0;
244
252
  border-radius: inherit;
245
- box-shadow: inset 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color);
253
+ box-shadow:
254
+ inset 0 0 0 var(--wp-admin-border-width-focus)
255
+ var(--wp-admin-theme-color);
246
256
  z-index: 2;
247
257
  pointer-events: none;
248
258
  }
@@ -255,7 +265,9 @@
255
265
 
256
266
  &.is-nesting .block-editor-list-view__menu,
257
267
  .block-editor-list-view-block__menu:focus {
258
- box-shadow: inset 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color);
268
+ box-shadow:
269
+ inset 0 0 0 var(--wp-admin-border-width-focus)
270
+ var(--wp-admin-theme-color);
259
271
  z-index: 1;
260
272
  }
261
273
 
@@ -297,14 +309,14 @@
297
309
 
298
310
  &,
299
311
  .components-button.has-icon {
300
- width: 24px;
301
- min-width: 24px;
312
+ width: $button-size-small;
313
+ min-width: $button-size-small;
302
314
  padding: 0;
303
315
  }
304
316
  }
305
317
 
306
318
  .block-editor-list-view-block__menu-cell {
307
- padding-right: $grid-unit-05;
319
+ padding-right: $grid-unit-15 * 0.5; // 6px.
308
320
 
309
321
  .components-button.has-icon {
310
322
  height: 24px;
@@ -458,7 +470,9 @@ $block-navigation-max-indent: 8;
458
470
  }
459
471
 
460
472
  .block-editor-list-view-leaf[aria-level] .block-editor-list-view__expander {
461
- margin-left: ( $icon-size ) * $block-navigation-max-indent + 4 * ( $block-navigation-max-indent - 1 );
473
+ margin-left:
474
+ ($icon-size) * $block-navigation-max-indent + 4 *
475
+ ($block-navigation-max-indent - 1);
462
476
  }
463
477
 
464
478
  .block-editor-list-view-leaf:not([aria-level="1"]) {
@@ -471,12 +485,12 @@ $block-navigation-max-indent: 8;
471
485
  // indentation in `use-list-view-drop-zone.js` must be updated as well
472
486
  // to ensure the drop zone is aligned with the indentation.
473
487
  @for $i from 0 to $block-navigation-max-indent {
474
- .block-editor-list-view-leaf[aria-level="#{ $i + 1 }"] .block-editor-list-view__expander {
488
+ .block-editor-list-view-leaf[aria-level="#{ $i + 1 }"]
489
+ .block-editor-list-view__expander {
475
490
  @if $i - 1 >= 0 {
476
- margin-left: ( $icon-size * $i ) + 4 * ($i - 1);
477
- }
478
- @else {
479
- margin-left: ( $icon-size * $i );
491
+ margin-left: ($icon-size * $i) + 4 * ($i - 1);
492
+ } @else {
493
+ margin-left: ($icon-size * $i);
480
494
  }
481
495
  }
482
496
  }
@@ -486,7 +500,9 @@ $block-navigation-max-indent: 8;
486
500
  }
487
501
 
488
502
  // Point downwards when open.
489
- .block-editor-list-view-leaf[data-expanded="true"] .block-editor-list-view__expander svg {
503
+ .block-editor-list-view-leaf[data-expanded="true"]
504
+ .block-editor-list-view__expander
505
+ svg {
490
506
  visibility: visible;
491
507
  transition: transform 0.2s ease;
492
508
  transform: rotate(90deg);
@@ -494,7 +510,9 @@ $block-navigation-max-indent: 8;
494
510
  }
495
511
 
496
512
  // Point rightwards when closed
497
- .block-editor-list-view-leaf[data-expanded="false"] .block-editor-list-view__expander svg {
513
+ .block-editor-list-view-leaf[data-expanded="false"]
514
+ .block-editor-list-view__expander
515
+ svg {
498
516
  visibility: visible;
499
517
  transform: rotate(0deg);
500
518
  transition: transform 0.2s ease;
@@ -557,11 +575,3 @@ $block-navigation-max-indent: 8;
557
575
  .list-view-appender__description {
558
576
  display: none;
559
577
  }
560
-
561
- .block-editor-list-view-block-select-button__bindings svg g {
562
- stroke: var(--wp-bound-block-color);
563
- fill: transparent;
564
- stroke-width: 1.5;
565
- stroke-linecap: round;
566
- stroke-linejoin: round;
567
- }
@@ -0,0 +1,33 @@
1
+ /**
2
+ * WordPress dependencies
3
+ */
4
+ import { useEffect } from '@wordpress/element';
5
+ import { useSelect } from '@wordpress/data';
6
+
7
+ /**
8
+ * Internal dependencies
9
+ */
10
+ import { store as blockEditorStore } from '../../store';
11
+ import { unlock } from '../../lock-unlock';
12
+
13
+ export default function useListViewCollapseItems( { collapseAll, expand } ) {
14
+ const { expandedBlock, getBlockParents } = useSelect( ( select ) => {
15
+ const { getBlockParents: _getBlockParents, getExpandedBlock } = unlock(
16
+ select( blockEditorStore )
17
+ );
18
+ return {
19
+ expandedBlock: getExpandedBlock(),
20
+ getBlockParents: _getBlockParents,
21
+ };
22
+ }, [] );
23
+
24
+ // Collapse all but the specified block when the expanded block client Id changes.
25
+ useEffect( () => {
26
+ if ( expandedBlock ) {
27
+ const blockParents = getBlockParents( expandedBlock, false );
28
+ // Collapse all blocks and expand the block's parents.
29
+ collapseAll();
30
+ expand( blockParents );
31
+ }
32
+ }, [ collapseAll, expand, expandedBlock, getBlockParents ] );
33
+ }
@@ -7,12 +7,15 @@ import { focus } from '@wordpress/dom';
7
7
  export const getBlockPositionDescription = ( position, siblingCount, level ) =>
8
8
  sprintf(
9
9
  /* translators: 1: The numerical position of the block. 2: The total number of blocks. 3. The level of nesting for the block. */
10
- __( 'Block %1$d of %2$d, Level %3$d' ),
10
+ __( 'Block %1$d of %2$d, Level %3$d.' ),
11
11
  position,
12
12
  siblingCount,
13
13
  level
14
14
  );
15
15
 
16
+ export const getBlockPropertiesDescription = ( isLocked ) =>
17
+ isLocked ? __( 'This block is locked.' ) : '';
18
+
16
19
  /**
17
20
  * Returns true if the client ID occurs within the block selection or multi-selection,
18
21
  * or false otherwise.
@@ -12,6 +12,10 @@ _Required._ HTML string to make editable. The HTML should be valid, and valid in
12
12
 
13
13
  _Required._ Called when the value changes.
14
14
 
15
+ ### `identifier: String`
16
+
17
+ _Optional._ If the editable field is bound to a block attribute (through the `value` and `onChange` props) then this prop should specify the attribute name. The field will use this value to set the block editor selection correctly, specifying in which attribute and at what offset does the selection start or end.
18
+
15
19
  ### `tagName: String`
16
20
 
17
21
  _Default: `div`._ The [tag name](https://www.w3.org/TR/html51/syntax.html#tag-name) of the editable element.
@@ -50,6 +54,7 @@ _Optional._ By default, all registered formats are allowed. This setting can be
50
54
  ```js
51
55
  <RichText
52
56
  tagName="h2"
57
+ identifier="content"
53
58
  value={ attributes.content }
54
59
  allowedFormats={ [ 'core/bold', 'core/italic' ] } // Allow the content to be made bold or italic, but do not allow othe formatting options
55
60
  onChange={ ( content ) => setAttributes( { content } ) }
@@ -99,6 +104,7 @@ registerBlockType( /* ... */, {
99
104
  <RichText
100
105
  tagName="h2"
101
106
  className={ className }
107
+ identifier="content"
102
108
  value={ attributes.content }
103
109
  onChange={ ( content ) => setAttributes( { content } ) }
104
110
  />
@@ -13,7 +13,7 @@ import {
13
13
  createContext,
14
14
  } from '@wordpress/element';
15
15
  import { useDispatch, useSelect } from '@wordpress/data';
16
- import { useMergeRefs } from '@wordpress/compose';
16
+ import { useMergeRefs, useInstanceId } from '@wordpress/compose';
17
17
  import {
18
18
  __unstableUseRichText as useRichText,
19
19
  removeFormat,
@@ -52,6 +52,8 @@ import { canBindBlock } from '../../hooks/use-bindings-attributes';
52
52
  export const keyboardShortcutContext = createContext();
53
53
  export const inputEventContext = createContext();
54
54
 
55
+ const instanceIdKey = Symbol( 'instanceId' );
56
+
55
57
  /**
56
58
  * Removes props used for the native version of RichText so that they are not
57
59
  * passed to the DOM element and log warnings.
@@ -75,7 +77,6 @@ function removeNativeProps( props ) {
75
77
  fontStyle,
76
78
  minWidth,
77
79
  maxWidth,
78
- setRef,
79
80
  disableSuggestions,
80
81
  disableAutocorrection,
81
82
  ...restProps
@@ -110,13 +111,15 @@ export function RichTextWrapper(
110
111
  __unstableDisableFormats: disableFormats,
111
112
  disableLineBreaks,
112
113
  __unstableAllowPrefixTransformations,
113
- disableEditing,
114
+ readOnly,
114
115
  ...props
115
116
  },
116
117
  forwardedRef
117
118
  ) {
118
119
  props = removeNativeProps( props );
119
120
 
121
+ const instanceId = useInstanceId( RichTextWrapper );
122
+
120
123
  const anchorRef = useRef();
121
124
  const context = useBlockEditContext();
122
125
  const { clientId, isSelected: isBlockSelected, name: blockName } = context;
@@ -139,7 +142,9 @@ export function RichTextWrapper(
139
142
  isSelected =
140
143
  selectionStart.clientId === clientId &&
141
144
  selectionEnd.clientId === clientId &&
142
- selectionStart.attributeKey === identifier;
145
+ ( identifier
146
+ ? selectionStart.attributeKey === identifier
147
+ : selectionStart[ instanceIdKey ] === instanceId );
143
148
  } else if ( originalIsSelected ) {
144
149
  isSelected = selectionStart.clientId === clientId;
145
150
  }
@@ -153,6 +158,7 @@ export function RichTextWrapper(
153
158
  const { selectionStart, selectionEnd, isSelected } = useSelect( selector, [
154
159
  clientId,
155
160
  identifier,
161
+ instanceId,
156
162
  originalIsSelected,
157
163
  isBlockSelected,
158
164
  ] );
@@ -196,7 +202,7 @@ export function RichTextWrapper(
196
202
  [ blockBindings, blockName ]
197
203
  );
198
204
 
199
- const shouldDisableEditing = disableEditing || disableBoundBlocks;
205
+ const shouldDisableEditing = readOnly || disableBoundBlocks;
200
206
 
201
207
  const { getSelectionStart, getSelectionEnd, getBlockRootClientId } =
202
208
  useSelect( blockEditorStore );
@@ -213,6 +219,13 @@ export function RichTextWrapper(
213
219
  const selection = {};
214
220
  const unset = start === undefined && end === undefined;
215
221
 
222
+ const baseSelection = {
223
+ clientId,
224
+ [ identifier ? 'attributeKey' : instanceIdKey ]: identifier
225
+ ? identifier
226
+ : instanceId,
227
+ };
228
+
216
229
  if ( typeof start === 'number' || unset ) {
217
230
  // If we are only setting the start (or the end below), which
218
231
  // means a partial selection, and we're not updating a selection
@@ -227,8 +240,7 @@ export function RichTextWrapper(
227
240
  }
228
241
 
229
242
  selection.start = {
230
- clientId,
231
- attributeKey: identifier,
243
+ ...baseSelection,
232
244
  offset: start,
233
245
  };
234
246
  }
@@ -243,15 +255,22 @@ export function RichTextWrapper(
243
255
  }
244
256
 
245
257
  selection.end = {
246
- clientId,
247
- attributeKey: identifier,
258
+ ...baseSelection,
248
259
  offset: end,
249
260
  };
250
261
  }
251
262
 
252
263
  selectionChange( selection );
253
264
  },
254
- [ clientId, identifier ]
265
+ [
266
+ clientId,
267
+ getBlockRootClientId,
268
+ getSelectionEnd,
269
+ getSelectionStart,
270
+ identifier,
271
+ instanceId,
272
+ selectionChange,
273
+ ]
255
274
  );
256
275
 
257
276
  const {
@@ -466,9 +485,7 @@ PrivateRichText.isEmpty = ( value ) => {
466
485
  * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/rich-text/README.md
467
486
  */
468
487
  const PublicForwardedRichTextContainer = forwardRef( ( props, ref ) => {
469
- return (
470
- <PrivateRichText ref={ ref } { ...props } disableEditing={ false } />
471
- );
488
+ return <PrivateRichText ref={ ref } { ...props } readOnly={ false } />;
472
489
  } );
473
490
 
474
491
  PublicForwardedRichTextContainer.Content = Content;