@blocklet/discuss-kit-ux 1.6.1 → 1.6.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.
@@ -1,7 +1,9 @@
1
+ /// <reference types="react" />
1
2
  import { InputProps } from './input';
2
3
  interface Props extends Omit<InputProps, 'render'> {
3
4
  sendText?: string;
4
- allowEmptyContent?: boolean;
5
+ sendIcon?: React.ReactNode;
6
+ disabledSend?: boolean;
5
7
  }
6
- export default function CommentInput({ allowEmptyContent, send, onSuccess, placeholder, sendText, draftKey, ...rest }: Props): import("react/jsx-runtime").JSX.Element;
8
+ export default function CommentInput({ disabledSend, send, onSuccess, placeholder, sendText, sendIcon, draftKey, ...rest }: Props): import("react/jsx-runtime").JSX.Element;
7
9
  export {};
@@ -4,7 +4,7 @@ import { OnContentChangePlugin } from "@blocklet/editor/lib/ext/OnContentChangeP
4
4
  import { CtrlsShortcutPlugin } from "@blocklet/editor/lib/ext/ShortcutPlugin";
5
5
  import { SafeAreaPlugin } from "@blocklet/editor/lib/ext/SafeAreaPlugin";
6
6
  import { lazy } from "react";
7
- import { i as inferInitialEditorState, I as ImagePathFixerPlugin, V as VideoPathFixerPlugin, a as isEmptyContent, s as stringify, g as getExcerptSync } from "./index-f257cd82.mjs";
7
+ import { i as inferInitialEditorState, I as ImagePathFixerPlugin, V as VideoPathFixerPlugin, a as isEmptyContent, s as stringify, g as getExcerptSync } from "./index-c741cc81.mjs";
8
8
  import "@blocklet/labels";
9
9
  import "@mui/material/styles";
10
10
  import "@mui/material/Box";
@@ -22,6 +22,7 @@ import "@mui/lab/LoadingButton";
22
22
  import "@mui/icons-material";
23
23
  import "@arcblock/ux/lib/Locale/context";
24
24
  import "@mui/material/Alert";
25
+ import "lodash/isBoolean";
25
26
  import "@mui/material/Button";
26
27
  import "@arcblock/did-connect/lib/Avatar";
27
28
  import "@mui/material/useMediaQuery";
@@ -24,6 +24,7 @@ import LoadingButton from "@mui/lab/LoadingButton";
24
24
  import { Send, Save, ChatBubbleOutlineOutlined, MoreVert, AddReactionOutlined, NavigateNext, DeleteOutlineOutlined, ContentCopy, ArrowUpward, ArrowDownward, ArrowBackIos, Add } from "@mui/icons-material";
25
25
  import { LocaleContext, useLocaleContext } from "@arcblock/ux/lib/Locale/context";
26
26
  import Alert from "@mui/material/Alert";
27
+ import isBoolean from "lodash/isBoolean";
27
28
  import Button from "@mui/material/Button";
28
29
  import DidAvatar from "@arcblock/did-connect/lib/Avatar";
29
30
  import useMediaQuery$1 from "@mui/material/useMediaQuery";
@@ -525,11 +526,12 @@ const StyledInput = styled$1(Input)`
525
526
  }
526
527
  `;
