@edifice.io/react 2.1.1-develop-integration.20250213121025 → 2.1.1-develop-integration.20250218102509
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/editor.js +2 -0
- package/dist/modules/editor/components/Editor/CantooModal.js +1 -1
- package/dist/modules/editor/components/Editor/Editor.js +4 -7
- package/dist/modules/editor/components/EditorToolbar/EditorToolbar.Cantoo.d.ts +3 -2
- package/dist/modules/editor/components/EditorToolbar/EditorToolbar.Cantoo.js +5 -3
- package/dist/modules/editor/components/EditorToolbar/EditorToolbar.d.ts +3 -2
- package/dist/modules/editor/components/EditorToolbar/EditorToolbar.js +3 -3
- package/dist/modules/editor/hooks/index.d.ts +1 -0
- package/dist/modules/editor/hooks/{useCantooModal.d.ts → useCantooAdaptTextBox.d.ts} +5 -6
- package/dist/modules/editor/hooks/{useCantooModal.js → useCantooAdaptTextBox.js} +2 -5
- package/package.json +6 -6
package/dist/editor.js
CHANGED
|
@@ -26,6 +26,7 @@ import { useSpeechRecognition } from "./modules/editor/hooks/useSpeechRecognitio
|
|
|
26
26
|
import { useSpeechSynthetisis } from "./modules/editor/hooks/useSpeechSynthetisis.js";
|
|
27
27
|
import { useTipTapEditor } from "./modules/editor/hooks/useTipTapEditor.js";
|
|
28
28
|
import { useCantooEditor } from "./modules/editor/hooks/useCantooEditor.js";
|
|
29
|
+
import { useCantooAdaptTextBox } from "./modules/editor/hooks/useCantooAdaptTextBox.js";
|
|
29
30
|
export {
|
|
30
31
|
default5 as AttachmentNodeView,
|
|
31
32
|
default10 as AttachmentRenderer,
|
|
@@ -44,6 +45,7 @@ export {
|
|
|
44
45
|
default13 as TableToolbar,
|
|
45
46
|
default8 as VideoNodeView,
|
|
46
47
|
useActionOptions,
|
|
48
|
+
useCantooAdaptTextBox,
|
|
47
49
|
useCantooEditor,
|
|
48
50
|
useCommentEditor,
|
|
49
51
|
useEditor,
|
|
@@ -3,7 +3,7 @@ import { useEditorContext } from "../../hooks/useEditorContext.js";
|
|
|
3
3
|
const CantooModal = () => {
|
|
4
4
|
const {
|
|
5
5
|
editor
|
|
6
|
-
} = useEditorContext(), Cantoo = window.Cantoo, editorHTML = editor == null ? void 0 : editor.getHTML(), cantooHTML = Cantoo == null ? void 0 : Cantoo.formatText(editorHTML);
|
|
6
|
+
} = useEditorContext(), Cantoo = window.Cantoo, editorHTML = editor == null ? void 0 : editor.getHTML(), cantooHTML = (Cantoo == null ? void 0 : Cantoo.formatText(editorHTML)) || editorHTML;
|
|
7
7
|
return /* @__PURE__ */ jsx("div", { className: "card p-24 mt-8", children: /* @__PURE__ */ jsx("div", { dangerouslySetInnerHTML: {
|
|
8
8
|
__html: cantooHTML
|
|
9
9
|
} }) });
|
|
@@ -3,7 +3,7 @@ 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 {
|
|
6
|
+
import { useCantooAdaptTextBox } from "../../hooks/useCantooAdaptTextBox.js";
|
|
7
7
|
import { useMathsStyles } from "../../hooks/useMathsStyles.js";
|
|
8
8
|
import { useTipTapEditor } from "../../hooks/useTipTapEditor.js";
|
|
9
9
|
import { useMediaLibraryEditor } from "../../hooks/useMediaLibraryEditor.js";
|
|
@@ -40,10 +40,7 @@ const MathsModal = /* @__PURE__ */ lazy(async () => await import("../MathsModal/
|
|
|
40
40
|
} = useMediaLibraryEditor(editor), {
|
|
41
41
|
toggle: toggleMathsModal,
|
|
42
42
|
...mathsModalHandlers
|
|
43
|
-
} = useMathsModal(editor),
|
|
44
|
-
toggle: toggleCantooModal,
|
|
45
|
-
...cantooModalHandlers
|
|
46
|
-
} = useCantooModal(), imageModal = useImageModal(editor, "media-library", visibility), linkToolbarHandlers = useLinkToolbar(editor, mediaLibraryModalRef), speechSynthetisis = useSpeechSynthetisis(editor);
|
|
43
|
+
} = useMathsModal(editor), cantooAdaptTextBox = useCantooAdaptTextBox(), imageModal = useImageModal(editor, "media-library", visibility), linkToolbarHandlers = useLinkToolbar(editor, mediaLibraryModalRef), speechSynthetisis = useSpeechSynthetisis(editor);
|
|
47
44
|
if (useMathsStyles(), useImperativeHandle(ref, () => ({
|
|
48
45
|
getContent: (as) => {
|
|
49
46
|
switch (as) {
|
|
@@ -68,7 +65,7 @@ const MathsModal = /* @__PURE__ */ lazy(async () => await import("../MathsModal/
|
|
|
68
65
|
editable
|
|
69
66
|
}, children: [
|
|
70
67
|
/* @__PURE__ */ jsxs("div", { className: borderClass, children: [
|
|
71
|
-
toolbar !== "none" && editable && /* @__PURE__ */ jsx(EditorToolbar, { mediaLibraryRef: mediaLibraryModalRef, toggleMathsModal,
|
|
68
|
+
toolbar !== "none" && editable && /* @__PURE__ */ jsx(EditorToolbar, { mediaLibraryRef: mediaLibraryModalRef, toggleMathsModal, cantooAdaptTextBoxRef: cantooAdaptTextBox }),
|
|
72
69
|
/* @__PURE__ */ jsx(EditorContent, { id: id ?? editorId, editor, className: contentClass })
|
|
73
70
|
] }),
|
|
74
71
|
/* @__PURE__ */ jsx(LinkToolbar, { editor, ...linkToolbarHandlers }),
|
|
@@ -78,7 +75,7 @@ const MathsModal = /* @__PURE__ */ lazy(async () => await import("../MathsModal/
|
|
|
78
75
|
editable && /* @__PURE__ */ jsx(MediaLibrary, { appCode, visibility, multiple: !0, ref: mediaLibraryModalRef, ...mediaLibraryModalHandlers }),
|
|
79
76
|
editable && mathsModalHandlers.isOpen && /* @__PURE__ */ jsx(MathsModal, { ...mathsModalHandlers }),
|
|
80
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 }),
|
|
81
|
-
editable &&
|
|
78
|
+
editable && cantooAdaptTextBox.isOpen && /* @__PURE__ */ jsx(CantooModal, {})
|
|
82
79
|
] })
|
|
83
80
|
] });
|
|
84
81
|
});
|
|
@@ -2,7 +2,8 @@ import { RefAttributes } from 'react';
|
|
|
2
2
|
import { IconButtonProps } from '../../../../components';
|
|
3
3
|
interface Props {
|
|
4
4
|
triggerProps: JSX.IntrinsicAttributes & Omit<IconButtonProps, 'ref'> & RefAttributes<HTMLButtonElement>;
|
|
5
|
-
|
|
5
|
+
openCantooAdaptTextBox: () => void | undefined;
|
|
6
|
+
isCantooAdaptTextBoxOpen: boolean | null;
|
|
6
7
|
}
|
|
7
|
-
export declare const EditorToolbarCantoo: ({ triggerProps,
|
|
8
|
+
export declare const EditorToolbarCantoo: ({ triggerProps, openCantooAdaptTextBox, isCantooAdaptTextBoxOpen, }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
8
9
|
export {};
|
|
@@ -14,7 +14,8 @@ import IconButton from "../../../../components/Button/IconButton.js";
|
|
|
14
14
|
import Dropdown from "../../../../components/Dropdown/Dropdown.js";
|
|
15
15
|
const EditorToolbarCantoo = ({
|
|
16
16
|
triggerProps,
|
|
17
|
-
|
|
17
|
+
openCantooAdaptTextBox,
|
|
18
|
+
isCantooAdaptTextBoxOpen
|
|
18
19
|
}) => {
|
|
19
20
|
const {
|
|
20
21
|
t
|
|
@@ -41,11 +42,12 @@ const EditorToolbarCantoo = ({
|
|
|
41
42
|
}, {
|
|
42
43
|
id: "formatText",
|
|
43
44
|
label: t("tiptap.toolbar.cantoo.formatText"),
|
|
45
|
+
className: isCantooAdaptTextBoxOpen ? "fw-bold" : "",
|
|
44
46
|
icon: /* @__PURE__ */ jsx(SvgIconWand, {}),
|
|
45
|
-
action: () => formatText(
|
|
47
|
+
action: () => formatText(openCantooAdaptTextBox)
|
|
46
48
|
}];
|
|
47
49
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
48
|
-
/* @__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 ? "is-selected" : "", "aria-label": t("tiptap.toolbar.cantoo.choice") }) }),
|
|
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") }) }),
|
|
49
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)) })
|
|
50
52
|
] });
|
|
51
53
|
};
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { RefObject } from 'react';
|
|
2
2
|
import { MediaLibraryRef } from '../../../multimedia';
|
|
3
|
+
import { CantooAdaptTextBox } from '../../hooks/useCantooAdaptTextBox.ts';
|
|
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;
|
|
8
9
|
/** API to open/close a Cantoo modal. */
|
|
9
|
-
|
|
10
|
+
cantooAdaptTextBoxRef: CantooAdaptTextBox;
|
|
10
11
|
}
|
|
11
|
-
export declare const EditorToolbar: ({ mediaLibraryRef, toggleMathsModal,
|
|
12
|
+
export declare const EditorToolbar: ({ mediaLibraryRef, toggleMathsModal, cantooAdaptTextBoxRef, }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
12
13
|
export {};
|
|
@@ -34,7 +34,7 @@ import { Toolbar } from "../../../../components/Toolbar/Toolbar.js";
|
|
|
34
34
|
const EditorToolbar = ({
|
|
35
35
|
mediaLibraryRef,
|
|
36
36
|
toggleMathsModal,
|
|
37
|
-
|
|
37
|
+
cantooAdaptTextBoxRef
|
|
38
38
|
}) => {
|
|
39
39
|
const {
|
|
40
40
|
t
|
|
@@ -174,7 +174,7 @@ const EditorToolbar = ({
|
|
|
174
174
|
{
|
|
175
175
|
type: "dropdown",
|
|
176
176
|
props: {
|
|
177
|
-
children: (triggerProps) => /* @__PURE__ */ jsx(EditorToolbarCantoo, { triggerProps,
|
|
177
|
+
children: (triggerProps) => /* @__PURE__ */ jsx(EditorToolbarCantoo, { triggerProps, openCantooAdaptTextBox: cantooAdaptTextBoxRef.toggle, isCantooAdaptTextBoxOpen: cantooAdaptTextBoxRef.isOpen })
|
|
178
178
|
},
|
|
179
179
|
name: "cantoo",
|
|
180
180
|
visibility: canUseCantoo ? "show" : "hide",
|
|
@@ -184,7 +184,7 @@ const EditorToolbar = ({
|
|
|
184
184
|
{
|
|
185
185
|
type: "divider",
|
|
186
186
|
name: "div-speech",
|
|
187
|
-
visibility: canRecognizeSpeech ? "show" : "hide"
|
|
187
|
+
visibility: canRecognizeSpeech || canUseCantoo ? "show" : "hide"
|
|
188
188
|
},
|
|
189
189
|
//--------------- TYPOGRAPHY ---------------//
|
|
190
190
|
{
|
|
@@ -4,12 +4,11 @@
|
|
|
4
4
|
* `isOpen`: truthy boolean when CantooModal sholud be visible,
|
|
5
5
|
* `toggle`: an imperative function to toggle the `isOpen` value,
|
|
6
6
|
* `onCancel`: Cancel event handler,
|
|
7
|
-
* `onSuccess`: Success event handler (adds a formula to the editor content),
|
|
8
7
|
* }
|
|
9
8
|
*/
|
|
10
|
-
export declare const
|
|
11
|
-
|
|
12
|
-
|
|
9
|
+
export declare const useCantooAdaptTextBox: () => CantooAdaptTextBox;
|
|
10
|
+
export interface CantooAdaptTextBox {
|
|
11
|
+
isOpen: boolean | null;
|
|
12
|
+
toggle: () => void;
|
|
13
13
|
onCancel: () => void;
|
|
14
|
-
|
|
15
|
-
};
|
|
14
|
+
}
|
|
@@ -1,17 +1,14 @@
|
|
|
1
1
|
import useToggle from "../../../hooks/useToggle/useToggle.js";
|
|
2
|
-
const
|
|
2
|
+
const useCantooAdaptTextBox = () => {
|
|
3
3
|
const [isOpen, toggle] = useToggle(!1);
|
|
4
4
|
return {
|
|
5
5
|
isOpen,
|
|
6
6
|
toggle,
|
|
7
7
|
onCancel: () => {
|
|
8
8
|
toggle();
|
|
9
|
-
},
|
|
10
|
-
onSuccess: () => {
|
|
11
|
-
toggle();
|
|
12
9
|
}
|
|
13
10
|
};
|
|
14
11
|
};
|
|
15
12
|
export {
|
|
16
|
-
|
|
13
|
+
useCantooAdaptTextBox
|
|
17
14
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@edifice.io/react",
|
|
3
|
-
"version": "2.1.1-develop-integration.
|
|
3
|
+
"version": "2.1.1-develop-integration.20250218102509",
|
|
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-integration.
|
|
122
|
-
"@edifice.io/tiptap-extensions": "2.1.1-develop-integration.
|
|
123
|
-
"@edifice.io/utilities": "2.1.1-develop-integration.
|
|
121
|
+
"@edifice.io/bootstrap": "2.1.1-develop-integration.20250218102509",
|
|
122
|
+
"@edifice.io/tiptap-extensions": "2.1.1-develop-integration.20250218102509",
|
|
123
|
+
"@edifice.io/utilities": "2.1.1-develop-integration.20250218102509"
|
|
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-integration.
|
|
155
|
-
"@edifice.io/config": "2.1.1-develop-integration.
|
|
154
|
+
"@edifice.io/client": "2.1.1-develop-integration.20250218102509",
|
|
155
|
+
"@edifice.io/config": "2.1.1-develop-integration.20250218102509"
|
|
156
156
|
},
|
|
157
157
|
"peerDependencies": {
|
|
158
158
|
"@react-spring/web": "^9.7.5",
|