@wordpress/block-editor 12.14.0 → 12.16.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 (664) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/README.md +10 -5
  3. package/build/components/block-canvas/index.js +22 -6
  4. package/build/components/block-canvas/index.js.map +1 -1
  5. package/build/components/block-card/index.js +1 -1
  6. package/build/components/block-card/index.js.map +1 -1
  7. package/build/components/block-controls/hook.js +3 -23
  8. package/build/components/block-controls/hook.js.map +1 -1
  9. package/build/components/block-edit/context.js +5 -1
  10. package/build/components/block-edit/context.js.map +1 -1
  11. package/build/components/block-edit/index.js +18 -9
  12. package/build/components/block-edit/index.js.map +1 -1
  13. package/build/components/block-info-slot-fill/index.js +3 -4
  14. package/build/components/block-info-slot-fill/index.js.map +1 -1
  15. package/build/components/block-list/block.js +28 -9
  16. package/build/components/block-list/block.js.map +1 -1
  17. package/build/components/block-list/block.native.js +16 -5
  18. package/build/components/block-list/block.native.js.map +1 -1
  19. package/build/components/block-list/use-block-props/index.js +61 -18
  20. package/build/components/block-list/use-block-props/index.js.map +1 -1
  21. package/build/components/block-list/use-block-props/use-focus-first-element.js +4 -29
  22. package/build/components/block-list/use-block-props/use-focus-first-element.js.map +1 -1
  23. package/build/components/block-list/use-block-props/use-is-hovered.js +4 -14
  24. package/build/components/block-list/use-block-props/use-is-hovered.js.map +1 -1
  25. package/build/components/block-list/use-block-props/use-selected-block-event-handlers.js +4 -2
  26. package/build/components/block-list/use-block-props/use-selected-block-event-handlers.js.map +1 -1
  27. package/build/components/block-parent-selector/index.js +1 -1
  28. package/build/components/block-parent-selector/index.js.map +1 -1
  29. package/build/components/block-pattern-setup/index.js +25 -16
  30. package/build/components/block-pattern-setup/index.js.map +1 -1
  31. package/build/components/block-pattern-setup/setup-toolbar.js +4 -2
  32. package/build/components/block-pattern-setup/setup-toolbar.js.map +1 -1
  33. package/build/components/block-patterns-list/index.js +37 -20
  34. package/build/components/block-patterns-list/index.js.map +1 -1
  35. package/build/components/block-removal-warning-modal/index.js +2 -9
  36. package/build/components/block-removal-warning-modal/index.js.map +1 -1
  37. package/build/components/block-rename/index.js +28 -0
  38. package/build/components/block-rename/index.js.map +1 -0
  39. package/build/components/block-rename/is-empty-string.js +10 -0
  40. package/build/components/block-rename/is-empty-string.js.map +1 -0
  41. package/build/components/block-rename/modal.js +90 -0
  42. package/build/components/block-rename/modal.js.map +1 -0
  43. package/build/components/block-rename/rename-control.js +74 -0
  44. package/build/components/block-rename/rename-control.js.map +1 -0
  45. package/build/components/block-rename/use-block-rename.js +17 -0
  46. package/build/components/block-rename/use-block-rename.js.map +1 -0
  47. package/build/components/block-settings/container.native.js +6 -4
  48. package/build/components/block-settings/container.native.js.map +1 -1
  49. package/build/components/block-settings-menu/block-settings-dropdown.js +33 -20
  50. package/build/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
  51. package/build/components/block-settings-menu-controls/index.js +7 -0
  52. package/build/components/block-settings-menu-controls/index.js.map +1 -1
  53. package/build/components/block-styles/index.js +1 -1
  54. package/build/components/block-styles/index.js.map +1 -1
  55. package/build/components/block-styles/index.native.js +3 -2
  56. package/build/components/block-styles/index.native.js.map +1 -1
  57. package/build/components/block-toolbar/block-toolbar-menu.native.js +1 -1
  58. package/build/components/block-toolbar/block-toolbar-menu.native.js.map +1 -1
  59. package/build/components/block-toolbar/index.js +89 -27
  60. package/build/components/block-toolbar/index.js.map +1 -1
  61. package/build/components/block-tools/block-toolbar-breadcrumb.js +49 -0
  62. package/build/components/block-tools/block-toolbar-breadcrumb.js.map +1 -0
  63. package/build/components/block-tools/block-toolbar-popover.js +86 -0
  64. package/build/components/block-tools/block-toolbar-popover.js.map +1 -0
  65. package/build/components/block-tools/index.js +27 -24
  66. package/build/components/block-tools/index.js.map +1 -1
  67. package/build/components/block-types-list/index.js +6 -2
  68. package/build/components/block-types-list/index.js.map +1 -1
  69. package/build/components/block-types-list/index.native.js +4 -3
  70. package/build/components/block-types-list/index.native.js.map +1 -1
  71. package/build/components/block-variation-picker/index.native.js +2 -1
  72. package/build/components/block-variation-picker/index.native.js.map +1 -1
  73. package/build/components/colors-gradients/control.js +28 -17
  74. package/build/components/colors-gradients/control.js.map +1 -1
  75. package/build/components/date-format-picker/index.js +8 -1
  76. package/build/components/date-format-picker/index.js.map +1 -1
  77. package/build/components/duotone-control/index.js +1 -4
  78. package/build/components/duotone-control/index.js.map +1 -1
  79. package/build/components/global-styles/advanced-panel.js +1 -1
  80. package/build/components/global-styles/advanced-panel.js.map +1 -1
  81. package/build/components/global-styles/color-panel.js +22 -20
  82. package/build/components/global-styles/color-panel.js.map +1 -1
  83. package/build/components/global-styles/filters-panel.js +9 -3
  84. package/build/components/global-styles/filters-panel.js.map +1 -1
  85. package/build/components/global-styles/typography-panel.js +20 -31
  86. package/build/components/global-styles/typography-panel.js.map +1 -1
  87. package/build/components/image-link-destinations/index.native.js +118 -0
  88. package/build/components/image-link-destinations/index.native.js.map +1 -0
  89. package/build/components/image-size-control/index.js +0 -5
  90. package/build/components/image-size-control/index.js.map +1 -1
  91. package/build/components/index.native.js +8 -0
  92. package/build/components/index.native.js.map +1 -1
  93. package/build/components/inner-blocks/index.js +3 -1
  94. package/build/components/inner-blocks/index.js.map +1 -1
  95. package/build/components/inner-blocks/warning-max-depth-exceeded.native.js +29 -31
  96. package/build/components/inner-blocks/warning-max-depth-exceeded.native.js.map +1 -1
  97. package/build/components/inserter/block-patterns-explorer/pattern-list.js +1 -1
  98. package/build/components/inserter/block-patterns-explorer/pattern-list.js.map +1 -1
  99. package/build/components/inserter/block-patterns-tab/pattern-category-previews.js +1 -1
  100. package/build/components/inserter/block-patterns-tab/pattern-category-previews.js.map +1 -1
  101. package/build/components/inserter/block-patterns-tab/use-pattern-categories.js +1 -1
  102. package/build/components/inserter/block-patterns-tab/use-pattern-categories.js.map +1 -1
  103. package/build/components/inserter/block-patterns-tab/utils.js +3 -4
  104. package/build/components/inserter/block-patterns-tab/utils.js.map +1 -1
  105. package/build/components/inserter/hooks/use-patterns-state.js +2 -1
  106. package/build/components/inserter/hooks/use-patterns-state.js.map +1 -1
  107. package/build/components/inserter/media-tab/media-panel.js +2 -2
  108. package/build/components/inserter/media-tab/media-panel.js.map +1 -1
  109. package/build/components/inserter/menu.js +14 -7
  110. package/build/components/inserter/menu.js.map +1 -1
  111. package/build/components/inserter/preview-panel.js +2 -2
  112. package/build/components/inserter/preview-panel.js.map +1 -1
  113. package/build/components/inserter-button/index.native.js +98 -0
  114. package/build/components/inserter-button/index.native.js.map +1 -0
  115. package/build/components/inserter-button/sparkles.js +23 -0
  116. package/build/components/inserter-button/sparkles.js.map +1 -0
  117. package/build/components/inserter-draggable-blocks/index.js +8 -4
  118. package/build/components/inserter-draggable-blocks/index.js.map +1 -1
  119. package/build/components/inserter-listbox/index.js +11 -6
  120. package/build/components/inserter-listbox/index.js.map +1 -1
  121. package/build/components/inserter-listbox/item.js +24 -23
  122. package/build/components/inserter-listbox/item.js.map +1 -1
  123. package/build/components/inserter-listbox/row.js +5 -5
  124. package/build/components/inserter-listbox/row.js.map +1 -1
  125. package/build/components/inspector-controls/fill.js +3 -3
  126. package/build/components/inspector-controls/fill.js.map +1 -1
  127. package/build/components/inspector-controls/fill.native.js +3 -3
  128. package/build/components/inspector-controls/fill.native.js.map +1 -1
  129. package/build/components/list-view/use-list-view-expand-selected-item.js +2 -3
  130. package/build/components/list-view/use-list-view-expand-selected-item.js.map +1 -1
  131. package/build/components/navigable-toolbar/index.js +2 -2
  132. package/build/components/navigable-toolbar/index.js.map +1 -1
  133. package/build/components/preview-options/index.js +6 -60
  134. package/build/components/preview-options/index.js.map +1 -1
  135. package/build/components/rich-text/content.js +26 -23
  136. package/build/components/rich-text/content.js.map +1 -1
  137. package/build/components/rich-text/get-rich-text-values.js +2 -1
  138. package/build/components/rich-text/get-rich-text-values.js.map +1 -1
  139. package/build/components/rich-text/index.js +2 -30
  140. package/build/components/rich-text/index.js.map +1 -1
  141. package/build/components/rich-text/index.native.js +10 -17
  142. package/build/components/rich-text/index.native.js.map +1 -1
  143. package/build/components/rich-text/native/get-format-colors.native.js +22 -24
  144. package/build/components/rich-text/native/get-format-colors.native.js.map +1 -1
  145. package/build/components/rich-text/native/index.native.js +41 -37
  146. package/build/components/rich-text/native/index.native.js.map +1 -1
  147. package/build/components/rich-text/use-input-rules.js +35 -2
  148. package/build/components/rich-text/use-input-rules.js.map +1 -1
  149. package/build/components/rich-text/with-deprecations.js +50 -0
  150. package/build/components/rich-text/with-deprecations.js.map +1 -0
  151. package/build/components/spacing-sizes-control/input-controls/spacing-input-control.js +1 -1
  152. package/build/components/spacing-sizes-control/input-controls/spacing-input-control.js.map +1 -1
  153. package/build/components/use-block-drop-zone/index.js +74 -9
  154. package/build/components/use-block-drop-zone/index.js.map +1 -1
  155. package/build/components/use-moving-animation/index.js +2 -1
  156. package/build/components/use-moving-animation/index.js.map +1 -1
  157. package/build/components/use-on-block-drop/index.js +1 -1
  158. package/build/components/use-on-block-drop/index.js.map +1 -1
  159. package/build/components/use-resize-canvas/index.js +4 -1
  160. package/build/components/use-resize-canvas/index.js.map +1 -1
  161. package/build/components/use-settings/index.js +16 -2
  162. package/build/components/use-settings/index.js.map +1 -1
  163. package/build/hooks/align.js +20 -68
  164. package/build/hooks/align.js.map +1 -1
  165. package/build/hooks/align.native.js +11 -1
  166. package/build/hooks/align.native.js.map +1 -1
  167. package/build/hooks/anchor.js +13 -29
  168. package/build/hooks/anchor.js.map +1 -1
  169. package/build/hooks/background.js +28 -31
  170. package/build/hooks/background.js.map +1 -1
  171. package/build/hooks/block-hooks.js +24 -32
  172. package/build/hooks/block-hooks.js.map +1 -1
  173. package/build/hooks/block-renaming.js +38 -0
  174. package/build/hooks/block-renaming.js.map +1 -1
  175. package/build/hooks/border.js +58 -80
  176. package/build/hooks/border.js.map +1 -1
  177. package/build/hooks/color.js +76 -89
  178. package/build/hooks/color.js.map +1 -1
  179. package/build/hooks/content-lock-ui.js +29 -29
  180. package/build/hooks/content-lock-ui.js.map +1 -1
  181. package/build/hooks/custom-class-name.js +12 -29
  182. package/build/hooks/custom-class-name.js.map +1 -1
  183. package/build/hooks/custom-fields.js +64 -73
  184. package/build/hooks/custom-fields.js.map +1 -1
  185. package/build/hooks/dimensions.js +21 -17
  186. package/build/hooks/dimensions.js.map +1 -1
  187. package/build/hooks/duotone.js +31 -61
  188. package/build/hooks/duotone.js.map +1 -1
  189. package/build/hooks/font-family.js +16 -25
  190. package/build/hooks/font-family.js.map +1 -1
  191. package/build/hooks/font-size.js +51 -119
  192. package/build/hooks/font-size.js.map +1 -1
  193. package/build/hooks/index.js +25 -15
  194. package/build/hooks/index.js.map +1 -1
  195. package/build/hooks/index.native.js +10 -3
  196. package/build/hooks/index.native.js.map +1 -1
  197. package/build/hooks/layout-child.js +68 -0
  198. package/build/hooks/layout-child.js.map +1 -0
  199. package/build/hooks/layout.js +29 -108
  200. package/build/hooks/layout.js.map +1 -1
  201. package/build/hooks/padding.js +2 -2
  202. package/build/hooks/padding.js.map +1 -1
  203. package/build/hooks/position.js +40 -62
  204. package/build/hooks/position.js.map +1 -1
  205. package/build/hooks/style.js +51 -88
  206. package/build/hooks/style.js.map +1 -1
  207. package/build/hooks/typography.js +34 -14
  208. package/build/hooks/typography.js.map +1 -1
  209. package/build/hooks/utils.js +154 -7
  210. package/build/hooks/utils.js.map +1 -1
  211. package/build/layouts/constrained.js +4 -3
  212. package/build/layouts/constrained.js.map +1 -1
  213. package/build/private-apis.js +0 -2
  214. package/build/private-apis.js.map +1 -1
  215. package/build/store/private-actions.js +8 -0
  216. package/build/store/private-actions.js.map +1 -1
  217. package/build/store/private-selectors.js +34 -0
  218. package/build/store/private-selectors.js.map +1 -1
  219. package/build/store/reducer.js +8 -0
  220. package/build/store/reducer.js.map +1 -1
  221. package/build/store/selectors.js +10 -58
  222. package/build/store/selectors.js.map +1 -1
  223. package/build/store/utils.js +66 -0
  224. package/build/store/utils.js.map +1 -0
  225. package/build/utils/object.js +21 -61
  226. package/build/utils/object.js.map +1 -1
  227. package/build/utils/selection.js +9 -1
  228. package/build/utils/selection.js.map +1 -1
  229. package/build/utils/transform-styles/index.js +26 -6
  230. package/build/utils/transform-styles/index.js.map +1 -1
  231. package/build-module/components/block-canvas/index.js +23 -7
  232. package/build-module/components/block-canvas/index.js.map +1 -1
  233. package/build-module/components/block-card/index.js +1 -1
  234. package/build-module/components/block-card/index.js.map +1 -1
  235. package/build-module/components/block-controls/hook.js +4 -24
  236. package/build-module/components/block-controls/hook.js.map +1 -1
  237. package/build-module/components/block-edit/context.js +2 -0
  238. package/build-module/components/block-edit/context.js.map +1 -1
  239. package/build-module/components/block-edit/index.js +19 -10
  240. package/build-module/components/block-edit/index.js.map +1 -1
  241. package/build-module/components/block-info-slot-fill/index.js +3 -3
  242. package/build-module/components/block-info-slot-fill/index.js.map +1 -1
  243. package/build-module/components/block-list/block.js +29 -10
  244. package/build-module/components/block-list/block.js.map +1 -1
  245. package/build-module/components/block-list/block.native.js +16 -5
  246. package/build-module/components/block-list/block.native.js.map +1 -1
  247. package/build-module/components/block-list/use-block-props/index.js +62 -19
  248. package/build-module/components/block-list/use-block-props/index.js.map +1 -1
  249. package/build-module/components/block-list/use-block-props/use-focus-first-element.js +4 -29
  250. package/build-module/components/block-list/use-block-props/use-focus-first-element.js.map +1 -1
  251. package/build-module/components/block-list/use-block-props/use-is-hovered.js +4 -14
  252. package/build-module/components/block-list/use-block-props/use-is-hovered.js.map +1 -1
  253. package/build-module/components/block-list/use-block-props/use-selected-block-event-handlers.js +4 -2
  254. package/build-module/components/block-list/use-block-props/use-selected-block-event-handlers.js.map +1 -1
  255. package/build-module/components/block-parent-selector/index.js +1 -1
  256. package/build-module/components/block-parent-selector/index.js.map +1 -1
  257. package/build-module/components/block-pattern-setup/index.js +24 -15
  258. package/build-module/components/block-pattern-setup/index.js.map +1 -1
  259. package/build-module/components/block-pattern-setup/setup-toolbar.js +4 -2
  260. package/build-module/components/block-pattern-setup/setup-toolbar.js.map +1 -1
  261. package/build-module/components/block-patterns-list/index.js +37 -20
  262. package/build-module/components/block-patterns-list/index.js.map +1 -1
  263. package/build-module/components/block-removal-warning-modal/index.js +3 -10
  264. package/build-module/components/block-removal-warning-modal/index.js.map +1 -1
  265. package/build-module/components/block-rename/index.js +4 -0
  266. package/build-module/components/block-rename/index.js.map +1 -0
  267. package/build-module/components/block-rename/is-empty-string.js +4 -0
  268. package/build-module/components/block-rename/is-empty-string.js.map +1 -0
  269. package/build-module/components/block-rename/modal.js +82 -0
  270. package/build-module/components/block-rename/modal.js.map +1 -0
  271. package/build-module/components/block-rename/rename-control.js +66 -0
  272. package/build-module/components/block-rename/rename-control.js.map +1 -0
  273. package/build-module/components/block-rename/use-block-rename.js +10 -0
  274. package/build-module/components/block-rename/use-block-rename.js.map +1 -0
  275. package/build-module/components/block-settings/container.native.js +4 -2
  276. package/build-module/components/block-settings/container.native.js.map +1 -1
  277. package/build-module/components/block-settings-menu/block-settings-dropdown.js +34 -21
  278. package/build-module/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
  279. package/build-module/components/block-settings-menu-controls/index.js +7 -0
  280. package/build-module/components/block-settings-menu-controls/index.js.map +1 -1
  281. package/build-module/components/block-styles/index.js +1 -1
  282. package/build-module/components/block-styles/index.js.map +1 -1
  283. package/build-module/components/block-styles/index.native.js +3 -2
  284. package/build-module/components/block-styles/index.native.js.map +1 -1
  285. package/build-module/components/block-toolbar/block-toolbar-menu.native.js +1 -1
  286. package/build-module/components/block-toolbar/block-toolbar-menu.native.js.map +1 -1
  287. package/build-module/components/block-toolbar/index.js +88 -25
  288. package/build-module/components/block-toolbar/index.js.map +1 -1
  289. package/build-module/components/block-tools/block-toolbar-breadcrumb.js +41 -0
  290. package/build-module/components/block-tools/block-toolbar-breadcrumb.js.map +1 -0
  291. package/build-module/components/block-tools/block-toolbar-popover.js +76 -0
  292. package/build-module/components/block-tools/block-toolbar-popover.js.map +1 -0
  293. package/build-module/components/block-tools/index.js +27 -24
  294. package/build-module/components/block-tools/index.js.map +1 -1
  295. package/build-module/components/block-types-list/index.js +6 -2
  296. package/build-module/components/block-types-list/index.js.map +1 -1
  297. package/build-module/components/block-types-list/index.native.js +2 -1
  298. package/build-module/components/block-types-list/index.native.js.map +1 -1
  299. package/build-module/components/block-variation-picker/index.native.js +2 -1
  300. package/build-module/components/block-variation-picker/index.native.js.map +1 -1
  301. package/build-module/components/colors-gradients/control.js +29 -18
  302. package/build-module/components/colors-gradients/control.js.map +1 -1
  303. package/build-module/components/date-format-picker/index.js +8 -1
  304. package/build-module/components/date-format-picker/index.js.map +1 -1
  305. package/build-module/components/duotone-control/index.js +1 -4
  306. package/build-module/components/duotone-control/index.js.map +1 -1
  307. package/build-module/components/global-styles/advanced-panel.js +1 -1
  308. package/build-module/components/global-styles/advanced-panel.js.map +1 -1
  309. package/build-module/components/global-styles/color-panel.js +23 -21
  310. package/build-module/components/global-styles/color-panel.js.map +1 -1
  311. package/build-module/components/global-styles/filters-panel.js +10 -4
  312. package/build-module/components/global-styles/filters-panel.js.map +1 -1
  313. package/build-module/components/global-styles/typography-panel.js +20 -31
  314. package/build-module/components/global-styles/typography-panel.js.map +1 -1
  315. package/build-module/components/image-link-destinations/index.native.js +109 -0
  316. package/build-module/components/image-link-destinations/index.native.js.map +1 -0
  317. package/build-module/components/image-size-control/index.js +0 -5
  318. package/build-module/components/image-size-control/index.js.map +1 -1
  319. package/build-module/components/index.native.js +1 -0
  320. package/build-module/components/index.native.js.map +1 -1
  321. package/build-module/components/inner-blocks/index.js +3 -1
  322. package/build-module/components/inner-blocks/index.js.map +1 -1
  323. package/build-module/components/inner-blocks/warning-max-depth-exceeded.native.js +30 -32
  324. package/build-module/components/inner-blocks/warning-max-depth-exceeded.native.js.map +1 -1
  325. package/build-module/components/inserter/block-patterns-explorer/pattern-list.js +2 -2
  326. package/build-module/components/inserter/block-patterns-explorer/pattern-list.js.map +1 -1
  327. package/build-module/components/inserter/block-patterns-tab/pattern-category-previews.js +4 -4
  328. package/build-module/components/inserter/block-patterns-tab/pattern-category-previews.js.map +1 -1
  329. package/build-module/components/inserter/block-patterns-tab/use-pattern-categories.js +2 -2
  330. package/build-module/components/inserter/block-patterns-tab/use-pattern-categories.js.map +1 -1
  331. package/build-module/components/inserter/block-patterns-tab/utils.js +3 -4
  332. package/build-module/components/inserter/block-patterns-tab/utils.js.map +1 -1
  333. package/build-module/components/inserter/hooks/use-patterns-state.js +2 -1
  334. package/build-module/components/inserter/hooks/use-patterns-state.js.map +1 -1
  335. package/build-module/components/inserter/media-tab/media-panel.js +1 -1
  336. package/build-module/components/inserter/media-tab/media-panel.js.map +1 -1
  337. package/build-module/components/inserter/menu.js +14 -7
  338. package/build-module/components/inserter/menu.js.map +1 -1
  339. package/build-module/components/inserter/preview-panel.js +2 -2
  340. package/build-module/components/inserter/preview-panel.js.map +1 -1
  341. package/build-module/components/inserter-button/index.native.js +89 -0
  342. package/build-module/components/inserter-button/index.native.js.map +1 -0
  343. package/build-module/components/inserter-button/sparkles.js +15 -0
  344. package/build-module/components/inserter-button/sparkles.js.map +1 -0
  345. package/build-module/components/inserter-draggable-blocks/index.js +9 -5
  346. package/build-module/components/inserter-draggable-blocks/index.js.map +1 -1
  347. package/build-module/components/inserter-listbox/index.js +13 -8
  348. package/build-module/components/inserter-listbox/index.js.map +1 -1
  349. package/build-module/components/inserter-listbox/item.js +25 -23
  350. package/build-module/components/inserter-listbox/item.js.map +1 -1
  351. package/build-module/components/inserter-listbox/row.js +6 -5
  352. package/build-module/components/inserter-listbox/row.js.map +1 -1
  353. package/build-module/components/inspector-controls/fill.js +3 -3
  354. package/build-module/components/inspector-controls/fill.js.map +1 -1
  355. package/build-module/components/inspector-controls/fill.native.js +3 -3
  356. package/build-module/components/inspector-controls/fill.native.js.map +1 -1
  357. package/build-module/components/list-view/use-list-view-expand-selected-item.js +2 -3
  358. package/build-module/components/list-view/use-list-view-expand-selected-item.js.map +1 -1
  359. package/build-module/components/navigable-toolbar/index.js +2 -2
  360. package/build-module/components/navigable-toolbar/index.js.map +1 -1
  361. package/build-module/components/preview-options/index.js +6 -60
  362. package/build-module/components/preview-options/index.js.map +1 -1
  363. package/build-module/components/rich-text/content.js +25 -21
  364. package/build-module/components/rich-text/content.js.map +1 -1
  365. package/build-module/components/rich-text/get-rich-text-values.js +2 -1
  366. package/build-module/components/rich-text/get-rich-text-values.js.map +1 -1
  367. package/build-module/components/rich-text/index.js +4 -32
  368. package/build-module/components/rich-text/index.js.map +1 -1
  369. package/build-module/components/rich-text/index.native.js +11 -19
  370. package/build-module/components/rich-text/index.native.js.map +1 -1
  371. package/build-module/components/rich-text/native/get-format-colors.native.js +22 -24
  372. package/build-module/components/rich-text/native/get-format-colors.native.js.map +1 -1
  373. package/build-module/components/rich-text/native/index.native.js +41 -37
  374. package/build-module/components/rich-text/native/index.native.js.map +1 -1
  375. package/build-module/components/rich-text/use-input-rules.js +36 -3
  376. package/build-module/components/rich-text/use-input-rules.js.map +1 -1
  377. package/build-module/components/rich-text/with-deprecations.js +42 -0
  378. package/build-module/components/rich-text/with-deprecations.js.map +1 -0
  379. package/build-module/components/spacing-sizes-control/input-controls/spacing-input-control.js +1 -1
  380. package/build-module/components/spacing-sizes-control/input-controls/spacing-input-control.js.map +1 -1
  381. package/build-module/components/use-block-drop-zone/index.js +73 -9
  382. package/build-module/components/use-block-drop-zone/index.js.map +1 -1
  383. package/build-module/components/use-moving-animation/index.js +2 -1
  384. package/build-module/components/use-moving-animation/index.js.map +1 -1
  385. package/build-module/components/use-on-block-drop/index.js +1 -1
  386. package/build-module/components/use-on-block-drop/index.js.map +1 -1
  387. package/build-module/components/use-resize-canvas/index.js +4 -1
  388. package/build-module/components/use-resize-canvas/index.js.map +1 -1
  389. package/build-module/components/use-settings/index.js +15 -3
  390. package/build-module/components/use-settings/index.js.map +1 -1
  391. package/build-module/hooks/align.js +19 -66
  392. package/build-module/hooks/align.js.map +1 -1
  393. package/build-module/hooks/align.native.js +1 -0
  394. package/build-module/hooks/align.native.js.map +1 -1
  395. package/build-module/hooks/anchor.js +11 -26
  396. package/build-module/hooks/anchor.js.map +1 -1
  397. package/build-module/hooks/background.js +26 -28
  398. package/build-module/hooks/background.js.map +1 -1
  399. package/build-module/hooks/block-hooks.js +22 -30
  400. package/build-module/hooks/block-hooks.js.map +1 -1
  401. package/build-module/hooks/block-renaming.js +36 -0
  402. package/build-module/hooks/block-renaming.js.map +1 -1
  403. package/build-module/hooks/border.js +57 -78
  404. package/build-module/hooks/border.js.map +1 -1
  405. package/build-module/hooks/color.js +74 -86
  406. package/build-module/hooks/color.js.map +1 -1
  407. package/build-module/hooks/content-lock-ui.js +27 -27
  408. package/build-module/hooks/content-lock-ui.js.map +1 -1
  409. package/build-module/hooks/custom-class-name.js +11 -27
  410. package/build-module/hooks/custom-class-name.js.map +1 -1
  411. package/build-module/hooks/custom-fields.js +60 -74
  412. package/build-module/hooks/custom-fields.js.map +1 -1
  413. package/build-module/hooks/dimensions.js +21 -16
  414. package/build-module/hooks/dimensions.js.map +1 -1
  415. package/build-module/hooks/duotone.js +30 -61
  416. package/build-module/hooks/duotone.js.map +1 -1
  417. package/build-module/hooks/font-family.js +14 -23
  418. package/build-module/hooks/font-family.js.map +1 -1
  419. package/build-module/hooks/font-size.js +49 -119
  420. package/build-module/hooks/font-size.js.map +1 -1
  421. package/build-module/hooks/index.js +18 -15
  422. package/build-module/hooks/index.js.map +1 -1
  423. package/build-module/hooks/index.native.js +5 -3
  424. package/build-module/hooks/index.native.js.map +1 -1
  425. package/build-module/hooks/layout-child.js +60 -0
  426. package/build-module/hooks/layout-child.js.map +1 -0
  427. package/build-module/hooks/layout.js +26 -105
  428. package/build-module/hooks/layout.js.map +1 -1
  429. package/build-module/hooks/padding.js +2 -2
  430. package/build-module/hooks/padding.js.map +1 -1
  431. package/build-module/hooks/position.js +38 -59
  432. package/build-module/hooks/position.js.map +1 -1
  433. package/build-module/hooks/style.js +51 -84
  434. package/build-module/hooks/style.js.map +1 -1
  435. package/build-module/hooks/typography.js +33 -12
  436. package/build-module/hooks/typography.js.map +1 -1
  437. package/build-module/hooks/utils.js +149 -6
  438. package/build-module/hooks/utils.js.map +1 -1
  439. package/build-module/layouts/constrained.js +4 -3
  440. package/build-module/layouts/constrained.js.map +1 -1
  441. package/build-module/private-apis.js +0 -2
  442. package/build-module/private-apis.js.map +1 -1
  443. package/build-module/store/private-actions.js +7 -0
  444. package/build-module/store/private-actions.js.map +1 -1
  445. package/build-module/store/private-selectors.js +33 -1
  446. package/build-module/store/private-selectors.js.map +1 -1
  447. package/build-module/store/reducer.js +8 -0
  448. package/build-module/store/reducer.js.map +1 -1
  449. package/build-module/store/selectors.js +3 -51
  450. package/build-module/store/selectors.js.map +1 -1
  451. package/build-module/store/utils.js +56 -0
  452. package/build-module/store/utils.js.map +1 -0
  453. package/build-module/utils/object.js +21 -60
  454. package/build-module/utils/object.js.map +1 -1
  455. package/build-module/utils/selection.js +9 -1
  456. package/build-module/utils/selection.js.map +1 -1
  457. package/build-module/utils/transform-styles/index.js +24 -7
  458. package/build-module/utils/transform-styles/index.js.map +1 -1
  459. package/build-style/content-rtl.css +6 -6
  460. package/build-style/content.css +6 -6
  461. package/build-style/style-rtl.css +123 -298
  462. package/build-style/style.css +123 -298
  463. package/package.json +31 -31
  464. package/src/components/block-canvas/index.js +31 -17
  465. package/src/components/block-caption/README.md +2 -2
  466. package/src/components/block-card/index.js +5 -3
  467. package/src/components/block-card/style.scss +7 -3
  468. package/src/components/block-controls/hook.js +8 -30
  469. package/src/components/block-controls/test/index.js +3 -3
  470. package/src/components/block-edit/context.js +3 -0
  471. package/src/components/block-edit/index.js +36 -10
  472. package/src/components/block-info-slot-fill/index.js +6 -3
  473. package/src/components/block-inspector/style.scss +0 -4
  474. package/src/components/block-list/block.js +39 -5
  475. package/src/components/block-list/block.native.js +20 -4
  476. package/src/components/block-list/use-block-props/index.js +74 -21
  477. package/src/components/block-list/use-block-props/use-focus-first-element.js +1 -34
  478. package/src/components/block-list/use-block-props/use-is-hovered.js +2 -13
  479. package/src/components/block-list/use-block-props/use-selected-block-event-handlers.js +1 -5
  480. package/src/components/block-parent-selector/index.js +1 -1
  481. package/src/components/block-pattern-setup/index.js +38 -22
  482. package/src/components/block-pattern-setup/setup-toolbar.js +2 -0
  483. package/src/components/block-pattern-setup/style.scss +4 -1
  484. package/src/components/block-patterns-list/README.md +4 -4
  485. package/src/components/block-patterns-list/index.js +61 -35
  486. package/src/components/block-patterns-list/style.scss +7 -0
  487. package/src/components/block-removal-warning-modal/index.js +7 -14
  488. package/src/components/block-rename/index.js +3 -0
  489. package/src/components/block-rename/is-empty-string.js +3 -0
  490. package/src/components/block-rename/modal.js +121 -0
  491. package/src/components/block-rename/rename-control.js +80 -0
  492. package/src/components/block-rename/use-block-rename.js +10 -0
  493. package/src/components/block-settings/container.native.js +3 -5
  494. package/src/components/block-settings-menu/block-settings-dropdown.js +38 -34
  495. package/src/components/block-settings-menu-controls/index.js +9 -0
  496. package/src/components/block-styles/index.js +1 -1
  497. package/src/components/block-styles/index.native.js +4 -2
  498. package/src/components/block-styles/style.scss +0 -11
  499. package/src/components/block-switcher/test/__snapshots__/index.js.snap +3 -1
  500. package/src/components/block-toolbar/block-toolbar-menu.native.js +1 -4
  501. package/src/components/block-toolbar/index.js +180 -95
  502. package/src/components/block-toolbar/style.scss +50 -66
  503. package/src/components/block-tools/block-toolbar-breadcrumb.js +46 -0
  504. package/src/components/block-tools/block-toolbar-popover.js +90 -0
  505. package/src/components/block-tools/index.js +42 -29
  506. package/src/components/block-tools/style.scss +60 -172
  507. package/src/components/block-types-list/index.js +5 -4
  508. package/src/components/block-types-list/index.native.js +2 -1
  509. package/src/components/block-variation-picker/index.native.js +1 -1
  510. package/src/components/button-block-appender/content.scss +2 -2
  511. package/src/components/colors-gradients/control.js +49 -30
  512. package/src/components/colors-gradients/style.scss +0 -7
  513. package/src/components/date-format-picker/index.js +7 -0
  514. package/src/components/duotone-control/index.js +2 -5
  515. package/src/components/duotone-control/style.scss +1 -6
  516. package/src/components/editable-text/README.md +0 -36
  517. package/src/components/global-styles/advanced-panel.js +1 -1
  518. package/src/components/global-styles/color-panel.js +34 -25
  519. package/src/components/global-styles/filters-panel.js +8 -4
  520. package/src/components/global-styles/typography-panel.js +23 -43
  521. package/src/components/image-link-destinations/index.native.js +152 -0
  522. package/src/components/image-link-destinations/style.native.scss +16 -0
  523. package/src/components/image-size-control/index.js +0 -6
  524. package/src/components/index.native.js +1 -0
  525. package/src/components/inner-blocks/README.md +13 -2
  526. package/src/components/inner-blocks/index.js +6 -2
  527. package/src/components/inner-blocks/warning-max-depth-exceeded.native.js +57 -33
  528. package/src/components/inserter/block-patterns-explorer/pattern-list.js +5 -1
  529. package/src/components/inserter/block-patterns-tab/pattern-category-previews.js +7 -3
  530. package/src/components/inserter/block-patterns-tab/use-pattern-categories.js +6 -1
  531. package/src/components/inserter/block-patterns-tab/utils.js +6 -4
  532. package/src/components/inserter/hooks/use-patterns-state.js +3 -1
  533. package/src/components/inserter/media-tab/media-panel.js +1 -1
  534. package/src/components/inserter/menu.js +16 -8
  535. package/src/components/inserter/preview-panel.js +2 -2
  536. package/src/components/inserter/style.scss +15 -17
  537. package/src/components/inserter-button/README.md +62 -0
  538. package/src/components/inserter-button/index.native.js +116 -0
  539. package/src/components/inserter-button/sparkles.js +15 -0
  540. package/src/components/inserter-button/style.native.scss +72 -0
  541. package/src/components/inserter-draggable-blocks/index.js +18 -5
  542. package/src/components/inserter-listbox/index.js +11 -7
  543. package/src/components/inserter-listbox/item.js +11 -12
  544. package/src/components/inserter-listbox/row.js +6 -12
  545. package/src/components/inspector-controls/fill.js +6 -3
  546. package/src/components/inspector-controls/fill.native.js +6 -3
  547. package/src/components/link-control/style.scss +1 -1
  548. package/src/components/link-control/test/index.js +1 -1
  549. package/src/components/list-view/use-list-view-expand-selected-item.js +7 -8
  550. package/src/components/navigable-toolbar/README.md +2 -0
  551. package/src/components/navigable-toolbar/index.js +2 -2
  552. package/src/components/plain-text/README.md +0 -28
  553. package/src/components/preview-options/index.js +6 -84
  554. package/src/components/rich-text/README.md +0 -58
  555. package/src/components/rich-text/content.js +27 -20
  556. package/src/components/rich-text/get-rich-text-values.js +6 -1
  557. package/src/components/rich-text/index.js +5 -46
  558. package/src/components/rich-text/index.native.js +9 -26
  559. package/src/components/rich-text/native/get-format-colors.native.js +33 -40
  560. package/src/components/rich-text/native/index.native.js +52 -50
  561. package/src/components/rich-text/use-input-rules.js +36 -3
  562. package/src/components/rich-text/with-deprecations.js +51 -0
  563. package/src/components/spacing-sizes-control/input-controls/spacing-input-control.js +1 -1
  564. package/src/components/url-input/README.md +1 -74
  565. package/src/components/use-block-drop-zone/index.js +118 -15
  566. package/src/components/use-moving-animation/index.js +1 -1
  567. package/src/components/use-on-block-drop/index.js +2 -1
  568. package/src/components/use-resize-canvas/README.md +3 -3
  569. package/src/components/use-resize-canvas/index.js +4 -1
  570. package/src/components/use-settings/index.js +17 -3
  571. package/src/components/use-settings/test/index.js +1 -1
  572. package/src/hooks/align.js +15 -76
  573. package/src/hooks/align.native.js +1 -0
  574. package/src/hooks/anchor.js +13 -33
  575. package/src/hooks/background.js +28 -23
  576. package/src/hooks/block-hooks.js +22 -51
  577. package/src/hooks/block-renaming.js +33 -0
  578. package/src/hooks/border.js +67 -118
  579. package/src/hooks/color.js +100 -132
  580. package/src/hooks/content-lock-ui.js +110 -122
  581. package/src/hooks/custom-class-name.js +8 -40
  582. package/src/hooks/custom-fields.js +70 -94
  583. package/src/hooks/dimensions.js +20 -16
  584. package/src/hooks/duotone.js +70 -127
  585. package/src/hooks/font-family.js +10 -29
  586. package/src/hooks/font-size.js +66 -162
  587. package/src/hooks/index.js +42 -15
  588. package/src/hooks/index.native.js +6 -3
  589. package/src/hooks/layout-child.js +53 -0
  590. package/src/hooks/layout.js +25 -110
  591. package/src/hooks/padding.js +2 -2
  592. package/src/hooks/position.js +50 -90
  593. package/src/hooks/style.js +117 -187
  594. package/src/hooks/test/__snapshots__/align.native.js.snap +5 -5
  595. package/src/hooks/test/align.js +1 -178
  596. package/src/hooks/typography.js +20 -16
  597. package/src/hooks/utils.js +187 -6
  598. package/src/layouts/constrained.js +57 -50
  599. package/src/private-apis.js +0 -2
  600. package/src/store/private-actions.js +8 -0
  601. package/src/store/private-selectors.js +45 -0
  602. package/src/store/reducer.js +8 -0
  603. package/src/store/selectors.js +5 -67
  604. package/src/store/utils.js +74 -0
  605. package/src/style.scss +1 -3
  606. package/src/utils/object.js +18 -69
  607. package/src/utils/selection.js +9 -2
  608. package/src/utils/test/transform-styles.js +49 -0
  609. package/src/utils/transform-styles/index.js +39 -13
  610. package/build/components/block-list/use-block-props/use-block-class-names.js +0 -67
  611. package/build/components/block-list/use-block-props/use-block-class-names.js.map +0 -1
  612. package/build/components/block-list/use-block-props/use-block-custom-class-name.js +0 -46
  613. package/build/components/block-list/use-block-props/use-block-custom-class-name.js.map +0 -1
  614. package/build/components/block-list/use-block-props/use-block-default-class-name.js +0 -37
  615. package/build/components/block-list/use-block-props/use-block-default-class-name.js.map +0 -1
  616. package/build/components/block-tools/back-compat.js +0 -45
  617. package/build/components/block-tools/back-compat.js.map +0 -1
  618. package/build/components/block-tools/block-contextual-toolbar.js +0 -91
  619. package/build/components/block-tools/block-contextual-toolbar.js.map +0 -1
  620. package/build/components/block-tools/selected-block-tools.js +0 -113
  621. package/build/components/block-tools/selected-block-tools.js.map +0 -1
  622. package/build/components/inserter/hooks/use-debounced-input.js +0 -22
  623. package/build/components/inserter/hooks/use-debounced-input.js.map +0 -1
  624. package/build/components/use-display-block-controls/index.js +0 -39
  625. package/build/components/use-display-block-controls/index.js.map +0 -1
  626. package/build/components/use-display-block-controls/index.native.js +0 -39
  627. package/build/components/use-display-block-controls/index.native.js.map +0 -1
  628. package/build/hooks/block-rename-ui.js +0 -167
  629. package/build/hooks/block-rename-ui.js.map +0 -1
  630. package/build-module/components/block-list/use-block-props/use-block-class-names.js +0 -60
  631. package/build-module/components/block-list/use-block-props/use-block-class-names.js.map +0 -1
  632. package/build-module/components/block-list/use-block-props/use-block-custom-class-name.js +0 -40
  633. package/build-module/components/block-list/use-block-props/use-block-custom-class-name.js.map +0 -1
  634. package/build-module/components/block-list/use-block-props/use-block-default-class-name.js +0 -31
  635. package/build-module/components/block-list/use-block-props/use-block-default-class-name.js.map +0 -1
  636. package/build-module/components/block-tools/back-compat.js +0 -35
  637. package/build-module/components/block-tools/back-compat.js.map +0 -1
  638. package/build-module/components/block-tools/block-contextual-toolbar.js +0 -83
  639. package/build-module/components/block-tools/block-contextual-toolbar.js.map +0 -1
  640. package/build-module/components/block-tools/selected-block-tools.js +0 -105
  641. package/build-module/components/block-tools/selected-block-tools.js.map +0 -1
  642. package/build-module/components/inserter/hooks/use-debounced-input.js +0 -15
  643. package/build-module/components/inserter/hooks/use-debounced-input.js.map +0 -1
  644. package/build-module/components/use-display-block-controls/index.js +0 -32
  645. package/build-module/components/use-display-block-controls/index.js.map +0 -1
  646. package/build-module/components/use-display-block-controls/index.native.js +0 -32
  647. package/build-module/components/use-display-block-controls/index.native.js.map +0 -1
  648. package/build-module/hooks/block-rename-ui.js +0 -159
  649. package/build-module/hooks/block-rename-ui.js.map +0 -1
  650. package/src/components/block-list/use-block-props/use-block-class-names.js +0 -66
  651. package/src/components/block-list/use-block-props/use-block-custom-class-name.js +0 -44
  652. package/src/components/block-list/use-block-props/use-block-default-class-name.js +0 -35
  653. package/src/components/block-parent-selector/style.scss +0 -11
  654. package/src/components/block-tools/back-compat.js +0 -35
  655. package/src/components/block-tools/block-contextual-toolbar.js +0 -100
  656. package/src/components/block-tools/selected-block-tools.js +0 -127
  657. package/src/components/inserter/hooks/use-debounced-input.js +0 -18
  658. package/src/components/preview-options/README.md +0 -94
  659. package/src/components/preview-options/style.scss +0 -64
  660. package/src/components/use-display-block-controls/index.js +0 -36
  661. package/src/components/use-display-block-controls/index.native.js +0 -37
  662. package/src/hooks/block-rename-ui.js +0 -228
  663. package/src/hooks/test/color.js +0 -112
  664. /package/src/{hooks/block-rename-ui.scss → components/block-rename/style.scss} +0 -0
