@edifice.io/react 2.6.10-develop-pedago.20261022131512 → 2.6.10-develop-b2school.20261023141442
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/Checkbox/Checkbox.js +1 -1
- package/dist/components/Layout/Layout.js +12 -4
- package/dist/components/Layout/components/Header.js +4 -4
- package/dist/components/Layout/components/NavLink.d.ts +3 -3
- package/dist/components/Layout/components/NavLink.js +5 -3
- package/dist/editor.js +0 -2
- package/dist/homepage.js +74 -24
- package/dist/hooks/useZendeskGuide/useZendeskGuide.d.ts +2 -6
- package/dist/hooks/useZendeskGuide/useZendeskGuide.js +11 -8
- package/dist/icons.js +406 -402
- package/dist/modules/HelpZone/HelpZone.js +6 -8
- package/dist/modules/HelpZone/HelpZoneContainer.js +2 -5
- package/dist/modules/editor/components/BubbleMenuEditImage/BubbleMenuEditImage.js +91 -110
- package/dist/modules/editor/components/BubbleMenuEditInformationPane/BubbleMenuEditInformationPane.js +96 -123
- package/dist/modules/editor/components/Editor/Editor.d.ts +5 -0
- package/dist/modules/editor/components/Editor/Editor.js +3 -0
- package/dist/modules/editor/components/EditorToolbar/EditorToolbar.HighlightColor.js +8 -5
- package/dist/modules/editor/components/EditorToolbar/EditorToolbar.TextColor.js +8 -5
- package/dist/modules/editor/components/EditorToolbar/EditorToolbar.Typography.js +2 -3
- package/dist/modules/editor/components/EditorToolbar/EditorToolbar.js +4 -6
- package/dist/modules/editor/components/Toolbar/LinkToolbar.TippyOptions.d.ts +2 -0
- package/dist/modules/editor/components/Toolbar/LinkToolbar.TippyOptions.js +8 -0
- package/dist/modules/editor/components/Toolbar/LinkToolbar.d.ts +3 -6
- package/dist/modules/editor/components/Toolbar/LinkToolbar.js +7 -29
- package/dist/modules/editor/components/Toolbar/TableToolbar.CellColor.js +2 -3
- package/dist/modules/editor/components/Toolbar/TableToolbar.js +45 -65
- package/dist/modules/editor/hooks/index.d.ts +0 -1
- package/dist/modules/editor/hooks/useCommentEditor.d.ts +1 -1
- package/dist/modules/editor/hooks/useCommentEditor.js +4 -12
- package/dist/modules/editor/hooks/useLinkToolbar.d.ts +2 -2
- package/dist/modules/editor/hooks/useLinkToolbar.js +1 -2
- package/dist/modules/editor/hooks/useTipTapEditor.d.ts +3 -3
- package/dist/modules/editor/hooks/useTipTapEditor.js +24 -81
- package/dist/modules/homepage/components/Agenda/Agenda.d.ts +10 -0
- package/dist/modules/homepage/components/Agenda/Agenda.js +54 -0
- package/dist/modules/homepage/components/Agenda/AgendaContainer.d.ts +1 -0
- package/dist/modules/homepage/components/Agenda/AgendaContainer.js +14 -0
- package/dist/modules/homepage/components/Agenda/AgendaEventCard.d.ts +10 -0
- package/dist/modules/homepage/components/Agenda/AgendaEventCard.js +30 -0
- package/dist/modules/homepage/components/Agenda/hooks/useAgendaContainer.d.ts +14 -0
- package/dist/modules/homepage/components/Agenda/hooks/useAgendaContainer.js +27 -0
- package/dist/modules/homepage/components/Agenda/index.d.ts +3 -0
- package/dist/modules/homepage/components/Agenda/services/api/agendaService.d.ts +24 -0
- package/dist/modules/homepage/components/Agenda/services/api/agendaService.js +45 -0
- package/dist/modules/homepage/components/Agenda/services/api/index.d.ts +4 -0
- package/dist/modules/homepage/components/Agenda/services/api/index.js +5 -0
- package/dist/modules/homepage/components/Agenda/services/queries/agenda.d.ts +19 -0
- package/dist/modules/homepage/components/Agenda/services/queries/agenda.js +26 -0
- package/dist/modules/homepage/components/BriefMe/BriefMe.d.ts +9 -0
- package/dist/modules/homepage/components/BriefMe/BriefMe.js +59 -0
- package/dist/modules/homepage/components/BriefMe/BriefMeContainer.d.ts +4 -0
- package/dist/modules/homepage/components/BriefMe/BriefMeContainer.js +17 -0
- package/dist/modules/homepage/components/BriefMe/index.d.ts +4 -0
- package/dist/modules/homepage/components/BriefMe/types.d.ts +17 -0
- package/dist/modules/homepage/components/BriefMe/types.js +8 -0
- package/dist/modules/homepage/components/BriefMe/useBriefMe.d.ts +31 -0
- package/dist/modules/homepage/components/BriefMe/useBriefMe.js +51 -0
- package/dist/modules/homepage/components/Cantine/Cantine.d.ts +7 -0
- package/dist/modules/homepage/components/Cantine/Cantine.js +44 -0
- package/dist/modules/homepage/components/Cantine/CantineContainer.d.ts +4 -0
- package/dist/modules/homepage/components/Cantine/CantineContainer.js +18 -0
- package/dist/modules/homepage/components/Cantine/CantineModal.d.ts +24 -0
- package/dist/modules/homepage/components/Cantine/CantineModal.js +88 -0
- package/dist/modules/homepage/components/Cantine/CantineModalContainer.d.ts +7 -0
- package/dist/modules/homepage/components/Cantine/CantineModalContainer.js +12 -0
- package/dist/modules/homepage/components/Cantine/components/CantineLegend.d.ts +5 -0
- package/dist/modules/homepage/components/Cantine/components/CantineLegend.js +22 -0
- package/dist/modules/homepage/components/Cantine/components/CantineMenuSection.d.ts +6 -0
- package/dist/modules/homepage/components/Cantine/components/CantineMenuSection.js +28 -0
- package/dist/modules/homepage/components/Cantine/components/cantineLabels.d.ts +12 -0
- package/dist/modules/homepage/components/Cantine/components/cantineLabels.js +60 -0
- package/dist/modules/homepage/components/Cantine/hooks/useCantine.d.ts +11 -0
- package/dist/modules/homepage/components/Cantine/hooks/useCantine.js +20 -0
- package/dist/modules/homepage/components/Cantine/hooks/useCantineMenu.d.ts +24 -0
- package/dist/modules/homepage/components/Cantine/hooks/useCantineMenu.js +65 -0
- package/dist/modules/homepage/components/Cantine/hooks/useCantineModal.d.ts +23 -0
- package/dist/modules/homepage/components/Cantine/hooks/useCantineModal.js +43 -0
- package/dist/modules/homepage/components/Cantine/index.d.ts +7 -0
- package/dist/modules/homepage/components/Cantine/types.d.ts +42 -0
- package/dist/modules/homepage/components/Communities/Communities.js +4 -4
- package/dist/modules/homepage/components/GenerationHdf/GenerationHdf.d.ts +16 -0
- package/dist/modules/homepage/components/GenerationHdf/GenerationHdf.js +48 -0
- package/dist/modules/homepage/components/GenerationHdf/GenerationHdfContainer.d.ts +4 -0
- package/dist/modules/homepage/components/GenerationHdf/GenerationHdfContainer.js +12 -0
- package/dist/modules/homepage/components/GenerationHdf/formatSolde.d.ts +1 -0
- package/dist/modules/homepage/components/GenerationHdf/formatSolde.js +6 -0
- package/dist/modules/homepage/components/GenerationHdf/index.d.ts +3 -0
- package/dist/modules/homepage/components/GenerationHdf/useGenerationHdf.d.ts +10 -0
- package/dist/modules/homepage/components/GenerationHdf/useGenerationHdf.js +68 -0
- package/dist/modules/homepage/components/Header/AccountActionListPopover.d.ts +13 -0
- package/dist/modules/homepage/components/Header/AccountActionListPopover.js +26 -0
- package/dist/modules/homepage/components/Header/ActionItem.d.ts +38 -0
- package/dist/modules/homepage/components/Header/ActionItem.js +34 -0
- package/dist/modules/homepage/components/Header/Header.js +28 -22
- package/dist/modules/homepage/components/Header/MyAppsPopover.d.ts +5 -0
- package/dist/modules/homepage/components/Header/MyAppsPopover.js +28 -0
- package/dist/modules/homepage/components/Header/useSafeHoverPopover.js +32 -0
- package/dist/modules/homepage/components/HomeCard/HomeCardHeader.d.ts +5 -1
- package/dist/modules/homepage/components/HomeCard/HomeCardHeader.js +1 -1
- package/dist/modules/homepage/components/MessageFlashList/MessageFlash.js +1 -1
- package/dist/modules/homepage/components/Notifications/NotificationList.js +7 -8
- package/dist/modules/homepage/components/Notifications/NotificationListSkeleton.js +7 -12
- package/dist/modules/homepage/components/Notifications/NotificationSkeleton.js +7 -4
- package/dist/modules/homepage/components/Notifications/components/NotificationFilterMenu.js +1 -5
- package/dist/modules/homepage/components/Notifications/components/NotificationFilterModal.js +10 -12
- package/dist/modules/homepage/components/Notifications/components/NotificationOptionsMenu.js +3 -9
- package/dist/modules/homepage/components/Notifications/components/ReportNotificationModal.js +6 -12
- package/dist/modules/homepage/components/Notifications/components/notificationAdapter.js +12 -10
- package/dist/modules/homepage/components/Notifications/hooks/useNotificationList.js +9 -10
- package/dist/modules/homepage/components/Qwant/Qwant.d.ts +4 -0
- package/dist/modules/homepage/components/Qwant/Qwant.js +41 -0
- package/dist/modules/homepage/components/Qwant/QwantContainer.d.ts +1 -0
- package/dist/modules/homepage/components/Qwant/QwantContainer.js +10 -0
- package/dist/modules/homepage/components/Qwant/index.d.ts +3 -0
- package/dist/modules/homepage/components/Rss/Rss.d.ts +11 -0
- package/dist/modules/homepage/components/Rss/Rss.js +64 -0
- package/dist/modules/homepage/components/Rss/RssContainer.d.ts +1 -0
- package/dist/modules/homepage/components/Rss/RssContainer.js +45 -0
- package/dist/modules/homepage/components/Rss/RssFeedForm.d.ts +13 -0
- package/dist/modules/homepage/components/Rss/RssFeedForm.js +69 -0
- package/dist/modules/homepage/components/Rss/RssFeedsModal.d.ts +11 -0
- package/dist/modules/homepage/components/Rss/RssFeedsModal.js +58 -0
- package/dist/modules/homepage/components/Rss/hooks/useRssContainer.d.ts +25 -0
- package/dist/modules/homepage/components/Rss/hooks/useRssContainer.js +43 -0
- package/dist/modules/homepage/components/Rss/index.d.ts +6 -0
- package/dist/modules/homepage/components/Rss/services/api/index.d.ts +5 -0
- package/dist/modules/homepage/components/Rss/services/api/index.js +5 -0
- package/dist/modules/homepage/components/Rss/services/api/rssService.d.ts +38 -0
- package/dist/modules/homepage/components/Rss/services/api/rssService.js +51 -0
- package/dist/modules/homepage/components/Rss/services/queries/rss.d.ts +28 -0
- package/dist/modules/homepage/components/Rss/services/queries/rss.js +71 -0
- package/dist/modules/homepage/components/Rss/types.d.ts +25 -0
- package/dist/modules/homepage/components/Rss/utils.d.ts +7 -0
- package/dist/modules/homepage/components/Rss/utils.js +19 -0
- package/dist/modules/homepage/components/SchoolSpace/SchoolSpaceContainer.js +1 -1
- package/dist/modules/homepage/components/Universalis/Universalis.d.ts +8 -0
- package/dist/modules/homepage/components/Universalis/Universalis.js +62 -0
- package/dist/modules/homepage/components/Universalis/UniversalisContainer.d.ts +1 -0
- package/dist/modules/homepage/components/Universalis/UniversalisContainer.js +16 -0
- package/dist/modules/homepage/components/Universalis/index.d.ts +3 -0
- package/dist/modules/homepage/components/UsefulLinks/UsefulLinks.js +2 -2
- package/dist/modules/homepage/components/UsefulLinks/UsefulLinksModal.js +2 -2
- package/dist/modules/homepage/components/UserSpace/UserSpace.d.ts +3 -1
- package/dist/modules/homepage/components/UserSpace/UserSpace.js +13 -7
- package/dist/modules/homepage/components/UserSpace/UserSpaceContainer.d.ts +4 -2
- package/dist/modules/homepage/components/UserSpace/UserSpaceContainer.js +3 -2
- package/dist/modules/homepage/components/WidgetsPersonalizationPanel/WidgetToggle.d.ts +16 -0
- package/dist/modules/homepage/components/WidgetsPersonalizationPanel/WidgetToggle.js +15 -0
- package/dist/modules/homepage/components/WidgetsPersonalizationPanel/WidgetsPersonalizationPanel.d.ts +21 -0
- package/dist/modules/homepage/components/WidgetsPersonalizationPanel/WidgetsPersonalizationPanel.js +47 -0
- package/dist/modules/homepage/components/WidgetsPersonalizationPanel/index.d.ts +2 -0
- package/dist/modules/homepage/components/index.d.ts +9 -1
- package/dist/modules/homepage/{components/SchoolSpace → hooks}/useUserSchools.d.ts +2 -2
- package/dist/modules/homepage/{components/SchoolSpace → hooks}/useUserSchools.js +4 -4
- package/dist/modules/icons/components/IconAddWidget.d.ts +7 -0
- package/dist/modules/icons/components/IconAddWidget.js +12 -0
- package/dist/modules/icons/components/IconLogout.d.ts +7 -0
- package/dist/modules/icons/components/IconLogout.js +13 -0
- package/dist/modules/icons/components/index.d.ts +2 -0
- package/dist/modules/multimedia/Linker/InternalLinker/InternalLinker.d.ts +1 -7
- package/dist/modules/multimedia/Linker/InternalLinker/InternalLinker.js +0 -2
- package/dist/modules/multimedia/MediaLibrary/MediaLibrary.d.ts +0 -2
- package/dist/modules/multimedia/MediaLibrary/MediaLibrary.js +0 -2
- package/dist/modules/multimedia/MediaLibrary/MediaLibraryContext.d.ts +0 -4
- package/dist/modules/multimedia/MediaLibrary/innertabs/Upload.js +1 -2
- package/dist/modules/multimedia/MediaLibrary/innertabs/Workspace.js +0 -3
- package/package.json +43 -35
- package/dist/modules/editor/components/Toolbar/FloatingMenuOptions.d.ts +0 -29
- package/dist/modules/editor/components/Toolbar/FloatingMenuOptions.js +0 -22
- package/dist/modules/editor/hooks/useEditorState.d.ts +0 -20
- package/dist/modules/editor/hooks/useEditorState.js +0 -16
- package/dist/node_modules/.pnpm/@tiptap_extension-floating-menu@3.32.0_@floating-ui_dom@1.6.0_@tiptap_core@3.32.0_@tiptap_pm@3.32.0__@tiptap_pm@3.32.0/node_modules/@tiptap/extension-floating-menu/dist/index.js +0 -159
- package/dist/node_modules/.pnpm/@tiptap_react@3.32.0_@floating-ui_dom@1.6.0_@tiptap_core@3.32.0_@tiptap_pm@3.32.0__@tiptap_pm_6inmb43gajy4fnlwtngbwkv7um/node_modules/@tiptap/react/dist/menus/index.js +0 -341
- package/dist/node_modules/.pnpm/prosemirror-model@1.25.12/node_modules/prosemirror-model/dist/index.js +0 -549
- package/dist/node_modules/.pnpm/prosemirror-state@1.4.4/node_modules/prosemirror-state/dist/index.js +0 -489
- package/dist/node_modules/.pnpm/prosemirror-transform@1.12.3/node_modules/prosemirror-transform/dist/index.js +0 -659
|
@@ -3,7 +3,6 @@ import { useState, useEffect, Fragment as Fragment$1 } from "react";
|
|
|
3
3
|
import { useTranslation } from "react-i18next";
|
|
4
4
|
import SvgIconTextTypo from "../../../icons/components/IconTextTypo.js";
|
|
5
5
|
import { useEditorContext } from "../../hooks/useEditorContext.js";
|
|
6
|
-
import { useEditorState } from "../../hooks/useEditorState.js";
|
|
7
6
|
import Tooltip from "../../../../components/Tooltip/Tooltip.js";
|
|
8
7
|
import IconButton from "../../../../components/Button/IconButton.js";
|
|
9
8
|
import Dropdown from "../../../../components/Dropdown/Dropdown.js";
|
|
@@ -14,11 +13,11 @@ const EditorToolbarTypography = ({
|
|
|
14
13
|
t
|
|
15
14
|
} = useTranslation(), {
|
|
16
15
|
editor
|
|
17
|
-
} = useEditorContext(), [value, setValue] = useState("sans-serif")
|
|
16
|
+
} = useEditorContext(), [value, setValue] = useState("sans-serif");
|
|
18
17
|
useEffect(() => {
|
|
19
18
|
const textStyle = editor == null ? void 0 : editor.getAttributes("textStyle");
|
|
20
19
|
setValue((textStyle == null ? void 0 : textStyle.fontFamily) ?? "");
|
|
21
|
-
}, [editor,
|
|
20
|
+
}, [editor, editor == null ? void 0 : editor.state]);
|
|
22
21
|
const options = [{
|
|
23
22
|
value: "",
|
|
24
23
|
label: t("tiptap.toolbar.typo.sans")
|
|
@@ -29,7 +29,6 @@ import { EditorToolbarTextSize } from "./EditorToolbar.TextSize.js";
|
|
|
29
29
|
import { EditorToolbarTypography } from "./EditorToolbar.Typography.js";
|
|
30
30
|
import { EditorToolbarCantoo } from "./EditorToolbar.Cantoo.js";
|
|
31
31
|
import { useEditorContext } from "../../hooks/useEditorContext.js";
|
|
32
|
-
import { useEditorState } from "../../hooks/useEditorState.js";
|
|
33
32
|
import { useActionOptions } from "../../hooks/useActionOptions.js";
|
|
34
33
|
import { useSpeechRecognition } from "../../hooks/useSpeechRecognition.js";
|
|
35
34
|
import { Toolbar } from "../../../../components/Toolbar/Toolbar.js";
|
|
@@ -43,7 +42,7 @@ const EditorToolbar = ({
|
|
|
43
42
|
} = useTranslation(), {
|
|
44
43
|
id,
|
|
45
44
|
editor
|
|
46
|
-
} = useEditorContext(),
|
|
45
|
+
} = useEditorContext(), [plusOptions, listOptions, alignmentOptions] = useActionOptions(editor, toggleMathsModal, mediaLibraryRef), {
|
|
47
46
|
isAvailable: canRecognizeSpeech,
|
|
48
47
|
isActive: speechRecognition,
|
|
49
48
|
toggle: toggleSpeechRecognition
|
|
@@ -73,8 +72,7 @@ const EditorToolbar = ({
|
|
|
73
72
|
},
|
|
74
73
|
name: "undo",
|
|
75
74
|
tooltip: t("editor.option.undo"),
|
|
76
|
-
|
|
77
|
-
visibility: showIf(hasExtension("undoRedo", editor))
|
|
75
|
+
visibility: showIf(hasExtension("history", editor))
|
|
78
76
|
},
|
|
79
77
|
//--------------- REDO ---------------//
|
|
80
78
|
{
|
|
@@ -87,7 +85,7 @@ const EditorToolbar = ({
|
|
|
87
85
|
},
|
|
88
86
|
name: "redo",
|
|
89
87
|
tooltip: t("editor.option.redo"),
|
|
90
|
-
visibility: showIf(hasExtension("
|
|
88
|
+
visibility: showIf(hasExtension("history", editor))
|
|
91
89
|
},
|
|
92
90
|
//-------------------------------------//
|
|
93
91
|
{
|
|
@@ -350,7 +348,7 @@ const EditorToolbar = ({
|
|
|
350
348
|
visibility: showIf(hasExtension("textAlign", editor))
|
|
351
349
|
}
|
|
352
350
|
];
|
|
353
|
-
}, [alignmentOptions, canRecognizeSpeech, editor,
|
|
351
|
+
}, [alignmentOptions, canRecognizeSpeech, editor, listOptions, mediaLibraryRef, plusOptions, speechRecognition, t, toggleSpeechRecognition]);
|
|
354
352
|
return /* @__PURE__ */ jsx("div", { className: "sticky-top z-1 editor-toolbar rounded-3", children: /* @__PURE__ */ jsx(Toolbar, { items: toolbarItems, variant: "no-shadow", className: "rounded-top-3", isBlock: !0, align: "left", ariaControls: id }) });
|
|
355
353
|
};
|
|
356
354
|
export {
|
|
@@ -1,18 +1,15 @@
|
|
|
1
|
-
import { HyperlinkAttributes } from '@edifice.io/tiptap-extensions/hyperlink';
|
|
2
|
-
import { LinkerAttributes } from '@edifice.io/tiptap-extensions/linker';
|
|
3
1
|
import { Editor } from '@tiptap/react';
|
|
4
|
-
type LinkAttrs = LinkerAttributes | HyperlinkAttributes;
|
|
5
2
|
interface LinkToolbarProps {
|
|
6
3
|
/**
|
|
7
4
|
* editor instance
|
|
8
5
|
*/
|
|
9
6
|
editor: Editor | null;
|
|
10
7
|
/** Handle Edit event */
|
|
11
|
-
onEdit: (attrs:
|
|
8
|
+
onEdit: (attrs: any) => void;
|
|
12
9
|
/** Handle Open event */
|
|
13
|
-
onOpen: (attrs:
|
|
10
|
+
onOpen: (attrs: any) => void;
|
|
14
11
|
/** Handle Unlink event */
|
|
15
|
-
onUnlink: (attrs:
|
|
12
|
+
onUnlink: (attrs: any) => void;
|
|
16
13
|
}
|
|
17
14
|
declare const LinkToolbar: ({ editor, onEdit, onOpen, onUnlink, }: LinkToolbarProps) => import("react/jsx-runtime").JSX.Element;
|
|
18
15
|
export default LinkToolbar;
|
|
@@ -1,20 +1,13 @@
|
|
|
1
1
|
import { jsx, Fragment } from "react/jsx-runtime";
|
|
2
|
-
import { useState, useMemo, useEffect
|
|
3
|
-
import {
|
|
2
|
+
import { useState, useMemo, useEffect } from "react";
|
|
3
|
+
import { FloatingMenu } from "@tiptap/react";
|
|
4
4
|
import { useTranslation } from "react-i18next";
|
|
5
|
-
import { useEditorState } from "../../hooks/useEditorState.js";
|
|
6
5
|
import SvgIconEdit from "../../../icons/components/IconEdit.js";
|
|
7
6
|
import SvgIconExternalLink from "../../../icons/components/IconExternalLink.js";
|
|
8
7
|
import SvgIconUnlink from "../../../icons/components/IconUnlink.js";
|
|
9
|
-
import {
|
|
8
|
+
import { tippyOptions } from "./LinkToolbar.TippyOptions.js";
|
|
10
9
|
import { Toolbar } from "../../../../components/Toolbar/Toolbar.js";
|
|
11
|
-
const
|
|
12
|
-
placement: "bottom",
|
|
13
|
-
offset: {
|
|
14
|
-
mainAxis: 10,
|
|
15
|
-
crossAxis: 0
|
|
16
|
-
}
|
|
17
|
-
}), LinkToolbar = ({
|
|
10
|
+
const LinkToolbar = ({
|
|
18
11
|
editor,
|
|
19
12
|
onEdit,
|
|
20
13
|
onOpen,
|
|
@@ -22,7 +15,7 @@ const floatingOptions = getFloatingMenuOptions({
|
|
|
22
15
|
}) => {
|
|
23
16
|
const {
|
|
24
17
|
t
|
|
25
|
-
} = useTranslation(),
|
|
18
|
+
} = useTranslation(), [linkAttrs, setLinkAttrs] = useState(), LinkToolbarItems = useMemo(() => [{
|
|
26
19
|
type: "icon",
|
|
27
20
|
name: "edit",
|
|
28
21
|
props: {
|
|
@@ -59,24 +52,9 @@ const floatingOptions = getFloatingMenuOptions({
|
|
|
59
52
|
position: "bottom"
|
|
60
53
|
}
|
|
61
54
|
}], [onEdit, onOpen, onUnlink, t, linkAttrs]);
|
|
62
|
-
useEffect(() => {
|
|
55
|
+
return useEffect(() => {
|
|
63
56
|
editor != null && editor.isActive("linker") ? setLinkAttrs(editor.getAttributes("linker")) : editor != null && editor.isActive("hyperlink") ? setLinkAttrs(editor.getAttributes("hyperlink")) : setLinkAttrs(void 0);
|
|
64
|
-
}, [editor
|
|
65
|
-
const handleShouldShow = useCallback(() => (editor == null ? void 0 : editor.isEditable) && ((editor == null ? void 0 : editor.isActive("linker")) || (editor == null ? void 0 : editor.isActive("hyperlink"))) || !1, [editor]);
|
|
66
|
-
return /* @__PURE__ */ jsx(Fragment, { children: editor && // BubbleMenu, not FloatingMenu: `shouldShow` below overrides visibility
|
|
67
|
-
// either way, this only changes the default position reference.
|
|
68
|
-
/* @__PURE__ */ jsx(
|
|
69
|
-
BubbleMenu,
|
|
70
|
-
{
|
|
71
|
-
editor,
|
|
72
|
-
options: floatingOptions,
|
|
73
|
-
shouldShow: handleShouldShow,
|
|
74
|
-
style: {
|
|
75
|
-
zIndex: FLOATING_MENU_Z_INDEX
|
|
76
|
-
},
|
|
77
|
-
children: /* @__PURE__ */ jsx(Toolbar, { className: "p-4", items: LinkToolbarItems })
|
|
78
|
-
}
|
|
79
|
-
) });
|
|
57
|
+
}, [editor == null ? void 0 : editor.state]), /* @__PURE__ */ jsx(Fragment, { children: editor && /* @__PURE__ */ jsx(FloatingMenu, { editor, tippyOptions, shouldShow: () => (editor == null ? void 0 : editor.isEditable) && ((editor == null ? void 0 : editor.isActive("linker")) || (editor == null ? void 0 : editor.isActive("hyperlink"))) || !1, children: /* @__PURE__ */ jsx(Toolbar, { className: "p-4", items: LinkToolbarItems }) }) });
|
|
80
58
|
};
|
|
81
59
|
export {
|
|
82
60
|
LinkToolbar as default
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { jsxs, Fragment, jsx } from "react/jsx-runtime";
|
|
2
2
|
import { useState, useCallback, useEffect } from "react";
|
|
3
3
|
import { useTranslation } from "react-i18next";
|
|
4
|
-
import { useEditorState } from "../../hooks/useEditorState.js";
|
|
5
4
|
import Tooltip from "../../../../components/Tooltip/Tooltip.js";
|
|
6
5
|
import Dropdown from "../../../../components/Dropdown/Dropdown.js";
|
|
7
6
|
import ColorPickerItem from "../../../../components/ColorPicker/ColorPickerItem.js";
|
|
@@ -13,7 +12,7 @@ const TableToolbarCellColor = ({
|
|
|
13
12
|
}) => {
|
|
14
13
|
const {
|
|
15
14
|
t
|
|
16
|
-
} = useTranslation(), [color, setColor] = useState("transparent"),
|
|
15
|
+
} = useTranslation(), [color, setColor] = useState("transparent"), applyColor = useCallback((value) => {
|
|
17
16
|
editor == null || editor.chain().focus().setCellAttribute(
|
|
18
17
|
"backgroundColor",
|
|
19
18
|
// reset color is transparent here => remove bkg color
|
|
@@ -22,7 +21,7 @@ const TableToolbarCellColor = ({
|
|
|
22
21
|
}, [editor, setColor]);
|
|
23
22
|
useEffect(() => {
|
|
24
23
|
setColor((editor == null ? void 0 : editor.getAttributes("tableCell").backgroundColor) ?? "transparent");
|
|
25
|
-
}, [editor,
|
|
24
|
+
}, [editor, editor == null ? void 0 : editor.state]);
|
|
26
25
|
const palettes = [{
|
|
27
26
|
...DefaultPalette,
|
|
28
27
|
label: t("tiptap.table.toolbar.cell.color"),
|
|
@@ -1,12 +1,9 @@
|
|
|
1
1
|
import { jsx, Fragment } from "react/jsx-runtime";
|
|
2
|
-
import { useState, useMemo, useEffect
|
|
3
|
-
import { findParentNodeClosestToPos } from "@tiptap/react";
|
|
4
|
-
import { FloatingMenu } from "../../../../node_modules/.pnpm/@tiptap_react@3.32.0_@floating-ui_dom@1.6.0_@tiptap_core@3.32.0_@tiptap_pm@3.32.0__@tiptap_pm_6inmb43gajy4fnlwtngbwkv7um/node_modules/@tiptap/react/dist/menus/index.js";
|
|
2
|
+
import { useState, useMemo, useEffect } from "react";
|
|
3
|
+
import { findParentNodeClosestToPos, FloatingMenu } from "@tiptap/react";
|
|
5
4
|
import { useTranslation } from "react-i18next";
|
|
6
5
|
import SvgIconMergeCells from "../../../icons/components/IconMergeCells.js";
|
|
7
6
|
import SvgIconSplitCells from "../../../icons/components/IconSplitCells.js";
|
|
8
|
-
import { useEditorState } from "../../hooks/useEditorState.js";
|
|
9
|
-
import { getFloatingMenuOptions, FLOATING_MENU_Z_INDEX } from "./FloatingMenuOptions.js";
|
|
10
7
|
import { TableToolbarAddMenu } from "./TableToolbar.AddMenu.js";
|
|
11
8
|
import { TableToolbarCellColor } from "./TableToolbar.CellColor.js";
|
|
12
9
|
import { TableToolbarDelMenu } from "./TableToolbar.DelMenu.js";
|
|
@@ -16,7 +13,7 @@ const TableToolbar = ({
|
|
|
16
13
|
}) => {
|
|
17
14
|
const {
|
|
18
15
|
t
|
|
19
|
-
} = useTranslation(), [isSpan, setSpan] = useState(void 0),
|
|
16
|
+
} = useTranslation(), [isSpan, setSpan] = useState(void 0), tippyOptions = useMemo(() => {
|
|
20
17
|
function adjustRect(rect) {
|
|
21
18
|
let yOffset = 0;
|
|
22
19
|
if (window.visualViewport) {
|
|
@@ -26,15 +23,11 @@ const TableToolbar = ({
|
|
|
26
23
|
return new DOMRect(rect.x, rect.y - yOffset, rect.width, rect.height);
|
|
27
24
|
}
|
|
28
25
|
return {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
}
|
|
35
|
-
}),
|
|
36
|
-
// Dead in v3: FloatingMenu has no reference-rect override (unlike
|
|
37
|
-
// BubbleMenu's getReferencedVirtualElement), so this never runs.
|
|
26
|
+
placement: "bottom",
|
|
27
|
+
offset: [0, 0],
|
|
28
|
+
zIndex: 999,
|
|
29
|
+
// popperOptions: {modifiers: [ /*see popper v2 modifiers*/ ]},
|
|
30
|
+
// Try to get the bounding rect of the table.
|
|
38
31
|
getReferenceClientRect: () => {
|
|
39
32
|
const parentDiv = editor != null && editor.isActive("table") ? findParentNodeClosestToPos(editor.state.selection.$anchor, (node) => node.type.name === "table") : null;
|
|
40
33
|
if (parentDiv) {
|
|
@@ -46,63 +39,50 @@ const TableToolbar = ({
|
|
|
46
39
|
}
|
|
47
40
|
};
|
|
48
41
|
}, [editor]);
|
|
49
|
-
useEffect(() => {
|
|
42
|
+
return useEffect(() => {
|
|
50
43
|
const cellAttr = editor == null ? void 0 : editor.getAttributes("tableCell"), headAttr = editor == null ? void 0 : editor.getAttributes("tableHeader");
|
|
51
44
|
if (typeof cellAttr < "u" || typeof headAttr < "u") {
|
|
52
45
|
const newSpan = (cellAttr == null ? void 0 : cellAttr.colspan) > 1 || (cellAttr == null ? void 0 : cellAttr.rowspan) > 1 || (headAttr == null ? void 0 : headAttr.colspan) > 1 || (headAttr == null ? void 0 : headAttr.rowspan) > 1;
|
|
53
46
|
newSpan !== isSpan && setSpan(newSpan);
|
|
54
47
|
} else
|
|
55
48
|
isSpan && setSpan(void 0);
|
|
56
|
-
}, [editor,
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
props: {
|
|
92
|
-
children: () => /* @__PURE__ */ jsx(TableToolbarAddMenu, { editor })
|
|
93
|
-
}
|
|
94
|
-
}, {
|
|
95
|
-
type: "divider",
|
|
96
|
-
name: "add-d1"
|
|
97
|
-
}, {
|
|
98
|
-
type: "dropdown",
|
|
99
|
-
name: "del",
|
|
100
|
-
props: {
|
|
101
|
-
children: () => /* @__PURE__ */ jsx(TableToolbarDelMenu, { editor })
|
|
102
|
-
}
|
|
103
|
-
}] })
|
|
49
|
+
}, [editor, editor == null ? void 0 : editor.state, isSpan]), /* @__PURE__ */ jsx(Fragment, { children: editor && /* @__PURE__ */ jsx(FloatingMenu, { editor, tippyOptions, shouldShow: () => (editor == null ? void 0 : editor.isEditable) && editor.isActive("table") || !1, children: /* @__PURE__ */ jsx(Toolbar, { className: "p-4", items: [{
|
|
50
|
+
type: "dropdown",
|
|
51
|
+
name: "bkg-col",
|
|
52
|
+
// isEnable:
|
|
53
|
+
// typeof editor?.getAttributes("tableCell") !== "undefined",
|
|
54
|
+
props: {
|
|
55
|
+
children: (_triggerProps, itemRefs) => /* @__PURE__ */ jsx(TableToolbarCellColor, { editor, itemRefs })
|
|
56
|
+
}
|
|
57
|
+
}, {
|
|
58
|
+
type: "icon",
|
|
59
|
+
name: "mergeorsplit",
|
|
60
|
+
// isEnable: typeof isSpan !== "undefined",
|
|
61
|
+
props: {
|
|
62
|
+
icon: isSpan ? /* @__PURE__ */ jsx(SvgIconSplitCells, {}) : /* @__PURE__ */ jsx(SvgIconMergeCells, {}),
|
|
63
|
+
"aria-label": t(isSpan ? "tiptap.table.toolbar.split" : "tiptap.table.toolbar.merge"),
|
|
64
|
+
onClick: () => editor == null ? void 0 : editor.chain().focus().mergeOrSplit().run()
|
|
65
|
+
},
|
|
66
|
+
tooltip: t(isSpan ? "tiptap.table.toolbar.split" : "tiptap.table.toolbar.merge")
|
|
67
|
+
}, {
|
|
68
|
+
type: "divider",
|
|
69
|
+
name: "add-d0"
|
|
70
|
+
}, {
|
|
71
|
+
type: "dropdown",
|
|
72
|
+
name: "add",
|
|
73
|
+
props: {
|
|
74
|
+
children: () => /* @__PURE__ */ jsx(TableToolbarAddMenu, { editor })
|
|
75
|
+
}
|
|
76
|
+
}, {
|
|
77
|
+
type: "divider",
|
|
78
|
+
name: "add-d1"
|
|
79
|
+
}, {
|
|
80
|
+
type: "dropdown",
|
|
81
|
+
name: "del",
|
|
82
|
+
props: {
|
|
83
|
+
children: () => /* @__PURE__ */ jsx(TableToolbarDelMenu, { editor })
|
|
104
84
|
}
|
|
105
|
-
) });
|
|
85
|
+
}] }) }) });
|
|
106
86
|
};
|
|
107
87
|
export {
|
|
108
88
|
TableToolbar as default
|
|
@@ -6,7 +6,7 @@ import { Content, HTMLContent } from '@tiptap/react';
|
|
|
6
6
|
* @param content default rich content
|
|
7
7
|
*/
|
|
8
8
|
export declare const useCommentEditor: (editable: boolean, content: Content, maxLength?: number) => {
|
|
9
|
-
editor: import('@tiptap/core').Editor;
|
|
9
|
+
editor: import('@tiptap/core').Editor | null;
|
|
10
10
|
commentLength: number;
|
|
11
11
|
getComment: () => HTMLContent;
|
|
12
12
|
resetComment: () => void;
|
|
@@ -1,22 +1,14 @@
|
|
|
1
1
|
import { useState, useEffect } from "react";
|
|
2
2
|
import { Hyperlink } from "@edifice.io/tiptap-extensions/hyperlink";
|
|
3
|
-
import
|
|
3
|
+
import CharacterCount from "@tiptap/extension-character-count";
|
|
4
4
|
import { useEditor } from "@tiptap/react";
|
|
5
5
|
import StarterKit from "@tiptap/starter-kit";
|
|
6
6
|
const useCommentEditor = (editable, content, maxLength = 800) => {
|
|
7
7
|
const [commentLength, setCommentLength] = useState(0), editor = useEditor({
|
|
8
8
|
editable,
|
|
9
|
-
extensions: [
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
StarterKit.configure({
|
|
13
|
-
link: !1
|
|
14
|
-
}),
|
|
15
|
-
Hyperlink,
|
|
16
|
-
CharacterCount.configure({
|
|
17
|
-
limit: maxLength
|
|
18
|
-
})
|
|
19
|
-
],
|
|
9
|
+
extensions: [StarterKit, Hyperlink, CharacterCount.configure({
|
|
10
|
+
limit: maxLength
|
|
11
|
+
})],
|
|
20
12
|
content
|
|
21
13
|
});
|
|
22
14
|
return useEffect(() => {
|
|
@@ -12,7 +12,7 @@ import { MediaLibraryRef } from '../../multimedia';
|
|
|
12
12
|
* }
|
|
13
13
|
*/
|
|
14
14
|
export declare const useLinkToolbar: (editor: Editor | null, mediaLibraryRef: RefObject<MediaLibraryRef>) => {
|
|
15
|
-
onEdit: (attrs: LinkerAttributes | HyperlinkAttributes
|
|
16
|
-
onOpen: (attrs: LinkerAttributes
|
|
15
|
+
onEdit: (attrs: LinkerAttributes | HyperlinkAttributes) => void;
|
|
16
|
+
onOpen: (attrs: LinkerAttributes) => void;
|
|
17
17
|
onUnlink: () => void;
|
|
18
18
|
};
|
|
@@ -2,7 +2,6 @@ import { useCallback } from "react";
|
|
|
2
2
|
const useLinkToolbar = (editor, mediaLibraryRef) => ({
|
|
3
3
|
onEdit: useCallback((attrs) => {
|
|
4
4
|
var _a, _b;
|
|
5
|
-
if (!attrs) return;
|
|
6
5
|
editor != null && editor.isActive("hyperlink") && editor.commands.extendMarkRange("hyperlink");
|
|
7
6
|
const attrsLinker = attrs;
|
|
8
7
|
if (attrsLinker["data-id"] || attrsLinker["data-app-prefix"])
|
|
@@ -26,7 +25,7 @@ const useLinkToolbar = (editor, mediaLibraryRef) => ({
|
|
|
26
25
|
}
|
|
27
26
|
}, [editor, mediaLibraryRef]),
|
|
28
27
|
onOpen: (attrs) => {
|
|
29
|
-
window.open(
|
|
28
|
+
window.open(attrs.href || "about:blank", "_blank");
|
|
30
29
|
},
|
|
31
30
|
onUnlink: () => {
|
|
32
31
|
var _a, _b, _c, _d;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Content,
|
|
1
|
+
import { Content, Extensions, FocusPosition } from '@tiptap/react';
|
|
2
2
|
import { WorkspaceVisibility } from '@edifice.io/client';
|
|
3
3
|
/**
|
|
4
4
|
* Hook that creates a tiptap editor instance.
|
|
@@ -13,8 +13,8 @@ import { WorkspaceVisibility } from '@edifice.io/client';
|
|
|
13
13
|
* @returns the editor instance and the editable state
|
|
14
14
|
*/
|
|
15
15
|
export declare const useTipTapEditor: (editable: boolean, content: Content, focus?: FocusPosition, placeholder?: string, onContentChange?: ({ editor }: {
|
|
16
|
-
editor:
|
|
16
|
+
editor: any;
|
|
17
17
|
}) => void, visibility?: WorkspaceVisibility, extensions?: Extensions) => {
|
|
18
|
-
editor: Editor;
|
|
18
|
+
editor: import('@tiptap/core').Editor | null;
|
|
19
19
|
editable: boolean;
|
|
20
20
|
};
|
|
@@ -9,14 +9,18 @@ import { SpeechSynthesis } from "@edifice.io/tiptap-extensions/speech-synthesis"
|
|
|
9
9
|
import { TableCell } from "@edifice.io/tiptap-extensions/table-cell";
|
|
10
10
|
import { Mathematics } from "@tiptap/extension-mathematics";
|
|
11
11
|
import Color from "@tiptap/extension-color";
|
|
12
|
+
import Focus from "@tiptap/extension-focus";
|
|
12
13
|
import FontFamily from "@tiptap/extension-font-family";
|
|
13
|
-
import
|
|
14
|
-
import { Focus, Placeholder } from "@tiptap/extensions";
|
|
14
|
+
import Placeholder from "@tiptap/extension-placeholder";
|
|
15
15
|
import Subscript from "@tiptap/extension-subscript";
|
|
16
16
|
import Superscript from "@tiptap/extension-superscript";
|
|
17
|
-
import
|
|
17
|
+
import Table from "@tiptap/extension-table";
|
|
18
|
+
import TableHeader from "@tiptap/extension-table-header";
|
|
19
|
+
import TableRow from "@tiptap/extension-table-row";
|
|
18
20
|
import TextAlign from "@tiptap/extension-text-align";
|
|
21
|
+
import TextStyle from "@tiptap/extension-text-style";
|
|
19
22
|
import Typography from "@tiptap/extension-typography";
|
|
23
|
+
import Underline from "@tiptap/extension-underline";
|
|
20
24
|
import { useEditor } from "@tiptap/react";
|
|
21
25
|
import StarterKit from "@tiptap/starter-kit";
|
|
22
26
|
import { useTranslation } from "react-i18next";
|
|
@@ -46,81 +50,22 @@ const useTipTapEditor = (editable, content, focus, placeholder, onContentChange,
|
|
|
46
50
|
// TipTap editor must be instantiated in editable mode for table columns to be resizable.
|
|
47
51
|
// It will then be set in the correct editable mode, by a useEffect below.
|
|
48
52
|
editable: !0,
|
|
49
|
-
extensions: [
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
CustomHighlight.configure({
|
|
66
|
-
multicolor: !0
|
|
67
|
-
}),
|
|
68
|
-
// v3's TextStyleKit bundles its own color/fontFamily/fontSize, which would
|
|
69
|
-
// duplicate the Color/FontFamily/FontSize added below. Disabled.
|
|
70
|
-
// backgroundColor/lineHeight are also disabled: they're new in v3 (v2
|
|
71
|
-
// stripped these inline styles), and lineHeight would otherwise collide
|
|
72
|
-
// with our own @edifice.io/tiptap-extensions/line-height by name for
|
|
73
|
-
// any caller that adds it via this hook's `extensions` param.
|
|
74
|
-
TextStyleKit.configure({
|
|
75
|
-
color: !1,
|
|
76
|
-
fontFamily: !1,
|
|
77
|
-
fontSize: !1,
|
|
78
|
-
backgroundColor: !1,
|
|
79
|
-
lineHeight: !1
|
|
80
|
-
}),
|
|
81
|
-
Color,
|
|
82
|
-
Subscript,
|
|
83
|
-
Superscript,
|
|
84
|
-
Table.configure({
|
|
85
|
-
resizable: !0
|
|
86
|
-
}),
|
|
87
|
-
TableRow,
|
|
88
|
-
TableHeader,
|
|
89
|
-
TableCell,
|
|
90
|
-
TextAlign.configure({
|
|
91
|
-
types: ["heading", "paragraph", "video", "audio", "iframe"]
|
|
92
|
-
}),
|
|
93
|
-
// The published package names this node 'customHeading' (to avoid
|
|
94
|
-
// colliding with v3 StarterKit's now-bundled 'heading', disabled
|
|
95
|
-
// above). Pinned back to 'heading' to match what's already stored for
|
|
96
|
-
// existing content, and what edifice-tiptap-transformer's own Heading
|
|
97
|
-
// model does server-side - without this, loading any stored content
|
|
98
|
-
// with a heading throws "Unknown node type: heading" and the editor
|
|
99
|
-
// falls back to an empty document.
|
|
100
|
-
CustomHeading.extend({
|
|
101
|
-
name: "heading"
|
|
102
|
-
}).configure({
|
|
103
|
-
levels: [1, 2]
|
|
104
|
-
}),
|
|
105
|
-
Typography,
|
|
106
|
-
FontSize,
|
|
107
|
-
SpeechRecognition,
|
|
108
|
-
SpeechSynthesis.configure({
|
|
109
|
-
lang: (currentLanguage == null ? void 0 : currentLanguage.length) === 2 ? `${currentLanguage}-${currentLanguage.toUpperCase()}` : "fr-FR"
|
|
110
|
-
}),
|
|
111
|
-
Hyperlink,
|
|
112
|
-
FontFamily,
|
|
113
|
-
Mathematics,
|
|
114
|
-
Alert,
|
|
115
|
-
IframeNodeView(MediaRenderer),
|
|
116
|
-
VideoNodeView(MediaRenderer),
|
|
117
|
-
AudioNodeView(AudioRenderer),
|
|
118
|
-
LinkerNodeView(LinkerRenderer),
|
|
119
|
-
ImageNodeView(MediaRenderer, uploadFile),
|
|
120
|
-
AttachmentNodeView(AttachmentRenderer),
|
|
121
|
-
InformationPaneNodeView(InformationPaneRenderer),
|
|
122
|
-
...extensions || []
|
|
123
|
-
],
|
|
53
|
+
extensions: [StarterKit, Focus.configure({
|
|
54
|
+
className: "has-focus",
|
|
55
|
+
mode: "all"
|
|
56
|
+
}), Placeholder.configure({
|
|
57
|
+
placeholder: t(placeholder || "tiptap.placeholder")
|
|
58
|
+
}), CustomHighlight.configure({
|
|
59
|
+
multicolor: !0
|
|
60
|
+
}), Underline, TextStyle, Color, Subscript, Superscript, Table.configure({
|
|
61
|
+
resizable: !0
|
|
62
|
+
}), TableRow, TableHeader, TableCell, TextAlign.configure({
|
|
63
|
+
types: ["heading", "paragraph", "video", "audio", "iframe"]
|
|
64
|
+
}), CustomHeading.configure({
|
|
65
|
+
levels: [1, 2]
|
|
66
|
+
}), Typography, FontSize, SpeechRecognition, SpeechSynthesis.configure({
|
|
67
|
+
lang: (currentLanguage == null ? void 0 : currentLanguage.length) === 2 ? `${currentLanguage}-${currentLanguage.toUpperCase()}` : "fr-FR"
|
|
68
|
+
}), Hyperlink, FontFamily, Mathematics, Alert, IframeNodeView(MediaRenderer), VideoNodeView(MediaRenderer), AudioNodeView(AudioRenderer), LinkerNodeView(LinkerRenderer), ImageNodeView(MediaRenderer, uploadFile), AttachmentNodeView(AttachmentRenderer), InformationPaneNodeView(InformationPaneRenderer), ...extensions || []],
|
|
124
69
|
content,
|
|
125
70
|
// If the onContentChange callback is provided, we call it on every content change.
|
|
126
71
|
...onContentChange ? {
|
|
@@ -130,9 +75,7 @@ const useTipTapEditor = (editable, content, focus, placeholder, onContentChange,
|
|
|
130
75
|
return useEffect(() => {
|
|
131
76
|
editor == null || editor.setEditable(editable, !1);
|
|
132
77
|
}, [editor, editable]), useEffect(() => {
|
|
133
|
-
editor == null || editor.commands.setContent(content
|
|
134
|
-
emitUpdate: !1
|
|
135
|
-
});
|
|
78
|
+
editor == null || editor.commands.setContent(content);
|
|
136
79
|
}, [content]), useEffect(() => {
|
|
137
80
|
focus && (editor == null || editor.commands.focus(focus));
|
|
138
81
|
}, [editor, focus, editable]), {
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { CalendarEvent } from '@edifice.io/client';
|
|
2
|
+
export interface AgendaProps {
|
|
3
|
+
events: CalendarEvent[];
|
|
4
|
+
onEventClick?: (event: CalendarEvent) => void;
|
|
5
|
+
onOpenAgendaClick?: () => void;
|
|
6
|
+
}
|
|
7
|
+
export declare const Agenda: {
|
|
8
|
+
({ events, onEventClick, onOpenAgendaClick, }: AgendaProps): import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
displayName: string;
|
|
10
|
+
};
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo } from "react";
|
|
3
|
+
import { useTranslation } from "react-i18next";
|
|
4
|
+
import illuEmptyAgenda from "@edifice.io/bootstrap/dist/images/homepage/illu-empty-agenda.svg";
|
|
5
|
+
import SvgIconExternalLink from "../../../icons/components/IconExternalLink.js";
|
|
6
|
+
import HomeCard from "../HomeCard/HomeCard.js";
|
|
7
|
+
import { AgendaEventCard } from "./AgendaEventCard.js";
|
|
8
|
+
import useDate from "../../../../hooks/useDate/useDate.js";
|
|
9
|
+
import Flex from "../../../../components/Flex/Flex.js";
|
|
10
|
+
const capitalize = (value) => value.charAt(0).toUpperCase() + value.slice(1), Agenda = ({
|
|
11
|
+
events,
|
|
12
|
+
onEventClick,
|
|
13
|
+
onOpenAgendaClick = () => window.open("/calendar", "_self")
|
|
14
|
+
}) => {
|
|
15
|
+
const {
|
|
16
|
+
t
|
|
17
|
+
} = useTranslation(), {
|
|
18
|
+
formatDate,
|
|
19
|
+
dateIsSame
|
|
20
|
+
} = useDate(), dayGroups = useMemo(() => {
|
|
21
|
+
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
22
|
+
return events.reduce((groups, event) => {
|
|
23
|
+
const lastGroup = groups[groups.length - 1];
|
|
24
|
+
return lastGroup && dateIsSame(lastGroup.date, event.startMoment, "day") ? (lastGroup.events.push(event), groups) : (groups.push({
|
|
25
|
+
key: event.id,
|
|
26
|
+
date: event.startMoment,
|
|
27
|
+
weekday: capitalize(formatDate(event.startMoment, "ddd")),
|
|
28
|
+
day: formatDate(event.startMoment, "D"),
|
|
29
|
+
month: dateIsSame(event.startMoment, now, "month") ? void 0 : formatDate(event.startMoment, "MMM"),
|
|
30
|
+
events: [event]
|
|
31
|
+
}), groups);
|
|
32
|
+
}, []);
|
|
33
|
+
}, [events, dateIsSame, formatDate]);
|
|
34
|
+
return /* @__PURE__ */ jsxs(HomeCard, { variant: "primary", children: [
|
|
35
|
+
/* @__PURE__ */ jsx(HomeCard.Header, { title: t("homepage.agenda.title"), actionLeftIcon: /* @__PURE__ */ jsx(SvgIconExternalLink, { width: "20", height: "20" }), onActionClick: onOpenAgendaClick, actionProps: {
|
|
36
|
+
"aria-label": t("homepage.agenda.openAgenda"),
|
|
37
|
+
"data-testid": "agenda-button-open"
|
|
38
|
+
} }),
|
|
39
|
+
/* @__PURE__ */ jsx(HomeCard.Content, { children: dayGroups.length === 0 ? /* @__PURE__ */ jsxs(Flex, { direction: "column", align: "center", gap: "8", className: "agenda-empty", children: [
|
|
40
|
+
/* @__PURE__ */ jsx("img", { src: illuEmptyAgenda, alt: "", width: 64, height: 64 }),
|
|
41
|
+
/* @__PURE__ */ jsx("span", { className: "agenda-empty-text", children: t("homepage.agenda.empty") })
|
|
42
|
+
] }) : /* @__PURE__ */ jsx(Flex, { direction: "column", gap: "8", className: "agenda-content", children: dayGroups.map((group) => /* @__PURE__ */ jsxs(Flex, { gap: "4", className: "agenda-day-group", "data-testid": "agenda-day-group", children: [
|
|
43
|
+
/* @__PURE__ */ jsxs(Flex, { direction: "column", align: "center", className: "agenda-day-group-date", children: [
|
|
44
|
+
/* @__PURE__ */ jsx("span", { children: group.weekday }),
|
|
45
|
+
/* @__PURE__ */ jsx("span", { className: "agenda-day-group-date-number", children: group.day }),
|
|
46
|
+
group.month && /* @__PURE__ */ jsx("span", { children: group.month })
|
|
47
|
+
] }),
|
|
48
|
+
/* @__PURE__ */ jsx(Flex, { direction: "column", gap: "8", className: "agenda-day-group-events", children: group.events.map((event) => /* @__PURE__ */ jsx(AgendaEventCard, { event, onClick: () => onEventClick == null ? void 0 : onEventClick(event) }, event.id)) })
|
|
49
|
+
] }, group.key)) }) })
|
|
50
|
+
] });
|
|
51
|
+
};
|
|
52
|
+
export {
|
|
53
|
+
Agenda
|
|
54
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function AgendaContainer(): import("react/jsx-runtime").JSX.Element;
|