@edifice.io/react 2.2.7-develop-b2school.20250523102221 → 2.2.8-develop-integration.20250523170252

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.
Files changed (100) hide show
  1. package/dist/components/Button/Button.d.ts +1 -1
  2. package/dist/components/Button/Button.js +1 -1
  3. package/dist/components/Button/IconButton.js +1 -1
  4. package/dist/components/Combobox/Combobox.d.ts +5 -60
  5. package/dist/components/Combobox/Combobox.js +7 -18
  6. package/dist/components/Combobox/ComboboxTrigger.d.ts +3 -34
  7. package/dist/components/Combobox/ComboboxTrigger.js +8 -33
  8. package/dist/components/Dropdown/Dropdown.d.ts +2 -10
  9. package/dist/components/Dropdown/Dropdown.js +3 -5
  10. package/dist/components/Dropdown/DropdownItem.d.ts +1 -5
  11. package/dist/components/Dropdown/DropdownItem.js +1 -4
  12. package/dist/components/Dropdown/DropdownTrigger.js +1 -5
  13. package/dist/components/Layout/components/Header.js +1 -1
  14. package/dist/components/List/List.d.ts +1 -15
  15. package/dist/components/List/List.js +12 -15
  16. package/dist/components/SearchBar/SearchBar.d.ts +1 -1
  17. package/dist/components/SearchBar/SearchBar.js +1 -3
  18. package/dist/components/Toolbar/Toolbar.d.ts +0 -4
  19. package/dist/components/Toolbar/Toolbar.js +3 -8
  20. package/dist/components/Tree/components/Tree.js +2 -1
  21. package/dist/components/Tree/hooks/useTree.d.ts +1 -0
  22. package/dist/components/Tree/hooks/useTree.js +25 -2
  23. package/dist/components/Tree/types/index.d.ts +4 -0
  24. package/dist/editor.js +26 -28
  25. package/dist/hooks/index.d.ts +0 -1
  26. package/dist/hooks/useCheckable/useCheckable.js +3 -10
  27. package/dist/hooks/useConversation/useConversation.d.ts +1 -1
  28. package/dist/hooks/useConversation/useConversation.js +17 -13
  29. package/dist/hooks/useDate/useDate.d.ts +0 -1
  30. package/dist/hooks/useDate/useDate.js +27 -33
  31. package/dist/hooks/useDropdown/useDropdown.d.ts +1 -2
  32. package/dist/hooks/useDropdown/useDropdown.js +3 -5
  33. package/dist/hooks/useHttpErrorToast/useHttpErrorToast.js +3 -12
  34. package/dist/icons.js +266 -280
  35. package/dist/index.d.ts +0 -1
  36. package/dist/index.js +20 -50
  37. package/dist/modals.js +14 -16
  38. package/dist/modules/editor/components/Editor/CantooAdaptTextBoxView.d.ts +7 -0
  39. package/dist/modules/editor/components/Editor/CantooAdaptTextBoxView.js +33 -0
  40. package/dist/modules/editor/components/Editor/Editor.d.ts +2 -8
  41. package/dist/modules/editor/components/Editor/Editor.js +19 -11
  42. package/dist/modules/editor/components/EditorToolbar/EditorToolbar.Cantoo.d.ts +9 -0
  43. package/dist/modules/editor/components/EditorToolbar/EditorToolbar.Cantoo.js +79 -0
  44. package/dist/modules/editor/components/EditorToolbar/EditorToolbar.d.ts +4 -1
  45. package/dist/modules/editor/components/EditorToolbar/EditorToolbar.js +15 -3
  46. package/dist/modules/editor/components/NodeView/index.d.ts +1 -2
  47. package/dist/modules/editor/components/Renderer/index.d.ts +1 -2
  48. package/dist/modules/editor/hooks/index.d.ts +1 -0
  49. package/dist/modules/editor/hooks/useCantooEditor.d.ts +17 -0
  50. package/dist/modules/editor/hooks/useCantooEditor.js +89 -0
  51. package/dist/modules/editor/hooks/useTipTapEditor.d.ts +2 -6
  52. package/dist/modules/editor/hooks/useTipTapEditor.js +2 -2
  53. package/dist/modules/icons/components/{IconGlobe2.d.ts → IconCantoo.d.ts} +2 -2
  54. package/dist/modules/icons/components/IconCantoo.js +23 -0
  55. package/dist/modules/icons/components/IconMicOff.d.ts +7 -0
  56. package/dist/modules/icons/components/IconMicOff.js +12 -0
  57. package/dist/modules/icons/components/IconTextToSpeechOff.d.ts +7 -0
  58. package/dist/modules/icons/components/IconTextToSpeechOff.js +12 -0
  59. package/dist/modules/icons/components/index.d.ts +3 -10
  60. package/dist/modules/modals/OnboardingModal/OnboardingModal.d.ts +5 -9
  61. package/dist/modules/modals/OnboardingModal/OnboardingModal.js +4 -5
  62. package/dist/modules/modals/index.d.ts +0 -1
  63. package/dist/modules/multimedia/index.d.ts +0 -1
  64. package/dist/multimedia.js +1 -3
  65. package/package.json +6 -6
  66. package/dist/hooks/useWorkspaceFolders/index.d.ts +0 -3
  67. package/dist/hooks/useWorkspaceFolders/useWorkspaceFolders.js +0 -54
  68. package/dist/hooks/useWorkspaceFolders/useWorkspaceFoldersTree.d.ts +0 -13
  69. package/dist/hooks/useWorkspaceFolders/useWorkspaceFoldersTree.js +0 -51
  70. package/dist/modules/editor/components/NodeView/ConversationHistoryNodeView.d.ts +0 -2
  71. package/dist/modules/editor/components/NodeView/ConversationHistoryNodeView.js +0 -10
  72. package/dist/modules/editor/components/Renderer/ConversationHistoryRenderer.d.ts +0 -8
  73. package/dist/modules/editor/components/Renderer/ConversationHistoryRenderer.js +0 -28
  74. package/dist/modules/icons/components/IconFolderAdd.d.ts +0 -7
  75. package/dist/modules/icons/components/IconFolderAdd.js +0 -13
  76. package/dist/modules/icons/components/IconFolderDelete.d.ts +0 -7
  77. package/dist/modules/icons/components/IconFolderDelete.js +0 -12
  78. package/dist/modules/icons/components/IconGlobe2.js +0 -16
  79. package/dist/modules/icons/components/IconGroupAvatar.d.ts +0 -7
  80. package/dist/modules/icons/components/IconGroupAvatar.js +0 -12
  81. package/dist/modules/icons/components/IconMailRecall.d.ts +0 -7
  82. package/dist/modules/icons/components/IconMailRecall.js +0 -13
  83. package/dist/modules/icons/components/IconQuestionMark.d.ts +0 -7
  84. package/dist/modules/icons/components/IconQuestionMark.js +0 -13
  85. package/dist/modules/icons/components/IconReadMail.d.ts +0 -7
  86. package/dist/modules/icons/components/IconReadMail.js +0 -16
  87. package/dist/modules/icons/components/IconSignature.d.ts +0 -7
  88. package/dist/modules/icons/components/IconSignature.js +0 -13
  89. package/dist/modules/icons/components/IconUndoAll.d.ts +0 -7
  90. package/dist/modules/icons/components/IconUndoAll.js +0 -14
  91. package/dist/modules/icons/components/IconUnreadMail.d.ts +0 -7
  92. package/dist/modules/icons/components/IconUnreadMail.js +0 -16
  93. package/dist/modules/modals/ConfirmModal/ConfirmModal.d.ts +0 -47
  94. package/dist/modules/modals/ConfirmModal/ConfirmModal.js +0 -37
  95. package/dist/modules/modals/ConfirmModal/index.d.ts +0 -1
  96. package/dist/modules/multimedia/WorkspaceFolders/WorkspaceFolders.d.ts +0 -8
  97. package/dist/modules/multimedia/WorkspaceFolders/WorkspaceFolders.js +0 -55
  98. package/dist/modules/multimedia/WorkspaceFolders/components/NewFolderForm.d.ts +0 -16
  99. package/dist/modules/multimedia/WorkspaceFolders/components/NewFolderForm.js +0 -39
  100. package/dist/modules/multimedia/WorkspaceFolders/index.d.ts +0 -1
