@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,758 +0,0 @@
1
- import debounce from './util/debounce'
2
-
3
- const parseMarkerNodeData = (data) => {
4
- const spaceAt = data.indexOf(' ')
5
- const content = JSON.parse(spaceAt > -1 ? data.substring(spaceAt + 1) : data)
6
- return content
7
- }
8
-
9
- window._deferInit
10
-
11
- window.addEventListener('load', (event) => {
12
- // These are the conditions for rendering the preview overlay frame:
13
- // - The preview is loaded in an iframe; which indicates that the User has not loaded the preview in a new tab.
14
- // - The preview page contains the server-side preview data needed for rendering the overlay UI.
15
- const previewToEditParticipating =
16
- window.location !== window.parent.location && window.PREVIEW_DATA
17
-
18
- const top = window.parent ? window.parent.parent : null
19
-
20
- if (window.PREVIEW_TO_EDIT_ENABLED && !previewToEditParticipating) {
21
- console.debug(
22
- 'Although preview to edit is enabled, this preview is not participating in preview to edit.',
23
- )
24
- }
25
-
26
- // The preview data is stored as a string to speed up finding matching module id's.
27
- const previewData = window.PREVIEW_DATA
28
- const contents = []
29
- const previewContainerId = window.PREVIEW_CONTAINER_ID
30
- const contentIdMeta = document.head.querySelector(
31
- '[name="brightspot.contentId"]',
32
- )
33
- const contentId = contentIdMeta ? contentIdMeta.getAttribute('content') : null
34
-
35
- // trigger dom parsing if it was paused/deferred previously
36
- const parseDom = () => {
37
- if (window._deferInit === undefined || window._deferInit === true) {
38
- window._deferInit = false
39
- init()
40
- }
41
- }
42
-
43
- if (previewToEditParticipating) {
44
- top?.postMessage(
45
- {
46
- type: 'BSP.Preview.ContentLoad',
47
- previewContainerId,
48
- },
49
- '*',
50
- )
51
-
52
- window.addEventListener('mouseover', parseDom)
53
- }
54
-
55
- window.addEventListener('message', async ({ data }) => {
56
- if (typeof data !== 'object') return
57
-
58
- const type = data.type
59
-
60
- if (type === 'BSP.Preview.PointerEvents') {
61
- window.document.body.style.pointerEvents = data.value
62
- }
63
-
64
- if (type === 'BSP.ContentEdit.ViewportDeviceChanged') {
65
- consecutiveResizes = 0
66
- init()
67
- } else if (type === 'BSP.Preview.Init') {
68
- window._deferInit = false
69
- init()
70
- } else if (type === 'BSP.Preview.UpdateInitToggle') {
71
- window._deferInit = data.deferPreviewInit
72
- }
73
- })
74
-
75
- let consecutiveResizes = 0
76
- let maxConsecutiveResizes = 3
77
- let intervalId
78
-
79
- const getPreviewHeight = (previewFrame) => {
80
- const { height, y } = previewFrame.getBoundingClientRect()
81
- // document body height including margin
82
- const frameHeight = Math.ceil(height + y)
83
- // total content height of document including content not visible on the screen
84
- const totalContentHeight = Math.ceil(previewFrame.scrollHeight)
85
- /**
86
- * 1. When viewing preview in p2e mode, set the overlay frame height to the maximum scrollable content height
87
- * 2. When p2e is disabled/not initialized, set the overlay frame height to include the
88
- * height of visible content + margin & borders
89
- */
90
- return previewToEditParticipating
91
- ? Math.max(totalContentHeight, frameHeight)
92
- : frameHeight
93
- }
94
-
95
- const handleResize = debounce(500, (entries) => {
96
- if (consecutiveResizes >= maxConsecutiveResizes) return
97
-
98
- const entry = entries[0]
99
- const previewFrame = entry.target
100
- const previewHeight = getPreviewHeight(previewFrame)
101
- let prevHeight = previewHeight
102
-
103
- top?.postMessage(
104
- {
105
- type: 'BSP.Preview.onChangedHeight',
106
- height: previewHeight,
107
- previewContainerId,
108
- },
109
- '*',
110
- )
111
-
112
- document.body.style.height = 'initial'
113
-
114
- if (intervalId) clearInterval(intervalId)
115
-
116
- intervalId = setInterval(() => {
117
- const adjustedHeight = getPreviewHeight(previewFrame)
118
- if (adjustedHeight === prevHeight) {
119
- // if the data-defer-init flag is not explicitly set to 'false', defer parsing
120
- if (window._deferInit === false) init()
121
- clearInterval(intervalId)
122
- intervalId = null
123
- }
124
- prevHeight = adjustedHeight
125
- }, 500)
126
-
127
- consecutiveResizes++
128
- })
129
-
130
- const observer = new ResizeObserver(handleResize)
131
- observer.observe(document.body)
132
-
133
- const init = () => {
134
- if (!previewToEditParticipating) return
135
-
136
- let listOverlays = new Map()
137
- let payload = new Map()
138
- let imageData = new Map()
139
- let allOverlays = new Map()
140
- let objectBeginMap = new Map()
141
- let decodedTexts = new Map()
142
- const root = document.body
143
-
144
- const walker = document.createTreeWalker(root, NodeFilter.SHOW_COMMENT, {
145
- acceptNode: function (node) {
146
- let nextSibling = node.nextSibling
147
- const data = node.data
148
- let filterResponse = NodeFilter.FILTER_ACCEPT
149
-
150
- // If the next node is a comment reject, we want to use the last field
151
- // comment prior to the Element node.
152
- if (nextSibling) {
153
- const nextNextSibling = nextSibling.nextSibling
154
-
155
- // TODO: This isn't working correctly.
156
- if (
157
- nextSibling.nodeType === Node.COMMENT_NODE ||
158
- (nextNextSibling &&
159
- nextSibling === Node.TEXT_NODE &&
160
- nextNextSibling.nodeType === Node.COMMENT_NODE)
161
- ) {
162
- return filterResponse
163
- }
164
- }
165
-
166
- if (nextSibling && nextSibling.nodeType === Node.TEXT_NODE) {
167
- nextSibling = nextSibling.nextElementSibling
168
- }
169
-
170
- if (data.startsWith('BrightspotCmsObjectBegin') && nextSibling) {
171
- const content = parseMarkerNodeData(data)
172
-
173
- // PreviewData is the string representation of the Content edit object data.
174
- // If this marker id is found in that data and it isn't the "main"
175
- // content object (like a "Gallery" or "Article") then accept this marker.
176
- if (
177
- previewData.indexOf(content.id) !== -1 &&
178
- content.id !== contentId
179
- ) {
180
- nextSibling.dataset.brightspotField = true
181
- filterResponse = NodeFilter.FILTER_ACCEPT
182
- }
183
- } else if (
184
- data.startsWith('BrightspotCmsFieldAccess') &&
185
- nextSibling &&
186
- nextSibling.nodeType === Node.ELEMENT_NODE &&
187
- !nextSibling.closest('[data-brightspot-field]')
188
- ) {
189
- const content = parseMarkerNodeData(data)
190
-
191
- if (previewData.indexOf(content.id) !== -1) {
192
- nextSibling.dataset.brightspotField = true
193
- filterResponse = NodeFilter.FILTER_ACCEPT
194
- }
195
- }
196
-
197
- return filterResponse
198
- },
199
- })
200
-
201
- const textMatched = (element, text, contentKey, rteFlagged) => {
202
- const processText = (str) => {
203
- // replaces smart quotes if any with plain quotes
204
- // replaces multiple spaces with a single space within the string
205
- str = str.replace(/[“”]/g, '"')
206
- str = str.replace(/[‘’]/g, "'")
207
- str = str
208
- .replace(/[\r\n\t]| /g, '')
209
- .split(' ')
210
- .filter((s) => s !== '')
211
- .join(' ')
212
- return str
213
- }
214
-
215
- const normalize = (text, override = false) => {
216
- const decodedText = decodedTexts.get(contentKey)
217
- if (decodedText && !override) return decodedText
218
- // Removes surrounding whitespace.
219
- text = text.trim()
220
- // Create a temporary div element to decode any html entities
221
- // and remove any html tags
222
- const tmpl = document.createElement('div')
223
- tmpl.innerHTML = text
224
- const normalizedText = processText(tmpl.textContent)
225
- decodedTexts.set(contentKey, normalizedText)
226
- return normalizedText
227
- }
228
-
229
- const hasEnhancements = (element) => {
230
- return (
231
- element.querySelector('[data-state], [class*="Enhancement"]') !== null
232
- )
233
- }
234
-
235
- const removeEnhancements = (element) => {
236
- // Enhancements shown in the theme may not be formatted the same way
237
- // as the enhancement state data suggests.
238
- // So we remove them from the element before string matching.
239
- const enhancements = element.querySelectorAll(
240
- '[data-state], [class*="Enhancement"]',
241
- )
242
- enhancements.forEach((enhancement) => {
243
- const space = document.createTextNode(' ')
244
- enhancement.parentElement?.insertBefore(space, enhancement)
245
- enhancement.parentElement?.removeChild(enhancement)
246
- })
247
- }
248
-
249
- let elementText
250
-
251
- // If marker suggests the element is rich text, we need to
252
- // remove enhancements before comparing text.
253
- if (rteFlagged && hasEnhancements(element)) {
254
- const textWrapper = document.createElement('div')
255
- textWrapper.innerHTML = text
256
- removeEnhancements(textWrapper)
257
- text = normalize(textWrapper.textContent, true)
258
-
259
- const tmp = element.cloneNode(true)
260
- removeEnhancements(tmp)
261
- elementText = processText(tmp.textContent)
262
- } else {
263
- elementText = processText(element.textContent)
264
- text = normalize(text)
265
- }
266
-
267
- if (elementText === text) {
268
- return true
269
- }
270
- return false
271
- }
272
-
273
- let nextCascadingElement = null
274
-
275
- while (walker.nextNode()) {
276
- const node = walker.currentNode
277
- const data = node.data
278
-
279
- if (
280
- data.startsWith('BrightspotCmsObjectBegin') ||
281
- data.startsWith('BrightspotCmsFieldAccess')
282
- ) {
283
- let content = parseMarkerNodeData(data)
284
-
285
- /* ignore cascading page layout preview markers and the preview elements for now */
286
- const layoutKeys = [
287
- 'cascadingPage.above',
288
- 'cascadingPage.below',
289
- 'cascadingPage.aside',
290
- 'cascadingPage.footer',
291
- ]
292
-
293
- if (content.isEmpty === 'false' && layoutKeys.includes(content.name)) {
294
- nextCascadingElement = node.nextElementSibling
295
- continue
296
- }
297
-
298
- if (data.startsWith('BrightspotCmsObjectBegin')) {
299
- content.type = 'bspModule'
300
- } else if (data.startsWith('BrightspotCmsFieldAccess')) {
301
- content.type = 'bspField'
302
- }
303
-
304
- // Try to associate the node with rich text.
305
- if (
306
- (node.element && node.element.classList.contains('.RichTextBody')) ||
307
- node.parentElement?.closest('.RichTextBody') ||
308
- (node.element &&
309
- node.element.classList.contains('[class*="Enhancement"]')) ||
310
- node.parentElement?.closest('.RichTextBody, [class*="Enhancement"]')
311
- ) {
312
- content.referencesRichText = true
313
- }
314
-
315
- let element =
316
- content.isEmpty !== 'true' ? node.nextElementSibling : null
317
-
318
- // Skip if element is the nextCascadingElement or its descendant
319
- if (
320
- nextCascadingElement &&
321
- (element === nextCascadingElement ||
322
- nextCascadingElement.contains(element))
323
- ) {
324
- continue
325
- }
326
-
327
- let prevElement = node.previousElementSibling || node.parentNode
328
- let textMatchFound = false
329
- const maxAttempts = 10
330
- if (element && content.text) {
331
- const contentKey = content.id + '/' + content.name
332
- const isRTE = content.isRTE === 'true'
333
- const exists = allOverlays.get(contentKey)
334
- if (exists && exists.textMatched) continue
335
- if (textMatched(element, content.text, contentKey, isRTE)) {
336
- textMatchFound = true
337
- } else {
338
- let attempts = 1
339
- for (const child of element.querySelectorAll(
340
- ':scope *:not(script):not(style):not(iframe)',
341
- )) {
342
- if (textMatched(child, content.text, contentKey, isRTE)) {
343
- textMatchFound = true
344
- element = child
345
- break
346
- } else if (attempts === maxAttempts) {
347
- attempts = 1
348
- console.debug(
349
- `Preview: looking for text match... Giving up after ${maxAttempts} attempts.`,
350
- )
351
- break
352
- }
353
- attempts++
354
- }
355
- }
356
- }
357
-
358
- // A non-empty comment marker which is associated to a text field
359
- // could be the only child. In that case use its parent element
360
- // for the preview element reference.
361
- /* eg:
362
- <div class="parent">
363
- <!--BrightspotCmsFieldAccess {"internalType":"text","displayName":"foo","isEmpty":"false","text":"Some text or nothing at all." ... }-->
364
- "Some text or nothing at all."
365
- </div>
366
- */
367
- if (
368
- !textMatchFound &&
369
- content.type === 'bspField' &&
370
- content.internalType === 'text' &&
371
- content.isEmpty !== 'true'
372
- ) {
373
- const elmToIgnore = element
374
- element = node.parentElement
375
- const isRTE = content.isRTE === 'true'
376
- if (element) {
377
- element.dataset.brightspotParentAssociated = true
378
- if (
379
- textMatched(
380
- element,
381
- content.text,
382
- content.id + '/' + content.name,
383
- isRTE,
384
- )
385
- ) {
386
- textMatchFound = true
387
- } else {
388
- let attempts = 1
389
- // Compare text of parent's immediate children.
390
- // When the correct preview element is not the first immediate child.
391
- for (const child of element.querySelectorAll(
392
- ':scope > *:not(script):not(style):not(iframe)',
393
- )) {
394
- if (
395
- !child.isEqualNode(elmToIgnore) &&
396
- textMatched(
397
- child,
398
- content.text,
399
- content.id + '/' + content.name,
400
- isRTE,
401
- )
402
- ) {
403
- textMatchFound = true
404
- element = child
405
- break
406
- } else if (attempts === maxAttempts) {
407
- attempts = 1
408
- console.debug(
409
- `Preview: looking for text match... Giving up after ${maxAttempts} attempts.`,
410
- )
411
- break
412
- }
413
- attempts++
414
- }
415
- }
416
- }
417
- }
418
-
419
- // Finally, no matches were found so we fallback to the
420
- // closest sibling to the marker.
421
- if (
422
- !textMatchFound &&
423
- node.nextElementSibling &&
424
- node.nextElementSibling.tagName !== 'BR'
425
- ) {
426
- element = node.nextElementSibling
427
- }
428
-
429
- let prevSibling
430
-
431
- if (content.isEmpty === 'true') {
432
- while (!prevSibling || prevElement !== document.documentElement) {
433
- prevSibling = prevElement.previousElementSibling
434
- if (prevSibling) break
435
- prevElement = prevElement.parentNode
436
- }
437
- }
438
-
439
- content.textMatched = textMatchFound
440
-
441
- let exists = allOverlays.get(
442
- content.id + '/' + content.name || content.typeLabel,
443
- )
444
-
445
- const name = content.name || content.typeLabel
446
-
447
- if (exists && exists.textMatched) {
448
- content = Object.assign({}, content, {
449
- parentNode: exists.parentNode,
450
- previewElement: exists.previewElement,
451
- textMatched: exists.textMatched,
452
- })
453
- } else if (exists && !exists.textMatched && textMatchFound) {
454
- content = Object.assign({}, exists, content, {
455
- parentNode: prevElement,
456
- previewElement: element,
457
- })
458
- }
459
-
460
- if (!exists) {
461
- contents.push(content)
462
- }
463
-
464
- // build overlays map
465
- let overlayId = content.id + '/' + name
466
- let overlay = null
467
- let numOfElements = 0
468
-
469
- // Markers which are unsupported:
470
- if (
471
- content.internalType === 'number' ||
472
- content.internalType === 'boolean' ||
473
- (content.type === 'bspField' && content.internalType === undefined)
474
- ) {
475
- continue
476
- }
477
-
478
- // Skip to the next node if no preview element exists.
479
- // or if the field is not in default 'Main' tab or is hidden
480
- // or it has dimensions but is inside a hidden ancestor element
481
- let parentNode = element?.parentNode
482
- parentNode = parentNode && parentNode !== root ? parentNode : element
483
- if (
484
- !element ||
485
- !parentNode.offsetParent ||
486
- content.isFieldHidden === 'true'
487
- ) {
488
- continue
489
- }
490
-
491
- if (content.type === 'bspModule') {
492
- if (allOverlays.has(overlayId)) {
493
- overlay = allOverlays.get(overlayId)
494
- if (overlay.previewElements.indexOf(element) === -1) {
495
- overlay.previewElements.push(element)
496
- overlay.dimensions.push(element?.getBoundingClientRect())
497
- }
498
- numOfElements = overlay.previewElements.length
499
- } else {
500
- const previewElements = []
501
- previewElements.push(element)
502
- const dimensions = []
503
- dimensions.push(element?.getBoundingClientRect())
504
- allOverlays.set(overlayId, {
505
- id: content.id,
506
- name: name,
507
- previewElements: previewElements,
508
- fieldValue: content.fieldValue ? content.fieldValue : null,
509
- type: content.type,
510
- internalType: content.internalType,
511
- isEmpty: content.isEmpty,
512
- label: content.displayName,
513
- parentNode: prevElement?.getBoundingClientRect(),
514
- textMatched: content.textMatched,
515
- dimensions: dimensions,
516
- referencesRichText: content.referencesRichText,
517
- })
518
- numOfElements = 1
519
- }
520
- const objectBegin = allOverlays.get(overlayId)
521
- objectBeginMap.set(overlayId, objectBegin)
522
- } else {
523
- // Is not a bspModule.
524
- if (
525
- !exists ||
526
- (exists && !exists.textMatched && textMatchFound) ||
527
- (exists && !content.text)
528
- ) {
529
- // Skip <source> elements so that <img> elements can be processed correctly.
530
- if (exists && element.tagName === 'SOURCE') {
531
- continue
532
- }
533
-
534
- allOverlays.set(overlayId, {
535
- id: content.id,
536
- name: name,
537
- previewElement: element,
538
- children: content.children
539
- ? content.children.split(',').map((item) => item.trim())
540
- : null,
541
- fieldValue: content.fieldValue ? content.fieldValue : null,
542
- listType: content.children ? true : false,
543
- type: content.type,
544
- internalType: content.internalType,
545
- isEmpty: content.isEmpty,
546
- label: content.displayName,
547
- textMatched: content.textMatched,
548
- parentNode: prevElement?.getBoundingClientRect(),
549
- dimensions: element?.getBoundingClientRect(),
550
- referencesRichText: content.referencesRichText,
551
- })
552
- } else if (
553
- content.internalType === 'text' &&
554
- content.referencesRichText
555
- ) {
556
- // Handles richtext fields which, for whatever reason,
557
- // don't result in a text match.
558
- allOverlays.set(overlayId, {
559
- id: content.id,
560
- name: name,
561
- previewElement: element,
562
- children: content.children
563
- ? content.children.split(',').map((item) => item.trim())
564
- : null,
565
- fieldValue: content.fieldValue ? content.fieldValue : null,
566
- listType: content.children ? true : false,
567
- type: content.type,
568
- internalType: content.internalType,
569
- isEmpty: content.isEmpty,
570
- label: content.displayName,
571
- textMatched: content.textMatched,
572
- parentNode: prevElement?.getBoundingClientRect(),
573
- dimensions: element?.getBoundingClientRect(),
574
- referencesRichText: content.referencesRichText,
575
- })
576
- }
577
- }
578
-
579
- // Try to find the image element nearby.
580
- let img =
581
- element.nodeName !== 'IMG'
582
- ? element.querySelector(':scope > img, :scope > picture > img')
583
- : element
584
-
585
- if (img) {
586
- const prevSib = img.previousSibling
587
- if (
588
- prevSib?.nodeName === '#comment' &&
589
- prevSib?.nodeValue.startsWith('BrightspotThemeData')
590
- ) {
591
- const {
592
- image: { name, height, width },
593
- } = parseMarkerNodeData(prevSib.data)
594
- imageData.set(JSON.stringify(img.getBoundingClientRect()), {
595
- name,
596
- height,
597
- width,
598
- rect: img.getBoundingClientRect(),
599
- })
600
- }
601
- }
602
-
603
- if (content.children) {
604
- listOverlays.set(overlayId, allOverlays.get(overlayId))
605
- }
606
- const overlayDimensions = allOverlays.get(overlayId).dimensions
607
-
608
- payload.set(overlayId, {
609
- id: content.id,
610
- children: content.children
611
- ? content.children.split(',').map((item) => item.trim())
612
- : null,
613
- type: content.type,
614
- name: name,
615
- label: content.displayName,
616
- internalType: content.internalType,
617
- hasElement:
618
- (content.type === 'bspField' || content.type === 'bspModule') &&
619
- element
620
- ? true
621
- : false,
622
- fieldValue: content.fieldValue ? content.fieldValue : null,
623
- isEmpty: content.isEmpty === 'true',
624
- dimensions: overlayDimensions,
625
- parentNode: prevSibling?.getBoundingClientRect(),
626
- listType: content.children ? true : false,
627
- textMatched: content.textMatched,
628
- referencesRichText: content.referencesRichText,
629
- })
630
-
631
- if (content.type === 'bspModule') {
632
- payload.numOfElements = numOfElements
633
- }
634
- }
635
- }
636
-
637
- listOverlays.forEach((overlay, key) => {
638
- const children = overlay.children
639
- let childElms = []
640
- children.forEach((child) => {
641
- const childOverlay = allOverlays.get(child)
642
- if (childOverlay) {
643
- if (childOverlay.previewElements) {
644
- childElms.push.apply(childElms, childOverlay.previewElements)
645
- } else if (childOverlay.previewElement) {
646
- childElms.push(childOverlay.previewElement)
647
- }
648
- }
649
- })
650
- if (children.length === childElms.length) {
651
- let parent = childElms[0]
652
- childElms.shift()
653
- if (childElms.length) {
654
- let common = false
655
- while (!common) {
656
- const node = parent
657
- let num = 0
658
- childElms.forEach((childElm) => {
659
- if (parent.contains(childElm)) {
660
- num = num + 1
661
- }
662
- })
663
- if (num === childElms.length) {
664
- common = true
665
- } else {
666
- parent = node.parentNode
667
- }
668
- }
669
- }
670
- if (parent) {
671
- const existing = payload.get(key)
672
- existing.dimensions = parent?.getBoundingClientRect()
673
- overlay.previewElement = parent
674
- }
675
- }
676
- })
677
-
678
- const sortPreviewElements = (elements) => {
679
- const compareDepth = (a, b) => {
680
- return a.dataset.depth - b.dataset.depth
681
- }
682
- elements.forEach((elm) => {
683
- let depth = 1
684
- let parent = elm.parentNode
685
- while (parent !== root) {
686
- depth = depth + 1
687
- parent = parent.parentNode
688
- // To ensure efficiency, only check up to a max depth of 30 nodes
689
- if (depth > 30) {
690
- break
691
- }
692
- }
693
- elm.dataset.depth = depth
694
- })
695
- elements.sort(compareDepth)
696
- }
697
-
698
- objectBeginMap.forEach((overlay, key) => {
699
- let prev = null
700
- let res = overlay
701
- let resMatches = []
702
- let payloadOverlay
703
- let noMatches = false
704
- let matches
705
- resMatches.push(overlay)
706
- while (!noMatches) {
707
- prev = res
708
- matches = []
709
- const resMatch = resMatches.map((match) => {
710
- return match.id
711
- })
712
-
713
- allOverlays.forEach((ovr) => {
714
- if (
715
- resMatch.includes(ovr.fieldValue?.split('/')[0]) &&
716
- !resMatch.includes(ovr.id) &&
717
- !ovr.visited
718
- ) {
719
- matches.push(ovr)
720
- ovr.visited = true
721
- }
722
- })
723
- if (matches.length) {
724
- noMatches = false
725
- resMatches = matches
726
- } else {
727
- noMatches = true
728
- }
729
- }
730
-
731
- if (overlay.previewElements.length > 1) {
732
- sortPreviewElements(overlay.previewElements)
733
- }
734
- resMatches.forEach((res, index) => {
735
- if (res !== overlay) {
736
- res.linked = key
737
- res.previewElement = overlay.previewElements[index]
738
- const ovrKey = res.id + '/' + res.name
739
- payloadOverlay = payload.get(ovrKey)
740
- payloadOverlay.linked = key
741
- payloadOverlay.linkedIdx = index
742
- payloadOverlay.dimensions =
743
- res.previewElement?.getBoundingClientRect()
744
- }
745
- })
746
- })
747
-
748
- top?.postMessage(
749
- {
750
- type: 'BSP.Preview.DOMParsed',
751
- overlays: payload,
752
- previewContainerId,
753
- imageData,
754
- },
755
- '*',
756
- )
757
- }
758
- })