527
528
  function CommentInput({
528
- allowEmptyContent,
529
+ disabledSend,
529
530
  send,
530
531
  onSuccess,
531
532
  placeholder,
532
533
  sendText,
534
+ sendIcon,
533
535
  draftKey = "",
534
536
  ...rest
535
537
  }) {
@@ -543,63 +545,65 @@ function CommentInput({
543
545
  onSuccess,
544
546
  draftKey,
545
547
  ...rest,
546
- render: ({ submit, content, loading, error, inSmallView }) => /* @__PURE__ */ jsxs(Fragment, { children: [
547
- /* @__PURE__ */ jsxs(
548
- Box,
549
- {
550
- position: "absolute",
551
- bottom: 0,
552
- left: 0,
553
- right: 0,
554
- p: 1,
555
- display: "flex",
556
- justifyContent: inSmallView ? "end" : "space-between",
557
- alignItems: "end",
558
- children: [
559
- /* @__PURE__ */ jsxs(
560
- Box,
561
- {
562
- component: "a",
563
- href: "https://docs.github.com/en/get-started/writing-on-github/getting-started-with-writing-and-formatting-on-github/basic-writing-and-formatting-syntax",
564
- target: "_blank",
565
- sx: {
566
- display: inSmallView ? "none" : "flex",
567
- alignItems: "center",
568
- m: 0,
569
- fontSize: 13,
570
- color: "grey.600",
571
- textDecoration: "none",
572
- "&:hover": { color: "grey.700" }
573
- },
574
- children: [
575
- /* @__PURE__ */ jsx(Box, { component: "span", sx: { display: "inline-flex", alignItems: "center", mr: 0.5, lineHeight: 1 }, children: /* @__PURE__ */ jsx(mdiLanguageMarkdown, { style: { fontSize: 16 } }) }),
576
- /* @__PURE__ */ jsx("span", { children: "Styling with Markdown is supported" })
577
- ]
578
- }
579
- ),
580
- /* @__PURE__ */ jsx(Box, { display: "flex", gap: 1, alignItems: "center", children: /* @__PURE__ */ jsx(
581
- LoadingButton,
582
- {
583
- disabled: allowEmptyContent ? false : !content,
584
- loading,
585
- loadingPosition: "start",
586
- startIcon: /* @__PURE__ */ jsx(Send, { sx: { transform: "rotate(-45deg) translateX(3px)" } }),
587
- variant: "contained",
588
- color: "primary",
589
- title: "⌘ Enter",
590
- onClick: submit,
591
- className: "editor-submit-button",
592
- children: /* @__PURE__ */ jsxs(Box, { component: "span", sx: { display: "inline-flex", gap: 0.5, fontSize: 12 }, children: [
593
- /* @__PURE__ */ jsx("span", { children: sendText || t("sendComment") }),
594
- /* @__PURE__ */ jsx(Box, { component: "span", sx: { display: inSmallView ? "none" : "inline" }, children: "(⌘ Enter)" })
595
- ] })
596
- }
597
- ) })
598
- ]
599
- }
600
- ),
601
- error && /* @__PURE__ */ jsx(Alert, { severity: "error", children: error })
602
- ] })
548
+ render: ({ submit, content, loading, error, inSmallView }) => {
549
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
550
+ /* @__PURE__ */ jsxs(
551
+ Box,
552
+ {
553
+ position: "absolute",
554
+ bottom: 0,
555
+ left: 0,
556
+ right: 0,
557
+ p: 1,
558
+ display: "flex",
559
+ justifyContent: inSmallView ? "end" : "space-between",
560
+ alignItems: "end",
561
+ children: [
562
+ /* @__PURE__ */ jsxs(
563
+ Box,
564
+ {
565
+ component: "a",
566
+ href: "https://docs.github.com/en/get-started/writing-on-github/getting-started-with-writing-and-formatting-on-github/basic-writing-and-formatting-syntax",
567
+ target: "_blank",
568
+ sx: {
569
+ display: inSmallView ? "none" : "flex",
570
+ alignItems: "center",
571
+ m: 0,
572
+ fontSize: 13,
573
+ color: "grey.600",
574
+ textDecoration: "none",
575
+ "&:hover": { color: "grey.700" }
576
+ },
577
+ children: [
578
+ /* @__PURE__ */ jsx(Box, { component: "span", sx: { display: "inline-flex", alignItems: "center", mr: 0.5, lineHeight: 1 }, children: /* @__PURE__ */ jsx(mdiLanguageMarkdown, { style: { fontSize: 16 } }) }),
579
+ /* @__PURE__ */ jsx("span", { children: "Styling with Markdown is supported" })
580
+ ]
581
+ }
582
+ ),
583
+ /* @__PURE__ */ jsx(Box, { display: "flex", gap: 1, alignItems: "center", children: /* @__PURE__ */ jsx(
584
+ LoadingButton,
585
+ {
586
+ disabled: isBoolean(disabledSend) ? disabledSend : !content,
587
+ loading,
588
+ loadingPosition: "start",
589
+ startIcon: sendIcon || /* @__PURE__ */ jsx(Send, { sx: { transform: "rotate(-45deg) translateX(3px)" } }),
590
+ variant: "contained",
591
+ color: "primary",
592
+ title: "⌘ Enter",
593
+ onClick: submit,
594
+ className: "editor-submit-button",
595
+ children: /* @__PURE__ */ jsxs(Box, { component: "span", sx: { display: "inline-flex", gap: 0.5, fontSize: 12 }, children: [
596
+ /* @__PURE__ */ jsx("span", { children: sendText || t("sendComment") }),
597
+ /* @__PURE__ */ jsx(Box, { component: "span", sx: { display: inSmallView ? "none" : "inline" }, children: "(⌘ Enter)" })
598
+ ] })
599
+ }
600
+ ) })
601
+ ]
602
+ }
603
+ ),
604
+ error && /* @__PURE__ */ jsx(Alert, { severity: "error", children: error })
605
+ ] });
606
+ }
603
607
  }
604
608
  );
605
609
  }
