@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
|
@@ -1,424 +0,0 @@
|
|
|
1
|
-
import React from "react"
|
|
2
|
-
import { useLexicalComposerContext } from "@lexical/react/LexicalComposerContext";
|
|
3
|
-
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
4
|
-
import { SELECTION_CHANGE_COMMAND, FORMAT_TEXT_COMMAND, $getSelection, $isRangeSelection, $createParagraphNode, $getNodeByKey, } from "lexical";
|
|
5
|
-
import { $wrapNodes, $isAtNodeEnd } from "@lexical/selection";
|
|
6
|
-
import { $getNearestNodeOfType, mergeRegister } from "@lexical/utils";
|
|
7
|
-
import { INSERT_ORDERED_LIST_COMMAND, INSERT_UNORDERED_LIST_COMMAND, REMOVE_LIST_COMMAND, $isListNode, ListNode } from "@lexical/list";
|
|
8
|
-
import { createPortal } from "react-dom";
|
|
9
|
-
import { $createHeadingNode, $createQuoteNode, $isHeadingNode } from "@lexical/rich-text";
|
|
10
|
-
import { $isCodeNode, getDefaultCodeLanguage, getCodeLanguages, $createCodeNode } from "@lexical/code";
|
|
11
|
-
import { Icon } from "@mui/material";
|
|
12
|
-
import FloatingLinkEditor from "./customLink/FloatingLinkEditor";
|
|
13
|
-
import { TOGGLE_CUSTOM_LINK_NODE_COMMAND, $isCustomLinkNode } from "./customLink/CustomLinkNode";
|
|
14
|
-
|
|
15
|
-
const LowPriority = 1;
|
|
16
|
-
|
|
17
|
-
const supportedBlockTypes = new Set(["paragraph", "quote", "code", "h1", "h2", "h3", "h4", "ul", "ol"]);
|
|
18
|
-
|
|
19
|
-
const blockTypeToBlockName: any = {
|
|
20
|
-
code: "Code Block",
|
|
21
|
-
h1: "Large Heading",
|
|
22
|
-
h2: "Small Heading",
|
|
23
|
-
h3: "Heading",
|
|
24
|
-
h4: "Heading",
|
|
25
|
-
h5: "Heading",
|
|
26
|
-
ol: "Numbered List",
|
|
27
|
-
paragraph: "Normal",
|
|
28
|
-
quote: "Quote",
|
|
29
|
-
ul: "Bulleted List"
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
function Divider() {
|
|
33
|
-
return <div className="divider" />;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
/*
|
|
37
|
-
function positionEditorElement(editor: any, rect: any) {
|
|
38
|
-
if (rect === null) {
|
|
39
|
-
editor.style.opacity = "0";
|
|
40
|
-
editor.style.top = "-1000px";
|
|
41
|
-
editor.style.left = "-1000px";
|
|
42
|
-
} else {
|
|
43
|
-
editor.style.opacity = "1";
|
|
44
|
-
editor.style.top = `${rect.top + rect.height + window.pageYOffset + 10}px`;
|
|
45
|
-
editor.style.left = `${rect.left + window.pageXOffset - editor.offsetWidth / 2 + rect.width / 2}px`;
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
*/
|
|
49
|
-
|
|
50
|
-
function Select({ onChange, className, options, value }: { onChange: any, className: any, options: any, value: any }) {
|
|
51
|
-
return (
|
|
52
|
-
<select className={className} onChange={onChange} value={value}>
|
|
53
|
-
<option hidden={true} value="" />
|
|
54
|
-
{options.map((option: any) => (
|
|
55
|
-
<option key={option} value={option}>
|
|
56
|
-
{option}
|
|
57
|
-
</option>
|
|
58
|
-
))}
|
|
59
|
-
</select>
|
|
60
|
-
);
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
export function getSelectedNode(selection: any) {
|
|
64
|
-
const anchor = selection.anchor;
|
|
65
|
-
const focus = selection.focus;
|
|
66
|
-
const anchorNode = selection.anchor.getNode();
|
|
67
|
-
const focusNode = selection.focus.getNode();
|
|
68
|
-
if (anchorNode === focusNode) {
|
|
69
|
-
return anchorNode;
|
|
70
|
-
}
|
|
71
|
-
const isBackward = selection.isBackward();
|
|
72
|
-
if (isBackward) {
|
|
73
|
-
return $isAtNodeEnd(focus) ? anchorNode : focusNode;
|
|
74
|
-
} else {
|
|
75
|
-
return $isAtNodeEnd(anchor) ? focusNode : anchorNode;
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
function BlockOptionsDropdownList({ editor, blockType, toolbarRef, setShowBlockOptionsDropDown }: { editor: any, blockType: any, toolbarRef: any, setShowBlockOptionsDropDown: any }) {
|
|
80
|
-
const dropDownRef = useRef(null);
|
|
81
|
-
|
|
82
|
-
useEffect(() => {
|
|
83
|
-
const toolbar = toolbarRef.current;
|
|
84
|
-
const dropDown = dropDownRef.current;
|
|
85
|
-
|
|
86
|
-
if (toolbar !== null && dropDown !== null) {
|
|
87
|
-
const { top, left } = toolbar.getBoundingClientRect();
|
|
88
|
-
dropDown.style.top = `${top + 40}px`;
|
|
89
|
-
dropDown.style.left = `${left}px`;
|
|
90
|
-
}
|
|
91
|
-
}, [dropDownRef, toolbarRef]);
|
|
92
|
-
|
|
93
|
-
useEffect(() => {
|
|
94
|
-
const dropDown = dropDownRef.current;
|
|
95
|
-
const toolbar = toolbarRef.current;
|
|
96
|
-
|
|
97
|
-
if (dropDown !== null && toolbar !== null) {
|
|
98
|
-
const handle = (event: any) => {
|
|
99
|
-
const target = event.target;
|
|
100
|
-
|
|
101
|
-
if (!dropDown.contains(target) && !toolbar.contains(target)) {
|
|
102
|
-
setShowBlockOptionsDropDown(false);
|
|
103
|
-
}
|
|
104
|
-
};
|
|
105
|
-
document.addEventListener("click", handle);
|
|
106
|
-
|
|
107
|
-
return () => {
|
|
108
|
-
document.removeEventListener("click", handle);
|
|
109
|
-
};
|
|
110
|
-
}
|
|
111
|
-
}, [dropDownRef, setShowBlockOptionsDropDown, toolbarRef]);
|
|
112
|
-
|
|
113
|
-
const formatParagraph = () => {
|
|
114
|
-
if (blockType !== "paragraph") {
|
|
115
|
-
editor.update(() => {
|
|
116
|
-
const selection = $getSelection();
|
|
117
|
-
|
|
118
|
-
if ($isRangeSelection(selection)) {
|
|
119
|
-
$wrapNodes(selection, () => $createParagraphNode());
|
|
120
|
-
}
|
|
121
|
-
});
|
|
122
|
-
}
|
|
123
|
-
setShowBlockOptionsDropDown(false);
|
|
124
|
-
};
|
|
125
|
-
|
|
126
|
-
const formatLargeHeading = () => {
|
|
127
|
-
if (blockType !== "h1") {
|
|
128
|
-
editor.update(() => {
|
|
129
|
-
const selection = $getSelection();
|
|
130
|
-
|
|
131
|
-
if ($isRangeSelection(selection)) {
|
|
132
|
-
$wrapNodes(selection, () => $createHeadingNode("h1"));
|
|
133
|
-
}
|
|
134
|
-
});
|
|
135
|
-
}
|
|
136
|
-
setShowBlockOptionsDropDown(false);
|
|
137
|
-
};
|
|
138
|
-
|
|
139
|
-
const formatSmallHeading = () => {
|
|
140
|
-
if (blockType !== "h2") {
|
|
141
|
-
editor.update(() => {
|
|
142
|
-
const selection = $getSelection();
|
|
143
|
-
|
|
144
|
-
if ($isRangeSelection(selection)) {
|
|
145
|
-
$wrapNodes(selection, () => $createHeadingNode("h2"));
|
|
146
|
-
}
|
|
147
|
-
});
|
|
148
|
-
}
|
|
149
|
-
setShowBlockOptionsDropDown(false);
|
|
150
|
-
};
|
|
151
|
-
|
|
152
|
-
const formatHeading3 = () => {
|
|
153
|
-
if (blockType !== "h3") {
|
|
154
|
-
editor.update(() => {
|
|
155
|
-
const selection = $getSelection();
|
|
156
|
-
if ($isRangeSelection(selection)) { $wrapNodes(selection, () => $createHeadingNode("h3")); }
|
|
157
|
-
});
|
|
158
|
-
}
|
|
159
|
-
setShowBlockOptionsDropDown(false);
|
|
160
|
-
};
|
|
161
|
-
|
|
162
|
-
const formatHeading4 = () => {
|
|
163
|
-
if (blockType !== "h4") {
|
|
164
|
-
editor.update(() => {
|
|
165
|
-
const selection = $getSelection();
|
|
166
|
-
if ($isRangeSelection(selection)) { $wrapNodes(selection, () => $createHeadingNode("h4")); }
|
|
167
|
-
});
|
|
168
|
-
}
|
|
169
|
-
setShowBlockOptionsDropDown(false);
|
|
170
|
-
};
|
|
171
|
-
|
|
172
|
-
const formatBulletList = () => {
|
|
173
|
-
if (blockType !== "ul") {
|
|
174
|
-
editor.dispatchCommand(INSERT_UNORDERED_LIST_COMMAND);
|
|
175
|
-
} else {
|
|
176
|
-
editor.dispatchCommand(REMOVE_LIST_COMMAND);
|
|
177
|
-
}
|
|
178
|
-
setShowBlockOptionsDropDown(false);
|
|
179
|
-
};
|
|
180
|
-
|
|
181
|
-
const formatNumberedList = () => {
|
|
182
|
-
if (blockType !== "ol") {
|
|
183
|
-
editor.dispatchCommand(INSERT_ORDERED_LIST_COMMAND);
|
|
184
|
-
} else {
|
|
185
|
-
editor.dispatchCommand(REMOVE_LIST_COMMAND);
|
|
186
|
-
}
|
|
187
|
-
setShowBlockOptionsDropDown(false);
|
|
188
|
-
};
|
|
189
|
-
|
|
190
|
-
const formatQuote = () => {
|
|
191
|
-
if (blockType !== "quote") {
|
|
192
|
-
editor.update(() => {
|
|
193
|
-
const selection = $getSelection();
|
|
194
|
-
|
|
195
|
-
if ($isRangeSelection(selection)) {
|
|
196
|
-
$wrapNodes(selection, () => $createQuoteNode());
|
|
197
|
-
}
|
|
198
|
-
});
|
|
199
|
-
}
|
|
200
|
-
setShowBlockOptionsDropDown(false);
|
|
201
|
-
};
|
|
202
|
-
|
|
203
|
-
const formatCodeBlock = () => {
|
|
204
|
-
if (blockType !== "code") {
|
|
205
|
-
editor.update(() => {
|
|
206
|
-
const selection = $getSelection();
|
|
207
|
-
if ($isRangeSelection(selection)) { $wrapNodes(selection, () => $createCodeNode()); }
|
|
208
|
-
});
|
|
209
|
-
}
|
|
210
|
-
setShowBlockOptionsDropDown(false);
|
|
211
|
-
};
|
|
212
|
-
|
|
213
|
-
return (
|
|
214
|
-
<div className="dropdown" ref={dropDownRef}>
|
|
215
|
-
<button className="item" onClick={formatParagraph}>
|
|
216
|
-
<span className="icon paragraph" />
|
|
217
|
-
<span className="text">Normal</span>
|
|
218
|
-
{blockType === "paragraph" && <span className="active" />}
|
|
219
|
-
</button>
|
|
220
|
-
<button className="item" onClick={formatLargeHeading}>
|
|
221
|
-
<span className="icon large-heading" />
|
|
222
|
-
<span className="text">Large Heading</span>
|
|
223
|
-
{blockType === "h1" && <span className="active" />}
|
|
224
|
-
</button>
|
|
225
|
-
<button className="item" onClick={formatSmallHeading}>
|
|
226
|
-
<span className="icon small-heading" />
|
|
227
|
-
<span className="text">Small Heading</span>
|
|
228
|
-
{blockType === "h2" && <span className="active" />}
|
|
229
|
-
</button>
|
|
230
|
-
<button className="item" onClick={formatHeading3}>
|
|
231
|
-
<span className="icon h3" />
|
|
232
|
-
<span className="text">Heading 3</span>
|
|
233
|
-
{blockType === "h4" && <span className="active" />}
|
|
234
|
-
</button>
|
|
235
|
-
<button className="item" onClick={formatHeading4}>
|
|
236
|
-
<span className="icon h4" />
|
|
237
|
-
<span className="text">Heading 4</span>
|
|
238
|
-
{blockType === "h4" && <span className="active" />}
|
|
239
|
-
</button>
|
|
240
|
-
<button className="item" onClick={formatBulletList}>
|
|
241
|
-
<span className="icon bullet-list" />
|
|
242
|
-
<span className="text">Bullet List</span>
|
|
243
|
-
{blockType === "ul" && <span className="active" />}
|
|
244
|
-
</button>
|
|
245
|
-
<button className="item" onClick={formatNumberedList}>
|
|
246
|
-
<span className="icon numbered-list" />
|
|
247
|
-
<span className="text">Numbered List</span>
|
|
248
|
-
{blockType === "ol" && <span className="active" />}
|
|
249
|
-
</button>
|
|
250
|
-
<button className="item" onClick={formatQuote}>
|
|
251
|
-
<span className="icon quote" />
|
|
252
|
-
<span className="text">Quote</span>
|
|
253
|
-
{blockType === "quote" && <span className="active" />}
|
|
254
|
-
</button>
|
|
255
|
-
<button className="item" onClick={formatCodeBlock}>
|
|
256
|
-
<span className="icon code" />
|
|
257
|
-
<span className="text">Code</span>
|
|
258
|
-
{blockType === "code" && <span className="active" />}
|
|
259
|
-
</button>
|
|
260
|
-
</div>
|
|
261
|
-
);
|
|
262
|
-
}
|
|
263
|
-
|
|
264
|
-
interface Props {
|
|
265
|
-
goFullScreen: () => void
|
|
266
|
-
}
|
|
267
|
-
|
|
268
|
-
export function ToolbarPlugin(props: Props) {
|
|
269
|
-
const [editor] = useLexicalComposerContext();
|
|
270
|
-
const toolbarRef = useRef(null);
|
|
271
|
-
const [blockType, setBlockType] = useState("paragraph");
|
|
272
|
-
const [selectedElementKey, setSelectedElementKey] = useState(null);
|
|
273
|
-
const [showBlockOptionsDropDown, setShowBlockOptionsDropDown] = useState(false);
|
|
274
|
-
const [codeLanguage, setCodeLanguage] = useState("");
|
|
275
|
-
const [isLink, setIsLink] = useState(false);
|
|
276
|
-
const [isBold, setIsBold] = useState(false);
|
|
277
|
-
const [isItalic, setIsItalic] = useState(false);
|
|
278
|
-
const [isUnderline, setIsUnderline] = useState(false);
|
|
279
|
-
const [isCode, setIsCode] = useState(false);
|
|
280
|
-
//const [isStrikethrough, setIsStrikethrough] = useState(false);
|
|
281
|
-
const [linkUrl, setLinkUrl] = useState<string>("https://");
|
|
282
|
-
const [targetAttribute, setTargetAttribute] = useState<string>("_self");
|
|
283
|
-
const [classNamesList, setClassNamesList] = useState<Array<string>>(["primary"]);
|
|
284
|
-
|
|
285
|
-
const updateToolbar = useCallback(() => {
|
|
286
|
-
const selection = $getSelection();
|
|
287
|
-
if ($isRangeSelection(selection)) {
|
|
288
|
-
const anchorNode = selection.anchor.getNode();
|
|
289
|
-
const element = anchorNode.getKey() === "root" ? anchorNode : anchorNode.getTopLevelElementOrThrow();
|
|
290
|
-
const elementKey = element.getKey();
|
|
291
|
-
const elementDOM = editor.getElementByKey(elementKey);
|
|
292
|
-
if (elementDOM !== null) {
|
|
293
|
-
setSelectedElementKey(elementKey);
|
|
294
|
-
if ($isListNode(element)) {
|
|
295
|
-
const parentList = $getNearestNodeOfType(anchorNode, ListNode);
|
|
296
|
-
const type = parentList ? parentList.getTag() : element.getTag();
|
|
297
|
-
setBlockType(type);
|
|
298
|
-
} else {
|
|
299
|
-
const type = $isHeadingNode(element) ? element.getTag() : element.getType();
|
|
300
|
-
setBlockType(type);
|
|
301
|
-
if ($isCodeNode(element)) {
|
|
302
|
-
setCodeLanguage(element.getLanguage() || getDefaultCodeLanguage());
|
|
303
|
-
}
|
|
304
|
-
}
|
|
305
|
-
}
|
|
306
|
-
// Update text format
|
|
307
|
-
setIsBold(selection.hasFormat("bold"));
|
|
308
|
-
setIsItalic(selection.hasFormat("italic"));
|
|
309
|
-
setIsUnderline(selection.hasFormat("underline"));
|
|
310
|
-
setIsCode(selection.hasFormat("code"));
|
|
311
|
-
//setIsStrikethrough(selection.hasFormat("strikethrough"));
|
|
312
|
-
|
|
313
|
-
// Update links
|
|
314
|
-
const node = getSelectedNode(selection);
|
|
315
|
-
const parent = node.getParent();
|
|
316
|
-
if ($isCustomLinkNode(parent) || $isCustomLinkNode(node)) {
|
|
317
|
-
setIsLink(true);
|
|
318
|
-
} else {
|
|
319
|
-
setIsLink(false);
|
|
320
|
-
}
|
|
321
|
-
}
|
|
322
|
-
}, [editor]);
|
|
323
|
-
|
|
324
|
-
useEffect(() =>
|
|
325
|
-
mergeRegister(
|
|
326
|
-
editor.registerUpdateListener(({ editorState }) => {
|
|
327
|
-
editorState.read(() => {
|
|
328
|
-
updateToolbar();
|
|
329
|
-
});
|
|
330
|
-
}),
|
|
331
|
-
editor.registerCommand(
|
|
332
|
-
SELECTION_CHANGE_COMMAND,
|
|
333
|
-
(_payload, newEditor) => {
|
|
334
|
-
updateToolbar();
|
|
335
|
-
return false;
|
|
336
|
-
},
|
|
337
|
-
LowPriority
|
|
338
|
-
)
|
|
339
|
-
), [editor, updateToolbar]);
|
|
340
|
-
|
|
341
|
-
const codeLanguges = useMemo(() => getCodeLanguages(), []);
|
|
342
|
-
const onCodeLanguageSelect = useCallback(
|
|
343
|
-
(e: any) => {
|
|
344
|
-
editor.update(() => {
|
|
345
|
-
if (selectedElementKey !== null) {
|
|
346
|
-
const node = $getNodeByKey(selectedElementKey);
|
|
347
|
-
if ($isCodeNode(node)) {
|
|
348
|
-
node.setLanguage(e.target.value);
|
|
349
|
-
}
|
|
350
|
-
}
|
|
351
|
-
});
|
|
352
|
-
},
|
|
353
|
-
[editor, selectedElementKey]
|
|
354
|
-
);
|
|
355
|
-
|
|
356
|
-
const insertLink = useCallback(() => {
|
|
357
|
-
editor.dispatchCommand(TOGGLE_CUSTOM_LINK_NODE_COMMAND, {
|
|
358
|
-
url: linkUrl,
|
|
359
|
-
classNames: classNamesList,
|
|
360
|
-
target: targetAttribute
|
|
361
|
-
});
|
|
362
|
-
}, [editor, isLink]); //eslint-disable-line
|
|
363
|
-
|
|
364
|
-
const editorEl = (typeof window !== 'undefined') && window.document.getElementById('elementEditDialog');
|
|
365
|
-
const portalKey = editorEl ? editorEl : document.body;
|
|
366
|
-
|
|
367
|
-
return (
|
|
368
|
-
<div className="toolbar" ref={toolbarRef}>
|
|
369
|
-
{supportedBlockTypes.has(blockType) && (
|
|
370
|
-
<>
|
|
371
|
-
<button
|
|
372
|
-
className="toolbar-item block-controls"
|
|
373
|
-
onClick={() => setShowBlockOptionsDropDown(!showBlockOptionsDropDown)}
|
|
374
|
-
aria-label="Formatting Options"
|
|
375
|
-
>
|
|
376
|
-
<span className={"icon block-type " + blockType} />
|
|
377
|
-
<span className="text">{
|
|
378
|
-
blockTypeToBlockName[blockType]
|
|
379
|
-
}</span>
|
|
380
|
-
<i className="chevron-down" />
|
|
381
|
-
</button>
|
|
382
|
-
{showBlockOptionsDropDown
|
|
383
|
-
&& createPortal(
|
|
384
|
-
<BlockOptionsDropdownList
|
|
385
|
-
editor={editor}
|
|
386
|
-
blockType={blockType}
|
|
387
|
-
toolbarRef={toolbarRef}
|
|
388
|
-
setShowBlockOptionsDropDown={setShowBlockOptionsDropDown}
|
|
389
|
-
/>,
|
|
390
|
-
portalKey
|
|
391
|
-
)}
|
|
392
|
-
<Divider />
|
|
393
|
-
</>
|
|
394
|
-
)}
|
|
395
|
-
{blockType === "code"
|
|
396
|
-
? (<>
|
|
397
|
-
<Select className="toolbar-item code-language" onChange={onCodeLanguageSelect} options={codeLanguges} value={codeLanguage} />
|
|
398
|
-
<i className="chevron-down inside" />
|
|
399
|
-
</>)
|
|
400
|
-
: (<>
|
|
401
|
-
<button onClick={() => { editor.dispatchCommand(FORMAT_TEXT_COMMAND, "bold"); }} className={"toolbar-item spaced " + (isBold ? "active" : "")} aria-label="Format Bold">
|
|
402
|
-
<i className="format bold" />
|
|
403
|
-
</button>
|
|
404
|
-
<button onClick={() => { editor.dispatchCommand(FORMAT_TEXT_COMMAND, "italic"); }} className={"toolbar-item spaced " + (isItalic ? "active" : "")} aria-label="Format Italics">
|
|
405
|
-
<i className="format italic" />
|
|
406
|
-
</button>
|
|
407
|
-
<button onClick={() => { editor.dispatchCommand(FORMAT_TEXT_COMMAND, "underline"); }} className={"toolbar-item spaced " + (isUnderline ? "active" : "")} aria-label="Format Underline">
|
|
408
|
-
<i className="format underline" />
|
|
409
|
-
</button>
|
|
410
|
-
<button onClick={insertLink} className={"toolbar-item spaced " + (isLink ? "active" : "")} aria-label="Insert Link">
|
|
411
|
-
<i className="format link" />
|
|
412
|
-
</button>
|
|
413
|
-
<button onClick={() => { editor.dispatchCommand(FORMAT_TEXT_COMMAND, "code"); }} className={"toolbar-item spaced " + (isCode ? "active" : "")} aria-label="Format Code">
|
|
414
|
-
<i className="format code" />
|
|
415
|
-
</button>
|
|
416
|
-
{isLink && createPortal(<FloatingLinkEditor selectedElementKey={selectedElementKey} linkUrl={linkUrl} setLinkUrl={setLinkUrl} classNamesList={classNamesList} setClassNamesList={setClassNamesList} targetAttribute={targetAttribute} setTargetAttribute={setTargetAttribute} />, portalKey)}
|
|
417
|
-
</>)}
|
|
418
|
-
<Divider />
|
|
419
|
-
<button onClick={() => { props.goFullScreen() }} className="toolbar-item spaced" aria-label="Full Screen">
|
|
420
|
-
<Icon>fullscreen</Icon>
|
|
421
|
-
</button>
|
|
422
|
-
</div>
|
|
423
|
-
);
|
|
424
|
-
}
|
|
@@ -1,224 +0,0 @@
|
|
|
1
|
-
import { LexicalNode, createCommand, LexicalCommand, $isElementNode, $getSelection, ElementNode, NodeKey, $applyNodeReplacement, $isRangeSelection } from "lexical";
|
|
2
|
-
import { LinkNode } from "@lexical/link";
|
|
3
|
-
import utils from "@lexical/utils";
|
|
4
|
-
|
|
5
|
-
export interface LinkCustomizationAttributes {
|
|
6
|
-
url: string;
|
|
7
|
-
target?: string;
|
|
8
|
-
classNames?: Array<string>;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export class CustomLinkNode extends LinkNode {
|
|
12
|
-
__url: string;
|
|
13
|
-
__target: string;
|
|
14
|
-
__classNames: Array<string>;
|
|
15
|
-
constructor(
|
|
16
|
-
url: string,
|
|
17
|
-
target: string,
|
|
18
|
-
classNames: Array<string>,
|
|
19
|
-
key?: NodeKey
|
|
20
|
-
) {
|
|
21
|
-
super(url, { target }, key);
|
|
22
|
-
this.__url = url || "https://";
|
|
23
|
-
this.__target = target || "_self";
|
|
24
|
-
this.__classNames = classNames || [];
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
static importJSON(serializedNode: any) {
|
|
28
|
-
return super.importJSON(serializedNode);
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
exportJSON() {
|
|
32
|
-
return super.exportJSON();
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
static getType() : string {
|
|
36
|
-
return "customlinknode";
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
static clone(node : CustomLinkNode) : CustomLinkNode {
|
|
40
|
-
const newLinkNode = new CustomLinkNode(node.__url, node.__target, node.__classNames, node.__key);
|
|
41
|
-
|
|
42
|
-
return $applyNodeReplacement(newLinkNode);
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
createDOM() {
|
|
46
|
-
const link = document.createElement("a");
|
|
47
|
-
|
|
48
|
-
link.href = this.__url;
|
|
49
|
-
|
|
50
|
-
link.setAttribute("target", this.__target || "_blank");
|
|
51
|
-
|
|
52
|
-
utils.addClassNamesToElement(link, (this.__classNames || []).join(" "));
|
|
53
|
-
|
|
54
|
-
return link;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
updateDOM(): boolean {
|
|
58
|
-
return false;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
setClassNames(classNames : Array<string>) : void {
|
|
62
|
-
const writable = this.getWritable();
|
|
63
|
-
|
|
64
|
-
writable.__classNames = classNames;
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
export const TOGGLE_CUSTOM_LINK_NODE_COMMAND: LexicalCommand<LinkCustomizationAttributes> = createCommand();
|
|
69
|
-
|
|
70
|
-
export function $createCustomLinkNode(
|
|
71
|
-
url: string,
|
|
72
|
-
target: string,
|
|
73
|
-
classNames: Array<string>
|
|
74
|
-
): CustomLinkNode {
|
|
75
|
-
return $applyNodeReplacement(new CustomLinkNode(url, target, classNames));
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
export function $isCustomLinkNode(
|
|
79
|
-
node: LexicalNode | null | undefined | any
|
|
80
|
-
): node is CustomLinkNode {
|
|
81
|
-
return node instanceof LinkNode;
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
export const toggleCustomLinkNode = (
|
|
85
|
-
{
|
|
86
|
-
url,
|
|
87
|
-
target = "_blank",
|
|
88
|
-
classNames = [],
|
|
89
|
-
getNodeByKey
|
|
90
|
-
} : LinkCustomizationAttributes & {
|
|
91
|
-
getNodeByKey: (key: NodeKey) => HTMLElement | null;
|
|
92
|
-
}): void => {
|
|
93
|
-
const addAttributesToLinkNode = (linkNode: CustomLinkNode, { url, target, classNames}: LinkCustomizationAttributes) => {
|
|
94
|
-
const dom = getNodeByKey(linkNode.getKey());
|
|
95
|
-
|
|
96
|
-
if (!dom) return;
|
|
97
|
-
|
|
98
|
-
const uniqueClassNames = classNames;
|
|
99
|
-
|
|
100
|
-
linkNode.setURL(url);
|
|
101
|
-
linkNode.setTarget(target);
|
|
102
|
-
|
|
103
|
-
linkNode.setClassNames(uniqueClassNames);
|
|
104
|
-
|
|
105
|
-
dom.setAttribute("href", url);
|
|
106
|
-
dom.setAttribute("target", target);
|
|
107
|
-
|
|
108
|
-
dom.setAttribute("class", uniqueClassNames.join(" "));
|
|
109
|
-
};
|
|
110
|
-
|
|
111
|
-
const selection = $getSelection();
|
|
112
|
-
|
|
113
|
-
if (!$isRangeSelection(selection)) {
|
|
114
|
-
return;
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
const nodes = selection.extract();
|
|
118
|
-
|
|
119
|
-
if (url === null) {
|
|
120
|
-
// Remove LinkNodes
|
|
121
|
-
nodes.forEach((node) => {
|
|
122
|
-
const parent = node.getParent();
|
|
123
|
-
|
|
124
|
-
if ($isCustomLinkNode(parent)) {
|
|
125
|
-
const children = parent.getChildren();
|
|
126
|
-
|
|
127
|
-
for (let i = 0; i < children.length; i++) {
|
|
128
|
-
parent.insertBefore(children[i]);
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
parent.remove();
|
|
132
|
-
}
|
|
133
|
-
});
|
|
134
|
-
} else {
|
|
135
|
-
// Add or merge LinkNodes
|
|
136
|
-
if (nodes.length === 1) {
|
|
137
|
-
const firstNode = nodes[0];
|
|
138
|
-
// if the first node is a LinkNode or if its
|
|
139
|
-
// parent is a LinkNode, we update the URL, target and rel.
|
|
140
|
-
const linkNode = $isCustomLinkNode(firstNode)
|
|
141
|
-
? firstNode
|
|
142
|
-
: $getLinkAncestor(firstNode);
|
|
143
|
-
if (linkNode !== null && $isCustomLinkNode(linkNode)) {
|
|
144
|
-
addAttributesToLinkNode(linkNode, {url, target, classNames});
|
|
145
|
-
return;
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
let prevParent: ElementNode | LinkNode | null = null;
|
|
150
|
-
let linkNode: LinkNode | null = null;
|
|
151
|
-
|
|
152
|
-
nodes.forEach((node) => {
|
|
153
|
-
const parent = node.getParent();
|
|
154
|
-
|
|
155
|
-
if (
|
|
156
|
-
parent === linkNode
|
|
157
|
-
|| parent === null
|
|
158
|
-
|| ($isElementNode(node) && !node.isInline())
|
|
159
|
-
) {
|
|
160
|
-
return;
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
if ($isCustomLinkNode(parent)) {
|
|
164
|
-
linkNode = parent;
|
|
165
|
-
|
|
166
|
-
addAttributesToLinkNode(parent, {url, target, classNames});
|
|
167
|
-
|
|
168
|
-
return;
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
if (!parent.is(prevParent)) {
|
|
172
|
-
prevParent = parent;
|
|
173
|
-
linkNode = $createCustomLinkNode(url, target, classNames);
|
|
174
|
-
|
|
175
|
-
if ($isCustomLinkNode(parent)) {
|
|
176
|
-
if (node.getPreviousSibling() === null) {
|
|
177
|
-
parent.insertBefore(linkNode);
|
|
178
|
-
} else {
|
|
179
|
-
parent.insertAfter(linkNode);
|
|
180
|
-
}
|
|
181
|
-
} else {
|
|
182
|
-
node.insertBefore(linkNode);
|
|
183
|
-
}
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
if ($isCustomLinkNode(node)) {
|
|
187
|
-
if (node.is(linkNode)) {
|
|
188
|
-
return;
|
|
189
|
-
}
|
|
190
|
-
if (linkNode !== null) {
|
|
191
|
-
const children = node.getChildren();
|
|
192
|
-
|
|
193
|
-
for (let i = 0; i < children.length; i++) {
|
|
194
|
-
linkNode.append(children[i]);
|
|
195
|
-
}
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
node.remove();
|
|
199
|
-
return;
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
if (linkNode !== null) {
|
|
203
|
-
linkNode.append(node);
|
|
204
|
-
}
|
|
205
|
-
});
|
|
206
|
-
}
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
const $getLinkAncestor = (node: LexicalNode): null | LexicalNode => (
|
|
210
|
-
$getAncestor(node, (ancestor) => $isCustomLinkNode(ancestor))
|
|
211
|
-
)
|
|
212
|
-
|
|
213
|
-
const $getAncestor = (
|
|
214
|
-
node: LexicalNode,
|
|
215
|
-
predicate: (ancestor: LexicalNode) => boolean
|
|
216
|
-
): null | LexicalNode => {
|
|
217
|
-
let parent: null | LexicalNode = node;
|
|
218
|
-
while (
|
|
219
|
-
parent !== null
|
|
220
|
-
&& (parent = parent.getParent()) !== null
|
|
221
|
-
&& !predicate(parent)
|
|
222
|
-
);
|
|
223
|
-
return parent;
|
|
224
|
-
}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { FC, useEffect } from "react";
|
|
2
|
-
import { useLexicalComposerContext } from "@lexical/react/LexicalComposerContext";
|
|
3
|
-
import {
|
|
4
|
-
LinkCustomizationAttributes,
|
|
5
|
-
toggleCustomLinkNode,
|
|
6
|
-
TOGGLE_CUSTOM_LINK_NODE_COMMAND
|
|
7
|
-
} from "./CustomLinkNode";
|
|
8
|
-
|
|
9
|
-
const COMMAND_PRIORITY = 1;
|
|
10
|
-
|
|
11
|
-
const CustomLinkNodePlugin: FC = () => {
|
|
12
|
-
const [editor] = useLexicalComposerContext();
|
|
13
|
-
|
|
14
|
-
useEffect(() => {
|
|
15
|
-
editor.registerCommand(
|
|
16
|
-
TOGGLE_CUSTOM_LINK_NODE_COMMAND,
|
|
17
|
-
(props: LinkCustomizationAttributes) => {
|
|
18
|
-
toggleCustomLinkNode({
|
|
19
|
-
...props,
|
|
20
|
-
getNodeByKey: (key: string) => editor.getElementByKey(key)
|
|
21
|
-
});
|
|
22
|
-
|
|
23
|
-
return true;
|
|
24
|
-
},
|
|
25
|
-
COMMAND_PRIORITY
|
|
26
|
-
);
|
|
27
|
-
}, [editor]);
|
|
28
|
-
|
|
29
|
-
return null;
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
export default CustomLinkNodePlugin;
|