@edifice.io/react 2.6.10-develop-b2school.20261023141442 → 2.6.10-develop-pedago.20261023145636
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 +4 -12
- 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 +3 -5
- package/dist/editor.js +2 -0
- package/dist/homepage.js +24 -74
- package/dist/hooks/useZendeskGuide/useZendeskGuide.d.ts +6 -2
- package/dist/hooks/useZendeskGuide/useZendeskGuide.js +8 -11
- package/dist/icons.js +402 -406
- package/dist/modules/HelpZone/HelpZone.js +8 -6
- package/dist/modules/HelpZone/HelpZoneContainer.js +5 -2
- package/dist/modules/editor/components/BubbleMenuEditImage/BubbleMenuEditImage.js +110 -91
- package/dist/modules/editor/components/BubbleMenuEditInformationPane/BubbleMenuEditInformationPane.js +123 -96
- package/dist/modules/editor/components/Editor/Editor.d.ts +0 -5
- package/dist/modules/editor/components/Editor/Editor.js +0 -3
- package/dist/modules/editor/components/EditorToolbar/EditorToolbar.HighlightColor.js +5 -8
- package/dist/modules/editor/components/EditorToolbar/EditorToolbar.TextColor.js +5 -8
- package/dist/modules/editor/components/EditorToolbar/EditorToolbar.TextSize.js +7 -3
- package/dist/modules/editor/components/EditorToolbar/EditorToolbar.Typography.js +3 -2
- package/dist/modules/editor/components/EditorToolbar/EditorToolbar.js +6 -4
- package/dist/modules/editor/components/Toolbar/FloatingMenuOptions.d.ts +29 -0
- package/dist/modules/editor/components/Toolbar/FloatingMenuOptions.js +22 -0
- package/dist/modules/editor/components/Toolbar/LinkToolbar.d.ts +6 -3
- package/dist/modules/editor/components/Toolbar/LinkToolbar.js +29 -7
- package/dist/modules/editor/components/Toolbar/TableToolbar.CellColor.js +3 -2
- package/dist/modules/editor/components/Toolbar/TableToolbar.js +65 -45
- package/dist/modules/editor/hooks/index.d.ts +1 -0
- package/dist/modules/editor/hooks/useCommentEditor.d.ts +1 -1
- package/dist/modules/editor/hooks/useCommentEditor.js +12 -4
- package/dist/modules/editor/hooks/useEditorState.d.ts +20 -0
- package/dist/modules/editor/hooks/useEditorState.js +16 -0
- package/dist/modules/editor/hooks/useLinkToolbar.d.ts +2 -2
- package/dist/modules/editor/hooks/useLinkToolbar.js +2 -1
- package/dist/modules/editor/hooks/useTipTapEditor.d.ts +3 -3
- package/dist/modules/editor/hooks/useTipTapEditor.js +81 -24
- package/dist/modules/homepage/components/Communities/Communities.js +4 -4
- package/dist/modules/homepage/components/Header/Header.js +22 -28
- package/dist/modules/homepage/components/HomeCard/HomeCardHeader.d.ts +1 -5
- 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 +8 -7
- package/dist/modules/homepage/components/Notifications/NotificationListSkeleton.js +12 -7
- package/dist/modules/homepage/components/Notifications/NotificationSkeleton.js +4 -7
- package/dist/modules/homepage/components/Notifications/components/NotificationFilterMenu.js +5 -1
- package/dist/modules/homepage/components/Notifications/components/NotificationFilterModal.js +12 -10
- package/dist/modules/homepage/components/Notifications/components/NotificationOptionsMenu.js +9 -3
- package/dist/modules/homepage/components/Notifications/components/ReportNotificationModal.js +12 -6
- package/dist/modules/homepage/components/Notifications/components/notificationAdapter.js +10 -12
- package/dist/modules/homepage/components/Notifications/hooks/useNotificationList.js +10 -9
- package/dist/modules/homepage/components/SchoolSpace/SchoolSpaceContainer.js +1 -1
- package/dist/modules/homepage/{hooks → components/SchoolSpace}/useUserSchools.d.ts +2 -2
- package/dist/modules/homepage/{hooks → components/SchoolSpace}/useUserSchools.js +4 -4
- 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 +1 -3
- package/dist/modules/homepage/components/UserSpace/UserSpace.js +7 -13
- package/dist/modules/homepage/components/UserSpace/UserSpaceContainer.d.ts +2 -4
- package/dist/modules/homepage/components/UserSpace/UserSpaceContainer.js +2 -3
- package/dist/modules/homepage/components/index.d.ts +1 -9
- package/dist/modules/icons/components/index.d.ts +0 -2
- package/dist/modules/modals/ResourceModal/ResourceModal.js +16 -9
- package/dist/modules/modals/ResourceModal/apps/BlogPublic.js +9 -13
- package/dist/modules/multimedia/Linker/InternalLinker/InternalLinker.d.ts +7 -1
- package/dist/modules/multimedia/Linker/InternalLinker/InternalLinker.js +2 -0
- package/dist/modules/multimedia/MediaLibrary/MediaLibrary.d.ts +2 -0
- package/dist/modules/multimedia/MediaLibrary/MediaLibrary.js +2 -0
- package/dist/modules/multimedia/MediaLibrary/MediaLibraryContext.d.ts +4 -0
- package/dist/modules/multimedia/MediaLibrary/innertabs/Upload.js +2 -1
- package/dist/modules/multimedia/MediaLibrary/innertabs/Workspace.js +3 -0
- 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 +159 -0
- 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 +341 -0
- package/dist/node_modules/.pnpm/prosemirror-model@1.25.12/node_modules/prosemirror-model/dist/index.js +549 -0
- package/dist/node_modules/.pnpm/prosemirror-state@1.4.4/node_modules/prosemirror-state/dist/index.js +489 -0
- package/dist/node_modules/.pnpm/prosemirror-transform@1.12.4/node_modules/prosemirror-transform/dist/index.js +659 -0
- package/package.json +35 -43
- package/dist/modules/editor/components/Toolbar/LinkToolbar.TippyOptions.d.ts +0 -2
- package/dist/modules/editor/components/Toolbar/LinkToolbar.TippyOptions.js +0 -8
- package/dist/modules/homepage/components/Agenda/Agenda.d.ts +0 -10
- package/dist/modules/homepage/components/Agenda/Agenda.js +0 -54
- package/dist/modules/homepage/components/Agenda/AgendaContainer.d.ts +0 -1
- package/dist/modules/homepage/components/Agenda/AgendaContainer.js +0 -14
- package/dist/modules/homepage/components/Agenda/AgendaEventCard.d.ts +0 -10
- package/dist/modules/homepage/components/Agenda/AgendaEventCard.js +0 -30
- package/dist/modules/homepage/components/Agenda/hooks/useAgendaContainer.d.ts +0 -14
- package/dist/modules/homepage/components/Agenda/hooks/useAgendaContainer.js +0 -27
- package/dist/modules/homepage/components/Agenda/index.d.ts +0 -3
- package/dist/modules/homepage/components/Agenda/services/api/agendaService.d.ts +0 -24
- package/dist/modules/homepage/components/Agenda/services/api/agendaService.js +0 -45
- package/dist/modules/homepage/components/Agenda/services/api/index.d.ts +0 -4
- package/dist/modules/homepage/components/Agenda/services/api/index.js +0 -5
- package/dist/modules/homepage/components/Agenda/services/queries/agenda.d.ts +0 -19
- package/dist/modules/homepage/components/Agenda/services/queries/agenda.js +0 -26
- package/dist/modules/homepage/components/BriefMe/BriefMe.d.ts +0 -9
- package/dist/modules/homepage/components/BriefMe/BriefMe.js +0 -59
- package/dist/modules/homepage/components/BriefMe/BriefMeContainer.d.ts +0 -4
- package/dist/modules/homepage/components/BriefMe/BriefMeContainer.js +0 -17
- package/dist/modules/homepage/components/BriefMe/index.d.ts +0 -4
- package/dist/modules/homepage/components/BriefMe/types.d.ts +0 -17
- package/dist/modules/homepage/components/BriefMe/types.js +0 -8
- package/dist/modules/homepage/components/BriefMe/useBriefMe.d.ts +0 -31
- package/dist/modules/homepage/components/BriefMe/useBriefMe.js +0 -51
- package/dist/modules/homepage/components/Cantine/Cantine.d.ts +0 -7
- package/dist/modules/homepage/components/Cantine/Cantine.js +0 -44
- package/dist/modules/homepage/components/Cantine/CantineContainer.d.ts +0 -4
- package/dist/modules/homepage/components/Cantine/CantineContainer.js +0 -18
- package/dist/modules/homepage/components/Cantine/CantineModal.d.ts +0 -24
- package/dist/modules/homepage/components/Cantine/CantineModal.js +0 -88
- package/dist/modules/homepage/components/Cantine/CantineModalContainer.d.ts +0 -7
- package/dist/modules/homepage/components/Cantine/CantineModalContainer.js +0 -12
- package/dist/modules/homepage/components/Cantine/components/CantineLegend.d.ts +0 -5
- package/dist/modules/homepage/components/Cantine/components/CantineLegend.js +0 -22
- package/dist/modules/homepage/components/Cantine/components/CantineMenuSection.d.ts +0 -6
- package/dist/modules/homepage/components/Cantine/components/CantineMenuSection.js +0 -28
- package/dist/modules/homepage/components/Cantine/components/cantineLabels.d.ts +0 -12
- package/dist/modules/homepage/components/Cantine/components/cantineLabels.js +0 -60
- package/dist/modules/homepage/components/Cantine/hooks/useCantine.d.ts +0 -11
- package/dist/modules/homepage/components/Cantine/hooks/useCantine.js +0 -20
- package/dist/modules/homepage/components/Cantine/hooks/useCantineMenu.d.ts +0 -24
- package/dist/modules/homepage/components/Cantine/hooks/useCantineMenu.js +0 -65
- package/dist/modules/homepage/components/Cantine/hooks/useCantineModal.d.ts +0 -23
- package/dist/modules/homepage/components/Cantine/hooks/useCantineModal.js +0 -43
- package/dist/modules/homepage/components/Cantine/index.d.ts +0 -7
- package/dist/modules/homepage/components/Cantine/types.d.ts +0 -42
- package/dist/modules/homepage/components/GenerationHdf/GenerationHdf.d.ts +0 -16
- package/dist/modules/homepage/components/GenerationHdf/GenerationHdf.js +0 -48
- package/dist/modules/homepage/components/GenerationHdf/GenerationHdfContainer.d.ts +0 -4
- package/dist/modules/homepage/components/GenerationHdf/GenerationHdfContainer.js +0 -12
- package/dist/modules/homepage/components/GenerationHdf/formatSolde.d.ts +0 -1
- package/dist/modules/homepage/components/GenerationHdf/formatSolde.js +0 -6
- package/dist/modules/homepage/components/GenerationHdf/index.d.ts +0 -3
- package/dist/modules/homepage/components/GenerationHdf/useGenerationHdf.d.ts +0 -10
- package/dist/modules/homepage/components/GenerationHdf/useGenerationHdf.js +0 -68
- package/dist/modules/homepage/components/Header/AccountActionListPopover.d.ts +0 -13
- package/dist/modules/homepage/components/Header/AccountActionListPopover.js +0 -26
- package/dist/modules/homepage/components/Header/ActionItem.d.ts +0 -38
- package/dist/modules/homepage/components/Header/ActionItem.js +0 -34
- package/dist/modules/homepage/components/Header/MyAppsPopover.d.ts +0 -5
- package/dist/modules/homepage/components/Header/MyAppsPopover.js +0 -28
- package/dist/modules/homepage/components/Header/useSafeHoverPopover.js +0 -32
- package/dist/modules/homepage/components/Qwant/Qwant.d.ts +0 -4
- package/dist/modules/homepage/components/Qwant/Qwant.js +0 -41
- package/dist/modules/homepage/components/Qwant/QwantContainer.d.ts +0 -1
- package/dist/modules/homepage/components/Qwant/QwantContainer.js +0 -10
- package/dist/modules/homepage/components/Qwant/index.d.ts +0 -3
- package/dist/modules/homepage/components/Rss/Rss.d.ts +0 -11
- package/dist/modules/homepage/components/Rss/Rss.js +0 -64
- package/dist/modules/homepage/components/Rss/RssContainer.d.ts +0 -1
- package/dist/modules/homepage/components/Rss/RssContainer.js +0 -45
- package/dist/modules/homepage/components/Rss/RssFeedForm.d.ts +0 -13
- package/dist/modules/homepage/components/Rss/RssFeedForm.js +0 -69
- package/dist/modules/homepage/components/Rss/RssFeedsModal.d.ts +0 -11
- package/dist/modules/homepage/components/Rss/RssFeedsModal.js +0 -58
- package/dist/modules/homepage/components/Rss/hooks/useRssContainer.d.ts +0 -25
- package/dist/modules/homepage/components/Rss/hooks/useRssContainer.js +0 -43
- package/dist/modules/homepage/components/Rss/index.d.ts +0 -6
- package/dist/modules/homepage/components/Rss/services/api/index.d.ts +0 -5
- package/dist/modules/homepage/components/Rss/services/api/index.js +0 -5
- package/dist/modules/homepage/components/Rss/services/api/rssService.d.ts +0 -38
- package/dist/modules/homepage/components/Rss/services/api/rssService.js +0 -51
- package/dist/modules/homepage/components/Rss/services/queries/rss.d.ts +0 -28
- package/dist/modules/homepage/components/Rss/services/queries/rss.js +0 -71
- package/dist/modules/homepage/components/Rss/types.d.ts +0 -25
- package/dist/modules/homepage/components/Rss/utils.d.ts +0 -7
- package/dist/modules/homepage/components/Rss/utils.js +0 -19
- package/dist/modules/homepage/components/Universalis/Universalis.d.ts +0 -8
- package/dist/modules/homepage/components/Universalis/Universalis.js +0 -62
- package/dist/modules/homepage/components/Universalis/UniversalisContainer.d.ts +0 -1
- package/dist/modules/homepage/components/Universalis/UniversalisContainer.js +0 -16
- package/dist/modules/homepage/components/Universalis/index.d.ts +0 -3
- package/dist/modules/homepage/components/WidgetsPersonalizationPanel/WidgetToggle.d.ts +0 -16
- package/dist/modules/homepage/components/WidgetsPersonalizationPanel/WidgetToggle.js +0 -15
- package/dist/modules/homepage/components/WidgetsPersonalizationPanel/WidgetsPersonalizationPanel.d.ts +0 -21
- package/dist/modules/homepage/components/WidgetsPersonalizationPanel/WidgetsPersonalizationPanel.js +0 -47
- package/dist/modules/homepage/components/WidgetsPersonalizationPanel/index.d.ts +0 -2
- package/dist/modules/icons/components/IconAddWidget.d.ts +0 -7
- package/dist/modules/icons/components/IconAddWidget.js +0 -12
- package/dist/modules/icons/components/IconLogout.d.ts +0 -7
- package/dist/modules/icons/components/IconLogout.js +0 -13
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { School
|
|
2
|
-
export declare function useUserSchools(
|
|
1
|
+
import { School } from '@edifice.io/client';
|
|
2
|
+
export declare function useUserSchools(): {
|
|
3
3
|
schools: School[];
|
|
4
4
|
selectedSchool: School | undefined;
|
|
5
5
|
handleSelectedSchoolChange: (school: School) => void;
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { WIDGET_NAME } from "@edifice.io/client";
|
|
2
2
|
import { useState, useEffect } from "react";
|
|
3
|
-
import useWidget from "
|
|
4
|
-
import useSession from "
|
|
5
|
-
function useUserSchools(
|
|
3
|
+
import useWidget from "../../hooks/useWidget.js";
|
|
4
|
+
import useSession from "../../../../hooks/useSession/useSession.js";
|
|
5
|
+
function useUserSchools() {
|
|
6
6
|
var _a, _b;
|
|
7
7
|
const {
|
|
8
8
|
data: session
|
|
9
9
|
} = useSession(), {
|
|
10
10
|
preference,
|
|
11
11
|
savePreference
|
|
12
|
-
} = useWidget(
|
|
12
|
+
} = useWidget(WIDGET_NAME.SCHOOL), [selectedSchool, setSelectedSchool] = useState(), [schools, setSchools] = useState((_a = session == null ? void 0 : session.userDescription) == null ? void 0 : _a.schools);
|
|
13
13
|
return useEffect(() => {
|
|
14
14
|
var _a2;
|
|
15
15
|
const newSchools = (_a2 = session == null ? void 0 : session.userDescription) == null ? void 0 : _a2.schools;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
2
|
import { useTranslation } from "react-i18next";
|
|
3
|
-
import
|
|
3
|
+
import illuEmptyUsefulLinks from "@edifice.io/bootstrap/dist/images/homepage/illu-empty-useful-links.png";
|
|
4
4
|
import SvgIconEdit from "../../../icons/components/IconEdit.js";
|
|
5
5
|
import HomeCard from "../HomeCard/HomeCard.js";
|
|
6
6
|
import Image from "../../../../components/Image/Image.js";
|
|
@@ -18,7 +18,7 @@ function UsefulLinks({
|
|
|
18
18
|
"data-testid": "usefullinks-button-edit"
|
|
19
19
|
} }),
|
|
20
20
|
/* @__PURE__ */ jsx(HomeCard.Content, { children: links.length === 0 ? /* @__PURE__ */ jsxs("div", { className: "useful-links-widget__empty", children: [
|
|
21
|
-
/* @__PURE__ */ jsx(Image, { src:
|
|
21
|
+
/* @__PURE__ */ jsx(Image, { src: illuEmptyUsefulLinks, alt: "", "aria-hidden": "true", style: {
|
|
22
22
|
width: 160,
|
|
23
23
|
height: 87
|
|
24
24
|
} }),
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
2
2
|
import { useTranslation } from "react-i18next";
|
|
3
|
-
import
|
|
3
|
+
import illuEmptyUsefulLinks from "@edifice.io/bootstrap/dist/images/homepage/illu-empty-useful-links.png";
|
|
4
4
|
import SvgIconClose from "../../../icons/components/IconClose.js";
|
|
5
5
|
import SvgIconEdit from "../../../icons/components/IconEdit.js";
|
|
6
6
|
import SvgIconPlus from "../../../icons/components/IconPlus.js";
|
|
@@ -29,7 +29,7 @@ function UsefulLinksModal({
|
|
|
29
29
|
/* @__PURE__ */ jsx(ModalBeta.Body, { children: links.length === 0 ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
30
30
|
/* @__PURE__ */ jsx(Flex, { justify: "end", className: "mb-16", children: addLinkButton }),
|
|
31
31
|
/* @__PURE__ */ jsxs("div", { className: "useful-links-modal__empty", children: [
|
|
32
|
-
/* @__PURE__ */ jsx(Image, { src:
|
|
32
|
+
/* @__PURE__ */ jsx(Image, { src: illuEmptyUsefulLinks, alt: "", "aria-hidden": "true", style: {
|
|
33
33
|
width: 200,
|
|
34
34
|
height: 109
|
|
35
35
|
} }),
|
|
@@ -5,10 +5,8 @@ export type UserSpaceProps = {
|
|
|
5
5
|
avatar: string;
|
|
6
6
|
profile: UserProfile[number];
|
|
7
7
|
children?: ReactNode;
|
|
8
|
-
/** Renders a trigger button in the top-right corner when provided. */
|
|
9
|
-
onCustomizeWidgetsClick?: () => void;
|
|
10
8
|
};
|
|
11
|
-
declare function UserSpace({ name, avatar, profile, children,
|
|
9
|
+
declare function UserSpace({ name, avatar, profile, children, }: UserSpaceProps): import("react/jsx-runtime").JSX.Element;
|
|
12
10
|
declare namespace UserSpace {
|
|
13
11
|
var displayName: string;
|
|
14
12
|
}
|
|
@@ -1,33 +1,27 @@
|
|
|
1
1
|
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
2
|
import { useTranslation } from "react-i18next";
|
|
3
|
-
import SvgIconAddWidget from "../../../icons/components/IconAddWidget.js";
|
|
4
3
|
import SvgIconClass from "../../../icons/components/IconClass.js";
|
|
5
4
|
import { useProfileLinks } from "./hooks/useProfileLinks.js";
|
|
6
5
|
import HomeCard from "../HomeCard/HomeCard.js";
|
|
7
6
|
import Flex from "../../../../components/Flex/Flex.js";
|
|
8
7
|
import Avatar from "../../../../components/Avatar/Avatar.js";
|
|
9
|
-
import IconButton from "../../../../components/Button/IconButton.js";
|
|
10
8
|
import ButtonBeta from "../../../../components/ButtonBeta/ButtonBeta.js";
|
|
11
9
|
function UserSpace({
|
|
12
10
|
name,
|
|
13
11
|
avatar,
|
|
14
12
|
profile,
|
|
15
|
-
children
|
|
16
|
-
onCustomizeWidgetsClick
|
|
13
|
+
children
|
|
17
14
|
}) {
|
|
18
15
|
const {
|
|
19
16
|
t
|
|
20
17
|
} = useTranslation(), links = useProfileLinks(profile);
|
|
21
18
|
return /* @__PURE__ */ jsxs(HomeCard, { variant: "user", footer: !!links && /* @__PURE__ */ jsx(Flex, { children: links.map((link, index) => /* @__PURE__ */ jsx(ButtonBeta, { size: "sm", variant: "ghost", leftIcon: /* @__PURE__ */ jsx(SvgIconClass, {}), onClick: () => window.location.href = link.url, children: link.text }, `${link.url}-${index}`)) }), children: [
|
|
22
|
-
/* @__PURE__ */ jsxs(Flex, { className: "user-space", direction: "row",
|
|
23
|
-
/* @__PURE__ */
|
|
24
|
-
|
|
25
|
-
/* @__PURE__ */
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
] })
|
|
29
|
-
] }),
|
|
30
|
-
onCustomizeWidgetsClick && /* @__PURE__ */ jsx(IconButton, { className: "user-space--customize-widgets", icon: /* @__PURE__ */ jsx(SvgIconAddWidget, {}), variant: "ghost", color: "tertiary", "aria-label": t("homepage.userSpace.customizeWidgets"), onClick: onCustomizeWidgetsClick })
|
|
19
|
+
/* @__PURE__ */ jsxs(Flex, { className: "user-space", direction: "row", gap: "8", children: [
|
|
20
|
+
/* @__PURE__ */ jsx(Avatar, { className: "user-space--avatar", size: "auto", alt: name, src: avatar, variant: "circle" }),
|
|
21
|
+
/* @__PURE__ */ jsxs(Flex, { direction: "column", children: [
|
|
22
|
+
/* @__PURE__ */ jsx("div", { "data-testid": "user-space-name", className: "user-space--name", children: name }),
|
|
23
|
+
/* @__PURE__ */ jsx("div", { "data-testid": "user-space-profile", className: "user-space--profile", children: t(profile) })
|
|
24
|
+
] })
|
|
31
25
|
] }),
|
|
32
26
|
children && /* @__PURE__ */ jsx(HomeCard.Content, { children })
|
|
33
27
|
] });
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
|
-
export
|
|
2
|
+
export declare function UserSpaceContainer({ children }: {
|
|
3
3
|
children?: ReactNode;
|
|
4
|
-
|
|
5
|
-
}
|
|
6
|
-
export declare function UserSpaceContainer({ children, onCustomizeWidgetsClick, }: UserSpaceContainerProps): import("react/jsx-runtime").JSX.Element | null;
|
|
4
|
+
}): import("react/jsx-runtime").JSX.Element | null;
|
|
7
5
|
export declare namespace UserSpaceContainer {
|
|
8
6
|
var displayName: string;
|
|
9
7
|
}
|
|
@@ -2,8 +2,7 @@ import { jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import UserSpace from "./UserSpace.js";
|
|
3
3
|
import useUser from "../../../../hooks/useUser/useUser.js";
|
|
4
4
|
function UserSpaceContainer({
|
|
5
|
-
children
|
|
6
|
-
onCustomizeWidgetsClick
|
|
5
|
+
children
|
|
7
6
|
}) {
|
|
8
7
|
var _a;
|
|
9
8
|
const {
|
|
@@ -13,7 +12,7 @@ function UserSpaceContainer({
|
|
|
13
12
|
} = useUser();
|
|
14
13
|
if (!user || !userDescription) return null;
|
|
15
14
|
const name = user.username || "", profile = ((_a = userDescription.profiles) == null ? void 0 : _a[0]) || "Guest";
|
|
16
|
-
return /* @__PURE__ */ jsx(UserSpace, { name, profile, avatar,
|
|
15
|
+
return /* @__PURE__ */ jsx(UserSpace, { name, profile, avatar, children });
|
|
17
16
|
}
|
|
18
17
|
export {
|
|
19
18
|
UserSpaceContainer
|
|
@@ -1,18 +1,10 @@
|
|
|
1
|
-
export * from './Agenda';
|
|
2
|
-
export * from './Communities';
|
|
3
|
-
export * from './BriefMe';
|
|
4
|
-
export * from './Cantine';
|
|
5
1
|
export * from './Favorites';
|
|
6
|
-
export * from './GenerationHdf';
|
|
7
2
|
export * from './Header';
|
|
8
3
|
export * from './HomeCard';
|
|
9
4
|
export * from './LastInfos';
|
|
10
5
|
export * from './MessageFlashList';
|
|
11
6
|
export * from './Notifications';
|
|
12
|
-
export * from './Qwant';
|
|
13
|
-
export * from './Rss';
|
|
14
7
|
export * from './SchoolSpace';
|
|
15
8
|
export * from './UsefulLinks';
|
|
16
|
-
export * from './Universalis';
|
|
17
9
|
export * from './UserSpace';
|
|
18
|
-
export * from './
|
|
10
|
+
export * from './Communities';
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
export { default as IconAddUser } from './IconAddUser';
|
|
2
|
-
export { default as IconAddWidget } from './IconAddWidget';
|
|
3
2
|
export { default as IconAdd } from './IconAdd';
|
|
4
3
|
export { default as IconAdjustSettings } from './IconAdjustSettings';
|
|
5
4
|
export { default as IconAiFill } from './IconAiFill';
|
|
@@ -85,7 +84,6 @@ export { default as IconLink } from './IconLink';
|
|
|
85
84
|
export { default as IconListOrder } from './IconListOrder';
|
|
86
85
|
export { default as IconLoader } from './IconLoader';
|
|
87
86
|
export { default as IconLock } from './IconLock';
|
|
88
|
-
export { default as IconLogout } from './IconLogout';
|
|
89
87
|
export { default as IconLsuArt } from './IconLsuArt';
|
|
90
88
|
export { default as IconLsuCompetenceNumerique } from './IconLsuCompetenceNumerique';
|
|
91
89
|
export { default as IconLsuEmc } from './IconLsuEmc';
|
|
@@ -51,12 +51,19 @@ const DEFAULT_INPUT_MAX_LENGTH = 60, DEFAULT_TEXTAREA_MAX_LENGTH = 400, Resource
|
|
|
51
51
|
} = useForm({
|
|
52
52
|
mode: "onChange",
|
|
53
53
|
defaultValues: {
|
|
54
|
-
description:
|
|
55
|
-
enablePublic:
|
|
56
|
-
title:
|
|
57
|
-
formSlug:
|
|
58
|
-
allowReplies:
|
|
59
|
-
}
|
|
54
|
+
description: "",
|
|
55
|
+
enablePublic: !1,
|
|
56
|
+
title: "",
|
|
57
|
+
formSlug: "",
|
|
58
|
+
allowReplies: !0
|
|
59
|
+
},
|
|
60
|
+
values: isUpdating && resource ? {
|
|
61
|
+
description: resource.description ?? "",
|
|
62
|
+
enablePublic: resource.public ?? !1,
|
|
63
|
+
title: resource.name ?? "",
|
|
64
|
+
formSlug: resource.slug ?? "",
|
|
65
|
+
allowReplies: resource.allowReplies ?? !0
|
|
66
|
+
} : void 0
|
|
60
67
|
}), {
|
|
61
68
|
ref: mediaLibraryRef,
|
|
62
69
|
libraryMedia,
|
|
@@ -143,9 +150,9 @@ const DEFAULT_INPUT_MAX_LENGTH = 60, DEFAULT_TEXTAREA_MAX_LENGTH = 400, Resource
|
|
|
143
150
|
maxLength: textareaMaxLength
|
|
144
151
|
}), placeholder: ((_f = customT.placeholder) == null ? void 0 : _f.description) ?? t("explorer.resource.editModal.description.placeholder"), size: "md", maxLength: textareaMaxLength, showCounter: !0 })
|
|
145
152
|
] }),
|
|
146
|
-
application === "blog" && hasOptionalCommentRepliesWorkflow === !0 && /* @__PURE__ */ jsxs(
|
|
147
|
-
/* @__PURE__ */ jsx(
|
|
148
|
-
/* @__PURE__ */ jsx(
|
|
153
|
+
application === "blog" && hasOptionalCommentRepliesWorkflow === !0 && /* @__PURE__ */ jsxs("div", { className: "form-check d-flex align-items-center gap-8 mt-16 mb-8", children: [
|
|
154
|
+
/* @__PURE__ */ jsx("input", { id: "allowReplies", type: "checkbox", className: "form-check-input mt-0", defaultChecked: isUpdating ? resource.allowReplies : !0, ...register("allowReplies") }),
|
|
155
|
+
/* @__PURE__ */ jsx("label", { htmlFor: "allowReplies", className: "form-check-label mb-0", children: t("explorer.resource.editModal.comments.allowReplies") })
|
|
149
156
|
] })
|
|
150
157
|
] })
|
|
151
158
|
] }),
|
|
@@ -4,8 +4,7 @@ import SvgIconCopy from "../../../icons/components/IconCopy.js";
|
|
|
4
4
|
import { useSlug } from "../hooks/useSlug.js";
|
|
5
5
|
import Heading from "../../../../components/Heading/Heading.js";
|
|
6
6
|
import Alert from "../../../../components/Alert/Alert.js";
|
|
7
|
-
import
|
|
8
|
-
import Input from "../../../../components/Input/Input.js";
|
|
7
|
+
import Switch from "../../../../components/Switch/Switch.js";
|
|
9
8
|
import Button from "../../../../components/Button/Button.js";
|
|
10
9
|
const BlogPublic = ({
|
|
11
10
|
appCode,
|
|
@@ -34,18 +33,15 @@ const BlogPublic = ({
|
|
|
34
33
|
appCode
|
|
35
34
|
] }),
|
|
36
35
|
/* @__PURE__ */ jsx(Alert, { type: "info", children: t("explorer.resource.editModal.access.alert") }),
|
|
37
|
-
/* @__PURE__ */
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
}), className: "form-check-input mt-0", size: "md" }),
|
|
45
|
-
/* @__PURE__ */ jsx(FormControl.Label, { className: "form-check-label mb-0", children: t("explorer.resource.editModal.access.flexSwitchCheckDefault.label") })
|
|
46
|
-
] }),
|
|
36
|
+
/* @__PURE__ */ jsx(Switch, { id: "flexSwitchCheckDefault", role: "switch", className: "mt-16 mb-8", label: t("explorer.resource.editModal.access.flexSwitchCheckDefault.label"), defaultChecked: isUpdating ? resource.public : !1, ...register("enablePublic", {
|
|
37
|
+
disabled: !resourceName,
|
|
38
|
+
onChange: (event) => {
|
|
39
|
+
const checked = event.target.checked;
|
|
40
|
+
onPublicChange(checked);
|
|
41
|
+
}
|
|
42
|
+
}) }),
|
|
47
43
|
isPublic && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
48
|
-
/* @__PURE__ */ jsx(
|
|
44
|
+
/* @__PURE__ */ jsx("input", { type: "hidden", defaultValue: isUpdating ? slug : "", ...register("formSlug") }, slug),
|
|
49
45
|
/* @__PURE__ */ jsxs("div", { className: "d-flex flex-wrap align-items-center gap-4", children: [
|
|
50
46
|
/* @__PURE__ */ jsxs("p", { className: "text-break", children: [
|
|
51
47
|
window.location.origin,
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
1
2
|
import { App, ILinkedResource } from '@edifice.io/client';
|
|
2
3
|
/**
|
|
3
4
|
* Definition of an internal link.
|
|
@@ -32,6 +33,11 @@ export interface InternalLinkerProps {
|
|
|
32
33
|
applicationList?: ApplicationOption[];
|
|
33
34
|
/** Whether to show the application selector */
|
|
34
35
|
showApplicationSelector?: boolean;
|
|
36
|
+
/**
|
|
37
|
+
* Rendered on the search row, where the application selector sits, for
|
|
38
|
+
* consumers that hide that selector but still need a filter of their own.
|
|
39
|
+
*/
|
|
40
|
+
searchFilter?: ReactNode;
|
|
35
41
|
/** Disable application selecetor */
|
|
36
42
|
disableApplicationSelector?: boolean;
|
|
37
43
|
/** Optional callback to filter resources after loading. Applied in addition to search filters. */
|
|
@@ -49,5 +55,5 @@ export interface InternalLinkerProps {
|
|
|
49
55
|
/** Label for the "load more" button. Defaults to the `bbm.linker.see.more` i18n key. */
|
|
50
56
|
loadMoreLabel?: string;
|
|
51
57
|
}
|
|
52
|
-
export declare const InternalLinker: ({ appCode, defaultAppCode, defaultResourceId, onChange, onSelect, multiple, resourceList, applicationList, showApplicationSelector, disableApplicationSelector, resourceFilter, onSearch, hasMoreResources, onLoadMore, loadMoreLabel, }: InternalLinkerProps) => import("react/jsx-runtime").JSX.Element;
|
|
58
|
+
export declare const InternalLinker: ({ appCode, defaultAppCode, defaultResourceId, onChange, onSelect, multiple, resourceList, applicationList, showApplicationSelector, searchFilter, disableApplicationSelector, resourceFilter, onSearch, hasMoreResources, onLoadMore, loadMoreLabel, }: InternalLinkerProps) => import("react/jsx-runtime").JSX.Element;
|
|
53
59
|
export default InternalLinker;
|
|
@@ -23,6 +23,7 @@ const InternalLinker = ({
|
|
|
23
23
|
resourceList,
|
|
24
24
|
applicationList,
|
|
25
25
|
showApplicationSelector = !0,
|
|
26
|
+
searchFilter,
|
|
26
27
|
disableApplicationSelector = !1,
|
|
27
28
|
resourceFilter,
|
|
28
29
|
onSearch,
|
|
@@ -131,6 +132,7 @@ const InternalLinker = ({
|
|
|
131
132
|
] }), variant: "ghost", size: "md", disabled: disableApplicationSelector }),
|
|
132
133
|
/* @__PURE__ */ jsx(Dropdown.Menu, { children: options == null ? void 0 : options.map((option) => /* @__PURE__ */ jsx(Dropdown.Item, { icon: option.icon, onClick: () => handleOptionClick(option), children: option.displayName }, option.application)) })
|
|
133
134
|
] }) }),
|
|
135
|
+
!showApplicationSelector && searchFilter && /* @__PURE__ */ jsx("div", { className: "flex-shrink-1 px-8 py-12 border-end align-self-center", children: searchFilter }),
|
|
134
136
|
/* @__PURE__ */ jsx("div", { className: "flex-grow-1 align-self-center", children: /* @__PURE__ */ jsx("form", { className: "gap-16 d-flex w-100 align-items-center px-16 py-8", onSubmit: handleSubmit, children: /* @__PURE__ */ jsx(SearchBar, { isVariant: !0, placeholder: t("search"), size: "lg", className: "w-100", disabled: !selectedApplication, onChange: handleSearchChange }) }) })
|
|
135
137
|
] }),
|
|
136
138
|
/* @__PURE__ */ jsxs("div", { className: "internal-linker flex-grow-1 w-100 rounded-bottom border gap-0 overflow-auto", children: [
|
|
@@ -65,6 +65,8 @@ export interface MediaLibraryProps {
|
|
|
65
65
|
visibility: WorkspaceVisibility;
|
|
66
66
|
/** Allow selecting / uploading multiple files at once ? */
|
|
67
67
|
multiple?: boolean;
|
|
68
|
+
/** Restrict attachments to PDF files in Workspace and Upload. */
|
|
69
|
+
pdfOnly?: boolean;
|
|
68
70
|
/**
|
|
69
71
|
* Called when the user validates the modal (Add button).
|
|
70
72
|
* @param result depends on which InnerTab is visible
|
|
@@ -70,6 +70,7 @@ const orderedTabs = [
|
|
|
70
70
|
appCode,
|
|
71
71
|
visibility,
|
|
72
72
|
multiple,
|
|
73
|
+
pdfOnly,
|
|
73
74
|
onSuccess,
|
|
74
75
|
onCancel,
|
|
75
76
|
onTabChange
|
|
@@ -224,6 +225,7 @@ const orderedTabs = [
|
|
|
224
225
|
appCode,
|
|
225
226
|
visibility,
|
|
226
227
|
multiple,
|
|
228
|
+
pdfOnly,
|
|
227
229
|
type,
|
|
228
230
|
setResultCounter,
|
|
229
231
|
setResult,
|
|
@@ -7,6 +7,8 @@ export declare const MediaLibraryContext: import('react').Context<{
|
|
|
7
7
|
visibility?: WorkspaceVisibility;
|
|
8
8
|
/** Allow selecting / uploading multiple files at once ? */
|
|
9
9
|
multiple?: boolean;
|
|
10
|
+
/** Restrict attachments to PDF files in Workspace and Upload. */
|
|
11
|
+
pdfOnly?: boolean;
|
|
10
12
|
/** Type of resource to search for. */
|
|
11
13
|
type: MediaLibraryType | null;
|
|
12
14
|
/** Set the counter in the success button label. */
|
|
@@ -36,6 +38,8 @@ export declare function useMediaLibraryContext(): {
|
|
|
36
38
|
visibility?: WorkspaceVisibility;
|
|
37
39
|
/** Allow selecting / uploading multiple files at once ? */
|
|
38
40
|
multiple?: boolean;
|
|
41
|
+
/** Restrict attachments to PDF files in Workspace and Upload. */
|
|
42
|
+
pdfOnly?: boolean;
|
|
39
43
|
/** Type of resource to search for. */
|
|
40
44
|
type: MediaLibraryType | null;
|
|
41
45
|
/** Set the counter in the success button label. */
|
|
@@ -36,6 +36,7 @@ const acceptedTypes = (type) => {
|
|
|
36
36
|
t
|
|
37
37
|
} = useTranslation(), {
|
|
38
38
|
type,
|
|
39
|
+
pdfOnly,
|
|
39
40
|
visibility,
|
|
40
41
|
multiple,
|
|
41
42
|
setResult,
|
|
@@ -60,7 +61,7 @@ const acceptedTypes = (type) => {
|
|
|
60
61
|
/* @__PURE__ */ jsx(Radio, { label: t("bbm.upload.sort.alpha"), name: "media-library-upload-sort", value: "alpha", model: sortByAlpha ? "alpha" : "date", checked: sortByAlpha, onChange: () => setSortByAlpha(!0), "data-testid": "media-library-upload-sort-alpha" }),
|
|
61
62
|
/* @__PURE__ */ jsx(Radio, { label: t("bbm.upload.sort.date"), name: "media-library-upload-sort", value: "date", model: sortByAlpha ? "alpha" : "date", checked: !sortByAlpha, onChange: () => setSortByAlpha(!1), "data-testid": "media-library-upload-sort-date" })
|
|
62
63
|
] }),
|
|
63
|
-
/* @__PURE__ */ jsx(Dropzone, { multiple, accept: acceptedTypes(type ?? "embedder"), children: /* @__PURE__ */ jsx(UploadFiles, { onFilesChange: handleOnFilesChange, visibility }) })
|
|
64
|
+
/* @__PURE__ */ jsx(Dropzone, { multiple, accept: type === "attachment" && pdfOnly ? ["application/pdf"] : acceptedTypes(type ?? "embedder"), children: /* @__PURE__ */ jsx(UploadFiles, { onFilesChange: handleOnFilesChange, visibility }) })
|
|
64
65
|
] });
|
|
65
66
|
};
|
|
66
67
|
export {
|
|
@@ -4,6 +4,7 @@ import Workspace$1 from "../../Workspace/Workspace.js";
|
|
|
4
4
|
const Workspace = () => {
|
|
5
5
|
const {
|
|
6
6
|
type,
|
|
7
|
+
pdfOnly,
|
|
7
8
|
setResultCounter,
|
|
8
9
|
setResult,
|
|
9
10
|
multiple,
|
|
@@ -17,6 +18,8 @@ const Workspace = () => {
|
|
|
17
18
|
return "audio";
|
|
18
19
|
case "video":
|
|
19
20
|
return "video";
|
|
21
|
+
case "attachment":
|
|
22
|
+
return pdfOnly ? "pdf" : null;
|
|
20
23
|
default:
|
|
21
24
|
return null;
|
|
22
25
|
}
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
import { getText, getTextSerializersFromSchema, posToDOMRect, Extension } from "@tiptap/core";
|
|
2
|
+
import { flip, shift, offset, arrow, size, autoPlacement, hide, inline, computePosition } from "@floating-ui/dom";
|
|
3
|
+
import { Plugin, PluginKey } from "../../../../../prosemirror-state@1.4.4/node_modules/prosemirror-state/dist/index.js";
|
|
4
|
+
var FloatingMenuView = class {
|
|
5
|
+
getTextContent(node) {
|
|
6
|
+
return getText(node, { textSerializers: getTextSerializersFromSchema(this.editor.schema) });
|
|
7
|
+
}
|
|
8
|
+
get middlewares() {
|
|
9
|
+
const middlewares = [];
|
|
10
|
+
return this.floatingUIOptions.flip && middlewares.push(flip(typeof this.floatingUIOptions.flip != "boolean" ? this.floatingUIOptions.flip : void 0)), this.floatingUIOptions.shift && middlewares.push(shift(typeof this.floatingUIOptions.shift != "boolean" ? this.floatingUIOptions.shift : void 0)), this.floatingUIOptions.offset && middlewares.push(offset(typeof this.floatingUIOptions.offset != "boolean" ? this.floatingUIOptions.offset : void 0)), this.floatingUIOptions.arrow && middlewares.push(arrow(this.floatingUIOptions.arrow)), this.floatingUIOptions.size && middlewares.push(size(typeof this.floatingUIOptions.size != "boolean" ? this.floatingUIOptions.size : void 0)), this.floatingUIOptions.autoPlacement && middlewares.push(autoPlacement(typeof this.floatingUIOptions.autoPlacement != "boolean" ? this.floatingUIOptions.autoPlacement : void 0)), this.floatingUIOptions.hide && middlewares.push(hide(typeof this.floatingUIOptions.hide != "boolean" ? this.floatingUIOptions.hide : void 0)), this.floatingUIOptions.inline && middlewares.push(inline(typeof this.floatingUIOptions.inline != "boolean" ? this.floatingUIOptions.inline : void 0)), middlewares;
|
|
11
|
+
}
|
|
12
|
+
constructor({ editor, element, view, pluginKey = "floatingMenu", updateDelay = 250, resizeDelay = 60, options, appendTo, shouldShow }) {
|
|
13
|
+
var _options$scrollTarget;
|
|
14
|
+
this.preventHide = !1, this.isVisible = !1, this.scrollTarget = window, this.shouldShow = ({ view: view2, state }) => {
|
|
15
|
+
const { selection } = state, { $anchor, empty } = selection, isRootDepth = $anchor.depth === 1, isEmptyTextBlock = $anchor.parent.isTextblock && !$anchor.parent.type.spec.code && !$anchor.parent.textContent && $anchor.parent.childCount === 0 && !this.getTextContent($anchor.parent);
|
|
16
|
+
return !(!view2.hasFocus() || !empty || !isRootDepth || !isEmptyTextBlock || !this.editor.isEditable);
|
|
17
|
+
}, this.floatingUIOptions = {
|
|
18
|
+
strategy: "absolute",
|
|
19
|
+
placement: "right",
|
|
20
|
+
offset: 8,
|
|
21
|
+
flip: {},
|
|
22
|
+
shift: {},
|
|
23
|
+
arrow: !1,
|
|
24
|
+
size: !1,
|
|
25
|
+
autoPlacement: !1,
|
|
26
|
+
hide: !1,
|
|
27
|
+
inline: !1
|
|
28
|
+
}, this.updateHandler = (view2, selectionChanged, docChanged, oldState) => {
|
|
29
|
+
const { composing } = view2;
|
|
30
|
+
if (!(composing || !selectionChanged && !docChanged)) {
|
|
31
|
+
if (!this.getShouldShow(oldState)) {
|
|
32
|
+
this.hide();
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
this.updatePosition(), this.show();
|
|
36
|
+
}
|
|
37
|
+
}, this.mousedownHandler = () => {
|
|
38
|
+
this.preventHide = !0;
|
|
39
|
+
}, this.focusHandler = () => {
|
|
40
|
+
setTimeout(() => this.update(this.editor.view));
|
|
41
|
+
}, this.blurHandler = ({ event }) => {
|
|
42
|
+
var _this$element$parentN;
|
|
43
|
+
if (this.preventHide) {
|
|
44
|
+
this.preventHide = !1;
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
event != null && event.relatedTarget && (!((_this$element$parentN = this.element.parentNode) === null || _this$element$parentN === void 0) && _this$element$parentN.contains(event.relatedTarget)) || (event == null ? void 0 : event.relatedTarget) !== this.editor.view.dom && this.hide();
|
|
48
|
+
}, this.transactionHandler = ({ transaction: tr }) => {
|
|
49
|
+
const meta = tr.getMeta(this.pluginKey);
|
|
50
|
+
meta === "updatePosition" ? this.updatePosition() : meta && typeof meta == "object" && meta.type === "updateOptions" ? this.updateOptions(meta.options) : meta === "hide" ? this.hide() : meta === "show" && (this.updatePosition(), this.show());
|
|
51
|
+
}, this.resizeHandler = () => {
|
|
52
|
+
this.resizeDebounceTimer && clearTimeout(this.resizeDebounceTimer), this.resizeDebounceTimer = window.setTimeout(() => {
|
|
53
|
+
this.updatePosition();
|
|
54
|
+
}, this.resizeDelay);
|
|
55
|
+
}, this.editor = editor, this.element = element, this.view = view, this.pluginKey = pluginKey, this.updateDelay = updateDelay, this.resizeDelay = resizeDelay, this.appendTo = appendTo, this.scrollTarget = (_options$scrollTarget = options == null ? void 0 : options.scrollTarget) !== null && _options$scrollTarget !== void 0 ? _options$scrollTarget : window, this.floatingUIOptions = {
|
|
56
|
+
...this.floatingUIOptions,
|
|
57
|
+
...options
|
|
58
|
+
}, this.element.tabIndex = 0, shouldShow && (this.shouldShow = shouldShow), this.element.addEventListener("mousedown", this.mousedownHandler, { capture: !0 }), this.editor.on("focus", this.focusHandler), this.editor.on("blur", this.blurHandler), this.editor.on("transaction", this.transactionHandler), window.addEventListener("resize", this.resizeHandler), this.scrollTarget.addEventListener("scroll", this.resizeHandler), this.update(view, view.state), this.getShouldShow() && (this.show(), this.updatePosition());
|
|
59
|
+
}
|
|
60
|
+
getShouldShow(oldState) {
|
|
61
|
+
var _this$shouldShow;
|
|
62
|
+
const { state } = this.view, { selection } = state, { ranges } = selection, from = Math.min(...ranges.map((range) => range.$from.pos)), to = Math.max(...ranges.map((range) => range.$to.pos));
|
|
63
|
+
return (_this$shouldShow = this.shouldShow) === null || _this$shouldShow === void 0 ? void 0 : _this$shouldShow.call(this, {
|
|
64
|
+
editor: this.editor,
|
|
65
|
+
view: this.view,
|
|
66
|
+
state,
|
|
67
|
+
oldState,
|
|
68
|
+
from,
|
|
69
|
+
to
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
updateOptions(newProps) {
|
|
73
|
+
if (newProps.updateDelay !== void 0 && (this.updateDelay = newProps.updateDelay), newProps.resizeDelay !== void 0 && (this.resizeDelay = newProps.resizeDelay), newProps.appendTo !== void 0 && (this.appendTo = newProps.appendTo), newProps.shouldShow !== void 0 && newProps.shouldShow && (this.shouldShow = newProps.shouldShow), newProps.options !== void 0) {
|
|
74
|
+
var _newProps$options$scr;
|
|
75
|
+
const newScrollTarget = (_newProps$options$scr = newProps.options.scrollTarget) !== null && _newProps$options$scr !== void 0 ? _newProps$options$scr : window;
|
|
76
|
+
newScrollTarget !== this.scrollTarget && (this.scrollTarget.removeEventListener("scroll", this.resizeHandler), this.scrollTarget = newScrollTarget, this.scrollTarget.addEventListener("scroll", this.resizeHandler)), this.floatingUIOptions = {
|
|
77
|
+
...this.floatingUIOptions,
|
|
78
|
+
...newProps.options
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
updatePosition() {
|
|
83
|
+
var _this$view;
|
|
84
|
+
if (!(!((_this$view = this.view) === null || _this$view === void 0 || (_this$view = _this$view.dom) === null || _this$view === void 0) && _this$view.parentNode)) return;
|
|
85
|
+
const { selection } = this.editor.state, domRect = posToDOMRect(this.view, selection.from, selection.to);
|
|
86
|
+
computePosition({
|
|
87
|
+
getBoundingClientRect: () => domRect,
|
|
88
|
+
getClientRects: () => [domRect]
|
|
89
|
+
}, this.element, {
|
|
90
|
+
placement: this.floatingUIOptions.placement,
|
|
91
|
+
strategy: this.floatingUIOptions.strategy,
|
|
92
|
+
middleware: this.middlewares
|
|
93
|
+
}).then(({ x, y, strategy, middlewareData }) => {
|
|
94
|
+
var _middlewareData$hide, _middlewareData$hide2;
|
|
95
|
+
if (!((_middlewareData$hide = middlewareData.hide) === null || _middlewareData$hide === void 0) && _middlewareData$hide.referenceHidden || !((_middlewareData$hide2 = middlewareData.hide) === null || _middlewareData$hide2 === void 0) && _middlewareData$hide2.escaped) {
|
|
96
|
+
this.element.style.visibility = "hidden";
|
|
97
|
+
return;
|
|
98
|
+
}
|
|
99
|
+
this.element.style.visibility = "visible", this.element.style.width = "max-content", this.element.style.position = strategy, this.element.style.left = `${x}px`, this.element.style.top = `${y}px`, this.isVisible && this.floatingUIOptions.onUpdate && this.floatingUIOptions.onUpdate();
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
update(view, oldState) {
|
|
103
|
+
const selectionChanged = !(oldState != null && oldState.selection.eq(view.state.selection)), docChanged = !(oldState != null && oldState.doc.eq(view.state.doc));
|
|
104
|
+
this.updateHandler(view, selectionChanged, docChanged, oldState);
|
|
105
|
+
}
|
|
106
|
+
show() {
|
|
107
|
+
var _ref;
|
|
108
|
+
if (this.isVisible) return;
|
|
109
|
+
this.element.style.visibility = "visible", this.element.style.opacity = "1";
|
|
110
|
+
const appendToElement = typeof this.appendTo == "function" ? this.appendTo() : this.appendTo;
|
|
111
|
+
(_ref = appendToElement ?? this.view.dom.parentElement) === null || _ref === void 0 || _ref.appendChild(this.element), this.floatingUIOptions.onShow && this.floatingUIOptions.onShow(), this.isVisible = !0;
|
|
112
|
+
}
|
|
113
|
+
hide() {
|
|
114
|
+
this.isVisible && (this.element.style.visibility = "hidden", this.element.style.opacity = "0", this.element.remove(), this.floatingUIOptions.onHide && this.floatingUIOptions.onHide(), this.isVisible = !1);
|
|
115
|
+
}
|
|
116
|
+
destroy() {
|
|
117
|
+
this.hide(), this.element.removeEventListener("mousedown", this.mousedownHandler, { capture: !0 }), window.removeEventListener("resize", this.resizeHandler), this.scrollTarget.removeEventListener("scroll", this.resizeHandler), this.editor.off("focus", this.focusHandler), this.editor.off("blur", this.blurHandler), this.editor.off("transaction", this.transactionHandler), this.floatingUIOptions.onDestroy && this.floatingUIOptions.onDestroy();
|
|
118
|
+
}
|
|
119
|
+
};
|
|
120
|
+
const FloatingMenuPlugin = (options) => new Plugin({
|
|
121
|
+
key: typeof options.pluginKey == "string" ? new PluginKey(options.pluginKey) : options.pluginKey,
|
|
122
|
+
view: (view) => new FloatingMenuView({
|
|
123
|
+
view,
|
|
124
|
+
...options
|
|
125
|
+
})
|
|
126
|
+
});
|
|
127
|
+
Extension.create({
|
|
128
|
+
name: "floatingMenu",
|
|
129
|
+
addOptions() {
|
|
130
|
+
return {
|
|
131
|
+
element: null,
|
|
132
|
+
options: {},
|
|
133
|
+
pluginKey: "floatingMenu",
|
|
134
|
+
updateDelay: void 0,
|
|
135
|
+
resizeDelay: void 0,
|
|
136
|
+
appendTo: void 0,
|
|
137
|
+
shouldShow: null
|
|
138
|
+
};
|
|
139
|
+
},
|
|
140
|
+
addCommands() {
|
|
141
|
+
return { updateFloatingMenuPosition: () => ({ tr, dispatch }) => (dispatch && tr.setMeta(this.options.pluginKey, "updatePosition"), !0) };
|
|
142
|
+
},
|
|
143
|
+
addProseMirrorPlugins() {
|
|
144
|
+
return this.options.element ? [FloatingMenuPlugin({
|
|
145
|
+
pluginKey: this.options.pluginKey,
|
|
146
|
+
editor: this.editor,
|
|
147
|
+
element: this.options.element,
|
|
148
|
+
updateDelay: this.options.updateDelay,
|
|
149
|
+
resizeDelay: this.options.resizeDelay,
|
|
150
|
+
options: this.options.options,
|
|
151
|
+
appendTo: this.options.appendTo,
|
|
152
|
+
shouldShow: this.options.shouldShow
|
|
153
|
+
})] : [];
|
|
154
|
+
}
|
|
155
|
+
});
|
|
156
|
+
export {
|
|
157
|
+
FloatingMenuPlugin,
|
|
158
|
+
FloatingMenuView
|
|
159
|
+
};
|