@wix/patterns-fields 1.16.0 → 1.18.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 (308) hide show
  1. package/cell-rich-content-input/package.json +5 -0
  2. package/dist/cjs/assets/locale/messages_en.json +6 -2
  3. package/dist/cjs/components/address/input/address-input.st.css.js +3 -3
  4. package/dist/cjs/components/address/input/address-input.st.css.js.map +1 -1
  5. package/dist/cjs/components/audio/actions/actions-menu/actions-menu.st.css.js +3 -3
  6. package/dist/cjs/components/audio/actions/actions-menu/actions-menu.st.css.js.map +1 -1
  7. package/dist/cjs/components/audio/audio-field/form-audio-field.st.css.js +4 -4
  8. package/dist/cjs/components/audio/audio-field/form-audio-field.st.css.js.map +1 -1
  9. package/dist/cjs/components/audio/audio-player/audio-player.st.css.js +2 -2
  10. package/dist/cjs/components/audio/audio-player/audio-player.st.css.js.map +1 -1
  11. package/dist/cjs/components/color-view/color-view.st.css.js +4 -4
  12. package/dist/cjs/components/color-view/color-view.st.css.js.map +1 -1
  13. package/dist/cjs/components/delete-dialog/delete-dialog.st.css.js +3 -3
  14. package/dist/cjs/components/delete-dialog/delete-dialog.st.css.js.map +1 -1
  15. package/dist/cjs/components/document/form-document-field.st.css.js +7 -7
  16. package/dist/cjs/components/document/form-document-field.st.css.js.map +1 -1
  17. package/dist/cjs/components/exclamation/exclamation.st.css.js +5 -5
  18. package/dist/cjs/components/exclamation/exclamation.st.css.js.map +1 -1
  19. package/dist/cjs/components/highlighted-text/highlighted-text.st.css.js +5 -5
  20. package/dist/cjs/components/highlighted-text/highlighted-text.st.css.js.map +1 -1
  21. package/dist/cjs/components/image/cell-image-edit.js +32 -61
  22. package/dist/cjs/components/image/cell-image-edit.js.map +1 -1
  23. package/dist/cjs/components/image/image-thumbnail.js +7 -6
  24. package/dist/cjs/components/image/image-thumbnail.js.map +1 -1
  25. package/dist/cjs/components/image/thumbnail-replace-overlay.js +29 -0
  26. package/dist/cjs/components/image/thumbnail-replace-overlay.js.map +1 -0
  27. package/dist/cjs/components/image/thumbnail-replace-overlay.st.css +15 -0
  28. package/dist/cjs/components/image/thumbnail-replace-overlay.st.css.js +23 -0
  29. package/dist/cjs/components/image/thumbnail-replace-overlay.st.css.js.map +1 -0
  30. package/dist/cjs/components/media-control/paste-url-button.st.css.js +4 -4
  31. package/dist/cjs/components/media-control/paste-url-button.st.css.js.map +1 -1
  32. package/dist/cjs/components/media-control/use-media-control.js +8 -9
  33. package/dist/cjs/components/media-control/use-media-control.js.map +1 -1
  34. package/dist/cjs/components/media-gallery/form-media-gallery-field.st.css.js +10 -10
  35. package/dist/cjs/components/media-gallery/form-media-gallery-field.st.css.js.map +1 -1
  36. package/dist/cjs/components/media-image/media-image.st.css.js +4 -4
  37. package/dist/cjs/components/media-image/media-image.st.css.js.map +1 -1
  38. package/dist/cjs/components/media-image/overlays/overlay.st.css.js +4 -4
  39. package/dist/cjs/components/media-image/overlays/overlay.st.css.js.map +1 -1
  40. package/dist/cjs/components/media-loader/media-loader.st.css.js +3 -3
  41. package/dist/cjs/components/media-loader/media-loader.st.css.js.map +1 -1
  42. package/dist/cjs/components/media-tag/web-media-tag/media-tag.st.css.js +2 -2
  43. package/dist/cjs/components/media-tag/web-media-tag/media-tag.st.css.js.map +1 -1
  44. package/dist/cjs/components/multi-document/multi-document-input/form-multi-document-field.js.map +1 -1
  45. package/dist/cjs/components/multi-document/multi-document-input/form-multi-document-view.js.map +1 -1
  46. package/dist/cjs/components/multi-document/multi-document-input/form-multi-document.st.css.js +5 -5
  47. package/dist/cjs/components/multi-document/multi-document-input/form-multi-document.st.css.js.map +1 -1
  48. package/dist/cjs/components/rich-content/cell-rich-content-input.js +1 -1
  49. package/dist/cjs/components/rich-content/cell-rich-content-input.js.map +1 -1
  50. package/dist/cjs/components/rich-content/cell-rich-content-view.js +1 -1
  51. package/dist/cjs/components/rich-content/cell-rich-content-view.js.map +1 -1
  52. package/dist/cjs/components/rich-content/editor.js +2 -10
  53. package/dist/cjs/components/rich-content/editor.js.map +1 -1
  54. package/dist/cjs/components/rich-content/rich-content-input/default-value-input/rich-content-default-value-input.st.css.js +6 -6
  55. package/dist/cjs/components/rich-content/rich-content-input/default-value-input/rich-content-default-value-input.st.css.js.map +1 -1
  56. package/dist/cjs/components/rich-content/rich-content-input/form-input/form-input.js +2 -1
  57. package/dist/cjs/components/rich-content/rich-content-input/form-input/form-input.js.map +1 -1
  58. package/dist/cjs/components/rich-content/rich-content-input/form-input/index.js +3 -4
  59. package/dist/cjs/components/rich-content/rich-content-input/form-input/index.js.map +1 -1
  60. package/dist/cjs/components/rich-content/rich-content-input/form-input/rich-content-form-input.st.css.js +5 -5
  61. package/dist/cjs/components/rich-content/rich-content-input/form-input/rich-content-form-input.st.css.js.map +1 -1
  62. package/dist/cjs/components/rich-content/rich-content-input/form-read-only-input/rich-content-form-read-only-input.st.css.js +2 -2
  63. package/dist/cjs/components/rich-content/rich-content-input/form-read-only-input/rich-content-form-read-only-input.st.css.js.map +1 -1
  64. package/dist/cjs/components/rich-content/rich-content-input/rich-content-common/fullscreen-modal/fullscreen-modal.st.css.js +3 -3
  65. package/dist/cjs/components/rich-content/rich-content-input/rich-content-common/fullscreen-modal/fullscreen-modal.st.css.js.map +1 -1
  66. package/dist/cjs/components/rich-content/rich-content-input/rich-content-common/publish-loader/publish-loader.st.css.js +3 -3
  67. package/dist/cjs/components/rich-content/rich-content-input/rich-content-common/publish-loader/publish-loader.st.css.js.map +1 -1
  68. package/dist/cjs/components/rich-content/rich-content-input/rich-content-common/toggle-fullscreen-button/toggle-fullscreen-button.st.css.js +2 -2
  69. package/dist/cjs/components/rich-content/rich-content-input/rich-content-common/toggle-fullscreen-button/toggle-fullscreen-button.st.css.js.map +1 -1
  70. package/dist/cjs/components/rich-content/rich-content-input/rich-content-editor/rich-content-editor.st.css.js +8 -8
  71. package/dist/cjs/components/rich-content/rich-content-input/rich-content-editor/rich-content-editor.st.css.js.map +1 -1
  72. package/dist/cjs/components/rich-content/rich-content-input/rich-content-editor/rich-content-toolbar.st.css.js +4 -4
  73. package/dist/cjs/components/rich-content/rich-content-input/rich-content-editor/rich-content-toolbar.st.css.js.map +1 -1
  74. package/dist/cjs/components/rich-content/rich-content-input/rich-content-viewer/rich-content-viewer.st.css.js +4 -4
  75. package/dist/cjs/components/rich-content/rich-content-input/rich-content-viewer/rich-content-viewer.st.css.js.map +1 -1
  76. package/dist/cjs/components/rich-text/cell-rich-text-editor.js +155 -0
  77. package/dist/cjs/components/rich-text/cell-rich-text-editor.js.map +1 -0
  78. package/dist/cjs/components/rich-text/cell-rich-text-input.js +153 -0
  79. package/dist/cjs/components/rich-text/cell-rich-text-input.js.map +1 -0
  80. package/dist/cjs/components/rich-text/cell-rich-text-view.js +30 -0
  81. package/dist/cjs/components/rich-text/cell-rich-text-view.js.map +1 -0
  82. package/dist/cjs/components/rich-text/index.js +18 -0
  83. package/dist/cjs/components/rich-text/index.js.map +1 -1
  84. package/dist/cjs/components/rich-text/rich-text-input/rich-text-editor/rich-editor.js +13 -1
  85. package/dist/cjs/components/rich-text/rich-text-input/rich-text-editor/rich-editor.js.map +1 -1
  86. package/dist/cjs/components/rich-text/rich-text-input/rich-text-editor/rich-editor.st.css +26 -22
  87. package/dist/cjs/components/rich-text/rich-text-input/rich-text-editor/rich-editor.st.css.js +50 -46
  88. package/dist/cjs/components/rich-text/rich-text-input/rich-text-editor/rich-editor.st.css.js.map +1 -1
  89. package/dist/cjs/components/rich-text/rich-text-input/rich-text-editor/rich-text-editor.st.css.js +4 -4
  90. package/dist/cjs/components/rich-text/rich-text-input/rich-text-editor/rich-text-editor.st.css.js.map +1 -1
  91. package/dist/cjs/components/rich-text/rich-text-input/rich-text-editor/toolbar/header-dropdown.js +168 -157
  92. package/dist/cjs/components/rich-text/rich-text-input/rich-text-editor/toolbar/header-dropdown.js.map +1 -1
  93. package/dist/cjs/components/rich-text/rich-text-input/rich-text-editor/toolbar/toolbar.st.css +13 -12
  94. package/dist/cjs/components/rich-text/rich-text-input/rich-text-editor/toolbar/toolbar.st.css.js +22 -19
  95. package/dist/cjs/components/rich-text/rich-text-input/rich-text-editor/toolbar/toolbar.st.css.js.map +1 -1
  96. package/dist/cjs/components/text/text-view.st.css.js +3 -3
  97. package/dist/cjs/components/text/text-view.st.css.js.map +1 -1
  98. package/dist/cjs/components/video/cell-video-edit.js +424 -0
  99. package/dist/cjs/components/video/cell-video-edit.js.map +1 -0
  100. package/dist/cjs/components/video/index.js +3 -1
  101. package/dist/cjs/components/video/index.js.map +1 -1
  102. package/dist/cjs/exports/cell-rich-content-input.js +8 -0
  103. package/dist/cjs/exports/cell-rich-content-input.js.map +1 -0
  104. package/dist/cjs/exports/form-rich-content-input.js +3 -4
  105. package/dist/cjs/exports/form-rich-content-input.js.map +1 -1
  106. package/dist/cjs/index.js +11 -0
  107. package/dist/cjs/index.js.map +1 -1
  108. package/dist/cjs/services/translations.js.map +1 -1
  109. package/dist/cjs/styles.global.css +1 -1
  110. package/dist/esm/assets/locale/messages_en.json +6 -2
  111. package/dist/esm/components/address/input/address-input.st.css.js +2 -2
  112. package/dist/esm/components/address/input/address-input.st.css.js.map +1 -1
  113. package/dist/esm/components/audio/actions/actions-menu/actions-menu.st.css.js +2 -2
  114. package/dist/esm/components/audio/actions/actions-menu/actions-menu.st.css.js.map +1 -1
  115. package/dist/esm/components/audio/audio-field/form-audio-field.st.css.js +2 -2
  116. package/dist/esm/components/audio/audio-player/audio-player.st.css.js +2 -2
  117. package/dist/esm/components/color-view/color-view.st.css.js +2 -2
  118. package/dist/esm/components/delete-dialog/delete-dialog.st.css.js +2 -2
  119. package/dist/esm/components/document/form-document-field.st.css.js +2 -2
  120. package/dist/esm/components/exclamation/exclamation.st.css.js +2 -2
  121. package/dist/esm/components/highlighted-text/highlighted-text.st.css.js +3 -3
  122. package/dist/esm/components/image/cell-image-edit.js +4 -21
  123. package/dist/esm/components/image/cell-image-edit.js.map +1 -1
  124. package/dist/esm/components/image/image-thumbnail.js +9 -3
  125. package/dist/esm/components/image/image-thumbnail.js.map +1 -1
  126. package/dist/esm/components/image/thumbnail-replace-overlay.js +7 -0
  127. package/dist/esm/components/image/thumbnail-replace-overlay.js.map +1 -0
  128. package/dist/esm/components/image/thumbnail-replace-overlay.st.css +15 -0
  129. package/dist/esm/components/image/thumbnail-replace-overlay.st.css.js +15 -0
  130. package/dist/esm/components/image/thumbnail-replace-overlay.st.css.js.map +1 -0
  131. package/dist/esm/components/media-control/paste-url-button.st.css.js +2 -2
  132. package/dist/esm/components/media-control/use-media-control.js +9 -8
  133. package/dist/esm/components/media-control/use-media-control.js.map +1 -1
  134. package/dist/esm/components/media-gallery/form-media-gallery-field.st.css.js +2 -2
  135. package/dist/esm/components/media-image/media-image.st.css.js +3 -3
  136. package/dist/esm/components/media-image/media-image.st.css.js.map +1 -1
  137. package/dist/esm/components/media-image/overlays/overlay.st.css.js +3 -3
  138. package/dist/esm/components/media-image/overlays/overlay.st.css.js.map +1 -1
  139. package/dist/esm/components/media-loader/media-loader.st.css.js +2 -2
  140. package/dist/esm/components/media-tag/web-media-tag/media-tag.st.css.js +2 -2
  141. package/dist/esm/components/multi-document/multi-document-input/form-multi-document-field.js.map +1 -1
  142. package/dist/esm/components/multi-document/multi-document-input/form-multi-document-view.js.map +1 -1
  143. package/dist/esm/components/multi-document/multi-document-input/form-multi-document.st.css.js +2 -2
  144. package/dist/esm/components/multi-document/multi-document-input/form-multi-document.st.css.js.map +1 -1
  145. package/dist/esm/components/rich-content/cell-rich-content-input.js.map +1 -1
  146. package/dist/esm/components/rich-content/cell-rich-content-view.js +1 -1
  147. package/dist/esm/components/rich-content/cell-rich-content-view.js.map +1 -1
  148. package/dist/esm/components/rich-content/editor.js +1 -2
  149. package/dist/esm/components/rich-content/editor.js.map +1 -1
  150. package/dist/esm/components/rich-content/rich-content-input/default-value-input/rich-content-default-value-input.st.css.js +3 -3
  151. package/dist/esm/components/rich-content/rich-content-input/form-input/form-input.js +1 -1
  152. package/dist/esm/components/rich-content/rich-content-input/form-input/form-input.js.map +1 -1
  153. package/dist/esm/components/rich-content/rich-content-input/form-input/index.js +1 -1
  154. package/dist/esm/components/rich-content/rich-content-input/form-input/index.js.map +1 -1
  155. package/dist/esm/components/rich-content/rich-content-input/form-input/rich-content-form-input.st.css.js +3 -3
  156. package/dist/esm/components/rich-content/rich-content-input/form-read-only-input/rich-content-form-read-only-input.st.css.js +2 -2
  157. package/dist/esm/components/rich-content/rich-content-input/rich-content-common/fullscreen-modal/fullscreen-modal.st.css.js +2 -2
  158. package/dist/esm/components/rich-content/rich-content-input/rich-content-common/publish-loader/publish-loader.st.css.js +2 -2
  159. package/dist/esm/components/rich-content/rich-content-input/rich-content-common/toggle-fullscreen-button/toggle-fullscreen-button.st.css.js +2 -2
  160. package/dist/esm/components/rich-content/rich-content-input/rich-content-editor/rich-content-editor.st.css.js +3 -3
  161. package/dist/esm/components/rich-content/rich-content-input/rich-content-editor/rich-content-editor.st.css.js.map +1 -1
  162. package/dist/esm/components/rich-content/rich-content-input/rich-content-editor/rich-content-toolbar.st.css.js +2 -2
  163. package/dist/esm/components/rich-content/rich-content-input/rich-content-editor/rich-content-toolbar.st.css.js.map +1 -1
  164. package/dist/esm/components/rich-content/rich-content-input/rich-content-viewer/rich-content-viewer.st.css.js +2 -2
  165. package/dist/esm/components/rich-text/cell-rich-text-editor.js +85 -0
  166. package/dist/esm/components/rich-text/cell-rich-text-editor.js.map +1 -0
  167. package/dist/esm/components/rich-text/cell-rich-text-input.js +77 -0
  168. package/dist/esm/components/rich-text/cell-rich-text-input.js.map +1 -0
  169. package/dist/esm/components/rich-text/cell-rich-text-view.js +11 -0
  170. package/dist/esm/components/rich-text/cell-rich-text-view.js.map +1 -0
  171. package/dist/esm/components/rich-text/index.js +3 -0
  172. package/dist/esm/components/rich-text/index.js.map +1 -1
  173. package/dist/esm/components/rich-text/rich-text-input/rich-text-editor/rich-editor.js +14 -2
  174. package/dist/esm/components/rich-text/rich-text-input/rich-text-editor/rich-editor.js.map +1 -1
  175. package/dist/esm/components/rich-text/rich-text-input/rich-text-editor/rich-editor.st.css +26 -22
  176. package/dist/esm/components/rich-text/rich-text-input/rich-text-editor/rich-editor.st.css.js +4 -4
  177. package/dist/esm/components/rich-text/rich-text-input/rich-text-editor/rich-editor.st.css.js.map +1 -1
  178. package/dist/esm/components/rich-text/rich-text-input/rich-text-editor/rich-text-editor.st.css.js +2 -2
  179. package/dist/esm/components/rich-text/rich-text-input/rich-text-editor/toolbar/header-dropdown.js +64 -50
  180. package/dist/esm/components/rich-text/rich-text-input/rich-text-editor/toolbar/header-dropdown.js.map +1 -1
  181. package/dist/esm/components/rich-text/rich-text-input/rich-text-editor/toolbar/toolbar.st.css +13 -12
  182. package/dist/esm/components/rich-text/rich-text-input/rich-text-editor/toolbar/toolbar.st.css.js +3 -3
  183. package/dist/esm/components/rich-text/rich-text-input/rich-text-editor/toolbar/toolbar.st.css.js.map +1 -1
  184. package/dist/esm/components/text/text-view.st.css.js +2 -2
  185. package/dist/esm/components/video/cell-video-edit.js +159 -0
  186. package/dist/esm/components/video/cell-video-edit.js.map +1 -0
  187. package/dist/esm/components/video/index.js +1 -0
  188. package/dist/esm/components/video/index.js.map +1 -1
  189. package/dist/esm/exports/cell-rich-content-input.js +2 -0
  190. package/dist/esm/exports/cell-rich-content-input.js.map +1 -0
  191. package/dist/esm/exports/form-rich-content-input.js +1 -1
  192. package/dist/esm/exports/form-rich-content-input.js.map +1 -1
  193. package/dist/esm/index.js +1 -0
  194. package/dist/esm/index.js.map +1 -1
  195. package/dist/esm/styles.global.css +1 -1
  196. package/dist/types/components/address/input/address-input.st.css.d.ts.map +1 -1
  197. package/dist/types/components/audio/actions/actions-menu/actions-menu.st.css.d.ts.map +1 -1
  198. package/dist/types/components/image/cell-image-edit.d.ts.map +1 -1
  199. package/dist/types/components/image/image-thumbnail.d.ts +1 -0
  200. package/dist/types/components/image/image-thumbnail.d.ts.map +1 -1
  201. package/dist/types/components/image/thumbnail-replace-overlay.d.ts +3 -0
  202. package/dist/types/components/image/thumbnail-replace-overlay.d.ts.map +1 -0
  203. package/dist/types/components/image/thumbnail-replace-overlay.st.css.d.ts +14 -0
  204. package/dist/types/components/image/thumbnail-replace-overlay.st.css.d.ts.map +1 -0
  205. package/dist/types/components/media-control/use-media-control.d.ts +3 -3
  206. package/dist/types/components/media-control/use-media-control.d.ts.map +1 -1
  207. package/dist/types/components/media-gallery/media-gallery-dialog/hooks.d.ts +2 -2
  208. package/dist/types/components/media-image/media-image.st.css.d.ts.map +1 -1
  209. package/dist/types/components/media-image/overlays/overlay.st.css.d.ts.map +1 -1
  210. package/dist/types/components/multi-document/multi-document-input/form-multi-document-view.d.ts +1 -1
  211. package/dist/types/components/multi-document/multi-document-input/form-multi-document-view.d.ts.map +1 -1
  212. package/dist/types/components/multi-document/multi-document-input/form-multi-document.st.css.d.ts.map +1 -1
  213. package/dist/types/components/rich-content/cell-rich-content-input.d.ts.map +1 -1
  214. package/dist/types/components/rich-content/cell-rich-content-view.d.ts.map +1 -1
  215. package/dist/types/components/rich-content/editor.d.ts +1 -2
  216. package/dist/types/components/rich-content/editor.d.ts.map +1 -1
  217. package/dist/types/components/rich-content/rich-content-input/form-input/form-input.d.ts +1 -1
  218. package/dist/types/components/rich-content/rich-content-input/form-input/form-input.d.ts.map +1 -1
  219. package/dist/types/components/rich-content/rich-content-input/form-input/index.d.ts +1 -1
  220. package/dist/types/components/rich-content/rich-content-input/form-input/index.d.ts.map +1 -1
  221. package/dist/types/components/rich-content/rich-content-input/rich-content-editor/rich-content-editor.st.css.d.ts.map +1 -1
  222. package/dist/types/components/rich-content/rich-content-input/rich-content-editor/rich-content-toolbar.st.css.d.ts.map +1 -1
  223. package/dist/types/components/rich-text/cell-rich-text-editor.d.ts +21 -0
  224. package/dist/types/components/rich-text/cell-rich-text-editor.d.ts.map +1 -0
  225. package/dist/types/components/rich-text/cell-rich-text-input.d.ts +23 -0
  226. package/dist/types/components/rich-text/cell-rich-text-input.d.ts.map +1 -0
  227. package/dist/types/components/rich-text/cell-rich-text-view.d.ts +8 -0
  228. package/dist/types/components/rich-text/cell-rich-text-view.d.ts.map +1 -0
  229. package/dist/types/components/rich-text/index.d.ts +4 -0
  230. package/dist/types/components/rich-text/index.d.ts.map +1 -1
  231. package/dist/types/components/rich-text/rich-text-input/rich-text-editor/rich-editor.d.ts.map +1 -1
  232. package/dist/types/components/rich-text/rich-text-input/rich-text-editor/rich-editor.st.css.d.ts +4 -0
  233. package/dist/types/components/rich-text/rich-text-input/rich-text-editor/rich-editor.st.css.d.ts.map +1 -1
  234. package/dist/types/components/rich-text/rich-text-input/rich-text-editor/toolbar/header-dropdown.d.ts +1 -0
  235. package/dist/types/components/rich-text/rich-text-input/rich-text-editor/toolbar/header-dropdown.d.ts.map +1 -1
  236. package/dist/types/components/rich-text/rich-text-input/rich-text-editor/toolbar/toolbar.st.css.d.ts +3 -0
  237. package/dist/types/components/rich-text/rich-text-input/rich-text-editor/toolbar/toolbar.st.css.d.ts.map +1 -1
  238. package/dist/types/components/video/cell-video-edit.d.ts +20 -0
  239. package/dist/types/components/video/cell-video-edit.d.ts.map +1 -0
  240. package/dist/types/components/video/index.d.ts +2 -0
  241. package/dist/types/components/video/index.d.ts.map +1 -1
  242. package/dist/types/exports/cell-rich-content-input.d.ts +2 -0
  243. package/dist/types/exports/cell-rich-content-input.d.ts.map +1 -0
  244. package/dist/types/exports/form-rich-content-input.d.ts +1 -2
  245. package/dist/types/exports/form-rich-content-input.d.ts.map +1 -1
  246. package/dist/types/index.d.ts +1 -0
  247. package/dist/types/index.d.ts.map +1 -1
  248. package/dist/types/services/translations.d.ts +1 -1
  249. package/dist/types/services/translations.d.ts.map +1 -1
  250. package/package.json +11 -5
  251. package/src/assets/locale/messages_en.json +6 -2
  252. package/src/components/address/input/address-input.st.css.ts +2 -2
  253. package/src/components/audio/actions/actions-menu/actions-menu.st.css.ts +2 -2
  254. package/src/components/audio/audio-field/form-audio-field.st.css.ts +2 -2
  255. package/src/components/audio/audio-player/audio-player.st.css.ts +2 -2
  256. package/src/components/color-view/color-view.st.css.ts +2 -2
  257. package/src/components/delete-dialog/delete-dialog.st.css.ts +2 -2
  258. package/src/components/document/form-document-field.st.css.ts +2 -2
  259. package/src/components/exclamation/exclamation.st.css.ts +2 -2
  260. package/src/components/highlighted-text/highlighted-text.st.css.ts +3 -3
  261. package/src/components/image/cell-image-edit.tsx +4 -26
  262. package/src/components/image/image-thumbnail.tsx +10 -2
  263. package/src/components/image/thumbnail-replace-overlay.st.css +15 -0
  264. package/src/components/image/thumbnail-replace-overlay.st.css.ts +25 -0
  265. package/src/components/image/thumbnail-replace-overlay.tsx +11 -0
  266. package/src/components/media-control/paste-url-button.st.css.ts +2 -2
  267. package/src/components/media-control/use-media-control.ts +13 -13
  268. package/src/components/media-gallery/form-media-gallery-field.st.css.ts +2 -2
  269. package/src/components/media-image/media-image.st.css.ts +3 -3
  270. package/src/components/media-image/overlays/overlay.st.css.ts +3 -3
  271. package/src/components/media-loader/media-loader.st.css.ts +2 -2
  272. package/src/components/media-tag/web-media-tag/media-tag.st.css.ts +2 -2
  273. package/src/components/multi-document/multi-document-input/form-multi-document-field.tsx +1 -1
  274. package/src/components/multi-document/multi-document-input/form-multi-document-view.tsx +2 -2
  275. package/src/components/multi-document/multi-document-input/form-multi-document.st.css.ts +2 -2
  276. package/src/components/rich-content/cell-rich-content-input.tsx +2 -3
  277. package/src/components/rich-content/cell-rich-content-view.tsx +1 -4
  278. package/src/components/rich-content/editor.ts +1 -2
  279. package/src/components/rich-content/rich-content-input/default-value-input/rich-content-default-value-input.st.css.ts +3 -3
  280. package/src/components/rich-content/rich-content-input/form-input/form-input.tsx +1 -1
  281. package/src/components/rich-content/rich-content-input/form-input/index.ts +1 -1
  282. package/src/components/rich-content/rich-content-input/form-input/rich-content-form-input.st.css.ts +3 -3
  283. package/src/components/rich-content/rich-content-input/form-read-only-input/rich-content-form-read-only-input.st.css.ts +2 -2
  284. package/src/components/rich-content/rich-content-input/rich-content-common/fullscreen-modal/fullscreen-modal.st.css.ts +2 -2
  285. package/src/components/rich-content/rich-content-input/rich-content-common/publish-loader/publish-loader.st.css.ts +2 -2
  286. package/src/components/rich-content/rich-content-input/rich-content-common/toggle-fullscreen-button/toggle-fullscreen-button.st.css.ts +2 -2
  287. package/src/components/rich-content/rich-content-input/rich-content-editor/rich-content-editor.st.css.ts +3 -3
  288. package/src/components/rich-content/rich-content-input/rich-content-editor/rich-content-toolbar.st.css.ts +2 -2
  289. package/src/components/rich-content/rich-content-input/rich-content-viewer/rich-content-viewer.st.css.ts +2 -2
  290. package/src/components/rich-text/cell-rich-text-editor.tsx +173 -0
  291. package/src/components/rich-text/cell-rich-text-input.tsx +126 -0
  292. package/src/components/rich-text/cell-rich-text-view.tsx +19 -0
  293. package/src/components/rich-text/index.ts +4 -0
  294. package/src/components/rich-text/rich-text-input/rich-text-editor/rich-editor.st.css +26 -22
  295. package/src/components/rich-text/rich-text-input/rich-text-editor/rich-editor.st.css.ts +4 -4
  296. package/src/components/rich-text/rich-text-input/rich-text-editor/rich-editor.tsx +22 -5
  297. package/src/components/rich-text/rich-text-input/rich-text-editor/rich-text-editor.st.css.ts +2 -2
  298. package/src/components/rich-text/rich-text-input/rich-text-editor/toolbar/header-dropdown.tsx +153 -126
  299. package/src/components/rich-text/rich-text-input/rich-text-editor/toolbar/toolbar.st.css +13 -12
  300. package/src/components/rich-text/rich-text-input/rich-text-editor/toolbar/toolbar.st.css.ts +3 -3
  301. package/src/components/text/text-view.st.css.ts +2 -2
  302. package/src/components/video/cell-video-edit.tsx +308 -0
  303. package/src/components/video/index.ts +2 -0
  304. package/src/exports/cell-rich-content-input.ts +4 -0
  305. package/src/exports/form-rich-content-input.ts +1 -5
  306. package/src/index.ts +1 -0
  307. package/src/services/translations.ts +5 -1
  308. package/src/styles.global.css +1 -1
