@edifice.io/react 2.1.0-develop-enabling.0 → 2.1.0-develop-wl.20250204154502
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/README.md +3 -3
- package/dist/components/AppIcon/AppIcon.js +2 -2
- package/dist/components/Attachment/Attachment.js +1 -1
- package/dist/components/Button/Button.js +1 -1
- package/dist/components/Form/FormContext.js +1 -1
- package/dist/components/Form/FormControl.js +1 -1
- package/dist/components/Layout/components/Header.js +5 -4
- package/dist/components/Layout/components/WidgetApps.js +1 -1
- package/dist/{hooks/useHeader → components/Layout/hooks}/useHeader.js +6 -6
- package/dist/components/Modal/Modal.js +1 -1
- package/dist/components/Tree/components/SortableTree.js +3 -2
- package/dist/components/Tree/types/index.d.ts +1 -0
- package/dist/components/Tree/utilities/tree.d.ts +2 -1
- package/dist/hooks/index.d.ts +1 -5
- package/dist/hooks/useConf/useConf.d.ts +2 -2
- package/dist/hooks/useDropdown/useDropdown.js +1 -1
- package/dist/hooks/useDropzone/useDropzone.js +1 -1
- package/dist/hooks/useHasWorkflow/useHasWorkflow.js +3 -11
- package/dist/hooks/useHttpErrorToast/index.d.ts +1 -0
- package/dist/hooks/useHttpErrorToast/useHttpErrorToast.d.ts +3 -0
- package/dist/hooks/useHttpErrorToast/useHttpErrorToast.js +21 -0
- package/dist/hooks/useSession/useSession.d.ts +2 -1
- package/dist/hooks/useTrapFocus/useTrapFocus.d.ts +1 -1
- package/dist/hooks/useTrapFocus/useTrapFocus.js +3 -2
- package/dist/hooks/useUploadFiles/useUploadFiles.js +1 -1
- package/dist/hooks/useWorkspaceSearch/useWorkspaceSearch.js +3 -11
- package/dist/icons-apps.js +220 -218
- package/dist/index.js +138 -144
- package/dist/modules/audience/ReactionChoice.d.ts +13 -0
- package/dist/modules/audience/ReactionModal.Card.js +4 -4
- package/dist/modules/audience/ReactionModal.d.ts +24 -6
- package/dist/modules/audience/ReactionModal.js +12 -9
- package/dist/modules/audience/ReactionSummary.d.ts +9 -0
- package/dist/modules/audience/ViewsCounter.d.ts +10 -0
- package/dist/modules/audience/ViewsModal.d.ts +13 -1
- package/dist/modules/audience/ViewsModal.js +22 -19
- package/dist/modules/comments/components/Comment.js +10 -7
- package/dist/modules/comments/components/CommentAvatar.js +1 -1
- package/dist/modules/comments/components/DeleteModal.d.ts +7 -0
- package/dist/modules/comments/components/DeleteModal.js +19 -0
- package/dist/modules/comments/context/Context.d.ts +2 -0
- package/dist/modules/comments/hooks/useComments.d.ts +5 -2
- package/dist/modules/comments/hooks/useComments.js +1 -1
- package/dist/modules/comments/hooks/useCommentsContext.d.ts +1 -0
- package/dist/modules/comments/hooks/useProfileQueries.d.ts +4 -1
- package/dist/modules/comments/provider/CommentProvider.js +3 -2
- package/dist/modules/comments/types.d.ts +5 -1
- package/dist/modules/editor/components/Editor/Editor.js +2 -2
- package/dist/modules/editor/components/{Editor → MathsModal}/MathsModal.d.ts +1 -1
- package/dist/modules/editor/components/{Editor → MathsModal}/MathsModal.js +2 -3
- package/dist/modules/editor/components/MathsModal/index.d.ts +1 -0
- package/dist/modules/editor/components/Renderer/AttachmentRenderer.js +12 -7
- package/dist/modules/editor/components/Renderer/AudioRenderer.js +4 -1
- package/dist/modules/editor/components/Renderer/LinkerRenderer.js +1 -1
- package/dist/modules/editor/components/Renderer/MediaRenderer.js +10 -2
- package/dist/modules/editor/hooks/useCommentEditor.d.ts +1 -1
- package/dist/modules/editor/hooks/useSpeechRecognition.js +2 -0
- package/dist/modules/editor/hooks/useSpeechSynthetisis.js +2 -0
- package/dist/modules/editor/hooks/useTipTapEditor.d.ts +1 -1
- package/dist/modules/editor/hooks/useTipTapEditor.js +4 -4
- package/dist/modules/icons/components/apps/IconAppointments.d.ts +7 -0
- package/dist/modules/icons/components/apps/IconAppointments.js +12 -0
- package/dist/modules/icons/components/apps/index.d.ts +1 -0
- package/dist/modules/multimedia/MediaLibrary/MediaLibrary.js +5 -1
- package/dist/modules/multimedia/UploadCard/UploadCard.js +2 -2
- package/dist/modules/multimedia/index.d.ts +2 -0
- package/dist/multimedia.js +10 -6
- package/dist/providers/MockedProvider/MockedProvider.d.ts +4 -0
- package/dist/providers/MockedProvider/MockedProvider.js +20 -0
- package/dist/providers/index.d.ts +1 -0
- package/package.json +57 -54
- package/dist/hooks/useAvatar/index.d.ts +0 -1
- package/dist/hooks/useAvatar/useAvatar.d.ts +0 -6
- package/dist/hooks/useAvatar/useAvatar.js +0 -30
- package/dist/hooks/useHeader/index.d.ts +0 -1
- package/dist/hooks/useHeader/useHeader.d.ts +0 -5
- package/dist/providers/MockedDataProvider/MockedDataProvider.d.ts +0 -28
- package/dist/providers/MockedDataProvider/MockedDataProvider.js +0 -9
- package/dist/providers/MockedDataProvider/index.d.ts +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsxs, jsx, Fragment } from "react/jsx-runtime";
|
|
2
|
-
import { useState } from "react";
|
|
2
|
+
import { useState, Suspense, lazy } from "react";
|
|
3
3
|
import { useTranslation } from "react-i18next";
|
|
4
4
|
import SvgIconSave from "../../icons/components/IconSave.js";
|
|
5
5
|
import { useAutosizeTextarea } from "../hooks/useAutosizeTextarea.js";
|
|
@@ -10,7 +10,8 @@ import { CommentDate } from "./CommentDate.js";
|
|
|
10
10
|
import { CommentTitle } from "./CommentTitle.js";
|
|
11
11
|
import { TextCounter } from "./TextCounter.js";
|
|
12
12
|
import Button from "../../../components/Button/Button.js";
|
|
13
|
-
|
|
13
|
+
import LoadingScreen from "../../../components/LoadingScreen/LoadingScreen.js";
|
|
14
|
+
const DeleteModal = /* @__PURE__ */ lazy(() => import("./DeleteModal.js")), Comment = ({
|
|
14
15
|
comment,
|
|
15
16
|
userId,
|
|
16
17
|
profile
|
|
@@ -22,12 +23,13 @@ const Comment = ({
|
|
|
22
23
|
createdAt,
|
|
23
24
|
updatedAt,
|
|
24
25
|
comment: content
|
|
25
|
-
} = comment, [ref, onFocus, resizeTextarea] = useAutosizeTextarea(!0), {
|
|
26
|
+
} = comment, [ref, onFocus, resizeTextarea] = useAutosizeTextarea(!0), [isDeleteModalOpen, setIsDeleteModalOpen] = useState(!1), {
|
|
26
27
|
t
|
|
27
28
|
} = useTranslation(), {
|
|
28
29
|
editCommentId,
|
|
29
30
|
options,
|
|
30
31
|
type,
|
|
32
|
+
userRights,
|
|
31
33
|
handleDeleteComment: onDeleteComment,
|
|
32
34
|
handleModifyComment,
|
|
33
35
|
handleReset,
|
|
@@ -57,14 +59,15 @@ const Comment = ({
|
|
|
57
59
|
] })
|
|
58
60
|
] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
59
61
|
/* @__PURE__ */ jsx("div", { className: "mt-8 mb-4", children: content }),
|
|
60
|
-
|
|
61
|
-
/* @__PURE__ */ jsx(Button, { variant: "ghost", color: "tertiary", size: "sm", onClick: () => {
|
|
62
|
+
type === "edit" && /* @__PURE__ */ jsxs("div", { className: "ms-n8", children: [
|
|
63
|
+
userId === authorId && /* @__PURE__ */ jsx(Button, { variant: "ghost", color: "tertiary", size: "sm", onClick: () => {
|
|
62
64
|
handleModifyComment(comment.id), setValue(content);
|
|
63
65
|
}, children: t("comment.edit") }),
|
|
64
|
-
/* @__PURE__ */ jsx(Button, { variant: "ghost", color: "tertiary", size: "sm", onClick: () =>
|
|
66
|
+
(userId === authorId || (userRights == null ? void 0 : userRights.manager)) && /* @__PURE__ */ jsx(Button, { variant: "ghost", color: "tertiary", size: "sm", onClick: () => setIsDeleteModalOpen(!0), children: t("comment.remove") })
|
|
65
67
|
] })
|
|
66
68
|
] })
|
|
67
|
-
] })
|
|
69
|
+
] }),
|
|
70
|
+
/* @__PURE__ */ jsx(Suspense, { fallback: /* @__PURE__ */ jsx(LoadingScreen, { position: !1 }), children: isDeleteModalOpen && /* @__PURE__ */ jsx(DeleteModal, { isOpen: isDeleteModalOpen, onCancel: () => setIsDeleteModalOpen(!1), onSuccess: () => onDeleteComment(id) }) })
|
|
68
71
|
] }, id);
|
|
69
72
|
};
|
|
70
73
|
export {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import { useTranslation } from "react-i18next";
|
|
3
|
-
import Avatar from "../../../components/Avatar/Avatar.js";
|
|
4
3
|
import useDirectory from "../../../hooks/useDirectory/useDirectory.js";
|
|
4
|
+
import Avatar from "../../../components/Avatar/Avatar.js";
|
|
5
5
|
const CommentAvatar = ({
|
|
6
6
|
id
|
|
7
7
|
}) => {
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
+
import Modal from "../../../components/Modal/Modal.js";
|
|
3
|
+
import Button from "../../../components/Button/Button.js";
|
|
4
|
+
const DeleteModal = ({
|
|
5
|
+
isOpen,
|
|
6
|
+
onCancel,
|
|
7
|
+
onSuccess
|
|
8
|
+
}) => /* @__PURE__ */ jsxs(Modal, { isOpen, onModalClose: onCancel, id: "delete-comment-modal", children: [
|
|
9
|
+
/* @__PURE__ */ jsx(Modal.Header, { onModalClose: onCancel, children: "Suppression de commentaire" }),
|
|
10
|
+
/* @__PURE__ */ jsx(Modal.Body, { children: /* @__PURE__ */ jsx("p", { children: "Voulez-vous vraiment supprimer ce commentaire ?" }) }),
|
|
11
|
+
/* @__PURE__ */ jsxs(Modal.Footer, { children: [
|
|
12
|
+
/* @__PURE__ */ jsx(Button, { color: "tertiary", onClick: onCancel, type: "button", variant: "ghost", children: "Annuler" }),
|
|
13
|
+
/* @__PURE__ */ jsx(Button, { color: "danger", onClick: onSuccess, type: "button", variant: "filled", children: "Supprimer le commentaire" })
|
|
14
|
+
] })
|
|
15
|
+
] });
|
|
16
|
+
export {
|
|
17
|
+
DeleteModal,
|
|
18
|
+
DeleteModal as default
|
|
19
|
+
};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { RightRole } from '@edifice.io/client';
|
|
1
2
|
import { CommentOptions, CommentProps, CommentType, UserProfileResult } from '../types';
|
|
2
3
|
export declare const CommentContext: import('react').Context<{
|
|
3
4
|
comments: CommentProps[] | undefined;
|
|
@@ -6,6 +7,7 @@ export declare const CommentContext: import('react').Context<{
|
|
|
6
7
|
profiles: (UserProfileResult | undefined)[];
|
|
7
8
|
options: Partial<CommentOptions>;
|
|
8
9
|
type: CommentType;
|
|
10
|
+
userRights?: Record<RightRole, boolean>;
|
|
9
11
|
setEditCommentId: (value: string | null) => void;
|
|
10
12
|
handleModifyComment: (commentId: string) => void;
|
|
11
13
|
handleChangeContent: (event: React.ChangeEvent<HTMLTextAreaElement>) => void;
|
|
@@ -6,7 +6,10 @@ export declare const useComments: ({ defaultComments, options, type, callbacks,
|
|
|
6
6
|
callbacks: CommentCallbacks | null;
|
|
7
7
|
}) => {
|
|
8
8
|
profilesQueries: {
|
|
9
|
-
data:
|
|
9
|
+
data: ({
|
|
10
|
+
userId: string;
|
|
11
|
+
profile: "Student" | "Teacher" | "Relative" | "Personnel" | "Guest";
|
|
12
|
+
} | undefined)[];
|
|
10
13
|
isLoading: boolean;
|
|
11
14
|
};
|
|
12
15
|
content: string;
|
|
@@ -24,6 +27,6 @@ export declare const useComments: ({ defaultComments, options, type, callbacks,
|
|
|
24
27
|
handleDeleteComment: (id: string) => void;
|
|
25
28
|
handleCreateComment: (content: string) => void;
|
|
26
29
|
handleModifyComment: (commentId: string) => void;
|
|
27
|
-
handleUpdateComment: (comment: string) => void
|
|
30
|
+
handleUpdateComment: (comment: string) => Promise<void>;
|
|
28
31
|
handleReset: () => void;
|
|
29
32
|
};
|
|
@@ -50,7 +50,7 @@ const useComments = ({
|
|
|
50
50
|
handleModifyComment: (commentId) => {
|
|
51
51
|
setEditCommentId(commentId);
|
|
52
52
|
},
|
|
53
|
-
handleUpdateComment: (comment) => {
|
|
53
|
+
handleUpdateComment: async (comment) => {
|
|
54
54
|
editCommentId && (type === "edit" && (callbacks == null || callbacks.put({
|
|
55
55
|
comment,
|
|
56
56
|
commentId: editCommentId
|
|
@@ -5,6 +5,7 @@ export declare const useCommentsContext: () => {
|
|
|
5
5
|
profiles: (import('../types').UserProfileResult | undefined)[];
|
|
6
6
|
options: Partial<import('../types').CommentOptions>;
|
|
7
7
|
type: import('../types').CommentType;
|
|
8
|
+
userRights?: Record<import('@edifice.io/client').RightRole, boolean>;
|
|
8
9
|
setEditCommentId: (value: string | null) => void;
|
|
9
10
|
handleModifyComment: (commentId: string) => void;
|
|
10
11
|
handleChangeContent: (event: React.ChangeEvent<HTMLTextAreaElement>) => void;
|
|
@@ -3,7 +3,7 @@ import { useMemo } from "react";
|
|
|
3
3
|
import { CommentForm } from "../components/CommentForm.js";
|
|
4
4
|
import { CommentHeader } from "../components/CommentHeader.js";
|
|
5
5
|
import { CommentList } from "../components/CommentList.js";
|
|
6
|
-
import {
|
|
6
|
+
import { DEFAULT_MAX_REPLIES, DEFAULT_ADD_COMMENTS, DEFAULT_MAX_COMMENTS, DEFAULT_MAX_REPLY_LENGTH, DEFAULT_MAX_COMMENT_LENGTH } from "../constants.js";
|
|
7
7
|
import { CommentContext } from "../context/Context.js";
|
|
8
8
|
import { useComments } from "../hooks/useComments.js";
|
|
9
9
|
import Button from "../../../components/Button/Button.js";
|
|
@@ -46,7 +46,7 @@ const CommentProvider = ({
|
|
|
46
46
|
defaultComments,
|
|
47
47
|
callbacks: type == "edit" ? props.callbacks : null,
|
|
48
48
|
options
|
|
49
|
-
}), values = useMemo(
|
|
49
|
+
}), userRights = type === "edit" ? props.rights : void 0, values = useMemo(
|
|
50
50
|
() => ({
|
|
51
51
|
comments,
|
|
52
52
|
content,
|
|
@@ -54,6 +54,7 @@ const CommentProvider = ({
|
|
|
54
54
|
editCommentId,
|
|
55
55
|
options,
|
|
56
56
|
type,
|
|
57
|
+
userRights,
|
|
57
58
|
setEditCommentId,
|
|
58
59
|
handleCreateComment,
|
|
59
60
|
handleModifyComment,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { UserProfile } from '@edifice.io/client';
|
|
1
|
+
import { RightRole, UserProfile } from '@edifice.io/client';
|
|
2
2
|
export interface CommentProps {
|
|
3
3
|
/**
|
|
4
4
|
* Comment Id
|
|
@@ -61,6 +61,10 @@ interface EditRootProps extends BaseProps {
|
|
|
61
61
|
* Callbacks to perform CRUD on comment
|
|
62
62
|
*/
|
|
63
63
|
callbacks: CommentCallbacks;
|
|
64
|
+
/**
|
|
65
|
+
* Rights to perform CRUD on comment
|
|
66
|
+
*/
|
|
67
|
+
rights?: Record<RightRole, boolean>;
|
|
64
68
|
}
|
|
65
69
|
interface ReadRootProps extends BaseProps {
|
|
66
70
|
type: 'read';
|
|
@@ -15,9 +15,9 @@ import { EditorToolbar } from "../EditorToolbar/EditorToolbar.js";
|
|
|
15
15
|
import LinkToolbar from "../Toolbar/LinkToolbar.js";
|
|
16
16
|
import TableToolbar from "../Toolbar/TableToolbar.js";
|
|
17
17
|
import BubbleMenuEditImage from "../BubbleMenuEditImage/BubbleMenuEditImage.js";
|
|
18
|
-
import LoadingScreen from "../../../../components/LoadingScreen/LoadingScreen.js";
|
|
19
18
|
import MediaLibrary from "../../../multimedia/MediaLibrary/MediaLibrary.js";
|
|
20
|
-
|
|
19
|
+
import LoadingScreen from "../../../../components/LoadingScreen/LoadingScreen.js";
|
|
20
|
+
const MathsModal = /* @__PURE__ */ lazy(async () => await import("../MathsModal/MathsModal.js")), ImageEditor = /* @__PURE__ */ lazy(async () => await import("../../../multimedia/ImageEditor/components/ImageEditor.js")), Editor = /* @__PURE__ */ forwardRef(({
|
|
21
21
|
id,
|
|
22
22
|
content,
|
|
23
23
|
mode = "read",
|
|
@@ -3,5 +3,5 @@ interface ModalProps {
|
|
|
3
3
|
onSuccess?: (formulaEditor: string) => void;
|
|
4
4
|
onCancel?: () => void;
|
|
5
5
|
}
|
|
6
|
-
declare const MathsModal: ({ isOpen, onSuccess, onCancel }: ModalProps) => import(
|
|
6
|
+
declare const MathsModal: ({ isOpen, onSuccess, onCancel }: ModalProps) => import("react/jsx-runtime").JSX.Element;
|
|
7
7
|
export default MathsModal;
|
|
@@ -3,7 +3,6 @@ import { useState, useEffect } from "react";
|
|
|
3
3
|
import Mathematics from "@tiptap-pro/extension-mathematics";
|
|
4
4
|
import { useEditor, EditorContent } from "@tiptap/react";
|
|
5
5
|
import StarterKit from "@tiptap/starter-kit";
|
|
6
|
-
import { createPortal } from "react-dom";
|
|
7
6
|
import { useTranslation } from "react-i18next";
|
|
8
7
|
import Modal from "../../../../components/Modal/Modal.js";
|
|
9
8
|
import Button from "../../../../components/Button/Button.js";
|
|
@@ -29,7 +28,7 @@ const MathsModal = ({
|
|
|
29
28
|
}, handleOnCancel = () => {
|
|
30
29
|
onCancel == null || onCancel();
|
|
31
30
|
};
|
|
32
|
-
return /* @__PURE__ */
|
|
31
|
+
return /* @__PURE__ */ jsxs(Modal, { id: "MathsModal", isOpen, onModalClose: handleOnCancel, children: [
|
|
33
32
|
/* @__PURE__ */ jsx(Modal.Header, { onModalClose: handleOnCancel, children: t("tiptap.maths.title") }),
|
|
34
33
|
/* @__PURE__ */ jsxs(Modal.Subtitle, { children: [
|
|
35
34
|
t("tiptap.maths.subtitle.1"),
|
|
@@ -43,7 +42,7 @@ const MathsModal = ({
|
|
|
43
42
|
/* @__PURE__ */ jsx(Button, { color: "tertiary", onClick: onCancel, type: "button", variant: "ghost", children: t("tiptap.maths.cancel") }),
|
|
44
43
|
/* @__PURE__ */ jsx(Button, { color: "primary", onClick: () => onSuccess == null ? void 0 : onSuccess(formulaEditor), type: "button", variant: "filled", children: t("tiptap.maths.add") })
|
|
45
44
|
] })
|
|
46
|
-
] })
|
|
45
|
+
] });
|
|
47
46
|
};
|
|
48
47
|
export {
|
|
49
48
|
MathsModal as default
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as MathsModal } from './MathsModal';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
2
|
-
import { useState } from "react";
|
|
2
|
+
import { useState, useEffect } from "react";
|
|
3
3
|
import { NodeViewWrapper } from "@tiptap/react";
|
|
4
4
|
import { useTranslation } from "react-i18next";
|
|
5
5
|
import SvgIconDelete from "../../../icons/components/IconDelete.js";
|
|
@@ -10,15 +10,20 @@ import { useEditorContext } from "../../hooks/useEditorContext.js";
|
|
|
10
10
|
import { Grid } from "../../../../components/Grid/Grid.js";
|
|
11
11
|
const AttachmentRenderer = (props) => {
|
|
12
12
|
const {
|
|
13
|
+
node,
|
|
14
|
+
editor
|
|
15
|
+
} = props, [attachmentArrayAttrs, setAttachmentArrayAttrs] = useState(node.attrs.links), {
|
|
13
16
|
t
|
|
14
17
|
} = useTranslation(), {
|
|
15
|
-
node
|
|
16
|
-
} = props, {
|
|
17
18
|
editable
|
|
18
|
-
} = useEditorContext()
|
|
19
|
-
|
|
19
|
+
} = useEditorContext();
|
|
20
|
+
useEffect(() => {
|
|
21
|
+
attachmentArrayAttrs !== node.attrs.links && setAttachmentArrayAttrs(node.attrs.links);
|
|
22
|
+
}, [node.attrs.links, attachmentArrayAttrs]);
|
|
23
|
+
const handleDelete = (index, documentId) => {
|
|
24
|
+
editor.commands.unsetAttachment(documentId), setAttachmentArrayAttrs((oldAttachments) => oldAttachments.filter((_, i) => i !== index));
|
|
20
25
|
};
|
|
21
|
-
return attachmentArrayAttrs.length !== 0 && /* @__PURE__ */ jsx(NodeViewWrapper, { children: /* @__PURE__ */ jsxs("div", { style: {
|
|
26
|
+
return (attachmentArrayAttrs == null ? void 0 : attachmentArrayAttrs.length) !== 0 && /* @__PURE__ */ jsx(NodeViewWrapper, { children: /* @__PURE__ */ jsxs("div", { style: {
|
|
22
27
|
backgroundColor: "#F2F2F2",
|
|
23
28
|
borderRadius: ".8rem",
|
|
24
29
|
padding: "1.2rem"
|
|
@@ -26,7 +31,7 @@ const AttachmentRenderer = (props) => {
|
|
|
26
31
|
/* @__PURE__ */ jsx("p", { className: "m-12 mt-0", children: t("tiptap.attachments.bloc") }),
|
|
27
32
|
/* @__PURE__ */ jsx(Grid, { children: attachmentArrayAttrs == null ? void 0 : attachmentArrayAttrs.map((attachment, index) => /* @__PURE__ */ jsx(Grid.Col, { sm: "6", children: /* @__PURE__ */ jsx(Attachment, { name: attachment.name, options: /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
28
33
|
/* @__PURE__ */ jsx("a", { href: attachment.href, download: !0, children: /* @__PURE__ */ jsx(IconButton, { "aria-label": t("tiptap.attachments.download"), color: "tertiary", type: "button", icon: /* @__PURE__ */ jsx(SvgIconDownload, {}), variant: "ghost" }) }),
|
|
29
|
-
editable && /* @__PURE__ */ jsx(IconButton, { "aria-label": t("tiptap.attachments.delete"), color: "danger", type: "button", icon: /* @__PURE__ */ jsx(SvgIconDelete, {}), variant: "ghost", onClick: () => handleDelete(index) })
|
|
34
|
+
editable && /* @__PURE__ */ jsx(IconButton, { "aria-label": t("tiptap.attachments.delete"), color: "danger", type: "button", icon: /* @__PURE__ */ jsx(SvgIconDelete, {}), variant: "ghost", onClick: () => handleDelete(index, attachment.documentId) })
|
|
30
35
|
] }) }) }, index)) })
|
|
31
36
|
] }) });
|
|
32
37
|
};
|
|
@@ -4,7 +4,10 @@ const AudioRenderer = (props) => {
|
|
|
4
4
|
const {
|
|
5
5
|
node
|
|
6
6
|
} = props;
|
|
7
|
-
return /* @__PURE__ */ jsx(NodeViewWrapper, {
|
|
7
|
+
return /* @__PURE__ */ jsx(NodeViewWrapper, { style: {
|
|
8
|
+
display: "inline-block",
|
|
9
|
+
width: "fit-content"
|
|
10
|
+
}, children: /* @__PURE__ */ jsx("div", { className: "audio-wrapper", "data-drag-handle": !0, children: /* @__PURE__ */ jsx("audio", { src: node.attrs.src, controls: !0, "data-document-id": node.attrs.src, children: /* @__PURE__ */ jsx("track", { kind: "captions" }) }) }) });
|
|
8
11
|
};
|
|
9
12
|
export {
|
|
10
13
|
AudioRenderer as default
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { NodeViewWrapper } from "@tiptap/react";
|
|
3
3
|
import clsx from "clsx";
|
|
4
|
+
import useEdificeIcons from "../../../../hooks/useEdificeIcons/useEdificeIcons.js";
|
|
4
5
|
import Badge from "../../../../components/Badge/Badge.js";
|
|
5
6
|
import AppIcon from "../../../../components/AppIcon/AppIcon.js";
|
|
6
|
-
import useEdificeIcons from "../../../../hooks/useEdificeIcons/useEdificeIcons.js";
|
|
7
7
|
const LinkerRenderer = ({
|
|
8
8
|
selected,
|
|
9
9
|
...props
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
2
2
|
import { useRef, useEffect } from "react";
|
|
3
|
+
import { odeServices } from "@edifice.io/client";
|
|
3
4
|
import { NodeViewWrapper } from "@tiptap/react";
|
|
4
5
|
import { useTranslation } from "react-i18next";
|
|
6
|
+
import useBrowserInfo from "../../../../hooks/useBrowserInfo/useBrowserInfo.js";
|
|
5
7
|
import { useResizeMedia } from "../../hooks/useResizeMedia.js";
|
|
6
8
|
import Image from "../../../../components/Image/Image.js";
|
|
7
9
|
const MediaRenderer = (props) => {
|
|
@@ -9,7 +11,10 @@ const MediaRenderer = (props) => {
|
|
|
9
11
|
node
|
|
10
12
|
} = props, {
|
|
11
13
|
t
|
|
12
|
-
} = useTranslation(),
|
|
14
|
+
} = useTranslation(), {
|
|
15
|
+
browser,
|
|
16
|
+
device
|
|
17
|
+
} = useBrowserInfo(navigator.userAgent), resizableMedia = useRef(null), {
|
|
13
18
|
startVerticalResize,
|
|
14
19
|
stopVerticalResize,
|
|
15
20
|
isVerticalResizeActive
|
|
@@ -36,7 +41,10 @@ const MediaRenderer = (props) => {
|
|
|
36
41
|
return {};
|
|
37
42
|
}
|
|
38
43
|
}, onVideoPlay = () => {
|
|
39
|
-
resizableMedia.current instanceof HTMLVideoElement
|
|
44
|
+
if (resizableMedia.current instanceof HTMLVideoElement) {
|
|
45
|
+
const videoElement = resizableMedia.current, videoId = videoElement.dataset.documentId, isCaptation = (videoElement.dataset.documentIsCaptation || "false") == "true";
|
|
46
|
+
videoId && odeServices.data().trackVideoRead(videoId, isCaptation, window.location.hostname, `${browser.name} ${browser.version}`, device.type);
|
|
47
|
+
}
|
|
40
48
|
};
|
|
41
49
|
return useEffect(() => {
|
|
42
50
|
if (!resizableMedia.current) return;
|
|
@@ -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/
|
|
9
|
+
editor: import('@tiptap/core').Editor | null;
|
|
10
10
|
commentLength: number;
|
|
11
11
|
getComment: () => HTMLContent;
|
|
12
12
|
resetComment: () => void;
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { useState } from "react";
|
|
2
|
+
import { odeServices } from "@edifice.io/client";
|
|
2
3
|
const useSpeechRecognition = (editor) => {
|
|
3
4
|
const [isActive, setActive] = useState(!1), toggle = () => {
|
|
4
5
|
if (isActive)
|
|
5
6
|
editor == null || editor.commands.stopSpeechRecognition(), setActive(!1);
|
|
6
7
|
else {
|
|
8
|
+
odeServices.data().trackSpeechAndText("STT");
|
|
7
9
|
const started = (editor == null ? void 0 : editor.commands.startSpeechRecognition()) || !1;
|
|
8
10
|
setActive(started);
|
|
9
11
|
}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { useState, useCallback } from "react";
|
|
2
|
+
import { odeServices } from "@edifice.io/client";
|
|
2
3
|
const useSpeechSynthetisis = (editor) => {
|
|
3
4
|
const [isActivated, setActivated] = useState(!1), toggle = useCallback(() => {
|
|
4
5
|
if (isActivated)
|
|
5
6
|
return editor == null || editor.commands.stopSpeechSynthesis(), setActivated(!1), !1;
|
|
6
7
|
{
|
|
8
|
+
odeServices.data().trackSpeechAndText("TTS");
|
|
7
9
|
const speech = (editor == null ? void 0 : editor.commands.startSpeechSynthesis()) || !1;
|
|
8
10
|
return setActivated(speech), speech;
|
|
9
11
|
}
|
|
@@ -11,6 +11,6 @@ import { WorkspaceVisibility } from '@edifice.io/client';
|
|
|
11
11
|
export declare const useTipTapEditor: (editable: boolean, content: Content, focus?: FocusPosition, placeholder?: string, onContentChange?: ({ editor }: {
|
|
12
12
|
editor: any;
|
|
13
13
|
}) => void, visibility?: WorkspaceVisibility) => {
|
|
14
|
-
editor: import('@tiptap/
|
|
14
|
+
editor: import('@tiptap/core').Editor | null;
|
|
15
15
|
editable: boolean;
|
|
16
16
|
};
|
|
@@ -28,13 +28,13 @@ import { useTranslation } from "react-i18next";
|
|
|
28
28
|
import { useEdificeClient } from "../../../providers/EdificeClientProvider/EdificeClientProvider.hook.js";
|
|
29
29
|
import useUpload from "../../../hooks/useUpload/useUpload.js";
|
|
30
30
|
import VideoNodeView from "../components/NodeView/VideoNodeView.js";
|
|
31
|
-
import MediaRenderer from "../components/Renderer/MediaRenderer.js";
|
|
32
31
|
import AudioNodeView from "../components/NodeView/AudioNodeView.js";
|
|
33
|
-
import AudioRenderer from "../components/Renderer/AudioRenderer.js";
|
|
34
32
|
import LinkerNodeView from "../components/NodeView/LinkerNodeView.js";
|
|
35
|
-
import LinkerRenderer from "../components/Renderer/LinkerRenderer.js";
|
|
36
33
|
import ImageNodeView from "../components/NodeView/ImageNodeView.js";
|
|
37
34
|
import AttachmentNodeView from "../components/NodeView/AttachmentNodeView.js";
|
|
35
|
+
import MediaRenderer from "../components/Renderer/MediaRenderer.js";
|
|
36
|
+
import AudioRenderer from "../components/Renderer/AudioRenderer.js";
|
|
37
|
+
import LinkerRenderer from "../components/Renderer/LinkerRenderer.js";
|
|
38
38
|
import AttachmentRenderer from "../components/Renderer/AttachmentRenderer.js";
|
|
39
39
|
const useTipTapEditor = (editable, content, focus, placeholder, onContentChange, visibility = "protected") => {
|
|
40
40
|
const {
|
|
@@ -58,7 +58,7 @@ const useTipTapEditor = (editable, content, focus, placeholder, onContentChange,
|
|
|
58
58
|
}), Underline, TextStyle, Color, Subscript, Superscript, Table.configure({
|
|
59
59
|
resizable: !0
|
|
60
60
|
}), TableRow, TableHeader, TableCell, TextAlign.configure({
|
|
61
|
-
types: ["heading", "paragraph", "
|
|
61
|
+
types: ["heading", "paragraph", "video"]
|
|
62
62
|
}), CustomHeading.configure({
|
|
63
63
|
levels: [1, 2]
|
|
64
64
|
}), Typography, FontSize, SpeechRecognition, SpeechSynthesis.configure({
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { SVGProps } from 'react';
|
|
2
|
+
interface SVGRProps {
|
|
3
|
+
title?: string;
|
|
4
|
+
titleId?: string;
|
|
5
|
+
}
|
|
6
|
+
declare const SvgIconAppointments: ({ title, titleId, ...props }: SVGProps<SVGSVGElement> & SVGRProps) => import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export default SvgIconAppointments;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
+
const SvgIconAppointments = ({
|
|
3
|
+
title,
|
|
4
|
+
titleId,
|
|
5
|
+
...props
|
|
6
|
+
}) => /* @__PURE__ */ jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", width: "24", height: "24", "aria-hidden": "true", "aria-labelledby": titleId, ...props, children: [
|
|
7
|
+
title ? /* @__PURE__ */ jsx("title", { id: titleId, children: title }) : null,
|
|
8
|
+
/* @__PURE__ */ jsx("path", { fill: "currentColor", d: "M18.616 5.414v-4.11c0-.72-.575-1.304-1.285-1.304s-1.286.584-1.286 1.304v4.11c0 .72.575 1.304 1.285 1.304s1.286-.583 1.286-1.304m-9.99-2.597V5.23c0 1.194-.947 2.156-2.124 2.156s-2.126-.962-2.126-2.156V2.817h-1.57C1.25 2.817 0 4.087 0 5.663v15.491C0 22.731 1.251 24 2.805 24h18.39C22.749 24 24 22.73 24 21.154V5.663c0-1.577-1.251-2.846-2.805-2.846h-1.81V5.23c0 1.194-.949 2.155-2.126 2.155s-2.125-.961-2.125-2.155V2.817zm3.048 6.83q.071 0 .141.006c.374.025.737.13 1.06.288 1.29.631 2.232 1.986 2.259 3.507.016.934-.515 1.722-1.153 2.159-.627.43-1.349.626-2.042.75.395.369.78.807 1.104 1.328.309.497.553.698.648.766l.004-.008.027-.035c.222-.268.477-1.095.477-1.095a.88.88 0 0 1 .386-.546.856.856 0 0 1 1.19.282.89.89 0 0 1 .108.662s-.166 1.013-.838 1.824c-.336.406-.997.824-1.71.653-.714-.17-1.227-.716-1.756-1.569-.441-.711-1.109-1.251-1.667-1.615.004.043.002.097 0 .15-.002.057-.004.114.001.158.144 1.131.438 1.678.438 1.678a.9.9 0 0 1 .06.668.87.87 0 0 1-.746.614.85.85 0 0 1-.633-.2.9.9 0 0 1-.212-.266s-.446-.882-.622-2.27-.113-3.353.783-5.676c.38-.987.964-1.69 1.704-2.015.324-.143.66-.202.99-.198m-.05 1.748a.7.7 0 0 0-.252.06c-.216.095-.513.348-.781 1.044-.318.825-.447 1.535-.557 2.223q.105.002.207.006c.36.014.726.027 1.368-.086.566-.1 1.098-.28 1.404-.489.306-.21.397-.332.391-.674-.012-.687-.662-1.656-1.28-1.957-.192-.094-.353-.134-.5-.127M7.817 1.305v4.11c0 .72-.576 1.303-1.286 1.303s-1.286-.583-1.286-1.304v-4.11C5.245.584 5.821 0 6.531 0s1.286.584 1.286 1.304" })
|
|
9
|
+
] });
|
|
10
|
+
export {
|
|
11
|
+
SvgIconAppointments as default
|
|
12
|
+
};
|
|
@@ -4,6 +4,7 @@ export { default as IconAdminPortal } from './IconAdminPortal';
|
|
|
4
4
|
export { default as IconAdmin } from './IconAdmin';
|
|
5
5
|
export { default as IconAdmissionPostBac } from './IconAdmissionPostBac';
|
|
6
6
|
export { default as IconAgenda } from './IconAgenda';
|
|
7
|
+
export { default as IconAppointments } from './IconAppointments';
|
|
7
8
|
export { default as IconArchive } from './IconArchive';
|
|
8
9
|
export { default as IconAssistance } from './IconAssistance';
|
|
9
10
|
export { default as IconAssr } from './IconAssr';
|
|
@@ -11,6 +11,7 @@ import SvgIconRecordVideo from "../../icons/components/IconRecordVideo.js";
|
|
|
11
11
|
import SvgIconSmartphone from "../../icons/components/IconSmartphone.js";
|
|
12
12
|
import { InnerTabs } from "./innertabs/index.js";
|
|
13
13
|
import { MediaLibraryContext } from "./MediaLibraryContext.js";
|
|
14
|
+
import useHttpErrorToast from "../../../hooks/useHttpErrorToast/useHttpErrorToast.js";
|
|
14
15
|
import useHasWorkflow from "../../../hooks/useHasWorkflow/useHasWorkflow.js";
|
|
15
16
|
import Modal from "../../../components/Modal/Modal.js";
|
|
16
17
|
import { Tabs } from "../../../components/Tabs/components/Tabs.js";
|
|
@@ -72,7 +73,10 @@ const orderedTabs = [
|
|
|
72
73
|
showLink,
|
|
73
74
|
type,
|
|
74
75
|
...refModal.current
|
|
75
|
-
}))
|
|
76
|
+
})), useHttpErrorToast({
|
|
77
|
+
isDismissible: !0,
|
|
78
|
+
duration: 1 / 0
|
|
79
|
+
});
|
|
76
80
|
const {
|
|
77
81
|
t
|
|
78
82
|
} = useTranslation(), workspaceCreateWorkflow = useHasWorkflow("org.entcore.workspace.controllers.WorkspaceController|addDocument"), videoCaptureWorkflow = useHasWorkflow("com.opendigitaleducation.video.controllers.VideoController|capture"), [type, setType] = useState(null), availableTabs = {
|
|
@@ -5,12 +5,12 @@ import SvgIconClose from "../../icons/components/IconClose.js";
|
|
|
5
5
|
import SvgIconReset from "../../icons/components/IconReset.js";
|
|
6
6
|
import SvgIconSuccessOutline from "../../icons/components/IconSuccessOutline.js";
|
|
7
7
|
import SvgIconWand from "../../icons/components/IconWand.js";
|
|
8
|
-
import Button from "../../../components/Button/Button.js";
|
|
9
|
-
import Image from "../../../components/Image/Image.js";
|
|
10
8
|
import Tooltip from "../../../components/Tooltip/Tooltip.js";
|
|
11
9
|
import Loading from "../../../components/Loading/Loading.js";
|
|
10
|
+
import Button from "../../../components/Button/Button.js";
|
|
12
11
|
import Card from "../../../components/Card/Card.js";
|
|
13
12
|
import IconButton from "../../../components/Button/IconButton.js";
|
|
13
|
+
import Image from "../../../components/Image/Image.js";
|
|
14
14
|
const UploadCard = ({
|
|
15
15
|
item,
|
|
16
16
|
status = "idle",
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
export * from './AudioRecorder';
|
|
2
2
|
export * from './Embed';
|
|
3
3
|
export * from './ImageEditor';
|
|
4
|
+
export * from './ImagePicker';
|
|
4
5
|
export * from './Linker';
|
|
5
6
|
export * from './MediaLibrary';
|
|
7
|
+
export * from './VideoEmbed';
|
|
6
8
|
export * from './VideoRecorder';
|
|
7
9
|
export * from './Workspace';
|
package/dist/multimedia.js
CHANGED
|
@@ -1,18 +1,22 @@
|
|
|
1
1
|
import { default as default2 } from "./modules/multimedia/AudioRecorder/AudioRecorder.js";
|
|
2
2
|
import { default as default3 } from "./modules/multimedia/Embed/Embed.js";
|
|
3
3
|
import { default as default4 } from "./modules/multimedia/ImageEditor/components/ImageEditor.js";
|
|
4
|
-
import { default as default5 } from "./modules/multimedia/
|
|
5
|
-
import { default as default6 } from "./modules/multimedia/
|
|
4
|
+
import { default as default5 } from "./modules/multimedia/VideoEmbed/VideoEmbed.js";
|
|
5
|
+
import { default as default6 } from "./modules/multimedia/VideoRecorder/VideoRecorder.js";
|
|
6
|
+
import { default as default7 } from "./modules/multimedia/Workspace/Workspace.js";
|
|
7
|
+
import { default as default8 } from "./modules/multimedia/ImagePicker/ImagePicker.js";
|
|
6
8
|
import { ExternalLinker } from "./modules/multimedia/Linker/ExternalLinker/ExternalLinker.js";
|
|
7
9
|
import { InternalLinker } from "./modules/multimedia/Linker/InternalLinker/InternalLinker.js";
|
|
8
|
-
import { default as
|
|
10
|
+
import { default as default9 } from "./modules/multimedia/MediaLibrary/MediaLibrary.js";
|
|
9
11
|
export {
|
|
10
12
|
default2 as AudioRecorder,
|
|
11
13
|
default3 as Embed,
|
|
12
14
|
ExternalLinker,
|
|
13
15
|
default4 as ImageEditor,
|
|
16
|
+
default8 as ImagePicker,
|
|
14
17
|
InternalLinker,
|
|
15
|
-
|
|
16
|
-
default5 as
|
|
17
|
-
default6 as
|
|
18
|
+
default9 as MediaLibrary,
|
|
19
|
+
default5 as VideoEmbed,
|
|
20
|
+
default6 as VideoRecorder,
|
|
21
|
+
default7 as Workspace
|
|
18
22
|
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { QueryClientProvider, QueryClient } from "@tanstack/react-query";
|
|
3
|
+
import { EdificeClientProvider } from "../EdificeClientProvider/EdificeClientProvider.js";
|
|
4
|
+
import { EdificeThemeContext } from "../EdificeThemeProvider/EdificeThemeProvider.context.js";
|
|
5
|
+
const queryClient = new QueryClient(), Providers = ({
|
|
6
|
+
children
|
|
7
|
+
}) => /* @__PURE__ */ jsx(QueryClientProvider, { client: queryClient, children: /* @__PURE__ */ jsx(EdificeClientProvider, { params: {
|
|
8
|
+
app: "wiki"
|
|
9
|
+
}, children }) }), MockedProvider = ({
|
|
10
|
+
children
|
|
11
|
+
}) => {
|
|
12
|
+
const themeContextValue = {
|
|
13
|
+
theme: "default",
|
|
14
|
+
setTheme: vi.fn()
|
|
15
|
+
};
|
|
16
|
+
return /* @__PURE__ */ jsx(Providers, { children: /* @__PURE__ */ jsx(EdificeThemeContext.Provider, { value: themeContextValue, children }) });
|
|
17
|
+
};
|
|
18
|
+
export {
|
|
19
|
+
MockedProvider
|
|
20
|
+
};
|
|
@@ -4,3 +4,4 @@ export * from './EdificeClientProvider/EdificeClientProvider.hook';
|
|
|
4
4
|
export * from './EdificeThemeProvider/EdificeThemeProvider';
|
|
5
5
|
export * from './EdificeThemeProvider/EdificeThemeProvider.context';
|
|
6
6
|
export * from './EdificeThemeProvider/EdificeThemeProvider.hook';
|
|
7
|
+
export * from './MockedProvider/MockedProvider';
|