@brightspot/ui 3.0.1-cms-ui-migration.2 → 3.0.1-cms-ui-migration.4

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 (320) hide show
  1. package/README.md +56 -37
  2. package/dist/custom-elements.json +1807 -1807
  3. package/dist/storybook/assets/{ActionBar.stories-hJ_5cm-P.js → ActionBar.stories-BZAVK1QG.js} +1 -1
  4. package/dist/storybook/assets/{ActionItem.stories-Bjx2803w.js → ActionItem.stories-BqiWvlWi.js} +1 -1
  5. package/dist/storybook/assets/{Avatar.stories-Cj0YgZ6f.js → Avatar.stories-DkdB6hd_.js} +1 -1
  6. package/dist/storybook/assets/{AvatarGroup.stories-Lh_sQFCU.js → AvatarGroup.stories-DODqaIix.js} +1 -1
  7. package/dist/storybook/assets/{Badge.stories-BL7RUibx.js → Badge.stories-DZoum08S.js} +1 -1
  8. package/dist/storybook/assets/{Button-BPHNcxqK.js → Button-BkmBgNO-.js} +1 -1
  9. package/dist/storybook/assets/{Button.stories-CAYO4gdU.js → Button.stories-BFhCL2dp.js} +1 -1
  10. package/dist/storybook/assets/{ButtonGroup.stories-Cd13Us5K.js → ButtonGroup.stories-DlTGTvkq.js} +1 -1
  11. package/dist/storybook/assets/{Celebrate.stories-D_KE3Qze.js → Celebrate.stories-m4d4zTEz.js} +1 -1
  12. package/dist/storybook/assets/{Checkbox.stories-Aj1xgZVn.js → Checkbox.stories-Y253YeU7.js} +1 -1
  13. package/dist/storybook/assets/{CircularProgress.stories-BecV_v6d.js → CircularProgress.stories-6BD8uV5G.js} +1 -1
  14. package/dist/storybook/assets/{ClipboardMixin.stories-DU-WiZ2f.js → ClipboardMixin.stories-BkH66rIU.js} +1 -1
  15. package/dist/storybook/assets/{Color-6BZIO3FS-BYl4KZZn.js → Color-6BZIO3FS-iG0OjPBU.js} +1 -1
  16. package/dist/storybook/assets/{Colors.stories-BMUVUy2q.js → Colors.stories-BxiyQnEg.js} +1 -1
  17. package/dist/storybook/assets/{CombinedEffects.stories-FHcPKFm6.js → CombinedEffects.stories-Bs3U7qRl.js} +1 -1
  18. package/dist/storybook/assets/{ComponentStatesMixin-EMUnfT5y.js → ComponentStatesMixin-DampYb5c.js} +1 -1
  19. package/dist/storybook/assets/{ComponentStatesMixin.stories-SXq0kzS9.js → ComponentStatesMixin.stories-CZ2OW7as.js} +1 -1
  20. package/dist/storybook/assets/{CopyToClipboard.stories-u43lhvcI.js → CopyToClipboard.stories-CdlghjaE.js} +1 -1
  21. package/dist/storybook/assets/{Debounce.stories-BdCn5qgO.js → Debounce.stories-CymT8PnT.js} +1 -1
  22. package/dist/storybook/assets/{DocsRenderer-LL677BLK-DxiEJ_jx.js → DocsRenderer-LL677BLK-dqHCo-GE.js} +3 -3
  23. package/dist/storybook/assets/{Dropdown.stories-BWSRwjIF.js → Dropdown.stories-B6JwKg-I.js} +1 -1
  24. package/dist/storybook/assets/{EmptyState.stories-BpobeZL5.js → EmptyState.stories-Bk229lPH.js} +1 -1
  25. package/dist/storybook/assets/{Events.stories-CP5kMzpr.js → Events.stories-C8-k9cx8.js} +1 -1
  26. package/dist/storybook/assets/{Heading.stories-CbJD-oTB.js → Heading.stories-DIdnAQRG.js} +1 -1
  27. package/dist/storybook/assets/{HueRipple.stories-BOABJ7zw.js → HueRipple.stories-B1gXAEaH.js} +1 -1
  28. package/dist/storybook/assets/{Icon.stories-CWlUHL4j.js → Icon.stories--1VJ0_yt.js} +1 -1
  29. package/dist/storybook/assets/{IconButton.stories-BWBs-OLT.js → IconButton.stories-CS2rEIir.js} +1 -1
  30. package/dist/storybook/assets/{LinearProgress.stories-LZ0GZoxF.js → LinearProgress.stories-Bx0CQQls.js} +1 -1
  31. package/dist/storybook/assets/{Pagination.stories-CbLaR3P9.js → Pagination.stories-B4AogTXB.js} +1 -1
  32. package/dist/storybook/assets/{Popover.stories-JHrWqYZw.js → Popover.stories-BR88DPgU.js} +1 -1
  33. package/dist/storybook/assets/{ReadyMixin-B1H2a9x8.js → ReadyMixin-n6qZO39Y.js} +1 -1
  34. package/dist/storybook/assets/{RovingTabindexMixin.stories-UMHpYG73.js → RovingTabindexMixin.stories-1xTJSMSv.js} +1 -1
  35. package/dist/storybook/assets/{Rtc.stories-VQtNSlls.js → Rtc.stories-Rt0A_rUZ.js} +1 -1
  36. package/dist/storybook/assets/{ScrollShadow.stories-CYdi8Tgp.js → ScrollShadow.stories-CjLdJyYu.js} +1 -1
  37. package/dist/storybook/assets/{Switch.stories-D8F2hZCf.js → Switch.stories-CF8wO4v2.js} +1 -1
  38. package/dist/storybook/assets/{Tab.stories-wgBP0lTj.js → Tab.stories-C8XNshog.js} +1 -1
  39. package/dist/storybook/assets/{Tabs.stories-C00rr5sf.js → Tabs.stories-B01l4rQx.js} +1 -1
  40. package/dist/storybook/assets/{Throttle.stories-BhQEfJbS.js → Throttle.stories-Bpi0K5j9.js} +1 -1
  41. package/dist/storybook/assets/{Tooltip.stories-CGoZ5qTn.js → Tooltip.stories-BC4zMiZ1.js} +1 -1
  42. package/dist/storybook/assets/{Upload.stories-B3K-HAXw.js → Upload.stories-2pWv_fZ1.js} +1 -1
  43. package/dist/storybook/assets/{UploadItem.stories-71ArSoUh.js → UploadItem.stories-aLeAUM7y.js} +1 -1
  44. package/dist/storybook/assets/{Welcome.stories-CihlfFXS.js → Welcome.stories-DJV83eb7.js} +1 -1
  45. package/dist/storybook/assets/{Widget.stories-1u4KbiJM.js → Widget.stories-Cz0i2o6L.js} +1 -1
  46. package/dist/storybook/assets/{WithTooltip-65CFNBJE-B3Jitxw9.js → WithTooltip-65CFNBJE-D8QwVYG8.js} +1 -1
  47. package/dist/storybook/assets/{blocks-C1HaXuQB.js → blocks-BFmpEZRy.js} +5 -5
  48. package/dist/storybook/assets/{formatter-EIJCOSYU-Dy9Lt9fs.js → formatter-EIJCOSYU-CdwdJOPy.js} +1 -1
  49. package/dist/storybook/assets/if-defined-gbJXriW-.js +1 -0
  50. package/dist/storybook/assets/{iframe-Dx6IxWXF.js → iframe-CyssRDCd.js} +4 -4
  51. package/dist/storybook/assets/{index-OrjedSVh.js → index-B82i8dhg.js} +1 -1
  52. package/dist/storybook/assets/{onFind-YTqjw6W0.js → onFind-BFI1uIxr.js} +1 -1
  53. package/dist/storybook/assets/{onFind.stories-DEvwTrmx.js → onFind.stories-zZjQs_Gn.js} +1 -1
  54. package/dist/storybook/assets/{onRemove.stories-D5mO-Lin.js → onRemove.stories-pFBwAIex.js} +1 -1
  55. package/dist/storybook/assets/{onVisible.stories-C3Rcz0Eb.js → onVisible.stories-5dErOVRq.js} +1 -1
  56. package/dist/storybook/assets/{style-map-CiMHry7H.js → style-map-D0EcLEWO.js} +1 -1
  57. package/dist/storybook/assets/{syntaxhighlighter-ED5Y7EFY-DIZnuhb2.js → syntaxhighlighter-ED5Y7EFY--2h_dVga.js} +1 -1
  58. package/dist/storybook/iframe.html +1 -1
  59. package/dist/storybook/project.json +1 -1
  60. package/package.json +16 -2
  61. package/src/legacy/tool-ui/src/AnalyticsWidget.css +1 -1
  62. package/src/legacy/tool-ui/src/Board.css +1 -1
  63. package/src/legacy/tool-ui/src/BulkUpload.css +1 -1
  64. package/src/legacy/tool-ui/src/ComboInput.css +1 -1
  65. package/src/legacy/tool-ui/src/Compat.css +5 -5
  66. package/src/legacy/tool-ui/src/ContentEditDrawer.css +1 -1
  67. package/src/legacy/tool-ui/src/Dialog.css +1 -1
  68. package/src/legacy/tool-ui/src/FormFilter.css +1 -1
  69. package/src/legacy/tool-ui/src/Icon/index.css +1 -1
  70. package/src/legacy/tool-ui/src/ImageEditor.css +1 -1
  71. package/src/legacy/tool-ui/src/Incompatible.css +2 -2
  72. package/src/legacy/tool-ui/src/LinkCarousel.css +1 -1
  73. package/src/legacy/tool-ui/src/Page.css +1 -1
  74. package/src/legacy/tool-ui/src/RepeatableContentInputGroup.css +1 -1
  75. package/src/legacy/tool-ui/src/RichText.css +1 -1
  76. package/src/legacy/tool-ui/src/SearchWidget.css +2 -2
  77. package/src/legacy/tool-ui/src/SearchWidgetAdvanced.css +1 -1
  78. package/src/legacy/tool-ui/src/Widget.css +1 -1
  79. package/src/legacy/tool-ui/src/main/webapp/dist/v5.5e5d7f655e174ddd85f5.css +5 -0
  80. package/dist/storybook/assets/if-defined-CA2KmTqA.js +0 -1
  81. package/docs/adr/0001-retire-cms-ui-package-fold-under-src-legacy.md +0 -78
  82. package/docs/adr/0002-yarn-workspaces-preserve-cms-ui-deps.md +0 -130
  83. package/docs/adr/0003-bundle-equivalence-as-fold-acceptance-criterion.md +0 -286
  84. package/src/legacy/tool-ui/src/main/resources/settings.properties +0 -1
  85. package/src/legacy/tool-ui/src/main/webapp/WEB-INF/web.xml +0 -81
  86. package/src/legacy/tool-ui/src/main/webapp/dist/v5.5e3fdf0f0b20b4e3c170.css +0 -5
  87. package/src/legacy/tool-ui/src/main/webapp/script/bsp-uploader.js +0 -170
  88. package/src/legacy/tool-ui/src/main/webapp/script/bsp-utils.js +0 -393
  89. package/src/legacy/tool-ui/src/main/webapp/script/content/layout-element.js +0 -141
  90. package/src/legacy/tool-ui/src/main/webapp/script/input/query.js +0 -78
  91. package/src/legacy/tool-ui/src/main/webapp/script/input/workflow.js +0 -718
  92. package/src/legacy/tool-ui/src/main/webapp/script/jquery.extra.js +0 -633
  93. package/src/legacy/tool-ui/src/main/webapp/script/v3/Dropbox.js +0 -18
  94. package/src/legacy/tool-ui/src/main/webapp/script/v3/EditFieldUpdate.js +0 -406
  95. package/src/legacy/tool-ui/src/main/webapp/script/v3/EditFieldUpdateCache.js +0 -1
  96. package/src/legacy/tool-ui/src/main/webapp/script/v3/Notification.js +0 -151
  97. package/src/legacy/tool-ui/src/main/webapp/script/v3/content/edit.js +0 -194
  98. package/src/legacy/tool-ui/src/main/webapp/script/v3/content/state.js +0 -785
  99. package/src/legacy/tool-ui/src/main/webapp/script/v3/csrf.js +0 -35
  100. package/src/legacy/tool-ui/src/main/webapp/script/v3/dashboard.js +0 -65
  101. package/src/legacy/tool-ui/src/main/webapp/script/v3/input/dataTransfer.js +0 -129
  102. package/src/legacy/tool-ui/src/main/webapp/script/v3/input/file.js +0 -433
  103. package/src/legacy/tool-ui/src/main/webapp/script/v3/input/object.js +0 -743
  104. package/src/legacy/tool-ui/src/main/webapp/script/v3/input/read-only.js +0 -17
  105. package/src/legacy/tool-ui/src/main/webapp/script/v3/jquery.frame.js +0 -478
  106. package/src/legacy/tool-ui/src/main/webapp/script/v3/jquery.repeatable.js +0 -2406
  107. package/src/legacy/tool-ui/src/main/webapp/script/v3/plugin/popup.d.ts +0 -2
  108. package/src/legacy/tool-ui/src/main/webapp/script/v3/plugin/popup.js +0 -446
  109. package/src/legacy/tool-ui/src/main/webapp/script/v3/search-filters.js +0 -62
  110. package/src/legacy/tool-ui/src/main/webapp/script/v3/search.js +0 -53
  111. package/src/legacy/tool-ui/src/main/webapp/script/v3.js +0 -1049
  112. package/src/legacy/tool-ui/src/main/webapp/v4/Admin.js +0 -16
  113. package/src/legacy/tool-ui/src/main/webapp/v4/AutoExpand.js +0 -84
  114. package/src/legacy/tool-ui/src/main/webapp/v4/AutoSubmit.js +0 -68
  115. package/src/legacy/tool-ui/src/main/webapp/v4/Bridge.js +0 -536
  116. package/src/legacy/tool-ui/src/main/webapp/v4/CheckboxInput.js +0 -22
  117. package/src/legacy/tool-ui/src/main/webapp/v4/ColorInput.js +0 -5
  118. package/src/legacy/tool-ui/src/main/webapp/v4/ColorInputSpectrum.js +0 -107
  119. package/src/legacy/tool-ui/src/main/webapp/v4/ComboInput.js +0 -1491
  120. package/src/legacy/tool-ui/src/main/webapp/v4/CommunityWidget.js +0 -29
  121. package/src/legacy/tool-ui/src/main/webapp/v4/ContentEdit.js +0 -2427
  122. package/src/legacy/tool-ui/src/main/webapp/v4/ContentLock.js +0 -470
  123. package/src/legacy/tool-ui/src/main/webapp/v4/ContentReporting.js +0 -32
  124. package/src/legacy/tool-ui/src/main/webapp/v4/DataTable.js +0 -31
  125. package/src/legacy/tool-ui/src/main/webapp/v4/DateStringField.js +0 -485
  126. package/src/legacy/tool-ui/src/main/webapp/v4/Entry.js +0 -264
  127. package/src/legacy/tool-ui/src/main/webapp/v4/ExternalItemAuth.js +0 -16
  128. package/src/legacy/tool-ui/src/main/webapp/v4/Form.js +0 -31
  129. package/src/legacy/tool-ui/src/main/webapp/v4/Hierarchy.js +0 -100
  130. package/src/legacy/tool-ui/src/main/webapp/v4/Icon.ts +0 -49
  131. package/src/legacy/tool-ui/src/main/webapp/v4/ImageEditor.js +0 -2403
  132. package/src/legacy/tool-ui/src/main/webapp/v4/ImageEditorBundle.js +0 -5
  133. package/src/legacy/tool-ui/src/main/webapp/v4/LinkCarousel.js +0 -40
  134. package/src/legacy/tool-ui/src/main/webapp/v4/LinkList.js +0 -14
  135. package/src/legacy/tool-ui/src/main/webapp/v4/LinkTable.js +0 -123
  136. package/src/legacy/tool-ui/src/main/webapp/v4/Location.js +0 -19
  137. package/src/legacy/tool-ui/src/main/webapp/v4/LocationMap.js +0 -148
  138. package/src/legacy/tool-ui/src/main/webapp/v4/LookingGlass.js +0 -24
  139. package/src/legacy/tool-ui/src/main/webapp/v4/Message.js +0 -14
  140. package/src/legacy/tool-ui/src/main/webapp/v4/NumberBar.js +0 -32
  141. package/src/legacy/tool-ui/src/main/webapp/v4/Page.js +0 -890
  142. package/src/legacy/tool-ui/src/main/webapp/v4/Preview.js +0 -758
  143. package/src/legacy/tool-ui/src/main/webapp/v4/PreviewEditor.js +0 -86
  144. package/src/legacy/tool-ui/src/main/webapp/v4/PreviewOverlay.js +0 -1005
  145. package/src/legacy/tool-ui/src/main/webapp/v4/PubSub.js +0 -47
  146. package/src/legacy/tool-ui/src/main/webapp/v4/QueryField.js +0 -211
  147. package/src/legacy/tool-ui/src/main/webapp/v4/RegionMap.js +0 -215
  148. package/src/legacy/tool-ui/src/main/webapp/v4/RepeatableContentInputGroup.js +0 -160
  149. package/src/legacy/tool-ui/src/main/webapp/v4/RichTextEditor.js +0 -154
  150. package/src/legacy/tool-ui/src/main/webapp/v4/SearchFields.js +0 -281
  151. package/src/legacy/tool-ui/src/main/webapp/v4/SearchResult.js +0 -255
  152. package/src/legacy/tool-ui/src/main/webapp/v4/SharePreview.js +0 -56
  153. package/src/legacy/tool-ui/src/main/webapp/v4/Sortable.js +0 -874
  154. package/src/legacy/tool-ui/src/main/webapp/v4/StyleEmbeddedContent.js +0 -100
  155. package/src/legacy/tool-ui/src/main/webapp/v4/StyleguidePresets.js +0 -357
  156. package/src/legacy/tool-ui/src/main/webapp/v4/TabContainer.js +0 -360
  157. package/src/legacy/tool-ui/src/main/webapp/v4/Taxonomy.js +0 -27
  158. package/src/legacy/tool-ui/src/main/webapp/v4/ThemeBundleEditor.js +0 -224
  159. package/src/legacy/tool-ui/src/main/webapp/v4/TimedContent.js +0 -147
  160. package/src/legacy/tool-ui/src/main/webapp/v4/TimedContentBundle.js +0 -8
  161. package/src/legacy/tool-ui/src/main/webapp/v4/VideoEditor.js +0 -2417
  162. package/src/legacy/tool-ui/src/main/webapp/v4/VideoEditorBundle.js +0 -8
  163. package/src/legacy/tool-ui/src/main/webapp/v4/ViewMirror.js +0 -52
  164. package/src/legacy/tool-ui/src/main/webapp/v4/ViewPreview.d.ts +0 -13
  165. package/src/legacy/tool-ui/src/main/webapp/v4/ViewPreview.js +0 -177
  166. package/src/legacy/tool-ui/src/main/webapp/v4/Widget.js +0 -90
  167. package/src/legacy/tool-ui/src/main/webapp/v4/__mocks__/fileMock.js +0 -1
  168. package/src/legacy/tool-ui/src/main/webapp/v4/__mocks__/styleMock.js +0 -1
  169. package/src/legacy/tool-ui/src/main/webapp/v4/__mocks__/textArea.mock.js +0 -20
  170. package/src/legacy/tool-ui/src/main/webapp/v4/__tests__/integration/globals.js +0 -770
  171. package/src/legacy/tool-ui/src/main/webapp/v4/__tests__/integration/rte/ProseMirror.test.js +0 -16
  172. package/src/legacy/tool-ui/src/main/webapp/v4/__tests__/integration/rte/index.html +0 -54
  173. package/src/legacy/tool-ui/src/main/webapp/v4/__tests__/integration/rte/plugins/comment_manager/CommentManager.test.js +0 -29
  174. package/src/legacy/tool-ui/src/main/webapp/v4/__tests__/integration/rte/plugins/comment_manager/index.html +0 -35
  175. package/src/legacy/tool-ui/src/main/webapp/v4/__tests__/integration/rte/plugins/custom_keyboard/CustomKeyboard.js +0 -42
  176. package/src/legacy/tool-ui/src/main/webapp/v4/__tests__/integration/rte/plugins/custom_keyboard/index.html +0 -37
  177. package/src/legacy/tool-ui/src/main/webapp/v4/__tests__/integration/rte/plugins/enhancement_manager/EnhancementManager.test.js +0 -288
  178. package/src/legacy/tool-ui/src/main/webapp/v4/__tests__/integration/rte/plugins/enhancement_manager/block.html +0 -38
  179. package/src/legacy/tool-ui/src/main/webapp/v4/__tests__/integration/rte/plugins/enhancement_manager/inline.html +0 -38
  180. package/src/legacy/tool-ui/src/main/webapp/v4/__tests__/integration/rte/plugins/enhancement_manager/no-popups.html +0 -38
  181. package/src/legacy/tool-ui/src/main/webapp/v4/__tests__/integration/rte/plugins/list_manager/ListManager.js +0 -257
  182. package/src/legacy/tool-ui/src/main/webapp/v4/__tests__/integration/rte/plugins/list_manager/index.html +0 -38
  183. package/src/legacy/tool-ui/src/main/webapp/v4/__tests__/integration/rte/plugins/menubar/hierarchal.html +0 -33
  184. package/src/legacy/tool-ui/src/main/webapp/v4/__tests__/integration/rte/plugins/menubar/index.html +0 -33
  185. package/src/legacy/tool-ui/src/main/webapp/v4/__tests__/integration/rte/plugins/menubar/menubar.test.js +0 -195
  186. package/src/legacy/tool-ui/src/main/webapp/v4/__tests__/integration/rte/plugins/menubar/small.html +0 -34
  187. package/src/legacy/tool-ui/src/main/webapp/v4/__tests__/integration/rte/plugins/menubar/tags.html +0 -34
  188. package/src/legacy/tool-ui/src/main/webapp/v4/__tests__/integration/rte/plugins/placeholder_manager/PlaceholderManager.test.js +0 -134
  189. package/src/legacy/tool-ui/src/main/webapp/v4/__tests__/integration/rte/plugins/placeholder_manager/has-editable-placeholder.html +0 -32
  190. package/src/legacy/tool-ui/src/main/webapp/v4/__tests__/integration/rte/plugins/placeholder_manager/has-text.html +0 -34
  191. package/src/legacy/tool-ui/src/main/webapp/v4/__tests__/integration/rte/plugins/placeholder_manager/index.html +0 -31
  192. package/src/legacy/tool-ui/src/main/webapp/v4/__tests__/integration/rte/plugins/table_manager/TableManager.test.js +0 -63
  193. package/src/legacy/tool-ui/src/main/webapp/v4/__tests__/integration/rte/plugins/table_manager/existing.html +0 -48
  194. package/src/legacy/tool-ui/src/main/webapp/v4/__tests__/integration/rte/plugins/track_manager/TrackManager.test.js +0 -291
  195. package/src/legacy/tool-ui/src/main/webapp/v4/__tests__/integration/rte/plugins/track_manager/existing.html +0 -39
  196. package/src/legacy/tool-ui/src/main/webapp/v4/__tests__/integration/rte/plugins/track_manager/insert.html +0 -37
  197. package/src/legacy/tool-ui/src/main/webapp/v4/__tests__/unit/Sortable.test.js +0 -105
  198. package/src/legacy/tool-ui/src/main/webapp/v4/__tests__/unit/rte/ProseMirror.test.js +0 -41
  199. package/src/legacy/tool-ui/src/main/webapp/v4/__tests__/unit/rte/codemirror-shim.test.js +0 -72
  200. package/src/legacy/tool-ui/src/main/webapp/v4/__tests__/unit/rte/plugins/collab_manager/CollabManager.test.js +0 -46
  201. package/src/legacy/tool-ui/src/main/webapp/v4/__tests__/unit/rte/plugins/enhancement_manager/EnhancementManager.test.js +0 -84
  202. package/src/legacy/tool-ui/src/main/webapp/v4/__tests__/unit/rte/plugins/list_manager/ListManager.test.js +0 -54
  203. package/src/legacy/tool-ui/src/main/webapp/v4/__tests__/unit/rte/plugins/menubar/menubar.test.js +0 -183
  204. package/src/legacy/tool-ui/src/main/webapp/v4/__tests__/unit/rte/plugins/spellcheck/SpellCheck.test.js +0 -45
  205. package/src/legacy/tool-ui/src/main/webapp/v4/__tests__/unit/rte/settings/BSSerializer.test.js +0 -346
  206. package/src/legacy/tool-ui/src/main/webapp/v4/__tests__/unit/rte/settings/menuItemsBuilder.test.js +0 -226
  207. package/src/legacy/tool-ui/src/main/webapp/v4/__tests__/unit/rte/utilities.test.js +0 -118
  208. package/src/legacy/tool-ui/src/main/webapp/v4/appetizeio/Appetizeio.js +0 -5
  209. package/src/legacy/tool-ui/src/main/webapp/v4/appetizeio/AppetizeioEmbedded.js +0 -113
  210. package/src/legacy/tool-ui/src/main/webapp/v4/compat/Fetch.js +0 -16
  211. package/src/legacy/tool-ui/src/main/webapp/v4/compat/jquery.js +0 -32
  212. package/src/legacy/tool-ui/src/main/webapp/v4/compat/requirejs.js +0 -13
  213. package/src/legacy/tool-ui/src/main/webapp/v4/dom/Tether.js +0 -1
  214. package/src/legacy/tool-ui/src/main/webapp/v4/dom/TetherLayout.js +0 -1
  215. package/src/legacy/tool-ui/src/main/webapp/v4/dom/closest.js +0 -1
  216. package/src/legacy/tool-ui/src/main/webapp/v4/dom/create.js +0 -1
  217. package/src/legacy/tool-ui/src/main/webapp/v4/dom/find.js +0 -1
  218. package/src/legacy/tool-ui/src/main/webapp/v4/dom/findAll.js +0 -1
  219. package/src/legacy/tool-ui/src/main/webapp/v4/dom/ifClick.js +0 -1
  220. package/src/legacy/tool-ui/src/main/webapp/v4/dom/ifMatches.js +0 -1
  221. package/src/legacy/tool-ui/src/main/webapp/v4/dom/ifUnmodified.js +0 -1
  222. package/src/legacy/tool-ui/src/main/webapp/v4/dom/index.js +0 -5
  223. package/src/legacy/tool-ui/src/main/webapp/v4/dom/insertBefore.js +0 -1
  224. package/src/legacy/tool-ui/src/main/webapp/v4/dom/insertFirst.js +0 -1
  225. package/src/legacy/tool-ui/src/main/webapp/v4/dom/insertLast.js +0 -1
  226. package/src/legacy/tool-ui/src/main/webapp/v4/dom/onFind.js +0 -1
  227. package/src/legacy/tool-ui/src/main/webapp/v4/dom/onFindOnce.js +0 -1
  228. package/src/legacy/tool-ui/src/main/webapp/v4/dom/onRTEReady.js +0 -1
  229. package/src/legacy/tool-ui/src/main/webapp/v4/dom/onRemove.js +0 -1
  230. package/src/legacy/tool-ui/src/main/webapp/v4/dom/onVisible.js +0 -1
  231. package/src/legacy/tool-ui/src/main/webapp/v4/dom/previousUntil.js +0 -1
  232. package/src/legacy/tool-ui/src/main/webapp/v4/dom/resolveIconCompat.js +0 -40
  233. package/src/legacy/tool-ui/src/main/webapp/v4/rtc/Socket.js +0 -1
  234. package/src/legacy/tool-ui/src/main/webapp/v4/rtc/index.js +0 -1
  235. package/src/legacy/tool-ui/src/main/webapp/v4/rte/ProseMirror.js +0 -909
  236. package/src/legacy/tool-ui/src/main/webapp/v4/rte/README.md +0 -68
  237. package/src/legacy/tool-ui/src/main/webapp/v4/rte/codemirror-shim.d.ts +0 -8
  238. package/src/legacy/tool-ui/src/main/webapp/v4/rte/codemirror-shim.js +0 -274
  239. package/src/legacy/tool-ui/src/main/webapp/v4/rte/collab-workflow.jpeg +0 -0
  240. package/src/legacy/tool-ui/src/main/webapp/v4/rte/interchangeable.ts +0 -250
  241. package/src/legacy/tool-ui/src/main/webapp/v4/rte/mention.js +0 -90
  242. package/src/legacy/tool-ui/src/main/webapp/v4/rte/plugins/PluginProvider.js +0 -124
  243. package/src/legacy/tool-ui/src/main/webapp/v4/rte/plugins/README.md +0 -46
  244. package/src/legacy/tool-ui/src/main/webapp/v4/rte/plugins/ai_inline_manager/AIInlineManager.ts +0 -124
  245. package/src/legacy/tool-ui/src/main/webapp/v4/rte/plugins/ai_inline_manager/views/AIInlineView.ts +0 -1019
  246. package/src/legacy/tool-ui/src/main/webapp/v4/rte/plugins/ai_manager/AiManager.ts +0 -199
  247. package/src/legacy/tool-ui/src/main/webapp/v4/rte/plugins/collab_manager/CollabManager.js +0 -339
  248. package/src/legacy/tool-ui/src/main/webapp/v4/rte/plugins/collab_manager/views/AvatarView.js +0 -96
  249. package/src/legacy/tool-ui/src/main/webapp/v4/rte/plugins/comment_manager/CommentManager.js +0 -348
  250. package/src/legacy/tool-ui/src/main/webapp/v4/rte/plugins/custom_keyboard/CustomKeyboard.js +0 -110
  251. package/src/legacy/tool-ui/src/main/webapp/v4/rte/plugins/custom_keyboard/README.md +0 -29
  252. package/src/legacy/tool-ui/src/main/webapp/v4/rte/plugins/enhancement_manager/EnhancementManager.js +0 -428
  253. package/src/legacy/tool-ui/src/main/webapp/v4/rte/plugins/enhancement_manager/README.md +0 -63
  254. package/src/legacy/tool-ui/src/main/webapp/v4/rte/plugins/enhancement_manager/commands.js +0 -690
  255. package/src/legacy/tool-ui/src/main/webapp/v4/rte/plugins/enhancement_manager/constants.js +0 -12
  256. package/src/legacy/tool-ui/src/main/webapp/v4/rte/plugins/enhancement_manager/enhancement-creation.jpeg +0 -0
  257. package/src/legacy/tool-ui/src/main/webapp/v4/rte/plugins/enhancement_manager/index.js +0 -15
  258. package/src/legacy/tool-ui/src/main/webapp/v4/rte/plugins/enhancement_manager/rte-flow.jpeg +0 -0
  259. package/src/legacy/tool-ui/src/main/webapp/v4/rte/plugins/enhancement_manager/views/ActionButtonView.js +0 -86
  260. package/src/legacy/tool-ui/src/main/webapp/v4/rte/plugins/enhancement_manager/views/BlockSubmenuView.js +0 -60
  261. package/src/legacy/tool-ui/src/main/webapp/v4/rte/plugins/enhancement_manager/views/EnhancementView.js +0 -208
  262. package/src/legacy/tool-ui/src/main/webapp/v4/rte/plugins/enhancement_manager/views/PreviewView.js +0 -102
  263. package/src/legacy/tool-ui/src/main/webapp/v4/rte/plugins/enhancement_manager/views/SubmenuView.js +0 -365
  264. package/src/legacy/tool-ui/src/main/webapp/v4/rte/plugins/find_replace_manager/FindReplaceManager.js +0 -239
  265. package/src/legacy/tool-ui/src/main/webapp/v4/rte/plugins/find_replace_manager/views/FindView.js +0 -604
  266. package/src/legacy/tool-ui/src/main/webapp/v4/rte/plugins/fullscreen_manager/FullscreenManager.js +0 -57
  267. package/src/legacy/tool-ui/src/main/webapp/v4/rte/plugins/fullscreen_manager/README.md +0 -26
  268. package/src/legacy/tool-ui/src/main/webapp/v4/rte/plugins/fullscreen_manager/commands.js +0 -16
  269. package/src/legacy/tool-ui/src/main/webapp/v4/rte/plugins/fullscreen_manager/index.js +0 -4
  270. package/src/legacy/tool-ui/src/main/webapp/v4/rte/plugins/fullscreen_manager/views/FullscreenView.js +0 -474
  271. package/src/legacy/tool-ui/src/main/webapp/v4/rte/plugins/html_editor_manager/htmlEditorManager.js +0 -66
  272. package/src/legacy/tool-ui/src/main/webapp/v4/rte/plugins/html_editor_manager/views/HtmlEditorView.js +0 -97
  273. package/src/legacy/tool-ui/src/main/webapp/v4/rte/plugins/list_manager/ListManager.js +0 -342
  274. package/src/legacy/tool-ui/src/main/webapp/v4/rte/plugins/list_manager/README.md +0 -50
  275. package/src/legacy/tool-ui/src/main/webapp/v4/rte/plugins/list_manager/commands.js +0 -207
  276. package/src/legacy/tool-ui/src/main/webapp/v4/rte/plugins/list_manager/constants.js +0 -26
  277. package/src/legacy/tool-ui/src/main/webapp/v4/rte/plugins/list_manager/index.js +0 -4
  278. package/src/legacy/tool-ui/src/main/webapp/v4/rte/plugins/menubar/Menubar.js +0 -485
  279. package/src/legacy/tool-ui/src/main/webapp/v4/rte/plugins/menubar/README.md +0 -40
  280. package/src/legacy/tool-ui/src/main/webapp/v4/rte/plugins/menubar/views/MenuView.js +0 -842
  281. package/src/legacy/tool-ui/src/main/webapp/v4/rte/plugins/paste_manager/PasteManager.js +0 -368
  282. package/src/legacy/tool-ui/src/main/webapp/v4/rte/plugins/placeholder_manager/PlaceHolderManager.js +0 -128
  283. package/src/legacy/tool-ui/src/main/webapp/v4/rte/plugins/raw_text_manager/README.md +0 -13
  284. package/src/legacy/tool-ui/src/main/webapp/v4/rte/plugins/raw_text_manager/RawTextManager.js +0 -96
  285. package/src/legacy/tool-ui/src/main/webapp/v4/rte/plugins/spellcheck/index.js +0 -3
  286. package/src/legacy/tool-ui/src/main/webapp/v4/rte/plugins/spellcheck/spellcheck-plugin.js +0 -280
  287. package/src/legacy/tool-ui/src/main/webapp/v4/rte/plugins/spellcheck/spellcheck-service.js +0 -94
  288. package/src/legacy/tool-ui/src/main/webapp/v4/rte/plugins/table_manager/TableManager.js +0 -57
  289. package/src/legacy/tool-ui/src/main/webapp/v4/rte/plugins/table_manager/commands.js +0 -97
  290. package/src/legacy/tool-ui/src/main/webapp/v4/rte/plugins/table_manager/views/TableSizerView.js +0 -88
  291. package/src/legacy/tool-ui/src/main/webapp/v4/rte/plugins/table_manager/views/TableView.js +0 -613
  292. package/src/legacy/tool-ui/src/main/webapp/v4/rte/plugins/track_manager/README.md +0 -13
  293. package/src/legacy/tool-ui/src/main/webapp/v4/rte/plugins/track_manager/TrackManager.js +0 -905
  294. package/src/legacy/tool-ui/src/main/webapp/v4/rte/settings/BSSerializer.js +0 -819
  295. package/src/legacy/tool-ui/src/main/webapp/v4/rte/settings/README.md +0 -80
  296. package/src/legacy/tool-ui/src/main/webapp/v4/rte/settings/commands.js +0 -98
  297. package/src/legacy/tool-ui/src/main/webapp/v4/rte/settings/constants.d.ts +0 -84
  298. package/src/legacy/tool-ui/src/main/webapp/v4/rte/settings/constants.js +0 -87
  299. package/src/legacy/tool-ui/src/main/webapp/v4/rte/settings/index.js +0 -13
  300. package/src/legacy/tool-ui/src/main/webapp/v4/rte/settings/keymapBuilder.js +0 -223
  301. package/src/legacy/tool-ui/src/main/webapp/v4/rte/settings/menuItemsBuilder.js +0 -559
  302. package/src/legacy/tool-ui/src/main/webapp/v4/rte/settings/schemaBuilder.js +0 -1281
  303. package/src/legacy/tool-ui/src/main/webapp/v4/rte/utilities.d.ts +0 -4
  304. package/src/legacy/tool-ui/src/main/webapp/v4/rte/utilities.js +0 -359
  305. package/src/legacy/tool-ui/src/main/webapp/v4/theme/ColorRotator.js +0 -1
  306. package/src/legacy/tool-ui/src/main/webapp/v4/util/debounce.js +0 -1
  307. package/src/legacy/tool-ui/src/main/webapp/v4/util/getComponentKey.js +0 -1
  308. package/src/legacy/tool-ui/src/main/webapp/v4/util/noise.js +0 -1
  309. package/src/legacy/tool-ui/src/main/webapp/v4/util/repaint.js +0 -1
  310. package/src/legacy/tool-ui/src/main/webapp/v4/util/storage.js +0 -1
  311. package/src/legacy/tool-ui/src/main/webapp/v4/util/throttle.js +0 -1
  312. package/src/legacy/tool-ui/src/main/webapp/v4/widget/AssignmentContent.js +0 -33
  313. package/src/legacy/tool-ui/src/main/webapp/v4/widget/AssignmentDeskDashboard.js +0 -217
  314. package/src/legacy/tool-ui/src/main/webapp/v4/widget/AssociatedContentWidget.js +0 -7
  315. package/src/legacy/tool-ui/src/main/webapp/v4/widget/BulkUpload.js +0 -19
  316. package/src/legacy/tool-ui/src/main/webapp/v4/widget/Calendar.js +0 -7
  317. package/src/legacy/tool-ui/src/main/webapp/v4/widget/ClosableWindow.js +0 -13
  318. package/src/legacy/tool-ui/src/main/webapp/v4/widget/PitchAssignments.js +0 -25
  319. package/src/legacy/tool-ui/src/main/webapp/v4/widget/PitchContent.js +0 -33
  320. package/src/legacy/tool-ui/src/main/webapp/v4/widget/Revisions.js +0 -61
