@edifice.io/react 2.4.0 → 2.4.1-develop-integration.20251010175409

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.
@@ -71,7 +71,7 @@ const DeleteModal = /* @__PURE__ */ lazy(() => import("./DeleteModal.js")), Comm
71
71
  ] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
72
72
  /* @__PURE__ */ jsx("div", { className: "mt-8 mb-4", children: content }),
73
73
  type === "edit" && /* @__PURE__ */ jsxs("div", { className: "ms-n8", children: [
74
- !replyTo && /* @__PURE__ */ jsx(Button, { variant: "ghost", color: "tertiary", size: "sm", onClick: () => handleReplyToComment(comment.id), children: t("comment.reply") }),
74
+ !replyTo && options.allowReplies && /* @__PURE__ */ jsx(Button, { variant: "ghost", color: "tertiary", size: "sm", onClick: () => handleReplyToComment(comment.id), children: t("comment.reply") }),
75
75
  userId === authorId && /* @__PURE__ */ jsx(Button, { variant: "ghost", color: "tertiary", size: "sm", onClick: () => {
76
76
  handleModifyComment(comment.id), setValue(content);
77
77
  }, children: t("comment.edit") }),
@@ -22,3 +22,4 @@ export declare const DEFAULT_MAX_REPLIES = 5;
22
22
  * Number of comments to add when adding more comment in the limited list
23
23
  */
24
24
  export declare const DEFAULT_ADD_REPLIES = 5;
25
+ export declare const DEFAULT_ALLOW_REPLIES = true;
@@ -1,7 +1,8 @@
1
- const DEFAULT_MAX_COMMENT_LENGTH = 200, DEFAULT_MAX_REPLY_LENGTH = 200, DEFAULT_MAX_COMMENTS = 4, DEFAULT_ADD_COMMENTS = 5, DEFAULT_MAX_REPLIES = 5, DEFAULT_ADD_REPLIES = 5;
1
+ const DEFAULT_MAX_COMMENT_LENGTH = 200, DEFAULT_MAX_REPLY_LENGTH = 200, DEFAULT_MAX_COMMENTS = 4, DEFAULT_ADD_COMMENTS = 5, DEFAULT_MAX_REPLIES = 5, DEFAULT_ADD_REPLIES = 5, DEFAULT_ALLOW_REPLIES = !0;
2
2
  export {
3
3
  DEFAULT_ADD_COMMENTS,
4
4
  DEFAULT_ADD_REPLIES,
5
+ DEFAULT_ALLOW_REPLIES,
5
6
  DEFAULT_MAX_COMMENTS,
6
7
  DEFAULT_MAX_COMMENT_LENGTH,
7
8
  DEFAULT_MAX_REPLIES,
@@ -3,7 +3,7 @@ import { useMemo } from "react";
3
3
  import { CommentForm } from "../components/CommentForm.js";
4
4
  import { CommentHeader } from "../components/CommentHeader.js";
5
5
  import { CommentList } from "../components/CommentList.js";
6
- import { DEFAULT_ADD_REPLIES, DEFAULT_MAX_REPLIES, DEFAULT_ADD_COMMENTS, DEFAULT_MAX_COMMENTS, DEFAULT_MAX_REPLY_LENGTH, DEFAULT_MAX_COMMENT_LENGTH } from "../constants.js";
6
+ import { DEFAULT_ALLOW_REPLIES, DEFAULT_ADD_REPLIES, DEFAULT_MAX_REPLIES, DEFAULT_ADD_COMMENTS, DEFAULT_MAX_COMMENTS, DEFAULT_MAX_REPLY_LENGTH, DEFAULT_MAX_COMMENT_LENGTH } from "../constants.js";
7
7
  import { CommentContext } from "../context/Context.js";
8
8
  import { useComments } from "../hooks/useComments.js";
9
9
  import Button from "../../../components/Button/Button.js";
@@ -20,6 +20,7 @@ const CommentProvider = ({
20
20
  additionalComments: DEFAULT_ADD_COMMENTS,
21
21
  maxReplies: DEFAULT_MAX_REPLIES,
22
22
  additionalReplies: DEFAULT_ADD_REPLIES,
23
+ allowReplies: DEFAULT_ALLOW_REPLIES,
23
24
  ...commentOptions
24
25
  }, {
25
26
  type
@@ -104,6 +104,10 @@ export type CommentOptions = {
104
104
  * Number of replies to load additionally in the limited list
105
105
  */
106
106
  additionalReplies: number;
107
+ /**
108
+ * Allow replying to comments
109
+ */
110
+ allowReplies: boolean;
107
111
  };
108
112
  export interface UserProfileResult {
109
113
  /**
@@ -66,7 +66,7 @@ const MediaRenderer = (props) => {
66
66
  case "iframe":
67
67
  return /* @__PURE__ */ jsxs(Fragment, { children: [
68
68
  /* @__PURE__ */ jsx("div", { className: "iframe-node-view" }),
69
- /* @__PURE__ */ jsx("iframe", { ref: resizableMedia, src: node.attrs.src, width, height, allowFullScreen: node.attrs.allowfullscreen ?? !0, style: node.attrs.style })
69
+ /* @__PURE__ */ jsx("iframe", { ref: resizableMedia, src: node.attrs.src, width, height, allowFullScreen: node.attrs.allowfullscreen ?? !0 })
70
70
  ] });
71
71
  default:
72
72
  return null;
@@ -6,6 +6,7 @@ export interface FormInputs {
6
6
  description: string;
7
7
  enablePublic: boolean;
8
8
  formSlug: string;
9
+ allowReplies: boolean;
9
10
  }
10
11
  /**
11
12
  * Custom translations interface for overriding default translations
@@ -8,6 +8,7 @@ import { TextareaCounter } from "../../../components/TextArea/TextareaCounter.js
8
8
  import ImagePicker from "../../multimedia/ImagePicker/ImagePicker.js";
9
9
  import { useThumb } from "./hooks/useThumb.js";
10
10
  import { useEdificeClient } from "../../../providers/EdificeClientProvider/EdificeClientProvider.hook.js";
11
+ import useHasWorkflow from "../../../hooks/useHasWorkflow/useHasWorkflow.js";
11
12
  import useToast from "../../../hooks/useToast/useToast.js";
12
13
  import useResource from "../../../hooks/useResource/useResource.js";
13
14
  import useMediaLibrary from "../../../hooks/useMediaLibrary/useMediaLibrary.js";
@@ -35,7 +36,7 @@ const DEFAULT_INPUT_MAX_LENGTH = 60, DEFAULT_TEXTAREA_MAX_LENGTH = 400, Resource
35
36
  const {
36
37
  appCode: contextAppCode,
37
38
  currentApp
38
- } = useEdificeClient(), application = customAppCode || contextAppCode, {
39
+ } = useEdificeClient(), application = customAppCode || contextAppCode, hasOptionalCommentRepliesWorkflow = useHasWorkflow("org.entcore.blog.controllers.optionalCommentReplies"), {
39
40
  t
40
41
  } = useTranslation(), {
41
42
  mode
@@ -54,7 +55,8 @@ const DEFAULT_INPUT_MAX_LENGTH = 60, DEFAULT_TEXTAREA_MAX_LENGTH = 400, Resource
54
55
  description: isUpdating ? resource == null ? void 0 : resource.description : "",
55
56
  enablePublic: isUpdating ? resource == null ? void 0 : resource.public : !1,
56
57
  title: isUpdating ? resource == null ? void 0 : resource.name : "",
57
- formSlug: isUpdating ? resource == null ? void 0 : resource.slug : ""
58
+ formSlug: isUpdating ? resource == null ? void 0 : resource.slug : "",
59
+ allowReplies: isUpdating ? resource == null ? void 0 : resource.allowReplies : !0
58
60
  }
59
61
  }), {
60
62
  ref: mediaLibraryRef,
@@ -75,7 +77,8 @@ const DEFAULT_INPUT_MAX_LENGTH = 60, DEFAULT_TEXTAREA_MAX_LENGTH = 400, Resource
75
77
  name: formData.title,
76
78
  public: formData.enablePublic,
77
79
  slug: formData.enablePublic && formData.formSlug || "",
78
- thumbnail
80
+ thumbnail,
81
+ allowReplies: formData.allowReplies
79
82
  };
80
83
  let result, param;
81
84
  if (isCreating) {
@@ -141,6 +144,10 @@ const DEFAULT_INPUT_MAX_LENGTH = 60, DEFAULT_TEXTAREA_MAX_LENGTH = 400, Resource
141
144
  maxLength: textareaMaxLength
142
145
  }), placeholder: ((_f = customT.placeholder) == null ? void 0 : _f.description) ?? t("explorer.resource.editModal.description.placeholder"), size: "md", maxLength: textareaMaxLength }),
143
146
  watchedDescription && /* @__PURE__ */ jsx(TextareaCounter, { content: watchedDescription, maxLength: textareaMaxLength })
147
+ ] }),
148
+ application === "blog" && hasOptionalCommentRepliesWorkflow === !0 && /* @__PURE__ */ jsxs(FormControl, { id: "allowReplies", className: "d-flex gap-8 mt-16 mb-8", children: [
149
+ /* @__PURE__ */ jsx(FormControl.Input, { type: "checkbox", defaultChecked: isUpdating ? resource.allowReplies : !0, ...register("allowReplies"), className: "form-check-input mt-0", size: "sm" }),
150
+ /* @__PURE__ */ jsx(FormControl.Label, { className: "form-check-label mb-0", children: t("explorer.comments.allowReplies") })
144
151
  ] })
145
152
  ] })
146
153
  ] }),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@edifice.io/react",