@@ -0,0 +1,153 @@
1
+ "use strict";
2
+
3
+ exports.__esModule = true;
4
+ exports.CellRichTextInput = void 0;
5
+ var _react = _interopRequireWildcard(require("react"));
6
+ var _designSystem = require("@wix/design-system");
7
+ var _cellRichTextEditor = require("./cell-rich-text-editor");
8
+ var _jsxFileName = "/home/builduser/work/843658b9f44192f0/packages/fields/dist/cjs/components/rich-text/cell-rich-text-input.tsx";
9
+ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
10
+ /** Fixed popover width matching the CMS rich text editor (popover-rich-text-editor.tsx). */
11
+ const POPOVER_WIDTH = 582;
12
+ /** Popover-based rich text editor for the richText cell type.
13
+ * Opens immediately as a popover anchored at the cell's top-left corner.
14
+ * Fixed 582px width (matching CMS), covers adjacent cells, flips upward when
15
+ * there is not enough room below. Changes are propagated live via onChange.
16
+ *
17
+ * Close behaviour mirrors cms-web PopoverRichTextEditor: the editor listens for
18
+ * focus/blur events on a wrapper div. onBlur schedules onCommit via
19
+ * requestAnimationFrame so toolbar actions (including dropdown selections in
20
+ * window portals) can cancel the deferred close by refocusing the editor. */
21
+ const CellRichTextInput = ({
22
+ value,
23
+ onChange,
24
+ initialTypedKey,
25
+ onCommit,
26
+ textStyle = _cellRichTextEditor.DEFAULT_CELL_TEXT_STYLE
27
+ }) => {
28
+ const [isFullScreen, setIsFullScreen] = (0, _react.useState)(false);
29
+ const isFullScreenRef = (0, _react.useRef)(false);
30
+ const blurFrameIdRef = (0, _react.useRef)(0);
31
+ const handleToggleFullScreen = (0, _react.useCallback)(() => {
32
+ setIsFullScreen(prev => {
33
+ const next = !prev;
34
+ isFullScreenRef.current = next;
35
+ return next;
36
+ });
37
+ }, []);
38
+ const handleFocus = (0, _react.useCallback)(() => {
39
+ cancelAnimationFrame(blurFrameIdRef.current);
40
+ }, []);
41
+ const handleBlur = (0, _react.useCallback)(() => {
42
+ cancelAnimationFrame(blurFrameIdRef.current);
43
+ blurFrameIdRef.current = requestAnimationFrame(() => {
44
+ if (!isFullScreenRef.current) {
45
+ onCommit == null || onCommit();
46
+ }
47
+ });
48
+ }, [onCommit]);
49
+
50
+ // Capture-phase native listener fires before ALL React bubble-phase handlers
51
+ // (including useKeyboardNavigation which would call cancelEdit() on ESC).
52
+ // stopPropagation() prevents the event from reaching any bubble-phase handler.
53
+ (0, _react.useEffect)(() => {
54
+ const handleKeyDown = e => {
55
+ if (e.key !== 'Escape') return;
56
+ e.stopPropagation();
57
+ if (isFullScreenRef.current) {
58
+ setIsFullScreen(false);
59
+ isFullScreenRef.current = false;
60
+ } else {
61
+ cancelAnimationFrame(blurFrameIdRef.current);
62
+ onCommit == null || onCommit();
63
+ }
64
+ };
65
+ document.addEventListener('keydown', handleKeyDown, true);
66
+ return () => document.removeEventListener('keydown', handleKeyDown, true);
67
+ }, [onCommit]);
68
+ return (
69
+ /*#__PURE__*/
70
+ // Zero-height anchor at the cell's top-left so the popover opens from there.
71
+ _react.default.createElement("div", {
72
+ style: {
73
+ position: 'absolute',
74
+ top: 0,
75
+ left: 0,
76
+ width: '100%',
77
+ height: 0,
78
+ overflow: 'visible',
79
+ fontSize: 0,
80
+ lineHeight: 0
81
+ },
82
+ __self: void 0,
83
+ __source: {
84
+ fileName: _jsxFileName,
85
+ lineNumber: 86,
86
+ columnNumber: 5
87
+ }
88
+ }, /*#__PURE__*/_react.default.createElement(_designSystem.Popover, {
89
+ shown: true,
90
+ placement: "bottom-start",
91
+ appendTo: "window",
92
+ width: POPOVER_WIDTH,
93
+ zIndex: 5001,
94
+ __self: void 0,
95
+ __source: {
96
+ fileName: _jsxFileName,
97
+ lineNumber: 98,
98
+ columnNumber: 7
99
+ }
100
+ }, /*#__PURE__*/_react.default.createElement(_designSystem.Popover.Element, {
101
+ __self: void 0,
102
+ __source: {
103
+ fileName: _jsxFileName,
104
+ lineNumber: 105,
105
+ columnNumber: 9
106
+ }
107
+ }, /*#__PURE__*/_react.default.createElement("div", {
108
+ style: {
109
+ width: '100%',
110
+ height: 0
111
+ },
112
+ __self: void 0,
113
+ __source: {
114
+ fileName: _jsxFileName,
115
+ lineNumber: 106,
116
+ columnNumber: 11
117
+ }
118
+ })), /*#__PURE__*/_react.default.createElement(_designSystem.Popover.Content, {
119
+ __self: void 0,
120
+ __source: {
121
+ fileName: _jsxFileName,
122
+ lineNumber: 108,
123
+ columnNumber: 9
124
+ }
125
+ }, /*#__PURE__*/_react.default.createElement("div", {
126
+ onFocus: handleFocus,
127
+ onBlur: handleBlur,
128
+ __self: void 0,
129
+ __source: {
130
+ fileName: _jsxFileName,
131
+ lineNumber: 109,
132
+ columnNumber: 11
133
+ }
134
+ }, /*#__PURE__*/_react.default.createElement(_cellRichTextEditor.CellRichTextEditor, {
135
+ value: value,
136
+ onChange: onChange,
137
+ autoFocus: true,
138
+ initialTypedKey: initialTypedKey,
139
+ isFullScreen: isFullScreen,
140
+ onToggleFullScreen: handleToggleFullScreen,
141
+ textStyle: textStyle,
142
+ __self: void 0,
143
+ __source: {
144
+ fileName: _jsxFileName,
145
+ lineNumber: 110,
146
+ columnNumber: 13
147
+ }
148
+ })))))
149
+ );
150
+ };
151
+ exports.CellRichTextInput = CellRichTextInput;
152
+ CellRichTextInput.displayName = 'CellRichTextInput';
153
+ //# sourceMappingURL=cell-rich-text-input.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_react","_interopRequireWildcard","require","_designSystem","_cellRichTextEditor","_jsxFileName","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","POPOVER_WIDTH","CellRichTextInput","value","onChange","initialTypedKey","onCommit","textStyle","DEFAULT_CELL_TEXT_STYLE","isFullScreen","setIsFullScreen","useState","isFullScreenRef","useRef","blurFrameIdRef","handleToggleFullScreen","useCallback","prev","next","current","handleFocus","cancelAnimationFrame","handleBlur","requestAnimationFrame","useEffect","handleKeyDown","key","stopPropagation","document","addEventListener","removeEventListener","createElement","style","position","top","left","width","height","overflow","fontSize","lineHeight","__self","__source","fileName","lineNumber","columnNumber","Popover","shown","placement","appendTo","zIndex","Element","Content","onFocus","onBlur","CellRichTextEditor","autoFocus","onToggleFullScreen","exports","displayName"],"sources":["../../../../src/components/rich-text/cell-rich-text-input.tsx"],"sourcesContent":["import React, { useCallback, useEffect, useRef, useState } from 'react';\nimport { Popover } from '@wix/design-system';\n\nimport {\n CellRichTextEditor,\n DEFAULT_CELL_TEXT_STYLE,\n} from './cell-rich-text-editor';\nimport type { RichTextStyleVariables } from './rich-text-input/rich-text-editor/text-style';\n\n/** Fixed popover width matching the CMS rich text editor (popover-rich-text-editor.tsx). */\nconst POPOVER_WIDTH = 582;\n\nexport interface CellRichTextInputProps {\n value?: string;\n onChange: (value: string) => void;\n /** Typed key from type-to-edit — appended to existing plain-text content on mount. */\n initialTypedKey?: string;\n /** Called when the editor loses focus (click outside) or ESC is pressed. */\n onCommit?: () => void;\n /** CSS custom properties for the --rt-* theming API. Defaults to standard sizes. */\n textStyle?: RichTextStyleVariables;\n}\n\n/** Popover-based rich text editor for the richText cell type.\n * Opens immediately as a popover anchored at the cell's top-left corner.\n * Fixed 582px width (matching CMS), covers adjacent cells, flips upward when\n * there is not enough room below. Changes are propagated live via onChange.\n *\n * Close behaviour mirrors cms-web PopoverRichTextEditor: the editor listens for\n * focus/blur events on a wrapper div. onBlur schedules onCommit via\n * requestAnimationFrame so toolbar actions (including dropdown selections in\n * window portals) can cancel the deferred close by refocusing the editor. */\nexport const CellRichTextInput: React.FC<CellRichTextInputProps> = ({\n value,\n onChange,\n initialTypedKey,\n onCommit,\n textStyle = DEFAULT_CELL_TEXT_STYLE,\n}) => {\n const [isFullScreen, setIsFullScreen] = useState(false);\n const isFullScreenRef = useRef(false);\n const blurFrameIdRef = useRef(0);\n\n const handleToggleFullScreen = useCallback(() => {\n setIsFullScreen((prev) => {\n const next = !prev;\n isFullScreenRef.current = next;\n return next;\n });\n }, []);\n\n const handleFocus = useCallback(() => {\n cancelAnimationFrame(blurFrameIdRef.current);\n }, []);\n\n const handleBlur = useCallback(() => {\n cancelAnimationFrame(blurFrameIdRef.current);\n blurFrameIdRef.current = requestAnimationFrame(() => {\n if (!isFullScreenRef.current) {\n onCommit?.();\n }\n });\n }, [onCommit]);\n\n // Capture-phase native listener fires before ALL React bubble-phase handlers\n // (including useKeyboardNavigation which would call cancelEdit() on ESC).\n // stopPropagation() prevents the event from reaching any bubble-phase handler.\n useEffect(() => {\n const handleKeyDown = (e: KeyboardEvent) => {\n if (e.key !== 'Escape') return;\n e.stopPropagation();\n if (isFullScreenRef.current) {\n setIsFullScreen(false);\n isFullScreenRef.current = false;\n } else {\n cancelAnimationFrame(blurFrameIdRef.current);\n onCommit?.();\n }\n };\n document.addEventListener('keydown', handleKeyDown, true);\n return () => document.removeEventListener('keydown', handleKeyDown, true);\n }, [onCommit]);\n\n return (\n // Zero-height anchor at the cell's top-left so the popover opens from there.\n <div\n style={{\n position: 'absolute',\n top: 0,\n left: 0,\n width: '100%',\n height: 0,\n overflow: 'visible',\n fontSize: 0,\n lineHeight: 0,\n }}\n >\n <Popover\n shown\n placement=\"bottom-start\"\n appendTo=\"window\"\n width={POPOVER_WIDTH}\n zIndex={5001}\n >\n <Popover.Element>\n <div style={{ width: '100%', height: 0 }} />\n </Popover.Element>\n <Popover.Content>\n <div onFocus={handleFocus} onBlur={handleBlur}>\n <CellRichTextEditor\n value={value}\n onChange={onChange}\n autoFocus\n initialTypedKey={initialTypedKey}\n isFullScreen={isFullScreen}\n onToggleFullScreen={handleToggleFullScreen}\n textStyle={textStyle}\n />\n </div>\n </Popover.Content>\n </Popover>\n </div>\n );\n};\n\nCellRichTextInput.displayName = 'CellRichTextInput';\n"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AEC,MAAM,EAAE;MAAE,CAAE;MAAAI,MAAA;MAAAC,QAAA;QAAAC,QAAA,EAAA9D,YAAA;QAAA+D,UAAA;QAAAC,YAAA;MAAA;IAAA,CAAE,CAC5B,CAAC,eAClBrE,MAAA,CAAAgB,OAAA,CAAAuC,aAAA,CAACpD,aAAA,CAAAmE,OAAO,CAACM,OAAO;MAAAX,MAAA;MAAAC,QAAA;QAAAC,QAAA,EAAA9D,YAAA;QAAA+D,UAAA;QAAAC,YAAA;MAAA;IAAA,gBACdrE,MAAA,CAAAgB,OAAA,CAAAuC,aAAA;MAAKsB,OAAO,EAAEjC,WAAY;MAACkC,MAAM,EAAEhC,UAAW;MAAAmB,MAAA;MAAAC,QAAA;QAAAC,QAAA,EAAA9D,YAAA;QAAA+D,UAAA;QAAAC,YAAA;MAAA;IAAA,gBAC5CrE,MAAA,CAAAgB,OAAA,CAAAuC,aAAA,CAACnD,mBAAA,CAAA2E,kBAAkB;MACjBpD,KAAK,EAAEA,KAAM;MACbC,QAAQ,EAAEA,QAAS;MACnBoD,SAAS;MACTnD,eAAe,EAAEA,eAAgB;MACjCI,YAAY,EAAEA,YAAa;MAC3BgD,kBAAkB,EAAE1C,sBAAuB;MAC3CR,SAAS,EAAEA,SAAU;MAAAkC,MAAA;MAAAC,QAAA;QAAAC,QAAA,EAAA9D,YAAA;QAAA+D,UAAA;QAAAC,YAAA;MAAA;IAAA,CACtB,CACE,CACU,CACV,CACN;EAAC;AAEV,CAAC;AAACa,OAAA,CAAAxD,iBAAA,GAAAA,iBAAA;AAEFA,iBAAiB,CAACyD,WAAW,GAAG,mBAAmB","ignoreList":[]}
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ exports.__esModule = true;
5
+ exports.CellRichTextView = void 0;
6
+ var _react = _interopRequireDefault(require("react"));
7
+ var _autoFieldTypes = require("../../auto-field-types");
8
+ var _text = require("../text");
9
+ var _jsxFileName = "/home/builduser/work/843658b9f44192f0/packages/fields/dist/cjs/components/rich-text/cell-rich-text-view.tsx";
10
+ /** Synchronous plain-text view for an HTML rich-text string.
11
+ * Strips all HTML tags via DOMParser — no loading spinner. */
12
+ const CellRichTextView = ({
13
+ value
14
+ }) => {
15
+ const plainText = value ? (0, _autoFieldTypes.HTMLToText)(value, {
16
+ singleLine: true
17
+ }) : '';
18
+ return /*#__PURE__*/_react.default.createElement(_text.TextView, {
19
+ data: plainText,
20
+ __self: void 0,
21
+ __source: {
22
+ fileName: _jsxFileName,
23
+ lineNumber: 16,
24
+ columnNumber: 10
25
+ }
26
+ });
27
+ };
28
+ exports.CellRichTextView = CellRichTextView;
29
+ CellRichTextView.displayName = 'CellRichTextView';
30
+ //# sourceMappingURL=cell-rich-text-view.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_react","_interopRequireDefault","require","_autoFieldTypes","_text","_jsxFileName","CellRichTextView","value","plainText","HTMLToText","singleLine","default","createElement","TextView","data","__self","__source","fileName","lineNumber","columnNumber","exports","displayName"],"sources":["../../../../src/components/rich-text/cell-rich-text-view.tsx"],"sourcesContent":["import React from 'react';\n\nimport { HTMLToText } from '../../auto-field-types';\nimport { TextView } from '../text';\n\nexport interface CellRichTextViewProps {\n value?: string | null;\n}\n\n/** Synchronous plain-text view for an HTML rich-text string.\n * Strips all HTML tags via DOMParser — no loading spinner. */\nexport const CellRichTextView: React.FC<CellRichTextViewProps> = ({\n value,\n}) => {\n const plainText = value ? HTMLToText(value, { singleLine: true }) : '';\n return <TextView data={plainText} />;\n};\n\nCellRichTextView.displayName = 'CellRichTextView';\n"],"mappings":";;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AAEA,IAAAC,eAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AAAmC,IAAAG,YAAA;AAMnC;AACA;AACO,MAAMC,gBAAiD,GAAGA,CAAC;EAChEC;AACF,CAAC,KAAK;EACJ,MAAMC,SAAS,GAAGD,KAAK,GAAG,IAAAE,0BAAU,EAACF,KAAK,EAAE;IAAEG,UAAU,EAAE;EAAK,CAAC,CAAC,GAAG,EAAE;EACtE,oBAAOV,MAAA,CAAAW,OAAA,CAAAC,aAAA,CAACR,KAAA,CAAAS,QAAQ;IAACC,IAAI,EAAEN,SAAU;IAAAO,MAAA;IAAAC,QAAA;MAAAC,QAAA,EAAAZ,YAAA;MAAAa,UAAA;MAAAC,YAAA;IAAA;EAAA,CAAE,CAAC;AACtC,CAAC;AAACC,OAAA,CAAAd,gBAAA,GAAAA,gBAAA;AAEFA,gBAAgB,CAACe,WAAW,GAAG,kBAAkB","ignoreList":[]}
@@ -13,6 +13,24 @@ Object.keys(_richTextInput).forEach(function (key) {
13
13
  if (key in exports && exports[key] === _richTextInput[key]) return;
14
14
  exports[key] = _richTextInput[key];
15
15
  });
