@blocklet/discuss-kit-ux 1.6.188 → 1.6.189
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/components/hooks/session.d.ts +8 -3
- package/dist/components/posts/post-content.d.ts +1 -2
- package/dist/{editor-1S0suIcX.mjs → editor-2xtEiiWT.mjs} +1 -1
- package/dist/{index-q1fCyaqz.mjs → index-XoHU_Puz.mjs} +141 -104
- package/dist/index.d.ts +1 -1
- package/dist/index.es.js +59 -58
- package/dist/index.umd.js +81 -44
- package/package.json +4 -4
|
@@ -10,10 +10,15 @@ export interface SessionContextUser {
|
|
|
10
10
|
permissions: string[];
|
|
11
11
|
role: string;
|
|
12
12
|
}
|
|
13
|
+
interface Session {
|
|
14
|
+
initialized: boolean;
|
|
15
|
+
user: SessionContextUser;
|
|
16
|
+
login: (...args: any[]) => void;
|
|
17
|
+
}
|
|
13
18
|
export declare const useSessionContext: () => {
|
|
14
19
|
isAdmin: boolean;
|
|
15
20
|
hasAnyPassport: (passports: string | string[]) => boolean;
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
};
|
|
21
|
+
hasAnyPermission: (perms: string | string[]) => boolean;
|
|
22
|
+
session: Session;
|
|
19
23
|
};
|
|
24
|
+
export {};
|
|
@@ -3,11 +3,10 @@ interface Props {
|
|
|
3
3
|
content: string;
|
|
4
4
|
editing?: boolean;
|
|
5
5
|
onExitEditing?: () => void;
|
|
6
|
-
onCancel?: () => void;
|
|
7
6
|
onSubmit?: Send;
|
|
8
7
|
autoCollapse?: boolean;
|
|
9
8
|
enableHeadingsIdPlugin?: boolean;
|
|
10
9
|
onReady?: () => void;
|
|
11
10
|
}
|
|
12
|
-
export default function PostContent({ content, editing, onExitEditing,
|
|
11
|
+
export default function PostContent({ content, editing, onExitEditing, onSubmit, autoCollapse, enableHeadingsIdPlugin, onReady, ...rest }: Props): import("react/jsx-runtime").JSX.Element;
|
|
13
12
|
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-
|
|
7
|
+
import { i as inferInitialEditorState, I as ImagePathFixerPlugin, V as VideoPathFixerPlugin, a as isEmptyContent, s as stringify, g as getExcerptSync } from "./index-XoHU_Puz.mjs";
|
|
8
8
|
import "@blocklet/labels";
|
|
9
9
|
import "@mui/material/styles";
|
|
10
10
|
import "@mui/material/Box";
|
|
@@ -8,7 +8,7 @@ var _a, _b;
|
|
|
8
8
|
import { Labels2, LabelPicker } from "@blocklet/labels";
|
|
9
9
|
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
10
10
|
import { useTheme, ThemeProvider, styled } from "@mui/material/styles";
|
|
11
|
-
import { useEffect, useRef, lazy, useState, createElement, useContext, isValidElement, Suspense,
|
|
11
|
+
import { useEffect, useRef, lazy, useState, createElement, useContext, useMemo, isValidElement, Suspense, createContext, Fragment as Fragment$1, forwardRef, useCallback } from "react";
|
|
12
12
|
import Box from "@mui/material/Box";
|
|
13
13
|
import isNil from "lodash/isNil";
|
|
14
14
|
import { useEditorConfig, EditorConfigProvider } from "@blocklet/editor/lib/config";
|
|
@@ -20,7 +20,7 @@ import { ImageNode } from "@blocklet/editor/lib/main/nodes/ImageNode";
|
|
|
20
20
|
import { VideoNode } from "@blocklet/editor/lib/ext/VideoPlugin/VideoNode";
|
|
21
21
|
import { useSize, useInViewport, useSetState, useGetState, useReactive } from "ahooks";
|
|
22
22
|
import LoadingButton from "@mui/lab/LoadingButton";
|
|
23
|
-
import { Send, Save, ChatBubbleOutlineOutlined, MoreVert,
|
|
23
|
+
import { Send, Save, ChatBubbleOutlineOutlined, MoreVert, NavigateNext, DeleteOutlineOutlined, ContentCopy, ArrowUpward, ArrowDownward, ArrowBackIos, Add, BorderColorOutlined } from "@mui/icons-material";
|
|
24
24
|
import { LocaleContext, useLocaleContext } from "@arcblock/ux/lib/Locale/context";
|
|
25
25
|
import Alert from "@mui/material/Alert";
|
|
26
26
|
import isBoolean from "lodash/isBoolean";
|
|
@@ -45,7 +45,7 @@ import BrokenImageIcon from "@mui/icons-material/BrokenImage";
|
|
|
45
45
|
import { Icon } from "@iconify/react";
|
|
46
46
|
import Empty$1 from "@arcblock/ux/lib/Empty";
|
|
47
47
|
import { SessionContext } from "@arcblock/did-connect/lib/Session";
|
|
48
|
-
import { useTheme as useTheme$1, useMediaQuery, Box as Box$1, Tooltip as Tooltip$1, Chip as Chip$1, alpha, ClickAwayListener, Dialog as Dialog$1, DialogTitle, DialogContent, DialogActions, DialogContentText, Button as Button$1, Skeleton, IconButton as IconButton$2, InputBase, tooltipClasses as tooltipClasses$1, Badge as Badge$1, Paper, ToggleButtonGroup, ToggleButton } from "@mui/material";
|
|
48
|
+
import { useTheme as useTheme$1, useMediaQuery, Box as Box$1, Tooltip as Tooltip$1, Chip as Chip$1, alpha, ClickAwayListener, Dialog as Dialog$1, DialogTitle, DialogContent, DialogActions, DialogContentText, Button as Button$1, Divider, Skeleton, IconButton as IconButton$2, InputBase, tooltipClasses as tooltipClasses$1, Badge as Badge$1, Paper, ToggleButtonGroup, ToggleButton } from "@mui/material";
|
|
49
49
|
import NotificationsActiveOutlinedIcon from "@mui/icons-material/NotificationsActiveOutlined";
|
|
50
50
|
import CheckboxPlugin from "@blocklet/editor/lib/ext/CheckboxPlugin";
|
|
51
51
|
import DIDAddress from "@arcblock/did-connect/lib/Address";
|
|
@@ -916,9 +916,13 @@ function Badge({
|
|
|
916
916
|
] }) : null;
|
|
917
917
|
}
|
|
918
918
|
const useSessionContext = () => {
|
|
919
|
-
var _a2, _b2;
|
|
919
|
+
var _a2, _b2, _c, _d;
|
|
920
920
|
const ctx = useContext(SessionContext) || {};
|
|
921
921
|
const loginRole = (_b2 = (_a2 = ctx == null ? void 0 : ctx.session) == null ? void 0 : _a2.user) == null ? void 0 : _b2.role;
|
|
922
|
+
const permissionSet = useMemo(() => {
|
|
923
|
+
var _a3, _b3;
|
|
924
|
+
return new Set(((_b3 = (_a3 = ctx.session) == null ? void 0 : _a3.user) == null ? void 0 : _b3.permissions) || []);
|
|
925
|
+
}, [(_d = (_c = ctx.session) == null ? void 0 : _c.user) == null ? void 0 : _d.permissions]);
|
|
922
926
|
return {
|
|
923
927
|
...ctx,
|
|
924
928
|
isAdmin: ["admin", "owner"].includes(loginRole),
|
|
@@ -928,6 +932,13 @@ const useSessionContext = () => {
|
|
|
928
932
|
}
|
|
929
933
|
const passportsArr = Array.isArray(passports) ? passports : [passports];
|
|
930
934
|
return passportsArr.includes(loginRole);
|
|
935
|
+
},
|
|
936
|
+
hasAnyPermission: (perms) => {
|
|
937
|
+
if (!perms || perms.length === 0) {
|
|
938
|
+
return true;
|
|
939
|
+
}
|
|
940
|
+
const permsArr = Array.isArray(perms) ? perms : [perms];
|
|
941
|
+
return permsArr.some((item) => permissionSet.has(item));
|
|
931
942
|
}
|
|
932
943
|
};
|
|
933
944
|
};
|
|
@@ -1303,7 +1314,6 @@ function PostContent({
|
|
|
1303
1314
|
content,
|
|
1304
1315
|
editing = false,
|
|
1305
1316
|
onExitEditing,
|
|
1306
|
-
onCancel,
|
|
1307
1317
|
onSubmit,
|
|
1308
1318
|
autoCollapse,
|
|
1309
1319
|
enableHeadingsIdPlugin,
|
|
@@ -1317,7 +1327,7 @@ function PostContent({
|
|
|
1317
1327
|
sx: {
|
|
1318
1328
|
".be-editable": { maxHeight: 768, overflow: "auto", minHeight: `${Math.max(innerHeight, 200)}px !important` }
|
|
1319
1329
|
},
|
|
1320
|
-
children: /* @__PURE__ */ jsx(PostEdit, { content, onCancel, send: onSubmit, onSuccess: onExitEditing })
|
|
1330
|
+
children: /* @__PURE__ */ jsx(PostEdit, { content, onCancel: onExitEditing, send: onSubmit, onSuccess: onExitEditing })
|
|
1321
1331
|
}
|
|
1322
1332
|
);
|
|
1323
1333
|
}
|
|
@@ -1499,7 +1509,7 @@ function PostComponent({
|
|
|
1499
1509
|
return /* @__PURE__ */ jsxs(Root$1, { sx: { position: "relative", mt: 2, py: 1 }, ...rest, children: [
|
|
1500
1510
|
/* @__PURE__ */ jsxs(Box, { id: post.id, flex: "1", className: clsx({ "post-highlighted": isTargetPost && hasEnteredViewport }), children: [
|
|
1501
1511
|
/* @__PURE__ */ jsxs(Box, { display: "flex", justifyContent: "space-between", alignItems: "start", children: [
|
|
1502
|
-
/* @__PURE__ */ jsx(AuthorInfo, { user: post.author, createdAt: renderTime(), showProfileCard }),
|
|
1512
|
+
/* @__PURE__ */ jsx(AuthorInfo, { size: "sm", user: post.author, createdAt: renderTime(), showProfileCard }),
|
|
1503
1513
|
/* @__PURE__ */ jsx(Menu, { items: menuItems, style: { position: "absolute", right: 0, top: 0 } })
|
|
1504
1514
|
] }),
|
|
1505
1515
|
/* @__PURE__ */ jsxs(Box, { sx: { ml: 5.5 }, children: [
|
|
@@ -1551,6 +1561,7 @@ function PostComponent({
|
|
|
1551
1561
|
renderExtraContent && renderExtraContent(postContext)
|
|
1552
1562
|
] });
|
|
1553
1563
|
}
|
|
1564
|
+
const tablerMessageCircle = (props) => /* @__PURE__ */ jsx("svg", { viewBox: "0 0 24 24", width: "1.2em", height: "1.2em", ...props, children: /* @__PURE__ */ jsx("path", { fill: "none", stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "m3 20l1.3-3.9C1.976 12.663 2.874 8.228 6.4 5.726c3.526-2.501 8.59-2.296 11.845.48c3.255 2.777 3.695 7.266 1.029 10.501C16.608 19.942 11.659 20.922 7.7 19z" }) });
|
|
1554
1565
|
const iconoirThumbsUp = (props) => /* @__PURE__ */ jsx("svg", { viewBox: "0 0 24 24", width: "1.2em", height: "1.2em", ...props, children: /* @__PURE__ */ jsxs("g", { fill: "none", stroke: "currentColor", strokeLinecap: "round", strokeWidth: 1.5, children: [
|
|
1555
1566
|
/* @__PURE__ */ jsx("path", { d: "M16.472 20H4.1a.6.6 0 0 1-.6-.6V9.6a.6.6 0 0 1 .6-.6h2.768a2 2 0 0 0 1.715-.971l2.71-4.517a1.631 1.631 0 0 1 2.961 1.308l-1.022 3.408a.6.6 0 0 0 .574.772h4.575a2 2 0 0 1 1.93 2.526l-1.91 7A2 2 0 0 1 16.473 20Z" }),
|
|
1556
1567
|
/* @__PURE__ */ jsx("path", { strokeLinejoin: "round", d: "M7 20V9" })
|
|
@@ -1783,6 +1794,10 @@ const IconButtonRoot = styled$1("div")`
|
|
|
1783
1794
|
}
|
|
1784
1795
|
}
|
|
1785
1796
|
`;
|
|
1797
|
+
const tablerMoodPlus = (props) => /* @__PURE__ */ jsx("svg", { viewBox: "0 0 24 24", width: "1.2em", height: "1.2em", ...props, children: /* @__PURE__ */ jsxs("g", { fill: "none", stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, children: [
|
|
1798
|
+
/* @__PURE__ */ jsx("path", { d: "M20.985 12.528a9 9 0 1 0-8.45 8.456M16 19h6m-3-3v6M9 10h.01M15 10h.01" }),
|
|
1799
|
+
/* @__PURE__ */ jsx("path", { d: "M9.5 15c.658.64 1.56 1 2.5 1s1.842-.36 2.5-1" })
|
|
1800
|
+
] }) });
|
|
1786
1801
|
const emojiFont = {
|
|
1787
1802
|
fontFamily: '"Twemoji Mozilla", "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji", "EmojiOne Color"'
|
|
1788
1803
|
};
|
|
@@ -1890,10 +1905,11 @@ function GithubReaction({
|
|
|
1890
1905
|
sx: {
|
|
1891
1906
|
lineHeight: "24px",
|
|
1892
1907
|
fontSize: 13,
|
|
1908
|
+
border: 1,
|
|
1909
|
+
borderColor: "divider",
|
|
1893
1910
|
borderRadius: 1,
|
|
1894
1911
|
cursor: "pointer",
|
|
1895
1912
|
...selected && {
|
|
1896
|
-
border: 1,
|
|
1897
1913
|
borderColor: "primary.light",
|
|
1898
1914
|
bgcolor: (theme) => alpha(theme.palette.primary.light, 0.2)
|
|
1899
1915
|
}
|
|
@@ -1913,14 +1929,21 @@ function GithubReaction({
|
|
|
1913
1929
|
display: "flex",
|
|
1914
1930
|
justifyContent: "center",
|
|
1915
1931
|
alignItems: "center",
|
|
1916
|
-
|
|
1917
|
-
|
|
1918
|
-
|
|
1919
|
-
|
|
1920
|
-
|
|
1932
|
+
gap: 0.75,
|
|
1933
|
+
ml: -0.25,
|
|
1934
|
+
cursor: "pointer",
|
|
1935
|
+
fontWeight: "medium",
|
|
1936
|
+
".github-reaction-text": {
|
|
1937
|
+
color: "text.secondary"
|
|
1938
|
+
},
|
|
1939
|
+
"&:hover .github-reaction-text": {
|
|
1940
|
+
color: "secondary.main"
|
|
1941
|
+
}
|
|
1921
1942
|
},
|
|
1943
|
+
onClick: handleOpen,
|
|
1922
1944
|
children: [
|
|
1923
|
-
/* @__PURE__ */ jsx(
|
|
1945
|
+
/* @__PURE__ */ jsx(Box$1, { className: "github-reaction-text", component: tablerMoodPlus, sx: { fontSize: 18 } }),
|
|
1946
|
+
/* @__PURE__ */ jsx(Box$1, { className: "github-reaction-text", component: "span", sx: { fontSize: 13 }, children: "Sticker" }),
|
|
1924
1947
|
open && /* @__PURE__ */ jsx(ClickAwayListener, { onClickAway: () => setOpen(false), children: /* @__PURE__ */ jsx(
|
|
1925
1948
|
Box$1,
|
|
1926
1949
|
{
|
|
@@ -2104,23 +2127,36 @@ function Comment({
|
|
|
2104
2127
|
};
|
|
2105
2128
|
const render = ({ post, interactive }) => {
|
|
2106
2129
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
2107
|
-
/* @__PURE__ */
|
|
2108
|
-
|
|
2109
|
-
|
|
2110
|
-
|
|
2111
|
-
|
|
2112
|
-
|
|
2113
|
-
|
|
2114
|
-
|
|
2115
|
-
|
|
2116
|
-
|
|
2117
|
-
|
|
2118
|
-
|
|
2119
|
-
|
|
2120
|
-
|
|
2121
|
-
|
|
2122
|
-
|
|
2123
|
-
|
|
2130
|
+
/* @__PURE__ */ jsxs(Box, { sx: { display: "flex", alignItems: "center", gap: 3, mt: 1 }, children: [
|
|
2131
|
+
/* @__PURE__ */ jsx(
|
|
2132
|
+
GithubReaction,
|
|
2133
|
+
{
|
|
2134
|
+
data: (post == null ? void 0 : post.rating) || [],
|
|
2135
|
+
onRate: ({ value, ratingType }) => onRate(post, value, ratingType),
|
|
2136
|
+
onUnrate: () => onUnrate(post),
|
|
2137
|
+
interactive
|
|
2138
|
+
}
|
|
2139
|
+
),
|
|
2140
|
+
(!!(session == null ? void 0 : session.user) || preferences.displayReplyButtonForAnonymousUsers) && interactive && /* @__PURE__ */ jsxs(
|
|
2141
|
+
Box,
|
|
2142
|
+
{
|
|
2143
|
+
onClick: () => protectLogin(session, () => setInputVisible(!inputVisible)),
|
|
2144
|
+
sx: {
|
|
2145
|
+
display: "flex",
|
|
2146
|
+
alignItems: "center",
|
|
2147
|
+
gap: 0.75,
|
|
2148
|
+
fontSize: 13,
|
|
2149
|
+
color: "text.secondary",
|
|
2150
|
+
lineHeight: 1,
|
|
2151
|
+
"&:hover": { cursor: "pointer" }
|
|
2152
|
+
},
|
|
2153
|
+
children: [
|
|
2154
|
+
/* @__PURE__ */ jsx(Box, { component: tablerMessageCircle, sx: { fontSize: 18, color: "text.secondary" } }),
|
|
2155
|
+
/* @__PURE__ */ jsx(Box, { component: "span", children: "Reply" })
|
|
2156
|
+
]
|
|
2157
|
+
}
|
|
2158
|
+
)
|
|
2159
|
+
] }),
|
|
2124
2160
|
inputVisible && /* @__PURE__ */ jsx(Box, { my: 2, children: /* @__PURE__ */ jsx(
|
|
2125
2161
|
CommentInput,
|
|
2126
2162
|
{
|
|
@@ -2128,7 +2164,8 @@ function Comment({
|
|
|
2128
2164
|
onSuccess: () => setInputVisible(false),
|
|
2129
2165
|
draftKey: `post-${post.id}`
|
|
2130
2166
|
}
|
|
2131
|
-
) })
|
|
2167
|
+
) }),
|
|
2168
|
+
/* @__PURE__ */ jsx(Divider, { sx: { mt: 3 } })
|
|
2132
2169
|
] });
|
|
2133
2170
|
};
|
|
2134
2171
|
const renderExtraContent = ({ post }) => {
|
|
@@ -2708,7 +2745,7 @@ function CoverImage({
|
|
|
2708
2745
|
pt: `${100 / aspectRatio}%`,
|
|
2709
2746
|
overflow: "hidden",
|
|
2710
2747
|
position: "relative",
|
|
2711
|
-
borderRadius:
|
|
2748
|
+
borderRadius: 1,
|
|
2712
2749
|
...shadow && { boxShadow: "rgb(0 0 0 / 12%) 0px 8px 30px" },
|
|
2713
2750
|
// https://stackoverflow.com/questions/49066011/overflow-hidden-with-border-radius-not-working-on-safari
|
|
2714
2751
|
transform: "translateZ(0)"
|
|
@@ -2789,7 +2826,7 @@ function CoverImageUpload({ url, onChange, ...rest }) {
|
|
|
2789
2826
|
height: 0,
|
|
2790
2827
|
pt: "56%",
|
|
2791
2828
|
overflow: "hidden",
|
|
2792
|
-
borderRadius:
|
|
2829
|
+
borderRadius: 1,
|
|
2793
2830
|
bgcolor: "grey.300",
|
|
2794
2831
|
cursor: "pointer"
|
|
2795
2832
|
},
|
|
@@ -3276,7 +3313,7 @@ function BlogPermaLink({ slug, onChange, ...rest }) {
|
|
|
3276
3313
|
alignItems: "center",
|
|
3277
3314
|
border: "1px solid #bbb",
|
|
3278
3315
|
borderRadius: 1,
|
|
3279
|
-
|
|
3316
|
+
overflow: "hidden"
|
|
3280
3317
|
},
|
|
3281
3318
|
children: [
|
|
3282
3319
|
/* @__PURE__ */ jsx(
|
|
@@ -3285,10 +3322,10 @@ function BlogPermaLink({ slug, onChange, ...rest }) {
|
|
|
3285
3322
|
sx: {
|
|
3286
3323
|
display: "flex",
|
|
3287
3324
|
alignItems: "center",
|
|
3288
|
-
width:
|
|
3325
|
+
width: 180,
|
|
3289
3326
|
alignSelf: "stretch",
|
|
3290
|
-
px:
|
|
3291
|
-
bgcolor: "grey.
|
|
3327
|
+
px: 1.25,
|
|
3328
|
+
bgcolor: "grey.200"
|
|
3292
3329
|
},
|
|
3293
3330
|
children: /* @__PURE__ */ jsx(
|
|
3294
3331
|
Box$1,
|
|
@@ -3300,10 +3337,11 @@ function BlogPermaLink({ slug, onChange, ...rest }) {
|
|
|
3300
3337
|
width: 1,
|
|
3301
3338
|
overflow: "hidden",
|
|
3302
3339
|
whiteSpace: "nowrap",
|
|
3303
|
-
fontSize: 14,
|
|
3304
3340
|
border: 0,
|
|
3305
3341
|
bgcolor: "inherit",
|
|
3306
|
-
outline: "none"
|
|
3342
|
+
outline: "none",
|
|
3343
|
+
fontSize: 14,
|
|
3344
|
+
color: "text.secondary"
|
|
3307
3345
|
}
|
|
3308
3346
|
}
|
|
3309
3347
|
)
|
|
@@ -3312,20 +3350,19 @@ function BlogPermaLink({ slug, onChange, ...rest }) {
|
|
|
3312
3350
|
/* @__PURE__ */ jsx(
|
|
3313
3351
|
InputBase,
|
|
3314
3352
|
{
|
|
3315
|
-
className: "blog-link",
|
|
3316
3353
|
value: slug,
|
|
3317
3354
|
onChange: (e) => onChange(e.target.value),
|
|
3318
|
-
sx: { ml:
|
|
3355
|
+
sx: { ml: 0.5, flex: 1, bgcolor: "transparent", input: { py: 1, fontSize: 14 } }
|
|
3319
3356
|
}
|
|
3320
3357
|
),
|
|
3321
3358
|
/* @__PURE__ */ jsx(
|
|
3322
3359
|
IconButton$2,
|
|
3323
3360
|
{
|
|
3324
|
-
sx: {
|
|
3361
|
+
sx: { px: 1 },
|
|
3325
3362
|
onClick: () => {
|
|
3326
3363
|
copy(joinUrl(prefix, slug));
|
|
3327
3364
|
},
|
|
3328
|
-
children: /* @__PURE__ */ jsx(ContentCopy, { sx: { fontSize:
|
|
3365
|
+
children: /* @__PURE__ */ jsx(ContentCopy, { sx: { fontSize: 18 } })
|
|
3329
3366
|
}
|
|
3330
3367
|
)
|
|
3331
3368
|
]
|
|
@@ -4366,7 +4403,7 @@ const PreviousLocationRecorder = () => {
|
|
|
4366
4403
|
};
|
|
4367
4404
|
function Back({ url, fallbackUrl, iconOnly, sx, ...rest }) {
|
|
4368
4405
|
const navigate = useNavigate();
|
|
4369
|
-
const mergedSx = [{
|
|
4406
|
+
const mergedSx = [{}, ...Array.isArray(sx) ? sx : [sx]];
|
|
4370
4407
|
const handleClick = () => {
|
|
4371
4408
|
if (url) {
|
|
4372
4409
|
navigate(url, { replace: true });
|
|
@@ -4385,8 +4422,7 @@ function Back({ url, fallbackUrl, iconOnly, sx, ...rest }) {
|
|
|
4385
4422
|
{
|
|
4386
4423
|
onClick: handleClick,
|
|
4387
4424
|
variant: "outlined",
|
|
4388
|
-
color: "
|
|
4389
|
-
size: "small",
|
|
4425
|
+
color: "primary",
|
|
4390
4426
|
startIcon: /* @__PURE__ */ jsx(ArrowBackIos, { style: { fontSize: 13 } }),
|
|
4391
4427
|
sx: mergedSx,
|
|
4392
4428
|
...rest,
|
|
@@ -5093,7 +5129,7 @@ function Pagination({
|
|
|
5093
5129
|
}
|
|
5094
5130
|
);
|
|
5095
5131
|
}
|
|
5096
|
-
const Editor = lazy(() => import("./editor-
|
|
5132
|
+
const Editor = lazy(() => import("./editor-2xtEiiWT.mjs"));
|
|
5097
5133
|
function LazyEditor(props) {
|
|
5098
5134
|
const fallback = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
5099
5135
|
/* @__PURE__ */ jsx(Skeleton, {}),
|
|
@@ -11259,83 +11295,84 @@ function SegmentedControl({ value, options, onChange, sx, ...rest }) {
|
|
|
11259
11295
|
) });
|
|
11260
11296
|
}
|
|
11261
11297
|
export {
|
|
11262
|
-
|
|
11298
|
+
useUnreadNotification as $,
|
|
11263
11299
|
Avatar as A,
|
|
11264
11300
|
Badge as B,
|
|
11265
11301
|
CommentInput as C,
|
|
11266
11302
|
DefaultEditorConfigProvider as D,
|
|
11267
11303
|
EmptyStatus as E,
|
|
11268
|
-
|
|
11304
|
+
BlogListWrapper as F,
|
|
11269
11305
|
GithubReaction as G,
|
|
11270
|
-
|
|
11306
|
+
BlogCard as H,
|
|
11271
11307
|
ImagePathFixerPlugin as I,
|
|
11272
|
-
|
|
11273
|
-
|
|
11274
|
-
|
|
11308
|
+
BlogPermaLink as J,
|
|
11309
|
+
getBlogLink as K,
|
|
11310
|
+
CoverImage as L,
|
|
11275
11311
|
Menu as M,
|
|
11276
|
-
|
|
11277
|
-
|
|
11312
|
+
CoverImageUpload as N,
|
|
11313
|
+
AccessControl as O,
|
|
11278
11314
|
Pagination as P,
|
|
11279
|
-
|
|
11315
|
+
useAuthzContext as Q,
|
|
11280
11316
|
RelativeTime as R,
|
|
11281
11317
|
ScrollableEditorWrapper as S,
|
|
11282
|
-
|
|
11283
|
-
|
|
11318
|
+
AuthzProvider as T,
|
|
11319
|
+
ChatClient as U,
|
|
11284
11320
|
VideoPathFixerPlugin as V,
|
|
11285
|
-
|
|
11286
|
-
|
|
11287
|
-
|
|
11288
|
-
|
|
11289
|
-
|
|
11321
|
+
Chat as W,
|
|
11322
|
+
ChatHeaderAddon as X,
|
|
11323
|
+
useChatContext as Y,
|
|
11324
|
+
ChatProvider as Z,
|
|
11325
|
+
UnreadNotificationContext as _,
|
|
11290
11326
|
isEmptyContent as a,
|
|
11291
|
-
|
|
11292
|
-
|
|
11293
|
-
|
|
11294
|
-
|
|
11295
|
-
|
|
11296
|
-
|
|
11297
|
-
|
|
11298
|
-
|
|
11299
|
-
|
|
11300
|
-
|
|
11301
|
-
|
|
11302
|
-
|
|
11303
|
-
|
|
11304
|
-
|
|
11305
|
-
|
|
11306
|
-
|
|
11307
|
-
|
|
11308
|
-
|
|
11309
|
-
|
|
11310
|
-
|
|
11311
|
-
|
|
11312
|
-
|
|
11313
|
-
|
|
11314
|
-
|
|
11315
|
-
|
|
11327
|
+
UnreadNotificationProvider as a0,
|
|
11328
|
+
Confirm as a1,
|
|
11329
|
+
ConfirmContext as a2,
|
|
11330
|
+
useConfirm as a3,
|
|
11331
|
+
ConfirmProvider as a4,
|
|
11332
|
+
SecureLabelPicker as a5,
|
|
11333
|
+
useApiErrorHandler as a6,
|
|
11334
|
+
useDefaultApiErrorHandler as a7,
|
|
11335
|
+
PreviousLocationRecorder as a8,
|
|
11336
|
+
Back as a9,
|
|
11337
|
+
LazyEditor as aa,
|
|
11338
|
+
EditorPreview as ab,
|
|
11339
|
+
DirtyPromptContainer as ac,
|
|
11340
|
+
ConfirmNavigation as ad,
|
|
11341
|
+
UploaderContext as ae,
|
|
11342
|
+
useUploader as af,
|
|
11343
|
+
UploaderTrigger as ag,
|
|
11344
|
+
UploaderProvider as ah,
|
|
11345
|
+
composeImageUrl as ai,
|
|
11346
|
+
usePointUpContext as aj,
|
|
11347
|
+
PointUpProvider as ak,
|
|
11348
|
+
ButtonGroup as al,
|
|
11349
|
+
SegmentedControl as am,
|
|
11350
|
+
create as an,
|
|
11351
|
+
getWsClient as ao,
|
|
11352
|
+
useSubscription as ap,
|
|
11316
11353
|
Input as b,
|
|
11317
11354
|
useChanged as c,
|
|
11318
|
-
|
|
11319
|
-
|
|
11320
|
-
|
|
11355
|
+
useSessionContext as d,
|
|
11356
|
+
utils as e,
|
|
11357
|
+
themeOverrides as f,
|
|
11321
11358
|
getExcerptSync as g,
|
|
11322
|
-
|
|
11359
|
+
InternalThemeProvider as h,
|
|
11323
11360
|
inferInitialEditorState as i,
|
|
11324
|
-
|
|
11325
|
-
|
|
11361
|
+
Avatars as j,
|
|
11362
|
+
AuthorInfo as k,
|
|
11326
11363
|
lexical as l,
|
|
11327
|
-
|
|
11328
|
-
|
|
11329
|
-
|
|
11364
|
+
SystemUser as m,
|
|
11365
|
+
PostContent as n,
|
|
11366
|
+
PostComponent as o,
|
|
11330
11367
|
preferences as p,
|
|
11331
|
-
|
|
11368
|
+
Comment as q,
|
|
11332
11369
|
routes as r,
|
|
11333
11370
|
stringify as s,
|
|
11334
11371
|
translations as t,
|
|
11335
11372
|
useNow as u,
|
|
11336
|
-
|
|
11337
|
-
|
|
11338
|
-
|
|
11339
|
-
|
|
11340
|
-
|
|
11373
|
+
CommentList as v,
|
|
11374
|
+
CommentsContext as w,
|
|
11375
|
+
useCommentsContext as x,
|
|
11376
|
+
CommentsProvider as y,
|
|
11377
|
+
BinaryThumb as z
|
|
11341
11378
|
};
|
package/dist/index.d.ts
CHANGED
|
@@ -18,7 +18,7 @@ export * from './components/editor';
|
|
|
18
18
|
export * as lexicalUtils from './components/lexical';
|
|
19
19
|
export * from './components/dirty-prompt';
|
|
20
20
|
export { translations } from './components/locale';
|
|
21
|
-
export { useNow, useChanged } from './components/hooks';
|
|
21
|
+
export { useNow, useChanged, useSessionContext } from './components/hooks';
|
|
22
22
|
export * as utils from './components/utils';
|
|
23
23
|
export * as routes from './components/routes';
|
|
24
24
|
export { default as preferences } from './preferences';
|
package/dist/index.es.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export * from "@blocklet/labels";
|
|
2
|
-
import {
|
|
2
|
+
import { O, k, T, A, j, a9, B, z, H, F, J, al, W, U, X, Z, q, C, v, w, y, a1, a2, ad, a4, L, N, D, ac, ab, E, G, b, h, aa, M, P, ak, o, n, a8, R, S, a5, am, m, _, a0, ae, ah, ag, ai, an, K, ao, l, p, r, f, t, a6, Q, c, Y, x, a3, a7, u, aj, d, ap, $, af, e } from "./index-XoHU_Puz.mjs";
|
|
3
3
|
import "react/jsx-runtime";
|
|
4
4
|
import "react";
|
|
5
5
|
import "@mui/material/Box";
|
|
@@ -7,7 +7,6 @@ import "@mui/material/Button";
|
|
|
7
7
|
import "@mui/lab/LoadingButton";
|
|
8
8
|
import "@mui/icons-material";
|
|
9
9
|
import "@arcblock/ux/lib/Locale/context";
|
|
10
|
-
import "@arcblock/did-connect/lib/Session";
|
|
11
10
|
import "@mui/material";
|
|
12
11
|
import "@mui/material/styles";
|
|
13
12
|
import "lodash/isNil";
|
|
@@ -40,6 +39,7 @@ import "@mui/material/Avatar";
|
|
|
40
39
|
import "@mui/icons-material/BrokenImage";
|
|
41
40
|
import "@iconify/react";
|
|
42
41
|
import "@arcblock/ux/lib/Empty";
|
|
42
|
+
import "@arcblock/did-connect/lib/Session";
|
|
43
43
|
import "@mui/icons-material/NotificationsActiveOutlined";
|
|
44
44
|
import "@blocklet/editor/lib/ext/CheckboxPlugin";
|
|
45
45
|
import "@arcblock/did-connect/lib/Address";
|
|
@@ -71,77 +71,78 @@ import "js-cookie";
|
|
|
71
71
|
import "@arcblock/ws";
|
|
72
72
|
import "@emotion/css";
|
|
73
73
|
export {
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
74
|
+
O as AccessControl,
|
|
75
|
+
k as AuthorInfo,
|
|
76
|
+
T as AuthzProvider,
|
|
77
77
|
A as Avatar,
|
|
78
|
-
|
|
79
|
-
|
|
78
|
+
j as Avatars,
|
|
79
|
+
a9 as Back,
|
|
80
80
|
B as Badge,
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
81
|
+
z as BinaryThumb,
|
|
82
|
+
H as BlogCard,
|
|
83
|
+
F as BlogList,
|
|
84
|
+
J as BlogPermaLink,
|
|
85
|
+
al as ButtonGroup,
|
|
86
|
+
W as Chat,
|
|
87
|
+
U as ChatClient,
|
|
88
|
+
X as ChatHeaderAddon,
|
|
89
|
+
Z as ChatProvider,
|
|
90
|
+
q as Comment,
|
|
91
91
|
C as CommentInput,
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
92
|
+
v as CommentList,
|
|
93
|
+
w as CommentsContext,
|
|
94
|
+
y as CommentsProvider,
|
|
95
|
+
a1 as Confirm,
|
|
96
|
+
a2 as ConfirmContext,
|
|
97
|
+
ad as ConfirmNavigation,
|
|
98
|
+
a4 as ConfirmProvider,
|
|
99
|
+
L as CoverImage,
|
|
100
|
+
N as CoverImageUpload,
|
|
101
101
|
D as DefaultEditorConfigProvider,
|
|
102
|
-
|
|
103
|
-
|
|
102
|
+
ac as DirtyPromptContainer,
|
|
103
|
+
ab as EditorPreview,
|
|
104
104
|
E as EmptyStatus,
|
|
105
105
|
G as GithubReaction,
|
|
106
106
|
b as Input,
|
|
107
|
-
|
|
108
|
-
|
|
107
|
+
h as InternalThemeProvider,
|
|
108
|
+
aa as LazyEditor,
|
|
109
109
|
M as Menu,
|
|
110
110
|
P as Pagination,
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
111
|
+
ak as PointUpProvider,
|
|
112
|
+
o as Post,
|
|
113
|
+
n as PostContent,
|
|
114
|
+
a8 as PreviousLocationRecorder,
|
|
115
115
|
R as RelativeTime,
|
|
116
116
|
S as ScrollableEditorWrapper,
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
117
|
+
a5 as SecureLabelPicker,
|
|
118
|
+
am as SegmentedControl,
|
|
119
|
+
m as SystemUser,
|
|
120
|
+
_ as UnreadNotificationContext,
|
|
121
|
+
a0 as UnreadNotificationProvider,
|
|
122
|
+
ae as UploaderContext,
|
|
123
|
+
ah as UploaderProvider,
|
|
124
|
+
ag as UploaderTrigger,
|
|
125
|
+
ai as composeImageUrl,
|
|
126
|
+
an as create,
|
|
127
|
+
K as getBlogLink,
|
|
128
|
+
ao as getWsClient,
|
|
129
129
|
l as lexicalUtils,
|
|
130
130
|
p as preferences,
|
|
131
131
|
r as routes,
|
|
132
|
-
|
|
132
|
+
f as themeOverrides,
|
|
133
133
|
t as translations,
|
|
134
|
-
|
|
135
|
-
|
|
134
|
+
a6 as useApiErrorHandler,
|
|
135
|
+
Q as useAuthzContext,
|
|
136
136
|
c as useChanged,
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
137
|
+
Y as useChatContext,
|
|
138
|
+
x as useCommentsContext,
|
|
139
|
+
a3 as useConfirm,
|
|
140
|
+
a7 as useDefaultApiErrorHandler,
|
|
141
141
|
u as useNow,
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
142
|
+
aj as usePointUpContext,
|
|
143
|
+
d as useSessionContext,
|
|
144
|
+
ap as useSubscription,
|
|
145
|
+
$ as useUnreadNotification,
|
|
146
|
+
af as useUploader,
|
|
147
|
+
e as utils
|
|
147
148
|
};
|
package/dist/index.umd.js
CHANGED
|
@@ -849,9 +849,13 @@ var __publicField = (obj, key, value) => {
|
|
|
849
849
|
] }) : null;
|
|
850
850
|
}
|
|
851
851
|
const useSessionContext = () => {
|
|
852
|
-
var _a2, _b2;
|
|
852
|
+
var _a2, _b2, _c, _d;
|
|
853
853
|
const ctx = react.useContext(Session.SessionContext) || {};
|
|
854
854
|
const loginRole = (_b2 = (_a2 = ctx == null ? void 0 : ctx.session) == null ? void 0 : _a2.user) == null ? void 0 : _b2.role;
|
|
855
|
+
const permissionSet = react.useMemo(() => {
|
|
856
|
+
var _a3, _b3;
|
|
857
|
+
return new Set(((_b3 = (_a3 = ctx.session) == null ? void 0 : _a3.user) == null ? void 0 : _b3.permissions) || []);
|
|
858
|
+
}, [(_d = (_c = ctx.session) == null ? void 0 : _c.user) == null ? void 0 : _d.permissions]);
|
|
855
859
|
return {
|
|
856
860
|
...ctx,
|
|
857
861
|
isAdmin: ["admin", "owner"].includes(loginRole),
|
|
@@ -861,6 +865,13 @@ var __publicField = (obj, key, value) => {
|
|
|
861
865
|
}
|
|
862
866
|
const passportsArr = Array.isArray(passports) ? passports : [passports];
|
|
863
867
|
return passportsArr.includes(loginRole);
|
|
868
|
+
},
|
|
869
|
+
hasAnyPermission: (perms) => {
|
|
870
|
+
if (!perms || perms.length === 0) {
|
|
871
|
+
return true;
|
|
872
|
+
}
|
|
873
|
+
const permsArr = Array.isArray(perms) ? perms : [perms];
|
|
874
|
+
return permsArr.some((item) => permissionSet.has(item));
|
|
864
875
|
}
|
|
865
876
|
};
|
|
866
877
|
};
|
|
@@ -1236,7 +1247,6 @@ var __publicField = (obj, key, value) => {
|
|
|
1236
1247
|
content,
|
|
1237
1248
|
editing = false,
|
|
1238
1249
|
onExitEditing,
|
|
1239
|
-
onCancel,
|
|
1240
1250
|
onSubmit,
|
|
1241
1251
|
autoCollapse,
|
|
1242
1252
|
enableHeadingsIdPlugin,
|
|
@@ -1250,7 +1260,7 @@ var __publicField = (obj, key, value) => {
|
|
|
1250
1260
|
sx: {
|
|
1251
1261
|
".be-editable": { maxHeight: 768, overflow: "auto", minHeight: `${Math.max(innerHeight, 200)}px !important` }
|
|
1252
1262
|
},
|
|
1253
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(PostEdit, { content, onCancel, send: onSubmit, onSuccess: onExitEditing })
|
|
1263
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(PostEdit, { content, onCancel: onExitEditing, send: onSubmit, onSuccess: onExitEditing })
|
|
1254
1264
|
}
|
|
1255
1265
|
);
|
|
1256
1266
|
}
|
|
@@ -1432,7 +1442,7 @@ var __publicField = (obj, key, value) => {
|
|
|
1432
1442
|
return /* @__PURE__ */ jsxRuntime.jsxs(Root$2, { sx: { position: "relative", mt: 2, py: 1 }, ...rest, children: [
|
|
1433
1443
|
/* @__PURE__ */ jsxRuntime.jsxs(Box, { id: post.id, flex: "1", className: clsx({ "post-highlighted": isTargetPost && hasEnteredViewport }), children: [
|
|
1434
1444
|
/* @__PURE__ */ jsxRuntime.jsxs(Box, { display: "flex", justifyContent: "space-between", alignItems: "start", children: [
|
|
1435
|
-
/* @__PURE__ */ jsxRuntime.jsx(AuthorInfo, { user: post.author, createdAt: renderTime(), showProfileCard }),
|
|
1445
|
+
/* @__PURE__ */ jsxRuntime.jsx(AuthorInfo, { size: "sm", user: post.author, createdAt: renderTime(), showProfileCard }),
|
|
1436
1446
|
/* @__PURE__ */ jsxRuntime.jsx(Menu, { items: menuItems, style: { position: "absolute", right: 0, top: 0 } })
|
|
1437
1447
|
] }),
|
|
1438
1448
|
/* @__PURE__ */ jsxRuntime.jsxs(Box, { sx: { ml: 5.5 }, children: [
|
|
@@ -1484,6 +1494,7 @@ var __publicField = (obj, key, value) => {
|
|
|
1484
1494
|
renderExtraContent && renderExtraContent(postContext)
|
|
1485
1495
|
] });
|
|
1486
1496
|
}
|
|
1497
|
+
const tablerMessageCircle = (props) => /* @__PURE__ */ jsxRuntime.jsx("svg", { viewBox: "0 0 24 24", width: "1.2em", height: "1.2em", ...props, children: /* @__PURE__ */ jsxRuntime.jsx("path", { fill: "none", stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "m3 20l1.3-3.9C1.976 12.663 2.874 8.228 6.4 5.726c3.526-2.501 8.59-2.296 11.845.48c3.255 2.777 3.695 7.266 1.029 10.501C16.608 19.942 11.659 20.922 7.7 19z" }) });
|
|
1487
1498
|
const iconoirThumbsUp = (props) => /* @__PURE__ */ jsxRuntime.jsx("svg", { viewBox: "0 0 24 24", width: "1.2em", height: "1.2em", ...props, children: /* @__PURE__ */ jsxRuntime.jsxs("g", { fill: "none", stroke: "currentColor", strokeLinecap: "round", strokeWidth: 1.5, children: [
|
|
1488
1499
|
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M16.472 20H4.1a.6.6 0 0 1-.6-.6V9.6a.6.6 0 0 1 .6-.6h2.768a2 2 0 0 0 1.715-.971l2.71-4.517a1.631 1.631 0 0 1 2.961 1.308l-1.022 3.408a.6.6 0 0 0 .574.772h4.575a2 2 0 0 1 1.93 2.526l-1.91 7A2 2 0 0 1 16.473 20Z" }),
|
|
1489
1500
|
/* @__PURE__ */ jsxRuntime.jsx("path", { strokeLinejoin: "round", d: "M7 20V9" })
|
|
@@ -1716,6 +1727,10 @@ var __publicField = (obj, key, value) => {
|
|
|
1716
1727
|
}
|
|
1717
1728
|
}
|
|
1718
1729
|
`;
|
|
1730
|
+
const tablerMoodPlus = (props) => /* @__PURE__ */ jsxRuntime.jsx("svg", { viewBox: "0 0 24 24", width: "1.2em", height: "1.2em", ...props, children: /* @__PURE__ */ jsxRuntime.jsxs("g", { fill: "none", stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, children: [
|
|
1731
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M20.985 12.528a9 9 0 1 0-8.45 8.456M16 19h6m-3-3v6M9 10h.01M15 10h.01" }),
|
|
1732
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M9.5 15c.658.64 1.56 1 2.5 1s1.842-.36 2.5-1" })
|
|
1733
|
+
] }) });
|
|
1719
1734
|
const emojiFont = {
|
|
1720
1735
|
fontFamily: '"Twemoji Mozilla", "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji", "EmojiOne Color"'
|
|
1721
1736
|
};
|
|
@@ -1823,10 +1838,11 @@ var __publicField = (obj, key, value) => {
|
|
|
1823
1838
|
sx: {
|
|
1824
1839
|
lineHeight: "24px",
|
|
1825
1840
|
fontSize: 13,
|
|
1841
|
+
border: 1,
|
|
1842
|
+
borderColor: "divider",
|
|
1826
1843
|
borderRadius: 1,
|
|
1827
1844
|
cursor: "pointer",
|
|
1828
1845
|
...selected && {
|
|
1829
|
-
border: 1,
|
|
1830
1846
|
borderColor: "primary.light",
|
|
1831
1847
|
bgcolor: (theme) => material.alpha(theme.palette.primary.light, 0.2)
|
|
1832
1848
|
}
|
|
@@ -1846,14 +1862,21 @@ var __publicField = (obj, key, value) => {
|
|
|
1846
1862
|
display: "flex",
|
|
1847
1863
|
justifyContent: "center",
|
|
1848
1864
|
alignItems: "center",
|
|
1849
|
-
|
|
1850
|
-
|
|
1851
|
-
|
|
1852
|
-
|
|
1853
|
-
|
|
1865
|
+
gap: 0.75,
|
|
1866
|
+
ml: -0.25,
|
|
1867
|
+
cursor: "pointer",
|
|
1868
|
+
fontWeight: "medium",
|
|
1869
|
+
".github-reaction-text": {
|
|
1870
|
+
color: "text.secondary"
|
|
1871
|
+
},
|
|
1872
|
+
"&:hover .github-reaction-text": {
|
|
1873
|
+
color: "secondary.main"
|
|
1874
|
+
}
|
|
1854
1875
|
},
|
|
1876
|
+
onClick: handleOpen,
|
|
1855
1877
|
children: [
|
|
1856
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1878
|
+
/* @__PURE__ */ jsxRuntime.jsx(material.Box, { className: "github-reaction-text", component: tablerMoodPlus, sx: { fontSize: 18 } }),
|
|
1879
|
+
/* @__PURE__ */ jsxRuntime.jsx(material.Box, { className: "github-reaction-text", component: "span", sx: { fontSize: 13 }, children: "Sticker" }),
|
|
1857
1880
|
open && /* @__PURE__ */ jsxRuntime.jsx(material.ClickAwayListener, { onClickAway: () => setOpen(false), children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1858
1881
|
material.Box,
|
|
1859
1882
|
{
|
|
@@ -2037,23 +2060,36 @@ var __publicField = (obj, key, value) => {
|
|
|
2037
2060
|
};
|
|
2038
2061
|
const render = ({ post, interactive }) => {
|
|
2039
2062
|
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
2040
|
-
/* @__PURE__ */ jsxRuntime.
|
|
2041
|
-
|
|
2042
|
-
|
|
2043
|
-
|
|
2044
|
-
|
|
2045
|
-
|
|
2046
|
-
|
|
2047
|
-
|
|
2048
|
-
|
|
2049
|
-
|
|
2050
|
-
|
|
2051
|
-
|
|
2052
|
-
|
|
2053
|
-
|
|
2054
|
-
|
|
2055
|
-
|
|
2056
|
-
|
|
2063
|
+
/* @__PURE__ */ jsxRuntime.jsxs(Box, { sx: { display: "flex", alignItems: "center", gap: 3, mt: 1 }, children: [
|
|
2064
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2065
|
+
GithubReaction,
|
|
2066
|
+
{
|
|
2067
|
+
data: (post == null ? void 0 : post.rating) || [],
|
|
2068
|
+
onRate: ({ value, ratingType }) => onRate(post, value, ratingType),
|
|
2069
|
+
onUnrate: () => onUnrate(post),
|
|
2070
|
+
interactive
|
|
2071
|
+
}
|
|
2072
|
+
),
|
|
2073
|
+
(!!(session == null ? void 0 : session.user) || preferences.displayReplyButtonForAnonymousUsers) && interactive && /* @__PURE__ */ jsxRuntime.jsxs(
|
|
2074
|
+
Box,
|
|
2075
|
+
{
|
|
2076
|
+
onClick: () => protectLogin(session, () => setInputVisible(!inputVisible)),
|
|
2077
|
+
sx: {
|
|
2078
|
+
display: "flex",
|
|
2079
|
+
alignItems: "center",
|
|
2080
|
+
gap: 0.75,
|
|
2081
|
+
fontSize: 13,
|
|
2082
|
+
color: "text.secondary",
|
|
2083
|
+
lineHeight: 1,
|
|
2084
|
+
"&:hover": { cursor: "pointer" }
|
|
2085
|
+
},
|
|
2086
|
+
children: [
|
|
2087
|
+
/* @__PURE__ */ jsxRuntime.jsx(Box, { component: tablerMessageCircle, sx: { fontSize: 18, color: "text.secondary" } }),
|
|
2088
|
+
/* @__PURE__ */ jsxRuntime.jsx(Box, { component: "span", children: "Reply" })
|
|
2089
|
+
]
|
|
2090
|
+
}
|
|
2091
|
+
)
|
|
2092
|
+
] }),
|
|
2057
2093
|
inputVisible && /* @__PURE__ */ jsxRuntime.jsx(Box, { my: 2, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2058
2094
|
CommentInput,
|
|
2059
2095
|
{
|
|
@@ -2061,7 +2097,8 @@ var __publicField = (obj, key, value) => {
|
|
|
2061
2097
|
onSuccess: () => setInputVisible(false),
|
|
2062
2098
|
draftKey: `post-${post.id}`
|
|
2063
2099
|
}
|
|
2064
|
-
) })
|
|
2100
|
+
) }),
|
|
2101
|
+
/* @__PURE__ */ jsxRuntime.jsx(material.Divider, { sx: { mt: 3 } })
|
|
2065
2102
|
] });
|
|
2066
2103
|
};
|
|
2067
2104
|
const renderExtraContent = ({ post }) => {
|
|
@@ -2641,7 +2678,7 @@ var __publicField = (obj, key, value) => {
|
|
|
2641
2678
|
pt: `${100 / aspectRatio}%`,
|
|
2642
2679
|
overflow: "hidden",
|
|
2643
2680
|
position: "relative",
|
|
2644
|
-
borderRadius:
|
|
2681
|
+
borderRadius: 1,
|
|
2645
2682
|
...shadow && { boxShadow: "rgb(0 0 0 / 12%) 0px 8px 30px" },
|
|
2646
2683
|
// https://stackoverflow.com/questions/49066011/overflow-hidden-with-border-radius-not-working-on-safari
|
|
2647
2684
|
transform: "translateZ(0)"
|
|
@@ -2722,7 +2759,7 @@ var __publicField = (obj, key, value) => {
|
|
|
2722
2759
|
height: 0,
|
|
2723
2760
|
pt: "56%",
|
|
2724
2761
|
overflow: "hidden",
|
|
2725
|
-
borderRadius:
|
|
2762
|
+
borderRadius: 1,
|
|
2726
2763
|
bgcolor: "grey.300",
|
|
2727
2764
|
cursor: "pointer"
|
|
2728
2765
|
},
|
|
@@ -3209,7 +3246,7 @@ var __publicField = (obj, key, value) => {
|
|
|
3209
3246
|
alignItems: "center",
|
|
3210
3247
|
border: "1px solid #bbb",
|
|
3211
3248
|
borderRadius: 1,
|
|
3212
|
-
|
|
3249
|
+
overflow: "hidden"
|
|
3213
3250
|
},
|
|
3214
3251
|
children: [
|
|
3215
3252
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -3218,10 +3255,10 @@ var __publicField = (obj, key, value) => {
|
|
|
3218
3255
|
sx: {
|
|
3219
3256
|
display: "flex",
|
|
3220
3257
|
alignItems: "center",
|
|
3221
|
-
width:
|
|
3258
|
+
width: 180,
|
|
3222
3259
|
alignSelf: "stretch",
|
|
3223
|
-
px:
|
|
3224
|
-
bgcolor: "grey.
|
|
3260
|
+
px: 1.25,
|
|
3261
|
+
bgcolor: "grey.200"
|
|
3225
3262
|
},
|
|
3226
3263
|
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
3227
3264
|
material.Box,
|
|
@@ -3233,10 +3270,11 @@ var __publicField = (obj, key, value) => {
|
|
|
3233
3270
|
width: 1,
|
|
3234
3271
|
overflow: "hidden",
|
|
3235
3272
|
whiteSpace: "nowrap",
|
|
3236
|
-
fontSize: 14,
|
|
3237
3273
|
border: 0,
|
|
3238
3274
|
bgcolor: "inherit",
|
|
3239
|
-
outline: "none"
|
|
3275
|
+
outline: "none",
|
|
3276
|
+
fontSize: 14,
|
|
3277
|
+
color: "text.secondary"
|
|
3240
3278
|
}
|
|
3241
3279
|
}
|
|
3242
3280
|
)
|
|
@@ -3245,20 +3283,19 @@ var __publicField = (obj, key, value) => {
|
|
|
3245
3283
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3246
3284
|
material.InputBase,
|
|
3247
3285
|
{
|
|
3248
|
-
className: "blog-link",
|
|
3249
3286
|
value: slug,
|
|
3250
3287
|
onChange: (e) => onChange(e.target.value),
|
|
3251
|
-
sx: { ml:
|
|
3288
|
+
sx: { ml: 0.5, flex: 1, bgcolor: "transparent", input: { py: 1, fontSize: 14 } }
|
|
3252
3289
|
}
|
|
3253
3290
|
),
|
|
3254
3291
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3255
3292
|
material.IconButton,
|
|
3256
3293
|
{
|
|
3257
|
-
sx: {
|
|
3294
|
+
sx: { px: 1 },
|
|
3258
3295
|
onClick: () => {
|
|
3259
3296
|
copy(joinUrl(prefix, slug));
|
|
3260
3297
|
},
|
|
3261
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(iconsMaterial.ContentCopy, { sx: { fontSize:
|
|
3298
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(iconsMaterial.ContentCopy, { sx: { fontSize: 18 } })
|
|
3262
3299
|
}
|
|
3263
3300
|
)
|
|
3264
3301
|
]
|
|
@@ -4299,7 +4336,7 @@ var __publicField = (obj, key, value) => {
|
|
|
4299
4336
|
};
|
|
4300
4337
|
function Back({ url, fallbackUrl, iconOnly, sx, ...rest }) {
|
|
4301
4338
|
const navigate = reactRouterDom.useNavigate();
|
|
4302
|
-
const mergedSx = [{
|
|
4339
|
+
const mergedSx = [{}, ...Array.isArray(sx) ? sx : [sx]];
|
|
4303
4340
|
const handleClick = () => {
|
|
4304
4341
|
if (url) {
|
|
4305
4342
|
navigate(url, { replace: true });
|
|
@@ -4318,8 +4355,7 @@ var __publicField = (obj, key, value) => {
|
|
|
4318
4355
|
{
|
|
4319
4356
|
onClick: handleClick,
|
|
4320
4357
|
variant: "outlined",
|
|
4321
|
-
color: "
|
|
4322
|
-
size: "small",
|
|
4358
|
+
color: "primary",
|
|
4323
4359
|
startIcon: /* @__PURE__ */ jsxRuntime.jsx(iconsMaterial.ArrowBackIos, { style: { fontSize: 13 } }),
|
|
4324
4360
|
sx: mergedSx,
|
|
4325
4361
|
...rest,
|
|
@@ -11291,6 +11327,7 @@ var __publicField = (obj, key, value) => {
|
|
|
11291
11327
|
exports2.useDefaultApiErrorHandler = useDefaultApiErrorHandler;
|
|
11292
11328
|
exports2.useNow = useNow;
|
|
11293
11329
|
exports2.usePointUpContext = usePointUpContext;
|
|
11330
|
+
exports2.useSessionContext = useSessionContext;
|
|
11294
11331
|
exports2.useSubscription = useSubscription;
|
|
11295
11332
|
exports2.useUnreadNotification = useUnreadNotification;
|
|
11296
11333
|
exports2.useUploader = useUploader;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@blocklet/discuss-kit-ux",
|
|
3
|
-
"version": "1.6.
|
|
3
|
+
"version": "1.6.189",
|
|
4
4
|
"files": [
|
|
5
5
|
"dist"
|
|
6
6
|
],
|
|
@@ -29,8 +29,8 @@
|
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
31
|
"@arcblock/ws": "^1.18.113",
|
|
32
|
-
"@blocklet/editor": "1.6.
|
|
33
|
-
"@blocklet/labels": "1.6.
|
|
32
|
+
"@blocklet/editor": "1.6.189",
|
|
33
|
+
"@blocklet/labels": "1.6.189",
|
|
34
34
|
"@blocklet/uploader": "^0.0.75",
|
|
35
35
|
"@emotion/css": "^11.10.5",
|
|
36
36
|
"@emotion/react": "^11.10.5",
|
|
@@ -94,5 +94,5 @@
|
|
|
94
94
|
"resolutions": {
|
|
95
95
|
"react": "^18.2.0"
|
|
96
96
|
},
|
|
97
|
-
"gitHead": "
|
|
97
|
+
"gitHead": "9dc3cda97f297d5f4818c0b7a7e0daa1e588d1dd"
|
|
98
98
|
}
|