@blocklet/discuss-kit-ux 2.0.1 → 2.0.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.umd.js CHANGED
@@ -1,6 +1,6 @@
1
1
  (function(global, factory) {
2
- typeof exports === "object" && typeof module !== "undefined" ? factory(exports, require("@blocklet/labels"), require("react/jsx-runtime"), require("@mui/material/styles"), require("@arcblock/ux/lib/Theme"), require("react"), require("@mui/material"), require("lodash/isNil"), require("@blocklet/editor/lib/config"), require("react-lazy-with-preload"), require("@lexical/react/LexicalComposerContext"), require("lexical"), require("ahooks"), require("@mui/material/Box"), 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/AvatarGroup"), require("@mui/material/colors"), require("@mui/material/useMediaQuery"), require("@arcblock/ux/lib/DID"), require("@mui/material/Tooltip"), require("react-router-dom"), 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("@arcblock/ux/lib/Empty"), require("@arcblock/did-connect/lib/Session"), require("@mui/icons-material/NotificationsActiveOutlined"), require("@blocklet/editor/lib/ext/CheckboxPlugin"), require("@arcblock/did-connect/lib/Address"), 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("react-dom"), require("dayjs"), require("dayjs/plugin/relativeTime"), require("mitt"), require("@mui/material/CircularProgress"), require("react-helmet"), require("react-flip-toolkit"), require("@mui/material/colors/grey"), require("semver-compare"), require("@arcblock/bridge"), require("@arcblock/react-hooks"), require("@mui/material/Fab"), require("lodash/debounce"), require("@mui/material/TextField"), require("@mui/icons-material/Add"), require("axios"), require("@arcblock/ux/lib/Toast"), require("@mui/material/Pagination"), require("unstated-next"), require("js-cookie"), require("@arcblock/ws"), require("@emotion/css"), 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", "@arcblock/ux/lib/Theme", "react", "@mui/material", "lodash/isNil", "@blocklet/editor/lib/config", "react-lazy-with-preload", "@lexical/react/LexicalComposerContext", "lexical", "ahooks", "@mui/material/Box", "@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/AvatarGroup", "@mui/material/colors", "@mui/material/useMediaQuery", "@arcblock/ux/lib/DID", "@mui/material/Tooltip", "react-router-dom", "@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", "@arcblock/ux/lib/Empty", "@arcblock/did-connect/lib/Session", "@mui/icons-material/NotificationsActiveOutlined", "@blocklet/editor/lib/ext/CheckboxPlugin", "@arcblock/did-connect/lib/Address", "@mui/material/MenuItem", "clsx", "@mui/material/IconButton", "@mui/material/Menu", "@arcblock/ux/lib/Dialog", "lodash/orderBy", "@mui/material/Typography", "@mui/material/Skeleton", "url-join", "react-dom", "dayjs", "dayjs/plugin/relativeTime", "mitt", "@mui/material/CircularProgress", "react-helmet", "react-flip-toolkit", "@mui/material/colors/grey", "semver-compare", "@arcblock/bridge", "@arcblock/react-hooks", "@mui/material/Fab", "lodash/debounce", "@mui/material/TextField", "@mui/icons-material/Add", "axios", "@arcblock/ux/lib/Toast", "@mui/material/Pagination", "unstated-next", "js-cookie", "@arcblock/ws", "@emotion/css", "@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.Theme, global.react, global.material, global.isNil, global.config, global.reactLazyWithPreload, global.LexicalComposerContext, global.lexical$1, global.ahooks, global.Box, global.LoadingButton, global.iconsMaterial, global.context, global.Alert, global.isBoolean, global.Button, global.DidAvatar, global.AvatarGroup, global.colors, global.useMediaQuery, global.DID, global.Tooltip, global.reactRouterDom, global.UxRelativeTime, global.Chip, global.Stack, global.groupBy, global.flatMap, global.uniqBy, global.trim, global.Avatar$1, global.BrokenImageIcon, global.react$1, global.Empty$3, global.Session, global.NotificationsActiveOutlinedIcon, global.CheckboxPlugin, global.DIDAddress, global.MuiMenuItem, global.clsx, global.IconButton$1, global.MuiMenu, global.Dialog, global.orderBy, global.Typography, global.Skeleton, global.joinUrl, global.ReactDOM, global.dayjs, global.relativeTime, global.mitt, global.CircularProgress, global.reactHelmet, global.reactFlipToolkit, global.grey, global.cmp, global.bridge, global.reactHooks, global.Fab, global.debounce, global.TextField, global.AddIcon, global.axios, global.Toast, global.MuiPagination, global.unstatedNext, global.Cookie, global.ws, global.css, global.OnContentChangePlugin, global.ShortcutPlugin, global.SafeAreaPlugin, global.text, global.ImageNode, global.VideoNode));
3
- })(this, function(exports2, labels, jsxRuntime, styles, Theme, react, material, isNil, config, reactLazyWithPreload, LexicalComposerContext, lexical$1, ahooks, Box, LoadingButton, iconsMaterial, context, Alert, isBoolean, Button, DidAvatar, AvatarGroup, colors, useMediaQuery, DID, Tooltip, reactRouterDom, UxRelativeTime, Chip, Stack, groupBy, flatMap, uniqBy, trim, Avatar$1, BrokenImageIcon, react$1, Empty$3, Session, NotificationsActiveOutlinedIcon, CheckboxPlugin, DIDAddress, MuiMenuItem, clsx, IconButton$1, MuiMenu, Dialog, orderBy, Typography, Skeleton, joinUrl, ReactDOM, dayjs, relativeTime, mitt, CircularProgress, reactHelmet, reactFlipToolkit, grey, cmp, bridge, reactHooks, Fab, debounce, TextField, AddIcon, axios, Toast, MuiPagination, unstatedNext, Cookie, ws, css, OnContentChangePlugin, ShortcutPlugin, SafeAreaPlugin, text, ImageNode, VideoNode) {
2
+ typeof exports === "object" && typeof module !== "undefined" ? factory(exports, require("@blocklet/labels"), require("react/jsx-runtime"), require("@mui/material/styles"), require("@arcblock/ux/lib/Theme"), require("react"), require("@mui/material"), require("lodash/isNil"), require("@blocklet/editor/lib/config"), require("react-lazy-with-preload"), require("@lexical/react/LexicalComposerContext"), require("lexical"), require("ahooks"), require("@mui/material/Box"), 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/AvatarGroup"), require("@mui/material/colors"), require("@mui/material/useMediaQuery"), require("@arcblock/ux/lib/DID"), require("@mui/material/Tooltip"), require("react-router-dom"), 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("@arcblock/ux/lib/Empty"), require("@arcblock/did-connect/lib/Session"), require("@mui/icons-material/NotificationsActiveOutlined"), require("@blocklet/editor/lib/ext/CheckboxPlugin"), require("@arcblock/did-connect/lib/Address"), 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("react-dom"), require("dayjs"), require("dayjs/plugin/relativeTime"), require("mitt"), require("@mui/material/CircularProgress"), require("react-helmet"), require("react-flip-toolkit"), require("@mui/material/colors/grey"), require("semver-compare"), require("@arcblock/bridge"), require("@arcblock/react-hooks"), require("@mui/material/Fab"), require("lodash/debounce"), require("@blocklet/editor/lib/main/hooks/useIsFocused"), require("@mui/material/TextField"), require("@mui/icons-material/Add"), require("@arcblock/did-connect/lib/SessionManager"), require("axios"), require("@arcblock/ux/lib/Toast"), require("@mui/material/Pagination"), require("unstated-next"), require("js-cookie"), require("@arcblock/ws"), require("@emotion/css"), 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", "@arcblock/ux/lib/Theme", "react", "@mui/material", "lodash/isNil", "@blocklet/editor/lib/config", "react-lazy-with-preload", "@lexical/react/LexicalComposerContext", "lexical", "ahooks", "@mui/material/Box", "@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/AvatarGroup", "@mui/material/colors", "@mui/material/useMediaQuery", "@arcblock/ux/lib/DID", "@mui/material/Tooltip", "react-router-dom", "@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", "@arcblock/ux/lib/Empty", "@arcblock/did-connect/lib/Session", "@mui/icons-material/NotificationsActiveOutlined", "@blocklet/editor/lib/ext/CheckboxPlugin", "@arcblock/did-connect/lib/Address", "@mui/material/MenuItem", "clsx", "@mui/material/IconButton", "@mui/material/Menu", "@arcblock/ux/lib/Dialog", "lodash/orderBy", "@mui/material/Typography", "@mui/material/Skeleton", "url-join", "react-dom", "dayjs", "dayjs/plugin/relativeTime", "mitt", "@mui/material/CircularProgress", "react-helmet", "react-flip-toolkit", "@mui/material/colors/grey", "semver-compare", "@arcblock/bridge", "@arcblock/react-hooks", "@mui/material/Fab", "lodash/debounce", "@blocklet/editor/lib/main/hooks/useIsFocused", "@mui/material/TextField", "@mui/icons-material/Add", "@arcblock/did-connect/lib/SessionManager", "axios", "@arcblock/ux/lib/Toast", "@mui/material/Pagination", "unstated-next", "js-cookie", "@arcblock/ws", "@emotion/css", "@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.Theme, global.react, global.material, global.isNil, global.config, global.reactLazyWithPreload, global.LexicalComposerContext, global.lexical$1, global.ahooks, global.Box, global.LoadingButton, global.iconsMaterial, global.context, global.Alert, global.isBoolean, global.Button, global.DidAvatar, global.AvatarGroup, global.colors, global.useMediaQuery, global.DID, global.Tooltip, global.reactRouterDom, global.UxRelativeTime, global.Chip, global.Stack, global.groupBy, global.flatMap, global.uniqBy, global.trim, global.Avatar$1, global.BrokenImageIcon, global.react$1, global.Empty$3, global.Session, global.NotificationsActiveOutlinedIcon, global.CheckboxPlugin, global.DIDAddress, global.MuiMenuItem, global.clsx, global.IconButton$1, global.MuiMenu, global.Dialog, global.orderBy, global.Typography, global.Skeleton, global.joinUrl, global.ReactDOM, global.dayjs, global.relativeTime, global.mitt, global.CircularProgress, global.reactHelmet, global.reactFlipToolkit, global.grey, global.cmp, global.bridge, global.reactHooks, global.Fab, global.debounce, global.useIsFocused, global.TextField, global.AddIcon, global.SessionManager, global.axios, global.Toast, global.MuiPagination, global.unstatedNext, global.Cookie, global.ws, global.css, global.OnContentChangePlugin, global.ShortcutPlugin$1, global.SafeAreaPlugin, global.text, global.ImageNode, global.VideoNode));
3
+ })(this, function(exports2, labels, jsxRuntime, styles, Theme, react, material, isNil, config, reactLazyWithPreload, LexicalComposerContext, lexical$1, ahooks, Box, LoadingButton, iconsMaterial, context, Alert, isBoolean, Button, DidAvatar, AvatarGroup, colors, useMediaQuery, DID, Tooltip, reactRouterDom, UxRelativeTime, Chip, Stack, groupBy, flatMap, uniqBy, trim, Avatar$1, BrokenImageIcon, react$1, Empty$3, Session, NotificationsActiveOutlinedIcon, CheckboxPlugin, DIDAddress, MuiMenuItem, clsx, IconButton$1, MuiMenu, Dialog, orderBy, Typography, Skeleton, joinUrl, ReactDOM, dayjs, relativeTime, mitt, CircularProgress, reactHelmet, reactFlipToolkit, grey, cmp, bridge, reactHooks, Fab, debounce, useIsFocused, TextField, AddIcon, SessionManager, axios, Toast, MuiPagination, unstatedNext, Cookie, ws, css, OnContentChangePlugin, ShortcutPlugin$1, SafeAreaPlugin, text, ImageNode, VideoNode) {
4
4
  "use strict";var __defProp = Object.defineProperty;
5
5
  var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
6
6
  var __publicField = (obj, key, value) => {
@@ -436,7 +436,7 @@ var __publicField = (obj, key, value) => {
436
436
  }, [editor2]);
437
437
  return null;
438
438
  }
439
- function AutoClearPlugin({ value, isChanged }) {
439
+ function AutoClearPlugin$1({ value, isChanged }) {
440
440
  const [editor2] = LexicalComposerContext.useLexicalComposerContext();
441
441
  react.useEffect(() => {
442
442
  try {
@@ -584,7 +584,7 @@ var __publicField = (obj, key, value) => {
584
584
  /* @__PURE__ */ jsxRuntime.jsx(CmdEnterShortcutPlugin, { shortcut, callback: handleCmdEnterPressed }),
585
585
  /* @__PURE__ */ jsxRuntime.jsx(ImagePathFixerPlugin, {}),
586
586
  /* @__PURE__ */ jsxRuntime.jsx(VideoPathFixerPlugin, {}),
587
- /* @__PURE__ */ jsxRuntime.jsx(AutoClearPlugin, { value: content, isChanged: isChanged.current }),
587
+ /* @__PURE__ */ jsxRuntime.jsx(AutoClearPlugin$1, { value: content, isChanged: isChanged.current }),
588
588
  children
589
589
  ]
590
590
  }
@@ -3862,6 +3862,15 @@ var __publicField = (obj, key, value) => {
3862
3862
  return false;
3863
3863
  }
3864
3864
  }, [walletVersion, mobile]);
3865
+ const isWebNavbar = react.useMemo(() => {
3866
+ try {
3867
+ const targetVersion = mobile.apple.device ? "5.4.6" : "5.4.4";
3868
+ return !!walletVersion && cmp(walletVersion, targetVersion) === 1;
3869
+ } catch (e) {
3870
+ console.error(e);
3871
+ return false;
3872
+ }
3873
+ }, [walletVersion, mobile]);
3865
3874
  const navigateToChat = ({ id: id2, title }) => {
3866
3875
  if (isChatInWalletV2) {
3867
3876
  navigate(`/chat-in-wallet/${id2}`);
@@ -3875,7 +3884,7 @@ var __publicField = (obj, key, value) => {
3875
3884
  const updateUnreadState = react.useCallback((unread) => {
3876
3885
  bridge.call("updateUnreadState", { unread, appId: window.blocklet.appPid, timestamp: /* @__PURE__ */ new Date() });
3877
3886
  }, []);
3878
- return { navigateToChat, navigateToChatList, isChatInWalletV2, updateUnreadState };
3887
+ return { navigateToChat, navigateToChatList, isChatInWalletV2, isWebNavbar, updateUnreadState };
3879
3888
  };
3880
3889
  function ChatList({ inWallet, ...rest }) {
3881
3890
  const { t } = context.useLocaleContext();
@@ -3920,6 +3929,7 @@ var __publicField = (obj, key, value) => {
3920
3929
  sx: {
3921
3930
  position: "relative",
3922
3931
  m: 1,
3932
+ mx: { xs: 0, sm: 1 },
3923
3933
  py: 1.5,
3924
3934
  px: 2,
3925
3935
  fontWeight: "bold",
@@ -3991,7 +4001,6 @@ var __publicField = (obj, key, value) => {
3991
4001
  };
3992
4002
  const baseItemSx = {
3993
4003
  px: 1.25,
3994
- py: 1,
3995
4004
  transition: "all 120ms linear"
3996
4005
  };
3997
4006
  function Message({ message, prevMessage, showTime = true, ...rest }) {
@@ -4044,7 +4053,9 @@ var __publicField = (obj, key, value) => {
4044
4053
  },
4045
4054
  ".author-info-title": {
4046
4055
  fontSize: 14,
4047
- fontWeight: 500
4056
+ fontWeight: 500,
4057
+ // username 下方首条消息的 margin-top
4058
+ "+ div": { mt: 1 }
4048
4059
  },
4049
4060
  ".author-chat-item": {
4050
4061
  ml: compactMessage ? 6 : 0,
@@ -4139,7 +4150,7 @@ var __publicField = (obj, key, value) => {
4139
4150
  const baseCardSx = {
4140
4151
  py: 1.5,
4141
4152
  px: 2,
4142
- background: "#fff",
4153
+ bgcolor: "grey.50",
4143
4154
  width: "fit-content",
4144
4155
  maxWidth: "calc(100% - 16px)",
4145
4156
  wordWrap: "break-word",
@@ -4369,7 +4380,7 @@ var __publicField = (obj, key, value) => {
4369
4380
  }
4370
4381
  return /* @__PURE__ */ jsxRuntime.jsx(Message, { message, showTime: false });
4371
4382
  };
4372
- return /* @__PURE__ */ jsxRuntime.jsx(Box, { sx: { ...baseItemSx, fontSize: 14 }, children: render() });
4383
+ return /* @__PURE__ */ jsxRuntime.jsx(Box, { sx: { ...baseItemSx, py: 0.5, fontSize: 14 }, children: render() });
4373
4384
  }
4374
4385
  const checkIsAtBottom = (element) => {
4375
4386
  return element && (element.scrollHeight === 0 || element.scrollHeight - element.scrollTop < element.clientHeight + 60);
@@ -4384,7 +4395,7 @@ var __publicField = (obj, key, value) => {
4384
4395
  const [isLoadingMore, setIsLoadingMore] = react.useState(false);
4385
4396
  const scrollToBottom = () => {
4386
4397
  var _a3, _b3;
4387
- (_b3 = containerRef.current) == null ? void 0 : _b3.scrollTo({ top: ((_a3 = containerRef.current) == null ? void 0 : _a3.scrollHeight) || 0, behavior: "smooth" });
4398
+ (_b3 = containerRef.current) == null ? void 0 : _b3.scrollTo({ top: ((_a3 = containerRef.current) == null ? void 0 : _a3.scrollHeight) || 0 });
4388
4399
  setIsAtBottom(true);
4389
4400
  };
4390
4401
  react.useEffect(() => {
@@ -4419,7 +4430,6 @@ var __publicField = (obj, key, value) => {
4419
4430
  py: 2.5,
4420
4431
  px: 1.25,
4421
4432
  gap: 1,
4422
- background: "rgba(249, 250, 251, 1)",
4423
4433
  // 闪烁
4424
4434
  "@keyframes blinking": {
4425
4435
  "0%": { opacity: 0 },
@@ -4594,6 +4604,270 @@ var __publicField = (obj, key, value) => {
4594
4604
  }
4595
4605
  );
4596
4606
  }
4607
+ const tablerSend = (props) => /* @__PURE__ */ jsxRuntime.jsx("svg", { viewBox: "0 0 24 24", "data-iconify": "tabler", width: "1.2em", height: "1.2em", ...props, children: /* @__PURE__ */ jsxRuntime.jsx("path", { fill: "none", stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M10 14L21 3m0 0l-6.5 18a.55.55 0 0 1-1 0L10 14l-7-3.5a.55.55 0 0 1 0-1z" }) });
4608
+ const tablerLetterCase = (props) => /* @__PURE__ */ jsxRuntime.jsx("svg", { viewBox: "0 0 24 24", "data-iconify": "tabler", width: "1.2em", height: "1.2em", ...props, children: /* @__PURE__ */ jsxRuntime.jsx("path", { fill: "none", stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M14 15.5a3.5 3.5 0 1 0 7 0a3.5 3.5 0 1 0-7 0M3 19V8.5a3.5 3.5 0 0 1 7 0V19m-7-6h7m11-1v7" }) });
4609
+ const Editor$1 = react.lazy(() => Promise.resolve().then(() => editor));
4610
+ function LazyEditor(props) {
4611
+ const fallback2 = /* @__PURE__ */ jsxRuntime.jsxs(material.Box, { sx: { px: 3 }, children: [
4612
+ /* @__PURE__ */ jsxRuntime.jsx(material.Skeleton, {}),
4613
+ /* @__PURE__ */ jsxRuntime.jsx(material.Skeleton, { width: "80%" }),
4614
+ /* @__PURE__ */ jsxRuntime.jsx(material.Skeleton, { width: "60%" }),
4615
+ /* @__PURE__ */ jsxRuntime.jsx(material.Skeleton, { width: "40%" })
4616
+ ] });
4617
+ return /* @__PURE__ */ jsxRuntime.jsx(react.Suspense, { fallback: fallback2, children: /* @__PURE__ */ jsxRuntime.jsx(Editor$1, { ...props }) });
4618
+ }
4619
+ const BlockletEditor$1 = react.lazy(() => import("@blocklet/editor"));
4620
+ const fallback = /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
4621
+ /* @__PURE__ */ jsxRuntime.jsx(material.Skeleton, {}),
4622
+ /* @__PURE__ */ jsxRuntime.jsx(material.Skeleton, { width: "80%" }),
4623
+ /* @__PURE__ */ jsxRuntime.jsx(material.Skeleton, { width: "60%" }),
4624
+ /* @__PURE__ */ jsxRuntime.jsx(material.Skeleton, { width: "40%" })
4625
+ ] });
4626
+ function EditorPreview({ content, children, ...rest }) {
4627
+ return /* @__PURE__ */ jsxRuntime.jsx(react.Suspense, { fallback, children: /* @__PURE__ */ jsxRuntime.jsxs(
4628
+ BlockletEditor$1,
4629
+ {
4630
+ editorState: inferInitialEditorState(content),
4631
+ editable: false,
4632
+ enableHeadingsIdPlugin: true,
4633
+ ...rest,
4634
+ children: [
4635
+ /* @__PURE__ */ jsxRuntime.jsx(ImagePathFixerPlugin, {}),
4636
+ /* @__PURE__ */ jsxRuntime.jsx(VideoPathFixerPlugin, {}),
4637
+ children
4638
+ ]
4639
+ }
4640
+ ) });
4641
+ }
4642
+ EditorPreview.fallback = fallback;
4643
+ function AutoClearPlugin({ clearKey }) {
4644
+ const [editor2] = LexicalComposerContext.useLexicalComposerContext();
4645
+ react.useEffect(() => {
4646
+ if (editor2 && clearKey) {
4647
+ editor2.update(() => {
4648
+ const root = lexical$1.$getRoot();
4649
+ root.clear();
4650
+ });
4651
+ }
4652
+ }, [editor2, clearKey]);
4653
+ return null;
4654
+ }
4655
+ function FocusPlugin({ callback }) {
4656
+ const hasFocus = useIsFocused.useIsFocused();
4657
+ react.useEffect(() => {
4658
+ callback(hasFocus);
4659
+ }, [callback, hasFocus]);
4660
+ return null;
4661
+ }
4662
+ function DraggerPlugin() {
4663
+ const [editor2] = LexicalComposerContext.useLexicalComposerContext();
4664
+ const { mobile } = reactHooks.useBrowser();
4665
+ const hasFocus = useIsFocused.useIsFocused();
4666
+ const selection = editor2.getEditorState().read(lexical$1.$getSelection);
4667
+ const enabled = mobile.any && hasFocus && selection;
4668
+ if (enabled) {
4669
+ return /* @__PURE__ */ jsxRuntime.jsx(
4670
+ material.Box,
4671
+ {
4672
+ sx: {
4673
+ position: "absolute",
4674
+ left: "50%",
4675
+ top: 4,
4676
+ width: 64,
4677
+ marginLeft: "-32px",
4678
+ height: 4,
4679
+ bgcolor: "grey.300",
4680
+ borderRadius: 0.1
4681
+ }
4682
+ }
4683
+ );
4684
+ }
4685
+ return null;
4686
+ }
4687
+ function ShortcutPlugin({ callback }) {
4688
+ const [editor2] = LexicalComposerContext.useLexicalComposerContext();
4689
+ const { mobile } = reactHooks.useBrowser();
4690
+ react.useEffect(() => {
4691
+ let dispatching = false;
4692
+ return editor2.registerCommand(
4693
+ lexical$1.KEY_ENTER_COMMAND,
4694
+ (e) => {
4695
+ if (dispatching || mobile.any) {
4696
+ dispatching = false;
4697
+ return false;
4698
+ }
4699
+ if (e.shiftKey) {
4700
+ dispatching = true;
4701
+ const keyboardEvent = new KeyboardEvent("keydown", {
4702
+ code: "Enter",
4703
+ key: "Enter",
4704
+ charCode: 13,
4705
+ keyCode: 13,
4706
+ view: window,
4707
+ bubbles: true
4708
+ });
4709
+ e.preventDefault();
4710
+ editor2.dispatchCommand(lexical$1.KEY_ENTER_COMMAND, keyboardEvent);
4711
+ return true;
4712
+ }
4713
+ callback();
4714
+ return true;
4715
+ },
4716
+ lexical$1.COMMAND_PRIORITY_CRITICAL
4717
+ );
4718
+ }, [editor2, callback, mobile.any]);
4719
+ return null;
4720
+ }
4721
+ function ChatInput({ initialContent, send, onContentChange }) {
4722
+ const { t } = context.useLocaleContext();
4723
+ const [content, setContent] = react.useState("");
4724
+ const [lastSent, setLastSent] = react.useState(0);
4725
+ const [toolbarVisible, setToolbarVisible] = ahooks.useLocalStorageState("chat-input-toolbar-visible", {
4726
+ defaultValue: false
4727
+ });
4728
+ const { mobile } = reactHooks.useBrowser();
4729
+ const [focused, setFocused] = react.useState(false);
4730
+ const compactView = mobile.any && !focused;
4731
+ const handleSend = () => {
4732
+ send(content);
4733
+ setContent("");
4734
+ setLastSent(Date.now());
4735
+ };
4736
+ return /* @__PURE__ */ jsxRuntime.jsxs(
4737
+ material.Box,
4738
+ {
4739
+ sx: {
4740
+ position: "relative",
4741
+ pb: 5,
4742
+ border: 1,
4743
+ borderColor: "divider",
4744
+ borderRadius: 1,
4745
+ overflow: "hidden",
4746
+ ".be-shell": { borderTop: "0 !important" },
4747
+ ".be-shell .toolbar": { bgcolor: "grey.50", ...!toolbarVisible && { display: "none" } },
4748
+ ".be-shell .be-editable": { px: "16px !important" },
4749
+ ".be-shell .be-placeholder": { left: 16 },
4750
+ ".be-shell .be-editable, .be-shell .be-content": { minHeight: "20px !important" },
4751
+ ".be-shell .be-editable p": { my: 0 },
4752
+ ".draggable-block-menu": { display: "none" },
4753
+ ...compactView && {
4754
+ pb: 0,
4755
+ borderRadius: 2,
4756
+ borderBottomLeftRadius: 0,
4757
+ borderBottomRightRadius: 0
4758
+ }
4759
+ },
4760
+ children: [
4761
+ /* @__PURE__ */ jsxRuntime.jsxs(
4762
+ material.Box,
4763
+ {
4764
+ sx: {
4765
+ maxHeight: 400,
4766
+ overflowY: "auto",
4767
+ ...compactView && {
4768
+ height: 44 + (toolbarVisible ? 44 : 0),
4769
+ pt: toolbarVisible ? 0 : 0.5,
4770
+ pb: 0.5,
4771
+ overflow: "hidden",
4772
+ ".be-shell .be-editable": { pr: "44px !important" }
4773
+ }
4774
+ },
4775
+ children: [
4776
+ compactView && !toolbarVisible && /* @__PURE__ */ jsxRuntime.jsx(
4777
+ material.Box,
4778
+ {
4779
+ sx: {
4780
+ position: "absolute",
4781
+ right: 12,
4782
+ top: 12,
4783
+ display: "flex",
4784
+ justifyContent: "center",
4785
+ alignItems: "center",
4786
+ width: 28,
4787
+ height: 28,
4788
+ bgcolor: "grey.300",
4789
+ borderRadius: "100%"
4790
+ },
4791
+ children: /* @__PURE__ */ jsxRuntime.jsx(material.Box, { component: tablerSend, sx: { fontSize: 13, color: "text.secondary" } })
4792
+ }
4793
+ ),
4794
+ /* @__PURE__ */ jsxRuntime.jsxs(
4795
+ LazyEditor,
4796
+ {
4797
+ enableSaveAreaPlugin: false,
4798
+ initialContent: initialContent || "",
4799
+ onChange: ({ content: contentStr, isEmpty }) => {
4800
+ const value = isEmpty ? "" : contentStr;
4801
+ setContent(value);
4802
+ onContentChange == null ? void 0 : onContentChange(value);
4803
+ },
4804
+ autoFocus: false,
4805
+ ignoreInitialChange: false,
4806
+ placeholder: "Jot something down",
4807
+ children: [
4808
+ /* @__PURE__ */ jsxRuntime.jsx(AutoClearPlugin, { clearKey: lastSent }),
4809
+ /* @__PURE__ */ jsxRuntime.jsx(ShortcutPlugin, { callback: handleSend }),
4810
+ /* @__PURE__ */ jsxRuntime.jsx(DraggerPlugin, {}),
4811
+ /* @__PURE__ */ jsxRuntime.jsx(FocusPlugin, { callback: (v2) => setFocused(v2) })
4812
+ ]
4813
+ }
4814
+ )
4815
+ ]
4816
+ }
4817
+ ),
4818
+ /* @__PURE__ */ jsxRuntime.jsxs(
4819
+ material.Box,
4820
+ {
4821
+ sx: {
4822
+ display: "flex",
4823
+ justifyContent: "space-between",
4824
+ alignItems: "center",
4825
+ position: "absolute",
4826
+ left: 0,
4827
+ right: 0,
4828
+ bottom: 0,
4829
+ height: 40,
4830
+ p: 1,
4831
+ ...compactView && { display: "none" }
4832
+ },
4833
+ children: [
4834
+ /* @__PURE__ */ jsxRuntime.jsx(
4835
+ material.Button,
4836
+ {
4837
+ size: "small",
4838
+ color: "primary",
4839
+ variant: "text",
4840
+ onClick: () => setToolbarVisible((x) => !x),
4841
+ startIcon: /* @__PURE__ */ jsxRuntime.jsx(material.Box, { component: tablerLetterCase, sx: { fontSize: "14px !important" } }),
4842
+ sx: {
4843
+ width: 32,
4844
+ height: 28,
4845
+ minWidth: 0,
4846
+ ".MuiButton-startIcon": { m: 0, color: "text.secondary" },
4847
+ ...toolbarVisible && { bgcolor: "grey.200" }
4848
+ }
4849
+ }
4850
+ ),
4851
+ /* @__PURE__ */ jsxRuntime.jsx(
4852
+ material.Button,
4853
+ {
4854
+ size: "small",
4855
+ color: "primary",
4856
+ variant: "contained",
4857
+ disabled: !content,
4858
+ onClick: handleSend,
4859
+ startIcon: /* @__PURE__ */ jsxRuntime.jsx(material.Box, { component: tablerSend, sx: { fontSize: "14px !important" } }),
4860
+ sx: { height: 28 },
4861
+ children: t("chat.send")
4862
+ }
4863
+ )
4864
+ ]
4865
+ }
4866
+ )
4867
+ ]
4868
+ }
4869
+ );
4870
+ }
4597
4871
  function getLineClamp(count) {
4598
4872
  return {
4599
4873
  display: "-webkit-box",
@@ -4617,7 +4891,7 @@ var __publicField = (obj, key, value) => {
4617
4891
  const isActive = isActiveChat(chat.id);
4618
4892
  const { session, isAdmin } = useSessionContext();
4619
4893
  const isCreator = chat.creator.did === ((_a2 = session == null ? void 0 : session.user) == null ? void 0 : _a2.did);
4620
- const [input, setInput] = react.useState("");
4894
+ const [input, setInput] = ahooks.useLocalStorageState(`chat-input-${chat.id}`, { defaultValue: "" });
4621
4895
  react.useEffect(() => {
4622
4896
  if (chat.isActivated) {
4623
4897
  initChatRoom(chat.id);
@@ -4639,7 +4913,10 @@ var __publicField = (obj, key, value) => {
4639
4913
  }
4640
4914
  if (chat.type === "dm") {
4641
4915
  const oppositeUser = getOppositeUser(chat);
4642
- return /* @__PURE__ */ jsxRuntime.jsx(RoomTitle, { title: oppositeUser.fullName });
4916
+ return /* @__PURE__ */ jsxRuntime.jsxs(Box, { sx: { display: "flex", alignItems: "center", gap: 1 }, children: [
4917
+ /* @__PURE__ */ jsxRuntime.jsx(Avatar, { did: oppositeUser == null ? void 0 : oppositeUser.did, src: oppositeUser == null ? void 0 : oppositeUser.avatar, size: 24, shape: "circle", variant: "rounded" }),
4918
+ /* @__PURE__ */ jsxRuntime.jsx(RoomTitle, { title: oppositeUser.fullName })
4919
+ ] });
4643
4920
  }
4644
4921
  if (chat.type === "channel") {
4645
4922
  const menuItems = [];
@@ -4724,66 +5001,41 @@ var __publicField = (obj, key, value) => {
4724
5001
  ]
4725
5002
  }
4726
5003
  ),
4727
- /* @__PURE__ */ jsxRuntime.jsx(Box, { sx: { flex: 1, overflow: "hidden", background: theme.palette.grey[50] }, children: /* @__PURE__ */ jsxRuntime.jsx(MessageList, { chat }) }),
4728
- /* @__PURE__ */ jsxRuntime.jsx(
4729
- Box,
4730
- {
4731
- sx: {
4732
- flex: "0 0 auto",
4733
- ".be-editable": { maxHeight: 200, overflow: "auto" },
4734
- ".be-editable, .be-content": { minHeight: "64px !important" },
4735
- ".be-shell": {
4736
- border: "none !important",
4737
- borderTop: "1px solid #e5e5e5 !important",
4738
- borderRadius: "0px !important"
4739
- }
4740
- },
4741
- children: /* @__PURE__ */ jsxRuntime.jsxs(Box, { sx: { position: "relative" }, children: [
4742
- isActive && /* @__PURE__ */ jsxRuntime.jsx(
4743
- CommentInput,
4744
- {
4745
- initialContent: input,
4746
- onChange: (editorState) => setInput(editorState ? JSON.stringify(editorState) : ""),
4747
- send: (content) => sendMessage(chat.id, content),
4748
- placeholder: t("chat.typeSomething"),
4749
- sendText: t("chat.reply"),
4750
- disabledSend: !(chat.type !== "channel" || chat.hasJoined)
4751
- }
4752
- ),
4753
- chat.type === "channel" && !chat.hasJoined && /* @__PURE__ */ jsxRuntime.jsxs(
4754
- Box,
4755
- {
4756
- sx: {
4757
- position: "absolute",
4758
- zIndex: 9999999,
4759
- top: 0,
4760
- left: 0,
4761
- right: 0,
4762
- bottom: 0,
4763
- bgcolor: "rgba(255, 255, 255, 0.7)",
4764
- display: "flex",
4765
- flexDirection: "column",
4766
- alignItems: "center",
4767
- justifyContent: "center",
4768
- color: "#fff"
4769
- },
4770
- children: [
4771
- /* @__PURE__ */ jsxRuntime.jsx(Box, { sx: { mb: 0.5, fontSize: 18 }, children: "🚪" }),
4772
- /* @__PURE__ */ jsxRuntime.jsx(Box, { sx: { color: "primary.main", mb: 0.5, fontSize: 13, fontWeight: 500 }, children: t("chat.notYetJoinedTheChannel") }),
4773
- /* @__PURE__ */ jsxRuntime.jsx(
4774
- Box,
4775
- {
4776
- sx: { color: "secondary.main", cursor: "pointer", fontSize: 13 },
4777
- onClick: () => joinChannel(chat.id),
4778
- children: t("chat.joinChannel")
4779
- }
4780
- )
4781
- ]
4782
- }
4783
- )
4784
- ] })
4785
- }
4786
- )
5004
+ /* @__PURE__ */ jsxRuntime.jsx(Box, { sx: { flex: 1, overflow: "hidden" }, children: /* @__PURE__ */ jsxRuntime.jsx(MessageList, { chat }) }),
5005
+ /* @__PURE__ */ jsxRuntime.jsxs(Box, { sx: { position: "relative" }, children: [
5006
+ chat.isActivated && chat.type !== "notification" && /* @__PURE__ */ jsxRuntime.jsx(Box, { sx: { px: { xs: 0, sm: 2.5 }, pb: { xs: 0, sm: 2.5 } }, children: /* @__PURE__ */ jsxRuntime.jsx(
5007
+ ChatInput,
5008
+ {
5009
+ initialContent: input,
5010
+ onContentChange: (v2) => setInput(v2),
5011
+ send: (content) => sendMessage(chat.id, content)
5012
+ }
5013
+ ) }),
5014
+ chat.type === "channel" && !chat.hasJoined && /* @__PURE__ */ jsxRuntime.jsxs(
5015
+ Box,
5016
+ {
5017
+ sx: {
5018
+ position: "absolute",
5019
+ zIndex: 9999999,
5020
+ top: 0,
5021
+ left: 0,
5022
+ right: 0,
5023
+ bottom: 0,
5024
+ bgcolor: "rgba(255, 255, 255, 0.7)",
5025
+ display: "flex",
5026
+ flexDirection: "column",
5027
+ alignItems: "center",
5028
+ justifyContent: "center",
5029
+ color: "#fff"
5030
+ },
5031
+ children: [
5032
+ /* @__PURE__ */ jsxRuntime.jsx(Box, { sx: { mb: 0.5, fontSize: 18 }, children: "🚪" }),
5033
+ /* @__PURE__ */ jsxRuntime.jsx(Box, { sx: { color: "primary.main", mb: 0.5, fontSize: 13, fontWeight: 500 }, children: t("chat.notYetJoinedTheChannel") }),
5034
+ /* @__PURE__ */ jsxRuntime.jsx(Box, { sx: { color: "secondary.main", cursor: "pointer", fontSize: 13 }, onClick: () => joinChannel(chat.id), children: t("chat.joinChannel") })
5035
+ ]
5036
+ }
5037
+ )
5038
+ ] })
4787
5039
  ] });
4788
5040
  }
4789
5041
  function NewChannelDialog({ open, onSubmit, onClose, ...rest }) {
@@ -5184,6 +5436,7 @@ var __publicField = (obj, key, value) => {
5184
5436
  !activeChatId && /* @__PURE__ */ jsxRuntime.jsx(Empty$1, { sx: { height: 1 } })
5185
5437
  ] }) });
5186
5438
  }
5439
+ const tablerSwitchHorizontal = (props) => /* @__PURE__ */ jsxRuntime.jsx("svg", { viewBox: "0 0 24 24", "data-iconify": "tabler", width: "1.2em", height: "1.2em", ...props, children: /* @__PURE__ */ jsxRuntime.jsx("path", { fill: "none", stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "m16 3l4 4l-4 4m-6-4h10M8 13l-4 4l4 4m-4-4h9" }) });
5187
5440
  function Empty({ sx }) {
5188
5441
  const { t } = context.useLocaleContext();
5189
5442
  const mergedSx = [
@@ -5203,16 +5456,28 @@ var __publicField = (obj, key, value) => {
5203
5456
  ] });
5204
5457
  }
5205
5458
  function ChatListInWallet({ sx, ...rest }) {
5459
+ var _a2, _b2;
5460
+ const { session } = useSessionContext();
5206
5461
  const { initialized, chats, activeChatId } = useChatContext();
5207
5462
  const { unread } = useUnreadNotification();
5208
- const { navigateToChatList, updateUnreadState } = useChatInWallet();
5463
+ const { navigateToChatList, updateUnreadState, isWebNavbar } = useChatInWallet();
5209
5464
  react.useEffect(() => {
5210
5465
  updateUnreadState(unread);
5211
5466
  }, [unread, updateUnreadState]);
5212
5467
  if (!initialized) {
5213
5468
  return /* @__PURE__ */ jsxRuntime.jsx(CircularProgress, {});
5214
5469
  }
5215
- const mergedSx = [{ display: "flex", height: "100%", bgcolor: "#fff" }, ...Array.isArray(sx) ? sx : [sx]];
5470
+ const mergedSx = [
5471
+ {
5472
+ display: "flex",
5473
+ height: "100%",
5474
+ bgcolor: "#fff",
5475
+ ...((_a2 = window.chatInWallet) == null ? void 0 : _a2.safeAreaInsetTop) && {
5476
+ pt: `${window.chatInWallet.safeAreaInsetTop}px`
5477
+ }
5478
+ },
5479
+ ...Array.isArray(sx) ? sx : [sx]
5480
+ ];
5216
5481
  return /* @__PURE__ */ jsxRuntime.jsx(Box, { ...rest, sx: mergedSx, children: /* @__PURE__ */ jsxRuntime.jsxs(
5217
5482
  Box,
5218
5483
  {
@@ -5223,7 +5488,37 @@ var __publicField = (obj, key, value) => {
5223
5488
  borderRight: { sm: "1px solid #e5e5e5" }
5224
5489
  },
5225
5490
  children: [
5226
- /* @__PURE__ */ jsxRuntime.jsx(UserSearch, { sx: { flex: "0 0 auto", py: 1, px: 3 } }),
5491
+ /* @__PURE__ */ jsxRuntime.jsxs(Box, { sx: { flex: "0 0 auto", py: 1, px: 2 }, children: [
5492
+ isWebNavbar && /* @__PURE__ */ jsxRuntime.jsxs(
5493
+ Box,
5494
+ {
5495
+ sx: {
5496
+ display: "flex",
5497
+ justifyContent: "space-between",
5498
+ mr: -1,
5499
+ mb: 1
5500
+ },
5501
+ children: [
5502
+ /* @__PURE__ */ jsxRuntime.jsxs(
5503
+ Box,
5504
+ {
5505
+ onClick: () => {
5506
+ bridge.call("switchApp");
5507
+ },
5508
+ sx: { display: "flex", alignItems: "center", gap: 1 },
5509
+ children: [
5510
+ /* @__PURE__ */ jsxRuntime.jsx(Box, { component: "img", src: window.blocklet.appLogo, alt: "", sx: { width: 20, height: 20 } }),
5511
+ /* @__PURE__ */ jsxRuntime.jsx(Box, { component: "span", sx: { typography: "h5", fontWeight: "medium" }, children: window.blocklet.appName }),
5512
+ /* @__PURE__ */ jsxRuntime.jsx(Box, { component: tablerSwitchHorizontal, sx: { fontSize: 15, color: "grey.600" } })
5513
+ ]
5514
+ }
5515
+ ),
5516
+ /* @__PURE__ */ jsxRuntime.jsx(SessionManager, { style: { padding: 0 }, showText: true, showRole: true, session })
5517
+ ]
5518
+ }
5519
+ ),
5520
+ /* @__PURE__ */ jsxRuntime.jsx(UserSearch, {})
5521
+ ] }),
5227
5522
  /* @__PURE__ */ jsxRuntime.jsx(material.Divider, {}),
5228
5523
  !!(chats == null ? void 0 : chats.length) && /* @__PURE__ */ jsxRuntime.jsx(ChatList, { sx: { flex: 1, overflowY: "auto" }, inWallet: true }),
5229
5524
  !(chats == null ? void 0 : chats.length) && /* @__PURE__ */ jsxRuntime.jsx(Empty, { sx: { flex: 1 } }),
@@ -5237,7 +5532,19 @@ var __publicField = (obj, key, value) => {
5237
5532
  onClose: () => navigateToChatList(),
5238
5533
  onOpen: () => {
5239
5534
  },
5240
- children: /* @__PURE__ */ jsxRuntime.jsx(Box, { sx: { width: 1, height: 1 }, children: /* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Outlet, {}) })
5535
+ children: /* @__PURE__ */ jsxRuntime.jsx(
5536
+ Box,
5537
+ {
5538
+ sx: {
5539
+ width: 1,
5540
+ height: 1,
5541
+ ...((_b2 = window.chatInWallet) == null ? void 0 : _b2.safeAreaInsetTop) && {
5542
+ pt: `${window.chatInWallet.safeAreaInsetTop}px`
5543
+ }
5544
+ },
5545
+ children: /* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Outlet, {})
5546
+ }
5547
+ )
5241
5548
  }
5242
5549
  )
5243
5550
  ]
@@ -5536,40 +5843,6 @@ var __publicField = (obj, key, value) => {
5536
5843
  }
5537
5844
  );
5538
5845
  }
5539
- const Editor$1 = react.lazy(() => Promise.resolve().then(() => editor));
5540
- function LazyEditor(props) {
5541
- const fallback2 = /* @__PURE__ */ jsxRuntime.jsxs(material.Box, { sx: { px: 3 }, children: [
5542
- /* @__PURE__ */ jsxRuntime.jsx(material.Skeleton, {}),
5543
- /* @__PURE__ */ jsxRuntime.jsx(material.Skeleton, { width: "80%" }),
5544
- /* @__PURE__ */ jsxRuntime.jsx(material.Skeleton, { width: "60%" }),
5545
- /* @__PURE__ */ jsxRuntime.jsx(material.Skeleton, { width: "40%" })
5546
- ] });
5547
- return /* @__PURE__ */ jsxRuntime.jsx(react.Suspense, { fallback: fallback2, children: /* @__PURE__ */ jsxRuntime.jsx(Editor$1, { ...props }) });
5548
- }
5549
- const BlockletEditor$1 = react.lazy(() => import("@blocklet/editor"));
5550
- const fallback = /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
5551
- /* @__PURE__ */ jsxRuntime.jsx(material.Skeleton, {}),
5552
- /* @__PURE__ */ jsxRuntime.jsx(material.Skeleton, { width: "80%" }),
5553
- /* @__PURE__ */ jsxRuntime.jsx(material.Skeleton, { width: "60%" }),
5554
- /* @__PURE__ */ jsxRuntime.jsx(material.Skeleton, { width: "40%" })
5555
- ] });
5556
- function EditorPreview({ content, children, ...rest }) {
5557
- return /* @__PURE__ */ jsxRuntime.jsx(react.Suspense, { fallback, children: /* @__PURE__ */ jsxRuntime.jsxs(
5558
- BlockletEditor$1,
5559
- {
5560
- editorState: inferInitialEditorState(content),
5561
- editable: false,
5562
- enableHeadingsIdPlugin: true,
5563
- ...rest,
5564
- children: [
5565
- /* @__PURE__ */ jsxRuntime.jsx(ImagePathFixerPlugin, {}),
5566
- /* @__PURE__ */ jsxRuntime.jsx(VideoPathFixerPlugin, {}),
5567
- children
5568
- ]
5569
- }
5570
- ) });
5571
- }
5572
- EditorPreview.fallback = fallback;
5573
5846
  const useBeforeUnloadPrompt = (dirty) => {
5574
5847
  react.useEffect(() => {
5575
5848
  const showPrompt = (e) => {
@@ -5735,7 +6008,8 @@ var __publicField = (obj, key, value) => {
5735
6008
  pointUp: "🎉 You got {points} {unit} {event}",
5736
6009
  loadMore: "Load older messages",
5737
6010
  notYetJoinedTheChannel: "Not yet joined the channel",
5738
- typeSomething: "Type here. Use Markdown, Drag or paste images"
6011
+ typeSomething: "Type here. Use Markdown, Drag or paste images",
6012
+ send: "Send"
5739
6013
  }
5740
6014
  };
5741
6015
  const zh = {
@@ -5815,7 +6089,8 @@ var __publicField = (obj, key, value) => {
5815
6089
  pointUp: "🎉 您获得了 {points} {unit} {event}",
5816
6090
  loadMore: "加载更多消息",
5817
6091
  notYetJoinedTheChannel: "暂未加入这个频道",
5818
- typeSomething: "在这里输入,适用 MarkDown,拽入或者黏贴图片"
6092
+ typeSomething: "在这里输入,适用 MarkDown,拽入或者黏贴图片",
6093
+ send: "发送"
5819
6094
  }
5820
6095
  };
5821
6096
  const translations = { zh, en };
@@ -11723,7 +11998,15 @@ var __publicField = (obj, key, value) => {
11723
11998
  min-height: 150px;
11724
11999
  }
11725
12000
  `;
11726
- function Editor({ initialContent, onChange, children, onSave, ...rest }) {
12001
+ function Editor({
12002
+ initialContent,
12003
+ onChange,
12004
+ children,
12005
+ onSave,
12006
+ enableSaveAreaPlugin = true,
12007
+ ignoreInitialChange = true,
12008
+ ...rest
12009
+ }) {
11727
12010
  const handleChange = async (editorState, editor2) => {
11728
12011
  const isEmpty = await isEmptyContent(editorState, editor2);
11729
12012
  onChange == null ? void 0 : onChange({
@@ -11737,9 +12020,9 @@ var __publicField = (obj, key, value) => {
11737
12020
  return /* @__PURE__ */ jsxRuntime.jsx(Root, { children: /* @__PURE__ */ jsxRuntime.jsxs(BlockletEditor, { editorState: inferInitialEditorState(initialContent), ...rest, children: [
11738
12021
  /* @__PURE__ */ jsxRuntime.jsx(ImagePathFixerPlugin, {}),
11739
12022
  /* @__PURE__ */ jsxRuntime.jsx(VideoPathFixerPlugin, {}),
11740
- /* @__PURE__ */ jsxRuntime.jsx(OnContentChangePlugin.OnContentChangePlugin, { onChange: handleChange }),
11741
- onSave && /* @__PURE__ */ jsxRuntime.jsx(ShortcutPlugin.CtrlsShortcutPlugin, { callback: onSave }),
11742
- /* @__PURE__ */ jsxRuntime.jsx(SafeAreaPlugin.SafeAreaPlugin, {}),
12023
+ /* @__PURE__ */ jsxRuntime.jsx(OnContentChangePlugin.OnContentChangePlugin, { onChange: handleChange, ignoreInitialChange }),
12024
+ onSave && /* @__PURE__ */ jsxRuntime.jsx(ShortcutPlugin$1.CtrlsShortcutPlugin, { callback: onSave }),
12025
+ enableSaveAreaPlugin && /* @__PURE__ */ jsxRuntime.jsx(SafeAreaPlugin.SafeAreaPlugin, {}),
11743
12026
  children
11744
12027
  ] }) });
11745
12028
  }