@wordpress/block-editor 12.16.0 → 12.17.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 (646) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/LICENSE.md +1 -1
  3. package/README.md +3 -6
  4. package/build/components/block-canvas/index.js +0 -2
  5. package/build/components/block-canvas/index.js.map +1 -1
  6. package/build/components/block-card/index.js +1 -1
  7. package/build/components/block-card/index.js.map +1 -1
  8. package/build/components/block-draggable/draggable-chip.js +6 -1
  9. package/build/components/block-draggable/draggable-chip.js.map +1 -1
  10. package/build/components/block-draggable/index.js +76 -6
  11. package/build/components/block-draggable/index.js.map +1 -1
  12. package/build/components/block-draggable/index.native.js +0 -6
  13. package/build/components/block-draggable/index.native.js.map +1 -1
  14. package/build/components/block-draggable/use-scroll-when-dragging.native.js +1 -1
  15. package/build/components/block-draggable/use-scroll-when-dragging.native.js.map +1 -1
  16. package/build/components/block-editing-mode/index.js +2 -3
  17. package/build/components/block-editing-mode/index.js.map +1 -1
  18. package/build/components/block-inspector/index.js +1 -1
  19. package/build/components/block-inspector/index.js.map +1 -1
  20. package/build/components/block-list/block-list-item-cell.native.js +1 -0
  21. package/build/components/block-list/block-list-item-cell.native.js.map +1 -1
  22. package/build/components/block-list/block.js +245 -102
  23. package/build/components/block-list/block.js.map +1 -1
  24. package/build/components/block-list/block.native.js +46 -20
  25. package/build/components/block-list/block.native.js.map +1 -1
  26. package/build/components/block-list/index.native.js +3 -5
  27. package/build/components/block-list/index.native.js.map +1 -1
  28. package/build/components/block-list/private-block-context.js +14 -0
  29. package/build/components/block-list/private-block-context.js.map +1 -0
  30. package/build/components/block-list/use-block-props/index.js +33 -96
  31. package/build/components/block-list/use-block-props/index.js.map +1 -1
  32. package/build/components/block-list/use-in-between-inserter.js +3 -2
  33. package/build/components/block-list/use-in-between-inserter.js.map +1 -1
  34. package/build/components/block-list/use-scroll-upon-insertion.native.js +41 -0
  35. package/build/components/block-list/use-scroll-upon-insertion.native.js.map +1 -0
  36. package/build/components/block-lock/toolbar.js +15 -27
  37. package/build/components/block-lock/toolbar.js.map +1 -1
  38. package/build/components/block-mover/index.js +2 -1
  39. package/build/components/block-mover/index.js.map +1 -1
  40. package/build/components/block-patterns-list/index.js +4 -4
  41. package/build/components/block-patterns-list/index.js.map +1 -1
  42. package/build/components/block-switcher/index.js +4 -4
  43. package/build/components/block-switcher/index.js.map +1 -1
  44. package/build/components/block-toolbar/index.js +1 -2
  45. package/build/components/block-toolbar/index.js.map +1 -1
  46. package/build/components/block-tools/block-toolbar-popover.js +0 -2
  47. package/build/components/block-tools/block-toolbar-popover.js.map +1 -1
  48. package/build/components/block-variation-transforms/index.js +29 -2
  49. package/build/components/block-variation-transforms/index.js.map +1 -1
  50. package/build/components/border-radius-control/linked-button.js +1 -1
  51. package/build/components/border-radius-control/linked-button.js.map +1 -1
  52. package/build/components/colors/utils.js +10 -2
  53. package/build/components/colors/utils.js.map +1 -1
  54. package/build/components/colors/with-colors.js +6 -2
  55. package/build/components/colors/with-colors.js.map +1 -1
  56. package/build/components/font-sizes/utils.js +10 -2
  57. package/build/components/font-sizes/utils.js.map +1 -1
  58. package/build/components/global-styles/border-panel.js +2 -1
  59. package/build/components/global-styles/border-panel.js.map +1 -1
  60. package/build/components/global-styles/color-panel.js +2 -1
  61. package/build/components/global-styles/color-panel.js.map +1 -1
  62. package/build/components/global-styles/dimensions-panel.js +4 -3
  63. package/build/components/global-styles/dimensions-panel.js.map +1 -1
  64. package/build/components/global-styles/effects-panel.js +2 -1
  65. package/build/components/global-styles/effects-panel.js.map +1 -1
  66. package/build/components/global-styles/filters-panel.js +1 -4
  67. package/build/components/global-styles/filters-panel.js.map +1 -1
  68. package/build/components/global-styles/get-global-styles-changes.js +192 -0
  69. package/build/components/global-styles/get-global-styles-changes.js.map +1 -0
  70. package/build/components/global-styles/hooks.js +1 -1
  71. package/build/components/global-styles/hooks.js.map +1 -1
  72. package/build/components/global-styles/image-settings-panel.js +7 -1
  73. package/build/components/global-styles/image-settings-panel.js.map +1 -1
  74. package/build/components/global-styles/index.js +7 -0
  75. package/build/components/global-styles/index.js.map +1 -1
  76. package/build/components/global-styles/typography-panel.js +2 -1
  77. package/build/components/global-styles/typography-panel.js.map +1 -1
  78. package/build/components/global-styles/use-global-styles-output.js +22 -8
  79. package/build/components/global-styles/use-global-styles-output.js.map +1 -1
  80. package/build/components/global-styles/utils.js +8 -1
  81. package/build/components/global-styles/utils.js.map +1 -1
  82. package/build/components/height-control/index.js +6 -2
  83. package/build/components/height-control/index.js.map +1 -1
  84. package/build/components/image-size-control/index.js +2 -2
  85. package/build/components/image-size-control/index.js.map +1 -1
  86. package/build/components/index.native.js +6 -5
  87. package/build/components/index.native.js.map +1 -1
  88. package/build/components/inner-blocks/index.js +61 -22
  89. package/build/components/inner-blocks/index.js.map +1 -1
  90. package/build/components/inner-blocks/index.native.js +18 -4
  91. package/build/components/inner-blocks/index.native.js.map +1 -1
  92. package/build/components/inner-blocks/use-inner-block-template-sync.js +5 -6
  93. package/build/components/inner-blocks/use-inner-block-template-sync.js.map +1 -1
  94. package/build/components/inner-blocks/use-nested-settings-update.js +5 -9
  95. package/build/components/inner-blocks/use-nested-settings-update.js.map +1 -1
  96. package/build/components/inserter/block-patterns-explorer/pattern-list.js +1 -1
  97. package/build/components/inserter/block-patterns-explorer/pattern-list.js.map +1 -1
  98. package/build/components/inserter/block-patterns-tab/pattern-category-previews.js +10 -9
  99. package/build/components/inserter/block-patterns-tab/pattern-category-previews.js.map +1 -1
  100. package/build/components/inserter/block-patterns-tab/patterns-filter.js +10 -10
  101. package/build/components/inserter/block-patterns-tab/patterns-filter.js.map +1 -1
  102. package/build/components/inserter/block-patterns-tab/use-pattern-categories.js +9 -9
  103. package/build/components/inserter/block-patterns-tab/use-pattern-categories.js.map +1 -1
  104. package/build/components/inserter/block-patterns-tab/utils.js +10 -14
  105. package/build/components/inserter/block-patterns-tab/utils.js.map +1 -1
  106. package/build/components/inserter/hooks/use-block-types-state.js +4 -14
  107. package/build/components/inserter/hooks/use-block-types-state.js.map +1 -1
  108. package/build/components/inserter/hooks/use-patterns-state.js +1 -1
  109. package/build/components/inserter/hooks/use-patterns-state.js.map +1 -1
  110. package/build/components/inserter/index.js +1 -2
  111. package/build/components/inserter/index.js.map +1 -1
  112. package/build/components/inserter/library.js +3 -7
  113. package/build/components/inserter/library.js.map +1 -1
  114. package/build/components/inserter/menu.js +14 -28
  115. package/build/components/inserter/menu.js.map +1 -1
  116. package/build/components/inserter/tabs.js +21 -21
  117. package/build/components/inserter/tabs.js.map +1 -1
  118. package/build/components/inserter-draggable-blocks/index.js +1 -1
  119. package/build/components/inserter-draggable-blocks/index.js.map +1 -1
  120. package/build/components/inserter-list-item/index.js +2 -4
  121. package/build/components/inserter-list-item/index.js.map +1 -1
  122. package/build/components/inspector-controls/block-support-tools-panel.js +3 -1
  123. package/build/components/inspector-controls/block-support-tools-panel.js.map +1 -1
  124. package/build/components/inspector-controls-tabs/index.js +34 -23
  125. package/build/components/inspector-controls-tabs/index.js.map +1 -1
  126. package/build/components/list-view/block-select-button.js +4 -0
  127. package/build/components/list-view/block-select-button.js.map +1 -1
  128. package/build/components/list-view/block.js +57 -3
  129. package/build/components/list-view/block.js.map +1 -1
  130. package/build/components/media-upload-progress/constants.js +19 -0
  131. package/build/components/media-upload-progress/constants.js.map +1 -0
  132. package/build/components/media-upload-progress/index.native.js +42 -17
  133. package/build/components/media-upload-progress/index.native.js.map +1 -1
  134. package/build/components/navigable-toolbar/index.js +9 -14
  135. package/build/components/navigable-toolbar/index.js.map +1 -1
  136. package/build/components/plain-text/index.native.js +8 -3
  137. package/build/components/plain-text/index.native.js.map +1 -1
  138. package/build/components/provider/index.js +3 -1
  139. package/build/components/provider/index.js.map +1 -1
  140. package/build/components/provider/use-block-sync.js +7 -1
  141. package/build/components/provider/use-block-sync.js.map +1 -1
  142. package/build/components/rich-text/index.js +17 -7
  143. package/build/components/rich-text/index.js.map +1 -1
  144. package/build/components/rich-text/native/index.native.js +16 -24
  145. package/build/components/rich-text/native/index.native.js.map +1 -1
  146. package/build/components/rich-text/use-input-rules.js +2 -2
  147. package/build/components/rich-text/use-input-rules.js.map +1 -1
  148. package/build/components/rich-text/use-mark-persistent.js +1 -1
  149. package/build/components/rich-text/use-mark-persistent.js.map +1 -1
  150. package/build/components/spacing-sizes-control/input-controls/spacing-input-control.js +1 -1
  151. package/build/components/spacing-sizes-control/input-controls/spacing-input-control.js.map +1 -1
  152. package/build/components/url-input/index.js +9 -6
  153. package/build/components/url-input/index.js.map +1 -1
  154. package/build/components/use-block-commands/index.js +14 -18
  155. package/build/components/use-block-commands/index.js.map +1 -1
  156. package/build/components/use-block-drop-zone/index.js +51 -22
  157. package/build/components/use-block-drop-zone/index.js.map +1 -1
  158. package/build/components/use-moving-animation/index.js +100 -92
  159. package/build/components/use-moving-animation/index.js.map +1 -1
  160. package/build/components/use-on-block-drop/index.js +8 -11
  161. package/build/components/use-on-block-drop/index.js.map +1 -1
  162. package/build/components/writing-flow/index.js +0 -1
  163. package/build/components/writing-flow/index.js.map +1 -1
  164. package/build/components/writing-flow/use-drag-selection.js +15 -4
  165. package/build/components/writing-flow/use-drag-selection.js.map +1 -1
  166. package/build/components/writing-flow/use-selection-observer.js +73 -27
  167. package/build/components/writing-flow/use-selection-observer.js.map +1 -1
  168. package/build/components/writing-flow/use-tab-nav.js +7 -4
  169. package/build/components/writing-flow/use-tab-nav.js.map +1 -1
  170. package/build/hooks/align.js +1 -1
  171. package/build/hooks/align.js.map +1 -1
  172. package/build/hooks/anchor.js +1 -1
  173. package/build/hooks/anchor.js.map +1 -1
  174. package/build/hooks/aria-label.js +9 -1
  175. package/build/hooks/aria-label.js.map +1 -1
  176. package/build/hooks/background.js +185 -20
  177. package/build/hooks/background.js.map +1 -1
  178. package/build/hooks/border.js +5 -10
  179. package/build/hooks/border.js.map +1 -1
  180. package/build/hooks/color.js +13 -11
  181. package/build/hooks/color.js.map +1 -1
  182. package/build/hooks/custom-class-name.js +1 -1
  183. package/build/hooks/custom-class-name.js.map +1 -1
  184. package/build/hooks/custom-class-name.native.js +9 -1
  185. package/build/hooks/custom-class-name.native.js.map +1 -1
  186. package/build/hooks/dimensions.js +4 -9
  187. package/build/hooks/dimensions.js.map +1 -1
  188. package/build/hooks/font-family.js +7 -3
  189. package/build/hooks/font-family.js.map +1 -1
  190. package/build/hooks/font-size.js +1 -1
  191. package/build/hooks/font-size.js.map +1 -1
  192. package/build/hooks/index.js +4 -3
  193. package/build/hooks/index.js.map +1 -1
  194. package/build/hooks/index.native.js +5 -3
  195. package/build/hooks/index.native.js.map +1 -1
  196. package/build/hooks/layout.js +10 -4
  197. package/build/hooks/layout.js.map +1 -1
  198. package/build/hooks/style.js +1 -1
  199. package/build/hooks/style.js.map +1 -1
  200. package/build/hooks/typography.js +4 -9
  201. package/build/hooks/typography.js.map +1 -1
  202. package/build/hooks/typography.native.js +43 -18
  203. package/build/hooks/typography.native.js.map +1 -1
  204. package/build/hooks/use-typography-props.js +10 -2
  205. package/build/hooks/use-typography-props.js.map +1 -1
  206. package/build/hooks/utils.js +44 -4
  207. package/build/hooks/utils.js.map +1 -1
  208. package/build/private-apis.js +2 -4
  209. package/build/private-apis.js.map +1 -1
  210. package/build/private-apis.native.js +0 -2
  211. package/build/private-apis.native.js.map +1 -1
  212. package/build/store/actions.js +0 -16
  213. package/build/store/actions.js.map +1 -1
  214. package/build/store/private-actions.js +51 -5
  215. package/build/store/private-actions.js.map +1 -1
  216. package/build/store/private-selectors.js +12 -0
  217. package/build/store/private-selectors.js.map +1 -1
  218. package/build/store/reducer.js +14 -6
  219. package/build/store/reducer.js.map +1 -1
  220. package/build/store/selectors.js +1 -13
  221. package/build/store/selectors.js.map +1 -1
  222. package/build/store/undo-ignore.js +12 -0
  223. package/build/store/undo-ignore.js.map +1 -0
  224. package/build/store/utils.js +1 -1
  225. package/build/store/utils.js.map +1 -1
  226. package/build/utils/get-px-from-css-unit.js +16 -0
  227. package/build/utils/get-px-from-css-unit.js.map +1 -0
  228. package/build/utils/index.js +2 -2
  229. package/build/utils/index.js.map +1 -1
  230. package/build/utils/object.js +0 -38
  231. package/build/utils/object.js.map +1 -1
  232. package/build/utils/use-can-block-toolbar-be-focused.js +46 -0
  233. package/build/utils/use-can-block-toolbar-be-focused.js.map +1 -0
  234. package/build-module/components/block-canvas/index.js +0 -2
  235. package/build-module/components/block-canvas/index.js.map +1 -1
  236. package/build-module/components/block-card/index.js +1 -1
  237. package/build-module/components/block-card/index.js.map +1 -1
  238. package/build-module/components/block-draggable/draggable-chip.js +6 -1
  239. package/build-module/components/block-draggable/draggable-chip.js.map +1 -1
  240. package/build-module/components/block-draggable/index.js +76 -6
  241. package/build-module/components/block-draggable/index.js.map +1 -1
  242. package/build-module/components/block-draggable/index.native.js +1 -7
  243. package/build-module/components/block-draggable/index.native.js.map +1 -1
  244. package/build-module/components/block-draggable/use-scroll-when-dragging.native.js +1 -1
  245. package/build-module/components/block-draggable/use-scroll-when-dragging.native.js.map +1 -1
  246. package/build-module/components/block-editing-mode/index.js +3 -4
  247. package/build-module/components/block-editing-mode/index.js.map +1 -1
  248. package/build-module/components/block-inspector/index.js +1 -1
  249. package/build-module/components/block-inspector/index.js.map +1 -1
  250. package/build-module/components/block-list/block-list-item-cell.native.js +1 -0
  251. package/build-module/components/block-list/block-list-item-cell.native.js.map +1 -1
  252. package/build-module/components/block-list/block.js +249 -106
  253. package/build-module/components/block-list/block.js.map +1 -1
  254. package/build-module/components/block-list/block.native.js +48 -22
  255. package/build-module/components/block-list/block.native.js.map +1 -1
  256. package/build-module/components/block-list/index.native.js +3 -5
  257. package/build-module/components/block-list/index.native.js.map +1 -1
  258. package/build-module/components/block-list/private-block-context.js +6 -0
  259. package/build-module/components/block-list/private-block-context.js.map +1 -0
  260. package/build-module/components/block-list/use-block-props/index.js +34 -97
  261. package/build-module/components/block-list/use-block-props/index.js.map +1 -1
  262. package/build-module/components/block-list/use-in-between-inserter.js +3 -2
  263. package/build-module/components/block-list/use-in-between-inserter.js.map +1 -1
  264. package/build-module/components/block-list/use-scroll-upon-insertion.native.js +33 -0
  265. package/build-module/components/block-list/use-scroll-upon-insertion.native.js.map +1 -0
  266. package/build-module/components/block-lock/toolbar.js +16 -28
  267. package/build-module/components/block-lock/toolbar.js.map +1 -1
  268. package/build-module/components/block-mover/index.js +2 -1
  269. package/build-module/components/block-mover/index.js.map +1 -1
  270. package/build-module/components/block-patterns-list/index.js +5 -5
  271. package/build-module/components/block-patterns-list/index.js.map +1 -1
  272. package/build-module/components/block-switcher/index.js +4 -4
  273. package/build-module/components/block-switcher/index.js.map +1 -1
  274. package/build-module/components/block-toolbar/index.js +1 -2
  275. package/build-module/components/block-toolbar/index.js.map +1 -1
  276. package/build-module/components/block-tools/block-toolbar-popover.js +0 -2
  277. package/build-module/components/block-tools/block-toolbar-popover.js.map +1 -1
  278. package/build-module/components/block-variation-transforms/index.js +30 -3
  279. package/build-module/components/block-variation-transforms/index.js.map +1 -1
  280. package/build-module/components/border-radius-control/linked-button.js +1 -1
  281. package/build-module/components/border-radius-control/linked-button.js.map +1 -1
  282. package/build-module/components/colors/utils.js +9 -1
  283. package/build-module/components/colors/utils.js.map +1 -1
  284. package/build-module/components/colors/with-colors.js +5 -1
  285. package/build-module/components/colors/with-colors.js.map +1 -1
  286. package/build-module/components/font-sizes/utils.js +9 -1
  287. package/build-module/components/font-sizes/utils.js.map +1 -1
  288. package/build-module/components/global-styles/border-panel.js +3 -2
  289. package/build-module/components/global-styles/border-panel.js.map +1 -1
  290. package/build-module/components/global-styles/color-panel.js +3 -2
  291. package/build-module/components/global-styles/color-panel.js.map +1 -1
  292. package/build-module/components/global-styles/dimensions-panel.js +5 -4
  293. package/build-module/components/global-styles/dimensions-panel.js.map +1 -1
  294. package/build-module/components/global-styles/effects-panel.js +3 -2
  295. package/build-module/components/global-styles/effects-panel.js.map +1 -1
  296. package/build-module/components/global-styles/filters-panel.js +2 -5
  297. package/build-module/components/global-styles/filters-panel.js.map +1 -1
  298. package/build-module/components/global-styles/get-global-styles-changes.js +184 -0
  299. package/build-module/components/global-styles/get-global-styles-changes.js.map +1 -0
  300. package/build-module/components/global-styles/hooks.js +1 -1
  301. package/build-module/components/global-styles/hooks.js.map +1 -1
  302. package/build-module/components/global-styles/image-settings-panel.js +7 -1
  303. package/build-module/components/global-styles/image-settings-panel.js.map +1 -1
  304. package/build-module/components/global-styles/index.js +1 -0
  305. package/build-module/components/global-styles/index.js.map +1 -1
  306. package/build-module/components/global-styles/typography-panel.js +3 -2
  307. package/build-module/components/global-styles/typography-panel.js.map +1 -1
  308. package/build-module/components/global-styles/use-global-styles-output.js +15 -1
  309. package/build-module/components/global-styles/use-global-styles-output.js.map +1 -1
  310. package/build-module/components/global-styles/utils.js +7 -0
  311. package/build-module/components/global-styles/utils.js.map +1 -1
  312. package/build-module/components/height-control/index.js +6 -2
  313. package/build-module/components/height-control/index.js.map +1 -1
  314. package/build-module/components/image-size-control/index.js +2 -2
  315. package/build-module/components/image-size-control/index.js.map +1 -1
  316. package/build-module/components/index.native.js +2 -1
  317. package/build-module/components/index.native.js.map +1 -1
  318. package/build-module/components/inner-blocks/index.js +62 -23
  319. package/build-module/components/inner-blocks/index.js.map +1 -1
  320. package/build-module/components/inner-blocks/index.native.js +18 -4
  321. package/build-module/components/inner-blocks/index.native.js.map +1 -1
  322. package/build-module/components/inner-blocks/use-inner-block-template-sync.js +5 -6
  323. package/build-module/components/inner-blocks/use-inner-block-template-sync.js.map +1 -1
  324. package/build-module/components/inner-blocks/use-nested-settings-update.js +6 -10
  325. package/build-module/components/inner-blocks/use-nested-settings-update.js.map +1 -1
  326. package/build-module/components/inserter/block-patterns-explorer/pattern-list.js +2 -2
  327. package/build-module/components/inserter/block-patterns-explorer/pattern-list.js.map +1 -1
  328. package/build-module/components/inserter/block-patterns-tab/pattern-category-previews.js +11 -10
  329. package/build-module/components/inserter/block-patterns-tab/pattern-category-previews.js.map +1 -1
  330. package/build-module/components/inserter/block-patterns-tab/patterns-filter.js +11 -11
  331. package/build-module/components/inserter/block-patterns-tab/patterns-filter.js.map +1 -1
  332. package/build-module/components/inserter/block-patterns-tab/use-pattern-categories.js +11 -11
  333. package/build-module/components/inserter/block-patterns-tab/use-pattern-categories.js.map +1 -1
  334. package/build-module/components/inserter/block-patterns-tab/utils.js +7 -11
  335. package/build-module/components/inserter/block-patterns-tab/utils.js.map +1 -1
  336. package/build-module/components/inserter/hooks/use-block-types-state.js +4 -14
  337. package/build-module/components/inserter/hooks/use-block-types-state.js.map +1 -1
  338. package/build-module/components/inserter/hooks/use-patterns-state.js +2 -2
  339. package/build-module/components/inserter/hooks/use-patterns-state.js.map +1 -1
  340. package/build-module/components/inserter/index.js +1 -2
  341. package/build-module/components/inserter/index.js.map +1 -1
  342. package/build-module/components/inserter/library.js +3 -7
  343. package/build-module/components/inserter/library.js.map +1 -1
  344. package/build-module/components/inserter/menu.js +14 -28
  345. package/build-module/components/inserter/menu.js.map +1 -1
  346. package/build-module/components/inserter/tabs.js +22 -22
  347. package/build-module/components/inserter/tabs.js.map +1 -1
  348. package/build-module/components/inserter-draggable-blocks/index.js +2 -2
  349. package/build-module/components/inserter-draggable-blocks/index.js.map +1 -1
  350. package/build-module/components/inserter-list-item/index.js +2 -4
  351. package/build-module/components/inserter-list-item/index.js.map +1 -1
  352. package/build-module/components/inspector-controls/block-support-tools-panel.js +3 -1
  353. package/build-module/components/inspector-controls/block-support-tools-panel.js.map +1 -1
  354. package/build-module/components/inspector-controls-tabs/index.js +35 -24
  355. package/build-module/components/inspector-controls-tabs/index.js.map +1 -1
  356. package/build-module/components/list-view/block-select-button.js +4 -0
  357. package/build-module/components/list-view/block-select-button.js.map +1 -1
  358. package/build-module/components/list-view/block.js +58 -4
  359. package/build-module/components/list-view/block.js.map +1 -1
  360. package/build-module/components/media-upload-progress/constants.js +7 -0
  361. package/build-module/components/media-upload-progress/constants.js.map +1 -0
  362. package/build-module/components/media-upload-progress/index.native.js +37 -8
  363. package/build-module/components/media-upload-progress/index.native.js.map +1 -1
  364. package/build-module/components/navigable-toolbar/index.js +9 -14
  365. package/build-module/components/navigable-toolbar/index.js.map +1 -1
  366. package/build-module/components/plain-text/index.native.js +6 -1
  367. package/build-module/components/plain-text/index.native.js.map +1 -1
  368. package/build-module/components/provider/index.js +3 -1
  369. package/build-module/components/provider/index.js.map +1 -1
  370. package/build-module/components/provider/use-block-sync.js +7 -1
  371. package/build-module/components/provider/use-block-sync.js.map +1 -1
  372. package/build-module/components/rich-text/index.js +17 -7
  373. package/build-module/components/rich-text/index.js.map +1 -1
  374. package/build-module/components/rich-text/native/index.native.js +16 -23
  375. package/build-module/components/rich-text/native/index.native.js.map +1 -1
  376. package/build-module/components/rich-text/use-input-rules.js +2 -2
  377. package/build-module/components/rich-text/use-input-rules.js.map +1 -1
  378. package/build-module/components/rich-text/use-mark-persistent.js +1 -1
  379. package/build-module/components/rich-text/use-mark-persistent.js.map +1 -1
  380. package/build-module/components/spacing-sizes-control/input-controls/spacing-input-control.js +1 -1
  381. package/build-module/components/spacing-sizes-control/input-controls/spacing-input-control.js.map +1 -1
  382. package/build-module/components/url-input/index.js +9 -6
  383. package/build-module/components/url-input/index.js.map +1 -1
  384. package/build-module/components/use-block-commands/index.js +14 -18
  385. package/build-module/components/use-block-commands/index.js.map +1 -1
  386. package/build-module/components/use-block-drop-zone/index.js +51 -23
  387. package/build-module/components/use-block-drop-zone/index.js.map +1 -1
  388. package/build-module/components/use-moving-animation/index.js +102 -94
  389. package/build-module/components/use-moving-animation/index.js.map +1 -1
  390. package/build-module/components/use-on-block-drop/index.js +8 -11
  391. package/build-module/components/use-on-block-drop/index.js.map +1 -1
  392. package/build-module/components/writing-flow/index.js +0 -1
  393. package/build-module/components/writing-flow/index.js.map +1 -1
  394. package/build-module/components/writing-flow/use-drag-selection.js +15 -4
  395. package/build-module/components/writing-flow/use-drag-selection.js.map +1 -1
  396. package/build-module/components/writing-flow/use-selection-observer.js +73 -27
  397. package/build-module/components/writing-flow/use-selection-observer.js.map +1 -1
  398. package/build-module/components/writing-flow/use-tab-nav.js +7 -4
  399. package/build-module/components/writing-flow/use-tab-nav.js.map +1 -1
  400. package/build-module/hooks/align.js +1 -1
  401. package/build-module/hooks/align.js.map +1 -1
  402. package/build-module/hooks/anchor.js +1 -1
  403. package/build-module/hooks/anchor.js.map +1 -1
  404. package/build-module/hooks/aria-label.js +7 -1
  405. package/build-module/hooks/aria-label.js.map +1 -1
  406. package/build-module/hooks/background.js +181 -19
  407. package/build-module/hooks/background.js.map +1 -1
  408. package/build-module/hooks/border.js +2 -8
  409. package/build-module/hooks/border.js.map +1 -1
  410. package/build-module/hooks/color.js +11 -9
  411. package/build-module/hooks/color.js.map +1 -1
  412. package/build-module/hooks/custom-class-name.js +1 -1
  413. package/build-module/hooks/custom-class-name.js.map +1 -1
  414. package/build-module/hooks/custom-class-name.native.js +7 -1
  415. package/build-module/hooks/custom-class-name.native.js.map +1 -1
  416. package/build-module/hooks/dimensions.js +1 -7
  417. package/build-module/hooks/dimensions.js.map +1 -1
  418. package/build-module/hooks/font-family.js +6 -2
  419. package/build-module/hooks/font-family.js.map +1 -1
  420. package/build-module/hooks/font-size.js +1 -1
  421. package/build-module/hooks/font-size.js.map +1 -1
  422. package/build-module/hooks/index.js +5 -4
  423. package/build-module/hooks/index.js.map +1 -1
  424. package/build-module/hooks/index.native.js +6 -4
  425. package/build-module/hooks/index.native.js.map +1 -1
  426. package/build-module/hooks/layout.js +9 -3
  427. package/build-module/hooks/layout.js.map +1 -1
  428. package/build-module/hooks/style.js +1 -1
  429. package/build-module/hooks/style.js.map +1 -1
  430. package/build-module/hooks/typography.js +1 -7
  431. package/build-module/hooks/typography.js.map +1 -1
  432. package/build-module/hooks/typography.native.js +43 -17
  433. package/build-module/hooks/typography.native.js.map +1 -1
  434. package/build-module/hooks/use-typography-props.js +9 -1
  435. package/build-module/hooks/use-typography-props.js.map +1 -1
  436. package/build-module/hooks/utils.js +43 -4
  437. package/build-module/hooks/utils.js.map +1 -1
  438. package/build-module/private-apis.js +2 -4
  439. package/build-module/private-apis.js.map +1 -1
  440. package/build-module/private-apis.native.js +0 -2
  441. package/build-module/private-apis.native.js.map +1 -1
  442. package/build-module/store/actions.js +0 -15
  443. package/build-module/store/actions.js.map +1 -1
  444. package/build-module/store/private-actions.js +49 -4
  445. package/build-module/store/private-actions.js.map +1 -1
  446. package/build-module/store/private-selectors.js +11 -0
  447. package/build-module/store/private-selectors.js.map +1 -1
  448. package/build-module/store/reducer.js +14 -6
  449. package/build-module/store/reducer.js.map +1 -1
  450. package/build-module/store/selectors.js +1 -12
  451. package/build-module/store/selectors.js.map +1 -1
  452. package/build-module/store/undo-ignore.js +5 -0
  453. package/build-module/store/undo-ignore.js.map +1 -0
  454. package/build-module/store/utils.js +2 -2
  455. package/build-module/store/utils.js.map +1 -1
  456. package/build-module/utils/get-px-from-css-unit.js +9 -0
  457. package/build-module/utils/get-px-from-css-unit.js.map +1 -0
  458. package/build-module/utils/index.js +1 -1
  459. package/build-module/utils/index.js.map +1 -1
  460. package/build-module/utils/object.js +0 -37
  461. package/build-module/utils/object.js.map +1 -1
  462. package/build-module/utils/use-can-block-toolbar-be-focused.js +40 -0
  463. package/build-module/utils/use-can-block-toolbar-be-focused.js.map +1 -0
  464. package/build-style/content-rtl.css +7 -6
  465. package/build-style/content.css +7 -6
  466. package/build-style/style-rtl.css +51 -8
  467. package/build-style/style.css +51 -8
  468. package/package.json +31 -31
  469. package/src/components/alignment-control/README.md +0 -5
  470. package/src/components/block-alignment-control/README.md +0 -5
  471. package/src/components/block-alignment-matrix-control/README.md +0 -10
  472. package/src/components/block-breadcrumb/README.md +0 -5
  473. package/src/components/block-canvas/index.js +0 -2
  474. package/src/components/block-canvas/style.scss +6 -0
  475. package/src/components/block-caption/README.md +0 -5
  476. package/src/components/block-card/README.md +0 -5
  477. package/src/components/block-card/index.js +1 -1
  478. package/src/components/block-draggable/draggable-chip.js +11 -1
  479. package/src/components/block-draggable/index.js +116 -4
  480. package/src/components/block-draggable/index.native.js +0 -5
  481. package/src/components/block-draggable/style.scss +35 -0
  482. package/src/components/block-draggable/test/helpers.native.js +8 -7
  483. package/src/components/block-draggable/use-scroll-when-dragging.native.js +1 -1
  484. package/src/components/block-editing-mode/index.js +3 -3
  485. package/src/components/block-icon/README.md +0 -5
  486. package/src/components/block-inspector/README.md +0 -5
  487. package/src/components/block-inspector/index.js +3 -1
  488. package/src/components/block-list/block-list-item-cell.native.js +5 -1
  489. package/src/components/block-list/block.js +290 -119
  490. package/src/components/block-list/block.native.js +55 -21
  491. package/src/components/block-list/content.scss +14 -10
  492. package/src/components/block-list/index.native.js +3 -5
  493. package/src/components/block-list/{block-list-block-context.js → private-block-context.js} +1 -1
  494. package/src/components/block-list/use-block-props/index.js +32 -128
  495. package/src/components/block-list/use-in-between-inserter.js +4 -1
  496. package/src/components/block-list/use-scroll-upon-insertion.native.js +52 -0
  497. package/src/components/block-lock/toolbar.js +15 -34
  498. package/src/components/block-mover/README.md +0 -5
  499. package/src/components/block-mover/index.js +1 -1
  500. package/src/components/block-parent-selector/README.md +0 -5
  501. package/src/components/block-patterns-list/README.md +0 -5
  502. package/src/components/block-patterns-list/index.js +8 -5
  503. package/src/components/block-switcher/index.js +49 -59
  504. package/src/components/block-toolbar/README.md +0 -5
  505. package/src/components/block-toolbar/index.js +1 -2
  506. package/src/components/block-tools/block-toolbar-popover.js +4 -10
  507. package/src/components/block-types-list/README.md +0 -5
  508. package/src/components/block-variation-picker/README.md +0 -5
  509. package/src/components/block-variation-transforms/README.md +0 -5
  510. package/src/components/block-variation-transforms/index.js +49 -3
  511. package/src/components/border-radius-control/linked-button.js +1 -1
  512. package/src/components/caption/README.md +0 -5
  513. package/src/components/color-palette/test/__snapshots__/control.js.snap +0 -1
  514. package/src/components/colors/utils.js +8 -1
  515. package/src/components/colors/with-colors.js +3 -1
  516. package/src/components/contrast-checker/README.md +0 -4
  517. package/src/components/copy-handler/README.md +0 -10
  518. package/src/components/font-sizes/utils.js +7 -1
  519. package/src/components/global-styles/border-panel.js +2 -1
  520. package/src/components/global-styles/color-panel.js +2 -1
  521. package/src/components/global-styles/dimensions-panel.js +4 -3
  522. package/src/components/global-styles/effects-panel.js +2 -1
  523. package/src/components/global-styles/filters-panel.js +2 -5
  524. package/src/components/global-styles/get-global-styles-changes.js +210 -0
  525. package/src/components/global-styles/hooks.js +3 -0
  526. package/src/components/global-styles/image-settings-panel.js +6 -0
  527. package/src/components/global-styles/index.js +1 -0
  528. package/src/components/global-styles/test/get-global-styles-changes.js +234 -0
  529. package/src/components/global-styles/typography-panel.js +2 -1
  530. package/src/components/global-styles/use-global-styles-output.js +9 -5
  531. package/src/components/global-styles/utils.js +7 -0
  532. package/src/components/height-control/README.md +2 -7
  533. package/src/components/height-control/index.js +4 -0
  534. package/src/components/image-size-control/index.js +5 -2
  535. package/src/components/index.native.js +2 -2
  536. package/src/components/inner-blocks/index.js +68 -29
  537. package/src/components/inner-blocks/index.native.js +19 -7
  538. package/src/components/inner-blocks/use-inner-block-template-sync.js +5 -7
  539. package/src/components/inner-blocks/use-nested-settings-update.js +6 -13
  540. package/src/components/inserter/block-patterns-explorer/pattern-list.js +2 -2
  541. package/src/components/inserter/block-patterns-tab/pattern-category-previews.js +15 -15
  542. package/src/components/inserter/block-patterns-tab/patterns-filter.js +15 -13
  543. package/src/components/inserter/block-patterns-tab/use-pattern-categories.js +15 -18
  544. package/src/components/inserter/block-patterns-tab/utils.js +11 -12
  545. package/src/components/inserter/hooks/use-block-types-state.js +9 -11
  546. package/src/components/inserter/hooks/use-patterns-state.js +2 -2
  547. package/src/components/inserter/index.js +0 -1
  548. package/src/components/inserter/library.js +2 -8
  549. package/src/components/inserter/menu.js +13 -31
  550. package/src/components/inserter/style.scss +6 -4
  551. package/src/components/inserter/tabs.js +34 -25
  552. package/src/components/inserter-draggable-blocks/index.js +2 -2
  553. package/src/components/inserter-list-item/index.js +6 -6
  554. package/src/components/inspector-controls/block-support-tools-panel.js +2 -0
  555. package/src/components/inspector-controls-tabs/index.js +39 -28
  556. package/src/components/inspector-controls-tabs/style.scss +3 -2
  557. package/src/components/letter-spacing-control/README.md +0 -5
  558. package/src/components/line-height-control/README.md +0 -5
  559. package/src/components/list-view/README.md +0 -5
  560. package/src/components/list-view/block-select-button.js +4 -0
  561. package/src/components/list-view/block.js +73 -2
  562. package/src/components/list-view/style.scss +6 -0
  563. package/src/components/media-upload-progress/constants.js +6 -0
  564. package/src/components/media-upload-progress/index.native.js +66 -14
  565. package/src/components/media-upload-progress/test/index.native.js +2 -2
  566. package/src/components/multi-selection-inspector/README.md +0 -5
  567. package/src/components/navigable-toolbar/index.js +13 -11
  568. package/src/components/plain-text/index.native.js +6 -1
  569. package/src/components/provider/index.js +1 -1
  570. package/src/components/provider/test/use-block-sync.js +20 -17
  571. package/src/components/provider/use-block-sync.js +6 -0
  572. package/src/components/rich-text/index.js +18 -6
  573. package/src/components/rich-text/native/index.native.js +16 -24
  574. package/src/components/rich-text/native/test/__snapshots__/index.native.js.snap +3 -3
  575. package/src/components/rich-text/native/test/index.native.js +72 -5
  576. package/src/components/rich-text/use-input-rules.js +2 -2
  577. package/src/components/rich-text/use-mark-persistent.js +1 -2
  578. package/src/components/spacing-sizes-control/input-controls/spacing-input-control.js +1 -1
  579. package/src/components/text-decoration-control/README.md +40 -0
  580. package/src/components/text-transform-control/README.md +0 -4
  581. package/src/components/ungroup-button/README.md +0 -5
  582. package/src/components/unit-control/README.md +0 -4
  583. package/src/components/url-input/index.js +11 -11
  584. package/src/components/use-block-commands/index.js +18 -21
  585. package/src/components/use-block-drop-zone/index.js +85 -34
  586. package/src/components/use-moving-animation/index.js +107 -103
  587. package/src/components/use-on-block-drop/index.js +7 -23
  588. package/src/components/use-on-block-drop/test/index.js +12 -26
  589. package/src/components/use-resize-canvas/README.md +0 -4
  590. package/src/components/use-settings/README.md +0 -4
  591. package/src/components/writing-flow/index.js +0 -1
  592. package/src/components/writing-flow/use-drag-selection.js +18 -4
  593. package/src/components/writing-flow/use-selection-observer.js +99 -37
  594. package/src/components/writing-flow/use-tab-nav.js +7 -7
  595. package/src/hooks/align.js +1 -5
  596. package/src/hooks/anchor.js +1 -5
  597. package/src/hooks/aria-label.js +8 -5
  598. package/src/hooks/background.js +253 -21
  599. package/src/hooks/border.js +2 -13
  600. package/src/hooks/color.js +19 -14
  601. package/src/hooks/custom-class-name.js +1 -5
  602. package/src/hooks/custom-class-name.native.js +8 -5
  603. package/src/hooks/dimensions.js +1 -7
  604. package/src/hooks/font-family.js +4 -7
  605. package/src/hooks/font-size.js +1 -6
  606. package/src/hooks/index.js +19 -3
  607. package/src/hooks/index.native.js +17 -4
  608. package/src/hooks/layout.js +5 -2
  609. package/src/hooks/style.js +1 -6
  610. package/src/hooks/test/anchor.js +4 -9
  611. package/src/hooks/test/custom-class-name.js +3 -8
  612. package/src/hooks/test/style.js +4 -14
  613. package/src/hooks/typography.js +1 -7
  614. package/src/hooks/typography.native.js +31 -33
  615. package/src/hooks/use-typography-props.js +7 -1
  616. package/src/hooks/utils.js +60 -2
  617. package/src/private-apis.js +2 -4
  618. package/src/private-apis.native.js +0 -2
  619. package/src/store/actions.js +0 -15
  620. package/src/store/private-actions.js +44 -4
  621. package/src/store/private-selectors.js +11 -0
  622. package/src/store/reducer.js +16 -5
  623. package/src/store/selectors.js +5 -13
  624. package/src/store/undo-ignore.js +4 -0
  625. package/src/store/utils.js +2 -2
  626. package/src/style.scss +1 -0
  627. package/src/utils/get-px-from-css-unit.js +8 -0
  628. package/src/utils/index.js +1 -1
  629. package/src/utils/object.js +0 -35
  630. package/src/utils/test/object.js +1 -96
  631. package/src/utils/use-can-block-toolbar-be-focused.js +48 -0
  632. package/build/components/block-list/block-list-block-context.js +0 -14
  633. package/build/components/block-list/block-list-block-context.js.map +0 -1
  634. package/build/utils/parse-css-unit-to-px.js +0 -302
  635. package/build/utils/parse-css-unit-to-px.js.map +0 -1
  636. package/build/utils/use-should-contextual-toolbar-show.js +0 -63
  637. package/build/utils/use-should-contextual-toolbar-show.js.map +0 -1
  638. package/build-module/components/block-list/block-list-block-context.js +0 -6
  639. package/build-module/components/block-list/block-list-block-context.js.map +0 -1
  640. package/build-module/utils/parse-css-unit-to-px.js +0 -294
  641. package/build-module/utils/parse-css-unit-to-px.js.map +0 -1
  642. package/build-module/utils/use-should-contextual-toolbar-show.js +0 -57
  643. package/build-module/utils/use-should-contextual-toolbar-show.js.map +0 -1
  644. package/src/utils/parse-css-unit-to-px.js +0 -329
  645. package/src/utils/test/parse-css-unit-to-px.js +0 -172
  646. package/src/utils/use-should-contextual-toolbar-show.js +0 -85