@@ -1 +1 @@
1
- {"version":3,"names":["_reactNative","require","_memize","_interopRequireDefault","_colord","_reactNativeAztec","_reactNativeBridge","_blockEditor","_element","_compose","_data","_blocks","_htmlEntities","_keycodes","_url","_icons","_i18n","_richText","_useFormatTypes","_formatEdit","_getFormatColors","_style","_toolbarButtonWithOptions","unescapeSpaces","text","replace","flatColorPalettes","memize","colorsPalettes","theme","custom","default","getSelectionColor","currentSelectionColor","defaultSelectionColor","baseGlobalStyles","isBlockBasedTheme","selectionColor","colordTextColor","colord","colordBackgroundColor","color","background","isColordTextReadable","isReadable","gutenbergFormatNamesToAztec","EMPTY_PARAGRAPH_TAGS","DEFAULT_FONT_SIZE","MIN_LINE_HEIGHT","RichText","Component","constructor","value","selectionStart","selectionEnd","__unstableMultilineTag","multiline","arguments","isMultiline","multilineTag","multilineWrapperTags","isIOS","Platform","OS","createRecord","bind","restoreParagraphTags","onChangeFromAztec","onKeyDown","handleEnter","handleDelete","onPaste","onFocus","onBlur","onTextUpdate","onContentSizeChange","onFormatChange","formatToValue","maxSize","debounceCreateUndoLevel","debounce","onCreateUndoLevel","onSelectionChange","onSelectionChangeFromAztec","valueToFormat","getHtmlToRender","handleSuggestionFunc","handleUserSuggestion","showUserSuggestions","handleXpostSuggestion","showXpostSuggestions","suggestionOptions","insertString","manipulateEventCounterToForceNativeToRefresh","shouldDropEventFromAztec","state","activeFormats","selectedFormat","height","currentFontSize","getFontSize","needsSelectionUpdate","savedContent","isTouched","lastAztecEventType","lastHistoryValue","getRecord","start","end","colorPalette","props","currentValue","formats","replacements","newFormats","getFormatColors","preserveWhiteSpace","create","html","range","Math","min","length","removeRootTagsProducedByAztec","toHTMLString","getActiveFormatNames","record","formatTypes","map","name","filter","getActiveFormat","undefined","Boolean","changeHandlers","Object","fromEntries","entries","key","startsWith","values","forEach","changeHandler","onChange","setState","string","toInsert","insert","__unstableOnCreateUndoLevel","result","removeRootTag","tagName","tagsToEliminate","element","removeTag","tag","openingTagRegexp","RegExp","closingTagRegexp","event","contentWithoutRootTag","nativeEvent","lastEventCount","eventCount","comesFromAztec","firedAfterTextChanged","formattedContent","refresh","contentSize","defaultPrevented","customEditableOnKeyDown","preventDefault","RCTAztecView","KeyCodes","keyCode","handleTriggerKeyCodes","ENTER","onEnter","shiftKey","DELETE","BACKSPACE","isReverse","onDelete","newValue","remove","isCollapsed","triggeredOption","find","option","triggeredKeyCode","triggerChar","charCodeAt","getTextContent","useTrigger","charAt","onClick","areMentionsSupported","areXPostsSupported","allOptions","supported","title","__","label","icon","atSymbol","plus","op","suggestionFunction","prefix","then","suggestion","catch","pastedText","pastedHtml","files","currentRecord","trimmedText","trim","isURL","linkedRecord","applyFormat","type","attributes","href","decodeEntities","window","console","log","plainText","unstableOnFocus","hasChanged","isManual","getActiveFormats","logText","shouldDrop","realStart","realEnd","max","__unstableIsSelected","isEmpty","Array","isArray","childrenBlock","toHTML","format","shouldComponentUpdate","nextProps","nextState","reversed","fontSize","style","lineHeight","componentDidMount","blockIsSelected","__unstableMobileNoFocusOnMount","_editor","focus","componentWillUnmount","isFocused","blur","componentDidUpdate","prevProps","isSelected","prevIsSelected","currentFontSizeStyle","getParsedFontSize","prevFontSizeStyle","isDifferentTag","extraAttributes","getEditableProps","className","_getPxFromCssUnit","width","Dimensions","get","cssUnitOptions","selectedPxValue","getPxFromCssUnit","parseFloat","tagNameFontSize","elements","typography","newFontSize","getLineHeight","tagNameLineHeight","newLineHeight","getIsBlockBasedTheme","isNaN","getBlockUseDefaultFont","tagsToMatch","test","getLinkTextColor","defaultColor","customColor","linkColor","isValid","toHex","getPlaceholderTextColor","_ref","_ref2","getStylesFromColorScheme","placeholderTextColor","placeholderStyle","styles","richTextPlaceholder","richTextPlaceholderDark","defaultPlaceholderTextColor","placeholderOpacity","inheritPlaceholderColor","placeholderColor","globalStylesPlaceholderColor","render","children","minWidth","maxWidth","parentBlockStyles","accessibilityLabel","disableEditingMenu","disableSuggestions","containerWidth","editableProps","blockUseDefaultFont","textDecorationColor","defaultTextDecorationColor","fontFamily","defaultFontFamily","richText","richTextDark","linkTextColor","currentSelectionStart","currentSelectionEnd","selection","brBeforeParaMatches","match","warn","count","newSelectionStart","newSelectionEnd","containerStyles","padding","backgroundColor","EditableView","_react","createElement","Fragment","View","editableTagName","ref","setRef","minHeight","placeholder","deleteEnter","triggerKeyCodes","blockType","maxImagesWidth","fontWeight","fontStyle","textAlign","id","disableAutocorrection","forwardedRef","BlockFormatControls","options","exports","defaultProps","withFormatTypes","WrappedComponent","clientId","identifier","withoutInteractiveFormatting","allowedFormats","useFormatTypes","_default","compose","withSelect","select","getBlockParents","getBlock","getSettings","parents","parentBlock","childrenStyles","settings","__experimentalGlobalStylesBaseStyles","colorPalettes","__experimentalFeatures","palette","colors","capabilities","mentions","xposts","withPreferredColorScheme"],"sources":["@wordpress/block-editor/src/components/rich-text/native/index.native.js"],"sourcesContent":["/* eslint no-console: [\"error\", { allow: [\"warn\"] }] */\n\n/**\n * External dependencies\n */\nimport { View, Platform, Dimensions } from 'react-native';\nimport memize from 'memize';\nimport { colord } from 'colord';\n\n/**\n * WordPress dependencies\n */\nimport RCTAztecView from '@wordpress/react-native-aztec';\nimport {\n\tshowUserSuggestions,\n\tshowXpostSuggestions,\n} from '@wordpress/react-native-bridge';\nimport { BlockFormatControls, getPxFromCssUnit } from '@wordpress/block-editor';\nimport { Component } from '@wordpress/element';\nimport {\n\tcompose,\n\tdebounce,\n\twithPreferredColorScheme,\n} from '@wordpress/compose';\nimport { withSelect } from '@wordpress/data';\nimport { childrenBlock } from '@wordpress/blocks';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { BACKSPACE, DELETE, ENTER } from '@wordpress/keycodes';\nimport { isURL } from '@wordpress/url';\nimport { atSymbol, plus } from '@wordpress/icons';\nimport { __ } from '@wordpress/i18n';\nimport {\n\tapplyFormat,\n\tgetActiveFormat,\n\tgetActiveFormats,\n\tinsert,\n\tgetTextContent,\n\tisEmpty,\n\tcreate,\n\ttoHTMLString,\n\tisCollapsed,\n\tremove,\n} from '@wordpress/rich-text';\n\n/**\n * Internal dependencies\n */\nimport { useFormatTypes } from './use-format-types';\nimport FormatEdit from './format-edit';\nimport { getFormatColors } from './get-format-colors';\nimport styles from './style.scss';\nimport ToolbarButtonWithOptions from './toolbar-button-with-options';\n\nconst unescapeSpaces = ( text ) => {\n\treturn text.replace( /&nbsp;|&#160;/gi, ' ' );\n};\n\n// The flattened color palettes array is memoized to ensure that the same array instance is\n// returned for the colors palettes. This value might be used as a prop, so having the same\n// instance will prevent unnecessary re-renders of the RichText component.\nconst flatColorPalettes = memize( ( colorsPalettes ) => [\n\t...( colorsPalettes?.theme || [] ),\n\t...( colorsPalettes?.custom || [] ),\n\t...( colorsPalettes?.default || [] ),\n] );\n\nconst getSelectionColor = memize(\n\t(\n\t\tcurrentSelectionColor,\n\t\tdefaultSelectionColor,\n\t\tbaseGlobalStyles,\n\t\tisBlockBasedTheme\n\t) => {\n\t\tlet selectionColor = defaultSelectionColor;\n\t\tif ( currentSelectionColor ) {\n\t\t\tselectionColor = currentSelectionColor;\n\t\t}\n\n\t\tif ( isBlockBasedTheme ) {\n\t\t\tconst colordTextColor = colord( selectionColor );\n\t\t\tconst colordBackgroundColor = colord(\n\t\t\t\tbaseGlobalStyles?.color?.background\n\t\t\t);\n\t\t\tconst isColordTextReadable = colordTextColor.isReadable(\n\t\t\t\tcolordBackgroundColor\n\t\t\t);\n\t\t\tif ( ! isColordTextReadable ) {\n\t\t\t\tselectionColor = baseGlobalStyles?.color?.text;\n\t\t\t}\n\t\t}\n\n\t\treturn selectionColor;\n\t}\n);\n\nconst gutenbergFormatNamesToAztec = {\n\t'core/bold': 'bold',\n\t'core/italic': 'italic',\n\t'core/strikethrough': 'strikethrough',\n\t'core/text-color': 'mark',\n};\n\nconst EMPTY_PARAGRAPH_TAGS = '<p></p>';\nconst DEFAULT_FONT_SIZE = 16;\nconst MIN_LINE_HEIGHT = 1;\n\nexport class RichText extends Component {\n\tconstructor( {\n\t\tvalue,\n\t\tselectionStart,\n\t\tselectionEnd,\n\t\t__unstableMultilineTag: multiline,\n\t} ) {\n\t\tsuper( ...arguments );\n\n\t\tthis.isMultiline = false;\n\t\tif ( multiline === true || multiline === 'p' || multiline === 'li' ) {\n\t\t\tthis.multilineTag = multiline === true ? 'p' : multiline;\n\t\t\tthis.isMultiline = true;\n\t\t}\n\n\t\tif ( this.multilineTag === 'li' ) {\n\t\t\tthis.multilineWrapperTags = [ 'ul', 'ol' ];\n\t\t}\n\n\t\tthis.isIOS = Platform.OS === 'ios';\n\t\tthis.createRecord = this.createRecord.bind( this );\n\t\tthis.restoreParagraphTags = this.restoreParagraphTags.bind( this );\n\t\tthis.onChangeFromAztec = this.onChangeFromAztec.bind( this );\n\t\tthis.onKeyDown = this.onKeyDown.bind( this );\n\t\tthis.handleEnter = this.handleEnter.bind( this );\n\t\tthis.handleDelete = this.handleDelete.bind( this );\n\t\tthis.onPaste = this.onPaste.bind( this );\n\t\tthis.onFocus = this.onFocus.bind( this );\n\t\tthis.onBlur = this.onBlur.bind( this );\n\t\tthis.onTextUpdate = this.onTextUpdate.bind( this );\n\t\tthis.onContentSizeChange = this.onContentSizeChange.bind( this );\n\t\tthis.onFormatChange = this.onFormatChange.bind( this );\n\t\tthis.formatToValue = memize( this.formatToValue.bind( this ), {\n\t\t\tmaxSize: 1,\n\t\t} );\n\t\tthis.debounceCreateUndoLevel = debounce( this.onCreateUndoLevel, 1000 );\n\t\t// This prevents a bug in Aztec which triggers onSelectionChange twice on format change.\n\t\tthis.onSelectionChange = this.onSelectionChange.bind( this );\n\t\tthis.onSelectionChangeFromAztec =\n\t\t\tthis.onSelectionChangeFromAztec.bind( this );\n\t\tthis.valueToFormat = this.valueToFormat.bind( this );\n\t\tthis.getHtmlToRender = this.getHtmlToRender.bind( this );\n\t\tthis.handleSuggestionFunc = this.handleSuggestionFunc.bind( this );\n\t\tthis.handleUserSuggestion = this.handleSuggestionFunc(\n\t\t\tshowUserSuggestions,\n\t\t\t'@'\n\t\t).bind( this );\n\t\tthis.handleXpostSuggestion = this.handleSuggestionFunc(\n\t\t\tshowXpostSuggestions,\n\t\t\t'+'\n\t\t).bind( this );\n\t\tthis.suggestionOptions = this.suggestionOptions.bind( this );\n\t\tthis.insertString = this.insertString.bind( this );\n\t\tthis.manipulateEventCounterToForceNativeToRefresh =\n\t\t\tthis.manipulateEventCounterToForceNativeToRefresh.bind( this );\n\t\tthis.shouldDropEventFromAztec =\n\t\t\tthis.shouldDropEventFromAztec.bind( this );\n\t\tthis.state = {\n\t\t\tactiveFormats: [],\n\t\t\tselectedFormat: null,\n\t\t\theight: 0,\n\t\t\tcurrentFontSize: this.getFontSize( arguments[ 0 ] ),\n\t\t};\n\t\tthis.needsSelectionUpdate = false;\n\t\tthis.savedContent = '';\n\t\tthis.isTouched = false;\n\t\tthis.lastAztecEventType = null;\n\n\t\tthis.lastHistoryValue = value;\n\n\t\t// Internal values that are update synchronously, unlike props.\n\t\tthis.value = value;\n\t\tthis.selectionStart = selectionStart;\n\t\tthis.selectionEnd = selectionEnd;\n\t}\n\n\t/**\n\t * Get the current record (value and selection) from props and state.\n\t *\n\t * @return {Object} The current record (value and selection).\n\t */\n\tgetRecord() {\n\t\tconst {\n\t\t\tselectionStart: start,\n\t\t\tselectionEnd: end,\n\t\t\tcolorPalette,\n\t\t} = this.props;\n\t\tconst { value } = this.props;\n\t\tconst currentValue = this.formatToValue( value );\n\n\t\tconst { formats, replacements, text } = currentValue;\n\t\tconst { activeFormats } = this.state;\n\t\tconst newFormats = getFormatColors( value, formats, colorPalette );\n\n\t\treturn {\n\t\t\tformats: newFormats,\n\t\t\treplacements,\n\t\t\ttext,\n\t\t\tstart,\n\t\t\tend,\n\t\t\tactiveFormats,\n\t\t};\n\t}\n\n\t/**\n\t * Creates a RichText value \"record\" from the current content and selection\n\t * information\n\t *\n\t *\n\t * @return {Object} A RichText value with formats and selection.\n\t */\n\tcreateRecord() {\n\t\tconst { preserveWhiteSpace } = this.props;\n\t\tconst value = {\n\t\t\tstart: this.selectionStart,\n\t\t\tend: this.selectionEnd,\n\t\t\t...create( {\n\t\t\t\thtml: this.value,\n\t\t\t\trange: null,\n\t\t\t\tmultilineTag: this.multilineTag,\n\t\t\t\tmultilineWrapperTags: this.multilineWrapperTags,\n\t\t\t\tpreserveWhiteSpace,\n\t\t\t} ),\n\t\t};\n\t\tconst start = Math.min( this.selectionStart, value.text.length );\n\t\tconst end = Math.min( this.selectionEnd, value.text.length );\n\t\treturn { ...value, start, end };\n\t}\n\n\tvalueToFormat( value ) {\n\t\t// Remove the outer root tags.\n\t\treturn this.removeRootTagsProducedByAztec(\n\t\t\ttoHTMLString( {\n\t\t\t\tvalue,\n\t\t\t\tmultilineTag: this.multilineTag,\n\t\t\t} )\n\t\t);\n\t}\n\n\tgetActiveFormatNames( record ) {\n\t\tconst { formatTypes } = this.props;\n\n\t\treturn formatTypes\n\t\t\t.map( ( { name } ) => name )\n\t\t\t.filter( ( name ) => {\n\t\t\t\treturn getActiveFormat( record, name ) !== undefined;\n\t\t\t} )\n\t\t\t.map( ( name ) => gutenbergFormatNamesToAztec[ name ] )\n\t\t\t.filter( Boolean );\n\t}\n\n\tonFormatChange( record ) {\n\t\tconst { start = 0, end = 0, activeFormats = [] } = record;\n\t\tconst changeHandlers = Object.fromEntries(\n\t\t\tObject.entries( this.props ).filter( ( [ key ] ) =>\n\t\t\t\tkey.startsWith( 'format_on_change_functions_' )\n\t\t\t)\n\t\t);\n\n\t\tObject.values( changeHandlers ).forEach( ( changeHandler ) => {\n\t\t\tchangeHandler( record.formats, record.text );\n\t\t} );\n\n\t\tthis.value = this.valueToFormat( record );\n\t\tthis.props.onChange( this.value );\n\t\tthis.setState( { activeFormats } );\n\t\tthis.props.onSelectionChange( start, end );\n\t\tthis.selectionStart = start;\n\t\tthis.selectionEnd = end;\n\n\t\tthis.onCreateUndoLevel();\n\n\t\tthis.lastAztecEventType = 'format change';\n\t}\n\n\tinsertString( record, string ) {\n\t\tif ( record && string ) {\n\t\t\tthis.manipulateEventCounterToForceNativeToRefresh(); // force a refresh on the native side\n\t\t\tconst toInsert = insert( record, string );\n\t\t\tthis.onFormatChange( toInsert );\n\t\t}\n\t}\n\n\tonCreateUndoLevel() {\n\t\tconst { __unstableOnCreateUndoLevel: onCreateUndoLevel } = this.props;\n\t\t// If the content is the same, no level needs to be created.\n\t\tif ( this.lastHistoryValue === this.value ) {\n\t\t\treturn;\n\t\t}\n\n\t\tonCreateUndoLevel();\n\t\tthis.lastHistoryValue = this.value;\n\t}\n\n\t/*\n\t * Cleans up any root tags produced by aztec.\n\t * TODO: This should be removed on a later version when aztec doesn't return the top tag of the text being edited\n\t */\n\tremoveRootTagsProducedByAztec( html ) {\n\t\tlet result = this.removeRootTag( this.props.tagName, html );\n\n\t\tif ( this.props.tagsToEliminate ) {\n\t\t\tthis.props.tagsToEliminate.forEach( ( element ) => {\n\t\t\t\tresult = this.removeTag( element, result );\n\t\t\t} );\n\t\t}\n\n\t\treturn result;\n\t}\n\n\tremoveRootTag( tag, html ) {\n\t\tconst openingTagRegexp = RegExp( '^<' + tag + '[^>]*>', 'gim' );\n\t\tconst closingTagRegexp = RegExp( '</' + tag + '>$', 'gim' );\n\n\t\treturn html\n\t\t\t.replace( openingTagRegexp, '' )\n\t\t\t.replace( closingTagRegexp, '' );\n\t}\n\n\tremoveTag( tag, html ) {\n\t\tconst openingTagRegexp = RegExp( '<' + tag + '>', 'gim' );\n\t\tconst closingTagRegexp = RegExp( '</' + tag + '>', 'gim' );\n\t\treturn html\n\t\t\t.replace( openingTagRegexp, '' )\n\t\t\t.replace( closingTagRegexp, '' );\n\t}\n\n\t/*\n\t * Handles any case where the content of the AztecRN instance has changed\n\t */\n\tonChangeFromAztec( event ) {\n\t\tif ( this.shouldDropEventFromAztec( event, 'onChange' ) ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst contentWithoutRootTag = this.removeRootTagsProducedByAztec(\n\t\t\tunescapeSpaces( event.nativeEvent.text )\n\t\t);\n\t\t// On iOS, onChange can be triggered after selection changes, even though there are no content changes.\n\t\tif ( contentWithoutRootTag === this.value ) {\n\t\t\treturn;\n\t\t}\n\t\tthis.lastEventCount = event.nativeEvent.eventCount;\n\t\tthis.comesFromAztec = true;\n\t\tthis.firedAfterTextChanged = true; // The onChange event always fires after the fact.\n\t\tthis.onTextUpdate( event );\n\t\tthis.lastAztecEventType = 'input';\n\t}\n\n\tonTextUpdate( event ) {\n\t\tconst contentWithoutRootTag = this.removeRootTagsProducedByAztec(\n\t\t\tunescapeSpaces( event.nativeEvent.text )\n\t\t);\n\t\tlet formattedContent = contentWithoutRootTag;\n\t\tif ( ! this.isIOS ) {\n\t\t\tformattedContent = this.restoreParagraphTags(\n\t\t\t\tcontentWithoutRootTag,\n\t\t\t\tthis.multilineTag\n\t\t\t);\n\t\t}\n\n\t\tthis.debounceCreateUndoLevel();\n\t\tconst refresh = this.value !== formattedContent;\n\t\tthis.value = formattedContent;\n\n\t\t// We don't want to refresh if our goal is just to create a record.\n\t\tif ( refresh ) {\n\t\t\tthis.props.onChange( formattedContent );\n\t\t}\n\t}\n\n\trestoreParagraphTags( value, tag ) {\n\t\tif ( tag === 'p' && ( ! value || ! value.startsWith( '<p>' ) ) ) {\n\t\t\treturn '<p>' + value + '</p>';\n\t\t}\n\t\treturn value;\n\t}\n\n\t/*\n\t * Handles any case where the content of the AztecRN instance has changed in size\n\t */\n\tonContentSizeChange( contentSize ) {\n\t\tthis.setState( contentSize );\n\t\tthis.lastAztecEventType = 'content size change';\n\t}\n\n\tonKeyDown( event ) {\n\t\tif ( event.defaultPrevented ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Add stubs for conformance in downstream autocompleters logic.\n\t\tthis.customEditableOnKeyDown?.( {\n\t\t\tpreventDefault: () => undefined,\n\t\t\t...event,\n\t\t\tkey: RCTAztecView.KeyCodes[ event?.keyCode ],\n\t\t} );\n\n\t\tthis.handleDelete( event );\n\t\tthis.handleEnter( event );\n\t\tthis.handleTriggerKeyCodes( event );\n\t}\n\n\thandleEnter( event ) {\n\t\tif ( event.keyCode !== ENTER ) {\n\t\t\treturn;\n\t\t}\n\t\tconst { onEnter } = this.props;\n\n\t\tif ( ! onEnter ) {\n\t\t\treturn;\n\t\t}\n\n\t\tonEnter( {\n\t\t\tvalue: this.createRecord(),\n\t\t\tonChange: this.onFormatChange,\n\t\t\tshiftKey: event.shiftKey,\n\t\t} );\n\t\tthis.lastAztecEventType = 'input';\n\t}\n\n\thandleDelete( event ) {\n\t\tif ( this.shouldDropEventFromAztec( event, 'handleDelete' ) ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst { keyCode } = event;\n\n\t\tif ( keyCode !== DELETE && keyCode !== BACKSPACE ) {\n\t\t\treturn;\n\t\t}\n\t\tconst isReverse = keyCode === BACKSPACE;\n\n\t\tconst { onDelete } = this.props;\n\t\tthis.lastEventCount = event.nativeEvent.eventCount;\n\t\tthis.comesFromAztec = true;\n\t\tthis.firedAfterTextChanged = event.nativeEvent.firedAfterTextChanged;\n\t\tconst value = this.createRecord();\n\t\tconst { start, end, text } = value;\n\t\tlet newValue;\n\n\t\t// Always handle full content deletion ourselves.\n\t\tif ( start === 0 && end !== 0 && end >= text.length ) {\n\t\t\tnewValue = remove( value );\n\t\t\tthis.onFormatChange( newValue );\n\t\t\tevent.preventDefault();\n\t\t\treturn;\n\t\t}\n\n\t\t// Only process delete if the key press occurs at an uncollapsed edge.\n\t\tif (\n\t\t\t! onDelete ||\n\t\t\t! isCollapsed( value ) ||\n\t\t\t( isReverse && start !== 0 ) ||\n\t\t\t( ! isReverse && end !== text.length )\n\t\t) {\n\t\t\treturn;\n\t\t}\n\n\t\tonDelete( { isReverse, value } );\n\n\t\tevent.preventDefault();\n\t\tthis.lastAztecEventType = 'input';\n\t}\n\n\thandleTriggerKeyCodes( event ) {\n\t\tconst { keyCode } = event;\n\t\tconst triggeredOption = this.suggestionOptions().find( ( option ) => {\n\t\t\tconst triggeredKeyCode = option.triggerChar.charCodeAt( 0 );\n\t\t\treturn triggeredKeyCode === keyCode;\n\t\t} );\n\n\t\tif ( triggeredOption ) {\n\t\t\tconst record = this.getRecord();\n\t\t\tconst text = getTextContent( record );\n\t\t\t// Only respond to the trigger if the selection is on the start of text or line\n\t\t\t// or if the character before is a space.\n\t\t\tconst useTrigger =\n\t\t\t\ttext.length === 0 ||\n\t\t\t\trecord.start === 0 ||\n\t\t\t\ttext.charAt( record.start - 1 ) === '\\n' ||\n\t\t\t\ttext.charAt( record.start - 1 ) === ' ';\n\n\t\t\tif ( useTrigger && triggeredOption.onClick ) {\n\t\t\t\ttriggeredOption.onClick();\n\t\t\t} else {\n\t\t\t\tthis.insertString( record, triggeredOption.triggerChar );\n\t\t\t}\n\t\t}\n\t}\n\n\tsuggestionOptions() {\n\t\tconst { areMentionsSupported, areXPostsSupported } = this.props;\n\t\tconst allOptions = [\n\t\t\t{\n\t\t\t\tsupported: areMentionsSupported,\n\t\t\t\ttitle: __( 'Insert mention' ),\n\t\t\t\tonClick: this.handleUserSuggestion,\n\t\t\t\ttriggerChar: '@',\n\t\t\t\tvalue: 'mention',\n\t\t\t\tlabel: __( 'Mention' ),\n\t\t\t\ticon: atSymbol,\n\t\t\t},\n\t\t\t{\n\t\t\t\tsupported: areXPostsSupported,\n\t\t\t\ttitle: __( 'Insert crosspost' ),\n\t\t\t\tonClick: this.handleXpostSuggestion,\n\t\t\t\ttriggerChar: '+',\n\t\t\t\tvalue: 'crosspost',\n\t\t\t\tlabel: __( 'Crosspost' ),\n\t\t\t\ticon: plus,\n\t\t\t},\n\t\t];\n\t\treturn allOptions.filter( ( op ) => op.supported );\n\t}\n\n\thandleSuggestionFunc( suggestionFunction, prefix ) {\n\t\treturn () => {\n\t\t\tconst record = this.getRecord();\n\t\t\tsuggestionFunction()\n\t\t\t\t.then( ( suggestion ) => {\n\t\t\t\t\tthis.insertString( record, `${ prefix }${ suggestion } ` );\n\t\t\t\t} )\n\t\t\t\t.catch( () => {} );\n\t\t};\n\t}\n\n\t/**\n\t * Handles a paste event from the native Aztec Wrapper.\n\t *\n\t * @param {Object} event The paste event which wraps `nativeEvent`.\n\t */\n\tonPaste( event ) {\n\t\tconst { onPaste, onChange } = this.props;\n\t\tconst { activeFormats = [] } = this.state;\n\n\t\tconst { pastedText, pastedHtml, files } = event.nativeEvent;\n\t\tconst currentRecord = this.createRecord();\n\n\t\tevent.preventDefault();\n\n\t\t// There is a selection, check if a URL is pasted.\n\t\tif ( ! isCollapsed( currentRecord ) ) {\n\t\t\tconst trimmedText = ( pastedHtml || pastedText )\n\t\t\t\t.replace( /<[^>]+>/g, '' )\n\t\t\t\t.trim();\n\n\t\t\t// A URL was pasted, turn the selection into a link.\n\t\t\tif ( isURL( trimmedText ) ) {\n\t\t\t\tconst linkedRecord = applyFormat( currentRecord, {\n\t\t\t\t\ttype: 'a',\n\t\t\t\t\tattributes: {\n\t\t\t\t\t\thref: decodeEntities( trimmedText ),\n\t\t\t\t\t},\n\t\t\t\t} );\n\t\t\t\tthis.value = this.valueToFormat( linkedRecord );\n\t\t\t\tonChange( this.value );\n\n\t\t\t\t// Allows us to ask for this information when we get a report.\n\t\t\t\twindow.console.log( 'Created link:\\n\\n', trimmedText );\n\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\n\t\tif ( onPaste ) {\n\t\t\tonPaste( {\n\t\t\t\tvalue: currentRecord,\n\t\t\t\tonChange: this.onFormatChange,\n\t\t\t\thtml: pastedHtml,\n\t\t\t\tplainText: pastedText,\n\t\t\t\tfiles,\n\t\t\t\tactiveFormats,\n\t\t\t} );\n\t\t}\n\t}\n\n\tonFocus() {\n\t\tthis.isTouched = true;\n\n\t\tconst { unstableOnFocus, onSelectionChange } = this.props;\n\n\t\tif ( unstableOnFocus ) {\n\t\t\tunstableOnFocus();\n\t\t}\n\n\t\t// We know for certain that on focus, the old selection is invalid. It\n\t\t// will be recalculated on `selectionchange`.\n\n\t\tonSelectionChange( this.selectionStart, this.selectionEnd );\n\n\t\tthis.lastAztecEventType = 'focus';\n\t}\n\n\tonBlur( event ) {\n\t\tthis.isTouched = false;\n\n\t\t// Check if value is up to date with latest state of native AztecView.\n\t\tif (\n\t\t\tevent.nativeEvent.text &&\n\t\t\tevent.nativeEvent.text !== this.props.value\n\t\t) {\n\t\t\tthis.onTextUpdate( event );\n\t\t}\n\n\t\tif ( this.props.onBlur ) {\n\t\t\tthis.props.onBlur( event );\n\t\t}\n\n\t\tthis.lastAztecEventType = 'blur';\n\t}\n\n\tonSelectionChange( start, end ) {\n\t\tconst hasChanged =\n\t\t\tthis.selectionStart !== start || this.selectionEnd !== end;\n\n\t\tthis.selectionStart = start;\n\t\tthis.selectionEnd = end;\n\n\t\t// This is a manual selection change event if onChange was not triggered just before\n\t\t// and we did not just trigger a text update\n\t\t// `onChange` could be the last event and could have been triggered a long time ago so\n\t\t// this approach is not perfectly reliable.\n\t\tconst isManual =\n\t\t\tthis.lastAztecEventType !== 'input' &&\n\t\t\tthis.props.value === this.value;\n\t\tif ( hasChanged && isManual ) {\n\t\t\tconst value = this.createRecord();\n\t\t\tconst activeFormats = getActiveFormats( value );\n\t\t\tthis.setState( { activeFormats } );\n\t\t}\n\n\t\tthis.props.onSelectionChange( start, end );\n\t}\n\n\tshouldDropEventFromAztec( event, logText ) {\n\t\tconst shouldDrop =\n\t\t\t! this.isIOS && event.nativeEvent.eventCount <= this.lastEventCount;\n\t\tif ( shouldDrop ) {\n\t\t\twindow.console.log(\n\t\t\t\t`Dropping ${ logText } from Aztec as its event counter is older than latest sent to the native side. Got ${ event.nativeEvent.eventCount } but lastEventCount is ${ this.lastEventCount }.`\n\t\t\t);\n\t\t}\n\t\treturn shouldDrop;\n\t}\n\n\tonSelectionChangeFromAztec( start, end, text, event ) {\n\t\tif ( this.shouldDropEventFromAztec( event, 'onSelectionChange' ) ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// `end` can be less than `start` on iOS\n\t\t// Let's fix that here so `rich-text/slice` can work properly.\n\t\tconst realStart = Math.min( start, end );\n\t\tconst realEnd = Math.max( start, end );\n\n\t\t// Check and dicsard stray event, where the text and selection is equal to the ones already cached.\n\t\tconst contentWithoutRootTag = this.removeRootTagsProducedByAztec(\n\t\t\tunescapeSpaces( event.nativeEvent.text )\n\t\t);\n\t\tif (\n\t\t\tcontentWithoutRootTag === this.value &&\n\t\t\trealStart === this.selectionStart &&\n\t\t\trealEnd === this.selectionEnd\n\t\t) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis.comesFromAztec = true;\n\t\tthis.firedAfterTextChanged = true; // Selection change event always fires after the fact.\n\n\t\t// Update text before updating selection\n\t\t// Make sure there are changes made to the content before upgrading it upward.\n\t\tthis.onTextUpdate( event );\n\n\t\t// Aztec can send us selection change events after it has lost focus.\n\t\t// For instance the autocorrect feature will complete a partially written\n\t\t// word when resigning focus, causing a selection change event.\n\t\t// Forwarding this selection change could cause this RichText to regain\n\t\t// focus and start a focus loop.\n\t\t//\n\t\t// See https://github.com/wordpress-mobile/gutenberg-mobile/issues/1696\n\t\tif ( this.props.__unstableIsSelected ) {\n\t\t\tthis.onSelectionChange( realStart, realEnd );\n\t\t}\n\t\t// Update lastEventCount to prevent Aztec from re-rendering the content it just sent.\n\t\tthis.lastEventCount = event.nativeEvent.eventCount;\n\n\t\tthis.lastAztecEventType = 'selection change';\n\t}\n\n\tisEmpty() {\n\t\treturn isEmpty( this.formatToValue( this.props.value ) );\n\t}\n\n\tformatToValue( value ) {\n\t\tconst { preserveWhiteSpace } = this.props;\n\t\t// Handle deprecated `children` and `node` sources.\n\t\tif ( Array.isArray( value ) ) {\n\t\t\treturn create( {\n\t\t\t\thtml: childrenBlock.toHTML( value ),\n\t\t\t\tmultilineTag: this.multilineTag,\n\t\t\t\tmultilineWrapperTags: this.multilineWrapperTags,\n\t\t\t\tpreserveWhiteSpace,\n\t\t\t} );\n\t\t}\n\n\t\tif ( this.props.format === 'string' ) {\n\t\t\treturn create( {\n\t\t\t\thtml: value,\n\t\t\t\tmultilineTag: this.multilineTag,\n\t\t\t\tmultilineWrapperTags: this.multilineWrapperTags,\n\t\t\t\tpreserveWhiteSpace,\n\t\t\t} );\n\t\t}\n\n\t\t// Guard for blocks passing `null` in onSplit callbacks. May be removed\n\t\t// if onSplit is revised to not pass a `null` value.\n\t\tif ( value === null ) {\n\t\t\treturn create();\n\t\t}\n\n\t\treturn value;\n\t}\n\n\tmanipulateEventCounterToForceNativeToRefresh() {\n\t\tif ( this.isIOS ) {\n\t\t\tthis.lastEventCount = undefined;\n\t\t\treturn;\n\t\t}\n\n\t\tif ( typeof this.lastEventCount !== 'undefined' ) {\n\t\t\tthis.lastEventCount += 100; // bump by a hundred, hopefully native hasn't bombarded the JS side in the meantime.\n\t\t} // no need to bump when 'undefined' as native side won't receive the key when the value is undefined, and that will cause force updating anyway,\n\t\t// see https://github.com/WordPress/gutenberg/blob/82e578dcc75e67891c750a41a04c1e31994192fc/packages/react-native-aztec/android/src/main/java/org/wordpress/mobile/ReactNativeAztec/ReactAztecManager.java#L213-L215\n\t}\n\n\tshouldComponentUpdate( nextProps, nextState ) {\n\t\tif (\n\t\t\tnextProps.tagName !== this.props.tagName ||\n\t\t\tnextProps.reversed !== this.props.reversed ||\n\t\t\tnextProps.start !== this.props.start\n\t\t) {\n\t\t\tthis.manipulateEventCounterToForceNativeToRefresh(); // force a refresh on the native side\n\t\t\tthis.value = undefined;\n\t\t\treturn true;\n\t\t}\n\n\t\t// TODO: Please re-introduce the check to avoid updating the content right after an `onChange` call.\n\t\t// It was removed in https://github.com/WordPress/gutenberg/pull/12417 to fix undo/redo problem.\n\n\t\t// If the component is changed React side (undo/redo/merging/splitting/custom text actions)\n\t\t// we need to make sure the native is updated as well.\n\n\t\t// Also, don't trust the \"this.lastContent\" as on Android, incomplete text events arrive\n\t\t// with only some of the text, while the virtual keyboard's suggestion system does its magic.\n\t\t// ** compare with this.lastContent for optimizing performance by not forcing Aztec with text it already has\n\t\t// , but compare with props.value to not lose \"half word\" text because of Android virtual keyb autosuggestion behavior\n\t\tif (\n\t\t\ttypeof nextProps.value !== 'undefined' &&\n\t\t\ttypeof this.props.value !== 'undefined' &&\n\t\t\t( ! this.comesFromAztec || ! this.firedAfterTextChanged ) &&\n\t\t\tnextProps.value !== this.props.value\n\t\t) {\n\t\t\t// Gutenberg seems to try to mirror the caret state even on events that only change the content so,\n\t\t\t// let's force caret update if state has selection set.\n\t\t\tif (\n\t\t\t\ttypeof nextProps.selectionStart !== 'undefined' &&\n\t\t\t\ttypeof nextProps.selectionEnd !== 'undefined'\n\t\t\t) {\n\t\t\t\tthis.needsSelectionUpdate = true;\n\t\t\t}\n\n\t\t\tthis.manipulateEventCounterToForceNativeToRefresh(); // force a refresh on the native side\n\t\t}\n\n\t\tif ( ! this.comesFromAztec ) {\n\t\t\tif (\n\t\t\t\ttypeof nextProps.selectionStart !== 'undefined' &&\n\t\t\t\ttypeof nextProps.selectionEnd !== 'undefined' &&\n\t\t\t\tnextProps.selectionStart !== this.props.selectionStart &&\n\t\t\t\tnextProps.selectionStart !== this.selectionStart &&\n\t\t\t\tnextProps.__unstableIsSelected\n\t\t\t) {\n\t\t\t\tthis.needsSelectionUpdate = true;\n\t\t\t\tthis.manipulateEventCounterToForceNativeToRefresh(); // force a refresh on the native side\n\t\t\t}\n\n\t\t\t// For font size changes from a prop value a force refresh\n\t\t\t// is needed without the selection update.\n\t\t\tif ( nextProps?.fontSize !== this.props?.fontSize ) {\n\t\t\t\tthis.manipulateEventCounterToForceNativeToRefresh(); // force a refresh on the native side\n\t\t\t}\n\n\t\t\tif (\n\t\t\t\t( nextProps?.style?.fontSize !== this.props?.style?.fontSize &&\n\t\t\t\t\tnextState.currentFontSize !==\n\t\t\t\t\t\tthis.state.currentFontSize ) ||\n\t\t\t\tnextState.currentFontSize !== this.state.currentFontSize ||\n\t\t\t\tnextProps?.style?.lineHeight !== this.props?.style?.lineHeight\n\t\t\t) {\n\t\t\t\tthis.needsSelectionUpdate = true;\n\t\t\t\tthis.manipulateEventCounterToForceNativeToRefresh(); // force a refresh on the native side\n\t\t\t}\n\t\t}\n\n\t\treturn true;\n\t}\n\n\tcomponentDidMount() {\n\t\t// Request focus if wrapping block is selected and parent hasn't inhibited the focus request. This method of focusing\n\t\t// is trying to implement the web-side counterpart of BlockList's `focusTabbable` where the BlockList is focusing an\n\t\t// inputbox by searching the DOM. We don't have the DOM in RN so, using the combination of blockIsSelected and __unstableMobileNoFocusOnMount\n\t\t// to determine if we should focus the RichText.\n\t\tif (\n\t\t\tthis.props.blockIsSelected &&\n\t\t\t! this.props.__unstableMobileNoFocusOnMount\n\t\t) {\n\t\t\tthis._editor.focus();\n\t\t\tthis.onSelectionChange(\n\t\t\t\tthis.props.selectionStart || 0,\n\t\t\t\tthis.props.selectionEnd || 0\n\t\t\t);\n\t\t}\n\t}\n\n\tcomponentWillUnmount() {\n\t\tif ( this._editor.isFocused() ) {\n\t\t\tthis._editor.blur();\n\t\t}\n\t}\n\n\tcomponentDidUpdate( prevProps ) {\n\t\tconst { style, tagName } = this.props;\n\t\tconst { currentFontSize } = this.state;\n\n\t\tif ( this.props.value !== this.value ) {\n\t\t\tthis.value = this.props.value;\n\t\t}\n\t\tconst { __unstableIsSelected: isSelected } = this.props;\n\n\t\tconst { __unstableIsSelected: prevIsSelected } = prevProps;\n\n\t\tif ( isSelected && ! prevIsSelected ) {\n\t\t\tthis._editor.focus();\n\t\t\t// Update selection props explicitly when component is selected as Aztec won't call onSelectionChange\n\t\t\t// if its internal value hasn't change. When created, default value is 0, 0.\n\t\t\tthis.onSelectionChange(\n\t\t\t\tthis.props.selectionStart || 0,\n\t\t\t\tthis.props.selectionEnd || 0\n\t\t\t);\n\t\t} else if ( ! isSelected && prevIsSelected ) {\n\t\t\tthis._editor.blur();\n\t\t}\n\n\t\t// For font size values changes from the font size picker\n\t\t// we compare previous values to refresh the selected font size,\n\t\t// this is also used when the tag name changes\n\t\t// e.g Heading block and a level change like h1->h2.\n\t\tconst currentFontSizeStyle = this.getParsedFontSize( style?.fontSize );\n\t\tconst prevFontSizeStyle = this.getParsedFontSize(\n\t\t\tprevProps?.style?.fontSize\n\t\t);\n\t\tconst isDifferentTag = prevProps.tagName !== tagName;\n\t\tif (\n\t\t\t( currentFontSize &&\n\t\t\t\t( currentFontSizeStyle || prevFontSizeStyle ) &&\n\t\t\t\tcurrentFontSizeStyle !== currentFontSize ) ||\n\t\t\tisDifferentTag\n\t\t) {\n\t\t\tthis.setState( {\n\t\t\t\tcurrentFontSize: this.getFontSize( this.props ),\n\t\t\t} );\n\t\t}\n\t}\n\n\tgetHtmlToRender( record, tagName ) {\n\t\t// Save back to HTML from React tree.\n\t\tlet value = this.valueToFormat( record );\n\n\t\tif ( value === undefined ) {\n\t\t\tthis.manipulateEventCounterToForceNativeToRefresh(); // force a refresh on the native side\n\t\t\tvalue = '';\n\t\t}\n\t\t// On android if content is empty we need to send no content or else the placeholder will not show.\n\t\tif (\n\t\t\t! this.isIOS &&\n\t\t\t( value === '' || value === EMPTY_PARAGRAPH_TAGS )\n\t\t) {\n\t\t\treturn '';\n\t\t}\n\n\t\tif ( tagName ) {\n\t\t\tlet extraAttributes = ``;\n\t\t\tif ( tagName === `ol` ) {\n\t\t\t\tif ( this.props.reversed ) {\n\t\t\t\t\textraAttributes += ` reversed`;\n\t\t\t\t}\n\t\t\t\tif ( this.props.start ) {\n\t\t\t\t\textraAttributes += ` start=${ this.props.start }`;\n\t\t\t\t}\n\t\t\t}\n\t\t\tvalue = `<${ tagName }${ extraAttributes }>${ value }</${ tagName }>`;\n\t\t}\n\t\treturn value;\n\t}\n\n\tgetEditableProps() {\n\t\treturn {\n\t\t\t// Overridable props.\n\t\t\tstyle: {},\n\t\t\tclassName: 'rich-text',\n\t\t\tonKeyDown: () => null,\n\t\t};\n\t}\n\n\tgetParsedFontSize( fontSize ) {\n\t\tconst { height, width } = Dimensions.get( 'window' );\n\t\tconst cssUnitOptions = { height, width, fontSize: DEFAULT_FONT_SIZE };\n\n\t\tif ( ! fontSize ) {\n\t\t\treturn fontSize;\n\t\t}\n\n\t\tconst selectedPxValue =\n\t\t\tgetPxFromCssUnit( fontSize, cssUnitOptions ) ?? DEFAULT_FONT_SIZE;\n\n\t\treturn parseFloat( selectedPxValue );\n\t}\n\n\tgetFontSize( props ) {\n\t\tconst { baseGlobalStyles, tagName, fontSize, style } = props;\n\t\tconst tagNameFontSize =\n\t\t\tbaseGlobalStyles?.elements?.[ tagName ]?.typography?.fontSize;\n\n\t\tlet newFontSize = DEFAULT_FONT_SIZE;\n\n\t\t// Disables line-height rendering for pre elements until we fix some issues with AztecAndroid.\n\t\tif ( tagName === 'pre' && ! this.isIOS ) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\t// For block-based themes, get the default editor font size.\n\t\tif ( baseGlobalStyles?.typography?.fontSize && tagName === 'p' ) {\n\t\t\tnewFontSize = baseGlobalStyles?.typography?.fontSize;\n\t\t}\n\n\t\t// For block-based themes, get the default element font size\n\t\t// e.g h1, h2.\n\t\tif ( tagNameFontSize ) {\n\t\t\tnewFontSize = tagNameFontSize;\n\t\t}\n\n\t\t// For font size values provided from the styles,\n\t\t// usually from values set from the font size picker.\n\t\tif ( style?.fontSize ) {\n\t\t\tnewFontSize = style.fontSize;\n\t\t}\n\n\t\t// Fall-back to a font size provided from its props (if there's any)\n\t\t// and there are no other default values to use.\n\t\tif ( fontSize && ! tagNameFontSize && ! style?.fontSize ) {\n\t\t\tnewFontSize = fontSize;\n\t\t}\n\n\t\t// We need to always convert to px units because the selected value\n\t\t// could be coming from the web where it could be stored as a different unit.\n\t\tconst selectedPxValue = this.getParsedFontSize( newFontSize );\n\n\t\treturn selectedPxValue;\n\t}\n\n\tgetLineHeight() {\n\t\tconst { baseGlobalStyles, tagName, lineHeight, style } = this.props;\n\t\tconst tagNameLineHeight =\n\t\t\tbaseGlobalStyles?.elements?.[ tagName ]?.typography?.lineHeight;\n\t\tlet newLineHeight;\n\n\t\t// Disables line-height rendering for pre elements until we fix some issues with AztecAndroid.\n\t\tif ( tagName === 'pre' && ! this.isIOS ) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\tif ( ! this.getIsBlockBasedTheme() ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// For block-based themes, get the default editor line height.\n\t\tif ( baseGlobalStyles?.typography?.lineHeight && tagName === 'p' ) {\n\t\t\tnewLineHeight = parseFloat(\n\t\t\t\tbaseGlobalStyles?.typography?.lineHeight\n\t\t\t);\n\t\t}\n\n\t\t// For block-based themes, get the default element line height\n\t\t// e.g h1, h2.\n\t\tif ( tagNameLineHeight ) {\n\t\t\tnewLineHeight = parseFloat( tagNameLineHeight );\n\t\t}\n\n\t\t// For line height values provided from the styles,\n\t\t// usually from values set from the line height picker.\n\t\tif ( style?.lineHeight ) {\n\t\t\tnewLineHeight = parseFloat( style.lineHeight );\n\t\t}\n\n\t\t// Fall-back to a line height provided from its props (if there's any)\n\t\t// and there are no other default values to use.\n\t\tif ( lineHeight && ! tagNameLineHeight && ! style?.lineHeight ) {\n\t\t\tnewLineHeight = lineHeight;\n\t\t}\n\n\t\t// Check the final value is not over the minimum supported value.\n\t\tif ( newLineHeight && newLineHeight < MIN_LINE_HEIGHT ) {\n\t\t\tnewLineHeight = MIN_LINE_HEIGHT;\n\t\t}\n\n\t\t// Until we parse CSS values correctly, avoid passing NaN values to Aztec\n\t\tif ( isNaN( newLineHeight ) ) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\treturn newLineHeight;\n\t}\n\n\tgetIsBlockBasedTheme() {\n\t\tconst { baseGlobalStyles } = this.props;\n\n\t\treturn (\n\t\t\tbaseGlobalStyles && Object.entries( baseGlobalStyles ).length !== 0\n\t\t);\n\t}\n\n\tgetBlockUseDefaultFont() {\n\t\t// For block-based themes it enables using the defaultFont\n\t\t// in Aztec for iOS so it allows customizing the font size\n\t\t// for the Preformatted/Code and Heading blocks.\n\t\tif ( ! this.isIOS ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst { tagName } = this.props;\n\t\tconst isBlockBasedTheme = this.getIsBlockBasedTheme();\n\t\tconst tagsToMatch = /pre|h([1-6])$/gm;\n\n\t\treturn isBlockBasedTheme && tagsToMatch.test( tagName );\n\t}\n\n\tgetLinkTextColor( defaultColor ) {\n\t\tconst { style } = this.props;\n\t\tconst customColor = style?.linkColor && colord( style.linkColor );\n\n\t\treturn customColor && customColor.isValid()\n\t\t\t? customColor.toHex()\n\t\t\t: defaultColor;\n\t}\n\n\tgetPlaceholderTextColor() {\n\t\tconst {\n\t\t\tbaseGlobalStyles,\n\t\t\tgetStylesFromColorScheme,\n\t\t\tplaceholderTextColor,\n\t\t\tstyle,\n\t\t} = this.props;\n\n\t\t// Default placeholder text color.\n\t\tconst placeholderStyle = getStylesFromColorScheme(\n\t\t\tstyles.richTextPlaceholder,\n\t\t\tstyles.richTextPlaceholderDark\n\t\t);\n\t\tconst { color: defaultPlaceholderTextColor } = placeholderStyle;\n\t\t// Custom 63% opacity for theme and inherited colors.\n\t\tconst placeholderOpacity = 'A1';\n\n\t\t// Determine inherited placeholder color if available.\n\t\tconst inheritPlaceholderColor = style?.placeholderColor\n\t\t\t? `${ style.placeholderColor }${ placeholderOpacity }`\n\t\t\t: undefined;\n\n\t\t// If using block-based themes, derive the placeholder color from global styles.\n\t\tconst globalStylesPlaceholderColor = baseGlobalStyles?.color?.text\n\t\t\t? `${ baseGlobalStyles.color.text }${ placeholderOpacity }`\n\t\t\t: undefined;\n\n\t\treturn (\n\t\t\tinheritPlaceholderColor ??\n\t\t\tplaceholderTextColor ??\n\t\t\tglobalStylesPlaceholderColor ??\n\t\t\tdefaultPlaceholderTextColor\n\t\t);\n\t}\n\n\trender() {\n\t\tconst {\n\t\t\ttagName,\n\t\t\tstyle,\n\t\t\t__unstableIsSelected: isSelected,\n\t\t\tchildren,\n\t\t\tgetStylesFromColorScheme,\n\t\t\tminWidth,\n\t\t\tmaxWidth,\n\t\t\tformatTypes,\n\t\t\tparentBlockStyles,\n\t\t\taccessibilityLabel,\n\t\t\tdisableEditingMenu = false,\n\t\t\tbaseGlobalStyles,\n\t\t\tselectionStart,\n\t\t\tselectionEnd,\n\t\t\tdisableSuggestions,\n\t\t\tcontainerWidth,\n\t\t} = this.props;\n\t\tconst { currentFontSize } = this.state;\n\n\t\tconst record = this.getRecord();\n\t\tconst html = this.getHtmlToRender( record, tagName );\n\t\tconst editableProps = this.getEditableProps();\n\t\tconst blockUseDefaultFont = this.getBlockUseDefaultFont();\n\n\t\tconst fontSize = currentFontSize;\n\t\tconst lineHeight = this.getLineHeight();\n\n\t\tconst {\n\t\t\tcolor: defaultColor,\n\t\t\ttextDecorationColor: defaultTextDecorationColor,\n\t\t\tfontFamily: defaultFontFamily,\n\t\t} = getStylesFromColorScheme( styles.richText, styles.richTextDark );\n\t\tconst linkTextColor = this.getLinkTextColor(\n\t\t\tdefaultTextDecorationColor\n\t\t);\n\n\t\tconst currentSelectionStart = selectionStart ?? 0;\n\t\tconst currentSelectionEnd = selectionEnd ?? 0;\n\t\tlet selection = null;\n\t\tif ( this.needsSelectionUpdate ) {\n\t\t\tthis.needsSelectionUpdate = false;\n\t\t\tselection = {\n\t\t\t\tstart: currentSelectionStart,\n\t\t\t\tend: currentSelectionEnd,\n\t\t\t};\n\n\t\t\t// On AztecAndroid, setting the caret to an out-of-bounds position will crash the editor so, let's check for some cases.\n\t\t\tif ( ! this.isIOS ) {\n\t\t\t\t// The following regular expression is used in Aztec here:\n\t\t\t\t// https://github.com/wordpress-mobile/AztecEditor-Android/blob/b1fad439d56fa6d4aa0b78526fef355c59d00dd3/aztec/src/main/kotlin/org/wordpress/aztec/AztecParser.kt#L656\n\t\t\t\tconst brBeforeParaMatches = html.match( /(<br>)+<\\/p>$/g );\n\t\t\t\tif ( brBeforeParaMatches ) {\n\t\t\t\t\tconsole.warn(\n\t\t\t\t\t\t'Oops, BR tag(s) at the end of content. Aztec will remove them, adapting the selection...'\n\t\t\t\t\t);\n\t\t\t\t\tconst count = (\n\t\t\t\t\t\tbrBeforeParaMatches[ 0 ].match( /br/g ) || []\n\t\t\t\t\t).length;\n\t\t\t\t\tif ( count > 0 ) {\n\t\t\t\t\t\tlet newSelectionStart = currentSelectionStart - count;\n\t\t\t\t\t\tif ( newSelectionStart < 0 ) {\n\t\t\t\t\t\t\tnewSelectionStart = 0;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tlet newSelectionEnd = currentSelectionEnd - count;\n\t\t\t\t\t\tif ( newSelectionEnd < 0 ) {\n\t\t\t\t\t\t\tnewSelectionEnd = 0;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tselection = {\n\t\t\t\t\t\t\tstart: newSelectionStart,\n\t\t\t\t\t\t\tend: newSelectionEnd,\n\t\t\t\t\t\t};\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif ( this.comesFromAztec ) {\n\t\t\tthis.comesFromAztec = false;\n\t\t\tthis.firedAfterTextChanged = false;\n\t\t}\n\n\t\t// Logic below assures that `RichText` width will always have equal value when container is almost fully filled.\n\t\tconst width =\n\t\t\tmaxWidth && this.state.width && maxWidth - this.state.width < 10\n\t\t\t\t? maxWidth\n\t\t\t\t: this.state.width;\n\t\tconst containerStyles = [\n\t\t\tstyle?.padding &&\n\t\t\t\tstyle?.backgroundColor && {\n\t\t\t\t\tpadding: style.padding,\n\t\t\t\t\tbackgroundColor: style.backgroundColor,\n\t\t\t\t},\n\t\t\tcontainerWidth && {\n\t\t\t\twidth: containerWidth,\n\t\t\t},\n\t\t];\n\n\t\tconst defaultSelectionColor = getStylesFromColorScheme(\n\t\t\tstyles[ 'rich-text-selection' ],\n\t\t\tstyles[ 'rich-text-selection--dark' ]\n\t\t).color;\n\t\tconst selectionColor = getSelectionColor(\n\t\t\tthis.props.selectionColor,\n\t\t\tdefaultSelectionColor,\n\t\t\tbaseGlobalStyles,\n\t\t\tthis.getIsBlockBasedTheme()\n\t\t);\n\n\t\tconst EditableView = ( props ) => {\n\t\t\tthis.customEditableOnKeyDown = props?.onKeyDown;\n\n\t\t\treturn <></>;\n\t\t};\n\n\t\treturn (\n\t\t\t<View style={ containerStyles }>\n\t\t\t\t{ children &&\n\t\t\t\t\tchildren( {\n\t\t\t\t\t\tisSelected,\n\t\t\t\t\t\tvalue: record,\n\t\t\t\t\t\tonChange: this.onFormatChange,\n\t\t\t\t\t\tonFocus: () => {},\n\t\t\t\t\t\teditableProps,\n\t\t\t\t\t\teditableTagName: EditableView,\n\t\t\t\t\t} ) }\n\t\t\t\t<RCTAztecView\n\t\t\t\t\taccessibilityLabel={ accessibilityLabel }\n\t\t\t\t\tref={ ( ref ) => {\n\t\t\t\t\t\tthis._editor = ref;\n\n\t\t\t\t\t\tif ( this.props.setRef ) {\n\t\t\t\t\t\t\tthis.props.setRef( ref );\n\t\t\t\t\t\t}\n\t\t\t\t\t} }\n\t\t\t\t\tstyle={ {\n\t\t\t\t\t\tbackgroundColor: styles.richText.backgroundColor,\n\t\t\t\t\t\t...style,\n\t\t\t\t\t\t...( this.isIOS && minWidth && maxWidth\n\t\t\t\t\t\t\t? { width }\n\t\t\t\t\t\t\t: { maxWidth } ),\n\t\t\t\t\t\tminHeight: this.state.height,\n\t\t\t\t\t} }\n\t\t\t\t\tblockUseDefaultFont={ blockUseDefaultFont }\n\t\t\t\t\ttext={ {\n\t\t\t\t\t\ttext: html,\n\t\t\t\t\t\teventCount: this.lastEventCount,\n\t\t\t\t\t\tselection,\n\t\t\t\t\t\tlinkTextColor,\n\t\t\t\t\t\ttag: tagName,\n\t\t\t\t\t} }\n\t\t\t\t\tplaceholder={ this.props.placeholder }\n\t\t\t\t\tplaceholderTextColor={ this.getPlaceholderTextColor() }\n\t\t\t\t\tdeleteEnter={ this.props.deleteEnter }\n\t\t\t\t\tonChange={ this.onChangeFromAztec }\n\t\t\t\t\tonFocus={ this.onFocus }\n\t\t\t\t\tonBlur={ this.onBlur }\n\t\t\t\t\tonKeyDown={ this.onKeyDown }\n\t\t\t\t\ttriggerKeyCodes={\n\t\t\t\t\t\tdisableEditingMenu\n\t\t\t\t\t\t\t? []\n\t\t\t\t\t\t\t: this.suggestionOptions().map(\n\t\t\t\t\t\t\t\t\t( op ) => op.triggerChar\n\t\t\t\t\t\t\t )\n\t\t\t\t\t}\n\t\t\t\t\tonPaste={ this.onPaste }\n\t\t\t\t\tactiveFormats={ this.getActiveFormatNames( record ) }\n\t\t\t\t\tonContentSizeChange={ this.onContentSizeChange }\n\t\t\t\t\tonSelectionChange={ this.onSelectionChangeFromAztec }\n\t\t\t\t\tblockType={ { tag: tagName } }\n\t\t\t\t\tcolor={\n\t\t\t\t\t\t( style && style.color ) ||\n\t\t\t\t\t\t( parentBlockStyles && parentBlockStyles.color ) ||\n\t\t\t\t\t\t( baseGlobalStyles && baseGlobalStyles?.color?.text ) ||\n\t\t\t\t\t\tdefaultColor\n\t\t\t\t\t}\n\t\t\t\t\tmaxImagesWidth={ 200 }\n\t\t\t\t\tfontFamily={ this.props.fontFamily || defaultFontFamily }\n\t\t\t\t\tfontSize={ fontSize }\n\t\t\t\t\tlineHeight={ lineHeight }\n\t\t\t\t\tfontWeight={ this.props.fontWeight }\n\t\t\t\t\tfontStyle={ this.props.fontStyle }\n\t\t\t\t\tdisableEditingMenu={ disableEditingMenu }\n\t\t\t\t\tisMultiline={ this.isMultiline }\n\t\t\t\t\ttextAlign={ this.props.textAlign }\n\t\t\t\t\t{ ...( this.isIOS ? { maxWidth } : {} ) }\n\t\t\t\t\tminWidth={ minWidth }\n\t\t\t\t\tid={ this.props.id }\n\t\t\t\t\tselectionColor={ selectionColor }\n\t\t\t\t\tdisableAutocorrection={ this.props.disableAutocorrection }\n\t\t\t\t/>\n\t\t\t\t{ isSelected && (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<FormatEdit\n\t\t\t\t\t\t\tforwardedRef={ this._editor }\n\t\t\t\t\t\t\tformatTypes={ formatTypes }\n\t\t\t\t\t\t\tvalue={ record }\n\t\t\t\t\t\t\tonChange={ this.onFormatChange }\n\t\t\t\t\t\t\tonFocus={ () => {} }\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t{ ! disableSuggestions && (\n\t\t\t\t\t\t\t<BlockFormatControls>\n\t\t\t\t\t\t\t\t<ToolbarButtonWithOptions\n\t\t\t\t\t\t\t\t\toptions={ this.suggestionOptions() }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</BlockFormatControls>\n\t\t\t\t\t\t) }\n\t\t\t\t\t</>\n\t\t\t\t) }\n\t\t\t</View>\n\t\t);\n\t}\n}\n\nRichText.defaultProps = {\n\tformat: 'string',\n\tvalue: '',\n\ttagName: 'div',\n};\n\nconst withFormatTypes = ( WrappedComponent ) => ( props ) => {\n\tconst {\n\t\tclientId,\n\t\tidentifier,\n\t\twithoutInteractiveFormatting,\n\t\tallowedFormats,\n\t} = props;\n\tconst { formatTypes } = useFormatTypes( {\n\t\tclientId,\n\t\tidentifier,\n\t\twithoutInteractiveFormatting,\n\t\tallowedFormats,\n\t} );\n\n\treturn <WrappedComponent { ...props } formatTypes={ formatTypes } />;\n};\n\nexport default compose( [\n\twithSelect( ( select, { clientId } ) => {\n\t\tconst { getBlockParents, getBlock, getSettings } =\n\t\t\tselect( 'core/block-editor' );\n\t\tconst parents = getBlockParents( clientId, true );\n\t\tconst parentBlock = parents ? getBlock( parents[ 0 ] ) : undefined;\n\t\tconst parentBlockStyles = parentBlock?.attributes?.childrenStyles;\n\n\t\tconst settings = getSettings();\n\t\tconst baseGlobalStyles = settings?.__experimentalGlobalStylesBaseStyles;\n\n\t\tconst colorPalettes = settings?.__experimentalFeatures?.color?.palette;\n\t\tconst colorPalette = colorPalettes\n\t\t\t? flatColorPalettes( colorPalettes )\n\t\t\t: settings?.colors;\n\n\t\treturn {\n\t\t\tareMentionsSupported: settings?.capabilities?.mentions === true,\n\t\t\tareXPostsSupported: settings?.capabilities?.xposts === true,\n\t\t\tparentBlockStyles,\n\t\t\tbaseGlobalStyles,\n\t\t\tcolorPalette,\n\t\t};\n\t} ),\n\twithPreferredColorScheme,\n\twithFormatTypes,\n] )( RichText );\n"],"mappings":";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AAGJ,WAAW,CAAC,CAAC;EAC9B,MAAMvV,gBAAgB,GAAG2V,QAAQ,EAAEC,oCAAoC;EAEvE,MAAMC,aAAa,GAAGF,QAAQ,EAAEG,sBAAsB,EAAExV,KAAK,EAAEyV,OAAO;EACtE,MAAMrR,YAAY,GAAGmR,aAAa,GAC/BtW,iBAAiB,CAAEsW,aAAc,CAAC,GAClCF,QAAQ,EAAEK,MAAM;EAEnB,OAAO;IACN/L,oBAAoB,EAAE0L,QAAQ,EAAEM,YAAY,EAAEC,QAAQ,KAAK,IAAI;IAC/DhM,kBAAkB,EAAEyL,QAAQ,EAAEM,YAAY,EAAEE,MAAM,KAAK,IAAI;IAC3D3E,iBAAiB;IACjBxR,gBAAgB;IAChB0E;EACD,CAAC;AACF,CAAE,CAAC,EACH0R,iCAAwB,EACxB1B,eAAe,CACd,CAAC,CAAE5T,QAAS,CAAC;AAAA0T,OAAA,CAAA5U,OAAA,GAAAqV,QAAA"}
1
+ {"version":3,"names":["_reactNative","require","_memize","_interopRequireDefault","_colord","_reactNativeAztec","_reactNativeBridge","_blockEditor","_element","_compose","_data","_blocks","_htmlEntities","_keycodes","_url","_icons","_i18n","_richText","_useFormatTypes","_formatEdit","_getFormatColors","_style","_toolbarButtonWithOptions","unescapeSpaces","text","replace","flatColorPalettes","memize","colorsPalettes","theme","custom","default","getSelectionColor","currentSelectionColor","defaultSelectionColor","baseGlobalStyles","isBlockBasedTheme","selectionColor","colordTextColor","colord","colordBackgroundColor","color","background","isColordTextReadable","isReadable","gutenbergFormatNamesToAztec","EMPTY_PARAGRAPH_TAGS","DEFAULT_FONT_SIZE","MIN_LINE_HEIGHT","RichText","Component","constructor","value","selectionStart","selectionEnd","arguments","isIOS","Platform","OS","createRecord","bind","onChangeFromAztec","onKeyDown","handleEnter","handleDelete","onPaste","onFocus","onBlur","onTextUpdate","onContentSizeChange","onFormatChange","formatToValue","maxSize","debounceCreateUndoLevel","debounce","onCreateUndoLevel","onSelectionChange","onSelectionChangeFromAztec","valueToFormat","getHtmlToRender","handleSuggestionFunc","handleUserSuggestion","showUserSuggestions","handleXpostSuggestion","showXpostSuggestions","suggestionOptions","insertString","manipulateEventCounterToForceNativeToRefresh","shouldDropEventFromAztec","state","activeFormats","selectedFormat","height","currentFontSize","getFontSize","needsSelectionUpdate","savedContent","isTouched","lastAztecEventType","lastHistoryValue","getRecord","start","end","colorPalette","props","currentValue","formats","replacements","newFormats","getFormatColors","preserveWhiteSpace","create","html","range","Math","min","length","removeRootTagsProducedByAztec","toHTMLString","getActiveFormatNames","record","formatTypes","map","name","filter","getActiveFormat","undefined","Boolean","changeHandlers","Object","fromEntries","entries","key","startsWith","values","forEach","changeHandler","onChange","setState","string","toInsert","insert","__unstableOnCreateUndoLevel","result","removeRootTag","tagName","tagsToEliminate","element","removeTag","tag","openingTagRegexp","RegExp","closingTagRegexp","event","contentWithoutRootTag","nativeEvent","lastEventCount","eventCount","comesFromAztec","firedAfterTextChanged","refresh","contentSize","defaultPrevented","customEditableOnKeyDown","preventDefault","RCTAztecView","KeyCodes","keyCode","handleTriggerKeyCodes","ENTER","onEnter","shiftKey","DELETE","BACKSPACE","isReverse","onDelete","newValue","remove","isCollapsed","triggeredOption","find","option","triggeredKeyCode","triggerChar","charCodeAt","getTextContent","useTrigger","charAt","onClick","areMentionsSupported","areXPostsSupported","allOptions","supported","title","__","label","icon","atSymbol","plus","op","suggestionFunction","prefix","then","suggestion","catch","pastedText","pastedHtml","files","currentRecord","trimmedText","trim","isURL","linkedRecord","applyFormat","type","attributes","href","decodeEntities","window","console","log","plainText","unstableOnFocus","hasChanged","isManual","getActiveFormats","logText","shouldDrop","shouldFocusTextInputAfterMerge","prevProps","__unstableIsSelected","isSelected","blockIsSelected","__unstableMobileNoFocusOnMount","prevIsSelected","prevBlockIsSelected","noSelectionValues","textInputWasNotFocused","realStart","realEnd","max","isEmpty","Array","isArray","childrenBlock","toHTML","format","shouldComponentUpdate","nextProps","nextState","reversed","fontSize","style","lineHeight","componentDidMount","_editor","focus","componentWillUnmount","isFocused","blur","componentDidUpdate","_this$value$length","lastCharacterPosition","currentFontSizeStyle","getParsedFontSize","prevFontSizeStyle","isDifferentTag","extraAttributes","getEditableProps","className","_getPxFromCssUnit","width","Dimensions","get","cssUnitOptions","selectedPxValue","getPxFromCssUnit","parseFloat","tagNameFontSize","elements","typography","newFontSize","getLineHeight","tagNameLineHeight","newLineHeight","getIsBlockBasedTheme","isNaN","getBlockUseDefaultFont","tagsToMatch","test","getLinkTextColor","defaultColor","customColor","linkColor","isValid","toHex","getPlaceholderTextColor","_ref","_ref2","getStylesFromColorScheme","placeholderTextColor","placeholderStyle","styles","richTextPlaceholder","richTextPlaceholderDark","defaultPlaceholderTextColor","placeholderOpacity","inheritPlaceholderColor","placeholderColor","globalStylesPlaceholderColor","render","children","minWidth","maxWidth","parentBlockStyles","accessibilityLabel","disableEditingMenu","disableSuggestions","containerWidth","editableProps","blockUseDefaultFont","textDecorationColor","defaultTextDecorationColor","fontFamily","defaultFontFamily","richText","richTextDark","linkTextColor","currentSelectionStart","currentSelectionEnd","selection","brBeforeParaMatches","match","warn","count","newSelectionStart","newSelectionEnd","containerStyles","padding","backgroundColor","EditableView","_react","createElement","Fragment","View","editableTagName","ref","setRef","minHeight","placeholder","deleteEnter","triggerKeyCodes","blockType","maxImagesWidth","fontWeight","fontStyle","isMultiline","textAlign","id","disableAutocorrection","forwardedRef","BlockFormatControls","options","exports","defaultProps","withFormatTypes","WrappedComponent","clientId","identifier","withoutInteractiveFormatting","allowedFormats","useFormatTypes","_default","compose","withSelect","select","getBlockParents","getBlock","getSettings","parents","parentBlock","childrenStyles","settings","__experimentalGlobalStylesBaseStyles","colorPalettes","__experimentalFeatures","palette","colors","capabilities","mentions","xposts","withPreferredColorScheme"],"sources":["@wordpress/block-editor/src/components/rich-text/native/index.native.js"],"sourcesContent":["/* eslint no-console: [\"error\", { allow: [\"warn\"] }] */\n\n/**\n * External dependencies\n */\nimport { View, Platform, Dimensions } from 'react-native';\nimport memize from 'memize';\nimport { colord } from 'colord';\n\n/**\n * WordPress dependencies\n */\nimport RCTAztecView from '@wordpress/react-native-aztec';\nimport {\n\tshowUserSuggestions,\n\tshowXpostSuggestions,\n} from '@wordpress/react-native-bridge';\nimport { BlockFormatControls, getPxFromCssUnit } from '@wordpress/block-editor';\nimport { Component } from '@wordpress/element';\nimport {\n\tcompose,\n\tdebounce,\n\twithPreferredColorScheme,\n} from '@wordpress/compose';\nimport { withSelect } from '@wordpress/data';\nimport { childrenBlock } from '@wordpress/blocks';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { BACKSPACE, DELETE, ENTER } from '@wordpress/keycodes';\nimport { isURL } from '@wordpress/url';\nimport { atSymbol, plus } from '@wordpress/icons';\nimport { __ } from '@wordpress/i18n';\nimport {\n\tapplyFormat,\n\tgetActiveFormat,\n\tgetActiveFormats,\n\tinsert,\n\tgetTextContent,\n\tisEmpty,\n\tcreate,\n\ttoHTMLString,\n\tisCollapsed,\n\tremove,\n} from '@wordpress/rich-text';\n\n/**\n * Internal dependencies\n */\nimport { useFormatTypes } from './use-format-types';\nimport FormatEdit from './format-edit';\nimport { getFormatColors } from './get-format-colors';\nimport styles from './style.scss';\nimport ToolbarButtonWithOptions from './toolbar-button-with-options';\n\nconst unescapeSpaces = ( text ) => {\n\treturn text.replace( /&nbsp;|&#160;/gi, ' ' );\n};\n\n// The flattened color palettes array is memoized to ensure that the same array instance is\n// returned for the colors palettes. This value might be used as a prop, so having the same\n// instance will prevent unnecessary re-renders of the RichText component.\nconst flatColorPalettes = memize( ( colorsPalettes ) => [\n\t...( colorsPalettes?.theme || [] ),\n\t...( colorsPalettes?.custom || [] ),\n\t...( colorsPalettes?.default || [] ),\n] );\n\nconst getSelectionColor = memize(\n\t(\n\t\tcurrentSelectionColor,\n\t\tdefaultSelectionColor,\n\t\tbaseGlobalStyles,\n\t\tisBlockBasedTheme\n\t) => {\n\t\tlet selectionColor = defaultSelectionColor;\n\t\tif ( currentSelectionColor ) {\n\t\t\tselectionColor = currentSelectionColor;\n\t\t}\n\n\t\tif ( isBlockBasedTheme ) {\n\t\t\tconst colordTextColor = colord( selectionColor );\n\t\t\tconst colordBackgroundColor = colord(\n\t\t\t\tbaseGlobalStyles?.color?.background\n\t\t\t);\n\t\t\tconst isColordTextReadable = colordTextColor.isReadable(\n\t\t\t\tcolordBackgroundColor\n\t\t\t);\n\t\t\tif ( ! isColordTextReadable ) {\n\t\t\t\tselectionColor = baseGlobalStyles?.color?.text;\n\t\t\t}\n\t\t}\n\n\t\treturn selectionColor;\n\t}\n);\n\nconst gutenbergFormatNamesToAztec = {\n\t'core/bold': 'bold',\n\t'core/italic': 'italic',\n\t'core/strikethrough': 'strikethrough',\n\t'core/text-color': 'mark',\n};\n\nconst EMPTY_PARAGRAPH_TAGS = '<p></p>';\nconst DEFAULT_FONT_SIZE = 16;\nconst MIN_LINE_HEIGHT = 1;\n\nexport class RichText extends Component {\n\tconstructor( { value, selectionStart, selectionEnd } ) {\n\t\tsuper( ...arguments );\n\n\t\tthis.isIOS = Platform.OS === 'ios';\n\t\tthis.createRecord = this.createRecord.bind( this );\n\t\tthis.onChangeFromAztec = this.onChangeFromAztec.bind( this );\n\t\tthis.onKeyDown = this.onKeyDown.bind( this );\n\t\tthis.handleEnter = this.handleEnter.bind( this );\n\t\tthis.handleDelete = this.handleDelete.bind( this );\n\t\tthis.onPaste = this.onPaste.bind( this );\n\t\tthis.onFocus = this.onFocus.bind( this );\n\t\tthis.onBlur = this.onBlur.bind( this );\n\t\tthis.onTextUpdate = this.onTextUpdate.bind( this );\n\t\tthis.onContentSizeChange = this.onContentSizeChange.bind( this );\n\t\tthis.onFormatChange = this.onFormatChange.bind( this );\n\t\tthis.formatToValue = memize( this.formatToValue.bind( this ), {\n\t\t\tmaxSize: 1,\n\t\t} );\n\t\tthis.debounceCreateUndoLevel = debounce( this.onCreateUndoLevel, 1000 );\n\t\t// This prevents a bug in Aztec which triggers onSelectionChange twice on format change.\n\t\tthis.onSelectionChange = this.onSelectionChange.bind( this );\n\t\tthis.onSelectionChangeFromAztec =\n\t\t\tthis.onSelectionChangeFromAztec.bind( this );\n\t\tthis.valueToFormat = this.valueToFormat.bind( this );\n\t\tthis.getHtmlToRender = this.getHtmlToRender.bind( this );\n\t\tthis.handleSuggestionFunc = this.handleSuggestionFunc.bind( this );\n\t\tthis.handleUserSuggestion = this.handleSuggestionFunc(\n\t\t\tshowUserSuggestions,\n\t\t\t'@'\n\t\t).bind( this );\n\t\tthis.handleXpostSuggestion = this.handleSuggestionFunc(\n\t\t\tshowXpostSuggestions,\n\t\t\t'+'\n\t\t).bind( this );\n\t\tthis.suggestionOptions = this.suggestionOptions.bind( this );\n\t\tthis.insertString = this.insertString.bind( this );\n\t\tthis.manipulateEventCounterToForceNativeToRefresh =\n\t\t\tthis.manipulateEventCounterToForceNativeToRefresh.bind( this );\n\t\tthis.shouldDropEventFromAztec =\n\t\t\tthis.shouldDropEventFromAztec.bind( this );\n\t\tthis.state = {\n\t\t\tactiveFormats: [],\n\t\t\tselectedFormat: null,\n\t\t\theight: 0,\n\t\t\tcurrentFontSize: this.getFontSize( arguments[ 0 ] ),\n\t\t};\n\t\tthis.needsSelectionUpdate = false;\n\t\tthis.savedContent = '';\n\t\tthis.isTouched = false;\n\t\tthis.lastAztecEventType = null;\n\n\t\tthis.lastHistoryValue = value;\n\n\t\t// Internal values that are update synchronously, unlike props.\n\t\tthis.value = value;\n\t\tthis.selectionStart = selectionStart;\n\t\tthis.selectionEnd = selectionEnd;\n\t}\n\n\t/**\n\t * Get the current record (value and selection) from props and state.\n\t *\n\t * @return {Object} The current record (value and selection).\n\t */\n\tgetRecord() {\n\t\tconst {\n\t\t\tselectionStart: start,\n\t\t\tselectionEnd: end,\n\t\t\tcolorPalette,\n\t\t} = this.props;\n\t\tconst { value } = this.props;\n\t\tconst currentValue = this.formatToValue( value );\n\n\t\tconst { formats, replacements, text } = currentValue;\n\t\tconst { activeFormats } = this.state;\n\t\tconst newFormats = getFormatColors( formats, colorPalette );\n\n\t\treturn {\n\t\t\tformats: newFormats,\n\t\t\treplacements,\n\t\t\ttext,\n\t\t\tstart,\n\t\t\tend,\n\t\t\tactiveFormats,\n\t\t};\n\t}\n\n\t/**\n\t * Creates a RichText value \"record\" from the current content and selection\n\t * information\n\t *\n\t *\n\t * @return {Object} A RichText value with formats and selection.\n\t */\n\tcreateRecord() {\n\t\tconst { preserveWhiteSpace } = this.props;\n\t\tconst value = {\n\t\t\tstart: this.selectionStart,\n\t\t\tend: this.selectionEnd,\n\t\t\t...create( {\n\t\t\t\thtml: this.value,\n\t\t\t\trange: null,\n\t\t\t\tpreserveWhiteSpace,\n\t\t\t} ),\n\t\t};\n\t\tconst start = Math.min( this.selectionStart, value.text.length );\n\t\tconst end = Math.min( this.selectionEnd, value.text.length );\n\t\treturn { ...value, start, end };\n\t}\n\n\tvalueToFormat( value ) {\n\t\t// Remove the outer root tags.\n\t\treturn this.removeRootTagsProducedByAztec( toHTMLString( { value } ) );\n\t}\n\n\tgetActiveFormatNames( record ) {\n\t\tconst { formatTypes } = this.props;\n\n\t\treturn formatTypes\n\t\t\t.map( ( { name } ) => name )\n\t\t\t.filter( ( name ) => {\n\t\t\t\treturn getActiveFormat( record, name ) !== undefined;\n\t\t\t} )\n\t\t\t.map( ( name ) => gutenbergFormatNamesToAztec[ name ] )\n\t\t\t.filter( Boolean );\n\t}\n\n\tonFormatChange( record ) {\n\t\tconst { start = 0, end = 0, activeFormats = [] } = record;\n\t\tconst changeHandlers = Object.fromEntries(\n\t\t\tObject.entries( this.props ).filter( ( [ key ] ) =>\n\t\t\t\tkey.startsWith( 'format_on_change_functions_' )\n\t\t\t)\n\t\t);\n\n\t\tObject.values( changeHandlers ).forEach( ( changeHandler ) => {\n\t\t\tchangeHandler( record.formats, record.text );\n\t\t} );\n\n\t\tthis.value = this.valueToFormat( record );\n\t\tthis.props.onChange( this.value );\n\t\tthis.setState( { activeFormats } );\n\t\tthis.props.onSelectionChange( start, end );\n\t\tthis.selectionStart = start;\n\t\tthis.selectionEnd = end;\n\n\t\tthis.onCreateUndoLevel();\n\n\t\tthis.lastAztecEventType = 'format change';\n\t}\n\n\tinsertString( record, string ) {\n\t\tif ( record && string ) {\n\t\t\tthis.manipulateEventCounterToForceNativeToRefresh(); // force a refresh on the native side\n\t\t\tconst toInsert = insert( record, string );\n\t\t\tthis.onFormatChange( toInsert );\n\t\t}\n\t}\n\n\tonCreateUndoLevel() {\n\t\tconst { __unstableOnCreateUndoLevel: onCreateUndoLevel } = this.props;\n\t\t// If the content is the same, no level needs to be created.\n\t\tif ( this.lastHistoryValue === this.value ) {\n\t\t\treturn;\n\t\t}\n\n\t\tonCreateUndoLevel();\n\t\tthis.lastHistoryValue = this.value;\n\t}\n\n\t/*\n\t * Cleans up any root tags produced by aztec.\n\t * TODO: This should be removed on a later version when aztec doesn't return the top tag of the text being edited\n\t */\n\tremoveRootTagsProducedByAztec( html ) {\n\t\tlet result = this.removeRootTag( this.props.tagName, html );\n\n\t\tif ( this.props.tagsToEliminate ) {\n\t\t\tthis.props.tagsToEliminate.forEach( ( element ) => {\n\t\t\t\tresult = this.removeTag( element, result );\n\t\t\t} );\n\t\t}\n\n\t\treturn result;\n\t}\n\n\tremoveRootTag( tag, html ) {\n\t\tconst openingTagRegexp = RegExp( '^<' + tag + '[^>]*>', 'gim' );\n\t\tconst closingTagRegexp = RegExp( '</' + tag + '>$', 'gim' );\n\n\t\treturn html\n\t\t\t.replace( openingTagRegexp, '' )\n\t\t\t.replace( closingTagRegexp, '' );\n\t}\n\n\tremoveTag( tag, html ) {\n\t\tconst openingTagRegexp = RegExp( '<' + tag + '>', 'gim' );\n\t\tconst closingTagRegexp = RegExp( '</' + tag + '>', 'gim' );\n\t\treturn html\n\t\t\t.replace( openingTagRegexp, '' )\n\t\t\t.replace( closingTagRegexp, '' );\n\t}\n\n\t/*\n\t * Handles any case where the content of the AztecRN instance has changed\n\t */\n\tonChangeFromAztec( event ) {\n\t\tif ( this.shouldDropEventFromAztec( event, 'onChange' ) ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst contentWithoutRootTag = this.removeRootTagsProducedByAztec(\n\t\t\tunescapeSpaces( event.nativeEvent.text )\n\t\t);\n\t\t// On iOS, onChange can be triggered after selection changes, even though there are no content changes.\n\t\tif ( contentWithoutRootTag === this.value ) {\n\t\t\treturn;\n\t\t}\n\t\tthis.lastEventCount = event.nativeEvent.eventCount;\n\t\tthis.comesFromAztec = true;\n\t\tthis.firedAfterTextChanged = true; // The onChange event always fires after the fact.\n\t\tthis.onTextUpdate( event );\n\t\tthis.lastAztecEventType = 'input';\n\t}\n\n\tonTextUpdate( event ) {\n\t\tconst contentWithoutRootTag = this.removeRootTagsProducedByAztec(\n\t\t\tunescapeSpaces( event.nativeEvent.text )\n\t\t);\n\n\t\tthis.debounceCreateUndoLevel();\n\t\tconst refresh = this.value !== contentWithoutRootTag;\n\t\tthis.value = contentWithoutRootTag;\n\n\t\t// We don't want to refresh if our goal is just to create a record.\n\t\tif ( refresh ) {\n\t\t\tthis.props.onChange( contentWithoutRootTag );\n\t\t}\n\t}\n\n\t/*\n\t * Handles any case where the content of the AztecRN instance has changed in size\n\t */\n\tonContentSizeChange( contentSize ) {\n\t\tthis.setState( contentSize );\n\t\tthis.lastAztecEventType = 'content size change';\n\t}\n\n\tonKeyDown( event ) {\n\t\tif ( event.defaultPrevented ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Add stubs for conformance in downstream autocompleters logic.\n\t\tthis.customEditableOnKeyDown?.( {\n\t\t\tpreventDefault: () => undefined,\n\t\t\t...event,\n\t\t\tkey: RCTAztecView.KeyCodes[ event?.keyCode ],\n\t\t} );\n\n\t\tthis.handleDelete( event );\n\t\tthis.handleEnter( event );\n\t\tthis.handleTriggerKeyCodes( event );\n\t}\n\n\thandleEnter( event ) {\n\t\tif ( event.keyCode !== ENTER ) {\n\t\t\treturn;\n\t\t}\n\t\tconst { onEnter } = this.props;\n\n\t\tif ( ! onEnter ) {\n\t\t\treturn;\n\t\t}\n\n\t\tonEnter( {\n\t\t\tvalue: this.createRecord(),\n\t\t\tonChange: this.onFormatChange,\n\t\t\tshiftKey: event.shiftKey,\n\t\t} );\n\t\tthis.lastAztecEventType = 'input';\n\t}\n\n\thandleDelete( event ) {\n\t\tif ( this.shouldDropEventFromAztec( event, 'handleDelete' ) ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst { keyCode } = event;\n\n\t\tif ( keyCode !== DELETE && keyCode !== BACKSPACE ) {\n\t\t\treturn;\n\t\t}\n\t\tconst isReverse = keyCode === BACKSPACE;\n\n\t\tconst { onDelete } = this.props;\n\t\tthis.lastEventCount = event.nativeEvent.eventCount;\n\t\tthis.comesFromAztec = true;\n\t\tthis.firedAfterTextChanged = event.nativeEvent.firedAfterTextChanged;\n\t\tconst value = this.createRecord();\n\t\tconst { start, end, text } = value;\n\t\tlet newValue;\n\n\t\t// Always handle full content deletion ourselves.\n\t\tif ( start === 0 && end !== 0 && end >= text.length ) {\n\t\t\tnewValue = remove( value );\n\t\t\tthis.onFormatChange( newValue );\n\t\t\tevent.preventDefault();\n\t\t\treturn;\n\t\t}\n\n\t\t// Only process delete if the key press occurs at an uncollapsed edge.\n\t\tif (\n\t\t\t! onDelete ||\n\t\t\t! isCollapsed( value ) ||\n\t\t\t( isReverse && start !== 0 ) ||\n\t\t\t( ! isReverse && end !== text.length )\n\t\t) {\n\t\t\treturn;\n\t\t}\n\n\t\tonDelete( { isReverse, value } );\n\n\t\tevent.preventDefault();\n\t\tthis.lastAztecEventType = 'input';\n\t}\n\n\thandleTriggerKeyCodes( event ) {\n\t\tconst { keyCode } = event;\n\t\tconst triggeredOption = this.suggestionOptions().find( ( option ) => {\n\t\t\tconst triggeredKeyCode = option.triggerChar.charCodeAt( 0 );\n\t\t\treturn triggeredKeyCode === keyCode;\n\t\t} );\n\n\t\tif ( triggeredOption ) {\n\t\t\tconst record = this.getRecord();\n\t\t\tconst text = getTextContent( record );\n\t\t\t// Only respond to the trigger if the selection is on the start of text or line\n\t\t\t// or if the character before is a space.\n\t\t\tconst useTrigger =\n\t\t\t\ttext.length === 0 ||\n\t\t\t\trecord.start === 0 ||\n\t\t\t\ttext.charAt( record.start - 1 ) === '\\n' ||\n\t\t\t\ttext.charAt( record.start - 1 ) === ' ';\n\n\t\t\tif ( useTrigger && triggeredOption.onClick ) {\n\t\t\t\ttriggeredOption.onClick();\n\t\t\t} else {\n\t\t\t\tthis.insertString( record, triggeredOption.triggerChar );\n\t\t\t}\n\t\t}\n\t}\n\n\tsuggestionOptions() {\n\t\tconst { areMentionsSupported, areXPostsSupported } = this.props;\n\t\tconst allOptions = [\n\t\t\t{\n\t\t\t\tsupported: areMentionsSupported,\n\t\t\t\ttitle: __( 'Insert mention' ),\n\t\t\t\tonClick: this.handleUserSuggestion,\n\t\t\t\ttriggerChar: '@',\n\t\t\t\tvalue: 'mention',\n\t\t\t\tlabel: __( 'Mention' ),\n\t\t\t\ticon: atSymbol,\n\t\t\t},\n\t\t\t{\n\t\t\t\tsupported: areXPostsSupported,\n\t\t\t\ttitle: __( 'Insert crosspost' ),\n\t\t\t\tonClick: this.handleXpostSuggestion,\n\t\t\t\ttriggerChar: '+',\n\t\t\t\tvalue: 'crosspost',\n\t\t\t\tlabel: __( 'Crosspost' ),\n\t\t\t\ticon: plus,\n\t\t\t},\n\t\t];\n\t\treturn allOptions.filter( ( op ) => op.supported );\n\t}\n\n\thandleSuggestionFunc( suggestionFunction, prefix ) {\n\t\treturn () => {\n\t\t\tconst record = this.getRecord();\n\t\t\tsuggestionFunction()\n\t\t\t\t.then( ( suggestion ) => {\n\t\t\t\t\tthis.insertString( record, `${ prefix }${ suggestion } ` );\n\t\t\t\t} )\n\t\t\t\t.catch( () => {} );\n\t\t};\n\t}\n\n\t/**\n\t * Handles a paste event from the native Aztec Wrapper.\n\t *\n\t * @param {Object} event The paste event which wraps `nativeEvent`.\n\t */\n\tonPaste( event ) {\n\t\tconst { onPaste, onChange } = this.props;\n\t\tconst { activeFormats = [] } = this.state;\n\n\t\tconst { pastedText, pastedHtml, files } = event.nativeEvent;\n\t\tconst currentRecord = this.createRecord();\n\n\t\tevent.preventDefault();\n\n\t\t// There is a selection, check if a URL is pasted.\n\t\tif ( ! isCollapsed( currentRecord ) ) {\n\t\t\tconst trimmedText = ( pastedHtml || pastedText )\n\t\t\t\t.replace( /<[^>]+>/g, '' )\n\t\t\t\t.trim();\n\n\t\t\t// A URL was pasted, turn the selection into a link.\n\t\t\tif ( isURL( trimmedText ) ) {\n\t\t\t\tconst linkedRecord = applyFormat( currentRecord, {\n\t\t\t\t\ttype: 'a',\n\t\t\t\t\tattributes: {\n\t\t\t\t\t\thref: decodeEntities( trimmedText ),\n\t\t\t\t\t},\n\t\t\t\t} );\n\t\t\t\tthis.value = this.valueToFormat( linkedRecord );\n\t\t\t\tonChange( this.value );\n\n\t\t\t\t// Allows us to ask for this information when we get a report.\n\t\t\t\twindow.console.log( 'Created link:\\n\\n', trimmedText );\n\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\n\t\tif ( onPaste ) {\n\t\t\tonPaste( {\n\t\t\t\tvalue: currentRecord,\n\t\t\t\tonChange: this.onFormatChange,\n\t\t\t\thtml: pastedHtml,\n\t\t\t\tplainText: pastedText,\n\t\t\t\tfiles,\n\t\t\t\tactiveFormats,\n\t\t\t} );\n\t\t}\n\t}\n\n\tonFocus() {\n\t\tthis.isTouched = true;\n\n\t\tconst { unstableOnFocus, onSelectionChange } = this.props;\n\n\t\tif ( unstableOnFocus ) {\n\t\t\tunstableOnFocus();\n\t\t}\n\n\t\t// We know for certain that on focus, the old selection is invalid. It\n\t\t// will be recalculated on `selectionchange`.\n\n\t\tonSelectionChange( this.selectionStart, this.selectionEnd );\n\n\t\tthis.lastAztecEventType = 'focus';\n\t}\n\n\tonBlur( event ) {\n\t\tthis.isTouched = false;\n\n\t\t// Check if value is up to date with latest state of native AztecView.\n\t\tif (\n\t\t\tevent.nativeEvent.text &&\n\t\t\tevent.nativeEvent.text !== this.props.value\n\t\t) {\n\t\t\tthis.onTextUpdate( event );\n\t\t}\n\n\t\tif ( this.props.onBlur ) {\n\t\t\tthis.props.onBlur( event );\n\t\t}\n\n\t\tthis.lastAztecEventType = 'blur';\n\t}\n\n\tonSelectionChange( start, end ) {\n\t\tconst hasChanged =\n\t\t\tthis.selectionStart !== start || this.selectionEnd !== end;\n\n\t\tthis.selectionStart = start;\n\t\tthis.selectionEnd = end;\n\n\t\t// This is a manual selection change event if onChange was not triggered just before\n\t\t// and we did not just trigger a text update\n\t\t// `onChange` could be the last event and could have been triggered a long time ago so\n\t\t// this approach is not perfectly reliable.\n\t\tconst isManual =\n\t\t\tthis.lastAztecEventType !== 'input' &&\n\t\t\tthis.props.value === this.value;\n\t\tif ( hasChanged && isManual ) {\n\t\t\tconst value = this.createRecord();\n\t\t\tconst activeFormats = getActiveFormats( value );\n\t\t\tthis.setState( { activeFormats } );\n\t\t}\n\n\t\tthis.props.onSelectionChange( start, end );\n\t}\n\n\tshouldDropEventFromAztec( event, logText ) {\n\t\tconst shouldDrop =\n\t\t\t! this.isIOS && event.nativeEvent.eventCount <= this.lastEventCount;\n\t\tif ( shouldDrop ) {\n\t\t\twindow.console.log(\n\t\t\t\t`Dropping ${ logText } from Aztec as its event counter is older than latest sent to the native side. Got ${ event.nativeEvent.eventCount } but lastEventCount is ${ this.lastEventCount }.`\n\t\t\t);\n\t\t}\n\t\treturn shouldDrop;\n\t}\n\n\t/**\n\t * Determines whether the text input should receive focus after an update.\n\t * For cases where a RichText with a value is merged with an empty one.\n\t *\n\t * @param {Object} prevProps - The previous props of the component.\n\t * @return {boolean} True if the text input should receive focus, false otherwise.\n\t */\n\tshouldFocusTextInputAfterMerge( prevProps ) {\n\t\tconst {\n\t\t\t__unstableIsSelected: isSelected,\n\t\t\tblockIsSelected,\n\t\t\tselectionStart,\n\t\t\tselectionEnd,\n\t\t\t__unstableMobileNoFocusOnMount,\n\t\t} = this.props;\n\n\t\tconst {\n\t\t\t__unstableIsSelected: prevIsSelected,\n\t\t\tblockIsSelected: prevBlockIsSelected,\n\t\t} = prevProps;\n\n\t\tconst noSelectionValues =\n\t\t\tselectionStart === undefined && selectionEnd === undefined;\n\t\tconst textInputWasNotFocused = ! prevIsSelected && ! isSelected;\n\n\t\treturn (\n\t\t\t! __unstableMobileNoFocusOnMount &&\n\t\t\tnoSelectionValues &&\n\t\t\ttextInputWasNotFocused &&\n\t\t\t! prevBlockIsSelected &&\n\t\t\tblockIsSelected\n\t\t);\n\t}\n\n\tonSelectionChangeFromAztec( start, end, text, event ) {\n\t\tif ( this.shouldDropEventFromAztec( event, 'onSelectionChange' ) ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// `end` can be less than `start` on iOS\n\t\t// Let's fix that here so `rich-text/slice` can work properly.\n\t\tconst realStart = Math.min( start, end );\n\t\tconst realEnd = Math.max( start, end );\n\n\t\t// Check and dicsard stray event, where the text and selection is equal to the ones already cached.\n\t\tconst contentWithoutRootTag = this.removeRootTagsProducedByAztec(\n\t\t\tunescapeSpaces( event.nativeEvent.text )\n\t\t);\n\t\tif (\n\t\t\tcontentWithoutRootTag === this.value &&\n\t\t\trealStart === this.selectionStart &&\n\t\t\trealEnd === this.selectionEnd\n\t\t) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis.comesFromAztec = true;\n\t\tthis.firedAfterTextChanged = true; // Selection change event always fires after the fact.\n\n\t\t// Update text before updating selection\n\t\t// Make sure there are changes made to the content before upgrading it upward.\n\t\tthis.onTextUpdate( event );\n\n\t\t// Aztec can send us selection change events after it has lost focus.\n\t\t// For instance the autocorrect feature will complete a partially written\n\t\t// word when resigning focus, causing a selection change event.\n\t\t// Forwarding this selection change could cause this RichText to regain\n\t\t// focus and start a focus loop.\n\t\t//\n\t\t// See https://github.com/wordpress-mobile/gutenberg-mobile/issues/1696\n\t\tif ( this.props.__unstableIsSelected ) {\n\t\t\tthis.onSelectionChange( realStart, realEnd );\n\t\t}\n\t\t// Update lastEventCount to prevent Aztec from re-rendering the content it just sent.\n\t\tthis.lastEventCount = event.nativeEvent.eventCount;\n\n\t\tthis.lastAztecEventType = 'selection change';\n\t}\n\n\tisEmpty() {\n\t\treturn isEmpty( this.formatToValue( this.props.value ) );\n\t}\n\n\tformatToValue( value ) {\n\t\tconst { preserveWhiteSpace } = this.props;\n\t\t// Handle deprecated `children` and `node` sources.\n\t\tif ( Array.isArray( value ) ) {\n\t\t\treturn create( {\n\t\t\t\thtml: childrenBlock.toHTML( value ),\n\t\t\t\tpreserveWhiteSpace,\n\t\t\t} );\n\t\t}\n\n\t\tif ( this.props.format === 'string' ) {\n\t\t\treturn create( {\n\t\t\t\thtml: value,\n\t\t\t\tpreserveWhiteSpace,\n\t\t\t} );\n\t\t}\n\n\t\t// Guard for blocks passing `null` in onSplit callbacks. May be removed\n\t\t// if onSplit is revised to not pass a `null` value.\n\t\tif ( value === null ) {\n\t\t\treturn create();\n\t\t}\n\n\t\treturn value;\n\t}\n\n\tmanipulateEventCounterToForceNativeToRefresh() {\n\t\tif ( this.isIOS ) {\n\t\t\tthis.lastEventCount = undefined;\n\t\t\treturn;\n\t\t}\n\n\t\tif ( typeof this.lastEventCount !== 'undefined' ) {\n\t\t\tthis.lastEventCount += 100; // bump by a hundred, hopefully native hasn't bombarded the JS side in the meantime.\n\t\t} // no need to bump when 'undefined' as native side won't receive the key when the value is undefined, and that will cause force updating anyway,\n\t\t// see https://github.com/WordPress/gutenberg/blob/82e578dcc75e67891c750a41a04c1e31994192fc/packages/react-native-aztec/android/src/main/java/org/wordpress/mobile/ReactNativeAztec/ReactAztecManager.java#L213-L215\n\t}\n\n\tshouldComponentUpdate( nextProps, nextState ) {\n\t\tif (\n\t\t\tnextProps.tagName !== this.props.tagName ||\n\t\t\tnextProps.reversed !== this.props.reversed ||\n\t\t\tnextProps.start !== this.props.start\n\t\t) {\n\t\t\tthis.manipulateEventCounterToForceNativeToRefresh(); // force a refresh on the native side\n\t\t\tthis.value = undefined;\n\t\t\treturn true;\n\t\t}\n\n\t\t// TODO: Please re-introduce the check to avoid updating the content right after an `onChange` call.\n\t\t// It was removed in https://github.com/WordPress/gutenberg/pull/12417 to fix undo/redo problem.\n\n\t\t// If the component is changed React side (undo/redo/merging/splitting/custom text actions)\n\t\t// we need to make sure the native is updated as well.\n\n\t\t// Also, don't trust the \"this.lastContent\" as on Android, incomplete text events arrive\n\t\t// with only some of the text, while the virtual keyboard's suggestion system does its magic.\n\t\t// ** compare with this.lastContent for optimizing performance by not forcing Aztec with text it already has\n\t\t// , but compare with props.value to not lose \"half word\" text because of Android virtual keyb autosuggestion behavior\n\t\tif (\n\t\t\ttypeof nextProps.value !== 'undefined' &&\n\t\t\ttypeof this.props.value !== 'undefined' &&\n\t\t\t( ! this.comesFromAztec || ! this.firedAfterTextChanged ) &&\n\t\t\tnextProps.value !== this.props.value\n\t\t) {\n\t\t\t// Gutenberg seems to try to mirror the caret state even on events that only change the content so,\n\t\t\t// let's force caret update if state has selection set.\n\t\t\tif (\n\t\t\t\ttypeof nextProps.selectionStart !== 'undefined' &&\n\t\t\t\ttypeof nextProps.selectionEnd !== 'undefined'\n\t\t\t) {\n\t\t\t\tthis.needsSelectionUpdate = true;\n\t\t\t}\n\n\t\t\tthis.manipulateEventCounterToForceNativeToRefresh(); // force a refresh on the native side\n\t\t}\n\n\t\tif ( ! this.comesFromAztec ) {\n\t\t\tif (\n\t\t\t\ttypeof nextProps.selectionStart !== 'undefined' &&\n\t\t\t\ttypeof nextProps.selectionEnd !== 'undefined' &&\n\t\t\t\tnextProps.selectionStart !== this.props.selectionStart &&\n\t\t\t\tnextProps.selectionStart !== this.selectionStart &&\n\t\t\t\tnextProps.__unstableIsSelected\n\t\t\t) {\n\t\t\t\tthis.needsSelectionUpdate = true;\n\t\t\t\tthis.manipulateEventCounterToForceNativeToRefresh(); // force a refresh on the native side\n\t\t\t}\n\n\t\t\t// For font size changes from a prop value a force refresh\n\t\t\t// is needed without the selection update.\n\t\t\tif ( nextProps?.fontSize !== this.props?.fontSize ) {\n\t\t\t\tthis.manipulateEventCounterToForceNativeToRefresh(); // force a refresh on the native side\n\t\t\t}\n\n\t\t\tif (\n\t\t\t\t( nextProps?.style?.fontSize !== this.props?.style?.fontSize &&\n\t\t\t\t\tnextState.currentFontSize !==\n\t\t\t\t\t\tthis.state.currentFontSize ) ||\n\t\t\t\tnextState.currentFontSize !== this.state.currentFontSize ||\n\t\t\t\tnextProps?.style?.lineHeight !== this.props?.style?.lineHeight\n\t\t\t) {\n\t\t\t\tthis.needsSelectionUpdate = true;\n\t\t\t\tthis.manipulateEventCounterToForceNativeToRefresh(); // force a refresh on the native side\n\t\t\t}\n\t\t}\n\n\t\treturn true;\n\t}\n\n\tcomponentDidMount() {\n\t\t// Request focus if wrapping block is selected and parent hasn't inhibited the focus request. This method of focusing\n\t\t// is trying to implement the web-side counterpart of BlockList's `focusTabbable` where the BlockList is focusing an\n\t\t// inputbox by searching the DOM. We don't have the DOM in RN so, using the combination of blockIsSelected and __unstableMobileNoFocusOnMount\n\t\t// to determine if we should focus the RichText.\n\t\tif (\n\t\t\tthis.props.blockIsSelected &&\n\t\t\t! this.props.__unstableMobileNoFocusOnMount\n\t\t) {\n\t\t\tthis._editor.focus();\n\t\t\tthis.onSelectionChange(\n\t\t\t\tthis.props.selectionStart || 0,\n\t\t\t\tthis.props.selectionEnd || 0\n\t\t\t);\n\t\t}\n\t}\n\n\tcomponentWillUnmount() {\n\t\tif ( this._editor.isFocused() ) {\n\t\t\tthis._editor.blur();\n\t\t}\n\t}\n\n\tcomponentDidUpdate( prevProps ) {\n\t\tconst { style, tagName } = this.props;\n\t\tconst { currentFontSize } = this.state;\n\n\t\tif ( this.props.value !== this.value ) {\n\t\t\tthis.value = this.props.value;\n\t\t}\n\t\tconst { __unstableIsSelected: prevIsSelected } = prevProps;\n\t\tconst { __unstableIsSelected: isSelected } = this.props;\n\n\t\tif ( isSelected && ! prevIsSelected ) {\n\t\t\tthis._editor.focus();\n\t\t\t// Update selection props explicitly when component is selected as Aztec won't call onSelectionChange\n\t\t\t// if its internal value hasn't change. When created, default value is 0, 0.\n\t\t\tthis.onSelectionChange(\n\t\t\t\tthis.props.selectionStart || 0,\n\t\t\t\tthis.props.selectionEnd || 0\n\t\t\t);\n\t\t} else if ( this.shouldFocusTextInputAfterMerge( prevProps ) ) {\n\t\t\t// Since this is happening when merging blocks, the selection should be at the last character position.\n\t\t\t// As a fallback the internal selectionEnd value is used.\n\t\t\tconst lastCharacterPosition =\n\t\t\t\tthis.value?.length ?? this.selectionEnd;\n\t\t\tthis._editor.focus();\n\t\t\tthis.props.onSelectionChange(\n\t\t\t\tlastCharacterPosition,\n\t\t\t\tlastCharacterPosition\n\t\t\t);\n\t\t} else if ( ! isSelected && prevIsSelected ) {\n\t\t\tthis._editor.blur();\n\t\t}\n\n\t\t// For font size values changes from the font size picker\n\t\t// we compare previous values to refresh the selected font size,\n\t\t// this is also used when the tag name changes\n\t\t// e.g Heading block and a level change like h1->h2.\n\t\tconst currentFontSizeStyle = this.getParsedFontSize( style?.fontSize );\n\t\tconst prevFontSizeStyle = this.getParsedFontSize(\n\t\t\tprevProps?.style?.fontSize\n\t\t);\n\t\tconst isDifferentTag = prevProps.tagName !== tagName;\n\t\tif (\n\t\t\t( currentFontSize &&\n\t\t\t\t( currentFontSizeStyle || prevFontSizeStyle ) &&\n\t\t\t\tcurrentFontSizeStyle !== currentFontSize ) ||\n\t\t\tisDifferentTag\n\t\t) {\n\t\t\tthis.setState( {\n\t\t\t\tcurrentFontSize: this.getFontSize( this.props ),\n\t\t\t} );\n\t\t}\n\t}\n\n\tgetHtmlToRender( record, tagName ) {\n\t\t// Save back to HTML from React tree.\n\t\tlet value = this.valueToFormat( record );\n\n\t\tif ( value === undefined ) {\n\t\t\tthis.manipulateEventCounterToForceNativeToRefresh(); // force a refresh on the native side\n\t\t\tvalue = '';\n\t\t}\n\t\t// On android if content is empty we need to send no content or else the placeholder will not show.\n\t\tif (\n\t\t\t! this.isIOS &&\n\t\t\t( value === '' || value === EMPTY_PARAGRAPH_TAGS )\n\t\t) {\n\t\t\treturn '';\n\t\t}\n\n\t\tif ( tagName ) {\n\t\t\tlet extraAttributes = ``;\n\t\t\tif ( tagName === `ol` ) {\n\t\t\t\tif ( this.props.reversed ) {\n\t\t\t\t\textraAttributes += ` reversed`;\n\t\t\t\t}\n\t\t\t\tif ( this.props.start ) {\n\t\t\t\t\textraAttributes += ` start=${ this.props.start }`;\n\t\t\t\t}\n\t\t\t}\n\t\t\tvalue = `<${ tagName }${ extraAttributes }>${ value }</${ tagName }>`;\n\t\t}\n\t\treturn value;\n\t}\n\n\tgetEditableProps() {\n\t\treturn {\n\t\t\t// Overridable props.\n\t\t\tstyle: {},\n\t\t\tclassName: 'rich-text',\n\t\t\tonKeyDown: () => null,\n\t\t};\n\t}\n\n\tgetParsedFontSize( fontSize ) {\n\t\tconst { height, width } = Dimensions.get( 'window' );\n\t\tconst cssUnitOptions = { height, width, fontSize: DEFAULT_FONT_SIZE };\n\n\t\tif ( ! fontSize ) {\n\t\t\treturn fontSize;\n\t\t}\n\n\t\tconst selectedPxValue =\n\t\t\tgetPxFromCssUnit( fontSize, cssUnitOptions ) ?? DEFAULT_FONT_SIZE;\n\n\t\treturn parseFloat( selectedPxValue );\n\t}\n\n\tgetFontSize( props ) {\n\t\tconst { baseGlobalStyles, tagName, fontSize, style } = props;\n\t\tconst tagNameFontSize =\n\t\t\tbaseGlobalStyles?.elements?.[ tagName ]?.typography?.fontSize;\n\n\t\tlet newFontSize = DEFAULT_FONT_SIZE;\n\n\t\t// Disables line-height rendering for pre elements until we fix some issues with AztecAndroid.\n\t\tif ( tagName === 'pre' && ! this.isIOS ) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\t// For block-based themes, get the default editor font size.\n\t\tif ( baseGlobalStyles?.typography?.fontSize && tagName === 'p' ) {\n\t\t\tnewFontSize = baseGlobalStyles?.typography?.fontSize;\n\t\t}\n\n\t\t// For block-based themes, get the default element font size\n\t\t// e.g h1, h2.\n\t\tif ( tagNameFontSize ) {\n\t\t\tnewFontSize = tagNameFontSize;\n\t\t}\n\n\t\t// For font size values provided from the styles,\n\t\t// usually from values set from the font size picker.\n\t\tif ( style?.fontSize ) {\n\t\t\tnewFontSize = style.fontSize;\n\t\t}\n\n\t\t// Fall-back to a font size provided from its props (if there's any)\n\t\t// and there are no other default values to use.\n\t\tif ( fontSize && ! tagNameFontSize && ! style?.fontSize ) {\n\t\t\tnewFontSize = fontSize;\n\t\t}\n\n\t\t// We need to always convert to px units because the selected value\n\t\t// could be coming from the web where it could be stored as a different unit.\n\t\tconst selectedPxValue = this.getParsedFontSize( newFontSize );\n\n\t\treturn selectedPxValue;\n\t}\n\n\tgetLineHeight() {\n\t\tconst { baseGlobalStyles, tagName, lineHeight, style } = this.props;\n\t\tconst tagNameLineHeight =\n\t\t\tbaseGlobalStyles?.elements?.[ tagName ]?.typography?.lineHeight;\n\t\tlet newLineHeight;\n\n\t\t// Disables line-height rendering for pre elements until we fix some issues with AztecAndroid.\n\t\tif ( tagName === 'pre' && ! this.isIOS ) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\tif ( ! this.getIsBlockBasedTheme() ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// For block-based themes, get the default editor line height.\n\t\tif ( baseGlobalStyles?.typography?.lineHeight && tagName === 'p' ) {\n\t\t\tnewLineHeight = parseFloat(\n\t\t\t\tbaseGlobalStyles?.typography?.lineHeight\n\t\t\t);\n\t\t}\n\n\t\t// For block-based themes, get the default element line height\n\t\t// e.g h1, h2.\n\t\tif ( tagNameLineHeight ) {\n\t\t\tnewLineHeight = parseFloat( tagNameLineHeight );\n\t\t}\n\n\t\t// For line height values provided from the styles,\n\t\t// usually from values set from the line height picker.\n\t\tif ( style?.lineHeight ) {\n\t\t\tnewLineHeight = parseFloat( style.lineHeight );\n\t\t}\n\n\t\t// Fall-back to a line height provided from its props (if there's any)\n\t\t// and there are no other default values to use.\n\t\tif ( lineHeight && ! tagNameLineHeight && ! style?.lineHeight ) {\n\t\t\tnewLineHeight = lineHeight;\n\t\t}\n\n\t\t// Check the final value is not over the minimum supported value.\n\t\tif ( newLineHeight && newLineHeight < MIN_LINE_HEIGHT ) {\n\t\t\tnewLineHeight = MIN_LINE_HEIGHT;\n\t\t}\n\n\t\t// Until we parse CSS values correctly, avoid passing NaN values to Aztec\n\t\tif ( isNaN( newLineHeight ) ) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\treturn newLineHeight;\n\t}\n\n\tgetIsBlockBasedTheme() {\n\t\tconst { baseGlobalStyles } = this.props;\n\n\t\treturn (\n\t\t\tbaseGlobalStyles && Object.entries( baseGlobalStyles ).length !== 0\n\t\t);\n\t}\n\n\tgetBlockUseDefaultFont() {\n\t\t// For block-based themes it enables using the defaultFont\n\t\t// in Aztec for iOS so it allows customizing the font size\n\t\t// for the Preformatted/Code and Heading blocks.\n\t\tif ( ! this.isIOS ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst { tagName } = this.props;\n\t\tconst isBlockBasedTheme = this.getIsBlockBasedTheme();\n\t\tconst tagsToMatch = /pre|h([1-6])$/gm;\n\n\t\treturn isBlockBasedTheme && tagsToMatch.test( tagName );\n\t}\n\n\tgetLinkTextColor( defaultColor ) {\n\t\tconst { style } = this.props;\n\t\tconst customColor = style?.linkColor && colord( style.linkColor );\n\n\t\treturn customColor && customColor.isValid()\n\t\t\t? customColor.toHex()\n\t\t\t: defaultColor;\n\t}\n\n\tgetPlaceholderTextColor() {\n\t\tconst {\n\t\t\tbaseGlobalStyles,\n\t\t\tgetStylesFromColorScheme,\n\t\t\tplaceholderTextColor,\n\t\t\tstyle,\n\t\t} = this.props;\n\n\t\t// Default placeholder text color.\n\t\tconst placeholderStyle = getStylesFromColorScheme(\n\t\t\tstyles.richTextPlaceholder,\n\t\t\tstyles.richTextPlaceholderDark\n\t\t);\n\t\tconst { color: defaultPlaceholderTextColor } = placeholderStyle;\n\t\t// Custom 63% opacity for theme and inherited colors.\n\t\tconst placeholderOpacity = 'A1';\n\n\t\t// Determine inherited placeholder color if available.\n\t\tconst inheritPlaceholderColor = style?.placeholderColor\n\t\t\t? `${ style.placeholderColor }${ placeholderOpacity }`\n\t\t\t: undefined;\n\n\t\t// If using block-based themes, derive the placeholder color from global styles.\n\t\tconst globalStylesPlaceholderColor = baseGlobalStyles?.color?.text\n\t\t\t? `${ baseGlobalStyles.color.text }${ placeholderOpacity }`\n\t\t\t: undefined;\n\n\t\treturn (\n\t\t\tinheritPlaceholderColor ??\n\t\t\tplaceholderTextColor ??\n\t\t\tglobalStylesPlaceholderColor ??\n\t\t\tdefaultPlaceholderTextColor\n\t\t);\n\t}\n\n\trender() {\n\t\tconst {\n\t\t\ttagName,\n\t\t\tstyle,\n\t\t\t__unstableIsSelected: isSelected,\n\t\t\tchildren,\n\t\t\tgetStylesFromColorScheme,\n\t\t\tminWidth,\n\t\t\tmaxWidth,\n\t\t\tformatTypes,\n\t\t\tparentBlockStyles,\n\t\t\taccessibilityLabel,\n\t\t\tdisableEditingMenu = false,\n\t\t\tbaseGlobalStyles,\n\t\t\tselectionStart,\n\t\t\tselectionEnd,\n\t\t\tdisableSuggestions,\n\t\t\tcontainerWidth,\n\t\t} = this.props;\n\t\tconst { currentFontSize } = this.state;\n\n\t\tconst record = this.getRecord();\n\t\tconst html = this.getHtmlToRender( record, tagName );\n\t\tconst editableProps = this.getEditableProps();\n\t\tconst blockUseDefaultFont = this.getBlockUseDefaultFont();\n\n\t\tconst fontSize = currentFontSize;\n\t\tconst lineHeight = this.getLineHeight();\n\n\t\tconst {\n\t\t\tcolor: defaultColor,\n\t\t\ttextDecorationColor: defaultTextDecorationColor,\n\t\t\tfontFamily: defaultFontFamily,\n\t\t} = getStylesFromColorScheme( styles.richText, styles.richTextDark );\n\t\tconst linkTextColor = this.getLinkTextColor(\n\t\t\tdefaultTextDecorationColor\n\t\t);\n\n\t\tconst currentSelectionStart = selectionStart ?? 0;\n\t\tconst currentSelectionEnd = selectionEnd ?? 0;\n\t\tlet selection = null;\n\t\tif ( this.needsSelectionUpdate ) {\n\t\t\tthis.needsSelectionUpdate = false;\n\t\t\tselection = {\n\t\t\t\tstart: currentSelectionStart,\n\t\t\t\tend: currentSelectionEnd,\n\t\t\t};\n\n\t\t\t// On AztecAndroid, setting the caret to an out-of-bounds position will crash the editor so, let's check for some cases.\n\t\t\tif ( ! this.isIOS ) {\n\t\t\t\t// The following regular expression is used in Aztec here:\n\t\t\t\t// https://github.com/wordpress-mobile/AztecEditor-Android/blob/b1fad439d56fa6d4aa0b78526fef355c59d00dd3/aztec/src/main/kotlin/org/wordpress/aztec/AztecParser.kt#L656\n\t\t\t\tconst brBeforeParaMatches = html.match( /(<br>)+<\\/p>$/g );\n\t\t\t\tif ( brBeforeParaMatches ) {\n\t\t\t\t\tconsole.warn(\n\t\t\t\t\t\t'Oops, BR tag(s) at the end of content. Aztec will remove them, adapting the selection...'\n\t\t\t\t\t);\n\t\t\t\t\tconst count = (\n\t\t\t\t\t\tbrBeforeParaMatches[ 0 ].match( /br/g ) || []\n\t\t\t\t\t).length;\n\t\t\t\t\tif ( count > 0 ) {\n\t\t\t\t\t\tlet newSelectionStart = currentSelectionStart - count;\n\t\t\t\t\t\tif ( newSelectionStart < 0 ) {\n\t\t\t\t\t\t\tnewSelectionStart = 0;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tlet newSelectionEnd = currentSelectionEnd - count;\n\t\t\t\t\t\tif ( newSelectionEnd < 0 ) {\n\t\t\t\t\t\t\tnewSelectionEnd = 0;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tselection = {\n\t\t\t\t\t\t\tstart: newSelectionStart,\n\t\t\t\t\t\t\tend: newSelectionEnd,\n\t\t\t\t\t\t};\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif ( this.comesFromAztec ) {\n\t\t\tthis.comesFromAztec = false;\n\t\t\tthis.firedAfterTextChanged = false;\n\t\t}\n\n\t\t// Logic below assures that `RichText` width will always have equal value when container is almost fully filled.\n\t\tconst width =\n\t\t\tmaxWidth && this.state.width && maxWidth - this.state.width < 10\n\t\t\t\t? maxWidth\n\t\t\t\t: this.state.width;\n\t\tconst containerStyles = [\n\t\t\tstyle?.padding &&\n\t\t\t\tstyle?.backgroundColor && {\n\t\t\t\t\tpadding: style.padding,\n\t\t\t\t\tbackgroundColor: style.backgroundColor,\n\t\t\t\t},\n\t\t\tcontainerWidth && {\n\t\t\t\twidth: containerWidth,\n\t\t\t},\n\t\t];\n\n\t\tconst defaultSelectionColor = getStylesFromColorScheme(\n\t\t\tstyles[ 'rich-text-selection' ],\n\t\t\tstyles[ 'rich-text-selection--dark' ]\n\t\t).color;\n\t\tconst selectionColor = getSelectionColor(\n\t\t\tthis.props.selectionColor,\n\t\t\tdefaultSelectionColor,\n\t\t\tbaseGlobalStyles,\n\t\t\tthis.getIsBlockBasedTheme()\n\t\t);\n\n\t\tconst EditableView = ( props ) => {\n\t\t\tthis.customEditableOnKeyDown = props?.onKeyDown;\n\n\t\t\treturn <></>;\n\t\t};\n\n\t\treturn (\n\t\t\t<View style={ containerStyles }>\n\t\t\t\t{ children &&\n\t\t\t\t\tchildren( {\n\t\t\t\t\t\tisSelected,\n\t\t\t\t\t\tvalue: record,\n\t\t\t\t\t\tonChange: this.onFormatChange,\n\t\t\t\t\t\tonFocus: () => {},\n\t\t\t\t\t\teditableProps,\n\t\t\t\t\t\teditableTagName: EditableView,\n\t\t\t\t\t} ) }\n\t\t\t\t<RCTAztecView\n\t\t\t\t\taccessibilityLabel={ accessibilityLabel }\n\t\t\t\t\tref={ ( ref ) => {\n\t\t\t\t\t\tthis._editor = ref;\n\n\t\t\t\t\t\tif ( this.props.setRef ) {\n\t\t\t\t\t\t\tthis.props.setRef( ref );\n\t\t\t\t\t\t}\n\t\t\t\t\t} }\n\t\t\t\t\tstyle={ {\n\t\t\t\t\t\tbackgroundColor: styles.richText.backgroundColor,\n\t\t\t\t\t\t...style,\n\t\t\t\t\t\t...( this.isIOS && minWidth && maxWidth\n\t\t\t\t\t\t\t? { width }\n\t\t\t\t\t\t\t: { maxWidth } ),\n\t\t\t\t\t\tminHeight: this.state.height,\n\t\t\t\t\t} }\n\t\t\t\t\tblockUseDefaultFont={ blockUseDefaultFont }\n\t\t\t\t\ttext={ {\n\t\t\t\t\t\ttext: html,\n\t\t\t\t\t\teventCount: this.lastEventCount,\n\t\t\t\t\t\tselection,\n\t\t\t\t\t\tlinkTextColor,\n\t\t\t\t\t\ttag: tagName,\n\t\t\t\t\t} }\n\t\t\t\t\tplaceholder={ this.props.placeholder }\n\t\t\t\t\tplaceholderTextColor={ this.getPlaceholderTextColor() }\n\t\t\t\t\tdeleteEnter={ this.props.deleteEnter }\n\t\t\t\t\tonChange={ this.onChangeFromAztec }\n\t\t\t\t\tonFocus={ this.onFocus }\n\t\t\t\t\tonBlur={ this.onBlur }\n\t\t\t\t\tonKeyDown={ this.onKeyDown }\n\t\t\t\t\ttriggerKeyCodes={\n\t\t\t\t\t\tdisableEditingMenu\n\t\t\t\t\t\t\t? []\n\t\t\t\t\t\t\t: this.suggestionOptions().map(\n\t\t\t\t\t\t\t\t\t( op ) => op.triggerChar\n\t\t\t\t\t\t\t )\n\t\t\t\t\t}\n\t\t\t\t\tonPaste={ this.onPaste }\n\t\t\t\t\tactiveFormats={ this.getActiveFormatNames( record ) }\n\t\t\t\t\tonContentSizeChange={ this.onContentSizeChange }\n\t\t\t\t\tonSelectionChange={ this.onSelectionChangeFromAztec }\n\t\t\t\t\tblockType={ { tag: tagName } }\n\t\t\t\t\tcolor={\n\t\t\t\t\t\t( style && style.color ) ||\n\t\t\t\t\t\t( parentBlockStyles && parentBlockStyles.color ) ||\n\t\t\t\t\t\t( baseGlobalStyles && baseGlobalStyles?.color?.text ) ||\n\t\t\t\t\t\tdefaultColor\n\t\t\t\t\t}\n\t\t\t\t\tmaxImagesWidth={ 200 }\n\t\t\t\t\tfontFamily={ this.props.fontFamily || defaultFontFamily }\n\t\t\t\t\tfontSize={ fontSize }\n\t\t\t\t\tlineHeight={ lineHeight }\n\t\t\t\t\tfontWeight={ this.props.fontWeight }\n\t\t\t\t\tfontStyle={ this.props.fontStyle }\n\t\t\t\t\tdisableEditingMenu={ disableEditingMenu }\n\t\t\t\t\tisMultiline={ false }\n\t\t\t\t\ttextAlign={ this.props.textAlign }\n\t\t\t\t\t{ ...( this.isIOS ? { maxWidth } : {} ) }\n\t\t\t\t\tminWidth={ minWidth }\n\t\t\t\t\tid={ this.props.id }\n\t\t\t\t\tselectionColor={ selectionColor }\n\t\t\t\t\tdisableAutocorrection={ this.props.disableAutocorrection }\n\t\t\t\t/>\n\t\t\t\t{ isSelected && (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<FormatEdit\n\t\t\t\t\t\t\tforwardedRef={ this._editor }\n\t\t\t\t\t\t\tformatTypes={ formatTypes }\n\t\t\t\t\t\t\tvalue={ record }\n\t\t\t\t\t\t\tonChange={ this.onFormatChange }\n\t\t\t\t\t\t\tonFocus={ () => {} }\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t{ ! disableSuggestions && (\n\t\t\t\t\t\t\t<BlockFormatControls>\n\t\t\t\t\t\t\t\t<ToolbarButtonWithOptions\n\t\t\t\t\t\t\t\t\toptions={ this.suggestionOptions() }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</BlockFormatControls>\n\t\t\t\t\t\t) }\n\t\t\t\t\t</>\n\t\t\t\t) }\n\t\t\t</View>\n\t\t);\n\t}\n}\n\nRichText.defaultProps = {\n\tformat: 'string',\n\tvalue: '',\n\ttagName: 'div',\n};\n\nconst withFormatTypes = ( WrappedComponent ) => ( props ) => {\n\tconst {\n\t\tclientId,\n\t\tidentifier,\n\t\twithoutInteractiveFormatting,\n\t\tallowedFormats,\n\t} = props;\n\tconst { formatTypes } = useFormatTypes( {\n\t\tclientId,\n\t\tidentifier,\n\t\twithoutInteractiveFormatting,\n\t\tallowedFormats,\n\t} );\n\n\treturn <WrappedComponent { ...props } formatTypes={ formatTypes } />;\n};\n\nexport default compose( [\n\twithSelect( ( select, { clientId } ) => {\n\t\tconst { getBlockParents, getBlock, getSettings } =\n\t\t\tselect( 'core/block-editor' );\n\t\tconst parents = getBlockParents( clientId, true );\n\t\tconst parentBlock = parents ? getBlock( parents[ 0 ] ) : undefined;\n\t\tconst parentBlockStyles = parentBlock?.attributes?.childrenStyles;\n\n\t\tconst settings = getSettings();\n\t\tconst baseGlobalStyles = settings?.__experimentalGlobalStylesBaseStyles;\n\n\t\tconst colorPalettes = settings?.__experimentalFeatures?.color?.palette;\n\t\tconst colorPalette = colorPalettes\n\t\t\t? flatColorPalettes( colorPalettes )\n\t\t\t: settings?.colors;\n\n\t\treturn {\n\t\t\tareMentionsSupported: settings?.capabilities?.mentions === true,\n\t\t\tareXPostsSupported: settings?.capabilities?.xposts === true,\n\t\t\tparentBlockStyles,\n\t\t\tbaseGlobalStyles,\n\t\t\tcolorPalette,\n\t\t};\n\t} ),\n\twithPreferredColorScheme,\n\twithFormatTypes,\n] )( RichText );\n"],"mappings":";;;;;;;;AAKA,IAAAA,YAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,OAAA,GAAAH,OAAA;AAKA,IAAAI,iBAAA,GAAAF,sBAAA,CAAAF,OAAA;AACA,IAAAK,kBAAA,GAAAL,OAAA;AAIA,IAAAM,YAAA,GAAAN,OAAA;AACA,IAAAO,QAAA,GAAAP,OAAA;AACA,IAAAQ,QAAA,GAAAR,OAAA;AAKA,IAAAS,KAAA,GAAAT,OAAA;AACA,IAAAU,OAAA,GAAAV,OAAA;AACA,IAAAW,aAAA,GAAAX,OAAA;AACA,IAAAY,SAAA,GAAAZ,OAAA;AACA,IAAAa,IAAA,GAAAb,OAAA;AACA,IAAAc,MAAA,GAAAd,OAAA;AACA,IAAAe,KAAA,GAAAf,OAAA;AACA,IAAAgB,SAAA,GAAAhB,OAAA;AAgBA,IAAAiB,eAAA,GAAAjB,OAAA;AACA,IAA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Q;IAAEC;EAAY,CAAC,GAC/CH,MAAM,CAAE,mBAAoB,CAAC;EAC9B,MAAMI,OAAO,GAAGH,eAAe,CAAET,QAAQ,EAAE,IAAK,CAAC;EACjD,MAAMa,WAAW,GAAGD,OAAO,GAAGF,QAAQ,CAAEE,OAAO,CAAE,CAAC,CAAG,CAAC,GAAG7P,SAAS;EAClE,MAAM4L,iBAAiB,GAAGkE,WAAW,EAAErK,UAAU,EAAEsK,cAAc;EAEjE,MAAMC,QAAQ,GAAGJ,WAAW,CAAC,CAAC;EAC9B,MAAMvV,gBAAgB,GAAG2V,QAAQ,EAAEC,oCAAoC;EAEvE,MAAMC,aAAa,GAAGF,QAAQ,EAAEG,sBAAsB,EAAExV,KAAK,EAAEyV,OAAO;EACtE,MAAM3R,YAAY,GAAGyR,aAAa,GAC/BtW,iBAAiB,CAAEsW,aAAc,CAAC,GAClCF,QAAQ,EAAEK,MAAM;EAEnB,OAAO;IACNtM,oBAAoB,EAAEiM,QAAQ,EAAEM,YAAY,EAAEC,QAAQ,KAAK,IAAI;IAC/DvM,kBAAkB,EAAEgM,QAAQ,EAAEM,YAAY,EAAEE,MAAM,KAAK,IAAI;IAC3D5E,iBAAiB;IACjBvR,gBAAgB;IAChBoE;EACD,CAAC;AACF,CAAE,CAAC,EACHgS,iCAAwB,EACxB1B,eAAe,CACd,CAAC,CAAE5T,QAAS,CAAC;AAAA0T,OAAA,CAAA5U,OAAA,GAAAqV,QAAA"}
@@ -25,7 +25,11 @@ function findSelection(blocks) {
25
25
  while (i--) {
26
26
  const attributeKey = (0, _selection.retrieveSelectedAttribute)(blocks[i].attributes);
27
27
  if (attributeKey) {
28
- blocks[i].attributes[attributeKey] = blocks[i].attributes[attributeKey].replace(_selection.START_OF_SELECTED_AREA, '');
28
+ blocks[i].attributes[attributeKey] = blocks[i].attributes[attributeKey]
29
+ // To do: refactor this to use rich text's selection instead, so
30
+ // we no longer have to use on this hack inserting a special
31
+ // character.
32
+ .toString().replace(_selection.START_OF_SELECTED_AREA, '');
29
33
  return [blocks[i].clientId, attributeKey, 0, 0];
30
34
  }
31
35
  const nestedSelection = findSelection(blocks[i].innerBlocks);
@@ -35,6 +39,35 @@ function findSelection(blocks) {
35
39
  }
36
40
  return [];
37
41
  }
42
+
43
+ /**
44
+ * An input rule that replaces two spaces with an en space, and an en space
45
+ * followed by a space with an em space.
46
+ *
47
+ * @param {Object} value Value to replace spaces in.
48
+ *
49
+ * @return {Object} Value with spaces replaced.
50
+ */
51
+ function replacePrecedingSpaces(value) {
52
+ if (!(0, _richText.isCollapsed)(value)) {
53
+ return value;
54
+ }
55
+ const {
56
+ text,
57
+ start
58
+ } = value;
59
+ const lastTwoCharacters = text.slice(start - 2, start);
60
+
61
+ // Replace two spaces with an em space.
62
+ if (lastTwoCharacters === ' ') {
63
+ return (0, _richText.insert)(value, '\u2002', start - 2, start);
64
+ }
65
+ // Replace an en space followed by a space with an em space.
66
+ else if (lastTwoCharacters === '\u2002 ') {
67
+ return (0, _richText.insert)(value, '\u2003', start - 2, start);
68
+ }
69
+ return value;
70
+ }
38
71
  function useInputRules(props) {
39
72
  const {
40
73
  __unstableMarkLastChangeAsPersistent,
@@ -114,7 +147,7 @@ function useInputRules(props) {
114
147
  accumlator = __unstableInputRule(accumlator);
115
148
  }
116
149
  return accumlator;
117
- }, (0, _preventEventDiscovery.preventEventDiscovery)(value));
150
+ }, (0, _preventEventDiscovery.preventEventDiscovery)(replacePrecedingSpaces(value)));
118
151
  if (transformed !== value) {
119
152
  __unstableMarkLastChangeAsPersistent();
120
153
  onChange({
@@ -1 +1 @@
1
- {"version":3,"names":["_element","require","_compose","_richText","_blocks","_data","_store","_preventEventDiscovery","_selection","findSelection","blocks","i","length","attributeKey","retrieveSelectedAttribute","attributes","replace","START_OF_SELECTED_AREA","clientId","nestedSelection","innerBlocks","useInputRules","props","__unstableMarkLastChangeAsPersistent","__unstableMarkAutomaticChange","useDispatch","blockEditorStore","propsRef","useRef","current","useRefEffect","element","inputRule","getValue","onReplace","selectionChange","value","start","text","characterBefore","slice","trimmedTextBefore","trim","prefixTransforms","getBlockTransforms","filter","type","transformation","findTransform","prefix","content","toHTMLString","insert","block","transform","onInput","event","inputType","onChange","__unstableAllowPrefixTransformations","formatTypes","transformed","reduce","accumlator","__unstableInputRule","preventEventDiscovery","activeFormats","addEventListener","removeEventListener"],"sources":["@wordpress/block-editor/src/components/rich-text/use-input-rules.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useRef } from '@wordpress/element';\nimport { useRefEffect } from '@wordpress/compose';\nimport { insert, toHTMLString } from '@wordpress/rich-text';\nimport { getBlockTransforms, findTransform } from '@wordpress/blocks';\nimport { useDispatch } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../../store';\nimport { preventEventDiscovery } from './prevent-event-discovery';\nimport {\n\tretrieveSelectedAttribute,\n\tSTART_OF_SELECTED_AREA,\n} from '../../utils/selection';\n\nfunction findSelection( blocks ) {\n\tlet i = blocks.length;\n\n\twhile ( i-- ) {\n\t\tconst attributeKey = retrieveSelectedAttribute(\n\t\t\tblocks[ i ].attributes\n\t\t);\n\n\t\tif ( attributeKey ) {\n\t\t\tblocks[ i ].attributes[ attributeKey ] = blocks[ i ].attributes[\n\t\t\t\tattributeKey\n\t\t\t].replace( START_OF_SELECTED_AREA, '' );\n\t\t\treturn [ blocks[ i ].clientId, attributeKey, 0, 0 ];\n\t\t}\n\n\t\tconst nestedSelection = findSelection( blocks[ i ].innerBlocks );\n\n\t\tif ( nestedSelection ) {\n\t\t\treturn nestedSelection;\n\t\t}\n\t}\n\n\treturn [];\n}\n\nexport function useInputRules( props ) {\n\tconst {\n\t\t__unstableMarkLastChangeAsPersistent,\n\t\t__unstableMarkAutomaticChange,\n\t} = useDispatch( blockEditorStore );\n\tconst propsRef = useRef( props );\n\tpropsRef.current = props;\n\treturn useRefEffect( ( element ) => {\n\t\tfunction inputRule() {\n\t\t\tconst { getValue, onReplace, selectionChange } = propsRef.current;\n\n\t\t\tif ( ! onReplace ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// We must use getValue() here because value may be update\n\t\t\t// asynchronously.\n\t\t\tconst value = getValue();\n\t\t\tconst { start, text } = value;\n\t\t\tconst characterBefore = text.slice( start - 1, start );\n\n\t\t\t// The character right before the caret must be a plain space.\n\t\t\tif ( characterBefore !== ' ' ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst trimmedTextBefore = text.slice( 0, start ).trim();\n\t\t\tconst prefixTransforms = getBlockTransforms( 'from' ).filter(\n\t\t\t\t( { type } ) => type === 'prefix'\n\t\t\t);\n\t\t\tconst transformation = findTransform(\n\t\t\t\tprefixTransforms,\n\t\t\t\t( { prefix } ) => {\n\t\t\t\t\treturn trimmedTextBefore === prefix;\n\t\t\t\t}\n\t\t\t);\n\n\t\t\tif ( ! transformation ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst content = toHTMLString( {\n\t\t\t\tvalue: insert( value, START_OF_SELECTED_AREA, 0, start ),\n\t\t\t} );\n\t\t\tconst block = transformation.transform( content );\n\n\t\t\tselectionChange( ...findSelection( [ block ] ) );\n\t\t\tonReplace( [ block ] );\n\t\t\t__unstableMarkAutomaticChange();\n\n\t\t\treturn true;\n\t\t}\n\n\t\tfunction onInput( event ) {\n\t\t\tconst { inputType, type } = event;\n\t\t\tconst {\n\t\t\t\tgetValue,\n\t\t\t\tonChange,\n\t\t\t\t__unstableAllowPrefixTransformations,\n\t\t\t\tformatTypes,\n\t\t\t} = propsRef.current;\n\n\t\t\t// Only run input rules when inserting text.\n\t\t\tif ( inputType !== 'insertText' && type !== 'compositionend' ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif ( __unstableAllowPrefixTransformations && inputRule ) {\n\t\t\t\tif ( inputRule() ) return;\n\t\t\t}\n\n\t\t\tconst value = getValue();\n\t\t\tconst transformed = formatTypes.reduce(\n\t\t\t\t( accumlator, { __unstableInputRule } ) => {\n\t\t\t\t\tif ( __unstableInputRule ) {\n\t\t\t\t\t\taccumlator = __unstableInputRule( accumlator );\n\t\t\t\t\t}\n\n\t\t\t\t\treturn accumlator;\n\t\t\t\t},\n\t\t\t\tpreventEventDiscovery( value )\n\t\t\t);\n\n\t\t\tif ( transformed !== value ) {\n\t\t\t\t__unstableMarkLastChangeAsPersistent();\n\t\t\t\tonChange( {\n\t\t\t\t\t...transformed,\n\t\t\t\t\tactiveFormats: value.activeFormats,\n\t\t\t\t} );\n\t\t\t\t__unstableMarkAutomaticChange();\n\t\t\t}\n\t\t}\n\n\t\telement.addEventListener( 'input', onInput );\n\t\telement.addEventListener( 'compositionend', onInput );\n\t\treturn () => {\n\t\t\telement.removeEventListener( 'input', onInput );\n\t\t\telement.removeEventListener( 'compositionend', onInput );\n\t\t};\n\t}, [] );\n}\n"],"mappings":";;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,SAAA,GAAAF,OAAA;AACA,IAAAG,OAAA,GAAAH,OAAA;AACA,IAAAI,KAAA,GAAAJ,OAAA;AAKA,IAAAK,MAAA,GAAAL,OAAA;AACA,IAAAM,sBAAA,GAAAN,OAAA;AACA,IAAAO,UAAA,GAAAP,OAAA;AAdA;AACA;AACA;;AAOA;AACA;AACA;;AAQA,SAASQ,aAAaA,CAAEC,MAAM,EAAG;EAChC,IAAIC,CAAC,GAAGD,MAAM,CAACE,MAAM;EAErB,OAAQD,CAAC,EAAE,EAAG;IACb,MAAME,YAAY,GAAG,IAAAC,oCAAyB,EAC7CJ,MAAM,CAAEC,CAAC,CAAE,CAACI,UACb,CAAC;IAED,IAAKF,YAAY,EAAG;MACnBH,MAAM,CAAEC,CAAC,CAAE,CAACI,UAAU,CAAEF,YAAY,CAAE,GAAGH,MAAM,CAAEC,CAAC,CAAE,CAACI,UAAU,CAC9DF,YAAY,CACZ,CAACG,OAAO,CAAEC,iCAAsB,EAAE,EAAG,CAAC;MACvC,OAAO,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AW,KAAKzB,KAAK,EAAG;QAC5Bb,oCAAoC,CAAC,CAAC;QACtCmC,QAAQ,CAAE;UACT,GAAGG,WAAW;UACdK,aAAa,EAAE9B,KAAK,CAAC8B;QACtB,CAAE,CAAC;QACH1C,6BAA6B,CAAC,CAAC;MAChC;IACD;IAEAO,OAAO,CAACoC,gBAAgB,CAAE,OAAO,EAAEZ,OAAQ,CAAC;IAC5CxB,OAAO,CAACoC,gBAAgB,CAAE,gBAAgB,EAAEZ,OAAQ,CAAC;IACrD,OAAO,MAAM;MACZxB,OAAO,CAACqC,mBAAmB,CAAE,OAAO,EAAEb,OAAQ,CAAC;MAC/CxB,OAAO,CAACqC,mBAAmB,CAAE,gBAAgB,EAAEb,OAAQ,CAAC;IACzD,CAAC;EACF,CAAC,EAAE,EAAG,CAAC;AACR"}
1
+ {"version":3,"names":["_element","require","_compose","_richText","_blocks","_data","_store","_preventEventDiscovery","_selection","findSelection","blocks","i","length","attributeKey","retrieveSelectedAttribute","attributes","toString","replace","START_OF_SELECTED_AREA","clientId","nestedSelection","innerBlocks","replacePrecedingSpaces","value","isCollapsed","text","start","lastTwoCharacters","slice","insert","useInputRules","props","__unstableMarkLastChangeAsPersistent","__unstableMarkAutomaticChange","useDispatch","blockEditorStore","propsRef","useRef","current","useRefEffect","element","inputRule","getValue","onReplace","selectionChange","characterBefore","trimmedTextBefore","trim","prefixTransforms","getBlockTransforms","filter","type","transformation","findTransform","prefix","content","toHTMLString","block","transform","onInput","event","inputType","onChange","__unstableAllowPrefixTransformations","formatTypes","transformed","reduce","accumlator","__unstableInputRule","preventEventDiscovery","activeFormats","addEventListener","removeEventListener"],"sources":["@wordpress/block-editor/src/components/rich-text/use-input-rules.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useRef } from '@wordpress/element';\nimport { useRefEffect } from '@wordpress/compose';\nimport { insert, isCollapsed, toHTMLString } from '@wordpress/rich-text';\nimport { getBlockTransforms, findTransform } from '@wordpress/blocks';\nimport { useDispatch } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../../store';\nimport { preventEventDiscovery } from './prevent-event-discovery';\nimport {\n\tretrieveSelectedAttribute,\n\tSTART_OF_SELECTED_AREA,\n} from '../../utils/selection';\n\nfunction findSelection( blocks ) {\n\tlet i = blocks.length;\n\n\twhile ( i-- ) {\n\t\tconst attributeKey = retrieveSelectedAttribute(\n\t\t\tblocks[ i ].attributes\n\t\t);\n\n\t\tif ( attributeKey ) {\n\t\t\tblocks[ i ].attributes[ attributeKey ] = blocks[ i ].attributes[\n\t\t\t\tattributeKey\n\t\t\t]\n\t\t\t\t// To do: refactor this to use rich text's selection instead, so\n\t\t\t\t// we no longer have to use on this hack inserting a special\n\t\t\t\t// character.\n\t\t\t\t.toString()\n\t\t\t\t.replace( START_OF_SELECTED_AREA, '' );\n\t\t\treturn [ blocks[ i ].clientId, attributeKey, 0, 0 ];\n\t\t}\n\n\t\tconst nestedSelection = findSelection( blocks[ i ].innerBlocks );\n\n\t\tif ( nestedSelection ) {\n\t\t\treturn nestedSelection;\n\t\t}\n\t}\n\n\treturn [];\n}\n\n/**\n * An input rule that replaces two spaces with an en space, and an en space\n * followed by a space with an em space.\n *\n * @param {Object} value Value to replace spaces in.\n *\n * @return {Object} Value with spaces replaced.\n */\nfunction replacePrecedingSpaces( value ) {\n\tif ( ! isCollapsed( value ) ) {\n\t\treturn value;\n\t}\n\n\tconst { text, start } = value;\n\tconst lastTwoCharacters = text.slice( start - 2, start );\n\n\t// Replace two spaces with an em space.\n\tif ( lastTwoCharacters === ' ' ) {\n\t\treturn insert( value, '\\u2002', start - 2, start );\n\t}\n\t// Replace an en space followed by a space with an em space.\n\telse if ( lastTwoCharacters === '\\u2002 ' ) {\n\t\treturn insert( value, '\\u2003', start - 2, start );\n\t}\n\n\treturn value;\n}\n\nexport function useInputRules( props ) {\n\tconst {\n\t\t__unstableMarkLastChangeAsPersistent,\n\t\t__unstableMarkAutomaticChange,\n\t} = useDispatch( blockEditorStore );\n\tconst propsRef = useRef( props );\n\tpropsRef.current = props;\n\treturn useRefEffect( ( element ) => {\n\t\tfunction inputRule() {\n\t\t\tconst { getValue, onReplace, selectionChange } = propsRef.current;\n\n\t\t\tif ( ! onReplace ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// We must use getValue() here because value may be update\n\t\t\t// asynchronously.\n\t\t\tconst value = getValue();\n\t\t\tconst { start, text } = value;\n\t\t\tconst characterBefore = text.slice( start - 1, start );\n\n\t\t\t// The character right before the caret must be a plain space.\n\t\t\tif ( characterBefore !== ' ' ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst trimmedTextBefore = text.slice( 0, start ).trim();\n\t\t\tconst prefixTransforms = getBlockTransforms( 'from' ).filter(\n\t\t\t\t( { type } ) => type === 'prefix'\n\t\t\t);\n\t\t\tconst transformation = findTransform(\n\t\t\t\tprefixTransforms,\n\t\t\t\t( { prefix } ) => {\n\t\t\t\t\treturn trimmedTextBefore === prefix;\n\t\t\t\t}\n\t\t\t);\n\n\t\t\tif ( ! transformation ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst content = toHTMLString( {\n\t\t\t\tvalue: insert( value, START_OF_SELECTED_AREA, 0, start ),\n\t\t\t} );\n\t\t\tconst block = transformation.transform( content );\n\n\t\t\tselectionChange( ...findSelection( [ block ] ) );\n\t\t\tonReplace( [ block ] );\n\t\t\t__unstableMarkAutomaticChange();\n\n\t\t\treturn true;\n\t\t}\n\n\t\tfunction onInput( event ) {\n\t\t\tconst { inputType, type } = event;\n\t\t\tconst {\n\t\t\t\tgetValue,\n\t\t\t\tonChange,\n\t\t\t\t__unstableAllowPrefixTransformations,\n\t\t\t\tformatTypes,\n\t\t\t} = propsRef.current;\n\n\t\t\t// Only run input rules when inserting text.\n\t\t\tif ( inputType !== 'insertText' && type !== 'compositionend' ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif ( __unstableAllowPrefixTransformations && inputRule ) {\n\t\t\t\tif ( inputRule() ) return;\n\t\t\t}\n\n\t\t\tconst value = getValue();\n\t\t\tconst transformed = formatTypes.reduce(\n\t\t\t\t( accumlator, { __unstableInputRule } ) => {\n\t\t\t\t\tif ( __unstableInputRule ) {\n\t\t\t\t\t\taccumlator = __unstableInputRule( accumlator );\n\t\t\t\t\t}\n\n\t\t\t\t\treturn accumlator;\n\t\t\t\t},\n\t\t\t\tpreventEventDiscovery( replacePrecedingSpaces( value ) )\n\t\t\t);\n\n\t\t\tif ( transformed !== value ) {\n\t\t\t\t__unstableMarkLastChangeAsPersistent();\n\t\t\t\tonChange( {\n\t\t\t\t\t...transformed,\n\t\t\t\t\tactiveFormats: value.activeFormats,\n\t\t\t\t} );\n\t\t\t\t__unstableMarkAutomaticChange();\n\t\t\t}\n\t\t}\n\n\t\telement.addEventListener( 'input', onInput );\n\t\telement.addEventListener( 'compositionend', onInput );\n\t\treturn () => {\n\t\t\telement.removeEventListener( 'input', onInput );\n\t\t\telement.removeEventListener( 'compositionend', onInput );\n\t\t};\n\t}, [] );\n}\n"],"mappings":";;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,SAAA,GAAAF,OAAA;AACA,IAAAG,OAAA,GAAAH,OAAA;AACA,IAAAI,KAAA,GAAAJ,OAAA;AAKA,IAAAK,MAAA,GAAAL,OAAA;AACA,IAAAM,sBAAA,GAAAN,OAAA;AACA,IAAAO,UAAA,GAAAP,OAAA;AAdA;AACA;AACA;;AAOA;AACA;AACA;;AAQA,SAASQ,aAAaA,CAAEC,MAAM,EAAG;EAChC,IAAIC,CAAC,GAAGD,MAAM,CAACE,MAAM;EAErB,OAAQD,CAAC,EAAE,EAAG;IACb,MAAME,YAAY,GAAG,IAAAC,oCAAyB,EAC7CJ,MAAM,CAAEC,CAAC,CAAE,CAACI,UACb,CAAC;IAED,IAAKF,YAAY,EAAG;MACnBH,MAAM,CAAEC,CAAC,CAAE,CAACI,UA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Eb,OAAQ,CAAC;MAC/CnB,OAAO,CAACgC,mBAAmB,CAAE,gBAAgB,EAAEb,OAAQ,CAAC;IACzD,CAAC;EACF,CAAC,EAAE,EAAG,CAAC;AACR"}
@@ -0,0 +1,50 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.withDeprecations = withDeprecations;
8
+ var _react = require("react");
9
+ var _element = require("@wordpress/element");
10
+ var _blocks = require("@wordpress/blocks");
11
+ var _compose = require("@wordpress/compose");
12
+ var _richText = require("@wordpress/rich-text");
13
+ var _deprecated = _interopRequireDefault(require("@wordpress/deprecated"));
14
+ var _multiline = _interopRequireDefault(require("./multiline"));
15
+ /**
16
+ * WordPress dependencies
17
+ */
18
+
19
+ /**
20
+ * Internal dependencies
21
+ */
22
+
23
+ function withDeprecations(Component) {
24
+ return (0, _element.forwardRef)((props, ref) => {
25
+ let value = props.value;
26
+ let onChange = props.onChange;
27
+
28
+ // Handle deprecated format.
29
+ if (Array.isArray(value)) {
30
+ (0, _deprecated.default)('wp.blockEditor.RichText value prop as children type', {
31
+ since: '6.1',
32
+ version: '6.3',
33
+ alternative: 'value prop as string',
34
+ link: 'https://developer.wordpress.org/block-editor/how-to-guides/block-tutorial/introducing-attributes-and-editable-fields/'
35
+ });
36
+ value = _blocks.children.toHTML(props.value);
37
+ onChange = newValue => props.onChange(_blocks.children.fromDOM((0, _richText.__unstableCreateElement)(document, newValue).childNodes));
38
+ }
39
+ const NewComponent = props.multiline ? _multiline.default : Component;
40
+ const instanceId = (0, _compose.useInstanceId)(NewComponent);
41
+ return (0, _react.createElement)(NewComponent, {
42
+ ...props,
43
+ identifier: props.identifier || instanceId,
44
+ value: value,
45
+ onChange: onChange,
46
+ ref: ref
47
+ });
48
+ });
49
+ }
50
+ //# sourceMappingURL=with-deprecations.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_element","require","_blocks","_compose","_richText","_deprecated","_interopRequireDefault","_multiline","withDeprecations","Component","forwardRef","props","ref","value","onChange","Array","isArray","deprecated","since","version","alternative","link","childrenSource","toHTML","newValue","fromDOM","__unstableCreateElement","document","childNodes","NewComponent","multiline","RichTextMultiline","instanceId","useInstanceId","_react","createElement","identifier"],"sources":["@wordpress/block-editor/src/components/rich-text/with-deprecations.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { forwardRef } from '@wordpress/element';\nimport { children as childrenSource } from '@wordpress/blocks';\nimport { useInstanceId } from '@wordpress/compose';\nimport { __unstableCreateElement } from '@wordpress/rich-text';\nimport deprecated from '@wordpress/deprecated';\n\n/**\n * Internal dependencies\n */\nimport RichTextMultiline from './multiline';\n\nexport function withDeprecations( Component ) {\n\treturn forwardRef( ( props, ref ) => {\n\t\tlet value = props.value;\n\t\tlet onChange = props.onChange;\n\n\t\t// Handle deprecated format.\n\t\tif ( Array.isArray( value ) ) {\n\t\t\tdeprecated( 'wp.blockEditor.RichText value prop as children type', {\n\t\t\t\tsince: '6.1',\n\t\t\t\tversion: '6.3',\n\t\t\t\talternative: 'value prop as string',\n\t\t\t\tlink: 'https://developer.wordpress.org/block-editor/how-to-guides/block-tutorial/introducing-attributes-and-editable-fields/',\n\t\t\t} );\n\n\t\t\tvalue = childrenSource.toHTML( props.value );\n\t\t\tonChange = ( newValue ) =>\n\t\t\t\tprops.onChange(\n\t\t\t\t\tchildrenSource.fromDOM(\n\t\t\t\t\t\t__unstableCreateElement( document, newValue ).childNodes\n\t\t\t\t\t)\n\t\t\t\t);\n\t\t}\n\n\t\tconst NewComponent = props.multiline ? RichTextMultiline : Component;\n\t\tconst instanceId = useInstanceId( NewComponent );\n\n\t\treturn (\n\t\t\t<NewComponent\n\t\t\t\t{ ...props }\n\t\t\t\tidentifier={ props.identifier || instanceId }\n\t\t\t\tvalue={ value }\n\t\t\t\tonChange={ onChange }\n\t\t\t\tref={ ref }\n\t\t\t/>\n\t\t);\n\t} );\n}\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,EAAGA,QAAU;MACrBF,GAAG,EAAGA;IAAK,CACX,CAAC;EAEJ,CAAE,CAAC;AACJ"}
@@ -181,7 +181,7 @@ function SpacingInputControl({
181
181
  } else if (!isMixed) {
182
182
  currentValue = !showCustomValueControl ? (0, _utils.getSliderValueFromPreset)(value, spacingSizes) : (0, _utils.getCustomValueFromPreset)(value, spacingSizes);
183
183
  }
184
- const selectedUnit = (0, _element.useMemo)(() => (0, _components.__experimentalParseQuantityAndUnitFromRawValue)(currentValue), [currentValue])[1] || units[0].value;
184
+ const selectedUnit = (0, _element.useMemo)(() => (0, _components.__experimentalParseQuantityAndUnitFromRawValue)(currentValue), [currentValue])[1] || units[0]?.value;
185
185
  const setInitialValue = () => {
186
186
  if (value === undefined) {
187
187
  onChange('0');