@blocklet/discuss-kit-ux 2.1.206 → 2.1.208
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-Cm1TeDDQ.mjs";
|
|
8
8
|
const BlockletEditor = lazyRetry(() => import("@blocklet/editor"));
|
|
9
9
|
const Root = styled(Box)`
|
|
10
10
|
.be-editable,
|
|
@@ -7,7 +7,7 @@ import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
|
7
7
|
import { useTheme, ThemeProvider, styled as styled$2 } from "@mui/material/styles";
|
|
8
8
|
import { create as create$1, styled } from "@arcblock/ux/lib/Theme";
|
|
9
9
|
import { useEffect, useRef, useState, createElement, useContext, useMemo, useLayoutEffect, useCallback, isValidElement, Suspense, createContext, Fragment as Fragment$1, forwardRef, useImperativeHandle } from "react";
|
|
10
|
-
import { Box, useTheme as useTheme$1, useMediaQuery, styled as styled$1, Button as Button$1, Stack as Stack$1, Tooltip as Tooltip$1, Chip as Chip$1, alpha, ClickAwayListener,
|
|
10
|
+
import { Box, useTheme as useTheme$1, useMediaQuery, styled as styled$1, Button as Button$1, Stack as Stack$1, Dialog, DialogTitle, DialogContent, DialogActions, DialogContentText, Tooltip as Tooltip$1, Chip as Chip$1, alpha, ClickAwayListener, Divider, Skeleton, IconButton as IconButton$2, InputBase, tooltipClasses as tooltipClasses$1, CircularProgress, Backdrop, Autocomplete, Typography as Typography$1, TextField, InputAdornment, SwipeableDrawer, Badge as Badge$1, Paper, ToggleButtonGroup, ToggleButton } from "@mui/material";
|
|
11
11
|
import isNil from "lodash/isNil";
|
|
12
12
|
import { useEditorConfig, EditorConfigProvider } from "@blocklet/editor/lib/config";
|
|
13
13
|
import { lazyWithPreload } from "react-lazy-with-preload";
|
|
@@ -56,7 +56,7 @@ import IconButton$1 from "@mui/material/IconButton";
|
|
|
56
56
|
import MuiMenu from "@mui/material/Menu";
|
|
57
57
|
import { EditorHolderProvider } from "@blocklet/editor/lib/ext/EditorHolderPlugin";
|
|
58
58
|
import red from "@mui/material/colors/red";
|
|
59
|
-
import Dialog from "@arcblock/ux/lib/Dialog";
|
|
59
|
+
import Dialog$1 from "@arcblock/ux/lib/Dialog";
|
|
60
60
|
import orderBy from "lodash/orderBy";
|
|
61
61
|
import Typography from "@mui/material/Typography";
|
|
62
62
|
import Skeleton$1 from "@mui/material/Skeleton";
|
|
@@ -1896,13 +1896,114 @@ function PostComponent({
|
|
|
1896
1896
|
renderExtraContent && renderExtraContent(postContext)
|
|
1897
1897
|
] });
|
|
1898
1898
|
}
|
|
1899
|
-
const tablerBubble = (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: "M12.4 3a5.34 5.34 0 0 1 4.906 3.239a5.333 5.333 0 0 1-1.195 10.6a4.26 4.26 0 0 1-5.28 1.863L7 21v-3.134a2.668 2.668 0 0 1-1.795-3.773A4.8 4.8 0 0 1 8.113 5.16A5.33 5.33 0 0 1 12.4 3" }) });
|
|
1900
1899
|
const tablerPinned = (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: "M9 4v6l-2 4v2h10v-2l-2-4V4m-3 12v5M8 4h8" }) });
|
|
1900
|
+
const prefs = window.blocklet.preferences;
|
|
1901
|
+
const preferences = {
|
|
1902
|
+
...prefs,
|
|
1903
|
+
// 对 preferences 做一些格式化处理
|
|
1904
|
+
maxCommentLength: parseInt(`${prefs.maxCommentLength}`, 10),
|
|
1905
|
+
maxDiscussionLength: parseInt(`${prefs.maxDiscussionLength}`, 10),
|
|
1906
|
+
maxPinLimit: parseInt(`${prefs.maxPinLimit}`, 10),
|
|
1907
|
+
maxFeaturedLimit: parseInt(`${prefs.maxFeaturedLimit}`, 10),
|
|
1908
|
+
assignmentAuthorizedPassports: (_d = prefs.assignmentAuthorizedPassports) == null ? void 0 : _d.split(",").map((x) => x.trim())
|
|
1909
|
+
};
|
|
1910
|
+
function Confirm({
|
|
1911
|
+
open,
|
|
1912
|
+
title,
|
|
1913
|
+
description,
|
|
1914
|
+
handleOk,
|
|
1915
|
+
handleCancel,
|
|
1916
|
+
okText,
|
|
1917
|
+
okButtonProps,
|
|
1918
|
+
cancelText,
|
|
1919
|
+
cancelButtonProps,
|
|
1920
|
+
actions,
|
|
1921
|
+
...rest
|
|
1922
|
+
}) {
|
|
1923
|
+
const theme = useTheme();
|
|
1924
|
+
const fullScreen = useMediaQuery(theme.breakpoints.down("md"));
|
|
1925
|
+
const { t } = useLocaleContext();
|
|
1926
|
+
const renderDesc = () => {
|
|
1927
|
+
if (isValidElement(description)) {
|
|
1928
|
+
return description;
|
|
1929
|
+
}
|
|
1930
|
+
return /* @__PURE__ */ jsx(DialogContentText, { children: description });
|
|
1931
|
+
};
|
|
1932
|
+
if (!open) {
|
|
1933
|
+
return null;
|
|
1934
|
+
}
|
|
1935
|
+
const renderActions = () => {
|
|
1936
|
+
const actionsArr = [
|
|
1937
|
+
/* @__PURE__ */ jsx(Button$1, { color: "inherit", variant: "text", onClick: handleCancel, ...cancelButtonProps, children: cancelText || t("cancel") || "Cancel" }, "cancel"),
|
|
1938
|
+
/* @__PURE__ */ jsx(Button$1, { color: "primary", variant: "contained", onClick: handleOk, ...okButtonProps, children: okText || t("confirm") || "Yes" }, "confirm")
|
|
1939
|
+
];
|
|
1940
|
+
if (actions) {
|
|
1941
|
+
return actions(actionsArr, handleCancel);
|
|
1942
|
+
}
|
|
1943
|
+
return actionsArr;
|
|
1944
|
+
};
|
|
1945
|
+
return /* @__PURE__ */ jsxs(Dialog, { fullScreen, onClose: handleCancel, maxWidth: "md", ...rest, open, children: [
|
|
1946
|
+
/* @__PURE__ */ jsx(DialogTitle, { variant: "h4", children: title }),
|
|
1947
|
+
/* @__PURE__ */ jsx(DialogContent, { sx: { minWidth: { xs: "initial", md: 400 } }, children: renderDesc() }),
|
|
1948
|
+
/* @__PURE__ */ jsx(DialogActions, { children: renderActions() })
|
|
1949
|
+
] });
|
|
1950
|
+
}
|
|
1951
|
+
const ConfirmContext = createContext({});
|
|
1952
|
+
const useConfirm = () => useContext(ConfirmContext);
|
|
1953
|
+
function ConfirmProvider({ children }) {
|
|
1954
|
+
const [open, setOpen] = useState(false);
|
|
1955
|
+
const [currentOptions, setCurrentOptions] = useState({});
|
|
1956
|
+
const resolver = useRef();
|
|
1957
|
+
const handleOk = () => {
|
|
1958
|
+
var _a2;
|
|
1959
|
+
(_a2 = resolver.current) == null ? void 0 : _a2.call(resolver, true);
|
|
1960
|
+
setOpen(false);
|
|
1961
|
+
};
|
|
1962
|
+
const handleCancel = () => {
|
|
1963
|
+
var _a2;
|
|
1964
|
+
(_a2 = resolver.current) == null ? void 0 : _a2.call(resolver, false);
|
|
1965
|
+
setOpen(false);
|
|
1966
|
+
};
|
|
1967
|
+
const confirm = (options) => {
|
|
1968
|
+
setCurrentOptions(options);
|
|
1969
|
+
setOpen(true);
|
|
1970
|
+
return new Promise((resolve) => {
|
|
1971
|
+
resolver.current = resolve;
|
|
1972
|
+
});
|
|
1973
|
+
};
|
|
1974
|
+
const value = useMemo(
|
|
1975
|
+
() => ({
|
|
1976
|
+
open,
|
|
1977
|
+
confirm
|
|
1978
|
+
}),
|
|
1979
|
+
[open]
|
|
1980
|
+
);
|
|
1981
|
+
return /* @__PURE__ */ jsxs(ConfirmContext.Provider, { value, children: [
|
|
1982
|
+
children,
|
|
1983
|
+
/* @__PURE__ */ jsx(
|
|
1984
|
+
Confirm,
|
|
1985
|
+
{
|
|
1986
|
+
...currentOptions.dialogProps,
|
|
1987
|
+
open,
|
|
1988
|
+
onClose: handleCancel,
|
|
1989
|
+
title: currentOptions.title,
|
|
1990
|
+
description: currentOptions.description,
|
|
1991
|
+
okText: currentOptions.okText,
|
|
1992
|
+
okButtonProps: currentOptions.okButtonProps,
|
|
1993
|
+
cancelText: currentOptions.cancelText,
|
|
1994
|
+
cancelButtonProps: currentOptions.cancelButtonProps,
|
|
1995
|
+
handleOk,
|
|
1996
|
+
handleCancel,
|
|
1997
|
+
actions: currentOptions.actions
|
|
1998
|
+
}
|
|
1999
|
+
)
|
|
2000
|
+
] });
|
|
2001
|
+
}
|
|
1901
2002
|
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: [
|
|
1902
2003
|
/* @__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.576a2 2 0 0 1 1.929 2.526l-1.91 7A2 2 0 0 1 16.473 20Z" }),
|
|
1903
2004
|
/* @__PURE__ */ jsx("path", { strokeLinejoin: "round", d: "M7 20V9" })
|
|
1904
2005
|
] }) });
|
|
1905
|
-
const StyledDialog = styled$1(Dialog)`
|
|
2006
|
+
const StyledDialog = styled$1(Dialog$1)`
|
|
1906
2007
|
.ux-dialog_header {
|
|
1907
2008
|
padding: 0 16px;
|
|
1908
2009
|
}
|
|
@@ -2346,108 +2447,6 @@ function GithubReaction({
|
|
|
2346
2447
|
)
|
|
2347
2448
|
] });
|
|
2348
2449
|
}
|
|
2349
|
-
const prefs = window.blocklet.preferences;
|
|
2350
|
-
const preferences = {
|
|
2351
|
-
...prefs,
|
|
2352
|
-
// 对 preferences 做一些格式化处理
|
|
2353
|
-
maxCommentLength: parseInt(`${prefs.maxCommentLength}`, 10),
|
|
2354
|
-
maxDiscussionLength: parseInt(`${prefs.maxDiscussionLength}`, 10),
|
|
2355
|
-
maxPinLimit: parseInt(`${prefs.maxPinLimit}`, 10),
|
|
2356
|
-
maxFeaturedLimit: parseInt(`${prefs.maxFeaturedLimit}`, 10),
|
|
2357
|
-
assignmentAuthorizedPassports: (_d = prefs.assignmentAuthorizedPassports) == null ? void 0 : _d.split(",").map((x) => x.trim())
|
|
2358
|
-
};
|
|
2359
|
-
function Confirm({
|
|
2360
|
-
open,
|
|
2361
|
-
title,
|
|
2362
|
-
description,
|
|
2363
|
-
handleOk,
|
|
2364
|
-
handleCancel,
|
|
2365
|
-
okText,
|
|
2366
|
-
okButtonProps,
|
|
2367
|
-
cancelText,
|
|
2368
|
-
cancelButtonProps,
|
|
2369
|
-
actions,
|
|
2370
|
-
...rest
|
|
2371
|
-
}) {
|
|
2372
|
-
const theme = useTheme();
|
|
2373
|
-
const fullScreen = useMediaQuery(theme.breakpoints.down("md"));
|
|
2374
|
-
const { t } = useLocaleContext();
|
|
2375
|
-
const renderDesc = () => {
|
|
2376
|
-
if (isValidElement(description)) {
|
|
2377
|
-
return description;
|
|
2378
|
-
}
|
|
2379
|
-
return /* @__PURE__ */ jsx(DialogContentText, { children: description });
|
|
2380
|
-
};
|
|
2381
|
-
if (!open) {
|
|
2382
|
-
return null;
|
|
2383
|
-
}
|
|
2384
|
-
const renderActions = () => {
|
|
2385
|
-
const actionsArr = [
|
|
2386
|
-
/* @__PURE__ */ jsx(Button$1, { color: "inherit", variant: "text", onClick: handleCancel, ...cancelButtonProps, children: cancelText || t("cancel") || "Cancel" }, "cancel"),
|
|
2387
|
-
/* @__PURE__ */ jsx(Button$1, { color: "primary", variant: "contained", onClick: handleOk, ...okButtonProps, children: okText || t("confirm") || "Yes" }, "confirm")
|
|
2388
|
-
];
|
|
2389
|
-
if (actions) {
|
|
2390
|
-
return actions(actionsArr, handleCancel);
|
|
2391
|
-
}
|
|
2392
|
-
return actionsArr;
|
|
2393
|
-
};
|
|
2394
|
-
return /* @__PURE__ */ jsxs(Dialog$1, { fullScreen, onClose: handleCancel, maxWidth: "md", ...rest, open, children: [
|
|
2395
|
-
/* @__PURE__ */ jsx(DialogTitle, { variant: "h4", children: title }),
|
|
2396
|
-
/* @__PURE__ */ jsx(DialogContent, { sx: { minWidth: { xs: "initial", md: 400 } }, children: renderDesc() }),
|
|
2397
|
-
/* @__PURE__ */ jsx(DialogActions, { children: renderActions() })
|
|
2398
|
-
] });
|
|
2399
|
-
}
|
|
2400
|
-
const ConfirmContext = createContext({});
|
|
2401
|
-
const useConfirm = () => useContext(ConfirmContext);
|
|
2402
|
-
function ConfirmProvider({ children }) {
|
|
2403
|
-
const [open, setOpen] = useState(false);
|
|
2404
|
-
const [currentOptions, setCurrentOptions] = useState({});
|
|
2405
|
-
const resolver = useRef();
|
|
2406
|
-
const handleOk = () => {
|
|
2407
|
-
var _a2;
|
|
2408
|
-
(_a2 = resolver.current) == null ? void 0 : _a2.call(resolver, true);
|
|
2409
|
-
setOpen(false);
|
|
2410
|
-
};
|
|
2411
|
-
const handleCancel = () => {
|
|
2412
|
-
var _a2;
|
|
2413
|
-
(_a2 = resolver.current) == null ? void 0 : _a2.call(resolver, false);
|
|
2414
|
-
setOpen(false);
|
|
2415
|
-
};
|
|
2416
|
-
const confirm = (options) => {
|
|
2417
|
-
setCurrentOptions(options);
|
|
2418
|
-
setOpen(true);
|
|
2419
|
-
return new Promise((resolve) => {
|
|
2420
|
-
resolver.current = resolve;
|
|
2421
|
-
});
|
|
2422
|
-
};
|
|
2423
|
-
const value = useMemo(
|
|
2424
|
-
() => ({
|
|
2425
|
-
open,
|
|
2426
|
-
confirm
|
|
2427
|
-
}),
|
|
2428
|
-
[open]
|
|
2429
|
-
);
|
|
2430
|
-
return /* @__PURE__ */ jsxs(ConfirmContext.Provider, { value, children: [
|
|
2431
|
-
children,
|
|
2432
|
-
/* @__PURE__ */ jsx(
|
|
2433
|
-
Confirm,
|
|
2434
|
-
{
|
|
2435
|
-
...currentOptions.dialogProps,
|
|
2436
|
-
open,
|
|
2437
|
-
onClose: handleCancel,
|
|
2438
|
-
title: currentOptions.title,
|
|
2439
|
-
description: currentOptions.description,
|
|
2440
|
-
okText: currentOptions.okText,
|
|
2441
|
-
okButtonProps: currentOptions.okButtonProps,
|
|
2442
|
-
cancelText: currentOptions.cancelText,
|
|
2443
|
-
cancelButtonProps: currentOptions.cancelButtonProps,
|
|
2444
|
-
handleOk,
|
|
2445
|
-
handleCancel,
|
|
2446
|
-
actions: currentOptions.actions
|
|
2447
|
-
}
|
|
2448
|
-
)
|
|
2449
|
-
] });
|
|
2450
|
-
}
|
|
2451
2450
|
function Comment({
|
|
2452
2451
|
onDelete,
|
|
2453
2452
|
onRate,
|
|
@@ -2523,9 +2522,9 @@ function Comment({
|
|
|
2523
2522
|
interactive,
|
|
2524
2523
|
append: /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
2525
2524
|
(!!(session == null ? void 0 : session.user) || preferences.displayReplyButtonForAnonymousUsers) && interactive && /* @__PURE__ */ jsx(
|
|
2526
|
-
|
|
2525
|
+
Icon,
|
|
2527
2526
|
{
|
|
2528
|
-
|
|
2527
|
+
icon: "feather:message-circle",
|
|
2529
2528
|
className: "github-reaction-icon",
|
|
2530
2529
|
onClick: () => protectLogin(session, () => setInputVisible(!inputVisible))
|
|
2531
2530
|
}
|
|
@@ -4919,7 +4918,7 @@ function Back({ url, fallbackUrl, iconOnly, sx, icon, ...rest }) {
|
|
|
4919
4918
|
}
|
|
4920
4919
|
const tablerSend = (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: "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" }) });
|
|
4921
4920
|
const tablerLetterCase = (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: "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" }) });
|
|
4922
|
-
const Editor = lazyRetry(() => import("./editor-
|
|
4921
|
+
const Editor = lazyRetry(() => import("./editor-ft4Hsx-A.mjs"));
|
|
4923
4922
|
function LazyEditor(props) {
|
|
4924
4923
|
const fallback2 = /* @__PURE__ */ jsxs(Box, { sx: { px: 3 }, children: [
|
|
4925
4924
|
/* @__PURE__ */ jsx(Skeleton, {}),
|
package/dist/index.es.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export * from "@blocklet/labels";
|
|
2
|
-
import { U, o, X, A, n, ae, B, G, L, K, N, aq, Z, Y, a0, _, $, a2, x, C, y, z, F, a6, a7, ai, a9, Q, T, ad, D, ah, ag, J, H, b, m, af, M, P, ap, w, v, R, S, aa, ar, q, a3, a5, aj, am, al, az, as, O, an, at, aw, ax, l, ay, h, p, r, k, av, t, j, ab, aA, W, c, a1, E, a8, ac, e, u, ao, d, au, a4, ak, f } from "./index-
|
|
2
|
+
import { U, o, X, A, n, ae, B, G, L, K, N, aq, Z, Y, a0, _, $, a2, x, C, y, z, F, a6, a7, ai, a9, Q, T, ad, D, ah, ag, J, H, b, m, af, M, P, ap, w, v, R, S, aa, ar, q, a3, a5, aj, am, al, az, as, O, an, at, aw, ax, l, ay, h, p, r, k, av, t, j, ab, aA, W, c, a1, E, a8, ac, e, u, ao, d, au, a4, ak, f } from "./index-Cm1TeDDQ.mjs";
|
|
3
3
|
import "react/jsx-runtime";
|
|
4
4
|
import "react";
|
|
5
5
|
import "@mui/material/Box";
|
package/dist/index.umd.js
CHANGED
|
@@ -1820,8 +1820,109 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
1820
1820
|
renderExtraContent && renderExtraContent(postContext)
|
|
1821
1821
|
] });
|
|
1822
1822
|
}
|
|
1823
|
-
const tablerBubble = (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: "M12.4 3a5.34 5.34 0 0 1 4.906 3.239a5.333 5.333 0 0 1-1.195 10.6a4.26 4.26 0 0 1-5.28 1.863L7 21v-3.134a2.668 2.668 0 0 1-1.795-3.773A4.8 4.8 0 0 1 8.113 5.16A5.33 5.33 0 0 1 12.4 3" }) });
|
|
1824
1823
|
const tablerPinned = (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: "M9 4v6l-2 4v2h10v-2l-2-4V4m-3 12v5M8 4h8" }) });
|
|
1824
|
+
const prefs = window.blocklet.preferences;
|
|
1825
|
+
const preferences = {
|
|
1826
|
+
...prefs,
|
|
1827
|
+
// 对 preferences 做一些格式化处理
|
|
1828
|
+
maxCommentLength: parseInt(`${prefs.maxCommentLength}`, 10),
|
|
1829
|
+
maxDiscussionLength: parseInt(`${prefs.maxDiscussionLength}`, 10),
|
|
1830
|
+
maxPinLimit: parseInt(`${prefs.maxPinLimit}`, 10),
|
|
1831
|
+
maxFeaturedLimit: parseInt(`${prefs.maxFeaturedLimit}`, 10),
|
|
1832
|
+
assignmentAuthorizedPassports: (_d = prefs.assignmentAuthorizedPassports) == null ? void 0 : _d.split(",").map((x) => x.trim())
|
|
1833
|
+
};
|
|
1834
|
+
function Confirm({
|
|
1835
|
+
open,
|
|
1836
|
+
title,
|
|
1837
|
+
description,
|
|
1838
|
+
handleOk,
|
|
1839
|
+
handleCancel,
|
|
1840
|
+
okText,
|
|
1841
|
+
okButtonProps,
|
|
1842
|
+
cancelText,
|
|
1843
|
+
cancelButtonProps,
|
|
1844
|
+
actions,
|
|
1845
|
+
...rest
|
|
1846
|
+
}) {
|
|
1847
|
+
const theme = styles.useTheme();
|
|
1848
|
+
const fullScreen = material.useMediaQuery(theme.breakpoints.down("md"));
|
|
1849
|
+
const { t } = context.useLocaleContext();
|
|
1850
|
+
const renderDesc = () => {
|
|
1851
|
+
if (react.isValidElement(description)) {
|
|
1852
|
+
return description;
|
|
1853
|
+
}
|
|
1854
|
+
return /* @__PURE__ */ jsxRuntime.jsx(material.DialogContentText, { children: description });
|
|
1855
|
+
};
|
|
1856
|
+
if (!open) {
|
|
1857
|
+
return null;
|
|
1858
|
+
}
|
|
1859
|
+
const renderActions = () => {
|
|
1860
|
+
const actionsArr = [
|
|
1861
|
+
/* @__PURE__ */ jsxRuntime.jsx(material.Button, { color: "inherit", variant: "text", onClick: handleCancel, ...cancelButtonProps, children: cancelText || t("cancel") || "Cancel" }, "cancel"),
|
|
1862
|
+
/* @__PURE__ */ jsxRuntime.jsx(material.Button, { color: "primary", variant: "contained", onClick: handleOk, ...okButtonProps, children: okText || t("confirm") || "Yes" }, "confirm")
|
|
1863
|
+
];
|
|
1864
|
+
if (actions) {
|
|
1865
|
+
return actions(actionsArr, handleCancel);
|
|
1866
|
+
}
|
|
1867
|
+
return actionsArr;
|
|
1868
|
+
};
|
|
1869
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(material.Dialog, { fullScreen, onClose: handleCancel, maxWidth: "md", ...rest, open, children: [
|
|
1870
|
+
/* @__PURE__ */ jsxRuntime.jsx(material.DialogTitle, { variant: "h4", children: title }),
|
|
1871
|
+
/* @__PURE__ */ jsxRuntime.jsx(material.DialogContent, { sx: { minWidth: { xs: "initial", md: 400 } }, children: renderDesc() }),
|
|
1872
|
+
/* @__PURE__ */ jsxRuntime.jsx(material.DialogActions, { children: renderActions() })
|
|
1873
|
+
] });
|
|
1874
|
+
}
|
|
1875
|
+
const ConfirmContext = react.createContext({});
|
|
1876
|
+
const useConfirm = () => react.useContext(ConfirmContext);
|
|
1877
|
+
function ConfirmProvider({ children }) {
|
|
1878
|
+
const [open, setOpen] = react.useState(false);
|
|
1879
|
+
const [currentOptions, setCurrentOptions] = react.useState({});
|
|
1880
|
+
const resolver = react.useRef();
|
|
1881
|
+
const handleOk = () => {
|
|
1882
|
+
var _a2;
|
|
1883
|
+
(_a2 = resolver.current) == null ? void 0 : _a2.call(resolver, true);
|
|
1884
|
+
setOpen(false);
|
|
1885
|
+
};
|
|
1886
|
+
const handleCancel = () => {
|
|
1887
|
+
var _a2;
|
|
1888
|
+
(_a2 = resolver.current) == null ? void 0 : _a2.call(resolver, false);
|
|
1889
|
+
setOpen(false);
|
|
1890
|
+
};
|
|
1891
|
+
const confirm = (options) => {
|
|
1892
|
+
setCurrentOptions(options);
|
|
1893
|
+
setOpen(true);
|
|
1894
|
+
return new Promise((resolve) => {
|
|
1895
|
+
resolver.current = resolve;
|
|
1896
|
+
});
|
|
1897
|
+
};
|
|
1898
|
+
const value = react.useMemo(
|
|
1899
|
+
() => ({
|
|
1900
|
+
open,
|
|
1901
|
+
confirm
|
|
1902
|
+
}),
|
|
1903
|
+
[open]
|
|
1904
|
+
);
|
|
1905
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(ConfirmContext.Provider, { value, children: [
|
|
1906
|
+
children,
|
|
1907
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1908
|
+
Confirm,
|
|
1909
|
+
{
|
|
1910
|
+
...currentOptions.dialogProps,
|
|
1911
|
+
open,
|
|
1912
|
+
onClose: handleCancel,
|
|
1913
|
+
title: currentOptions.title,
|
|
1914
|
+
description: currentOptions.description,
|
|
1915
|
+
okText: currentOptions.okText,
|
|
1916
|
+
okButtonProps: currentOptions.okButtonProps,
|
|
1917
|
+
cancelText: currentOptions.cancelText,
|
|
1918
|
+
cancelButtonProps: currentOptions.cancelButtonProps,
|
|
1919
|
+
handleOk,
|
|
1920
|
+
handleCancel,
|
|
1921
|
+
actions: currentOptions.actions
|
|
1922
|
+
}
|
|
1923
|
+
)
|
|
1924
|
+
] });
|
|
1925
|
+
}
|
|
1825
1926
|
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: [
|
|
1826
1927
|
/* @__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.576a2 2 0 0 1 1.929 2.526l-1.91 7A2 2 0 0 1 16.473 20Z" }),
|
|
1827
1928
|
/* @__PURE__ */ jsxRuntime.jsx("path", { strokeLinejoin: "round", d: "M7 20V9" })
|
|
@@ -2270,108 +2371,6 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
2270
2371
|
)
|
|
2271
2372
|
] });
|
|
2272
2373
|
}
|
|
2273
|
-
const prefs = window.blocklet.preferences;
|
|
2274
|
-
const preferences = {
|
|
2275
|
-
...prefs,
|
|
2276
|
-
// 对 preferences 做一些格式化处理
|
|
2277
|
-
maxCommentLength: parseInt(`${prefs.maxCommentLength}`, 10),
|
|
2278
|
-
maxDiscussionLength: parseInt(`${prefs.maxDiscussionLength}`, 10),
|
|
2279
|
-
maxPinLimit: parseInt(`${prefs.maxPinLimit}`, 10),
|
|
2280
|
-
maxFeaturedLimit: parseInt(`${prefs.maxFeaturedLimit}`, 10),
|
|
2281
|
-
assignmentAuthorizedPassports: (_d = prefs.assignmentAuthorizedPassports) == null ? void 0 : _d.split(",").map((x) => x.trim())
|
|
2282
|
-
};
|
|
2283
|
-
function Confirm({
|
|
2284
|
-
open,
|
|
2285
|
-
title,
|
|
2286
|
-
description,
|
|
2287
|
-
handleOk,
|
|
2288
|
-
handleCancel,
|
|
2289
|
-
okText,
|
|
2290
|
-
okButtonProps,
|
|
2291
|
-
cancelText,
|
|
2292
|
-
cancelButtonProps,
|
|
2293
|
-
actions,
|
|
2294
|
-
...rest
|
|
2295
|
-
}) {
|
|
2296
|
-
const theme = styles.useTheme();
|
|
2297
|
-
const fullScreen = material.useMediaQuery(theme.breakpoints.down("md"));
|
|
2298
|
-
const { t } = context.useLocaleContext();
|
|
2299
|
-
const renderDesc = () => {
|
|
2300
|
-
if (react.isValidElement(description)) {
|
|
2301
|
-
return description;
|
|
2302
|
-
}
|
|
2303
|
-
return /* @__PURE__ */ jsxRuntime.jsx(material.DialogContentText, { children: description });
|
|
2304
|
-
};
|
|
2305
|
-
if (!open) {
|
|
2306
|
-
return null;
|
|
2307
|
-
}
|
|
2308
|
-
const renderActions = () => {
|
|
2309
|
-
const actionsArr = [
|
|
2310
|
-
/* @__PURE__ */ jsxRuntime.jsx(material.Button, { color: "inherit", variant: "text", onClick: handleCancel, ...cancelButtonProps, children: cancelText || t("cancel") || "Cancel" }, "cancel"),
|
|
2311
|
-
/* @__PURE__ */ jsxRuntime.jsx(material.Button, { color: "primary", variant: "contained", onClick: handleOk, ...okButtonProps, children: okText || t("confirm") || "Yes" }, "confirm")
|
|
2312
|
-
];
|
|
2313
|
-
if (actions) {
|
|
2314
|
-
return actions(actionsArr, handleCancel);
|
|
2315
|
-
}
|
|
2316
|
-
return actionsArr;
|
|
2317
|
-
};
|
|
2318
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(material.Dialog, { fullScreen, onClose: handleCancel, maxWidth: "md", ...rest, open, children: [
|
|
2319
|
-
/* @__PURE__ */ jsxRuntime.jsx(material.DialogTitle, { variant: "h4", children: title }),
|
|
2320
|
-
/* @__PURE__ */ jsxRuntime.jsx(material.DialogContent, { sx: { minWidth: { xs: "initial", md: 400 } }, children: renderDesc() }),
|
|
2321
|
-
/* @__PURE__ */ jsxRuntime.jsx(material.DialogActions, { children: renderActions() })
|
|
2322
|
-
] });
|
|
2323
|
-
}
|
|
2324
|
-
const ConfirmContext = react.createContext({});
|
|
2325
|
-
const useConfirm = () => react.useContext(ConfirmContext);
|
|
2326
|
-
function ConfirmProvider({ children }) {
|
|
2327
|
-
const [open, setOpen] = react.useState(false);
|
|
2328
|
-
const [currentOptions, setCurrentOptions] = react.useState({});
|
|
2329
|
-
const resolver = react.useRef();
|
|
2330
|
-
const handleOk = () => {
|
|
2331
|
-
var _a2;
|
|
2332
|
-
(_a2 = resolver.current) == null ? void 0 : _a2.call(resolver, true);
|
|
2333
|
-
setOpen(false);
|
|
2334
|
-
};
|
|
2335
|
-
const handleCancel = () => {
|
|
2336
|
-
var _a2;
|
|
2337
|
-
(_a2 = resolver.current) == null ? void 0 : _a2.call(resolver, false);
|
|
2338
|
-
setOpen(false);
|
|
2339
|
-
};
|
|
2340
|
-
const confirm = (options) => {
|
|
2341
|
-
setCurrentOptions(options);
|
|
2342
|
-
setOpen(true);
|
|
2343
|
-
return new Promise((resolve) => {
|
|
2344
|
-
resolver.current = resolve;
|
|
2345
|
-
});
|
|
2346
|
-
};
|
|
2347
|
-
const value = react.useMemo(
|
|
2348
|
-
() => ({
|
|
2349
|
-
open,
|
|
2350
|
-
confirm
|
|
2351
|
-
}),
|
|
2352
|
-
[open]
|
|
2353
|
-
);
|
|
2354
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(ConfirmContext.Provider, { value, children: [
|
|
2355
|
-
children,
|
|
2356
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2357
|
-
Confirm,
|
|
2358
|
-
{
|
|
2359
|
-
...currentOptions.dialogProps,
|
|
2360
|
-
open,
|
|
2361
|
-
onClose: handleCancel,
|
|
2362
|
-
title: currentOptions.title,
|
|
2363
|
-
description: currentOptions.description,
|
|
2364
|
-
okText: currentOptions.okText,
|
|
2365
|
-
okButtonProps: currentOptions.okButtonProps,
|
|
2366
|
-
cancelText: currentOptions.cancelText,
|
|
2367
|
-
cancelButtonProps: currentOptions.cancelButtonProps,
|
|
2368
|
-
handleOk,
|
|
2369
|
-
handleCancel,
|
|
2370
|
-
actions: currentOptions.actions
|
|
2371
|
-
}
|
|
2372
|
-
)
|
|
2373
|
-
] });
|
|
2374
|
-
}
|
|
2375
2374
|
function Comment({
|
|
2376
2375
|
onDelete,
|
|
2377
2376
|
onRate,
|
|
@@ -2447,9 +2446,9 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
2447
2446
|
interactive,
|
|
2448
2447
|
append: /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
2449
2448
|
(!!(session == null ? void 0 : session.user) || preferences.displayReplyButtonForAnonymousUsers) && interactive && /* @__PURE__ */ jsxRuntime.jsx(
|
|
2450
|
-
|
|
2449
|
+
react$1.Icon,
|
|
2451
2450
|
{
|
|
2452
|
-
|
|
2451
|
+
icon: "feather:message-circle",
|
|
2453
2452
|
className: "github-reaction-icon",
|
|
2454
2453
|
onClick: () => protectLogin(session, () => setInputVisible(!inputVisible))
|
|
2455
2454
|
}
|
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.208",
|
|
4
4
|
"files": [
|
|
5
5
|
"dist"
|
|
6
6
|
],
|
|
@@ -18,8 +18,8 @@
|
|
|
18
18
|
"access": "public"
|
|
19
19
|
},
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@arcblock/bridge": "^2.12.
|
|
22
|
-
"@arcblock/react-hooks": "^2.12.
|
|
21
|
+
"@arcblock/bridge": "^2.12.27",
|
|
22
|
+
"@arcblock/react-hooks": "^2.12.27",
|
|
23
23
|
"@arcblock/ws": "^1.19.15",
|
|
24
24
|
"@blocklet/uploader": "^0.1.78",
|
|
25
25
|
"@emotion/css": "^11.13.0",
|
|
@@ -45,8 +45,8 @@
|
|
|
45
45
|
"ufo": "^1.5.4",
|
|
46
46
|
"unstated-next": "^1.1.0",
|
|
47
47
|
"url-join": "^4.0.1",
|
|
48
|
-
"@blocklet/editor": "^2.1.
|
|
49
|
-
"@blocklet/labels": "^2.1.
|
|
48
|
+
"@blocklet/editor": "^2.1.208",
|
|
49
|
+
"@blocklet/labels": "^2.1.208"
|
|
50
50
|
},
|
|
51
51
|
"peerDependencies": {
|
|
52
52
|
"@arcblock/did-connect": "^2.10.36",
|