@brightspot/ui 3.0.1-cms-ui-migration.2 → 3.0.1-cms-ui-migration.3
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.
- package/README.md +54 -35
- package/dist/custom-elements.json +1924 -1924
- package/dist/storybook/assets/{ActionBar.stories-hJ_5cm-P.js → ActionBar.stories-CSxtZl7v.js} +1 -1
- package/dist/storybook/assets/{ActionItem.stories-Bjx2803w.js → ActionItem.stories-BWcMRMP3.js} +1 -1
- package/dist/storybook/assets/{Avatar.stories-Cj0YgZ6f.js → Avatar.stories-CYTUGXzH.js} +1 -1
- package/dist/storybook/assets/{AvatarGroup.stories-Lh_sQFCU.js → AvatarGroup.stories-CSYBYo_5.js} +1 -1
- package/dist/storybook/assets/{Badge.stories-BL7RUibx.js → Badge.stories-LuF4BuVr.js} +1 -1
- package/dist/storybook/assets/{Button-BPHNcxqK.js → Button-CrXCMxHb.js} +1 -1
- package/dist/storybook/assets/{Button.stories-CAYO4gdU.js → Button.stories-JVwxdrdM.js} +1 -1
- package/dist/storybook/assets/{ButtonGroup.stories-Cd13Us5K.js → ButtonGroup.stories-qtq64a1H.js} +1 -1
- package/dist/storybook/assets/{Celebrate.stories-D_KE3Qze.js → Celebrate.stories-DjTtaSd6.js} +1 -1
- package/dist/storybook/assets/{Checkbox.stories-Aj1xgZVn.js → Checkbox.stories-v1Pr5mL6.js} +1 -1
- package/dist/storybook/assets/{CircularProgress.stories-BecV_v6d.js → CircularProgress.stories-DkV7PJ4D.js} +1 -1
- package/dist/storybook/assets/{ClipboardMixin.stories-DU-WiZ2f.js → ClipboardMixin.stories-Dh5c7uSM.js} +1 -1
- package/dist/storybook/assets/{Color-6BZIO3FS-BYl4KZZn.js → Color-6BZIO3FS-B1gcREt6.js} +1 -1
- package/dist/storybook/assets/{Colors.stories-BMUVUy2q.js → Colors.stories-DnubtRqn.js} +1 -1
- package/dist/storybook/assets/{CombinedEffects.stories-FHcPKFm6.js → CombinedEffects.stories-By6akSve.js} +1 -1
- package/dist/storybook/assets/{ComponentStatesMixin-EMUnfT5y.js → ComponentStatesMixin-CPLGv3h-.js} +1 -1
- package/dist/storybook/assets/{ComponentStatesMixin.stories-SXq0kzS9.js → ComponentStatesMixin.stories-CiQ_lyhm.js} +1 -1
- package/dist/storybook/assets/{CopyToClipboard.stories-u43lhvcI.js → CopyToClipboard.stories-cJ7rl3mj.js} +1 -1
- package/dist/storybook/assets/{Debounce.stories-BdCn5qgO.js → Debounce.stories-Bw-goobU.js} +1 -1
- package/dist/storybook/assets/{DocsRenderer-LL677BLK-DxiEJ_jx.js → DocsRenderer-LL677BLK-CNW57dGQ.js} +3 -3
- package/dist/storybook/assets/{Dropdown.stories-BWSRwjIF.js → Dropdown.stories-CwC3HXXd.js} +1 -1
- package/dist/storybook/assets/{EmptyState.stories-BpobeZL5.js → EmptyState.stories-BUEJwuhP.js} +1 -1
- package/dist/storybook/assets/{Events.stories-CP5kMzpr.js → Events.stories-D1mf9buv.js} +1 -1
- package/dist/storybook/assets/{Heading.stories-CbJD-oTB.js → Heading.stories-DO906G4P.js} +1 -1
- package/dist/storybook/assets/{HueRipple.stories-BOABJ7zw.js → HueRipple.stories-BOySRSZB.js} +1 -1
- package/dist/storybook/assets/{Icon.stories-CWlUHL4j.js → Icon.stories-BsqgTbdG.js} +1 -1
- package/dist/storybook/assets/{IconButton.stories-BWBs-OLT.js → IconButton.stories-aza1AAKk.js} +1 -1
- package/dist/storybook/assets/{LinearProgress.stories-LZ0GZoxF.js → LinearProgress.stories-CDYmiiex.js} +1 -1
- package/dist/storybook/assets/{Pagination.stories-CbLaR3P9.js → Pagination.stories-LXB-x7YB.js} +1 -1
- package/dist/storybook/assets/{Popover.stories-JHrWqYZw.js → Popover.stories-DY1HesPJ.js} +1 -1
- package/dist/storybook/assets/{ReadyMixin-B1H2a9x8.js → ReadyMixin-DmOC67IJ.js} +1 -1
- package/dist/storybook/assets/{RovingTabindexMixin.stories-UMHpYG73.js → RovingTabindexMixin.stories-BWy0Rq8d.js} +1 -1
- package/dist/storybook/assets/{Rtc.stories-VQtNSlls.js → Rtc.stories-DrmdqqbI.js} +1 -1
- package/dist/storybook/assets/{ScrollShadow.stories-CYdi8Tgp.js → ScrollShadow.stories-DiKFPazh.js} +1 -1
- package/dist/storybook/assets/{Switch.stories-D8F2hZCf.js → Switch.stories-BgFnw8_z.js} +1 -1
- package/dist/storybook/assets/{Tab.stories-wgBP0lTj.js → Tab.stories-c2wLMooF.js} +1 -1
- package/dist/storybook/assets/{Tabs.stories-C00rr5sf.js → Tabs.stories-CjH8seNP.js} +1 -1
- package/dist/storybook/assets/{Throttle.stories-BhQEfJbS.js → Throttle.stories-CXysc_QE.js} +1 -1
- package/dist/storybook/assets/{Tooltip.stories-CGoZ5qTn.js → Tooltip.stories-6qzyByPm.js} +1 -1
- package/dist/storybook/assets/{Upload.stories-B3K-HAXw.js → Upload.stories-BLxykydQ.js} +1 -1
- package/dist/storybook/assets/{UploadItem.stories-71ArSoUh.js → UploadItem.stories-CcfcqdJW.js} +1 -1
- package/dist/storybook/assets/{Welcome.stories-CihlfFXS.js → Welcome.stories-CzYS_3fH.js} +1 -1
- package/dist/storybook/assets/{Widget.stories-1u4KbiJM.js → Widget.stories-Du7T4LAI.js} +1 -1
- package/dist/storybook/assets/{WithTooltip-65CFNBJE-B3Jitxw9.js → WithTooltip-65CFNBJE-D4LfXdYt.js} +1 -1
- package/dist/storybook/assets/{blocks-C1HaXuQB.js → blocks-DR3fGePu.js} +5 -5
- package/dist/storybook/assets/{formatter-EIJCOSYU-Dy9Lt9fs.js → formatter-EIJCOSYU-Cf01216O.js} +1 -1
- package/dist/storybook/assets/if-defined-DaMmbcIU.js +1 -0
- package/dist/storybook/assets/{iframe-Dx6IxWXF.js → iframe-CQArUhO8.js} +4 -4
- package/dist/storybook/assets/{index-OrjedSVh.js → index-B1uI_67G.js} +1 -1
- package/dist/storybook/assets/{onFind-YTqjw6W0.js → onFind-BpFkN2Rh.js} +1 -1
- package/dist/storybook/assets/{onFind.stories-DEvwTrmx.js → onFind.stories-Cxdeg69X.js} +1 -1
- package/dist/storybook/assets/{onRemove.stories-D5mO-Lin.js → onRemove.stories-BHEWpNrE.js} +1 -1
- package/dist/storybook/assets/{onVisible.stories-C3Rcz0Eb.js → onVisible.stories-DFJ3S_ZS.js} +1 -1
- package/dist/storybook/assets/{style-map-CiMHry7H.js → style-map-DJ83UC3V.js} +1 -1
- package/dist/storybook/assets/{syntaxhighlighter-ED5Y7EFY-DIZnuhb2.js → syntaxhighlighter-ED5Y7EFY-zYN83mxK.js} +1 -1
- package/dist/storybook/iframe.html +1 -1
- package/dist/storybook/project.json +1 -1
- package/package.json +16 -2
- package/dist/storybook/assets/if-defined-CA2KmTqA.js +0 -1
- package/src/legacy/tool-ui/src/main/resources/settings.properties +0 -1
- package/src/legacy/tool-ui/src/main/webapp/WEB-INF/web.xml +0 -81
- package/src/legacy/tool-ui/src/main/webapp/script/bsp-uploader.js +0 -170
- package/src/legacy/tool-ui/src/main/webapp/script/bsp-utils.js +0 -393
- package/src/legacy/tool-ui/src/main/webapp/script/content/layout-element.js +0 -141
- package/src/legacy/tool-ui/src/main/webapp/script/input/query.js +0 -78
- package/src/legacy/tool-ui/src/main/webapp/script/input/workflow.js +0 -718
- package/src/legacy/tool-ui/src/main/webapp/script/jquery.extra.js +0 -633
- package/src/legacy/tool-ui/src/main/webapp/script/v3/Dropbox.js +0 -18
- package/src/legacy/tool-ui/src/main/webapp/script/v3/EditFieldUpdate.js +0 -406
- package/src/legacy/tool-ui/src/main/webapp/script/v3/EditFieldUpdateCache.js +0 -1
- package/src/legacy/tool-ui/src/main/webapp/script/v3/Notification.js +0 -151
- package/src/legacy/tool-ui/src/main/webapp/script/v3/content/edit.js +0 -194
- package/src/legacy/tool-ui/src/main/webapp/script/v3/content/state.js +0 -785
- package/src/legacy/tool-ui/src/main/webapp/script/v3/csrf.js +0 -35
- package/src/legacy/tool-ui/src/main/webapp/script/v3/dashboard.js +0 -65
- package/src/legacy/tool-ui/src/main/webapp/script/v3/input/dataTransfer.js +0 -129
- package/src/legacy/tool-ui/src/main/webapp/script/v3/input/file.js +0 -433
- package/src/legacy/tool-ui/src/main/webapp/script/v3/input/object.js +0 -743
- package/src/legacy/tool-ui/src/main/webapp/script/v3/input/read-only.js +0 -17
- package/src/legacy/tool-ui/src/main/webapp/script/v3/jquery.frame.js +0 -478
- package/src/legacy/tool-ui/src/main/webapp/script/v3/jquery.repeatable.js +0 -2406
- package/src/legacy/tool-ui/src/main/webapp/script/v3/plugin/popup.d.ts +0 -2
- package/src/legacy/tool-ui/src/main/webapp/script/v3/plugin/popup.js +0 -446
- package/src/legacy/tool-ui/src/main/webapp/script/v3/search-filters.js +0 -62
- package/src/legacy/tool-ui/src/main/webapp/script/v3/search.js +0 -53
- package/src/legacy/tool-ui/src/main/webapp/script/v3.js +0 -1049
- package/src/legacy/tool-ui/src/main/webapp/v4/Admin.js +0 -16
- package/src/legacy/tool-ui/src/main/webapp/v4/AutoExpand.js +0 -84
- package/src/legacy/tool-ui/src/main/webapp/v4/AutoSubmit.js +0 -68
- package/src/legacy/tool-ui/src/main/webapp/v4/Bridge.js +0 -536
- package/src/legacy/tool-ui/src/main/webapp/v4/CheckboxInput.js +0 -22
- package/src/legacy/tool-ui/src/main/webapp/v4/ColorInput.js +0 -5
- package/src/legacy/tool-ui/src/main/webapp/v4/ColorInputSpectrum.js +0 -107
- package/src/legacy/tool-ui/src/main/webapp/v4/ComboInput.js +0 -1491
- package/src/legacy/tool-ui/src/main/webapp/v4/CommunityWidget.js +0 -29
- package/src/legacy/tool-ui/src/main/webapp/v4/ContentEdit.js +0 -2427
- package/src/legacy/tool-ui/src/main/webapp/v4/ContentLock.js +0 -470
- package/src/legacy/tool-ui/src/main/webapp/v4/ContentReporting.js +0 -32
- package/src/legacy/tool-ui/src/main/webapp/v4/DataTable.js +0 -31
- package/src/legacy/tool-ui/src/main/webapp/v4/DateStringField.js +0 -485
- package/src/legacy/tool-ui/src/main/webapp/v4/Entry.js +0 -264
- package/src/legacy/tool-ui/src/main/webapp/v4/ExternalItemAuth.js +0 -16
- package/src/legacy/tool-ui/src/main/webapp/v4/Form.js +0 -31
- package/src/legacy/tool-ui/src/main/webapp/v4/Hierarchy.js +0 -100
- package/src/legacy/tool-ui/src/main/webapp/v4/Icon.ts +0 -49
- package/src/legacy/tool-ui/src/main/webapp/v4/ImageEditor.js +0 -2403
- package/src/legacy/tool-ui/src/main/webapp/v4/ImageEditorBundle.js +0 -5
- package/src/legacy/tool-ui/src/main/webapp/v4/LinkCarousel.js +0 -40
- package/src/legacy/tool-ui/src/main/webapp/v4/LinkList.js +0 -14
- package/src/legacy/tool-ui/src/main/webapp/v4/LinkTable.js +0 -123
- package/src/legacy/tool-ui/src/main/webapp/v4/Location.js +0 -19
- package/src/legacy/tool-ui/src/main/webapp/v4/LocationMap.js +0 -148
- package/src/legacy/tool-ui/src/main/webapp/v4/LookingGlass.js +0 -24
- package/src/legacy/tool-ui/src/main/webapp/v4/Message.js +0 -14
- package/src/legacy/tool-ui/src/main/webapp/v4/NumberBar.js +0 -32
- package/src/legacy/tool-ui/src/main/webapp/v4/Page.js +0 -890
- package/src/legacy/tool-ui/src/main/webapp/v4/Preview.js +0 -758
- package/src/legacy/tool-ui/src/main/webapp/v4/PreviewEditor.js +0 -86
- package/src/legacy/tool-ui/src/main/webapp/v4/PreviewOverlay.js +0 -1005
- package/src/legacy/tool-ui/src/main/webapp/v4/PubSub.js +0 -47
- package/src/legacy/tool-ui/src/main/webapp/v4/QueryField.js +0 -211
- package/src/legacy/tool-ui/src/main/webapp/v4/RegionMap.js +0 -215
- package/src/legacy/tool-ui/src/main/webapp/v4/RepeatableContentInputGroup.js +0 -160
- package/src/legacy/tool-ui/src/main/webapp/v4/RichTextEditor.js +0 -154
- package/src/legacy/tool-ui/src/main/webapp/v4/SearchFields.js +0 -281
- package/src/legacy/tool-ui/src/main/webapp/v4/SearchResult.js +0 -255
- package/src/legacy/tool-ui/src/main/webapp/v4/SharePreview.js +0 -56
- package/src/legacy/tool-ui/src/main/webapp/v4/Sortable.js +0 -874
- package/src/legacy/tool-ui/src/main/webapp/v4/StyleEmbeddedContent.js +0 -100
- package/src/legacy/tool-ui/src/main/webapp/v4/StyleguidePresets.js +0 -357
- package/src/legacy/tool-ui/src/main/webapp/v4/TabContainer.js +0 -360
- package/src/legacy/tool-ui/src/main/webapp/v4/Taxonomy.js +0 -27
- package/src/legacy/tool-ui/src/main/webapp/v4/ThemeBundleEditor.js +0 -224
- package/src/legacy/tool-ui/src/main/webapp/v4/TimedContent.js +0 -147
- package/src/legacy/tool-ui/src/main/webapp/v4/TimedContentBundle.js +0 -8
- package/src/legacy/tool-ui/src/main/webapp/v4/VideoEditor.js +0 -2417
- package/src/legacy/tool-ui/src/main/webapp/v4/VideoEditorBundle.js +0 -8
- package/src/legacy/tool-ui/src/main/webapp/v4/ViewMirror.js +0 -52
- package/src/legacy/tool-ui/src/main/webapp/v4/ViewPreview.d.ts +0 -13
- package/src/legacy/tool-ui/src/main/webapp/v4/ViewPreview.js +0 -177
- package/src/legacy/tool-ui/src/main/webapp/v4/Widget.js +0 -90
- package/src/legacy/tool-ui/src/main/webapp/v4/__mocks__/fileMock.js +0 -1
- package/src/legacy/tool-ui/src/main/webapp/v4/__mocks__/styleMock.js +0 -1
- package/src/legacy/tool-ui/src/main/webapp/v4/__mocks__/textArea.mock.js +0 -20
- package/src/legacy/tool-ui/src/main/webapp/v4/__tests__/integration/globals.js +0 -770
- package/src/legacy/tool-ui/src/main/webapp/v4/__tests__/integration/rte/ProseMirror.test.js +0 -16
- package/src/legacy/tool-ui/src/main/webapp/v4/__tests__/integration/rte/index.html +0 -54
- package/src/legacy/tool-ui/src/main/webapp/v4/__tests__/integration/rte/plugins/comment_manager/CommentManager.test.js +0 -29
- package/src/legacy/tool-ui/src/main/webapp/v4/__tests__/integration/rte/plugins/comment_manager/index.html +0 -35
- package/src/legacy/tool-ui/src/main/webapp/v4/__tests__/integration/rte/plugins/custom_keyboard/CustomKeyboard.js +0 -42
- package/src/legacy/tool-ui/src/main/webapp/v4/__tests__/integration/rte/plugins/custom_keyboard/index.html +0 -37
- package/src/legacy/tool-ui/src/main/webapp/v4/__tests__/integration/rte/plugins/enhancement_manager/EnhancementManager.test.js +0 -288
- package/src/legacy/tool-ui/src/main/webapp/v4/__tests__/integration/rte/plugins/enhancement_manager/block.html +0 -38
- package/src/legacy/tool-ui/src/main/webapp/v4/__tests__/integration/rte/plugins/enhancement_manager/inline.html +0 -38
- package/src/legacy/tool-ui/src/main/webapp/v4/__tests__/integration/rte/plugins/enhancement_manager/no-popups.html +0 -38
- package/src/legacy/tool-ui/src/main/webapp/v4/__tests__/integration/rte/plugins/list_manager/ListManager.js +0 -257
- package/src/legacy/tool-ui/src/main/webapp/v4/__tests__/integration/rte/plugins/list_manager/index.html +0 -38
- package/src/legacy/tool-ui/src/main/webapp/v4/__tests__/integration/rte/plugins/menubar/hierarchal.html +0 -33
- package/src/legacy/tool-ui/src/main/webapp/v4/__tests__/integration/rte/plugins/menubar/index.html +0 -33
- package/src/legacy/tool-ui/src/main/webapp/v4/__tests__/integration/rte/plugins/menubar/menubar.test.js +0 -195
- package/src/legacy/tool-ui/src/main/webapp/v4/__tests__/integration/rte/plugins/menubar/small.html +0 -34
- package/src/legacy/tool-ui/src/main/webapp/v4/__tests__/integration/rte/plugins/menubar/tags.html +0 -34
- package/src/legacy/tool-ui/src/main/webapp/v4/__tests__/integration/rte/plugins/placeholder_manager/PlaceholderManager.test.js +0 -134
- package/src/legacy/tool-ui/src/main/webapp/v4/__tests__/integration/rte/plugins/placeholder_manager/has-editable-placeholder.html +0 -32
- package/src/legacy/tool-ui/src/main/webapp/v4/__tests__/integration/rte/plugins/placeholder_manager/has-text.html +0 -34
- package/src/legacy/tool-ui/src/main/webapp/v4/__tests__/integration/rte/plugins/placeholder_manager/index.html +0 -31
- package/src/legacy/tool-ui/src/main/webapp/v4/__tests__/integration/rte/plugins/table_manager/TableManager.test.js +0 -63
- package/src/legacy/tool-ui/src/main/webapp/v4/__tests__/integration/rte/plugins/table_manager/existing.html +0 -48
- package/src/legacy/tool-ui/src/main/webapp/v4/__tests__/integration/rte/plugins/track_manager/TrackManager.test.js +0 -291
- package/src/legacy/tool-ui/src/main/webapp/v4/__tests__/integration/rte/plugins/track_manager/existing.html +0 -39
- package/src/legacy/tool-ui/src/main/webapp/v4/__tests__/integration/rte/plugins/track_manager/insert.html +0 -37
- package/src/legacy/tool-ui/src/main/webapp/v4/__tests__/unit/Sortable.test.js +0 -105
- package/src/legacy/tool-ui/src/main/webapp/v4/__tests__/unit/rte/ProseMirror.test.js +0 -41
- package/src/legacy/tool-ui/src/main/webapp/v4/__tests__/unit/rte/codemirror-shim.test.js +0 -72
- package/src/legacy/tool-ui/src/main/webapp/v4/__tests__/unit/rte/plugins/collab_manager/CollabManager.test.js +0 -46
- package/src/legacy/tool-ui/src/main/webapp/v4/__tests__/unit/rte/plugins/enhancement_manager/EnhancementManager.test.js +0 -84
- package/src/legacy/tool-ui/src/main/webapp/v4/__tests__/unit/rte/plugins/list_manager/ListManager.test.js +0 -54
- package/src/legacy/tool-ui/src/main/webapp/v4/__tests__/unit/rte/plugins/menubar/menubar.test.js +0 -183
- package/src/legacy/tool-ui/src/main/webapp/v4/__tests__/unit/rte/plugins/spellcheck/SpellCheck.test.js +0 -45
- package/src/legacy/tool-ui/src/main/webapp/v4/__tests__/unit/rte/settings/BSSerializer.test.js +0 -346
- package/src/legacy/tool-ui/src/main/webapp/v4/__tests__/unit/rte/settings/menuItemsBuilder.test.js +0 -226
- package/src/legacy/tool-ui/src/main/webapp/v4/__tests__/unit/rte/utilities.test.js +0 -118
- package/src/legacy/tool-ui/src/main/webapp/v4/appetizeio/Appetizeio.js +0 -5
- package/src/legacy/tool-ui/src/main/webapp/v4/appetizeio/AppetizeioEmbedded.js +0 -113
- package/src/legacy/tool-ui/src/main/webapp/v4/compat/Fetch.js +0 -16
- package/src/legacy/tool-ui/src/main/webapp/v4/compat/jquery.js +0 -32
- package/src/legacy/tool-ui/src/main/webapp/v4/compat/requirejs.js +0 -13
- package/src/legacy/tool-ui/src/main/webapp/v4/dom/Tether.js +0 -1
- package/src/legacy/tool-ui/src/main/webapp/v4/dom/TetherLayout.js +0 -1
- package/src/legacy/tool-ui/src/main/webapp/v4/dom/closest.js +0 -1
- package/src/legacy/tool-ui/src/main/webapp/v4/dom/create.js +0 -1
- package/src/legacy/tool-ui/src/main/webapp/v4/dom/find.js +0 -1
- package/src/legacy/tool-ui/src/main/webapp/v4/dom/findAll.js +0 -1
- package/src/legacy/tool-ui/src/main/webapp/v4/dom/ifClick.js +0 -1
- package/src/legacy/tool-ui/src/main/webapp/v4/dom/ifMatches.js +0 -1
- package/src/legacy/tool-ui/src/main/webapp/v4/dom/ifUnmodified.js +0 -1
- package/src/legacy/tool-ui/src/main/webapp/v4/dom/index.js +0 -5
- package/src/legacy/tool-ui/src/main/webapp/v4/dom/insertBefore.js +0 -1
- package/src/legacy/tool-ui/src/main/webapp/v4/dom/insertFirst.js +0 -1
- package/src/legacy/tool-ui/src/main/webapp/v4/dom/insertLast.js +0 -1
- package/src/legacy/tool-ui/src/main/webapp/v4/dom/onFind.js +0 -1
- package/src/legacy/tool-ui/src/main/webapp/v4/dom/onFindOnce.js +0 -1
- package/src/legacy/tool-ui/src/main/webapp/v4/dom/onRTEReady.js +0 -1
- package/src/legacy/tool-ui/src/main/webapp/v4/dom/onRemove.js +0 -1
- package/src/legacy/tool-ui/src/main/webapp/v4/dom/onVisible.js +0 -1
- package/src/legacy/tool-ui/src/main/webapp/v4/dom/previousUntil.js +0 -1
- package/src/legacy/tool-ui/src/main/webapp/v4/dom/resolveIconCompat.js +0 -40
- package/src/legacy/tool-ui/src/main/webapp/v4/rtc/Socket.js +0 -1
- package/src/legacy/tool-ui/src/main/webapp/v4/rtc/index.js +0 -1
- package/src/legacy/tool-ui/src/main/webapp/v4/rte/ProseMirror.js +0 -909
- package/src/legacy/tool-ui/src/main/webapp/v4/rte/README.md +0 -68
- package/src/legacy/tool-ui/src/main/webapp/v4/rte/codemirror-shim.d.ts +0 -8
- package/src/legacy/tool-ui/src/main/webapp/v4/rte/codemirror-shim.js +0 -274
- package/src/legacy/tool-ui/src/main/webapp/v4/rte/collab-workflow.jpeg +0 -0
- package/src/legacy/tool-ui/src/main/webapp/v4/rte/interchangeable.ts +0 -250
- package/src/legacy/tool-ui/src/main/webapp/v4/rte/mention.js +0 -90
- package/src/legacy/tool-ui/src/main/webapp/v4/rte/plugins/PluginProvider.js +0 -124
- package/src/legacy/tool-ui/src/main/webapp/v4/rte/plugins/README.md +0 -46
- package/src/legacy/tool-ui/src/main/webapp/v4/rte/plugins/ai_inline_manager/AIInlineManager.ts +0 -124
- package/src/legacy/tool-ui/src/main/webapp/v4/rte/plugins/ai_inline_manager/views/AIInlineView.ts +0 -1019
- package/src/legacy/tool-ui/src/main/webapp/v4/rte/plugins/ai_manager/AiManager.ts +0 -199
- package/src/legacy/tool-ui/src/main/webapp/v4/rte/plugins/collab_manager/CollabManager.js +0 -339
- package/src/legacy/tool-ui/src/main/webapp/v4/rte/plugins/collab_manager/views/AvatarView.js +0 -96
- package/src/legacy/tool-ui/src/main/webapp/v4/rte/plugins/comment_manager/CommentManager.js +0 -348
- package/src/legacy/tool-ui/src/main/webapp/v4/rte/plugins/custom_keyboard/CustomKeyboard.js +0 -110
- package/src/legacy/tool-ui/src/main/webapp/v4/rte/plugins/custom_keyboard/README.md +0 -29
- package/src/legacy/tool-ui/src/main/webapp/v4/rte/plugins/enhancement_manager/EnhancementManager.js +0 -428
- package/src/legacy/tool-ui/src/main/webapp/v4/rte/plugins/enhancement_manager/README.md +0 -63
- package/src/legacy/tool-ui/src/main/webapp/v4/rte/plugins/enhancement_manager/commands.js +0 -690
- package/src/legacy/tool-ui/src/main/webapp/v4/rte/plugins/enhancement_manager/constants.js +0 -12
- package/src/legacy/tool-ui/src/main/webapp/v4/rte/plugins/enhancement_manager/enhancement-creation.jpeg +0 -0
- package/src/legacy/tool-ui/src/main/webapp/v4/rte/plugins/enhancement_manager/index.js +0 -15
- package/src/legacy/tool-ui/src/main/webapp/v4/rte/plugins/enhancement_manager/rte-flow.jpeg +0 -0
- package/src/legacy/tool-ui/src/main/webapp/v4/rte/plugins/enhancement_manager/views/ActionButtonView.js +0 -86
- package/src/legacy/tool-ui/src/main/webapp/v4/rte/plugins/enhancement_manager/views/BlockSubmenuView.js +0 -60
- package/src/legacy/tool-ui/src/main/webapp/v4/rte/plugins/enhancement_manager/views/EnhancementView.js +0 -208
- package/src/legacy/tool-ui/src/main/webapp/v4/rte/plugins/enhancement_manager/views/PreviewView.js +0 -102
- package/src/legacy/tool-ui/src/main/webapp/v4/rte/plugins/enhancement_manager/views/SubmenuView.js +0 -365
- package/src/legacy/tool-ui/src/main/webapp/v4/rte/plugins/find_replace_manager/FindReplaceManager.js +0 -239
- package/src/legacy/tool-ui/src/main/webapp/v4/rte/plugins/find_replace_manager/views/FindView.js +0 -604
- package/src/legacy/tool-ui/src/main/webapp/v4/rte/plugins/fullscreen_manager/FullscreenManager.js +0 -57
- package/src/legacy/tool-ui/src/main/webapp/v4/rte/plugins/fullscreen_manager/README.md +0 -26
- package/src/legacy/tool-ui/src/main/webapp/v4/rte/plugins/fullscreen_manager/commands.js +0 -16
- package/src/legacy/tool-ui/src/main/webapp/v4/rte/plugins/fullscreen_manager/index.js +0 -4
- package/src/legacy/tool-ui/src/main/webapp/v4/rte/plugins/fullscreen_manager/views/FullscreenView.js +0 -474
- package/src/legacy/tool-ui/src/main/webapp/v4/rte/plugins/html_editor_manager/htmlEditorManager.js +0 -66
- package/src/legacy/tool-ui/src/main/webapp/v4/rte/plugins/html_editor_manager/views/HtmlEditorView.js +0 -97
- package/src/legacy/tool-ui/src/main/webapp/v4/rte/plugins/list_manager/ListManager.js +0 -342
- package/src/legacy/tool-ui/src/main/webapp/v4/rte/plugins/list_manager/README.md +0 -50
- package/src/legacy/tool-ui/src/main/webapp/v4/rte/plugins/list_manager/commands.js +0 -207
- package/src/legacy/tool-ui/src/main/webapp/v4/rte/plugins/list_manager/constants.js +0 -26
- package/src/legacy/tool-ui/src/main/webapp/v4/rte/plugins/list_manager/index.js +0 -4
- package/src/legacy/tool-ui/src/main/webapp/v4/rte/plugins/menubar/Menubar.js +0 -485
- package/src/legacy/tool-ui/src/main/webapp/v4/rte/plugins/menubar/README.md +0 -40
- package/src/legacy/tool-ui/src/main/webapp/v4/rte/plugins/menubar/views/MenuView.js +0 -842
- package/src/legacy/tool-ui/src/main/webapp/v4/rte/plugins/paste_manager/PasteManager.js +0 -368
- package/src/legacy/tool-ui/src/main/webapp/v4/rte/plugins/placeholder_manager/PlaceHolderManager.js +0 -128
- package/src/legacy/tool-ui/src/main/webapp/v4/rte/plugins/raw_text_manager/README.md +0 -13
- package/src/legacy/tool-ui/src/main/webapp/v4/rte/plugins/raw_text_manager/RawTextManager.js +0 -96
- package/src/legacy/tool-ui/src/main/webapp/v4/rte/plugins/spellcheck/index.js +0 -3
- package/src/legacy/tool-ui/src/main/webapp/v4/rte/plugins/spellcheck/spellcheck-plugin.js +0 -280
- package/src/legacy/tool-ui/src/main/webapp/v4/rte/plugins/spellcheck/spellcheck-service.js +0 -94
- package/src/legacy/tool-ui/src/main/webapp/v4/rte/plugins/table_manager/TableManager.js +0 -57
- package/src/legacy/tool-ui/src/main/webapp/v4/rte/plugins/table_manager/commands.js +0 -97
- package/src/legacy/tool-ui/src/main/webapp/v4/rte/plugins/table_manager/views/TableSizerView.js +0 -88
- package/src/legacy/tool-ui/src/main/webapp/v4/rte/plugins/table_manager/views/TableView.js +0 -613
- package/src/legacy/tool-ui/src/main/webapp/v4/rte/plugins/track_manager/README.md +0 -13
- package/src/legacy/tool-ui/src/main/webapp/v4/rte/plugins/track_manager/TrackManager.js +0 -905
- package/src/legacy/tool-ui/src/main/webapp/v4/rte/settings/BSSerializer.js +0 -819
- package/src/legacy/tool-ui/src/main/webapp/v4/rte/settings/README.md +0 -80
- package/src/legacy/tool-ui/src/main/webapp/v4/rte/settings/commands.js +0 -98
- package/src/legacy/tool-ui/src/main/webapp/v4/rte/settings/constants.d.ts +0 -84
- package/src/legacy/tool-ui/src/main/webapp/v4/rte/settings/constants.js +0 -87
- package/src/legacy/tool-ui/src/main/webapp/v4/rte/settings/index.js +0 -13
- package/src/legacy/tool-ui/src/main/webapp/v4/rte/settings/keymapBuilder.js +0 -223
- package/src/legacy/tool-ui/src/main/webapp/v4/rte/settings/menuItemsBuilder.js +0 -559
- package/src/legacy/tool-ui/src/main/webapp/v4/rte/settings/schemaBuilder.js +0 -1281
- package/src/legacy/tool-ui/src/main/webapp/v4/rte/utilities.d.ts +0 -4
- package/src/legacy/tool-ui/src/main/webapp/v4/rte/utilities.js +0 -359
- package/src/legacy/tool-ui/src/main/webapp/v4/theme/ColorRotator.js +0 -1
- package/src/legacy/tool-ui/src/main/webapp/v4/util/debounce.js +0 -1
- package/src/legacy/tool-ui/src/main/webapp/v4/util/getComponentKey.js +0 -1
- package/src/legacy/tool-ui/src/main/webapp/v4/util/noise.js +0 -1
- package/src/legacy/tool-ui/src/main/webapp/v4/util/repaint.js +0 -1
- package/src/legacy/tool-ui/src/main/webapp/v4/util/storage.js +0 -1
- package/src/legacy/tool-ui/src/main/webapp/v4/util/throttle.js +0 -1
- package/src/legacy/tool-ui/src/main/webapp/v4/widget/AssignmentContent.js +0 -33
- package/src/legacy/tool-ui/src/main/webapp/v4/widget/AssignmentDeskDashboard.js +0 -217
- package/src/legacy/tool-ui/src/main/webapp/v4/widget/AssociatedContentWidget.js +0 -7
- package/src/legacy/tool-ui/src/main/webapp/v4/widget/BulkUpload.js +0 -19
- package/src/legacy/tool-ui/src/main/webapp/v4/widget/Calendar.js +0 -7
- package/src/legacy/tool-ui/src/main/webapp/v4/widget/ClosableWindow.js +0 -13
- package/src/legacy/tool-ui/src/main/webapp/v4/widget/PitchAssignments.js +0 -25
- package/src/legacy/tool-ui/src/main/webapp/v4/widget/PitchContent.js +0 -33
- 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 }
|