@edifice.io/react 2.2.5 → 2.2.6
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/Flex/Flex.d.ts +12 -0
- package/dist/components/Flex/Flex.js +19 -0
- package/dist/components/Flex/index.d.ts +2 -0
- package/dist/components/Table/components/Table.d.ts +2 -0
- package/dist/components/Table/components/Table.js +8 -2
- package/dist/components/index.d.ts +1 -0
- package/dist/editor.js +2 -0
- package/dist/icons.js +266 -260
- package/dist/index.js +128 -126
- package/dist/modules/editor/components/Editor/CantooAdaptTextBoxView.d.ts +7 -0
- package/dist/modules/editor/components/Editor/CantooAdaptTextBoxView.js +33 -0
- package/dist/modules/editor/components/Editor/Editor.d.ts +1 -0
- package/dist/modules/editor/components/Editor/Editor.js +18 -6
- package/dist/modules/editor/components/EditorToolbar/EditorToolbar.Cantoo.d.ts +9 -0
- package/dist/modules/editor/components/EditorToolbar/EditorToolbar.Cantoo.js +79 -0
- package/dist/modules/editor/components/EditorToolbar/EditorToolbar.d.ts +4 -1
- package/dist/modules/editor/components/EditorToolbar/EditorToolbar.js +15 -3
- package/dist/modules/editor/hooks/index.d.ts +1 -0
- package/dist/modules/editor/hooks/useCantooEditor.d.ts +17 -0
- package/dist/modules/editor/hooks/useCantooEditor.js +89 -0
- package/dist/modules/icons/components/IconCantoo.d.ts +7 -0
- package/dist/modules/icons/components/IconCantoo.js +23 -0
- package/dist/modules/icons/components/IconMicOff.d.ts +7 -0
- package/dist/modules/icons/components/IconMicOff.js +12 -0
- package/dist/modules/icons/components/IconTextToSpeechOff.d.ts +7 -0
- package/dist/modules/icons/components/IconTextToSpeechOff.js +12 -0
- package/dist/modules/icons/components/index.d.ts +3 -0
- package/dist/modules/multimedia/Linker/InternalLinker/InternalLinker.js +6 -5
- package/package.json +6 -6
package/dist/index.js
CHANGED
|
@@ -18,70 +18,71 @@ import { default as default18 } from "./components/Combobox/Combobox.js";
|
|
|
18
18
|
import { default as default19 } from "./components/Dropdown/Dropdown.js";
|
|
19
19
|
import { default as default20 } from "./components/Dropzone/Dropzone.js";
|
|
20
20
|
import { default as default21 } from "./components/EmptyScreen/EmptyScreen.js";
|
|
21
|
-
import { default as default22 } from "./components/
|
|
22
|
-
import { default as default23 } from "./components/Form/
|
|
23
|
-
import { default as default24 } from "./components/
|
|
24
|
-
import { default as default25 } from "./components/
|
|
25
|
-
import { default as default26 } from "./components/
|
|
26
|
-
import { default as default27 } from "./components/
|
|
27
|
-
import { default as default28 } from "./components/
|
|
28
|
-
import { default as default29 } from "./components/
|
|
29
|
-
import { default as default30 } from "./components/
|
|
30
|
-
import { default as default31 } from "./components/
|
|
31
|
-
import { default as default32 } from "./components/
|
|
32
|
-
import { default as default33 } from "./components/
|
|
33
|
-
import { default as default34 } from "./components/
|
|
34
|
-
import { default as default35 } from "./components/
|
|
35
|
-
import { default as default36 } from "./components/
|
|
36
|
-
import { default as default37 } from "./components/
|
|
37
|
-
import { default as default38 } from "./components/
|
|
38
|
-
import { default as default39 } from "./components/
|
|
39
|
-
import { default as default40 } from "./components/
|
|
21
|
+
import { default as default22 } from "./components/Flex/Flex.js";
|
|
22
|
+
import { default as default23 } from "./components/Form/FormText.js";
|
|
23
|
+
import { default as default24 } from "./components/Form/FormControl.js";
|
|
24
|
+
import { default as default25 } from "./components/Heading/Heading.js";
|
|
25
|
+
import { default as default26 } from "./components/Image/Image.js";
|
|
26
|
+
import { default as default27 } from "./components/Input/Input.js";
|
|
27
|
+
import { default as default28 } from "./components/Label/Label.js";
|
|
28
|
+
import { default as default29 } from "./components/Loading/Loading.js";
|
|
29
|
+
import { default as default30 } from "./components/LoadingScreen/LoadingScreen.js";
|
|
30
|
+
import { default as default31 } from "./components/Logo/Logo.js";
|
|
31
|
+
import { default as default32 } from "./components/Modal/Modal.js";
|
|
32
|
+
import { default as default33 } from "./components/PreventPropagation/PreventPropagation.js";
|
|
33
|
+
import { default as default34 } from "./components/Radio/Radio.js";
|
|
34
|
+
import { default as default35 } from "./components/SearchBar/SearchBar.js";
|
|
35
|
+
import { default as default36 } from "./components/Select/Select.js";
|
|
36
|
+
import { default as default37 } from "./components/StackedGroup/StackedGroup.js";
|
|
37
|
+
import { default as default38 } from "./components/Switch/Switch.js";
|
|
38
|
+
import { default as default39 } from "./components/Table/components/Table.js";
|
|
39
|
+
import { default as default40 } from "./components/TextArea/TextArea.js";
|
|
40
|
+
import { default as default41 } from "./components/Tooltip/Tooltip.js";
|
|
40
41
|
import { DndTree } from "./components/Tree/components/DndTree.js";
|
|
41
|
-
import { default as
|
|
42
|
-
import { default as
|
|
43
|
-
import { default as
|
|
44
|
-
import { default as
|
|
45
|
-
import { default as
|
|
46
|
-
import { default as
|
|
47
|
-
import { default as
|
|
48
|
-
import { default as
|
|
49
|
-
import { default as
|
|
50
|
-
import { default as
|
|
51
|
-
import { default as
|
|
52
|
-
import { default as
|
|
53
|
-
import { default as
|
|
54
|
-
import { default as
|
|
55
|
-
import { default as
|
|
56
|
-
import { default as
|
|
57
|
-
import { default as
|
|
58
|
-
import { default as
|
|
59
|
-
import { default as
|
|
60
|
-
import { default as
|
|
61
|
-
import { default as
|
|
62
|
-
import { default as
|
|
63
|
-
import { default as
|
|
64
|
-
import { default as
|
|
65
|
-
import { default as
|
|
66
|
-
import { default as
|
|
67
|
-
import { default as
|
|
68
|
-
import { default as
|
|
69
|
-
import { default as
|
|
70
|
-
import { default as
|
|
71
|
-
import { default as
|
|
72
|
-
import { default as
|
|
73
|
-
import { default as
|
|
74
|
-
import { default as
|
|
75
|
-
import { default as
|
|
76
|
-
import { default as
|
|
77
|
-
import { default as
|
|
78
|
-
import { default as
|
|
79
|
-
import { default as
|
|
80
|
-
import { default as
|
|
81
|
-
import { default as
|
|
82
|
-
import { default as
|
|
83
|
-
import { default as
|
|
84
|
-
import { default as
|
|
42
|
+
import { default as default42 } from "./components/Tree/components/SortableTree.js";
|
|
43
|
+
import { default as default43 } from "./components/Tree/components/Tree.js";
|
|
44
|
+
import { default as default44 } from "./components/TreeView/TreeView.js";
|
|
45
|
+
import { default as default45 } from "./components/VisuallyHidden/VisuallyHidden.js";
|
|
46
|
+
import { default as default46 } from "./hooks/useBookmark/useBookmark.js";
|
|
47
|
+
import { default as default47 } from "./hooks/useBreakpoint/useBreakpoint.js";
|
|
48
|
+
import { default as default48 } from "./hooks/useBrowserInfo/useBrowserInfo.js";
|
|
49
|
+
import { default as default49 } from "./hooks/useCantoo/useCantoo.js";
|
|
50
|
+
import { default as default50 } from "./hooks/useClickOutside/useClickOutside.js";
|
|
51
|
+
import { default as default51 } from "./hooks/useConversation/useConversation.js";
|
|
52
|
+
import { default as default52 } from "./hooks/useDate/useDate.js";
|
|
53
|
+
import { default as default53 } from "./hooks/useDebounce/useDebounce.js";
|
|
54
|
+
import { default as default54 } from "./hooks/useDirectory/useDirectory.js";
|
|
55
|
+
import { default as default55 } from "./hooks/useDropdown/useDropdown.js";
|
|
56
|
+
import { default as default56 } from "./hooks/useDropzone/useDropzone.js";
|
|
57
|
+
import { default as default57 } from "./hooks/useEdificeIcons/useEdificeIcons.js";
|
|
58
|
+
import { default as default58 } from "./hooks/useHasWorkflow/useHasWorkflow.js";
|
|
59
|
+
import { default as default59 } from "./hooks/useHover/useHover.js";
|
|
60
|
+
import { default as default60 } from "./hooks/useHttpErrorToast/useHttpErrorToast.js";
|
|
61
|
+
import { default as default61 } from "./hooks/useImage/useImage.js";
|
|
62
|
+
import { default as default62 } from "./hooks/useIsAdml/useIsAdml.js";
|
|
63
|
+
import { default as default63 } from "./hooks/useKeyPress/useKeyPress.js";
|
|
64
|
+
import { default as default64 } from "./hooks/useLibraryUrl/useLibraryUrl.js";
|
|
65
|
+
import { default as default65 } from "./hooks/useMediaLibrary/useMediaLibrary.js";
|
|
66
|
+
import { default as default66 } from "./hooks/useScrollToTop/useScrollToTop.js";
|
|
67
|
+
import { default as default67 } from "./hooks/useTitle/useTitle.js";
|
|
68
|
+
import { default as default68 } from "./hooks/useToast/useToast.js";
|
|
69
|
+
import { default as default69 } from "./hooks/useToggle/useToggle.js";
|
|
70
|
+
import { default as default70 } from "./hooks/useTrapFocus/useTrapFocus.js";
|
|
71
|
+
import { default as default71 } from "./hooks/useTrashedResource/useTrashedResource.js";
|
|
72
|
+
import { default as default72 } from "./hooks/useUpload/useUpload.js";
|
|
73
|
+
import { default as default73 } from "./hooks/useUploadFiles/useUploadFiles.js";
|
|
74
|
+
import { default as default74 } from "./hooks/useUser/useUser.js";
|
|
75
|
+
import { default as default75 } from "./hooks/useWorkspaceFile/useWorkspaceFile.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";
|
|
85
86
|
import { AccessiblePalette, DefaultPalette } from "./components/ColorPicker/ColorPalette.js";
|
|
86
87
|
import { DropzoneContext, useDropzoneContext } from "./components/Dropzone/DropzoneContext.js";
|
|
87
88
|
import { Column, Grid } from "./components/Grid/Grid.js";
|
|
@@ -118,7 +119,7 @@ export {
|
|
|
118
119
|
default7 as Avatar,
|
|
119
120
|
default8 as AvatarGroup,
|
|
120
121
|
default9 as Badge,
|
|
121
|
-
|
|
122
|
+
default81 as BlogPublic,
|
|
122
123
|
default10 as Breadcrumb,
|
|
123
124
|
default11 as Button,
|
|
124
125
|
default14 as Card,
|
|
@@ -137,49 +138,50 @@ export {
|
|
|
137
138
|
EdificeThemeContext,
|
|
138
139
|
EdificeThemeProvider,
|
|
139
140
|
default21 as EmptyScreen,
|
|
140
|
-
|
|
141
|
-
|
|
141
|
+
default22 as Flex,
|
|
142
|
+
default24 as FormControl,
|
|
143
|
+
default23 as FormText,
|
|
142
144
|
Grid,
|
|
143
|
-
|
|
145
|
+
default25 as Heading,
|
|
144
146
|
default12 as IconButton,
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
147
|
+
default26 as Image,
|
|
148
|
+
default27 as Input,
|
|
149
|
+
default28 as Label,
|
|
148
150
|
Layout,
|
|
149
151
|
List,
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
152
|
+
default29 as Loading,
|
|
153
|
+
default30 as LoadingScreen,
|
|
154
|
+
default31 as Logo,
|
|
153
155
|
Menu,
|
|
154
156
|
MockedProvider,
|
|
155
|
-
|
|
156
|
-
|
|
157
|
+
default32 as Modal,
|
|
158
|
+
default79 as OnboardingModal,
|
|
157
159
|
Popover,
|
|
158
160
|
PopoverBody,
|
|
159
161
|
PopoverFooter,
|
|
160
162
|
PopoverHeader,
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
163
|
+
default33 as PreventPropagation,
|
|
164
|
+
default80 as PublishModal,
|
|
165
|
+
default34 as Radio,
|
|
164
166
|
ResourceModal,
|
|
165
|
-
|
|
167
|
+
default35 as SearchBar,
|
|
166
168
|
default13 as SearchButton,
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
169
|
+
default36 as Select,
|
|
170
|
+
default84 as ShareBlog,
|
|
171
|
+
default83 as ShareModal,
|
|
172
|
+
default42 as SortableTree,
|
|
173
|
+
default37 as StackedGroup,
|
|
174
|
+
default38 as Switch,
|
|
175
|
+
default39 as Table,
|
|
174
176
|
Tabs,
|
|
175
|
-
|
|
177
|
+
default40 as TextArea,
|
|
176
178
|
Toolbar,
|
|
177
|
-
|
|
178
|
-
|
|
179
|
+
default41 as Tooltip,
|
|
180
|
+
default43 as Tree,
|
|
179
181
|
TreeNode,
|
|
180
182
|
TreeNodeFolderWrapper,
|
|
181
|
-
|
|
182
|
-
|
|
183
|
+
default44 as TreeView,
|
|
184
|
+
default45 as VisuallyHidden,
|
|
183
185
|
addNode,
|
|
184
186
|
arrayUnique,
|
|
185
187
|
buildTree,
|
|
@@ -207,46 +209,46 @@ export {
|
|
|
207
209
|
setRef,
|
|
208
210
|
updateNode,
|
|
209
211
|
updateParentIds,
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
212
|
+
default46 as useBookmark,
|
|
213
|
+
default47 as useBreakpoint,
|
|
214
|
+
default48 as useBrowserInfo,
|
|
215
|
+
default49 as useCantoo,
|
|
214
216
|
useCheckable,
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
217
|
+
default50 as useClickOutside,
|
|
218
|
+
default51 as useConversation,
|
|
219
|
+
default52 as useDate,
|
|
220
|
+
default53 as useDebounce,
|
|
221
|
+
default54 as useDirectory,
|
|
222
|
+
default55 as useDropdown,
|
|
223
|
+
default56 as useDropzone,
|
|
222
224
|
useDropzoneContext,
|
|
223
225
|
useEdificeClient,
|
|
224
|
-
|
|
226
|
+
default57 as useEdificeIcons,
|
|
225
227
|
useEdificeTheme,
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
228
|
+
default58 as useHasWorkflow,
|
|
229
|
+
default59 as useHover,
|
|
230
|
+
default60 as useHttpErrorToast,
|
|
231
|
+
default61 as useImage,
|
|
232
|
+
default62 as useIsAdml,
|
|
233
|
+
default63 as useKeyPress,
|
|
234
|
+
default64 as useLibraryUrl,
|
|
235
|
+
default65 as useMediaLibrary,
|
|
236
|
+
default66 as useScrollToTop,
|
|
237
|
+
default85 as useShareMutation,
|
|
238
|
+
default67 as useTitle,
|
|
239
|
+
default68 as useToast,
|
|
240
|
+
default69 as useToggle,
|
|
241
|
+
default70 as useTrapFocus,
|
|
242
|
+
default71 as useTrashedResource,
|
|
241
243
|
useTreeSortable,
|
|
242
244
|
useTreeView,
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
245
|
+
default82 as useUpdateMutation,
|
|
246
|
+
default72 as useUpload,
|
|
247
|
+
default73 as useUploadFiles,
|
|
248
|
+
default74 as useUser,
|
|
249
|
+
default75 as useWorkspaceFile,
|
|
250
|
+
default76 as useWorkspaceSearch,
|
|
251
|
+
default77 as useXitiTrackPageLoad,
|
|
252
|
+
default78 as useZendeskGuide,
|
|
251
253
|
wrapTreeNode
|
|
252
254
|
};
|
|
@@ -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
|
+
};
|
|
@@ -40,6 +40,7 @@ export interface EditorProps {
|
|
|
40
40
|
onContentChange?: ({ editor }: {
|
|
41
41
|
editor: any;
|
|
42
42
|
}) => void;
|
|
43
|
+
cantooParam?: 'simplify' | 'none';
|
|
43
44
|
}
|
|
44
45
|
declare const Editor: import('react').ForwardRefExoticComponent<EditorProps & import('react').RefAttributes<EditorRef>>;
|
|
45
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";
|
|
@@ -28,7 +31,8 @@ const MathsModal = /* @__PURE__ */ lazy(async () => await import("../MathsModal/
|
|
|
28
31
|
focus = "start",
|
|
29
32
|
placeholder = "",
|
|
30
33
|
visibility = "protected",
|
|
31
|
-
onContentChange
|
|
34
|
+
onContentChange,
|
|
35
|
+
cantooParam = "none"
|
|
32
36
|
}, ref) => {
|
|
33
37
|
const editorId = useId(), {
|
|
34
38
|
appCode
|
|
@@ -42,7 +46,7 @@ const MathsModal = /* @__PURE__ */ lazy(async () => await import("../MathsModal/
|
|
|
42
46
|
toggle: toggleMathsModal,
|
|
43
47
|
...mathsModalHandlers
|
|
44
48
|
} = useMathsModal(editor), imageModal = useImageModal(editor, "media-library", visibility), linkToolbarHandlers = useLinkToolbar(editor, mediaLibraryModalRef), speechSynthetisis = useSpeechSynthetisis(editor);
|
|
45
|
-
|
|
49
|
+
useMathsStyles(), useImperativeHandle(ref, () => ({
|
|
46
50
|
getContent: (as) => {
|
|
47
51
|
switch (as) {
|
|
48
52
|
case "html":
|
|
@@ -57,7 +61,9 @@ const MathsModal = /* @__PURE__ */ lazy(async () => await import("../MathsModal/
|
|
|
57
61
|
},
|
|
58
62
|
toogleSpeechSynthetisis: speechSynthetisis.toggle,
|
|
59
63
|
isSpeeching: () => speechSynthetisis.isActivated
|
|
60
|
-
}))
|
|
64
|
+
}));
|
|
65
|
+
const contooEditor = useCantooEditor(editor, cantooParam);
|
|
66
|
+
if (!editor) return null;
|
|
61
67
|
const borderClass = clsx(variant === "outline" && "border rounded-3"), contentClass = clsx(variant === "outline" && "py-12 px-16");
|
|
62
68
|
return /* @__PURE__ */ jsxs(EditorContext.Provider, { value: {
|
|
63
69
|
id: id ?? editorId,
|
|
@@ -66,8 +72,13 @@ const MathsModal = /* @__PURE__ */ lazy(async () => await import("../MathsModal/
|
|
|
66
72
|
editable
|
|
67
73
|
}, children: [
|
|
68
74
|
/* @__PURE__ */ jsxs("div", { className: borderClass, children: [
|
|
69
|
-
toolbar !== "none" && editable && /* @__PURE__ */ jsx(EditorToolbar, { mediaLibraryRef: mediaLibraryModalRef, toggleMathsModal }),
|
|
70
|
-
/* @__PURE__ */
|
|
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
|
+
] })
|
|
71
82
|
] }),
|
|
72
83
|
/* @__PURE__ */ jsx(LinkToolbar, { editor, ...linkToolbarHandlers }),
|
|
73
84
|
/* @__PURE__ */ jsx(TableToolbar, { editor }),
|
|
@@ -78,7 +89,8 @@ const MathsModal = /* @__PURE__ */ lazy(async () => await import("../MathsModal/
|
|
|
78
89
|
/* @__PURE__ */ jsxs(Suspense, { fallback: /* @__PURE__ */ jsx(LoadingScreen, {}), children: [
|
|
79
90
|
editable && /* @__PURE__ */ jsx(MediaLibrary, { appCode, visibility, multiple: !0, ref: mediaLibraryModalRef, ...mediaLibraryModalHandlers }),
|
|
80
91
|
editable && mathsModalHandlers.isOpen && /* @__PURE__ */ jsx(MathsModal, { ...mathsModalHandlers }),
|
|
81
|
-
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 })
|
|
82
94
|
] })
|
|
83
95
|
] });
|
|
84
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 {
|
|
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
|
{
|
|
@@ -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;
|