@blocklet/discuss-kit-post 2.4.1 → 2.4.3

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/index.d.ts CHANGED
@@ -1,7 +1,8 @@
1
1
  import { BoxProps } from '@mui/material';
2
+ import { PostAutoTranslationContainer } from '@blocklet/discuss-kit-ux';
2
3
  interface PostProps extends BoxProps {
3
4
  postId: string;
4
5
  readonly?: boolean;
5
6
  }
6
7
  export declare function Post(props: PostProps): import("react/jsx-runtime").JSX.Element | null;
7
- export {};
8
+ export { PostAutoTranslationContainer };
package/dist/index.es.js CHANGED
@@ -4,7 +4,8 @@ import { useSetState, useGetState, useDocumentVisibility, useRequest, useThrottl
4
4
  import { useLocaleContext, LocaleProvider } from "@arcblock/ux/lib/Locale/context";
5
5
  import { SessionContext } from "@arcblock/did-connect/lib/Session";
6
6
  import { useRef, useState, useCallback, useEffect, useContext } from "react";
7
- import { DirtyPromptContainer, useEventCallback, utils, toast, LazyEditor, SubscriptionPaywall, EditorPreview, InternalThemeProvider, UploaderProvider, DefaultEditorConfigProvider } from "@blocklet/discuss-kit-ux";
7
+ import { DirtyPromptContainer, useEventCallback, utils, toast, LazyEditor, SubscriptionPaywall, PostAutoTranslationContainer, EditorPreview, InternalThemeProvider, UploaderProvider, DefaultEditorConfigProvider } from "@blocklet/discuss-kit-ux";
8
+ import { PostAutoTranslationContainer as PostAutoTranslationContainer2 } from "@blocklet/discuss-kit-ux";
8
9
  import { Edit } from "@mui/icons-material";
9
10
  import { createAxios } from "@blocklet/js-sdk";
10
11
  import { joinURL, withQuery } from "ufo";
@@ -279,6 +280,7 @@ function InternalPost({ postId, sx, readonly, ...rest }) {
279
280
  mutate,
280
281
  loading
281
282
  } = useRequest(() => fetchPost(postId, locale), { refreshDeps: [postId, locale] });
283
+ const { plugin } = PostAutoTranslationContainer.useContainer();
282
284
  if (loading) {
283
285
  return EditorPreview.fallback;
284
286
  }
@@ -316,7 +318,7 @@ function InternalPost({ postId, sx, readonly, ...rest }) {
316
318
  children: /* @__PURE__ */ jsx(Edit, {})
317
319
  }
318
320
  ),
319
- editable ? /* @__PURE__ */ jsx(PostEdit, { post, onSave: handleSave, onUpdate: handleUpdate, onCancel: () => setEditable(false) }) : /* @__PURE__ */ jsx(PostPaywall, { post, children: /* @__PURE__ */ jsx(EditorPreview, { content: post.content || "" }) })
321
+ editable ? /* @__PURE__ */ jsx(PostEdit, { post, onSave: handleSave, onUpdate: handleUpdate, onCancel: () => setEditable(false) }) : /* @__PURE__ */ jsx(PostPaywall, { post, children: /* @__PURE__ */ jsx(EditorPreview, { content: post.content || "", prepend: plugin }) })
320
322
  ] }) }) }) }) });
321
323
  }
322
324
  function Post(props) {
@@ -326,5 +328,6 @@ function Post(props) {
326
328
  return /* @__PURE__ */ jsx(InternalPost, { ...props });
327
329
  }
328
330
  export {
329
- Post
331
+ Post,
332
+ PostAutoTranslationContainer2 as PostAutoTranslationContainer
330
333
  };
package/dist/index.umd.js CHANGED
@@ -272,6 +272,7 @@
272
272
  mutate,
273
273
  loading
274
274
  } = ahooks.useRequest(() => fetchPost(postId, locale), { refreshDeps: [postId, locale] });
275
+ const { plugin } = discussKitUx.PostAutoTranslationContainer.useContainer();
275
276
  if (loading) {
276
277
  return discussKitUx.EditorPreview.fallback;
277
278
  }
@@ -309,7 +310,7 @@
309
310
  children: /* @__PURE__ */ jsxRuntime.jsx(iconsMaterial.Edit, {})
310
311
  }
311
312
  ),
312
- editable ? /* @__PURE__ */ jsxRuntime.jsx(PostEdit, { post, onSave: handleSave, onUpdate: handleUpdate, onCancel: () => setEditable(false) }) : /* @__PURE__ */ jsxRuntime.jsx(PostPaywall, { post, children: /* @__PURE__ */ jsxRuntime.jsx(discussKitUx.EditorPreview, { content: post.content || "" }) })
313
+ editable ? /* @__PURE__ */ jsxRuntime.jsx(PostEdit, { post, onSave: handleSave, onUpdate: handleUpdate, onCancel: () => setEditable(false) }) : /* @__PURE__ */ jsxRuntime.jsx(PostPaywall, { post, children: /* @__PURE__ */ jsxRuntime.jsx(discussKitUx.EditorPreview, { content: post.content || "", prepend: plugin }) })
313
314
  ] }) }) }) }) });
314
315
  }
315
316
  function Post(props) {
@@ -318,6 +319,10 @@
318
319
  }
319
320
  return /* @__PURE__ */ jsxRuntime.jsx(InternalPost, { ...props });
320
321
  }
322
+ Object.defineProperty(exports2, "PostAutoTranslationContainer", {
323
+ enumerable: true,
324
+ get: () => discussKitUx.PostAutoTranslationContainer
325
+ });
321
326
  exports2.Post = Post;
322
327
  Object.defineProperty(exports2, Symbol.toStringTag, { value: "Module" });
323
328
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blocklet/discuss-kit-post",
3
- "version": "2.4.1",
3
+ "version": "2.4.3",
4
4
  "files": [
5
5
  "dist"
6
6
  ],
@@ -23,7 +23,7 @@
23
23
  "ahooks": "^3.8.1",
24
24
  "flat": "^5.0.2",
25
25
  "ufo": "1.3.1",
26
- "@blocklet/discuss-kit-ux": "^2.4.1"
26
+ "@blocklet/discuss-kit-ux": "^2.4.3"
27
27
  },
28
28
  "peerDependencies": {
29
29
  "@arcblock/did-connect": "^3.0.1",