@@ -133,9 +133,17 @@ function RichTextWrapper({
133
133
  props = removeNativeProps(props);
134
134
  const anchorRef = (0, _element.useRef)();
135
135
  const {
136
- clientId
136
+ clientId,
137
+ isSelected: isBlockSelected
137
138
  } = (0, _blockEdit.useBlockEditContext)();
138
139
  const selector = select => {
140
+ // Avoid subscribing to the block editor store if the block is not
141
+ // selected.
142
+ if (!isBlockSelected) {
143
+ return {
144
+ isSelected: false
145
+ };
146
+ }
139
147
  const {
140
148
  getSelectionStart,
141
149
  getSelectionEnd
@@ -154,14 +162,11 @@ function RichTextWrapper({
154
162
  isSelected
155
163
  };
156
164
  };
157
- // This selector must run on every render so the right selection state is
158
- // retrieved from the store on merge.
159
- // To do: fix this somehow.
160
165
  const {
161
166
  selectionStart,
162
167
  selectionEnd,
163
168
  isSelected
164
- } = (0, _data.useSelect)(selector);
169
+ } = (0, _data.useSelect)(selector, [clientId, identifier, originalIsSelected, isBlockSelected]);
165
170
  const {
166
171
  getSelectionStart,
167
172
  getSelectionEnd,
@@ -303,7 +308,11 @@ function RichTextWrapper({
303
308
  "aria-label": placeholder,
304
309
  ...props,
305
310
  ...autocompleteProps,
306
- ref: (0, _compose.useMergeRefs)([forwardedRef, autocompleteProps.ref, props.ref, richTextRef, (0, _useBeforeInputRules.useBeforeInputRules)({
311
+ ref: (0, _compose.useMergeRefs)([
312
+ // Rich text ref must be first because its focus listener
313
+ // must be set up before any other ref calls .focus() on
314
+ // mount.
315
+ richTextRef, forwardedRef, autocompleteProps.ref, props.ref, (0, _useBeforeInputRules.useBeforeInputRules)({
307
316
  value,
308
317
  onChange
309
318
  }), (0, _useInputRules.useInputRules)({
@@ -348,7 +357,8 @@ function RichTextWrapper({
348
357
  // tabIndex because Safari will focus the element. However,
349
358
  // Safari will correctly ignore nested contentEditable elements.
350
359
  ,
351
- tabIndex: props.tabIndex === 0 ? null : props.tabIndex
360
+ tabIndex: props.tabIndex === 0 ? null : props.tabIndex,
361
+ "data-wp-block-attribute-key": identifier
352
362
  }));
353
363
  }
354
364
  const ForwardedRichTextContainer = (0, _withDeprecations.withDeprecations)((0, _element.forwardRef)(RichTextWrapper));
@@ -1 +1 @@
1
- {"version":3,"names":["_classnames","_interopRequireDefault","require","_element","_data","_compose","_richText","_components","_autocomplete","_blockEdit","_formatToolbarContainer","_store","_useUndoAutomaticChange","_useMarkPersistent","_usePasteHandler","_useBeforeInputRules","_useInputRules","_useDelete","_useEnter","_useFormatTypes","_useRemoveBrowserShortcuts","_useShortcuts","_useInputEvents","_useInsertReplacementText","_useFirefoxCompat","_formatEdit","_utils","_content","_withDeprecations","_shortcut","_toolbarButton","_inputEvent","keyboardShortcutContext","createContext","exports","inputEventContext","removeNativeProps","props","__unstableMobileNoFocusOnMount","deleteEnter","placeholderTextColor","textAlign","selectionColor","tagsToEliminate","disableEditingMenu","fontSize","fontFamily","fontWeight","fontStyle","minWidth","maxWidth","setRef","disableSuggestions","disableAutocorrection","restProps","RichTextWrapper","children","tagName","value","adjustedValue","onChange","adjustedOnChange","isSelected","originalIsSelected","multiline","inlineToolbar","wrapperClassName","autocompleters","onReplace","placeholder","allowedFormats","withoutInteractiveFormatting","onRemove","onMerge","onSplit","__unstableOnSplitAtEnd","onSplitAtEnd","__unstableOnSplitAtDoubleLineEnd","onSplitAtDoubleLineEnd","identifier","preserveWhiteSpace","__unstablePastePlainText","pastePlainText","__unstableEmbedURLOnPaste","__unstableDisableFormats","disableFormats","disableLineBreaks","__unstableAllowPrefixTransformations","forwardedRef","anchorRef","useRef","clientId","useBlockEditContext","selector","select","getSelectionStart","getSelectionEnd","blockEditorStore","selectionStart","selectionEnd","undefined","attributeKey","offset","useSelect","getBlockRootClientId","selectionChange","useDispatch","adjustedAllowedFormats","getAllowedFormats","hasFormats","length","onSelectionChange","useCallback","start","end","selection","unset","formatTypes","prepareHandlers","valueHandlers","changeHandlers","dependencies","useFormatTypes","addEditorOnlyFormats","reduce","accumulator","fn","text","formats","removeEditorOnlyFormats","forEach","formatType","__experimentalCreatePrepareEditableTree","removeFormat","name","addInvisibleFormats","getValue","ref","richTextRef","useRichText","html","__unstableFormats","__unstableText","Object","values","changeHandler","__unstableIsSelected","__unstableDependencies","__unstableAfterParse","__unstableBeforeSerialize","__unstableAddInvisibleFormats","autocompleteProps","useBlockEditorAutocompleteProps","completers","record","useMarkPersistent","keyboardShortcuts","Set","inputEvents","onFocus","current","focus","TagName","_react","createElement","Fragment","Provider","Popover","__unstableSlotNameProvider","default","inline","editableContentElement","role","useMergeRefs","useBeforeInputRules","useInputRules","useInsertReplacementText","useRemoveBrowserShortcuts","useShortcuts","useInputEvents","useUndoAutomaticChange","usePasteHandler","useDelete","useEnter","useFirefoxCompat","contentEditable","suppressContentEditableWarning","className","classnames","tabIndex","ForwardedRichTextContainer","withDeprecations","forwardRef","Content","isEmpty","_default"],"sources":["@wordpress/block-editor/src/components/rich-text/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tuseRef,\n\tuseCallback,\n\tforwardRef,\n\tcreateContext,\n} from '@wordpress/element';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { useMergeRefs } from '@wordpress/compose';\nimport {\n\t__unstableUseRichText as useRichText,\n\tremoveFormat,\n} from '@wordpress/rich-text';\nimport { Popover } from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport { useBlockEditorAutocompleteProps } from '../autocomplete';\nimport { useBlockEditContext } from '../block-edit';\nimport FormatToolbarContainer from './format-toolbar-container';\nimport { store as blockEditorStore } from '../../store';\nimport { useUndoAutomaticChange } from './use-undo-automatic-change';\nimport { useMarkPersistent } from './use-mark-persistent';\nimport { usePasteHandler } from './use-paste-handler';\nimport { useBeforeInputRules } from './use-before-input-rules';\nimport { useInputRules } from './use-input-rules';\nimport { useDelete } from './use-delete';\nimport { useEnter } from './use-enter';\nimport { useFormatTypes } from './use-format-types';\nimport { useRemoveBrowserShortcuts } from './use-remove-browser-shortcuts';\nimport { useShortcuts } from './use-shortcuts';\nimport { useInputEvents } from './use-input-events';\nimport { useInsertReplacementText } from './use-insert-replacement-text';\nimport { useFirefoxCompat } from './use-firefox-compat';\nimport FormatEdit from './format-edit';\nimport { getAllowedFormats } from './utils';\nimport { Content } from './content';\nimport { withDeprecations } from './with-deprecations';\n\nexport const keyboardShortcutContext = createContext();\nexport const inputEventContext = createContext();\n\n/**\n * Removes props used for the native version of RichText so that they are not\n * passed to the DOM element and log warnings.\n *\n * @param {Object} props Props to filter.\n *\n * @return {Object} Filtered props.\n */\nfunction removeNativeProps( props ) {\n\tconst {\n\t\t__unstableMobileNoFocusOnMount,\n\t\tdeleteEnter,\n\t\tplaceholderTextColor,\n\t\ttextAlign,\n\t\tselectionColor,\n\t\ttagsToEliminate,\n\t\tdisableEditingMenu,\n\t\tfontSize,\n\t\tfontFamily,\n\t\tfontWeight,\n\t\tfontStyle,\n\t\tminWidth,\n\t\tmaxWidth,\n\t\tsetRef,\n\t\tdisableSuggestions,\n\t\tdisableAutocorrection,\n\t\t...restProps\n\t} = props;\n\treturn restProps;\n}\n\nexport function RichTextWrapper(\n\t{\n\t\tchildren,\n\t\ttagName = 'div',\n\t\tvalue: adjustedValue = '',\n\t\tonChange: adjustedOnChange,\n\t\tisSelected: originalIsSelected,\n\t\tmultiline,\n\t\tinlineToolbar,\n\t\twrapperClassName,\n\t\tautocompleters,\n\t\tonReplace,\n\t\tplaceholder,\n\t\tallowedFormats,\n\t\twithoutInteractiveFormatting,\n\t\tonRemove,\n\t\tonMerge,\n\t\tonSplit,\n\t\t__unstableOnSplitAtEnd: onSplitAtEnd,\n\t\t__unstableOnSplitAtDoubleLineEnd: onSplitAtDoubleLineEnd,\n\t\tidentifier,\n\t\tpreserveWhiteSpace,\n\t\t__unstablePastePlainText: pastePlainText,\n\t\t__unstableEmbedURLOnPaste,\n\t\t__unstableDisableFormats: disableFormats,\n\t\tdisableLineBreaks,\n\t\t__unstableAllowPrefixTransformations,\n\t\t...props\n\t},\n\tforwardedRef\n) {\n\tprops = removeNativeProps( props );\n\n\tconst anchorRef = useRef();\n\tconst { clientId } = useBlockEditContext();\n\tconst selector = ( select ) => {\n\t\tconst { getSelectionStart, getSelectionEnd } =\n\t\t\tselect( blockEditorStore );\n\t\tconst selectionStart = getSelectionStart();\n\t\tconst selectionEnd = getSelectionEnd();\n\n\t\tlet isSelected;\n\n\t\tif ( originalIsSelected === undefined ) {\n\t\t\tisSelected =\n\t\t\t\tselectionStart.clientId === clientId &&\n\t\t\t\tselectionEnd.clientId === clientId &&\n\t\t\t\tselectionStart.attributeKey === identifier;\n\t\t} else if ( originalIsSelected ) {\n\t\t\tisSelected = selectionStart.clientId === clientId;\n\t\t}\n\n\t\treturn {\n\t\t\tselectionStart: isSelected ? selectionStart.offset : undefined,\n\t\t\tselectionEnd: isSelected ? selectionEnd.offset : undefined,\n\t\t\tisSelected,\n\t\t};\n\t};\n\t// This selector must run on every render so the right selection state is\n\t// retrieved from the store on merge.\n\t// To do: fix this somehow.\n\tconst { selectionStart, selectionEnd, isSelected } = useSelect( selector );\n\tconst { getSelectionStart, getSelectionEnd, getBlockRootClientId } =\n\t\tuseSelect( blockEditorStore );\n\tconst { selectionChange } = useDispatch( blockEditorStore );\n\tconst adjustedAllowedFormats = getAllowedFormats( {\n\t\tallowedFormats,\n\t\tdisableFormats,\n\t} );\n\tconst hasFormats =\n\t\t! adjustedAllowedFormats || adjustedAllowedFormats.length > 0;\n\n\tconst onSelectionChange = useCallback(\n\t\t( start, end ) => {\n\t\t\tconst selection = {};\n\t\t\tconst unset = start === undefined && end === undefined;\n\n\t\t\tif ( typeof start === 'number' || unset ) {\n\t\t\t\t// If we are only setting the start (or the end below), which\n\t\t\t\t// means a partial selection, and we're not updating a selection\n\t\t\t\t// with the same client ID, abort. This means the selected block\n\t\t\t\t// is a parent block.\n\t\t\t\tif (\n\t\t\t\t\tend === undefined &&\n\t\t\t\t\tgetBlockRootClientId( clientId ) !==\n\t\t\t\t\t\tgetBlockRootClientId( getSelectionEnd().clientId )\n\t\t\t\t) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tselection.start = {\n\t\t\t\t\tclientId,\n\t\t\t\t\tattributeKey: identifier,\n\t\t\t\t\toffset: start,\n\t\t\t\t};\n\t\t\t}\n\n\t\t\tif ( typeof end === 'number' || unset ) {\n\t\t\t\tif (\n\t\t\t\t\tstart === undefined &&\n\t\t\t\t\tgetBlockRootClientId( clientId ) !==\n\t\t\t\t\t\tgetBlockRootClientId( getSelectionStart().clientId )\n\t\t\t\t) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tselection.end = {\n\t\t\t\t\tclientId,\n\t\t\t\t\tattributeKey: identifier,\n\t\t\t\t\toffset: end,\n\t\t\t\t};\n\t\t\t}\n\n\t\t\tselectionChange( selection );\n\t\t},\n\t\t[ clientId, identifier ]\n\t);\n\n\tconst {\n\t\tformatTypes,\n\t\tprepareHandlers,\n\t\tvalueHandlers,\n\t\tchangeHandlers,\n\t\tdependencies,\n\t} = useFormatTypes( {\n\t\tclientId,\n\t\tidentifier,\n\t\twithoutInteractiveFormatting,\n\t\tallowedFormats: adjustedAllowedFormats,\n\t} );\n\n\tfunction addEditorOnlyFormats( value ) {\n\t\treturn valueHandlers.reduce(\n\t\t\t( accumulator, fn ) => fn( accumulator, value.text ),\n\t\t\tvalue.formats\n\t\t);\n\t}\n\n\tfunction removeEditorOnlyFormats( value ) {\n\t\tformatTypes.forEach( ( formatType ) => {\n\t\t\t// Remove formats created by prepareEditableTree, because they are editor only.\n\t\t\tif ( formatType.__experimentalCreatePrepareEditableTree ) {\n\t\t\t\tvalue = removeFormat(\n\t\t\t\t\tvalue,\n\t\t\t\t\tformatType.name,\n\t\t\t\t\t0,\n\t\t\t\t\tvalue.text.length\n\t\t\t\t);\n\t\t\t}\n\t\t} );\n\n\t\treturn value.formats;\n\t}\n\n\tfunction addInvisibleFormats( value ) {\n\t\treturn prepareHandlers.reduce(\n\t\t\t( accumulator, fn ) => fn( accumulator, value.text ),\n\t\t\tvalue.formats\n\t\t);\n\t}\n\n\tconst {\n\t\tvalue,\n\t\tgetValue,\n\t\tonChange,\n\t\tref: richTextRef,\n\t} = useRichText( {\n\t\tvalue: adjustedValue,\n\t\tonChange( html, { __unstableFormats, __unstableText } ) {\n\t\t\tadjustedOnChange( html );\n\t\t\tObject.values( changeHandlers ).forEach( ( changeHandler ) => {\n\t\t\t\tchangeHandler( __unstableFormats, __unstableText );\n\t\t\t} );\n\t\t},\n\t\tselectionStart,\n\t\tselectionEnd,\n\t\tonSelectionChange,\n\t\tplaceholder,\n\t\t__unstableIsSelected: isSelected,\n\t\t__unstableDisableFormats: disableFormats,\n\t\tpreserveWhiteSpace,\n\t\t__unstableDependencies: [ ...dependencies, tagName ],\n\t\t__unstableAfterParse: addEditorOnlyFormats,\n\t\t__unstableBeforeSerialize: removeEditorOnlyFormats,\n\t\t__unstableAddInvisibleFormats: addInvisibleFormats,\n\t} );\n\tconst autocompleteProps = useBlockEditorAutocompleteProps( {\n\t\tonReplace,\n\t\tcompleters: autocompleters,\n\t\trecord: value,\n\t\tonChange,\n\t} );\n\n\tuseMarkPersistent( { html: adjustedValue, value } );\n\n\tconst keyboardShortcuts = useRef( new Set() );\n\tconst inputEvents = useRef( new Set() );\n\n\tfunction onFocus() {\n\t\tanchorRef.current?.focus();\n\t}\n\n\tconst TagName = tagName;\n\treturn (\n\t\t<>\n\t\t\t{ isSelected && (\n\t\t\t\t<keyboardShortcutContext.Provider value={ keyboardShortcuts }>\n\t\t\t\t\t<inputEventContext.Provider value={ inputEvents }>\n\t\t\t\t\t\t<Popover.__unstableSlotNameProvider value=\"__unstable-block-tools-after\">\n\t\t\t\t\t\t\t{ children &&\n\t\t\t\t\t\t\t\tchildren( { value, onChange, onFocus } ) }\n\n\t\t\t\t\t\t\t<FormatEdit\n\t\t\t\t\t\t\t\tvalue={ value }\n\t\t\t\t\t\t\t\tonChange={ onChange }\n\t\t\t\t\t\t\t\tonFocus={ onFocus }\n\t\t\t\t\t\t\t\tformatTypes={ formatTypes }\n\t\t\t\t\t\t\t\tforwardedRef={ anchorRef }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</Popover.__unstableSlotNameProvider>\n\t\t\t\t\t</inputEventContext.Provider>\n\t\t\t\t</keyboardShortcutContext.Provider>\n\t\t\t) }\n\t\t\t{ isSelected && hasFormats && (\n\t\t\t\t<FormatToolbarContainer\n\t\t\t\t\tinline={ inlineToolbar }\n\t\t\t\t\teditableContentElement={ anchorRef.current }\n\t\t\t\t\tvalue={ value }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t<TagName\n\t\t\t\t// Overridable props.\n\t\t\t\trole=\"textbox\"\n\t\t\t\taria-multiline={ ! disableLineBreaks }\n\t\t\t\taria-label={ placeholder }\n\t\t\t\t{ ...props }\n\t\t\t\t{ ...autocompleteProps }\n\t\t\t\tref={ useMergeRefs( [\n\t\t\t\t\tforwardedRef,\n\t\t\t\t\tautocompleteProps.ref,\n\t\t\t\t\tprops.ref,\n\t\t\t\t\trichTextRef,\n\t\t\t\t\tuseBeforeInputRules( { value, onChange } ),\n\t\t\t\t\tuseInputRules( {\n\t\t\t\t\t\tgetValue,\n\t\t\t\t\t\tonChange,\n\t\t\t\t\t\t__unstableAllowPrefixTransformations,\n\t\t\t\t\t\tformatTypes,\n\t\t\t\t\t\tonReplace,\n\t\t\t\t\t\tselectionChange,\n\t\t\t\t\t} ),\n\t\t\t\t\tuseInsertReplacementText(),\n\t\t\t\t\tuseRemoveBrowserShortcuts(),\n\t\t\t\t\tuseShortcuts( keyboardShortcuts ),\n\t\t\t\t\tuseInputEvents( inputEvents ),\n\t\t\t\t\tuseUndoAutomaticChange(),\n\t\t\t\t\tusePasteHandler( {\n\t\t\t\t\t\tisSelected,\n\t\t\t\t\t\tdisableFormats,\n\t\t\t\t\t\tonChange,\n\t\t\t\t\t\tvalue,\n\t\t\t\t\t\tformatTypes,\n\t\t\t\t\t\ttagName,\n\t\t\t\t\t\tonReplace,\n\t\t\t\t\t\tonSplit,\n\t\t\t\t\t\t__unstableEmbedURLOnPaste,\n\t\t\t\t\t\tpastePlainText,\n\t\t\t\t\t} ),\n\t\t\t\t\tuseDelete( {\n\t\t\t\t\t\tvalue,\n\t\t\t\t\t\tonMerge,\n\t\t\t\t\t\tonRemove,\n\t\t\t\t\t} ),\n\t\t\t\t\tuseEnter( {\n\t\t\t\t\t\tremoveEditorOnlyFormats,\n\t\t\t\t\t\tvalue,\n\t\t\t\t\t\tonReplace,\n\t\t\t\t\t\tonSplit,\n\t\t\t\t\t\tonChange,\n\t\t\t\t\t\tdisableLineBreaks,\n\t\t\t\t\t\tonSplitAtEnd,\n\t\t\t\t\t\tonSplitAtDoubleLineEnd,\n\t\t\t\t\t} ),\n\t\t\t\t\tuseFirefoxCompat(),\n\t\t\t\t\tanchorRef,\n\t\t\t\t] ) }\n\t\t\t\tcontentEditable={ true }\n\t\t\t\tsuppressContentEditableWarning={ true }\n\t\t\t\tclassName={ classnames(\n\t\t\t\t\t'block-editor-rich-text__editable',\n\t\t\t\t\tprops.className,\n\t\t\t\t\t'rich-text'\n\t\t\t\t) }\n\t\t\t\t// Setting tabIndex to 0 is unnecessary, the element is already\n\t\t\t\t// focusable because it's contentEditable. This also fixes a\n\t\t\t\t// Safari bug where it's not possible to Shift+Click multi\n\t\t\t\t// select blocks when Shift Clicking into an element with\n\t\t\t\t// tabIndex because Safari will focus the element. However,\n\t\t\t\t// Safari will correctly ignore nested contentEditable elements.\n\t\t\t\ttabIndex={ props.tabIndex === 0 ? null : props.tabIndex }\n\t\t\t/>\n\t\t</>\n\t);\n}\n\nconst ForwardedRichTextContainer = withDeprecations(\n\tforwardRef( RichTextWrapper )\n);\n\nForwardedRichTextContainer.Content = Content;\nForwardedRichTextContainer.isEmpty = ( value ) => {\n\treturn ! value || value.length === 0;\n};\n\n/**\n * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/rich-text/README.md\n */\nexport default ForwardedRichTextContainer;\nexport { RichTextShortcut } from './shortcut';\nexport { RichTextToolbarButton } from './toolbar-button';\nexport { __unstableRichTextInputEvent } from './input-event';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA,IAAAA,WAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,QAAA,GAAAD,OAAA;AAMA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AACA,IAAAI,SAAA,GAAAJ,OAAA;AAIA,IAAAK,WAAA,GAAAL,OAAA;AAKA,IAAAM,aAAA,GAAAN,OAAA;AACA,IAAAO,UAAA,GAAAP,OAAA;AACA,IAAAQ,uBAAA,GAAAT,sBAAA,CAAAC,OAAA;AACA,IAAAS,MAAA,GAAAT,OAAA;AACA,IAAAU,uBAAA,GAAAV,OAAA;AACA,IAAAW,kBAAA,GAAAX,OAAA;AACA,IAAAY,gBAAA,GAAAZ,OAAA;AACA,IAAAa,oBAAA,GAAAb,OAAA;AACA,IAAAc,cAAA,GAAAd,OAAA;AACA,IAAAe,UAAA,GAAAf,OAAA;AACA,IAAAgB,SAAA,GAAAhB,OAAA;AACA,IAAAiB,eAAA,GAAAjB,OAAA;AACA,IAAAkB,0BAAA,GAAAlB,OAAA;AACA,IAAAmB,aAAA,GAAAnB,OAAA;AACA,IAAAoB,eAAA,GAAApB,OAAA;AACA,IAAAqB,yBAAA,G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IAAAsB,8CAAsB,EAAC,CAAC,EACxB,IAAAC,gCAAe,EAAE;MAChBvH,UAAU;MACVuB,cAAc;MACdzB,QAAQ;MACRF,KAAK;MACL2D,WAAW;MACX5D,OAAO;MACPW,SAAS;MACTM,OAAO;MACPS,yBAAyB;MACzBD;IACD,CAAE,CAAC,EACH,IAAAoG,oBAAS,EAAE;MACV5H,KAAK;MACLe,OAAO;MACPD;IACD,CAAE,CAAC,EACH,IAAA+G,kBAAQ,EAAE;MACTtD,uBAAuB;MACvBvE,KAAK;MACLU,SAAS;MACTM,OAAO;MACPd,QAAQ;MACR0B,iBAAiB;MACjBV,YAAY;MACZE;IACD,CAAE,CAAC,EACH,IAAA0G,kCAAgB,EAAC,CAAC,EAClB/F,SAAS,CACR,CAAG;IACLgG,eAAe,EAAG,IAAM;IACxBC,8BAA8B,EAAG,IAAM;IACvCC,SAAS,EAAG,IAAAC,mBAAU,EACrB,kCAAkC,EAClCvJ,KAAK,CAACsJ,SAAS,EACf,WACD;IACA;IACA;IACA;IACA;IACA;IACA;IAAA;IACAE,QAAQ,EAAGxJ,KAAK,CAACwJ,QAAQ,KAAK,CAAC,GAAG,IAAI,GAAGxJ,KAAK,CAACwJ;EAAU,CACzD,CACA,CAAC;AAEL;AAEA,MAAMC,0BAA0B,GAAG,IAAAC,kCAAgB,EAClD,IAAAC,mBAAU,EAAEzI,eAAgB,CAC7B,CAAC;AAEDuI,0BAA0B,CAACG,OAAO,GAAGA,gBAAO;AAC5CH,0BAA0B,CAACI,OAAO,GAAKxI,KAAK,IAAM;EACjD,OAAO,CAAEA,KAAK,IAAIA,KAAK,CAACoD,MAAM,KAAK,CAAC;AACrC,CAAC;;AAED;AACA;AACA;AAFA,IAAAqF,QAAA,GAGeL,0BAA0B;AAAA5J,OAAA,CAAAuI,OAAA,GAAA0B,QAAA"}
1
+ {"version":3,"names":["_classnames","_interopRequireDefault","require","_element","_data","_compose","_richText","_components","_autocomplete","_blockEdit","_formatToolbarContainer","_store","_useUndoAutomaticChange","_useMarkPersistent","_usePasteHandler","_useBeforeInputRules","_useInputRules","_useDelete","_useEnter","_useFormatTypes","_useRemoveBrowserShortcuts","_useShortcuts","_useInputEvents","_useInsertReplacementText","_useFirefoxCompat","_formatEdit","_utils","_content","_withDeprecations","_shortcut","_toolbarButton","_inputEvent","keyboardShortcutContext","createContext","exports","inputEventContext","removeNativeProps","props","__unstableMobileNoFocusOnMount","deleteEnter","placeholderTextColor","textAlign","selectionColor","tagsToEliminate","disableEditingMenu","fontSize","fontFamily","fontWeight","fontStyle","minWidth","maxWidth","setRef","disableSuggestions","disableAutocorrection","restProps","RichTextWrapper","children","tagName","value","adjustedValue","onChange","adjustedOnChange","isSelected","originalIsSelected","multiline","inlineToolbar","wrapperClassName","autocompleters","onReplace","placeholder","allowedFormats","withoutInteractiveFormatting","onRemove","onMerge","onSplit","__unstableOnSplitAtEnd","onSplitAtEnd","__unstableOnSplitAtDoubleLineEnd","onSplitAtDoubleLineEnd","identifier","preserveWhiteSpace","__unstablePastePlainText","pastePlainText","__unstableEmbedURLOnPaste","__unstableDisableFormats","disableFormats","disableLineBreaks","__unstableAllowPrefixTransformations","forwardedRef","anchorRef","useRef","clientId","isBlockSelected","useBlockEditContext","selector","select","getSelectionStart","getSelectionEnd","blockEditorStore","selectionStart","selectionEnd","undefined","attributeKey","offset","useSelect","getBlockRootClientId","selectionChange","useDispatch","adjustedAllowedFormats","getAllowedFormats","hasFormats","length","onSelectionChange","useCallback","start","end","selection","unset","formatTypes","prepareHandlers","valueHandlers","changeHandlers","dependencies","useFormatTypes","addEditorOnlyFormats","reduce","accumulator","fn","text","formats","removeEditorOnlyFormats","forEach","formatType","__experimentalCreatePrepareEditableTree","removeFormat","name","addInvisibleFormats","getValue","ref","richTextRef","useRichText","html","__unstableFormats","__unstableText","Object","values","changeHandler","__unstableIsSelected","__unstableDependencies","__unstableAfterParse","__unstableBeforeSerialize","__unstableAddInvisibleFormats","autocompleteProps","useBlockEditorAutocompleteProps","completers","record","useMarkPersistent","keyboardShortcuts","Set","inputEvents","onFocus","current","focus","TagName","_react","createElement","Fragment","Provider","Popover","__unstableSlotNameProvider","default","inline","editableContentElement","role","useMergeRefs","useBeforeInputRules","useInputRules","useInsertReplacementText","useRemoveBrowserShortcuts","useShortcuts","useInputEvents","useUndoAutomaticChange","usePasteHandler","useDelete","useEnter","useFirefoxCompat","contentEditable","suppressContentEditableWarning","className","classnames","tabIndex","ForwardedRichTextContainer","withDeprecations","forwardRef","Content","isEmpty","_default"],"sources":["@wordpress/block-editor/src/components/rich-text/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tuseRef,\n\tuseCallback,\n\tforwardRef,\n\tcreateContext,\n} from '@wordpress/element';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { useMergeRefs } from '@wordpress/compose';\nimport {\n\t__unstableUseRichText as useRichText,\n\tremoveFormat,\n} from '@wordpress/rich-text';\nimport { Popover } from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport { useBlockEditorAutocompleteProps } from '../autocomplete';\nimport { useBlockEditContext } from '../block-edit';\nimport FormatToolbarContainer from './format-toolbar-container';\nimport { store as blockEditorStore } from '../../store';\nimport { useUndoAutomaticChange } from './use-undo-automatic-change';\nimport { useMarkPersistent } from './use-mark-persistent';\nimport { usePasteHandler } from './use-paste-handler';\nimport { useBeforeInputRules } from './use-before-input-rules';\nimport { useInputRules } from './use-input-rules';\nimport { useDelete } from './use-delete';\nimport { useEnter } from './use-enter';\nimport { useFormatTypes } from './use-format-types';\nimport { useRemoveBrowserShortcuts } from './use-remove-browser-shortcuts';\nimport { useShortcuts } from './use-shortcuts';\nimport { useInputEvents } from './use-input-events';\nimport { useInsertReplacementText } from './use-insert-replacement-text';\nimport { useFirefoxCompat } from './use-firefox-compat';\nimport FormatEdit from './format-edit';\nimport { getAllowedFormats } from './utils';\nimport { Content } from './content';\nimport { withDeprecations } from './with-deprecations';\n\nexport const keyboardShortcutContext = createContext();\nexport const inputEventContext = createContext();\n\n/**\n * Removes props used for the native version of RichText so that they are not\n * passed to the DOM element and log warnings.\n *\n * @param {Object} props Props to filter.\n *\n * @return {Object} Filtered props.\n */\nfunction removeNativeProps( props ) {\n\tconst {\n\t\t__unstableMobileNoFocusOnMount,\n\t\tdeleteEnter,\n\t\tplaceholderTextColor,\n\t\ttextAlign,\n\t\tselectionColor,\n\t\ttagsToEliminate,\n\t\tdisableEditingMenu,\n\t\tfontSize,\n\t\tfontFamily,\n\t\tfontWeight,\n\t\tfontStyle,\n\t\tminWidth,\n\t\tmaxWidth,\n\t\tsetRef,\n\t\tdisableSuggestions,\n\t\tdisableAutocorrection,\n\t\t...restProps\n\t} = props;\n\treturn restProps;\n}\n\nexport function RichTextWrapper(\n\t{\n\t\tchildren,\n\t\ttagName = 'div',\n\t\tvalue: adjustedValue = '',\n\t\tonChange: adjustedOnChange,\n\t\tisSelected: originalIsSelected,\n\t\tmultiline,\n\t\tinlineToolbar,\n\t\twrapperClassName,\n\t\tautocompleters,\n\t\tonReplace,\n\t\tplaceholder,\n\t\tallowedFormats,\n\t\twithoutInteractiveFormatting,\n\t\tonRemove,\n\t\tonMerge,\n\t\tonSplit,\n\t\t__unstableOnSplitAtEnd: onSplitAtEnd,\n\t\t__unstableOnSplitAtDoubleLineEnd: onSplitAtDoubleLineEnd,\n\t\tidentifier,\n\t\tpreserveWhiteSpace,\n\t\t__unstablePastePlainText: pastePlainText,\n\t\t__unstableEmbedURLOnPaste,\n\t\t__unstableDisableFormats: disableFormats,\n\t\tdisableLineBreaks,\n\t\t__unstableAllowPrefixTransformations,\n\t\t...props\n\t},\n\tforwardedRef\n) {\n\tprops = removeNativeProps( props );\n\n\tconst anchorRef = useRef();\n\tconst { clientId, isSelected: isBlockSelected } = useBlockEditContext();\n\tconst selector = ( select ) => {\n\t\t// Avoid subscribing to the block editor store if the block is not\n\t\t// selected.\n\t\tif ( ! isBlockSelected ) {\n\t\t\treturn { isSelected: false };\n\t\t}\n\n\t\tconst { getSelectionStart, getSelectionEnd } =\n\t\t\tselect( blockEditorStore );\n\t\tconst selectionStart = getSelectionStart();\n\t\tconst selectionEnd = getSelectionEnd();\n\n\t\tlet isSelected;\n\n\t\tif ( originalIsSelected === undefined ) {\n\t\t\tisSelected =\n\t\t\t\tselectionStart.clientId === clientId &&\n\t\t\t\tselectionEnd.clientId === clientId &&\n\t\t\t\tselectionStart.attributeKey === identifier;\n\t\t} else if ( originalIsSelected ) {\n\t\t\tisSelected = selectionStart.clientId === clientId;\n\t\t}\n\n\t\treturn {\n\t\t\tselectionStart: isSelected ? selectionStart.offset : undefined,\n\t\t\tselectionEnd: isSelected ? selectionEnd.offset : undefined,\n\t\t\tisSelected,\n\t\t};\n\t};\n\tconst { selectionStart, selectionEnd, isSelected } = useSelect( selector, [\n\t\tclientId,\n\t\tidentifier,\n\t\toriginalIsSelected,\n\t\tisBlockSelected,\n\t] );\n\tconst { getSelectionStart, getSelectionEnd, getBlockRootClientId } =\n\t\tuseSelect( blockEditorStore );\n\tconst { selectionChange } = useDispatch( blockEditorStore );\n\tconst adjustedAllowedFormats = getAllowedFormats( {\n\t\tallowedFormats,\n\t\tdisableFormats,\n\t} );\n\tconst hasFormats =\n\t\t! adjustedAllowedFormats || adjustedAllowedFormats.length > 0;\n\n\tconst onSelectionChange = useCallback(\n\t\t( start, end ) => {\n\t\t\tconst selection = {};\n\t\t\tconst unset = start === undefined && end === undefined;\n\n\t\t\tif ( typeof start === 'number' || unset ) {\n\t\t\t\t// If we are only setting the start (or the end below), which\n\t\t\t\t// means a partial selection, and we're not updating a selection\n\t\t\t\t// with the same client ID, abort. This means the selected block\n\t\t\t\t// is a parent block.\n\t\t\t\tif (\n\t\t\t\t\tend === undefined &&\n\t\t\t\t\tgetBlockRootClientId( clientId ) !==\n\t\t\t\t\t\tgetBlockRootClientId( getSelectionEnd().clientId )\n\t\t\t\t) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tselection.start = {\n\t\t\t\t\tclientId,\n\t\t\t\t\tattributeKey: identifier,\n\t\t\t\t\toffset: start,\n\t\t\t\t};\n\t\t\t}\n\n\t\t\tif ( typeof end === 'number' || unset ) {\n\t\t\t\tif (\n\t\t\t\t\tstart === undefined &&\n\t\t\t\t\tgetBlockRootClientId( clientId ) !==\n\t\t\t\t\t\tgetBlockRootClientId( getSelectionStart().clientId )\n\t\t\t\t) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tselection.end = {\n\t\t\t\t\tclientId,\n\t\t\t\t\tattributeKey: identifier,\n\t\t\t\t\toffset: end,\n\t\t\t\t};\n\t\t\t}\n\n\t\t\tselectionChange( selection );\n\t\t},\n\t\t[ clientId, identifier ]\n\t);\n\n\tconst {\n\t\tformatTypes,\n\t\tprepareHandlers,\n\t\tvalueHandlers,\n\t\tchangeHandlers,\n\t\tdependencies,\n\t} = useFormatTypes( {\n\t\tclientId,\n\t\tidentifier,\n\t\twithoutInteractiveFormatting,\n\t\tallowedFormats: adjustedAllowedFormats,\n\t} );\n\n\tfunction addEditorOnlyFormats( value ) {\n\t\treturn valueHandlers.reduce(\n\t\t\t( accumulator, fn ) => fn( accumulator, value.text ),\n\t\t\tvalue.formats\n\t\t);\n\t}\n\n\tfunction removeEditorOnlyFormats( value ) {\n\t\tformatTypes.forEach( ( formatType ) => {\n\t\t\t// Remove formats created by prepareEditableTree, because they are editor only.\n\t\t\tif ( formatType.__experimentalCreatePrepareEditableTree ) {\n\t\t\t\tvalue = removeFormat(\n\t\t\t\t\tvalue,\n\t\t\t\t\tformatType.name,\n\t\t\t\t\t0,\n\t\t\t\t\tvalue.text.length\n\t\t\t\t);\n\t\t\t}\n\t\t} );\n\n\t\treturn value.formats;\n\t}\n\n\tfunction addInvisibleFormats( value ) {\n\t\treturn prepareHandlers.reduce(\n\t\t\t( accumulator, fn ) => fn( accumulator, value.text ),\n\t\t\tvalue.formats\n\t\t);\n\t}\n\n\tconst {\n\t\tvalue,\n\t\tgetValue,\n\t\tonChange,\n\t\tref: richTextRef,\n\t} = useRichText( {\n\t\tvalue: adjustedValue,\n\t\tonChange( html, { __unstableFormats, __unstableText } ) {\n\t\t\tadjustedOnChange( html );\n\t\t\tObject.values( changeHandlers ).forEach( ( changeHandler ) => {\n\t\t\t\tchangeHandler( __unstableFormats, __unstableText );\n\t\t\t} );\n\t\t},\n\t\tselectionStart,\n\t\tselectionEnd,\n\t\tonSelectionChange,\n\t\tplaceholder,\n\t\t__unstableIsSelected: isSelected,\n\t\t__unstableDisableFormats: disableFormats,\n\t\tpreserveWhiteSpace,\n\t\t__unstableDependencies: [ ...dependencies, tagName ],\n\t\t__unstableAfterParse: addEditorOnlyFormats,\n\t\t__unstableBeforeSerialize: removeEditorOnlyFormats,\n\t\t__unstableAddInvisibleFormats: addInvisibleFormats,\n\t} );\n\tconst autocompleteProps = useBlockEditorAutocompleteProps( {\n\t\tonReplace,\n\t\tcompleters: autocompleters,\n\t\trecord: value,\n\t\tonChange,\n\t} );\n\n\tuseMarkPersistent( { html: adjustedValue, value } );\n\n\tconst keyboardShortcuts = useRef( new Set() );\n\tconst inputEvents = useRef( new Set() );\n\n\tfunction onFocus() {\n\t\tanchorRef.current?.focus();\n\t}\n\n\tconst TagName = tagName;\n\treturn (\n\t\t<>\n\t\t\t{ isSelected && (\n\t\t\t\t<keyboardShortcutContext.Provider value={ keyboardShortcuts }>\n\t\t\t\t\t<inputEventContext.Provider value={ inputEvents }>\n\t\t\t\t\t\t<Popover.__unstableSlotNameProvider value=\"__unstable-block-tools-after\">\n\t\t\t\t\t\t\t{ children &&\n\t\t\t\t\t\t\t\tchildren( { value, onChange, onFocus } ) }\n\n\t\t\t\t\t\t\t<FormatEdit\n\t\t\t\t\t\t\t\tvalue={ value }\n\t\t\t\t\t\t\t\tonChange={ onChange }\n\t\t\t\t\t\t\t\tonFocus={ onFocus }\n\t\t\t\t\t\t\t\tformatTypes={ formatTypes }\n\t\t\t\t\t\t\t\tforwardedRef={ anchorRef }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</Popover.__unstableSlotNameProvider>\n\t\t\t\t\t</inputEventContext.Provider>\n\t\t\t\t</keyboardShortcutContext.Provider>\n\t\t\t) }\n\t\t\t{ isSelected && hasFormats && (\n\t\t\t\t<FormatToolbarContainer\n\t\t\t\t\tinline={ inlineToolbar }\n\t\t\t\t\teditableContentElement={ anchorRef.current }\n\t\t\t\t\tvalue={ value }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t<TagName\n\t\t\t\t// Overridable props.\n\t\t\t\trole=\"textbox\"\n\t\t\t\taria-multiline={ ! disableLineBreaks }\n\t\t\t\taria-label={ placeholder }\n\t\t\t\t{ ...props }\n\t\t\t\t{ ...autocompleteProps }\n\t\t\t\tref={ useMergeRefs( [\n\t\t\t\t\t// Rich text ref must be first because its focus listener\n\t\t\t\t\t// must be set up before any other ref calls .focus() on\n\t\t\t\t\t// mount.\n\t\t\t\t\trichTextRef,\n\t\t\t\t\tforwardedRef,\n\t\t\t\t\tautocompleteProps.ref,\n\t\t\t\t\tprops.ref,\n\t\t\t\t\tuseBeforeInputRules( { value, onChange } ),\n\t\t\t\t\tuseInputRules( {\n\t\t\t\t\t\tgetValue,\n\t\t\t\t\t\tonChange,\n\t\t\t\t\t\t__unstableAllowPrefixTransformations,\n\t\t\t\t\t\tformatTypes,\n\t\t\t\t\t\tonReplace,\n\t\t\t\t\t\tselectionChange,\n\t\t\t\t\t} ),\n\t\t\t\t\tuseInsertReplacementText(),\n\t\t\t\t\tuseRemoveBrowserShortcuts(),\n\t\t\t\t\tuseShortcuts( keyboardShortcuts ),\n\t\t\t\t\tuseInputEvents( inputEvents ),\n\t\t\t\t\tuseUndoAutomaticChange(),\n\t\t\t\t\tusePasteHandler( {\n\t\t\t\t\t\tisSelected,\n\t\t\t\t\t\tdisableFormats,\n\t\t\t\t\t\tonChange,\n\t\t\t\t\t\tvalue,\n\t\t\t\t\t\tformatTypes,\n\t\t\t\t\t\ttagName,\n\t\t\t\t\t\tonReplace,\n\t\t\t\t\t\tonSplit,\n\t\t\t\t\t\t__unstableEmbedURLOnPaste,\n\t\t\t\t\t\tpastePlainText,\n\t\t\t\t\t} ),\n\t\t\t\t\tuseDelete( {\n\t\t\t\t\t\tvalue,\n\t\t\t\t\t\tonMerge,\n\t\t\t\t\t\tonRemove,\n\t\t\t\t\t} ),\n\t\t\t\t\tuseEnter( {\n\t\t\t\t\t\tremoveEditorOnlyFormats,\n\t\t\t\t\t\tvalue,\n\t\t\t\t\t\tonReplace,\n\t\t\t\t\t\tonSplit,\n\t\t\t\t\t\tonChange,\n\t\t\t\t\t\tdisableLineBreaks,\n\t\t\t\t\t\tonSplitAtEnd,\n\t\t\t\t\t\tonSplitAtDoubleLineEnd,\n\t\t\t\t\t} ),\n\t\t\t\t\tuseFirefoxCompat(),\n\t\t\t\t\tanchorRef,\n\t\t\t\t] ) }\n\t\t\t\tcontentEditable={ true }\n\t\t\t\tsuppressContentEditableWarning={ true }\n\t\t\t\tclassName={ classnames(\n\t\t\t\t\t'block-editor-rich-text__editable',\n\t\t\t\t\tprops.className,\n\t\t\t\t\t'rich-text'\n\t\t\t\t) }\n\t\t\t\t// Setting tabIndex to 0 is unnecessary, the element is already\n\t\t\t\t// focusable because it's contentEditable. This also fixes a\n\t\t\t\t// Safari bug where it's not possible to Shift+Click multi\n\t\t\t\t// select blocks when Shift Clicking into an element with\n\t\t\t\t// tabIndex because Safari will focus the element. However,\n\t\t\t\t// Safari will correctly ignore nested contentEditable elements.\n\t\t\t\ttabIndex={ props.tabIndex === 0 ? null : props.tabIndex }\n\t\t\t\tdata-wp-block-attribute-key={ identifier }\n\t\t\t/>\n\t\t</>\n\t);\n}\n\nconst ForwardedRichTextContainer = withDeprecations(\n\tforwardRef( RichTextWrapper )\n);\n\nForwardedRichTextContainer.Content = Content;\nForwardedRichTextContainer.isEmpty = ( value ) => {\n\treturn ! value || value.length === 0;\n};\n\n/**\n * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/rich-text/README.md\n */\nexport default ForwardedRichTextContainer;\nexport { RichTextShortcut } from './shortcut';\nexport { RichTextToolbarButton } from './toolbar-button';\nexport { __unstableRichTextInputEvent } from './input-event';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA,IAAAA,WAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,QAAA,GAAAD,OAAA;AAMA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AACA,IAAAI,SAAA,GAAAJ,OAAA;AAIA,IAAAK,WAAA,GAAAL,OAAA;AAKA,IAAAM,aAAA,GAAAN,OAAA;AACA,IAAAO,UAAA,GAAAP,OAAA;AACA,IAAAQ,uBAAA,GAAAT,sBAAA,CAAAC,OAAA;AACA,IAAAS,MAAA,GAAAT,OAAA;AACA,IAAAU,uBAAA,GAAAV,OAAA;AACA,IAAAW,kBAAA,GAAAX,OAAA;AACA,IAAAY,gBAAA,GAAAZ,OAAA;AACA,IAAAa,oBAAA,GAAAb,OAAA;AACA,IAAAc,cAAA,GAAAd,OAAA;AACA,IAAAe,UAAA,GAAAf,OAAA;AACA,IAAAgB,SAAA,GAAAhB,OAAA;AACA,IAAAiB,eAAA,GAAAjB,OAAA;AACA,IAAAkB,0BAAA,GAAAlB,OAAA;AACA,IAAAmB,aAAA,GAAAnB,OAAA;AACA,IAAAoB,eAAA,GAAApB,OAAA;AACA,IAAAqB,yBAAA,GAAArB,OAAA;AACA,IAAAsB,iBAAA,GAAAtB,OAAA;AACA,IAAAuB,WAAA,GAAAxB,sBAAA,CAAAC,OAAA;AACA,IAAAwB,MAAA,GAAAxB,OAAA;AACA,IAAAyB,QAAA,GAAAzB,OAAA;AACA,IAAA0B,iBAAA,GAAA1B,OAAA;AA8WA,IAAA2B,SAAA,GAAA3B,OAAA;AACA,IAAA4B,cAAA,GAAA5B,OAAA;AACA,IAAA6B,WAAA,GAAA7B,OAAA;AA7Z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,WAAW;MACX7D,OAAO;MACPW,SAAS;MACTM,OAAO;MACPS,yBAAyB;MACzBD;IACD,CAAE,CAAC,EACH,IAAAqG,oBAAS,EAAE;MACV7H,KAAK;MACLe,OAAO;MACPD;IACD,CAAE,CAAC,EACH,IAAAgH,kBAAQ,EAAE;MACTtD,uBAAuB;MACvBxE,KAAK;MACLU,SAAS;MACTM,OAAO;MACPd,QAAQ;MACR0B,iBAAiB;MACjBV,YAAY;MACZE;IACD,CAAE,CAAC,EACH,IAAA2G,kCAAgB,EAAC,CAAC,EAClBhG,SAAS,CACR,CAAG;IACLiG,eAAe,EAAG,IAAM;IACxBC,8BAA8B,EAAG,IAAM;IACvCC,SAAS,EAAG,IAAAC,mBAAU,EACrB,kCAAkC,EAClCxJ,KAAK,CAACuJ,SAAS,EACf,WACD;IACA;IACA;IACA;IACA;IACA;IACA;IAAA;IACAE,QAAQ,EAAGzJ,KAAK,CAACyJ,QAAQ,KAAK,CAAC,GAAG,IAAI,GAAGzJ,KAAK,CAACyJ,QAAU;IACzD,+BAA8B/G;EAAY,CAC1C,CACA,CAAC;AAEL;AAEA,MAAMgH,0BAA0B,GAAG,IAAAC,kCAAgB,EAClD,IAAAC,mBAAU,EAAE1I,eAAgB,CAC7B,CAAC;AAEDwI,0BAA0B,CAACG,OAAO,GAAGA,gBAAO;AAC5CH,0BAA0B,CAACI,OAAO,GAAKzI,KAAK,IAAM;EACjD,OAAO,CAAEA,KAAK,IAAIA,KAAK,CAACqD,MAAM,KAAK,CAAC;AACrC,CAAC;;AAED;AACA;AACA;AAFA,IAAAqF,QAAA,GAGeL,0BAA0B;AAAA7J,OAAA,CAAAwI,OAAA,GAAA0B,QAAA"}
@@ -12,6 +12,7 @@ var _colord = require("colord");
12
12
  var _reactNativeAztec = _interopRequireDefault(require("@wordpress/react-native-aztec"));
13
13
  var _reactNativeBridge = require("@wordpress/react-native-bridge");
14
14
  var _blockEditor = require("@wordpress/block-editor");
15
+ var _components = require("@wordpress/components");
15
16
  var _element = require("@wordpress/element");
16
17
  var _compose = require("@wordpress/compose");
17
18
  var _data = require("@wordpress/data");
@@ -41,10 +42,6 @@ var _toolbarButtonWithOptions = _interopRequireDefault(require("./toolbar-button
41
42
  * Internal dependencies
42
43
  */
43
44
 
44
- const unescapeSpaces = text => {
45
- return text.replace(/&nbsp;|&#160;/gi, ' ');
46
- };
47
-
48
45
  // The flattened color palettes array is memoized to ensure that the same array instance is
49
46
  // returned for the colors palettes. This value might be used as a prop, so having the same
50
47
  // instance will prevent unnecessary re-renders of the RichText component.
@@ -237,7 +234,7 @@ class RichText extends _element.Component {
237
234
  __unstableOnCreateUndoLevel: onCreateUndoLevel
238
235
  } = this.props;
239
236
  // If the content is the same, no level needs to be created.
240
- if (this.lastHistoryValue === this.value) {
237
+ if (this.lastHistoryValue.toString() === this.value.toString()) {
241
238
  return;
242
239
  }
243
240
  onCreateUndoLevel();
@@ -275,9 +272,9 @@ class RichText extends _element.Component {
275
272
  if (this.shouldDropEventFromAztec(event, 'onChange')) {
276
273
  return;
277
274
  }
278
- const contentWithoutRootTag = this.removeRootTagsProducedByAztec(unescapeSpaces(event.nativeEvent.text));
275
+ const contentWithoutRootTag = this.removeRootTagsProducedByAztec(event.nativeEvent.text);
279
276
  // On iOS, onChange can be triggered after selection changes, even though there are no content changes.
280
- if (contentWithoutRootTag === this.value) {
277
+ if (contentWithoutRootTag === this.value.toString()) {
281
278
  return;
282
279
  }
283
280
  this.lastEventCount = event.nativeEvent.eventCount;
@@ -287,9 +284,9 @@ class RichText extends _element.Component {
287
284
  this.lastAztecEventType = 'input';
288
285
  }
289
286
  onTextUpdate(event) {
290
- const contentWithoutRootTag = this.removeRootTagsProducedByAztec(unescapeSpaces(event.nativeEvent.text));
287
+ const contentWithoutRootTag = this.removeRootTagsProducedByAztec(event.nativeEvent.text);
291
288
  this.debounceCreateUndoLevel();
292
- const refresh = this.value !== contentWithoutRootTag;
289
+ const refresh = this.value.toString() !== contentWithoutRootTag;
293
290
  this.value = contentWithoutRootTag;
294
291
 
295
292
  // We don't want to refresh if our goal is just to create a record.
@@ -507,7 +504,7 @@ class RichText extends _element.Component {
507
504
  this.isTouched = false;
508
505
 
509
506
  // Check if value is up to date with latest state of native AztecView.
510
- if (event.nativeEvent.text && event.nativeEvent.text !== this.props.value) {
507
+ if (event.nativeEvent.text && event.nativeEvent.text !== this.props.value.toString()) {
511
508
  this.onTextUpdate(event);
512
509
  }
513
510
  if (this.props.onBlur) {
@@ -524,7 +521,7 @@ class RichText extends _element.Component {
524
521
  // and we did not just trigger a text update
525
522
  // `onChange` could be the last event and could have been triggered a long time ago so
526
523
  // this approach is not perfectly reliable.
527
- const isManual = this.lastAztecEventType !== 'input' && this.props.value === this.value;
524
+ const isManual = this.lastAztecEventType !== 'input' && this.props.value.toString() === this.value.toString();
528
525
  if (hasChanged && isManual) {
529
526
  const value = this.createRecord();
530
527
  const activeFormats = (0, _richText.getActiveFormats)(value);
@@ -576,8 +573,8 @@ class RichText extends _element.Component {
576
573
  const realEnd = Math.max(start, end);
577
574
 
578
575
  // Check and dicsard stray event, where the text and selection is equal to the ones already cached.
579
- const contentWithoutRootTag = this.removeRootTagsProducedByAztec(unescapeSpaces(event.nativeEvent.text));
580
- if (contentWithoutRootTag === this.value && realStart === this.selectionStart && realEnd === this.selectionEnd) {
576
+ const contentWithoutRootTag = this.removeRootTagsProducedByAztec(event.nativeEvent.text);
577
+ if (contentWithoutRootTag === this.value.toString() && realStart === this.selectionStart && realEnd === this.selectionEnd) {
581
578
  return;
582
579
  }
583
580
  this.comesFromAztec = true;
@@ -657,7 +654,7 @@ class RichText extends _element.Component {
657
654
  // with only some of the text, while the virtual keyboard's suggestion system does its magic.
658
655
  // ** compare with this.lastContent for optimizing performance by not forcing Aztec with text it already has
659
656
  // , but compare with props.value to not lose "half word" text because of Android virtual keyb autosuggestion behavior
660
- if (typeof nextProps.value !== 'undefined' && typeof this.props.value !== 'undefined' && (!this.comesFromAztec || !this.firedAfterTextChanged) && nextProps.value !== this.props.value) {
657
+ if (typeof nextProps.value !== 'undefined' && typeof this.props.value !== 'undefined' && (!this.comesFromAztec || !this.firedAfterTextChanged) && nextProps.value.toString() !== this.props.value.toString()) {
661
658
  // Gutenberg seems to try to mirror the caret state even on events that only change the content so,
662
659
  // let's force caret update if state has selection set.
663
660
  if (typeof nextProps.selectionStart !== 'undefined' && typeof nextProps.selectionEnd !== 'undefined') {
@@ -696,11 +693,6 @@ class RichText extends _element.Component {
696
693
  this.onSelectionChange(this.props.selectionStart || 0, this.props.selectionEnd || 0);
697
694
  }
698
695
  }
699
- componentWillUnmount() {
700
- if (this._editor.isFocused()) {
701
- this._editor.blur();
702
- }
703
- }
704
696
  componentDidUpdate(prevProps) {
705
697
  const {
706
698
  style,
@@ -709,7 +701,7 @@ class RichText extends _element.Component {
709
701
  const {
710
702
  currentFontSize
711
703
  } = this.state;
712
- if (this.props.value !== this.value) {
704
+ if (this.props.value.toString() !== this.value.toString()) {
713
705
  this.value = this.props.value;
714
706
  }
715
707
  const {
@@ -724,10 +716,10 @@ class RichText extends _element.Component {
724
716
  // if its internal value hasn't change. When created, default value is 0, 0.
725
717
  this.onSelectionChange(this.props.selectionStart || 0, this.props.selectionEnd || 0);
726
718
  } else if (this.shouldFocusTextInputAfterMerge(prevProps)) {
727
- var _this$value$length;
719
+ var _this$value$toString$;
728
720
  // Since this is happening when merging blocks, the selection should be at the last character position.
729
721
  // As a fallback the internal selectionEnd value is used.
730
- const lastCharacterPosition = (_this$value$length = this.value?.length) !== null && _this$value$length !== void 0 ? _this$value$length : this.selectionEnd;
722
+ const lastCharacterPosition = (_this$value$toString$ = this.value?.toString().length) !== null && _this$value$toString$ !== void 0 ? _this$value$toString$ : this.selectionEnd;
731
723
  this._editor.focus();
732
724
  this.props.onSelectionChange(lastCharacterPosition, lastCharacterPosition);
733
725
  } else if (!isSelected && prevIsSelected) {
@@ -755,7 +747,7 @@ class RichText extends _element.Component {
755
747
  value = '';
756
748
  }
757
749
  // On android if content is empty we need to send no content or else the placeholder will not show.
758
- if (!this.isIOS && (value === '' || value === EMPTY_PARAGRAPH_TAGS)) {
750
+ if (!this.isIOS && (value.toString() === '' || value.toString() === EMPTY_PARAGRAPH_TAGS)) {
759
751
  return '';
760
752
  }
761
753
  if (tagName) {
@@ -794,7 +786,7 @@ class RichText extends _element.Component {
794
786
  if (!fontSize) {
795
787
  return fontSize;
796
788
  }
797
- const selectedPxValue = (_getPxFromCssUnit = (0, _blockEditor.getPxFromCssUnit)(fontSize, cssUnitOptions)) !== null && _getPxFromCssUnit !== void 0 ? _getPxFromCssUnit : DEFAULT_FONT_SIZE;
789
+ const selectedPxValue = (_getPxFromCssUnit = (0, _components.getPxFromCssUnit)(fontSize, cssUnitOptions)) !== null && _getPxFromCssUnit !== void 0 ? _getPxFromCssUnit : DEFAULT_FONT_SIZE;
798
790
  return parseFloat(selectedPxValue);
799
791
  }
800
792
  getFontSize(props) {