@blocklet/discuss-kit-ux 2.0.94 → 2.0.96

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.
@@ -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-BPvWJjAI.mjs";
7
+ import { i as inferInitialEditorState, I as ImagePathFixerPlugin, V as VideoPathFixerPlugin, a as isEmptyContent, s as stringify, g as getExcerptSync } from "./index-Caco31R0.mjs";
8
8
  const BlockletEditor = lazy(() => import("@blocklet/editor"));
9
9
  const Root = styled(Box)`
10
10
  .be-editable,
@@ -4027,7 +4027,7 @@ function ChannelGroup({ size = "normal", chat, children, ...rest }) {
4027
4027
  }
4028
4028
  ),
4029
4029
  /* @__PURE__ */ jsxs(Box$1, { sx: { display: "flex", flexDirection: "column", height: "100%", justifyContent: "space-between" }, children: [
4030
- /* @__PURE__ */ jsx(Box$1, { sx: { display: "flex", alignItems: "center" }, lineHeight: 1.5, children: /* @__PURE__ */ jsx(Box$1, { component: "span", sx: { fontWeight: "bold" }, children: chat == null ? void 0 : chat.name }) }),
4030
+ /* @__PURE__ */ jsx(Box$1, { sx: { display: "flex", alignItems: "center" }, lineHeight: 1.5, children: /* @__PURE__ */ jsx(Box$1, { component: "span", sx: { fontWeight: "bold", wordBreak: "break-word" }, children: chat == null ? void 0 : chat.name }) }),
4031
4031
  children && /* @__PURE__ */ jsx(Box$1, { children })
4032
4032
  ] })
4033
4033
  ] });
@@ -4760,7 +4760,7 @@ function Back({ url, fallbackUrl, iconOnly, sx, ...rest }) {
4760
4760
  }
4761
4761
  const tablerSend = (props) => /* @__PURE__ */ jsx("svg", { viewBox: "0 0 24 24", "data-iconify": "tabler", width: "1.2em", height: "1.2em", ...props, children: /* @__PURE__ */ 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" }) });
4762
4762
  const tablerLetterCase = (props) => /* @__PURE__ */ jsx("svg", { viewBox: "0 0 24 24", "data-iconify": "tabler", width: "1.2em", height: "1.2em", ...props, children: /* @__PURE__ */ 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" }) });
4763
- const Editor = lazy(() => import("./editor-HBkw1czM.mjs"));
4763
+ const Editor = lazy(() => import("./editor-ksxz55jz.mjs"));
4764
4764
  function LazyEditor(props) {
4765
4765
  const fallback2 = /* @__PURE__ */ jsxs(Box, { sx: { px: 3 }, children: [
4766
4766
  /* @__PURE__ */ jsx(Skeleton, {}),
@@ -4993,7 +4993,6 @@ function ChatInput({ initialContent, send, onContentChange, onFocusChange }) {
4993
4993
  onContentChange == null ? void 0 : onContentChange(value);
4994
4994
  },
4995
4995
  autoFocus: false,
4996
- ignoreInitialChange: false,
4997
4996
  placeholder: "Jot something down",
4998
4997
  children: [
4999
4998
  /* @__PURE__ */ jsx(AutoClearPlugin, { clearKey: lastSent }),
@@ -5065,7 +5064,8 @@ function getLineClamp(count) {
5065
5064
  WebkitLineClamp: count,
5066
5065
  WebkitBoxOrient: "vertical",
5067
5066
  overflow: "hidden",
5068
- lineHeight: 1.5
5067
+ lineHeight: 1.5,
5068
+ wordBreak: "break-word"
5069
5069
  };
5070
5070
  }
5071
5071
  function RoomTitle({ title }) {
@@ -5128,11 +5128,11 @@ function ChatRoom({ chat, inWallet, ...rest }) {
5128
5128
  );
5129
5129
  }
5130
5130
  return /* @__PURE__ */ jsxs(Box$1, { sx: { display: "flex", justifyContent: "space-between", alignItems: "center", width: 1, flex: 1 }, children: [
5131
- /* @__PURE__ */ jsxs(Box$1, { children: [
5131
+ /* @__PURE__ */ jsxs(Box$1, { sx: { minWidth: 0 }, children: [
5132
5132
  /* @__PURE__ */ jsx(Box$1, { component: "span", sx: { fontSize: 14, fontWeight: "bold", color: "grey.700", ...getLineClamp(1) }, children: chat.name }),
5133
5133
  /* @__PURE__ */ jsx(Box$1, { sx: { fontSize: 12, color: "grey.500", ...getLineClamp(1) }, children: chat.description })
5134
5134
  ] }),
5135
- /* @__PURE__ */ jsxs(Box$1, { sx: { display: "flex", alignItems: "center", gap: 1 }, children: [
5135
+ /* @__PURE__ */ jsxs(Box$1, { sx: { display: "flex", flexShrink: 0, alignItems: "center", gap: 1 }, children: [
5136
5136
  !chat.hasJoined && /* @__PURE__ */ jsx(
5137
5137
  Button,
5138
5138
  {
@@ -5227,7 +5227,6 @@ function ChatRoom({ chat, inWallet, ...rest }) {
5227
5227
  color: "#fff"
5228
5228
  },
5229
5229
  children: [
5230
- /* @__PURE__ */ jsx(Box$1, { sx: { mb: 0.5, fontSize: 18 }, children: "🚪" }),
5231
5230
  /* @__PURE__ */ jsx(Box$1, { sx: { color: "primary.main", mb: 0.5, fontSize: 13, fontWeight: 500 }, children: t("chat.notYetJoinedTheChannel") }),
5232
5231
  /* @__PURE__ */ jsx(Box$1, { sx: { color: "secondary.main", cursor: "pointer", fontSize: 13 }, onClick: () => joinChannel(chat.id), children: t("chat.joinChannel") })
5233
5232
  ]
@@ -6078,12 +6077,40 @@ const useBeforeUnloadPrompt = (dirty) => {
6078
6077
  };
6079
6078
  }, [dirty]);
6080
6079
  };
6080
+ const useDirtySources = () => {
6081
+ const [state, setState] = useState({});
6082
+ const dirty = Object.values(state).some(Boolean);
6083
+ const markDirty = useCallback(
6084
+ (key) => {
6085
+ setState((prev) => ({ ...prev, [key]: true }));
6086
+ },
6087
+ [setState]
6088
+ );
6089
+ const resetDirty = useCallback(
6090
+ (key) => {
6091
+ setState((prev) => ({ ...prev, [key]: false }));
6092
+ },
6093
+ [setState]
6094
+ );
6095
+ useEffect(() => {
6096
+ const onMarkDirty = (e) => markDirty(e.detail.key);
6097
+ const onReset = (e) => resetDirty(e.detail.key);
6098
+ window.addEventListener("blocklet:markDirty", onMarkDirty);
6099
+ window.addEventListener("blocklet:resetDirty", onReset);
6100
+ return () => {
6101
+ window.removeEventListener("blocklet:markDirty", onMarkDirty);
6102
+ window.removeEventListener("blocklet:resetDirty", onReset);
6103
+ };
6104
+ }, [markDirty, resetDirty]);
6105
+ return { dirty };
6106
+ };
6081
6107
  const useDirtyPrompt = () => {
6082
6108
  const { t } = useLocaleContext();
6083
6109
  const [dirty, setDirty, getDirty] = useGetState(false);
6084
6110
  const { confirm } = useConfirm();
6085
6111
  const resetCallbackRef = useRef(null);
6086
6112
  useBeforeUnloadPrompt(dirty);
6113
+ const multiDirtySourceState = useDirtySources();
6087
6114
  const reset = useCallback(
6088
6115
  (callback) => {
6089
6116
  resetCallbackRef.current = callback;
@@ -6115,7 +6142,7 @@ const useDirtyPrompt = () => {
6115
6142
  }
6116
6143
  return true;
6117
6144
  }, [confirm, reset, getDirty, t]);
6118
- return { dirty, markDirty, reset, check };
6145
+ return { dirty: dirty || multiDirtySourceState.dirty, markDirty, reset, check };
6119
6146
  };
6120
6147
  const DirtyPromptContainer = createContainer(useDirtyPrompt);
6121
6148
  function ConfirmNavigation() {
@@ -6149,7 +6176,8 @@ function ConfirmNavigation() {
6149
6176
  handleCancel: () => {
6150
6177
  var _a2;
6151
6178
  return (_a2 = blocker.reset) == null ? void 0 : _a2.call(blocker);
6152
- }
6179
+ },
6180
+ sx: { zIndex: 99999 }
6153
6181
  }
6154
6182
  );
6155
6183
  }
package/dist/index.es.js CHANGED
@@ -1,5 +1,5 @@
1
1
  export * from "@blocklet/labels";
2
- import { T, n, W, A, m, ad, B, F, K, J, L, ap, Y, X, $, Z, _, a1, w, C, x, y, E, a5, a6, ah, a8, O, Q, ac, D, ag, af, H, G, b, k, ae, M, P, ao, v, q, R, S, a9, aq, o, a2, a4, ai, al, ak, am, ar, N, as, l, f, p, r, j, t, h, aa, U, c, a0, z, a7, ab, u, an, d, at, a3, aj, e } from "./index-BPvWJjAI.mjs";
2
+ import { T, n, W, A, m, ad, B, F, K, J, L, ap, Y, X, $, Z, _, a1, w, C, x, y, E, a5, a6, ah, a8, O, Q, ac, D, ag, af, H, G, b, k, ae, M, P, ao, v, q, R, S, a9, aq, o, a2, a4, ai, al, ak, am, ar, N, as, l, f, p, r, j, t, h, aa, U, c, a0, z, a7, ab, u, an, d, at, a3, aj, e } from "./index-Caco31R0.mjs";
3
3
  import "react/jsx-runtime";
4
4
  import "react";
5
5
  import "@mui/material/Box";
package/dist/index.umd.js CHANGED
@@ -3953,7 +3953,7 @@ var __publicField = (obj, key, value) => {
3953
3953
  }
3954
3954
  ),
3955
3955
  /* @__PURE__ */ jsxRuntime.jsxs(Box, { sx: { display: "flex", flexDirection: "column", height: "100%", justifyContent: "space-between" }, children: [
3956
- /* @__PURE__ */ jsxRuntime.jsx(Box, { sx: { display: "flex", alignItems: "center" }, lineHeight: 1.5, children: /* @__PURE__ */ jsxRuntime.jsx(Box, { component: "span", sx: { fontWeight: "bold" }, children: chat == null ? void 0 : chat.name }) }),
3956
+ /* @__PURE__ */ jsxRuntime.jsx(Box, { sx: { display: "flex", alignItems: "center" }, lineHeight: 1.5, children: /* @__PURE__ */ jsxRuntime.jsx(Box, { component: "span", sx: { fontWeight: "bold", wordBreak: "break-word" }, children: chat == null ? void 0 : chat.name }) }),
3957
3957
  children && /* @__PURE__ */ jsxRuntime.jsx(Box, { children })
3958
3958
  ] })
3959
3959
  ] });
@@ -4919,7 +4919,6 @@ var __publicField = (obj, key, value) => {
4919
4919
  onContentChange == null ? void 0 : onContentChange(value);
4920
4920
  },
4921
4921
  autoFocus: false,
4922
- ignoreInitialChange: false,
4923
4922
  placeholder: "Jot something down",
4924
4923
  children: [
4925
4924
  /* @__PURE__ */ jsxRuntime.jsx(AutoClearPlugin, { clearKey: lastSent }),
@@ -4991,7 +4990,8 @@ var __publicField = (obj, key, value) => {
4991
4990
  WebkitLineClamp: count,
4992
4991
  WebkitBoxOrient: "vertical",
4993
4992
  overflow: "hidden",
4994
- lineHeight: 1.5
4993
+ lineHeight: 1.5,
4994
+ wordBreak: "break-word"
4995
4995
  };
4996
4996
  }
4997
4997
  function RoomTitle({ title }) {
@@ -5054,11 +5054,11 @@ var __publicField = (obj, key, value) => {
5054
5054
  );
5055
5055
  }
5056
5056
  return /* @__PURE__ */ jsxRuntime.jsxs(Box, { sx: { display: "flex", justifyContent: "space-between", alignItems: "center", width: 1, flex: 1 }, children: [
5057
- /* @__PURE__ */ jsxRuntime.jsxs(Box, { children: [
5057
+ /* @__PURE__ */ jsxRuntime.jsxs(Box, { sx: { minWidth: 0 }, children: [
5058
5058
  /* @__PURE__ */ jsxRuntime.jsx(Box, { component: "span", sx: { fontSize: 14, fontWeight: "bold", color: "grey.700", ...getLineClamp(1) }, children: chat.name }),
5059
5059
  /* @__PURE__ */ jsxRuntime.jsx(Box, { sx: { fontSize: 12, color: "grey.500", ...getLineClamp(1) }, children: chat.description })
5060
5060
  ] }),
5061
- /* @__PURE__ */ jsxRuntime.jsxs(Box, { sx: { display: "flex", alignItems: "center", gap: 1 }, children: [
5061
+ /* @__PURE__ */ jsxRuntime.jsxs(Box, { sx: { display: "flex", flexShrink: 0, alignItems: "center", gap: 1 }, children: [
5062
5062
  !chat.hasJoined && /* @__PURE__ */ jsxRuntime.jsx(
5063
5063
  Button,
5064
5064
  {
@@ -5153,7 +5153,6 @@ var __publicField = (obj, key, value) => {
5153
5153
  color: "#fff"
5154
5154
  },
5155
5155
  children: [
5156
- /* @__PURE__ */ jsxRuntime.jsx(Box, { sx: { mb: 0.5, fontSize: 18 }, children: "🚪" }),
5157
5156
  /* @__PURE__ */ jsxRuntime.jsx(Box, { sx: { color: "primary.main", mb: 0.5, fontSize: 13, fontWeight: 500 }, children: t("chat.notYetJoinedTheChannel") }),
5158
5157
  /* @__PURE__ */ jsxRuntime.jsx(Box, { sx: { color: "secondary.main", cursor: "pointer", fontSize: 13 }, onClick: () => joinChannel(chat.id), children: t("chat.joinChannel") })
5159
5158
  ]
@@ -6004,12 +6003,40 @@ var __publicField = (obj, key, value) => {
6004
6003
  };
6005
6004
  }, [dirty]);
6006
6005
  };
6006
+ const useDirtySources = () => {
6007
+ const [state, setState] = react.useState({});
6008
+ const dirty = Object.values(state).some(Boolean);
6009
+ const markDirty = react.useCallback(
6010
+ (key) => {
6011
+ setState((prev) => ({ ...prev, [key]: true }));
6012
+ },
6013
+ [setState]
6014
+ );
6015
+ const resetDirty = react.useCallback(
6016
+ (key) => {
6017
+ setState((prev) => ({ ...prev, [key]: false }));
6018
+ },
6019
+ [setState]
6020
+ );
6021
+ react.useEffect(() => {
6022
+ const onMarkDirty = (e) => markDirty(e.detail.key);
6023
+ const onReset = (e) => resetDirty(e.detail.key);
6024
+ window.addEventListener("blocklet:markDirty", onMarkDirty);
6025
+ window.addEventListener("blocklet:resetDirty", onReset);
6026
+ return () => {
6027
+ window.removeEventListener("blocklet:markDirty", onMarkDirty);
6028
+ window.removeEventListener("blocklet:resetDirty", onReset);
6029
+ };
6030
+ }, [markDirty, resetDirty]);
6031
+ return { dirty };
6032
+ };
6007
6033
  const useDirtyPrompt = () => {
6008
6034
  const { t } = context.useLocaleContext();
6009
6035
  const [dirty, setDirty, getDirty] = ahooks.useGetState(false);
6010
6036
  const { confirm } = useConfirm();
6011
6037
  const resetCallbackRef = react.useRef(null);
6012
6038
  useBeforeUnloadPrompt(dirty);
6039
+ const multiDirtySourceState = useDirtySources();
6013
6040
  const reset = react.useCallback(
6014
6041
  (callback) => {
6015
6042
  resetCallbackRef.current = callback;
@@ -6041,7 +6068,7 @@ var __publicField = (obj, key, value) => {
6041
6068
  }
6042
6069
  return true;
6043
6070
  }, [confirm, reset, getDirty, t]);
6044
- return { dirty, markDirty, reset, check };
6071
+ return { dirty: dirty || multiDirtySourceState.dirty, markDirty, reset, check };
6045
6072
  };
6046
6073
  const DirtyPromptContainer = unstatedNext.createContainer(useDirtyPrompt);
6047
6074
  function ConfirmNavigation() {
@@ -6075,7 +6102,8 @@ var __publicField = (obj, key, value) => {
6075
6102
  handleCancel: () => {
6076
6103
  var _a2;
6077
6104
  return (_a2 = blocker.reset) == null ? void 0 : _a2.call(blocker);
6078
- }
6105
+ },
6106
+ sx: { zIndex: 99999 }
6079
6107
  }
6080
6108
  );
6081
6109
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blocklet/discuss-kit-ux",
3
- "version": "2.0.94",
3
+ "version": "2.0.96",
4
4
  "files": [
5
5
  "dist"
6
6
  ],
@@ -31,8 +31,8 @@
31
31
  "@arcblock/bridge": "^2.10.12",
32
32
  "@arcblock/react-hooks": "^2.10.12",
33
33
  "@arcblock/ws": "^1.18.128",
34
- "@blocklet/editor": "2.0.94",
35
- "@blocklet/labels": "2.0.94",
34
+ "@blocklet/editor": "2.0.96",
35
+ "@blocklet/labels": "2.0.96",
36
36
  "@blocklet/uploader": "^0.1.20",
37
37
  "@emotion/css": "^11.10.5",
38
38
  "@emotion/react": "^11.10.5",
@@ -100,5 +100,5 @@
100
100
  "resolutions": {
101
101
  "react": "^18.2.0"
102
102
  },
103
- "gitHead": "02ab63096d5ce531d390d4a3e600d4812e212d57"
103
+ "gitHead": "ee7ea575137f9253ee9292ad6dc3763192118791"
104
104
  }