package/dist/index.js CHANGED
@@ -73,28 +73,16 @@ import { default as default72 } from "./hooks/useUpload/useUpload.js";
73
73
  import { default as default73 } from "./hooks/useUploadFiles/useUploadFiles.js";
74
74
  import { default as default74 } from "./hooks/useUser/useUser.js";
75
75
  import { default as default75 } from "./hooks/useWorkspaceFile/useWorkspaceFile.js";
76
- import { default as default76 } from "./hooks/useWorkspaceFolders/useWorkspaceFolders.js";
77
- import { WORKSPACE_SHARED_FOLDER_ID, WORKSPACE_USER_FOLDER_ID, default as default77 } from "./hooks/useWorkspaceFolders/useWorkspaceFoldersTree.js";
78
- import { default as default78 } from "./hooks/useWorkspaceSearch/useWorkspaceSearch.js";
79
- import { default as default79 } from "./hooks/useXitiTrackPageLoad/useXitiTrackPageLoad.js";
80
- import { default as default80 } from "./hooks/useZendeskGuide/useZendeskGuide.js";
81
- import { default as default81 } from "./modules/modals/ConfirmModal/ConfirmModal.js";
82
- import { default as default82 } from "./modules/modals/OnboardingModal/OnboardingModal.js";
83
- import { default as default83 } from "./modules/modals/PublishModal/PublishModal.js";
84
- import { default as default84 } from "./modules/modals/ResourceModal/apps/BlogPublic.js";
85
- import { default as default85 } from "./modules/modals/ResourceModal/hooks/useUpdateMutation.js";
86
- import { default as default86 } from "./modules/modals/ShareModal/ShareModal.js";
87
- import { default as default87 } from "./modules/modals/ShareModal/apps/ShareBlog.js";
88
- import { default as default88 } from "./modules/modals/ShareModal/hooks/useShareMutation.js";
89
- import { default as default89 } from "./modules/multimedia/AudioRecorder/AudioRecorder.js";
90
- import { default as default90 } from "./modules/multimedia/Embed/Embed.js";
91
- import { default as default91 } from "./modules/multimedia/ImageEditor/components/ImageEditor.js";
92
- import { default as default92 } from "./modules/multimedia/ImagePicker/ImagePicker.js";
93
- import { default as default93 } from "./modules/multimedia/MediaLibrary/MediaLibrary.js";
94
- import { default as default94 } from "./modules/multimedia/VideoEmbed/VideoEmbed.js";
95
- import { default as default95 } from "./modules/multimedia/VideoRecorder/VideoRecorder.js";
96
- import { default as default96 } from "./modules/multimedia/Workspace/Workspace.js";
97
- import { default as default97 } from "./modules/multimedia/WorkspaceFolders/WorkspaceFolders.js";
76
+ import { default as default76 } from "./hooks/useWorkspaceSearch/useWorkspaceSearch.js";
77
+ import { default as default77 } from "./hooks/useXitiTrackPageLoad/useXitiTrackPageLoad.js";
78
+ import { default as default78 } from "./hooks/useZendeskGuide/useZendeskGuide.js";
79
+ import { default as default79 } from "./modules/modals/OnboardingModal/OnboardingModal.js";
80
+ import { default as default80 } from "./modules/modals/PublishModal/PublishModal.js";
81
+ import { default as default81 } from "./modules/modals/ResourceModal/apps/BlogPublic.js";
82
+ import { default as default82 } from "./modules/modals/ResourceModal/hooks/useUpdateMutation.js";
83
+ import { default as default83 } from "./modules/modals/ShareModal/ShareModal.js";
84
+ import { default as default84 } from "./modules/modals/ShareModal/apps/ShareBlog.js";
85
+ import { default as default85 } from "./modules/modals/ShareModal/hooks/useShareMutation.js";
98
86
  import { AccessiblePalette, DefaultPalette } from "./components/ColorPicker/ColorPalette.js";
