@blocklet/discuss-kit-ux 1.5.186 → 1.5.188

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.
@@ -0,0 +1 @@
1
+ export declare function VideoPathFixerPlugin(): null;
@@ -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, a as isEmptyContent, s as stringify, g as getExcerptSync } from "./index-625024f0.mjs";
7
+ import { i as inferInitialEditorState, I as ImagePathFixerPlugin, V as VideoPathFixerPlugin, a as isEmptyContent, s as stringify, g as getExcerptSync } from "./index-20737352.mjs";
8
8
  import "@blocklet/labels";
9
9
  import "@mui/material/styles";
10
10
  import "@mui/material/Box";
@@ -15,6 +15,7 @@ import "@lexical/text";
15
15
  import "url-join";
16
16
  import "@lexical/react/LexicalComposerContext";
17
17
  import "@blocklet/editor/lib/main/nodes/ImageNode";
18
+ import "@blocklet/editor/lib/ext/VideoPlugin/VideoNode";
18
19
  import "ahooks";
19
20
  import "@mui/lab/LoadingButton";
20
21
  import "@mui/icons-material";
@@ -81,6 +82,7 @@ function Editor({ initialContent, onChange, children, onSave, ...rest }) {
81
82
  };
82
83
  return /* @__PURE__ */ jsx(Root, { children: /* @__PURE__ */ jsxs(BlockletEditor, { editorState: inferInitialEditorState(initialContent), ...rest, children: [
83
84
  /* @__PURE__ */ jsx(ImagePathFixerPlugin, {}),
85
+ /* @__PURE__ */ jsx(VideoPathFixerPlugin, {}),
84
86
  /* @__PURE__ */ jsx(OnContentChangePlugin, { onChange: handleChange }),
85
87
  onSave && /* @__PURE__ */ jsx(CtrlsShortcutPlugin, { callback: onSave }),
86
88
  /* @__PURE__ */ jsx(SafeAreaPlugin, {}),
@@ -17,6 +17,7 @@ import { $isRootTextContentEmpty } from "@lexical/text";
17
17
  import joinUrl from "url-join";
18
18
  import { useLexicalComposerContext } from "@lexical/react/LexicalComposerContext";
19
19
  import { ImageNode } from "@blocklet/editor/lib/main/nodes/ImageNode";
20
+ import { VideoNode } from "@blocklet/editor/lib/ext/VideoPlugin/VideoNode";
20
21
  import { useSize, useSetState, useGetState, useReactive } from "ahooks";
21
22
  import LoadingButton from "@mui/lab/LoadingButton";
22
23
  import { Send, Save, ChatBubbleOutlineOutlined, MoreVert, AddReactionOutlined, NavigateNext, DeleteOutlineOutlined, ContentCopy, ArrowUpward, ArrowDownward, ArrowBackIos, Add } from "@mui/icons-material";
@@ -174,7 +175,7 @@ const getBlockletMountPointInfo = (name) => {
174
175
  };
175
176
  const blockletExists = (name) => {
176
177
  const info = getBlockletMountPointInfo(name);
177
- return (info == null ? void 0 : info.status) === '"running"';
178
+ return (info == null ? void 0 : info.status) === "running";
178
179
  };
179
180
  const inferDiscussKitApiPrefix = () => {
180
181
  const service = getBlockletMountPointInfo("did-comments");
@@ -294,13 +295,13 @@ function CmdEnterShortcutPlugin({ callback, shortcut = "CMD_ENTER" }) {
294
295
  }, [editor, callback]);
295
296
  return null;
296
297
  }
297
- const UPLOADS_PREFIX = "/uploads";
298
- const IMAGE_URL_PREFIX = joinUrl(inferDiscussKitApiPrefix(), UPLOADS_PREFIX);
299
- const originalExportJSON = ImageNode.prototype.exportJSON;
298
+ const UPLOADS_PREFIX$1 = "/uploads";
299
+ const IMAGE_URL_PREFIX = joinUrl(inferDiscussKitApiPrefix(), UPLOADS_PREFIX$1);
300
+ const originalExportJSON$1 = ImageNode.prototype.exportJSON;
300
301
  const ensureLeadingSlash = (str) => str.startsWith("/") ? str : `/${str}`;
301
302
  const stripResizeQuery = (str) => str.split("?").shift();
302
303
  ImageNode.prototype.exportJSON = function exportJSON() {
303
- const json = originalExportJSON.call(this);
304
+ const json = originalExportJSON$1.call(this);
304
305
  if (json.src && json.src.startsWith(IMAGE_URL_PREFIX)) {
305
306
  json.src = json.src.replace(IMAGE_URL_PREFIX, "");
306
307
  json.src = ensureLeadingSlash(json.src);
@@ -332,6 +333,30 @@ function ImagePathFixerPlugin() {
332
333
  }, [editor]);
333
334
  return null;
334
335
  }
336
+ const UPLOADS_PREFIX = joinUrl(inferDiscussKitApiPrefix(), "/uploads");
337
+ const originalExportJSON = VideoNode.prototype.exportJSON;
338
+ VideoNode.prototype.exportJSON = function exportJSON2() {
339
+ const json = originalExportJSON.call(this);
340
+ if (this.__originalSrc__ !== void 0) {
341
+ json.src = this.__originalSrc__;
342
+ }
343
+ return json;
344
+ };
345
+ function VideoNodeTransform(node) {
346
+ const targetNode = node;
347
+ const src = targetNode.getSrc();
348
+ if ((src == null ? void 0 : src.startsWith("/")) && targetNode.__originalSrc__ === void 0) {
349
+ targetNode.setSrc(joinUrl(UPLOADS_PREFIX, src));
350
+ targetNode.__originalSrc__ = src;
351
+ }
352
+ }
353
+ function VideoPathFixerPlugin() {
354
+ const [editor] = useLexicalComposerContext();
355
+ useEffect(() => {
356
+ return editor.registerNodeTransform(VideoNode, VideoNodeTransform);
357
+ }, [editor]);
358
+ return null;
359
+ }
335
360
  function AutoClearPlugin({ value, isChanged }) {
336
361
  const [editor] = useLexicalComposerContext();
337
362
  useEffect(() => {
@@ -472,6 +497,7 @@ const Input = ({
472
497
  children: [
473
498
  /* @__PURE__ */ jsx(CmdEnterShortcutPlugin, { shortcut, callback: handleCmdEnterPressed }),
474
499
  /* @__PURE__ */ jsx(ImagePathFixerPlugin, {}),
500
+ /* @__PURE__ */ jsx(VideoPathFixerPlugin, {}),
475
501
  /* @__PURE__ */ jsx(AutoClearPlugin, { value: content, isChanged: isChanged.current }),
476
502
  children
477
503
  ]
@@ -1108,6 +1134,7 @@ function PostContent({
1108
1134
  if (!autoCollapse) {
1109
1135
  return /* @__PURE__ */ jsx(Suspense, { children: /* @__PURE__ */ jsxs(StyledBlockletEditor, { editable: false, editorState: inferInitialEditorState(content), children: [
1110
1136
  /* @__PURE__ */ jsx(ImagePathFixerPlugin, {}),
1137
+ /* @__PURE__ */ jsx(VideoPathFixerPlugin, {}),
1111
1138
  /* @__PURE__ */ jsx(CheckboxPlugin, { send: onSubmit })
1112
1139
  ] }) });
1113
1140
  }
@@ -2374,9 +2401,9 @@ function UploaderProvider({ children }) {
2374
2401
  "image/jpeg",
2375
2402
  "image/gif",
2376
2403
  "image/webp",
2377
- "image/svg+xml"
2378
- // 'video/mp4',
2379
- // 'video/webm',
2404
+ "image/svg+xml",
2405
+ "video/mp4",
2406
+ "video/webm"
2380
2407
  ],
2381
2408
  maxNumberOfFiles: void 0
2382
2409
  // default is unlimited
@@ -4313,7 +4340,7 @@ function Pagination({ page, size = 20, total, onChange, routerMode = true, ...re
4313
4340
  }
4314
4341
  );
4315
4342
  }
4316
- const Editor = lazy(() => import("./editor-c429bd0d.mjs"));
4343
+ const Editor = lazy(() => import("./editor-90305710.mjs"));
4317
4344
  function LazyEditor(props) {
4318
4345
  const fallback = /* @__PURE__ */ jsxs(Fragment, { children: [
4319
4346
  /* @__PURE__ */ jsx(Skeleton, {}),
@@ -4333,6 +4360,7 @@ function EditorPreview({ content, children, ...rest }) {
4333
4360
  ] });
4334
4361
  return /* @__PURE__ */ jsx(Suspense, { fallback, children: /* @__PURE__ */ jsxs(BlockletEditor, { editorState: inferInitialEditorState(content), editable: false, ...rest, children: [
4335
4362
  /* @__PURE__ */ jsx(ImagePathFixerPlugin, {}),
4363
+ /* @__PURE__ */ jsx(VideoPathFixerPlugin, {}),
4336
4364
  children
4337
4365
  ] }) });
4338
4366
  }
@@ -10157,7 +10185,7 @@ function PointUpProvider({ children }) {
10157
10185
  ] });
10158
10186
  }
10159
10187
  export {
10160
- useConfirm as $,
10188
+ ConfirmContext as $,
10161
10189
  Avatar as A,
10162
10190
  BinaryThumb as B,
10163
10191
  CommentInput as C,
@@ -10179,33 +10207,34 @@ export {
10179
10207
  ScrollableEditorWrapper as S,
10180
10208
  ChatHeaderAddon as T,
10181
10209
  useChatContext as U,
10182
- ChatProvider as V,
10183
- UnreadNotificationContext as W,
10184
- useUnreadNotification as X,
10185
- UnreadNotificationProvider as Y,
10186
- Confirm as Z,
10187
- ConfirmContext as _,
10210
+ VideoPathFixerPlugin as V,
10211
+ ChatProvider as W,
10212
+ UnreadNotificationContext as X,
10213
+ useUnreadNotification as Y,
10214
+ UnreadNotificationProvider as Z,
10215
+ Confirm as _,
10188
10216
  isEmptyContent as a,
10189
- ConfirmProvider as a0,
10190
- SecureLabelPicker as a1,
10191
- useApiErrorHandler as a2,
10192
- useDefaultApiErrorHandler as a3,
10193
- PreviousLocationRecorder as a4,
10194
- Back as a5,
10195
- LazyEditor as a6,
10196
- EditorPreview as a7,
10197
- DirtyPromptContainer as a8,
10198
- ConfirmNavigation as a9,
10199
- UploaderContext as aa,
10200
- useUploader as ab,
10201
- UploaderTrigger as ac,
10202
- UploaderProvider as ad,
10203
- composeImageUrl as ae,
10204
- usePointUpContext as af,
10205
- PointUpProvider as ag,
10206
- create as ah,
10207
- getWsClient as ai,
10208
- useSubscription as aj,
10217
+ useConfirm as a0,
10218
+ ConfirmProvider as a1,
10219
+ SecureLabelPicker as a2,
10220
+ useApiErrorHandler as a3,
10221
+ useDefaultApiErrorHandler as a4,
10222
+ PreviousLocationRecorder as a5,
10223
+ Back as a6,
10224
+ LazyEditor as a7,
10225
+ EditorPreview as a8,
10226
+ DirtyPromptContainer as a9,
10227
+ ConfirmNavigation as aa,
10228
+ UploaderContext as ab,
10229
+ useUploader as ac,
10230
+ UploaderTrigger as ad,
10231
+ UploaderProvider as ae,
10232
+ composeImageUrl as af,
10233
+ usePointUpContext as ag,
10234
+ PointUpProvider as ah,
10235
+ create as ai,
10236
+ getWsClient as aj,
10237
+ useSubscription as ak,
10209
10238
  InternalThemeProvider as b,
10210
10239
  Input as c,
10211
10240
  translations as d,
package/dist/index.es.js CHANGED
@@ -1,5 +1,5 @@
1
1
  export * from "@blocklet/labels";
2
- import { K, j, N, A, h, a5, B, z, y, E, Q, O, T, V, o, C, q, v, x, Z, _, a9, a0, H, J, D, a8, a7, G, c, b, a6, M, P, ag, n, m, a4, R, S, a1, k, W, Y, aa, ad, ac, ae, ah, F, ai, l, p, r, t, d, a2, L, e, U, w, $, a3, u, af, aj, X, ab, f } from "./index-625024f0.mjs";
2
+ import { K, j, N, A, h, a6, B, z, y, E, Q, O, T, W, o, C, q, v, x, _, $, aa, a1, H, J, D, a9, a8, G, c, b, a7, M, P, ah, n, m, a5, R, S, a2, k, X, Z, ab, ae, ad, af, ai, F, aj, l, p, r, t, d, a3, L, e, U, w, a0, a4, u, ag, ak, Y, ac, f } from "./index-20737352.mjs";
3
3
  import "react/jsx-runtime";
4
4
  import "react";
5
5
  import "@mui/material/Box";
@@ -17,6 +17,7 @@ import "@lexical/text";
17
17
  import "url-join";
18
18
  import "@lexical/react/LexicalComposerContext";
19
19
  import "@blocklet/editor/lib/main/nodes/ImageNode";
20
+ import "@blocklet/editor/lib/ext/VideoPlugin/VideoNode";
20
21
  import "ahooks";
21
22
  import "@mui/material/Alert";
22
23
  import "@arcblock/did-connect/lib/Avatar";
@@ -64,7 +65,7 @@ export {
64
65
  N as AuthzProvider,
65
66
  A as Avatar,
66
67
  h as Avatars,
67
- a5 as Back,
68
+ a6 as Back,
68
69
  B as BinaryThumb,
69
70
  z as BlogCard,
70
71
  y as BlogList,
@@ -72,60 +73,60 @@ export {
72
73
  Q as Chat,
73
74
  O as ChatClient,
74
75
  T as ChatHeaderAddon,
75
- V as ChatProvider,
76
+ W as ChatProvider,
76
77
  o as Comment,
77
78
  C as CommentInput,
78
79
  q as CommentList,
79
80
  v as CommentsContext,
80
81
  x as CommentsProvider,
81
- Z as Confirm,
82
- _ as ConfirmContext,
83
- a9 as ConfirmNavigation,
84
- a0 as ConfirmProvider,
82
+ _ as Confirm,
83
+ $ as ConfirmContext,
84
+ aa as ConfirmNavigation,
85
+ a1 as ConfirmProvider,
85
86
  H as CoverImage,
86
87
  J as CoverImageUpload,
87
88
  D as DefaultEditorConfigProvider,
88
- a8 as DirtyPromptContainer,
89
- a7 as EditorPreview,
89
+ a9 as DirtyPromptContainer,
90
+ a8 as EditorPreview,
90
91
  G as GithubReaction,
91
92
  c as Input,
92
93
  b as InternalThemeProvider,
93
- a6 as LazyEditor,
94
+ a7 as LazyEditor,
94
95
  M as Menu,
95
96
  P as Pagination,
96
- ag as PointUpProvider,
97
+ ah as PointUpProvider,
97
98
  n as Post,
98
99
  m as PostContent,
99
- a4 as PreviousLocationRecorder,
100
+ a5 as PreviousLocationRecorder,
100
101
  R as RelativeTime,
101
102
  S as ScrollableEditorWrapper,
102
- a1 as SecureLabelPicker,
103
+ a2 as SecureLabelPicker,
103
104
  k as SystemUser,
104
- W as UnreadNotificationContext,
105
- Y as UnreadNotificationProvider,
106
- aa as UploaderContext,
107
- ad as UploaderProvider,
108
- ac as UploaderTrigger,
109
- ae as composeImageUrl,
110
- ah as create,
105
+ X as UnreadNotificationContext,
106
+ Z as UnreadNotificationProvider,
107
+ ab as UploaderContext,
108
+ ae as UploaderProvider,
109
+ ad as UploaderTrigger,
110
+ af as composeImageUrl,
111
+ ai as create,
111
112
  F as getBlogLink,
112
- ai as getWsClient,
113
+ aj as getWsClient,
113
114
  l as lexicalUtils,
114
115
  p as preferences,
115
116
  r as routes,
116
117
  t as themeOverrides,
117
118
  d as translations,
118
- a2 as useApiErrorHandler,
119
+ a3 as useApiErrorHandler,
119
120
  L as useAuthzContext,
120
121
  e as useChanged,
121
122
  U as useChatContext,
122
123
  w as useCommentsContext,
123
- $ as useConfirm,
124
- a3 as useDefaultApiErrorHandler,
124
+ a0 as useConfirm,
125
+ a4 as useDefaultApiErrorHandler,
125
126
  u as useNow,
126
- af as usePointUpContext,
127
- aj as useSubscription,
128
- X as useUnreadNotification,
129
- ab as useUploader,
127
+ ag as usePointUpContext,
128
+ ak as useSubscription,
129
+ Y as useUnreadNotification,
130
+ ac as useUploader,
130
131
  f as utils
131
132
  };
package/dist/index.umd.js CHANGED
@@ -5,8 +5,8 @@ var __publicField = (obj, key, value) => {
5
5
  return value;
6
6
  };
7
7
  (function(global, factory) {
8
- typeof exports === "object" && typeof module !== "undefined" ? factory(exports, require("@blocklet/labels"), require("react/jsx-runtime"), require("@mui/material/styles"), require("react"), require("@mui/material/Box"), require("@arcblock/ux/lib/Theme"), require("@blocklet/editor/lib/config"), require("@lexical/react/LexicalComposerContext"), require("lexical"), require("ahooks"), require("@mui/lab/LoadingButton"), require("@mui/icons-material"), require("@arcblock/ux/lib/Locale/context"), require("@mui/material/Alert"), require("@mui/material/Button"), require("@arcblock/did-connect/lib/Avatar"), require("@mui/material/useMediaQuery"), require("@arcblock/did-connect/lib/Address"), require("@mui/material/Tooltip"), 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("react-router-dom"), require("@mui/material/colors"), require("@arcblock/did-connect/lib/Session"), require("@mui/material"), require("@blocklet/editor/lib/ext/CheckboxPlugin"), 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("url-join"), require("dayjs"), require("dayjs/plugin/relativeTime"), require("mitt"), require("@mui/material/CircularProgress"), require("@mui/material/Fab"), require("lodash/debounce"), require("@mui/material/TextField"), require("axios"), require("@arcblock/ux/lib/Toast"), require("@mui/material/Pagination"), require("unstated-next"), require("react-dom"), require("js-cookie"), require("@arcblock/ws"), 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")) : typeof define === "function" && define.amd ? define(["exports", "@blocklet/labels", "react/jsx-runtime", "@mui/material/styles", "react", "@mui/material/Box", "@arcblock/ux/lib/Theme", "@blocklet/editor/lib/config", "@lexical/react/LexicalComposerContext", "lexical", "ahooks", "@mui/lab/LoadingButton", "@mui/icons-material", "@arcblock/ux/lib/Locale/context", "@mui/material/Alert", "@mui/material/Button", "@arcblock/did-connect/lib/Avatar", "@mui/material/useMediaQuery", "@arcblock/did-connect/lib/Address", "@mui/material/Tooltip", "@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", "react-router-dom", "@mui/material/colors", "@arcblock/did-connect/lib/Session", "@mui/material", "@blocklet/editor/lib/ext/CheckboxPlugin", "@mui/material/MenuItem", "clsx", "@mui/material/IconButton", "@mui/material/Menu", "@arcblock/ux/lib/Dialog", "lodash/orderBy", "@mui/material/Typography", "@mui/material/Skeleton", "url-join", "dayjs", "dayjs/plugin/relativeTime", "mitt", "@mui/material/CircularProgress", "@mui/material/Fab", "lodash/debounce", "@mui/material/TextField", "axios", "@arcblock/ux/lib/Toast", "@mui/material/Pagination", "unstated-next", "react-dom", "js-cookie", "@arcblock/ws", "@blocklet/editor/lib/ext/OnContentChangePlugin", "@blocklet/editor/lib/ext/ShortcutPlugin", "@blocklet/editor/lib/ext/SafeAreaPlugin", "@lexical/text", "@blocklet/editor/lib/main/nodes/ImageNode"], factory) : (global = typeof globalThis !== "undefined" ? globalThis : global || self, factory(global.DiscussKitComponents = {}, global.labels, global.jsxRuntime, global.styles, global.react, global.Box, global.Theme, global.config, global.LexicalComposerContext, global.lexical$1, global.ahooks, global.LoadingButton, global.iconsMaterial, global.context, global.Alert, global.Button, global.DidAvatar, global.useMediaQuery, global.DIDAddress, global.Tooltip, global.UxRelativeTime, global.Chip, global.Stack, global.groupBy, global.flatMap, global.uniqBy, global.trim, global.Avatar$1, global.BrokenImageIcon, global.react$1, global.reactRouterDom, global.colors, global.Session, global.material, global.CheckboxPlugin, global.MuiMenuItem, global.clsx, global.IconButton$1, global.MuiMenu, global.Dialog, global.orderBy, global.Typography, global.Skeleton, global.joinUrl, global.dayjs, global.relativeTime, global.mitt, global.CircularProgress, global.Fab, global.debounce, global.TextField, global.axios, global.Toast, global.MuiPagination, global.unstatedNext, global.reactDom, global.Cookie, global.ws, global.OnContentChangePlugin, global.ShortcutPlugin, global.SafeAreaPlugin, global.text, global.ImageNode));
9
- })(this, function(exports2, labels, jsxRuntime, styles, react, Box, Theme, config, LexicalComposerContext, lexical$1, ahooks, LoadingButton, iconsMaterial, context, Alert, Button, DidAvatar, useMediaQuery, DIDAddress, Tooltip, UxRelativeTime, Chip, Stack, groupBy, flatMap, uniqBy, trim, Avatar$1, BrokenImageIcon, react$1, reactRouterDom, colors, Session, material, CheckboxPlugin, MuiMenuItem, clsx, IconButton$1, MuiMenu, Dialog, orderBy, Typography, Skeleton, joinUrl, dayjs, relativeTime, mitt, CircularProgress, Fab, debounce, TextField, axios, Toast, MuiPagination, unstatedNext, reactDom, Cookie, ws, OnContentChangePlugin, ShortcutPlugin, SafeAreaPlugin, text, ImageNode) {
8
+ typeof exports === "object" && typeof module !== "undefined" ? factory(exports, require("@blocklet/labels"), require("react/jsx-runtime"), require("@mui/material/styles"), require("react"), require("@mui/material/Box"), require("@arcblock/ux/lib/Theme"), require("@blocklet/editor/lib/config"), require("@lexical/react/LexicalComposerContext"), require("lexical"), require("ahooks"), require("@mui/lab/LoadingButton"), require("@mui/icons-material"), require("@arcblock/ux/lib/Locale/context"), require("@mui/material/Alert"), require("@mui/material/Button"), require("@arcblock/did-connect/lib/Avatar"), require("@mui/material/useMediaQuery"), require("@arcblock/did-connect/lib/Address"), require("@mui/material/Tooltip"), 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("react-router-dom"), require("@mui/material/colors"), require("@arcblock/did-connect/lib/Session"), require("@mui/material"), require("@blocklet/editor/lib/ext/CheckboxPlugin"), 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("url-join"), require("dayjs"), require("dayjs/plugin/relativeTime"), require("mitt"), require("@mui/material/CircularProgress"), require("@mui/material/Fab"), require("lodash/debounce"), require("@mui/material/TextField"), require("axios"), require("@arcblock/ux/lib/Toast"), require("@mui/material/Pagination"), require("unstated-next"), require("react-dom"), require("js-cookie"), require("@arcblock/ws"), 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", "react", "@mui/material/Box", "@arcblock/ux/lib/Theme", "@blocklet/editor/lib/config", "@lexical/react/LexicalComposerContext", "lexical", "ahooks", "@mui/lab/LoadingButton", "@mui/icons-material", "@arcblock/ux/lib/Locale/context", "@mui/material/Alert", "@mui/material/Button", "@arcblock/did-connect/lib/Avatar", "@mui/material/useMediaQuery", "@arcblock/did-connect/lib/Address", "@mui/material/Tooltip", "@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", "react-router-dom", "@mui/material/colors", "@arcblock/did-connect/lib/Session", "@mui/material", "@blocklet/editor/lib/ext/CheckboxPlugin", "@mui/material/MenuItem", "clsx", "@mui/material/IconButton", "@mui/material/Menu", "@arcblock/ux/lib/Dialog", "lodash/orderBy", "@mui/material/Typography", "@mui/material/Skeleton", "url-join", "dayjs", "dayjs/plugin/relativeTime", "mitt", "@mui/material/CircularProgress", "@mui/material/Fab", "lodash/debounce", "@mui/material/TextField", "axios", "@arcblock/ux/lib/Toast", "@mui/material/Pagination", "unstated-next", "react-dom", "js-cookie", "@arcblock/ws", "@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.react, global.Box, global.Theme, global.config, global.LexicalComposerContext, global.lexical$1, global.ahooks, global.LoadingButton, global.iconsMaterial, global.context, global.Alert, global.Button, global.DidAvatar, global.useMediaQuery, global.DIDAddress, global.Tooltip, global.UxRelativeTime, global.Chip, global.Stack, global.groupBy, global.flatMap, global.uniqBy, global.trim, global.Avatar$1, global.BrokenImageIcon, global.react$1, global.reactRouterDom, global.colors, global.Session, global.material, global.CheckboxPlugin, global.MuiMenuItem, global.clsx, global.IconButton$1, global.MuiMenu, global.Dialog, global.orderBy, global.Typography, global.Skeleton, global.joinUrl, global.dayjs, global.relativeTime, global.mitt, global.CircularProgress, global.Fab, global.debounce, global.TextField, global.axios, global.Toast, global.MuiPagination, global.unstatedNext, global.reactDom, global.Cookie, global.ws, global.OnContentChangePlugin, global.ShortcutPlugin, global.SafeAreaPlugin, global.text, global.ImageNode, global.VideoNode));
9
+ })(this, function(exports2, labels, jsxRuntime, styles, react, Box, Theme, config, LexicalComposerContext, lexical$1, ahooks, LoadingButton, iconsMaterial, context, Alert, Button, DidAvatar, useMediaQuery, DIDAddress, Tooltip, UxRelativeTime, Chip, Stack, groupBy, flatMap, uniqBy, trim, Avatar$1, BrokenImageIcon, react$1, reactRouterDom, colors, Session, material, CheckboxPlugin, MuiMenuItem, clsx, IconButton$1, MuiMenu, Dialog, orderBy, Typography, Skeleton, joinUrl, dayjs, relativeTime, mitt, CircularProgress, Fab, debounce, TextField, axios, Toast, MuiPagination, unstatedNext, reactDom, Cookie, ws, OnContentChangePlugin, ShortcutPlugin, SafeAreaPlugin, text, ImageNode, VideoNode) {
10
10
  var _a, _b;
11
11
  "use strict";
12
12
  const themeOverrides = {
@@ -119,7 +119,7 @@ var __publicField = (obj, key, value) => {
119
119
  };
120
120
  const blockletExists = (name) => {
121
121
  const info = getBlockletMountPointInfo(name);
122
- return (info == null ? void 0 : info.status) === '"running"';
122
+ return (info == null ? void 0 : info.status) === "running";
123
123
  };
124
124
  const inferDiscussKitApiPrefix = () => {
125
125
  const service = getBlockletMountPointInfo("did-comments");
@@ -239,13 +239,13 @@ var __publicField = (obj, key, value) => {
239
239
  }, [editor2, callback]);
240
240
  return null;
241
241
  }
242
- const UPLOADS_PREFIX = "/uploads";
243
- const IMAGE_URL_PREFIX = joinUrl(inferDiscussKitApiPrefix(), UPLOADS_PREFIX);
244
- const originalExportJSON = ImageNode.ImageNode.prototype.exportJSON;
242
+ const UPLOADS_PREFIX$1 = "/uploads";
243
+ const IMAGE_URL_PREFIX = joinUrl(inferDiscussKitApiPrefix(), UPLOADS_PREFIX$1);
244
+ const originalExportJSON$1 = ImageNode.ImageNode.prototype.exportJSON;
245
245
  const ensureLeadingSlash = (str) => str.startsWith("/") ? str : `/${str}`;
246
246
  const stripResizeQuery = (str) => str.split("?").shift();
247
247
  ImageNode.ImageNode.prototype.exportJSON = function exportJSON() {
248
- const json = originalExportJSON.call(this);
248
+ const json = originalExportJSON$1.call(this);
249
249
  if (json.src && json.src.startsWith(IMAGE_URL_PREFIX)) {
250
250
  json.src = json.src.replace(IMAGE_URL_PREFIX, "");
251
251
  json.src = ensureLeadingSlash(json.src);
@@ -277,6 +277,30 @@ var __publicField = (obj, key, value) => {
277
277
  }, [editor2]);
278
278
  return null;
279
279
  }
280
+ const UPLOADS_PREFIX = joinUrl(inferDiscussKitApiPrefix(), "/uploads");
281
+ const originalExportJSON = VideoNode.VideoNode.prototype.exportJSON;
282
+ VideoNode.VideoNode.prototype.exportJSON = function exportJSON() {
283
+ const json = originalExportJSON.call(this);
284
+ if (this.__originalSrc__ !== void 0) {
285
+ json.src = this.__originalSrc__;
286
+ }
287
+ return json;
288
+ };
289
+ function VideoNodeTransform(node) {
290
+ const targetNode = node;
291
+ const src = targetNode.getSrc();
292
+ if ((src == null ? void 0 : src.startsWith("/")) && targetNode.__originalSrc__ === void 0) {
293
+ targetNode.setSrc(joinUrl(UPLOADS_PREFIX, src));
294
+ targetNode.__originalSrc__ = src;
295
+ }
296
+ }
297
+ function VideoPathFixerPlugin() {
298
+ const [editor2] = LexicalComposerContext.useLexicalComposerContext();
299
+ react.useEffect(() => {
300
+ return editor2.registerNodeTransform(VideoNode.VideoNode, VideoNodeTransform);
301
+ }, [editor2]);
302
+ return null;
303
+ }
280
304
  function AutoClearPlugin({ value, isChanged }) {
281
305
  const [editor2] = LexicalComposerContext.useLexicalComposerContext();
282
306
  react.useEffect(() => {
@@ -417,6 +441,7 @@ var __publicField = (obj, key, value) => {
417
441
  children: [
418
442
  /* @__PURE__ */ jsxRuntime.jsx(CmdEnterShortcutPlugin, { shortcut, callback: handleCmdEnterPressed }),
419
443
  /* @__PURE__ */ jsxRuntime.jsx(ImagePathFixerPlugin, {}),
444
+ /* @__PURE__ */ jsxRuntime.jsx(VideoPathFixerPlugin, {}),
420
445
  /* @__PURE__ */ jsxRuntime.jsx(AutoClearPlugin, { value: content, isChanged: isChanged.current }),
421
446
  children
422
447
  ]
@@ -1053,6 +1078,7 @@ var __publicField = (obj, key, value) => {
1053
1078
  if (!autoCollapse) {
1054
1079
  return /* @__PURE__ */ jsxRuntime.jsx(react.Suspense, { children: /* @__PURE__ */ jsxRuntime.jsxs(StyledBlockletEditor, { editable: false, editorState: inferInitialEditorState(content), children: [
1055
1080
  /* @__PURE__ */ jsxRuntime.jsx(ImagePathFixerPlugin, {}),
1081
+ /* @__PURE__ */ jsxRuntime.jsx(VideoPathFixerPlugin, {}),
1056
1082
  /* @__PURE__ */ jsxRuntime.jsx(CheckboxPlugin, { send: onSubmit })
1057
1083
  ] }) });
1058
1084
  }
@@ -2319,9 +2345,9 @@ var __publicField = (obj, key, value) => {
2319
2345
  "image/jpeg",
2320
2346
  "image/gif",
2321
2347
  "image/webp",
2322
- "image/svg+xml"
2323
- // 'video/mp4',
2324
- // 'video/webm',
2348
+ "image/svg+xml",
2349
+ "video/mp4",
2350
+ "video/webm"
2325
2351
  ],
2326
2352
  maxNumberOfFiles: void 0
2327
2353
  // default is unlimited
@@ -4278,6 +4304,7 @@ var __publicField = (obj, key, value) => {
4278
4304
  ] });
4279
4305
  return /* @__PURE__ */ jsxRuntime.jsx(react.Suspense, { fallback, children: /* @__PURE__ */ jsxRuntime.jsxs(BlockletEditor$1, { editorState: inferInitialEditorState(content), editable: false, ...rest, children: [
4280
4306
  /* @__PURE__ */ jsxRuntime.jsx(ImagePathFixerPlugin, {}),
4307
+ /* @__PURE__ */ jsxRuntime.jsx(VideoPathFixerPlugin, {}),
4281
4308
  children
4282
4309
  ] }) });
4283
4310
  }
@@ -10121,6 +10148,7 @@ var __publicField = (obj, key, value) => {
10121
10148
  };
10122
10149
  return /* @__PURE__ */ jsxRuntime.jsx(Root, { children: /* @__PURE__ */ jsxRuntime.jsxs(BlockletEditor, { editorState: inferInitialEditorState(initialContent), ...rest, children: [
10123
10150
  /* @__PURE__ */ jsxRuntime.jsx(ImagePathFixerPlugin, {}),
10151
+ /* @__PURE__ */ jsxRuntime.jsx(VideoPathFixerPlugin, {}),
10124
10152
  /* @__PURE__ */ jsxRuntime.jsx(OnContentChangePlugin.OnContentChangePlugin, { onChange: handleChange }),
10125
10153
  onSave && /* @__PURE__ */ jsxRuntime.jsx(ShortcutPlugin.CtrlsShortcutPlugin, { callback: onSave }),
10126
10154
  /* @__PURE__ */ jsxRuntime.jsx(SafeAreaPlugin.SafeAreaPlugin, {}),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blocklet/discuss-kit-ux",
3
- "version": "1.5.186",
3
+ "version": "1.5.188",
4
4
  "files": [
5
5
  "dist"
6
6
  ],
@@ -29,8 +29,8 @@
29
29
  },
30
30
  "dependencies": {
31
31
  "@arcblock/ws": "^1.18.95",
32
- "@blocklet/editor": "1.5.186",
33
- "@blocklet/labels": "1.5.186",
32
+ "@blocklet/editor": "1.5.188",
33
+ "@blocklet/labels": "1.5.188",
34
34
  "@blocklet/uploader": "^0.0.45",
35
35
  "@emotion/css": "^11.10.5",
36
36
  "@emotion/react": "^11.10.5",
@@ -59,8 +59,7 @@
59
59
  "lodash": "^4.17.21",
60
60
  "react": ">=18.0.0",
61
61
  "react-dom": ">=18.0.0",
62
- "react-router-dom": "^6.4.0",
63
- "uppload": "^3.2.1"
62
+ "react-router-dom": "^6.4.0"
64
63
  },
65
64
  "devDependencies": {
66
65
  "@arcblock/eslint-config-ts": "^0.2.4",
@@ -93,5 +92,5 @@
93
92
  "resolutions": {
94
93
  "react": "^18.2.0"
95
94
  },
96
- "gitHead": "5779304dfb653bfa91e78094391c84a03a48d00c"
95
+ "gitHead": "4b497e94ef7c269bcbe7067bccad21b61ca305ba"
97
96
  }