16
+ var _cellRichTextView = require("./cell-rich-text-view");
17
+ Object.keys(_cellRichTextView).forEach(function (key) {
18
+ if (key === "default" || key === "__esModule") return;
19
+ if (key in exports && exports[key] === _cellRichTextView[key]) return;
20
+ exports[key] = _cellRichTextView[key];
21
+ });
22
+ var _cellRichTextEditor = require("./cell-rich-text-editor");
23
+ Object.keys(_cellRichTextEditor).forEach(function (key) {
24
+ if (key === "default" || key === "__esModule") return;
25
+ if (key in exports && exports[key] === _cellRichTextEditor[key]) return;
26
+ exports[key] = _cellRichTextEditor[key];
27
+ });
28
+ var _cellRichTextInput = require("./cell-rich-text-input");
29
+ Object.keys(_cellRichTextInput).forEach(function (key) {
30
+ if (key === "default" || key === "__esModule") return;
31
+ if (key in exports && exports[key] === _cellRichTextInput[key]) return;
32
+ exports[key] = _cellRichTextInput[key];
33
+ });
16
34
  var _link = require("./components/link");
17
35
  Object.keys(_link).forEach(function (key) {
18
36
  if (key === "default" || key === "__esModule") return;
@@ -1 +1 @@
1
- {"version":3,"names":["_richTextView","require","Object","keys","forEach","key","exports","_richTextInput","_link"],"sources":["../../../../src/components/rich-text/index.ts"],"sourcesContent":["export * from './rich-text-view';\nexport * from './rich-text-input';\n\nexport type { NoOptions, TextKeys } from './types';\nexport * from './components/link';\n"],"mappings":";;;AAAA,IAAAA,aAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,aAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAL,aAAA,CAAAK,GAAA;EAAAC,OAAA,CAAAD,GAAA,IAAAL,aAAA,CAAAK,GAAA;AAAA;AACA,IAAAE,cAAA,GAAAN,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAI,cAAA,EAAAH,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAE,cAAA,CAAAF,GAAA;EAAAC,OAAA,CAAAD,GAAA,IAAAE,cAAA,CAAAF,GAAA;AAAA;AAGA,IAAAG,KAAA,GAAAP,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAK,KAAA,EAAAJ,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAG,KAAA,CAAAH,GAAA;EAAAC,OAAA,CAAAD,GAAA,IAAAG,KAAA,CAAAH,GAAA;AAAA","ignoreList":[]}
1
+ {"version":3,"names":["_richTextView","require","Object","keys","forEach","key","exports","_richTextInput","_cellRichTextView","_cellRichTextEditor","_cellRichTextInput","_link"],"sources":["../../../../src/components/rich-text/index.ts"],"sourcesContent":["export * from './rich-text-view';\nexport * from './rich-text-input';\nexport * from './cell-rich-text-view';\nexport * from './cell-rich-text-editor';\nexport * from './cell-rich-text-input';\nexport type { RichTextStyleVariables } from './rich-text-input/rich-text-editor/text-style';\n\nexport type { NoOptions, TextK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,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAK,kBAAA,CAAAL,GAAA;EAAAC,OAAA,CAAAD,GAAA,IAAAK,kBAAA,CAAAL,GAAA;AAAA;AAIA,IAAAM,KAAA,GAAAV,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAQ,KAAA,EAAAP,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAM,KAAA,CAAAN,GAAA;EAAAC,OAAA,CAAAD,GAAA,IAAAM,KAAA,CAAAN,GAAA;AAAA","ignoreList":[]}
@@ -211,6 +211,12 @@ class RichEditor extends _react.default.Component {
211
211
  let {
212
212
  editorState
213
213
  } = this.props;
214
+ // Restore the last focused selection before computing selected blocks — the
215
+ // editor may have blurred (portal click) before onSelect fires, leaving the
216
+ // current selection stale or collapsed.
217
+ if (this.lastSelectionWithFocus) {
218
+ editorState = _draftJs.EditorState.acceptSelection(editorState, this.lastSelectionWithFocus);
219
+ }
214
220
  let contentState = editorState.getCurrentContent();
215
221
  const selectedBlocks = this.getSelectedBlocks(editorState);
216
222
  if (selectedBlocks.length) {
@@ -246,7 +252,12 @@ class RichEditor extends _react.default.Component {
246
252
  }
247
253
  editorState = _draftJs.EditorState.push(editorState, contentState, 'change-block-type');
248
254
  if (this.lastSelectionWithFocus) {
249
- editorState = _draftJs.EditorState.forceSelection(editorState, this.lastSelectionWithFocus);
255
+ if ((0, _utils.containsActiveElement)(this.root)) {
256
+ editorState = _draftJs.EditorState.acceptSelection(editorState, this.lastSelectionWithFocus);
257
+ } else {
258
+ editorState = _draftJs.EditorState.forceSelection(editorState, this.lastSelectionWithFocus);
259
+ this.focus();
260
+ }
250
261
  }
251
262
  this.onChange(editorState);
252
263
  });
@@ -385,6 +396,7 @@ class RichEditor extends _react.default.Component {
385
396
  handleKeyCommand: this.handleKeyCommand,
386
397
  blockStyleFn: _utils2.blockStyleFn,
387
398
  handlePastedText: this.handlePastedText,
399
+ preserveSelectionOnBlur: true,
388
400
  __self: this,
389
401
  __source: {
390
402
  fileName: _jsxFileName,
@@ -1 +1 @@
1
- {"version":3,"names":["_react","_interopRequireDefault","require","_draftJs","_draftjsConductor","_immutable","_utils","_utils2","_toolbar","_richEditorStCss","_jsxFileName","MAX_DEPTH","STRING_TO_ORDERED_LIST_RE","STRING_TO_UNORDERED_LIST_RE","RichEditor","React","Component","constructor","args","_defineProperty2","default","root","containsActiveElement","_this$editor","editor","focus","baseEditorState","editorState","applyAdvancedModifications","selection","getSelection","getHasFocus","lastSelectionWithFocus","props","onChange","e","isFullScreen","onToggleFullScreen","key","preventDefault","currentBlock","getCurrentBlock","isListType","isListItemBlockType","getType","shiftKey","handleRemoveListIndent","handleAddListIndent","nextState","RichUtils","onTab","event","currentBlockKey","getKey","previousListItem","getPreviousListItemBlock","nextEditorState","previousListItemDepth","getDepth","nextDepth","preventAndStopEvent","initialBlock","initialBlockDepth","initialBlockType","nextContentState","getCurrentContent","blockAfter","getBlockAfter","merge","blockMap","getBlockMap","set","EditorState","push","_","html","newState","handleDraftEditorPastedText","block","text","getText","type","test","convertBlockToListItem","command","includes","splitAndUnstyleBlock","completeKeyCommand","splitAndCopyInlineBlockType","removeCurrentBlock","handleKeyCommand","textAlign","data","Map","style","contentState","Modifier","mergeBlockData","selectedBlocks","blockKey","getStartKey","getBlockForKey","getEndKey","getKeyAfter","value","getSelectedBlocks","length","unstyleBlocks","every","getData","get","toggleListType","forEach","blockType","inlineBlockType","listType","otherType","blockSelection","SelectionState","createEmpty","getLength","setBlockType","forceSelection","inlineStyle","toggleInlineStyle","link","entityKey","isCollapsed","anchorOffset","getAnchorOffset","textEntityKey","createEntity","getLastCreatedEntityKey","insertText","undefined","focusOffset","hasFocus","url","toggleLink","getCurrentInlineStyle","contains","customStyleMap","styles","concat","Object","keys","contentWithoutStyles","reduce","removeInlineStyle","setBlockData","applyEntity","toggleBlockType","componentDidMount","autoFocus","copySource","registerCopySource","componentWillUnmount","unregister","componentDidUpdate","render","headingsEnabled","readOnly","createElement","ref","className","classes","onKeyDown","__self","__source","fileName","lineNumber","columnNumber","Toolbar","onChangeBlock","onChangeStyle","onChangeLink","onChangeAlign","onClear","Editor","tabIndex","stripPastedStyles","keyBindingFn","getDefaultKeyBinding","blockStyleFn","handlePastedText","exports"],"sources":["../../../../../../src/components/rich-text/rich-text-input/rich-text-editor/rich-editor.tsx"],"sourcesContent":["import React from 'react';\n\nimport type {\n ContentBlock,\n ContentState,\n DraftHandleValue,\n DraftBlockType,\n} from 'draft-js';\nimport {\n Editor,\n EditorState,\n getDefaultKeyBinding,\n RichUtils,\n Modifier,\n SelectionState,\n} from 'draft-js';\nimport {\n registerCopySource,\n handleDraftEditorPastedText,\n} from 'draftjs-conductor';\nimport { Map } from 'immutable';\n\nimport { preventAndStopEvent, containsActiveElement } from '../../../../utils';\n\nimport type { CustomStyleMap } from './utils';\nimport {\n blockStyleFn,\n convertBlockToListItem,\n removeCurrentBlock,\n getCurrentBlock,\n splitAndUnstyleBlock,\n splitAndCopyInlineBlockType,\n isListItemBlockType,\n getPreviousListItemBlock,\n} from './utils';\nimport { Toolbar } from './toolbar';\nimport { classes } from './rich-editor.st.css.js';\n\nconst MAX_DEPTH = 4;\n// \"1.\" or \"1 .\"\nconst STRING_TO_ORDERED_LIST_RE = /^1\\s?\\.$/;\n// \"- \"\nconst STRING_TO_UNORDERED_LIST_RE = /^-\\s$/;\n\nexport interface RichEditorProps {\n readOnly?: boolean;\n onToggleFullScreen?: () => void;\n onToolbarMouseDown?: React.MouseEventHandler;\n customStyleMap: CustomStyleMap;\n editorState: EditorState;\n onChange: (editorState: EditorState) => void;\n isFullScreen?: boolean;\n headingsEnabled?: boolean;\n autoFocus?: boolean;\n}\n\nexport class RichEditor extends React.Component<RichEditorProps> {\n public editor: Editor | null = null;\n\n private root: HTMLElement | null = null;\n\n private copySource: { unregister: () => void } | null = null;\n\n private lastSelectionWithFocus: SelectionState | null = null;\n\n public componentDidMount() {\n if (this.props.autoFocus) {\n this.focus();\n }\n\n if (this.editor) {\n this.copySource = registerCopySource(this.editor);\n }\n }\n\n componentWillUnmount() {\n if (this.copySource) {\n this.copySource.unregister();\n }\n }\n\n componentDidUpdate() {\n if (!this.copySource && this.editor) {\n this.copySource = registerCopySource(this.editor);\n }\n }\n\n public render() {\n const {\n onToggleFullScreen,\n isFullScreen,\n headingsEnabled,\n editorState,\n customStyleMap,\n readOnly,\n } = this.props;\n\n return (\n <div\n ref={(root) => (this.root = root)}\n className={classes.root}\n onKeyDown={this.onKeyDown}\n >\n {!readOnly && (\n <Toolbar\n isFullScreen={isFullScreen}\n editorState={editorState}\n onChangeBlock={this.onChangeBlock}\n onChangeStyle={this.onChangeStyle}\n onChangeLink={this.onChangeLink}\n onChangeAlign={this.onChangeAlign}\n onClear={this.onClear}\n onToggleFullScreen={onToggleFullScreen}\n headingsEnabled={headingsEnabled}\n />\n )}\n <div className={classes.editor}>\n <Editor\n ref={(editor) => (this.editor = editor)}\n readOnly={readOnly}\n tabIndex={-1}\n editorState={editorState}\n stripPastedStyles={false}\n onChange={this.onChange}\n customStyleMap={customStyleMap}\n keyBindingFn={getDefaultKeyBinding}\n handleKeyCommand={this.handleKeyCommand}\n blockStyleFn={blockStyleFn}\n handlePastedText={this.handlePastedText}\n />\n </div>\n </div>\n );\n }\n\n public focus = () => {\n if (this.root && !containsActiveElement(this.root)) {\n this.editor?.focus();\n }\n };\n\n private onChange = (baseEditorState: EditorState) => {\n const editorState = this.applyAdvancedModifications(baseEditorState);\n const selection = editorState.getSelection();\n\n if (selection.getHasFocus()) {\n this.lastSelectionWithFocus = selection;\n }\n\n this.props.onChange(editorState);\n };\n\n private onKeyDown = (e: React.KeyboardEvent) => {\n const { editorState, isFullScreen, onToggleFullScreen } = this.props;\n /**\n * TODO\n * Ctrl+k - Link\n * Ctrl+Shift+L - align:left\n * Ctrl+Shift+E - align:center\n * Ctrl+Shift+R - align:right\n * Ctrl+Shift+J - align:justify\n * Ctrl+Shift+7 - ordered-list\n * Ctrl+Shift+8 - unordered-list\n * Ctrl+Alt+0 - normal text\n * Ctrl+Alt+1 - header-two\n * Ctrl+Alt+2 - header-three\n * Ctrl+\\ - clear formatting\n */\n switch (e.key) {\n case 'F11':\n if (onToggleFullScreen) {\n e.preventDefault();\n onToggleFullScreen();\n }\n break;\n case 'Escape':\n if (isFullScreen && onToggleFullScreen) {\n onToggleFullScreen();\n }\n break;\n case 'Tab': {\n const currentBlock = getCurrentBlock(editorState);\n const isListType = isListItemBlockType(currentBlock.getType());\n\n if (isListType && e.shiftKey) {\n this.handleRemoveListIndent(e, editorState);\n break;\n }\n\n if (isListType) {\n this.handleAddListIndent(e, editorState);\n break;\n }\n\n const nextState = RichUtils.onTab(e, editorState, MAX_DEPTH);\n\n this.onChange(nextState);\n break;\n }\n }\n };\n\n private handleAddListIndent = (\n event: React.KeyboardEvent,\n editorState: EditorState,\n ) => {\n const currentBlock = getCurrentBlock(editorState);\n const currentBlockKey = currentBlock.getKey();\n const previousListItem = getPreviousListItemBlock(\n editorState,\n currentBlockKey,\n );\n\n if (!previousListItem) {\n return;\n }\n\n const nextEditorState = RichUtils.onTab(event, editorState, MAX_DEPTH);\n\n const previousListItemDepth = previousListItem.getDepth();\n const nextDepth = getCurrentBlock(nextEditorState).getDepth();\n\n // Allow only one level of nesting related to the previous list item\n if (nextDepth > previousListItemDepth + 1) {\n return;\n }\n\n preventAndStopEvent(event);\n this.onChange(nextEditorState);\n };\n\n private handleRemoveListIndent = (\n event: React.KeyboardEvent,\n editorState: EditorState,\n ) => {\n const initialBlock = getCurrentBlock(editorState);\n const initialBlockDepth = initialBlock.getDepth();\n const initialBlockType = initialBlock.getType();\n\n if (initialBlockDepth === 0) {\n return;\n }\n\n let nextEditorState = RichUtils.onTab(event, editorState, MAX_DEPTH);\n let nextContentState = nextEditorState.getCurrentContent();\n\n const currentBlock = getCurrentBlock(nextEditorState);\n\n let blockAfter: ContentBlock | undefined = nextContentState.getBlockAfter(\n currentBlock.getKey(),\n );\n\n while (\n blockAfter &&\n initialBlockType === blockAfter.getType() &&\n blockAfter.getDepth() >= initialBlockDepth + 1\n ) {\n nextContentState = nextContentState.merge({\n blockMap: nextContentState\n .getBlockMap()\n .set(\n blockAfter.getKey(),\n blockAfter.set('depth', blockAfter.getDepth() - 1) as ContentBlock,\n ),\n }) as ContentState;\n\n blockAfter = nextContentState.getBlockAfter(blockAfter.getKey());\n }\n\n nextEditorState = EditorState.push(\n editorState,\n nextContentState as ContentState,\n 'adjust-depth',\n );\n\n preventAndStopEvent(event);\n this.onChange(nextEditorState);\n };\n\n private handlePastedText = (\n _: string,\n html: string | undefined,\n editorState: EditorState,\n ): DraftHandleValue => {\n const newState = handleDraftEditorPastedText(_, html, editorState);\n\n if (newState) {\n this.onChange(newState);\n return 'handled';\n }\n\n return 'not-handled';\n };\n\n private applyAdvancedModifications = (\n editorState: EditorState,\n ): EditorState => {\n const block = getCurrentBlock(editorState);\n const text = block.getText();\n const type = block.getType();\n\n if (STRING_TO_ORDERED_LIST_RE.test(text) && type === 'unstyled') {\n return convertBlockToListItem(editorState, true);\n }\n\n if (STRING_TO_UNORDERED_LIST_RE.test(text) && type === 'unstyled') {\n return convertBlockToListItem(editorState, false);\n }\n\n return editorState;\n };\n\n private handleKeyCommand = (\n command: string,\n editorState: EditorState,\n ): DraftHandleValue => {\n let block: ContentBlock;\n let nextState: EditorState | null;\n\n switch (command) {\n case 'split-block':\n block = getCurrentBlock(editorState);\n\n if (block.getType().includes('header')) {\n nextState = splitAndUnstyleBlock(editorState);\n return this.completeKeyCommand(nextState);\n }\n\n if (isListItemBlockType(block.getType())) {\n nextState = splitAndCopyInlineBlockType(editorState);\n return this.completeKeyCommand(nextState);\n }\n break;\n case 'delete':\n case 'backspace':\n block = getCurrentBlock(editorState);\n\n if (!block.getText()) {\n nextState = removeCurrentBlock(editorState, command);\n return this.completeKeyCommand(nextState);\n }\n break;\n }\n\n nextState = RichUtils.handleKeyCommand(editorState, command);\n return this.completeKeyCommand(nextState);\n };\n\n private completeKeyCommand = (editorState: EditorState | null) => {\n if (editorState) {\n this.onChange(editorState);\n return 'handled';\n }\n return 'not-handled';\n };\n\n private onChangeAlign = (textAlign: string) => {\n const { editorState } = this.props;\n const data = Map({ style: { textAlign } });\n\n const contentState = Modifier.mergeBlockData(\n editorState.getCurrentContent(),\n editorState.getSelection(),\n data,\n );\n const nextState = EditorState.push(\n editorState,\n contentState,\n 'change-block-data',\n );\n this.onChange(nextState);\n };\n\n private getSelectedBlocks = (editorState: EditorState) => {\n const selection = editorState.getSelection();\n const contentState = editorState.getCurrentContent();\n const selectedBlocks = [];\n\n let blockKey = selection.getStartKey();\n selectedBlocks.push(contentState.getBlockForKey(blockKey));\n\n while (blockKey !== selection.getEndKey()) {\n blockKey = contentState.getKeyAfter(blockKey);\n selectedBlocks.push(contentState.getBlockForKey(blockKey));\n }\n\n return selectedBlocks;\n };\n\n private onChangeBlock = (value: string) => {\n let { editorState } = this.props;\n let contentState = editorState.getCurrentContent();\n const selectedBlocks = this.getSelectedBlocks(editorState);\n\n if (selectedBlocks.length) {\n // if every block have value style then remove it from all\n // else set every block to value\n // also remember case when we explicitly trying to unstyle blocks\n const unstyleBlocks =\n value === 'unstyled' ||\n selectedBlocks.every(\n (block) =>\n block.getType() === value ||\n block.getData().get('inlineBlockType', 'unstyled') === value,\n );\n\n const toggleListType = isListItemBlockType(value as DraftBlockType);\n\n selectedBlocks.forEach((block) => {\n let blockType = block.getType();\n let inlineBlockType = block\n .getData()\n .get('inlineBlockType', 'unstyled') as DraftBlockType;\n\n let [listType, otherType]: [DraftBlockType, DraftBlockType] =\n isListItemBlockType(blockType)\n ? [blockType, inlineBlockType]\n : ['unstyled', blockType];\n\n if (unstyleBlocks) {\n listType = listType === value ? 'unstyled' : listType;\n otherType = [otherType, 'unstyled'].includes(value)\n ? 'unstyled'\n : otherType;\n } else {\n if (toggleListType) {\n listType = value as DraftBlockType;\n } else {\n otherType = value as DraftBlockType;\n }\n }\n\n blockType = listType !== 'unstyled' ? listType : otherType;\n inlineBlockType = listType !== 'unstyled' ? otherType : 'unstyled';\n\n // create selection for whole block\n const blockSelection = SelectionState.createEmpty(block.getKey()).set(\n 'focusOffset',\n block.getLength(),\n ) as SelectionState;\n\n contentState = Modifier.setBlockType(\n contentState,\n blockSelection,\n blockType,\n );\n contentState = Modifier.mergeBlockData(\n contentState,\n blockSelection,\n Map({ inlineBlockType }),\n );\n });\n }\n\n editorState = EditorState.push(\n editorState,\n contentState,\n 'change-block-type',\n );\n\n if (this.lastSelectionWithFocus) {\n editorState = EditorState.forceSelection(\n editorState,\n this.lastSelectionWithFocus,\n );\n }\n this.onChange(editorState);\n };\n\n private onChangeStyle = (inlineStyle: string) => {\n const editorState = RichUtils.toggleInlineStyle(\n this.props.editorState,\n inlineStyle,\n );\n this.onChange(editorState);\n };\n\n private onChangeLink = (link?: string) => {\n let { editorState } = this.props;\n\n if (this.lastSelectionWithFocus) {\n editorState = EditorState.forceSelection(\n editorState,\n this.lastSelectionWithFocus,\n );\n }\n let selection = editorState.getSelection();\n let contentState = editorState.getCurrentContent();\n let entityKey: string | null = null;\n this.focus();\n\n if (link) {\n // we need to add text when no text is selected\n if (selection.isCollapsed()) {\n const anchorOffset = selection.getAnchorOffset();\n const textEntityKey = contentState\n .createEntity('PLACEHOLDER', 'IMMUTABLE')\n .getLastCreatedEntityKey();\n\n contentState = Modifier.insertText(\n contentState,\n selection,\n link,\n undefined,\n textEntityKey,\n );\n editorState = EditorState.push(\n editorState,\n contentState,\n 'insert-characters',\n );\n selection = selection.merge({\n focusOffset: anchorOffset + link.length,\n hasFocus: true,\n }) as SelectionState;\n editorState = EditorState.forceSelection(editorState, selection);\n contentState = editorState.getCurrentContent();\n }\n contentState = contentState.createEntity('LINK', 'MUTABLE', {\n url: link,\n });\n entityKey = contentState.getLastCreatedEntityKey();\n }\n editorState = RichUtils.toggleLink(editorState, selection, entityKey);\n\n if (!editorState.getCurrentInlineStyle().contains('UNDERLINE')) {\n editorState = RichUtils.toggleInlineStyle(editorState, 'UNDERLINE');\n }\n\n this.onChange(editorState);\n };\n\n private onClear = () => {\n const { editorState, customStyleMap } = this.props;\n const selection = editorState.getSelection();\n // clear inline styles\n const styles = [\n 'BOLD',\n 'ITALIC',\n 'UNDERLINE',\n 'STRIKETHROUGH',\n 'CODE',\n ].concat(Object.keys(customStyleMap));\n let contentWithoutStyles = styles.reduce(\n (contentState, style) =>\n Modifier.removeInlineStyle(contentState, selection, style),\n editorState.getCurrentContent(),\n );\n\n // clear inline styles applied to blocks (backward compatibility)\n contentWithoutStyles = Modifier.setBlockData(\n contentWithoutStyles,\n selection,\n Map(),\n );\n\n // remove all entities like links\n contentWithoutStyles = Modifier.applyEntity(\n contentWithoutStyles,\n selection,\n null,\n );\n\n // clear blocks\n let nextState = EditorState.push(\n editorState,\n contentWithoutStyles,\n 'change-inline-style',\n );\n nextState = RichUtils.toggleBlockType(nextState, 'unstyled');\n this.onChange(nextState);\n };\n}\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AAQA,IAAAC,QAAA,GAAAD,OAAA;AAQA,IAAAE,iBAAA,GAAAF,OAAA;AAIA,IAAAG,UAAA,GAAAH,OAAA;AAEA,IAAAI,MAAA,GAAAJ,OAAA;AAGA,IAAAK,OAAA,GAAAL,OAAA;AAUA,IAAAM,QAAA,GAAAN,OAAA;AACA,IAAAO,gBAAA,GAAAP,OAAA;AAAkD,IAAAQ,YAAA;AAElD,MAAMC,SAAS,GAAG,CAAC;AACnB;AACA,MAAMC,yBAAyB,GAAG,UAAU;AAC5C;AACA,MAAMC,2BAA2B,GAAG,OAAO;AAcpC,MAAMC,UAAU,SAASC,cAAK,CAACC,SAAS,CAAkB;EAAAC,YAAA,GAAAC,IAAA;IAAA,SAAAA,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AA,CAAAoB,OAAA,CAAA8I,aAAA;MAAKE,SAAS,EAAEC,wBAAO,CAAC7I,MAAO;MAAA+I,MAAA;MAAAC,QAAA;QAAAC,QAAA,EAAA/J,YAAA;QAAAgK,UAAA;QAAAC,YAAA;MAAA;IAAA,gBAC7B3K,MAAA,CAAAoB,OAAA,CAAA8I,aAAA,CAAC/J,QAAA,CAAA+K,MAAM;MACLf,GAAG,EAAG3I,MAAM,IAAM,IAAI,CAACA,MAAM,GAAGA,MAAQ;MACxCyI,QAAQ,EAAEA,QAAS;MACnBkB,QAAQ,EAAE,CAAC,CAAE;MACbxJ,WAAW,EAAEA,WAAY;MACzByJ,iBAAiB,EAAE,KAAM;MACzBlJ,QAAQ,EAAE,IAAI,CAACA,QAAS;MACxB2G,cAAc,EAAEA,cAAe;MAC/BwC,YAAY,EAAEC,6BAAqB;MACnC5F,gBAAgB,EAAE,IAAI,CAACA,gBAAiB;MACxC6F,YAAY,EAAEA,oBAAa;MAC3BC,gBAAgB,EAAE,IAAI,CAACA,gBAAiB;MAAAjB,MAAA;MAAAC,QAAA;QAAAC,QAAA,EAAA/J,YAAA;QAAAgK,UAAA;QAAAC,YAAA;MAAA;IAAA,CACzC,CACE,CACF,CAAC;EAEV;AAubF;AAACc,OAAA,CAAA3K,UAAA,GAAAA,UAAA","ignoreList":[]}
1
+ {"version":3,"names":["_react","_interopRequireDefault","require","_draftJs","_draftjsConductor","_immutable","_utils","_utils2","_toolbar","_richEditorStCss","_jsxFileName","MAX_DEPTH","STRING_TO_ORDERED_LIST_RE","STRING_TO_UNORDERED_LIST_RE","RichEditor","React","Component","constructor","args","_defineProperty2","default","root","containsActiveElement","_this$editor","editor","focus","baseEditorState","editorState","applyAdvancedModifications","selection","getSelection","getHasFocus","lastSelectionWithFocus","props","onChange","e","isFullScreen","onToggleFullScreen","key","preventDefault","currentBlock","getCurrentBlock","isListType","isListItemBlockType","getType","shiftKey","handleRemoveListIndent","handleAddListIndent","nextState","RichUtils","onTab","event","currentBlockKey","getKey","previousListItem","getPreviousListItemBlock","nextEditorState","previousListItemDepth","getDepth","nextDepth","preventAndStopEvent","initialBlock","initialBlockDepth","initialBlockType","nextContentState","getCurrentContent","blockAfter","getBlockAfter","merge","blockMap","getBlockMap","set","EditorState","push","_","html","newState","handleDraftEditorPastedText","block","text","getText","type","test","convertBlockToListItem","command","includes","splitAndUnstyleBlock","completeKeyCommand","splitAndCopyInlineBlockType","removeCurrentBlock","handleKeyCommand","textAlign","data","Map","style","contentState","Modifier","mergeBlockData","selectedBlocks","blockKey","getStartKey","getBlockForKey","getEndKey","getKeyAfter","value","acceptSelection","getSelectedBlocks","length","unstyleBlocks","every","getData","get","toggleListType","forEach","blockType","inlineBlockType","listType","otherType","blockSelection","SelectionState","createEmpty","getLength","setBlockType","forceSelection","inlineStyle","toggleInlineStyle","link","entityKey","isCollapsed","anchorOffset","getAnchorOffset","textEntityKey","createEntity","getLastCreatedEntityKey","insertText","undefined","focusOffset","hasFocus","url","toggleLink","getCurrentInlineStyle","contains","customStyleMap","styles","concat","Object","keys","contentWithoutStyles","reduce","removeInlineStyle","setBlockData","applyEntity","toggleBlockType","componentDidMount","autoFocus","copySource","registerCopySource","componentWillUnmount","unregister","componentDidUpdate","render","headingsEnabled","readOnly","createElement","ref","className","classes","onKeyDown","__self","__source","fileName","lineNumber","columnNumber","Toolbar","onChangeBlock","onChangeStyle","onChangeLink","onChangeAlign","onClear","Editor","tabIndex","stripPastedStyles","keyBindingFn","getDefaultKeyBinding","blockStyleFn","handlePastedText","preserveSelectionOnBlur","exports"],"sources":["../../../../../../src/components/rich-text/rich-text-input/rich-text-editor/rich-editor.tsx"],"sourcesContent":["import React from 'react';\n\nimport type {\n ContentBlock,\n ContentState,\n DraftHandleValue,\n DraftBlockType,\n} from 'draft-js';\nimport {\n Editor,\n EditorState,\n getDefaultKeyBinding,\n RichUtils,\n Modifier,\n SelectionState,\n} from 'draft-js';\nimport {\n registerCopySource,\n handleDraftEditorPastedText,\n} from 'draftjs-conductor';\nimport { Map } from 'immutable';\n\nimport { preventAndStopEvent, containsActiveElement } from '../../../../utils';\n\nimport type { CustomStyleMap } from './utils';\nimport {\n blockStyleFn,\n convertBlockToListItem,\n removeCurrentBlock,\n getCurrentBlock,\n splitAndUnstyleBlock,\n splitAndCopyInlineBlockType,\n isListItemBlockType,\n getPreviousListItemBlock,\n} from './utils';\nimport { Toolbar } from './toolbar';\nimport { classes } from './rich-editor.st.css.js';\n\nconst MAX_DEPTH = 4;\n// \"1.\" or \"1 .\"\nconst STRING_TO_ORDERED_LIST_RE = /^1\\s?\\.$/;\n// \"- \"\nconst STRING_TO_UNORDERED_LIST_RE = /^-\\s$/;\n\nexport interface RichEditorProps {\n readOnly?: boolean;\n onToggleFullScreen?: () => void;\n onToolbarMouseDown?: React.MouseEventHandler;\n customStyleMap: CustomStyleMap;\n editorState: EditorState;\n onChange: (editorState: EditorState) => void;\n isFullScreen?: boolean;\n headingsEnabled?: boolean;\n autoFocus?: boolean;\n}\n\nexport class RichEditor extends React.Component<RichEditorProps> {\n public editor: Editor | null = null;\n\n private root: HTMLElement | null = null;\n\n private copySource: { unregister: () => void } | null = null;\n\n private lastSelectionWithFocus: SelectionState | null = null;\n\n public componentDidMount() {\n if (this.props.autoFocus) {\n this.focus();\n }\n\n if (this.editor) {\n this.copySource = registerCopySource(this.editor);\n }\n }\n\n componentWillUnmount() {\n if (this.copySource) {\n this.copySource.unregister();\n }\n }\n\n componentDidUpdate() {\n if (!this.copySource && this.editor) {\n this.copySource = registerCopySource(this.editor);\n }\n }\n\n public render() {\n const {\n onToggleFullScreen,\n isFullScreen,\n headingsEnabled,\n editorState,\n customStyleMap,\n readOnly,\n } = this.props;\n\n return (\n <div\n ref={(root) => (this.root = root)}\n className={classes.root}\n onKeyDown={this.onKeyDown}\n >\n {!readOnly && (\n <Toolbar\n isFullScreen={isFullScreen}\n editorState={editorState}\n onChangeBlock={this.onChangeBlock}\n onChangeStyle={this.onChangeStyle}\n onChangeLink={this.onChangeLink}\n onChangeAlign={this.onChangeAlign}\n onClear={this.onClear}\n onToggleFullScreen={onToggleFullScreen}\n headingsEnabled={headingsEnabled}\n />\n )}\n <div className={classes.editor}>\n <Editor\n ref={(editor) => (this.editor = editor)}\n readOnly={readOnly}\n tabIndex={-1}\n editorState={editorState}\n stripPastedStyles={false}\n onChange={this.onChange}\n customStyleMap={customStyleMap}\n keyBindingFn={getDefaultKeyBinding}\n handleKeyCommand={this.handleKeyCommand}\n blockStyleFn={blockStyleFn}\n handlePastedText={this.handlePastedText}\n preserveSelectionOnBlur\n />\n </div>\n </div>\n );\n }\n\n public focus = () => {\n if (this.root && !containsActiveElement(this.root)) {\n this.editor?.focus();\n }\n };\n\n private onChange = (baseEditorState: EditorState) => {\n const editorState = this.applyAdvancedModifications(baseEditorState);\n const selection = editorState.getSelection();\n\n if (selection.getHasFocus()) {\n this.lastSelectionWithFocus = selection;\n }\n\n this.props.onChange(editorState);\n };\n\n private onKeyDown = (e: React.KeyboardEvent) => {\n const { editorState, isFullScreen, onToggleFullScreen } = this.props;\n /**\n * TODO\n * Ctrl+k - Link\n * Ctrl+Shift+L - align:left\n * Ctrl+Shift+E - align:center\n * Ctrl+Shift+R - align:right\n * Ctrl+Shift+J - align:justify\n * Ctrl+Shift+7 - ordered-list\n * Ctrl+Shift+8 - unordered-list\n * Ctrl+Alt+0 - normal text\n * Ctrl+Alt+1 - header-two\n * Ctrl+Alt+2 - header-three\n * Ctrl+\\ - clear formatting\n */\n switch (e.key) {\n case 'F11':\n if (onToggleFullScreen) {\n e.preventDefault();\n onToggleFullScreen();\n }\n break;\n case 'Escape':\n if (isFullScreen && onToggleFullScreen) {\n onToggleFullScreen();\n }\n break;\n case 'Tab': {\n const currentBlock = getCurrentBlock(editorState);\n const isListType = isListItemBlockType(currentBlock.getType());\n\n if (isListType && e.shiftKey) {\n this.handleRemoveListIndent(e, editorState);\n break;\n }\n\n if (isListType) {\n this.handleAddListIndent(e, editorState);\n break;\n }\n\n const nextState = RichUtils.onTab(e, editorState, MAX_DEPTH);\n\n this.onChange(nextState);\n break;\n }\n }\n };\n\n private handleAddListIndent = (\n event: React.KeyboardEvent,\n editorState: EditorState,\n ) => {\n const currentBlock = getCurrentBlock(editorState);\n const currentBlockKey = currentBlock.getKey();\n const previousListItem = getPreviousListItemBlock(\n editorState,\n currentBlockKey,\n );\n\n if (!previousListItem) {\n return;\n }\n\n const nextEditorState = RichUtils.onTab(event, editorState, MAX_DEPTH);\n\n const previousListItemDepth = previousListItem.getDepth();\n const nextDepth = getCurrentBlock(nextEditorState).getDepth();\n\n // Allow only one level of nesting related to the previous list item\n if (nextDepth > previousListItemDepth + 1) {\n return;\n }\n\n preventAndStopEvent(event);\n this.onChange(nextEditorState);\n };\n\n private handleRemoveListIndent = (\n event: React.KeyboardEvent,\n editorState: EditorState,\n ) => {\n const initialBlock = getCurrentBlock(editorState);\n const initialBlockDepth = initialBlock.getDepth();\n const initialBlockType = initialBlock.getType();\n\n if (initialBlockDepth === 0) {\n return;\n }\n\n let nextEditorState = RichUtils.onTab(event, editorState, MAX_DEPTH);\n let nextContentState = nextEditorState.getCurrentContent();\n\n const currentBlock = getCurrentBlock(nextEditorState);\n\n let blockAfter: ContentBlock | undefined = nextContentState.getBlockAfter(\n currentBlock.getKey(),\n );\n\n while (\n blockAfter &&\n initialBlockType === blockAfter.getType() &&\n blockAfter.getDepth() >= initialBlockDepth + 1\n ) {\n nextContentState = nextContentState.merge({\n blockMap: nextContentState\n .getBlockMap()\n .set(\n blockAfter.getKey(),\n blockAfter.set('depth', blockAfter.getDepth() - 1) as ContentBlock,\n ),\n }) as ContentState;\n\n blockAfter = nextContentState.getBlockAfter(blockAfter.getKey());\n }\n\n nextEditorState = EditorState.push(\n editorState,\n nextContentState as ContentState,\n 'adjust-depth',\n );\n\n preventAndStopEvent(event);\n this.onChange(nextEditorState);\n };\n\n private handlePastedText = (\n _: string,\n html: string | undefined,\n editorState: EditorState,\n ): DraftHandleValue => {\n const newState = handleDraftEditorPastedText(_, html, editorState);\n\n if (newState) {\n this.onChange(newState);\n return 'handled';\n }\n\n return 'not-handled';\n };\n\n private applyAdvancedModifications = (\n editorState: EditorState,\n ): EditorState => {\n const block = getCurrentBlock(editorState);\n const text = block.getText();\n const type = block.getType();\n\n if (STRING_TO_ORDERED_LIST_RE.test(text) && type === 'unstyled') {\n return convertBlockToListItem(editorState, true);\n }\n\n if (STRING_TO_UNORDERED_LIST_RE.test(text) && type === 'unstyled') {\n return convertBlockToListItem(editorState, false);\n }\n\n return editorState;\n };\n\n private handleKeyCommand = (\n command: string,\n editorState: EditorState,\n ): DraftHandleValue => {\n let block: ContentBlock;\n let nextState: EditorState | null;\n\n switch (command) {\n case 'split-block':\n block = getCurrentBlock(editorState);\n\n if (block.getType().includes('header')) {\n nextState = splitAndUnstyleBlock(editorState);\n return this.completeKeyCommand(nextState);\n }\n\n if (isListItemBlockType(block.getType())) {\n nextState = splitAndCopyInlineBlockType(editorState);\n return this.completeKeyCommand(nextState);\n }\n break;\n case 'delete':\n case 'backspace':\n block = getCurrentBlock(editorState);\n\n if (!block.getText()) {\n nextState = removeCurrentBlock(editorState, command);\n return this.completeKeyCommand(nextState);\n }\n break;\n }\n\n nextState = RichUtils.handleKeyCommand(editorState, command);\n return this.completeKeyCommand(nextState);\n };\n\n private completeKeyCommand = (editorState: EditorState | null) => {\n if (editorState) {\n this.onChange(editorState);\n return 'handled';\n }\n return 'not-handled';\n };\n\n private onChangeAlign = (textAlign: string) => {\n const { editorState } = this.props;\n const data = Map({ style: { textAlign } });\n\n const contentState = Modifier.mergeBlockData(\n editorState.getCurrentContent(),\n editorState.getSelection(),\n data,\n );\n const nextState = EditorState.push(\n editorState,\n contentState,\n 'change-block-data',\n );\n this.onChange(nextState);\n };\n\n private getSelectedBlocks = (editorState: EditorState) => {\n const selection = editorState.getSelection();\n const contentState = editorState.getCurrentContent();\n const selectedBlocks = [];\n\n let blockKey = selection.getStartKey();\n selectedBlocks.push(contentState.getBlockForKey(blockKey));\n\n while (blockKey !== selection.getEndKey()) {\n blockKey = contentState.getKeyAfter(blockKey);\n selectedBlocks.push(contentState.getBlockForKey(blockKey));\n }\n\n return selectedBlocks;\n };\n\n private onChangeBlock = (value: string) => {\n let { editorState } = this.props;\n // Restore the last focused selection before computing selected blocks — the\n // editor may have blurred (portal click) before onSelect fires, leaving the\n // current selection stale or collapsed.\n if (this.lastSelectionWithFocus) {\n editorState = EditorState.acceptSelection(\n editorState,\n this.lastSelectionWithFocus,\n );\n }\n let contentState = editorState.getCurrentContent();\n const selectedBlocks = this.getSelectedBlocks(editorState);\n if (selectedBlocks.length) {\n // if every block have value style then remove it from all\n // else set every block to value\n // also remember case when we explicitly trying to unstyle blocks\n const unstyleBlocks =\n value === 'unstyled' ||\n selectedBlocks.every(\n (block) =>\n block.getType() === value ||\n block.getData().get('inlineBlockType', 'unstyled') === value,\n );\n\n const toggleListType = isListItemBlockType(value as DraftBlockType);\n\n selectedBlocks.forEach((block) => {\n let blockType = block.getType();\n let inlineBlockType = block\n .getData()\n .get('inlineBlockType', 'unstyled') as DraftBlockType;\n\n let [listType, otherType]: [DraftBlockType, DraftBlockType] =\n isListItemBlockType(blockType)\n ? [blockType, inlineBlockType]\n : ['unstyled', blockType];\n\n if (unstyleBlocks) {\n listType = listType === value ? 'unstyled' : listType;\n otherType = [otherType, 'unstyled'].includes(value)\n ? 'unstyled'\n : otherType;\n } else {\n if (toggleListType) {\n listType = value as DraftBlockType;\n } else {\n otherType = value as DraftBlockType;\n }\n }\n\n blockType = listType !== 'unstyled' ? listType : otherType;\n inlineBlockType = listType !== 'unstyled' ? otherType : 'unstyled';\n\n // create selection for whole block\n const blockSelection = SelectionState.createEmpty(block.getKey()).set(\n 'focusOffset',\n block.getLength(),\n ) as SelectionState;\n\n contentState = Modifier.setBlockType(\n contentState,\n blockSelection,\n blockType,\n );\n contentState = Modifier.mergeBlockData(\n contentState,\n blockSelection,\n Map({ inlineBlockType }),\n );\n });\n }\n\n editorState = EditorState.push(\n editorState,\n contentState,\n 'change-block-type',\n );\n\n if (this.lastSelectionWithFocus) {\n if (containsActiveElement(this.root)) {\n editorState = EditorState.acceptSelection(\n editorState,\n this.lastSelectionWithFocus,\n );\n } else {\n editorState = EditorState.forceSelection(\n editorState,\n this.lastSelectionWithFocus,\n );\n this.focus();\n }\n }\n this.onChange(editorState);\n };\n\n private onChangeStyle = (inlineStyle: string) => {\n const editorState = RichUtils.toggleInlineStyle(\n this.props.editorState,\n inlineStyle,\n );\n this.onChange(editorState);\n };\n\n private onChangeLink = (link?: string) => {\n let { editorState } = this.props;\n\n if (this.lastSelectionWithFocus) {\n editorState = EditorState.forceSelection(\n editorState,\n this.lastSelectionWithFocus,\n );\n }\n let selection = editorState.getSelection();\n let contentState = editorState.getCurrentContent();\n let entityKey: string | null = null;\n this.focus();\n\n if (link) {\n // we need to add text when no text is selected\n if (selection.isCollapsed()) {\n const anchorOffset = selection.getAnchorOffset();\n const textEntityKey = contentState\n .createEntity('PLACEHOLDER', 'IMMUTABLE')\n .getLastCreatedEntityKey();\n\n contentState = Modifier.insertText(\n contentState,\n selection,\n link,\n undefined,\n textEntityKey,\n );\n editorState = EditorState.push(\n editorState,\n contentState,\n 'insert-characters',\n );\n selection = selection.merge({\n focusOffset: anchorOffset + link.length,\n hasFocus: true,\n }) as SelectionState;\n editorState = EditorState.forceSelection(editorState, selection);\n contentState = editorState.getCurrentContent();\n }\n contentState = contentState.createEntity('LINK', 'MUTABLE', {\n url: link,\n });\n entityKey = contentState.getLastCreatedEntityKey();\n }\n editorState = RichUtils.toggleLink(editorState, selection, entityKey);\n\n if (!editorState.getCurrentInlineStyle().contains('UNDERLINE')) {\n editorState = RichUtils.toggleInlineStyle(editorState, 'UNDERLINE');\n }\n\n this.onChange(editorState);\n };\n\n private onClear = () => {\n const { editorState, customStyleMap } = this.props;\n const selection = editorState.getSelection();\n // clear inline styles\n const styles = [\n 'BOLD',\n 'ITALIC',\n 'UNDERLINE',\n 'STRIKETHROUGH',\n 'CODE',\n ].concat(Object.keys(customStyleMap));\n let contentWithoutStyles = styles.reduce(\n (contentState, style) =>\n Modifier.removeInlineStyle(contentState, selection, style),\n editorState.getCurrentContent(),\n );\n\n // clear inline styles applied to blocks (backward compatibility)\n contentWithoutStyles = Modifier.setBlockData(\n contentWithoutStyles,\n selection,\n Map(),\n );\n\n // remove all entities like links\n contentWithoutStyles = Modifier.applyEntity(\n contentWithoutStyles,\n selection,\n null,\n );\n\n // clear blocks\n let nextState = EditorState.push(\n editorState,\n contentWithoutStyles,\n 'change-inline-style',\n );\n nextState = RichUtils.toggleBlockType(nextState, 'unstyled');\n this.onChange(nextState);\n };\n}\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AAQA,IAAAC,QAAA,GAAAD,OAAA;AAQA,IAAAE,iBAAA,GAAAF,OAAA;AAIA,IAAAG,UAAA,GAAAH,OAAA;AAEA,IAAAI,MAAA,GAAAJ,OAAA;AAGA,IAAAK,OAAA,GAAAL,OAAA;AAUA,IAAAM,QAAA,GAAAN,OAAA;AACA,IAAAO,gBAAA,GAAAP,OAAA;AAAkD,IAAAQ,YAAA;AAElD,MAAMC,SAAS,GAAG,CAAC;AACnB;AACA,MAAMC,yBAAyB,GAAG,UAAU;AAC5C;AACA,MAAMC,2BAA2B,GAAG,OAAO;AAcpC,MAAMC,UAAU,SAASC,cAAK,CAACC,SAAS,CAAkB;EAAAC,YAAA,GAAAC,IAAA;IAAA,SAAAA,IAAA;IAAA,IAAAC,gBAAA,CAAAC,OAAA,kBAChC,IAAI;IAAA,IAAAD,gBAAA,CAAAC,OAAA,gBAEA,IAAI;IAAA,IAAAD,gBAAA,CAAAC,OAAA,sBAEiB,IAAI;IAAA,IAAAD,gBAAA,CAAAC,OAAA,kCAEJ,IAAI;IAAA,IAAAD,gBAAA,CAAAC,OAAA,iBAyE7C,MAAM;MACnB,IAAI,IAAI,CAACC,IAAI,IAAI,CAAC,IAAAC,4BAAqB,EAAC,IAAI,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,YAAA;MAAA;IAAA,CAClC,CACF,eACD5K,MAAA,CAAAoB,OAAA,CAAA+I,aAAA;MAAKE,SAAS,EAAEC,wBAAO,CAAC9I,MAAO;MAAAgJ,MAAA;MAAAC,QAAA;QAAAC,QAAA,EAAAhK,YAAA;QAAAiK,UAAA;QAAAC,YAAA;MAAA;IAAA,gBAC7B5K,MAAA,CAAAoB,OAAA,CAAA+I,aAAA,CAAChK,QAAA,CAAAgL,MAAM;MACLf,GAAG,EAAG5I,MAAM,IAAM,IAAI,CAACA,MAAM,GAAGA,MAAQ;MACxC0I,QAAQ,EAAEA,QAAS;MACnBkB,QAAQ,EAAE,CAAC,CAAE;MACbzJ,WAAW,EAAEA,WAAY;MACzB0J,iBAAiB,EAAE,KAAM;MACzBnJ,QAAQ,EAAE,IAAI,CAACA,QAAS;MACxB4G,cAAc,EAAEA,cAAe;MAC/BwC,YAAY,EAAEC,6BAAqB;MACnC7F,gBAAgB,EAAE,IAAI,CAACA,gBAAiB;MACxC8F,YAAY,EAAEA,oBAAa;MAC3BC,gBAAgB,EAAE,IAAI,CAACA,gBAAiB;MACxCC,uBAAuB;MAAAlB,MAAA;MAAAC,QAAA;QAAAC,QAAA,EAAAhK,YAAA;QAAAiK,UAAA;QAAAC,YAAA;MAAA;IAAA,CACxB,CACE,CACF,CAAC;EAEV;AAucF;AAACe,OAAA,CAAA7K,UAAA,GAAAA,UAAA","ignoreList":[]}
@@ -6,6 +6,7 @@
6
6
  @property st-global(--wds-color-black-100);
7
7
  @property st-global(--wds-color-black-700);
8
8
  @property st-global(--wds-font-family-default);
9
+ @property st-global(--wsr-font-family);
9
10
  @property st-global(--wds-font-weight-medium);
10
11
  @property st-global(--wds-font-weight-bold);
11
12
  @property st-global(--wds-font-size-500);
@@ -65,66 +66,69 @@
65
66
  @property st-global(--rt-p3-lineHeight);
66
67
 
67
68
  :vars {
69
+ /* Madefor fallback ensures the correct font renders even without a WDS theme. */
70
+ fontFamilyDefault: var(--wds-font-family-default, var(--wsr-font-family, Madefor));
71
+
68
72
  h1FontSize: var(--rt-h1-fontSize, 72px);
69
73
  h1FontStyle: var(--rt-h1-fontStyle, normal);
70
- h1FontWeight: var(--rt-h1-fontWeight, var(--wds-font-weight-bold));
71
- h1FontFamily: var(--rt-h1-fontFamily, var(--wds-font-family-default));
74
+ h1FontWeight: var(--rt-h1-fontWeight, var(--wds-font-weight-bold, 700));
75
+ h1FontFamily: var(--rt-h1-fontFamily, value(fontFamilyDefault));
72
76
  h1LineHeight: var(--rt-h1-lineHeight, 1.33);
73
77
  h1Font: value(h1FontStyle) value(h1FontWeight) value(h1FontSize)/value(h1LineHeight) value(h1FontFamily);
74
78
 
75
79
  h2FontSize: var(--rt-h2-fontSize, 42px);
76
80
  h2FontStyle: var(--rt-h2-fontStyle, normal);
77
- h2FontWeight: var(--rt-h2-fontWeight, var(--wds-font-weight-bold));
78
- h2FontFamily: var(--rt-h2-fontFamily, var(--wds-font-family-default));
81
+ h2FontWeight: var(--rt-h2-fontWeight, var(--wds-font-weight-bold, 700));
82
+ h2FontFamily: var(--rt-h2-fontFamily, value(fontFamilyDefault));
79
83
  h2LineHeight: var(--rt-h2-lineHeight, 1.2);
80
84
  h2Font: value(h2FontStyle) value(h2FontWeight) value(h2FontSize)/value(h2LineHeight) value(h2FontFamily);
81
85
 
82
86
  h3FontSize: var(--rt-h3-fontSize, 38px);
83
87
  h3FontStyle: var(--rt-h3-fontStyle, normal);
84
- h3FontWeight: var(--rt-h3-fontWeight, var(--wds-font-weight-medium));
85
- h3FontFamily: var(--rt-h3-fontFamily, var(--wds-font-family-default));
88
+ h3FontWeight: var(--rt-h3-fontWeight, var(--wds-font-weight-medium, 500));
89
+ h3FontFamily: var(--rt-h3-fontFamily, value(fontFamilyDefault));
86
90
  h3LineHeight: var(--rt-h3-lineHeight, 1.2);
87
91
  h3Font: value(h3FontStyle) value(h3FontWeight) value(h3FontSize)/value(h3LineHeight) value(h3FontFamily);
88
92
 
89
93
  h4FontSize: var(--rt-h4-fontSize, 34px);
90
94
  h4FontStyle: var(--rt-h4-fontStyle, normal);
91
- h4FontWeight: var(--rt-h4-fontWeight, var(--wds-font-weight-bold));
92
- h4FontFamily: var(--rt-h4-fontFamily, var(--wds-font-family-default));
95
+ h4FontWeight: var(--rt-h4-fontWeight, var(--wds-font-weight-bold, 700));
96
+ h4FontFamily: var(--rt-h4-fontFamily, value(fontFamilyDefault));
93
97
  h4LineHeight: var(--rt-h4-lineHeight, 1.2);
94
98
  h4Font: value(h4FontStyle) value(h4FontWeight) value(h4FontSize)/value(h4LineHeight) value(h4FontFamily);
95
99
 
96
100
  h5FontSize: var(--rt-h5-fontSize, 28px);
97
101
  h5FontStyle: var(--rt-h5-fontStyle, normal);
98
- h5FontWeight: var(--rt-h5-fontWeight, var(--wds-font-weight-bold));
99
- h5FontFamily: var(--rt-h5-fontFamily, var(--wds-font-family-default));
102
+ h5FontWeight: var(--rt-h5-fontWeight, var(--wds-font-weight-bold, 700));
103
+ h5FontFamily: var(--rt-h5-fontFamily, value(fontFamilyDefault));
100
104
  h5LineHeight: var(--rt-h5-lineHeight, 1.2);
101
105
  h5Font: value(h5FontStyle) value(h5FontWeight) value(h5FontSize)/value(h5LineHeight) value(h5FontFamily);
102
106
 
103
107
  h6FontSize: var(--rt-h6-fontSize, 22px);
104
108
  h6FontStyle: var(--rt-h6-fontStyle, normal);
105
- h6FontWeight: var(--rt-h6-fontWeight, var(--wds-font-weight-medium));
106
- h6FontFamily: var(--rt-h6-fontFamily, var(--wds-font-family-default));
109
+ h6FontWeight: var(--rt-h6-fontWeight, var(--wds-font-weight-medium, 500));
110
+ h6FontFamily: var(--rt-h6-fontFamily, value(fontFamilyDefault));
107
111
  h6LineHeight: var(--rt-h6-lineHeight, 1.2);
108
112
  h6Font: value(h6FontStyle) value(h6FontWeight) value(h6FontSize)/value(h6LineHeight) value(h6FontFamily);
109
113
 
110
114
  p1FontSize: var(--rt-p1-fontSize, 18px);
111
115
  p1FontStyle: var(--rt-p1-fontStyle, normal);
112
- p1FontWeight: var(--rt-p1-fontWeight, var(--wds-font-weight-medium));
113
- p1FontFamily: var(--rt-p1-fontFamily, var(--wds-font-family-default));
116
+ p1FontWeight: var(--rt-p1-fontWeight, var(--wds-font-weight-medium, 500));
117
+ p1FontFamily: var(--rt-p1-fontFamily, value(fontFamilyDefault));
114
118
  p1LineHeight: var(--rt-p1-lineHeight, 24px);
115
119
  p1Font: value(p1FontStyle) value(p1FontWeight) value(p1FontSize)/value(p1LineHeight) value(p1FontFamily);
116
120
 
117
121
  unstyledFontSize: var(--rt-unstyled-fontSize, 16px);
118
122
  unstyledFontStyle: var(--rt-unstyled-fontStyle, normal);
119
- unstyledFontWeight: var(--rt-unstyled-fontWeight, var(--wds-font-weight-medium));
120
- unstyledFontFamily: var(--rt-unstyled-fontFamily, var(--wds-font-family-default));
123
+ unstyledFontWeight: var(--rt-unstyled-fontWeight, var(--wds-font-weight-medium, 500));
124
+ unstyledFontFamily: var(--rt-unstyled-fontFamily, value(fontFamilyDefault));
121
125
  unstyledLineHeight: var(--rt-unstyled-lineHeight, 24px);
122
126
  unstyledFont: value(unstyledFontStyle) value(unstyledFontWeight) value(unstyledFontSize)/value(unstyledLineHeight) value(unstyledFontFamily);
123
127
 
124
128
  p3FontSize: var(--rt-p3-fontSize, 14px);
125
129
  p3FontStyle: var(--rt-p3-fontStyle, normal);
126
- p3FontWeight: var(--rt-p3-fontWeight, var(--wds-font-weight-medium));
127
- p3FontFamily: var(--rt-p3-fontFamily, var(--wds-font-family-default));
130
+ p3FontWeight: var(--rt-p3-fontWeight, var(--wds-font-weight-medium, 500));
131
+ p3FontFamily: var(--rt-p3-fontFamily, value(fontFamilyDefault));
128
132
  p3LineHeight: var(--rt-p3-lineHeight, 18px);
129
133
  p3Font: value(p3FontStyle) value(p3FontWeight) value(p3FontSize)/value(p3LineHeight) value(p3FontFamily);
130
134
  }
@@ -132,10 +136,10 @@
132
136
  .root {
133
137
  display: flex;
134
138
  flex-direction: column;
135
- font-weight: var(--wds-font-weight-medium);
139
+ font-weight: var(--wds-font-weight-medium, 500);
136
140
  font-size: var(--wds-font-size-500);
137
141
  line-height: var(--wds-font-line-height-300);
138
- font-family: var(--wds-font-family-default);
142
+ font-family: value(fontFamilyDefault);
139
143
  }
140
144
 
141
145
  .editor {
@@ -145,8 +149,8 @@
145
149
  flex-direction: column;
146
150
  flex: 1;
147
151
  cursor: text;
148
- color: var(--wds-color-black-100);
149
- background: var(--wds-color-black-700);
152
+ color: var(--wds-color-black-100, var(--wsr-color-D10, #131720));
153
+ background: var(--wds-color-black-700, var(--wsr-color-D70, #edeef2));
150
154
  }
151
155
 
152
156
  .editor :global(.DraftEditor-root) {