@blocklet/discuss-kit-ux 2.1.9 → 2.1.11
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/chat/hooks.d.ts +1 -0
- package/dist/components/uploader/utils.d.ts +1 -1
- package/dist/components/utils.d.ts +1 -1
- package/dist/{editor-DmeTB3KQ.mjs → editor-Degz44Rt.mjs} +1 -1
- package/dist/{index-DJrI2eNo.mjs → index-CLrbAT1P.mjs} +38 -46
- package/dist/index.es.js +2 -2
- package/dist/index.umd.js +35 -45
- package/package.json +3 -3
|
@@ -6,6 +6,7 @@ export declare const useChatInWallet: () => {
|
|
|
6
6
|
navigateToChatList: () => void;
|
|
7
7
|
isChatInWalletV2: boolean;
|
|
8
8
|
isWebNavbar: boolean;
|
|
9
|
+
isInArcSphere: boolean;
|
|
9
10
|
updateUnreadState: (unread: boolean) => void;
|
|
10
11
|
chatInWallet: import('react-router-dom').PathMatch<"chatId"> | null;
|
|
11
12
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const
|
|
1
|
+
export declare const getUploadedImageUrl: (imageUrl: string, width?: number) => string;
|
|
@@ -12,11 +12,11 @@ export declare function tryParseJSONObject(str: string): boolean;
|
|
|
12
12
|
export declare const getPreference: (key: string) => any;
|
|
13
13
|
export declare const getBlockletMountPointInfo: (name: string) => ComponentMountPoint | undefined;
|
|
14
14
|
export declare const blockletExists: (name: string) => boolean;
|
|
15
|
-
export declare const inferDiscussKitApiPrefix: () => any;
|
|
16
15
|
export declare const getDraftSessionKeyPrefix: () => string;
|
|
17
16
|
export declare const getExcerptFromLexicalContent: (content: any, size?: number) => string;
|
|
18
17
|
export declare const mergeSx: (initial: SystemStyleObject<Theme>, sx?: SxProps<Theme>) => any[];
|
|
19
18
|
export declare const discussKitMountPoint: string | undefined;
|
|
19
|
+
export declare const discussKitUploadsUrl: string;
|
|
20
20
|
export declare const isInDiscussKitApp: boolean | "" | undefined;
|
|
21
21
|
export declare const openProfile: (did: string, newTab?: boolean) => void;
|
|
22
22
|
export declare const randomId: () => string;
|
|
@@ -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-CLrbAT1P.mjs";
|
|
8
8
|
const BlockletEditor = lazy(() => import("@blocklet/editor"));
|
|
9
9
|
const Root = styled(Box)`
|
|
10
10
|
.be-editable,
|
|
@@ -13,8 +13,7 @@ import { useEditorConfig, EditorConfigProvider } from "@blocklet/editor/lib/conf
|
|
|
13
13
|
import { lazyWithPreload } from "react-lazy-with-preload";
|
|
14
14
|
import { $getRoot, $createParagraphNode, $createTextNode, KEY_ENTER_COMMAND, COMMAND_PRIORITY_LOW, $getSelection } from "lexical";
|
|
15
15
|
import { $isRootTextContentEmpty } from "@lexical/text";
|
|
16
|
-
import { withTrailingSlash, withQuery
|
|
17
|
-
import joinUrl from "url-join";
|
|
16
|
+
import { joinURL, withTrailingSlash, withQuery } from "ufo";
|
|
18
17
|
import { useLexicalComposerContext } from "@lexical/react/LexicalComposerContext";
|
|
19
18
|
import { ImageNode } from "@blocklet/editor/lib/main/nodes/ImageNode";
|
|
20
19
|
import { VideoNode } from "@blocklet/editor/lib/ext/VideoPlugin/VideoNode";
|
|
@@ -62,6 +61,7 @@ import Skeleton$1 from "@mui/material/Skeleton";
|
|
|
62
61
|
import ReactDOM, { createPortal } from "react-dom";
|
|
63
62
|
import dayjs from "dayjs";
|
|
64
63
|
import relativeTime from "dayjs/plugin/relativeTime";
|
|
64
|
+
import joinUrl from "url-join";
|
|
65
65
|
import mitt from "mitt";
|
|
66
66
|
import CircularProgress$1 from "@mui/material/CircularProgress";
|
|
67
67
|
import { Helmet } from "react-helmet";
|
|
@@ -74,6 +74,8 @@ import { useIsFocused } from "@blocklet/editor/lib/main/hooks/useIsFocused";
|
|
|
74
74
|
import { BusyPlugin } from "@blocklet/editor/lib/ext/BusyPlugin";
|
|
75
75
|
import TextField from "@mui/material/TextField";
|
|
76
76
|
import AddIcon from "@mui/icons-material/Add";
|
|
77
|
+
import ArrowBackIosIcon from "@mui/icons-material/ArrowBackIos";
|
|
78
|
+
import ShortTextIcon from "@mui/icons-material/ShortText";
|
|
77
79
|
import { AxiosError } from "axios";
|
|
78
80
|
import Toast from "@arcblock/ux/lib/Toast";
|
|
79
81
|
import MuiPagination from "@mui/material/Pagination";
|
|
@@ -294,10 +296,6 @@ const blockletExists = (name) => {
|
|
|
294
296
|
const info = getBlockletMountPointInfo(name);
|
|
295
297
|
return (info == null ? void 0 : info.status) === "running";
|
|
296
298
|
};
|
|
297
|
-
const inferDiscussKitApiPrefix = () => {
|
|
298
|
-
const service = getBlockletMountPointInfo("did-comments");
|
|
299
|
-
return service ? joinUrl(service.mountPoint, "/") : "/";
|
|
300
|
-
};
|
|
301
299
|
const getDraftSessionKeyPrefix = () => {
|
|
302
300
|
return "comment-draft-";
|
|
303
301
|
};
|
|
@@ -342,6 +340,7 @@ const mergeSx = (initial, sx) => {
|
|
|
342
340
|
return mergedSx;
|
|
343
341
|
};
|
|
344
342
|
const discussKitMountPoint = (_a = getBlockletMountPointInfo("did-comments")) == null ? void 0 : _a.mountPoint;
|
|
343
|
+
const discussKitUploadsUrl = joinURL(discussKitMountPoint || "", "/uploads");
|
|
345
344
|
const isInDiscussKitApp = discussKitMountPoint && withTrailingSlash(window.blocklet.prefix) === withTrailingSlash(discussKitMountPoint);
|
|
346
345
|
const openProfile = (did, newTab) => {
|
|
347
346
|
if (did) {
|
|
@@ -363,6 +362,7 @@ const utils = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePropert
|
|
|
363
362
|
blockletExists,
|
|
364
363
|
copy,
|
|
365
364
|
discussKitMountPoint,
|
|
365
|
+
discussKitUploadsUrl,
|
|
366
366
|
getBlockletMountPointInfo,
|
|
367
367
|
getDiscussKitClientId,
|
|
368
368
|
getDraftSessionKeyPrefix,
|
|
@@ -370,7 +370,6 @@ const utils = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePropert
|
|
|
370
370
|
getLastItem,
|
|
371
371
|
getPreference,
|
|
372
372
|
getResizedAvatar,
|
|
373
|
-
inferDiscussKitApiPrefix,
|
|
374
373
|
isInDiscussKitApp,
|
|
375
374
|
mergeSx,
|
|
376
375
|
minDelay,
|
|
@@ -480,14 +479,12 @@ function CmdEnterShortcutPlugin({ callback, shortcut = "CMD_ENTER" }) {
|
|
|
480
479
|
}, [editor, callback]);
|
|
481
480
|
return null;
|
|
482
481
|
}
|
|
483
|
-
const UPLOADS_PREFIX$1 = "/uploads";
|
|
484
|
-
const IMAGE_URL_PREFIX = joinUrl(inferDiscussKitApiPrefix(), UPLOADS_PREFIX$1);
|
|
485
482
|
const originalExportJSON$1 = ImageNode.prototype.exportJSON;
|
|
486
483
|
const ensureLeadingSlash$1 = (str) => str.startsWith("/") ? str : `/${str}`;
|
|
487
484
|
ImageNode.prototype.exportJSON = function exportJSON() {
|
|
488
485
|
const json = originalExportJSON$1.call(this);
|
|
489
|
-
if (json.src && json.src.startsWith(
|
|
490
|
-
json.src = json.src.replace(
|
|
486
|
+
if (json.src && json.src.startsWith(discussKitUploadsUrl)) {
|
|
487
|
+
json.src = json.src.replace(discussKitUploadsUrl, "");
|
|
491
488
|
json.src = ensureLeadingSlash$1(json.src);
|
|
492
489
|
}
|
|
493
490
|
return json;
|
|
@@ -495,8 +492,8 @@ ImageNode.prototype.exportJSON = function exportJSON() {
|
|
|
495
492
|
function imageNodeTransform(node) {
|
|
496
493
|
const targetNode = node;
|
|
497
494
|
const src = targetNode.getSrc();
|
|
498
|
-
if ((src == null ? void 0 : src.startsWith("/")) && !src.startsWith(
|
|
499
|
-
targetNode.setSrc(
|
|
495
|
+
if ((src == null ? void 0 : src.startsWith("/")) && !src.startsWith(discussKitUploadsUrl)) {
|
|
496
|
+
targetNode.setSrc(joinURL(discussKitUploadsUrl, src));
|
|
500
497
|
}
|
|
501
498
|
}
|
|
502
499
|
function ImagePathFixerPlugin() {
|
|
@@ -506,13 +503,12 @@ function ImagePathFixerPlugin() {
|
|
|
506
503
|
}, [editor]);
|
|
507
504
|
return null;
|
|
508
505
|
}
|
|
509
|
-
const UPLOADS_PREFIX = joinUrl(inferDiscussKitApiPrefix(), "/uploads");
|
|
510
506
|
const originalExportJSON = VideoNode.prototype.exportJSON;
|
|
511
507
|
const ensureLeadingSlash = (str) => str.startsWith("/") ? str : `/${str}`;
|
|
512
508
|
VideoNode.prototype.exportJSON = function exportJSON2() {
|
|
513
509
|
const json = originalExportJSON.call(this);
|
|
514
|
-
if (json.src && json.src.startsWith(
|
|
515
|
-
json.src = json.src.replace(
|
|
510
|
+
if (json.src && json.src.startsWith(discussKitUploadsUrl)) {
|
|
511
|
+
json.src = json.src.replace(discussKitUploadsUrl, "");
|
|
516
512
|
json.src = ensureLeadingSlash(json.src);
|
|
517
513
|
}
|
|
518
514
|
return json;
|
|
@@ -520,8 +516,8 @@ VideoNode.prototype.exportJSON = function exportJSON2() {
|
|
|
520
516
|
function VideoNodeTransform(node) {
|
|
521
517
|
const targetNode = node;
|
|
522
518
|
const src = targetNode.getSrc();
|
|
523
|
-
if ((src == null ? void 0 : src.startsWith("/")) && !src.startsWith(
|
|
524
|
-
targetNode.setSrc(
|
|
519
|
+
if ((src == null ? void 0 : src.startsWith("/")) && !src.startsWith(discussKitUploadsUrl)) {
|
|
520
|
+
targetNode.setSrc(joinURL(discussKitUploadsUrl, src));
|
|
525
521
|
}
|
|
526
522
|
}
|
|
527
523
|
function VideoPathFixerPlugin() {
|
|
@@ -1269,6 +1265,7 @@ const useChatInWallet = () => {
|
|
|
1269
1265
|
navigateToChatList,
|
|
1270
1266
|
isChatInWalletV2,
|
|
1271
1267
|
isWebNavbar,
|
|
1268
|
+
isInArcSphere,
|
|
1272
1269
|
updateUnreadState,
|
|
1273
1270
|
chatInWallet
|
|
1274
1271
|
};
|
|
@@ -2939,16 +2936,18 @@ function CommentList(props) {
|
|
|
2939
2936
|
] });
|
|
2940
2937
|
}
|
|
2941
2938
|
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" }) });
|
|
2942
|
-
const
|
|
2939
|
+
const getUploadedImageUrl = (imageUrl, width = 320) => {
|
|
2943
2940
|
var _a2;
|
|
2944
|
-
const prefix2 =
|
|
2941
|
+
const prefix2 = joinURL(((_a2 = window.blocklet) == null ? void 0 : _a2.prefix) || "/", "uploads");
|
|
2945
2942
|
let result = imageUrl;
|
|
2946
2943
|
if (imageUrl && imageUrl.startsWith("/") && !imageUrl.startsWith(prefix2)) {
|
|
2947
|
-
result =
|
|
2944
|
+
result = joinURL(prefix2, imageUrl);
|
|
2948
2945
|
const tmp = new URL(result, window.location.origin);
|
|
2949
|
-
|
|
2950
|
-
|
|
2951
|
-
|
|
2946
|
+
if (!imageUrl.endsWith(".gif")) {
|
|
2947
|
+
tmp.searchParams.set("imageFilter", "resize");
|
|
2948
|
+
tmp.searchParams.set("w", width.toString());
|
|
2949
|
+
tmp.searchParams.set("f", "webp");
|
|
2950
|
+
}
|
|
2952
2951
|
return tmp.href;
|
|
2953
2952
|
}
|
|
2954
2953
|
return result;
|
|
@@ -3063,7 +3062,7 @@ function CoverImage({
|
|
|
3063
3062
|
/* @__PURE__ */ jsx(Box, { children: /* @__PURE__ */ jsx(
|
|
3064
3063
|
"img",
|
|
3065
3064
|
{
|
|
3066
|
-
src: url ?
|
|
3065
|
+
src: url ? getUploadedImageUrl(url, width) : "",
|
|
3067
3066
|
loading,
|
|
3068
3067
|
fetchpriority,
|
|
3069
3068
|
style: {
|
|
@@ -3595,7 +3594,7 @@ function BlogListWrapper({
|
|
|
3595
3594
|
}
|
|
3596
3595
|
return /* @__PURE__ */ jsx(BlogList, { ...rest });
|
|
3597
3596
|
}
|
|
3598
|
-
const prefix =
|
|
3597
|
+
const prefix = joinURL(window.location.origin, discussKitMountPoint || "", "blog");
|
|
3599
3598
|
function BlogPermaLink({ slug, onChange, ...rest }) {
|
|
3600
3599
|
return /* @__PURE__ */ jsx(Box, { ...rest, className: "blog-permalink-container", children: /* @__PURE__ */ jsxs(
|
|
3601
3600
|
Box,
|
|
@@ -3653,7 +3652,7 @@ function BlogPermaLink({ slug, onChange, ...rest }) {
|
|
|
3653
3652
|
{
|
|
3654
3653
|
sx: { px: 1 },
|
|
3655
3654
|
onClick: () => {
|
|
3656
|
-
copy(
|
|
3655
|
+
copy(joinURL(prefix, slug));
|
|
3657
3656
|
},
|
|
3658
3657
|
children: /* @__PURE__ */ jsx(ContentCopy, { sx: { fontSize: 18 } })
|
|
3659
3658
|
}
|
|
@@ -4716,7 +4715,7 @@ function Back({ url, fallbackUrl, iconOnly, sx, ...rest }) {
|
|
|
4716
4715
|
}
|
|
4717
4716
|
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" }) });
|
|
4718
4717
|
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" }) });
|
|
4719
|
-
const Editor = lazy(() => import("./editor-
|
|
4718
|
+
const Editor = lazy(() => import("./editor-Degz44Rt.mjs"));
|
|
4720
4719
|
function LazyEditor(props) {
|
|
4721
4720
|
const fallback2 = /* @__PURE__ */ jsxs(Box, { sx: { px: 3 }, children: [
|
|
4722
4721
|
/* @__PURE__ */ jsx(Skeleton, {}),
|
|
@@ -5593,7 +5592,6 @@ function ChatInWallet({ sx, ...rest }) {
|
|
|
5593
5592
|
!activeChatId && /* @__PURE__ */ jsx(Empty$1, { sx: { height: 1 } })
|
|
5594
5593
|
] }) });
|
|
5595
5594
|
}
|
|
5596
|
-
const tablerSwitchHorizontal = (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: "m16 3l4 4l-4 4m-6-4h10M8 13l-4 4l4 4m-4-4h9" }) });
|
|
5597
5595
|
function Empty({ sx }) {
|
|
5598
5596
|
const { t } = useLocaleContext();
|
|
5599
5597
|
const mergedSx = [
|
|
@@ -5637,7 +5635,7 @@ function ChatListInWallet({ sx, ...rest }) {
|
|
|
5637
5635
|
const { session } = useSessionContext();
|
|
5638
5636
|
const { initialized, chats, activeChatId } = useChatContext();
|
|
5639
5637
|
const { unread } = useUnreadNotification();
|
|
5640
|
-
const { navigateToChatList, updateUnreadState, isWebNavbar } = useChatInWallet();
|
|
5638
|
+
const { navigateToChatList, updateUnreadState, isWebNavbar, isInArcSphere } = useChatInWallet();
|
|
5641
5639
|
useEffect(() => {
|
|
5642
5640
|
updateUnreadState(unread);
|
|
5643
5641
|
}, [unread, updateUnreadState]);
|
|
@@ -5676,6 +5674,7 @@ function ChatListInWallet({ sx, ...rest }) {
|
|
|
5676
5674
|
mb: 1
|
|
5677
5675
|
},
|
|
5678
5676
|
children: [
|
|
5677
|
+
isInArcSphere && /* @__PURE__ */ jsx(IconButton$2, { onClick: () => bridge.call("arcClosePage"), children: /* @__PURE__ */ jsx(Box$1, { component: ArrowBackIosIcon, sx: { fontSize: 16 } }) }),
|
|
5679
5678
|
/* @__PURE__ */ jsxs(
|
|
5680
5679
|
Box$1,
|
|
5681
5680
|
{
|
|
@@ -5686,13 +5685,7 @@ function ChatListInWallet({ sx, ...rest }) {
|
|
|
5686
5685
|
children: [
|
|
5687
5686
|
/* @__PURE__ */ jsx(Box$1, { component: "img", src: window.blocklet.appLogo, alt: "", sx: { width: 20, height: 20 } }),
|
|
5688
5687
|
/* @__PURE__ */ jsx(Box$1, { component: "span", sx: { typography: "h5", fontWeight: "bold" }, children: window.blocklet.appName }),
|
|
5689
|
-
/* @__PURE__ */ jsx(
|
|
5690
|
-
Box$1,
|
|
5691
|
-
{
|
|
5692
|
-
component: tablerSwitchHorizontal,
|
|
5693
|
-
sx: { fontSize: 15, color: "grey.600", "& [stroke-width='2']": { strokeWidth: "2!important" } }
|
|
5694
|
-
}
|
|
5695
|
-
)
|
|
5688
|
+
/* @__PURE__ */ jsx(Box$1, { component: ShortTextIcon, sx: { color: "grey.600" } })
|
|
5696
5689
|
]
|
|
5697
5690
|
}
|
|
5698
5691
|
),
|
|
@@ -5889,8 +5882,7 @@ const DefaultApiErrorHandler = ({ request }) => {
|
|
|
5889
5882
|
useDefaultApiErrorHandler({ request });
|
|
5890
5883
|
return null;
|
|
5891
5884
|
};
|
|
5892
|
-
const
|
|
5893
|
-
const baseURL = joinUrl(window.location.origin, apiPrefix);
|
|
5885
|
+
const baseURL = joinURL(window.location.origin, discussKitMountPoint || "");
|
|
5894
5886
|
let cachedTemplateList = null;
|
|
5895
5887
|
function DefaultEditorConfigProvider({
|
|
5896
5888
|
request,
|
|
@@ -5932,14 +5924,14 @@ function DefaultEditorConfigProvider({
|
|
|
5932
5924
|
var _a3;
|
|
5933
5925
|
if (typeof payload === "string") {
|
|
5934
5926
|
const result2 = await request.post(
|
|
5935
|
-
|
|
5927
|
+
joinURL("/api/ai/completions"),
|
|
5936
5928
|
{ prompt: payload },
|
|
5937
5929
|
{ baseURL, timeout: 3e4 }
|
|
5938
5930
|
);
|
|
5939
5931
|
return (_a3 = result2.data) == null ? void 0 : _a3.message;
|
|
5940
5932
|
}
|
|
5941
5933
|
const result = await request.post(
|
|
5942
|
-
|
|
5934
|
+
joinURL(window.location.origin, aiAssistantMountPoint || "", "/api/ai/completions"),
|
|
5943
5935
|
{ ...payload, stream: false },
|
|
5944
5936
|
{ timeout: 3e4 }
|
|
5945
5937
|
);
|
|
@@ -5957,7 +5949,7 @@ function DefaultEditorConfigProvider({
|
|
|
5957
5949
|
return cachedTemplateList;
|
|
5958
5950
|
}
|
|
5959
5951
|
try {
|
|
5960
|
-
const { data = [] } = await request.get(
|
|
5952
|
+
const { data = [] } = await request.get(joinURL("/api/resources/posts"), { baseURL });
|
|
5961
5953
|
cachedTemplateList = data;
|
|
5962
5954
|
return data;
|
|
5963
5955
|
} catch (e) {
|
|
@@ -5971,7 +5963,7 @@ function DefaultEditorConfigProvider({
|
|
|
5971
5963
|
if (!(item == null ? void 0 : item.id) || !(item == null ? void 0 : item.content)) {
|
|
5972
5964
|
throw new Error("item is required");
|
|
5973
5965
|
}
|
|
5974
|
-
const { data } = await request.post(
|
|
5966
|
+
const { data } = await request.post(joinURL("/api/resources/import"), item, { baseURL });
|
|
5975
5967
|
return data;
|
|
5976
5968
|
}
|
|
5977
5969
|
};
|
|
@@ -5988,8 +5980,8 @@ function DefaultEditorConfigProvider({
|
|
|
5988
5980
|
}
|
|
5989
5981
|
},
|
|
5990
5982
|
userService,
|
|
5991
|
-
blockletEmbedEndpoint:
|
|
5992
|
-
openGraphEndpoint:
|
|
5983
|
+
blockletEmbedEndpoint: joinURL(window.location.origin, discussKitMountPoint || "", "/api/embed/check"),
|
|
5984
|
+
openGraphEndpoint: joinURL(window.location.origin, discussKitMountPoint || "", "/api/embed/og"),
|
|
5993
5985
|
AI,
|
|
5994
5986
|
templatePlugin
|
|
5995
5987
|
};
|
|
@@ -12291,7 +12283,7 @@ export {
|
|
|
12291
12283
|
useUploader as aj,
|
|
12292
12284
|
UploaderTrigger as ak,
|
|
12293
12285
|
UploaderProvider as al,
|
|
12294
|
-
|
|
12286
|
+
getUploadedImageUrl as am,
|
|
12295
12287
|
usePointUpContext as an,
|
|
12296
12288
|
PointUpProvider as ao,
|
|
12297
12289
|
ButtonGroup as ap,
|
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,
|
|
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-CLrbAT1P.mjs";
|
|
3
3
|
import "react/jsx-runtime";
|
|
4
4
|
import "react";
|
|
5
5
|
import "@mui/material/Box";
|
|
@@ -62,9 +62,9 @@ export {
|
|
|
62
62
|
ai as UploaderContext,
|
|
63
63
|
al as UploaderProvider,
|
|
64
64
|
ak as UploaderTrigger,
|
|
65
|
-
am as composeImageUrl,
|
|
66
65
|
ar as create,
|
|
67
66
|
N as getBlogLink,
|
|
67
|
+
am as getUploadedImageUrl,
|
|
68
68
|
as as getWsClient,
|
|
69
69
|
l as lexicalUtils,
|
|
70
70
|
f as preferences,
|
package/dist/index.umd.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
(function(global, factory) {
|
|
2
|
-
typeof exports === "object" && typeof module !== "undefined" ? factory(exports, require("@blocklet/labels"), require("react/jsx-runtime"), require("@mui/material/styles"), require("@arcblock/ux/lib/Theme"), require("react"), require("@mui/material"), require("lodash/isNil"), require("@blocklet/editor/lib/config"), require("react-lazy-with-preload"), require("@lexical/react/LexicalComposerContext"), require("lexical"), require("ahooks"), require("@mui/material/Box"), require("@mui/lab/LoadingButton"), require("@mui/icons-material"), require("@arcblock/ux/lib/Locale/context"), require("@mui/material/Alert"), require("lodash/isBoolean"), require("@mui/material/Button"), require("@arcblock/did-connect/lib/Avatar"), require("@mui/material/AvatarGroup"), require("@mui/material/colors"), require("@mui/material/useMediaQuery"), require("@arcblock/ux/lib/DID"), require("@mui/material/Tooltip"), require("react-router-dom"), require("@arcblock/react-hooks"), require("@arcblock/ux/lib/RelativeTime"), require("@mui/material/Chip"), require("@mui/material/Stack"), require("lodash/groupBy"), require("lodash/flatMap"), require("lodash/uniqBy"), require("lodash/trim"), require("@mui/material/Avatar"), require("@mui/icons-material/BrokenImage"), require("@iconify/react"), require("@arcblock/ux/lib/Empty"), require("@arcblock/did-connect/lib/Session"), require("semver-compare"), require("@arcblock/bridge"), require("@mui/icons-material/NotificationsActiveOutlined"), require("@blocklet/editor/lib/ext/CheckboxPlugin"), require("@arcblock/did-connect/lib/Address"), require("@mui/material/MenuItem"), require("clsx"), require("@mui/material/IconButton"), require("@mui/material/Menu"), require("@arcblock/ux/lib/Dialog"), require("lodash/orderBy"), require("@mui/material/Typography"), require("@mui/material/Skeleton"), require("react-dom"), require("
|
|
3
|
-
})(this, function(exports2, labels, jsxRuntime, styles, Theme, react, material, isNil, config, reactLazyWithPreload, LexicalComposerContext, lexical$1, ahooks, Box, LoadingButton, iconsMaterial, context, Alert, isBoolean, Button, DidAvatar, AvatarGroup, colors, useMediaQuery, DID, Tooltip, reactRouterDom, reactHooks, UxRelativeTime, Chip, Stack, groupBy, flatMap, uniqBy, trim, Avatar$1, BrokenImageIcon, react$1, Empty$3, Session, cmp, bridge, NotificationsActiveOutlinedIcon, CheckboxPlugin, DIDAddress, MuiMenuItem, clsx, IconButton$1, MuiMenu, Dialog, orderBy, Typography, Skeleton, ReactDOM,
|
|
2
|
+
typeof exports === "object" && typeof module !== "undefined" ? factory(exports, require("@blocklet/labels"), require("react/jsx-runtime"), require("@mui/material/styles"), require("@arcblock/ux/lib/Theme"), require("react"), require("@mui/material"), require("lodash/isNil"), require("@blocklet/editor/lib/config"), require("react-lazy-with-preload"), require("@lexical/react/LexicalComposerContext"), require("lexical"), require("ahooks"), require("@mui/material/Box"), require("@mui/lab/LoadingButton"), require("@mui/icons-material"), require("@arcblock/ux/lib/Locale/context"), require("@mui/material/Alert"), require("lodash/isBoolean"), require("@mui/material/Button"), require("@arcblock/did-connect/lib/Avatar"), require("@mui/material/AvatarGroup"), require("@mui/material/colors"), require("@mui/material/useMediaQuery"), require("@arcblock/ux/lib/DID"), require("@mui/material/Tooltip"), require("react-router-dom"), require("@arcblock/react-hooks"), require("@arcblock/ux/lib/RelativeTime"), require("@mui/material/Chip"), require("@mui/material/Stack"), require("lodash/groupBy"), require("lodash/flatMap"), require("lodash/uniqBy"), require("lodash/trim"), require("@mui/material/Avatar"), require("@mui/icons-material/BrokenImage"), require("@iconify/react"), require("@arcblock/ux/lib/Empty"), require("@arcblock/did-connect/lib/Session"), require("semver-compare"), require("@arcblock/bridge"), require("@mui/icons-material/NotificationsActiveOutlined"), require("@blocklet/editor/lib/ext/CheckboxPlugin"), require("@arcblock/did-connect/lib/Address"), require("@mui/material/MenuItem"), require("clsx"), require("@mui/material/IconButton"), require("@mui/material/Menu"), require("@arcblock/ux/lib/Dialog"), require("lodash/orderBy"), require("@mui/material/Typography"), require("@mui/material/Skeleton"), require("react-dom"), require("ufo"), require("dayjs"), require("dayjs/plugin/relativeTime"), require("url-join"), require("mitt"), require("@mui/material/CircularProgress"), require("react-helmet"), require("react-flip-toolkit"), require("@mui/material/colors/grey"), require("@blocklet/editor"), require("@mui/material/Fab"), require("lodash/debounce"), require("@blocklet/editor/lib/main/hooks/useIsFocused"), require("@blocklet/editor/lib/ext/BusyPlugin"), require("@mui/material/TextField"), require("@mui/icons-material/Add"), require("@mui/icons-material/ArrowBackIos"), require("@mui/icons-material/ShortText"), require("axios"), require("@arcblock/ux/lib/Toast"), require("@mui/material/Pagination"), require("unstated-next"), require("js-cookie"), require("@arcblock/ws"), require("@emotion/css"), require("@blocklet/editor/lib/ext/OnContentChangePlugin"), require("@blocklet/editor/lib/ext/ShortcutPlugin"), require("@blocklet/editor/lib/ext/SafeAreaPlugin"), require("@lexical/text"), require("@blocklet/editor/lib/main/nodes/ImageNode"), require("@blocklet/editor/lib/ext/VideoPlugin/VideoNode")) : typeof define === "function" && define.amd ? define(["exports", "@blocklet/labels", "react/jsx-runtime", "@mui/material/styles", "@arcblock/ux/lib/Theme", "react", "@mui/material", "lodash/isNil", "@blocklet/editor/lib/config", "react-lazy-with-preload", "@lexical/react/LexicalComposerContext", "lexical", "ahooks", "@mui/material/Box", "@mui/lab/LoadingButton", "@mui/icons-material", "@arcblock/ux/lib/Locale/context", "@mui/material/Alert", "lodash/isBoolean", "@mui/material/Button", "@arcblock/did-connect/lib/Avatar", "@mui/material/AvatarGroup", "@mui/material/colors", "@mui/material/useMediaQuery", "@arcblock/ux/lib/DID", "@mui/material/Tooltip", "react-router-dom", "@arcblock/react-hooks", "@arcblock/ux/lib/RelativeTime", "@mui/material/Chip", "@mui/material/Stack", "lodash/groupBy", "lodash/flatMap", "lodash/uniqBy", "lodash/trim", "@mui/material/Avatar", "@mui/icons-material/BrokenImage", "@iconify/react", "@arcblock/ux/lib/Empty", "@arcblock/did-connect/lib/Session", "semver-compare", "@arcblock/bridge", "@mui/icons-material/NotificationsActiveOutlined", "@blocklet/editor/lib/ext/CheckboxPlugin", "@arcblock/did-connect/lib/Address", "@mui/material/MenuItem", "clsx", "@mui/material/IconButton", "@mui/material/Menu", "@arcblock/ux/lib/Dialog", "lodash/orderBy", "@mui/material/Typography", "@mui/material/Skeleton", "react-dom", "ufo", "dayjs", "dayjs/plugin/relativeTime", "url-join", "mitt", "@mui/material/CircularProgress", "react-helmet", "react-flip-toolkit", "@mui/material/colors/grey", "@blocklet/editor", "@mui/material/Fab", "lodash/debounce", "@blocklet/editor/lib/main/hooks/useIsFocused", "@blocklet/editor/lib/ext/BusyPlugin", "@mui/material/TextField", "@mui/icons-material/Add", "@mui/icons-material/ArrowBackIos", "@mui/icons-material/ShortText", "axios", "@arcblock/ux/lib/Toast", "@mui/material/Pagination", "unstated-next", "js-cookie", "@arcblock/ws", "@emotion/css", "@blocklet/editor/lib/ext/OnContentChangePlugin", "@blocklet/editor/lib/ext/ShortcutPlugin", "@blocklet/editor/lib/ext/SafeAreaPlugin", "@lexical/text", "@blocklet/editor/lib/main/nodes/ImageNode", "@blocklet/editor/lib/ext/VideoPlugin/VideoNode"], factory) : (global = typeof globalThis !== "undefined" ? globalThis : global || self, factory(global.DiscussKitComponents = {}, global.labels, global.jsxRuntime, global.styles, global.Theme, global.react, global.material, global.isNil, global.config, global.reactLazyWithPreload, global.LexicalComposerContext, global.lexical$1, global.ahooks, global.Box, global.LoadingButton, global.iconsMaterial, global.context, global.Alert, global.isBoolean, global.Button, global.DidAvatar, global.AvatarGroup, global.colors, global.useMediaQuery, global.DID, global.Tooltip, global.reactRouterDom, global.reactHooks, global.UxRelativeTime, global.Chip, global.Stack, global.groupBy, global.flatMap, global.uniqBy, global.trim, global.Avatar$1, global.BrokenImageIcon, global.react$1, global.Empty$3, global.Session, global.cmp, global.bridge, global.NotificationsActiveOutlinedIcon, global.CheckboxPlugin, global.DIDAddress, global.MuiMenuItem, global.clsx, global.IconButton$1, global.MuiMenu, global.Dialog, global.orderBy, global.Typography, global.Skeleton, global.ReactDOM, global.ufo, global.dayjs, global.relativeTime, global.joinUrl, global.mitt, global.CircularProgress, global.reactHelmet, global.reactFlipToolkit, global.grey, global.editor$1, global.Fab, global.debounce, global.useIsFocused, global.BusyPlugin, global.TextField, global.AddIcon, global.ArrowBackIosIcon, global.ShortTextIcon, global.axios, global.Toast, global.MuiPagination, global.unstatedNext, global.Cookie, global.ws, global.css, global.OnContentChangePlugin, global.ShortcutPlugin$1, global.SafeAreaPlugin, global.text, global.ImageNode, global.VideoNode));
|
|
3
|
+
})(this, function(exports2, labels, jsxRuntime, styles, Theme, react, material, isNil, config, reactLazyWithPreload, LexicalComposerContext, lexical$1, ahooks, Box, LoadingButton, iconsMaterial, context, Alert, isBoolean, Button, DidAvatar, AvatarGroup, colors, useMediaQuery, DID, Tooltip, reactRouterDom, reactHooks, UxRelativeTime, Chip, Stack, groupBy, flatMap, uniqBy, trim, Avatar$1, BrokenImageIcon, react$1, Empty$3, Session, cmp, bridge, NotificationsActiveOutlinedIcon, CheckboxPlugin, DIDAddress, MuiMenuItem, clsx, IconButton$1, MuiMenu, Dialog, orderBy, Typography, Skeleton, ReactDOM, ufo, dayjs, relativeTime, joinUrl, mitt, CircularProgress, reactHelmet, reactFlipToolkit, grey, editor$1, Fab, debounce, useIsFocused, BusyPlugin, TextField, AddIcon, ArrowBackIosIcon, ShortTextIcon, axios, Toast, MuiPagination, unstatedNext, Cookie, ws, css, OnContentChangePlugin, ShortcutPlugin$1, SafeAreaPlugin, text, ImageNode, VideoNode) {
|
|
4
4
|
"use strict";var __defProp = Object.defineProperty;
|
|
5
5
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
6
6
|
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
@@ -219,10 +219,6 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
219
219
|
const info = getBlockletMountPointInfo(name);
|
|
220
220
|
return (info == null ? void 0 : info.status) === "running";
|
|
221
221
|
};
|
|
222
|
-
const inferDiscussKitApiPrefix = () => {
|
|
223
|
-
const service = getBlockletMountPointInfo("did-comments");
|
|
224
|
-
return service ? joinUrl(service.mountPoint, "/") : "/";
|
|
225
|
-
};
|
|
226
222
|
const getDraftSessionKeyPrefix = () => {
|
|
227
223
|
return "comment-draft-";
|
|
228
224
|
};
|
|
@@ -267,6 +263,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
267
263
|
return mergedSx;
|
|
268
264
|
};
|
|
269
265
|
const discussKitMountPoint = (_a = getBlockletMountPointInfo("did-comments")) == null ? void 0 : _a.mountPoint;
|
|
266
|
+
const discussKitUploadsUrl = ufo.joinURL(discussKitMountPoint || "", "/uploads");
|
|
270
267
|
const isInDiscussKitApp = discussKitMountPoint && ufo.withTrailingSlash(window.blocklet.prefix) === ufo.withTrailingSlash(discussKitMountPoint);
|
|
271
268
|
const openProfile = (did, newTab) => {
|
|
272
269
|
if (did) {
|
|
@@ -288,6 +285,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
288
285
|
blockletExists,
|
|
289
286
|
copy,
|
|
290
287
|
discussKitMountPoint,
|
|
288
|
+
discussKitUploadsUrl,
|
|
291
289
|
getBlockletMountPointInfo,
|
|
292
290
|
getDiscussKitClientId,
|
|
293
291
|
getDraftSessionKeyPrefix,
|
|
@@ -295,7 +293,6 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
295
293
|
getLastItem,
|
|
296
294
|
getPreference,
|
|
297
295
|
getResizedAvatar,
|
|
298
|
-
inferDiscussKitApiPrefix,
|
|
299
296
|
isInDiscussKitApp,
|
|
300
297
|
mergeSx,
|
|
301
298
|
minDelay,
|
|
@@ -405,14 +402,12 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
405
402
|
}, [editor2, callback]);
|
|
406
403
|
return null;
|
|
407
404
|
}
|
|
408
|
-
const UPLOADS_PREFIX$1 = "/uploads";
|
|
409
|
-
const IMAGE_URL_PREFIX = joinUrl(inferDiscussKitApiPrefix(), UPLOADS_PREFIX$1);
|
|
410
405
|
const originalExportJSON$1 = ImageNode.ImageNode.prototype.exportJSON;
|
|
411
406
|
const ensureLeadingSlash$1 = (str) => str.startsWith("/") ? str : `/${str}`;
|
|
412
407
|
ImageNode.ImageNode.prototype.exportJSON = function exportJSON() {
|
|
413
408
|
const json = originalExportJSON$1.call(this);
|
|
414
|
-
if (json.src && json.src.startsWith(
|
|
415
|
-
json.src = json.src.replace(
|
|
409
|
+
if (json.src && json.src.startsWith(discussKitUploadsUrl)) {
|
|
410
|
+
json.src = json.src.replace(discussKitUploadsUrl, "");
|
|
416
411
|
json.src = ensureLeadingSlash$1(json.src);
|
|
417
412
|
}
|
|
418
413
|
return json;
|
|
@@ -420,8 +415,8 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
420
415
|
function imageNodeTransform(node) {
|
|
421
416
|
const targetNode = node;
|
|
422
417
|
const src = targetNode.getSrc();
|
|
423
|
-
if ((src == null ? void 0 : src.startsWith("/")) && !src.startsWith(
|
|
424
|
-
targetNode.setSrc(
|
|
418
|
+
if ((src == null ? void 0 : src.startsWith("/")) && !src.startsWith(discussKitUploadsUrl)) {
|
|
419
|
+
targetNode.setSrc(ufo.joinURL(discussKitUploadsUrl, src));
|
|
425
420
|
}
|
|
426
421
|
}
|
|
427
422
|
function ImagePathFixerPlugin() {
|
|
@@ -431,13 +426,12 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
431
426
|
}, [editor2]);
|
|
432
427
|
return null;
|
|
433
428
|
}
|
|
434
|
-
const UPLOADS_PREFIX = joinUrl(inferDiscussKitApiPrefix(), "/uploads");
|
|
435
429
|
const originalExportJSON = VideoNode.VideoNode.prototype.exportJSON;
|
|
436
430
|
const ensureLeadingSlash = (str) => str.startsWith("/") ? str : `/${str}`;
|
|
437
431
|
VideoNode.VideoNode.prototype.exportJSON = function exportJSON() {
|
|
438
432
|
const json = originalExportJSON.call(this);
|
|
439
|
-
if (json.src && json.src.startsWith(
|
|
440
|
-
json.src = json.src.replace(
|
|
433
|
+
if (json.src && json.src.startsWith(discussKitUploadsUrl)) {
|
|
434
|
+
json.src = json.src.replace(discussKitUploadsUrl, "");
|
|
441
435
|
json.src = ensureLeadingSlash(json.src);
|
|
442
436
|
}
|
|
443
437
|
return json;
|
|
@@ -445,8 +439,8 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
445
439
|
function VideoNodeTransform(node) {
|
|
446
440
|
const targetNode = node;
|
|
447
441
|
const src = targetNode.getSrc();
|
|
448
|
-
if ((src == null ? void 0 : src.startsWith("/")) && !src.startsWith(
|
|
449
|
-
targetNode.setSrc(
|
|
442
|
+
if ((src == null ? void 0 : src.startsWith("/")) && !src.startsWith(discussKitUploadsUrl)) {
|
|
443
|
+
targetNode.setSrc(ufo.joinURL(discussKitUploadsUrl, src));
|
|
450
444
|
}
|
|
451
445
|
}
|
|
452
446
|
function VideoPathFixerPlugin() {
|
|
@@ -1194,6 +1188,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
1194
1188
|
navigateToChatList,
|
|
1195
1189
|
isChatInWalletV2,
|
|
1196
1190
|
isWebNavbar,
|
|
1191
|
+
isInArcSphere,
|
|
1197
1192
|
updateUnreadState,
|
|
1198
1193
|
chatInWallet
|
|
1199
1194
|
};
|
|
@@ -2864,16 +2859,18 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
2864
2859
|
] });
|
|
2865
2860
|
}
|
|
2866
2861
|
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" }) });
|
|
2867
|
-
const
|
|
2862
|
+
const getUploadedImageUrl = (imageUrl, width = 320) => {
|
|
2868
2863
|
var _a2;
|
|
2869
|
-
const prefix2 =
|
|
2864
|
+
const prefix2 = ufo.joinURL(((_a2 = window.blocklet) == null ? void 0 : _a2.prefix) || "/", "uploads");
|
|
2870
2865
|
let result = imageUrl;
|
|
2871
2866
|
if (imageUrl && imageUrl.startsWith("/") && !imageUrl.startsWith(prefix2)) {
|
|
2872
|
-
result =
|
|
2867
|
+
result = ufo.joinURL(prefix2, imageUrl);
|
|
2873
2868
|
const tmp = new URL(result, window.location.origin);
|
|
2874
|
-
|
|
2875
|
-
|
|
2876
|
-
|
|
2869
|
+
if (!imageUrl.endsWith(".gif")) {
|
|
2870
|
+
tmp.searchParams.set("imageFilter", "resize");
|
|
2871
|
+
tmp.searchParams.set("w", width.toString());
|
|
2872
|
+
tmp.searchParams.set("f", "webp");
|
|
2873
|
+
}
|
|
2877
2874
|
return tmp.href;
|
|
2878
2875
|
}
|
|
2879
2876
|
return result;
|
|
@@ -2988,7 +2985,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
2988
2985
|
/* @__PURE__ */ jsxRuntime.jsx(material.Box, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2989
2986
|
"img",
|
|
2990
2987
|
{
|
|
2991
|
-
src: url ?
|
|
2988
|
+
src: url ? getUploadedImageUrl(url, width) : "",
|
|
2992
2989
|
loading,
|
|
2993
2990
|
fetchpriority,
|
|
2994
2991
|
style: {
|
|
@@ -3520,7 +3517,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
3520
3517
|
}
|
|
3521
3518
|
return /* @__PURE__ */ jsxRuntime.jsx(BlogList, { ...rest });
|
|
3522
3519
|
}
|
|
3523
|
-
const prefix =
|
|
3520
|
+
const prefix = ufo.joinURL(window.location.origin, discussKitMountPoint || "", "blog");
|
|
3524
3521
|
function BlogPermaLink({ slug, onChange, ...rest }) {
|
|
3525
3522
|
return /* @__PURE__ */ jsxRuntime.jsx(material.Box, { ...rest, className: "blog-permalink-container", children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
3526
3523
|
material.Box,
|
|
@@ -3578,7 +3575,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
3578
3575
|
{
|
|
3579
3576
|
sx: { px: 1 },
|
|
3580
3577
|
onClick: () => {
|
|
3581
|
-
copy(
|
|
3578
|
+
copy(ufo.joinURL(prefix, slug));
|
|
3582
3579
|
},
|
|
3583
3580
|
children: /* @__PURE__ */ jsxRuntime.jsx(iconsMaterial.ContentCopy, { sx: { fontSize: 18 } })
|
|
3584
3581
|
}
|
|
@@ -5518,7 +5515,6 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
5518
5515
|
!activeChatId && /* @__PURE__ */ jsxRuntime.jsx(Empty$1, { sx: { height: 1 } })
|
|
5519
5516
|
] }) });
|
|
5520
5517
|
}
|
|
5521
|
-
const tablerSwitchHorizontal = (props) => /* @__PURE__ */ jsxRuntime.jsx("svg", { viewBox: "0 0 24 24", "data-iconify": "tabler", width: "1.2em", height: "1.2em", ...props, children: /* @__PURE__ */ jsxRuntime.jsx("path", { fill: "none", stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "m16 3l4 4l-4 4m-6-4h10M8 13l-4 4l4 4m-4-4h9" }) });
|
|
5522
5518
|
function Empty({ sx }) {
|
|
5523
5519
|
const { t } = context.useLocaleContext();
|
|
5524
5520
|
const mergedSx = [
|
|
@@ -5562,7 +5558,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
5562
5558
|
const { session } = useSessionContext();
|
|
5563
5559
|
const { initialized, chats, activeChatId } = useChatContext();
|
|
5564
5560
|
const { unread } = useUnreadNotification();
|
|
5565
|
-
const { navigateToChatList, updateUnreadState, isWebNavbar } = useChatInWallet();
|
|
5561
|
+
const { navigateToChatList, updateUnreadState, isWebNavbar, isInArcSphere } = useChatInWallet();
|
|
5566
5562
|
react.useEffect(() => {
|
|
5567
5563
|
updateUnreadState(unread);
|
|
5568
5564
|
}, [unread, updateUnreadState]);
|
|
@@ -5601,6 +5597,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
5601
5597
|
mb: 1
|
|
5602
5598
|
},
|
|
5603
5599
|
children: [
|
|
5600
|
+
isInArcSphere && /* @__PURE__ */ jsxRuntime.jsx(material.IconButton, { onClick: () => bridge.call("arcClosePage"), children: /* @__PURE__ */ jsxRuntime.jsx(Box, { component: ArrowBackIosIcon, sx: { fontSize: 16 } }) }),
|
|
5604
5601
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
5605
5602
|
Box,
|
|
5606
5603
|
{
|
|
@@ -5611,13 +5608,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
5611
5608
|
children: [
|
|
5612
5609
|
/* @__PURE__ */ jsxRuntime.jsx(Box, { component: "img", src: window.blocklet.appLogo, alt: "", sx: { width: 20, height: 20 } }),
|
|
5613
5610
|
/* @__PURE__ */ jsxRuntime.jsx(Box, { component: "span", sx: { typography: "h5", fontWeight: "bold" }, children: window.blocklet.appName }),
|
|
5614
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
5615
|
-
Box,
|
|
5616
|
-
{
|
|
5617
|
-
component: tablerSwitchHorizontal,
|
|
5618
|
-
sx: { fontSize: 15, color: "grey.600", "& [stroke-width='2']": { strokeWidth: "2!important" } }
|
|
5619
|
-
}
|
|
5620
|
-
)
|
|
5611
|
+
/* @__PURE__ */ jsxRuntime.jsx(Box, { component: ShortTextIcon, sx: { color: "grey.600" } })
|
|
5621
5612
|
]
|
|
5622
5613
|
}
|
|
5623
5614
|
),
|
|
@@ -5814,8 +5805,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
5814
5805
|
useDefaultApiErrorHandler({ request });
|
|
5815
5806
|
return null;
|
|
5816
5807
|
};
|
|
5817
|
-
const
|
|
5818
|
-
const baseURL = joinUrl(window.location.origin, apiPrefix);
|
|
5808
|
+
const baseURL = ufo.joinURL(window.location.origin, discussKitMountPoint || "");
|
|
5819
5809
|
let cachedTemplateList = null;
|
|
5820
5810
|
function DefaultEditorConfigProvider({
|
|
5821
5811
|
request,
|
|
@@ -5857,14 +5847,14 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
5857
5847
|
var _a3;
|
|
5858
5848
|
if (typeof payload === "string") {
|
|
5859
5849
|
const result2 = await request.post(
|
|
5860
|
-
|
|
5850
|
+
ufo.joinURL("/api/ai/completions"),
|
|
5861
5851
|
{ prompt: payload },
|
|
5862
5852
|
{ baseURL, timeout: 3e4 }
|
|
5863
5853
|
);
|
|
5864
5854
|
return (_a3 = result2.data) == null ? void 0 : _a3.message;
|
|
5865
5855
|
}
|
|
5866
5856
|
const result = await request.post(
|
|
5867
|
-
|
|
5857
|
+
ufo.joinURL(window.location.origin, aiAssistantMountPoint || "", "/api/ai/completions"),
|
|
5868
5858
|
{ ...payload, stream: false },
|
|
5869
5859
|
{ timeout: 3e4 }
|
|
5870
5860
|
);
|
|
@@ -5882,7 +5872,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
5882
5872
|
return cachedTemplateList;
|
|
5883
5873
|
}
|
|
5884
5874
|
try {
|
|
5885
|
-
const { data = [] } = await request.get(
|
|
5875
|
+
const { data = [] } = await request.get(ufo.joinURL("/api/resources/posts"), { baseURL });
|
|
5886
5876
|
cachedTemplateList = data;
|
|
5887
5877
|
return data;
|
|
5888
5878
|
} catch (e) {
|
|
@@ -5896,7 +5886,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
5896
5886
|
if (!(item == null ? void 0 : item.id) || !(item == null ? void 0 : item.content)) {
|
|
5897
5887
|
throw new Error("item is required");
|
|
5898
5888
|
}
|
|
5899
|
-
const { data } = await request.post(
|
|
5889
|
+
const { data } = await request.post(ufo.joinURL("/api/resources/import"), item, { baseURL });
|
|
5900
5890
|
return data;
|
|
5901
5891
|
}
|
|
5902
5892
|
};
|
|
@@ -5913,8 +5903,8 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
5913
5903
|
}
|
|
5914
5904
|
},
|
|
5915
5905
|
userService,
|
|
5916
|
-
blockletEmbedEndpoint:
|
|
5917
|
-
openGraphEndpoint:
|
|
5906
|
+
blockletEmbedEndpoint: ufo.joinURL(window.location.origin, discussKitMountPoint || "", "/api/embed/check"),
|
|
5907
|
+
openGraphEndpoint: ufo.joinURL(window.location.origin, discussKitMountPoint || "", "/api/embed/og"),
|
|
5918
5908
|
AI,
|
|
5919
5909
|
templatePlugin
|
|
5920
5910
|
};
|
|
@@ -12256,9 +12246,9 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
12256
12246
|
exports2.UploaderContext = UploaderContext;
|
|
12257
12247
|
exports2.UploaderProvider = UploaderProvider;
|
|
12258
12248
|
exports2.UploaderTrigger = UploaderTrigger;
|
|
12259
|
-
exports2.composeImageUrl = composeImageUrl;
|
|
12260
12249
|
exports2.create = create;
|
|
12261
12250
|
exports2.getBlogLink = getBlogLink;
|
|
12251
|
+
exports2.getUploadedImageUrl = getUploadedImageUrl;
|
|
12262
12252
|
exports2.getWsClient = getWsClient;
|
|
12263
12253
|
exports2.lexicalUtils = lexical;
|
|
12264
12254
|
exports2.preferences = preferences;
|
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.11",
|
|
4
4
|
"files": [
|
|
5
5
|
"dist"
|
|
6
6
|
],
|
|
@@ -43,8 +43,8 @@
|
|
|
43
43
|
"ufo": "^1.5.4",
|
|
44
44
|
"unstated-next": "^1.1.0",
|
|
45
45
|
"url-join": "^4.0.1",
|
|
46
|
-
"@blocklet/editor": "^2.1.
|
|
47
|
-
"@blocklet/labels": "^2.1.
|
|
46
|
+
"@blocklet/editor": "^2.1.11",
|
|
47
|
+
"@blocklet/labels": "^2.1.11"
|
|
48
48
|
},
|
|
49
49
|
"peerDependencies": {
|
|
50
50
|
"@arcblock/did-connect": "^2.10.36",
|