@@ -1012,8 +1016,8 @@ function AuthorInfo({
1012
1016
  return /* @__PURE__ */ jsx(HtmlTooltip$1, { title: /* @__PURE__ */ jsx(ProfileCard, { user }), children: /* @__PURE__ */ jsx(Box, { sx: { display: "flex" }, children: /* @__PURE__ */ jsx(
1013
1017
  Avatar,
1014
1018
  {
1015
- did: user.did,
1016
- src: user.avatar,
1019
+ did: user == null ? void 0 : user.did,
1020
+ src: user == null ? void 0 : user.avatar,
1017
1021
  size: avatarSize,
1018
1022
  shape: "circle",
1019
1023
  variant: "circle",
@@ -1026,8 +1030,8 @@ function AuthorInfo({
1026
1030
  return /* @__PURE__ */ jsx(
1027
1031
  Avatar,
1028
1032
  {
1029
- did: user.did,
1030
- src: user.avatar,
1033
+ did: user == null ? void 0 : user.did,
1034
+ src: user == null ? void 0 : user.avatar,
1031
1035
  size: avatarSize,
1032
1036
  shape: "circle",
1033
1037
  variant: "circle",
@@ -1041,9 +1045,9 @@ function AuthorInfo({
1041
1045
  Badge,
1042
1046
  {
1043
1047
  startComponent: !downMd && /* @__PURE__ */ jsx(Box, { component: "span", display: "inline-block", mx: 0.5 }, "dot"),
1044
- passports: user.passports || [],
1045
- pointInfo: user.pointInfo || {},
1046
- did: user.did
1048
+ passports: (user == null ? void 0 : user.passports) || [],
1049
+ pointInfo: (user == null ? void 0 : user.pointInfo) || {},
1050
+ did: user == null ? void 0 : user.did
1047
1051
  }
1048
1052
  );
1049
1053
  return /* @__PURE__ */ jsxs(Box, { sx: { display: "flex", alignItems: "center", gap: 1, fontSize }, ...rest, children: [
@@ -1055,7 +1059,7 @@ function AuthorInfo({
1055
1059
  sx: { display: "flex", alignItems: "center", minHeight: 20, flexWrap: "wrap", lineHeight: 1.5 },
1056
1060
  lineHeight: 1,
1057
1061
  children: [
1058
- /* @__PURE__ */ jsx("span", { className: "user-fullname", children: user.fullName }),
1062
+ /* @__PURE__ */ jsx("span", { className: "user-fullname", children: user == null ? void 0 : user.fullName }),
1059
1063
  createdAt && /* @__PURE__ */ jsxs(Fragment, { children: [
1060
1064
  /* @__PURE__ */ jsx(Box, { component: "span", display: "inline-block", mx: 0.5, children: "·" }),
1061
1065
  renderTime()
@@ -1066,7 +1070,7 @@ function AuthorInfo({
1066
1070
  }
1067
1071
  ),
1068
1072
  showBadge && downMd && /* @__PURE__ */ jsx(Box, { mt: 0.5, children: BadgeRender }),
1069
- showDID && !(responsive && downMd) && /* @__PURE__ */ jsx(DID, { style: { lineHeight: 1.5, minHeight: 20, maxWidth: 250 }, size: 14, did: user.did })
1073
+ showDID && !(responsive && downMd) && /* @__PURE__ */ jsx(DID, { style: { lineHeight: 1.5, minHeight: 20, maxWidth: 250 }, size: 14, did: user == null ? void 0 : user.did })
1070
1074
  ] })
1071
1075
  ] });
1072
1076
  }
@@ -2477,6 +2481,7 @@ function CoverImage({
2477
2481
  ...rest
2478
2482
  }) {
2479
2483
  const [loaded, setLoaded] = useState(false);
2484
+ const [errored, setErrored] = useState(false);
2480
2485
  return /* @__PURE__ */ jsxs(
2481
2486
  Box$1,
2482
2487
  {
@@ -2526,10 +2531,11 @@ function CoverImage({
2526
2531
  visibility: loaded ? "visible" : "hidden"
2527
2532
  },
2528
2533
  alt: "cover",
2529
- onLoad: () => setLoaded(true)
2534
+ onLoad: () => setLoaded(true),
2535
+ onError: () => setErrored(true)
2530
2536
  }
2531
2537
  ),
2532
- !url && /* @__PURE__ */ jsx(
2538
+ (!url || errored) && /* @__PURE__ */ jsx(
2533
2539
  Box$1,
2534
2540
  {
2535
2541
  sx: {
@@ -4395,7 +4401,7 @@ function Pagination({ page, size = 20, total, onChange, routerMode = true, ...re
4395
4401
  }
4396
4402
  );
4397
4403
  }
4398
- const Editor = lazy(() => import("./editor-6acff851.mjs"));
4404
+ const Editor = lazy(() => import("./editor-c4782500.mjs"));
4399
4405
  function LazyEditor(props) {
4400
4406
  const fallback = /* @__PURE__ */ jsxs(Fragment, { children: [
4401
4407
  /* @__PURE__ */ jsx(Skeleton, {}),
package/dist/index.es.js CHANGED
@@ -1,5 +1,5 @@
1
1
  export * from "@blocklet/labels";
2
- import { K, j, N, A, h, a6, B, z, y, E, Q, O, T, W, o, C, q, v, x, _, $, aa, a1, H, J, D, a9, a8, G, c, b, a7, M, P, ah, n, m, a5, R, S, a2, k, X, Z, ab, ae, ad, af, ai, F, aj, l, p, r, t, d, a3, L, e, U, w, a0, a4, u, ag, ak, Y, ac, f } from "./index-f257cd82.mjs";
2
+ import { K, j, N, A, h, a6, B, z, y, E, Q, O, T, W, o, C, q, v, x, _, $, aa, a1, H, J, D, a9, a8, G, c, b, a7, M, P, ah, n, m, a5, R, S, a2, k, X, Z, ab, ae, ad, af, ai, F, aj, l, p, r, t, d, a3, L, e, U, w, a0, a4, u, ag, ak, Y, ac, f } from "./index-c741cc81.mjs";
3
3
  import "react/jsx-runtime";
4
4
  import "react";
5
5
  import "@mui/material/Box";
@@ -21,6 +21,7 @@ import "@blocklet/editor/lib/main/nodes/ImageNode";
21
21
  import "@blocklet/editor/lib/ext/VideoPlugin/VideoNode";
22
22
  import "ahooks";
23
23
  import "@mui/material/Alert";
24
+ import "lodash/isBoolean";
24
25
  import "@arcblock/did-connect/lib/Avatar";
25
26
  import "@mui/material/useMediaQuery";
26
27
  import "@arcblock/ux/lib/DID";
package/dist/index.umd.js CHANGED
@@ -5,8 +5,8 @@ var __publicField = (obj, key, value) => {
5
5
  return value;
6
6
  };
7
7
  (function(global, factory) {
8
- typeof exports === "object" && typeof module !== "undefined" ? factory(exports, require("@blocklet/labels"), require("react/jsx-runtime"), require("@mui/material/styles"), require("react"), require("@mui/material/Box"), require("@arcblock/ux/lib/Theme"), require("lodash/isNil"), require("@blocklet/editor/lib/config"), require("@lexical/react/LexicalComposerContext"), require("lexical"), require("ahooks"), require("@mui/lab/LoadingButton"), require("@mui/icons-material"), require("@arcblock/ux/lib/Locale/context"), require("@mui/material/Alert"), require("@mui/material/Button"), require("@arcblock/did-connect/lib/Avatar"), require("@mui/material/useMediaQuery"), require("@arcblock/ux/lib/DID"), require("@mui/material/Tooltip"), require("@arcblock/ux/lib/RelativeTime"), require("@mui/material/Chip"), require("@mui/material/Stack"), require("lodash/groupBy"), require("lodash/flatMap"), require("lodash/uniqBy"), require("lodash/trim"), require("@mui/material/Avatar"), require("@mui/icons-material/BrokenImage"), require("@iconify/react"), require("react-router-dom"), require("@mui/material/colors"), require("@arcblock/did-connect/lib/Session"), require("@mui/material"), require("@arcblock/did-connect/lib/Address"), require("@blocklet/editor/lib/ext/CheckboxPlugin"), require("@mui/material/MenuItem"), require("clsx"), require("@mui/material/IconButton"), require("@mui/material/Menu"), require("@arcblock/ux/lib/Dialog"), require("lodash/orderBy"), require("@mui/material/Typography"), require("@mui/material/Skeleton"), require("url-join"), require("dayjs"), require("dayjs/plugin/relativeTime"), require("mitt"), require("@mui/material/CircularProgress"), require("@mui/material/Fab"), require("lodash/debounce"), require("@mui/material/TextField"), require("axios"), require("@arcblock/ux/lib/Toast"), require("@mui/material/Pagination"), require("unstated-next"), require("react-dom"), require("js-cookie"), require("@arcblock/ws"), require("@blocklet/editor/lib/ext/OnContentChangePlugin"), require("@blocklet/editor/lib/ext/ShortcutPlugin"), require("@blocklet/editor/lib/ext/SafeAreaPlugin"), require("@lexical/text"), require("@blocklet/editor/lib/main/nodes/ImageNode"), require("@blocklet/editor/lib/ext/VideoPlugin/VideoNode")) : typeof define === "function" && define.amd ? define(["exports", "@blocklet/labels", "react/jsx-runtime", "@mui/material/styles", "react", "@mui/material/Box", "@arcblock/ux/lib/Theme", "lodash/isNil", "@blocklet/editor/lib/config", "@lexical/react/LexicalComposerContext", "lexical", "ahooks", "@mui/lab/LoadingButton", "@mui/icons-material", "@arcblock/ux/lib/Locale/context", "@mui/material/Alert", "@mui/material/Button", "@arcblock/did-connect/lib/Avatar", "@mui/material/useMediaQuery", "@arcblock/ux/lib/DID", "@mui/material/Tooltip", "@arcblock/ux/lib/RelativeTime", "@mui/material/Chip", "@mui/material/Stack", "lodash/groupBy", "lodash/flatMap", "lodash/uniqBy", "lodash/trim", "@mui/material/Avatar", "@mui/icons-material/BrokenImage", "@iconify/react", "react-router-dom", "@mui/material/colors", "@arcblock/did-connect/lib/Session", "@mui/material", "@arcblock/did-connect/lib/Address", "@blocklet/editor/lib/ext/CheckboxPlugin", "@mui/material/MenuItem", "clsx", "@mui/material/IconButton", "@mui/material/Menu", "@arcblock/ux/lib/Dialog", "lodash/orderBy", "@mui/material/Typography", "@mui/material/Skeleton", "url-join", "dayjs", "dayjs/plugin/relativeTime", "mitt", "@mui/material/CircularProgress", "@mui/material/Fab", "lodash/debounce", "@mui/material/TextField", "axios", "@arcblock/ux/lib/Toast", "@mui/material/Pagination", "unstated-next", "react-dom", "js-cookie", "@arcblock/ws", "@blocklet/editor/lib/ext/OnContentChangePlugin", "@blocklet/editor/lib/ext/ShortcutPlugin", "@blocklet/editor/lib/ext/SafeAreaPlugin", "@lexical/text", "@blocklet/editor/lib/main/nodes/ImageNode", "@blocklet/editor/lib/ext/VideoPlugin/VideoNode"], factory) : (global = typeof globalThis !== "undefined" ? globalThis : global || self, factory(global.DiscussKitComponents = {}, global.labels, global.jsxRuntime, global.styles, global.react, global.Box, global.Theme, global.isNil, global.config, global.LexicalComposerContext, global.lexical$1, global.ahooks, global.LoadingButton, global.iconsMaterial, global.context, global.Alert, global.Button, global.DidAvatar, global.useMediaQuery, global.DID, global.Tooltip, global.UxRelativeTime, global.Chip, global.Stack, global.groupBy, global.flatMap, global.uniqBy, global.trim, global.Avatar$1, global.BrokenImageIcon, global.react$1, global.reactRouterDom, global.colors, global.Session, global.material, global.DIDAddress, global.CheckboxPlugin, global.MuiMenuItem, global.clsx, global.IconButton$1, global.MuiMenu, global.Dialog, global.orderBy, global.Typography, global.Skeleton, global.joinUrl, global.dayjs, global.relativeTime, global.mitt, global.CircularProgress, global.Fab, global.debounce, global.TextField, global.axios, global.Toast, global.MuiPagination, global.unstatedNext, global.reactDom, global.Cookie, global.ws, global.OnContentChangePlugin, global.ShortcutPlugin, global.SafeAreaPlugin, global.text, global.ImageNode, global.VideoNode));
9
- })(this, function(exports2, labels, jsxRuntime, styles, react, Box, Theme, isNil, config, LexicalComposerContext, lexical$1, ahooks, LoadingButton, iconsMaterial, context, Alert, Button, DidAvatar, useMediaQuery, DID, Tooltip, UxRelativeTime, Chip, Stack, groupBy, flatMap, uniqBy, trim, Avatar$1, BrokenImageIcon, react$1, reactRouterDom, colors, Session, material, DIDAddress, CheckboxPlugin, MuiMenuItem, clsx, IconButton$1, MuiMenu, Dialog, orderBy, Typography, Skeleton, joinUrl, dayjs, relativeTime, mitt, CircularProgress, Fab, debounce, TextField, axios, Toast, MuiPagination, unstatedNext, reactDom, Cookie, ws, OnContentChangePlugin, ShortcutPlugin, SafeAreaPlugin, text, ImageNode, VideoNode) {
8
+ typeof exports === "object" && typeof module !== "undefined" ? factory(exports, require("@blocklet/labels"), require("react/jsx-runtime"), require("@mui/material/styles"), require("react"), require("@mui/material/Box"), require("@arcblock/ux/lib/Theme"), require("lodash/isNil"), require("@blocklet/editor/lib/config"), require("@lexical/react/LexicalComposerContext"), require("lexical"), require("ahooks"), require("@mui/lab/LoadingButton"), require("@mui/icons-material"), require("@arcblock/ux/lib/Locale/context"), require("@mui/material/Alert"), require("lodash/isBoolean"), require("@mui/material/Button"), require("@arcblock/did-connect/lib/Avatar"), require("@mui/material/useMediaQuery"), require("@arcblock/ux/lib/DID"), require("@mui/material/Tooltip"), require("@arcblock/ux/lib/RelativeTime"), require("@mui/material/Chip"), require("@mui/material/Stack"), require("lodash/groupBy"), require("lodash/flatMap"), require("lodash/uniqBy"), require("lodash/trim"), require("@mui/material/Avatar"), require("@mui/icons-material/BrokenImage"), require("@iconify/react"), require("react-router-dom"), require("@mui/material/colors"), require("@arcblock/did-connect/lib/Session"), require("@mui/material"), require("@arcblock/did-connect/lib/Address"), require("@blocklet/editor/lib/ext/CheckboxPlugin"), require("@mui/material/MenuItem"), require("clsx"), require("@mui/material/IconButton"), require("@mui/material/Menu"), require("@arcblock/ux/lib/Dialog"), require("lodash/orderBy"), require("@mui/material/Typography"), require("@mui/material/Skeleton"), require("url-join"), require("dayjs"), require("dayjs/plugin/relativeTime"), require("mitt"), require("@mui/material/CircularProgress"), require("@mui/material/Fab"), require("lodash/debounce"), require("@mui/material/TextField"), require("axios"), require("@arcblock/ux/lib/Toast"), require("@mui/material/Pagination"), require("unstated-next"), require("react-dom"), require("js-cookie"), require("@arcblock/ws"), require("@blocklet/editor/lib/ext/OnContentChangePlugin"), require("@blocklet/editor/lib/ext/ShortcutPlugin"), require("@blocklet/editor/lib/ext/SafeAreaPlugin"), require("@lexical/text"), require("@blocklet/editor/lib/main/nodes/ImageNode"), require("@blocklet/editor/lib/ext/VideoPlugin/VideoNode")) : typeof define === "function" && define.amd ? define(["exports", "@blocklet/labels", "react/jsx-runtime", "@mui/material/styles", "react", "@mui/material/Box", "@arcblock/ux/lib/Theme", "lodash/isNil", "@blocklet/editor/lib/config", "@lexical/react/LexicalComposerContext", "lexical", "ahooks", "@mui/lab/LoadingButton", "@mui/icons-material", "@arcblock/ux/lib/Locale/context", "@mui/material/Alert", "lodash/isBoolean", "@mui/material/Button", "@arcblock/did-connect/lib/Avatar", "@mui/material/useMediaQuery", "@arcblock/ux/lib/DID", "@mui/material/Tooltip", "@arcblock/ux/lib/RelativeTime", "@mui/material/Chip", "@mui/material/Stack", "lodash/groupBy", "lodash/flatMap", "lodash/uniqBy", "lodash/trim", "@mui/material/Avatar", "@mui/icons-material/BrokenImage", "@iconify/react", "react-router-dom", "@mui/material/colors", "@arcblock/did-connect/lib/Session", "@mui/material", "@arcblock/did-connect/lib/Address", "@blocklet/editor/lib/ext/CheckboxPlugin", "@mui/material/MenuItem", "clsx", "@mui/material/IconButton", "@mui/material/Menu", "@arcblock/ux/lib/Dialog", "lodash/orderBy", "@mui/material/Typography", "@mui/material/Skeleton", "url-join", "dayjs", "dayjs/plugin/relativeTime", "mitt", "@mui/material/CircularProgress", "@mui/material/Fab", "lodash/debounce", "@mui/material/TextField", "axios", "@arcblock/ux/lib/Toast", "@mui/material/Pagination", "unstated-next", "react-dom", "js-cookie", "@arcblock/ws", "@blocklet/editor/lib/ext/OnContentChangePlugin", "@blocklet/editor/lib/ext/ShortcutPlugin", "@blocklet/editor/lib/ext/SafeAreaPlugin", "@lexical/text", "@blocklet/editor/lib/main/nodes/ImageNode", "@blocklet/editor/lib/ext/VideoPlugin/VideoNode"], factory) : (global = typeof globalThis !== "undefined" ? globalThis : global || self, factory(global.DiscussKitComponents = {}, global.labels, global.jsxRuntime, global.styles, global.react, global.Box, global.Theme, global.isNil, global.config, global.LexicalComposerContext, global.lexical$1, global.ahooks, global.LoadingButton, global.iconsMaterial, global.context, global.Alert, global.isBoolean, global.Button, global.DidAvatar, global.useMediaQuery, global.DID, global.Tooltip, global.UxRelativeTime, global.Chip, global.Stack, global.groupBy, global.flatMap, global.uniqBy, global.trim, global.Avatar$1, global.BrokenImageIcon, global.react$1, global.reactRouterDom, global.colors, global.Session, global.material, global.DIDAddress, global.CheckboxPlugin, global.MuiMenuItem, global.clsx, global.IconButton$1, global.MuiMenu, global.Dialog, global.orderBy, global.Typography, global.Skeleton, global.joinUrl, global.dayjs, global.relativeTime, global.mitt, global.CircularProgress, global.Fab, global.debounce, global.TextField, global.axios, global.Toast, global.MuiPagination, global.unstatedNext, global.reactDom, global.Cookie, global.ws, global.OnContentChangePlugin, global.ShortcutPlugin, global.SafeAreaPlugin, global.text, global.ImageNode, global.VideoNode));
9
+ })(this, function(exports2, labels, jsxRuntime, styles, react, Box, Theme, isNil, config, LexicalComposerContext, lexical$1, ahooks, LoadingButton, iconsMaterial, context, Alert, isBoolean, Button, DidAvatar, useMediaQuery, DID, Tooltip, UxRelativeTime, Chip, Stack, groupBy, flatMap, uniqBy, trim, Avatar$1, BrokenImageIcon, react$1, reactRouterDom, colors, Session, material, DIDAddress, CheckboxPlugin, MuiMenuItem, clsx, IconButton$1, MuiMenu, Dialog, orderBy, Typography, Skeleton, joinUrl, dayjs, relativeTime, mitt, CircularProgress, Fab, debounce, TextField, axios, Toast, MuiPagination, unstatedNext, reactDom, Cookie, ws, OnContentChangePlugin, ShortcutPlugin, SafeAreaPlugin, text, ImageNode, VideoNode) {
10
10
  var _a, _b;
11
11
  "use strict";
12
12
  const themeOverrides = {
@@ -467,11 +467,12 @@ var __publicField = (obj, key, value) => {
467
467
  }
468
468
  `;
469
469
  function CommentInput({
470
- allowEmptyContent,
470
+ disabledSend,
471
471
  send,
472
472
  onSuccess,
473
473
  placeholder,
474
474
  sendText,
475
+ sendIcon,
475
476
  draftKey = "",
476
477
  ...rest
477
478
  }) {
@@ -485,63 +486,65 @@ var __publicField = (obj, key, value) => {
485
486
  onSuccess,
486
487
  draftKey,
487
488
  ...rest,
488
- render: ({ submit, content, loading, error, inSmallView }) => /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
489
- /* @__PURE__ */ jsxRuntime.jsxs(
490
- Box,
491
- {
492
- position: "absolute",
493
- bottom: 0,
494
- left: 0,
495
- right: 0,
496
- p: 1,
497
- display: "flex",
498
- justifyContent: inSmallView ? "end" : "space-between",
499
- alignItems: "end",
500
- children: [
501
- /* @__PURE__ */ jsxRuntime.jsxs(
502
- Box,
503
- {
504
- component: "a",
505
- href: "https://docs.github.com/en/get-started/writing-on-github/getting-started-with-writing-and-formatting-on-github/basic-writing-and-formatting-syntax",
506
- target: "_blank",
507
- sx: {
508
- display: inSmallView ? "none" : "flex",
509
- alignItems: "center",
510
- m: 0,
511
- fontSize: 13,
512
- color: "grey.600",
513
- textDecoration: "none",
514
- "&:hover": { color: "grey.700" }
515
- },
516
- children: [
517
- /* @__PURE__ */ jsxRuntime.jsx(Box, { component: "span", sx: { display: "inline-flex", alignItems: "center", mr: 0.5, lineHeight: 1 }, children: /* @__PURE__ */ jsxRuntime.jsx(mdiLanguageMarkdown, { style: { fontSize: 16 } }) }),
518
- /* @__PURE__ */ jsxRuntime.jsx("span", { children: "Styling with Markdown is supported" })
519
- ]
520
- }
521
- ),
522
- /* @__PURE__ */ jsxRuntime.jsx(Box, { display: "flex", gap: 1, alignItems: "center", children: /* @__PURE__ */ jsxRuntime.jsx(
523
- LoadingButton,
524
- {
525
- disabled: allowEmptyContent ? false : !content,
526
- loading,
527
- loadingPosition: "start",
528
- startIcon: /* @__PURE__ */ jsxRuntime.jsx(iconsMaterial.Send, { sx: { transform: "rotate(-45deg) translateX(3px)" } }),
529
- variant: "contained",
530
- color: "primary",
531
- title: "⌘ Enter",
532
- onClick: submit,
533
- className: "editor-submit-button",
534
- children: /* @__PURE__ */ jsxRuntime.jsxs(Box, { component: "span", sx: { display: "inline-flex", gap: 0.5, fontSize: 12 }, children: [
535
- /* @__PURE__ */ jsxRuntime.jsx("span", { children: sendText || t("sendComment") }),
536
- /* @__PURE__ */ jsxRuntime.jsx(Box, { component: "span", sx: { display: inSmallView ? "none" : "inline" }, children: "(⌘ Enter)" })
537
- ] })
538
- }
539
- ) })
540
- ]
541
- }
542
- ),
543
- error && /* @__PURE__ */ jsxRuntime.jsx(Alert, { severity: "error", children: error })
544
- ] })
489
+ render: ({ submit, content, loading, error, inSmallView }) => {
490
+ return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
491
+ /* @__PURE__ */ jsxRuntime.jsxs(
492
+ Box,
493
+ {
494
+ position: "absolute",
495
+ bottom: 0,
496
+ left: 0,
497
+ right: 0,
498
+ p: 1,
499
+ display: "flex",
500
+ justifyContent: inSmallView ? "end" : "space-between",
501
+ alignItems: "end",
502
+ children: [
503
+ /* @__PURE__ */ jsxRuntime.jsxs(
504
+ Box,
505
+ {
506
+ component: "a",
507
+ href: "https://docs.github.com/en/get-started/writing-on-github/getting-started-with-writing-and-formatting-on-github/basic-writing-and-formatting-syntax",
508
+ target: "_blank",
509
+ sx: {
510
+ display: inSmallView ? "none" : "flex",
511
+ alignItems: "center",
512
+ m: 0,
513
+ fontSize: 13,
514
+ color: "grey.600",
515
+ textDecoration: "none",
516
+ "&:hover": { color: "grey.700" }
517
+ },
518
+ children: [
519
+ /* @__PURE__ */ jsxRuntime.jsx(Box, { component: "span", sx: { display: "inline-flex", alignItems: "center", mr: 0.5, lineHeight: 1 }, children: /* @__PURE__ */ jsxRuntime.jsx(mdiLanguageMarkdown, { style: { fontSize: 16 } }) }),
520
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: "Styling with Markdown is supported" })
521
+ ]
522
+ }
523
+ ),
524
+ /* @__PURE__ */ jsxRuntime.jsx(Box, { display: "flex", gap: 1, alignItems: "center", children: /* @__PURE__ */ jsxRuntime.jsx(
525
+ LoadingButton,
526
+ {
527
+ disabled: isBoolean(disabledSend) ? disabledSend : !content,
528
+ loading,
529
+ loadingPosition: "start",
530
+ startIcon: sendIcon || /* @__PURE__ */ jsxRuntime.jsx(iconsMaterial.Send, { sx: { transform: "rotate(-45deg) translateX(3px)" } }),
531
+ variant: "contained",
532
+ color: "primary",
533
+ title: "⌘ Enter",
534
+ onClick: submit,
535
+ className: "editor-submit-button",
536
+ children: /* @__PURE__ */ jsxRuntime.jsxs(Box, { component: "span", sx: { display: "inline-flex", gap: 0.5, fontSize: 12 }, children: [
537
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: sendText || t("sendComment") }),
538
+ /* @__PURE__ */ jsxRuntime.jsx(Box, { component: "span", sx: { display: inSmallView ? "none" : "inline" }, children: "(⌘ Enter)" })
539
+ ] })
540
+ }
541
+ ) })
542
+ ]
543
+ }
544
+ ),
545
+ error && /* @__PURE__ */ jsxRuntime.jsx(Alert, { severity: "error", children: error })
546
+ ] });
547
+ }
545
548
  }
546
549
  );
547
550
  }
@@ -954,8 +957,8 @@ var __publicField = (obj, key, value) => {
954
957
  return /* @__PURE__ */ jsxRuntime.jsx(HtmlTooltip$1, { title: /* @__PURE__ */ jsxRuntime.jsx(ProfileCard, { user }), children: /* @__PURE__ */ jsxRuntime.jsx(Box, { sx: { display: "flex" }, children: /* @__PURE__ */ jsxRuntime.jsx(
955
958
  Avatar,
956
959
  {
957
- did: user.did,
958
- src: user.avatar,
960
+ did: user == null ? void 0 : user.did,
961
+ src: user == null ? void 0 : user.avatar,
959
962
  size: avatarSize,
960
963
  shape: "circle",
961
964
  variant: "circle",
@@ -968,8 +971,8 @@ var __publicField = (obj, key, value) => {
968
971
  return /* @__PURE__ */ jsxRuntime.jsx(
969
972
  Avatar,
970
973
  {
971
- did: user.did,
972
- src: user.avatar,
974
+ did: user == null ? void 0 : user.did,
975
+ src: user == null ? void 0 : user.avatar,
973
976
  size: avatarSize,
974
977
  shape: "circle",
975
978
  variant: "circle",
@@ -983,9 +986,9 @@ var __publicField = (obj, key, value) => {
983
986
  Badge,
984
987
  {
985
988
  startComponent: !downMd && /* @__PURE__ */ jsxRuntime.jsx(Box, { component: "span", display: "inline-block", mx: 0.5 }, "dot"),
986
- passports: user.passports || [],
987
- pointInfo: user.pointInfo || {},
988
- did: user.did
989
+ passports: (user == null ? void 0 : user.passports) || [],
990
+ pointInfo: (user == null ? void 0 : user.pointInfo) || {},
991
+ did: user == null ? void 0 : user.did
989
992
  }
990
993
  );
991
994
  return /* @__PURE__ */ jsxRuntime.jsxs(Box, { sx: { display: "flex", alignItems: "center", gap: 1, fontSize }, ...rest, children: [
@@ -997,7 +1000,7 @@ var __publicField = (obj, key, value) => {
997
1000
  sx: { display: "flex", alignItems: "center", minHeight: 20, flexWrap: "wrap", lineHeight: 1.5 },
998
1001
  lineHeight: 1,
999
1002
  children: [
1000
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "user-fullname", children: user.fullName }),
1003
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "user-fullname", children: user == null ? void 0 : user.fullName }),
1001
1004
  createdAt && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
1002
1005
  /* @__PURE__ */ jsxRuntime.jsx(Box, { component: "span", display: "inline-block", mx: 0.5, children: "·" }),
1003
1006
  renderTime()
@@ -1008,7 +1011,7 @@ var __publicField = (obj, key, value) => {
1008
1011
  }
1009
1012
  ),
1010
1013
  showBadge && downMd && /* @__PURE__ */ jsxRuntime.jsx(Box, { mt: 0.5, children: BadgeRender }),
1011
- showDID && !(responsive && downMd) && /* @__PURE__ */ jsxRuntime.jsx(DID, { style: { lineHeight: 1.5, minHeight: 20, maxWidth: 250 }, size: 14, did: user.did })
1014
+ showDID && !(responsive && downMd) && /* @__PURE__ */ jsxRuntime.jsx(DID, { style: { lineHeight: 1.5, minHeight: 20, maxWidth: 250 }, size: 14, did: user == null ? void 0 : user.did })
1012
1015
  ] })
1013
1016
  ] });
1014
1017
  }
@@ -2419,6 +2422,7 @@ var __publicField = (obj, key, value) => {
2419
2422
  ...rest
2420
2423
  }) {
2421
2424
  const [loaded, setLoaded] = react.useState(false);
2425
+ const [errored, setErrored] = react.useState(false);
2422
2426
  return /* @__PURE__ */ jsxRuntime.jsxs(
2423
2427
  material.Box,
2424
2428
  {
@@ -2468,10 +2472,11 @@ var __publicField = (obj, key, value) => {
2468
2472
  visibility: loaded ? "visible" : "hidden"
2469
2473
  },
2470
2474
  alt: "cover",
2471
- onLoad: () => setLoaded(true)
2475
+ onLoad: () => setLoaded(true),
2476
+ onError: () => setErrored(true)
2472
2477
  }
2473
2478
  ),
2474
- !url && /* @__PURE__ */ jsxRuntime.jsx(
2479
+ (!url || errored) && /* @__PURE__ */ jsxRuntime.jsx(
2475
2480
  material.Box,
2476
2481
  {
2477
2482
  sx: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blocklet/discuss-kit-ux",
3
- "version": "1.6.1",
3
+ "version": "1.6.3",
4
4
  "files": [
5
5
  "dist"
6
6
  ],
@@ -29,8 +29,8 @@
29
29
  },
30
30
  "dependencies": {
31
31
  "@arcblock/ws": "^1.18.103",
32
- "@blocklet/editor": "1.6.1",
33
- "@blocklet/labels": "1.6.1",
32
+ "@blocklet/editor": "1.6.3",
33
+ "@blocklet/labels": "1.6.3",
34
34
  "@blocklet/uploader": "^0.0.53",
35
35
  "@emotion/css": "^11.10.5",
36
36
  "@emotion/react": "^11.10.5",
@@ -92,5 +92,5 @@
92
92
  "resolutions": {
93
93
  "react": "^18.2.0"
94
94
  },
95
- "gitHead": "d8fb7b4134fea2793fe80478d644b0e38b34048a"
95
+ "gitHead": "14ab368c74fc02f22ea8a2afe19cd67d16bad7d9"
96
96
  }