99
87
  import { DropzoneContext, useDropzoneContext } from "./components/Dropzone/DropzoneContext.js";
100
88
  import { Column, Grid } from "./components/Grid/Grid.js";
@@ -111,8 +99,6 @@ import { TreeNode } from "./components/TreeView/TreeNode.js";
111
99
  import { TreeNodeFolderWrapper, addNode, arrayUnique, deleteNode, findNodeById, findParentNode, findPathById, findTreeNode, getAncestors, hasChildren, modifyNode, moveNode, updateNode, wrapTreeNode } from "./components/TreeView/utilities/treeview.js";
112
100
  import { useCheckable } from "./hooks/useCheckable/useCheckable.js";
113
101
  import { ResourceModal } from "./modules/modals/ResourceModal/ResourceModal.js";
114
- import { ExternalLinker } from "./modules/multimedia/Linker/ExternalLinker/ExternalLinker.js";
115
- import { InternalLinker } from "./modules/multimedia/Linker/InternalLinker/InternalLinker.js";
116
102
  import { EdificeClientProvider } from "./providers/EdificeClientProvider/EdificeClientProvider.js";
117
103
  import { EdificeClientContext } from "./providers/EdificeClientProvider/EdificeClientProvider.context.js";
118
104
  import { useEdificeClient } from "./providers/EdificeClientProvider/EdificeClientProvider.hook.js";
