@edifice.io/react 2.1.0-develop-b2school.20250205111203 → 2.1.0-develop-b2school.20250206155953

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 CHANGED
@@ -1,17 +1,19 @@
1
1
  import { EditorContent, useEditor } from "@tiptap/react";
2
2
  import { default as default2 } from "./modules/editor/components/Editor/Editor.js";
3
3
  import { default as default3 } from "./modules/editor/components/BubbleMenuEditImage/BubbleMenuEditImage.js";
4
- import { default as default4 } from "./modules/editor/components/NodeView/AudioNodeView.js";
5
- import { default as default5 } from "./modules/editor/components/NodeView/AttachmentNodeView.js";
6
- import { default as default6 } from "./modules/editor/components/NodeView/ImageNodeView.js";
7
- import { default as default7 } from "./modules/editor/components/NodeView/LinkerNodeView.js";
8
- import { default as default8 } from "./modules/editor/components/NodeView/VideoNodeView.js";
9
- import { default as default9 } from "./modules/editor/components/Renderer/AudioRenderer.js";
4
+ import { default as default4 } from "./modules/editor/components/NodeView/AttachmentNodeView.js";
5
+ import { default as default5 } from "./modules/editor/components/NodeView/AudioNodeView.js";
6
+ import { default as default6 } from "./modules/editor/components/NodeView/ConversationHistoryNodeView.js";
7
+ import { default as default7 } from "./modules/editor/components/NodeView/ImageNodeView.js";
8
+ import { default as default8 } from "./modules/editor/components/NodeView/LinkerNodeView.js";
9
+ import { default as default9 } from "./modules/editor/components/NodeView/VideoNodeView.js";
10
10
  import { default as default10 } from "./modules/editor/components/Renderer/AttachmentRenderer.js";
11
- import { default as default11 } from "./modules/editor/components/Renderer/LinkerRenderer.js";
12
- import { default as default12 } from "./modules/editor/components/Renderer/MediaRenderer.js";
13
- import { default as default13 } from "./modules/editor/components/Toolbar/TableToolbar.js";
14
- import { default as default14 } from "./modules/editor/components/Toolbar/LinkToolbar.js";
11
+ import { default as default11 } from "./modules/editor/components/Renderer/AudioRenderer.js";
12
+ import { default as default12 } from "./modules/editor/components/Renderer/ConversationHistoryRenderer.js";
13
+ import { default as default13 } from "./modules/editor/components/Renderer/LinkerRenderer.js";
14
+ import { default as default14 } from "./modules/editor/components/Renderer/MediaRenderer.js";
15
+ import { default as default15 } from "./modules/editor/components/Toolbar/TableToolbar.js";
16
+ import { default as default16 } from "./modules/editor/components/Toolbar/LinkToolbar.js";
15
17
  import { EditorToolbar } from "./modules/editor/components/EditorToolbar/EditorToolbar.js";
16
18
  import { useActionOptions } from "./modules/editor/hooks/useActionOptions.js";
17
19
  import { useCommentEditor } from "./modules/editor/hooks/useCommentEditor.js";
@@ -26,22 +28,24 @@ import { useSpeechRecognition } from "./modules/editor/hooks/useSpeechRecognitio
26
28
  import { useSpeechSynthetisis } from "./modules/editor/hooks/useSpeechSynthetisis.js";
27
29
  import { useTipTapEditor } from "./modules/editor/hooks/useTipTapEditor.js";
