@churchapps/apphelper 0.4.12 → 0.4.18
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/dist/components/DisplayBox.js +12 -18
- package/dist/components/DisplayBox.js.map +1 -1
- package/dist/components/ErrorMessages.js +9 -46
- package/dist/components/ErrorMessages.js.map +1 -1
- package/dist/components/ExportLink.d.ts.map +1 -1
- package/dist/components/ExportLink.js +8 -10
- package/dist/components/ExportLink.js.map +1 -1
- package/dist/components/FloatingSupport.js +7 -14
- package/dist/components/FloatingSupport.js.map +1 -1
- package/dist/components/FormCardPayment.d.ts.map +1 -1
- package/dist/components/FormCardPayment.js +28 -64
- package/dist/components/FormCardPayment.js.map +1 -1
- package/dist/components/FormSubmissionEdit.d.ts.map +1 -1
- package/dist/components/FormSubmissionEdit.js +28 -66
- package/dist/components/FormSubmissionEdit.js.map +1 -1
- package/dist/components/HelpIcon.js +3 -7
- package/dist/components/HelpIcon.js.map +1 -1
- package/dist/components/ImageEditor.d.ts.map +1 -1
- package/dist/components/ImageEditor.js +13 -19
- package/dist/components/ImageEditor.js.map +1 -1
- package/dist/components/InputBox.d.ts.map +1 -1
- package/dist/components/InputBox.js +13 -15
- package/dist/components/InputBox.js.map +1 -1
- package/dist/components/Loading.d.ts +0 -1
- package/dist/components/Loading.d.ts.map +1 -1
- package/dist/components/Loading.js +52 -12
- package/dist/components/Loading.js.map +1 -1
- package/dist/components/PageHeader.d.ts +15 -0
- package/dist/components/PageHeader.d.ts.map +1 -0
- package/dist/components/PageHeader.js +41 -0
- package/dist/components/PageHeader.js.map +1 -0
- package/dist/components/PersonAvatar.d.ts +12 -0
- package/dist/components/PersonAvatar.d.ts.map +1 -0
- package/dist/components/PersonAvatar.js +55 -0
- package/dist/components/PersonAvatar.js.map +1 -0
- package/dist/components/QuestionEdit.js +20 -26
- package/dist/components/QuestionEdit.js.map +1 -1
- package/dist/components/SmallButton.js +9 -15
- package/dist/components/SmallButton.js.map +1 -1
- package/dist/components/SupportModal.d.ts.map +1 -1
- package/dist/components/SupportModal.js +5 -9
- package/dist/components/SupportModal.js.map +1 -1
- package/dist/components/TabPanel.js +5 -9
- package/dist/components/TabPanel.js.map +1 -1
- package/dist/components/header/Banner.js +3 -7
- package/dist/components/header/Banner.js.map +1 -1
- package/dist/components/header/PrimaryMenu.d.ts.map +1 -1
- package/dist/components/header/PrimaryMenu.js +30 -30
- package/dist/components/header/PrimaryMenu.js.map +1 -1
- package/dist/components/header/SecondaryMenu.js +6 -10
- package/dist/components/header/SecondaryMenu.js.map +1 -1
- package/dist/components/header/SecondaryMenuAlt.js +8 -15
- package/dist/components/header/SecondaryMenuAlt.js.map +1 -1
- package/dist/components/header/SiteHeader.d.ts +2 -1
- package/dist/components/header/SiteHeader.d.ts.map +1 -1
- package/dist/components/header/SiteHeader.js +109 -17
- package/dist/components/header/SiteHeader.js.map +1 -1
- package/dist/components/header/SupportDrawer.js +14 -18
- package/dist/components/header/SupportDrawer.js.map +1 -1
- package/dist/components/header/index.js +2 -7
- package/dist/components/header/index.js.map +1 -1
- package/dist/components/index.d.ts +2 -4
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/index.js +18 -52
- package/dist/components/index.js.map +1 -1
- package/dist/components/notes/AddNote.d.ts.map +1 -1
- package/dist/components/notes/AddNote.js +56 -54
- package/dist/components/notes/AddNote.js.map +1 -1
- package/dist/components/notes/Note.d.ts.map +1 -1
- package/dist/components/notes/Note.js +11 -15
- package/dist/components/notes/Note.js.map +1 -1
- package/dist/components/notes/Notes.d.ts.map +1 -1
- package/dist/components/notes/Notes.js +134 -40
- package/dist/components/notes/Notes.js.map +1 -1
- package/dist/components/notes/index.js +3 -9
- package/dist/components/notes/index.js.map +1 -1
- package/dist/components/wrapper/AppList.d.ts.map +1 -1
- package/dist/components/wrapper/AppList.js +7 -13
- package/dist/components/wrapper/AppList.js.map +1 -1
- package/dist/components/wrapper/ChurchList.d.ts.map +1 -1
- package/dist/components/wrapper/ChurchList.js +55 -21
- package/dist/components/wrapper/ChurchList.js.map +1 -1
- package/dist/components/wrapper/NavItem.js +11 -15
- package/dist/components/wrapper/NavItem.js.map +1 -1
- package/dist/components/wrapper/NewPrivateMessage.d.ts.map +1 -1
- package/dist/components/wrapper/NewPrivateMessage.js +38 -68
- package/dist/components/wrapper/NewPrivateMessage.js.map +1 -1
- package/dist/components/wrapper/Notifications.d.ts.map +1 -1
- package/dist/components/wrapper/Notifications.js +53 -57
- package/dist/components/wrapper/Notifications.js.map +1 -1
- package/dist/components/wrapper/PrivateMessageDetails.d.ts +1 -0
- package/dist/components/wrapper/PrivateMessageDetails.d.ts.map +1 -1
- package/dist/components/wrapper/PrivateMessageDetails.js +54 -9
- package/dist/components/wrapper/PrivateMessageDetails.js.map +1 -1
- package/dist/components/wrapper/PrivateMessages.d.ts.map +1 -1
- package/dist/components/wrapper/PrivateMessages.js +363 -78
- package/dist/components/wrapper/PrivateMessages.js.map +1 -1
- package/dist/components/wrapper/UserMenu.d.ts.map +1 -1
- package/dist/components/wrapper/UserMenu.js +182 -54
- package/dist/components/wrapper/UserMenu.js.map +1 -1
- package/dist/components/wrapper/index.d.ts +2 -1
- package/dist/components/wrapper/index.d.ts.map +1 -1
- package/dist/components/wrapper/index.js +8 -17
- package/dist/components/wrapper/index.js.map +1 -1
- package/dist/helpers/AnalyticsHelper.d.ts.map +1 -1
- package/dist/helpers/AnalyticsHelper.js +11 -19
- package/dist/helpers/AnalyticsHelper.js.map +1 -1
- package/dist/helpers/AppearanceHelper.js +1 -5
- package/dist/helpers/AppearanceHelper.js.map +1 -1
- package/dist/helpers/ArrayHelper.d.ts.map +1 -1
- package/dist/helpers/ArrayHelper.js +3 -8
- package/dist/helpers/ArrayHelper.js.map +1 -1
- package/dist/helpers/CurrencyHelper.js +1 -5
- package/dist/helpers/CurrencyHelper.js.map +1 -1
- package/dist/helpers/DateHelper.js +3 -7
- package/dist/helpers/DateHelper.js.map +1 -1
- package/dist/helpers/ErrorHelper.js +3 -7
- package/dist/helpers/ErrorHelper.js.map +1 -1
- package/dist/helpers/EventHelper.d.ts.map +1 -1
- package/dist/helpers/EventHelper.js +4 -11
- package/dist/helpers/EventHelper.js.map +1 -1
- package/dist/helpers/FileHelper.js +3 -10
- package/dist/helpers/FileHelper.js.map +1 -1
- package/dist/helpers/Locale.d.ts +1 -1
- package/dist/helpers/Locale.d.ts.map +1 -1
- package/dist/helpers/Locale.js +18 -20
- package/dist/helpers/Locale.js.map +1 -1
- package/dist/helpers/NotificationService.d.ts +56 -0
- package/dist/helpers/NotificationService.d.ts.map +1 -0
- package/dist/helpers/NotificationService.js +176 -0
- package/dist/helpers/NotificationService.js.map +1 -0
- package/dist/helpers/PersonHelper.d.ts.map +1 -1
- package/dist/helpers/PersonHelper.js +5 -9
- package/dist/helpers/PersonHelper.js.map +1 -1
- package/dist/helpers/SlugHelper.js +4 -11
- package/dist/helpers/SlugHelper.js.map +1 -1
- package/dist/helpers/SocketHelper.d.ts +12 -0
- package/dist/helpers/SocketHelper.d.ts.map +1 -1
- package/dist/helpers/SocketHelper.js +163 -44
- package/dist/helpers/SocketHelper.js.map +1 -1
- package/dist/helpers/UniqueIdHelper.js +1 -5
- package/dist/helpers/UniqueIdHelper.js.map +1 -1
- package/dist/helpers/UserHelper.js +8 -12
- package/dist/helpers/UserHelper.js.map +1 -1
- package/dist/helpers/createEmotionCache.js +3 -9
- package/dist/helpers/createEmotionCache.js.map +1 -1
- package/dist/helpers/index.d.ts +7 -16
- package/dist/helpers/index.d.ts.map +1 -1
- package/dist/helpers/index.js +10 -54
- package/dist/helpers/index.js.map +1 -1
- package/dist/hooks/index.d.ts +2 -0
- package/dist/hooks/index.d.ts.map +1 -1
- package/dist/hooks/index.js +2 -5
- package/dist/hooks/index.js.map +1 -1
- package/dist/hooks/useMountedState.js +5 -9
- package/dist/hooks/useMountedState.js.map +1 -1
- package/dist/hooks/useNotifications.d.ts +30 -0
- package/dist/hooks/useNotifications.d.ts.map +1 -0
- package/dist/hooks/useNotifications.js +79 -0
- package/dist/hooks/useNotifications.js.map +1 -0
- package/dist/index.d.ts +0 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -22
- package/dist/index.js.map +1 -1
- package/dist/public/css/styles.css +6 -2
- package/package.json +6 -28
- package/public/css/styles.css +6 -2
- package/src/components/ExportLink.tsx +12 -3
- package/src/components/FormCardPayment.tsx +4 -3
- package/src/components/FormSubmissionEdit.tsx +5 -6
- package/src/components/ImageEditor.tsx +15 -12
- package/src/components/InputBox.tsx +2 -1
- package/src/components/Loading.tsx +47 -1
- package/src/components/PageHeader.tsx +107 -0
- package/src/components/PersonAvatar.tsx +78 -0
- package/src/components/SupportModal.tsx +8 -3
- package/src/components/header/PrimaryMenu.tsx +85 -42
- package/src/components/header/SiteHeader.tsx +131 -8
- package/src/components/header/SupportDrawer.tsx +1 -1
- package/src/components/index.tsx +2 -5
- package/src/components/notes/AddNote.tsx +105 -19
- package/src/components/notes/Note.tsx +43 -22
- package/src/components/notes/Notes.tsx +160 -21
- package/src/components/wrapper/AppList.tsx +1 -4
- package/src/components/wrapper/ChurchList.tsx +45 -5
- package/src/components/wrapper/NewPrivateMessage.tsx +181 -44
- package/src/components/wrapper/Notifications.tsx +164 -29
- package/src/components/wrapper/PrivateMessageDetails.tsx +100 -13
- package/src/components/wrapper/PrivateMessages.tsx +539 -56
- package/src/components/wrapper/UserMenu.tsx +218 -38
- package/src/components/wrapper/index.tsx +3 -2
- package/src/helpers/AnalyticsHelper.ts +1 -2
- package/src/helpers/ArrayHelper.ts +0 -1
- package/src/helpers/ErrorHelper.ts +1 -1
- package/src/helpers/EventHelper.ts +0 -3
- package/src/helpers/Locale.ts +8 -3
- package/src/helpers/NotificationService.ts +211 -0
- package/src/helpers/PersonHelper.ts +1 -2
- package/src/helpers/SocketHelper.ts +184 -39
- package/src/helpers/UserHelper.ts +2 -2
- package/src/helpers/index.ts +46 -16
- package/src/hooks/index.ts +2 -0
- package/src/hooks/useNotifications.ts +94 -0
- package/src/index.ts +1 -4
- package/tsconfig.json +2 -2
- package/.eslintignore +0 -4
- package/.github/FUNDING.yml +0 -1
- package/.vscode/settings.json +0 -6
- package/CHUMS_COMPONENT_EXTRACTION_CANDIDATES.md +0 -210
- package/CLAUDE.md +0 -111
- package/COMPONENT_USAGE_REPORT.md +0 -322
- package/LICENSE +0 -21
- package/README.md +0 -24
- package/b1app-specific-components.md +0 -146
- package/component-usage-analysis.md +0 -169
- package/dist/components/markdownEditor/Editor.d.ts +0 -13
- package/dist/components/markdownEditor/Editor.d.ts.map +0 -1
- package/dist/components/markdownEditor/Editor.js +0 -92
- package/dist/components/markdownEditor/Editor.js.map +0 -1
- package/dist/components/markdownEditor/IconNamesList.d.ts +0 -3
- package/dist/components/markdownEditor/IconNamesList.d.ts.map +0 -1
- package/dist/components/markdownEditor/IconNamesList.js +0 -16
- package/dist/components/markdownEditor/IconNamesList.js.map +0 -1
- package/dist/components/markdownEditor/MarkdownEditor.d.ts +0 -10
- package/dist/components/markdownEditor/MarkdownEditor.d.ts.map +0 -1
- package/dist/components/markdownEditor/MarkdownEditor.js +0 -45
- package/dist/components/markdownEditor/MarkdownEditor.js.map +0 -1
- package/dist/components/markdownEditor/MarkdownModal.d.ts +0 -9
- package/dist/components/markdownEditor/MarkdownModal.d.ts.map +0 -1
- package/dist/components/markdownEditor/MarkdownModal.js +0 -24
- package/dist/components/markdownEditor/MarkdownModal.js.map +0 -1
- package/dist/components/markdownEditor/MarkdownPreview.d.ts +0 -9
- package/dist/components/markdownEditor/MarkdownPreview.d.ts.map +0 -1
- package/dist/components/markdownEditor/MarkdownPreview.js +0 -45
- package/dist/components/markdownEditor/MarkdownPreview.js.map +0 -1
- package/dist/components/markdownEditor/MarkdownPreviewLight.d.ts +0 -7
- package/dist/components/markdownEditor/MarkdownPreviewLight.d.ts.map +0 -1
- package/dist/components/markdownEditor/MarkdownPreviewLight.js +0 -53
- package/dist/components/markdownEditor/MarkdownPreviewLight.js.map +0 -1
- package/dist/components/markdownEditor/editor.css +0 -787
- package/dist/components/markdownEditor/images/emoji/1F600.png +0 -0
- package/dist/components/markdownEditor/images/emoji/1F641.png +0 -0
- package/dist/components/markdownEditor/images/emoji/1F642.png +0 -0
- package/dist/components/markdownEditor/images/emoji/2764.png +0 -0
- package/dist/components/markdownEditor/images/icons/arrow-clockwise.svg +0 -4
- package/dist/components/markdownEditor/images/icons/arrow-counterclockwise.svg +0 -4
- package/dist/components/markdownEditor/images/icons/chat-square-quote.svg +0 -4
- package/dist/components/markdownEditor/images/icons/chevron-down.svg +0 -3
- package/dist/components/markdownEditor/images/icons/code.svg +0 -3
- package/dist/components/markdownEditor/images/icons/journal-code.svg +0 -5
- package/dist/components/markdownEditor/images/icons/journal-text.svg +0 -5
- package/dist/components/markdownEditor/images/icons/justify.svg +0 -3
- package/dist/components/markdownEditor/images/icons/link.svg +0 -4
- package/dist/components/markdownEditor/images/icons/list-ol.svg +0 -4
- package/dist/components/markdownEditor/images/icons/list-ul.svg +0 -3
- package/dist/components/markdownEditor/images/icons/pencil-fill.svg +0 -3
- package/dist/components/markdownEditor/images/icons/text-center.svg +0 -3
- package/dist/components/markdownEditor/images/icons/text-left.svg +0 -3
- package/dist/components/markdownEditor/images/icons/text-paragraph.svg +0 -3
- package/dist/components/markdownEditor/images/icons/text-right.svg +0 -3
- package/dist/components/markdownEditor/images/icons/type-bold.svg +0 -3
- package/dist/components/markdownEditor/images/icons/type-h1.svg +0 -3
- package/dist/components/markdownEditor/images/icons/type-h2.svg +0 -3
- package/dist/components/markdownEditor/images/icons/type-h3.svg +0 -3
- package/dist/components/markdownEditor/images/icons/type-h4.svg +0 -13
- package/dist/components/markdownEditor/images/icons/type-italic.svg +0 -3
- package/dist/components/markdownEditor/images/icons/type-strikethrough.svg +0 -3
- package/dist/components/markdownEditor/images/icons/type-underline.svg +0 -3
- package/dist/components/markdownEditor/index.d.ts +0 -4
- package/dist/components/markdownEditor/index.d.ts.map +0 -1
- package/dist/components/markdownEditor/index.js +0 -10
- package/dist/components/markdownEditor/index.js.map +0 -1
- package/dist/components/markdownEditor/plugins/AutoLinkPlugin.d.ts +0 -2
- package/dist/components/markdownEditor/plugins/AutoLinkPlugin.d.ts.map +0 -1
- package/dist/components/markdownEditor/plugins/AutoLinkPlugin.js +0 -31
- package/dist/components/markdownEditor/plugins/AutoLinkPlugin.js.map +0 -1
- package/dist/components/markdownEditor/plugins/ControlledEditorPlugin.d.ts +0 -8
- package/dist/components/markdownEditor/plugins/ControlledEditorPlugin.d.ts.map +0 -1
- package/dist/components/markdownEditor/plugins/ControlledEditorPlugin.js +0 -19
- package/dist/components/markdownEditor/plugins/ControlledEditorPlugin.js.map +0 -1
- package/dist/components/markdownEditor/plugins/FloatingTextMenu/FloatingTextFormatToolbarPlugin.d.ts +0 -6
- package/dist/components/markdownEditor/plugins/FloatingTextMenu/FloatingTextFormatToolbarPlugin.d.ts.map +0 -1
- package/dist/components/markdownEditor/plugins/FloatingTextMenu/FloatingTextFormatToolbarPlugin.js +0 -310
- package/dist/components/markdownEditor/plugins/FloatingTextMenu/FloatingTextFormatToolbarPlugin.js.map +0 -1
- package/dist/components/markdownEditor/plugins/FloatingTextMenu/getDOMRangeRect.d.ts +0 -2
- package/dist/components/markdownEditor/plugins/FloatingTextMenu/getDOMRangeRect.d.ts.map +0 -1
- package/dist/components/markdownEditor/plugins/FloatingTextMenu/getDOMRangeRect.js +0 -19
- package/dist/components/markdownEditor/plugins/FloatingTextMenu/getDOMRangeRect.js.map +0 -1
- package/dist/components/markdownEditor/plugins/FloatingTextMenu/getSelectNode.d.ts +0 -2
- package/dist/components/markdownEditor/plugins/FloatingTextMenu/getSelectNode.d.ts.map +0 -1
- package/dist/components/markdownEditor/plugins/FloatingTextMenu/getSelectNode.js +0 -21
- package/dist/components/markdownEditor/plugins/FloatingTextMenu/getSelectNode.js.map +0 -1
- package/dist/components/markdownEditor/plugins/FloatingTextMenu/setFloatingElemPosition.d.ts +0 -2
- package/dist/components/markdownEditor/plugins/FloatingTextMenu/setFloatingElemPosition.d.ts.map +0 -1
- package/dist/components/markdownEditor/plugins/FloatingTextMenu/setFloatingElemPosition.js +0 -29
- package/dist/components/markdownEditor/plugins/FloatingTextMenu/setFloatingElemPosition.js.map +0 -1
- package/dist/components/markdownEditor/plugins/ListMaxIndentLevelPlugin.d.ts +0 -2
- package/dist/components/markdownEditor/plugins/ListMaxIndentLevelPlugin.d.ts.map +0 -1
- package/dist/components/markdownEditor/plugins/ListMaxIndentLevelPlugin.js +0 -45
- package/dist/components/markdownEditor/plugins/ListMaxIndentLevelPlugin.js.map +0 -1
- package/dist/components/markdownEditor/plugins/MarkdownTransformers.d.ts +0 -12
- package/dist/components/markdownEditor/plugins/MarkdownTransformers.d.ts.map +0 -1
- package/dist/components/markdownEditor/plugins/MarkdownTransformers.js +0 -85
- package/dist/components/markdownEditor/plugins/MarkdownTransformers.js.map +0 -1
- package/dist/components/markdownEditor/plugins/ReadOnlyPlugin.d.ts +0 -6
- package/dist/components/markdownEditor/plugins/ReadOnlyPlugin.d.ts.map +0 -1
- package/dist/components/markdownEditor/plugins/ReadOnlyPlugin.js +0 -12
- package/dist/components/markdownEditor/plugins/ReadOnlyPlugin.js.map +0 -1
- package/dist/components/markdownEditor/plugins/ToolbarPlugin.d.ts +0 -7
- package/dist/components/markdownEditor/plugins/ToolbarPlugin.d.ts.map +0 -1
- package/dist/components/markdownEditor/plugins/ToolbarPlugin.js +0 -282
- package/dist/components/markdownEditor/plugins/ToolbarPlugin.js.map +0 -1
- package/dist/components/markdownEditor/plugins/customLink/CustomLinkNode.d.ts +0 -27
- package/dist/components/markdownEditor/plugins/customLink/CustomLinkNode.d.ts.map +0 -1
- package/dist/components/markdownEditor/plugins/customLink/CustomLinkNode.js +0 -158
- package/dist/components/markdownEditor/plugins/customLink/CustomLinkNode.js.map +0 -1
- package/dist/components/markdownEditor/plugins/customLink/CustomLinkNodePlugin.d.ts +0 -4
- package/dist/components/markdownEditor/plugins/customLink/CustomLinkNodePlugin.d.ts.map +0 -1
- package/dist/components/markdownEditor/plugins/customLink/CustomLinkNodePlugin.js +0 -21
- package/dist/components/markdownEditor/plugins/customLink/CustomLinkNodePlugin.js.map +0 -1
- package/dist/components/markdownEditor/plugins/customLink/CustomLinkNodeTransformer.d.ts +0 -3
- package/dist/components/markdownEditor/plugins/customLink/CustomLinkNodeTransformer.d.ts.map +0 -1
- package/dist/components/markdownEditor/plugins/customLink/CustomLinkNodeTransformer.js +0 -71
- package/dist/components/markdownEditor/plugins/customLink/CustomLinkNodeTransformer.js.map +0 -1
- package/dist/components/markdownEditor/plugins/customLink/FloatingLinkEditor.d.ts +0 -5
- package/dist/components/markdownEditor/plugins/customLink/FloatingLinkEditor.d.ts.map +0 -1
- package/dist/components/markdownEditor/plugins/customLink/FloatingLinkEditor.js +0 -190
- package/dist/components/markdownEditor/plugins/customLink/FloatingLinkEditor.js.map +0 -1
- package/dist/components/markdownEditor/plugins/customLink/FloatingLinkEditor.types.d.ts +0 -11
- package/dist/components/markdownEditor/plugins/customLink/FloatingLinkEditor.types.d.ts.map +0 -1
- package/dist/components/markdownEditor/plugins/customLink/FloatingLinkEditor.types.js +0 -3
- package/dist/components/markdownEditor/plugins/customLink/FloatingLinkEditor.types.js.map +0 -1
- package/dist/components/markdownEditor/plugins/emoji/EmojiNode.d.ts +0 -24
- package/dist/components/markdownEditor/plugins/emoji/EmojiNode.d.ts.map +0 -1
- package/dist/components/markdownEditor/plugins/emoji/EmojiNode.js +0 -66
- package/dist/components/markdownEditor/plugins/emoji/EmojiNode.js.map +0 -1
- package/dist/components/markdownEditor/plugins/emoji/EmojiNodeTransform.d.ts +0 -4
- package/dist/components/markdownEditor/plugins/emoji/EmojiNodeTransform.d.ts.map +0 -1
- package/dist/components/markdownEditor/plugins/emoji/EmojiNodeTransform.js +0 -35
- package/dist/components/markdownEditor/plugins/emoji/EmojiNodeTransform.js.map +0 -1
- package/dist/components/markdownEditor/plugins/emoji/EmojiPickerPlugin.d.ts +0 -9
- package/dist/components/markdownEditor/plugins/emoji/EmojiPickerPlugin.d.ts.map +0 -1
- package/dist/components/markdownEditor/plugins/emoji/EmojiPickerPlugin.js +0 -103
- package/dist/components/markdownEditor/plugins/emoji/EmojiPickerPlugin.js.map +0 -1
- package/dist/components/markdownEditor/plugins/emoji/EmojisPlugin.d.ts +0 -10
- package/dist/components/markdownEditor/plugins/emoji/EmojisPlugin.d.ts.map +0 -1
- package/dist/components/markdownEditor/plugins/emoji/EmojisPlugin.js +0 -59
- package/dist/components/markdownEditor/plugins/emoji/EmojisPlugin.js.map +0 -1
- package/dist/components/markdownEditor/plugins/index.d.ts +0 -7
- package/dist/components/markdownEditor/plugins/index.d.ts.map +0 -1
- package/dist/components/markdownEditor/plugins/index.js +0 -16
- package/dist/components/markdownEditor/plugins/index.js.map +0 -1
- package/dist/components/markdownEditor/theme.d.ts +0 -66
- package/dist/components/markdownEditor/theme.d.ts.map +0 -1
- package/dist/components/markdownEditor/theme.js +0 -69
- package/dist/components/markdownEditor/theme.js.map +0 -1
- package/dist/components/reporting/ChartReport.d.ts +0 -8
- package/dist/components/reporting/ChartReport.d.ts.map +0 -1
- package/dist/components/reporting/ChartReport.js +0 -81
- package/dist/components/reporting/ChartReport.js.map +0 -1
- package/dist/components/reporting/ReportFilter.d.ts +0 -9
- package/dist/components/reporting/ReportFilter.d.ts.map +0 -1
- package/dist/components/reporting/ReportFilter.js +0 -52
- package/dist/components/reporting/ReportFilter.js.map +0 -1
- package/dist/components/reporting/ReportFilterField.d.ts +0 -9
- package/dist/components/reporting/ReportFilterField.d.ts.map +0 -1
- package/dist/components/reporting/ReportFilterField.js +0 -156
- package/dist/components/reporting/ReportFilterField.js.map +0 -1
- package/dist/components/reporting/ReportOutput.d.ts +0 -8
- package/dist/components/reporting/ReportOutput.d.ts.map +0 -1
- package/dist/components/reporting/ReportOutput.js +0 -177
- package/dist/components/reporting/ReportOutput.js.map +0 -1
- package/dist/components/reporting/ReportWithFilter.d.ts +0 -7
- package/dist/components/reporting/ReportWithFilter.d.ts.map +0 -1
- package/dist/components/reporting/ReportWithFilter.js +0 -65
- package/dist/components/reporting/ReportWithFilter.js.map +0 -1
- package/dist/components/reporting/TableReport.d.ts +0 -8
- package/dist/components/reporting/TableReport.d.ts.map +0 -1
- package/dist/components/reporting/TableReport.js +0 -30
- package/dist/components/reporting/TableReport.js.map +0 -1
- package/dist/components/reporting/TreeReport.d.ts +0 -8
- package/dist/components/reporting/TreeReport.d.ts.map +0 -1
- package/dist/components/reporting/TreeReport.js +0 -89
- package/dist/components/reporting/TreeReport.js.map +0 -1
- package/dist/components/reporting/index.d.ts +0 -5
- package/dist/components/reporting/index.d.ts.map +0 -1
- package/dist/components/reporting/index.js +0 -12
- package/dist/components/reporting/index.js.map +0 -1
- package/dist/components/wrapper/Drawers.d.ts +0 -5
- package/dist/components/wrapper/Drawers.d.ts.map +0 -1
- package/dist/components/wrapper/Drawers.js +0 -54
- package/dist/components/wrapper/Drawers.js.map +0 -1
- package/dist/components/wrapper/SiteWrapper.d.ts +0 -15
- package/dist/components/wrapper/SiteWrapper.d.ts.map +0 -1
- package/dist/components/wrapper/SiteWrapper.js +0 -60
- package/dist/components/wrapper/SiteWrapper.js.map +0 -1
- package/dist/components/wrapper/TabPanel.d.ts +0 -9
- package/dist/components/wrapper/TabPanel.d.ts.map +0 -1
- package/dist/components/wrapper/TabPanel.js +0 -20
- package/dist/components/wrapper/TabPanel.js.map +0 -1
- package/dist/donationComponents/components/BankForm.d.ts +0 -14
- package/dist/donationComponents/components/BankForm.d.ts.map +0 -1
- package/dist/donationComponents/components/BankForm.js +0 -126
- package/dist/donationComponents/components/BankForm.js.map +0 -1
- package/dist/donationComponents/components/CardForm.d.ts +0 -13
- package/dist/donationComponents/components/CardForm.d.ts.map +0 -1
- package/dist/donationComponents/components/CardForm.js +0 -122
- package/dist/donationComponents/components/CardForm.js.map +0 -1
- package/dist/donationComponents/components/DonationForm.d.ts +0 -15
- package/dist/donationComponents/components/DonationForm.d.ts.map +0 -1
- package/dist/donationComponents/components/DonationForm.js +0 -199
- package/dist/donationComponents/components/DonationForm.js.map +0 -1
- package/dist/donationComponents/components/FundDonation.d.ts +0 -12
- package/dist/donationComponents/components/FundDonation.d.ts.map +0 -1
- package/dist/donationComponents/components/FundDonation.js +0 -32
- package/dist/donationComponents/components/FundDonation.js.map +0 -1
- package/dist/donationComponents/components/FundDonations.d.ts +0 -11
- package/dist/donationComponents/components/FundDonations.d.ts.map +0 -1
- package/dist/donationComponents/components/FundDonations.js +0 -33
- package/dist/donationComponents/components/FundDonations.js.map +0 -1
- package/dist/donationComponents/components/NonAuthDonation.d.ts +0 -12
- package/dist/donationComponents/components/NonAuthDonation.d.ts.map +0 -1
- package/dist/donationComponents/components/NonAuthDonation.js +0 -27
- package/dist/donationComponents/components/NonAuthDonation.js.map +0 -1
- package/dist/donationComponents/components/NonAuthDonationInner.d.ts +0 -12
- package/dist/donationComponents/components/NonAuthDonationInner.d.ts.map +0 -1
- package/dist/donationComponents/components/NonAuthDonationInner.js +0 -277
- package/dist/donationComponents/components/NonAuthDonationInner.js.map +0 -1
- package/dist/donationComponents/components/PaymentMethods.d.ts +0 -14
- package/dist/donationComponents/components/PaymentMethods.d.ts.map +0 -1
- package/dist/donationComponents/components/PaymentMethods.js +0 -84
- package/dist/donationComponents/components/PaymentMethods.js.map +0 -1
- package/dist/donationComponents/components/RecurringDonations.d.ts +0 -10
- package/dist/donationComponents/components/RecurringDonations.d.ts.map +0 -1
- package/dist/donationComponents/components/RecurringDonations.js +0 -93
- package/dist/donationComponents/components/RecurringDonations.js.map +0 -1
- package/dist/donationComponents/components/RecurringDonationsEdit.d.ts +0 -11
- package/dist/donationComponents/components/RecurringDonationsEdit.d.ts.map +0 -1
- package/dist/donationComponents/components/RecurringDonationsEdit.js +0 -66
- package/dist/donationComponents/components/RecurringDonationsEdit.js.map +0 -1
- package/dist/donationComponents/components/index.d.ts +0 -11
- package/dist/donationComponents/components/index.d.ts.map +0 -1
- package/dist/donationComponents/components/index.js +0 -24
- package/dist/donationComponents/components/index.js.map +0 -1
- package/dist/donationComponents/index.d.ts +0 -3
- package/dist/donationComponents/index.d.ts.map +0 -1
- package/dist/donationComponents/index.js +0 -21
- package/dist/donationComponents/index.js.map +0 -1
- package/dist/donationComponents/modals/DonationPreviewModal.d.ts +0 -15
- package/dist/donationComponents/modals/DonationPreviewModal.d.ts.map +0 -1
- package/dist/donationComponents/modals/DonationPreviewModal.js +0 -33
- package/dist/donationComponents/modals/DonationPreviewModal.js.map +0 -1
- package/dist/helpers/ApiHelper.d.ts +0 -18
- package/dist/helpers/ApiHelper.d.ts.map +0 -1
- package/dist/helpers/ApiHelper.js +0 -123
- package/dist/helpers/ApiHelper.js.map +0 -1
- package/dist/helpers/CommonEnvironmentHelper.d.ts +0 -21
- package/dist/helpers/CommonEnvironmentHelper.d.ts.map +0 -1
- package/dist/helpers/CommonEnvironmentHelper.js +0 -100
- package/dist/helpers/CommonEnvironmentHelper.js.map +0 -1
- package/dist/helpers/DonationHelper.d.ts +0 -8
- package/dist/helpers/DonationHelper.d.ts.map +0 -1
- package/dist/helpers/DonationHelper.js +0 -33
- package/dist/helpers/DonationHelper.js.map +0 -1
- package/dist/helpers/ReportHelper.d.ts +0 -5
- package/dist/helpers/ReportHelper.d.ts.map +0 -1
- package/dist/helpers/ReportHelper.js +0 -37
- package/dist/helpers/ReportHelper.js.map +0 -1
- package/dist/pageComponents/LoginPage.d.ts +0 -25
- package/dist/pageComponents/LoginPage.d.ts.map +0 -1
- package/dist/pageComponents/LoginPage.js +0 -288
- package/dist/pageComponents/LoginPage.js.map +0 -1
- package/dist/pageComponents/LogoutPage.d.ts +0 -9
- package/dist/pageComponents/LogoutPage.d.ts.map +0 -1
- package/dist/pageComponents/LogoutPage.js +0 -37
- package/dist/pageComponents/LogoutPage.js.map +0 -1
- package/dist/pageComponents/components/Forgot.d.ts +0 -8
- package/dist/pageComponents/components/Forgot.d.ts.map +0 -1
- package/dist/pageComponents/components/Forgot.js +0 -53
- package/dist/pageComponents/components/Forgot.js.map +0 -1
- package/dist/pageComponents/components/Login.d.ts +0 -15
- package/dist/pageComponents/components/Login.d.ts.map +0 -1
- package/dist/pageComponents/components/Login.js +0 -73
- package/dist/pageComponents/components/Login.js.map +0 -1
- package/dist/pageComponents/components/LoginSetPassword.d.ts +0 -13
- package/dist/pageComponents/components/LoginSetPassword.d.ts.map +0 -1
- package/dist/pageComponents/components/LoginSetPassword.js +0 -112
- package/dist/pageComponents/components/LoginSetPassword.js.map +0 -1
- package/dist/pageComponents/components/Register.d.ts +0 -12
- package/dist/pageComponents/components/Register.d.ts.map +0 -1
- package/dist/pageComponents/components/Register.js +0 -95
- package/dist/pageComponents/components/Register.js.map +0 -1
- package/dist/pageComponents/components/SelectChurchModal.d.ts +0 -14
- package/dist/pageComponents/components/SelectChurchModal.d.ts.map +0 -1
- package/dist/pageComponents/components/SelectChurchModal.js +0 -37
- package/dist/pageComponents/components/SelectChurchModal.js.map +0 -1
- package/dist/pageComponents/components/SelectChurchRegister.d.ts +0 -11
- package/dist/pageComponents/components/SelectChurchRegister.d.ts.map +0 -1
- package/dist/pageComponents/components/SelectChurchRegister.js +0 -89
- package/dist/pageComponents/components/SelectChurchRegister.js.map +0 -1
- package/dist/pageComponents/components/SelectChurchSearch.d.ts +0 -10
- package/dist/pageComponents/components/SelectChurchSearch.d.ts.map +0 -1
- package/dist/pageComponents/components/SelectChurchSearch.js +0 -58
- package/dist/pageComponents/components/SelectChurchSearch.js.map +0 -1
- package/dist/pageComponents/components/SelectableChurch.d.ts +0 -9
- package/dist/pageComponents/components/SelectableChurch.d.ts.map +0 -1
- package/dist/pageComponents/components/SelectableChurch.js +0 -18
- package/dist/pageComponents/components/SelectableChurch.js.map +0 -1
- package/dist/pageComponents/index.d.ts +0 -4
- package/dist/pageComponents/index.d.ts.map +0 -1
- package/dist/pageComponents/index.js +0 -10
- package/dist/pageComponents/index.js.map +0 -1
- package/src/components/markdownEditor/Editor.tsx +0 -150
- package/src/components/markdownEditor/IconNamesList.ts +0 -14
- package/src/components/markdownEditor/MarkdownEditor.tsx +0 -18
- package/src/components/markdownEditor/MarkdownModal.tsx +0 -49
- package/src/components/markdownEditor/MarkdownPreview.tsx +0 -18
- package/src/components/markdownEditor/MarkdownPreviewLight.tsx +0 -53
- package/src/components/markdownEditor/editor.css +0 -787
- package/src/components/markdownEditor/images/emoji/1F600.png +0 -0
- package/src/components/markdownEditor/images/emoji/1F641.png +0 -0
- package/src/components/markdownEditor/images/emoji/1F642.png +0 -0
- package/src/components/markdownEditor/images/emoji/2764.png +0 -0
- package/src/components/markdownEditor/images/icons/arrow-clockwise.svg +0 -4
- package/src/components/markdownEditor/images/icons/arrow-counterclockwise.svg +0 -4
- package/src/components/markdownEditor/images/icons/chat-square-quote.svg +0 -4
- package/src/components/markdownEditor/images/icons/chevron-down.svg +0 -3
- package/src/components/markdownEditor/images/icons/code.svg +0 -3
- package/src/components/markdownEditor/images/icons/journal-code.svg +0 -5
- package/src/components/markdownEditor/images/icons/journal-text.svg +0 -5
- package/src/components/markdownEditor/images/icons/justify.svg +0 -3
- package/src/components/markdownEditor/images/icons/link.svg +0 -4
- package/src/components/markdownEditor/images/icons/list-ol.svg +0 -4
- package/src/components/markdownEditor/images/icons/list-ul.svg +0 -3
- package/src/components/markdownEditor/images/icons/pencil-fill.svg +0 -3
- package/src/components/markdownEditor/images/icons/text-center.svg +0 -3
- package/src/components/markdownEditor/images/icons/text-left.svg +0 -3
- package/src/components/markdownEditor/images/icons/text-paragraph.svg +0 -3
- package/src/components/markdownEditor/images/icons/text-right.svg +0 -3
- package/src/components/markdownEditor/images/icons/type-bold.svg +0 -3
- package/src/components/markdownEditor/images/icons/type-h1.svg +0 -3
- package/src/components/markdownEditor/images/icons/type-h2.svg +0 -3
- package/src/components/markdownEditor/images/icons/type-h3.svg +0 -3
- package/src/components/markdownEditor/images/icons/type-h4.svg +0 -13
- package/src/components/markdownEditor/images/icons/type-italic.svg +0 -3
- package/src/components/markdownEditor/images/icons/type-strikethrough.svg +0 -3
- package/src/components/markdownEditor/images/icons/type-underline.svg +0 -3
- package/src/components/markdownEditor/index.ts +0 -3
- package/src/components/markdownEditor/plugins/AutoLinkPlugin.tsx +0 -35
- package/src/components/markdownEditor/plugins/ControlledEditorPlugin.tsx +0 -24
- package/src/components/markdownEditor/plugins/FloatingTextMenu/FloatingTextFormatToolbarPlugin.tsx +0 -445
- package/src/components/markdownEditor/plugins/FloatingTextMenu/getDOMRangeRect.tsx +0 -17
- package/src/components/markdownEditor/plugins/FloatingTextMenu/getSelectNode.tsx +0 -17
- package/src/components/markdownEditor/plugins/FloatingTextMenu/setFloatingElemPosition.tsx +0 -33
- package/src/components/markdownEditor/plugins/ListMaxIndentLevelPlugin.tsx +0 -68
- package/src/components/markdownEditor/plugins/MarkdownTransformers.ts +0 -106
- package/src/components/markdownEditor/plugins/ReadOnlyPlugin.tsx +0 -15
- package/src/components/markdownEditor/plugins/ToolbarPlugin.tsx +0 -424
- package/src/components/markdownEditor/plugins/customLink/CustomLinkNode.tsx +0 -224
- package/src/components/markdownEditor/plugins/customLink/CustomLinkNodePlugin.tsx +0 -32
- package/src/components/markdownEditor/plugins/customLink/CustomLinkNodeTransformer.tsx +0 -102
- package/src/components/markdownEditor/plugins/customLink/FloatingLinkEditor.tsx +0 -270
- package/src/components/markdownEditor/plugins/customLink/FloatingLinkEditor.types.ts +0 -11
- package/src/components/markdownEditor/plugins/emoji/EmojiNode.tsx +0 -95
- package/src/components/markdownEditor/plugins/emoji/EmojiNodeTransform.ts +0 -41
- package/src/components/markdownEditor/plugins/emoji/EmojiPickerPlugin.tsx +0 -152
- package/src/components/markdownEditor/plugins/emoji/EmojisPlugin.tsx +0 -70
- package/src/components/markdownEditor/plugins/index.ts +0 -6
- package/src/components/markdownEditor/theme.ts +0 -65
- package/src/components/reporting/ChartReport.tsx +0 -89
- package/src/components/reporting/ReportFilter.tsx +0 -56
- package/src/components/reporting/ReportFilterField.tsx +0 -163
- package/src/components/reporting/ReportOutput.tsx +0 -168
- package/src/components/reporting/ReportWithFilter.tsx +0 -72
- package/src/components/reporting/TableReport.tsx +0 -44
- package/src/components/reporting/TreeReport.tsx +0 -103
- package/src/components/reporting/index.ts +0 -4
- package/src/components/wrapper/Drawers.tsx +0 -62
- package/src/components/wrapper/SiteWrapper.tsx +0 -99
- package/src/components/wrapper/TabPanel.tsx +0 -32
- package/src/donationComponents/components/BankForm.tsx +0 -163
- package/src/donationComponents/components/CardForm.tsx +0 -104
- package/src/donationComponents/components/DonationForm.tsx +0 -260
- package/src/donationComponents/components/FundDonation.tsx +0 -59
- package/src/donationComponents/components/FundDonations.tsx +0 -44
- package/src/donationComponents/components/NonAuthDonation.tsx +0 -34
- package/src/donationComponents/components/NonAuthDonationInner.tsx +0 -300
- package/src/donationComponents/components/PaymentMethods.tsx +0 -133
- package/src/donationComponents/components/RecurringDonations.tsx +0 -117
- package/src/donationComponents/components/RecurringDonationsEdit.tsx +0 -96
- package/src/donationComponents/components/index.tsx +0 -10
- package/src/donationComponents/index.ts +0 -2
- package/src/donationComponents/modals/DonationPreviewModal.tsx +0 -70
- package/src/helpers/ApiHelper.ts +0 -127
- package/src/helpers/CommonEnvironmentHelper.ts +0 -98
- package/src/helpers/DonationHelper.ts +0 -26
- package/src/helpers/ReportHelper.ts +0 -34
- package/src/pageComponents/LoginPage.tsx +0 -284
- package/src/pageComponents/LogoutPage.tsx +0 -43
- package/src/pageComponents/components/Forgot.tsx +0 -81
- package/src/pageComponents/components/Login.tsx +0 -62
- package/src/pageComponents/components/LoginSetPassword.tsx +0 -98
- package/src/pageComponents/components/Register.tsx +0 -103
- package/src/pageComponents/components/SelectChurchModal.tsx +0 -58
- package/src/pageComponents/components/SelectChurchRegister.tsx +0 -87
- package/src/pageComponents/components/SelectChurchSearch.tsx +0 -71
- package/src/pageComponents/components/SelectableChurch.tsx +0 -40
- package/src/pageComponents/index.ts +0 -3
package/src/components/markdownEditor/plugins/FloatingTextMenu/FloatingTextFormatToolbarPlugin.tsx
DELETED
|
@@ -1,445 +0,0 @@
|
|
|
1
|
-
import { $isCodeHighlightNode } from "@lexical/code";
|
|
2
|
-
import { $isLinkNode, TOGGLE_LINK_COMMAND } from "@lexical/link";
|
|
3
|
-
import { useLexicalComposerContext } from "@lexical/react/LexicalComposerContext";
|
|
4
|
-
import { mergeRegister } from "@lexical/utils";
|
|
5
|
-
import { $convertToMarkdownString } from "@lexical/markdown";
|
|
6
|
-
import { $createParagraphNode, $getSelection, $isRangeSelection, $isTextNode, COMMAND_PRIORITY_LOW, FORMAT_TEXT_COMMAND, SELECTION_CHANGE_COMMAND } from "lexical";
|
|
7
|
-
import { $createHeadingNode, $isHeadingNode } from "@lexical/rich-text";
|
|
8
|
-
import { $wrapNodes } from "@lexical/selection";
|
|
9
|
-
import React, { useCallback, useEffect, useRef, useState } from "react";
|
|
10
|
-
import { createPortal } from "react-dom";
|
|
11
|
-
import { Box, styled, IconButton, Icon, Select, MenuItem } from "@mui/material";
|
|
12
|
-
|
|
13
|
-
import { getDOMRangeRect } from "./getDOMRangeRect";
|
|
14
|
-
import { getSelectedNode } from "./getSelectNode";
|
|
15
|
-
import { setFloatingElemPosition } from "./setFloatingElemPosition";
|
|
16
|
-
import { PLAYGROUND_TRANSFORMERS } from "../MarkdownTransformers";
|
|
17
|
-
import { ApiHelper } from "../../../../helpers";
|
|
18
|
-
|
|
19
|
-
export const FloatingDivContainer = styled(Box)({
|
|
20
|
-
display: "flex",
|
|
21
|
-
background: "#fff",
|
|
22
|
-
padding: 4,
|
|
23
|
-
verticalAlign: "middle",
|
|
24
|
-
position: "absolute",
|
|
25
|
-
top: 0,
|
|
26
|
-
left: 0,
|
|
27
|
-
zIndex: 1400,
|
|
28
|
-
opacity: 0,
|
|
29
|
-
backgroundColor: "#fff",
|
|
30
|
-
boxShadow: "0px 5px 10px rgba(0, 0, 0, 0.3)",
|
|
31
|
-
borderRadius: 8,
|
|
32
|
-
transition: "opacity 0.5s",
|
|
33
|
-
height: 35,
|
|
34
|
-
willChange: "transform",
|
|
35
|
-
});
|
|
36
|
-
|
|
37
|
-
function TextFormatFloatingToolbar({ editor, anchorElem, isLink, isBold, isItalic, isUnderline, isCode, isStrikethrough, isSubscript, isSuperscript, blockType, setBlockType }: any) {
|
|
38
|
-
const popupCharStylesEditorRef = useRef(null);
|
|
39
|
-
|
|
40
|
-
const applyFormatting = (command: string) => {
|
|
41
|
-
editor.dispatchCommand(FORMAT_TEXT_COMMAND, command);
|
|
42
|
-
saveChanges(editor);
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
const insertLink = useCallback(() => {
|
|
46
|
-
if (!isLink) {
|
|
47
|
-
editor.dispatchCommand(TOGGLE_LINK_COMMAND, "https://");
|
|
48
|
-
} else {
|
|
49
|
-
editor.dispatchCommand(TOGGLE_LINK_COMMAND, null);
|
|
50
|
-
}
|
|
51
|
-
}, [editor, isLink]);
|
|
52
|
-
|
|
53
|
-
function mouseMoveListener(e: any) {
|
|
54
|
-
if (
|
|
55
|
-
popupCharStylesEditorRef?.current &&
|
|
56
|
-
(e.buttons === 1 || e.buttons === 3)
|
|
57
|
-
) {
|
|
58
|
-
popupCharStylesEditorRef.current.style.pointerEvents = "none";
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
function mouseUpListener(e: any) {
|
|
62
|
-
if (popupCharStylesEditorRef?.current) {
|
|
63
|
-
popupCharStylesEditorRef.current.style.pointerEvents = "auto";
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
useEffect(() => {
|
|
68
|
-
if (popupCharStylesEditorRef?.current) {
|
|
69
|
-
document.addEventListener("mousemove", mouseMoveListener);
|
|
70
|
-
document.addEventListener("mouseup", mouseUpListener);
|
|
71
|
-
|
|
72
|
-
return () => {
|
|
73
|
-
document.removeEventListener("mousemove", mouseMoveListener);
|
|
74
|
-
document.removeEventListener("mouseup", mouseUpListener);
|
|
75
|
-
};
|
|
76
|
-
}
|
|
77
|
-
}, [popupCharStylesEditorRef]);
|
|
78
|
-
|
|
79
|
-
const updateTextFormatFloatingToolbar = useCallback(() => {
|
|
80
|
-
const selection = $getSelection();
|
|
81
|
-
|
|
82
|
-
const popupCharStylesEditorElem = popupCharStylesEditorRef.current;
|
|
83
|
-
const nativeSelection = window.getSelection();
|
|
84
|
-
|
|
85
|
-
if (popupCharStylesEditorElem === null) {
|
|
86
|
-
return;
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
const rootElement = editor.getRootElement();
|
|
90
|
-
if (
|
|
91
|
-
selection !== null &&
|
|
92
|
-
nativeSelection !== null &&
|
|
93
|
-
!nativeSelection.isCollapsed &&
|
|
94
|
-
rootElement !== null &&
|
|
95
|
-
rootElement.contains(nativeSelection.anchorNode)
|
|
96
|
-
) {
|
|
97
|
-
const rangeRect = getDOMRangeRect(nativeSelection, rootElement);
|
|
98
|
-
|
|
99
|
-
setFloatingElemPosition(rangeRect, popupCharStylesEditorElem, anchorElem);
|
|
100
|
-
}
|
|
101
|
-
}, [editor, anchorElem]);
|
|
102
|
-
|
|
103
|
-
useEffect(() => {
|
|
104
|
-
const scrollerElem = anchorElem.parentElement;
|
|
105
|
-
|
|
106
|
-
const update = () => {
|
|
107
|
-
editor.getEditorState().read(() => {
|
|
108
|
-
updateTextFormatFloatingToolbar();
|
|
109
|
-
});
|
|
110
|
-
};
|
|
111
|
-
|
|
112
|
-
window.addEventListener("resize", update);
|
|
113
|
-
if (scrollerElem) {
|
|
114
|
-
scrollerElem.addEventListener("scroll", update);
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
return () => {
|
|
118
|
-
window.removeEventListener("resize", update);
|
|
119
|
-
if (scrollerElem) {
|
|
120
|
-
scrollerElem.removeEventListener("scroll", update);
|
|
121
|
-
}
|
|
122
|
-
};
|
|
123
|
-
}, [editor, updateTextFormatFloatingToolbar, anchorElem]);
|
|
124
|
-
|
|
125
|
-
useEffect(() => {
|
|
126
|
-
editor.getEditorState().read(() => {
|
|
127
|
-
updateTextFormatFloatingToolbar();
|
|
128
|
-
});
|
|
129
|
-
return mergeRegister(
|
|
130
|
-
editor.registerUpdateListener(({ editorState }: any) => {
|
|
131
|
-
editorState.read(() => {
|
|
132
|
-
updateTextFormatFloatingToolbar();
|
|
133
|
-
});
|
|
134
|
-
}),
|
|
135
|
-
|
|
136
|
-
editor.registerCommand(
|
|
137
|
-
SELECTION_CHANGE_COMMAND,
|
|
138
|
-
() => {
|
|
139
|
-
updateTextFormatFloatingToolbar();
|
|
140
|
-
return false;
|
|
141
|
-
},
|
|
142
|
-
COMMAND_PRIORITY_LOW
|
|
143
|
-
)
|
|
144
|
-
);
|
|
145
|
-
}, [editor, updateTextFormatFloatingToolbar]);
|
|
146
|
-
|
|
147
|
-
const formatBlock = (type: string) => {
|
|
148
|
-
editor.update(() => {
|
|
149
|
-
const selection = $getSelection();
|
|
150
|
-
if ($isRangeSelection(selection)) {
|
|
151
|
-
$wrapNodes(selection, () =>
|
|
152
|
-
//@ts-ignore
|
|
153
|
-
type === "paragraph" ? $createParagraphNode() : $createHeadingNode(type)
|
|
154
|
-
);
|
|
155
|
-
}
|
|
156
|
-
});
|
|
157
|
-
setBlockType(type);
|
|
158
|
-
saveChanges(editor)
|
|
159
|
-
};
|
|
160
|
-
|
|
161
|
-
return (
|
|
162
|
-
<FloatingDivContainer ref={popupCharStylesEditorRef}>
|
|
163
|
-
<>
|
|
164
|
-
<Select
|
|
165
|
-
value={blockType}
|
|
166
|
-
onChange={(e) => formatBlock(e.target.value)}
|
|
167
|
-
sx={{
|
|
168
|
-
minWidth: 120,
|
|
169
|
-
backgroundColor: "#fff",
|
|
170
|
-
borderRadius: 2,
|
|
171
|
-
marginRight: 0.3,
|
|
172
|
-
}}
|
|
173
|
-
>
|
|
174
|
-
<MenuItem value="paragraph">Normal</MenuItem>
|
|
175
|
-
<MenuItem value="h1">Heading 1</MenuItem>
|
|
176
|
-
<MenuItem value="h2">Heading 2</MenuItem>
|
|
177
|
-
<MenuItem value="h3">Heading 3</MenuItem>
|
|
178
|
-
<MenuItem value="h4">Heading 4</MenuItem>
|
|
179
|
-
</Select>
|
|
180
|
-
<IconButton
|
|
181
|
-
onClick={() => {
|
|
182
|
-
applyFormatting("bold");
|
|
183
|
-
}}
|
|
184
|
-
sx={{ backgroundColor: isBold ? "#e0e0e0" : undefined, borderRadius: 2, marginRight: 0.3 }}
|
|
185
|
-
>
|
|
186
|
-
<Icon>format_bold_outline</Icon>
|
|
187
|
-
</IconButton>
|
|
188
|
-
|
|
189
|
-
<IconButton
|
|
190
|
-
onClick={() => {
|
|
191
|
-
applyFormatting("italic");
|
|
192
|
-
}}
|
|
193
|
-
sx={{ backgroundColor: isItalic ? "#e0e0e0" : undefined, borderRadius: 2, marginRight: 0.3 }}
|
|
194
|
-
>
|
|
195
|
-
<Icon>format_italic_outline</Icon>
|
|
196
|
-
</IconButton>
|
|
197
|
-
|
|
198
|
-
<IconButton
|
|
199
|
-
onClick={() => {
|
|
200
|
-
applyFormatting("underline");
|
|
201
|
-
}}
|
|
202
|
-
sx={{ backgroundColor: isUnderline ? "#e0e0e0" : undefined, borderRadius: 2, marginRight: 0.3 }}
|
|
203
|
-
>
|
|
204
|
-
<Icon>format_underlined_outline</Icon>
|
|
205
|
-
</IconButton>
|
|
206
|
-
|
|
207
|
-
{/* <IconButton
|
|
208
|
-
onClick={() => {
|
|
209
|
-
applyFormatting("strikethrough");
|
|
210
|
-
}}
|
|
211
|
-
sx={{ backgroundColor: isStrikethrough ? "#e0e0e0" : undefined, borderRadius: 2, marginRight: 0.3 }}
|
|
212
|
-
>
|
|
213
|
-
<Icon>strikethrough_s_outline</Icon>
|
|
214
|
-
</IconButton> */}
|
|
215
|
-
|
|
216
|
-
<IconButton
|
|
217
|
-
onClick={() => {
|
|
218
|
-
applyFormatting("code");
|
|
219
|
-
}}
|
|
220
|
-
sx={{ backgroundColor: isCode ? "#e0e0e0" : undefined, borderRadius: 2, marginRight: 0.3 }}
|
|
221
|
-
>
|
|
222
|
-
<Icon>code</Icon>
|
|
223
|
-
</IconButton>
|
|
224
|
-
|
|
225
|
-
{/* <IconButton
|
|
226
|
-
onClick={insertLink}
|
|
227
|
-
sx={{ backgroundColor: isLink ? "#e0e0e0" : undefined, borderRadius: 2 }}
|
|
228
|
-
>
|
|
229
|
-
<Icon>insert_link_outline</Icon>
|
|
230
|
-
</IconButton> */}
|
|
231
|
-
</>
|
|
232
|
-
</FloatingDivContainer>
|
|
233
|
-
);
|
|
234
|
-
}
|
|
235
|
-
|
|
236
|
-
let lastSavedText = ""; // Track last saved text
|
|
237
|
-
let lastFormattingState = {}; // Track last formatting state
|
|
238
|
-
|
|
239
|
-
//@ts-ignore
|
|
240
|
-
const getFormattingState = (selection) => {
|
|
241
|
-
const node = getSelectedNode(selection);
|
|
242
|
-
let blockType = "paragraph";
|
|
243
|
-
if ($isHeadingNode(node)) {
|
|
244
|
-
blockType = node.getTag(); // "h1", "h2", etc.
|
|
245
|
-
}
|
|
246
|
-
|
|
247
|
-
return {
|
|
248
|
-
isBold: selection.hasFormat("bold"),
|
|
249
|
-
isItalic: selection.hasFormat("italic"),
|
|
250
|
-
isUnderline: selection.hasFormat("underline"),
|
|
251
|
-
// isStrikethrough: selection.hasFormat("strikethrough"),
|
|
252
|
-
isCode: selection.hasFormat("code"),
|
|
253
|
-
blockType
|
|
254
|
-
}
|
|
255
|
-
}
|
|
256
|
-
|
|
257
|
-
const saveChanges = (editor: any) => {
|
|
258
|
-
editor.update(() => {
|
|
259
|
-
const selection = $getSelection();
|
|
260
|
-
if ($isRangeSelection(selection)) {
|
|
261
|
-
const text = selection.getTextContent().trim();
|
|
262
|
-
const newFormattingState = getFormattingState(selection); // Get current formatting
|
|
263
|
-
|
|
264
|
-
// Get the parent block node (ensuring it's not just a text node)
|
|
265
|
-
const node = getSelectedNode(selection);
|
|
266
|
-
const parentNode = node.getParent(); // Get the parent block-level node
|
|
267
|
-
let blockType = "paragraph";
|
|
268
|
-
|
|
269
|
-
if ($isHeadingNode(parentNode)) {
|
|
270
|
-
blockType = parentNode.getTag(); // Get heading type
|
|
271
|
-
} else if ($isHeadingNode(node)) {
|
|
272
|
-
blockType = node.getTag();
|
|
273
|
-
}
|
|
274
|
-
|
|
275
|
-
//@ts-ignore
|
|
276
|
-
if (JSON.stringify(newFormattingState) !== JSON.stringify(lastFormattingState) || blockType !== lastFormattingState.blockType) {
|
|
277
|
-
lastSavedText = text;
|
|
278
|
-
lastFormattingState = { ...newFormattingState, blockType };
|
|
279
|
-
|
|
280
|
-
const editorNode = editor.getRootElement();
|
|
281
|
-
const elementJSON = editorNode?.dataset?.element;
|
|
282
|
-
if (elementJSON) {
|
|
283
|
-
const markdown = $convertToMarkdownString(PLAYGROUND_TRANSFORMERS)
|
|
284
|
-
const element: any = JSON.parse(elementJSON);
|
|
285
|
-
|
|
286
|
-
element.answers.text = markdown;
|
|
287
|
-
element.answersJSON = JSON.stringify(element.answers);
|
|
288
|
-
|
|
289
|
-
ApiHelper.post("/elements", [element], "ContentApi");
|
|
290
|
-
}
|
|
291
|
-
}
|
|
292
|
-
}
|
|
293
|
-
})
|
|
294
|
-
}
|
|
295
|
-
|
|
296
|
-
const updateFormattingState = (editor: any) => {
|
|
297
|
-
editor.update(() => {
|
|
298
|
-
const selection = $getSelection();
|
|
299
|
-
if ($isRangeSelection(selection)) {
|
|
300
|
-
lastFormattingState = getFormattingState(selection);
|
|
301
|
-
}
|
|
302
|
-
})
|
|
303
|
-
}
|
|
304
|
-
|
|
305
|
-
function useFloatingTextFormatToolbar(editor: any, anchorElem: any) {
|
|
306
|
-
const [isText, setIsText] = useState(false);
|
|
307
|
-
const [isLink, setIsLink] = useState(false);
|
|
308
|
-
const [isBold, setIsBold] = useState(false);
|
|
309
|
-
const [isItalic, setIsItalic] = useState(false);
|
|
310
|
-
const [isUnderline, setIsUnderline] = useState(false);
|
|
311
|
-
const [isStrikethrough, setIsStrikethrough] = useState(false);
|
|
312
|
-
const [isSubscript, setIsSubscript] = useState(false);
|
|
313
|
-
const [isSuperscript, setIsSuperscript] = useState(false);
|
|
314
|
-
const [isCode, setIsCode] = useState(false);
|
|
315
|
-
const [blockType, setBlockType] = useState("paragraph");
|
|
316
|
-
|
|
317
|
-
const updatePopup = useCallback(() => {
|
|
318
|
-
editor.getEditorState().read(() => {
|
|
319
|
-
// Should not to pop up the floating toolbar when using IME input
|
|
320
|
-
if (editor.isComposing()) {
|
|
321
|
-
return;
|
|
322
|
-
}
|
|
323
|
-
const selection = $getSelection();
|
|
324
|
-
const nativeSelection = window.getSelection();
|
|
325
|
-
const rootElement = editor.getRootElement();
|
|
326
|
-
|
|
327
|
-
if (
|
|
328
|
-
nativeSelection !== null &&
|
|
329
|
-
(!$isRangeSelection(selection) ||
|
|
330
|
-
rootElement === null ||
|
|
331
|
-
!rootElement.contains(nativeSelection.anchorNode))
|
|
332
|
-
) {
|
|
333
|
-
setIsText(false);
|
|
334
|
-
return;
|
|
335
|
-
}
|
|
336
|
-
|
|
337
|
-
if (!$isRangeSelection(selection)) {
|
|
338
|
-
return;
|
|
339
|
-
}
|
|
340
|
-
|
|
341
|
-
const node = getSelectedNode(selection);
|
|
342
|
-
|
|
343
|
-
// Update text format
|
|
344
|
-
setIsBold(selection.hasFormat("bold"));
|
|
345
|
-
setIsItalic(selection.hasFormat("italic"));
|
|
346
|
-
setIsUnderline(selection.hasFormat("underline"));
|
|
347
|
-
setIsStrikethrough(selection.hasFormat("strikethrough"));
|
|
348
|
-
setIsSubscript(selection.hasFormat("subscript"));
|
|
349
|
-
setIsSuperscript(selection.hasFormat("superscript"));
|
|
350
|
-
setIsCode(selection.hasFormat("code"));
|
|
351
|
-
|
|
352
|
-
// Update links
|
|
353
|
-
const parent = node.getParent();
|
|
354
|
-
if ($isLinkNode(parent) || $isLinkNode(node)) {
|
|
355
|
-
setIsLink(true);
|
|
356
|
-
} else {
|
|
357
|
-
setIsLink(false);
|
|
358
|
-
}
|
|
359
|
-
|
|
360
|
-
if (
|
|
361
|
-
!$isCodeHighlightNode(selection.anchor.getNode()) &&
|
|
362
|
-
selection.getTextContent() !== ""
|
|
363
|
-
) {
|
|
364
|
-
setIsText($isTextNode(node));
|
|
365
|
-
} else {
|
|
366
|
-
setIsText(false);
|
|
367
|
-
}
|
|
368
|
-
|
|
369
|
-
const rawTextContent = selection.getTextContent().replace(/\n/g, "");
|
|
370
|
-
if (!selection.isCollapsed() && rawTextContent === "") {
|
|
371
|
-
setIsText(false);
|
|
372
|
-
return;
|
|
373
|
-
}
|
|
374
|
-
|
|
375
|
-
if ($isRangeSelection(selection)) {
|
|
376
|
-
const text = selection.getTextContent().trim();
|
|
377
|
-
if (text && JSON.stringify(lastFormattingState === "{}")) {
|
|
378
|
-
updateFormattingState(editor);
|
|
379
|
-
}
|
|
380
|
-
}
|
|
381
|
-
|
|
382
|
-
let type = "paragraph";
|
|
383
|
-
if ($isHeadingNode(parent)) {
|
|
384
|
-
type = parent.getTag();
|
|
385
|
-
} else if ($isHeadingNode(node)) {
|
|
386
|
-
type = node.getTag();
|
|
387
|
-
}
|
|
388
|
-
setBlockType(type);
|
|
389
|
-
});
|
|
390
|
-
|
|
391
|
-
}, [editor]);
|
|
392
|
-
|
|
393
|
-
useEffect(() => {
|
|
394
|
-
document.addEventListener("selectionchange", updatePopup);
|
|
395
|
-
return () => {
|
|
396
|
-
document.removeEventListener("selectionchange", updatePopup);
|
|
397
|
-
};
|
|
398
|
-
}, [updatePopup]);
|
|
399
|
-
|
|
400
|
-
useEffect(() => {
|
|
401
|
-
return mergeRegister(
|
|
402
|
-
editor.registerUpdateListener(() => {
|
|
403
|
-
updatePopup();
|
|
404
|
-
}),
|
|
405
|
-
editor.registerCommand(SELECTION_CHANGE_COMMAND, () => {
|
|
406
|
-
updatePopup();
|
|
407
|
-
return false;
|
|
408
|
-
},COMMAND_PRIORITY_LOW),
|
|
409
|
-
editor.registerRootListener(() => {
|
|
410
|
-
if (editor.getRootElement() === null) {
|
|
411
|
-
setIsText(false);
|
|
412
|
-
}
|
|
413
|
-
})
|
|
414
|
-
);
|
|
415
|
-
}, [editor, updatePopup]);
|
|
416
|
-
|
|
417
|
-
if (!isText || isLink) {
|
|
418
|
-
return null;
|
|
419
|
-
}
|
|
420
|
-
|
|
421
|
-
return createPortal(
|
|
422
|
-
<TextFormatFloatingToolbar
|
|
423
|
-
editor={editor}
|
|
424
|
-
anchorElem={anchorElem}
|
|
425
|
-
isLink={isLink}
|
|
426
|
-
isBold={isBold}
|
|
427
|
-
isItalic={isItalic}
|
|
428
|
-
isStrikethrough={isStrikethrough}
|
|
429
|
-
isSubscript={isSubscript}
|
|
430
|
-
isSuperscript={isSuperscript}
|
|
431
|
-
isUnderline={isUnderline}
|
|
432
|
-
isCode={isCode}
|
|
433
|
-
blockType={blockType}
|
|
434
|
-
setBlockType={setBlockType}
|
|
435
|
-
/>,
|
|
436
|
-
anchorElem
|
|
437
|
-
);
|
|
438
|
-
}
|
|
439
|
-
|
|
440
|
-
export default function FloatingTextFormatToolbarPlugin({
|
|
441
|
-
anchorElem = document.body,
|
|
442
|
-
}) {
|
|
443
|
-
const [editor] = useLexicalComposerContext();
|
|
444
|
-
return useFloatingTextFormatToolbar(editor, anchorElem);
|
|
445
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
export function getDOMRangeRect(nativeSelection: any, rootElement: any) {
|
|
2
|
-
const domRange = nativeSelection.getRangeAt(0);
|
|
3
|
-
|
|
4
|
-
let rect;
|
|
5
|
-
|
|
6
|
-
if (nativeSelection.anchorNode === rootElement) {
|
|
7
|
-
let inner = rootElement;
|
|
8
|
-
while (inner.firstElementChild != null) {
|
|
9
|
-
inner = inner.firstElementChild;
|
|
10
|
-
}
|
|
11
|
-
rect = inner.getBoundingClientRect();
|
|
12
|
-
} else {
|
|
13
|
-
rect = domRange.getBoundingClientRect();
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
return rect;
|
|
17
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { $isAtNodeEnd } from "@lexical/selection";
|
|
2
|
-
|
|
3
|
-
export function getSelectedNode(selection: any) {
|
|
4
|
-
const anchor = selection.anchor;
|
|
5
|
-
const focus = selection.focus;
|
|
6
|
-
const anchorNode = selection.anchor.getNode();
|
|
7
|
-
const focusNode = selection.focus.getNode();
|
|
8
|
-
if (anchorNode === focusNode) {
|
|
9
|
-
return anchorNode;
|
|
10
|
-
}
|
|
11
|
-
const isBackward = selection.isBackward();
|
|
12
|
-
if (isBackward) {
|
|
13
|
-
return $isAtNodeEnd(focus) ? anchorNode : focusNode;
|
|
14
|
-
} else {
|
|
15
|
-
return $isAtNodeEnd(anchor) ? anchorNode : focusNode;
|
|
16
|
-
}
|
|
17
|
-
}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
const VERTICAL_GAP = 10;
|
|
2
|
-
const HORIZONTAL_OFFSET = 5;
|
|
3
|
-
|
|
4
|
-
export function setFloatingElemPosition( targetRect: any, floatingElem: any, anchorElem: any, verticalGap = VERTICAL_GAP, horizontalOffset = HORIZONTAL_OFFSET ) {
|
|
5
|
-
const scrollerElem = anchorElem.parentElement;
|
|
6
|
-
|
|
7
|
-
if (targetRect === null || !scrollerElem) {
|
|
8
|
-
floatingElem.style.opacity = "0";
|
|
9
|
-
floatingElem.style.transform = "translate(-10000px, -10000px)";
|
|
10
|
-
return;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
const floatingElemRect = floatingElem.getBoundingClientRect();
|
|
14
|
-
const anchorElementRect = anchorElem.getBoundingClientRect();
|
|
15
|
-
const editorScrollerRect = scrollerElem.getBoundingClientRect();
|
|
16
|
-
|
|
17
|
-
let top = targetRect.top - floatingElemRect.height - verticalGap;
|
|
18
|
-
let left = targetRect.left - horizontalOffset;
|
|
19
|
-
|
|
20
|
-
if (top < editorScrollerRect.top) {
|
|
21
|
-
top += floatingElemRect.height + targetRect.height + verticalGap * 2;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
if (left + floatingElemRect.width > editorScrollerRect.right) {
|
|
25
|
-
left = editorScrollerRect.right - floatingElemRect.width - horizontalOffset;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
top -= anchorElementRect.top;
|
|
29
|
-
left -= anchorElementRect.left;
|
|
30
|
-
|
|
31
|
-
floatingElem.style.opacity = "1";
|
|
32
|
-
floatingElem.style.transform = `translate(${left}px, ${top}px)`;
|
|
33
|
-
}
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
import { $getListDepth, $isListItemNode, $isListNode } from "@lexical/list";
|
|
2
|
-
import { useLexicalComposerContext } from "@lexical/react/LexicalComposerContext";
|
|
3
|
-
import {
|
|
4
|
-
$getSelection,
|
|
5
|
-
$isElementNode,
|
|
6
|
-
$isRangeSelection,
|
|
7
|
-
INDENT_CONTENT_COMMAND,
|
|
8
|
-
COMMAND_PRIORITY_HIGH
|
|
9
|
-
} from "lexical";
|
|
10
|
-
import { useEffect } from "react";
|
|
11
|
-
|
|
12
|
-
function getElementNodesInSelection(selection: any) {
|
|
13
|
-
const nodesInSelection = selection.getNodes();
|
|
14
|
-
|
|
15
|
-
if (nodesInSelection.length === 0) {
|
|
16
|
-
return new Set([
|
|
17
|
-
selection.anchor.getNode().getParentOrThrow(),
|
|
18
|
-
selection.focus.getNode().getParentOrThrow()
|
|
19
|
-
]);
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
return new Set(
|
|
23
|
-
nodesInSelection.map((n: any) => ($isElementNode(n) ? n : n.getParentOrThrow()))
|
|
24
|
-
);
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
function isIndentPermitted(maxDepth: any) {
|
|
28
|
-
const selection = $getSelection();
|
|
29
|
-
|
|
30
|
-
if (!$isRangeSelection(selection)) {
|
|
31
|
-
return false;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
const elementNodesInSelection = getElementNodesInSelection(selection);
|
|
35
|
-
|
|
36
|
-
let totalDepth = 0;
|
|
37
|
-
// @ts-ignore
|
|
38
|
-
for (const elementNode of elementNodesInSelection) {
|
|
39
|
-
if ($isListNode(elementNode)) {
|
|
40
|
-
totalDepth = Math.max($getListDepth(elementNode) + 1, totalDepth);
|
|
41
|
-
} else if ($isListItemNode(elementNode)) {
|
|
42
|
-
const parent = elementNode.getParent();
|
|
43
|
-
if (!$isListNode(parent)) {
|
|
44
|
-
throw new Error(
|
|
45
|
-
"ListMaxIndentLevelPlugin: A ListItemNode must have a ListNode for a parent."
|
|
46
|
-
);
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
totalDepth = Math.max($getListDepth(parent) + 1, totalDepth);
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
return totalDepth <= maxDepth;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
export function ListMaxIndentLevelPlugin(data: any): any {
|
|
57
|
-
const [editor] = useLexicalComposerContext();
|
|
58
|
-
|
|
59
|
-
useEffect(() => (
|
|
60
|
-
editor.registerCommand(
|
|
61
|
-
INDENT_CONTENT_COMMAND,
|
|
62
|
-
() => !isIndentPermitted(data.maxDepth ?? 7),
|
|
63
|
-
COMMAND_PRIORITY_HIGH
|
|
64
|
-
)
|
|
65
|
-
), [editor, data.maxDepth]);
|
|
66
|
-
|
|
67
|
-
return null;
|
|
68
|
-
}
|
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
import type { ElementTransformer, Transformer } from "@lexical/markdown";
|
|
2
|
-
import type { LexicalNode, TextFormatType } from "lexical";
|
|
3
|
-
|
|
4
|
-
import {
|
|
5
|
-
ELEMENT_TRANSFORMERS,
|
|
6
|
-
TEXT_FORMAT_TRANSFORMERS,
|
|
7
|
-
TRANSFORMERS
|
|
8
|
-
} from "@lexical/markdown";
|
|
9
|
-
import {
|
|
10
|
-
$createHorizontalRuleNode,
|
|
11
|
-
$isHorizontalRuleNode,
|
|
12
|
-
HorizontalRuleNode
|
|
13
|
-
} from "@lexical/react/LexicalHorizontalRuleNode";
|
|
14
|
-
import { CUSTOM_LINK_NODE_TRANSFORMER } from "./customLink/CustomLinkNodeTransformer";
|
|
15
|
-
import { EMOJI_NODE_MARKDOWN_TRANSFORM } from "./emoji/EmojiNodeTransform";
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
export const HR: ElementTransformer = {
|
|
19
|
-
dependencies: [HorizontalRuleNode],
|
|
20
|
-
export: (node: LexicalNode) => ($isHorizontalRuleNode(node) ? "***" : null),
|
|
21
|
-
regExp: /^(---|\*\*\*|___)\s?$/,
|
|
22
|
-
replace: (parentNode, _1, _2, isImport) => {
|
|
23
|
-
const line = $createHorizontalRuleNode();
|
|
24
|
-
|
|
25
|
-
// TODO: Get rid of isImport flag
|
|
26
|
-
if (isImport || parentNode.getNextSibling() != null) {
|
|
27
|
-
parentNode.replace(line);
|
|
28
|
-
} else {
|
|
29
|
-
parentNode.insertBefore(line);
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
line.selectNext();
|
|
33
|
-
},
|
|
34
|
-
type: "element"
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
export type TextFormatTransformer = Readonly<{
|
|
38
|
-
format: ReadonlyArray<TextFormatType>;
|
|
39
|
-
tag: string;
|
|
40
|
-
intraword?: boolean;
|
|
41
|
-
type: "text-format";
|
|
42
|
-
}>;
|
|
43
|
-
/*
|
|
44
|
-
export type TextMatchTransformer = Readonly<{
|
|
45
|
-
dependencies: Array<Klass<LexicalNode>>;
|
|
46
|
-
export: (
|
|
47
|
-
node: LexicalNode,
|
|
48
|
-
// eslint-disable-next-line no-shadow
|
|
49
|
-
exportChildren: (node: ElementNode) => string,
|
|
50
|
-
// eslint-disable-next-line no-shadow
|
|
51
|
-
exportFormat: (node: TextNode, textContent: string) => string,
|
|
52
|
-
) => string | null;
|
|
53
|
-
importRegExp: RegExp;
|
|
54
|
-
regExp: RegExp;
|
|
55
|
-
replace: (node: TextNode, match: RegExpMatchArray) => void;
|
|
56
|
-
trigger: string;
|
|
57
|
-
type: 'text-match';
|
|
58
|
-
}>;
|
|
59
|
-
*/
|
|
60
|
-
|
|
61
|
-
export const UNDERLINE: TextFormatTransformer = {
|
|
62
|
-
format: ["underline"],
|
|
63
|
-
intraword: false,
|
|
64
|
-
tag: "__",
|
|
65
|
-
type: "text-format"
|
|
66
|
-
};
|
|
67
|
-
/*
|
|
68
|
-
export const UNDERLINE: TextMatchTransformer = {
|
|
69
|
-
dependencies: [],
|
|
70
|
-
export: (node, exportChildren, exportFormat) => {
|
|
71
|
-
const linkContent = `[${node.getTextContent()}](${node.getURL()})`;
|
|
72
|
-
const firstChild = node.getFirstChild();
|
|
73
|
-
// Add text styles only if link has single text node inside. If it's more
|
|
74
|
-
// then one we ignore it as markdown does not support nested styles for links
|
|
75
|
-
if (node.getChildrenSize() === 1 && $isTextNode(firstChild)) {
|
|
76
|
-
return exportFormat(firstChild, linkContent);
|
|
77
|
-
} else {
|
|
78
|
-
return linkContent;
|
|
79
|
-
}
|
|
80
|
-
},
|
|
81
|
-
importRegExp: /(?:\[([^[]+)\])(?:\(([^()]+)\))/,
|
|
82
|
-
regExp: /(?:\[([^[]+)\])(?:\(([^()]+)\))$/,
|
|
83
|
-
replace: (textNode, match) => {
|
|
84
|
-
const [, linkText, linkUrl] = match;
|
|
85
|
-
const linkNode = $createLinkNode(linkUrl);
|
|
86
|
-
const linkTextNode = $createTextNode(linkText);
|
|
87
|
-
linkTextNode.setFormat(textNode.getFormat());
|
|
88
|
-
linkNode.append(linkTextNode);
|
|
89
|
-
textNode.replace(linkNode);
|
|
90
|
-
},
|
|
91
|
-
trigger: ')',
|
|
92
|
-
type: 'text-match',
|
|
93
|
-
};
|
|
94
|
-
*/
|
|
95
|
-
|
|
96
|
-
const modifiedTextTransformers = [EMOJI_NODE_MARKDOWN_TRANSFORM];
|
|
97
|
-
|
|
98
|
-
export const PLAYGROUND_TRANSFORMERS: Array<Transformer> = [
|
|
99
|
-
...modifiedTextTransformers,
|
|
100
|
-
HR,
|
|
101
|
-
...ELEMENT_TRANSFORMERS,
|
|
102
|
-
|
|
103
|
-
CUSTOM_LINK_NODE_TRANSFORMER,
|
|
104
|
-
...TRANSFORMERS.splice(0, 13),
|
|
105
|
-
UNDERLINE,
|
|
106
|
-
];
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { useEffect } from "react";
|
|
2
|
-
import { useLexicalComposerContext } from "@lexical/react/LexicalComposerContext";
|
|
3
|
-
|
|
4
|
-
interface Props {
|
|
5
|
-
isDisabled?: boolean
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
// When isDisabled true, set active editor in ReadOnly mode preventing changes
|
|
9
|
-
export function ReadOnlyPlugin(props: Props): any {
|
|
10
|
-
const [editor] = useLexicalComposerContext();
|
|
11
|
-
|
|
12
|
-
useEffect(() => { editor.setEditable(!props.isDisabled); }, [editor, props.isDisabled]);
|
|
13
|
-
|
|
14
|
-
return null;
|
|
15
|
-
}
|