impact-ui 4.0.0-alpha.2 → 4.0.0-alpha.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.
- package/MIGRATION_GUIDE.md +37 -7
- package/README.md +6 -6
- package/bin/migrate.js +5 -5
- package/codemods/transform.js +17 -23
- package/dist/components/Accordion/index.js +8 -8
- package/dist/components/AccordionModern/SortableAccordionComp.js +7 -7
- package/dist/components/AccordionModern/index.js +2 -2
- package/dist/components/Alert/index.js +14 -14
- package/dist/components/Avatar/index.js +2 -2
- package/dist/components/Badge/filled/filledIconLabelBadges/index.js +1 -1
- package/dist/components/Badge/filled/filledOnlyIconBadges/index.js +1 -1
- package/dist/components/Badge/filled/filledOnlyLabelBadges/index.js +1 -1
- package/dist/components/Badge/stroke/strokeIconLabelBadges/index.js +1 -1
- package/dist/components/Badge/stroke/strokeOnlyIconBadges/index.js +1 -1
- package/dist/components/Badge/stroke/strokeOnlyLabelBadges/index.js +1 -1
- package/dist/components/Badge/subtle/subtleIOnlyIconBadges/index.js +1 -1
- package/dist/components/Badge/subtle/subtleIconLabelBadges/index.js +1 -1
- package/dist/components/Badge/subtle/subtleOnlyLabelBadges/index.js +1 -1
- package/dist/components/Breadcrumbs/index.js +10 -10
- package/dist/components/Button/index.js +3 -3
- package/dist/components/ButtonGroup/index.js +4 -4
- package/dist/components/Card/index.js +2 -2
- package/dist/components/Chart/index.d.ts.map +1 -1
- package/dist/components/Chart/index.js +20 -19
- package/dist/components/Chatbot/bookMarkPanel.d.ts.map +1 -1
- package/dist/components/Chatbot/bookMarkPanel.js +9 -8
- package/dist/components/Chatbot/chatBotLandingScreen.js +2 -2
- package/dist/components/Chatbot/chatInput.d.ts.map +1 -1
- package/dist/components/Chatbot/chatInput.js +11 -11
- package/dist/components/Chatbot/chatbotModuleMenu.d.ts.map +1 -1
- package/dist/components/Chatbot/chatbotModuleMenu.js +13 -12
- package/dist/components/Chatbot/constant.d.ts.map +1 -1
- package/dist/components/Chatbot/constant.js +6 -5
- package/dist/components/Chatbot/customScreen.js +2 -2
- package/dist/components/Chatbot/historyPanel.d.ts.map +1 -1
- package/dist/components/Chatbot/historyPanel.js +2 -1
- package/dist/components/Chatbot/index.d.ts.map +1 -1
- package/dist/components/Chatbot/index.js +2 -1
- package/dist/components/Chatbot/newChatComponent.d.ts.map +1 -1
- package/dist/components/Chatbot/newChatComponent.js +3 -2
- package/dist/components/Checkbox/Dashed.js +3 -3
- package/dist/components/Checkbox/Default.js +3 -3
- package/dist/components/Checkbox/WithDropDown.js +7 -7
- package/dist/components/Checkbox/WithoutFormLabel.js +2 -2
- package/dist/components/Chips/index.js +1 -1
- package/dist/components/CreateItemFlow/index.d.ts.map +1 -1
- package/dist/components/CreateItemFlow/index.js +4 -3
- package/dist/components/DatePicker/showMonthYearSelect.js +3 -3
- package/dist/components/DateRangePicker/dateRangePickerInput.d.ts.map +1 -1
- package/dist/components/DateRangePicker/dateRangePickerInput.js +2 -1
- package/dist/components/DynamicLayout/index.js +2 -2
- package/dist/components/EmptyState/EmptyStateImage.d.ts +0 -1
- package/dist/components/EmptyState/EmptyStateImage.d.ts.map +1 -1
- package/dist/components/EmptyState/EmptyStateImage.js +17 -36
- package/dist/components/FileUpload/fileUploadAssets.loader.d.ts +1 -3
- package/dist/components/FileUpload/fileUploadAssets.loader.d.ts.map +1 -1
- package/dist/components/FileUpload/fileUploadAssets.loader.js +17 -48
- package/dist/components/FileUpload/index.js +2 -2
- package/dist/components/FilterPanel/FilterPanelHeader.js +2 -2
- package/dist/components/FilterPanel/PanelSidebar.js +4 -4
- package/dist/components/FilterPanel/index.js +1 -1
- package/dist/components/FiltersStrip/AppliedFilters.js +2 -2
- package/dist/components/FiltersStrip/FilterDropDown.js +2 -2
- package/dist/components/FiltersStrip/FilterSlider.js +8 -8
- package/dist/components/FiltersStrip/index.js +2 -2
- package/dist/components/Header/index.d.ts.map +1 -1
- package/dist/components/Header/index.js +7 -6
- package/dist/components/HomePage/constants.d.ts.map +1 -1
- package/dist/components/HomePage/constants.js +67 -66
- package/dist/components/HomePage/index.d.ts.map +1 -1
- package/dist/components/HomePage/index.js +64 -9
- package/dist/components/Input/HelperText.js +2 -2
- package/dist/components/Input/InputWithIcon.js +2 -2
- package/dist/components/Input/VanillaInput.js +2 -2
- package/dist/components/Loader/index.js +2 -2
- package/dist/components/Menu/IconMenuItem.js +4 -4
- package/dist/components/Menu/MenuHeaderInfo.d.ts.map +1 -1
- package/dist/components/Menu/MenuHeaderInfo.js +3 -2
- package/dist/components/Menu/NestedMenuItem.js +2 -2
- package/dist/components/Menu/index.js +2 -2
- package/dist/components/Menu/nestedMenuItemsFromObject.js +2 -3
- package/dist/components/Modal/index.js +4 -4
- package/dist/components/Notification/NotificationBody/index.js +2 -2
- package/dist/components/Notification/index.js +1 -1
- package/dist/components/Panel/index.js +1 -1
- package/dist/components/Popover/index.js +4 -4
- package/dist/components/ProgressBar/index.js +1 -1
- package/dist/components/Prompt/index.js +7 -7
- package/dist/components/RadioButtonGroup/index.js +3 -3
- package/dist/components/Select/customGroupHeading.js +1 -1
- package/dist/components/Select/index.js +4 -4
- package/dist/components/Select/menuList.js +2 -2
- package/dist/components/Select/optionList.js +3 -3
- package/dist/components/Sidebar/ChildMenu.js +1 -1
- package/dist/components/Sidebar/ParentMenu.js +6 -6
- package/dist/components/Sidebar/SidebarActions.d.ts.map +1 -1
- package/dist/components/Sidebar/SidebarActions.js +2 -1
- package/dist/components/Sidebar/SidebarMenus.js +2 -2
- package/dist/components/Sidebar/index.d.ts.map +1 -1
- package/dist/components/Sidebar/index.js +4 -3
- package/dist/components/Slider/index.js +4 -4
- package/dist/components/Stepper/index.js +5 -5
- package/dist/components/Switch/index.js +2 -2
- package/dist/components/Table/AgGridHeader.d.ts.map +1 -1
- package/dist/components/Table/AgGridHeader.js +18 -17
- package/dist/components/Table/CommentsPortal.d.ts.map +1 -1
- package/dist/components/Table/CommentsPortal.js +5 -4
- package/dist/components/Table/NewAdvanceSearchModal/NewAdvanceSearchModal.js +4 -4
- package/dist/components/Table/NewAdvanceSearchModal/NewAdvanceSearchModalItem.js +3 -3
- package/dist/components/Table/NoComments.js +2 -2
- package/dist/components/Table/TableImpl.d.ts +1 -2
- package/dist/components/Table/TableImpl.d.ts.map +1 -1
- package/dist/components/Table/TableImpl.js +7 -6
- package/dist/components/Table/commentPanel.d.ts.map +1 -1
- package/dist/components/Table/commentPanel.js +8 -7
- package/dist/components/Table/tableFunctions.d.ts +1 -3
- package/dist/components/Table/tableFunctions.d.ts.map +1 -1
- package/dist/components/Table/tableFunctions.js +26 -25
- package/dist/components/Table/tableHeader.d.ts.map +1 -1
- package/dist/components/Table/tableHeader.js +3 -2
- package/dist/components/Table/tableMoreOptions.d.ts.map +1 -1
- package/dist/components/Table/tableMoreOptions.js +3 -1
- package/dist/components/Table/tablePagination.js +2 -2
- package/dist/components/Table/tableSettings.js +6 -6
- package/dist/components/Table/withCommentIcon.d.ts.map +1 -1
- package/dist/components/Table/withCommentIcon.js +2 -1
- package/dist/components/TableChat/components/ChatMessageSkeleton/ChatFooterSkeleton.js +1 -1
- package/dist/components/TableChat/components/ChatMessageSkeleton/ChatHeaderSkeleton.js +1 -1
- package/dist/components/TableChat/components/ChatMessageSkeleton/ChatMessageListSkeleton.js +1 -1
- package/dist/components/TableChat/components/TableChatLeftSection/AddChatContainer/AddChatContainer.js +1 -1
- package/dist/components/TableChat/components/TableChatLeftSection/ChatChannelItem.d.ts.map +1 -1
- package/dist/components/TableChat/components/TableChatLeftSection/ChatChannelItem.js +5 -4
- package/dist/components/TableChat/components/TableChatLeftSection/ChatHeaderButton/ChatHeaderButton.js +2 -2
- package/dist/components/TableChat/components/TableChatLeftSection/ChatHeaderNavigation.js +11 -11
- package/dist/components/TableChat/components/TableChatLeftSection/ChatIconButton/ChatIconButton.js +2 -2
- package/dist/components/TableChat/components/TableChatRightSection/ChatDefaultMessageType/ChatDefaultMessageType.d.ts.map +1 -1
- package/dist/components/TableChat/components/TableChatRightSection/ChatDefaultMessageType/ChatDefaultMessageType.js +13 -12
- package/dist/components/TableChat/components/TableChatRightSection/ChatDeleteMessageType/ChatDeletedMessageType.js +2 -2
- package/dist/components/TableChat/components/TableChatRightSection/ChatEditedMessageType /ChatEditedMessageType.d.ts.map +1 -1
- package/dist/components/TableChat/components/TableChatRightSection/ChatEditedMessageType /ChatEditedMessageType.js +5 -4
- package/dist/components/TableChat/components/TableChatRightSection/ChatHeader/ChatHeader.d.ts.map +1 -1
- package/dist/components/TableChat/components/TableChatRightSection/ChatHeader/ChatHeader.js +2 -1
- package/dist/components/TableChat/components/TableChatRightSection/ChatHeader/ChatHeaderAction.d.ts.map +1 -1
- package/dist/components/TableChat/components/TableChatRightSection/ChatHeader/ChatHeaderAction.js +7 -6
- package/dist/components/TableChat/components/TableChatRightSection/ChatHeader/ChatHeaderInfo.d.ts.map +1 -1
- package/dist/components/TableChat/components/TableChatRightSection/ChatHeader/ChatHeaderInfo.js +2 -0
- package/dist/components/TableChat/components/TableChatRightSection/ChatInput/ChatInput.d.ts.map +1 -1
- package/dist/components/TableChat/components/TableChatRightSection/ChatInput/ChatInput.js +19 -16
- package/dist/components/TableChat/components/TableChatRightSection/ChatMessages/ChatMessage.d.ts.map +1 -1
- package/dist/components/TableChat/components/TableChatRightSection/ChatMessages/ChatMessage.js +5 -2
- package/dist/components/TableChat/components/TableChatRightSection/EmojiPicker/EmojiPicker.js +3 -3
- package/dist/components/TableChat/components/TableChatRightSection/FileUploader/FileUploader.js +8 -14
- package/dist/components/TableChat/components/TableChatRightSection/ImageUploader/ImageUploader.js +5 -8
- package/dist/components/TableChat/components/TableChatRightSection/PinedChatPanel/PinedChatPanel.d.ts.map +1 -1
- package/dist/components/TableChat/components/TableChatRightSection/PinedChatPanel/PinedChatPanel.js +10 -22
- package/dist/components/TableChat/components/TableChatRightSection/ReplyBadge/ReplyBadge.d.ts.map +1 -1
- package/dist/components/TableChat/components/TableChatRightSection/TableChatRightSection.d.ts.map +1 -1
- package/dist/components/TableChat/components/TableChatRightSection/TableChatRightSection.js +4 -3
- package/dist/components/TableChat/components/TextEditor/EditorToolbar.js +38 -38
- package/dist/components/TableChat/components/TextEditor/Mention.js +8 -8
- package/dist/components/TableChat/components/TextEditor/suggestion.js +2 -2
- package/dist/components/Tabs/TabPanel.js +1 -1
- package/dist/components/Tabs/index.js +4 -4
- package/dist/components/Tag/filled.js +3 -3
- package/dist/components/Tag/solid.js +3 -3
- package/dist/components/Tag/stroke.js +3 -3
- package/dist/components/TextArea/index.js +2 -2
- package/dist/components/Toast/index.js +1 -1
- package/dist/components/Tooltip/index.js +2 -2
- package/dist/components/common/HelperText/index.js +1 -1
- package/dist/components/index.d.ts +1 -0
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/index.js +3 -1
- package/dist/mcp-component-registry.json +3614 -0
- package/dist/node_modules/react-dates/lib/initialize.js +2 -2
- package/dist/node_modules/react-dates/lib/utils/registerCSSInterfaceWithDefaultTheme.js +4 -4
- package/dist/node_modules/react-dates/lib/utils/registerInterfaceWithDefaultTheme.js +2 -2
- package/dist/styles/style.css +1 -1
- package/dist/utils/assetBase.d.ts +7 -0
- package/dist/utils/assetBase.d.ts.map +1 -0
- package/dist/utils/assetBase.js +14 -0
- package/eslint-plugin/rules/no-barrel-import.js +21 -9
- package/package.json +6 -6
- package/dist/_virtual/Add.js +0 -4
- package/dist/_virtual/AttachFile.js +0 -4
- package/dist/_virtual/AutoFixHigh.js +0 -4
- package/dist/_virtual/Block.js +0 -4
- package/dist/_virtual/Brush.js +0 -4
- package/dist/_virtual/Cancel.js +0 -4
- package/dist/_virtual/CheckCircle.js +0 -4
- package/dist/_virtual/ChevronLeft.js +0 -4
- package/dist/_virtual/ChevronRight.js +0 -4
- package/dist/_virtual/ChevronRightOutlined.js +0 -4
- package/dist/_virtual/Clear.js +0 -4
- package/dist/_virtual/Close.js +0 -4
- package/dist/_virtual/CloseOutlined.js +0 -4
- package/dist/_virtual/DeleteOutlineOutlined.js +0 -4
- package/dist/_virtual/DeleteOutlined.js +0 -4
- package/dist/_virtual/DragIndicator.js +0 -4
- package/dist/_virtual/ErrorOutline.js +0 -4
- package/dist/_virtual/ExpandLess.js +0 -4
- package/dist/_virtual/ExpandMore.js +0 -4
- package/dist/_virtual/FileDownloadOutlined.js +0 -4
- package/dist/_virtual/FilterList.js +0 -4
- package/dist/_virtual/FormatBold.js +0 -4
- package/dist/_virtual/FormatColorTextOutlined.js +0 -4
- package/dist/_virtual/FormatItalic.js +0 -4
- package/dist/_virtual/FormatListBulleted.js +0 -4
- package/dist/_virtual/FormatListNumbered.js +0 -4
- package/dist/_virtual/Image.js +0 -4
- package/dist/_virtual/Info.js +0 -4
- package/dist/_virtual/InsertEmoticon.js +0 -4
- package/dist/_virtual/IsConstructor.js +0 -4
- package/dist/_virtual/KeyboardArrowDown.js +0 -4
- package/dist/_virtual/KeyboardArrowDownOutlined.js +0 -4
- package/dist/_virtual/KeyboardArrowLeft.js +0 -4
- package/dist/_virtual/KeyboardArrowRight.js +0 -4
- package/dist/_virtual/KeyboardArrowRightOutlined.js +0 -4
- package/dist/_virtual/KeyboardArrowUp.js +0 -4
- package/dist/_virtual/Link.js +0 -4
- package/dist/_virtual/Looks3.js +0 -4
- package/dist/_virtual/Looks4.js +0 -4
- package/dist/_virtual/Looks5.js +0 -4
- package/dist/_virtual/Looks6.js +0 -4
- package/dist/_virtual/LooksOne.js +0 -4
- package/dist/_virtual/LooksTwo.js +0 -4
- package/dist/_virtual/MoreHoriz.js +0 -4
- package/dist/_virtual/MoreVert.js +0 -4
- package/dist/_virtual/North.js +0 -4
- package/dist/_virtual/NotificationsOff.js +0 -4
- package/dist/_virtual/SaveOutlined.js +0 -4
- package/dist/_virtual/Search.js +0 -4
- package/dist/_virtual/SearchOutlined.js +0 -4
- package/dist/_virtual/SettingsOutlined.js +0 -4
- package/dist/_virtual/StrikethroughS.js +0 -4
- package/dist/_virtual/TableChartOutlined.js +0 -4
- package/dist/_virtual/Tune.js +0 -4
- package/dist/_virtual/ViewColumnOutlined.js +0 -4
- package/dist/_virtual/Warning.js +0 -4
- package/dist/_virtual/___vite-browser-external.js +0 -6
- package/dist/_virtual/__vite-browser-external.js +0 -4
- package/dist/_virtual/_commonjsHelpers.js +0 -33
- package/dist/_virtual/colorManipulator.js +0 -4
- package/dist/_virtual/constants.js +0 -4
- package/dist/_virtual/createStyled.js +0 -4
- package/dist/_virtual/createSvgIcon.js +0 -4
- package/dist/_virtual/extends.js +0 -6
- package/dist/_virtual/getClassName.js +0 -4
- package/dist/_virtual/heatmap.js +0 -4
- package/dist/_virtual/highcharts-3d.js +0 -4
- package/dist/_virtual/highcharts-more.js +0 -4
- package/dist/_virtual/highcharts-react.min.js +0 -4
- package/dist/_virtual/highcharts.js +0 -4
- package/dist/_virtual/index.js +0 -4
- package/dist/_virtual/index10.js +0 -6
- package/dist/_virtual/index11.js +0 -6
- package/dist/_virtual/index12.js +0 -6
- package/dist/_virtual/index13.js +0 -6
- package/dist/_virtual/index14.js +0 -4
- package/dist/_virtual/index15.js +0 -4
- package/dist/_virtual/index16.js +0 -4
- package/dist/_virtual/index17.js +0 -4
- package/dist/_virtual/index2.js +0 -6
- package/dist/_virtual/index3.js +0 -4
- package/dist/_virtual/index4.js +0 -4
- package/dist/_virtual/index5.js +0 -6
- package/dist/_virtual/index6.js +0 -6
- package/dist/_virtual/index7.js +0 -4
- package/dist/_virtual/index8.js +0 -6
- package/dist/_virtual/index9.js +0 -6
- package/dist/_virtual/interopRequireDefault.js +0 -4
- package/dist/_virtual/objectWithoutPropertiesLoose.js +0 -4
- package/dist/_virtual/react-is.development.js +0 -4
- package/dist/_virtual/react-is.development2.js +0 -4
- package/dist/_virtual/react-is.development3.js +0 -4
- package/dist/_virtual/react-is.production.js +0 -4
- package/dist/_virtual/react-is.production.min.js +0 -4
- package/dist/_virtual/react-is.production.min2.js +0 -4
- package/dist/_virtual/separateStyles.js +0 -4
- package/dist/_virtual/stock.js +0 -4
- package/dist/_virtual/treemap.js +0 -4
- package/dist/_virtual/useThemeWithoutDefault.js +0 -4
- package/dist/_virtual/venn.js +0 -4
- package/dist/assets/Chart-dropdown.svg.js +0 -4
- package/dist/assets/CheckTickAll.svg.js +0 -4
- package/dist/assets/Collapse.svg.js +0 -4
- package/dist/assets/Comment.svg.js +0 -4
- package/dist/assets/Down.svg.js +0 -4
- package/dist/assets/IA_Logo.svg.js +0 -4
- package/dist/assets/MoreHorizontal.svg.js +0 -4
- package/dist/assets/Up.svg.js +0 -4
- package/dist/assets/active-notificationIcon.svg.js +0 -4
- package/dist/assets/activeModuleIcon.svg.js +0 -4
- package/dist/assets/bell.svg.js +0 -4
- package/dist/assets/bookmarkIcon.svg.js +0 -4
- package/dist/assets/calendar.svg.js +0 -4
- package/dist/assets/chat-home-icon.svg.js +0 -4
- package/dist/assets/chatBotMicIcon.svg.js +0 -4
- package/dist/assets/chatBotRefreshIcon.svg.js +0 -4
- package/dist/assets/chatBotSendIcon.svg.js +0 -4
- package/dist/assets/chatIcon.svg.js +0 -4
- package/dist/assets/chatbotBannerIcon.svg.js +0 -4
- package/dist/assets/chatbotStopIcon.svg.js +0 -4
- package/dist/assets/checkBlueIcon.svg.js +0 -4
- package/dist/assets/checkGreeIcon.svg.js +0 -4
- package/dist/assets/checkIcon.svg.js +0 -4
- package/dist/assets/clientLogos/Balsam.svg.js +0 -4
- package/dist/assets/clientLogos/Starboard.svg.js +0 -4
- package/dist/assets/clientLogos/figs.svg.js +0 -4
- package/dist/assets/close.svg.js +0 -4
- package/dist/assets/collapse-icon.svg.js +0 -4
- package/dist/assets/comment-indicator.svg.js +0 -4
- package/dist/assets/commentEmptyStateIcon.svg.js +0 -4
- package/dist/assets/createFlowImage.svg.js +0 -4
- package/dist/assets/csv-icon.svg.js +0 -4
- package/dist/assets/defaultViewIcon.svg.js +0 -4
- package/dist/assets/defaultViewIconActive.svg.js +0 -4
- package/dist/assets/delete-black.svg.js +0 -4
- package/dist/assets/deleteIcon.svg.js +0 -4
- package/dist/assets/deleteRedIcon.svg.js +0 -4
- package/dist/assets/downArrow.svg.js +0 -4
- package/dist/assets/edit-black.svg.js +0 -4
- package/dist/assets/editYellowIcon.svg.js +0 -4
- package/dist/assets/excel-icon.svg.js +0 -4
- package/dist/assets/expand-icon.svg.js +0 -4
- package/dist/assets/failed-csv-icon.svg.js +0 -4
- package/dist/assets/failed-excel-icon.svg.js +0 -4
- package/dist/assets/file-upload-error.svg.js +0 -4
- package/dist/assets/file-upload.svg.js +0 -4
- package/dist/assets/fileUploadDownloadIcon.svg.js +0 -4
- package/dist/assets/fileUploadRetryIcon.svg.js +0 -4
- package/dist/assets/hamburger-close.svg.js +0 -4
- package/dist/assets/help-icon.svg.js +0 -4
- package/dist/assets/historyIcon.svg.js +0 -4
- package/dist/assets/landingPageAssets/agenticIcons/starIcon1.svg.js +0 -4
- package/dist/assets/landingPageAssets/agenticIcons/starIcon2.svg.js +0 -4
- package/dist/assets/landingPageAssets/agenticIcons/starIcon3.svg.js +0 -4
- package/dist/assets/landingPageAssets/agenticIcons/starIcon4.svg.js +0 -4
- package/dist/assets/landingPageAssets/agenticIcons/starIcon5.svg.js +0 -4
- package/dist/assets/landingPageAssets/book-demo.svg.js +0 -4
- package/dist/assets/landingPageAssets/configuration_icon.svg.js +0 -4
- package/dist/assets/landingPageAssets/launch.svg.js +0 -4
- package/dist/assets/listIcon.svg.js +0 -4
- package/dist/assets/logout-icon.svg.js +0 -4
- package/dist/assets/material-symbols_sort.svg.js +0 -4
- package/dist/assets/message-icon-disabled.svg.js +0 -4
- package/dist/assets/message-icon.svg.js +0 -4
- package/dist/assets/newChatIcon.svg.js +0 -4
- package/dist/assets/no-filter-results.svg.js +0 -4
- package/dist/assets/notAllowedGreenIcon.svg.js +0 -4
- package/dist/assets/notification-dnd.svg.js +0 -4
- package/dist/assets/pageIcon.svg.js +0 -4
- package/dist/assets/pencilIcon.svg.js +0 -4
- package/dist/assets/pinedIcon.svg.js +0 -4
- package/dist/assets/pinnedIcon.svg.js +0 -4
- package/dist/assets/saveViewDeleteIcon.svg.js +0 -4
- package/dist/assets/saveViewEditIcon.svg.js +0 -4
- package/dist/assets/saveViewIcon.svg.js +0 -4
- package/dist/assets/search.svg.js +0 -4
- package/dist/assets/searchIcon.svg.js +0 -4
- package/dist/assets/searchIconTable.svg.js +0 -4
- package/dist/assets/sendIcon.svg.js +0 -4
- package/dist/assets/smartBotAlan.svg.js +0 -4
- package/dist/assets/success-fill.svg.js +0 -4
- package/dist/assets/success-gray.svg.js +0 -4
- package/dist/assets/sun.png.js +0 -4
- package/dist/assets/tableSettingIcon.svg.js +0 -4
- package/dist/assets/tableSortIcon.svg.js +0 -4
- package/dist/assets/text-icon.svg.js +0 -4
- package/dist/assets/thumbsUpYellowIcon.svg.js +0 -4
- package/dist/assets/thumbsupBlueIcon.svg.js +0 -4
- package/dist/assets/treadChatIcon.svg.js +0 -4
- package/dist/assets/treedotIcon.svg.js +0 -4
- package/dist/assets/unpinedIcon.svg.js +0 -4
- package/dist/assets/upload-close-icon.svg.js +0 -4
- package/dist/assets/upload-pause-icon.svg.js +0 -4
- package/dist/assets/uploadDownloadIcon.svg.js +0 -4
- package/dist/assets/userPlusIcon1.svg.js +0 -4
- package/dist/assets/warningRedIcon.svg.js +0 -4
- package/dist/assets/webp/clientLogos/PACSUN.webp.js +0 -4
- package/dist/assets/webp/clientLogos/aaa.webp.js +0 -4
- package/dist/assets/webp/clientLogos/al-futtaim.webp.js +0 -4
- package/dist/assets/webp/clientLogos/arhaus.webp.js +0 -4
- package/dist/assets/webp/clientLogos/asley-stewart.webp.js +0 -4
- package/dist/assets/webp/clientLogos/briscoe.webp.js +0 -4
- package/dist/assets/webp/clientLogos/carters.webp.js +0 -4
- package/dist/assets/webp/clientLogos/cb.webp.js +0 -4
- package/dist/assets/webp/clientLogos/coach.webp.js +0 -4
- package/dist/assets/webp/clientLogos/dollargeneral.webp.js +0 -4
- package/dist/assets/webp/clientLogos/fossil.webp.js +0 -4
- package/dist/assets/webp/clientLogos/jared.webp.js +0 -4
- package/dist/assets/webp/clientLogos/katespade.webp.js +0 -4
- package/dist/assets/webp/clientLogos/kay.webp.js +0 -4
- package/dist/assets/webp/clientLogos/kik.webp.js +0 -4
- package/dist/assets/webp/clientLogos/leslies.webp.js +0 -4
- package/dist/assets/webp/clientLogos/lovisa_1.webp.js +0 -4
- package/dist/assets/webp/clientLogos/lsco_logo_red.webp.js +0 -4
- package/dist/assets/webp/clientLogos/m-s.webp.js +0 -4
- package/dist/assets/webp/clientLogos/oshkosh.webp.js +0 -4
- package/dist/assets/webp/clientLogos/pantagonia.webp.js +0 -4
- package/dist/assets/webp/clientLogos/pink.webp.js +0 -4
- package/dist/assets/webp/clientLogos/pitta-roso.webp.js +0 -4
- package/dist/assets/webp/clientLogos/psp.webp.js +0 -4
- package/dist/assets/webp/clientLogos/ralphlauren.webp.js +0 -4
- package/dist/assets/webp/clientLogos/rebel.webp.js +0 -4
- package/dist/assets/webp/clientLogos/scarpe.webp.js +0 -4
- package/dist/assets/webp/clientLogos/signet.webp.js +0 -4
- package/dist/assets/webp/clientLogos/so5.webp.js +0 -4
- package/dist/assets/webp/clientLogos/spanx.webp.js +0 -4
- package/dist/assets/webp/clientLogos/stevemadden.webp.js +0 -4
- package/dist/assets/webp/clientLogos/stuart.webp.js +0 -4
- package/dist/assets/webp/clientLogos/tillys.webp.js +0 -4
- package/dist/assets/webp/clientLogos/tommy-bahama.webp.js +0 -4
- package/dist/assets/webp/clientLogos/vs.webp.js +0 -4
- package/dist/assets/webp/clientLogos/zales.webp.js +0 -4
- package/dist/assets/webp/emptyState1.webp.js +0 -4
- package/dist/assets/webp/emptyState2.webp.js +0 -4
- package/dist/assets/webp/emptyState3.webp.js +0 -4
- package/dist/assets/webp/emptyState4.webp.js +0 -4
- package/dist/assets/webp/emptyState5.webp.js +0 -4
- package/dist/assets/webp/emptyState6.webp.js +0 -4
- package/dist/assets/webp/landingPageAssets/agenticIcons/1.webp.js +0 -4
- package/dist/assets/webp/landingPageAssets/agenticIcons/10.webp.js +0 -4
- package/dist/assets/webp/landingPageAssets/agenticIcons/11.webp.js +0 -4
- package/dist/assets/webp/landingPageAssets/agenticIcons/12.webp.js +0 -4
- package/dist/assets/webp/landingPageAssets/agenticIcons/13.webp.js +0 -4
- package/dist/assets/webp/landingPageAssets/agenticIcons/14.webp.js +0 -4
- package/dist/assets/webp/landingPageAssets/agenticIcons/15.webp.js +0 -4
- package/dist/assets/webp/landingPageAssets/agenticIcons/17.webp.js +0 -4
- package/dist/assets/webp/landingPageAssets/agenticIcons/19.webp.js +0 -4
- package/dist/assets/webp/landingPageAssets/agenticIcons/2.webp.js +0 -4
- package/dist/assets/webp/landingPageAssets/agenticIcons/20.webp.js +0 -4
- package/dist/assets/webp/landingPageAssets/agenticIcons/21.webp.js +0 -4
- package/dist/assets/webp/landingPageAssets/agenticIcons/22.webp.js +0 -4
- package/dist/assets/webp/landingPageAssets/agenticIcons/23.webp.js +0 -4
- package/dist/assets/webp/landingPageAssets/agenticIcons/24.webp.js +0 -4
- package/dist/assets/webp/landingPageAssets/agenticIcons/3.webp.js +0 -4
- package/dist/assets/webp/landingPageAssets/agenticIcons/4.webp.js +0 -4
- package/dist/assets/webp/landingPageAssets/agenticIcons/5.webp.js +0 -4
- package/dist/assets/webp/landingPageAssets/agenticIcons/6.webp.js +0 -4
- package/dist/assets/webp/landingPageAssets/agenticIcons/7.webp.js +0 -4
- package/dist/assets/webp/landingPageAssets/agenticIcons/8.webp.js +0 -4
- package/dist/assets/webp/landingPageAssets/carouselImages/image-2.webp.js +0 -4
- package/dist/node_modules/@babel/runtime/helpers/esm/arrayLikeToArray.js +0 -8
- package/dist/node_modules/@babel/runtime/helpers/esm/arrayWithHoles.js +0 -6
- package/dist/node_modules/@babel/runtime/helpers/esm/arrayWithoutHoles.js +0 -7
- package/dist/node_modules/@babel/runtime/helpers/esm/assertThisInitialized.js +0 -7
- package/dist/node_modules/@babel/runtime/helpers/esm/classCallCheck.js +0 -6
- package/dist/node_modules/@babel/runtime/helpers/esm/createClass.js +0 -15
- package/dist/node_modules/@babel/runtime/helpers/esm/createSuper.js +0 -17
- package/dist/node_modules/@babel/runtime/helpers/esm/defineProperty.js +0 -12
- package/dist/node_modules/@babel/runtime/helpers/esm/extends.js +0 -12
- package/dist/node_modules/@babel/runtime/helpers/esm/getPrototypeOf.js +0 -8
- package/dist/node_modules/@babel/runtime/helpers/esm/inherits.js +0 -16
- package/dist/node_modules/@babel/runtime/helpers/esm/inheritsLoose.js +0 -7
- package/dist/node_modules/@babel/runtime/helpers/esm/isNativeReflectConstruct.js +0 -13
- package/dist/node_modules/@babel/runtime/helpers/esm/iterableToArray.js +0 -6
- package/dist/node_modules/@babel/runtime/helpers/esm/iterableToArrayLimit.js +0 -24
- package/dist/node_modules/@babel/runtime/helpers/esm/nonIterableRest.js +0 -6
- package/dist/node_modules/@babel/runtime/helpers/esm/nonIterableSpread.js +0 -6
- package/dist/node_modules/@babel/runtime/helpers/esm/objectSpread2.js +0 -25
- package/dist/node_modules/@babel/runtime/helpers/esm/objectWithoutProperties.js +0 -13
- package/dist/node_modules/@babel/runtime/helpers/esm/objectWithoutPropertiesLoose.js +0 -12
- package/dist/node_modules/@babel/runtime/helpers/esm/possibleConstructorReturn.js +0 -10
- package/dist/node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js +0 -8
- package/dist/node_modules/@babel/runtime/helpers/esm/slicedToArray.js +0 -10
- package/dist/node_modules/@babel/runtime/helpers/esm/taggedTemplateLiteral.js +0 -10
- package/dist/node_modules/@babel/runtime/helpers/esm/toConsumableArray.js +0 -10
- package/dist/node_modules/@babel/runtime/helpers/esm/toPrimitive.js +0 -14
- package/dist/node_modules/@babel/runtime/helpers/esm/toPropertyKey.js +0 -9
- package/dist/node_modules/@babel/runtime/helpers/esm/typeof.js +0 -11
- package/dist/node_modules/@babel/runtime/helpers/esm/unsupportedIterableToArray.js +0 -11
- package/dist/node_modules/@babel/runtime/helpers/interopRequireDefault.js +0 -13
- package/dist/node_modules/@babel/runtime/helpers/objectWithoutPropertiesLoose.js +0 -22
- package/dist/node_modules/@dnd-kit/accessibility/dist/accessibility.esm.js +0 -59
- package/dist/node_modules/@dnd-kit/core/dist/core.esm.js +0 -3405
- package/dist/node_modules/@dnd-kit/sortable/dist/sortable.esm.js +0 -418
- package/dist/node_modules/@dnd-kit/utilities/dist/utilities.esm.js +0 -301
- package/dist/node_modules/@emotion/cache/dist/emotion-cache.browser.esm.js +0 -311
- package/dist/node_modules/@emotion/hash/dist/emotion-hash.esm.js +0 -31
- package/dist/node_modules/@emotion/is-prop-valid/dist/emotion-is-prop-valid.esm.js +0 -11
- package/dist/node_modules/@emotion/memoize/dist/emotion-memoize.esm.js +0 -10
- package/dist/node_modules/@emotion/react/dist/emotion-element-f0de968e.browser.esm.js +0 -85
- package/dist/node_modules/@emotion/react/dist/emotion-react.browser.esm.js +0 -100
- package/dist/node_modules/@emotion/serialize/dist/emotion-serialize.esm.js +0 -173
- package/dist/node_modules/@emotion/sheet/dist/emotion-sheet.esm.js +0 -83
- package/dist/node_modules/@emotion/styled/base/dist/emotion-styled-base.browser.esm.js +0 -130
- package/dist/node_modules/@emotion/styled/dist/emotion-styled.browser.esm.js +0 -146
- package/dist/node_modules/@emotion/unitless/dist/emotion-unitless.esm.js +0 -53
- package/dist/node_modules/@emotion/use-insertion-effect-with-fallbacks/dist/emotion-use-insertion-effect-with-fallbacks.browser.esm.js +0 -11
- package/dist/node_modules/@emotion/utils/dist/emotion-utils.browser.esm.js +0 -45
- package/dist/node_modules/@floating-ui/dom/dist/floating-ui.dom.js +0 -257
- package/dist/node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.js +0 -122
- package/dist/node_modules/@floating-ui/utils/dist/floating-ui.utils.js +0 -34
- package/dist/node_modules/@mui/base/TextareaAutosize/TextareaAutosize.js +0 -195
- package/dist/node_modules/@mui/icons-material/Add.js +0 -17
- package/dist/node_modules/@mui/icons-material/AttachFile.js +0 -17
- package/dist/node_modules/@mui/icons-material/AutoFixHigh.js +0 -17
- package/dist/node_modules/@mui/icons-material/Block.js +0 -17
- package/dist/node_modules/@mui/icons-material/Brush.js +0 -17
- package/dist/node_modules/@mui/icons-material/Cancel.js +0 -17
- package/dist/node_modules/@mui/icons-material/CheckCircle.js +0 -17
- package/dist/node_modules/@mui/icons-material/ChevronLeft.js +0 -17
- package/dist/node_modules/@mui/icons-material/ChevronRight.js +0 -17
- package/dist/node_modules/@mui/icons-material/ChevronRightOutlined.js +0 -17
- package/dist/node_modules/@mui/icons-material/Clear.js +0 -17
- package/dist/node_modules/@mui/icons-material/Close.js +0 -17
- package/dist/node_modules/@mui/icons-material/CloseOutlined.js +0 -17
- package/dist/node_modules/@mui/icons-material/DeleteOutlineOutlined.js +0 -17
- package/dist/node_modules/@mui/icons-material/DeleteOutlined.js +0 -17
- package/dist/node_modules/@mui/icons-material/DragIndicator.js +0 -17
- package/dist/node_modules/@mui/icons-material/ErrorOutline.js +0 -17
- package/dist/node_modules/@mui/icons-material/ExpandLess.js +0 -17
- package/dist/node_modules/@mui/icons-material/ExpandMore.js +0 -17
- package/dist/node_modules/@mui/icons-material/FileDownloadOutlined.js +0 -17
- package/dist/node_modules/@mui/icons-material/FilterList.js +0 -17
- package/dist/node_modules/@mui/icons-material/FormatBold.js +0 -17
- package/dist/node_modules/@mui/icons-material/FormatColorTextOutlined.js +0 -17
- package/dist/node_modules/@mui/icons-material/FormatItalic.js +0 -17
- package/dist/node_modules/@mui/icons-material/FormatListBulleted.js +0 -17
- package/dist/node_modules/@mui/icons-material/FormatListNumbered.js +0 -17
- package/dist/node_modules/@mui/icons-material/Image.js +0 -17
- package/dist/node_modules/@mui/icons-material/Info.js +0 -17
- package/dist/node_modules/@mui/icons-material/InsertEmoticon.js +0 -17
- package/dist/node_modules/@mui/icons-material/KeyboardArrowDown.js +0 -17
- package/dist/node_modules/@mui/icons-material/KeyboardArrowDownOutlined.js +0 -17
- package/dist/node_modules/@mui/icons-material/KeyboardArrowLeft.js +0 -17
- package/dist/node_modules/@mui/icons-material/KeyboardArrowRight.js +0 -17
- package/dist/node_modules/@mui/icons-material/KeyboardArrowRightOutlined.js +0 -17
- package/dist/node_modules/@mui/icons-material/KeyboardArrowUp.js +0 -17
- package/dist/node_modules/@mui/icons-material/Link.js +0 -17
- package/dist/node_modules/@mui/icons-material/Looks3.js +0 -17
- package/dist/node_modules/@mui/icons-material/Looks4.js +0 -17
- package/dist/node_modules/@mui/icons-material/Looks5.js +0 -17
- package/dist/node_modules/@mui/icons-material/Looks6.js +0 -17
- package/dist/node_modules/@mui/icons-material/LooksOne.js +0 -17
- package/dist/node_modules/@mui/icons-material/LooksTwo.js +0 -17
- package/dist/node_modules/@mui/icons-material/MoreHoriz.js +0 -17
- package/dist/node_modules/@mui/icons-material/MoreVert.js +0 -17
- package/dist/node_modules/@mui/icons-material/North.js +0 -17
- package/dist/node_modules/@mui/icons-material/NotificationsOff.js +0 -17
- package/dist/node_modules/@mui/icons-material/SaveOutlined.js +0 -17
- package/dist/node_modules/@mui/icons-material/Search.js +0 -17
- package/dist/node_modules/@mui/icons-material/SearchOutlined.js +0 -17
- package/dist/node_modules/@mui/icons-material/SettingsOutlined.js +0 -17
- package/dist/node_modules/@mui/icons-material/StrikethroughS.js +0 -17
- package/dist/node_modules/@mui/icons-material/TableChartOutlined.js +0 -17
- package/dist/node_modules/@mui/icons-material/Tune.js +0 -17
- package/dist/node_modules/@mui/icons-material/ViewColumnOutlined.js +0 -17
- package/dist/node_modules/@mui/icons-material/Warning.js +0 -17
- package/dist/node_modules/@mui/icons-material/esm/AddOutlined.js +0 -8
- package/dist/node_modules/@mui/icons-material/esm/ChevronRight.js +0 -8
- package/dist/node_modules/@mui/icons-material/esm/Close.js +0 -8
- package/dist/node_modules/@mui/icons-material/esm/DragIndicator.js +0 -8
- package/dist/node_modules/@mui/icons-material/esm/FileDownload.js +0 -8
- package/dist/node_modules/@mui/icons-material/esm/HighlightOff.js +0 -8
- package/dist/node_modules/@mui/icons-material/esm/KeyboardArrowDown.js +0 -8
- package/dist/node_modules/@mui/icons-material/esm/Replay.js +0 -8
- package/dist/node_modules/@mui/icons-material/utils/createSvgIcon.js +0 -24
- package/dist/node_modules/@mui/material/Accordion/Accordion.js +0 -294
- package/dist/node_modules/@mui/material/Accordion/AccordionContext.js +0 -8
- package/dist/node_modules/@mui/material/Accordion/accordionClasses.js +0 -10
- package/dist/node_modules/@mui/material/AccordionDetails/AccordionDetails.js +0 -70
- package/dist/node_modules/@mui/material/AccordionDetails/accordionDetailsClasses.js +0 -9
- package/dist/node_modules/@mui/material/AccordionSummary/AccordionSummary.js +0 -198
- package/dist/node_modules/@mui/material/AccordionSummary/accordionSummaryClasses.js +0 -10
- package/dist/node_modules/@mui/material/Alert/Alert.js +0 -346
- package/dist/node_modules/@mui/material/Alert/alertClasses.js +0 -10
- package/dist/node_modules/@mui/material/AlertTitle/AlertTitle.js +0 -76
- package/dist/node_modules/@mui/material/AlertTitle/alertTitleClasses.js +0 -9
- package/dist/node_modules/@mui/material/Avatar/Avatar.js +0 -284
- package/dist/node_modules/@mui/material/Avatar/avatarClasses.js +0 -9
- package/dist/node_modules/@mui/material/Backdrop/Backdrop.js +0 -187
- package/dist/node_modules/@mui/material/Backdrop/backdropClasses.js +0 -9
- package/dist/node_modules/@mui/material/Badge/Badge.js +0 -427
- package/dist/node_modules/@mui/material/Badge/badgeClasses.js +0 -37
- package/dist/node_modules/@mui/material/Badge/useBadge.js +0 -31
- package/dist/node_modules/@mui/material/Box/Box.js +0 -35
- package/dist/node_modules/@mui/material/Box/boxClasses.js +0 -5
- package/dist/node_modules/@mui/material/Breadcrumbs/BreadcrumbCollapsed.js +0 -85
- package/dist/node_modules/@mui/material/Breadcrumbs/Breadcrumbs.js +0 -233
- package/dist/node_modules/@mui/material/Breadcrumbs/breadcrumbsClasses.js +0 -10
- package/dist/node_modules/@mui/material/Button/Button.js +0 -378
- package/dist/node_modules/@mui/material/Button/buttonClasses.js +0 -10
- package/dist/node_modules/@mui/material/ButtonBase/ButtonBase.js +0 -458
- package/dist/node_modules/@mui/material/ButtonBase/Ripple.js +0 -83
- package/dist/node_modules/@mui/material/ButtonBase/TouchRipple.js +0 -303
- package/dist/node_modules/@mui/material/ButtonBase/buttonBaseClasses.js +0 -10
- package/dist/node_modules/@mui/material/ButtonBase/touchRippleClasses.js +0 -5
- package/dist/node_modules/@mui/material/ButtonGroup/ButtonGroupButtonContext.js +0 -8
- package/dist/node_modules/@mui/material/ButtonGroup/ButtonGroupContext.js +0 -8
- package/dist/node_modules/@mui/material/Card/Card.js +0 -86
- package/dist/node_modules/@mui/material/Card/cardClasses.js +0 -9
- package/dist/node_modules/@mui/material/Checkbox/Checkbox.js +0 -212
- package/dist/node_modules/@mui/material/Checkbox/checkboxClasses.js +0 -10
- package/dist/node_modules/@mui/material/Chip/Chip.js +0 -496
- package/dist/node_modules/@mui/material/Chip/chipClasses.js +0 -10
- package/dist/node_modules/@mui/material/CircularProgress/CircularProgress.js +0 -240
- package/dist/node_modules/@mui/material/CircularProgress/circularProgressClasses.js +0 -9
- package/dist/node_modules/@mui/material/ClickAwayListener/ClickAwayListener.js +0 -146
- package/dist/node_modules/@mui/material/Collapse/Collapse.js +0 -363
- package/dist/node_modules/@mui/material/Collapse/collapseClasses.js +0 -9
- package/dist/node_modules/@mui/material/DefaultPropsProvider/DefaultPropsProvider.js +0 -24
- package/dist/node_modules/@mui/material/Dialog/Dialog.js +0 -393
- package/dist/node_modules/@mui/material/Dialog/DialogContext.js +0 -8
- package/dist/node_modules/@mui/material/Dialog/dialogClasses.js +0 -10
- package/dist/node_modules/@mui/material/DialogActions/DialogActions.js +0 -92
- package/dist/node_modules/@mui/material/DialogActions/dialogActionsClasses.js +0 -9
- package/dist/node_modules/@mui/material/DialogContent/DialogContent.js +0 -98
- package/dist/node_modules/@mui/material/DialogContent/dialogContentClasses.js +0 -9
- package/dist/node_modules/@mui/material/DialogContentText/DialogContentText.js +0 -74
- package/dist/node_modules/@mui/material/DialogContentText/dialogContentTextClasses.js +0 -9
- package/dist/node_modules/@mui/material/DialogTitle/DialogTitle.js +0 -82
- package/dist/node_modules/@mui/material/DialogTitle/dialogTitleClasses.js +0 -10
- package/dist/node_modules/@mui/material/Divider/dividerClasses.js +0 -5
- package/dist/node_modules/@mui/material/Drawer/Drawer.js +0 -309
- package/dist/node_modules/@mui/material/Drawer/drawerClasses.js +0 -9
- package/dist/node_modules/@mui/material/Fade/Fade.js +0 -195
- package/dist/node_modules/@mui/material/FilledInput/FilledInput.js +0 -430
- package/dist/node_modules/@mui/material/FilledInput/filledInputClasses.js +0 -12
- package/dist/node_modules/@mui/material/FormControl/FormControl.js +0 -259
- package/dist/node_modules/@mui/material/FormControl/FormControlContext.js +0 -8
- package/dist/node_modules/@mui/material/FormControl/formControlClasses.js +0 -9
- package/dist/node_modules/@mui/material/FormControl/formControlState.js +0 -18
- package/dist/node_modules/@mui/material/FormControl/useFormControl.js +0 -8
- package/dist/node_modules/@mui/material/FormControlLabel/FormControlLabel.js +0 -239
- package/dist/node_modules/@mui/material/FormControlLabel/formControlLabelClasses.js +0 -10
- package/dist/node_modules/@mui/material/FormGroup/FormGroup.js +0 -98
- package/dist/node_modules/@mui/material/FormGroup/formGroupClasses.js +0 -9
- package/dist/node_modules/@mui/material/FormHelperText/FormHelperText.js +0 -167
- package/dist/node_modules/@mui/material/FormHelperText/formHelperTextClasses.js +0 -10
- package/dist/node_modules/@mui/material/GlobalStyles/GlobalStyles.js +0 -26
- package/dist/node_modules/@mui/material/Grow/Grow.js +0 -240
- package/dist/node_modules/@mui/material/IconButton/IconButton.js +0 -199
- package/dist/node_modules/@mui/material/IconButton/iconButtonClasses.js +0 -10
- package/dist/node_modules/@mui/material/Input/Input.js +0 -343
- package/dist/node_modules/@mui/material/Input/inputClasses.js +0 -12
- package/dist/node_modules/@mui/material/InputBase/InputBase.js +0 -695
- package/dist/node_modules/@mui/material/InputBase/inputBaseClasses.js +0 -10
- package/dist/node_modules/@mui/material/InputBase/utils.js +0 -14
- package/dist/node_modules/@mui/material/LinearProgress/LinearProgress.js +0 -335
- package/dist/node_modules/@mui/material/LinearProgress/linearProgressClasses.js +0 -9
- package/dist/node_modules/@mui/material/Link/Link.js +0 -211
- package/dist/node_modules/@mui/material/Link/getTextDecoration.js +0 -28
- package/dist/node_modules/@mui/material/Link/linkClasses.js +0 -10
- package/dist/node_modules/@mui/material/List/List.js +0 -126
- package/dist/node_modules/@mui/material/List/ListContext.js +0 -8
- package/dist/node_modules/@mui/material/List/listClasses.js +0 -9
- package/dist/node_modules/@mui/material/ListItemIcon/ListItemIcon.js +0 -87
- package/dist/node_modules/@mui/material/ListItemIcon/listItemIconClasses.js +0 -10
- package/dist/node_modules/@mui/material/ListItemText/listItemTextClasses.js +0 -5
- package/dist/node_modules/@mui/material/Menu/Menu.js +0 -297
- package/dist/node_modules/@mui/material/Menu/menuClasses.js +0 -9
- package/dist/node_modules/@mui/material/MenuItem/MenuItem.js +0 -261
- package/dist/node_modules/@mui/material/MenuItem/menuItemClasses.js +0 -10
- package/dist/node_modules/@mui/material/MenuList/MenuList.js +0 -250
- package/dist/node_modules/@mui/material/Modal/Modal.js +0 -367
- package/dist/node_modules/@mui/material/Modal/ModalManager.js +0 -189
- package/dist/node_modules/@mui/material/Modal/modalClasses.js +0 -9
- package/dist/node_modules/@mui/material/Modal/useModal.js +0 -168
- package/dist/node_modules/@mui/material/NativeSelect/NativeSelectInput.js +0 -217
- package/dist/node_modules/@mui/material/NativeSelect/nativeSelectClasses.js +0 -10
- package/dist/node_modules/@mui/material/OutlinedInput/NotchedOutline.js +0 -136
- package/dist/node_modules/@mui/material/OutlinedInput/OutlinedInput.js +0 -349
- package/dist/node_modules/@mui/material/OutlinedInput/outlinedInputClasses.js +0 -12
- package/dist/node_modules/@mui/material/Paper/Paper.js +0 -145
- package/dist/node_modules/@mui/material/Paper/paperClasses.js +0 -9
- package/dist/node_modules/@mui/material/Popover/Popover.js +0 -510
- package/dist/node_modules/@mui/material/Popover/popoverClasses.js +0 -9
- package/dist/node_modules/@mui/material/Popper/BasePopper.js +0 -362
- package/dist/node_modules/@mui/material/Popper/Popper.js +0 -195
- package/dist/node_modules/@mui/material/Popper/popperClasses.js +0 -9
- package/dist/node_modules/@mui/material/Portal/Portal.js +0 -82
- package/dist/node_modules/@mui/material/Radio/Radio.js +0 -212
- package/dist/node_modules/@mui/material/Radio/RadioButtonIcon.js +0 -82
- package/dist/node_modules/@mui/material/Radio/radioClasses.js +0 -10
- package/dist/node_modules/@mui/material/RadioGroup/RadioGroup.js +0 -116
- package/dist/node_modules/@mui/material/RadioGroup/RadioGroupContext.js +0 -8
- package/dist/node_modules/@mui/material/RadioGroup/radioGroupClasses.js +0 -9
- package/dist/node_modules/@mui/material/RadioGroup/useRadioGroup.js +0 -8
- package/dist/node_modules/@mui/material/Select/Select.js +0 -283
- package/dist/node_modules/@mui/material/Select/SelectInput.js +0 -631
- package/dist/node_modules/@mui/material/Select/selectClasses.js +0 -10
- package/dist/node_modules/@mui/material/Skeleton/Skeleton.js +0 -218
- package/dist/node_modules/@mui/material/Skeleton/skeletonClasses.js +0 -9
- package/dist/node_modules/@mui/material/Slide/Slide.js +0 -315
- package/dist/node_modules/@mui/material/Slider/Slider.js +0 -1045
- package/dist/node_modules/@mui/material/Slider/SliderValueLabel.js +0 -50
- package/dist/node_modules/@mui/material/Slider/sliderClasses.js +0 -10
- package/dist/node_modules/@mui/material/Slider/useSlider.js +0 -605
- package/dist/node_modules/@mui/material/Snackbar/Snackbar.js +0 -304
- package/dist/node_modules/@mui/material/Snackbar/snackbarClasses.js +0 -9
- package/dist/node_modules/@mui/material/Snackbar/useSnackbar.js +0 -108
- package/dist/node_modules/@mui/material/SnackbarContent/SnackbarContent.js +0 -132
- package/dist/node_modules/@mui/material/SnackbarContent/snackbarContentClasses.js +0 -9
- package/dist/node_modules/@mui/material/Stack/Stack.js +0 -62
- package/dist/node_modules/@mui/material/Step/Step.js +0 -167
- package/dist/node_modules/@mui/material/Step/StepContext.js +0 -8
- package/dist/node_modules/@mui/material/Step/stepClasses.js +0 -9
- package/dist/node_modules/@mui/material/StepConnector/StepConnector.js +0 -134
- package/dist/node_modules/@mui/material/StepConnector/stepConnectorClasses.js +0 -9
- package/dist/node_modules/@mui/material/StepIcon/StepIcon.js +0 -159
- package/dist/node_modules/@mui/material/StepIcon/stepIconClasses.js +0 -10
- package/dist/node_modules/@mui/material/StepLabel/StepLabel.js +0 -237
- package/dist/node_modules/@mui/material/StepLabel/stepLabelClasses.js +0 -10
- package/dist/node_modules/@mui/material/Stepper/Stepper.js +0 -153
- package/dist/node_modules/@mui/material/Stepper/StepperContext.js +0 -8
- package/dist/node_modules/@mui/material/Stepper/stepperClasses.js +0 -9
- package/dist/node_modules/@mui/material/SvgIcon/SvgIcon.js +0 -185
- package/dist/node_modules/@mui/material/SvgIcon/svgIconClasses.js +0 -9
- package/dist/node_modules/@mui/material/Switch/Switch.js +0 -335
- package/dist/node_modules/@mui/material/Switch/switchClasses.js +0 -10
- package/dist/node_modules/@mui/material/Tab/Tab.js +0 -263
- package/dist/node_modules/@mui/material/Tab/tabClasses.js +0 -10
- package/dist/node_modules/@mui/material/TabScrollButton/TabScrollButton.js +0 -153
- package/dist/node_modules/@mui/material/TabScrollButton/tabScrollButtonClasses.js +0 -10
- package/dist/node_modules/@mui/material/Tabs/ScrollbarSize.js +0 -56
- package/dist/node_modules/@mui/material/Tabs/Tabs.js +0 -801
- package/dist/node_modules/@mui/material/Tabs/tabsClasses.js +0 -10
- package/dist/node_modules/@mui/material/TextareaAutosize/TextareaAutosize.js +0 -216
- package/dist/node_modules/@mui/material/ToggleButton/ToggleButton.js +0 -233
- package/dist/node_modules/@mui/material/ToggleButton/toggleButtonClasses.js +0 -10
- package/dist/node_modules/@mui/material/ToggleButtonGroup/ToggleButtonGroup.js +0 -269
- package/dist/node_modules/@mui/material/ToggleButtonGroup/ToggleButtonGroupButtonContext.js +0 -8
- package/dist/node_modules/@mui/material/ToggleButtonGroup/ToggleButtonGroupContext.js +0 -8
- package/dist/node_modules/@mui/material/ToggleButtonGroup/isValueSelected.js +0 -12
- package/dist/node_modules/@mui/material/ToggleButtonGroup/toggleButtonGroupClasses.js +0 -10
- package/dist/node_modules/@mui/material/Tooltip/Tooltip.js +0 -737
- package/dist/node_modules/@mui/material/Tooltip/tooltipClasses.js +0 -10
- package/dist/node_modules/@mui/material/Typography/Typography.js +0 -196
- package/dist/node_modules/@mui/material/Typography/typographyClasses.js +0 -9
- package/dist/node_modules/@mui/material/Unstable_TrapFocus/FocusTrap.js +0 -280
- package/dist/node_modules/@mui/material/colors/blue.js +0 -10
- package/dist/node_modules/@mui/material/colors/common.js +0 -7
- package/dist/node_modules/@mui/material/colors/green.js +0 -11
- package/dist/node_modules/@mui/material/colors/grey.js +0 -19
- package/dist/node_modules/@mui/material/colors/lightBlue.js +0 -10
- package/dist/node_modules/@mui/material/colors/orange.js +0 -10
- package/dist/node_modules/@mui/material/colors/purple.js +0 -11
- package/dist/node_modules/@mui/material/colors/red.js +0 -10
- package/dist/node_modules/@mui/material/internal/SwitchBase.js +0 -266
- package/dist/node_modules/@mui/material/internal/animate.js +0 -44
- package/dist/node_modules/@mui/material/internal/svg-icons/ArrowDropDown.js +0 -9
- package/dist/node_modules/@mui/material/internal/svg-icons/Cancel.js +0 -9
- package/dist/node_modules/@mui/material/internal/svg-icons/CheckBox.js +0 -9
- package/dist/node_modules/@mui/material/internal/svg-icons/CheckBoxOutlineBlank.js +0 -9
- package/dist/node_modules/@mui/material/internal/svg-icons/CheckCircle.js +0 -9
- package/dist/node_modules/@mui/material/internal/svg-icons/Close.js +0 -9
- package/dist/node_modules/@mui/material/internal/svg-icons/ErrorOutline.js +0 -9
- package/dist/node_modules/@mui/material/internal/svg-icons/IndeterminateCheckBox.js +0 -9
- package/dist/node_modules/@mui/material/internal/svg-icons/InfoOutlined.js +0 -9
- package/dist/node_modules/@mui/material/internal/svg-icons/KeyboardArrowLeft.js +0 -9
- package/dist/node_modules/@mui/material/internal/svg-icons/KeyboardArrowRight.js +0 -9
- package/dist/node_modules/@mui/material/internal/svg-icons/MoreHoriz.js +0 -9
- package/dist/node_modules/@mui/material/internal/svg-icons/Person.js +0 -9
- package/dist/node_modules/@mui/material/internal/svg-icons/RadioButtonChecked.js +0 -9
- package/dist/node_modules/@mui/material/internal/svg-icons/RadioButtonUnchecked.js +0 -9
- package/dist/node_modules/@mui/material/internal/svg-icons/ReportProblemOutlined.js +0 -9
- package/dist/node_modules/@mui/material/internal/svg-icons/SuccessOutlined.js +0 -9
- package/dist/node_modules/@mui/material/internal/svg-icons/Warning.js +0 -9
- package/dist/node_modules/@mui/material/internal/switchBaseClasses.js +0 -9
- package/dist/node_modules/@mui/material/node_modules/@mui/utils/esm/ClassNameGenerator/ClassNameGenerator.js +0 -19
- package/dist/node_modules/@mui/material/node_modules/@mui/utils/esm/HTMLElementType/HTMLElementType.js +0 -17
- package/dist/node_modules/@mui/material/node_modules/@mui/utils/esm/appendOwnerState/appendOwnerState.js +0 -13
- package/dist/node_modules/@mui/material/node_modules/@mui/utils/esm/capitalize/capitalize.js +0 -10
- package/dist/node_modules/@mui/material/node_modules/@mui/utils/esm/chainPropTypes/chainPropTypes.js +0 -11
- package/dist/node_modules/@mui/material/node_modules/@mui/utils/esm/clamp/clamp.js +0 -6
- package/dist/node_modules/@mui/material/node_modules/@mui/utils/esm/composeClasses/composeClasses.js +0 -25
- package/dist/node_modules/@mui/material/node_modules/@mui/utils/esm/createChainedFunction/createChainedFunction.js +0 -15
- package/dist/node_modules/@mui/material/node_modules/@mui/utils/esm/debounce/debounce.js +0 -17
- package/dist/node_modules/@mui/material/node_modules/@mui/utils/esm/deepmerge/deepmerge.js +0 -43
- package/dist/node_modules/@mui/material/node_modules/@mui/utils/esm/deprecatedPropType/deprecatedPropType.js +0 -16
- package/dist/node_modules/@mui/material/node_modules/@mui/utils/esm/elementAcceptingRef/elementAcceptingRef.js +0 -33
- package/dist/node_modules/@mui/material/node_modules/@mui/utils/esm/elementTypeAcceptingRef/elementTypeAcceptingRef.js +0 -31
- package/dist/node_modules/@mui/material/node_modules/@mui/utils/esm/exactProp/exactProp.js +0 -19
- package/dist/node_modules/@mui/material/node_modules/@mui/utils/esm/extractEventHandlers/extractEventHandlers.js +0 -13
- package/dist/node_modules/@mui/material/node_modules/@mui/utils/esm/formatMuiErrorMessage/formatMuiErrorMessage.js +0 -10
- package/dist/node_modules/@mui/material/node_modules/@mui/utils/esm/generateUtilityClass/generateUtilityClass.js +0 -23
- package/dist/node_modules/@mui/material/node_modules/@mui/utils/esm/generateUtilityClasses/generateUtilityClasses.js +0 -11
- package/dist/node_modules/@mui/material/node_modules/@mui/utils/esm/getReactElementRef/getReactElementRef.js +0 -11
- package/dist/node_modules/@mui/material/node_modules/@mui/utils/esm/getScrollbarSize/getScrollbarSize.js +0 -7
- package/dist/node_modules/@mui/material/node_modules/@mui/utils/esm/getValidReactChildren/getValidReactChildren.js +0 -7
- package/dist/node_modules/@mui/material/node_modules/@mui/utils/esm/integerPropType/integerPropType.js +0 -52
- package/dist/node_modules/@mui/material/node_modules/@mui/utils/esm/isHostComponent/isHostComponent.js +0 -6
- package/dist/node_modules/@mui/material/node_modules/@mui/utils/esm/isMuiElement/isMuiElement.js +0 -13
- package/dist/node_modules/@mui/material/node_modules/@mui/utils/esm/mergeSlotProps/mergeSlotProps.js +0 -48
- package/dist/node_modules/@mui/material/node_modules/@mui/utils/esm/omitEventHandlers/omitEventHandlers.js +0 -13
- package/dist/node_modules/@mui/material/node_modules/@mui/utils/esm/ownerDocument/ownerDocument.js +0 -6
- package/dist/node_modules/@mui/material/node_modules/@mui/utils/esm/ownerWindow/ownerWindow.js +0 -8
- package/dist/node_modules/@mui/material/node_modules/@mui/utils/esm/refType/refType.js +0 -5
- package/dist/node_modules/@mui/material/node_modules/@mui/utils/esm/requirePropFactory/requirePropFactory.js +0 -25
- package/dist/node_modules/@mui/material/node_modules/@mui/utils/esm/resolveComponentProps/resolveComponentProps.js +0 -9
- package/dist/node_modules/@mui/material/node_modules/@mui/utils/esm/resolveProps/resolveProps.js +0 -29
- package/dist/node_modules/@mui/material/node_modules/@mui/utils/esm/scrollLeft/scrollLeft.js +0 -49
- package/dist/node_modules/@mui/material/node_modules/@mui/utils/esm/setRef/setRef.js +0 -10
- package/dist/node_modules/@mui/material/node_modules/@mui/utils/esm/unsupportedProp/unsupportedProp.js +0 -13
- package/dist/node_modules/@mui/material/node_modules/@mui/utils/esm/useControlled/useControlled.js +0 -37
- package/dist/node_modules/@mui/material/node_modules/@mui/utils/esm/useEnhancedEffect/useEnhancedEffect.js +0 -5
- package/dist/node_modules/@mui/material/node_modules/@mui/utils/esm/useEventCallback/useEventCallback.js +0 -15
- package/dist/node_modules/@mui/material/node_modules/@mui/utils/esm/useForkRef/useForkRef.js +0 -17
- package/dist/node_modules/@mui/material/node_modules/@mui/utils/esm/useId/useId.js +0 -24
- package/dist/node_modules/@mui/material/node_modules/@mui/utils/esm/useIsFocusVisible/useIsFocusVisible.js +0 -104
- package/dist/node_modules/@mui/material/node_modules/@mui/utils/esm/useLazyRef/useLazyRef.js +0 -12
- package/dist/node_modules/@mui/material/node_modules/@mui/utils/esm/useOnMount/useOnMount.js +0 -8
- package/dist/node_modules/@mui/material/node_modules/@mui/utils/esm/usePreviousProps/usePreviousProps.js +0 -11
- package/dist/node_modules/@mui/material/node_modules/@mui/utils/esm/useSlotProps/useSlotProps.js +0 -31
- package/dist/node_modules/@mui/material/node_modules/@mui/utils/esm/useTimeout/useTimeout.js +0 -38
- package/dist/node_modules/@mui/material/node_modules/@mui/utils/esm/visuallyHidden/visuallyHidden.js +0 -14
- package/dist/node_modules/@mui/material/styles/createMixins.js +0 -19
- package/dist/node_modules/@mui/material/styles/createPalette.js +0 -305
- package/dist/node_modules/@mui/material/styles/createTheme.js +0 -79
- package/dist/node_modules/@mui/material/styles/createTransitions.js +0 -83
- package/dist/node_modules/@mui/material/styles/createTypography.js +0 -87
- package/dist/node_modules/@mui/material/styles/cssUtils.js +0 -10
- package/dist/node_modules/@mui/material/styles/defaultTheme.js +0 -5
- package/dist/node_modules/@mui/material/styles/getOverlayAlpha.js +0 -12
- package/dist/node_modules/@mui/material/styles/identifier.js +0 -4
- package/dist/node_modules/@mui/material/styles/rootShouldForwardProp.js +0 -5
- package/dist/node_modules/@mui/material/styles/shadows.js +0 -10
- package/dist/node_modules/@mui/material/styles/slotShouldForwardProp.js +0 -6
- package/dist/node_modules/@mui/material/styles/styled.js +0 -13
- package/dist/node_modules/@mui/material/styles/useTheme.js +0 -14
- package/dist/node_modules/@mui/material/styles/zIndex.js +0 -13
- package/dist/node_modules/@mui/material/transitions/utils.js +0 -18
- package/dist/node_modules/@mui/material/utils/areArraysEqual.js +0 -6
- package/dist/node_modules/@mui/material/utils/capitalize.js +0 -4
- package/dist/node_modules/@mui/material/utils/createChainedFunction.js +0 -4
- package/dist/node_modules/@mui/material/utils/createSvgIcon.js +0 -22
- package/dist/node_modules/@mui/material/utils/debounce.js +0 -4
- package/dist/node_modules/@mui/material/utils/deprecatedPropType.js +0 -4
- package/dist/node_modules/@mui/material/utils/getScrollbarSize.js +0 -4
- package/dist/node_modules/@mui/material/utils/index.js +0 -46
- package/dist/node_modules/@mui/material/utils/isMuiElement.js +0 -4
- package/dist/node_modules/@mui/material/utils/ownerDocument.js +0 -4
- package/dist/node_modules/@mui/material/utils/ownerWindow.js +0 -4
- package/dist/node_modules/@mui/material/utils/requirePropFactory.js +0 -4
- package/dist/node_modules/@mui/material/utils/setRef.js +0 -4
- package/dist/node_modules/@mui/material/utils/shouldSpreadAdditionalProps.js +0 -7
- package/dist/node_modules/@mui/material/utils/unsupportedProp.js +0 -4
- package/dist/node_modules/@mui/material/utils/useControlled.js +0 -4
- package/dist/node_modules/@mui/material/utils/useEnhancedEffect.js +0 -4
- package/dist/node_modules/@mui/material/utils/useEventCallback.js +0 -4
- package/dist/node_modules/@mui/material/utils/useForkRef.js +0 -4
- package/dist/node_modules/@mui/material/utils/useId.js +0 -4
- package/dist/node_modules/@mui/material/utils/useIsFocusVisible.js +0 -4
- package/dist/node_modules/@mui/material/utils/useSlot.js +0 -55
- package/dist/node_modules/@mui/styled-engine/GlobalStyles/GlobalStyles.js +0 -24
- package/dist/node_modules/@mui/styled-engine/StyledEngineProvider/StyledEngineProvider.js +0 -65
- package/dist/node_modules/@mui/styled-engine/index.js +0 -48
- package/dist/node_modules/@mui/system/colorManipulator.js +0 -271
- package/dist/node_modules/@mui/system/createStyled.js +0 -265
- package/dist/node_modules/@mui/system/esm/DefaultPropsProvider/DefaultPropsProvider.js +0 -53
- package/dist/node_modules/@mui/system/esm/GlobalStyles/GlobalStyles.js +0 -61
- package/dist/node_modules/@mui/system/esm/RtlProvider/index.js +0 -15
- package/dist/node_modules/@mui/system/esm/Stack/createStack.js +0 -167
- package/dist/node_modules/@mui/system/esm/borders.js +0 -61
- package/dist/node_modules/@mui/system/esm/breakpoints.js +0 -122
- package/dist/node_modules/@mui/system/esm/colorManipulator.js +0 -96
- package/dist/node_modules/@mui/system/esm/compose.js +0 -23
- package/dist/node_modules/@mui/system/esm/createBox.js +0 -38
- package/dist/node_modules/@mui/system/esm/createStyled.js +0 -231
- package/dist/node_modules/@mui/system/esm/createTheme/applyStyles.js +0 -16
- package/dist/node_modules/@mui/system/esm/createTheme/createBreakpoints.js +0 -78
- package/dist/node_modules/@mui/system/esm/createTheme/createSpacing.js +0 -26
- package/dist/node_modules/@mui/system/esm/createTheme/createTheme.js +0 -44
- package/dist/node_modules/@mui/system/esm/createTheme/index.js +0 -8
- package/dist/node_modules/@mui/system/esm/createTheme/shape.js +0 -6
- package/dist/node_modules/@mui/system/esm/cssGrid.js +0 -89
- package/dist/node_modules/@mui/system/esm/memoize.js +0 -12
- package/dist/node_modules/@mui/system/esm/merge.js +0 -13
- package/dist/node_modules/@mui/system/esm/palette.js +0 -31
- package/dist/node_modules/@mui/system/esm/responsivePropType.js +0 -5
- package/dist/node_modules/@mui/system/esm/sizing.js +0 -74
- package/dist/node_modules/@mui/system/esm/spacing.js +0 -144
- package/dist/node_modules/@mui/system/esm/style.js +0 -73
- package/dist/node_modules/@mui/system/esm/styleFunctionSx/defaultSxConfig.js +0 -293
- package/dist/node_modules/@mui/system/esm/styleFunctionSx/extendSxProp.js +0 -50
- package/dist/node_modules/@mui/system/esm/styleFunctionSx/index.js +0 -9
- package/dist/node_modules/@mui/system/esm/styleFunctionSx/styleFunctionSx.js +0 -125
- package/dist/node_modules/@mui/system/esm/styled.js +0 -5
- package/dist/node_modules/@mui/system/esm/useTheme.js +0 -10
- package/dist/node_modules/@mui/system/esm/useThemeProps/getThemeProps.js +0 -15
- package/dist/node_modules/@mui/system/esm/useThemeProps/useThemeProps.js +0 -22
- package/dist/node_modules/@mui/system/esm/useThemeWithoutDefault.js +0 -12
- package/dist/node_modules/@mui/system/node_modules/@mui/utils/esm/ClassNameGenerator/ClassNameGenerator.js +0 -19
- package/dist/node_modules/@mui/system/node_modules/@mui/utils/esm/capitalize/capitalize.js +0 -10
- package/dist/node_modules/@mui/system/node_modules/@mui/utils/esm/capitalize/index.js +0 -4
- package/dist/node_modules/@mui/system/node_modules/@mui/utils/esm/clamp/clamp.js +0 -6
- package/dist/node_modules/@mui/system/node_modules/@mui/utils/esm/clamp/index.js +0 -4
- package/dist/node_modules/@mui/system/node_modules/@mui/utils/esm/composeClasses/composeClasses.js +0 -25
- package/dist/node_modules/@mui/system/node_modules/@mui/utils/esm/deepmerge/deepmerge.js +0 -43
- package/dist/node_modules/@mui/system/node_modules/@mui/utils/esm/deepmerge/index.js +0 -5
- package/dist/node_modules/@mui/system/node_modules/@mui/utils/esm/formatMuiErrorMessage/formatMuiErrorMessage.js +0 -10
- package/dist/node_modules/@mui/system/node_modules/@mui/utils/esm/formatMuiErrorMessage/index.js +0 -4
- package/dist/node_modules/@mui/system/node_modules/@mui/utils/esm/generateUtilityClass/generateUtilityClass.js +0 -23
- package/dist/node_modules/@mui/system/node_modules/@mui/utils/esm/getDisplayName/getDisplayName.js +0 -40
- package/dist/node_modules/@mui/system/node_modules/@mui/utils/esm/getDisplayName/index.js +0 -5
- package/dist/node_modules/@mui/system/node_modules/@mui/utils/esm/resolveProps/resolveProps.js +0 -29
- package/dist/node_modules/@mui/system/useThemeWithoutDefault.js +0 -39
- package/dist/node_modules/@mui/utils/esm/debounce/debounce.js +0 -17
- package/dist/node_modules/@mui/utils/esm/ownerDocument/ownerDocument.js +0 -6
- package/dist/node_modules/@mui/utils/esm/ownerWindow/ownerWindow.js +0 -8
- package/dist/node_modules/@mui/utils/esm/useEnhancedEffect/useEnhancedEffect.js +0 -5
- package/dist/node_modules/@mui/utils/esm/useForkRef/useForkRef.js +0 -42
- package/dist/node_modules/@popperjs/core/lib/createPopper.js +0 -149
- package/dist/node_modules/@popperjs/core/lib/dom-utils/contains.js +0 -19
- package/dist/node_modules/@popperjs/core/lib/dom-utils/getBoundingClientRect.js +0 -38
- package/dist/node_modules/@popperjs/core/lib/dom-utils/getClippingRect.js +0 -61
- package/dist/node_modules/@popperjs/core/lib/dom-utils/getCompositeRect.js +0 -53
- package/dist/node_modules/@popperjs/core/lib/dom-utils/getComputedStyle.js +0 -7
- package/dist/node_modules/@popperjs/core/lib/dom-utils/getDocumentElement.js +0 -10
- package/dist/node_modules/@popperjs/core/lib/dom-utils/getDocumentRect.js +0 -27
- package/dist/node_modules/@popperjs/core/lib/dom-utils/getHTMLElementScroll.js +0 -9
- package/dist/node_modules/@popperjs/core/lib/dom-utils/getLayoutRect.js +0 -21
- package/dist/node_modules/@popperjs/core/lib/dom-utils/getNodeName.js +0 -6
- package/dist/node_modules/@popperjs/core/lib/dom-utils/getNodeScroll.js +0 -14
- package/dist/node_modules/@popperjs/core/lib/dom-utils/getOffsetParent.js +0 -51
- package/dist/node_modules/@popperjs/core/lib/dom-utils/getParentNode.js +0 -21
- package/dist/node_modules/@popperjs/core/lib/dom-utils/getScrollParent.js +0 -16
- package/dist/node_modules/@popperjs/core/lib/dom-utils/getViewportRect.js +0 -31
- package/dist/node_modules/@popperjs/core/lib/dom-utils/getWindow.js +0 -13
- package/dist/node_modules/@popperjs/core/lib/dom-utils/getWindowScroll.js +0 -13
- package/dist/node_modules/@popperjs/core/lib/dom-utils/getWindowScrollBarX.js +0 -9
- package/dist/node_modules/@popperjs/core/lib/dom-utils/instanceOf.js +0 -21
- package/dist/node_modules/@popperjs/core/lib/dom-utils/isLayoutViewport.js +0 -7
- package/dist/node_modules/@popperjs/core/lib/dom-utils/isScrollParent.js +0 -8
- package/dist/node_modules/@popperjs/core/lib/dom-utils/isTableElement.js +0 -7
- package/dist/node_modules/@popperjs/core/lib/dom-utils/listScrollParents.js +0 -22
- package/dist/node_modules/@popperjs/core/lib/enums.js +0 -54
- package/dist/node_modules/@popperjs/core/lib/modifiers/applyStyles.js +0 -71
- package/dist/node_modules/@popperjs/core/lib/modifiers/arrow.js +0 -72
- package/dist/node_modules/@popperjs/core/lib/modifiers/computeStyles.js +0 -131
- package/dist/node_modules/@popperjs/core/lib/modifiers/eventListeners.js +0 -40
- package/dist/node_modules/@popperjs/core/lib/modifiers/flip.js +0 -113
- package/dist/node_modules/@popperjs/core/lib/modifiers/hide.js +0 -57
- package/dist/node_modules/@popperjs/core/lib/modifiers/offset.js +0 -43
- package/dist/node_modules/@popperjs/core/lib/modifiers/popperOffsets.js +0 -19
- package/dist/node_modules/@popperjs/core/lib/modifiers/preventOverflow.js +0 -105
- package/dist/node_modules/@popperjs/core/lib/popper.js +0 -28
- package/dist/node_modules/@popperjs/core/lib/utils/computeAutoPlacement.js +0 -35
- package/dist/node_modules/@popperjs/core/lib/utils/computeOffsets.js +0 -59
- package/dist/node_modules/@popperjs/core/lib/utils/debounce.js +0 -17
- package/dist/node_modules/@popperjs/core/lib/utils/detectOverflow.js +0 -47
- package/dist/node_modules/@popperjs/core/lib/utils/expandToHashMap.js +0 -9
- package/dist/node_modules/@popperjs/core/lib/utils/getAltAxis.js +0 -6
- package/dist/node_modules/@popperjs/core/lib/utils/getBasePlacement.js +0 -6
- package/dist/node_modules/@popperjs/core/lib/utils/getFreshSideObject.js +0 -11
- package/dist/node_modules/@popperjs/core/lib/utils/getMainAxisFromPlacement.js +0 -6
- package/dist/node_modules/@popperjs/core/lib/utils/getOppositePlacement.js +0 -14
- package/dist/node_modules/@popperjs/core/lib/utils/getOppositeVariationPlacement.js +0 -12
- package/dist/node_modules/@popperjs/core/lib/utils/getVariation.js +0 -6
- package/dist/node_modules/@popperjs/core/lib/utils/math.js +0 -8
- package/dist/node_modules/@popperjs/core/lib/utils/mergeByName.js +0 -16
- package/dist/node_modules/@popperjs/core/lib/utils/mergePaddingObject.js +0 -7
- package/dist/node_modules/@popperjs/core/lib/utils/orderModifiers.js +0 -39
- package/dist/node_modules/@popperjs/core/lib/utils/rectToClientRect.js +0 -11
- package/dist/node_modules/@popperjs/core/lib/utils/userAgent.js +0 -12
- package/dist/node_modules/@popperjs/core/lib/utils/within.js +0 -12
- package/dist/node_modules/@remix-run/router/dist/router.js +0 -400
- package/dist/node_modules/@tiptap/core/dist/index.js +0 -4252
- package/dist/node_modules/@tiptap/extension-blockquote/dist/index.js +0 -52
- package/dist/node_modules/@tiptap/extension-bold/dist/index.js +0 -86
- package/dist/node_modules/@tiptap/extension-bullet-list/dist/index.js +0 -68
- package/dist/node_modules/@tiptap/extension-code/dist/index.js +0 -62
- package/dist/node_modules/@tiptap/extension-code-block/dist/index.js +0 -196
- package/dist/node_modules/@tiptap/extension-document/dist/index.js +0 -10
- package/dist/node_modules/@tiptap/extension-dropcursor/dist/index.js +0 -21
- package/dist/node_modules/@tiptap/extension-gapcursor/dist/index.js +0 -25
- package/dist/node_modules/@tiptap/extension-hard-break/dist/index.js +0 -60
- package/dist/node_modules/@tiptap/extension-heading/dist/index.js +0 -71
- package/dist/node_modules/@tiptap/extension-highlight/dist/index.js +0 -82
- package/dist/node_modules/@tiptap/extension-history/dist/index.js +0 -40
- package/dist/node_modules/@tiptap/extension-horizontal-rule/dist/index.js +0 -79
- package/dist/node_modules/@tiptap/extension-image/dist/index.js +0 -69
- package/dist/node_modules/@tiptap/extension-italic/dist/index.js +0 -85
- package/dist/node_modules/@tiptap/extension-link/dist/index.js +0 -360
- package/dist/node_modules/@tiptap/extension-list-item/dist/index.js +0 -34
- package/dist/node_modules/@tiptap/extension-mention/dist/index.js +0 -213
- package/dist/node_modules/@tiptap/extension-ordered-list/dist/index.js +0 -86
- package/dist/node_modules/@tiptap/extension-paragraph/dist/index.js +0 -36
- package/dist/node_modules/@tiptap/extension-placeholder/dist/index.js +0 -60
- package/dist/node_modules/@tiptap/extension-strike/dist/index.js +0 -72
- package/dist/node_modules/@tiptap/extension-text/dist/index.js +0 -9
- package/dist/node_modules/@tiptap/react/dist/index.js +0 -1077
- package/dist/node_modules/@tiptap/starter-kit/dist/index.js +0 -84
- package/dist/node_modules/@tiptap/suggestion/dist/index.js +0 -224
- package/dist/node_modules/array.prototype.flat/implementation.js +0 -33
- package/dist/node_modules/array.prototype.flat/index.js +0 -28
- package/dist/node_modules/array.prototype.flat/polyfill.js +0 -15
- package/dist/node_modules/array.prototype.flat/shim.js +0 -28
- package/dist/node_modules/call-bind/index.js +0 -34
- package/dist/node_modules/call-bind-apply-helpers/actualApply.js +0 -19
- package/dist/node_modules/call-bind-apply-helpers/applyBind.js +0 -19
- package/dist/node_modules/call-bind-apply-helpers/functionApply.js +0 -11
- package/dist/node_modules/call-bind-apply-helpers/functionCall.js +0 -11
- package/dist/node_modules/call-bind-apply-helpers/index.js +0 -24
- package/dist/node_modules/call-bind-apply-helpers/reflectApply.js +0 -11
- package/dist/node_modules/call-bound/index.js +0 -28
- package/dist/node_modules/clsx/dist/clsx.js +0 -17
- package/dist/node_modules/define-data-property/index.js +0 -55
- package/dist/node_modules/define-properties/index.js +0 -50
- package/dist/node_modules/dompurify/dist/purify.es.js +0 -1012
- package/dist/node_modules/dunder-proto/get.js +0 -36
- package/dist/node_modules/dunder-proto/set.js +0 -40
- package/dist/node_modules/emoji-picker-react/dist/emoji-picker-react.esm.js +0 -25708
- package/dist/node_modules/es-abstract/2024/ArrayCreate.js +0 -45
- package/dist/node_modules/es-abstract/2024/ArraySpeciesCreate.js +0 -50
- package/dist/node_modules/es-abstract/2024/Call.js +0 -26
- package/dist/node_modules/es-abstract/2024/CreateDataProperty.js +0 -33
- package/dist/node_modules/es-abstract/2024/CreateDataPropertyOrThrow.js +0 -30
- package/dist/node_modules/es-abstract/2024/DefinePropertyOrThrow.js +0 -48
- package/dist/node_modules/es-abstract/2024/FlattenIntoArray.js +0 -65
- package/dist/node_modules/es-abstract/2024/FromPropertyDescriptor.js +0 -22
- package/dist/node_modules/es-abstract/2024/Get.js +0 -27
- package/dist/node_modules/es-abstract/2024/HasProperty.js +0 -25
- package/dist/node_modules/es-abstract/2024/IsAccessorDescriptor.js +0 -28
- package/dist/node_modules/es-abstract/2024/IsArray.js +0 -12
- package/dist/node_modules/es-abstract/2024/IsCallable.js +0 -12
- package/dist/node_modules/es-abstract/2024/IsConstructor.js +0 -42
- package/dist/node_modules/es-abstract/2024/IsDataDescriptor.js +0 -28
- package/dist/node_modules/es-abstract/2024/IsExtensible.js +0 -21
- package/dist/node_modules/es-abstract/2024/IsGenericDescriptor.js +0 -30
- package/dist/node_modules/es-abstract/2024/LengthOfArrayLike.js +0 -24
- package/dist/node_modules/es-abstract/2024/OrdinaryDefineOwnProperty.js +0 -59
- package/dist/node_modules/es-abstract/2024/SameValue.js +0 -21
- package/dist/node_modules/es-abstract/2024/StringToNumber.js +0 -48
- package/dist/node_modules/es-abstract/2024/ToBoolean.js +0 -13
- package/dist/node_modules/es-abstract/2024/ToIntegerOrInfinity.js +0 -28
- package/dist/node_modules/es-abstract/2024/ToLength.js +0 -24
- package/dist/node_modules/es-abstract/2024/ToNumber.js +0 -34
- package/dist/node_modules/es-abstract/2024/ToObject.js +0 -12
- package/dist/node_modules/es-abstract/2024/ToPrimitive.js +0 -18
- package/dist/node_modules/es-abstract/2024/ToPropertyDescriptor.js +0 -56
- package/dist/node_modules/es-abstract/2024/ToString.js +0 -21
- package/dist/node_modules/es-abstract/2024/ValidateAndApplyPropertyDescriptor.js +0 -161
- package/dist/node_modules/es-abstract/2024/floor.js +0 -18
- package/dist/node_modules/es-abstract/2024/truncate.js +0 -21
- package/dist/node_modules/es-abstract/GetIntrinsic.js +0 -12
- package/dist/node_modules/es-abstract/helpers/DefineOwnProperty.js +0 -42
- package/dist/node_modules/es-abstract/helpers/IsArray.js +0 -18
- package/dist/node_modules/es-abstract/helpers/fromPropertyDescriptor.js +0 -35
- package/dist/node_modules/es-abstract/helpers/isFullyPopulatedPropertyDescriptor.js +0 -15
- package/dist/node_modules/es-abstract/helpers/isPrimitive.js +0 -13
- package/dist/node_modules/es-abstract/helpers/isPropertyKey.js +0 -13
- package/dist/node_modules/es-abstract/helpers/records/property-descriptor.js +0 -39
- package/dist/node_modules/es-define-property/index.js +0 -19
- package/dist/node_modules/es-errors/eval.js +0 -11
- package/dist/node_modules/es-errors/index.js +0 -11
- package/dist/node_modules/es-errors/range.js +0 -11
- package/dist/node_modules/es-errors/ref.js +0 -11
- package/dist/node_modules/es-errors/syntax.js +0 -11
- package/dist/node_modules/es-errors/type.js +0 -11
- package/dist/node_modules/es-errors/uri.js +0 -11
- package/dist/node_modules/es-object-atoms/RequireObjectCoercible.js +0 -18
- package/dist/node_modules/es-object-atoms/ToObject.js +0 -18
- package/dist/node_modules/es-object-atoms/index.js +0 -11
- package/dist/node_modules/es-object-atoms/isObject.js +0 -13
- package/dist/node_modules/es-shim-unscopables/index.js +0 -26
- package/dist/node_modules/es-to-primitive/es2015.js +0 -89
- package/dist/node_modules/es-to-primitive/helpers/isPrimitive.js +0 -13
- package/dist/node_modules/flairup/dist/esm/index.js +0 -334
- package/dist/node_modules/function-bind/implementation.js +0 -79
- package/dist/node_modules/function-bind/index.js +0 -13
- package/dist/node_modules/get-intrinsic/index.js +0 -358
- package/dist/node_modules/get-proto/Object.getPrototypeOf.js +0 -13
- package/dist/node_modules/get-proto/Reflect.getPrototypeOf.js +0 -11
- package/dist/node_modules/get-proto/index.js +0 -26
- package/dist/node_modules/global-cache/index.js +0 -85
- package/dist/node_modules/gopd/gOPD.js +0 -11
- package/dist/node_modules/gopd/index.js +0 -20
- package/dist/node_modules/has-property-descriptors/index.js +0 -26
- package/dist/node_modules/has-symbols/index.js +0 -28
- package/dist/node_modules/has-symbols/shams.js +0 -58
- package/dist/node_modules/has-tostringtag/shams.js +0 -15
- package/dist/node_modules/hasown/index.js +0 -15
- package/dist/node_modules/highcharts/highcharts-3d.js +0 -768
- package/dist/node_modules/highcharts/highcharts-more.js +0 -1814
- package/dist/node_modules/highcharts/highcharts.js +0 -5153
- package/dist/node_modules/highcharts/modules/heatmap.js +0 -416
- package/dist/node_modules/highcharts/modules/stock.js +0 -2095
- package/dist/node_modules/highcharts/modules/treemap.js +0 -558
- package/dist/node_modules/highcharts/modules/venn.js +0 -434
- package/dist/node_modules/highcharts-border-radius/index.js +0 -92
- package/dist/node_modules/highcharts-react-official/dist/highcharts-react.min.js +0 -106
- package/dist/node_modules/hoist-non-react-statics/dist/hoist-non-react-statics.cjs.js +0 -20
- package/dist/node_modules/hoist-non-react-statics/node_modules/react-is/cjs/react-is.development.js +0 -165
- package/dist/node_modules/hoist-non-react-statics/node_modules/react-is/cjs/react-is.production.min.js +0 -106
- package/dist/node_modules/hoist-non-react-statics/node_modules/react-is/index.js +0 -12
- package/dist/node_modules/is-callable/index.js +0 -120
- package/dist/node_modules/is-date-object/index.js +0 -31
- package/dist/node_modules/is-regex/index.js +0 -70
- package/dist/node_modules/is-symbol/index.js +0 -44
- package/dist/node_modules/linkifyjs/dist/linkify.js +0 -1158
- package/dist/node_modules/math-intrinsics/abs.js +0 -11
- package/dist/node_modules/math-intrinsics/constants/maxArrayLength.js +0 -11
- package/dist/node_modules/math-intrinsics/constants/maxSafeInteger.js +0 -12
- package/dist/node_modules/math-intrinsics/floor.js +0 -11
- package/dist/node_modules/math-intrinsics/isFinite.js +0 -15
- package/dist/node_modules/math-intrinsics/isInteger.js +0 -25
- package/dist/node_modules/math-intrinsics/isNaN.js +0 -13
- package/dist/node_modules/math-intrinsics/max.js +0 -11
- package/dist/node_modules/math-intrinsics/min.js +0 -11
- package/dist/node_modules/math-intrinsics/pow.js +0 -11
- package/dist/node_modules/math-intrinsics/round.js +0 -11
- package/dist/node_modules/math-intrinsics/sign.js +0 -18
- package/dist/node_modules/memoize-one/dist/memoize-one.esm.js +0 -52
- package/dist/node_modules/object-assign/index.js +0 -78
- package/dist/node_modules/object-inspect/index.js +0 -537
- package/dist/node_modules/object-keys/implementation.js +0 -125
- package/dist/node_modules/object-keys/index.js +0 -39
- package/dist/node_modules/object-keys/isArguments.js +0 -19
- package/dist/node_modules/orderedmap/dist/index.js +0 -119
- package/dist/node_modules/prop-types/checkPropTypes.js +0 -68
- package/dist/node_modules/prop-types/factoryWithThrowingShims.js +0 -58
- package/dist/node_modules/prop-types/factoryWithTypeCheckers.js +0 -451
- package/dist/node_modules/prop-types/index.js +0 -17
- package/dist/node_modules/prop-types/lib/ReactPropTypesSecret.js +0 -12
- package/dist/node_modules/prop-types/lib/has.js +0 -11
- package/dist/node_modules/prop-types/node_modules/react-is/cjs/react-is.development.js +0 -165
- package/dist/node_modules/prop-types/node_modules/react-is/cjs/react-is.production.min.js +0 -106
- package/dist/node_modules/prop-types/node_modules/react-is/index.js +0 -17
- package/dist/node_modules/prosemirror-commands/dist/index.js +0 -526
- package/dist/node_modules/prosemirror-dropcursor/dist/index.js +0 -136
- package/dist/node_modules/prosemirror-gapcursor/dist/index.js +0 -220
- package/dist/node_modules/prosemirror-history/dist/index.js +0 -356
- package/dist/node_modules/prosemirror-keymap/dist/index.js +0 -83
- package/dist/node_modules/prosemirror-model/dist/index.js +0 -3208
- package/dist/node_modules/prosemirror-schema-list/dist/index.js +0 -130
- package/dist/node_modules/prosemirror-state/dist/index.js +0 -935
- package/dist/node_modules/prosemirror-transform/dist/index.js +0 -1861
- package/dist/node_modules/prosemirror-view/dist/index.js +0 -5223
- package/dist/node_modules/react-hook-form/dist/index.esm.js +0 -2089
- package/dist/node_modules/react-is/cjs/react-is.development.js +0 -105
- package/dist/node_modules/react-is/cjs/react-is.production.js +0 -103
- package/dist/node_modules/react-is/index.js +0 -12
- package/dist/node_modules/react-router/dist/index.js +0 -375
- package/dist/node_modules/react-router-dom/dist/index.js +0 -521
- package/dist/node_modules/react-select/dist/Select-ef7c0426.esm.js +0 -2317
- package/dist/node_modules/react-select/dist/index-641ee5b8.esm.js +0 -1071
- package/dist/node_modules/react-select/dist/react-select.esm.js +0 -20
- package/dist/node_modules/react-select/dist/useStateManager-7e1e8489.esm.js +0 -51
- package/dist/node_modules/react-textarea-autosize/dist/react-textarea-autosize.browser.esm.js +0 -213
- package/dist/node_modules/react-transition-group/esm/Transition.js +0 -439
- package/dist/node_modules/react-transition-group/esm/TransitionGroup.js +0 -144
- package/dist/node_modules/react-transition-group/esm/TransitionGroupContext.js +0 -5
- package/dist/node_modules/react-transition-group/esm/config.js +0 -6
- package/dist/node_modules/react-transition-group/esm/utils/ChildMapping.js +0 -99
- package/dist/node_modules/react-transition-group/esm/utils/PropTypes.js +0 -21
- package/dist/node_modules/react-transition-group/esm/utils/reflow.js +0 -6
- package/dist/node_modules/react-window/dist/index.esm.js +0 -505
- package/dist/node_modules/react-window/node_modules/memoize-one/dist/memoize-one.esm.js +0 -50
- package/dist/node_modules/react-with-styles-interface-css/dist/index.js +0 -57
- package/dist/node_modules/react-with-styles-interface-css/dist/utils/constants.js +0 -18
- package/dist/node_modules/react-with-styles-interface-css/dist/utils/getClassName.js +0 -20
- package/dist/node_modules/react-with-styles-interface-css/dist/utils/separateStyles.js +0 -39
- package/dist/node_modules/react-with-styles-interface-css/index.js +0 -12
- package/dist/node_modules/rope-sequence/dist/index.js +0 -183
- package/dist/node_modules/safe-regex-test/index.js +0 -25
- package/dist/node_modules/set-function-length/index.js +0 -61
- package/dist/node_modules/set-proto/Object.setPrototypeOf.js +0 -13
- package/dist/node_modules/set-proto/Reflect.setPrototypeOf.js +0 -11
- package/dist/node_modules/set-proto/index.js +0 -27
- package/dist/node_modules/string.prototype.trim/implementation.js +0 -24
- package/dist/node_modules/string.prototype.trim/index.js +0 -33
- package/dist/node_modules/string.prototype.trim/polyfill.js +0 -20
- package/dist/node_modules/string.prototype.trim/shim.js +0 -27
- package/dist/node_modules/stylis/src/Enum.js +0 -20
- package/dist/node_modules/stylis/src/Middleware.js +0 -22
- package/dist/node_modules/stylis/src/Parser.js +0 -140
- package/dist/node_modules/stylis/src/Serializer.js +0 -29
- package/dist/node_modules/stylis/src/Tokenizer.js +0 -150
- package/dist/node_modules/stylis/src/Utility.js +0 -52
- package/dist/node_modules/tippy.js/dist/tippy.esm.js +0 -1283
- package/dist/node_modules/use-composed-ref/dist/use-composed-ref.esm.js +0 -25
- package/dist/node_modules/use-isomorphic-layout-effect/dist/use-isomorphic-layout-effect.browser.esm.js +0 -5
- package/dist/node_modules/use-latest/dist/use-latest.esm.js +0 -12
- package/dist/node_modules/w3c-keyname/index.js +0 -105
- package/dist/stats.html +0 -4950
|
@@ -1,4252 +0,0 @@
|
|
|
1
|
-
import { EditorState, NodeSelection, Plugin, PluginKey, Selection, TextSelection, AllSelection } from "../../../prosemirror-state/dist/index.js";
|
|
2
|
-
import { EditorView } from "../../../prosemirror-view/dist/index.js";
|
|
3
|
-
import { keymap } from "../../../prosemirror-keymap/dist/index.js";
|
|
4
|
-
import { DOMSerializer, Schema, Fragment, Node as Node$1, DOMParser, Slice } from "../../../prosemirror-model/dist/index.js";
|
|
5
|
-
import { findWrapping, canJoin, Transform, canSplit, joinPoint, liftTarget, ReplaceStep, ReplaceAroundStep } from "../../../prosemirror-transform/dist/index.js";
|
|
6
|
-
import { wrapIn as wrapIn$1, setBlockType, selectTextblockStart as selectTextblockStart$1, selectTextblockEnd as selectTextblockEnd$1, selectParentNode as selectParentNode$1, selectNodeForward as selectNodeForward$1, selectNodeBackward as selectNodeBackward$1, newlineInCode as newlineInCode$1, liftEmptyBlock as liftEmptyBlock$1, lift as lift$1, joinUp as joinUp$1, joinTextblockForward as joinTextblockForward$1, joinTextblockBackward as joinTextblockBackward$1, joinForward as joinForward$1, joinDown as joinDown$1, joinBackward as joinBackward$1, exitCode as exitCode$1, deleteSelection as deleteSelection$1, createParagraphNear as createParagraphNear$1 } from "../../../prosemirror-commands/dist/index.js";
|
|
7
|
-
import { wrapInList as wrapInList$1, sinkListItem as sinkListItem$1, liftListItem as liftListItem$1 } from "../../../prosemirror-schema-list/dist/index.js";
|
|
8
|
-
function createChainableState(config) {
|
|
9
|
-
const { state, transaction } = config;
|
|
10
|
-
let { selection } = transaction;
|
|
11
|
-
let { doc } = transaction;
|
|
12
|
-
let { storedMarks } = transaction;
|
|
13
|
-
return {
|
|
14
|
-
...state,
|
|
15
|
-
apply: state.apply.bind(state),
|
|
16
|
-
applyTransaction: state.applyTransaction.bind(state),
|
|
17
|
-
plugins: state.plugins,
|
|
18
|
-
schema: state.schema,
|
|
19
|
-
reconfigure: state.reconfigure.bind(state),
|
|
20
|
-
toJSON: state.toJSON.bind(state),
|
|
21
|
-
get storedMarks() {
|
|
22
|
-
return storedMarks;
|
|
23
|
-
},
|
|
24
|
-
get selection() {
|
|
25
|
-
return selection;
|
|
26
|
-
},
|
|
27
|
-
get doc() {
|
|
28
|
-
return doc;
|
|
29
|
-
},
|
|
30
|
-
get tr() {
|
|
31
|
-
selection = transaction.selection;
|
|
32
|
-
doc = transaction.doc;
|
|
33
|
-
storedMarks = transaction.storedMarks;
|
|
34
|
-
return transaction;
|
|
35
|
-
}
|
|
36
|
-
};
|
|
37
|
-
}
|
|
38
|
-
class CommandManager {
|
|
39
|
-
constructor(props) {
|
|
40
|
-
this.editor = props.editor;
|
|
41
|
-
this.rawCommands = this.editor.extensionManager.commands;
|
|
42
|
-
this.customState = props.state;
|
|
43
|
-
}
|
|
44
|
-
get hasCustomState() {
|
|
45
|
-
return !!this.customState;
|
|
46
|
-
}
|
|
47
|
-
get state() {
|
|
48
|
-
return this.customState || this.editor.state;
|
|
49
|
-
}
|
|
50
|
-
get commands() {
|
|
51
|
-
const { rawCommands, editor, state } = this;
|
|
52
|
-
const { view } = editor;
|
|
53
|
-
const { tr } = state;
|
|
54
|
-
const props = this.buildProps(tr);
|
|
55
|
-
return Object.fromEntries(Object.entries(rawCommands).map(([name, command2]) => {
|
|
56
|
-
const method = (...args) => {
|
|
57
|
-
const callback = command2(...args)(props);
|
|
58
|
-
if (!tr.getMeta("preventDispatch") && !this.hasCustomState) {
|
|
59
|
-
view.dispatch(tr);
|
|
60
|
-
}
|
|
61
|
-
return callback;
|
|
62
|
-
};
|
|
63
|
-
return [name, method];
|
|
64
|
-
}));
|
|
65
|
-
}
|
|
66
|
-
get chain() {
|
|
67
|
-
return () => this.createChain();
|
|
68
|
-
}
|
|
69
|
-
get can() {
|
|
70
|
-
return () => this.createCan();
|
|
71
|
-
}
|
|
72
|
-
createChain(startTr, shouldDispatch = true) {
|
|
73
|
-
const { rawCommands, editor, state } = this;
|
|
74
|
-
const { view } = editor;
|
|
75
|
-
const callbacks = [];
|
|
76
|
-
const hasStartTransaction = !!startTr;
|
|
77
|
-
const tr = startTr || state.tr;
|
|
78
|
-
const run2 = () => {
|
|
79
|
-
if (!hasStartTransaction && shouldDispatch && !tr.getMeta("preventDispatch") && !this.hasCustomState) {
|
|
80
|
-
view.dispatch(tr);
|
|
81
|
-
}
|
|
82
|
-
return callbacks.every((callback) => callback === true);
|
|
83
|
-
};
|
|
84
|
-
const chain = {
|
|
85
|
-
...Object.fromEntries(Object.entries(rawCommands).map(([name, command2]) => {
|
|
86
|
-
const chainedCommand = (...args) => {
|
|
87
|
-
const props = this.buildProps(tr, shouldDispatch);
|
|
88
|
-
const callback = command2(...args)(props);
|
|
89
|
-
callbacks.push(callback);
|
|
90
|
-
return chain;
|
|
91
|
-
};
|
|
92
|
-
return [name, chainedCommand];
|
|
93
|
-
})),
|
|
94
|
-
run: run2
|
|
95
|
-
};
|
|
96
|
-
return chain;
|
|
97
|
-
}
|
|
98
|
-
createCan(startTr) {
|
|
99
|
-
const { rawCommands, state } = this;
|
|
100
|
-
const dispatch = false;
|
|
101
|
-
const tr = startTr || state.tr;
|
|
102
|
-
const props = this.buildProps(tr, dispatch);
|
|
103
|
-
const formattedCommands = Object.fromEntries(Object.entries(rawCommands).map(([name, command2]) => {
|
|
104
|
-
return [name, (...args) => command2(...args)({ ...props, dispatch: void 0 })];
|
|
105
|
-
}));
|
|
106
|
-
return {
|
|
107
|
-
...formattedCommands,
|
|
108
|
-
chain: () => this.createChain(tr, dispatch)
|
|
109
|
-
};
|
|
110
|
-
}
|
|
111
|
-
buildProps(tr, shouldDispatch = true) {
|
|
112
|
-
const { rawCommands, editor, state } = this;
|
|
113
|
-
const { view } = editor;
|
|
114
|
-
const props = {
|
|
115
|
-
tr,
|
|
116
|
-
editor,
|
|
117
|
-
view,
|
|
118
|
-
state: createChainableState({
|
|
119
|
-
state,
|
|
120
|
-
transaction: tr
|
|
121
|
-
}),
|
|
122
|
-
dispatch: shouldDispatch ? () => void 0 : void 0,
|
|
123
|
-
chain: () => this.createChain(tr, shouldDispatch),
|
|
124
|
-
can: () => this.createCan(tr),
|
|
125
|
-
get commands() {
|
|
126
|
-
return Object.fromEntries(Object.entries(rawCommands).map(([name, command2]) => {
|
|
127
|
-
return [name, (...args) => command2(...args)(props)];
|
|
128
|
-
}));
|
|
129
|
-
}
|
|
130
|
-
};
|
|
131
|
-
return props;
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
class EventEmitter {
|
|
135
|
-
constructor() {
|
|
136
|
-
this.callbacks = {};
|
|
137
|
-
}
|
|
138
|
-
on(event, fn) {
|
|
139
|
-
if (!this.callbacks[event]) {
|
|
140
|
-
this.callbacks[event] = [];
|
|
141
|
-
}
|
|
142
|
-
this.callbacks[event].push(fn);
|
|
143
|
-
return this;
|
|
144
|
-
}
|
|
145
|
-
emit(event, ...args) {
|
|
146
|
-
const callbacks = this.callbacks[event];
|
|
147
|
-
if (callbacks) {
|
|
148
|
-
callbacks.forEach((callback) => callback.apply(this, args));
|
|
149
|
-
}
|
|
150
|
-
return this;
|
|
151
|
-
}
|
|
152
|
-
off(event, fn) {
|
|
153
|
-
const callbacks = this.callbacks[event];
|
|
154
|
-
if (callbacks) {
|
|
155
|
-
if (fn) {
|
|
156
|
-
this.callbacks[event] = callbacks.filter((callback) => callback !== fn);
|
|
157
|
-
} else {
|
|
158
|
-
delete this.callbacks[event];
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
return this;
|
|
162
|
-
}
|
|
163
|
-
once(event, fn) {
|
|
164
|
-
const onceFn = (...args) => {
|
|
165
|
-
this.off(event, onceFn);
|
|
166
|
-
fn.apply(this, args);
|
|
167
|
-
};
|
|
168
|
-
return this.on(event, onceFn);
|
|
169
|
-
}
|
|
170
|
-
removeAllListeners() {
|
|
171
|
-
this.callbacks = {};
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
|
-
function getExtensionField(extension, field, context) {
|
|
175
|
-
if (extension.config[field] === void 0 && extension.parent) {
|
|
176
|
-
return getExtensionField(extension.parent, field, context);
|
|
177
|
-
}
|
|
178
|
-
if (typeof extension.config[field] === "function") {
|
|
179
|
-
const value = extension.config[field].bind({
|
|
180
|
-
...context,
|
|
181
|
-
parent: extension.parent ? getExtensionField(extension.parent, field, context) : null
|
|
182
|
-
});
|
|
183
|
-
return value;
|
|
184
|
-
}
|
|
185
|
-
return extension.config[field];
|
|
186
|
-
}
|
|
187
|
-
function splitExtensions(extensions) {
|
|
188
|
-
const baseExtensions = extensions.filter((extension) => extension.type === "extension");
|
|
189
|
-
const nodeExtensions = extensions.filter((extension) => extension.type === "node");
|
|
190
|
-
const markExtensions = extensions.filter((extension) => extension.type === "mark");
|
|
191
|
-
return {
|
|
192
|
-
baseExtensions,
|
|
193
|
-
nodeExtensions,
|
|
194
|
-
markExtensions
|
|
195
|
-
};
|
|
196
|
-
}
|
|
197
|
-
function getAttributesFromExtensions(extensions) {
|
|
198
|
-
const extensionAttributes = [];
|
|
199
|
-
const { nodeExtensions, markExtensions } = splitExtensions(extensions);
|
|
200
|
-
const nodeAndMarkExtensions = [...nodeExtensions, ...markExtensions];
|
|
201
|
-
const defaultAttribute = {
|
|
202
|
-
default: null,
|
|
203
|
-
rendered: true,
|
|
204
|
-
renderHTML: null,
|
|
205
|
-
parseHTML: null,
|
|
206
|
-
keepOnSplit: true,
|
|
207
|
-
isRequired: false
|
|
208
|
-
};
|
|
209
|
-
extensions.forEach((extension) => {
|
|
210
|
-
const context = {
|
|
211
|
-
name: extension.name,
|
|
212
|
-
options: extension.options,
|
|
213
|
-
storage: extension.storage,
|
|
214
|
-
extensions: nodeAndMarkExtensions
|
|
215
|
-
};
|
|
216
|
-
const addGlobalAttributes = getExtensionField(extension, "addGlobalAttributes", context);
|
|
217
|
-
if (!addGlobalAttributes) {
|
|
218
|
-
return;
|
|
219
|
-
}
|
|
220
|
-
const globalAttributes = addGlobalAttributes();
|
|
221
|
-
globalAttributes.forEach((globalAttribute) => {
|
|
222
|
-
globalAttribute.types.forEach((type) => {
|
|
223
|
-
Object.entries(globalAttribute.attributes).forEach(([name, attribute]) => {
|
|
224
|
-
extensionAttributes.push({
|
|
225
|
-
type,
|
|
226
|
-
name,
|
|
227
|
-
attribute: {
|
|
228
|
-
...defaultAttribute,
|
|
229
|
-
...attribute
|
|
230
|
-
}
|
|
231
|
-
});
|
|
232
|
-
});
|
|
233
|
-
});
|
|
234
|
-
});
|
|
235
|
-
});
|
|
236
|
-
nodeAndMarkExtensions.forEach((extension) => {
|
|
237
|
-
const context = {
|
|
238
|
-
name: extension.name,
|
|
239
|
-
options: extension.options,
|
|
240
|
-
storage: extension.storage
|
|
241
|
-
};
|
|
242
|
-
const addAttributes = getExtensionField(extension, "addAttributes", context);
|
|
243
|
-
if (!addAttributes) {
|
|
244
|
-
return;
|
|
245
|
-
}
|
|
246
|
-
const attributes = addAttributes();
|
|
247
|
-
Object.entries(attributes).forEach(([name, attribute]) => {
|
|
248
|
-
const mergedAttr = {
|
|
249
|
-
...defaultAttribute,
|
|
250
|
-
...attribute
|
|
251
|
-
};
|
|
252
|
-
if (typeof (mergedAttr === null || mergedAttr === void 0 ? void 0 : mergedAttr.default) === "function") {
|
|
253
|
-
mergedAttr.default = mergedAttr.default();
|
|
254
|
-
}
|
|
255
|
-
if ((mergedAttr === null || mergedAttr === void 0 ? void 0 : mergedAttr.isRequired) && (mergedAttr === null || mergedAttr === void 0 ? void 0 : mergedAttr.default) === void 0) {
|
|
256
|
-
delete mergedAttr.default;
|
|
257
|
-
}
|
|
258
|
-
extensionAttributes.push({
|
|
259
|
-
type: extension.name,
|
|
260
|
-
name,
|
|
261
|
-
attribute: mergedAttr
|
|
262
|
-
});
|
|
263
|
-
});
|
|
264
|
-
});
|
|
265
|
-
return extensionAttributes;
|
|
266
|
-
}
|
|
267
|
-
function getNodeType(nameOrType, schema) {
|
|
268
|
-
if (typeof nameOrType === "string") {
|
|
269
|
-
if (!schema.nodes[nameOrType]) {
|
|
270
|
-
throw Error(`There is no node type named '${nameOrType}'. Maybe you forgot to add the extension?`);
|
|
271
|
-
}
|
|
272
|
-
return schema.nodes[nameOrType];
|
|
273
|
-
}
|
|
274
|
-
return nameOrType;
|
|
275
|
-
}
|
|
276
|
-
function mergeAttributes(...objects) {
|
|
277
|
-
return objects.filter((item) => !!item).reduce((items, item) => {
|
|
278
|
-
const mergedAttributes = { ...items };
|
|
279
|
-
Object.entries(item).forEach(([key, value]) => {
|
|
280
|
-
const exists = mergedAttributes[key];
|
|
281
|
-
if (!exists) {
|
|
282
|
-
mergedAttributes[key] = value;
|
|
283
|
-
return;
|
|
284
|
-
}
|
|
285
|
-
if (key === "class") {
|
|
286
|
-
const valueClasses = value ? String(value).split(" ") : [];
|
|
287
|
-
const existingClasses = mergedAttributes[key] ? mergedAttributes[key].split(" ") : [];
|
|
288
|
-
const insertClasses = valueClasses.filter((valueClass) => !existingClasses.includes(valueClass));
|
|
289
|
-
mergedAttributes[key] = [...existingClasses, ...insertClasses].join(" ");
|
|
290
|
-
} else if (key === "style") {
|
|
291
|
-
const newStyles = value ? value.split(";").map((style2) => style2.trim()).filter(Boolean) : [];
|
|
292
|
-
const existingStyles = mergedAttributes[key] ? mergedAttributes[key].split(";").map((style2) => style2.trim()).filter(Boolean) : [];
|
|
293
|
-
const styleMap = /* @__PURE__ */ new Map();
|
|
294
|
-
existingStyles.forEach((style2) => {
|
|
295
|
-
const [property, val] = style2.split(":").map((part) => part.trim());
|
|
296
|
-
styleMap.set(property, val);
|
|
297
|
-
});
|
|
298
|
-
newStyles.forEach((style2) => {
|
|
299
|
-
const [property, val] = style2.split(":").map((part) => part.trim());
|
|
300
|
-
styleMap.set(property, val);
|
|
301
|
-
});
|
|
302
|
-
mergedAttributes[key] = Array.from(styleMap.entries()).map(([property, val]) => `${property}: ${val}`).join("; ");
|
|
303
|
-
} else {
|
|
304
|
-
mergedAttributes[key] = value;
|
|
305
|
-
}
|
|
306
|
-
});
|
|
307
|
-
return mergedAttributes;
|
|
308
|
-
}, {});
|
|
309
|
-
}
|
|
310
|
-
function getRenderedAttributes(nodeOrMark, extensionAttributes) {
|
|
311
|
-
return extensionAttributes.filter((attribute) => attribute.type === nodeOrMark.type.name).filter((item) => item.attribute.rendered).map((item) => {
|
|
312
|
-
if (!item.attribute.renderHTML) {
|
|
313
|
-
return {
|
|
314
|
-
[item.name]: nodeOrMark.attrs[item.name]
|
|
315
|
-
};
|
|
316
|
-
}
|
|
317
|
-
return item.attribute.renderHTML(nodeOrMark.attrs) || {};
|
|
318
|
-
}).reduce((attributes, attribute) => mergeAttributes(attributes, attribute), {});
|
|
319
|
-
}
|
|
320
|
-
function isFunction(value) {
|
|
321
|
-
return typeof value === "function";
|
|
322
|
-
}
|
|
323
|
-
function callOrReturn(value, context = void 0, ...props) {
|
|
324
|
-
if (isFunction(value)) {
|
|
325
|
-
if (context) {
|
|
326
|
-
return value.bind(context)(...props);
|
|
327
|
-
}
|
|
328
|
-
return value(...props);
|
|
329
|
-
}
|
|
330
|
-
return value;
|
|
331
|
-
}
|
|
332
|
-
function isEmptyObject(value = {}) {
|
|
333
|
-
return Object.keys(value).length === 0 && value.constructor === Object;
|
|
334
|
-
}
|
|
335
|
-
function fromString(value) {
|
|
336
|
-
if (typeof value !== "string") {
|
|
337
|
-
return value;
|
|
338
|
-
}
|
|
339
|
-
if (value.match(/^[+-]?(?:\d*\.)?\d+$/)) {
|
|
340
|
-
return Number(value);
|
|
341
|
-
}
|
|
342
|
-
if (value === "true") {
|
|
343
|
-
return true;
|
|
344
|
-
}
|
|
345
|
-
if (value === "false") {
|
|
346
|
-
return false;
|
|
347
|
-
}
|
|
348
|
-
return value;
|
|
349
|
-
}
|
|
350
|
-
function injectExtensionAttributesToParseRule(parseRule, extensionAttributes) {
|
|
351
|
-
if ("style" in parseRule) {
|
|
352
|
-
return parseRule;
|
|
353
|
-
}
|
|
354
|
-
return {
|
|
355
|
-
...parseRule,
|
|
356
|
-
getAttrs: (node) => {
|
|
357
|
-
const oldAttributes = parseRule.getAttrs ? parseRule.getAttrs(node) : parseRule.attrs;
|
|
358
|
-
if (oldAttributes === false) {
|
|
359
|
-
return false;
|
|
360
|
-
}
|
|
361
|
-
const newAttributes = extensionAttributes.reduce((items, item) => {
|
|
362
|
-
const value = item.attribute.parseHTML ? item.attribute.parseHTML(node) : fromString(node.getAttribute(item.name));
|
|
363
|
-
if (value === null || value === void 0) {
|
|
364
|
-
return items;
|
|
365
|
-
}
|
|
366
|
-
return {
|
|
367
|
-
...items,
|
|
368
|
-
[item.name]: value
|
|
369
|
-
};
|
|
370
|
-
}, {});
|
|
371
|
-
return { ...oldAttributes, ...newAttributes };
|
|
372
|
-
}
|
|
373
|
-
};
|
|
374
|
-
}
|
|
375
|
-
function cleanUpSchemaItem(data) {
|
|
376
|
-
return Object.fromEntries(
|
|
377
|
-
// @ts-ignore
|
|
378
|
-
Object.entries(data).filter(([key, value]) => {
|
|
379
|
-
if (key === "attrs" && isEmptyObject(value)) {
|
|
380
|
-
return false;
|
|
381
|
-
}
|
|
382
|
-
return value !== null && value !== void 0;
|
|
383
|
-
})
|
|
384
|
-
);
|
|
385
|
-
}
|
|
386
|
-
function getSchemaByResolvedExtensions(extensions, editor) {
|
|
387
|
-
var _a;
|
|
388
|
-
const allAttributes = getAttributesFromExtensions(extensions);
|
|
389
|
-
const { nodeExtensions, markExtensions } = splitExtensions(extensions);
|
|
390
|
-
const topNode = (_a = nodeExtensions.find((extension) => getExtensionField(extension, "topNode"))) === null || _a === void 0 ? void 0 : _a.name;
|
|
391
|
-
const nodes = Object.fromEntries(nodeExtensions.map((extension) => {
|
|
392
|
-
const extensionAttributes = allAttributes.filter((attribute) => attribute.type === extension.name);
|
|
393
|
-
const context = {
|
|
394
|
-
name: extension.name,
|
|
395
|
-
options: extension.options,
|
|
396
|
-
storage: extension.storage,
|
|
397
|
-
editor
|
|
398
|
-
};
|
|
399
|
-
const extraNodeFields = extensions.reduce((fields, e) => {
|
|
400
|
-
const extendNodeSchema = getExtensionField(e, "extendNodeSchema", context);
|
|
401
|
-
return {
|
|
402
|
-
...fields,
|
|
403
|
-
...extendNodeSchema ? extendNodeSchema(extension) : {}
|
|
404
|
-
};
|
|
405
|
-
}, {});
|
|
406
|
-
const schema = cleanUpSchemaItem({
|
|
407
|
-
...extraNodeFields,
|
|
408
|
-
content: callOrReturn(getExtensionField(extension, "content", context)),
|
|
409
|
-
marks: callOrReturn(getExtensionField(extension, "marks", context)),
|
|
410
|
-
group: callOrReturn(getExtensionField(extension, "group", context)),
|
|
411
|
-
inline: callOrReturn(getExtensionField(extension, "inline", context)),
|
|
412
|
-
atom: callOrReturn(getExtensionField(extension, "atom", context)),
|
|
413
|
-
selectable: callOrReturn(getExtensionField(extension, "selectable", context)),
|
|
414
|
-
draggable: callOrReturn(getExtensionField(extension, "draggable", context)),
|
|
415
|
-
code: callOrReturn(getExtensionField(extension, "code", context)),
|
|
416
|
-
whitespace: callOrReturn(getExtensionField(extension, "whitespace", context)),
|
|
417
|
-
linebreakReplacement: callOrReturn(getExtensionField(extension, "linebreakReplacement", context)),
|
|
418
|
-
defining: callOrReturn(getExtensionField(extension, "defining", context)),
|
|
419
|
-
isolating: callOrReturn(getExtensionField(extension, "isolating", context)),
|
|
420
|
-
attrs: Object.fromEntries(extensionAttributes.map((extensionAttribute) => {
|
|
421
|
-
var _a2;
|
|
422
|
-
return [extensionAttribute.name, { default: (_a2 = extensionAttribute === null || extensionAttribute === void 0 ? void 0 : extensionAttribute.attribute) === null || _a2 === void 0 ? void 0 : _a2.default }];
|
|
423
|
-
}))
|
|
424
|
-
});
|
|
425
|
-
const parseHTML = callOrReturn(getExtensionField(extension, "parseHTML", context));
|
|
426
|
-
if (parseHTML) {
|
|
427
|
-
schema.parseDOM = parseHTML.map((parseRule) => injectExtensionAttributesToParseRule(parseRule, extensionAttributes));
|
|
428
|
-
}
|
|
429
|
-
const renderHTML = getExtensionField(extension, "renderHTML", context);
|
|
430
|
-
if (renderHTML) {
|
|
431
|
-
schema.toDOM = (node) => renderHTML({
|
|
432
|
-
node,
|
|
433
|
-
HTMLAttributes: getRenderedAttributes(node, extensionAttributes)
|
|
434
|
-
});
|
|
435
|
-
}
|
|
436
|
-
const renderText = getExtensionField(extension, "renderText", context);
|
|
437
|
-
if (renderText) {
|
|
438
|
-
schema.toText = renderText;
|
|
439
|
-
}
|
|
440
|
-
return [extension.name, schema];
|
|
441
|
-
}));
|
|
442
|
-
const marks = Object.fromEntries(markExtensions.map((extension) => {
|
|
443
|
-
const extensionAttributes = allAttributes.filter((attribute) => attribute.type === extension.name);
|
|
444
|
-
const context = {
|
|
445
|
-
name: extension.name,
|
|
446
|
-
options: extension.options,
|
|
447
|
-
storage: extension.storage,
|
|
448
|
-
editor
|
|
449
|
-
};
|
|
450
|
-
const extraMarkFields = extensions.reduce((fields, e) => {
|
|
451
|
-
const extendMarkSchema = getExtensionField(e, "extendMarkSchema", context);
|
|
452
|
-
return {
|
|
453
|
-
...fields,
|
|
454
|
-
...extendMarkSchema ? extendMarkSchema(extension) : {}
|
|
455
|
-
};
|
|
456
|
-
}, {});
|
|
457
|
-
const schema = cleanUpSchemaItem({
|
|
458
|
-
...extraMarkFields,
|
|
459
|
-
inclusive: callOrReturn(getExtensionField(extension, "inclusive", context)),
|
|
460
|
-
excludes: callOrReturn(getExtensionField(extension, "excludes", context)),
|
|
461
|
-
group: callOrReturn(getExtensionField(extension, "group", context)),
|
|
462
|
-
spanning: callOrReturn(getExtensionField(extension, "spanning", context)),
|
|
463
|
-
code: callOrReturn(getExtensionField(extension, "code", context)),
|
|
464
|
-
attrs: Object.fromEntries(extensionAttributes.map((extensionAttribute) => {
|
|
465
|
-
var _a2;
|
|
466
|
-
return [extensionAttribute.name, { default: (_a2 = extensionAttribute === null || extensionAttribute === void 0 ? void 0 : extensionAttribute.attribute) === null || _a2 === void 0 ? void 0 : _a2.default }];
|
|
467
|
-
}))
|
|
468
|
-
});
|
|
469
|
-
const parseHTML = callOrReturn(getExtensionField(extension, "parseHTML", context));
|
|
470
|
-
if (parseHTML) {
|
|
471
|
-
schema.parseDOM = parseHTML.map((parseRule) => injectExtensionAttributesToParseRule(parseRule, extensionAttributes));
|
|
472
|
-
}
|
|
473
|
-
const renderHTML = getExtensionField(extension, "renderHTML", context);
|
|
474
|
-
if (renderHTML) {
|
|
475
|
-
schema.toDOM = (mark) => renderHTML({
|
|
476
|
-
mark,
|
|
477
|
-
HTMLAttributes: getRenderedAttributes(mark, extensionAttributes)
|
|
478
|
-
});
|
|
479
|
-
}
|
|
480
|
-
return [extension.name, schema];
|
|
481
|
-
}));
|
|
482
|
-
return new Schema({
|
|
483
|
-
topNode,
|
|
484
|
-
nodes,
|
|
485
|
-
marks
|
|
486
|
-
});
|
|
487
|
-
}
|
|
488
|
-
function getSchemaTypeByName(name, schema) {
|
|
489
|
-
return schema.nodes[name] || schema.marks[name] || null;
|
|
490
|
-
}
|
|
491
|
-
function isExtensionRulesEnabled(extension, enabled) {
|
|
492
|
-
if (Array.isArray(enabled)) {
|
|
493
|
-
return enabled.some((enabledExtension) => {
|
|
494
|
-
const name = typeof enabledExtension === "string" ? enabledExtension : enabledExtension.name;
|
|
495
|
-
return name === extension.name;
|
|
496
|
-
});
|
|
497
|
-
}
|
|
498
|
-
return enabled;
|
|
499
|
-
}
|
|
500
|
-
function getHTMLFromFragment(fragment, schema) {
|
|
501
|
-
const documentFragment = DOMSerializer.fromSchema(schema).serializeFragment(fragment);
|
|
502
|
-
const temporaryDocument = document.implementation.createHTMLDocument();
|
|
503
|
-
const container = temporaryDocument.createElement("div");
|
|
504
|
-
container.appendChild(documentFragment);
|
|
505
|
-
return container.innerHTML;
|
|
506
|
-
}
|
|
507
|
-
const getTextContentFromNodes = ($from, maxMatch = 500) => {
|
|
508
|
-
let textBefore = "";
|
|
509
|
-
const sliceEndPos = $from.parentOffset;
|
|
510
|
-
$from.parent.nodesBetween(Math.max(0, sliceEndPos - maxMatch), sliceEndPos, (node, pos, parent, index) => {
|
|
511
|
-
var _a, _b;
|
|
512
|
-
const chunk = ((_b = (_a = node.type.spec).toText) === null || _b === void 0 ? void 0 : _b.call(_a, {
|
|
513
|
-
node,
|
|
514
|
-
pos,
|
|
515
|
-
parent,
|
|
516
|
-
index
|
|
517
|
-
})) || node.textContent || "%leaf%";
|
|
518
|
-
textBefore += node.isAtom && !node.isText ? chunk : chunk.slice(0, Math.max(0, sliceEndPos - pos));
|
|
519
|
-
});
|
|
520
|
-
return textBefore;
|
|
521
|
-
};
|
|
522
|
-
function isRegExp(value) {
|
|
523
|
-
return Object.prototype.toString.call(value) === "[object RegExp]";
|
|
524
|
-
}
|
|
525
|
-
class InputRule {
|
|
526
|
-
constructor(config) {
|
|
527
|
-
this.find = config.find;
|
|
528
|
-
this.handler = config.handler;
|
|
529
|
-
}
|
|
530
|
-
}
|
|
531
|
-
const inputRuleMatcherHandler = (text, find) => {
|
|
532
|
-
if (isRegExp(find)) {
|
|
533
|
-
return find.exec(text);
|
|
534
|
-
}
|
|
535
|
-
const inputRuleMatch = find(text);
|
|
536
|
-
if (!inputRuleMatch) {
|
|
537
|
-
return null;
|
|
538
|
-
}
|
|
539
|
-
const result = [inputRuleMatch.text];
|
|
540
|
-
result.index = inputRuleMatch.index;
|
|
541
|
-
result.input = text;
|
|
542
|
-
result.data = inputRuleMatch.data;
|
|
543
|
-
if (inputRuleMatch.replaceWith) {
|
|
544
|
-
if (!inputRuleMatch.text.includes(inputRuleMatch.replaceWith)) {
|
|
545
|
-
console.warn('[tiptap warn]: "inputRuleMatch.replaceWith" must be part of "inputRuleMatch.text".');
|
|
546
|
-
}
|
|
547
|
-
result.push(inputRuleMatch.replaceWith);
|
|
548
|
-
}
|
|
549
|
-
return result;
|
|
550
|
-
};
|
|
551
|
-
function run$1(config) {
|
|
552
|
-
var _a;
|
|
553
|
-
const { editor, from, to, text, rules, plugin } = config;
|
|
554
|
-
const { view } = editor;
|
|
555
|
-
if (view.composing) {
|
|
556
|
-
return false;
|
|
557
|
-
}
|
|
558
|
-
const $from = view.state.doc.resolve(from);
|
|
559
|
-
if (
|
|
560
|
-
// check for code node
|
|
561
|
-
$from.parent.type.spec.code || !!((_a = $from.nodeBefore || $from.nodeAfter) === null || _a === void 0 ? void 0 : _a.marks.find((mark) => mark.type.spec.code))
|
|
562
|
-
) {
|
|
563
|
-
return false;
|
|
564
|
-
}
|
|
565
|
-
let matched = false;
|
|
566
|
-
const textBefore = getTextContentFromNodes($from) + text;
|
|
567
|
-
rules.forEach((rule) => {
|
|
568
|
-
if (matched) {
|
|
569
|
-
return;
|
|
570
|
-
}
|
|
571
|
-
const match = inputRuleMatcherHandler(textBefore, rule.find);
|
|
572
|
-
if (!match) {
|
|
573
|
-
return;
|
|
574
|
-
}
|
|
575
|
-
const tr = view.state.tr;
|
|
576
|
-
const state = createChainableState({
|
|
577
|
-
state: view.state,
|
|
578
|
-
transaction: tr
|
|
579
|
-
});
|
|
580
|
-
const range = {
|
|
581
|
-
from: from - (match[0].length - text.length),
|
|
582
|
-
to
|
|
583
|
-
};
|
|
584
|
-
const { commands: commands2, chain, can } = new CommandManager({
|
|
585
|
-
editor,
|
|
586
|
-
state
|
|
587
|
-
});
|
|
588
|
-
const handler = rule.handler({
|
|
589
|
-
state,
|
|
590
|
-
range,
|
|
591
|
-
match,
|
|
592
|
-
commands: commands2,
|
|
593
|
-
chain,
|
|
594
|
-
can
|
|
595
|
-
});
|
|
596
|
-
if (handler === null || !tr.steps.length) {
|
|
597
|
-
return;
|
|
598
|
-
}
|
|
599
|
-
tr.setMeta(plugin, {
|
|
600
|
-
transform: tr,
|
|
601
|
-
from,
|
|
602
|
-
to,
|
|
603
|
-
text
|
|
604
|
-
});
|
|
605
|
-
view.dispatch(tr);
|
|
606
|
-
matched = true;
|
|
607
|
-
});
|
|
608
|
-
return matched;
|
|
609
|
-
}
|
|
610
|
-
function inputRulesPlugin(props) {
|
|
611
|
-
const { editor, rules } = props;
|
|
612
|
-
const plugin = new Plugin({
|
|
613
|
-
state: {
|
|
614
|
-
init() {
|
|
615
|
-
return null;
|
|
616
|
-
},
|
|
617
|
-
apply(tr, prev, state) {
|
|
618
|
-
const stored = tr.getMeta(plugin);
|
|
619
|
-
if (stored) {
|
|
620
|
-
return stored;
|
|
621
|
-
}
|
|
622
|
-
const simulatedInputMeta = tr.getMeta("applyInputRules");
|
|
623
|
-
const isSimulatedInput = !!simulatedInputMeta;
|
|
624
|
-
if (isSimulatedInput) {
|
|
625
|
-
setTimeout(() => {
|
|
626
|
-
let { text } = simulatedInputMeta;
|
|
627
|
-
if (typeof text === "string") {
|
|
628
|
-
text = text;
|
|
629
|
-
} else {
|
|
630
|
-
text = getHTMLFromFragment(Fragment.from(text), state.schema);
|
|
631
|
-
}
|
|
632
|
-
const { from } = simulatedInputMeta;
|
|
633
|
-
const to = from + text.length;
|
|
634
|
-
run$1({
|
|
635
|
-
editor,
|
|
636
|
-
from,
|
|
637
|
-
to,
|
|
638
|
-
text,
|
|
639
|
-
rules,
|
|
640
|
-
plugin
|
|
641
|
-
});
|
|
642
|
-
});
|
|
643
|
-
}
|
|
644
|
-
return tr.selectionSet || tr.docChanged ? null : prev;
|
|
645
|
-
}
|
|
646
|
-
},
|
|
647
|
-
props: {
|
|
648
|
-
handleTextInput(view, from, to, text) {
|
|
649
|
-
return run$1({
|
|
650
|
-
editor,
|
|
651
|
-
from,
|
|
652
|
-
to,
|
|
653
|
-
text,
|
|
654
|
-
rules,
|
|
655
|
-
plugin
|
|
656
|
-
});
|
|
657
|
-
},
|
|
658
|
-
handleDOMEvents: {
|
|
659
|
-
compositionend: (view) => {
|
|
660
|
-
setTimeout(() => {
|
|
661
|
-
const { $cursor } = view.state.selection;
|
|
662
|
-
if ($cursor) {
|
|
663
|
-
run$1({
|
|
664
|
-
editor,
|
|
665
|
-
from: $cursor.pos,
|
|
666
|
-
to: $cursor.pos,
|
|
667
|
-
text: "",
|
|
668
|
-
rules,
|
|
669
|
-
plugin
|
|
670
|
-
});
|
|
671
|
-
}
|
|
672
|
-
});
|
|
673
|
-
return false;
|
|
674
|
-
}
|
|
675
|
-
},
|
|
676
|
-
// add support for input rules to trigger on enter
|
|
677
|
-
// this is useful for example for code blocks
|
|
678
|
-
handleKeyDown(view, event) {
|
|
679
|
-
if (event.key !== "Enter") {
|
|
680
|
-
return false;
|
|
681
|
-
}
|
|
682
|
-
const { $cursor } = view.state.selection;
|
|
683
|
-
if ($cursor) {
|
|
684
|
-
return run$1({
|
|
685
|
-
editor,
|
|
686
|
-
from: $cursor.pos,
|
|
687
|
-
to: $cursor.pos,
|
|
688
|
-
text: "\n",
|
|
689
|
-
rules,
|
|
690
|
-
plugin
|
|
691
|
-
});
|
|
692
|
-
}
|
|
693
|
-
return false;
|
|
694
|
-
}
|
|
695
|
-
},
|
|
696
|
-
// @ts-ignore
|
|
697
|
-
isInputRules: true
|
|
698
|
-
});
|
|
699
|
-
return plugin;
|
|
700
|
-
}
|
|
701
|
-
function getType(value) {
|
|
702
|
-
return Object.prototype.toString.call(value).slice(8, -1);
|
|
703
|
-
}
|
|
704
|
-
function isPlainObject(value) {
|
|
705
|
-
if (getType(value) !== "Object") {
|
|
706
|
-
return false;
|
|
707
|
-
}
|
|
708
|
-
return value.constructor === Object && Object.getPrototypeOf(value) === Object.prototype;
|
|
709
|
-
}
|
|
710
|
-
function mergeDeep(target, source) {
|
|
711
|
-
const output = { ...target };
|
|
712
|
-
if (isPlainObject(target) && isPlainObject(source)) {
|
|
713
|
-
Object.keys(source).forEach((key) => {
|
|
714
|
-
if (isPlainObject(source[key]) && isPlainObject(target[key])) {
|
|
715
|
-
output[key] = mergeDeep(target[key], source[key]);
|
|
716
|
-
} else {
|
|
717
|
-
output[key] = source[key];
|
|
718
|
-
}
|
|
719
|
-
});
|
|
720
|
-
}
|
|
721
|
-
return output;
|
|
722
|
-
}
|
|
723
|
-
class Mark {
|
|
724
|
-
constructor(config = {}) {
|
|
725
|
-
this.type = "mark";
|
|
726
|
-
this.name = "mark";
|
|
727
|
-
this.parent = null;
|
|
728
|
-
this.child = null;
|
|
729
|
-
this.config = {
|
|
730
|
-
name: this.name,
|
|
731
|
-
defaultOptions: {}
|
|
732
|
-
};
|
|
733
|
-
this.config = {
|
|
734
|
-
...this.config,
|
|
735
|
-
...config
|
|
736
|
-
};
|
|
737
|
-
this.name = this.config.name;
|
|
738
|
-
if (config.defaultOptions && Object.keys(config.defaultOptions).length > 0) {
|
|
739
|
-
console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`);
|
|
740
|
-
}
|
|
741
|
-
this.options = this.config.defaultOptions;
|
|
742
|
-
if (this.config.addOptions) {
|
|
743
|
-
this.options = callOrReturn(getExtensionField(this, "addOptions", {
|
|
744
|
-
name: this.name
|
|
745
|
-
}));
|
|
746
|
-
}
|
|
747
|
-
this.storage = callOrReturn(getExtensionField(this, "addStorage", {
|
|
748
|
-
name: this.name,
|
|
749
|
-
options: this.options
|
|
750
|
-
})) || {};
|
|
751
|
-
}
|
|
752
|
-
static create(config = {}) {
|
|
753
|
-
return new Mark(config);
|
|
754
|
-
}
|
|
755
|
-
configure(options = {}) {
|
|
756
|
-
const extension = this.extend({
|
|
757
|
-
...this.config,
|
|
758
|
-
addOptions: () => {
|
|
759
|
-
return mergeDeep(this.options, options);
|
|
760
|
-
}
|
|
761
|
-
});
|
|
762
|
-
extension.name = this.name;
|
|
763
|
-
extension.parent = this.parent;
|
|
764
|
-
return extension;
|
|
765
|
-
}
|
|
766
|
-
extend(extendedConfig = {}) {
|
|
767
|
-
const extension = new Mark(extendedConfig);
|
|
768
|
-
extension.parent = this;
|
|
769
|
-
this.child = extension;
|
|
770
|
-
extension.name = extendedConfig.name ? extendedConfig.name : extension.parent.name;
|
|
771
|
-
if (extendedConfig.defaultOptions && Object.keys(extendedConfig.defaultOptions).length > 0) {
|
|
772
|
-
console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${extension.name}".`);
|
|
773
|
-
}
|
|
774
|
-
extension.options = callOrReturn(getExtensionField(extension, "addOptions", {
|
|
775
|
-
name: extension.name
|
|
776
|
-
}));
|
|
777
|
-
extension.storage = callOrReturn(getExtensionField(extension, "addStorage", {
|
|
778
|
-
name: extension.name,
|
|
779
|
-
options: extension.options
|
|
780
|
-
}));
|
|
781
|
-
return extension;
|
|
782
|
-
}
|
|
783
|
-
static handleExit({ editor, mark }) {
|
|
784
|
-
const { tr } = editor.state;
|
|
785
|
-
const currentPos = editor.state.selection.$from;
|
|
786
|
-
const isAtEnd = currentPos.pos === currentPos.end();
|
|
787
|
-
if (isAtEnd) {
|
|
788
|
-
const currentMarks = currentPos.marks();
|
|
789
|
-
const isInMark = !!currentMarks.find((m) => (m === null || m === void 0 ? void 0 : m.type.name) === mark.name);
|
|
790
|
-
if (!isInMark) {
|
|
791
|
-
return false;
|
|
792
|
-
}
|
|
793
|
-
const removeMark = currentMarks.find((m) => (m === null || m === void 0 ? void 0 : m.type.name) === mark.name);
|
|
794
|
-
if (removeMark) {
|
|
795
|
-
tr.removeStoredMark(removeMark);
|
|
796
|
-
}
|
|
797
|
-
tr.insertText(" ", currentPos.pos);
|
|
798
|
-
editor.view.dispatch(tr);
|
|
799
|
-
return true;
|
|
800
|
-
}
|
|
801
|
-
return false;
|
|
802
|
-
}
|
|
803
|
-
}
|
|
804
|
-
function isNumber(value) {
|
|
805
|
-
return typeof value === "number";
|
|
806
|
-
}
|
|
807
|
-
class PasteRule {
|
|
808
|
-
constructor(config) {
|
|
809
|
-
this.find = config.find;
|
|
810
|
-
this.handler = config.handler;
|
|
811
|
-
}
|
|
812
|
-
}
|
|
813
|
-
const pasteRuleMatcherHandler = (text, find, event) => {
|
|
814
|
-
if (isRegExp(find)) {
|
|
815
|
-
return [...text.matchAll(find)];
|
|
816
|
-
}
|
|
817
|
-
const matches = find(text, event);
|
|
818
|
-
if (!matches) {
|
|
819
|
-
return [];
|
|
820
|
-
}
|
|
821
|
-
return matches.map((pasteRuleMatch) => {
|
|
822
|
-
const result = [pasteRuleMatch.text];
|
|
823
|
-
result.index = pasteRuleMatch.index;
|
|
824
|
-
result.input = text;
|
|
825
|
-
result.data = pasteRuleMatch.data;
|
|
826
|
-
if (pasteRuleMatch.replaceWith) {
|
|
827
|
-
if (!pasteRuleMatch.text.includes(pasteRuleMatch.replaceWith)) {
|
|
828
|
-
console.warn('[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".');
|
|
829
|
-
}
|
|
830
|
-
result.push(pasteRuleMatch.replaceWith);
|
|
831
|
-
}
|
|
832
|
-
return result;
|
|
833
|
-
});
|
|
834
|
-
};
|
|
835
|
-
function run(config) {
|
|
836
|
-
const { editor, state, from, to, rule, pasteEvent, dropEvent } = config;
|
|
837
|
-
const { commands: commands2, chain, can } = new CommandManager({
|
|
838
|
-
editor,
|
|
839
|
-
state
|
|
840
|
-
});
|
|
841
|
-
const handlers = [];
|
|
842
|
-
state.doc.nodesBetween(from, to, (node, pos) => {
|
|
843
|
-
if (!node.isTextblock || node.type.spec.code) {
|
|
844
|
-
return;
|
|
845
|
-
}
|
|
846
|
-
const resolvedFrom = Math.max(from, pos);
|
|
847
|
-
const resolvedTo = Math.min(to, pos + node.content.size);
|
|
848
|
-
const textToMatch = node.textBetween(resolvedFrom - pos, resolvedTo - pos, void 0, "");
|
|
849
|
-
const matches = pasteRuleMatcherHandler(textToMatch, rule.find, pasteEvent);
|
|
850
|
-
matches.forEach((match) => {
|
|
851
|
-
if (match.index === void 0) {
|
|
852
|
-
return;
|
|
853
|
-
}
|
|
854
|
-
const start = resolvedFrom + match.index + 1;
|
|
855
|
-
const end = start + match[0].length;
|
|
856
|
-
const range = {
|
|
857
|
-
from: state.tr.mapping.map(start),
|
|
858
|
-
to: state.tr.mapping.map(end)
|
|
859
|
-
};
|
|
860
|
-
const handler = rule.handler({
|
|
861
|
-
state,
|
|
862
|
-
range,
|
|
863
|
-
match,
|
|
864
|
-
commands: commands2,
|
|
865
|
-
chain,
|
|
866
|
-
can,
|
|
867
|
-
pasteEvent,
|
|
868
|
-
dropEvent
|
|
869
|
-
});
|
|
870
|
-
handlers.push(handler);
|
|
871
|
-
});
|
|
872
|
-
});
|
|
873
|
-
const success = handlers.every((handler) => handler !== null);
|
|
874
|
-
return success;
|
|
875
|
-
}
|
|
876
|
-
let tiptapDragFromOtherEditor = null;
|
|
877
|
-
const createClipboardPasteEvent = (text) => {
|
|
878
|
-
var _a;
|
|
879
|
-
const event = new ClipboardEvent("paste", {
|
|
880
|
-
clipboardData: new DataTransfer()
|
|
881
|
-
});
|
|
882
|
-
(_a = event.clipboardData) === null || _a === void 0 ? void 0 : _a.setData("text/html", text);
|
|
883
|
-
return event;
|
|
884
|
-
};
|
|
885
|
-
function pasteRulesPlugin(props) {
|
|
886
|
-
const { editor, rules } = props;
|
|
887
|
-
let dragSourceElement = null;
|
|
888
|
-
let isPastedFromProseMirror = false;
|
|
889
|
-
let isDroppedFromProseMirror = false;
|
|
890
|
-
let pasteEvent = typeof ClipboardEvent !== "undefined" ? new ClipboardEvent("paste") : null;
|
|
891
|
-
let dropEvent;
|
|
892
|
-
try {
|
|
893
|
-
dropEvent = typeof DragEvent !== "undefined" ? new DragEvent("drop") : null;
|
|
894
|
-
} catch {
|
|
895
|
-
dropEvent = null;
|
|
896
|
-
}
|
|
897
|
-
const processEvent = ({ state, from, to, rule, pasteEvt }) => {
|
|
898
|
-
const tr = state.tr;
|
|
899
|
-
const chainableState = createChainableState({
|
|
900
|
-
state,
|
|
901
|
-
transaction: tr
|
|
902
|
-
});
|
|
903
|
-
const handler = run({
|
|
904
|
-
editor,
|
|
905
|
-
state: chainableState,
|
|
906
|
-
from: Math.max(from - 1, 0),
|
|
907
|
-
to: to.b - 1,
|
|
908
|
-
rule,
|
|
909
|
-
pasteEvent: pasteEvt,
|
|
910
|
-
dropEvent
|
|
911
|
-
});
|
|
912
|
-
if (!handler || !tr.steps.length) {
|
|
913
|
-
return;
|
|
914
|
-
}
|
|
915
|
-
try {
|
|
916
|
-
dropEvent = typeof DragEvent !== "undefined" ? new DragEvent("drop") : null;
|
|
917
|
-
} catch {
|
|
918
|
-
dropEvent = null;
|
|
919
|
-
}
|
|
920
|
-
pasteEvent = typeof ClipboardEvent !== "undefined" ? new ClipboardEvent("paste") : null;
|
|
921
|
-
return tr;
|
|
922
|
-
};
|
|
923
|
-
const plugins = rules.map((rule) => {
|
|
924
|
-
return new Plugin({
|
|
925
|
-
// we register a global drag handler to track the current drag source element
|
|
926
|
-
view(view) {
|
|
927
|
-
const handleDragstart = (event) => {
|
|
928
|
-
var _a;
|
|
929
|
-
dragSourceElement = ((_a = view.dom.parentElement) === null || _a === void 0 ? void 0 : _a.contains(event.target)) ? view.dom.parentElement : null;
|
|
930
|
-
if (dragSourceElement) {
|
|
931
|
-
tiptapDragFromOtherEditor = editor;
|
|
932
|
-
}
|
|
933
|
-
};
|
|
934
|
-
const handleDragend = () => {
|
|
935
|
-
if (tiptapDragFromOtherEditor) {
|
|
936
|
-
tiptapDragFromOtherEditor = null;
|
|
937
|
-
}
|
|
938
|
-
};
|
|
939
|
-
window.addEventListener("dragstart", handleDragstart);
|
|
940
|
-
window.addEventListener("dragend", handleDragend);
|
|
941
|
-
return {
|
|
942
|
-
destroy() {
|
|
943
|
-
window.removeEventListener("dragstart", handleDragstart);
|
|
944
|
-
window.removeEventListener("dragend", handleDragend);
|
|
945
|
-
}
|
|
946
|
-
};
|
|
947
|
-
},
|
|
948
|
-
props: {
|
|
949
|
-
handleDOMEvents: {
|
|
950
|
-
drop: (view, event) => {
|
|
951
|
-
isDroppedFromProseMirror = dragSourceElement === view.dom.parentElement;
|
|
952
|
-
dropEvent = event;
|
|
953
|
-
if (!isDroppedFromProseMirror) {
|
|
954
|
-
const dragFromOtherEditor = tiptapDragFromOtherEditor;
|
|
955
|
-
if (dragFromOtherEditor === null || dragFromOtherEditor === void 0 ? void 0 : dragFromOtherEditor.isEditable) {
|
|
956
|
-
setTimeout(() => {
|
|
957
|
-
const selection = dragFromOtherEditor.state.selection;
|
|
958
|
-
if (selection) {
|
|
959
|
-
dragFromOtherEditor.commands.deleteRange({ from: selection.from, to: selection.to });
|
|
960
|
-
}
|
|
961
|
-
}, 10);
|
|
962
|
-
}
|
|
963
|
-
}
|
|
964
|
-
return false;
|
|
965
|
-
},
|
|
966
|
-
paste: (_view, event) => {
|
|
967
|
-
var _a;
|
|
968
|
-
const html = (_a = event.clipboardData) === null || _a === void 0 ? void 0 : _a.getData("text/html");
|
|
969
|
-
pasteEvent = event;
|
|
970
|
-
isPastedFromProseMirror = !!(html === null || html === void 0 ? void 0 : html.includes("data-pm-slice"));
|
|
971
|
-
return false;
|
|
972
|
-
}
|
|
973
|
-
}
|
|
974
|
-
},
|
|
975
|
-
appendTransaction: (transactions, oldState, state) => {
|
|
976
|
-
const transaction = transactions[0];
|
|
977
|
-
const isPaste = transaction.getMeta("uiEvent") === "paste" && !isPastedFromProseMirror;
|
|
978
|
-
const isDrop = transaction.getMeta("uiEvent") === "drop" && !isDroppedFromProseMirror;
|
|
979
|
-
const simulatedPasteMeta = transaction.getMeta("applyPasteRules");
|
|
980
|
-
const isSimulatedPaste = !!simulatedPasteMeta;
|
|
981
|
-
if (!isPaste && !isDrop && !isSimulatedPaste) {
|
|
982
|
-
return;
|
|
983
|
-
}
|
|
984
|
-
if (isSimulatedPaste) {
|
|
985
|
-
let { text } = simulatedPasteMeta;
|
|
986
|
-
if (typeof text === "string") {
|
|
987
|
-
text = text;
|
|
988
|
-
} else {
|
|
989
|
-
text = getHTMLFromFragment(Fragment.from(text), state.schema);
|
|
990
|
-
}
|
|
991
|
-
const { from: from2 } = simulatedPasteMeta;
|
|
992
|
-
const to2 = from2 + text.length;
|
|
993
|
-
const pasteEvt = createClipboardPasteEvent(text);
|
|
994
|
-
return processEvent({
|
|
995
|
-
rule,
|
|
996
|
-
state,
|
|
997
|
-
from: from2,
|
|
998
|
-
to: { b: to2 },
|
|
999
|
-
pasteEvt
|
|
1000
|
-
});
|
|
1001
|
-
}
|
|
1002
|
-
const from = oldState.doc.content.findDiffStart(state.doc.content);
|
|
1003
|
-
const to = oldState.doc.content.findDiffEnd(state.doc.content);
|
|
1004
|
-
if (!isNumber(from) || !to || from === to.b) {
|
|
1005
|
-
return;
|
|
1006
|
-
}
|
|
1007
|
-
return processEvent({
|
|
1008
|
-
rule,
|
|
1009
|
-
state,
|
|
1010
|
-
from,
|
|
1011
|
-
to,
|
|
1012
|
-
pasteEvt: pasteEvent
|
|
1013
|
-
});
|
|
1014
|
-
}
|
|
1015
|
-
});
|
|
1016
|
-
});
|
|
1017
|
-
return plugins;
|
|
1018
|
-
}
|
|
1019
|
-
function findDuplicates(items) {
|
|
1020
|
-
const filtered = items.filter((el, index) => items.indexOf(el) !== index);
|
|
1021
|
-
return Array.from(new Set(filtered));
|
|
1022
|
-
}
|
|
1023
|
-
class ExtensionManager {
|
|
1024
|
-
constructor(extensions, editor) {
|
|
1025
|
-
this.splittableMarks = [];
|
|
1026
|
-
this.editor = editor;
|
|
1027
|
-
this.extensions = ExtensionManager.resolve(extensions);
|
|
1028
|
-
this.schema = getSchemaByResolvedExtensions(this.extensions, editor);
|
|
1029
|
-
this.setupExtensions();
|
|
1030
|
-
}
|
|
1031
|
-
/**
|
|
1032
|
-
* Returns a flattened and sorted extension list while
|
|
1033
|
-
* also checking for duplicated extensions and warns the user.
|
|
1034
|
-
* @param extensions An array of Tiptap extensions
|
|
1035
|
-
* @returns An flattened and sorted array of Tiptap extensions
|
|
1036
|
-
*/
|
|
1037
|
-
static resolve(extensions) {
|
|
1038
|
-
const resolvedExtensions = ExtensionManager.sort(ExtensionManager.flatten(extensions));
|
|
1039
|
-
const duplicatedNames = findDuplicates(resolvedExtensions.map((extension) => extension.name));
|
|
1040
|
-
if (duplicatedNames.length) {
|
|
1041
|
-
console.warn(`[tiptap warn]: Duplicate extension names found: [${duplicatedNames.map((item) => `'${item}'`).join(", ")}]. This can lead to issues.`);
|
|
1042
|
-
}
|
|
1043
|
-
return resolvedExtensions;
|
|
1044
|
-
}
|
|
1045
|
-
/**
|
|
1046
|
-
* Create a flattened array of extensions by traversing the `addExtensions` field.
|
|
1047
|
-
* @param extensions An array of Tiptap extensions
|
|
1048
|
-
* @returns A flattened array of Tiptap extensions
|
|
1049
|
-
*/
|
|
1050
|
-
static flatten(extensions) {
|
|
1051
|
-
return extensions.map((extension) => {
|
|
1052
|
-
const context = {
|
|
1053
|
-
name: extension.name,
|
|
1054
|
-
options: extension.options,
|
|
1055
|
-
storage: extension.storage
|
|
1056
|
-
};
|
|
1057
|
-
const addExtensions = getExtensionField(extension, "addExtensions", context);
|
|
1058
|
-
if (addExtensions) {
|
|
1059
|
-
return [extension, ...this.flatten(addExtensions())];
|
|
1060
|
-
}
|
|
1061
|
-
return extension;
|
|
1062
|
-
}).flat(10);
|
|
1063
|
-
}
|
|
1064
|
-
/**
|
|
1065
|
-
* Sort extensions by priority.
|
|
1066
|
-
* @param extensions An array of Tiptap extensions
|
|
1067
|
-
* @returns A sorted array of Tiptap extensions by priority
|
|
1068
|
-
*/
|
|
1069
|
-
static sort(extensions) {
|
|
1070
|
-
const defaultPriority = 100;
|
|
1071
|
-
return extensions.sort((a, b) => {
|
|
1072
|
-
const priorityA = getExtensionField(a, "priority") || defaultPriority;
|
|
1073
|
-
const priorityB = getExtensionField(b, "priority") || defaultPriority;
|
|
1074
|
-
if (priorityA > priorityB) {
|
|
1075
|
-
return -1;
|
|
1076
|
-
}
|
|
1077
|
-
if (priorityA < priorityB) {
|
|
1078
|
-
return 1;
|
|
1079
|
-
}
|
|
1080
|
-
return 0;
|
|
1081
|
-
});
|
|
1082
|
-
}
|
|
1083
|
-
/**
|
|
1084
|
-
* Get all commands from the extensions.
|
|
1085
|
-
* @returns An object with all commands where the key is the command name and the value is the command function
|
|
1086
|
-
*/
|
|
1087
|
-
get commands() {
|
|
1088
|
-
return this.extensions.reduce((commands2, extension) => {
|
|
1089
|
-
const context = {
|
|
1090
|
-
name: extension.name,
|
|
1091
|
-
options: extension.options,
|
|
1092
|
-
storage: extension.storage,
|
|
1093
|
-
editor: this.editor,
|
|
1094
|
-
type: getSchemaTypeByName(extension.name, this.schema)
|
|
1095
|
-
};
|
|
1096
|
-
const addCommands = getExtensionField(extension, "addCommands", context);
|
|
1097
|
-
if (!addCommands) {
|
|
1098
|
-
return commands2;
|
|
1099
|
-
}
|
|
1100
|
-
return {
|
|
1101
|
-
...commands2,
|
|
1102
|
-
...addCommands()
|
|
1103
|
-
};
|
|
1104
|
-
}, {});
|
|
1105
|
-
}
|
|
1106
|
-
/**
|
|
1107
|
-
* Get all registered Prosemirror plugins from the extensions.
|
|
1108
|
-
* @returns An array of Prosemirror plugins
|
|
1109
|
-
*/
|
|
1110
|
-
get plugins() {
|
|
1111
|
-
const { editor } = this;
|
|
1112
|
-
const extensions = ExtensionManager.sort([...this.extensions].reverse());
|
|
1113
|
-
const inputRules = [];
|
|
1114
|
-
const pasteRules = [];
|
|
1115
|
-
const allPlugins = extensions.map((extension) => {
|
|
1116
|
-
const context = {
|
|
1117
|
-
name: extension.name,
|
|
1118
|
-
options: extension.options,
|
|
1119
|
-
storage: extension.storage,
|
|
1120
|
-
editor,
|
|
1121
|
-
type: getSchemaTypeByName(extension.name, this.schema)
|
|
1122
|
-
};
|
|
1123
|
-
const plugins = [];
|
|
1124
|
-
const addKeyboardShortcuts = getExtensionField(extension, "addKeyboardShortcuts", context);
|
|
1125
|
-
let defaultBindings = {};
|
|
1126
|
-
if (extension.type === "mark" && getExtensionField(extension, "exitable", context)) {
|
|
1127
|
-
defaultBindings.ArrowRight = () => Mark.handleExit({ editor, mark: extension });
|
|
1128
|
-
}
|
|
1129
|
-
if (addKeyboardShortcuts) {
|
|
1130
|
-
const bindings = Object.fromEntries(Object.entries(addKeyboardShortcuts()).map(([shortcut, method]) => {
|
|
1131
|
-
return [shortcut, () => method({ editor })];
|
|
1132
|
-
}));
|
|
1133
|
-
defaultBindings = { ...defaultBindings, ...bindings };
|
|
1134
|
-
}
|
|
1135
|
-
const keyMapPlugin = keymap(defaultBindings);
|
|
1136
|
-
plugins.push(keyMapPlugin);
|
|
1137
|
-
const addInputRules = getExtensionField(extension, "addInputRules", context);
|
|
1138
|
-
if (isExtensionRulesEnabled(extension, editor.options.enableInputRules) && addInputRules) {
|
|
1139
|
-
inputRules.push(...addInputRules());
|
|
1140
|
-
}
|
|
1141
|
-
const addPasteRules = getExtensionField(extension, "addPasteRules", context);
|
|
1142
|
-
if (isExtensionRulesEnabled(extension, editor.options.enablePasteRules) && addPasteRules) {
|
|
1143
|
-
pasteRules.push(...addPasteRules());
|
|
1144
|
-
}
|
|
1145
|
-
const addProseMirrorPlugins = getExtensionField(extension, "addProseMirrorPlugins", context);
|
|
1146
|
-
if (addProseMirrorPlugins) {
|
|
1147
|
-
const proseMirrorPlugins = addProseMirrorPlugins();
|
|
1148
|
-
plugins.push(...proseMirrorPlugins);
|
|
1149
|
-
}
|
|
1150
|
-
return plugins;
|
|
1151
|
-
}).flat();
|
|
1152
|
-
return [
|
|
1153
|
-
inputRulesPlugin({
|
|
1154
|
-
editor,
|
|
1155
|
-
rules: inputRules
|
|
1156
|
-
}),
|
|
1157
|
-
...pasteRulesPlugin({
|
|
1158
|
-
editor,
|
|
1159
|
-
rules: pasteRules
|
|
1160
|
-
}),
|
|
1161
|
-
...allPlugins
|
|
1162
|
-
];
|
|
1163
|
-
}
|
|
1164
|
-
/**
|
|
1165
|
-
* Get all attributes from the extensions.
|
|
1166
|
-
* @returns An array of attributes
|
|
1167
|
-
*/
|
|
1168
|
-
get attributes() {
|
|
1169
|
-
return getAttributesFromExtensions(this.extensions);
|
|
1170
|
-
}
|
|
1171
|
-
/**
|
|
1172
|
-
* Get all node views from the extensions.
|
|
1173
|
-
* @returns An object with all node views where the key is the node name and the value is the node view function
|
|
1174
|
-
*/
|
|
1175
|
-
get nodeViews() {
|
|
1176
|
-
const { editor } = this;
|
|
1177
|
-
const { nodeExtensions } = splitExtensions(this.extensions);
|
|
1178
|
-
return Object.fromEntries(nodeExtensions.filter((extension) => !!getExtensionField(extension, "addNodeView")).map((extension) => {
|
|
1179
|
-
const extensionAttributes = this.attributes.filter((attribute) => attribute.type === extension.name);
|
|
1180
|
-
const context = {
|
|
1181
|
-
name: extension.name,
|
|
1182
|
-
options: extension.options,
|
|
1183
|
-
storage: extension.storage,
|
|
1184
|
-
editor,
|
|
1185
|
-
type: getNodeType(extension.name, this.schema)
|
|
1186
|
-
};
|
|
1187
|
-
const addNodeView = getExtensionField(extension, "addNodeView", context);
|
|
1188
|
-
if (!addNodeView) {
|
|
1189
|
-
return [];
|
|
1190
|
-
}
|
|
1191
|
-
const nodeview = (node, view, getPos, decorations, innerDecorations) => {
|
|
1192
|
-
const HTMLAttributes = getRenderedAttributes(node, extensionAttributes);
|
|
1193
|
-
return addNodeView()({
|
|
1194
|
-
// pass-through
|
|
1195
|
-
node,
|
|
1196
|
-
view,
|
|
1197
|
-
getPos,
|
|
1198
|
-
decorations,
|
|
1199
|
-
innerDecorations,
|
|
1200
|
-
// tiptap-specific
|
|
1201
|
-
editor,
|
|
1202
|
-
extension,
|
|
1203
|
-
HTMLAttributes
|
|
1204
|
-
});
|
|
1205
|
-
};
|
|
1206
|
-
return [extension.name, nodeview];
|
|
1207
|
-
}));
|
|
1208
|
-
}
|
|
1209
|
-
/**
|
|
1210
|
-
* Go through all extensions, create extension storages & setup marks
|
|
1211
|
-
* & bind editor event listener.
|
|
1212
|
-
*/
|
|
1213
|
-
setupExtensions() {
|
|
1214
|
-
this.extensions.forEach((extension) => {
|
|
1215
|
-
var _a;
|
|
1216
|
-
this.editor.extensionStorage[extension.name] = extension.storage;
|
|
1217
|
-
const context = {
|
|
1218
|
-
name: extension.name,
|
|
1219
|
-
options: extension.options,
|
|
1220
|
-
storage: extension.storage,
|
|
1221
|
-
editor: this.editor,
|
|
1222
|
-
type: getSchemaTypeByName(extension.name, this.schema)
|
|
1223
|
-
};
|
|
1224
|
-
if (extension.type === "mark") {
|
|
1225
|
-
const keepOnSplit = (_a = callOrReturn(getExtensionField(extension, "keepOnSplit", context))) !== null && _a !== void 0 ? _a : true;
|
|
1226
|
-
if (keepOnSplit) {
|
|
1227
|
-
this.splittableMarks.push(extension.name);
|
|
1228
|
-
}
|
|
1229
|
-
}
|
|
1230
|
-
const onBeforeCreate = getExtensionField(extension, "onBeforeCreate", context);
|
|
1231
|
-
const onCreate = getExtensionField(extension, "onCreate", context);
|
|
1232
|
-
const onUpdate = getExtensionField(extension, "onUpdate", context);
|
|
1233
|
-
const onSelectionUpdate = getExtensionField(extension, "onSelectionUpdate", context);
|
|
1234
|
-
const onTransaction = getExtensionField(extension, "onTransaction", context);
|
|
1235
|
-
const onFocus = getExtensionField(extension, "onFocus", context);
|
|
1236
|
-
const onBlur = getExtensionField(extension, "onBlur", context);
|
|
1237
|
-
const onDestroy = getExtensionField(extension, "onDestroy", context);
|
|
1238
|
-
if (onBeforeCreate) {
|
|
1239
|
-
this.editor.on("beforeCreate", onBeforeCreate);
|
|
1240
|
-
}
|
|
1241
|
-
if (onCreate) {
|
|
1242
|
-
this.editor.on("create", onCreate);
|
|
1243
|
-
}
|
|
1244
|
-
if (onUpdate) {
|
|
1245
|
-
this.editor.on("update", onUpdate);
|
|
1246
|
-
}
|
|
1247
|
-
if (onSelectionUpdate) {
|
|
1248
|
-
this.editor.on("selectionUpdate", onSelectionUpdate);
|
|
1249
|
-
}
|
|
1250
|
-
if (onTransaction) {
|
|
1251
|
-
this.editor.on("transaction", onTransaction);
|
|
1252
|
-
}
|
|
1253
|
-
if (onFocus) {
|
|
1254
|
-
this.editor.on("focus", onFocus);
|
|
1255
|
-
}
|
|
1256
|
-
if (onBlur) {
|
|
1257
|
-
this.editor.on("blur", onBlur);
|
|
1258
|
-
}
|
|
1259
|
-
if (onDestroy) {
|
|
1260
|
-
this.editor.on("destroy", onDestroy);
|
|
1261
|
-
}
|
|
1262
|
-
});
|
|
1263
|
-
}
|
|
1264
|
-
}
|
|
1265
|
-
class Extension {
|
|
1266
|
-
constructor(config = {}) {
|
|
1267
|
-
this.type = "extension";
|
|
1268
|
-
this.name = "extension";
|
|
1269
|
-
this.parent = null;
|
|
1270
|
-
this.child = null;
|
|
1271
|
-
this.config = {
|
|
1272
|
-
name: this.name,
|
|
1273
|
-
defaultOptions: {}
|
|
1274
|
-
};
|
|
1275
|
-
this.config = {
|
|
1276
|
-
...this.config,
|
|
1277
|
-
...config
|
|
1278
|
-
};
|
|
1279
|
-
this.name = this.config.name;
|
|
1280
|
-
if (config.defaultOptions && Object.keys(config.defaultOptions).length > 0) {
|
|
1281
|
-
console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`);
|
|
1282
|
-
}
|
|
1283
|
-
this.options = this.config.defaultOptions;
|
|
1284
|
-
if (this.config.addOptions) {
|
|
1285
|
-
this.options = callOrReturn(getExtensionField(this, "addOptions", {
|
|
1286
|
-
name: this.name
|
|
1287
|
-
}));
|
|
1288
|
-
}
|
|
1289
|
-
this.storage = callOrReturn(getExtensionField(this, "addStorage", {
|
|
1290
|
-
name: this.name,
|
|
1291
|
-
options: this.options
|
|
1292
|
-
})) || {};
|
|
1293
|
-
}
|
|
1294
|
-
static create(config = {}) {
|
|
1295
|
-
return new Extension(config);
|
|
1296
|
-
}
|
|
1297
|
-
configure(options = {}) {
|
|
1298
|
-
const extension = this.extend({
|
|
1299
|
-
...this.config,
|
|
1300
|
-
addOptions: () => {
|
|
1301
|
-
return mergeDeep(this.options, options);
|
|
1302
|
-
}
|
|
1303
|
-
});
|
|
1304
|
-
extension.name = this.name;
|
|
1305
|
-
extension.parent = this.parent;
|
|
1306
|
-
return extension;
|
|
1307
|
-
}
|
|
1308
|
-
extend(extendedConfig = {}) {
|
|
1309
|
-
const extension = new Extension({ ...this.config, ...extendedConfig });
|
|
1310
|
-
extension.parent = this;
|
|
1311
|
-
this.child = extension;
|
|
1312
|
-
extension.name = extendedConfig.name ? extendedConfig.name : extension.parent.name;
|
|
1313
|
-
if (extendedConfig.defaultOptions && Object.keys(extendedConfig.defaultOptions).length > 0) {
|
|
1314
|
-
console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${extension.name}".`);
|
|
1315
|
-
}
|
|
1316
|
-
extension.options = callOrReturn(getExtensionField(extension, "addOptions", {
|
|
1317
|
-
name: extension.name
|
|
1318
|
-
}));
|
|
1319
|
-
extension.storage = callOrReturn(getExtensionField(extension, "addStorage", {
|
|
1320
|
-
name: extension.name,
|
|
1321
|
-
options: extension.options
|
|
1322
|
-
}));
|
|
1323
|
-
return extension;
|
|
1324
|
-
}
|
|
1325
|
-
}
|
|
1326
|
-
function getTextBetween(startNode, range, options) {
|
|
1327
|
-
const { from, to } = range;
|
|
1328
|
-
const { blockSeparator = "\n\n", textSerializers = {} } = options || {};
|
|
1329
|
-
let text = "";
|
|
1330
|
-
startNode.nodesBetween(from, to, (node, pos, parent, index) => {
|
|
1331
|
-
var _a;
|
|
1332
|
-
if (node.isBlock && pos > from) {
|
|
1333
|
-
text += blockSeparator;
|
|
1334
|
-
}
|
|
1335
|
-
const textSerializer = textSerializers === null || textSerializers === void 0 ? void 0 : textSerializers[node.type.name];
|
|
1336
|
-
if (textSerializer) {
|
|
1337
|
-
if (parent) {
|
|
1338
|
-
text += textSerializer({
|
|
1339
|
-
node,
|
|
1340
|
-
pos,
|
|
1341
|
-
parent,
|
|
1342
|
-
index,
|
|
1343
|
-
range
|
|
1344
|
-
});
|
|
1345
|
-
}
|
|
1346
|
-
return false;
|
|
1347
|
-
}
|
|
1348
|
-
if (node.isText) {
|
|
1349
|
-
text += (_a = node === null || node === void 0 ? void 0 : node.text) === null || _a === void 0 ? void 0 : _a.slice(Math.max(from, pos) - pos, to - pos);
|
|
1350
|
-
}
|
|
1351
|
-
});
|
|
1352
|
-
return text;
|
|
1353
|
-
}
|
|
1354
|
-
function getTextSerializersFromSchema(schema) {
|
|
1355
|
-
return Object.fromEntries(Object.entries(schema.nodes).filter(([, node]) => node.spec.toText).map(([name, node]) => [name, node.spec.toText]));
|
|
1356
|
-
}
|
|
1357
|
-
const ClipboardTextSerializer = Extension.create({
|
|
1358
|
-
name: "clipboardTextSerializer",
|
|
1359
|
-
addOptions() {
|
|
1360
|
-
return {
|
|
1361
|
-
blockSeparator: void 0
|
|
1362
|
-
};
|
|
1363
|
-
},
|
|
1364
|
-
addProseMirrorPlugins() {
|
|
1365
|
-
return [
|
|
1366
|
-
new Plugin({
|
|
1367
|
-
key: new PluginKey("clipboardTextSerializer"),
|
|
1368
|
-
props: {
|
|
1369
|
-
clipboardTextSerializer: () => {
|
|
1370
|
-
const { editor } = this;
|
|
1371
|
-
const { state, schema } = editor;
|
|
1372
|
-
const { doc, selection } = state;
|
|
1373
|
-
const { ranges } = selection;
|
|
1374
|
-
const from = Math.min(...ranges.map((range2) => range2.$from.pos));
|
|
1375
|
-
const to = Math.max(...ranges.map((range2) => range2.$to.pos));
|
|
1376
|
-
const textSerializers = getTextSerializersFromSchema(schema);
|
|
1377
|
-
const range = { from, to };
|
|
1378
|
-
return getTextBetween(doc, range, {
|
|
1379
|
-
...this.options.blockSeparator !== void 0 ? { blockSeparator: this.options.blockSeparator } : {},
|
|
1380
|
-
textSerializers
|
|
1381
|
-
});
|
|
1382
|
-
}
|
|
1383
|
-
}
|
|
1384
|
-
})
|
|
1385
|
-
];
|
|
1386
|
-
}
|
|
1387
|
-
});
|
|
1388
|
-
const blur = () => ({ editor, view }) => {
|
|
1389
|
-
requestAnimationFrame(() => {
|
|
1390
|
-
var _a;
|
|
1391
|
-
if (!editor.isDestroyed) {
|
|
1392
|
-
view.dom.blur();
|
|
1393
|
-
(_a = window === null || window === void 0 ? void 0 : window.getSelection()) === null || _a === void 0 ? void 0 : _a.removeAllRanges();
|
|
1394
|
-
}
|
|
1395
|
-
});
|
|
1396
|
-
return true;
|
|
1397
|
-
};
|
|
1398
|
-
const clearContent = (emitUpdate = false) => ({ commands: commands2 }) => {
|
|
1399
|
-
return commands2.setContent("", emitUpdate);
|
|
1400
|
-
};
|
|
1401
|
-
const clearNodes = () => ({ state, tr, dispatch }) => {
|
|
1402
|
-
const { selection } = tr;
|
|
1403
|
-
const { ranges } = selection;
|
|
1404
|
-
if (!dispatch) {
|
|
1405
|
-
return true;
|
|
1406
|
-
}
|
|
1407
|
-
ranges.forEach(({ $from, $to }) => {
|
|
1408
|
-
state.doc.nodesBetween($from.pos, $to.pos, (node, pos) => {
|
|
1409
|
-
if (node.type.isText) {
|
|
1410
|
-
return;
|
|
1411
|
-
}
|
|
1412
|
-
const { doc, mapping } = tr;
|
|
1413
|
-
const $mappedFrom = doc.resolve(mapping.map(pos));
|
|
1414
|
-
const $mappedTo = doc.resolve(mapping.map(pos + node.nodeSize));
|
|
1415
|
-
const nodeRange = $mappedFrom.blockRange($mappedTo);
|
|
1416
|
-
if (!nodeRange) {
|
|
1417
|
-
return;
|
|
1418
|
-
}
|
|
1419
|
-
const targetLiftDepth = liftTarget(nodeRange);
|
|
1420
|
-
if (node.type.isTextblock) {
|
|
1421
|
-
const { defaultType } = $mappedFrom.parent.contentMatchAt($mappedFrom.index());
|
|
1422
|
-
tr.setNodeMarkup(nodeRange.start, defaultType);
|
|
1423
|
-
}
|
|
1424
|
-
if (targetLiftDepth || targetLiftDepth === 0) {
|
|
1425
|
-
tr.lift(nodeRange, targetLiftDepth);
|
|
1426
|
-
}
|
|
1427
|
-
});
|
|
1428
|
-
});
|
|
1429
|
-
return true;
|
|
1430
|
-
};
|
|
1431
|
-
const command = (fn) => (props) => {
|
|
1432
|
-
return fn(props);
|
|
1433
|
-
};
|
|
1434
|
-
const createParagraphNear = () => ({ state, dispatch }) => {
|
|
1435
|
-
return createParagraphNear$1(state, dispatch);
|
|
1436
|
-
};
|
|
1437
|
-
const cut = (originRange, targetPos) => ({ editor, tr }) => {
|
|
1438
|
-
const { state } = editor;
|
|
1439
|
-
const contentSlice = state.doc.slice(originRange.from, originRange.to);
|
|
1440
|
-
tr.deleteRange(originRange.from, originRange.to);
|
|
1441
|
-
const newPos = tr.mapping.map(targetPos);
|
|
1442
|
-
tr.insert(newPos, contentSlice.content);
|
|
1443
|
-
tr.setSelection(new TextSelection(tr.doc.resolve(Math.max(newPos - 1, 0))));
|
|
1444
|
-
return true;
|
|
1445
|
-
};
|
|
1446
|
-
const deleteCurrentNode = () => ({ tr, dispatch }) => {
|
|
1447
|
-
const { selection } = tr;
|
|
1448
|
-
const currentNode = selection.$anchor.node();
|
|
1449
|
-
if (currentNode.content.size > 0) {
|
|
1450
|
-
return false;
|
|
1451
|
-
}
|
|
1452
|
-
const $pos = tr.selection.$anchor;
|
|
1453
|
-
for (let depth = $pos.depth; depth > 0; depth -= 1) {
|
|
1454
|
-
const node = $pos.node(depth);
|
|
1455
|
-
if (node.type === currentNode.type) {
|
|
1456
|
-
if (dispatch) {
|
|
1457
|
-
const from = $pos.before(depth);
|
|
1458
|
-
const to = $pos.after(depth);
|
|
1459
|
-
tr.delete(from, to).scrollIntoView();
|
|
1460
|
-
}
|
|
1461
|
-
return true;
|
|
1462
|
-
}
|
|
1463
|
-
}
|
|
1464
|
-
return false;
|
|
1465
|
-
};
|
|
1466
|
-
const deleteNode = (typeOrName) => ({ tr, state, dispatch }) => {
|
|
1467
|
-
const type = getNodeType(typeOrName, state.schema);
|
|
1468
|
-
const $pos = tr.selection.$anchor;
|
|
1469
|
-
for (let depth = $pos.depth; depth > 0; depth -= 1) {
|
|
1470
|
-
const node = $pos.node(depth);
|
|
1471
|
-
if (node.type === type) {
|
|
1472
|
-
if (dispatch) {
|
|
1473
|
-
const from = $pos.before(depth);
|
|
1474
|
-
const to = $pos.after(depth);
|
|
1475
|
-
tr.delete(from, to).scrollIntoView();
|
|
1476
|
-
}
|
|
1477
|
-
return true;
|
|
1478
|
-
}
|
|
1479
|
-
}
|
|
1480
|
-
return false;
|
|
1481
|
-
};
|
|
1482
|
-
const deleteRange = (range) => ({ tr, dispatch }) => {
|
|
1483
|
-
const { from, to } = range;
|
|
1484
|
-
if (dispatch) {
|
|
1485
|
-
tr.delete(from, to);
|
|
1486
|
-
}
|
|
1487
|
-
return true;
|
|
1488
|
-
};
|
|
1489
|
-
const deleteSelection = () => ({ state, dispatch }) => {
|
|
1490
|
-
return deleteSelection$1(state, dispatch);
|
|
1491
|
-
};
|
|
1492
|
-
const enter = () => ({ commands: commands2 }) => {
|
|
1493
|
-
return commands2.keyboardShortcut("Enter");
|
|
1494
|
-
};
|
|
1495
|
-
const exitCode = () => ({ state, dispatch }) => {
|
|
1496
|
-
return exitCode$1(state, dispatch);
|
|
1497
|
-
};
|
|
1498
|
-
function objectIncludes(object1, object2, options = { strict: true }) {
|
|
1499
|
-
const keys = Object.keys(object2);
|
|
1500
|
-
if (!keys.length) {
|
|
1501
|
-
return true;
|
|
1502
|
-
}
|
|
1503
|
-
return keys.every((key) => {
|
|
1504
|
-
if (options.strict) {
|
|
1505
|
-
return object2[key] === object1[key];
|
|
1506
|
-
}
|
|
1507
|
-
if (isRegExp(object2[key])) {
|
|
1508
|
-
return object2[key].test(object1[key]);
|
|
1509
|
-
}
|
|
1510
|
-
return object2[key] === object1[key];
|
|
1511
|
-
});
|
|
1512
|
-
}
|
|
1513
|
-
function findMarkInSet(marks, type, attributes = {}) {
|
|
1514
|
-
return marks.find((item) => {
|
|
1515
|
-
return item.type === type && objectIncludes(
|
|
1516
|
-
// Only check equality for the attributes that are provided
|
|
1517
|
-
Object.fromEntries(Object.keys(attributes).map((k) => [k, item.attrs[k]])),
|
|
1518
|
-
attributes
|
|
1519
|
-
);
|
|
1520
|
-
});
|
|
1521
|
-
}
|
|
1522
|
-
function isMarkInSet(marks, type, attributes = {}) {
|
|
1523
|
-
return !!findMarkInSet(marks, type, attributes);
|
|
1524
|
-
}
|
|
1525
|
-
function getMarkRange($pos, type, attributes) {
|
|
1526
|
-
var _a;
|
|
1527
|
-
if (!$pos || !type) {
|
|
1528
|
-
return;
|
|
1529
|
-
}
|
|
1530
|
-
let start = $pos.parent.childAfter($pos.parentOffset);
|
|
1531
|
-
if (!start.node || !start.node.marks.some((mark2) => mark2.type === type)) {
|
|
1532
|
-
start = $pos.parent.childBefore($pos.parentOffset);
|
|
1533
|
-
}
|
|
1534
|
-
if (!start.node || !start.node.marks.some((mark2) => mark2.type === type)) {
|
|
1535
|
-
return;
|
|
1536
|
-
}
|
|
1537
|
-
attributes = attributes || ((_a = start.node.marks[0]) === null || _a === void 0 ? void 0 : _a.attrs);
|
|
1538
|
-
const mark = findMarkInSet([...start.node.marks], type, attributes);
|
|
1539
|
-
if (!mark) {
|
|
1540
|
-
return;
|
|
1541
|
-
}
|
|
1542
|
-
let startIndex = start.index;
|
|
1543
|
-
let startPos = $pos.start() + start.offset;
|
|
1544
|
-
let endIndex = startIndex + 1;
|
|
1545
|
-
let endPos = startPos + start.node.nodeSize;
|
|
1546
|
-
while (startIndex > 0 && isMarkInSet([...$pos.parent.child(startIndex - 1).marks], type, attributes)) {
|
|
1547
|
-
startIndex -= 1;
|
|
1548
|
-
startPos -= $pos.parent.child(startIndex).nodeSize;
|
|
1549
|
-
}
|
|
1550
|
-
while (endIndex < $pos.parent.childCount && isMarkInSet([...$pos.parent.child(endIndex).marks], type, attributes)) {
|
|
1551
|
-
endPos += $pos.parent.child(endIndex).nodeSize;
|
|
1552
|
-
endIndex += 1;
|
|
1553
|
-
}
|
|
1554
|
-
return {
|
|
1555
|
-
from: startPos,
|
|
1556
|
-
to: endPos
|
|
1557
|
-
};
|
|
1558
|
-
}
|
|
1559
|
-
function getMarkType(nameOrType, schema) {
|
|
1560
|
-
if (typeof nameOrType === "string") {
|
|
1561
|
-
if (!schema.marks[nameOrType]) {
|
|
1562
|
-
throw Error(`There is no mark type named '${nameOrType}'. Maybe you forgot to add the extension?`);
|
|
1563
|
-
}
|
|
1564
|
-
return schema.marks[nameOrType];
|
|
1565
|
-
}
|
|
1566
|
-
return nameOrType;
|
|
1567
|
-
}
|
|
1568
|
-
const extendMarkRange = (typeOrName, attributes = {}) => ({ tr, state, dispatch }) => {
|
|
1569
|
-
const type = getMarkType(typeOrName, state.schema);
|
|
1570
|
-
const { doc, selection } = tr;
|
|
1571
|
-
const { $from, from, to } = selection;
|
|
1572
|
-
if (dispatch) {
|
|
1573
|
-
const range = getMarkRange($from, type, attributes);
|
|
1574
|
-
if (range && range.from <= from && range.to >= to) {
|
|
1575
|
-
const newSelection = TextSelection.create(doc, range.from, range.to);
|
|
1576
|
-
tr.setSelection(newSelection);
|
|
1577
|
-
}
|
|
1578
|
-
}
|
|
1579
|
-
return true;
|
|
1580
|
-
};
|
|
1581
|
-
const first = (commands2) => (props) => {
|
|
1582
|
-
const items = typeof commands2 === "function" ? commands2(props) : commands2;
|
|
1583
|
-
for (let i = 0; i < items.length; i += 1) {
|
|
1584
|
-
if (items[i](props)) {
|
|
1585
|
-
return true;
|
|
1586
|
-
}
|
|
1587
|
-
}
|
|
1588
|
-
return false;
|
|
1589
|
-
};
|
|
1590
|
-
function isTextSelection(value) {
|
|
1591
|
-
return value instanceof TextSelection;
|
|
1592
|
-
}
|
|
1593
|
-
function minMax(value = 0, min = 0, max = 0) {
|
|
1594
|
-
return Math.min(Math.max(value, min), max);
|
|
1595
|
-
}
|
|
1596
|
-
function resolveFocusPosition(doc, position = null) {
|
|
1597
|
-
if (!position) {
|
|
1598
|
-
return null;
|
|
1599
|
-
}
|
|
1600
|
-
const selectionAtStart = Selection.atStart(doc);
|
|
1601
|
-
const selectionAtEnd = Selection.atEnd(doc);
|
|
1602
|
-
if (position === "start" || position === true) {
|
|
1603
|
-
return selectionAtStart;
|
|
1604
|
-
}
|
|
1605
|
-
if (position === "end") {
|
|
1606
|
-
return selectionAtEnd;
|
|
1607
|
-
}
|
|
1608
|
-
const minPos = selectionAtStart.from;
|
|
1609
|
-
const maxPos = selectionAtEnd.to;
|
|
1610
|
-
if (position === "all") {
|
|
1611
|
-
return TextSelection.create(doc, minMax(0, minPos, maxPos), minMax(doc.content.size, minPos, maxPos));
|
|
1612
|
-
}
|
|
1613
|
-
return TextSelection.create(doc, minMax(position, minPos, maxPos), minMax(position, minPos, maxPos));
|
|
1614
|
-
}
|
|
1615
|
-
function isAndroid() {
|
|
1616
|
-
return navigator.platform === "Android" || /android/i.test(navigator.userAgent);
|
|
1617
|
-
}
|
|
1618
|
-
function isiOS() {
|
|
1619
|
-
return [
|
|
1620
|
-
"iPad Simulator",
|
|
1621
|
-
"iPhone Simulator",
|
|
1622
|
-
"iPod Simulator",
|
|
1623
|
-
"iPad",
|
|
1624
|
-
"iPhone",
|
|
1625
|
-
"iPod"
|
|
1626
|
-
].includes(navigator.platform) || navigator.userAgent.includes("Mac") && "ontouchend" in document;
|
|
1627
|
-
}
|
|
1628
|
-
function isSafari() {
|
|
1629
|
-
return typeof navigator !== "undefined" ? /^((?!chrome|android).)*safari/i.test(navigator.userAgent) : false;
|
|
1630
|
-
}
|
|
1631
|
-
const focus = (position = null, options = {}) => ({ editor, view, tr, dispatch }) => {
|
|
1632
|
-
options = {
|
|
1633
|
-
scrollIntoView: true,
|
|
1634
|
-
...options
|
|
1635
|
-
};
|
|
1636
|
-
const delayedFocus = () => {
|
|
1637
|
-
if (isiOS() || isAndroid()) {
|
|
1638
|
-
view.dom.focus();
|
|
1639
|
-
}
|
|
1640
|
-
requestAnimationFrame(() => {
|
|
1641
|
-
if (!editor.isDestroyed) {
|
|
1642
|
-
view.focus();
|
|
1643
|
-
if (isSafari() && !isiOS() && !isAndroid()) {
|
|
1644
|
-
view.dom.focus({ preventScroll: true });
|
|
1645
|
-
}
|
|
1646
|
-
}
|
|
1647
|
-
});
|
|
1648
|
-
};
|
|
1649
|
-
if (view.hasFocus() && position === null || position === false) {
|
|
1650
|
-
return true;
|
|
1651
|
-
}
|
|
1652
|
-
if (dispatch && position === null && !isTextSelection(editor.state.selection)) {
|
|
1653
|
-
delayedFocus();
|
|
1654
|
-
return true;
|
|
1655
|
-
}
|
|
1656
|
-
const selection = resolveFocusPosition(tr.doc, position) || editor.state.selection;
|
|
1657
|
-
const isSameSelection = editor.state.selection.eq(selection);
|
|
1658
|
-
if (dispatch) {
|
|
1659
|
-
if (!isSameSelection) {
|
|
1660
|
-
tr.setSelection(selection);
|
|
1661
|
-
}
|
|
1662
|
-
if (isSameSelection && tr.storedMarks) {
|
|
1663
|
-
tr.setStoredMarks(tr.storedMarks);
|
|
1664
|
-
}
|
|
1665
|
-
delayedFocus();
|
|
1666
|
-
}
|
|
1667
|
-
return true;
|
|
1668
|
-
};
|
|
1669
|
-
const forEach = (items, fn) => (props) => {
|
|
1670
|
-
return items.every((item, index) => fn(item, { ...props, index }));
|
|
1671
|
-
};
|
|
1672
|
-
const insertContent = (value, options) => ({ tr, commands: commands2 }) => {
|
|
1673
|
-
return commands2.insertContentAt({ from: tr.selection.from, to: tr.selection.to }, value, options);
|
|
1674
|
-
};
|
|
1675
|
-
const removeWhitespaces = (node) => {
|
|
1676
|
-
const children = node.childNodes;
|
|
1677
|
-
for (let i = children.length - 1; i >= 0; i -= 1) {
|
|
1678
|
-
const child = children[i];
|
|
1679
|
-
if (child.nodeType === 3 && child.nodeValue && /^(\n\s\s|\n)$/.test(child.nodeValue)) {
|
|
1680
|
-
node.removeChild(child);
|
|
1681
|
-
} else if (child.nodeType === 1) {
|
|
1682
|
-
removeWhitespaces(child);
|
|
1683
|
-
}
|
|
1684
|
-
}
|
|
1685
|
-
return node;
|
|
1686
|
-
};
|
|
1687
|
-
function elementFromString(value) {
|
|
1688
|
-
const wrappedValue = `<body>${value}</body>`;
|
|
1689
|
-
const html = new window.DOMParser().parseFromString(wrappedValue, "text/html").body;
|
|
1690
|
-
return removeWhitespaces(html);
|
|
1691
|
-
}
|
|
1692
|
-
function createNodeFromContent(content, schema, options) {
|
|
1693
|
-
if (content instanceof Node$1 || content instanceof Fragment) {
|
|
1694
|
-
return content;
|
|
1695
|
-
}
|
|
1696
|
-
options = {
|
|
1697
|
-
slice: true,
|
|
1698
|
-
parseOptions: {},
|
|
1699
|
-
...options
|
|
1700
|
-
};
|
|
1701
|
-
const isJSONContent = typeof content === "object" && content !== null;
|
|
1702
|
-
const isTextContent = typeof content === "string";
|
|
1703
|
-
if (isJSONContent) {
|
|
1704
|
-
try {
|
|
1705
|
-
const isArrayContent = Array.isArray(content) && content.length > 0;
|
|
1706
|
-
if (isArrayContent) {
|
|
1707
|
-
return Fragment.fromArray(content.map((item) => schema.nodeFromJSON(item)));
|
|
1708
|
-
}
|
|
1709
|
-
const node = schema.nodeFromJSON(content);
|
|
1710
|
-
if (options.errorOnInvalidContent) {
|
|
1711
|
-
node.check();
|
|
1712
|
-
}
|
|
1713
|
-
return node;
|
|
1714
|
-
} catch (error) {
|
|
1715
|
-
if (options.errorOnInvalidContent) {
|
|
1716
|
-
throw new Error("[tiptap error]: Invalid JSON content", { cause: error });
|
|
1717
|
-
}
|
|
1718
|
-
console.warn("[tiptap warn]: Invalid content.", "Passed value:", content, "Error:", error);
|
|
1719
|
-
return createNodeFromContent("", schema, options);
|
|
1720
|
-
}
|
|
1721
|
-
}
|
|
1722
|
-
if (isTextContent) {
|
|
1723
|
-
if (options.errorOnInvalidContent) {
|
|
1724
|
-
let hasInvalidContent = false;
|
|
1725
|
-
let invalidContent = "";
|
|
1726
|
-
const contentCheckSchema = new Schema({
|
|
1727
|
-
topNode: schema.spec.topNode,
|
|
1728
|
-
marks: schema.spec.marks,
|
|
1729
|
-
// Prosemirror's schemas are executed such that: the last to execute, matches last
|
|
1730
|
-
// This means that we can add a catch-all node at the end of the schema to catch any content that we don't know how to handle
|
|
1731
|
-
nodes: schema.spec.nodes.append({
|
|
1732
|
-
__tiptap__private__unknown__catch__all__node: {
|
|
1733
|
-
content: "inline*",
|
|
1734
|
-
group: "block",
|
|
1735
|
-
parseDOM: [
|
|
1736
|
-
{
|
|
1737
|
-
tag: "*",
|
|
1738
|
-
getAttrs: (e) => {
|
|
1739
|
-
hasInvalidContent = true;
|
|
1740
|
-
invalidContent = typeof e === "string" ? e : e.outerHTML;
|
|
1741
|
-
return null;
|
|
1742
|
-
}
|
|
1743
|
-
}
|
|
1744
|
-
]
|
|
1745
|
-
}
|
|
1746
|
-
})
|
|
1747
|
-
});
|
|
1748
|
-
if (options.slice) {
|
|
1749
|
-
DOMParser.fromSchema(contentCheckSchema).parseSlice(elementFromString(content), options.parseOptions);
|
|
1750
|
-
} else {
|
|
1751
|
-
DOMParser.fromSchema(contentCheckSchema).parse(elementFromString(content), options.parseOptions);
|
|
1752
|
-
}
|
|
1753
|
-
if (options.errorOnInvalidContent && hasInvalidContent) {
|
|
1754
|
-
throw new Error("[tiptap error]: Invalid HTML content", { cause: new Error(`Invalid element found: ${invalidContent}`) });
|
|
1755
|
-
}
|
|
1756
|
-
}
|
|
1757
|
-
const parser = DOMParser.fromSchema(schema);
|
|
1758
|
-
if (options.slice) {
|
|
1759
|
-
return parser.parseSlice(elementFromString(content), options.parseOptions).content;
|
|
1760
|
-
}
|
|
1761
|
-
return parser.parse(elementFromString(content), options.parseOptions);
|
|
1762
|
-
}
|
|
1763
|
-
return createNodeFromContent("", schema, options);
|
|
1764
|
-
}
|
|
1765
|
-
function selectionToInsertionEnd(tr, startLen, bias) {
|
|
1766
|
-
const last = tr.steps.length - 1;
|
|
1767
|
-
if (last < startLen) {
|
|
1768
|
-
return;
|
|
1769
|
-
}
|
|
1770
|
-
const step = tr.steps[last];
|
|
1771
|
-
if (!(step instanceof ReplaceStep || step instanceof ReplaceAroundStep)) {
|
|
1772
|
-
return;
|
|
1773
|
-
}
|
|
1774
|
-
const map = tr.mapping.maps[last];
|
|
1775
|
-
let end = 0;
|
|
1776
|
-
map.forEach((_from, _to, _newFrom, newTo) => {
|
|
1777
|
-
if (end === 0) {
|
|
1778
|
-
end = newTo;
|
|
1779
|
-
}
|
|
1780
|
-
});
|
|
1781
|
-
tr.setSelection(Selection.near(tr.doc.resolve(end), bias));
|
|
1782
|
-
}
|
|
1783
|
-
const isFragment = (nodeOrFragment) => {
|
|
1784
|
-
return !("type" in nodeOrFragment);
|
|
1785
|
-
};
|
|
1786
|
-
const insertContentAt = (position, value, options) => ({ tr, dispatch, editor }) => {
|
|
1787
|
-
var _a;
|
|
1788
|
-
if (dispatch) {
|
|
1789
|
-
options = {
|
|
1790
|
-
parseOptions: editor.options.parseOptions,
|
|
1791
|
-
updateSelection: true,
|
|
1792
|
-
applyInputRules: false,
|
|
1793
|
-
applyPasteRules: false,
|
|
1794
|
-
...options
|
|
1795
|
-
};
|
|
1796
|
-
let content;
|
|
1797
|
-
const emitContentError = (error) => {
|
|
1798
|
-
editor.emit("contentError", {
|
|
1799
|
-
editor,
|
|
1800
|
-
error,
|
|
1801
|
-
disableCollaboration: () => {
|
|
1802
|
-
if (editor.storage.collaboration) {
|
|
1803
|
-
editor.storage.collaboration.isDisabled = true;
|
|
1804
|
-
}
|
|
1805
|
-
}
|
|
1806
|
-
});
|
|
1807
|
-
};
|
|
1808
|
-
const parseOptions = {
|
|
1809
|
-
preserveWhitespace: "full",
|
|
1810
|
-
...options.parseOptions
|
|
1811
|
-
};
|
|
1812
|
-
if (!options.errorOnInvalidContent && !editor.options.enableContentCheck && editor.options.emitContentError) {
|
|
1813
|
-
try {
|
|
1814
|
-
createNodeFromContent(value, editor.schema, {
|
|
1815
|
-
parseOptions,
|
|
1816
|
-
errorOnInvalidContent: true
|
|
1817
|
-
});
|
|
1818
|
-
} catch (e) {
|
|
1819
|
-
emitContentError(e);
|
|
1820
|
-
}
|
|
1821
|
-
}
|
|
1822
|
-
try {
|
|
1823
|
-
content = createNodeFromContent(value, editor.schema, {
|
|
1824
|
-
parseOptions,
|
|
1825
|
-
errorOnInvalidContent: (_a = options.errorOnInvalidContent) !== null && _a !== void 0 ? _a : editor.options.enableContentCheck
|
|
1826
|
-
});
|
|
1827
|
-
} catch (e) {
|
|
1828
|
-
emitContentError(e);
|
|
1829
|
-
return false;
|
|
1830
|
-
}
|
|
1831
|
-
let { from, to } = typeof position === "number" ? { from: position, to: position } : { from: position.from, to: position.to };
|
|
1832
|
-
let isOnlyTextContent = true;
|
|
1833
|
-
let isOnlyBlockContent = true;
|
|
1834
|
-
const nodes = isFragment(content) ? content : [content];
|
|
1835
|
-
nodes.forEach((node) => {
|
|
1836
|
-
node.check();
|
|
1837
|
-
isOnlyTextContent = isOnlyTextContent ? node.isText && node.marks.length === 0 : false;
|
|
1838
|
-
isOnlyBlockContent = isOnlyBlockContent ? node.isBlock : false;
|
|
1839
|
-
});
|
|
1840
|
-
if (from === to && isOnlyBlockContent) {
|
|
1841
|
-
const { parent } = tr.doc.resolve(from);
|
|
1842
|
-
const isEmptyTextBlock = parent.isTextblock && !parent.type.spec.code && !parent.childCount;
|
|
1843
|
-
if (isEmptyTextBlock) {
|
|
1844
|
-
from -= 1;
|
|
1845
|
-
to += 1;
|
|
1846
|
-
}
|
|
1847
|
-
}
|
|
1848
|
-
let newContent;
|
|
1849
|
-
if (isOnlyTextContent) {
|
|
1850
|
-
if (Array.isArray(value)) {
|
|
1851
|
-
newContent = value.map((v) => v.text || "").join("");
|
|
1852
|
-
} else if (value instanceof Fragment) {
|
|
1853
|
-
let text = "";
|
|
1854
|
-
value.forEach((node) => {
|
|
1855
|
-
if (node.text) {
|
|
1856
|
-
text += node.text;
|
|
1857
|
-
}
|
|
1858
|
-
});
|
|
1859
|
-
newContent = text;
|
|
1860
|
-
} else if (typeof value === "object" && !!value && !!value.text) {
|
|
1861
|
-
newContent = value.text;
|
|
1862
|
-
} else {
|
|
1863
|
-
newContent = value;
|
|
1864
|
-
}
|
|
1865
|
-
tr.insertText(newContent, from, to);
|
|
1866
|
-
} else {
|
|
1867
|
-
newContent = content;
|
|
1868
|
-
tr.replaceWith(from, to, newContent);
|
|
1869
|
-
}
|
|
1870
|
-
if (options.updateSelection) {
|
|
1871
|
-
selectionToInsertionEnd(tr, tr.steps.length - 1, -1);
|
|
1872
|
-
}
|
|
1873
|
-
if (options.applyInputRules) {
|
|
1874
|
-
tr.setMeta("applyInputRules", { from, text: newContent });
|
|
1875
|
-
}
|
|
1876
|
-
if (options.applyPasteRules) {
|
|
1877
|
-
tr.setMeta("applyPasteRules", { from, text: newContent });
|
|
1878
|
-
}
|
|
1879
|
-
}
|
|
1880
|
-
return true;
|
|
1881
|
-
};
|
|
1882
|
-
const joinUp = () => ({ state, dispatch }) => {
|
|
1883
|
-
return joinUp$1(state, dispatch);
|
|
1884
|
-
};
|
|
1885
|
-
const joinDown = () => ({ state, dispatch }) => {
|
|
1886
|
-
return joinDown$1(state, dispatch);
|
|
1887
|
-
};
|
|
1888
|
-
const joinBackward = () => ({ state, dispatch }) => {
|
|
1889
|
-
return joinBackward$1(state, dispatch);
|
|
1890
|
-
};
|
|
1891
|
-
const joinForward = () => ({ state, dispatch }) => {
|
|
1892
|
-
return joinForward$1(state, dispatch);
|
|
1893
|
-
};
|
|
1894
|
-
const joinItemBackward = () => ({ state, dispatch, tr }) => {
|
|
1895
|
-
try {
|
|
1896
|
-
const point = joinPoint(state.doc, state.selection.$from.pos, -1);
|
|
1897
|
-
if (point === null || point === void 0) {
|
|
1898
|
-
return false;
|
|
1899
|
-
}
|
|
1900
|
-
tr.join(point, 2);
|
|
1901
|
-
if (dispatch) {
|
|
1902
|
-
dispatch(tr);
|
|
1903
|
-
}
|
|
1904
|
-
return true;
|
|
1905
|
-
} catch {
|
|
1906
|
-
return false;
|
|
1907
|
-
}
|
|
1908
|
-
};
|
|
1909
|
-
const joinItemForward = () => ({ state, dispatch, tr }) => {
|
|
1910
|
-
try {
|
|
1911
|
-
const point = joinPoint(state.doc, state.selection.$from.pos, 1);
|
|
1912
|
-
if (point === null || point === void 0) {
|
|
1913
|
-
return false;
|
|
1914
|
-
}
|
|
1915
|
-
tr.join(point, 2);
|
|
1916
|
-
if (dispatch) {
|
|
1917
|
-
dispatch(tr);
|
|
1918
|
-
}
|
|
1919
|
-
return true;
|
|
1920
|
-
} catch {
|
|
1921
|
-
return false;
|
|
1922
|
-
}
|
|
1923
|
-
};
|
|
1924
|
-
const joinTextblockBackward = () => ({ state, dispatch }) => {
|
|
1925
|
-
return joinTextblockBackward$1(state, dispatch);
|
|
1926
|
-
};
|
|
1927
|
-
const joinTextblockForward = () => ({ state, dispatch }) => {
|
|
1928
|
-
return joinTextblockForward$1(state, dispatch);
|
|
1929
|
-
};
|
|
1930
|
-
function isMacOS() {
|
|
1931
|
-
return typeof navigator !== "undefined" ? /Mac/.test(navigator.platform) : false;
|
|
1932
|
-
}
|
|
1933
|
-
function normalizeKeyName(name) {
|
|
1934
|
-
const parts = name.split(/-(?!$)/);
|
|
1935
|
-
let result = parts[parts.length - 1];
|
|
1936
|
-
if (result === "Space") {
|
|
1937
|
-
result = " ";
|
|
1938
|
-
}
|
|
1939
|
-
let alt;
|
|
1940
|
-
let ctrl;
|
|
1941
|
-
let shift;
|
|
1942
|
-
let meta;
|
|
1943
|
-
for (let i = 0; i < parts.length - 1; i += 1) {
|
|
1944
|
-
const mod = parts[i];
|
|
1945
|
-
if (/^(cmd|meta|m)$/i.test(mod)) {
|
|
1946
|
-
meta = true;
|
|
1947
|
-
} else if (/^a(lt)?$/i.test(mod)) {
|
|
1948
|
-
alt = true;
|
|
1949
|
-
} else if (/^(c|ctrl|control)$/i.test(mod)) {
|
|
1950
|
-
ctrl = true;
|
|
1951
|
-
} else if (/^s(hift)?$/i.test(mod)) {
|
|
1952
|
-
shift = true;
|
|
1953
|
-
} else if (/^mod$/i.test(mod)) {
|
|
1954
|
-
if (isiOS() || isMacOS()) {
|
|
1955
|
-
meta = true;
|
|
1956
|
-
} else {
|
|
1957
|
-
ctrl = true;
|
|
1958
|
-
}
|
|
1959
|
-
} else {
|
|
1960
|
-
throw new Error(`Unrecognized modifier name: ${mod}`);
|
|
1961
|
-
}
|
|
1962
|
-
}
|
|
1963
|
-
if (alt) {
|
|
1964
|
-
result = `Alt-${result}`;
|
|
1965
|
-
}
|
|
1966
|
-
if (ctrl) {
|
|
1967
|
-
result = `Ctrl-${result}`;
|
|
1968
|
-
}
|
|
1969
|
-
if (meta) {
|
|
1970
|
-
result = `Meta-${result}`;
|
|
1971
|
-
}
|
|
1972
|
-
if (shift) {
|
|
1973
|
-
result = `Shift-${result}`;
|
|
1974
|
-
}
|
|
1975
|
-
return result;
|
|
1976
|
-
}
|
|
1977
|
-
const keyboardShortcut = (name) => ({ editor, view, tr, dispatch }) => {
|
|
1978
|
-
const keys = normalizeKeyName(name).split(/-(?!$)/);
|
|
1979
|
-
const key = keys.find((item) => !["Alt", "Ctrl", "Meta", "Shift"].includes(item));
|
|
1980
|
-
const event = new KeyboardEvent("keydown", {
|
|
1981
|
-
key: key === "Space" ? " " : key,
|
|
1982
|
-
altKey: keys.includes("Alt"),
|
|
1983
|
-
ctrlKey: keys.includes("Ctrl"),
|
|
1984
|
-
metaKey: keys.includes("Meta"),
|
|
1985
|
-
shiftKey: keys.includes("Shift"),
|
|
1986
|
-
bubbles: true,
|
|
1987
|
-
cancelable: true
|
|
1988
|
-
});
|
|
1989
|
-
const capturedTransaction = editor.captureTransaction(() => {
|
|
1990
|
-
view.someProp("handleKeyDown", (f) => f(view, event));
|
|
1991
|
-
});
|
|
1992
|
-
capturedTransaction === null || capturedTransaction === void 0 ? void 0 : capturedTransaction.steps.forEach((step) => {
|
|
1993
|
-
const newStep = step.map(tr.mapping);
|
|
1994
|
-
if (newStep && dispatch) {
|
|
1995
|
-
tr.maybeStep(newStep);
|
|
1996
|
-
}
|
|
1997
|
-
});
|
|
1998
|
-
return true;
|
|
1999
|
-
};
|
|
2000
|
-
function isNodeActive(state, typeOrName, attributes = {}) {
|
|
2001
|
-
const { from, to, empty } = state.selection;
|
|
2002
|
-
const type = typeOrName ? getNodeType(typeOrName, state.schema) : null;
|
|
2003
|
-
const nodeRanges = [];
|
|
2004
|
-
state.doc.nodesBetween(from, to, (node, pos) => {
|
|
2005
|
-
if (node.isText) {
|
|
2006
|
-
return;
|
|
2007
|
-
}
|
|
2008
|
-
const relativeFrom = Math.max(from, pos);
|
|
2009
|
-
const relativeTo = Math.min(to, pos + node.nodeSize);
|
|
2010
|
-
nodeRanges.push({
|
|
2011
|
-
node,
|
|
2012
|
-
from: relativeFrom,
|
|
2013
|
-
to: relativeTo
|
|
2014
|
-
});
|
|
2015
|
-
});
|
|
2016
|
-
const selectionRange = to - from;
|
|
2017
|
-
const matchedNodeRanges = nodeRanges.filter((nodeRange) => {
|
|
2018
|
-
if (!type) {
|
|
2019
|
-
return true;
|
|
2020
|
-
}
|
|
2021
|
-
return type.name === nodeRange.node.type.name;
|
|
2022
|
-
}).filter((nodeRange) => objectIncludes(nodeRange.node.attrs, attributes, { strict: false }));
|
|
2023
|
-
if (empty) {
|
|
2024
|
-
return !!matchedNodeRanges.length;
|
|
2025
|
-
}
|
|
2026
|
-
const range = matchedNodeRanges.reduce((sum, nodeRange) => sum + nodeRange.to - nodeRange.from, 0);
|
|
2027
|
-
return range >= selectionRange;
|
|
2028
|
-
}
|
|
2029
|
-
const lift = (typeOrName, attributes = {}) => ({ state, dispatch }) => {
|
|
2030
|
-
const type = getNodeType(typeOrName, state.schema);
|
|
2031
|
-
const isActive2 = isNodeActive(state, type, attributes);
|
|
2032
|
-
if (!isActive2) {
|
|
2033
|
-
return false;
|
|
2034
|
-
}
|
|
2035
|
-
return lift$1(state, dispatch);
|
|
2036
|
-
};
|
|
2037
|
-
const liftEmptyBlock = () => ({ state, dispatch }) => {
|
|
2038
|
-
return liftEmptyBlock$1(state, dispatch);
|
|
2039
|
-
};
|
|
2040
|
-
const liftListItem = (typeOrName) => ({ state, dispatch }) => {
|
|
2041
|
-
const type = getNodeType(typeOrName, state.schema);
|
|
2042
|
-
return liftListItem$1(type)(state, dispatch);
|
|
2043
|
-
};
|
|
2044
|
-
const newlineInCode = () => ({ state, dispatch }) => {
|
|
2045
|
-
return newlineInCode$1(state, dispatch);
|
|
2046
|
-
};
|
|
2047
|
-
function getSchemaTypeNameByName(name, schema) {
|
|
2048
|
-
if (schema.nodes[name]) {
|
|
2049
|
-
return "node";
|
|
2050
|
-
}
|
|
2051
|
-
if (schema.marks[name]) {
|
|
2052
|
-
return "mark";
|
|
2053
|
-
}
|
|
2054
|
-
return null;
|
|
2055
|
-
}
|
|
2056
|
-
function deleteProps(obj, propOrProps) {
|
|
2057
|
-
const props = typeof propOrProps === "string" ? [propOrProps] : propOrProps;
|
|
2058
|
-
return Object.keys(obj).reduce((newObj, prop) => {
|
|
2059
|
-
if (!props.includes(prop)) {
|
|
2060
|
-
newObj[prop] = obj[prop];
|
|
2061
|
-
}
|
|
2062
|
-
return newObj;
|
|
2063
|
-
}, {});
|
|
2064
|
-
}
|
|
2065
|
-
const resetAttributes = (typeOrName, attributes) => ({ tr, state, dispatch }) => {
|
|
2066
|
-
let nodeType = null;
|
|
2067
|
-
let markType = null;
|
|
2068
|
-
const schemaType = getSchemaTypeNameByName(typeof typeOrName === "string" ? typeOrName : typeOrName.name, state.schema);
|
|
2069
|
-
if (!schemaType) {
|
|
2070
|
-
return false;
|
|
2071
|
-
}
|
|
2072
|
-
if (schemaType === "node") {
|
|
2073
|
-
nodeType = getNodeType(typeOrName, state.schema);
|
|
2074
|
-
}
|
|
2075
|
-
if (schemaType === "mark") {
|
|
2076
|
-
markType = getMarkType(typeOrName, state.schema);
|
|
2077
|
-
}
|
|
2078
|
-
if (dispatch) {
|
|
2079
|
-
tr.selection.ranges.forEach((range) => {
|
|
2080
|
-
state.doc.nodesBetween(range.$from.pos, range.$to.pos, (node, pos) => {
|
|
2081
|
-
if (nodeType && nodeType === node.type) {
|
|
2082
|
-
tr.setNodeMarkup(pos, void 0, deleteProps(node.attrs, attributes));
|
|
2083
|
-
}
|
|
2084
|
-
if (markType && node.marks.length) {
|
|
2085
|
-
node.marks.forEach((mark) => {
|
|
2086
|
-
if (markType === mark.type) {
|
|
2087
|
-
tr.addMark(pos, pos + node.nodeSize, markType.create(deleteProps(mark.attrs, attributes)));
|
|
2088
|
-
}
|
|
2089
|
-
});
|
|
2090
|
-
}
|
|
2091
|
-
});
|
|
2092
|
-
});
|
|
2093
|
-
}
|
|
2094
|
-
return true;
|
|
2095
|
-
};
|
|
2096
|
-
const scrollIntoView = () => ({ tr, dispatch }) => {
|
|
2097
|
-
if (dispatch) {
|
|
2098
|
-
tr.scrollIntoView();
|
|
2099
|
-
}
|
|
2100
|
-
return true;
|
|
2101
|
-
};
|
|
2102
|
-
const selectAll = () => ({ tr, dispatch }) => {
|
|
2103
|
-
if (dispatch) {
|
|
2104
|
-
const selection = new AllSelection(tr.doc);
|
|
2105
|
-
tr.setSelection(selection);
|
|
2106
|
-
}
|
|
2107
|
-
return true;
|
|
2108
|
-
};
|
|
2109
|
-
const selectNodeBackward = () => ({ state, dispatch }) => {
|
|
2110
|
-
return selectNodeBackward$1(state, dispatch);
|
|
2111
|
-
};
|
|
2112
|
-
const selectNodeForward = () => ({ state, dispatch }) => {
|
|
2113
|
-
return selectNodeForward$1(state, dispatch);
|
|
2114
|
-
};
|
|
2115
|
-
const selectParentNode = () => ({ state, dispatch }) => {
|
|
2116
|
-
return selectParentNode$1(state, dispatch);
|
|
2117
|
-
};
|
|
2118
|
-
const selectTextblockEnd = () => ({ state, dispatch }) => {
|
|
2119
|
-
return selectTextblockEnd$1(state, dispatch);
|
|
2120
|
-
};
|
|
2121
|
-
const selectTextblockStart = () => ({ state, dispatch }) => {
|
|
2122
|
-
return selectTextblockStart$1(state, dispatch);
|
|
2123
|
-
};
|
|
2124
|
-
function createDocument(content, schema, parseOptions = {}, options = {}) {
|
|
2125
|
-
return createNodeFromContent(content, schema, {
|
|
2126
|
-
slice: false,
|
|
2127
|
-
parseOptions,
|
|
2128
|
-
errorOnInvalidContent: options.errorOnInvalidContent
|
|
2129
|
-
});
|
|
2130
|
-
}
|
|
2131
|
-
const setContent = (content, emitUpdate = false, parseOptions = {}, options = {}) => ({ editor, tr, dispatch, commands: commands2 }) => {
|
|
2132
|
-
var _a, _b;
|
|
2133
|
-
const { doc } = tr;
|
|
2134
|
-
if (parseOptions.preserveWhitespace !== "full") {
|
|
2135
|
-
const document2 = createDocument(content, editor.schema, parseOptions, {
|
|
2136
|
-
errorOnInvalidContent: (_a = options.errorOnInvalidContent) !== null && _a !== void 0 ? _a : editor.options.enableContentCheck
|
|
2137
|
-
});
|
|
2138
|
-
if (dispatch) {
|
|
2139
|
-
tr.replaceWith(0, doc.content.size, document2).setMeta("preventUpdate", !emitUpdate);
|
|
2140
|
-
}
|
|
2141
|
-
return true;
|
|
2142
|
-
}
|
|
2143
|
-
if (dispatch) {
|
|
2144
|
-
tr.setMeta("preventUpdate", !emitUpdate);
|
|
2145
|
-
}
|
|
2146
|
-
return commands2.insertContentAt({ from: 0, to: doc.content.size }, content, {
|
|
2147
|
-
parseOptions,
|
|
2148
|
-
errorOnInvalidContent: (_b = options.errorOnInvalidContent) !== null && _b !== void 0 ? _b : editor.options.enableContentCheck
|
|
2149
|
-
});
|
|
2150
|
-
};
|
|
2151
|
-
function getMarkAttributes(state, typeOrName) {
|
|
2152
|
-
const type = getMarkType(typeOrName, state.schema);
|
|
2153
|
-
const { from, to, empty } = state.selection;
|
|
2154
|
-
const marks = [];
|
|
2155
|
-
if (empty) {
|
|
2156
|
-
if (state.storedMarks) {
|
|
2157
|
-
marks.push(...state.storedMarks);
|
|
2158
|
-
}
|
|
2159
|
-
marks.push(...state.selection.$head.marks());
|
|
2160
|
-
} else {
|
|
2161
|
-
state.doc.nodesBetween(from, to, (node) => {
|
|
2162
|
-
marks.push(...node.marks);
|
|
2163
|
-
});
|
|
2164
|
-
}
|
|
2165
|
-
const mark = marks.find((markItem) => markItem.type.name === type.name);
|
|
2166
|
-
if (!mark) {
|
|
2167
|
-
return {};
|
|
2168
|
-
}
|
|
2169
|
-
return { ...mark.attrs };
|
|
2170
|
-
}
|
|
2171
|
-
function combineTransactionSteps(oldDoc, transactions) {
|
|
2172
|
-
const transform = new Transform(oldDoc);
|
|
2173
|
-
transactions.forEach((transaction) => {
|
|
2174
|
-
transaction.steps.forEach((step) => {
|
|
2175
|
-
transform.step(step);
|
|
2176
|
-
});
|
|
2177
|
-
});
|
|
2178
|
-
return transform;
|
|
2179
|
-
}
|
|
2180
|
-
function defaultBlockAt(match) {
|
|
2181
|
-
for (let i = 0; i < match.edgeCount; i += 1) {
|
|
2182
|
-
const { type } = match.edge(i);
|
|
2183
|
-
if (type.isTextblock && !type.hasRequiredAttrs()) {
|
|
2184
|
-
return type;
|
|
2185
|
-
}
|
|
2186
|
-
}
|
|
2187
|
-
return null;
|
|
2188
|
-
}
|
|
2189
|
-
function findChildrenInRange(node, range, predicate) {
|
|
2190
|
-
const nodesWithPos = [];
|
|
2191
|
-
node.nodesBetween(range.from, range.to, (child, pos) => {
|
|
2192
|
-
if (predicate(child)) {
|
|
2193
|
-
nodesWithPos.push({
|
|
2194
|
-
node: child,
|
|
2195
|
-
pos
|
|
2196
|
-
});
|
|
2197
|
-
}
|
|
2198
|
-
});
|
|
2199
|
-
return nodesWithPos;
|
|
2200
|
-
}
|
|
2201
|
-
function findParentNodeClosestToPos($pos, predicate) {
|
|
2202
|
-
for (let i = $pos.depth; i > 0; i -= 1) {
|
|
2203
|
-
const node = $pos.node(i);
|
|
2204
|
-
if (predicate(node)) {
|
|
2205
|
-
return {
|
|
2206
|
-
pos: i > 0 ? $pos.before(i) : 0,
|
|
2207
|
-
start: $pos.start(i),
|
|
2208
|
-
depth: i,
|
|
2209
|
-
node
|
|
2210
|
-
};
|
|
2211
|
-
}
|
|
2212
|
-
}
|
|
2213
|
-
}
|
|
2214
|
-
function findParentNode(predicate) {
|
|
2215
|
-
return (selection) => findParentNodeClosestToPos(selection.$from, predicate);
|
|
2216
|
-
}
|
|
2217
|
-
function getText(node, options) {
|
|
2218
|
-
const range = {
|
|
2219
|
-
from: 0,
|
|
2220
|
-
to: node.content.size
|
|
2221
|
-
};
|
|
2222
|
-
return getTextBetween(node, range, options);
|
|
2223
|
-
}
|
|
2224
|
-
function getNodeAttributes(state, typeOrName) {
|
|
2225
|
-
const type = getNodeType(typeOrName, state.schema);
|
|
2226
|
-
const { from, to } = state.selection;
|
|
2227
|
-
const nodes = [];
|
|
2228
|
-
state.doc.nodesBetween(from, to, (node2) => {
|
|
2229
|
-
nodes.push(node2);
|
|
2230
|
-
});
|
|
2231
|
-
const node = nodes.reverse().find((nodeItem) => nodeItem.type.name === type.name);
|
|
2232
|
-
if (!node) {
|
|
2233
|
-
return {};
|
|
2234
|
-
}
|
|
2235
|
-
return { ...node.attrs };
|
|
2236
|
-
}
|
|
2237
|
-
function getAttributes(state, typeOrName) {
|
|
2238
|
-
const schemaType = getSchemaTypeNameByName(typeof typeOrName === "string" ? typeOrName : typeOrName.name, state.schema);
|
|
2239
|
-
if (schemaType === "node") {
|
|
2240
|
-
return getNodeAttributes(state, typeOrName);
|
|
2241
|
-
}
|
|
2242
|
-
if (schemaType === "mark") {
|
|
2243
|
-
return getMarkAttributes(state, typeOrName);
|
|
2244
|
-
}
|
|
2245
|
-
return {};
|
|
2246
|
-
}
|
|
2247
|
-
function removeDuplicates(array, by = JSON.stringify) {
|
|
2248
|
-
const seen = {};
|
|
2249
|
-
return array.filter((item) => {
|
|
2250
|
-
const key = by(item);
|
|
2251
|
-
return Object.prototype.hasOwnProperty.call(seen, key) ? false : seen[key] = true;
|
|
2252
|
-
});
|
|
2253
|
-
}
|
|
2254
|
-
function simplifyChangedRanges(changes) {
|
|
2255
|
-
const uniqueChanges = removeDuplicates(changes);
|
|
2256
|
-
return uniqueChanges.length === 1 ? uniqueChanges : uniqueChanges.filter((change, index) => {
|
|
2257
|
-
const rest = uniqueChanges.filter((_, i) => i !== index);
|
|
2258
|
-
return !rest.some((otherChange) => {
|
|
2259
|
-
return change.oldRange.from >= otherChange.oldRange.from && change.oldRange.to <= otherChange.oldRange.to && change.newRange.from >= otherChange.newRange.from && change.newRange.to <= otherChange.newRange.to;
|
|
2260
|
-
});
|
|
2261
|
-
});
|
|
2262
|
-
}
|
|
2263
|
-
function getChangedRanges(transform) {
|
|
2264
|
-
const { mapping, steps } = transform;
|
|
2265
|
-
const changes = [];
|
|
2266
|
-
mapping.maps.forEach((stepMap, index) => {
|
|
2267
|
-
const ranges = [];
|
|
2268
|
-
if (!stepMap.ranges.length) {
|
|
2269
|
-
const { from, to } = steps[index];
|
|
2270
|
-
if (from === void 0 || to === void 0) {
|
|
2271
|
-
return;
|
|
2272
|
-
}
|
|
2273
|
-
ranges.push({ from, to });
|
|
2274
|
-
} else {
|
|
2275
|
-
stepMap.forEach((from, to) => {
|
|
2276
|
-
ranges.push({ from, to });
|
|
2277
|
-
});
|
|
2278
|
-
}
|
|
2279
|
-
ranges.forEach(({ from, to }) => {
|
|
2280
|
-
const newStart = mapping.slice(index).map(from, -1);
|
|
2281
|
-
const newEnd = mapping.slice(index).map(to);
|
|
2282
|
-
const oldStart = mapping.invert().map(newStart, -1);
|
|
2283
|
-
const oldEnd = mapping.invert().map(newEnd);
|
|
2284
|
-
changes.push({
|
|
2285
|
-
oldRange: {
|
|
2286
|
-
from: oldStart,
|
|
2287
|
-
to: oldEnd
|
|
2288
|
-
},
|
|
2289
|
-
newRange: {
|
|
2290
|
-
from: newStart,
|
|
2291
|
-
to: newEnd
|
|
2292
|
-
}
|
|
2293
|
-
});
|
|
2294
|
-
});
|
|
2295
|
-
});
|
|
2296
|
-
return simplifyChangedRanges(changes);
|
|
2297
|
-
}
|
|
2298
|
-
function getMarksBetween(from, to, doc) {
|
|
2299
|
-
const marks = [];
|
|
2300
|
-
if (from === to) {
|
|
2301
|
-
doc.resolve(from).marks().forEach((mark) => {
|
|
2302
|
-
const $pos = doc.resolve(from);
|
|
2303
|
-
const range = getMarkRange($pos, mark.type);
|
|
2304
|
-
if (!range) {
|
|
2305
|
-
return;
|
|
2306
|
-
}
|
|
2307
|
-
marks.push({
|
|
2308
|
-
mark,
|
|
2309
|
-
...range
|
|
2310
|
-
});
|
|
2311
|
-
});
|
|
2312
|
-
} else {
|
|
2313
|
-
doc.nodesBetween(from, to, (node, pos) => {
|
|
2314
|
-
if (!node || (node === null || node === void 0 ? void 0 : node.nodeSize) === void 0) {
|
|
2315
|
-
return;
|
|
2316
|
-
}
|
|
2317
|
-
marks.push(...node.marks.map((mark) => ({
|
|
2318
|
-
from: pos,
|
|
2319
|
-
to: pos + node.nodeSize,
|
|
2320
|
-
mark
|
|
2321
|
-
})));
|
|
2322
|
-
});
|
|
2323
|
-
}
|
|
2324
|
-
return marks;
|
|
2325
|
-
}
|
|
2326
|
-
function getSplittedAttributes(extensionAttributes, typeName, attributes) {
|
|
2327
|
-
return Object.fromEntries(Object.entries(attributes).filter(([name]) => {
|
|
2328
|
-
const extensionAttribute = extensionAttributes.find((item) => {
|
|
2329
|
-
return item.type === typeName && item.name === name;
|
|
2330
|
-
});
|
|
2331
|
-
if (!extensionAttribute) {
|
|
2332
|
-
return false;
|
|
2333
|
-
}
|
|
2334
|
-
return extensionAttribute.attribute.keepOnSplit;
|
|
2335
|
-
}));
|
|
2336
|
-
}
|
|
2337
|
-
function isMarkActive(state, typeOrName, attributes = {}) {
|
|
2338
|
-
const { empty, ranges } = state.selection;
|
|
2339
|
-
const type = typeOrName ? getMarkType(typeOrName, state.schema) : null;
|
|
2340
|
-
if (empty) {
|
|
2341
|
-
return !!(state.storedMarks || state.selection.$from.marks()).filter((mark) => {
|
|
2342
|
-
if (!type) {
|
|
2343
|
-
return true;
|
|
2344
|
-
}
|
|
2345
|
-
return type.name === mark.type.name;
|
|
2346
|
-
}).find((mark) => objectIncludes(mark.attrs, attributes, { strict: false }));
|
|
2347
|
-
}
|
|
2348
|
-
let selectionRange = 0;
|
|
2349
|
-
const markRanges = [];
|
|
2350
|
-
ranges.forEach(({ $from, $to }) => {
|
|
2351
|
-
const from = $from.pos;
|
|
2352
|
-
const to = $to.pos;
|
|
2353
|
-
state.doc.nodesBetween(from, to, (node, pos) => {
|
|
2354
|
-
if (!node.isText && !node.marks.length) {
|
|
2355
|
-
return;
|
|
2356
|
-
}
|
|
2357
|
-
const relativeFrom = Math.max(from, pos);
|
|
2358
|
-
const relativeTo = Math.min(to, pos + node.nodeSize);
|
|
2359
|
-
const range2 = relativeTo - relativeFrom;
|
|
2360
|
-
selectionRange += range2;
|
|
2361
|
-
markRanges.push(...node.marks.map((mark) => ({
|
|
2362
|
-
mark,
|
|
2363
|
-
from: relativeFrom,
|
|
2364
|
-
to: relativeTo
|
|
2365
|
-
})));
|
|
2366
|
-
});
|
|
2367
|
-
});
|
|
2368
|
-
if (selectionRange === 0) {
|
|
2369
|
-
return false;
|
|
2370
|
-
}
|
|
2371
|
-
const matchedRange = markRanges.filter((markRange) => {
|
|
2372
|
-
if (!type) {
|
|
2373
|
-
return true;
|
|
2374
|
-
}
|
|
2375
|
-
return type.name === markRange.mark.type.name;
|
|
2376
|
-
}).filter((markRange) => objectIncludes(markRange.mark.attrs, attributes, { strict: false })).reduce((sum, markRange) => sum + markRange.to - markRange.from, 0);
|
|
2377
|
-
const excludedRange = markRanges.filter((markRange) => {
|
|
2378
|
-
if (!type) {
|
|
2379
|
-
return true;
|
|
2380
|
-
}
|
|
2381
|
-
return markRange.mark.type !== type && markRange.mark.type.excludes(type);
|
|
2382
|
-
}).reduce((sum, markRange) => sum + markRange.to - markRange.from, 0);
|
|
2383
|
-
const range = matchedRange > 0 ? matchedRange + excludedRange : matchedRange;
|
|
2384
|
-
return range >= selectionRange;
|
|
2385
|
-
}
|
|
2386
|
-
function isActive(state, name, attributes = {}) {
|
|
2387
|
-
if (!name) {
|
|
2388
|
-
return isNodeActive(state, null, attributes) || isMarkActive(state, null, attributes);
|
|
2389
|
-
}
|
|
2390
|
-
const schemaType = getSchemaTypeNameByName(name, state.schema);
|
|
2391
|
-
if (schemaType === "node") {
|
|
2392
|
-
return isNodeActive(state, name, attributes);
|
|
2393
|
-
}
|
|
2394
|
-
if (schemaType === "mark") {
|
|
2395
|
-
return isMarkActive(state, name, attributes);
|
|
2396
|
-
}
|
|
2397
|
-
return false;
|
|
2398
|
-
}
|
|
2399
|
-
function isList(name, extensions) {
|
|
2400
|
-
const { nodeExtensions } = splitExtensions(extensions);
|
|
2401
|
-
const extension = nodeExtensions.find((item) => item.name === name);
|
|
2402
|
-
if (!extension) {
|
|
2403
|
-
return false;
|
|
2404
|
-
}
|
|
2405
|
-
const context = {
|
|
2406
|
-
name: extension.name,
|
|
2407
|
-
options: extension.options,
|
|
2408
|
-
storage: extension.storage
|
|
2409
|
-
};
|
|
2410
|
-
const group = callOrReturn(getExtensionField(extension, "group", context));
|
|
2411
|
-
if (typeof group !== "string") {
|
|
2412
|
-
return false;
|
|
2413
|
-
}
|
|
2414
|
-
return group.split(" ").includes("list");
|
|
2415
|
-
}
|
|
2416
|
-
function isNodeEmpty(node, { checkChildren = true, ignoreWhitespace = false } = {}) {
|
|
2417
|
-
var _a;
|
|
2418
|
-
if (ignoreWhitespace) {
|
|
2419
|
-
if (node.type.name === "hardBreak") {
|
|
2420
|
-
return true;
|
|
2421
|
-
}
|
|
2422
|
-
if (node.isText) {
|
|
2423
|
-
return /^\s*$/m.test((_a = node.text) !== null && _a !== void 0 ? _a : "");
|
|
2424
|
-
}
|
|
2425
|
-
}
|
|
2426
|
-
if (node.isText) {
|
|
2427
|
-
return !node.text;
|
|
2428
|
-
}
|
|
2429
|
-
if (node.isAtom || node.isLeaf) {
|
|
2430
|
-
return false;
|
|
2431
|
-
}
|
|
2432
|
-
if (node.content.childCount === 0) {
|
|
2433
|
-
return true;
|
|
2434
|
-
}
|
|
2435
|
-
if (checkChildren) {
|
|
2436
|
-
let isContentEmpty = true;
|
|
2437
|
-
node.content.forEach((childNode) => {
|
|
2438
|
-
if (isContentEmpty === false) {
|
|
2439
|
-
return;
|
|
2440
|
-
}
|
|
2441
|
-
if (!isNodeEmpty(childNode, { ignoreWhitespace, checkChildren })) {
|
|
2442
|
-
isContentEmpty = false;
|
|
2443
|
-
}
|
|
2444
|
-
});
|
|
2445
|
-
return isContentEmpty;
|
|
2446
|
-
}
|
|
2447
|
-
return false;
|
|
2448
|
-
}
|
|
2449
|
-
function isNodeSelection(value) {
|
|
2450
|
-
return value instanceof NodeSelection;
|
|
2451
|
-
}
|
|
2452
|
-
function canSetMark(state, tr, newMarkType) {
|
|
2453
|
-
var _a;
|
|
2454
|
-
const { selection } = tr;
|
|
2455
|
-
let cursor = null;
|
|
2456
|
-
if (isTextSelection(selection)) {
|
|
2457
|
-
cursor = selection.$cursor;
|
|
2458
|
-
}
|
|
2459
|
-
if (cursor) {
|
|
2460
|
-
const currentMarks = (_a = state.storedMarks) !== null && _a !== void 0 ? _a : cursor.marks();
|
|
2461
|
-
return !!newMarkType.isInSet(currentMarks) || !currentMarks.some((mark) => mark.type.excludes(newMarkType));
|
|
2462
|
-
}
|
|
2463
|
-
const { ranges } = selection;
|
|
2464
|
-
return ranges.some(({ $from, $to }) => {
|
|
2465
|
-
let someNodeSupportsMark = $from.depth === 0 ? state.doc.inlineContent && state.doc.type.allowsMarkType(newMarkType) : false;
|
|
2466
|
-
state.doc.nodesBetween($from.pos, $to.pos, (node, _pos, parent) => {
|
|
2467
|
-
if (someNodeSupportsMark) {
|
|
2468
|
-
return false;
|
|
2469
|
-
}
|
|
2470
|
-
if (node.isInline) {
|
|
2471
|
-
const parentAllowsMarkType = !parent || parent.type.allowsMarkType(newMarkType);
|
|
2472
|
-
const currentMarksAllowMarkType = !!newMarkType.isInSet(node.marks) || !node.marks.some((otherMark) => otherMark.type.excludes(newMarkType));
|
|
2473
|
-
someNodeSupportsMark = parentAllowsMarkType && currentMarksAllowMarkType;
|
|
2474
|
-
}
|
|
2475
|
-
return !someNodeSupportsMark;
|
|
2476
|
-
});
|
|
2477
|
-
return someNodeSupportsMark;
|
|
2478
|
-
});
|
|
2479
|
-
}
|
|
2480
|
-
const setMark = (typeOrName, attributes = {}) => ({ tr, state, dispatch }) => {
|
|
2481
|
-
const { selection } = tr;
|
|
2482
|
-
const { empty, ranges } = selection;
|
|
2483
|
-
const type = getMarkType(typeOrName, state.schema);
|
|
2484
|
-
if (dispatch) {
|
|
2485
|
-
if (empty) {
|
|
2486
|
-
const oldAttributes = getMarkAttributes(state, type);
|
|
2487
|
-
tr.addStoredMark(type.create({
|
|
2488
|
-
...oldAttributes,
|
|
2489
|
-
...attributes
|
|
2490
|
-
}));
|
|
2491
|
-
} else {
|
|
2492
|
-
ranges.forEach((range) => {
|
|
2493
|
-
const from = range.$from.pos;
|
|
2494
|
-
const to = range.$to.pos;
|
|
2495
|
-
state.doc.nodesBetween(from, to, (node, pos) => {
|
|
2496
|
-
const trimmedFrom = Math.max(pos, from);
|
|
2497
|
-
const trimmedTo = Math.min(pos + node.nodeSize, to);
|
|
2498
|
-
const someHasMark = node.marks.find((mark) => mark.type === type);
|
|
2499
|
-
if (someHasMark) {
|
|
2500
|
-
node.marks.forEach((mark) => {
|
|
2501
|
-
if (type === mark.type) {
|
|
2502
|
-
tr.addMark(trimmedFrom, trimmedTo, type.create({
|
|
2503
|
-
...mark.attrs,
|
|
2504
|
-
...attributes
|
|
2505
|
-
}));
|
|
2506
|
-
}
|
|
2507
|
-
});
|
|
2508
|
-
} else {
|
|
2509
|
-
tr.addMark(trimmedFrom, trimmedTo, type.create(attributes));
|
|
2510
|
-
}
|
|
2511
|
-
});
|
|
2512
|
-
});
|
|
2513
|
-
}
|
|
2514
|
-
}
|
|
2515
|
-
return canSetMark(state, tr, type);
|
|
2516
|
-
};
|
|
2517
|
-
const setMeta = (key, value) => ({ tr }) => {
|
|
2518
|
-
tr.setMeta(key, value);
|
|
2519
|
-
return true;
|
|
2520
|
-
};
|
|
2521
|
-
const setNode = (typeOrName, attributes = {}) => ({ state, dispatch, chain }) => {
|
|
2522
|
-
const type = getNodeType(typeOrName, state.schema);
|
|
2523
|
-
let attributesToCopy;
|
|
2524
|
-
if (state.selection.$anchor.sameParent(state.selection.$head)) {
|
|
2525
|
-
attributesToCopy = state.selection.$anchor.parent.attrs;
|
|
2526
|
-
}
|
|
2527
|
-
if (!type.isTextblock) {
|
|
2528
|
-
console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.');
|
|
2529
|
-
return false;
|
|
2530
|
-
}
|
|
2531
|
-
return chain().command(({ commands: commands2 }) => {
|
|
2532
|
-
const canSetBlock = setBlockType(type, { ...attributesToCopy, ...attributes })(state);
|
|
2533
|
-
if (canSetBlock) {
|
|
2534
|
-
return true;
|
|
2535
|
-
}
|
|
2536
|
-
return commands2.clearNodes();
|
|
2537
|
-
}).command(({ state: updatedState }) => {
|
|
2538
|
-
return setBlockType(type, { ...attributesToCopy, ...attributes })(updatedState, dispatch);
|
|
2539
|
-
}).run();
|
|
2540
|
-
};
|
|
2541
|
-
const setNodeSelection = (position) => ({ tr, dispatch }) => {
|
|
2542
|
-
if (dispatch) {
|
|
2543
|
-
const { doc } = tr;
|
|
2544
|
-
const from = minMax(position, 0, doc.content.size);
|
|
2545
|
-
const selection = NodeSelection.create(doc, from);
|
|
2546
|
-
tr.setSelection(selection);
|
|
2547
|
-
}
|
|
2548
|
-
return true;
|
|
2549
|
-
};
|
|
2550
|
-
const setTextSelection = (position) => ({ tr, dispatch }) => {
|
|
2551
|
-
if (dispatch) {
|
|
2552
|
-
const { doc } = tr;
|
|
2553
|
-
const { from, to } = typeof position === "number" ? { from: position, to: position } : position;
|
|
2554
|
-
const minPos = TextSelection.atStart(doc).from;
|
|
2555
|
-
const maxPos = TextSelection.atEnd(doc).to;
|
|
2556
|
-
const resolvedFrom = minMax(from, minPos, maxPos);
|
|
2557
|
-
const resolvedEnd = minMax(to, minPos, maxPos);
|
|
2558
|
-
const selection = TextSelection.create(doc, resolvedFrom, resolvedEnd);
|
|
2559
|
-
tr.setSelection(selection);
|
|
2560
|
-
}
|
|
2561
|
-
return true;
|
|
2562
|
-
};
|
|
2563
|
-
const sinkListItem = (typeOrName) => ({ state, dispatch }) => {
|
|
2564
|
-
const type = getNodeType(typeOrName, state.schema);
|
|
2565
|
-
return sinkListItem$1(type)(state, dispatch);
|
|
2566
|
-
};
|
|
2567
|
-
function ensureMarks(state, splittableMarks) {
|
|
2568
|
-
const marks = state.storedMarks || state.selection.$to.parentOffset && state.selection.$from.marks();
|
|
2569
|
-
if (marks) {
|
|
2570
|
-
const filteredMarks = marks.filter((mark) => splittableMarks === null || splittableMarks === void 0 ? void 0 : splittableMarks.includes(mark.type.name));
|
|
2571
|
-
state.tr.ensureMarks(filteredMarks);
|
|
2572
|
-
}
|
|
2573
|
-
}
|
|
2574
|
-
const splitBlock = ({ keepMarks = true } = {}) => ({ tr, state, dispatch, editor }) => {
|
|
2575
|
-
const { selection, doc } = tr;
|
|
2576
|
-
const { $from, $to } = selection;
|
|
2577
|
-
const extensionAttributes = editor.extensionManager.attributes;
|
|
2578
|
-
const newAttributes = getSplittedAttributes(extensionAttributes, $from.node().type.name, $from.node().attrs);
|
|
2579
|
-
if (selection instanceof NodeSelection && selection.node.isBlock) {
|
|
2580
|
-
if (!$from.parentOffset || !canSplit(doc, $from.pos)) {
|
|
2581
|
-
return false;
|
|
2582
|
-
}
|
|
2583
|
-
if (dispatch) {
|
|
2584
|
-
if (keepMarks) {
|
|
2585
|
-
ensureMarks(state, editor.extensionManager.splittableMarks);
|
|
2586
|
-
}
|
|
2587
|
-
tr.split($from.pos).scrollIntoView();
|
|
2588
|
-
}
|
|
2589
|
-
return true;
|
|
2590
|
-
}
|
|
2591
|
-
if (!$from.parent.isBlock) {
|
|
2592
|
-
return false;
|
|
2593
|
-
}
|
|
2594
|
-
const atEnd = $to.parentOffset === $to.parent.content.size;
|
|
2595
|
-
const deflt = $from.depth === 0 ? void 0 : defaultBlockAt($from.node(-1).contentMatchAt($from.indexAfter(-1)));
|
|
2596
|
-
let types = atEnd && deflt ? [
|
|
2597
|
-
{
|
|
2598
|
-
type: deflt,
|
|
2599
|
-
attrs: newAttributes
|
|
2600
|
-
}
|
|
2601
|
-
] : void 0;
|
|
2602
|
-
let can = canSplit(tr.doc, tr.mapping.map($from.pos), 1, types);
|
|
2603
|
-
if (!types && !can && canSplit(tr.doc, tr.mapping.map($from.pos), 1, deflt ? [{ type: deflt }] : void 0)) {
|
|
2604
|
-
can = true;
|
|
2605
|
-
types = deflt ? [
|
|
2606
|
-
{
|
|
2607
|
-
type: deflt,
|
|
2608
|
-
attrs: newAttributes
|
|
2609
|
-
}
|
|
2610
|
-
] : void 0;
|
|
2611
|
-
}
|
|
2612
|
-
if (dispatch) {
|
|
2613
|
-
if (can) {
|
|
2614
|
-
if (selection instanceof TextSelection) {
|
|
2615
|
-
tr.deleteSelection();
|
|
2616
|
-
}
|
|
2617
|
-
tr.split(tr.mapping.map($from.pos), 1, types);
|
|
2618
|
-
if (deflt && !atEnd && !$from.parentOffset && $from.parent.type !== deflt) {
|
|
2619
|
-
const first2 = tr.mapping.map($from.before());
|
|
2620
|
-
const $first = tr.doc.resolve(first2);
|
|
2621
|
-
if ($from.node(-1).canReplaceWith($first.index(), $first.index() + 1, deflt)) {
|
|
2622
|
-
tr.setNodeMarkup(tr.mapping.map($from.before()), deflt);
|
|
2623
|
-
}
|
|
2624
|
-
}
|
|
2625
|
-
}
|
|
2626
|
-
if (keepMarks) {
|
|
2627
|
-
ensureMarks(state, editor.extensionManager.splittableMarks);
|
|
2628
|
-
}
|
|
2629
|
-
tr.scrollIntoView();
|
|
2630
|
-
}
|
|
2631
|
-
return can;
|
|
2632
|
-
};
|
|
2633
|
-
const splitListItem = (typeOrName, overrideAttrs = {}) => ({ tr, state, dispatch, editor }) => {
|
|
2634
|
-
var _a;
|
|
2635
|
-
const type = getNodeType(typeOrName, state.schema);
|
|
2636
|
-
const { $from, $to } = state.selection;
|
|
2637
|
-
const node = state.selection.node;
|
|
2638
|
-
if (node && node.isBlock || $from.depth < 2 || !$from.sameParent($to)) {
|
|
2639
|
-
return false;
|
|
2640
|
-
}
|
|
2641
|
-
const grandParent = $from.node(-1);
|
|
2642
|
-
if (grandParent.type !== type) {
|
|
2643
|
-
return false;
|
|
2644
|
-
}
|
|
2645
|
-
const extensionAttributes = editor.extensionManager.attributes;
|
|
2646
|
-
if ($from.parent.content.size === 0 && $from.node(-1).childCount === $from.indexAfter(-1)) {
|
|
2647
|
-
if ($from.depth === 2 || $from.node(-3).type !== type || $from.index(-2) !== $from.node(-2).childCount - 1) {
|
|
2648
|
-
return false;
|
|
2649
|
-
}
|
|
2650
|
-
if (dispatch) {
|
|
2651
|
-
let wrap = Fragment.empty;
|
|
2652
|
-
const depthBefore = $from.index(-1) ? 1 : $from.index(-2) ? 2 : 3;
|
|
2653
|
-
for (let d = $from.depth - depthBefore; d >= $from.depth - 3; d -= 1) {
|
|
2654
|
-
wrap = Fragment.from($from.node(d).copy(wrap));
|
|
2655
|
-
}
|
|
2656
|
-
const depthAfter = $from.indexAfter(-1) < $from.node(-2).childCount ? 1 : $from.indexAfter(-2) < $from.node(-3).childCount ? 2 : 3;
|
|
2657
|
-
const newNextTypeAttributes2 = {
|
|
2658
|
-
...getSplittedAttributes(extensionAttributes, $from.node().type.name, $from.node().attrs),
|
|
2659
|
-
...overrideAttrs
|
|
2660
|
-
};
|
|
2661
|
-
const nextType2 = ((_a = type.contentMatch.defaultType) === null || _a === void 0 ? void 0 : _a.createAndFill(newNextTypeAttributes2)) || void 0;
|
|
2662
|
-
wrap = wrap.append(Fragment.from(type.createAndFill(null, nextType2) || void 0));
|
|
2663
|
-
const start = $from.before($from.depth - (depthBefore - 1));
|
|
2664
|
-
tr.replace(start, $from.after(-depthAfter), new Slice(wrap, 4 - depthBefore, 0));
|
|
2665
|
-
let sel = -1;
|
|
2666
|
-
tr.doc.nodesBetween(start, tr.doc.content.size, (n, pos) => {
|
|
2667
|
-
if (sel > -1) {
|
|
2668
|
-
return false;
|
|
2669
|
-
}
|
|
2670
|
-
if (n.isTextblock && n.content.size === 0) {
|
|
2671
|
-
sel = pos + 1;
|
|
2672
|
-
}
|
|
2673
|
-
});
|
|
2674
|
-
if (sel > -1) {
|
|
2675
|
-
tr.setSelection(TextSelection.near(tr.doc.resolve(sel)));
|
|
2676
|
-
}
|
|
2677
|
-
tr.scrollIntoView();
|
|
2678
|
-
}
|
|
2679
|
-
return true;
|
|
2680
|
-
}
|
|
2681
|
-
const nextType = $to.pos === $from.end() ? grandParent.contentMatchAt(0).defaultType : null;
|
|
2682
|
-
const newTypeAttributes = {
|
|
2683
|
-
...getSplittedAttributes(extensionAttributes, grandParent.type.name, grandParent.attrs),
|
|
2684
|
-
...overrideAttrs
|
|
2685
|
-
};
|
|
2686
|
-
const newNextTypeAttributes = {
|
|
2687
|
-
...getSplittedAttributes(extensionAttributes, $from.node().type.name, $from.node().attrs),
|
|
2688
|
-
...overrideAttrs
|
|
2689
|
-
};
|
|
2690
|
-
tr.delete($from.pos, $to.pos);
|
|
2691
|
-
const types = nextType ? [
|
|
2692
|
-
{ type, attrs: newTypeAttributes },
|
|
2693
|
-
{ type: nextType, attrs: newNextTypeAttributes }
|
|
2694
|
-
] : [{ type, attrs: newTypeAttributes }];
|
|
2695
|
-
if (!canSplit(tr.doc, $from.pos, 2)) {
|
|
2696
|
-
return false;
|
|
2697
|
-
}
|
|
2698
|
-
if (dispatch) {
|
|
2699
|
-
const { selection, storedMarks } = state;
|
|
2700
|
-
const { splittableMarks } = editor.extensionManager;
|
|
2701
|
-
const marks = storedMarks || selection.$to.parentOffset && selection.$from.marks();
|
|
2702
|
-
tr.split($from.pos, 2, types).scrollIntoView();
|
|
2703
|
-
if (!marks || !dispatch) {
|
|
2704
|
-
return true;
|
|
2705
|
-
}
|
|
2706
|
-
const filteredMarks = marks.filter((mark) => splittableMarks.includes(mark.type.name));
|
|
2707
|
-
tr.ensureMarks(filteredMarks);
|
|
2708
|
-
}
|
|
2709
|
-
return true;
|
|
2710
|
-
};
|
|
2711
|
-
const joinListBackwards = (tr, listType) => {
|
|
2712
|
-
const list = findParentNode((node) => node.type === listType)(tr.selection);
|
|
2713
|
-
if (!list) {
|
|
2714
|
-
return true;
|
|
2715
|
-
}
|
|
2716
|
-
const before = tr.doc.resolve(Math.max(0, list.pos - 1)).before(list.depth);
|
|
2717
|
-
if (before === void 0) {
|
|
2718
|
-
return true;
|
|
2719
|
-
}
|
|
2720
|
-
const nodeBefore = tr.doc.nodeAt(before);
|
|
2721
|
-
const canJoinBackwards = list.node.type === (nodeBefore === null || nodeBefore === void 0 ? void 0 : nodeBefore.type) && canJoin(tr.doc, list.pos);
|
|
2722
|
-
if (!canJoinBackwards) {
|
|
2723
|
-
return true;
|
|
2724
|
-
}
|
|
2725
|
-
tr.join(list.pos);
|
|
2726
|
-
return true;
|
|
2727
|
-
};
|
|
2728
|
-
const joinListForwards = (tr, listType) => {
|
|
2729
|
-
const list = findParentNode((node) => node.type === listType)(tr.selection);
|
|
2730
|
-
if (!list) {
|
|
2731
|
-
return true;
|
|
2732
|
-
}
|
|
2733
|
-
const after = tr.doc.resolve(list.start).after(list.depth);
|
|
2734
|
-
if (after === void 0) {
|
|
2735
|
-
return true;
|
|
2736
|
-
}
|
|
2737
|
-
const nodeAfter = tr.doc.nodeAt(after);
|
|
2738
|
-
const canJoinForwards = list.node.type === (nodeAfter === null || nodeAfter === void 0 ? void 0 : nodeAfter.type) && canJoin(tr.doc, after);
|
|
2739
|
-
if (!canJoinForwards) {
|
|
2740
|
-
return true;
|
|
2741
|
-
}
|
|
2742
|
-
tr.join(after);
|
|
2743
|
-
return true;
|
|
2744
|
-
};
|
|
2745
|
-
const toggleList = (listTypeOrName, itemTypeOrName, keepMarks, attributes = {}) => ({ editor, tr, state, dispatch, chain, commands: commands2, can }) => {
|
|
2746
|
-
const { extensions, splittableMarks } = editor.extensionManager;
|
|
2747
|
-
const listType = getNodeType(listTypeOrName, state.schema);
|
|
2748
|
-
const itemType = getNodeType(itemTypeOrName, state.schema);
|
|
2749
|
-
const { selection, storedMarks } = state;
|
|
2750
|
-
const { $from, $to } = selection;
|
|
2751
|
-
const range = $from.blockRange($to);
|
|
2752
|
-
const marks = storedMarks || selection.$to.parentOffset && selection.$from.marks();
|
|
2753
|
-
if (!range) {
|
|
2754
|
-
return false;
|
|
2755
|
-
}
|
|
2756
|
-
const parentList = findParentNode((node) => isList(node.type.name, extensions))(selection);
|
|
2757
|
-
if (range.depth >= 1 && parentList && range.depth - parentList.depth <= 1) {
|
|
2758
|
-
if (parentList.node.type === listType) {
|
|
2759
|
-
return commands2.liftListItem(itemType);
|
|
2760
|
-
}
|
|
2761
|
-
if (isList(parentList.node.type.name, extensions) && listType.validContent(parentList.node.content) && dispatch) {
|
|
2762
|
-
return chain().command(() => {
|
|
2763
|
-
tr.setNodeMarkup(parentList.pos, listType);
|
|
2764
|
-
return true;
|
|
2765
|
-
}).command(() => joinListBackwards(tr, listType)).command(() => joinListForwards(tr, listType)).run();
|
|
2766
|
-
}
|
|
2767
|
-
}
|
|
2768
|
-
if (!keepMarks || !marks || !dispatch) {
|
|
2769
|
-
return chain().command(() => {
|
|
2770
|
-
const canWrapInList = can().wrapInList(listType, attributes);
|
|
2771
|
-
if (canWrapInList) {
|
|
2772
|
-
return true;
|
|
2773
|
-
}
|
|
2774
|
-
return commands2.clearNodes();
|
|
2775
|
-
}).wrapInList(listType, attributes).command(() => joinListBackwards(tr, listType)).command(() => joinListForwards(tr, listType)).run();
|
|
2776
|
-
}
|
|
2777
|
-
return chain().command(() => {
|
|
2778
|
-
const canWrapInList = can().wrapInList(listType, attributes);
|
|
2779
|
-
const filteredMarks = marks.filter((mark) => splittableMarks.includes(mark.type.name));
|
|
2780
|
-
tr.ensureMarks(filteredMarks);
|
|
2781
|
-
if (canWrapInList) {
|
|
2782
|
-
return true;
|
|
2783
|
-
}
|
|
2784
|
-
return commands2.clearNodes();
|
|
2785
|
-
}).wrapInList(listType, attributes).command(() => joinListBackwards(tr, listType)).command(() => joinListForwards(tr, listType)).run();
|
|
2786
|
-
};
|
|
2787
|
-
const toggleMark = (typeOrName, attributes = {}, options = {}) => ({ state, commands: commands2 }) => {
|
|
2788
|
-
const { extendEmptyMarkRange = false } = options;
|
|
2789
|
-
const type = getMarkType(typeOrName, state.schema);
|
|
2790
|
-
const isActive2 = isMarkActive(state, type, attributes);
|
|
2791
|
-
if (isActive2) {
|
|
2792
|
-
return commands2.unsetMark(type, { extendEmptyMarkRange });
|
|
2793
|
-
}
|
|
2794
|
-
return commands2.setMark(type, attributes);
|
|
2795
|
-
};
|
|
2796
|
-
const toggleNode = (typeOrName, toggleTypeOrName, attributes = {}) => ({ state, commands: commands2 }) => {
|
|
2797
|
-
const type = getNodeType(typeOrName, state.schema);
|
|
2798
|
-
const toggleType = getNodeType(toggleTypeOrName, state.schema);
|
|
2799
|
-
const isActive2 = isNodeActive(state, type, attributes);
|
|
2800
|
-
let attributesToCopy;
|
|
2801
|
-
if (state.selection.$anchor.sameParent(state.selection.$head)) {
|
|
2802
|
-
attributesToCopy = state.selection.$anchor.parent.attrs;
|
|
2803
|
-
}
|
|
2804
|
-
if (isActive2) {
|
|
2805
|
-
return commands2.setNode(toggleType, attributesToCopy);
|
|
2806
|
-
}
|
|
2807
|
-
return commands2.setNode(type, { ...attributesToCopy, ...attributes });
|
|
2808
|
-
};
|
|
2809
|
-
const toggleWrap = (typeOrName, attributes = {}) => ({ state, commands: commands2 }) => {
|
|
2810
|
-
const type = getNodeType(typeOrName, state.schema);
|
|
2811
|
-
const isActive2 = isNodeActive(state, type, attributes);
|
|
2812
|
-
if (isActive2) {
|
|
2813
|
-
return commands2.lift(type);
|
|
2814
|
-
}
|
|
2815
|
-
return commands2.wrapIn(type, attributes);
|
|
2816
|
-
};
|
|
2817
|
-
const undoInputRule = () => ({ state, dispatch }) => {
|
|
2818
|
-
const plugins = state.plugins;
|
|
2819
|
-
for (let i = 0; i < plugins.length; i += 1) {
|
|
2820
|
-
const plugin = plugins[i];
|
|
2821
|
-
let undoable;
|
|
2822
|
-
if (plugin.spec.isInputRules && (undoable = plugin.getState(state))) {
|
|
2823
|
-
if (dispatch) {
|
|
2824
|
-
const tr = state.tr;
|
|
2825
|
-
const toUndo = undoable.transform;
|
|
2826
|
-
for (let j = toUndo.steps.length - 1; j >= 0; j -= 1) {
|
|
2827
|
-
tr.step(toUndo.steps[j].invert(toUndo.docs[j]));
|
|
2828
|
-
}
|
|
2829
|
-
if (undoable.text) {
|
|
2830
|
-
const marks = tr.doc.resolve(undoable.from).marks();
|
|
2831
|
-
tr.replaceWith(undoable.from, undoable.to, state.schema.text(undoable.text, marks));
|
|
2832
|
-
} else {
|
|
2833
|
-
tr.delete(undoable.from, undoable.to);
|
|
2834
|
-
}
|
|
2835
|
-
}
|
|
2836
|
-
return true;
|
|
2837
|
-
}
|
|
2838
|
-
}
|
|
2839
|
-
return false;
|
|
2840
|
-
};
|
|
2841
|
-
const unsetAllMarks = () => ({ tr, dispatch }) => {
|
|
2842
|
-
const { selection } = tr;
|
|
2843
|
-
const { empty, ranges } = selection;
|
|
2844
|
-
if (empty) {
|
|
2845
|
-
return true;
|
|
2846
|
-
}
|
|
2847
|
-
if (dispatch) {
|
|
2848
|
-
ranges.forEach((range) => {
|
|
2849
|
-
tr.removeMark(range.$from.pos, range.$to.pos);
|
|
2850
|
-
});
|
|
2851
|
-
}
|
|
2852
|
-
return true;
|
|
2853
|
-
};
|
|
2854
|
-
const unsetMark = (typeOrName, options = {}) => ({ tr, state, dispatch }) => {
|
|
2855
|
-
var _a;
|
|
2856
|
-
const { extendEmptyMarkRange = false } = options;
|
|
2857
|
-
const { selection } = tr;
|
|
2858
|
-
const type = getMarkType(typeOrName, state.schema);
|
|
2859
|
-
const { $from, empty, ranges } = selection;
|
|
2860
|
-
if (!dispatch) {
|
|
2861
|
-
return true;
|
|
2862
|
-
}
|
|
2863
|
-
if (empty && extendEmptyMarkRange) {
|
|
2864
|
-
let { from, to } = selection;
|
|
2865
|
-
const attrs = (_a = $from.marks().find((mark) => mark.type === type)) === null || _a === void 0 ? void 0 : _a.attrs;
|
|
2866
|
-
const range = getMarkRange($from, type, attrs);
|
|
2867
|
-
if (range) {
|
|
2868
|
-
from = range.from;
|
|
2869
|
-
to = range.to;
|
|
2870
|
-
}
|
|
2871
|
-
tr.removeMark(from, to, type);
|
|
2872
|
-
} else {
|
|
2873
|
-
ranges.forEach((range) => {
|
|
2874
|
-
tr.removeMark(range.$from.pos, range.$to.pos, type);
|
|
2875
|
-
});
|
|
2876
|
-
}
|
|
2877
|
-
tr.removeStoredMark(type);
|
|
2878
|
-
return true;
|
|
2879
|
-
};
|
|
2880
|
-
const updateAttributes = (typeOrName, attributes = {}) => ({ tr, state, dispatch }) => {
|
|
2881
|
-
let nodeType = null;
|
|
2882
|
-
let markType = null;
|
|
2883
|
-
const schemaType = getSchemaTypeNameByName(typeof typeOrName === "string" ? typeOrName : typeOrName.name, state.schema);
|
|
2884
|
-
if (!schemaType) {
|
|
2885
|
-
return false;
|
|
2886
|
-
}
|
|
2887
|
-
if (schemaType === "node") {
|
|
2888
|
-
nodeType = getNodeType(typeOrName, state.schema);
|
|
2889
|
-
}
|
|
2890
|
-
if (schemaType === "mark") {
|
|
2891
|
-
markType = getMarkType(typeOrName, state.schema);
|
|
2892
|
-
}
|
|
2893
|
-
if (dispatch) {
|
|
2894
|
-
tr.selection.ranges.forEach((range) => {
|
|
2895
|
-
const from = range.$from.pos;
|
|
2896
|
-
const to = range.$to.pos;
|
|
2897
|
-
let lastPos;
|
|
2898
|
-
let lastNode;
|
|
2899
|
-
let trimmedFrom;
|
|
2900
|
-
let trimmedTo;
|
|
2901
|
-
if (tr.selection.empty) {
|
|
2902
|
-
state.doc.nodesBetween(from, to, (node, pos) => {
|
|
2903
|
-
if (nodeType && nodeType === node.type) {
|
|
2904
|
-
trimmedFrom = Math.max(pos, from);
|
|
2905
|
-
trimmedTo = Math.min(pos + node.nodeSize, to);
|
|
2906
|
-
lastPos = pos;
|
|
2907
|
-
lastNode = node;
|
|
2908
|
-
}
|
|
2909
|
-
});
|
|
2910
|
-
} else {
|
|
2911
|
-
state.doc.nodesBetween(from, to, (node, pos) => {
|
|
2912
|
-
if (pos < from && nodeType && nodeType === node.type) {
|
|
2913
|
-
trimmedFrom = Math.max(pos, from);
|
|
2914
|
-
trimmedTo = Math.min(pos + node.nodeSize, to);
|
|
2915
|
-
lastPos = pos;
|
|
2916
|
-
lastNode = node;
|
|
2917
|
-
}
|
|
2918
|
-
if (pos >= from && pos <= to) {
|
|
2919
|
-
if (nodeType && nodeType === node.type) {
|
|
2920
|
-
tr.setNodeMarkup(pos, void 0, {
|
|
2921
|
-
...node.attrs,
|
|
2922
|
-
...attributes
|
|
2923
|
-
});
|
|
2924
|
-
}
|
|
2925
|
-
if (markType && node.marks.length) {
|
|
2926
|
-
node.marks.forEach((mark) => {
|
|
2927
|
-
if (markType === mark.type) {
|
|
2928
|
-
const trimmedFrom2 = Math.max(pos, from);
|
|
2929
|
-
const trimmedTo2 = Math.min(pos + node.nodeSize, to);
|
|
2930
|
-
tr.addMark(trimmedFrom2, trimmedTo2, markType.create({
|
|
2931
|
-
...mark.attrs,
|
|
2932
|
-
...attributes
|
|
2933
|
-
}));
|
|
2934
|
-
}
|
|
2935
|
-
});
|
|
2936
|
-
}
|
|
2937
|
-
}
|
|
2938
|
-
});
|
|
2939
|
-
}
|
|
2940
|
-
if (lastNode) {
|
|
2941
|
-
if (lastPos !== void 0) {
|
|
2942
|
-
tr.setNodeMarkup(lastPos, void 0, {
|
|
2943
|
-
...lastNode.attrs,
|
|
2944
|
-
...attributes
|
|
2945
|
-
});
|
|
2946
|
-
}
|
|
2947
|
-
if (markType && lastNode.marks.length) {
|
|
2948
|
-
lastNode.marks.forEach((mark) => {
|
|
2949
|
-
if (markType === mark.type) {
|
|
2950
|
-
tr.addMark(trimmedFrom, trimmedTo, markType.create({
|
|
2951
|
-
...mark.attrs,
|
|
2952
|
-
...attributes
|
|
2953
|
-
}));
|
|
2954
|
-
}
|
|
2955
|
-
});
|
|
2956
|
-
}
|
|
2957
|
-
}
|
|
2958
|
-
});
|
|
2959
|
-
}
|
|
2960
|
-
return true;
|
|
2961
|
-
};
|
|
2962
|
-
const wrapIn = (typeOrName, attributes = {}) => ({ state, dispatch }) => {
|
|
2963
|
-
const type = getNodeType(typeOrName, state.schema);
|
|
2964
|
-
return wrapIn$1(type, attributes)(state, dispatch);
|
|
2965
|
-
};
|
|
2966
|
-
const wrapInList = (typeOrName, attributes = {}) => ({ state, dispatch }) => {
|
|
2967
|
-
const type = getNodeType(typeOrName, state.schema);
|
|
2968
|
-
return wrapInList$1(type, attributes)(state, dispatch);
|
|
2969
|
-
};
|
|
2970
|
-
var commands = /* @__PURE__ */ Object.freeze({
|
|
2971
|
-
__proto__: null,
|
|
2972
|
-
blur,
|
|
2973
|
-
clearContent,
|
|
2974
|
-
clearNodes,
|
|
2975
|
-
command,
|
|
2976
|
-
createParagraphNear,
|
|
2977
|
-
cut,
|
|
2978
|
-
deleteCurrentNode,
|
|
2979
|
-
deleteNode,
|
|
2980
|
-
deleteRange,
|
|
2981
|
-
deleteSelection,
|
|
2982
|
-
enter,
|
|
2983
|
-
exitCode,
|
|
2984
|
-
extendMarkRange,
|
|
2985
|
-
first,
|
|
2986
|
-
focus,
|
|
2987
|
-
forEach,
|
|
2988
|
-
insertContent,
|
|
2989
|
-
insertContentAt,
|
|
2990
|
-
joinBackward,
|
|
2991
|
-
joinDown,
|
|
2992
|
-
joinForward,
|
|
2993
|
-
joinItemBackward,
|
|
2994
|
-
joinItemForward,
|
|
2995
|
-
joinTextblockBackward,
|
|
2996
|
-
joinTextblockForward,
|
|
2997
|
-
joinUp,
|
|
2998
|
-
keyboardShortcut,
|
|
2999
|
-
lift,
|
|
3000
|
-
liftEmptyBlock,
|
|
3001
|
-
liftListItem,
|
|
3002
|
-
newlineInCode,
|
|
3003
|
-
resetAttributes,
|
|
3004
|
-
scrollIntoView,
|
|
3005
|
-
selectAll,
|
|
3006
|
-
selectNodeBackward,
|
|
3007
|
-
selectNodeForward,
|
|
3008
|
-
selectParentNode,
|
|
3009
|
-
selectTextblockEnd,
|
|
3010
|
-
selectTextblockStart,
|
|
3011
|
-
setContent,
|
|
3012
|
-
setMark,
|
|
3013
|
-
setMeta,
|
|
3014
|
-
setNode,
|
|
3015
|
-
setNodeSelection,
|
|
3016
|
-
setTextSelection,
|
|
3017
|
-
sinkListItem,
|
|
3018
|
-
splitBlock,
|
|
3019
|
-
splitListItem,
|
|
3020
|
-
toggleList,
|
|
3021
|
-
toggleMark,
|
|
3022
|
-
toggleNode,
|
|
3023
|
-
toggleWrap,
|
|
3024
|
-
undoInputRule,
|
|
3025
|
-
unsetAllMarks,
|
|
3026
|
-
unsetMark,
|
|
3027
|
-
updateAttributes,
|
|
3028
|
-
wrapIn,
|
|
3029
|
-
wrapInList
|
|
3030
|
-
});
|
|
3031
|
-
const Commands = Extension.create({
|
|
3032
|
-
name: "commands",
|
|
3033
|
-
addCommands() {
|
|
3034
|
-
return {
|
|
3035
|
-
...commands
|
|
3036
|
-
};
|
|
3037
|
-
}
|
|
3038
|
-
});
|
|
3039
|
-
const Drop = Extension.create({
|
|
3040
|
-
name: "drop",
|
|
3041
|
-
addProseMirrorPlugins() {
|
|
3042
|
-
return [
|
|
3043
|
-
new Plugin({
|
|
3044
|
-
key: new PluginKey("tiptapDrop"),
|
|
3045
|
-
props: {
|
|
3046
|
-
handleDrop: (_, e, slice, moved) => {
|
|
3047
|
-
this.editor.emit("drop", {
|
|
3048
|
-
editor: this.editor,
|
|
3049
|
-
event: e,
|
|
3050
|
-
slice,
|
|
3051
|
-
moved
|
|
3052
|
-
});
|
|
3053
|
-
}
|
|
3054
|
-
}
|
|
3055
|
-
})
|
|
3056
|
-
];
|
|
3057
|
-
}
|
|
3058
|
-
});
|
|
3059
|
-
const Editable = Extension.create({
|
|
3060
|
-
name: "editable",
|
|
3061
|
-
addProseMirrorPlugins() {
|
|
3062
|
-
return [
|
|
3063
|
-
new Plugin({
|
|
3064
|
-
key: new PluginKey("editable"),
|
|
3065
|
-
props: {
|
|
3066
|
-
editable: () => this.editor.options.editable
|
|
3067
|
-
}
|
|
3068
|
-
})
|
|
3069
|
-
];
|
|
3070
|
-
}
|
|
3071
|
-
});
|
|
3072
|
-
const focusEventsPluginKey = new PluginKey("focusEvents");
|
|
3073
|
-
const FocusEvents = Extension.create({
|
|
3074
|
-
name: "focusEvents",
|
|
3075
|
-
addProseMirrorPlugins() {
|
|
3076
|
-
const { editor } = this;
|
|
3077
|
-
return [
|
|
3078
|
-
new Plugin({
|
|
3079
|
-
key: focusEventsPluginKey,
|
|
3080
|
-
props: {
|
|
3081
|
-
handleDOMEvents: {
|
|
3082
|
-
focus: (view, event) => {
|
|
3083
|
-
editor.isFocused = true;
|
|
3084
|
-
const transaction = editor.state.tr.setMeta("focus", { event }).setMeta("addToHistory", false);
|
|
3085
|
-
view.dispatch(transaction);
|
|
3086
|
-
return false;
|
|
3087
|
-
},
|
|
3088
|
-
blur: (view, event) => {
|
|
3089
|
-
editor.isFocused = false;
|
|
3090
|
-
const transaction = editor.state.tr.setMeta("blur", { event }).setMeta("addToHistory", false);
|
|
3091
|
-
view.dispatch(transaction);
|
|
3092
|
-
return false;
|
|
3093
|
-
}
|
|
3094
|
-
}
|
|
3095
|
-
}
|
|
3096
|
-
})
|
|
3097
|
-
];
|
|
3098
|
-
}
|
|
3099
|
-
});
|
|
3100
|
-
const Keymap = Extension.create({
|
|
3101
|
-
name: "keymap",
|
|
3102
|
-
addKeyboardShortcuts() {
|
|
3103
|
-
const handleBackspace = () => this.editor.commands.first(({ commands: commands2 }) => [
|
|
3104
|
-
() => commands2.undoInputRule(),
|
|
3105
|
-
// maybe convert first text block node to default node
|
|
3106
|
-
() => commands2.command(({ tr }) => {
|
|
3107
|
-
const { selection, doc } = tr;
|
|
3108
|
-
const { empty, $anchor } = selection;
|
|
3109
|
-
const { pos, parent } = $anchor;
|
|
3110
|
-
const $parentPos = $anchor.parent.isTextblock && pos > 0 ? tr.doc.resolve(pos - 1) : $anchor;
|
|
3111
|
-
const parentIsIsolating = $parentPos.parent.type.spec.isolating;
|
|
3112
|
-
const parentPos = $anchor.pos - $anchor.parentOffset;
|
|
3113
|
-
const isAtStart = parentIsIsolating && $parentPos.parent.childCount === 1 ? parentPos === $anchor.pos : Selection.atStart(doc).from === pos;
|
|
3114
|
-
if (!empty || !parent.type.isTextblock || parent.textContent.length || !isAtStart || isAtStart && $anchor.parent.type.name === "paragraph") {
|
|
3115
|
-
return false;
|
|
3116
|
-
}
|
|
3117
|
-
return commands2.clearNodes();
|
|
3118
|
-
}),
|
|
3119
|
-
() => commands2.deleteSelection(),
|
|
3120
|
-
() => commands2.joinBackward(),
|
|
3121
|
-
() => commands2.selectNodeBackward()
|
|
3122
|
-
]);
|
|
3123
|
-
const handleDelete = () => this.editor.commands.first(({ commands: commands2 }) => [
|
|
3124
|
-
() => commands2.deleteSelection(),
|
|
3125
|
-
() => commands2.deleteCurrentNode(),
|
|
3126
|
-
() => commands2.joinForward(),
|
|
3127
|
-
() => commands2.selectNodeForward()
|
|
3128
|
-
]);
|
|
3129
|
-
const handleEnter = () => this.editor.commands.first(({ commands: commands2 }) => [
|
|
3130
|
-
() => commands2.newlineInCode(),
|
|
3131
|
-
() => commands2.createParagraphNear(),
|
|
3132
|
-
() => commands2.liftEmptyBlock(),
|
|
3133
|
-
() => commands2.splitBlock()
|
|
3134
|
-
]);
|
|
3135
|
-
const baseKeymap = {
|
|
3136
|
-
Enter: handleEnter,
|
|
3137
|
-
"Mod-Enter": () => this.editor.commands.exitCode(),
|
|
3138
|
-
Backspace: handleBackspace,
|
|
3139
|
-
"Mod-Backspace": handleBackspace,
|
|
3140
|
-
"Shift-Backspace": handleBackspace,
|
|
3141
|
-
Delete: handleDelete,
|
|
3142
|
-
"Mod-Delete": handleDelete,
|
|
3143
|
-
"Mod-a": () => this.editor.commands.selectAll()
|
|
3144
|
-
};
|
|
3145
|
-
const pcKeymap = {
|
|
3146
|
-
...baseKeymap
|
|
3147
|
-
};
|
|
3148
|
-
const macKeymap = {
|
|
3149
|
-
...baseKeymap,
|
|
3150
|
-
"Ctrl-h": handleBackspace,
|
|
3151
|
-
"Alt-Backspace": handleBackspace,
|
|
3152
|
-
"Ctrl-d": handleDelete,
|
|
3153
|
-
"Ctrl-Alt-Backspace": handleDelete,
|
|
3154
|
-
"Alt-Delete": handleDelete,
|
|
3155
|
-
"Alt-d": handleDelete,
|
|
3156
|
-
"Ctrl-a": () => this.editor.commands.selectTextblockStart(),
|
|
3157
|
-
"Ctrl-e": () => this.editor.commands.selectTextblockEnd()
|
|
3158
|
-
};
|
|
3159
|
-
if (isiOS() || isMacOS()) {
|
|
3160
|
-
return macKeymap;
|
|
3161
|
-
}
|
|
3162
|
-
return pcKeymap;
|
|
3163
|
-
},
|
|
3164
|
-
addProseMirrorPlugins() {
|
|
3165
|
-
return [
|
|
3166
|
-
// With this plugin we check if the whole document was selected and deleted.
|
|
3167
|
-
// In this case we will additionally call `clearNodes()` to convert e.g. a heading
|
|
3168
|
-
// to a paragraph if necessary.
|
|
3169
|
-
// This is an alternative to ProseMirror's `AllSelection`, which doesn’t work well
|
|
3170
|
-
// with many other commands.
|
|
3171
|
-
new Plugin({
|
|
3172
|
-
key: new PluginKey("clearDocument"),
|
|
3173
|
-
appendTransaction: (transactions, oldState, newState) => {
|
|
3174
|
-
if (transactions.some((tr2) => tr2.getMeta("composition"))) {
|
|
3175
|
-
return;
|
|
3176
|
-
}
|
|
3177
|
-
const docChanges = transactions.some((transaction) => transaction.docChanged) && !oldState.doc.eq(newState.doc);
|
|
3178
|
-
const ignoreTr = transactions.some((transaction) => transaction.getMeta("preventClearDocument"));
|
|
3179
|
-
if (!docChanges || ignoreTr) {
|
|
3180
|
-
return;
|
|
3181
|
-
}
|
|
3182
|
-
const { empty, from, to } = oldState.selection;
|
|
3183
|
-
const allFrom = Selection.atStart(oldState.doc).from;
|
|
3184
|
-
const allEnd = Selection.atEnd(oldState.doc).to;
|
|
3185
|
-
const allWasSelected = from === allFrom && to === allEnd;
|
|
3186
|
-
if (empty || !allWasSelected) {
|
|
3187
|
-
return;
|
|
3188
|
-
}
|
|
3189
|
-
const isEmpty = isNodeEmpty(newState.doc);
|
|
3190
|
-
if (!isEmpty) {
|
|
3191
|
-
return;
|
|
3192
|
-
}
|
|
3193
|
-
const tr = newState.tr;
|
|
3194
|
-
const state = createChainableState({
|
|
3195
|
-
state: newState,
|
|
3196
|
-
transaction: tr
|
|
3197
|
-
});
|
|
3198
|
-
const { commands: commands2 } = new CommandManager({
|
|
3199
|
-
editor: this.editor,
|
|
3200
|
-
state
|
|
3201
|
-
});
|
|
3202
|
-
commands2.clearNodes();
|
|
3203
|
-
if (!tr.steps.length) {
|
|
3204
|
-
return;
|
|
3205
|
-
}
|
|
3206
|
-
return tr;
|
|
3207
|
-
}
|
|
3208
|
-
})
|
|
3209
|
-
];
|
|
3210
|
-
}
|
|
3211
|
-
});
|
|
3212
|
-
const Paste = Extension.create({
|
|
3213
|
-
name: "paste",
|
|
3214
|
-
addProseMirrorPlugins() {
|
|
3215
|
-
return [
|
|
3216
|
-
new Plugin({
|
|
3217
|
-
key: new PluginKey("tiptapPaste"),
|
|
3218
|
-
props: {
|
|
3219
|
-
handlePaste: (_view, e, slice) => {
|
|
3220
|
-
this.editor.emit("paste", {
|
|
3221
|
-
editor: this.editor,
|
|
3222
|
-
event: e,
|
|
3223
|
-
slice
|
|
3224
|
-
});
|
|
3225
|
-
}
|
|
3226
|
-
}
|
|
3227
|
-
})
|
|
3228
|
-
];
|
|
3229
|
-
}
|
|
3230
|
-
});
|
|
3231
|
-
const Tabindex = Extension.create({
|
|
3232
|
-
name: "tabindex",
|
|
3233
|
-
addProseMirrorPlugins() {
|
|
3234
|
-
return [
|
|
3235
|
-
new Plugin({
|
|
3236
|
-
key: new PluginKey("tabindex"),
|
|
3237
|
-
props: {
|
|
3238
|
-
attributes: () => this.editor.isEditable ? { tabindex: "0" } : {}
|
|
3239
|
-
}
|
|
3240
|
-
})
|
|
3241
|
-
];
|
|
3242
|
-
}
|
|
3243
|
-
});
|
|
3244
|
-
class NodePos {
|
|
3245
|
-
get name() {
|
|
3246
|
-
return this.node.type.name;
|
|
3247
|
-
}
|
|
3248
|
-
constructor(pos, editor, isBlock = false, node = null) {
|
|
3249
|
-
this.currentNode = null;
|
|
3250
|
-
this.actualDepth = null;
|
|
3251
|
-
this.isBlock = isBlock;
|
|
3252
|
-
this.resolvedPos = pos;
|
|
3253
|
-
this.editor = editor;
|
|
3254
|
-
this.currentNode = node;
|
|
3255
|
-
}
|
|
3256
|
-
get node() {
|
|
3257
|
-
return this.currentNode || this.resolvedPos.node();
|
|
3258
|
-
}
|
|
3259
|
-
get element() {
|
|
3260
|
-
return this.editor.view.domAtPos(this.pos).node;
|
|
3261
|
-
}
|
|
3262
|
-
get depth() {
|
|
3263
|
-
var _a;
|
|
3264
|
-
return (_a = this.actualDepth) !== null && _a !== void 0 ? _a : this.resolvedPos.depth;
|
|
3265
|
-
}
|
|
3266
|
-
get pos() {
|
|
3267
|
-
return this.resolvedPos.pos;
|
|
3268
|
-
}
|
|
3269
|
-
get content() {
|
|
3270
|
-
return this.node.content;
|
|
3271
|
-
}
|
|
3272
|
-
set content(content) {
|
|
3273
|
-
let from = this.from;
|
|
3274
|
-
let to = this.to;
|
|
3275
|
-
if (this.isBlock) {
|
|
3276
|
-
if (this.content.size === 0) {
|
|
3277
|
-
console.error(`You can’t set content on a block node. Tried to set content on ${this.name} at ${this.pos}`);
|
|
3278
|
-
return;
|
|
3279
|
-
}
|
|
3280
|
-
from = this.from + 1;
|
|
3281
|
-
to = this.to - 1;
|
|
3282
|
-
}
|
|
3283
|
-
this.editor.commands.insertContentAt({ from, to }, content);
|
|
3284
|
-
}
|
|
3285
|
-
get attributes() {
|
|
3286
|
-
return this.node.attrs;
|
|
3287
|
-
}
|
|
3288
|
-
get textContent() {
|
|
3289
|
-
return this.node.textContent;
|
|
3290
|
-
}
|
|
3291
|
-
get size() {
|
|
3292
|
-
return this.node.nodeSize;
|
|
3293
|
-
}
|
|
3294
|
-
get from() {
|
|
3295
|
-
if (this.isBlock) {
|
|
3296
|
-
return this.pos;
|
|
3297
|
-
}
|
|
3298
|
-
return this.resolvedPos.start(this.resolvedPos.depth);
|
|
3299
|
-
}
|
|
3300
|
-
get range() {
|
|
3301
|
-
return {
|
|
3302
|
-
from: this.from,
|
|
3303
|
-
to: this.to
|
|
3304
|
-
};
|
|
3305
|
-
}
|
|
3306
|
-
get to() {
|
|
3307
|
-
if (this.isBlock) {
|
|
3308
|
-
return this.pos + this.size;
|
|
3309
|
-
}
|
|
3310
|
-
return this.resolvedPos.end(this.resolvedPos.depth) + (this.node.isText ? 0 : 1);
|
|
3311
|
-
}
|
|
3312
|
-
get parent() {
|
|
3313
|
-
if (this.depth === 0) {
|
|
3314
|
-
return null;
|
|
3315
|
-
}
|
|
3316
|
-
const parentPos = this.resolvedPos.start(this.resolvedPos.depth - 1);
|
|
3317
|
-
const $pos = this.resolvedPos.doc.resolve(parentPos);
|
|
3318
|
-
return new NodePos($pos, this.editor);
|
|
3319
|
-
}
|
|
3320
|
-
get before() {
|
|
3321
|
-
let $pos = this.resolvedPos.doc.resolve(this.from - (this.isBlock ? 1 : 2));
|
|
3322
|
-
if ($pos.depth !== this.depth) {
|
|
3323
|
-
$pos = this.resolvedPos.doc.resolve(this.from - 3);
|
|
3324
|
-
}
|
|
3325
|
-
return new NodePos($pos, this.editor);
|
|
3326
|
-
}
|
|
3327
|
-
get after() {
|
|
3328
|
-
let $pos = this.resolvedPos.doc.resolve(this.to + (this.isBlock ? 2 : 1));
|
|
3329
|
-
if ($pos.depth !== this.depth) {
|
|
3330
|
-
$pos = this.resolvedPos.doc.resolve(this.to + 3);
|
|
3331
|
-
}
|
|
3332
|
-
return new NodePos($pos, this.editor);
|
|
3333
|
-
}
|
|
3334
|
-
get children() {
|
|
3335
|
-
const children = [];
|
|
3336
|
-
this.node.content.forEach((node, offset) => {
|
|
3337
|
-
const isBlock = node.isBlock && !node.isTextblock;
|
|
3338
|
-
const isNonTextAtom = node.isAtom && !node.isText;
|
|
3339
|
-
const targetPos = this.pos + offset + (isNonTextAtom ? 0 : 1);
|
|
3340
|
-
if (targetPos < 0 || targetPos > this.resolvedPos.doc.nodeSize - 2) {
|
|
3341
|
-
return;
|
|
3342
|
-
}
|
|
3343
|
-
const $pos = this.resolvedPos.doc.resolve(targetPos);
|
|
3344
|
-
if (!isBlock && $pos.depth <= this.depth) {
|
|
3345
|
-
return;
|
|
3346
|
-
}
|
|
3347
|
-
const childNodePos = new NodePos($pos, this.editor, isBlock, isBlock ? node : null);
|
|
3348
|
-
if (isBlock) {
|
|
3349
|
-
childNodePos.actualDepth = this.depth + 1;
|
|
3350
|
-
}
|
|
3351
|
-
children.push(new NodePos($pos, this.editor, isBlock, isBlock ? node : null));
|
|
3352
|
-
});
|
|
3353
|
-
return children;
|
|
3354
|
-
}
|
|
3355
|
-
get firstChild() {
|
|
3356
|
-
return this.children[0] || null;
|
|
3357
|
-
}
|
|
3358
|
-
get lastChild() {
|
|
3359
|
-
const children = this.children;
|
|
3360
|
-
return children[children.length - 1] || null;
|
|
3361
|
-
}
|
|
3362
|
-
closest(selector, attributes = {}) {
|
|
3363
|
-
let node = null;
|
|
3364
|
-
let currentNode = this.parent;
|
|
3365
|
-
while (currentNode && !node) {
|
|
3366
|
-
if (currentNode.node.type.name === selector) {
|
|
3367
|
-
if (Object.keys(attributes).length > 0) {
|
|
3368
|
-
const nodeAttributes = currentNode.node.attrs;
|
|
3369
|
-
const attrKeys = Object.keys(attributes);
|
|
3370
|
-
for (let index = 0; index < attrKeys.length; index += 1) {
|
|
3371
|
-
const key = attrKeys[index];
|
|
3372
|
-
if (nodeAttributes[key] !== attributes[key]) {
|
|
3373
|
-
break;
|
|
3374
|
-
}
|
|
3375
|
-
}
|
|
3376
|
-
} else {
|
|
3377
|
-
node = currentNode;
|
|
3378
|
-
}
|
|
3379
|
-
}
|
|
3380
|
-
currentNode = currentNode.parent;
|
|
3381
|
-
}
|
|
3382
|
-
return node;
|
|
3383
|
-
}
|
|
3384
|
-
querySelector(selector, attributes = {}) {
|
|
3385
|
-
return this.querySelectorAll(selector, attributes, true)[0] || null;
|
|
3386
|
-
}
|
|
3387
|
-
querySelectorAll(selector, attributes = {}, firstItemOnly = false) {
|
|
3388
|
-
let nodes = [];
|
|
3389
|
-
if (!this.children || this.children.length === 0) {
|
|
3390
|
-
return nodes;
|
|
3391
|
-
}
|
|
3392
|
-
const attrKeys = Object.keys(attributes);
|
|
3393
|
-
this.children.forEach((childPos) => {
|
|
3394
|
-
if (firstItemOnly && nodes.length > 0) {
|
|
3395
|
-
return;
|
|
3396
|
-
}
|
|
3397
|
-
if (childPos.node.type.name === selector) {
|
|
3398
|
-
const doesAllAttributesMatch = attrKeys.every((key) => attributes[key] === childPos.node.attrs[key]);
|
|
3399
|
-
if (doesAllAttributesMatch) {
|
|
3400
|
-
nodes.push(childPos);
|
|
3401
|
-
}
|
|
3402
|
-
}
|
|
3403
|
-
if (firstItemOnly && nodes.length > 0) {
|
|
3404
|
-
return;
|
|
3405
|
-
}
|
|
3406
|
-
nodes = nodes.concat(childPos.querySelectorAll(selector, attributes, firstItemOnly));
|
|
3407
|
-
});
|
|
3408
|
-
return nodes;
|
|
3409
|
-
}
|
|
3410
|
-
setAttribute(attributes) {
|
|
3411
|
-
const { tr } = this.editor.state;
|
|
3412
|
-
tr.setNodeMarkup(this.from, void 0, {
|
|
3413
|
-
...this.node.attrs,
|
|
3414
|
-
...attributes
|
|
3415
|
-
});
|
|
3416
|
-
this.editor.view.dispatch(tr);
|
|
3417
|
-
}
|
|
3418
|
-
}
|
|
3419
|
-
const style = `.ProseMirror {
|
|
3420
|
-
position: relative;
|
|
3421
|
-
}
|
|
3422
|
-
|
|
3423
|
-
.ProseMirror {
|
|
3424
|
-
word-wrap: break-word;
|
|
3425
|
-
white-space: pre-wrap;
|
|
3426
|
-
white-space: break-spaces;
|
|
3427
|
-
-webkit-font-variant-ligatures: none;
|
|
3428
|
-
font-variant-ligatures: none;
|
|
3429
|
-
font-feature-settings: "liga" 0; /* the above doesn't seem to work in Edge */
|
|
3430
|
-
}
|
|
3431
|
-
|
|
3432
|
-
.ProseMirror [contenteditable="false"] {
|
|
3433
|
-
white-space: normal;
|
|
3434
|
-
}
|
|
3435
|
-
|
|
3436
|
-
.ProseMirror [contenteditable="false"] [contenteditable="true"] {
|
|
3437
|
-
white-space: pre-wrap;
|
|
3438
|
-
}
|
|
3439
|
-
|
|
3440
|
-
.ProseMirror pre {
|
|
3441
|
-
white-space: pre-wrap;
|
|
3442
|
-
}
|
|
3443
|
-
|
|
3444
|
-
img.ProseMirror-separator {
|
|
3445
|
-
display: inline !important;
|
|
3446
|
-
border: none !important;
|
|
3447
|
-
margin: 0 !important;
|
|
3448
|
-
width: 0 !important;
|
|
3449
|
-
height: 0 !important;
|
|
3450
|
-
}
|
|
3451
|
-
|
|
3452
|
-
.ProseMirror-gapcursor {
|
|
3453
|
-
display: none;
|
|
3454
|
-
pointer-events: none;
|
|
3455
|
-
position: absolute;
|
|
3456
|
-
margin: 0;
|
|
3457
|
-
}
|
|
3458
|
-
|
|
3459
|
-
.ProseMirror-gapcursor:after {
|
|
3460
|
-
content: "";
|
|
3461
|
-
display: block;
|
|
3462
|
-
position: absolute;
|
|
3463
|
-
top: -2px;
|
|
3464
|
-
width: 20px;
|
|
3465
|
-
border-top: 1px solid black;
|
|
3466
|
-
animation: ProseMirror-cursor-blink 1.1s steps(2, start) infinite;
|
|
3467
|
-
}
|
|
3468
|
-
|
|
3469
|
-
@keyframes ProseMirror-cursor-blink {
|
|
3470
|
-
to {
|
|
3471
|
-
visibility: hidden;
|
|
3472
|
-
}
|
|
3473
|
-
}
|
|
3474
|
-
|
|
3475
|
-
.ProseMirror-hideselection *::selection {
|
|
3476
|
-
background: transparent;
|
|
3477
|
-
}
|
|
3478
|
-
|
|
3479
|
-
.ProseMirror-hideselection *::-moz-selection {
|
|
3480
|
-
background: transparent;
|
|
3481
|
-
}
|
|
3482
|
-
|
|
3483
|
-
.ProseMirror-hideselection * {
|
|
3484
|
-
caret-color: transparent;
|
|
3485
|
-
}
|
|
3486
|
-
|
|
3487
|
-
.ProseMirror-focused .ProseMirror-gapcursor {
|
|
3488
|
-
display: block;
|
|
3489
|
-
}
|
|
3490
|
-
|
|
3491
|
-
.tippy-box[data-animation=fade][data-state=hidden] {
|
|
3492
|
-
opacity: 0
|
|
3493
|
-
}`;
|
|
3494
|
-
function createStyleTag(style2, nonce, suffix) {
|
|
3495
|
-
const tiptapStyleTag = document.querySelector(`style[data-tiptap-style${""}]`);
|
|
3496
|
-
if (tiptapStyleTag !== null) {
|
|
3497
|
-
return tiptapStyleTag;
|
|
3498
|
-
}
|
|
3499
|
-
const styleNode = document.createElement("style");
|
|
3500
|
-
if (nonce) {
|
|
3501
|
-
styleNode.setAttribute("nonce", nonce);
|
|
3502
|
-
}
|
|
3503
|
-
styleNode.setAttribute(`data-tiptap-style${""}`, "");
|
|
3504
|
-
styleNode.innerHTML = style2;
|
|
3505
|
-
document.getElementsByTagName("head")[0].appendChild(styleNode);
|
|
3506
|
-
return styleNode;
|
|
3507
|
-
}
|
|
3508
|
-
class Editor extends EventEmitter {
|
|
3509
|
-
constructor(options = {}) {
|
|
3510
|
-
super();
|
|
3511
|
-
this.isFocused = false;
|
|
3512
|
-
this.isInitialized = false;
|
|
3513
|
-
this.extensionStorage = {};
|
|
3514
|
-
this.options = {
|
|
3515
|
-
element: document.createElement("div"),
|
|
3516
|
-
content: "",
|
|
3517
|
-
injectCSS: true,
|
|
3518
|
-
injectNonce: void 0,
|
|
3519
|
-
extensions: [],
|
|
3520
|
-
autofocus: false,
|
|
3521
|
-
editable: true,
|
|
3522
|
-
editorProps: {},
|
|
3523
|
-
parseOptions: {},
|
|
3524
|
-
coreExtensionOptions: {},
|
|
3525
|
-
enableInputRules: true,
|
|
3526
|
-
enablePasteRules: true,
|
|
3527
|
-
enableCoreExtensions: true,
|
|
3528
|
-
enableContentCheck: false,
|
|
3529
|
-
emitContentError: false,
|
|
3530
|
-
onBeforeCreate: () => null,
|
|
3531
|
-
onCreate: () => null,
|
|
3532
|
-
onUpdate: () => null,
|
|
3533
|
-
onSelectionUpdate: () => null,
|
|
3534
|
-
onTransaction: () => null,
|
|
3535
|
-
onFocus: () => null,
|
|
3536
|
-
onBlur: () => null,
|
|
3537
|
-
onDestroy: () => null,
|
|
3538
|
-
onContentError: ({ error }) => {
|
|
3539
|
-
throw error;
|
|
3540
|
-
},
|
|
3541
|
-
onPaste: () => null,
|
|
3542
|
-
onDrop: () => null
|
|
3543
|
-
};
|
|
3544
|
-
this.isCapturingTransaction = false;
|
|
3545
|
-
this.capturedTransaction = null;
|
|
3546
|
-
this.setOptions(options);
|
|
3547
|
-
this.createExtensionManager();
|
|
3548
|
-
this.createCommandManager();
|
|
3549
|
-
this.createSchema();
|
|
3550
|
-
this.on("beforeCreate", this.options.onBeforeCreate);
|
|
3551
|
-
this.emit("beforeCreate", { editor: this });
|
|
3552
|
-
this.on("contentError", this.options.onContentError);
|
|
3553
|
-
this.createView();
|
|
3554
|
-
this.injectCSS();
|
|
3555
|
-
this.on("create", this.options.onCreate);
|
|
3556
|
-
this.on("update", this.options.onUpdate);
|
|
3557
|
-
this.on("selectionUpdate", this.options.onSelectionUpdate);
|
|
3558
|
-
this.on("transaction", this.options.onTransaction);
|
|
3559
|
-
this.on("focus", this.options.onFocus);
|
|
3560
|
-
this.on("blur", this.options.onBlur);
|
|
3561
|
-
this.on("destroy", this.options.onDestroy);
|
|
3562
|
-
this.on("drop", ({ event, slice, moved }) => this.options.onDrop(event, slice, moved));
|
|
3563
|
-
this.on("paste", ({ event, slice }) => this.options.onPaste(event, slice));
|
|
3564
|
-
window.setTimeout(() => {
|
|
3565
|
-
if (this.isDestroyed) {
|
|
3566
|
-
return;
|
|
3567
|
-
}
|
|
3568
|
-
this.commands.focus(this.options.autofocus);
|
|
3569
|
-
this.emit("create", { editor: this });
|
|
3570
|
-
this.isInitialized = true;
|
|
3571
|
-
}, 0);
|
|
3572
|
-
}
|
|
3573
|
-
/**
|
|
3574
|
-
* Returns the editor storage.
|
|
3575
|
-
*/
|
|
3576
|
-
get storage() {
|
|
3577
|
-
return this.extensionStorage;
|
|
3578
|
-
}
|
|
3579
|
-
/**
|
|
3580
|
-
* An object of all registered commands.
|
|
3581
|
-
*/
|
|
3582
|
-
get commands() {
|
|
3583
|
-
return this.commandManager.commands;
|
|
3584
|
-
}
|
|
3585
|
-
/**
|
|
3586
|
-
* Create a command chain to call multiple commands at once.
|
|
3587
|
-
*/
|
|
3588
|
-
chain() {
|
|
3589
|
-
return this.commandManager.chain();
|
|
3590
|
-
}
|
|
3591
|
-
/**
|
|
3592
|
-
* Check if a command or a command chain can be executed. Without executing it.
|
|
3593
|
-
*/
|
|
3594
|
-
can() {
|
|
3595
|
-
return this.commandManager.can();
|
|
3596
|
-
}
|
|
3597
|
-
/**
|
|
3598
|
-
* Inject CSS styles.
|
|
3599
|
-
*/
|
|
3600
|
-
injectCSS() {
|
|
3601
|
-
if (this.options.injectCSS && document) {
|
|
3602
|
-
this.css = createStyleTag(style, this.options.injectNonce);
|
|
3603
|
-
}
|
|
3604
|
-
}
|
|
3605
|
-
/**
|
|
3606
|
-
* Update editor options.
|
|
3607
|
-
*
|
|
3608
|
-
* @param options A list of options
|
|
3609
|
-
*/
|
|
3610
|
-
setOptions(options = {}) {
|
|
3611
|
-
this.options = {
|
|
3612
|
-
...this.options,
|
|
3613
|
-
...options
|
|
3614
|
-
};
|
|
3615
|
-
if (!this.view || !this.state || this.isDestroyed) {
|
|
3616
|
-
return;
|
|
3617
|
-
}
|
|
3618
|
-
if (this.options.editorProps) {
|
|
3619
|
-
this.view.setProps(this.options.editorProps);
|
|
3620
|
-
}
|
|
3621
|
-
this.view.updateState(this.state);
|
|
3622
|
-
}
|
|
3623
|
-
/**
|
|
3624
|
-
* Update editable state of the editor.
|
|
3625
|
-
*/
|
|
3626
|
-
setEditable(editable, emitUpdate = true) {
|
|
3627
|
-
this.setOptions({ editable });
|
|
3628
|
-
if (emitUpdate) {
|
|
3629
|
-
this.emit("update", { editor: this, transaction: this.state.tr });
|
|
3630
|
-
}
|
|
3631
|
-
}
|
|
3632
|
-
/**
|
|
3633
|
-
* Returns whether the editor is editable.
|
|
3634
|
-
*/
|
|
3635
|
-
get isEditable() {
|
|
3636
|
-
return this.options.editable && this.view && this.view.editable;
|
|
3637
|
-
}
|
|
3638
|
-
/**
|
|
3639
|
-
* Returns the editor state.
|
|
3640
|
-
*/
|
|
3641
|
-
get state() {
|
|
3642
|
-
return this.view.state;
|
|
3643
|
-
}
|
|
3644
|
-
/**
|
|
3645
|
-
* Register a ProseMirror plugin.
|
|
3646
|
-
*
|
|
3647
|
-
* @param plugin A ProseMirror plugin
|
|
3648
|
-
* @param handlePlugins Control how to merge the plugin into the existing plugins.
|
|
3649
|
-
* @returns The new editor state
|
|
3650
|
-
*/
|
|
3651
|
-
registerPlugin(plugin, handlePlugins) {
|
|
3652
|
-
const plugins = isFunction(handlePlugins) ? handlePlugins(plugin, [...this.state.plugins]) : [...this.state.plugins, plugin];
|
|
3653
|
-
const state = this.state.reconfigure({ plugins });
|
|
3654
|
-
this.view.updateState(state);
|
|
3655
|
-
return state;
|
|
3656
|
-
}
|
|
3657
|
-
/**
|
|
3658
|
-
* Unregister a ProseMirror plugin.
|
|
3659
|
-
*
|
|
3660
|
-
* @param nameOrPluginKeyToRemove The plugins name
|
|
3661
|
-
* @returns The new editor state or undefined if the editor is destroyed
|
|
3662
|
-
*/
|
|
3663
|
-
unregisterPlugin(nameOrPluginKeyToRemove) {
|
|
3664
|
-
if (this.isDestroyed) {
|
|
3665
|
-
return void 0;
|
|
3666
|
-
}
|
|
3667
|
-
const prevPlugins = this.state.plugins;
|
|
3668
|
-
let plugins = prevPlugins;
|
|
3669
|
-
[].concat(nameOrPluginKeyToRemove).forEach((nameOrPluginKey) => {
|
|
3670
|
-
const name = typeof nameOrPluginKey === "string" ? `${nameOrPluginKey}$` : nameOrPluginKey.key;
|
|
3671
|
-
plugins = plugins.filter((plugin) => !plugin.key.startsWith(name));
|
|
3672
|
-
});
|
|
3673
|
-
if (prevPlugins.length === plugins.length) {
|
|
3674
|
-
return void 0;
|
|
3675
|
-
}
|
|
3676
|
-
const state = this.state.reconfigure({
|
|
3677
|
-
plugins
|
|
3678
|
-
});
|
|
3679
|
-
this.view.updateState(state);
|
|
3680
|
-
return state;
|
|
3681
|
-
}
|
|
3682
|
-
/**
|
|
3683
|
-
* Creates an extension manager.
|
|
3684
|
-
*/
|
|
3685
|
-
createExtensionManager() {
|
|
3686
|
-
var _a, _b;
|
|
3687
|
-
const coreExtensions = this.options.enableCoreExtensions ? [
|
|
3688
|
-
Editable,
|
|
3689
|
-
ClipboardTextSerializer.configure({
|
|
3690
|
-
blockSeparator: (_b = (_a = this.options.coreExtensionOptions) === null || _a === void 0 ? void 0 : _a.clipboardTextSerializer) === null || _b === void 0 ? void 0 : _b.blockSeparator
|
|
3691
|
-
}),
|
|
3692
|
-
Commands,
|
|
3693
|
-
FocusEvents,
|
|
3694
|
-
Keymap,
|
|
3695
|
-
Tabindex,
|
|
3696
|
-
Drop,
|
|
3697
|
-
Paste
|
|
3698
|
-
].filter((ext) => {
|
|
3699
|
-
if (typeof this.options.enableCoreExtensions === "object") {
|
|
3700
|
-
return this.options.enableCoreExtensions[ext.name] !== false;
|
|
3701
|
-
}
|
|
3702
|
-
return true;
|
|
3703
|
-
}) : [];
|
|
3704
|
-
const allExtensions = [...coreExtensions, ...this.options.extensions].filter((extension) => {
|
|
3705
|
-
return ["extension", "node", "mark"].includes(extension === null || extension === void 0 ? void 0 : extension.type);
|
|
3706
|
-
});
|
|
3707
|
-
this.extensionManager = new ExtensionManager(allExtensions, this);
|
|
3708
|
-
}
|
|
3709
|
-
/**
|
|
3710
|
-
* Creates an command manager.
|
|
3711
|
-
*/
|
|
3712
|
-
createCommandManager() {
|
|
3713
|
-
this.commandManager = new CommandManager({
|
|
3714
|
-
editor: this
|
|
3715
|
-
});
|
|
3716
|
-
}
|
|
3717
|
-
/**
|
|
3718
|
-
* Creates a ProseMirror schema.
|
|
3719
|
-
*/
|
|
3720
|
-
createSchema() {
|
|
3721
|
-
this.schema = this.extensionManager.schema;
|
|
3722
|
-
}
|
|
3723
|
-
/**
|
|
3724
|
-
* Creates a ProseMirror view.
|
|
3725
|
-
*/
|
|
3726
|
-
createView() {
|
|
3727
|
-
var _a;
|
|
3728
|
-
let doc;
|
|
3729
|
-
try {
|
|
3730
|
-
doc = createDocument(this.options.content, this.schema, this.options.parseOptions, { errorOnInvalidContent: this.options.enableContentCheck });
|
|
3731
|
-
} catch (e) {
|
|
3732
|
-
if (!(e instanceof Error) || !["[tiptap error]: Invalid JSON content", "[tiptap error]: Invalid HTML content"].includes(e.message)) {
|
|
3733
|
-
throw e;
|
|
3734
|
-
}
|
|
3735
|
-
this.emit("contentError", {
|
|
3736
|
-
editor: this,
|
|
3737
|
-
error: e,
|
|
3738
|
-
disableCollaboration: () => {
|
|
3739
|
-
if (this.storage.collaboration) {
|
|
3740
|
-
this.storage.collaboration.isDisabled = true;
|
|
3741
|
-
}
|
|
3742
|
-
this.options.extensions = this.options.extensions.filter((extension) => extension.name !== "collaboration");
|
|
3743
|
-
this.createExtensionManager();
|
|
3744
|
-
}
|
|
3745
|
-
});
|
|
3746
|
-
doc = createDocument(this.options.content, this.schema, this.options.parseOptions, { errorOnInvalidContent: false });
|
|
3747
|
-
}
|
|
3748
|
-
const selection = resolveFocusPosition(doc, this.options.autofocus);
|
|
3749
|
-
this.view = new EditorView(this.options.element, {
|
|
3750
|
-
...this.options.editorProps,
|
|
3751
|
-
attributes: {
|
|
3752
|
-
// add `role="textbox"` to the editor element
|
|
3753
|
-
role: "textbox",
|
|
3754
|
-
...(_a = this.options.editorProps) === null || _a === void 0 ? void 0 : _a.attributes
|
|
3755
|
-
},
|
|
3756
|
-
dispatchTransaction: this.dispatchTransaction.bind(this),
|
|
3757
|
-
state: EditorState.create({
|
|
3758
|
-
doc,
|
|
3759
|
-
selection: selection || void 0
|
|
3760
|
-
})
|
|
3761
|
-
});
|
|
3762
|
-
const newState = this.state.reconfigure({
|
|
3763
|
-
plugins: this.extensionManager.plugins
|
|
3764
|
-
});
|
|
3765
|
-
this.view.updateState(newState);
|
|
3766
|
-
this.createNodeViews();
|
|
3767
|
-
this.prependClass();
|
|
3768
|
-
const dom = this.view.dom;
|
|
3769
|
-
dom.editor = this;
|
|
3770
|
-
}
|
|
3771
|
-
/**
|
|
3772
|
-
* Creates all node views.
|
|
3773
|
-
*/
|
|
3774
|
-
createNodeViews() {
|
|
3775
|
-
if (this.view.isDestroyed) {
|
|
3776
|
-
return;
|
|
3777
|
-
}
|
|
3778
|
-
this.view.setProps({
|
|
3779
|
-
nodeViews: this.extensionManager.nodeViews
|
|
3780
|
-
});
|
|
3781
|
-
}
|
|
3782
|
-
/**
|
|
3783
|
-
* Prepend class name to element.
|
|
3784
|
-
*/
|
|
3785
|
-
prependClass() {
|
|
3786
|
-
this.view.dom.className = `tiptap ${this.view.dom.className}`;
|
|
3787
|
-
}
|
|
3788
|
-
captureTransaction(fn) {
|
|
3789
|
-
this.isCapturingTransaction = true;
|
|
3790
|
-
fn();
|
|
3791
|
-
this.isCapturingTransaction = false;
|
|
3792
|
-
const tr = this.capturedTransaction;
|
|
3793
|
-
this.capturedTransaction = null;
|
|
3794
|
-
return tr;
|
|
3795
|
-
}
|
|
3796
|
-
/**
|
|
3797
|
-
* The callback over which to send transactions (state updates) produced by the view.
|
|
3798
|
-
*
|
|
3799
|
-
* @param transaction An editor state transaction
|
|
3800
|
-
*/
|
|
3801
|
-
dispatchTransaction(transaction) {
|
|
3802
|
-
if (this.view.isDestroyed) {
|
|
3803
|
-
return;
|
|
3804
|
-
}
|
|
3805
|
-
if (this.isCapturingTransaction) {
|
|
3806
|
-
if (!this.capturedTransaction) {
|
|
3807
|
-
this.capturedTransaction = transaction;
|
|
3808
|
-
return;
|
|
3809
|
-
}
|
|
3810
|
-
transaction.steps.forEach((step) => {
|
|
3811
|
-
var _a;
|
|
3812
|
-
return (_a = this.capturedTransaction) === null || _a === void 0 ? void 0 : _a.step(step);
|
|
3813
|
-
});
|
|
3814
|
-
return;
|
|
3815
|
-
}
|
|
3816
|
-
const state = this.state.apply(transaction);
|
|
3817
|
-
const selectionHasChanged = !this.state.selection.eq(state.selection);
|
|
3818
|
-
this.emit("beforeTransaction", {
|
|
3819
|
-
editor: this,
|
|
3820
|
-
transaction,
|
|
3821
|
-
nextState: state
|
|
3822
|
-
});
|
|
3823
|
-
this.view.updateState(state);
|
|
3824
|
-
this.emit("transaction", {
|
|
3825
|
-
editor: this,
|
|
3826
|
-
transaction
|
|
3827
|
-
});
|
|
3828
|
-
if (selectionHasChanged) {
|
|
3829
|
-
this.emit("selectionUpdate", {
|
|
3830
|
-
editor: this,
|
|
3831
|
-
transaction
|
|
3832
|
-
});
|
|
3833
|
-
}
|
|
3834
|
-
const focus2 = transaction.getMeta("focus");
|
|
3835
|
-
const blur2 = transaction.getMeta("blur");
|
|
3836
|
-
if (focus2) {
|
|
3837
|
-
this.emit("focus", {
|
|
3838
|
-
editor: this,
|
|
3839
|
-
event: focus2.event,
|
|
3840
|
-
transaction
|
|
3841
|
-
});
|
|
3842
|
-
}
|
|
3843
|
-
if (blur2) {
|
|
3844
|
-
this.emit("blur", {
|
|
3845
|
-
editor: this,
|
|
3846
|
-
event: blur2.event,
|
|
3847
|
-
transaction
|
|
3848
|
-
});
|
|
3849
|
-
}
|
|
3850
|
-
if (!transaction.docChanged || transaction.getMeta("preventUpdate")) {
|
|
3851
|
-
return;
|
|
3852
|
-
}
|
|
3853
|
-
this.emit("update", {
|
|
3854
|
-
editor: this,
|
|
3855
|
-
transaction
|
|
3856
|
-
});
|
|
3857
|
-
}
|
|
3858
|
-
/**
|
|
3859
|
-
* Get attributes of the currently selected node or mark.
|
|
3860
|
-
*/
|
|
3861
|
-
getAttributes(nameOrType) {
|
|
3862
|
-
return getAttributes(this.state, nameOrType);
|
|
3863
|
-
}
|
|
3864
|
-
isActive(nameOrAttributes, attributesOrUndefined) {
|
|
3865
|
-
const name = typeof nameOrAttributes === "string" ? nameOrAttributes : null;
|
|
3866
|
-
const attributes = typeof nameOrAttributes === "string" ? attributesOrUndefined : nameOrAttributes;
|
|
3867
|
-
return isActive(this.state, name, attributes);
|
|
3868
|
-
}
|
|
3869
|
-
/**
|
|
3870
|
-
* Get the document as JSON.
|
|
3871
|
-
*/
|
|
3872
|
-
getJSON() {
|
|
3873
|
-
return this.state.doc.toJSON();
|
|
3874
|
-
}
|
|
3875
|
-
/**
|
|
3876
|
-
* Get the document as HTML.
|
|
3877
|
-
*/
|
|
3878
|
-
getHTML() {
|
|
3879
|
-
return getHTMLFromFragment(this.state.doc.content, this.schema);
|
|
3880
|
-
}
|
|
3881
|
-
/**
|
|
3882
|
-
* Get the document as text.
|
|
3883
|
-
*/
|
|
3884
|
-
getText(options) {
|
|
3885
|
-
const { blockSeparator = "\n\n", textSerializers = {} } = options || {};
|
|
3886
|
-
return getText(this.state.doc, {
|
|
3887
|
-
blockSeparator,
|
|
3888
|
-
textSerializers: {
|
|
3889
|
-
...getTextSerializersFromSchema(this.schema),
|
|
3890
|
-
...textSerializers
|
|
3891
|
-
}
|
|
3892
|
-
});
|
|
3893
|
-
}
|
|
3894
|
-
/**
|
|
3895
|
-
* Check if there is no content.
|
|
3896
|
-
*/
|
|
3897
|
-
get isEmpty() {
|
|
3898
|
-
return isNodeEmpty(this.state.doc);
|
|
3899
|
-
}
|
|
3900
|
-
/**
|
|
3901
|
-
* Get the number of characters for the current document.
|
|
3902
|
-
*
|
|
3903
|
-
* @deprecated
|
|
3904
|
-
*/
|
|
3905
|
-
getCharacterCount() {
|
|
3906
|
-
console.warn('[tiptap warn]: "editor.getCharacterCount()" is deprecated. Please use "editor.storage.characterCount.characters()" instead.');
|
|
3907
|
-
return this.state.doc.content.size - 2;
|
|
3908
|
-
}
|
|
3909
|
-
/**
|
|
3910
|
-
* Destroy the editor.
|
|
3911
|
-
*/
|
|
3912
|
-
destroy() {
|
|
3913
|
-
this.emit("destroy");
|
|
3914
|
-
if (this.view) {
|
|
3915
|
-
const dom = this.view.dom;
|
|
3916
|
-
if (dom && dom.editor) {
|
|
3917
|
-
delete dom.editor;
|
|
3918
|
-
}
|
|
3919
|
-
this.view.destroy();
|
|
3920
|
-
}
|
|
3921
|
-
this.removeAllListeners();
|
|
3922
|
-
}
|
|
3923
|
-
/**
|
|
3924
|
-
* Check if the editor is already destroyed.
|
|
3925
|
-
*/
|
|
3926
|
-
get isDestroyed() {
|
|
3927
|
-
var _a;
|
|
3928
|
-
return !((_a = this.view) === null || _a === void 0 ? void 0 : _a.docView);
|
|
3929
|
-
}
|
|
3930
|
-
$node(selector, attributes) {
|
|
3931
|
-
var _a;
|
|
3932
|
-
return ((_a = this.$doc) === null || _a === void 0 ? void 0 : _a.querySelector(selector, attributes)) || null;
|
|
3933
|
-
}
|
|
3934
|
-
$nodes(selector, attributes) {
|
|
3935
|
-
var _a;
|
|
3936
|
-
return ((_a = this.$doc) === null || _a === void 0 ? void 0 : _a.querySelectorAll(selector, attributes)) || null;
|
|
3937
|
-
}
|
|
3938
|
-
$pos(pos) {
|
|
3939
|
-
const $pos = this.state.doc.resolve(pos);
|
|
3940
|
-
return new NodePos($pos, this);
|
|
3941
|
-
}
|
|
3942
|
-
get $doc() {
|
|
3943
|
-
return this.$pos(0);
|
|
3944
|
-
}
|
|
3945
|
-
}
|
|
3946
|
-
function markInputRule(config) {
|
|
3947
|
-
return new InputRule({
|
|
3948
|
-
find: config.find,
|
|
3949
|
-
handler: ({ state, range, match }) => {
|
|
3950
|
-
const attributes = callOrReturn(config.getAttributes, void 0, match);
|
|
3951
|
-
if (attributes === false || attributes === null) {
|
|
3952
|
-
return null;
|
|
3953
|
-
}
|
|
3954
|
-
const { tr } = state;
|
|
3955
|
-
const captureGroup = match[match.length - 1];
|
|
3956
|
-
const fullMatch = match[0];
|
|
3957
|
-
if (captureGroup) {
|
|
3958
|
-
const startSpaces = fullMatch.search(/\S/);
|
|
3959
|
-
const textStart = range.from + fullMatch.indexOf(captureGroup);
|
|
3960
|
-
const textEnd = textStart + captureGroup.length;
|
|
3961
|
-
const excludedMarks = getMarksBetween(range.from, range.to, state.doc).filter((item) => {
|
|
3962
|
-
const excluded = item.mark.type.excluded;
|
|
3963
|
-
return excluded.find((type) => type === config.type && type !== item.mark.type);
|
|
3964
|
-
}).filter((item) => item.to > textStart);
|
|
3965
|
-
if (excludedMarks.length) {
|
|
3966
|
-
return null;
|
|
3967
|
-
}
|
|
3968
|
-
if (textEnd < range.to) {
|
|
3969
|
-
tr.delete(textEnd, range.to);
|
|
3970
|
-
}
|
|
3971
|
-
if (textStart > range.from) {
|
|
3972
|
-
tr.delete(range.from + startSpaces, textStart);
|
|
3973
|
-
}
|
|
3974
|
-
const markEnd = range.from + startSpaces + captureGroup.length;
|
|
3975
|
-
tr.addMark(range.from + startSpaces, markEnd, config.type.create(attributes || {}));
|
|
3976
|
-
tr.removeStoredMark(config.type);
|
|
3977
|
-
}
|
|
3978
|
-
}
|
|
3979
|
-
});
|
|
3980
|
-
}
|
|
3981
|
-
function nodeInputRule(config) {
|
|
3982
|
-
return new InputRule({
|
|
3983
|
-
find: config.find,
|
|
3984
|
-
handler: ({ state, range, match }) => {
|
|
3985
|
-
const attributes = callOrReturn(config.getAttributes, void 0, match) || {};
|
|
3986
|
-
const { tr } = state;
|
|
3987
|
-
const start = range.from;
|
|
3988
|
-
let end = range.to;
|
|
3989
|
-
const newNode = config.type.create(attributes);
|
|
3990
|
-
if (match[1]) {
|
|
3991
|
-
const offset = match[0].lastIndexOf(match[1]);
|
|
3992
|
-
let matchStart = start + offset;
|
|
3993
|
-
if (matchStart > end) {
|
|
3994
|
-
matchStart = end;
|
|
3995
|
-
} else {
|
|
3996
|
-
end = matchStart + match[1].length;
|
|
3997
|
-
}
|
|
3998
|
-
const lastChar = match[0][match[0].length - 1];
|
|
3999
|
-
tr.insertText(lastChar, start + match[0].length - 1);
|
|
4000
|
-
tr.replaceWith(matchStart, end, newNode);
|
|
4001
|
-
} else if (match[0]) {
|
|
4002
|
-
const insertionStart = config.type.isInline ? start : start - 1;
|
|
4003
|
-
tr.insert(insertionStart, config.type.create(attributes)).delete(tr.mapping.map(start), tr.mapping.map(end));
|
|
4004
|
-
}
|
|
4005
|
-
tr.scrollIntoView();
|
|
4006
|
-
}
|
|
4007
|
-
});
|
|
4008
|
-
}
|
|
4009
|
-
function textblockTypeInputRule(config) {
|
|
4010
|
-
return new InputRule({
|
|
4011
|
-
find: config.find,
|
|
4012
|
-
handler: ({ state, range, match }) => {
|
|
4013
|
-
const $start = state.doc.resolve(range.from);
|
|
4014
|
-
const attributes = callOrReturn(config.getAttributes, void 0, match) || {};
|
|
4015
|
-
if (!$start.node(-1).canReplaceWith($start.index(-1), $start.indexAfter(-1), config.type)) {
|
|
4016
|
-
return null;
|
|
4017
|
-
}
|
|
4018
|
-
state.tr.delete(range.from, range.to).setBlockType(range.from, range.from, config.type, attributes);
|
|
4019
|
-
}
|
|
4020
|
-
});
|
|
4021
|
-
}
|
|
4022
|
-
function wrappingInputRule(config) {
|
|
4023
|
-
return new InputRule({
|
|
4024
|
-
find: config.find,
|
|
4025
|
-
handler: ({ state, range, match, chain }) => {
|
|
4026
|
-
const attributes = callOrReturn(config.getAttributes, void 0, match) || {};
|
|
4027
|
-
const tr = state.tr.delete(range.from, range.to);
|
|
4028
|
-
const $start = tr.doc.resolve(range.from);
|
|
4029
|
-
const blockRange = $start.blockRange();
|
|
4030
|
-
const wrapping = blockRange && findWrapping(blockRange, config.type, attributes);
|
|
4031
|
-
if (!wrapping) {
|
|
4032
|
-
return null;
|
|
4033
|
-
}
|
|
4034
|
-
tr.wrap(blockRange, wrapping);
|
|
4035
|
-
if (config.keepMarks && config.editor) {
|
|
4036
|
-
const { selection, storedMarks } = state;
|
|
4037
|
-
const { splittableMarks } = config.editor.extensionManager;
|
|
4038
|
-
const marks = storedMarks || selection.$to.parentOffset && selection.$from.marks();
|
|
4039
|
-
if (marks) {
|
|
4040
|
-
const filteredMarks = marks.filter((mark) => splittableMarks.includes(mark.type.name));
|
|
4041
|
-
tr.ensureMarks(filteredMarks);
|
|
4042
|
-
}
|
|
4043
|
-
}
|
|
4044
|
-
if (config.keepAttributes) {
|
|
4045
|
-
const nodeType = config.type.name === "bulletList" || config.type.name === "orderedList" ? "listItem" : "taskList";
|
|
4046
|
-
chain().updateAttributes(nodeType, attributes).run();
|
|
4047
|
-
}
|
|
4048
|
-
const before = tr.doc.resolve(range.from - 1).nodeBefore;
|
|
4049
|
-
if (before && before.type === config.type && canJoin(tr.doc, range.from - 1) && (!config.joinPredicate || config.joinPredicate(match, before))) {
|
|
4050
|
-
tr.join(range.from - 1);
|
|
4051
|
-
}
|
|
4052
|
-
}
|
|
4053
|
-
});
|
|
4054
|
-
}
|
|
4055
|
-
class Node {
|
|
4056
|
-
constructor(config = {}) {
|
|
4057
|
-
this.type = "node";
|
|
4058
|
-
this.name = "node";
|
|
4059
|
-
this.parent = null;
|
|
4060
|
-
this.child = null;
|
|
4061
|
-
this.config = {
|
|
4062
|
-
name: this.name,
|
|
4063
|
-
defaultOptions: {}
|
|
4064
|
-
};
|
|
4065
|
-
this.config = {
|
|
4066
|
-
...this.config,
|
|
4067
|
-
...config
|
|
4068
|
-
};
|
|
4069
|
-
this.name = this.config.name;
|
|
4070
|
-
if (config.defaultOptions && Object.keys(config.defaultOptions).length > 0) {
|
|
4071
|
-
console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`);
|
|
4072
|
-
}
|
|
4073
|
-
this.options = this.config.defaultOptions;
|
|
4074
|
-
if (this.config.addOptions) {
|
|
4075
|
-
this.options = callOrReturn(getExtensionField(this, "addOptions", {
|
|
4076
|
-
name: this.name
|
|
4077
|
-
}));
|
|
4078
|
-
}
|
|
4079
|
-
this.storage = callOrReturn(getExtensionField(this, "addStorage", {
|
|
4080
|
-
name: this.name,
|
|
4081
|
-
options: this.options
|
|
4082
|
-
})) || {};
|
|
4083
|
-
}
|
|
4084
|
-
static create(config = {}) {
|
|
4085
|
-
return new Node(config);
|
|
4086
|
-
}
|
|
4087
|
-
configure(options = {}) {
|
|
4088
|
-
const extension = this.extend({
|
|
4089
|
-
...this.config,
|
|
4090
|
-
addOptions: () => {
|
|
4091
|
-
return mergeDeep(this.options, options);
|
|
4092
|
-
}
|
|
4093
|
-
});
|
|
4094
|
-
extension.name = this.name;
|
|
4095
|
-
extension.parent = this.parent;
|
|
4096
|
-
return extension;
|
|
4097
|
-
}
|
|
4098
|
-
extend(extendedConfig = {}) {
|
|
4099
|
-
const extension = new Node(extendedConfig);
|
|
4100
|
-
extension.parent = this;
|
|
4101
|
-
this.child = extension;
|
|
4102
|
-
extension.name = extendedConfig.name ? extendedConfig.name : extension.parent.name;
|
|
4103
|
-
if (extendedConfig.defaultOptions && Object.keys(extendedConfig.defaultOptions).length > 0) {
|
|
4104
|
-
console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${extension.name}".`);
|
|
4105
|
-
}
|
|
4106
|
-
extension.options = callOrReturn(getExtensionField(extension, "addOptions", {
|
|
4107
|
-
name: extension.name
|
|
4108
|
-
}));
|
|
4109
|
-
extension.storage = callOrReturn(getExtensionField(extension, "addStorage", {
|
|
4110
|
-
name: extension.name,
|
|
4111
|
-
options: extension.options
|
|
4112
|
-
}));
|
|
4113
|
-
return extension;
|
|
4114
|
-
}
|
|
4115
|
-
}
|
|
4116
|
-
function markPasteRule(config) {
|
|
4117
|
-
return new PasteRule({
|
|
4118
|
-
find: config.find,
|
|
4119
|
-
handler: ({ state, range, match, pasteEvent }) => {
|
|
4120
|
-
const attributes = callOrReturn(config.getAttributes, void 0, match, pasteEvent);
|
|
4121
|
-
if (attributes === false || attributes === null) {
|
|
4122
|
-
return null;
|
|
4123
|
-
}
|
|
4124
|
-
const { tr } = state;
|
|
4125
|
-
const captureGroup = match[match.length - 1];
|
|
4126
|
-
const fullMatch = match[0];
|
|
4127
|
-
let markEnd = range.to;
|
|
4128
|
-
if (captureGroup) {
|
|
4129
|
-
const startSpaces = fullMatch.search(/\S/);
|
|
4130
|
-
const textStart = range.from + fullMatch.indexOf(captureGroup);
|
|
4131
|
-
const textEnd = textStart + captureGroup.length;
|
|
4132
|
-
const excludedMarks = getMarksBetween(range.from, range.to, state.doc).filter((item) => {
|
|
4133
|
-
const excluded = item.mark.type.excluded;
|
|
4134
|
-
return excluded.find((type) => type === config.type && type !== item.mark.type);
|
|
4135
|
-
}).filter((item) => item.to > textStart);
|
|
4136
|
-
if (excludedMarks.length) {
|
|
4137
|
-
return null;
|
|
4138
|
-
}
|
|
4139
|
-
if (textEnd < range.to) {
|
|
4140
|
-
tr.delete(textEnd, range.to);
|
|
4141
|
-
}
|
|
4142
|
-
if (textStart > range.from) {
|
|
4143
|
-
tr.delete(range.from + startSpaces, textStart);
|
|
4144
|
-
}
|
|
4145
|
-
markEnd = range.from + startSpaces + captureGroup.length;
|
|
4146
|
-
tr.addMark(range.from + startSpaces, markEnd, config.type.create(attributes || {}));
|
|
4147
|
-
tr.removeStoredMark(config.type);
|
|
4148
|
-
}
|
|
4149
|
-
}
|
|
4150
|
-
});
|
|
4151
|
-
}
|
|
4152
|
-
function canInsertNode(state, nodeType) {
|
|
4153
|
-
const { selection } = state;
|
|
4154
|
-
const { $from } = selection;
|
|
4155
|
-
if (selection instanceof NodeSelection) {
|
|
4156
|
-
const index = $from.index();
|
|
4157
|
-
const parent = $from.parent;
|
|
4158
|
-
return parent.canReplaceWith(index, index + 1, nodeType);
|
|
4159
|
-
}
|
|
4160
|
-
let depth = $from.depth;
|
|
4161
|
-
while (depth >= 0) {
|
|
4162
|
-
const index = $from.index(depth);
|
|
4163
|
-
const parent = $from.node(depth);
|
|
4164
|
-
const match = parent.contentMatchAt(index);
|
|
4165
|
-
if (match.matchType(nodeType)) {
|
|
4166
|
-
return true;
|
|
4167
|
-
}
|
|
4168
|
-
depth -= 1;
|
|
4169
|
-
}
|
|
4170
|
-
return false;
|
|
4171
|
-
}
|
|
4172
|
-
function escapeForRegEx(string) {
|
|
4173
|
-
return string.replace(/[-/\\^$*+?.()|[\]{}]/g, "\\$&");
|
|
4174
|
-
}
|
|
4175
|
-
export {
|
|
4176
|
-
CommandManager,
|
|
4177
|
-
Editor,
|
|
4178
|
-
Extension,
|
|
4179
|
-
InputRule,
|
|
4180
|
-
Mark,
|
|
4181
|
-
Node,
|
|
4182
|
-
NodePos,
|
|
4183
|
-
PasteRule,
|
|
4184
|
-
callOrReturn,
|
|
4185
|
-
canInsertNode,
|
|
4186
|
-
combineTransactionSteps,
|
|
4187
|
-
createChainableState,
|
|
4188
|
-
createDocument,
|
|
4189
|
-
createNodeFromContent,
|
|
4190
|
-
createStyleTag,
|
|
4191
|
-
defaultBlockAt,
|
|
4192
|
-
deleteProps,
|
|
4193
|
-
elementFromString,
|
|
4194
|
-
escapeForRegEx,
|
|
4195
|
-
findChildrenInRange,
|
|
4196
|
-
findDuplicates,
|
|
4197
|
-
findParentNode,
|
|
4198
|
-
findParentNodeClosestToPos,
|
|
4199
|
-
fromString,
|
|
4200
|
-
getAttributes,
|
|
4201
|
-
getAttributesFromExtensions,
|
|
4202
|
-
getChangedRanges,
|
|
4203
|
-
getExtensionField,
|
|
4204
|
-
getHTMLFromFragment,
|
|
4205
|
-
getMarkAttributes,
|
|
4206
|
-
getMarkRange,
|
|
4207
|
-
getMarkType,
|
|
4208
|
-
getMarksBetween,
|
|
4209
|
-
getNodeAttributes,
|
|
4210
|
-
getNodeType,
|
|
4211
|
-
getRenderedAttributes,
|
|
4212
|
-
getSchemaByResolvedExtensions,
|
|
4213
|
-
getSchemaTypeByName,
|
|
4214
|
-
getSchemaTypeNameByName,
|
|
4215
|
-
getSplittedAttributes,
|
|
4216
|
-
getText,
|
|
4217
|
-
getTextBetween,
|
|
4218
|
-
getTextContentFromNodes,
|
|
4219
|
-
getTextSerializersFromSchema,
|
|
4220
|
-
injectExtensionAttributesToParseRule,
|
|
4221
|
-
inputRulesPlugin,
|
|
4222
|
-
isActive,
|
|
4223
|
-
isEmptyObject,
|
|
4224
|
-
isExtensionRulesEnabled,
|
|
4225
|
-
isFunction,
|
|
4226
|
-
isList,
|
|
4227
|
-
isMacOS,
|
|
4228
|
-
isMarkActive,
|
|
4229
|
-
isNodeActive,
|
|
4230
|
-
isNodeEmpty,
|
|
4231
|
-
isNodeSelection,
|
|
4232
|
-
isNumber,
|
|
4233
|
-
isPlainObject,
|
|
4234
|
-
isRegExp,
|
|
4235
|
-
isSafari,
|
|
4236
|
-
isTextSelection,
|
|
4237
|
-
isiOS,
|
|
4238
|
-
markInputRule,
|
|
4239
|
-
markPasteRule,
|
|
4240
|
-
mergeAttributes,
|
|
4241
|
-
mergeDeep,
|
|
4242
|
-
minMax,
|
|
4243
|
-
nodeInputRule,
|
|
4244
|
-
objectIncludes,
|
|
4245
|
-
pasteRulesPlugin,
|
|
4246
|
-
removeDuplicates,
|
|
4247
|
-
resolveFocusPosition,
|
|
4248
|
-
selectionToInsertionEnd,
|
|
4249
|
-
splitExtensions,
|
|
4250
|
-
textblockTypeInputRule,
|
|
4251
|
-
wrappingInputRule
|
|
4252
|
-
};
|