28
30
  export {
29
- default5 as AttachmentNodeView,
31
+ default4 as AttachmentNodeView,
30
32
  default10 as AttachmentRenderer,
31
- default4 as AudioNodeView,
32
- default9 as AudioRenderer,
33
+ default5 as AudioNodeView,
34
+ default11 as AudioRenderer,
33
35
  default3 as BubbleMenuEditImage,
36
+ default6 as ConversationHistoryNodeView,
37
+ default12 as ConversationHistoryRenderer,
34
38
  default2 as Editor,
35
39
  EditorContent,
36
40
  EditorContext,
37
41
  EditorToolbar,
38
- default6 as ImageNodeView,
39
- default14 as LinkToolbar,
40
- default7 as LinkerNodeView,
41
- default11 as LinkerRenderer,
42
- default12 as MediaRenderer,
43
- default13 as TableToolbar,
44
- default8 as VideoNodeView,
42
+ default7 as ImageNodeView,
43
+ default16 as LinkToolbar,
44
+ default8 as LinkerNodeView,
45
+ default13 as LinkerRenderer,
46
+ default14 as MediaRenderer,
47
+ default15 as TableToolbar,
48
+ default9 as VideoNodeView,
45
49
  useActionOptions,
46
50
  useCommentEditor,
47
51
  useEditor,
@@ -1,5 +1,5 @@
1
1
  import { WorkspaceVisibility } from '@edifice.io/client';
2
- import { Content, FocusPosition, JSONContent } from '@tiptap/react';
2
+ import { Content, Extensions, 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;
@@ -40,6 +40,8 @@ export interface EditorProps {
40
40
  onContentChange?: ({ editor }: {
41
41
  editor: any;
42
42
  }) => void;
43
+ /** Extensions to add to the editor */
44
+ extensions?: Extensions;
43
45
  }
44
46
  declare const Editor: import('react').ForwardRefExoticComponent<EditorProps & import('react').RefAttributes<EditorRef>>;
45
47
  export default Editor;
@@ -26,14 +26,15 @@ const MathsModal = /* @__PURE__ */ lazy(async () => await import("../MathsModal/
26
26
  focus = "start",
27
27
  placeholder = "",
28
28
  visibility = "protected",
29
- onContentChange
29
+ onContentChange,
30
+ extensions
30
31
  }, ref) => {
31
32
  const editorId = useId(), {
32
33
  appCode
33
34
  } = useEdificeClient(), {
34
35
  editor,
35
36
  editable
36
- } = useTipTapEditor(mode === "edit", content, focus, placeholder, onContentChange, visibility), {
37
+ } = useTipTapEditor(mode === "edit", content, focus, placeholder, onContentChange, visibility, extensions), {
37
38
  ref: mediaLibraryModalRef,
38
39
  ...mediaLibraryModalHandlers
39
40
  } = useMediaLibraryEditor(editor), {
@@ -0,0 +1,2 @@
1
+ declare const ConversationHistoryNodeView: (Component: any) => import('@tiptap/core').Node<any, any>;
2
+ export default ConversationHistoryNodeView;
@@ -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 ? {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@edifice.io/react",
3
- "version": "2.1.0-develop-b2school.20250205111203",
3
+ "version": "2.1.0-develop-b2school.20250206155953",
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.0-develop-b2school.20250205111203",
122
- "@edifice.io/tiptap-extensions": "2.1.0-develop-b2school.20250205111203",
123
- "@edifice.io/utilities": "2.1.0-develop-b2school.20250205111203"
121
+ "@edifice.io/bootstrap": "2.1.0-develop-b2school.20250206155953",
122
+ "@edifice.io/tiptap-extensions": "2.1.0-develop-b2school.20250206155953",
123
+ "@edifice.io/utilities": "2.1.0-develop-b2school.20250206155953"
124
124
  },
125
125
  "devDependencies": {
126
126
  "@babel/plugin-transform-react-pure-annotations": "^7.23.3",
@@ -148,8 +148,8 @@
148
148
  "vite": "^5.4.11",
149
149
  "vite-plugin-dts": "^4.1.0",
150
150
  "vite-tsconfig-paths": "^5.0.1",
151
- "@edifice.io/client": "2.1.0-develop-b2school.20250205111203",
152
- "@edifice.io/config": "2.1.0-develop-b2school.20250205111203"
151
+ "@edifice.io/client": "2.1.0-develop-b2school.20250206155953",
152
+ "@edifice.io/config": "2.1.0-develop-b2school.20250206155953"
153
153
  },
154
154
  "peerDependencies": {
155
155
  "@react-spring/web": "^9.7.5",