@blocklet/discuss-kit-ux 2.1.126 → 2.1.128
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 { lazyRetry } from "@arcblock/ux/lib/Util";
|
|
7
|
-
import { i as inferInitialEditorState, I as ImagePathFixerPlugin, V as VideoPathFixerPlugin, a as isEmptyContent, s as stringify, g as getExcerptSync } from "./index-
|
|
7
|
+
import { i as inferInitialEditorState, I as ImagePathFixerPlugin, V as VideoPathFixerPlugin, a as isEmptyContent, s as stringify, g as getExcerptSync } from "./index-Bgt3USBX.mjs";
|
|
8
8
|
const BlockletEditor = lazyRetry(() => import("@blocklet/editor"));
|
|
9
9
|
const Root = styled(Box)`
|
|
10
10
|
.be-editable,
|
|
@@ -1024,26 +1024,27 @@ function Badge({
|
|
|
1024
1024
|
] }) : null;
|
|
1025
1025
|
}
|
|
1026
1026
|
const useSessionContext = () => {
|
|
1027
|
-
var _a2, _b2, _c2, _d2, _e, _f
|
|
1027
|
+
var _a2, _b2, _c2, _d2, _e, _f;
|
|
1028
1028
|
const ctx = useContext(SessionContext) || {};
|
|
1029
|
-
const
|
|
1029
|
+
const roles = [...((_c2 = (_b2 = (_a2 = ctx == null ? void 0 : ctx.session) == null ? void 0 : _a2.user) == null ? void 0 : _b2.passports) == null ? void 0 : _c2.map((p) => p.name)) || [], "guest"];
|
|
1030
1030
|
const permissionSet = useMemo(() => {
|
|
1031
1031
|
var _a3, _b3;
|
|
1032
1032
|
return new Set(((_b3 = (_a3 = ctx.session) == null ? void 0 : _a3.user) == null ? void 0 : _b3.permissions) || []);
|
|
1033
|
-
}, [(
|
|
1033
|
+
}, [(_e = (_d2 = ctx.session) == null ? void 0 : _d2.user) == null ? void 0 : _e.permissions]);
|
|
1034
|
+
const hasAnyPassport = (passports) => {
|
|
1035
|
+
if (!passports || passports.length === 0) {
|
|
1036
|
+
return true;
|
|
1037
|
+
}
|
|
1038
|
+
const passportsArr = Array.isArray(passports) ? passports : [passports];
|
|
1039
|
+
return roles.some((x) => passportsArr.includes(x));
|
|
1040
|
+
};
|
|
1034
1041
|
return {
|
|
1035
1042
|
...ctx,
|
|
1036
|
-
isAuthenticated: !!((
|
|
1037
|
-
isAdmin: ["admin", "owner"]
|
|
1038
|
-
isMember: ["member"]
|
|
1039
|
-
isBlogEditor: (
|
|
1040
|
-
hasAnyPassport
|
|
1041
|
-
if (!passports || passports.length === 0) {
|
|
1042
|
-
return true;
|
|
1043
|
-
}
|
|
1044
|
-
const passportsArr = Array.isArray(passports) ? passports : [passports];
|
|
1045
|
-
return passportsArr.includes(loginRole);
|
|
1046
|
-
},
|
|
1043
|
+
isAuthenticated: !!((_f = ctx.session) == null ? void 0 : _f.user),
|
|
1044
|
+
isAdmin: hasAnyPassport(["admin", "owner"]),
|
|
1045
|
+
isMember: hasAnyPassport(["member"]),
|
|
1046
|
+
isBlogEditor: hasAnyPassport(["blogEditor"]),
|
|
1047
|
+
hasAnyPassport,
|
|
1047
1048
|
hasAnyPermission: (perms) => {
|
|
1048
1049
|
if (!perms || perms.length === 0) {
|
|
1049
1050
|
return true;
|
|
@@ -4295,7 +4296,7 @@ function Message({ message, prevMessage, showTime = true, ...rest }) {
|
|
|
4295
4296
|
}
|
|
4296
4297
|
};
|
|
4297
4298
|
const renderPostContent = () => {
|
|
4298
|
-
return /* @__PURE__ */ jsx(Box$1, { className: "author-chat-item", children: renderMessage ? renderMessage(message) : /* @__PURE__ */ jsx(PostContent, { content: message.content }) });
|
|
4299
|
+
return /* @__PURE__ */ jsx(Box$1, { className: "author-chat-item", sx: { my: 1 }, children: renderMessage ? renderMessage(message) : /* @__PURE__ */ jsx(PostContent, { content: message.content }) });
|
|
4299
4300
|
};
|
|
4300
4301
|
const menuItems = [];
|
|
4301
4302
|
const isSender = message.sender.did === ((_a2 = session == null ? void 0 : session.user) == null ? void 0 : _a2.did);
|
|
@@ -4798,7 +4799,7 @@ function Back({ url, fallbackUrl, iconOnly, sx, ...rest }) {
|
|
|
4798
4799
|
}
|
|
4799
4800
|
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" }) });
|
|
4800
4801
|
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" }) });
|
|
4801
|
-
const Editor = lazyRetry(() => import("./editor-
|
|
4802
|
+
const Editor = lazyRetry(() => import("./editor-BiGepVAY.mjs"));
|
|
4802
4803
|
function LazyEditor(props) {
|
|
4803
4804
|
const fallback2 = /* @__PURE__ */ jsxs(Box, { sx: { px: 3 }, children: [
|
|
4804
4805
|
/* @__PURE__ */ jsx(Skeleton, {}),
|
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, ar, N, am, as, l, f, p, r, j, t, h, aa, U, c, a0, z, a7, ab, u, an, d, at, a3, aj, e } from "./index-
|
|
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, ar, N, am, as, l, f, p, r, j, t, h, aa, U, c, a0, z, a7, ab, u, an, d, at, a3, aj, e } from "./index-Bgt3USBX.mjs";
|
|
3
3
|
import "react/jsx-runtime";
|
|
4
4
|
import "react";
|
|
5
5
|
import "@mui/material/Box";
|
package/dist/index.umd.js
CHANGED
|
@@ -947,26 +947,27 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
947
947
|
] }) : null;
|
|
948
948
|
}
|
|
949
949
|
const useSessionContext = () => {
|
|
950
|
-
var _a2, _b2, _c2, _d2, _e, _f
|
|
950
|
+
var _a2, _b2, _c2, _d2, _e, _f;
|
|
951
951
|
const ctx = react.useContext(Session.SessionContext) || {};
|
|
952
|
-
const
|
|
952
|
+
const roles = [...((_c2 = (_b2 = (_a2 = ctx == null ? void 0 : ctx.session) == null ? void 0 : _a2.user) == null ? void 0 : _b2.passports) == null ? void 0 : _c2.map((p) => p.name)) || [], "guest"];
|
|
953
953
|
const permissionSet = react.useMemo(() => {
|
|
954
954
|
var _a3, _b3;
|
|
955
955
|
return new Set(((_b3 = (_a3 = ctx.session) == null ? void 0 : _a3.user) == null ? void 0 : _b3.permissions) || []);
|
|
956
|
-
}, [(
|
|
956
|
+
}, [(_e = (_d2 = ctx.session) == null ? void 0 : _d2.user) == null ? void 0 : _e.permissions]);
|
|
957
|
+
const hasAnyPassport = (passports) => {
|
|
958
|
+
if (!passports || passports.length === 0) {
|
|
959
|
+
return true;
|
|
960
|
+
}
|
|
961
|
+
const passportsArr = Array.isArray(passports) ? passports : [passports];
|
|
962
|
+
return roles.some((x) => passportsArr.includes(x));
|
|
963
|
+
};
|
|
957
964
|
return {
|
|
958
965
|
...ctx,
|
|
959
|
-
isAuthenticated: !!((
|
|
960
|
-
isAdmin: ["admin", "owner"]
|
|
961
|
-
isMember: ["member"]
|
|
962
|
-
isBlogEditor: (
|
|
963
|
-
hasAnyPassport
|
|
964
|
-
if (!passports || passports.length === 0) {
|
|
965
|
-
return true;
|
|
966
|
-
}
|
|
967
|
-
const passportsArr = Array.isArray(passports) ? passports : [passports];
|
|
968
|
-
return passportsArr.includes(loginRole);
|
|
969
|
-
},
|
|
966
|
+
isAuthenticated: !!((_f = ctx.session) == null ? void 0 : _f.user),
|
|
967
|
+
isAdmin: hasAnyPassport(["admin", "owner"]),
|
|
968
|
+
isMember: hasAnyPassport(["member"]),
|
|
969
|
+
isBlogEditor: hasAnyPassport(["blogEditor"]),
|
|
970
|
+
hasAnyPassport,
|
|
970
971
|
hasAnyPermission: (perms) => {
|
|
971
972
|
if (!perms || perms.length === 0) {
|
|
972
973
|
return true;
|
|
@@ -4218,7 +4219,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
4218
4219
|
}
|
|
4219
4220
|
};
|
|
4220
4221
|
const renderPostContent = () => {
|
|
4221
|
-
return /* @__PURE__ */ jsxRuntime.jsx(Box, { className: "author-chat-item", children: renderMessage ? renderMessage(message) : /* @__PURE__ */ jsxRuntime.jsx(PostContent, { content: message.content }) });
|
|
4222
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Box, { className: "author-chat-item", sx: { my: 1 }, children: renderMessage ? renderMessage(message) : /* @__PURE__ */ jsxRuntime.jsx(PostContent, { content: message.content }) });
|
|
4222
4223
|
};
|
|
4223
4224
|
const menuItems = [];
|
|
4224
4225
|
const isSender = message.sender.did === ((_a2 = session == null ? void 0 : session.user) == null ? void 0 : _a2.did);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@blocklet/discuss-kit-ux",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.128",
|
|
4
4
|
"files": [
|
|
5
5
|
"dist"
|
|
6
6
|
],
|
|
@@ -44,8 +44,8 @@
|
|
|
44
44
|
"ufo": "^1.5.4",
|
|
45
45
|
"unstated-next": "^1.1.0",
|
|
46
46
|
"url-join": "^4.0.1",
|
|
47
|
-
"@blocklet/editor": "^2.1.
|
|
48
|
-
"@blocklet/labels": "^2.1.
|
|
47
|
+
"@blocklet/editor": "^2.1.128",
|
|
48
|
+
"@blocklet/labels": "^2.1.128"
|
|
49
49
|
},
|
|
50
50
|
"peerDependencies": {
|
|
51
51
|
"@arcblock/did-connect": "^2.10.36",
|