@edifice.io/react 2.1.1-develop-integration.20250218112719 → 2.1.1-develop-b2school.20250219164321
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/Dropdown/DropdownTrigger.js +5 -1
- package/dist/components/List/List.d.ts +9 -1
- package/dist/components/List/List.js +9 -9
- package/dist/components/SearchBar/SearchBar.d.ts +1 -1
- package/dist/components/SearchBar/SearchBar.js +3 -1
- package/dist/editor.js +24 -24
- package/dist/hooks/useCheckable/useCheckable.js +1 -1
- package/dist/hooks/useConversation/useConversation.d.ts +1 -1
- package/dist/hooks/useConversation/useConversation.js +13 -17
- package/dist/icons.js +136 -134
- package/dist/modules/editor/components/Editor/Editor.d.ts +3 -1
- package/dist/modules/editor/components/Editor/Editor.js +7 -8
- package/dist/modules/editor/components/EditorToolbar/EditorToolbar.d.ts +1 -4
- package/dist/modules/editor/components/EditorToolbar/EditorToolbar.js +4 -19
- package/dist/modules/editor/components/NodeView/ConversationHistoryNodeView.d.ts +2 -0
- package/dist/modules/editor/components/NodeView/ConversationHistoryNodeView.js +10 -0
- package/dist/modules/editor/components/NodeView/index.d.ts +2 -1
- package/dist/modules/editor/components/Renderer/ConversationHistoryRenderer.d.ts +8 -0
- package/dist/modules/editor/components/Renderer/ConversationHistoryRenderer.js +28 -0
- package/dist/modules/editor/components/Renderer/index.d.ts +2 -1
- package/dist/modules/editor/hooks/index.d.ts +0 -2
- package/dist/modules/editor/hooks/useTipTapEditor.d.ts +6 -2
- package/dist/modules/editor/hooks/useTipTapEditor.js +2 -2
- package/dist/modules/icons/components/IconFolderAdd.d.ts +7 -0
- package/dist/modules/icons/components/IconFolderAdd.js +13 -0
- package/dist/modules/icons/components/IconReadMail.d.ts +7 -0
- package/dist/modules/icons/components/IconReadMail.js +16 -0
- package/dist/modules/icons/components/IconUndoAll.d.ts +7 -0
- package/dist/modules/icons/components/IconUndoAll.js +14 -0
- package/dist/modules/icons/components/IconUnreadMail.d.ts +7 -0
- package/dist/modules/icons/components/IconUnreadMail.js +16 -0
- package/dist/modules/icons/components/index.d.ts +4 -3
- package/package.json +6 -6
- package/dist/modules/editor/components/Editor/CantooModal.d.ts +0 -2
- package/dist/modules/editor/components/Editor/CantooModal.js +0 -13
- package/dist/modules/editor/components/EditorToolbar/EditorToolbar.Cantoo.d.ts +0 -9
- package/dist/modules/editor/components/EditorToolbar/EditorToolbar.Cantoo.js +0 -56
- package/dist/modules/editor/hooks/useCantooAdaptTextBox.d.ts +0 -14
- package/dist/modules/editor/hooks/useCantooAdaptTextBox.js +0 -14
- package/dist/modules/editor/hooks/useCantooEditor.d.ts +0 -9
- package/dist/modules/editor/hooks/useCantooEditor.js +0 -51
- package/dist/modules/icons/components/IconCantoo.d.ts +0 -7
- package/dist/modules/icons/components/IconCantoo.js +0 -23
- package/dist/modules/icons/components/IconMicOff.d.ts +0 -7
- package/dist/modules/icons/components/IconMicOff.js +0 -12
- package/dist/modules/icons/components/IconTextToSpeechOff.d.ts +0 -7
- package/dist/modules/icons/components/IconTextToSpeechOff.js +0 -12
|
@@ -3,7 +3,6 @@ import { forwardRef, useId, useImperativeHandle, Suspense, lazy } from "react";
|
|
|
3
3
|
import { EditorContent } from "@tiptap/react";
|
|
4
4
|
import clsx from "clsx";
|
|
5
5
|
import { useEdificeClient } from "../../../../providers/EdificeClientProvider/EdificeClientProvider.hook.js";
|
|
6
|
-
import { useCantooAdaptTextBox } from "../../hooks/useCantooAdaptTextBox.js";
|
|
7
6
|
import { useMathsStyles } from "../../hooks/useMathsStyles.js";
|
|
8
7
|
import { useTipTapEditor } from "../../hooks/useTipTapEditor.js";
|
|
9
8
|
import { useMediaLibraryEditor } from "../../hooks/useMediaLibraryEditor.js";
|
|
@@ -18,7 +17,7 @@ import TableToolbar from "../Toolbar/TableToolbar.js";
|
|
|
18
17
|
import BubbleMenuEditImage from "../BubbleMenuEditImage/BubbleMenuEditImage.js";
|
|
19
18
|
import MediaLibrary from "../../../multimedia/MediaLibrary/MediaLibrary.js";
|
|
20
19
|
import LoadingScreen from "../../../../components/LoadingScreen/LoadingScreen.js";
|
|
21
|
-
const MathsModal = /* @__PURE__ */ lazy(async () => await import("../MathsModal/MathsModal.js")), ImageEditor = /* @__PURE__ */ lazy(async () => await import("../../../multimedia/ImageEditor/components/ImageEditor.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(({
|
|
22
21
|
id,
|
|
23
22
|
content,
|
|
24
23
|
mode = "read",
|
|
@@ -27,20 +26,21 @@ const MathsModal = /* @__PURE__ */ lazy(async () => await import("../MathsModal/
|
|
|
27
26
|
focus = "start",
|
|
28
27
|
placeholder = "",
|
|
29
28
|
visibility = "protected",
|
|
30
|
-
onContentChange
|
|
29
|
+
onContentChange,
|
|
30
|
+
extensions
|
|
31
31
|
}, ref) => {
|
|
32
32
|
const editorId = useId(), {
|
|
33
33
|
appCode
|
|
34
34
|
} = useEdificeClient(), {
|
|
35
35
|
editor,
|
|
36
36
|
editable
|
|
37
|
-
} = useTipTapEditor(mode === "edit", content, focus, placeholder, onContentChange, visibility), {
|
|
37
|
+
} = useTipTapEditor(mode === "edit", content, focus, placeholder, onContentChange, visibility, extensions), {
|
|
38
38
|
ref: mediaLibraryModalRef,
|
|
39
39
|
...mediaLibraryModalHandlers
|
|
40
40
|
} = useMediaLibraryEditor(editor), {
|
|
41
41
|
toggle: toggleMathsModal,
|
|
42
42
|
...mathsModalHandlers
|
|
43
|
-
} = useMathsModal(editor),
|
|
43
|
+
} = useMathsModal(editor), imageModal = useImageModal(editor, "media-library", visibility), linkToolbarHandlers = useLinkToolbar(editor, mediaLibraryModalRef), speechSynthetisis = useSpeechSynthetisis(editor);
|
|
44
44
|
if (useMathsStyles(), useImperativeHandle(ref, () => ({
|
|
45
45
|
getContent: (as) => {
|
|
46
46
|
switch (as) {
|
|
@@ -65,7 +65,7 @@ const MathsModal = /* @__PURE__ */ lazy(async () => await import("../MathsModal/
|
|
|
65
65
|
editable
|
|
66
66
|
}, children: [
|
|
67
67
|
/* @__PURE__ */ jsxs("div", { className: borderClass, children: [
|
|
68
|
-
toolbar !== "none" && editable && /* @__PURE__ */ jsx(EditorToolbar, { mediaLibraryRef: mediaLibraryModalRef, toggleMathsModal
|
|
68
|
+
toolbar !== "none" && editable && /* @__PURE__ */ jsx(EditorToolbar, { mediaLibraryRef: mediaLibraryModalRef, toggleMathsModal }),
|
|
69
69
|
/* @__PURE__ */ jsx(EditorContent, { id: id ?? editorId, editor, className: contentClass })
|
|
70
70
|
] }),
|
|
71
71
|
/* @__PURE__ */ jsx(LinkToolbar, { editor, ...linkToolbarHandlers }),
|
|
@@ -74,8 +74,7 @@ const MathsModal = /* @__PURE__ */ lazy(async () => await import("../MathsModal/
|
|
|
74
74
|
/* @__PURE__ */ jsxs(Suspense, { fallback: /* @__PURE__ */ jsx(LoadingScreen, {}), children: [
|
|
75
75
|
editable && /* @__PURE__ */ jsx(MediaLibrary, { appCode, visibility, multiple: !0, ref: mediaLibraryModalRef, ...mediaLibraryModalHandlers }),
|
|
76
76
|
editable && mathsModalHandlers.isOpen && /* @__PURE__ */ jsx(MathsModal, { ...mathsModalHandlers }),
|
|
77
|
-
editable && (imageModal == null ? void 0 : imageModal.isOpen) && (imageModal == null ? void 0 : imageModal.currentImage) && /* @__PURE__ */ jsx(ImageEditor, { altText: imageModal == null ? void 0 : imageModal.currentImage.alt, legend: imageModal == null ? void 0 : imageModal.currentImage.title, image: imageModal == null ? void 0 : imageModal.currentImage.src, isOpen: imageModal.isOpen, onCancel: imageModal.handleCancel, onSave: imageModal.handleSave, onError: console.error })
|
|
78
|
-
editable && cantooAdaptTextBox.isOpen && /* @__PURE__ */ jsx(CantooModal, {})
|
|
77
|
+
editable && (imageModal == null ? void 0 : imageModal.isOpen) && (imageModal == null ? void 0 : imageModal.currentImage) && /* @__PURE__ */ jsx(ImageEditor, { altText: imageModal == null ? void 0 : imageModal.currentImage.alt, legend: imageModal == null ? void 0 : imageModal.currentImage.title, image: imageModal == null ? void 0 : imageModal.currentImage.src, isOpen: imageModal.isOpen, onCancel: imageModal.handleCancel, onSave: imageModal.handleSave, onError: console.error })
|
|
79
78
|
] })
|
|
80
79
|
] });
|
|
81
80
|
});
|
|
@@ -1,13 +1,10 @@
|
|
|
1
1
|
import { RefObject } from 'react';
|
|
2
2
|
import { MediaLibraryRef } from '../../../multimedia';
|
|
3
|
-
import { CantooAdaptTextBox } from '../../hooks/useCantooAdaptTextBox.ts';
|
|
4
3
|
interface Props {
|
|
5
4
|
/** Ref to a MediaLibrary instance */
|
|
6
5
|
mediaLibraryRef: RefObject<MediaLibraryRef>;
|
|
7
6
|
/** API to open/close a Math modal. */
|
|
8
7
|
toggleMathsModal: () => void;
|
|
9
|
-
/** API to open/close a Cantoo modal. */
|
|
10
|
-
cantooAdaptTextBoxRef: CantooAdaptTextBox;
|
|
11
8
|
}
|
|
12
|
-
export declare const EditorToolbar: ({ mediaLibraryRef, toggleMathsModal
|
|
9
|
+
export declare const EditorToolbar: ({ mediaLibraryRef, toggleMathsModal }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
13
10
|
export {};
|
|
@@ -25,25 +25,20 @@ import { EditorToolbarPlusMenu } from "./EditorToolbar.PlusMenu.js";
|
|
|
25
25
|
import { EditorToolbarTextColor } from "./EditorToolbar.TextColor.js";
|
|
26
26
|
import { EditorToolbarTextSize } from "./EditorToolbar.TextSize.js";
|
|
27
27
|
import { EditorToolbarTypography } from "./EditorToolbar.Typography.js";
|
|
28
|
-
import {
|
|
29
|
-
import { useCantooEditor } from "../../hooks/useCantooEditor.js";
|
|
28
|
+
import { useEditorContext } from "../../hooks/useEditorContext.js";
|
|
30
29
|
import { useActionOptions } from "../../hooks/useActionOptions.js";
|
|
31
30
|
import { useSpeechRecognition } from "../../hooks/useSpeechRecognition.js";
|
|
32
|
-
import { useEditorContext } from "../../hooks/useEditorContext.js";
|
|
33
31
|
import { Toolbar } from "../../../../components/Toolbar/Toolbar.js";
|
|
34
32
|
const EditorToolbar = ({
|
|
35
33
|
mediaLibraryRef,
|
|
36
|
-
toggleMathsModal
|
|
37
|
-
cantooAdaptTextBoxRef
|
|
34
|
+
toggleMathsModal
|
|
38
35
|
}) => {
|
|
39
36
|
const {
|
|
40
37
|
t
|
|
41
38
|
} = useTranslation(), {
|
|
42
39
|
id,
|
|
43
40
|
editor
|
|
44
|
-
} = useEditorContext(), {
|
|
45
|
-
isAvailable: canUseCantoo
|
|
46
|
-
} = useCantooEditor(editor), [plusOptions, listOptions, alignmentOptions] = useActionOptions(editor, toggleMathsModal, mediaLibraryRef), {
|
|
41
|
+
} = useEditorContext(), [plusOptions, listOptions, alignmentOptions] = useActionOptions(editor, toggleMathsModal, mediaLibraryRef), {
|
|
47
42
|
isAvailable: canRecognizeSpeech,
|
|
48
43
|
isActive: speechRecognition,
|
|
49
44
|
toggle: toggleSpeechRecognition
|
|
@@ -170,21 +165,11 @@ const EditorToolbar = ({
|
|
|
170
165
|
name: "speechtotext",
|
|
171
166
|
tooltip: t("tiptap.toolbar.stt")
|
|
172
167
|
},
|
|
173
|
-
//------------- CANTOO ---------------//
|
|
174
|
-
{
|
|
175
|
-
type: "dropdown",
|
|
176
|
-
props: {
|
|
177
|
-
children: (triggerProps) => /* @__PURE__ */ jsx(EditorToolbarCantoo, { triggerProps, openCantooAdaptTextBox: cantooAdaptTextBoxRef.toggle, isCantooAdaptTextBoxOpen: cantooAdaptTextBoxRef.isOpen })
|
|
178
|
-
},
|
|
179
|
-
name: "cantoo",
|
|
180
|
-
visibility: canUseCantoo ? "show" : "hide",
|
|
181
|
-
tooltip: t("tiptap.toolbar.cantoo.choice")
|
|
182
|
-
},
|
|
183
168
|
//------------------------------------//
|
|
184
169
|
{
|
|
185
170
|
type: "divider",
|
|
186
171
|
name: "div-speech",
|
|
187
|
-
visibility: canRecognizeSpeech
|
|
172
|
+
visibility: canRecognizeSpeech ? "show" : "hide"
|
|
188
173
|
},
|
|
189
174
|
//--------------- TYPOGRAPHY ---------------//
|
|
190
175
|
{
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ConversationHistory } from "@edifice.io/tiptap-extensions/conversation-history";
|
|
2
|
+
import { ReactNodeViewRenderer } from "@tiptap/react";
|
|
3
|
+
const ConversationHistoryNodeView = (Component) => ConversationHistory.extend({
|
|
4
|
+
addNodeView() {
|
|
5
|
+
return ReactNodeViewRenderer(Component);
|
|
6
|
+
}
|
|
7
|
+
});
|
|
8
|
+
export {
|
|
9
|
+
ConversationHistoryNodeView as default
|
|
10
|
+
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
export { default as AudioNodeView } from './AudioNodeView';
|
|
2
1
|
export { default as AttachmentNodeView } from './AttachmentNodeView';
|
|
2
|
+
export { default as AudioNodeView } from './AudioNodeView';
|
|
3
|
+
export { default as ConversationHistoryNodeView } from './ConversationHistoryNodeView';
|
|
3
4
|
export { default as ImageNodeView } from './ImageNodeView';
|
|
4
5
|
export { default as LinkerNodeView } from './LinkerNodeView';
|
|
5
6
|
export { default as VideoNodeView } from './VideoNodeView';
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `ConversationHistoryRenderer` is a React component that renders a button to toggle the visibility
|
|
3
|
+
* of conversation history content. It uses the `@tiptap/react` library for rendering content and
|
|
4
|
+
* `clsx` for conditional class names. The component also utilizes the `useTranslation` hook from
|
|
5
|
+
* `react-i18next` for internationalization and a custom `useToggle` hook for managing the open state.
|
|
6
|
+
*/
|
|
7
|
+
declare const ConversationHistoryRenderer: () => import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export default ConversationHistoryRenderer;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { jsxs, jsx, Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { NodeViewWrapper, NodeViewContent } from "@tiptap/react";
|
|
3
|
+
import clsx from "clsx";
|
|
4
|
+
import { useTranslation } from "react-i18next";
|
|
5
|
+
import SvgIconRafterDown from "../../../icons/components/IconRafterDown.js";
|
|
6
|
+
import SvgIconRafterUp from "../../../icons/components/IconRafterUp.js";
|
|
7
|
+
import useToggle from "../../../../hooks/useToggle/useToggle.js";
|
|
8
|
+
import Button from "../../../../components/Button/Button.js";
|
|
9
|
+
const ConversationHistoryRenderer = () => {
|
|
10
|
+
const {
|
|
11
|
+
t
|
|
12
|
+
} = useTranslation("conversation"), [open, toggleOpen] = useToggle(!1), classes = clsx("conversation-history ps-16", {
|
|
13
|
+
show: open
|
|
14
|
+
});
|
|
15
|
+
return /* @__PURE__ */ jsxs(NodeViewWrapper, { as: "div", contentEditable: !1, children: [
|
|
16
|
+
/* @__PURE__ */ jsx(Button, { variant: "ghost", onClick: toggleOpen, size: "sm", className: "d-flex align-items-center gap-4 text-gray-800 fs-6 mt-24", children: open ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
17
|
+
t("message.history.hide"),
|
|
18
|
+
/* @__PURE__ */ jsx(SvgIconRafterUp, { width: 16, height: 16 })
|
|
19
|
+
] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
20
|
+
t("message.history.show"),
|
|
21
|
+
/* @__PURE__ */ jsx(SvgIconRafterDown, { width: 16, height: 16 })
|
|
22
|
+
] }) }),
|
|
23
|
+
/* @__PURE__ */ jsx("div", { className: classes, "data-testid": "conversation-history-content", children: /* @__PURE__ */ jsx(NodeViewContent, {}) })
|
|
24
|
+
] });
|
|
25
|
+
};
|
|
26
|
+
export {
|
|
27
|
+
ConversationHistoryRenderer as default
|
|
28
|
+
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
export { default as AudioRenderer } from './AudioRenderer';
|
|
2
1
|
export { default as AttachmentRenderer } from './AttachmentRenderer';
|
|
2
|
+
export { default as AudioRenderer } from './AudioRenderer';
|
|
3
|
+
export { default as ConversationHistoryRenderer } from './ConversationHistoryRenderer';
|
|
3
4
|
export { default as LinkerRenderer } from './LinkerRenderer';
|
|
4
5
|
export { default as MediaRenderer } from './MediaRenderer';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Content, FocusPosition } from '@tiptap/react';
|
|
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.
|
|
@@ -7,10 +7,14 @@ import { WorkspaceVisibility } from '@edifice.io/client';
|
|
|
7
7
|
* @param content default rich content
|
|
8
8
|
* @param focus set focus position to the editor
|
|
9
9
|
* @param placeholder editor placeholder content
|
|
10
|
+
* @param onContentChange callback to be called on content change
|
|
11
|
+
* @param visibility workspace visibility
|
|
12
|
+
* @param extensions extensions to add to the editor
|
|
13
|
+
* @returns the editor instance and the editable state
|
|
10
14
|
*/
|
|
11
15
|
export declare const useTipTapEditor: (editable: boolean, content: Content, focus?: FocusPosition, placeholder?: string, onContentChange?: ({ editor }: {
|
|
12
16
|
editor: any;
|
|
13
|
-
}) => void, visibility?: WorkspaceVisibility) => {
|
|
17
|
+
}) => void, visibility?: WorkspaceVisibility, extensions?: Extensions) => {
|
|
14
18
|
editor: import('@tiptap/core').Editor | null;
|
|
15
19
|
editable: boolean;
|
|
16
20
|
};
|
|
@@ -36,7 +36,7 @@ import MediaRenderer from "../components/Renderer/MediaRenderer.js";
|
|
|
36
36
|
import AudioRenderer from "../components/Renderer/AudioRenderer.js";
|
|
37
37
|
import LinkerRenderer from "../components/Renderer/LinkerRenderer.js";
|
|
38
38
|
import AttachmentRenderer from "../components/Renderer/AttachmentRenderer.js";
|
|
39
|
-
const useTipTapEditor = (editable, content, focus, placeholder, onContentChange, visibility = "protected") => {
|
|
39
|
+
const useTipTapEditor = (editable, content, focus, placeholder, onContentChange, visibility = "protected", extensions) => {
|
|
40
40
|
const {
|
|
41
41
|
currentLanguage
|
|
42
42
|
} = useEdificeClient(), {
|
|
@@ -63,7 +63,7 @@ const useTipTapEditor = (editable, content, focus, placeholder, onContentChange,
|
|
|
63
63
|
levels: [1, 2]
|
|
64
64
|
}), Typography, FontSize, SpeechRecognition, SpeechSynthesis.configure({
|
|
65
65
|
lang: (currentLanguage == null ? void 0 : currentLanguage.length) === 2 ? `${currentLanguage}-${currentLanguage.toUpperCase()}` : "fr-FR"
|
|
66
|
-
}), Iframe, Hyperlink, FontFamily, Mathematics, Alert, VideoNodeView(MediaRenderer), AudioNodeView(AudioRenderer), LinkerNodeView(LinkerRenderer), ImageNodeView(MediaRenderer, uploadFile), AttachmentNodeView(AttachmentRenderer)],
|
|
66
|
+
}), Iframe, Hyperlink, FontFamily, Mathematics, Alert, VideoNodeView(MediaRenderer), AudioNodeView(AudioRenderer), LinkerNodeView(LinkerRenderer), ImageNodeView(MediaRenderer, uploadFile), AttachmentNodeView(AttachmentRenderer), ...extensions || []],
|
|
67
67
|
content,
|
|
68
68
|
// If the onContentChange callback is provided, we call it on every content change.
|
|
69
69
|
...onContentChange ? {
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { SVGProps } from 'react';
|
|
2
|
+
interface SVGRProps {
|
|
3
|
+
title?: string;
|
|
4
|
+
titleId?: string;
|
|
5
|
+
}
|
|
6
|
+
declare const SvgIconFolderAdd: ({ title, titleId, ...props }: SVGProps<SVGSVGElement> & SVGRProps) => import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export default SvgIconFolderAdd;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
+
const SvgIconFolderAdd = ({
|
|
3
|
+
title,
|
|
4
|
+
titleId,
|
|
5
|
+
...props
|
|
6
|
+
}) => /* @__PURE__ */ jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", width: "24", height: "24", fill: "none", viewBox: "0 0 24 24", "aria-hidden": "true", "aria-labelledby": titleId, ...props, children: [
|
|
7
|
+
title ? /* @__PURE__ */ jsx("title", { id: titleId, children: title }) : null,
|
|
8
|
+
/* @__PURE__ */ jsx("g", { clipPath: "url(#icon-folder-add_svg__a)", children: /* @__PURE__ */ jsx("path", { fill: "currentColor", fillRule: "evenodd", d: "M10.985 5.283A2 2 0 0 0 12.965 7H22v12H2V4h7.5a1.5 1.5 0 0 1 1.485 1.283M1.902 2C.852 2 0 2.852 0 3.902V19a2 2 0 0 0 2 2h20a2 2 0 0 0 2-2V7a2 2 0 0 0-2-2h-9.035A3.5 3.5 0 0 0 9.5 2zM12 8a1 1 0 0 1 1 1v3h3a1 1 0 1 1 0 2h-3v3a1 1 0 1 1-2 0v-3H8a1 1 0 1 1 0-2h3V9a1 1 0 0 1 1-1", clipRule: "evenodd" }) }),
|
|
9
|
+
/* @__PURE__ */ jsx("defs", { children: /* @__PURE__ */ jsx("clipPath", { id: "icon-folder-add_svg__a", children: /* @__PURE__ */ jsx("path", { fill: "#fff", d: "M0 0h24v24H0z" }) }) })
|
|
10
|
+
] });
|
|
11
|
+
export {
|
|
12
|
+
SvgIconFolderAdd as default
|
|
13
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { SVGProps } from 'react';
|
|
2
|
+
interface SVGRProps {
|
|
3
|
+
title?: string;
|
|
4
|
+
titleId?: string;
|
|
5
|
+
}
|
|
6
|
+
declare const SvgIconReadMail: ({ title, titleId, ...props }: SVGProps<SVGSVGElement> & SVGRProps) => import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export default SvgIconReadMail;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
+
const SvgIconReadMail = ({
|
|
3
|
+
title,
|
|
4
|
+
titleId,
|
|
5
|
+
...props
|
|
6
|
+
}) => /* @__PURE__ */ jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", width: "24", height: "24", fill: "none", viewBox: "0 0 24 24", "aria-hidden": "true", "aria-labelledby": titleId, ...props, children: [
|
|
7
|
+
title ? /* @__PURE__ */ jsx("title", { id: titleId, children: title }) : null,
|
|
8
|
+
/* @__PURE__ */ jsxs("g", { fill: "currentColor", fillRule: "evenodd", clipPath: "url(#icon-read-mail_svg__a)", clipRule: "evenodd", children: [
|
|
9
|
+
/* @__PURE__ */ jsx("path", { d: "M1.143 8.986a1 1 0 0 1 1.372-.343l8.97 5.382a1 1 0 0 0 1.03 0l8.97-5.382a1 1 0 1 1 1.03 1.714l-8.971 5.383a3 3 0 0 1-3.088 0l-8.97-5.382a1 1 0 0 1-.343-1.373" }),
|
|
10
|
+
/* @__PURE__ */ jsx("path", { d: "M12.466 2.4a.95.95 0 0 0-.932 0c-1.333.74-3.83 2.146-5.99 3.465-1.083.662-2.063 1.29-2.764 1.797a8 8 0 0 0-.78.62v11.003H0V8c0-.38.191-.664.272-.776.107-.148.238-.285.364-.404.254-.24.594-.506.973-.78.765-.552 1.797-1.212 2.892-1.881C6.697 2.817 9.224 1.395 10.563.65a2.95 2.95 0 0 1 2.874 0c1.34.744 3.866 2.166 6.062 3.508 1.095.669 2.127 1.33 2.892 1.882.38.273.719.54.973.78.126.118.257.255.364.403.08.112.272.395.272.776v11.285h-2V8.284l-.009-.008a8 8 0 0 0-.77-.613c-.702-.506-1.682-1.135-2.765-1.797-2.16-1.32-4.657-2.725-5.99-3.466M2.321 19.802c.253.192.647.34 1.123.34h17.112c.476 0 .87-.148 1.123-.34.252-.192.321-.384.321-.517h2c0 .892-.479 1.629-1.111 2.11-.632.479-1.46.747-2.333.747H3.444c-.873 0-1.701-.268-2.333-.748S0 20.178 0 19.285h2c0 .133.069.326.32.518" })
|
|
11
|
+
] }),
|
|
12
|
+
/* @__PURE__ */ jsx("defs", { children: /* @__PURE__ */ jsx("clipPath", { id: "icon-read-mail_svg__a", children: /* @__PURE__ */ jsx("path", { fill: "#fff", d: "M0 0h24v24H0z" }) }) })
|
|
13
|
+
] });
|
|
14
|
+
export {
|
|
15
|
+
SvgIconReadMail as default
|
|
16
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { SVGProps } from 'react';
|
|
2
|
+
interface SVGRProps {
|
|
3
|
+
title?: string;
|
|
4
|
+
titleId?: string;
|
|
5
|
+
}
|
|
6
|
+
declare const SvgIconUndoAll: ({ title, titleId, ...props }: SVGProps<SVGSVGElement> & SVGRProps) => import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export default SvgIconUndoAll;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
+
const SvgIconUndoAll = ({
|
|
3
|
+
title,
|
|
4
|
+
titleId,
|
|
5
|
+
...props
|
|
6
|
+
}) => /* @__PURE__ */ jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", width: "24", height: "24", fill: "none", viewBox: "0 0 24 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", fillRule: "evenodd", d: "M11.648 12.564a.917.917 0 0 0 0-1.297L7.713 7.332l3.935-3.935A.917.917 0 1 0 10.352 2.1L5.768 6.684a.917.917 0 0 0 0 1.296l4.584 4.583a.917.917 0 0 0 1.296 0", clipRule: "evenodd" }),
|
|
9
|
+
/* @__PURE__ */ jsx("path", { fill: "currentColor", fillRule: "evenodd", d: "M7.523 12.564a.917.917 0 0 0 0-1.297L3.588 7.332l3.935-3.935A.917.917 0 1 0 6.227 2.1L1.643 6.684a.917.917 0 0 0 0 1.296l4.584 4.583a.917.917 0 0 0 1.296 0", clipRule: "evenodd" }),
|
|
10
|
+
/* @__PURE__ */ jsx("path", { fill: "currentColor", fillRule: "evenodd", d: "M19.25 18.332c.506 0 .917-.41.917-.917V11a4.583 4.583 0 0 0-4.584-4.584H6.417a.917.917 0 0 0 0 1.834h9.166a2.75 2.75 0 0 1 2.75 2.75v6.416c0 .507.41.917.917.917", clipRule: "evenodd" })
|
|
11
|
+
] });
|
|
12
|
+
export {
|
|
13
|
+
SvgIconUndoAll as default
|
|
14
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { SVGProps } from 'react';
|
|
2
|
+
interface SVGRProps {
|
|
3
|
+
title?: string;
|
|
4
|
+
titleId?: string;
|
|
5
|
+
}
|
|
6
|
+
declare const SvgIconUnreadMail: ({ title, titleId, ...props }: SVGProps<SVGSVGElement> & SVGRProps) => import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export default SvgIconUnreadMail;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
+
const SvgIconUnreadMail = ({
|
|
3
|
+
title,
|
|
4
|
+
titleId,
|
|
5
|
+
...props
|
|
6
|
+
}) => /* @__PURE__ */ jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", width: "24", height: "24", fill: "none", viewBox: "0 0 24 24", "aria-hidden": "true", "aria-labelledby": titleId, ...props, children: [
|
|
7
|
+
title ? /* @__PURE__ */ jsx("title", { id: titleId, children: title }) : null,
|
|
8
|
+
/* @__PURE__ */ jsxs("g", { fill: "currentColor", fillRule: "evenodd", clipPath: "url(#icon-unread-mail_svg__a)", clipRule: "evenodd", children: [
|
|
9
|
+
/* @__PURE__ */ jsx("path", { d: "M7.975 4.5a5.1 5.1 0 0 0-.204-2h12.785A3.437 3.437 0 0 1 24 5.948V18.07c0 1.9-1.548 3.429-3.444 3.429H3.444A3.437 3.437 0 0 1 0 18.071V8.001c.581.436 1.261.749 2 .899v9.171c0 .783.64 1.429 1.444 1.429h17.112c.803 0 1.444-.646 1.444-1.429V7.79l-9.448 6.257a1 1 0 0 1-1.104 0L3.744 8.945a5 5 0 0 0 2.228-.924L12 12.014l9.916-6.567c-.2-.55-.73-.947-1.36-.947z" }),
|
|
10
|
+
/* @__PURE__ */ jsx("path", { d: "M3 7a3 3 0 1 0 0-6 3 3 0 0 0 0 6" })
|
|
11
|
+
] }),
|
|
12
|
+
/* @__PURE__ */ jsx("defs", { children: /* @__PURE__ */ jsx("clipPath", { id: "icon-unread-mail_svg__a", children: /* @__PURE__ */ jsx("path", { fill: "#fff", d: "M0 0h24v24H0z" }) }) })
|
|
13
|
+
] });
|
|
14
|
+
export {
|
|
15
|
+
SvgIconUnreadMail as default
|
|
16
|
+
};
|
|
@@ -20,7 +20,6 @@ export { default as IconBurgerMenu } from './IconBurgerMenu';
|
|
|
20
20
|
export { default as IconCalendarLight } from './IconCalendarLight';
|
|
21
21
|
export { default as IconCalendar } from './IconCalendar';
|
|
22
22
|
export { default as IconCamera } from './IconCamera';
|
|
23
|
-
export { default as IconCantoo } from './IconCantoo';
|
|
24
23
|
export { default as IconCenter } from './IconCenter';
|
|
25
24
|
export { default as IconCheck } from './IconCheck';
|
|
26
25
|
export { default as IconChecklist } from './IconChecklist';
|
|
@@ -45,6 +44,7 @@ export { default as IconExternalLink } from './IconExternalLink';
|
|
|
45
44
|
export { default as IconFiles } from './IconFiles';
|
|
46
45
|
export { default as IconFilter } from './IconFilter';
|
|
47
46
|
export { default as IconFlag } from './IconFlag';
|
|
47
|
+
export { default as IconFolderAdd } from './IconFolderAdd';
|
|
48
48
|
export { default as IconFolderMove } from './IconFolderMove';
|
|
49
49
|
export { default as IconFolder } from './IconFolder';
|
|
50
50
|
export { default as IconForgoing } from './IconForgoing';
|
|
@@ -69,7 +69,6 @@ export { default as IconLock } from './IconLock';
|
|
|
69
69
|
export { default as IconMail } from './IconMail';
|
|
70
70
|
export { default as IconMergeCells } from './IconMergeCells';
|
|
71
71
|
export { default as IconMessageInfo } from './IconMessageInfo';
|
|
72
|
-
export { default as IconMicOff } from './IconMicOff';
|
|
73
72
|
export { default as IconMic } from './IconMic';
|
|
74
73
|
export { default as IconMinus } from './IconMinus';
|
|
75
74
|
export { default as IconMove } from './IconMove';
|
|
@@ -93,6 +92,7 @@ export { default as IconRafterLeft } from './IconRafterLeft';
|
|
|
93
92
|
export { default as IconRafterRight } from './IconRafterRight';
|
|
94
93
|
export { default as IconRafterUp } from './IconRafterUp';
|
|
95
94
|
export { default as IconReaction } from './IconReaction';
|
|
95
|
+
export { default as IconReadMail } from './IconReadMail';
|
|
96
96
|
export { default as IconRecordPause } from './IconRecordPause';
|
|
97
97
|
export { default as IconRecordStop } from './IconRecordStop';
|
|
98
98
|
export { default as IconRecordVideo } from './IconRecordVideo';
|
|
@@ -129,16 +129,17 @@ export { default as IconTextHighlight } from './IconTextHighlight';
|
|
|
129
129
|
export { default as IconTextItalic } from './IconTextItalic';
|
|
130
130
|
export { default as IconTextPage } from './IconTextPage';
|
|
131
131
|
export { default as IconTextSize } from './IconTextSize';
|
|
132
|
-
export { default as IconTextToSpeechOff } from './IconTextToSpeechOff';
|
|
133
132
|
export { default as IconTextToSpeech } from './IconTextToSpeech';
|
|
134
133
|
export { default as IconTextTypo } from './IconTextTypo';
|
|
135
134
|
export { default as IconTextUnderline } from './IconTextUnderline';
|
|
136
135
|
export { default as IconTextVanilla } from './IconTextVanilla';
|
|
137
136
|
export { default as IconTool } from './IconTool';
|
|
138
137
|
export { default as IconTrendingUp } from './IconTrendingUp';
|
|
138
|
+
export { default as IconUndoAll } from './IconUndoAll';
|
|
139
139
|
export { default as IconUndo } from './IconUndo';
|
|
140
140
|
export { default as IconUnlink } from './IconUnlink';
|
|
141
141
|
export { default as IconUnlock } from './IconUnlock';
|
|
142
|
+
export { default as IconUnreadMail } from './IconUnreadMail';
|
|
142
143
|
export { default as IconUpload } from './IconUpload';
|
|
143
144
|
export { default as IconUserSearch } from './IconUserSearch';
|
|
144
145
|
export { default as IconUser } from './IconUser';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@edifice.io/react",
|
|
3
|
-
"version": "2.1.1-develop-
|
|
3
|
+
"version": "2.1.1-develop-b2school.20250219164321",
|
|
4
4
|
"description": "Edifice React Library",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -118,9 +118,9 @@
|
|
|
118
118
|
"react-slugify": "^3.0.3",
|
|
119
119
|
"swiper": "^10.1.0",
|
|
120
120
|
"ua-parser-js": "^1.0.36",
|
|
121
|
-
"@edifice.io/bootstrap": "2.1.1-develop-
|
|
122
|
-
"@edifice.io/tiptap-extensions": "2.1.1-develop-
|
|
123
|
-
"@edifice.io/utilities": "2.1.1-develop-
|
|
121
|
+
"@edifice.io/bootstrap": "2.1.1-develop-b2school.20250219164321",
|
|
122
|
+
"@edifice.io/tiptap-extensions": "2.1.1-develop-b2school.20250219164321",
|
|
123
|
+
"@edifice.io/utilities": "2.1.1-develop-b2school.20250219164321"
|
|
124
124
|
},
|
|
125
125
|
"devDependencies": {
|
|
126
126
|
"@babel/plugin-transform-react-pure-annotations": "^7.23.3",
|
|
@@ -151,8 +151,8 @@
|
|
|
151
151
|
"vite": "^5.4.11",
|
|
152
152
|
"vite-plugin-dts": "^4.1.0",
|
|
153
153
|
"vite-tsconfig-paths": "^5.0.1",
|
|
154
|
-
"@edifice.io/client": "2.1.1-develop-
|
|
155
|
-
"@edifice.io/config": "2.1.1-develop-
|
|
154
|
+
"@edifice.io/client": "2.1.1-develop-b2school.20250219164321",
|
|
155
|
+
"@edifice.io/config": "2.1.1-develop-b2school.20250219164321"
|
|
156
156
|
},
|
|
157
157
|
"peerDependencies": {
|
|
158
158
|
"@react-spring/web": "^9.7.5",
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import { useEditorContext } from "../../hooks/useEditorContext.js";
|
|
3
|
-
const CantooModal = () => {
|
|
4
|
-
const {
|
|
5
|
-
editor
|
|
6
|
-
} = useEditorContext(), Cantoo = window.Cantoo, editorHTML = editor == null ? void 0 : editor.getHTML(), cantooHTML = (Cantoo == null ? void 0 : Cantoo.formatText(editorHTML)) || editorHTML;
|
|
7
|
-
return /* @__PURE__ */ jsx("div", { className: "card p-24 mt-8", children: /* @__PURE__ */ jsx("div", { dangerouslySetInnerHTML: {
|
|
8
|
-
__html: cantooHTML
|
|
9
|
-
} }) });
|
|
10
|
-
};
|
|
11
|
-
export {
|
|
12
|
-
CantooModal as default
|
|
13
|
-
};
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { RefAttributes } from 'react';
|
|
2
|
-
import { IconButtonProps } from '../../../../components';
|
|
3
|
-
interface Props {
|
|
4
|
-
triggerProps: JSX.IntrinsicAttributes & Omit<IconButtonProps, 'ref'> & RefAttributes<HTMLButtonElement>;
|
|
5
|
-
openCantooAdaptTextBox: () => void | undefined;
|
|
6
|
-
isCantooAdaptTextBoxOpen: boolean | null;
|
|
7
|
-
}
|
|
8
|
-
export declare const EditorToolbarCantoo: ({ triggerProps, openCantooAdaptTextBox, isCantooAdaptTextBoxOpen, }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
9
|
-
export {};
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
2
|
-
import { Fragment as Fragment$1 } from "react";
|
|
3
|
-
import { useTranslation } from "react-i18next";
|
|
4
|
-
import SvgIconCantoo from "../../../icons/components/IconCantoo.js";
|
|
5
|
-
import SvgIconMicOff from "../../../icons/components/IconMicOff.js";
|
|
6
|
-
import SvgIconMic from "../../../icons/components/IconMic.js";
|
|
7
|
-
import SvgIconTextToSpeechOff from "../../../icons/components/IconTextToSpeechOff.js";
|
|
8
|
-
import SvgIconTextToSpeech from "../../../icons/components/IconTextToSpeech.js";
|
|
9
|
-
import SvgIconWand from "../../../icons/components/IconWand.js";
|
|
10
|
-
import { useCantooEditor } from "../../hooks/useCantooEditor.js";
|
|
11
|
-
import { useEditorContext } from "../../hooks/useEditorContext.js";
|
|
12
|
-
import Tooltip from "../../../../components/Tooltip/Tooltip.js";
|
|
13
|
-
import IconButton from "../../../../components/Button/IconButton.js";
|
|
14
|
-
import Dropdown from "../../../../components/Dropdown/Dropdown.js";
|
|
15
|
-
const EditorToolbarCantoo = ({
|
|
16
|
-
triggerProps,
|
|
17
|
-
openCantooAdaptTextBox,
|
|
18
|
-
isCantooAdaptTextBoxOpen
|
|
19
|
-
}) => {
|
|
20
|
-
const {
|
|
21
|
-
t
|
|
22
|
-
} = useTranslation(), {
|
|
23
|
-
editor
|
|
24
|
-
} = useEditorContext(), {
|
|
25
|
-
speech2textIsActive,
|
|
26
|
-
text2speechIsActive,
|
|
27
|
-
toggleSpeech2Text,
|
|
28
|
-
toggleText2Speech,
|
|
29
|
-
formatText
|
|
30
|
-
} = useCantooEditor(editor), cantooOptions = [{
|
|
31
|
-
id: "speech2text",
|
|
32
|
-
label: t("tiptap.toolbar.cantoo.speech2text"),
|
|
33
|
-
className: speech2textIsActive ? "fw-bold" : "",
|
|
34
|
-
icon: speech2textIsActive ? /* @__PURE__ */ jsx(SvgIconMicOff, {}) : /* @__PURE__ */ jsx(SvgIconMic, {}),
|
|
35
|
-
action: () => toggleSpeech2Text()
|
|
36
|
-
}, {
|
|
37
|
-
id: "text2speech",
|
|
38
|
-
label: t("tiptap.toolbar.cantoo.text2speech"),
|
|
39
|
-
className: text2speechIsActive ? "fw-bold" : "",
|
|
40
|
-
icon: text2speechIsActive ? /* @__PURE__ */ jsx(SvgIconTextToSpeechOff, {}) : /* @__PURE__ */ jsx(SvgIconTextToSpeech, {}),
|
|
41
|
-
action: () => toggleText2Speech()
|
|
42
|
-
}, {
|
|
43
|
-
id: "formatText",
|
|
44
|
-
label: t("tiptap.toolbar.cantoo.formatText"),
|
|
45
|
-
className: isCantooAdaptTextBoxOpen ? "fw-bold" : "",
|
|
46
|
-
icon: /* @__PURE__ */ jsx(SvgIconWand, {}),
|
|
47
|
-
action: () => formatText(openCantooAdaptTextBox)
|
|
48
|
-
}];
|
|
49
|
-
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
50
|
-
/* @__PURE__ */ jsx(Tooltip, { message: t("tiptap.toolbar.cantoo.choice"), placement: "top", children: /* @__PURE__ */ jsx(IconButton, { ...triggerProps, type: "button", variant: "ghost", color: "tertiary", icon: /* @__PURE__ */ jsx(SvgIconCantoo, {}), className: speech2textIsActive || text2speechIsActive || isCantooAdaptTextBoxOpen ? "is-selected" : "", "aria-label": t("tiptap.toolbar.cantoo.choice") }) }),
|
|
51
|
-
/* @__PURE__ */ jsx(Dropdown.Menu, { children: cantooOptions.map((option) => /* @__PURE__ */ jsx(Fragment$1, { children: /* @__PURE__ */ jsx(Dropdown.Item, { onClick: option.action, icon: option.icon, children: /* @__PURE__ */ jsx("span", { className: option.className, children: option.label }) }) }, option.id)) })
|
|
52
|
-
] });
|
|
53
|
-
};
|
|
54
|
-
export {
|
|
55
|
-
EditorToolbarCantoo
|
|
56
|
-
};
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Custom hook to manage CantooModal events in an editor.
|
|
3
|
-
* @returns {
|
|
4
|
-
* `isOpen`: truthy boolean when CantooModal sholud be visible,
|
|
5
|
-
* `toggle`: an imperative function to toggle the `isOpen` value,
|
|
6
|
-
* `onCancel`: Cancel event handler,
|
|
7
|
-
* }
|
|
8
|
-
*/
|
|
9
|
-
export declare const useCantooAdaptTextBox: () => CantooAdaptTextBox;
|
|
10
|
-
export interface CantooAdaptTextBox {
|
|
11
|
-
isOpen: boolean | null;
|
|
12
|
-
toggle: () => void;
|
|
13
|
-
onCancel: () => void;
|
|
14
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import useToggle from "../../../hooks/useToggle/useToggle.js";
|
|
2
|
-
const useCantooAdaptTextBox = () => {
|
|
3
|
-
const [isOpen, toggle] = useToggle(!1);
|
|
4
|
-
return {
|
|
5
|
-
isOpen,
|
|
6
|
-
toggle,
|
|
7
|
-
onCancel: () => {
|
|
8
|
-
toggle();
|
|
9
|
-
}
|
|
10
|
-
};
|
|
11
|
-
};
|
|
12
|
-
export {
|
|
13
|
-
useCantooAdaptTextBox
|
|
14
|
-
};
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { Editor } from '@tiptap/react';
|
|
2
|
-
export declare const useCantooEditor: (editor: Editor | null) => {
|
|
3
|
-
isAvailable: boolean | Record<string, boolean> | undefined;
|
|
4
|
-
speech2textIsActive: boolean;
|
|
5
|
-
text2speechIsActive: boolean;
|
|
6
|
-
toggleSpeech2Text: () => Promise<void>;
|
|
7
|
-
toggleText2Speech: () => void;
|
|
8
|
-
formatText: (openModal: () => void) => void;
|
|
9
|
-
};
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import { useState } from "react";
|
|
2
|
-
import useHasWorkflow from "../../../hooks/useHasWorkflow/useHasWorkflow.js";
|
|
3
|
-
const useCantooEditor = (editor) => {
|
|
4
|
-
const isAvailable = useHasWorkflow("org.entcore.portal.controllers.PortalController|optionalFeatureCantoo"), [speech2textIsActive, setSpeech2textActive] = useState(!1), [text2speechIsActive, setText2speechActive] = useState(!1), Cantoo = window.Cantoo;
|
|
5
|
-
return {
|
|
6
|
-
isAvailable,
|
|
7
|
-
speech2textIsActive,
|
|
8
|
-
text2speechIsActive,
|
|
9
|
-
toggleSpeech2Text: async () => {
|
|
10
|
-
if (speech2textIsActive) {
|
|
11
|
-
setSpeech2textActive(!1);
|
|
12
|
-
try {
|
|
13
|
-
await Cantoo.speech2text.stop();
|
|
14
|
-
} catch (e) {
|
|
15
|
-
console.warn("Error while trying to stop Cantoo (speech2text)", e);
|
|
16
|
-
}
|
|
17
|
-
} else
|
|
18
|
-
try {
|
|
19
|
-
if (setSpeech2textActive(!0), await Cantoo.speech2text.isAvailableOnDevice())
|
|
20
|
-
if (await Cantoo.speech2text.requestPermission())
|
|
21
|
-
await Cantoo.speech2text.start((data) => {
|
|
22
|
-
editor == null || editor.chain().focus().insertContent(data.join(" ")).run();
|
|
23
|
-
}, window.navigator.language);
|
|
24
|
-
else
|
|
25
|
-
throw new Error("Permission denied");
|
|
26
|
-
else
|
|
27
|
-
throw new Error("Cantoo not available");
|
|
28
|
-
} catch (e) {
|
|
29
|
-
console.warn("Error while trying to use Cantoo (speech2text)", e), setSpeech2textActive(!1);
|
|
30
|
-
}
|
|
31
|
-
},
|
|
32
|
-
toggleText2Speech: () => {
|
|
33
|
-
if (text2speechIsActive)
|
|
34
|
-
setText2speechActive(!1), window.speechSynthesis.cancel();
|
|
35
|
-
else
|
|
36
|
-
try {
|
|
37
|
-
setText2speechActive(!0), Cantoo.text2speech.readText(editor == null ? void 0 : editor.getText()), Cantoo.text2speech.utter.onend = () => {
|
|
38
|
-
setText2speechActive(!1);
|
|
39
|
-
};
|
|
40
|
-
} catch (e) {
|
|
41
|
-
console.warn("Error while trying to use Cantoo (text2speech)", e), setText2speechActive(!1);
|
|
42
|
-
}
|
|
43
|
-
},
|
|
44
|
-
formatText: (openModal) => {
|
|
45
|
-
openModal();
|
|
46
|
-
}
|
|
47
|
-
};
|
|
48
|
-
};
|
|
49
|
-
export {
|
|
50
|
-
useCantooEditor
|
|
51
|
-
};
|