@blocklet/discuss-kit-ux 2.4.7 → 2.4.8
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/blog/index.d.ts +1 -1
- package/dist/components/blog/permalink.d.ts +2 -1
- package/dist/{editor-CDCMSBkq.mjs → editor-CtlzSYeG.mjs} +1 -1
- package/dist/{index-CMUop2jt.mjs → index-DtIsMICl.mjs} +19 -19
- package/dist/index.es.js +2 -2
- package/dist/index.umd.js +18 -18
- package/package.json +3 -3
|
@@ -2,6 +2,7 @@ import { BoxProps } from '@mui/material';
|
|
|
2
2
|
interface Props extends Omit<BoxProps, 'onChange'> {
|
|
3
3
|
slug: string;
|
|
4
4
|
onChange: (slug: string) => void;
|
|
5
|
+
prefix?: string;
|
|
5
6
|
}
|
|
6
|
-
export declare function
|
|
7
|
+
export declare function PostPermaLink({ slug, onChange, prefix, ...rest }: Props): import("react/jsx-runtime").JSX.Element;
|
|
7
8
|
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 { lazyRetry } from "@arcblock/ux/lib/Util";
|
|
7
|
-
import { i as inferInitialEditorState, I as ImagePathFixerPlugin, V as VideoPathFixerPlugin, a as isEmptyContent, g as getExcerptSync, s as stringify } from "./index-
|
|
7
|
+
import { i as inferInitialEditorState, I as ImagePathFixerPlugin, V as VideoPathFixerPlugin, a as isEmptyContent, g as getExcerptSync, s as stringify } from "./index-DtIsMICl.mjs";
|
|
8
8
|
const BlockletEditor = lazyRetry(() => import("@blocklet/editor"));
|
|
9
9
|
const Root = styled(Box)`
|
|
10
10
|
.be-editable,
|
|
@@ -1056,7 +1056,7 @@ function Badge({
|
|
|
1056
1056
|
const { badgeName, badgeIcon, badgeColor, badgeBackground } = item;
|
|
1057
1057
|
let icon;
|
|
1058
1058
|
if (badgeIcon) {
|
|
1059
|
-
const isHttpIcon = ["http", "/", "data"].some((
|
|
1059
|
+
const isHttpIcon = ["http", "/", "data"].some((prefix) => badgeIcon.startsWith(prefix));
|
|
1060
1060
|
const badgeIconStyle = showIconOnly ? iconOnlyStyle : iconStyle;
|
|
1061
1061
|
if (!isHttpIcon) {
|
|
1062
1062
|
icon = /* @__PURE__ */ jsx(Icon, { className: "badge-icon", icon: badgeIcon, color: badgeColor, style: { ...badgeIconStyle } });
|
|
@@ -2723,7 +2723,7 @@ function Comment({
|
|
|
2723
2723
|
};
|
|
2724
2724
|
const render = ({ post, interactive }) => {
|
|
2725
2725
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
2726
|
-
post.pinnedAt && /* @__PURE__ */ jsx(Box$1, { sx: { display: "flex", alignItems: "end", gap: 3, mt: 1 }, children: /* @__PURE__ */ jsxs(
|
|
2726
|
+
post.pinnedAt && /* @__PURE__ */ jsx(Box$1, { sx: { display: "flex", alignItems: "end", gap: 3, mt: 1, mb: 1 }, children: /* @__PURE__ */ jsxs(
|
|
2727
2727
|
Box$1,
|
|
2728
2728
|
{
|
|
2729
2729
|
component: "span",
|
|
@@ -3312,10 +3312,10 @@ function CommentList(props) {
|
|
|
3312
3312
|
}
|
|
3313
3313
|
const materialSymbolsUpload = (props) => /* @__PURE__ */ jsx("svg", { viewBox: "0 0 24 24", width: "1.2em", height: "1.2em", ...props, children: /* @__PURE__ */ jsx("path", { fill: "currentColor", d: "M11 16V7.85l-2.6 2.6L7 9l5-5l5 5l-1.4 1.45l-2.6-2.6V16zm-5 4q-.825 0-1.412-.587T4 18v-3h2v3h12v-3h2v3q0 .825-.587 1.413T18 20z" }) });
|
|
3314
3314
|
const getUploadedImageUrl = (imageUrl, width = 320) => {
|
|
3315
|
-
const
|
|
3315
|
+
const prefix = joinURL(window.blocklet?.prefix || "/", "uploads");
|
|
3316
3316
|
let result = imageUrl;
|
|
3317
|
-
if (imageUrl && imageUrl.startsWith("/") && !imageUrl.startsWith(
|
|
3318
|
-
result = joinURL(
|
|
3317
|
+
if (imageUrl && imageUrl.startsWith("/") && !imageUrl.startsWith(prefix)) {
|
|
3318
|
+
result = joinURL(prefix, imageUrl);
|
|
3319
3319
|
const tmp = new URL(result, window.location.origin);
|
|
3320
3320
|
if (!imageUrl.endsWith(".gif")) {
|
|
3321
3321
|
tmp.searchParams.set("imageFilter", "resize");
|
|
@@ -4019,8 +4019,8 @@ function BlogListWrapper({
|
|
|
4019
4019
|
}
|
|
4020
4020
|
return /* @__PURE__ */ jsx(BlogList, { ...rest });
|
|
4021
4021
|
}
|
|
4022
|
-
const
|
|
4023
|
-
function
|
|
4022
|
+
const baseURL$1 = joinURL(window.location.origin, discussKitMountPoint || "");
|
|
4023
|
+
function PostPermaLink({ slug, onChange, prefix = "blog", ...rest }) {
|
|
4024
4024
|
return /* @__PURE__ */ jsx(Box, { ...rest, className: "blog-permalink-container", children: /* @__PURE__ */ jsxs(
|
|
4025
4025
|
Box,
|
|
4026
4026
|
{
|
|
@@ -4039,16 +4039,16 @@ function BlogPermaLink({ slug, onChange, ...rest }) {
|
|
|
4039
4039
|
sx: {
|
|
4040
4040
|
display: "flex",
|
|
4041
4041
|
alignItems: "center",
|
|
4042
|
-
width:
|
|
4042
|
+
width: 140,
|
|
4043
4043
|
alignSelf: "stretch",
|
|
4044
4044
|
px: 1.25,
|
|
4045
|
-
bgcolor: "grey.
|
|
4045
|
+
bgcolor: "grey.100"
|
|
4046
4046
|
},
|
|
4047
4047
|
children: /* @__PURE__ */ jsx(
|
|
4048
4048
|
Box,
|
|
4049
4049
|
{
|
|
4050
4050
|
component: "input",
|
|
4051
|
-
value: prefix,
|
|
4051
|
+
value: joinURL(baseURL$1, prefix),
|
|
4052
4052
|
readOnly: true,
|
|
4053
4053
|
sx: {
|
|
4054
4054
|
width: 1,
|
|
@@ -4077,7 +4077,7 @@ function BlogPermaLink({ slug, onChange, ...rest }) {
|
|
|
4077
4077
|
{
|
|
4078
4078
|
sx: { px: 1 },
|
|
4079
4079
|
onClick: () => {
|
|
4080
|
-
copy(joinURL(prefix, slug));
|
|
4080
|
+
copy(joinURL(baseURL$1, prefix, slug));
|
|
4081
4081
|
},
|
|
4082
4082
|
children: /* @__PURE__ */ jsx(ContentCopy, { sx: { fontSize: 18 } })
|
|
4083
4083
|
}
|
|
@@ -5210,7 +5210,7 @@ function Back({ url, fallbackUrl, iconOnly, sx, icon, ...rest }) {
|
|
|
5210
5210
|
}
|
|
5211
5211
|
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" }) });
|
|
5212
5212
|
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" }) });
|
|
5213
|
-
const Editor = lazyRetry(() => import("./editor-
|
|
5213
|
+
const Editor = lazyRetry(() => import("./editor-CtlzSYeG.mjs"));
|
|
5214
5214
|
function LazyEditor(props) {
|
|
5215
5215
|
const fallback2 = /* @__PURE__ */ jsxs(Box, { sx: { px: 3 }, children: [
|
|
5216
5216
|
/* @__PURE__ */ jsx(Skeleton, {}),
|
|
@@ -6819,8 +6819,8 @@ const boxAnimation = {
|
|
|
6819
6819
|
layers
|
|
6820
6820
|
};
|
|
6821
6821
|
let client;
|
|
6822
|
-
function create(
|
|
6823
|
-
const pathPrefix =
|
|
6822
|
+
function create(prefix) {
|
|
6823
|
+
const pathPrefix = prefix;
|
|
6824
6824
|
const url = `//${window.location.host}${pathPrefix.replace(/\/$/, "")}`;
|
|
6825
6825
|
return new WsClient(url, {
|
|
6826
6826
|
heartbeatIntervalMs: 10 * 1e3,
|
|
@@ -6832,18 +6832,18 @@ function create(prefix2) {
|
|
|
6832
6832
|
}
|
|
6833
6833
|
});
|
|
6834
6834
|
}
|
|
6835
|
-
function getWsClient(
|
|
6835
|
+
function getWsClient(prefix = window.blocklet?.prefix || "/") {
|
|
6836
6836
|
if (!client) {
|
|
6837
|
-
client = create(
|
|
6837
|
+
client = create(prefix);
|
|
6838
6838
|
}
|
|
6839
6839
|
return client;
|
|
6840
6840
|
}
|
|
6841
6841
|
const useSubscription = (event, cb = () => {
|
|
6842
|
-
}, deps = [],
|
|
6842
|
+
}, deps = [], prefix = window.blocklet?.prefix || "/") => {
|
|
6843
6843
|
useEffect(() => {
|
|
6844
6844
|
if (event) {
|
|
6845
6845
|
if (!client) {
|
|
6846
|
-
client = getWsClient(
|
|
6846
|
+
client = getWsClient(prefix);
|
|
6847
6847
|
}
|
|
6848
6848
|
client.on(event, cb);
|
|
6849
6849
|
return () => {
|
|
@@ -7526,7 +7526,7 @@ export {
|
|
|
7526
7526
|
BlogListWrapper as L,
|
|
7527
7527
|
Menu as M,
|
|
7528
7528
|
BlogCard as N,
|
|
7529
|
-
|
|
7529
|
+
PostPermaLink as O,
|
|
7530
7530
|
Pagination as P,
|
|
7531
7531
|
getBlogLink as Q,
|
|
7532
7532
|
RelativeTime as R,
|
package/dist/index.es.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export * from "@blocklet/labels";
|
|
2
|
-
import { W, o, Y, aQ, A, n, af, B, G, N, L,
|
|
2
|
+
import { W, o, Y, aQ, A, n, af, B, G, N, L, ar, _, Z, a1, $, a0, a3, x, C, y, z, F, a7, a8, aj, aa, T, U, ae, D, ai, ah, K, H, J, aG, aH, b, m, ag, M, P, aC, aq, w, aR, aS, v, O, aE, aF, R, S, ab, as, aD, q, aP, a4, a6, ak, an, am, aM, aI, aA, at, Q, ao, aK, au, aJ, ax, ay, aN, aL, l, az, h, p, r, k, aw, t, j, ac, aB, X, aT, c, a2, E, a9, ad, aV, e, u, ap, d, av, aU, aO, a5, al, f } from "./index-DtIsMICl.mjs";
|
|
3
3
|
import "react/jsx-runtime";
|
|
4
4
|
import "react";
|
|
5
5
|
import "@mui/material/Box";
|
|
@@ -20,7 +20,6 @@ export {
|
|
|
20
20
|
G as BinaryThumb,
|
|
21
21
|
N as BlogCard,
|
|
22
22
|
L as BlogList,
|
|
23
|
-
O as BlogPermaLink,
|
|
24
23
|
ar as ButtonGroup,
|
|
25
24
|
_ as Chat,
|
|
26
25
|
Z as ChatClient,
|
|
@@ -59,6 +58,7 @@ export {
|
|
|
59
58
|
aR as PostAutoTranslatePlugin,
|
|
60
59
|
aS as PostAutoTranslationContainer,
|
|
61
60
|
v as PostContent,
|
|
61
|
+
O as PostPermaLink,
|
|
62
62
|
aE as ProfileCard,
|
|
63
63
|
aF as ProfileCardTooltip,
|
|
64
64
|
R as RelativeTime,
|
package/dist/index.umd.js
CHANGED
|
@@ -975,7 +975,7 @@
|
|
|
975
975
|
const { badgeName, badgeIcon, badgeColor, badgeBackground } = item;
|
|
976
976
|
let icon;
|
|
977
977
|
if (badgeIcon) {
|
|
978
|
-
const isHttpIcon = ["http", "/", "data"].some((
|
|
978
|
+
const isHttpIcon = ["http", "/", "data"].some((prefix) => badgeIcon.startsWith(prefix));
|
|
979
979
|
const badgeIconStyle = showIconOnly ? iconOnlyStyle : iconStyle;
|
|
980
980
|
if (!isHttpIcon) {
|
|
981
981
|
icon = /* @__PURE__ */ jsxRuntime.jsx(react$1.Icon, { className: "badge-icon", icon: badgeIcon, color: badgeColor, style: { ...badgeIconStyle } });
|
|
@@ -2642,7 +2642,7 @@
|
|
|
2642
2642
|
};
|
|
2643
2643
|
const render = ({ post, interactive }) => {
|
|
2644
2644
|
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
2645
|
-
post.pinnedAt && /* @__PURE__ */ jsxRuntime.jsx(Box, { sx: { display: "flex", alignItems: "end", gap: 3, mt: 1 }, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
2645
|
+
post.pinnedAt && /* @__PURE__ */ jsxRuntime.jsx(Box, { sx: { display: "flex", alignItems: "end", gap: 3, mt: 1, mb: 1 }, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
2646
2646
|
Box,
|
|
2647
2647
|
{
|
|
2648
2648
|
component: "span",
|
|
@@ -3231,10 +3231,10 @@
|
|
|
3231
3231
|
}
|
|
3232
3232
|
const materialSymbolsUpload = (props) => /* @__PURE__ */ jsxRuntime.jsx("svg", { viewBox: "0 0 24 24", width: "1.2em", height: "1.2em", ...props, children: /* @__PURE__ */ jsxRuntime.jsx("path", { fill: "currentColor", d: "M11 16V7.85l-2.6 2.6L7 9l5-5l5 5l-1.4 1.45l-2.6-2.6V16zm-5 4q-.825 0-1.412-.587T4 18v-3h2v3h12v-3h2v3q0 .825-.587 1.413T18 20z" }) });
|
|
3233
3233
|
const getUploadedImageUrl = (imageUrl, width = 320) => {
|
|
3234
|
-
const
|
|
3234
|
+
const prefix = ufo.joinURL(window.blocklet?.prefix || "/", "uploads");
|
|
3235
3235
|
let result = imageUrl;
|
|
3236
|
-
if (imageUrl && imageUrl.startsWith("/") && !imageUrl.startsWith(
|
|
3237
|
-
result = ufo.joinURL(
|
|
3236
|
+
if (imageUrl && imageUrl.startsWith("/") && !imageUrl.startsWith(prefix)) {
|
|
3237
|
+
result = ufo.joinURL(prefix, imageUrl);
|
|
3238
3238
|
const tmp = new URL(result, window.location.origin);
|
|
3239
3239
|
if (!imageUrl.endsWith(".gif")) {
|
|
3240
3240
|
tmp.searchParams.set("imageFilter", "resize");
|
|
@@ -3938,8 +3938,8 @@
|
|
|
3938
3938
|
}
|
|
3939
3939
|
return /* @__PURE__ */ jsxRuntime.jsx(BlogList, { ...rest });
|
|
3940
3940
|
}
|
|
3941
|
-
const
|
|
3942
|
-
function
|
|
3941
|
+
const baseURL$1 = ufo.joinURL(window.location.origin, discussKitMountPoint || "");
|
|
3942
|
+
function PostPermaLink({ slug, onChange, prefix = "blog", ...rest }) {
|
|
3943
3943
|
return /* @__PURE__ */ jsxRuntime.jsx(material.Box, { ...rest, className: "blog-permalink-container", children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
3944
3944
|
material.Box,
|
|
3945
3945
|
{
|
|
@@ -3958,16 +3958,16 @@
|
|
|
3958
3958
|
sx: {
|
|
3959
3959
|
display: "flex",
|
|
3960
3960
|
alignItems: "center",
|
|
3961
|
-
width:
|
|
3961
|
+
width: 140,
|
|
3962
3962
|
alignSelf: "stretch",
|
|
3963
3963
|
px: 1.25,
|
|
3964
|
-
bgcolor: "grey.
|
|
3964
|
+
bgcolor: "grey.100"
|
|
3965
3965
|
},
|
|
3966
3966
|
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
3967
3967
|
material.Box,
|
|
3968
3968
|
{
|
|
3969
3969
|
component: "input",
|
|
3970
|
-
value: prefix,
|
|
3970
|
+
value: ufo.joinURL(baseURL$1, prefix),
|
|
3971
3971
|
readOnly: true,
|
|
3972
3972
|
sx: {
|
|
3973
3973
|
width: 1,
|
|
@@ -3996,7 +3996,7 @@
|
|
|
3996
3996
|
{
|
|
3997
3997
|
sx: { px: 1 },
|
|
3998
3998
|
onClick: () => {
|
|
3999
|
-
copy(ufo.joinURL(prefix, slug));
|
|
3999
|
+
copy(ufo.joinURL(baseURL$1, prefix, slug));
|
|
4000
4000
|
},
|
|
4001
4001
|
children: /* @__PURE__ */ jsxRuntime.jsx(iconsMaterial.ContentCopy, { sx: { fontSize: 18 } })
|
|
4002
4002
|
}
|
|
@@ -6738,8 +6738,8 @@
|
|
|
6738
6738
|
layers
|
|
6739
6739
|
};
|
|
6740
6740
|
let client;
|
|
6741
|
-
function create(
|
|
6742
|
-
const pathPrefix =
|
|
6741
|
+
function create(prefix) {
|
|
6742
|
+
const pathPrefix = prefix;
|
|
6743
6743
|
const url = `//${window.location.host}${pathPrefix.replace(/\/$/, "")}`;
|
|
6744
6744
|
return new ws.WsClient(url, {
|
|
6745
6745
|
heartbeatIntervalMs: 10 * 1e3,
|
|
@@ -6751,18 +6751,18 @@
|
|
|
6751
6751
|
}
|
|
6752
6752
|
});
|
|
6753
6753
|
}
|
|
6754
|
-
function getWsClient(
|
|
6754
|
+
function getWsClient(prefix = window.blocklet?.prefix || "/") {
|
|
6755
6755
|
if (!client) {
|
|
6756
|
-
client = create(
|
|
6756
|
+
client = create(prefix);
|
|
6757
6757
|
}
|
|
6758
6758
|
return client;
|
|
6759
6759
|
}
|
|
6760
6760
|
const useSubscription = (event, cb = () => {
|
|
6761
|
-
}, deps = [],
|
|
6761
|
+
}, deps = [], prefix = window.blocklet?.prefix || "/") => {
|
|
6762
6762
|
react.useEffect(() => {
|
|
6763
6763
|
if (event) {
|
|
6764
6764
|
if (!client) {
|
|
6765
|
-
client = getWsClient(
|
|
6765
|
+
client = getWsClient(prefix);
|
|
6766
6766
|
}
|
|
6767
6767
|
client.on(event, cb);
|
|
6768
6768
|
return () => {
|
|
@@ -7479,7 +7479,6 @@
|
|
|
7479
7479
|
exports2.BinaryThumb = BinaryThumb;
|
|
7480
7480
|
exports2.BlogCard = BlogCard;
|
|
7481
7481
|
exports2.BlogList = BlogListWrapper;
|
|
7482
|
-
exports2.BlogPermaLink = BlogPermaLink;
|
|
7483
7482
|
exports2.ButtonGroup = ButtonGroup;
|
|
7484
7483
|
exports2.Chat = Chat;
|
|
7485
7484
|
exports2.ChatClient = ChatClient;
|
|
@@ -7518,6 +7517,7 @@
|
|
|
7518
7517
|
exports2.PostAutoTranslatePlugin = PostAutoTranslatePlugin;
|
|
7519
7518
|
exports2.PostAutoTranslationContainer = PostAutoTranslationContainer;
|
|
7520
7519
|
exports2.PostContent = PostContent;
|
|
7520
|
+
exports2.PostPermaLink = PostPermaLink;
|
|
7521
7521
|
exports2.ProfileCard = ProfileCard;
|
|
7522
7522
|
exports2.ProfileCardTooltip = ProfileCardTooltip;
|
|
7523
7523
|
exports2.RelativeTime = RelativeTime;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@blocklet/discuss-kit-ux",
|
|
3
|
-
"version": "2.4.
|
|
3
|
+
"version": "2.4.8",
|
|
4
4
|
"files": [
|
|
5
5
|
"dist"
|
|
6
6
|
],
|
|
@@ -48,8 +48,8 @@
|
|
|
48
48
|
"unstated-next": "^1.1.0",
|
|
49
49
|
"url-join": "^4.0.1",
|
|
50
50
|
"zustand": "^4.5.5",
|
|
51
|
-
"@blocklet/editor": "^2.4.
|
|
52
|
-
"@blocklet/labels": "^2.4.
|
|
51
|
+
"@blocklet/editor": "^2.4.8",
|
|
52
|
+
"@blocklet/labels": "^2.4.8"
|
|
53
53
|
},
|
|
54
54
|
"peerDependencies": {
|
|
55
55
|
"@arcblock/did-connect": "^3.0.1",
|