3
- "version": "2.4.0",
3
+ "version": "2.4.1-develop-integration.20251010175409",
4
4
  "description": "Edifice React Library",
5
5
  "keywords": [
6
6
  "react",
@@ -131,9 +131,9 @@
131
131
  "react-slugify": "^3.0.3",
132
132
  "swiper": "^10.1.0",
133
133
  "ua-parser-js": "^1.0.36",
134
- "@edifice.io/bootstrap": "2.4.0",
135
- "@edifice.io/tiptap-extensions": "2.4.0",
136
- "@edifice.io/utilities": "2.4.0"
134
+ "@edifice.io/bootstrap": "2.4.1-develop-integration.20251010175409",
135
+ "@edifice.io/tiptap-extensions": "2.4.1-develop-integration.20251010175409",
136
+ "@edifice.io/utilities": "2.4.1-develop-integration.20251010175409"
137
137
  },
138
138
  "devDependencies": {
139
139
  "@babel/plugin-transform-react-pure-annotations": "^7.23.3",
@@ -164,8 +164,8 @@
164
164
  "vite": "^5.4.11",
165
165
  "vite-plugin-dts": "^4.1.0",
166
166
  "vite-tsconfig-paths": "^5.0.1",
167
- "@edifice.io/client": "2.4.0",
168
- "@edifice.io/config": "2.4.0"
167
+ "@edifice.io/client": "2.4.1-develop-integration.20251010175409",
168
+ "@edifice.io/config": "2.4.1-develop-integration.20251010175409"
169
169
  },
170
170
  "peerDependencies": {
171
171
  "@react-spring/web": "^9.7.5",