@@ -1,909 +0,0 @@
1
- import {
2
- constants,
3
- buildMenuItemsFromConfig,
4
- buildKeymap,
5
- buildSchemaFromConfig,
6
- } from './settings'
7
- import { getState, replaceWholeDocumentWithNewContent } from './utilities'
8
- import { EditorView } from 'prosemirror-view'
9
- import { getLegacyHTMLTextForProsemirror } from './codemirror-shim'
10
- import { defaultBrightspotDOMSerializer } from './settings/BSSerializer'
11
- import { EnhancementView } from './plugins/enhancement_manager/views/EnhancementView'
12
- import { TableView } from './plugins/table_manager/views/TableView'
13
- import rtc from '../rtc'
14
- import {
15
- receiveTransaction,
16
- sendableSteps,
17
- getVersion,
18
- } from 'prosemirror-collab'
19
- import { Step } from 'prosemirror-transform'
20
- import { DOMParser, DOMSerializer } from 'prosemirror-model'
21
-
22
- import DOMPurify from 'dompurify'
23
- import { v1 as uuidv1 } from 'uuid'
24
-
25
- import './Mention.less'
26
- import {
27
- getAriaWordCountMessage,
28
- getWordCountLabel,
29
- } from '../../../webapp/script/v3'
30
- import { announceWithDelay } from '../../../../dom/aria'
31
-
32
- if (!window.BRIGHTSPOT?.ui.cms.enableV5UI) {
33
- await import('./Mention.less')
34
- await import('./ProseMirror.less')
35
- await import('./ProseMirrorContainer.less')
36
- } else {
37
- await import('../../../../ProseMirror.css')
38
- }
39
-
40
- /**
41
- * @class
42
- * A rich text editor class that uses [link prosemirror]{@link https://prosemirror.net/}
43
- * as the underlying framework.
44
- *
45
- * Because the prosemirror RTE is in a separate `div`,
46
- * we hide the textarea, but we keep it update as seen
47
- * later in the dispatchAction callback because when the
48
- * user submits the form, the textarea value is the source
49
- * of truth that will be saved to the data store.
50
- */
51
- class RTE {
52
- /**
53
- * @param {!Element} ctx The DOM element that represents this RTE instance
54
- * @param {!OrderedMap=} customMenuBar Allows customization or complete
55
- * replacement of the default menu bar.
56
- * @param {string} userLabel User name of the user signed in to the CMS
57
- * @param {string} userId User id of the user signed in to the CMS
58
- * @param {Array.<string>|null} richTextElementTags Rich Text Elements that are allowed in
59
- * this instance of the RTE
60
- * @param {string} fieldName The id of this field. Needed for collaboration.
61
- * @param {boolean} isCollab Indicates if collaboration is enabled for this field.
62
- * @param {number} numLines The minimum number of lines a RTE should show on
63
- * load
64
- */
65
- constructor(
66
- ctx,
67
- customMenuBar,
68
- isInline,
69
- userLabel,
70
- userId,
71
- richTextElementTags,
72
- fieldName,
73
- isCollab,
74
- compliantTagNameMap,
75
- numLines,
76
- ) {
77
- ctx.setAttribute('style', constants.STYLES.DISPLAY_NONE)
78
- this.ctx = ctx
79
- // Even though we are minimizing our use of jQuery, we still need a
80
- // jQuery object to receive jQuery-driven event notifications from
81
- // elsewhere in the app.
82
- this.$ctx = $(ctx)
83
- this.schema = buildSchemaFromConfig(
84
- customMenuBar,
85
- richTextElementTags,
86
- compliantTagNameMap,
87
- )
88
- this.pendingRequest = null
89
- this.userId = userId
90
- this.userLabel = userLabel
91
- this.compliantTagNameMap = compliantTagNameMap
92
- this.menuItems = buildMenuItemsFromConfig(
93
- customMenuBar,
94
- this.schema,
95
- isInline,
96
- userLabel,
97
- userId,
98
- richTextElementTags,
99
- )
100
-
101
- const parentElement = document.createElement('div')
102
- parentElement.className = 'ProseMirrorContainer hide'
103
- this.ctx.parentNode.appendChild(parentElement)
104
-
105
- // Set up the avatar container if this is a collaborative editor.
106
- if (isCollab) {
107
- const avatarWrapper = document.createElement('div')
108
- avatarWrapper.className = constants.CLASSES.PM_AVATAR_WRAPPER
109
- parentElement.appendChild(avatarWrapper)
110
- }
111
- this.toolbarWrapper = document.createElement('div')
112
- this.toolbarWrapper.className = 'ProseMirrorToolbar'
113
- parentElement.appendChild(this.toolbarWrapper)
114
- this.numLines = numLines
115
- this.fieldName = fieldName
116
- this.isCollab = isCollab
117
- this.loaded = false
118
- this.hasCursorState = false
119
- this.parentElement = parentElement
120
- // Word count performance optimization state
121
- this.wordCountScheduled = false
122
- this.lastDisplayText = ''
123
- this.lastMeasuredWidth = 0
124
-
125
- parentElement.addEventListener('click', (evt) => {
126
- if (evt.target.tagName === 'A' || evt.target.tagName === 'LI') {
127
- evt.target.setAttribute('data-leave-popup-open', 'true')
128
- }
129
- })
130
-
131
- parentElement.addEventListener('dragstart', (event) => {
132
- event.preventDefault()
133
- })
134
-
135
- parentElement.addEventListener('com.psddev.cms.rte.clear', () => {
136
- const { state, dispatch } = this.view
137
-
138
- replaceWholeDocumentWithNewContent(
139
- state,
140
- '',
141
- this.compliantTagNameMap,
142
- dispatch,
143
- false,
144
- true,
145
- )
146
- })
147
-
148
- if (this.isCollab) {
149
- rtc.execute('com.psddev.cms.rte.RichTextCollabUserAction', {
150
- fieldName: this.fieldName,
151
- })
152
-
153
- window.addEventListener('click', (evt) => {
154
- if (!this.view || !this.view.dom) {
155
- return
156
- }
157
- let el = evt.target
158
- let found = false
159
- while (el) {
160
- if (this.view.dom.parentNode === el) {
161
- found = true
162
- break
163
- }
164
- el = el.parentElement
165
- }
166
- if (!found) {
167
- this.createRecord()
168
- }
169
- })
170
-
171
- window.addEventListener('unload', (evt) => {
172
- this.createRecord()
173
- })
174
-
175
- PubSub.subscribe('collabLock', (incomingData) => {
176
- const { id } = incomingData
177
- this.createLockRecord(id)
178
- })
179
-
180
- PubSub.subscribe('collabUnlock', (incomingData) => {
181
- const { id } = incomingData
182
- this.removeLockRecord(id)
183
- })
184
- }
185
- }
186
-
187
- setValue = (newValue) => {
188
- const { state, dispatch } = this.view
189
-
190
- replaceWholeDocumentWithNewContent(
191
- state,
192
- newValue,
193
- this.compliantTagNameMap,
194
- dispatch,
195
- true,
196
- true,
197
- false,
198
- )
199
- }
200
-
201
- /**
202
- * Each RTE instance can have customized minimum number of lines on
203
- * page load. The min-height style property is derived by
204
- * multiplying this number by the line-height of the text. This is
205
- * done in the css, with a custom property `--ProseMirror-numLines`
206
- * used as the multiplier. Here we are setting this custom property
207
- * dynamically with the customized number passed into the RTE
208
- * at run time.
209
- */
210
- setMinHeight = () => {
211
- this.view.dom.style.setProperty('--ProseMirror-numLines', this.numLines)
212
- }
213
-
214
- /**
215
- * Hides the 'loading' div, which was created to indicate
216
- * to the user the RTE is loading. Also unhides the parent ProseMirror
217
- * container, so that the editor can fade in.
218
- */
219
- hideLoader = () => {
220
- const loader = this.view.dom.parentElement.previousSibling
221
- if (loader) {
222
- loader.classList.add('hide')
223
- loader.style.minHeight = 0
224
- }
225
- this.view.dom.parentElement.classList.remove('hide')
226
- }
227
-
228
- /**
229
- * If data-dynamic-placeholder is used on the textarea
230
- * then it triggers a `placeholderUpdate` event to let us know
231
- * when the placeholder changes (refer to state.js for more information).
232
- * This method will check to see if the field is rendering placeholder content
233
- * by looking for the constants.CLASSES.IS_PLACEHOLDER_CONTENT class.
234
- * If it is, this replaces all of the content with the new value in the placeholder
235
- * attribute. A common use case is when the user creates a new image with description
236
- * meta data and then uploads the image, which will trigger an update on the caption
237
- * field placeholder attribute.
238
- */
239
- handlePlaceholderUpdate = (data) => {
240
- const { state, dispatch, dom } = this.view
241
- const placeholder = this.ctx.getAttribute('placeholder')
242
- const value = defaultBrightspotDOMSerializer.serialize(
243
- state.doc.content,
244
- this.compliantTagNameMap,
245
- )
246
-
247
- if (
248
- data?.clearOnChange ||
249
- dom.parentElement.classList.contains(
250
- constants.CLASSES.IS_PLACEHOLDER_CONTENT,
251
- ) ||
252
- (value === '' && value !== placeholder)
253
- ) {
254
- replaceWholeDocumentWithNewContent(
255
- state,
256
- placeholder,
257
- this.compliantTagNameMap,
258
- dispatch,
259
- false,
260
- true,
261
- )
262
- } else if (value === placeholder) {
263
- this.parentElement.classList.add(constants.CLASSES.IS_PLACEHOLDER_CONTENT)
264
- }
265
- }
266
-
267
- /**
268
- * Gets the initial content for the RTE from the textarea backing the RTE.
269
- * This is used when there is no record for this field either
270
- * because this content object is new or because collab is not
271
- * enabled.
272
- */
273
- getInitialContent = () => {
274
- let content = this.ctx.value
275
- if (!content && this.ctx.hasAttribute('placeholder')) {
276
- content = this.ctx.getAttribute('placeholder')
277
- }
278
- const sanitize =
279
- this.ctx.closest('.CIG')?.dataset?.type === 'com.psddev.conversation.Post'
280
- const tmp = document.createElement('div')
281
- tmp.innerHTML = getLegacyHTMLTextForProsemirror(
282
- content,
283
- this.schema,
284
- this.compliantTagNameMap,
285
- false,
286
- sanitize,
287
- )
288
-
289
- return DOMParser.fromSchema(this.schema).parse(tmp, {
290
- preserveWhitespace: 'full',
291
- })
292
- }
293
-
294
- /**
295
- * Builds our view.
296
- *
297
- * @param {Prosemirror.Node} doc The content for the initial
298
- * view built either from the field record if one exists, or
299
- * the textarea content if no field record exists.
300
- * @param {number} version The version from which this RTE content is built,
301
- * needed for collab editing. This will come from the server if a
302
- * record exists, otherwise will be 0.
303
- * @param {Object.<number>} anchorMap A mapping of userIds to their anchors, as
304
- * provided by the backend, or an empty object if no record exists.
305
- * @param {Object.<Object.<number>>} rangeList A list of mappings of userIds to their
306
- * selected ranges, as provided by the backend, or an empty array if no record
307
- * exists.
308
- */
309
- buildView = (doc, version, anchorMap, rangeList, lockedList) => {
310
- const state = getState(
311
- doc,
312
- this.menuItems,
313
- buildKeymap,
314
- this.schema,
315
- this.userId,
316
- this.userLabel,
317
- version,
318
- anchorMap,
319
- rangeList,
320
- lockedList,
321
- this.isCollab,
322
- this.ctx,
323
- this.compliantTagNameMap,
324
- )
325
- this.view = this.getView(state)
326
- if (ENABLE_PROSE_MIRROR_SPELL_CHECK) {
327
- this.view.dom.spellcheck = false
328
- }
329
- this.setMinHeight()
330
- this.hideLoader()
331
- this.view.submenu = document.createElement('div')
332
- this.view.submenu.className = 'ProsemirrorEnhancementMenuContainer'
333
- this.view.dom.parentNode.append(this.view.submenu)
334
-
335
- // Ensuring content preview is updated.
336
- if (this.initialPayload) {
337
- const content = defaultBrightspotDOMSerializer.serialize(
338
- this.view.state.doc.content,
339
- this.compliantTagNameMap,
340
- )
341
- this.ctx.value = content
342
- const evt = document.createEvent('HTMLEvents')
343
- evt.initEvent('input', true, false)
344
- this.ctx.dispatchEvent(evt)
345
- }
346
-
347
- this.loaded = true
348
-
349
- this.ctx
350
- .getAttributeNames()
351
- .filter((name) => name.startsWith('aria-'))
352
- .forEach((name) => {
353
- this.view.dom.setAttribute(name, this.ctx.getAttribute(name))
354
- })
355
-
356
- // Copy the error message 'id' attribute to set the 'aria-describedby' attribute value.
357
- const row = this.view.dom.closest('.CIG-row')
358
- if (row) {
359
- const message = row.querySelector('.Message.is-error')
360
- if (message) {
361
- const id = message.getAttribute('id')
362
- if (id) {
363
- this.view.dom.setAttribute('aria-describedby', id)
364
- this.view.dom.setAttribute('aria-invalid', 'true')
365
- }
366
- }
367
- }
368
-
369
- if (
370
- this.ctx.hasAttribute('placeholder') &&
371
- (this.ctx.getAttribute('placeholder') === this.ctx.value ||
372
- !this.ctx.value)
373
- ) {
374
- this.parentElement.classList.add(constants.CLASSES.IS_PLACEHOLDER_CONTENT)
375
- }
376
-
377
- this.$ctx.on('placeholderUpdate', (event, data) => {
378
- this.handlePlaceholderUpdate(data)
379
- })
380
-
381
- // Some plugins anchor their widgets based on the view.dom
382
- // or its children, but the view can expand and contract based
383
- // on user interaction with the overall UI (e.g. opening/closing preview,
384
- // going to full-screen mode), so this will ensure we can know when the
385
- // editor has implicitly resized itself. So that every plugin does not
386
- // instantiate an observer, we are setting up one here with a queue of
387
- // callbacks for which plugins can register.
388
- //
389
- // Callback should be an object with a property `callback` that is your
390
- // callback function. This allows other properties to be attached
391
- // to this queued callback object (e.g. an ID for easy
392
- // removal of the callback when it is no longer needed).
393
- const ro = new ResizeObserver(() => {
394
- if (
395
- this.view &&
396
- this.view.props &&
397
- this.view.props.props &&
398
- this.view.props.props.resizeCallbacks
399
- ) {
400
- this.view.props.props.resizeCallbacks.forEach((callback) => {
401
- if (callback.callback) {
402
- callback.callback()
403
- }
404
- })
405
- }
406
- })
407
-
408
- ro.observe(this.view.dom)
409
-
410
- PubSub.publish('rteLoaded', this)
411
- }
412
-
413
- /**
414
- * We kick off RTC initalization and set up RTC create and receive
415
- * actions if collab editing is enabled. Our initialize callback kicks
416
- * off setting up the RTE. If !isCollab, we just kick off setting up
417
- * the RTE.
418
- */
419
- init() {
420
- if (this.isCollab) {
421
- rtc.initialize(
422
- 'com.psddev.cms.rte.RichTextCollabItemState',
423
- {
424
- fieldName: this.fieldName,
425
- },
426
- () => {
427
- if (this.loaded) {
428
- return
429
- }
430
- let doc
431
- let version = 0
432
- let anchorMap = {}
433
- let rangeList = []
434
- let lockedList = (this.lockedList = {})
435
-
436
- if (this.initialPayload) {
437
- // We have a record for this field, build our RTE from this data. data
438
- // comes from the server record and is handed to us in the first broadcast.
439
- // doc is a JSON representation of the current editor's content the last
440
- // time a record for this field was saved. We need to set the collab
441
- // plugin version to the version coming from the server, as this represents
442
- // what is in doc as well as all the steps that have been taken for this field.
443
- version = parseInt(this.initialPayload.version)
444
- doc = this.schema.nodeFromJSON(JSON.parse(this.initialPayload.doc))
445
- anchorMap = this.initialPayload.anchorMap
446
- rangeList = this.initialPayload.rangeList
447
- lockedList = this.initialPayload.lockedList || {}
448
- } else {
449
- // No record at this time. Content object is new or generated by CodeMirror,
450
- // Build our initial content from the textarea value and creat the new
451
- // record.
452
- doc = this.getInitialContent()
453
- this.createNewRecord(doc)
454
- }
455
- this.buildView(doc, version, anchorMap, rangeList, lockedList)
456
- this.setUpWordCount()
457
- this.handleWordCount()
458
- },
459
- )
460
-
461
- rtc.receive('com.psddev.cms.rte.RichTextCollabItemBroadcast', (data) => {
462
- const fieldName = data.fieldName
463
- if (fieldName !== this.fieldName) {
464
- return
465
- }
466
-
467
- if (!this.loaded) {
468
- // Our RTE hasn't been built yet. Get the server data and stop,
469
- // which will take us back to initialize to kick off the RTE
470
- // with this data from the field record.
471
- this.initialPayload = data
472
- return
473
- }
474
- // Has our pending request been handled by the server
475
- // yet? If so, then we shouldn't have any more pending
476
- // requests.
477
- const resolvedRequestIds = data.resolvedRequestIds
478
- // We also check to see if the record version has been reset to 0, which
479
- // happens when all clients are disconnected from the record. If a client
480
- // fires a request and then loses connection to the server, we don't
481
- // want the client to persist in a pendingRequest state.
482
- if (resolvedRequestIds[this.pendingRequest] || data.version === 0) {
483
- this.pendingRequest = null
484
- }
485
-
486
- const version = getVersion(this.view.state)
487
-
488
- if (data.wasRejected) {
489
- this.createRecord(this.view.state.tr, this.view.state)
490
- }
491
-
492
- const stepsList = data.stepsList
493
- const clientList = data.clientList
494
- const stepsSince = stepsList.slice(version)
495
- const clientsSince = clientList.slice(version)
496
-
497
- try {
498
- let tr = receiveTransaction(
499
- this.view.state,
500
- stepsSince.map((j) => Step.fromJSON(this.schema, j)),
501
- clientsSince,
502
- {
503
- mapSelectionBackward: true,
504
- },
505
- )
506
- tr.type = 'received'
507
- tr.setMeta('collabManager$', {
508
- anchorMap: data.anchorMap,
509
- rangeList: data.rangeList,
510
- lockedList: data.lockedList || {},
511
- })
512
- this.dispatchAction(tr)
513
- if (this.hasQueuedRequest) {
514
- this.hasQueuedRequest = false
515
- this.createRecord(this.view.state.tr, this.view.state)
516
- }
517
- } catch (e) {
518
- console.log(e)
519
- }
520
- })
521
- } else {
522
- const doc = this.getInitialContent()
523
- let version = 0
524
- let anchorMap = {}
525
- let rangeList = []
526
- this.buildView(doc, version, anchorMap, rangeList)
527
- this.setUpWordCount()
528
- this.handleWordCount()
529
- }
530
- }
531
-
532
- createLockRecord = (lockedId) => {
533
- rtc.execute('com.psddev.cms.rte.RichTextCollabItemAction', {
534
- fieldName: this.fieldName,
535
- type: 'lockOnly',
536
- clientId: this.userId,
537
- lockedId: lockedId,
538
- })
539
- }
540
-
541
- removeLockRecord = (lockedId) => {
542
- rtc.execute('com.psddev.cms.rte.RichTextCollabItemAction', {
543
- fieldName: this.fieldName,
544
- type: 'unlockOnly',
545
- clientId: this.userId,
546
- lockedId: lockedId,
547
- })
548
- }
549
-
550
- createNewRecord = (doc) => {
551
- this.pendingRequest = uuidv1()
552
- rtc.execute('com.psddev.cms.rte.RichTextCollabItemAction', {
553
- fieldName: this.fieldName,
554
- anchor: JSON.stringify({ [this.userId]: null }),
555
- type: 'create',
556
- rangeList: JSON.stringify([]),
557
- requestId: this.pendingRequest,
558
- doc: JSON.stringify(doc.toJSON()),
559
- })
560
- }
561
-
562
- createRecord = (transaction, state) => {
563
- // Do we have a pending request? If so, we don't want to
564
- // send another request while 1 is already in flight. We
565
- // don't want to lose that we have pending updates, though,
566
- // so we set our hasQueuedRequest to true and we will later
567
- // create another request when the one in flight resolves.
568
- if (this.pendingRequest) {
569
- this.hasQueuedRequest = true
570
- return
571
- }
572
- this.pendingRequest = uuidv1()
573
- if (!transaction || !state) {
574
- if (this.hasCursorState) {
575
- // User has stopped interacting with the RTE and clicked somewhere
576
- // else on the page or reloaded/navigated away. We need to clear
577
- // any anchor or range mappings.
578
- rtc.execute('com.psddev.cms.rte.RichTextCollabItemAction', {
579
- fieldName: this.fieldName,
580
- anchor: JSON.stringify({ [this.userId]: null }),
581
- type: 'anchorOnly',
582
- rangeList: JSON.stringify([]),
583
- requestId: this.pendingRequest,
584
- })
585
-
586
- this.hasCursorState = false
587
- }
588
-
589
- return
590
- }
591
- const sendable = sendableSteps(state)
592
- const { anchor, ranges, empty } = state.selection
593
-
594
- if (sendable) {
595
- const doc = JSON.stringify(state.doc.toJSON())
596
-
597
- rtc.execute('com.psddev.cms.rte.RichTextCollabItemAction', {
598
- fieldName: this.fieldName,
599
- stepsList: JSON.stringify(sendable.steps),
600
- doc,
601
- version: sendable.version,
602
- clientId: this.userId,
603
- anchor: JSON.stringify({ [this.userId]: anchor }),
604
- type: 'steps',
605
- rangeList: JSON.stringify([]),
606
- requestId: this.pendingRequest,
607
- })
608
- this.hasCursorState = true
609
- } else if (empty) {
610
- rtc.execute('com.psddev.cms.rte.RichTextCollabItemAction', {
611
- fieldName: this.fieldName,
612
- anchor: JSON.stringify({ [this.userId]: anchor }),
613
- type: 'anchorOnly',
614
- rangeList: JSON.stringify([]),
615
- requestId: this.pendingRequest,
616
- })
617
- this.hasCursorState = true
618
- } else {
619
- const rangeList = []
620
- ranges.forEach((range) => {
621
- const { $from, $to } = range
622
- const from = $from.pos
623
- const to = $to.pos
624
- rangeList.push({
625
- from,
626
- to,
627
- clientId: this.userId,
628
- requestId: this.pendingRequest,
629
- })
630
- })
631
-
632
- rtc.execute('com.psddev.cms.rte.RichTextCollabItemAction', {
633
- fieldName: this.fieldName,
634
- anchor: JSON.stringify({ [this.userId]: anchor }),
635
- type: 'range',
636
- rangeList: JSON.stringify(rangeList),
637
- requestId: this.pendingRequest,
638
- })
639
-
640
- this.hasCursorState = true
641
- }
642
- }
643
-
644
- /**
645
- * Sets up the word count div and spans.
646
- */
647
- setUpWordCount = () => {
648
- this.view.wordCount = document.createElement('div')
649
- const wc = this.view.wordCount
650
- wc.className = 'CIG-wordCount'
651
- wc.setAttribute('role', 'status')
652
- wc.setAttribute('aria-live', 'off')
653
- this.toolbarWrapper.appendChild(wc)
654
-
655
- // Count all sidebar icons for positioning
656
- const sidebarIcons = this.toolbarWrapper.querySelectorAll(
657
- "[data-rte-style='rte2-toolbar-find'], [data-rte-style='rte2-toolbar-fullscreen'], [data-rte-style='rte2-toolbar-ai-inline']",
658
- )
659
- const sidebarIconCount = sidebarIcons.length
660
- this.toolbarWrapper.dataset.sidebarIconCount = sidebarIconCount
661
-
662
- positionWordCount()
663
-
664
- function positionWordCount() {
665
- if (sidebarIconCount === 3) {
666
- wc.style['inset-inline-end'] =
667
- 'var(--ProseMirror-wordCountSpacingWithThreeIcons)'
668
- } else if (sidebarIconCount === 2) {
669
- wc.style['inset-inline-end'] =
670
- 'var(--ProseMirror-wordCountSpacingWithTwoIcons)'
671
- } else if (sidebarIconCount === 1) {
672
- wc.style['inset-inline-end'] =
673
- 'var(--ProseMirror-wordCountSpacingWithOneIcon)'
674
- }
675
- }
676
- }
677
-
678
- /**
679
- * Schedules a word count update. Throttled to run at most once per
680
- * animation frame to improve INP (Interaction to Next Paint) performance.
681
- */
682
- handleWordCount = () => {
683
- if (!this.view.wordCount) {
684
- return
685
- }
686
-
687
- // Throttle: skip if already scheduled for this frame
688
- if (this.wordCountScheduled) {
689
- return
690
- }
691
-
692
- this.wordCountScheduled = true
693
- requestAnimationFrame(() => {
694
- this.wordCountScheduled = false
695
- this.calculateWordCount()
696
- })
697
- }
698
-
699
- /**
700
- * Calculates the word and char count and updates the display.
701
- * Optimized to use match() instead of exec() for better performance.
702
- */
703
- calculateWordCount = () => {
704
- if (!this.view.wordCount) {
705
- return
706
- }
707
-
708
- // Which chararacters make up a word?
709
- // This must account for unicode characters to support multiple locales!
710
- // Taken from here: http://stackoverflow.com/a/22075070/101157
711
- // U+0027 = apostrophe
712
- // U+2019 = right single quote
713
- const wordRegEx =
714
- /[0-9_'-\u0027\u2019\u0041-\u005A\u0061-\u007A\u00AA\u00B5\u00BA\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u0527\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u08A0\u08A2-\u08AC\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0977\u0979-\u097F\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C33\u0C35-\u0C39\u0C3D\u0C58\u0C59\u0C60\u0C61\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D60\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F4\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191C\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19C1-\u19C7\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2183\u2184\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005\u3006\u3031-\u3035\u303B\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FCC\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA697\uA6A0-\uA6E5\uA717-\uA71F\uA722-\uA788\uA78B-\uA78E\uA790-\uA793\uA7A0-\uA7AA\uA7F8-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA80-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uABC0-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]+/g
715
-
716
- let charCount = 0
717
- let wordCount = 0
718
- const marksToExclude = new Set(['del', 'comment', 'html'])
719
-
720
- if (
721
- !this.parentElement.classList.contains('isPlaceholderContent') ||
722
- this.ctx.hasAttribute('data-editable-placeholder')
723
- ) {
724
- this.view.state.doc.descendants((node, pos) => {
725
- if (node.isText) {
726
- const marks = node.marks
727
- const hasForbiddenMark = marks.some((mark) => {
728
- return marksToExclude.has(mark.type.name)
729
- })
730
- if (!hasForbiddenMark) {
731
- charCount = charCount + node.text.length
732
- // Use match() instead of exec() loop for better performance
733
- const matches = node.text.match(wordRegEx)
734
- if (matches) {
735
- wordCount += matches.length
736
- }
737
- }
738
- }
739
- })
740
- }
741
-
742
- this.updateWordCountDisplay(wordCount, charCount)
743
- }
744
-
745
- /**
746
- * Updates the word count display, avoiding layout thrashing by
747
- * deferring layout reads to the next frame.
748
- */
749
- updateWordCountDisplay = (wordCount, charCount) => {
750
- const min = +this.ctx.dataset.suggestedMinimum
751
- const max = +this.ctx.dataset.suggestedMaximum
752
-
753
- const warningMessage =
754
- charCount < min
755
- ? this.ctx.dataset.suggestedMinimumMessage
756
- : charCount > max
757
- ? this.ctx.dataset.suggestedMaximumMessage
758
- : ''
759
-
760
- const displayText = warningMessage || `${wordCount}w ${charCount}c`
761
-
762
- // Only update if text actually changed
763
- if (displayText !== this.lastDisplayText) {
764
- this.lastDisplayText = displayText
765
-
766
- // WRITE phase - update DOM
767
- this.view.wordCount.innerText = displayText
768
- this.view.wordCount.setAttribute(
769
- 'aria-label',
770
- getWordCountLabel(wordCount, charCount, warningMessage),
771
- )
772
-
773
- // Defer READ to next frame to avoid forced reflow
774
- requestAnimationFrame(() => {
775
- const width = this.view.wordCount.clientWidth
776
-
777
- // Only update CSS var if width actually changed
778
- if (width !== this.lastMeasuredWidth) {
779
- this.lastMeasuredWidth = width
780
- this.toolbarWrapper.style.setProperty(
781
- '--ProseMirror-wordCount',
782
- `${width}px`,
783
- )
784
- }
785
- })
786
-
787
- // Defer non-critical aria announcements
788
- announceWithDelay(
789
- getAriaWordCountMessage(
790
- wordCount,
791
- charCount,
792
- min,
793
- max,
794
- this.ctx.dataset.suggestedMinimumMessage,
795
- this.ctx.dataset.suggestedMaximumMessage,
796
- ),
797
- )
798
- }
799
- }
800
-
801
- dispatchAction(transaction) {
802
- const state = this.view.state.apply(transaction)
803
- this.view.updateState(state)
804
-
805
- if (transaction.type !== 'received' && this.isCollab) {
806
- this.createRecord(transaction, state)
807
- }
808
-
809
- if (transaction.docChanged) {
810
- const content = defaultBrightspotDOMSerializer.serialize(
811
- this.view.state.doc.content,
812
- this.compliantTagNameMap,
813
- )
814
- // If the value of the content is the same as the placeholder,
815
- // we don't want to update the textarea value.
816
- if (
817
- this.ctx.getAttribute('placeholder') &&
818
- content === this.ctx.getAttribute('placeholder')
819
- ) {
820
- this.ctx.value = ''
821
- this.parentElement.classList.add(
822
- constants.CLASSES.IS_PLACEHOLDER_CONTENT,
823
- )
824
- } else {
825
- this.ctx.value = content
826
- this.parentElement.classList.remove(
827
- constants.CLASSES.IS_PLACEHOLDER_CONTENT,
828
- )
829
- }
830
- this.handleWordCount()
831
- if (!transaction.getMeta('disableNativeEvent')) {
832
- const evt = document.createEvent('HTMLEvents')
833
- evt.initEvent('input', true, false)
834
- this.ctx.dispatchEvent(evt)
835
- }
836
- }
837
- }
838
-
839
- getView(state) {
840
- const nodeViews = {}
841
- RICH_TEXT_ELEMENTS_PM.filter((obj) => {
842
- return (
843
- obj.popup &&
844
- obj.tag !== 'table' &&
845
- obj.tag !== 'tr' &&
846
- obj.tag !== 'td' &&
847
- obj.tag !== 'ul' &&
848
- obj.tag !== 'ol'
849
- )
850
- }).forEach((obj) => {
851
- nodeViews[obj.tag] = (node, view, getPos) => {
852
- return new EnhancementView(
853
- node,
854
- view,
855
- getPos,
856
- this.lockedList,
857
- this.isCollab,
858
- )
859
- }
860
- })
861
-
862
- // Override the default DOMSerializer to perform markup conversions when
863
- // cutting and pasting from ProseMirror to outside applications.
864
- const baseSerializer = DOMSerializer.fromSchema(state.config.schema)
865
- const clipboardSerializer = new DOMSerializer(
866
- Object.assign({}, baseSerializer.nodes, {
867
- line: function toDOM(node) {
868
- return ['p', node.attrs, 0]
869
- },
870
- }),
871
- baseSerializer.marks,
872
- )
873
-
874
- // Check if this should be readonly
875
- const isEditable = !this.ctx.closest('.is-readOnly')
876
-
877
- return new EditorView(this.parentElement, {
878
- state: state,
879
- editable() {
880
- return isEditable
881
- },
882
- attributes: {
883
- tabIndex: '0', // Ensures the editor is focusable even if it's readonly
884
- },
885
- dispatchTransaction: this.dispatchAction.bind(this),
886
- nodeViews: {
887
- inlineEnhancement(node, view, getPos) {
888
- return new EnhancementView(node, view, getPos)
889
- },
890
- blockEnhancement(node, view, getPos) {
891
- return new EnhancementView(node, view, getPos)
892
- },
893
- table(node, view, getPos) {
894
- return new TableView(node, view, getPos)
895
- },
896
- ...nodeViews,
897
- },
898
- clipboardSerializer: clipboardSerializer,
899
-
900
- props: {
901
- ctx: this.ctx,
902
- isFullScreen: false,
903
- resizeCallbacks: [],
904
- },
905
- })
906
- }
907
- }
908
-
909
- export { RTE }