@@ -130,11 +116,10 @@ export {
130
116
  default4 as AppHeader,
131
117
  default5 as AppIcon,
132
118
  default6 as Attachment,
133
- default89 as AudioRecorder,
134
119
  default7 as Avatar,
135
120
  default8 as AvatarGroup,
136
121
  default9 as Badge,
137
- default84 as BlogPublic,
122
+ default81 as BlogPublic,
138
123
  default10 as Breadcrumb,
139
124
  default11 as Button,
140
125
  default14 as Card,
@@ -143,7 +128,6 @@ export {
143
128
  default17 as ColorPickerItem,
144
129
  Column,
145
130
  default18 as Combobox,
146
- default81 as ConfirmModal,
147
131
  DefaultPalette,
148
132
  DndTree,
149
133
  default19 as Dropdown,
@@ -153,9 +137,7 @@ export {
153
137
  EdificeClientProvider,
154
138
  EdificeThemeContext,
155
139
  EdificeThemeProvider,
156
- default90 as Embed,
157
140
  default21 as EmptyScreen,
158
- ExternalLinker,
159
141
  default22 as Flex,
160
142
  default24 as FormControl,
161
143
  default23 as FormText,
@@ -163,34 +145,30 @@ export {
163
145
  default25 as Heading,
164
146
  default12 as IconButton,
165
147
  default26 as Image,
166
- default91 as ImageEditor,
167
- default92 as ImagePicker,
168
148
  default27 as Input,
169
- InternalLinker,
170
149
  default28 as Label,
171
150
  Layout,
172
151
  List,
173
152
  default29 as Loading,
174
153
  default30 as LoadingScreen,
175
154
  default31 as Logo,
176
- default93 as MediaLibrary,
177
155
  Menu,
178
156
  MockedProvider,
179
157
  default32 as Modal,
180
- default82 as OnboardingModal,
158
+ default79 as OnboardingModal,
181
159
  Popover,
182
160
  PopoverBody,
183
161
  PopoverFooter,
184
162
  PopoverHeader,
185
163
  default33 as PreventPropagation,
186
- default83 as PublishModal,
164
+ default80 as PublishModal,
187
165
  default34 as Radio,
188
166
  ResourceModal,
189
167
  default35 as SearchBar,
190
168
  default13 as SearchButton,
191
169
  default36 as Select,
192
- default87 as ShareBlog,
193
- default86 as ShareModal,
170
+ default84 as ShareBlog,
171
+ default83 as ShareModal,
194
172
  default42 as SortableTree,
195
173
  default37 as StackedGroup,
196
174
  default38 as Switch,
@@ -203,13 +181,7 @@ export {
203
181
  TreeNode,
204
182
  TreeNodeFolderWrapper,
205
183
  default44 as TreeView,
206
- default94 as VideoEmbed,
207
- default95 as VideoRecorder,
208
184
  default45 as VisuallyHidden,
209
- WORKSPACE_SHARED_FOLDER_ID,
210
- WORKSPACE_USER_FOLDER_ID,
211
- default96 as Workspace,
212
- default97 as WorkspaceFolders,
213
185
  addNode,
214
186
  arrayUnique,
215
187
  buildTree,
@@ -262,7 +234,7 @@ export {
262
234
  default64 as useLibraryUrl,
263
235
  default65 as useMediaLibrary,
264
236
  default66 as useScrollToTop,
265
- default88 as useShareMutation,
237
+ default85 as useShareMutation,
266
238
  default67 as useTitle,
267
239
  default68 as useToast,
268
240
  default69 as useToggle,
@@ -270,15 +242,13 @@ export {
270
242
  default71 as useTrashedResource,
271
243
  useTreeSortable,
272
244
  useTreeView,
273
- default85 as useUpdateMutation,
245
+ default82 as useUpdateMutation,
274
246
  default72 as useUpload,
275
247
  default73 as useUploadFiles,
276
248
  default74 as useUser,
277
249
  default75 as useWorkspaceFile,
278
- default76 as useWorkspaceFolders,
279
- default77 as useWorkspaceFoldersTree,
280
- default78 as useWorkspaceSearch,
281
- default79 as useXitiTrackPageLoad,
282
- default80 as useZendeskGuide,
250
+ default76 as useWorkspaceSearch,
251
+ default77 as useXitiTrackPageLoad,
252
+ default78 as useZendeskGuide,
283
253
  wrapTreeNode
284
254
  };
package/dist/modals.js CHANGED
@@ -1,20 +1,18 @@
1
- import { default as default2 } from "./modules/modals/ConfirmModal/ConfirmModal.js";
2
- import { default as default3 } from "./modules/modals/OnboardingModal/OnboardingModal.js";
3
- import { default as default4 } from "./modules/modals/PublishModal/PublishModal.js";
4
- import { default as default5 } from "./modules/modals/ResourceModal/apps/BlogPublic.js";
5
- import { default as default6 } from "./modules/modals/ResourceModal/hooks/useUpdateMutation.js";
6
- import { default as default7 } from "./modules/modals/ShareModal/ShareModal.js";
7
- import { default as default8 } from "./modules/modals/ShareModal/apps/ShareBlog.js";
8
- import { default as default9 } from "./modules/modals/ShareModal/hooks/useShareMutation.js";
1
+ import { default as default2 } from "./modules/modals/OnboardingModal/OnboardingModal.js";
2
+ import { default as default3 } from "./modules/modals/PublishModal/PublishModal.js";
3
+ import { default as default4 } from "./modules/modals/ResourceModal/apps/BlogPublic.js";
4
+ import { default as default5 } from "./modules/modals/ResourceModal/hooks/useUpdateMutation.js";
5
+ import { default as default6 } from "./modules/modals/ShareModal/ShareModal.js";
6
+ import { default as default7 } from "./modules/modals/ShareModal/apps/ShareBlog.js";
7
+ import { default as default8 } from "./modules/modals/ShareModal/hooks/useShareMutation.js";
9
8
  import { ResourceModal } from "./modules/modals/ResourceModal/ResourceModal.js";
10
9
  export {
11
- default5 as BlogPublic,
12
- default2 as ConfirmModal,
13
- default3 as OnboardingModal,
14
- default4 as PublishModal,
10
+ default4 as BlogPublic,
11
+ default2 as OnboardingModal,
12
+ default3 as PublishModal,
15
13
  ResourceModal,
16
- default8 as ShareBlog,
17
- default7 as ShareModal,
18
- default9 as useShareMutation,
19
- default6 as useUpdateMutation
14
+ default7 as ShareBlog,
15
+ default6 as ShareModal,
16
+ default8 as useShareMutation,
17
+ default5 as useUpdateMutation
20
18
  };
@@ -0,0 +1,7 @@
1
+ declare const CantooAdaptTextBoxView: ({ openPosition, }: {
2
+ openPosition?: {
3
+ right: boolean;
4
+ bottom: boolean;
5
+ };
6
+ }) => import("react/jsx-runtime").JSX.Element;
7
+ export default CantooAdaptTextBoxView;
@@ -0,0 +1,33 @@
1
+ import { jsxs, Fragment, jsx } from "react/jsx-runtime";
2
+ import { useRef, useEffect } from "react";
3
+ import { useEditorContext } from "../../hooks/useEditorContext.js";
4
+ const CantooAdaptTextBoxView = ({
5
+ openPosition
6
+ }) => {
7
+ const {
8
+ editor
9
+ } = useEditorContext(), containerRef = useRef(null), Cantoo = window.Cantoo, editorHTML = editor == null ? void 0 : editor.getHTML(), cantooHTML = (Cantoo == null ? void 0 : Cantoo.formatText(editorHTML)) || editorHTML;
10
+ return useEffect(() => {
11
+ var _a;
12
+ openPosition != null && openPosition.bottom && ((_a = containerRef.current) == null || _a.scrollIntoView({
13
+ behavior: "smooth",
14
+ block: "nearest",
15
+ inline: "nearest"
16
+ }));
17
+ }, []), /* @__PURE__ */ jsxs(Fragment, { children: [
18
+ (openPosition == null ? void 0 : openPosition.right) && /* @__PURE__ */ jsx("div", { style: {
19
+ width: "1px",
20
+ backgroundColor: "#e0e0e0",
21
+ margin: "0 3px"
22
+ } }),
23
+ /* @__PURE__ */ jsx("div", { style: {
24
+ flex: 1,
25
+ marginTop: openPosition != null && openPosition.bottom ? "16px" : "0px"
26
+ }, children: /* @__PURE__ */ jsx("div", { ref: containerRef, className: `${openPosition != null && openPosition.bottom ? "card" : ""} py-12 px-16`, children: /* @__PURE__ */ jsx("div", { dangerouslySetInnerHTML: {
27
+ __html: cantooHTML
28
+ } }) }) })
29
+ ] });
30
+ };
31
+ export {
32
+ CantooAdaptTextBoxView as default
33
+ };
@@ -1,5 +1,5 @@
1
1
  import { WorkspaceVisibility } from '@edifice.io/client';
2
- import { Content, Extensions, FocusPosition, JSONContent } from '@tiptap/react';
2
+ import { Content, FocusPosition, JSONContent } from '@tiptap/react';
3
3
  export interface EditorRef {
4
4
  /** Get the current content. */
5
5
  getContent: (as: 'html' | 'json' | 'plain') => undefined | string | JSONContent;
@@ -7,11 +7,6 @@ export interface EditorRef {
7
7
  isSpeeching: () => boolean;
8
8
  /** [De]activate speech synthetisis */
9
9
  toogleSpeechSynthetisis: () => boolean;
10
- /**
11
- * Set focus to the editor
12
- * @param position
13
- */
14
- setFocus: (position: FocusPosition) => void;
15
10
  }
16
11
  /**
17
12
  * Editor component properties
@@ -45,8 +40,7 @@ export interface EditorProps {
45
40
  onContentChange?: ({ editor }: {
46
41
  editor: any;
47
42
  }) => void;
48
- /** Extensions to add to the editor */
49
- extensions?: Extensions;
43
+ cantooParam?: 'simplify' | 'none';
50
44
  }
51
45
  declare const Editor: import('react').ForwardRefExoticComponent<EditorProps & import('react').RefAttributes<EditorRef>>;
52
46
  export default Editor;
@@ -5,14 +5,17 @@ import clsx from "clsx";
5
5
  import "@tiptap/starter-kit";
6
6
  import { useEdificeClient } from "../../../../providers/EdificeClientProvider/EdificeClientProvider.hook.js";
7
7
  import { useMathsStyles } from "../../hooks/useMathsStyles.js";
8
+ import CantooAdaptTextBoxView from "./CantooAdaptTextBoxView.js";
8
9
  import { useTipTapEditor } from "../../hooks/useTipTapEditor.js";
9
10
  import { useMediaLibraryEditor } from "../../hooks/useMediaLibraryEditor.js";
10
11
  import { useMathsModal } from "../../hooks/useMathsModal.js";
11
12
  import { useImageModal } from "../../hooks/useImageModal.js";
12
13
  import { useLinkToolbar } from "../../hooks/useLinkToolbar.js";
13
14
  import { useSpeechSynthetisis } from "../../hooks/useSpeechSynthetisis.js";
15
+ import { useCantooEditor } from "../../hooks/useCantooEditor.js";
14
16
  import { EditorContext } from "../../hooks/useEditorContext.js";
15
17
  import { EditorToolbar } from "../EditorToolbar/EditorToolbar.js";
18
+ import Flex from "../../../../components/Flex/Flex.js";
16
19
  import LinkToolbar from "../Toolbar/LinkToolbar.js";
17
20
  import TableToolbar from "../Toolbar/TableToolbar.js";
18
21
  import BubbleMenuEditImage from "../BubbleMenuEditImage/BubbleMenuEditImage.js";
@@ -29,21 +32,21 @@ const MathsModal = /* @__PURE__ */ lazy(async () => await import("../MathsModal/
29
32
  placeholder = "",
30
33
  visibility = "protected",
31
34
  onContentChange,
32
- extensions
35
+ cantooParam = "none"
33
36
  }, ref) => {
34
37
  const editorId = useId(), {
35
38
  appCode
36
39
  } = useEdificeClient(), {
37
40
  editor,
38
41
  editable
39
- } = useTipTapEditor(mode === "edit", content, focus, placeholder, onContentChange, visibility, extensions), {
42
+ } = useTipTapEditor(mode === "edit", content, focus, placeholder, onContentChange, visibility), {
40
43
  ref: mediaLibraryModalRef,
41
44
  ...mediaLibraryModalHandlers
42
45
  } = useMediaLibraryEditor(editor), {
43
46
  toggle: toggleMathsModal,
44
47
  ...mathsModalHandlers
45
48
  } = useMathsModal(editor), imageModal = useImageModal(editor, "media-library", visibility), linkToolbarHandlers = useLinkToolbar(editor, mediaLibraryModalRef), speechSynthetisis = useSpeechSynthetisis(editor);
46
- if (useMathsStyles(), useImperativeHandle(ref, () => ({
49
+ useMathsStyles(), useImperativeHandle(ref, () => ({
47
50
  getContent: (as) => {
48
51
  switch (as) {
49
52
  case "html":
@@ -57,11 +60,10 @@ const MathsModal = /* @__PURE__ */ lazy(async () => await import("../MathsModal/
57
60
  }
58
61
  },
59
62
  toogleSpeechSynthetisis: speechSynthetisis.toggle,
60
- isSpeeching: () => speechSynthetisis.isActivated,
61
- setFocus: (position) => {
62
- editor && editor.commands.focus(position);
63
- }
64
- })), !editor) return null;
63
+ isSpeeching: () => speechSynthetisis.isActivated
64
+ }));
65
+ const contooEditor = useCantooEditor(editor, cantooParam);
66
+ if (!editor) return null;
65
67
  const borderClass = clsx(variant === "outline" && "border rounded-3"), contentClass = clsx(variant === "outline" && "py-12 px-16");
66
68
  return /* @__PURE__ */ jsxs(EditorContext.Provider, { value: {
67
69
  id: id ?? editorId,
@@ -70,8 +72,13 @@ const MathsModal = /* @__PURE__ */ lazy(async () => await import("../MathsModal/
70
72
  editable
71
73
  }, children: [
72
74
  /* @__PURE__ */ jsxs("div", { className: borderClass, children: [
73
- toolbar !== "none" && editable && /* @__PURE__ */ jsx(EditorToolbar, { mediaLibraryRef: mediaLibraryModalRef, toggleMathsModal }),
74
- /* @__PURE__ */ jsx(EditorContent, { id: id ?? editorId, editor, className: contentClass })
75
+ toolbar !== "none" && editable && /* @__PURE__ */ jsx(EditorToolbar, { mediaLibraryRef: mediaLibraryModalRef, toggleMathsModal, cantooEditor: contooEditor }),
76
+ /* @__PURE__ */ jsxs(Flex, { direction: "row", children: [
77
+ /* @__PURE__ */ jsx(EditorContent, { id: id ?? editorId, editor, className: contentClass, style: {
78
+ flex: 1
79
+ } }),
80
+ editable && contooEditor.openPositionAdaptText.right && /* @__PURE__ */ jsx(CantooAdaptTextBoxView, { openPosition: contooEditor.openPositionAdaptText })
81
+ ] })
75
82
  ] }),
76
83
  /* @__PURE__ */ jsx(LinkToolbar, { editor, ...linkToolbarHandlers }),
77
84
  /* @__PURE__ */ jsx(TableToolbar, { editor }),
@@ -82,7 +89,8 @@ const MathsModal = /* @__PURE__ */ lazy(async () => await import("../MathsModal/
82
89
  /* @__PURE__ */ jsxs(Suspense, { fallback: /* @__PURE__ */ jsx(LoadingScreen, {}), children: [
83
90
  editable && /* @__PURE__ */ jsx(MediaLibrary, { appCode, visibility, multiple: !0, ref: mediaLibraryModalRef, ...mediaLibraryModalHandlers }),
84
91
  editable && mathsModalHandlers.isOpen && /* @__PURE__ */ jsx(MathsModal, { ...mathsModalHandlers }),
85
- 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 })
92
+ 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 }),
93
+ editable && contooEditor.openPositionAdaptText.bottom && /* @__PURE__ */ jsx(CantooAdaptTextBoxView, { openPosition: contooEditor.openPositionAdaptText })
86
94
  ] })
87
95
  ] });
88
96
  });
@@ -0,0 +1,9 @@
1
+ import { RefAttributes } from 'react';
2
+ import { IconButtonProps } from '../../../../components';
3
+ import { CantooEditor } from '../../hooks';
4
+ interface Props {
5
+ triggerProps: JSX.IntrinsicAttributes & Omit<IconButtonProps, 'ref'> & RefAttributes<HTMLButtonElement>;
6
+ cantooEditor: CantooEditor;
7
+ }
8
+ export declare const EditorToolbarCantoo: ({ triggerProps, cantooEditor }: Props) => import("react/jsx-runtime").JSX.Element;
9
+ export {};
@@ -0,0 +1,79 @@
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 SvgIconDeleteColumnHighlight from "../../../icons/components/IconDeleteColumnHighlight.js";
6
+ import SvgIconDeleteRowHighlight from "../../../icons/components/IconDeleteRowHighlight.js";
7
+ import SvgIconMicOff from "../../../icons/components/IconMicOff.js";
8
+ import SvgIconMic from "../../../icons/components/IconMic.js";
9
+ import SvgIconSettings from "../../../icons/components/IconSettings.js";
10
+ import SvgIconTextToSpeechOff from "../../../icons/components/IconTextToSpeechOff.js";
11
+ import SvgIconTextToSpeech from "../../../icons/components/IconTextToSpeech.js";
12
+ import SvgIconWand from "../../../icons/components/IconWand.js";
13
+ import Tooltip from "../../../../components/Tooltip/Tooltip.js";
14
+ import IconButton from "../../../../components/Button/IconButton.js";
15
+ import Dropdown from "../../../../components/Dropdown/Dropdown.js";
16
+ const EditorToolbarCantoo = ({
17
+ triggerProps,
18
+ cantooEditor
19
+ }) => {
20
+ const {
21
+ t
22
+ } = useTranslation(), {
23
+ speech2textIsAvailable,
24
+ speech2textIsActive,
25
+ text2speechIsActive,
26
+ toggleSpeech2Text,
27
+ toggleText2Speech,
28
+ toogleSettings,
29
+ cantooParam
30
+ } = cantooEditor, cantooOptionsAdaptText = [{
31
+ id: "right",
32
+ label: t("tiptap.toolbar.cantoo.formatText.show.on.right"),
33
+ icon: /* @__PURE__ */ jsx(SvgIconDeleteColumnHighlight, {}),
34
+ className: cantooEditor.openPositionAdaptText.right ? "fw-bold" : "",
35
+ action: () => cantooEditor.handleCantooAdaptTextPosition("right")
36
+ }, {
37
+ id: "bottom",
38
+ label: t("tiptap.toolbar.cantoo.formatText.show.on.bottom"),
39
+ icon: /* @__PURE__ */ jsx(SvgIconDeleteRowHighlight, {}),
40
+ className: cantooEditor.openPositionAdaptText.bottom ? "fw-bold" : "",
41
+ action: () => cantooEditor.handleCantooAdaptTextPosition("bottom")
42
+ }], cantooOptions = [...cantooParam === "simplify" ? [{
43
+ id: "formatText",
44
+ label: t("tiptap.toolbar.cantoo.formatText"),
45
+ className: cantooEditor.openPositionAdaptText.bottom ? "fw-bold" : "",
46
+ icon: /* @__PURE__ */ jsx(SvgIconWand, {}),
47
+ action: () => cantooEditor.handleCantooAdaptTextPosition("bottom")
48
+ }] : [], ...speech2textIsAvailable ? [{
49
+ id: "speech2text",
50
+ label: t("tiptap.toolbar.cantoo.speech2text"),
51
+ className: speech2textIsActive ? "fw-bold" : "",
52
+ icon: speech2textIsActive ? /* @__PURE__ */ jsx(SvgIconMicOff, {}) : /* @__PURE__ */ jsx(SvgIconMic, {}),
53
+ action: () => toggleSpeech2Text()
54
+ }] : [], {
55
+ id: "text2speech",
56
+ label: t("tiptap.toolbar.cantoo.text2speech"),
57
+ className: text2speechIsActive ? "fw-bold" : "",
58
+ icon: text2speechIsActive ? /* @__PURE__ */ jsx(SvgIconTextToSpeechOff, {}) : /* @__PURE__ */ jsx(SvgIconTextToSpeech, {}),
59
+ action: () => toggleText2Speech()
60
+ }, ...cantooParam === "simplify" ? [] : [{
61
+ id: "settings",
62
+ label: t("tiptap.toolbar.cantoo.settings"),
63
+ icon: /* @__PURE__ */ jsx(SvgIconSettings, {}),
64
+ action: () => toogleSettings()
65
+ }]];
66
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
67
+ /* @__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 || cantooEditor.openPositionAdaptText.right || cantooEditor.openPositionAdaptText.bottom ? "is-selected" : "", "aria-label": t("tiptap.toolbar.cantoo.choice"), isLoading: !window.Cantoo }) }),
68
+ /* @__PURE__ */ jsxs(Dropdown.Menu, { children: [
69
+ cantooParam != "simplify" && /* @__PURE__ */ jsxs(Fragment, { children: [
70
+ /* @__PURE__ */ jsx(Dropdown.MenuGroup, { label: t("tiptap.toolbar.cantoo.formatText"), children: cantooOptionsAdaptText.map((option) => /* @__PURE__ */ jsx(Fragment$1, { children: /* @__PURE__ */ jsx(Dropdown.Item, { onClick: option.action, icon: option.icon, className: option.className, children: /* @__PURE__ */ jsx("span", { children: option.label }) }) }, option.id)) }),
71
+ /* @__PURE__ */ jsx(Dropdown.Separator, {})
72
+ ] }),
73
+ 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))
74
+ ] })
75
+ ] });
76
+ };
77
+ export {
78
+ EditorToolbarCantoo
79
+ };
@@ -1,10 +1,13 @@
1
1
  import { RefObject } from 'react';
2
+ import { CantooEditor } from '../..';
2
3
  import { MediaLibraryRef } from '../../../multimedia';
3
4
  interface Props {
4
5
  /** Ref to a MediaLibrary instance */
5
6
  mediaLibraryRef: RefObject<MediaLibraryRef>;
6
7
  /** API to open/close a Math modal. */
7
8
  toggleMathsModal: () => void;
9
+ /** Ref to a Cantoo editor instance */
10
+ cantooEditor: CantooEditor;
8
11
  }
9
- export declare const EditorToolbar: ({ mediaLibraryRef, toggleMathsModal }: Props) => import("react/jsx-runtime").JSX.Element;
12
+ export declare const EditorToolbar: ({ mediaLibraryRef, toggleMathsModal, cantooEditor, }: Props) => import("react/jsx-runtime").JSX.Element;
10
13
  export {};
@@ -27,13 +27,15 @@ import { EditorToolbarPlusMenu } from "./EditorToolbar.PlusMenu.js";
27
27
  import { EditorToolbarTextColor } from "./EditorToolbar.TextColor.js";
28
28
  import { EditorToolbarTextSize } from "./EditorToolbar.TextSize.js";
29
29
  import { EditorToolbarTypography } from "./EditorToolbar.Typography.js";
30
- import { useEditorContext } from "../../hooks/useEditorContext.js";
30
+ import { EditorToolbarCantoo } from "./EditorToolbar.Cantoo.js";
31
31
  import { useActionOptions } from "../../hooks/useActionOptions.js";
32
32
  import { useSpeechRecognition } from "../../hooks/useSpeechRecognition.js";
33
+ import { useEditorContext } from "../../hooks/useEditorContext.js";
33
34
  import { Toolbar } from "../../../../components/Toolbar/Toolbar.js";
34
35
  const EditorToolbar = ({
35
36
  mediaLibraryRef,
36
- toggleMathsModal
37
+ toggleMathsModal,
38
+ cantooEditor
37
39
  }) => {
38
40
  const {
39
41
  t
@@ -167,11 +169,21 @@ const EditorToolbar = ({
167
169
  name: "speechtotext",
168
170
  tooltip: t("tiptap.toolbar.stt")
169
171
  },
172
+ //------------- CANTOO ---------------//
173
+ {
174
+ type: "dropdown",
175
+ props: {
176
+ children: (triggerProps) => /* @__PURE__ */ jsx(EditorToolbarCantoo, { triggerProps, cantooEditor })
177
+ },
178
+ name: "cantoo",
179
+ visibility: cantooEditor.isAvailable ? "show" : "hide",
180
+ tooltip: t("tiptap.toolbar.cantoo.choice")
181
+ },
170
182
  //------------------------------------//
171
183
  {
172
184
  type: "divider",
173
185
  name: "div-speech",
174
- visibility: canRecognizeSpeech ? "show" : "hide"
186
+ visibility: canRecognizeSpeech || cantooEditor.isAvailable ? "show" : "hide"
175
187
  },
176
188
  //--------------- TYPOGRAPHY ---------------//
177
189
  {
@@ -1,6 +1,5 @@
1
- export { default as AttachmentNodeView } from './AttachmentNodeView';
2
1
  export { default as AudioNodeView } from './AudioNodeView';
3
- export { default as ConversationHistoryNodeView } from './ConversationHistoryNodeView';
2
+ export { default as AttachmentNodeView } from './AttachmentNodeView';
4
3
  export { default as ImageNodeView } from './ImageNodeView';
5
4
  export { default as LinkerNodeView } from './LinkerNodeView';
6
5
  export { default as VideoNodeView } from './VideoNodeView';
@@ -1,6 +1,5 @@
1
- export { default as AttachmentRenderer } from './AttachmentRenderer';
2
1
  export { default as AudioRenderer } from './AudioRenderer';
3
- export { default as ConversationHistoryRenderer } from './ConversationHistoryRenderer';
2
+ export { default as AttachmentRenderer } from './AttachmentRenderer';
4
3
  export { default as LinkerRenderer } from './LinkerRenderer';
5
4
  export { default as MediaRenderer } from './MediaRenderer';
6
5
  export { default as InformationPaneRenderer } from './InformationPaneRenderer';
@@ -10,3 +10,4 @@ export * from './useResizeMedia';
10
10
  export * from './useSpeechRecognition';
11
11
  export * from './useSpeechSynthetisis';
12
12
  export * from './useTipTapEditor';
13
+ export * from './useCantooEditor';
@@ -0,0 +1,17 @@
1
+ import { Editor } from '@tiptap/react';
2
+ export interface CantooEditor {
3
+ cantooParam: string;
4
+ isAvailable: boolean;
5
+ speech2textIsAvailable: boolean;
6
+ speech2textIsActive: boolean;
7
+ text2speechIsActive: boolean;
8
+ toggleSpeech2Text: () => void;
9
+ toggleText2Speech: () => void;
10
+ toogleSettings: () => void;
11
+ openPositionAdaptText: {
12
+ right: boolean;
13
+ bottom: boolean;
14
+ };
15
+ handleCantooAdaptTextPosition: (position: string) => void;
16
+ }
17
+ export declare const useCantooEditor: (editor: Editor | null, cantooParam: string) => CantooEditor;
@@ -0,0 +1,89 @@
1
+ import { useState, useCallback } from "react";
2
+ import { odeServices } from "@edifice.io/client";
3
+ import useHasWorkflow from "../../../hooks/useHasWorkflow/useHasWorkflow.js";
4
+ const useCantooEditor = (editor, cantooParam) => {
5
+ const Cantoo = window.Cantoo, isAvailable = useHasWorkflow("org.entcore.portal.controllers.PortalController|optionalFeatureCantoo"), [speech2textIsActive, setSpeech2textActive] = useState(!1), [text2speechIsActive, setText2speechActive] = useState(!1), [openPositionAdaptText, setOpenPositionAdaptText] = useState({
6
+ right: !1,
7
+ bottom: !1
8
+ }), speech2textIsAvailable = (Cantoo == null ? void 0 : Cantoo.speech2text.isAvailableOnDevice()) || !1, toggleSpeech2Text = async () => {
9
+ if (speech2textIsActive) {
10
+ setSpeech2textActive(!1);
11
+ try {
12
+ await Cantoo.speech2text.stop();
13
+ } catch (e) {
14
+ console.warn("Error while trying to stop Cantoo (speech2text)", e);
15
+ }
16
+ } else
17
+ try {
18
+ if (setSpeech2textActive(!0), speech2textIsAvailable)
19
+ if (await Cantoo.speech2text.requestPermission())
20
+ cantooStoreEvent("CANTOO_EDITEUR_SPEECH_TO_TEXT"), await Cantoo.speech2text.start((data) => {
21
+ editor == null || editor.chain().focus().insertContent(data.join(" ")).run();
22
+ }, window.navigator.language);
23
+ else
24
+ throw setSpeech2textActive(!1), new Error("Cantoo speech2text permission denied, please check your browser settings");
25
+ else
26
+ throw setSpeech2textActive(!1), new Error("Cantoo speech2text not available on this device");
27
+ } catch (e) {
28
+ console.warn("Error while trying to use Cantoo (speech2text)", e), setSpeech2textActive(!1);
29
+ }
30
+ }, toggleText2Speech = () => {
31
+ if (text2speechIsActive)
32
+ setText2speechActive(!1), window.speechSynthesis.cancel();
33
+ else
34
+ try {
35
+ setText2speechActive(!0), Cantoo.text2speech.readText(editor == null ? void 0 : editor.getText()), cantooStoreEvent("CANTOO_EDITEUR_TEXT_TO_SPEECH"), Cantoo.text2speech.utter.onend = () => {
36
+ setText2speechActive(!1);
37
+ };
38
+ } catch (e) {
39
+ console.warn("Error while trying to use Cantoo (text2speech)", e), setText2speechActive(!1);
40
+ }
41
+ }, handleCantooAdaptTextPosition = (position) => {
42
+ switch (position) {
43
+ case "right":
44
+ openPositionAdaptText.right || cantooStoreEvent("CANTOO_EDITEUR_ADAPT_TEXT"), setOpenPositionAdaptText((prev) => ({
45
+ bottom: !1,
46
+ right: !prev.right
47
+ }));
48
+ break;
49
+ case "bottom":
50
+ openPositionAdaptText.bottom || cantooStoreEvent("CANTOO_EDITEUR_ADAPT_TEXT"), setOpenPositionAdaptText((prev) => ({
51
+ right: !1,
52
+ bottom: !prev.bottom
53
+ }));
54
+ break;
55
+ }
56
+ }, toogleSettings = () => {
57
+ if (!Cantoo) {
58
+ console.warn("Cantoo not available");
59
+ return;
60
+ }
61
+ Cantoo.openCantooWebConfig();
62
+ }, cantooStoreEvent = useCallback(async (eventType) => {
63
+ if (eventType.length > 0) {
64
+ const data = {
65
+ "event-type": eventType
66
+ };
67
+ try {
68
+ await odeServices.http().post("/infra/event/web/store", data);
69
+ } catch (e) {
70
+ console.warn("Error while storing event", e);
71
+ }
72
+ }
73
+ }, []);
74
+ return {
75
+ cantooParam,
76
+ isAvailable,
77
+ speech2textIsAvailable,
78
+ speech2textIsActive,
79
+ text2speechIsActive,
80
+ toggleSpeech2Text,
81
+ toggleText2Speech,
82
+ toogleSettings,
83
+ openPositionAdaptText,
84
+ handleCantooAdaptTextPosition
85
+ };
86
+ };
87
+ export {
88
+ useCantooEditor
89
+ };