@blocklet/discuss-kit-ux 2.4.67 → 2.4.68
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/editor/blocklet-editor.d.ts +2 -0
- package/dist/components/editor/blocklet-editor.mjs +12 -0
- package/dist/components/editor/editor.mjs +1 -2
- package/dist/components/editor/index.d.ts +1 -0
- package/dist/components/editor/index.mjs +1 -0
- package/dist/components/editor/preview.mjs +1 -2
- package/dist/components/input/index.d.ts +1 -1
- package/dist/components/input/index.mjs +1 -1
- package/dist/components/input/input.d.ts +0 -1
- package/dist/components/input/input.mjs +1 -3
- package/dist/components/posts/post-content.d.ts +2 -1
- package/dist/components/posts/post-content.mjs +11 -4
- package/dist/index.d.ts +1 -1
- package/dist/index.mjs +1 -1
- package/package.json +3 -3
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { useEffect, useState } from "react";
|
|
2
|
+
import { lazyWithPreload } from "react-lazy-with-preload";
|
|
3
|
+
export const BlockletEditor = lazyWithPreload(() => import("@blocklet/editor"));
|
|
4
|
+
export const useBlockletEditorLoaded = () => {
|
|
5
|
+
const [loaded, setLoaded] = useState(false);
|
|
6
|
+
useEffect(() => {
|
|
7
|
+
BlockletEditor.preload().then(() => {
|
|
8
|
+
setLoaded(true);
|
|
9
|
+
});
|
|
10
|
+
}, []);
|
|
11
|
+
return loaded;
|
|
12
|
+
};
|
|
@@ -3,11 +3,10 @@ import { Box, styled } from "@mui/material";
|
|
|
3
3
|
import { OnContentChangePlugin } from "@blocklet/editor/lib/ext/OnContentChangePlugin";
|
|
4
4
|
import { CtrlsShortcutPlugin } from "@blocklet/editor/lib/ext/ShortcutPlugin";
|
|
5
5
|
import { SafeAreaPlugin } from "@blocklet/editor/lib/ext/SafeAreaPlugin";
|
|
6
|
-
import { lazyRetry as lazy } from "@arcblock/ux/lib/Util";
|
|
7
6
|
import { isEmptyContent, inferInitialEditorState, stringify, getExcerptSync } from "../lexical.mjs";
|
|
8
7
|
import ImagePathFixerPlugin from "../input/image-path-fixer-plugin.mjs";
|
|
9
8
|
import { VideoPathFixerPlugin } from "./plugins/video-path-fixer-plugin.mjs";
|
|
10
|
-
|
|
9
|
+
import { BlockletEditor } from "./blocklet-editor.mjs";
|
|
11
10
|
const Root = styled(Box)`
|
|
12
11
|
.be-editable,
|
|
13
12
|
.be-content {
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Suspense } from "react";
|
|
3
|
-
import { lazyRetry as lazy } from "@arcblock/ux/lib/Util";
|
|
4
3
|
import { Skeleton } from "@mui/material";
|
|
5
4
|
import { inferInitialEditorState } from "../lexical.mjs";
|
|
6
5
|
import ImagePathFixerPlugin from "../input/image-path-fixer-plugin.mjs";
|
|
7
6
|
import { VideoPathFixerPlugin } from "./plugins/video-path-fixer-plugin.mjs";
|
|
8
|
-
|
|
7
|
+
import { BlockletEditor } from "./blocklet-editor.mjs";
|
|
9
8
|
const fallback = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
10
9
|
/* @__PURE__ */ jsx(Skeleton, {}),
|
|
11
10
|
/* @__PURE__ */ jsx(Skeleton, { width: "80%" }),
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { default as Input
|
|
1
|
+
export { default as Input } from './input';
|
|
2
2
|
export { default as CommentInput } from './comment-input';
|
|
3
3
|
export { default as PostEdit } from './post-edit';
|
|
4
4
|
export { default as ScrollableEditorWrapper } from './scrollable-editor-wrapper';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { default as Input
|
|
1
|
+
export { default as Input } from "./input.mjs";
|
|
2
2
|
export { default as CommentInput } from "./comment-input.mjs";
|
|
3
3
|
export { default as PostEdit } from "./post-edit.mjs";
|
|
4
4
|
export { default as ScrollableEditorWrapper } from "./scrollable-editor-wrapper.mjs";
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { MutableRefObject } from 'react';
|
|
2
2
|
import { type BoxProps } from '@mui/material';
|
|
3
3
|
import type { EditorState, LexicalEditor } from 'lexical';
|
|
4
|
-
export declare const preloadInput: () => Promise<typeof import("@blocklet/editor").default>;
|
|
5
4
|
export type Send = (content: string) => Promise<any>;
|
|
6
5
|
export interface RenderProps {
|
|
7
6
|
content: EditorState | null;
|
|
@@ -4,7 +4,6 @@ import { useState, useRef } from "react";
|
|
|
4
4
|
import { Box } from "@mui/material";
|
|
5
5
|
import isNil from "lodash/isNil";
|
|
6
6
|
import { EditorConfigProvider, useEditorConfig } from "@blocklet/editor/lib/config";
|
|
7
|
-
import { lazyWithPreload } from "react-lazy-with-preload";
|
|
8
7
|
import { isEmptyContent, inferInitialEditorState } from "../lexical.mjs";
|
|
9
8
|
import ShortcutPlugin from "./shortcut-plugin.mjs";
|
|
10
9
|
import ImagePathFixerPlugin from "./image-path-fixer-plugin.mjs";
|
|
@@ -13,8 +12,7 @@ import AutoClearPlugin from "./auto-clear-plugin.mjs";
|
|
|
13
12
|
import useMeasure from "../hooks/measure.mjs";
|
|
14
13
|
import { mergeSx } from "../utils.mjs";
|
|
15
14
|
import { MAX_COMMENT_LENGTH } from "../../constants.mjs";
|
|
16
|
-
|
|
17
|
-
export const preloadInput = () => BlockletEditor.preload();
|
|
15
|
+
import { BlockletEditor } from "../editor/blocklet-editor.mjs";
|
|
18
16
|
const Input = ({
|
|
19
17
|
initialContent = "",
|
|
20
18
|
send,
|
|
@@ -10,6 +10,7 @@ interface Props {
|
|
|
10
10
|
onReady?: () => void;
|
|
11
11
|
children?: React.ReactNode;
|
|
12
12
|
editorPrepend?: React.ReactNode;
|
|
13
|
+
editorFallback?: React.ReactNode;
|
|
13
14
|
}
|
|
14
|
-
export default function PostContent({ content, editing, onExitEditing, onSubmit, autoCollapse, enableHeadingsIdPlugin, onReady, children, editorPrepend, ...rest }: Props): import("react").JSX.Element;
|
|
15
|
+
export default function PostContent({ content, editing, onExitEditing, onSubmit, autoCollapse, enableHeadingsIdPlugin, onReady, children, editorPrepend, editorFallback, ...rest }: Props): import("react").JSX.Element;
|
|
15
16
|
export {};
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Suspense } from "react";
|
|
3
|
-
import { lazyRetry as lazy } from "@arcblock/ux/lib/Util";
|
|
4
3
|
import CheckboxPlugin from "@blocklet/editor/lib/ext/CheckboxPlugin";
|
|
5
4
|
import { styled } from "@mui/material/styles";
|
|
6
5
|
import Box from "@mui/material/Box";
|
|
6
|
+
import { Skeleton } from "@mui/material";
|
|
7
7
|
import { inferInitialEditorState } from "../lexical.mjs";
|
|
8
8
|
import { ViewMore } from "../view-more.mjs";
|
|
9
9
|
import PostEdit from "../input/post-edit.mjs";
|
|
10
10
|
import ImagePathFixerPlugin from "../input/image-path-fixer-plugin.mjs";
|
|
11
11
|
import { VideoPathFixerPlugin } from "../editor/plugins/video-path-fixer-plugin.mjs";
|
|
12
|
-
|
|
12
|
+
import { BlockletEditor } from "../editor/blocklet-editor.mjs";
|
|
13
13
|
const StyledBlockletEditor = styled(BlockletEditor)`
|
|
14
14
|
.editor-scroller {
|
|
15
15
|
min-height: initial;
|
|
@@ -32,6 +32,7 @@ export default function PostContent({
|
|
|
32
32
|
onReady,
|
|
33
33
|
children,
|
|
34
34
|
editorPrepend,
|
|
35
|
+
editorFallback,
|
|
35
36
|
...rest
|
|
36
37
|
}) {
|
|
37
38
|
if (editing && onSubmit) {
|
|
@@ -45,8 +46,14 @@ export default function PostContent({
|
|
|
45
46
|
}
|
|
46
47
|
);
|
|
47
48
|
}
|
|
49
|
+
const fallback = editorFallback || /* @__PURE__ */ jsxs(Box, { sx: { px: 3 }, children: [
|
|
50
|
+
/* @__PURE__ */ jsx(Skeleton, {}),
|
|
51
|
+
/* @__PURE__ */ jsx(Skeleton, { width: "80%" }),
|
|
52
|
+
/* @__PURE__ */ jsx(Skeleton, { width: "60%" }),
|
|
53
|
+
/* @__PURE__ */ jsx(Skeleton, { width: "40%" })
|
|
54
|
+
] });
|
|
48
55
|
if (!autoCollapse) {
|
|
49
|
-
return /* @__PURE__ */ jsx(Suspense, { children: /* @__PURE__ */ jsxs(
|
|
56
|
+
return /* @__PURE__ */ jsx(Suspense, { fallback, children: /* @__PURE__ */ jsxs(
|
|
50
57
|
StyledBlockletEditor,
|
|
51
58
|
{
|
|
52
59
|
editable: false,
|
|
@@ -65,7 +72,7 @@ export default function PostContent({
|
|
|
65
72
|
}
|
|
66
73
|
) });
|
|
67
74
|
}
|
|
68
|
-
return /* @__PURE__ */ jsx(Suspense, { children: /* @__PURE__ */ jsx(ViewMore, { ...rest, children: /* @__PURE__ */ jsxs(
|
|
75
|
+
return /* @__PURE__ */ jsx(Suspense, { fallback, children: /* @__PURE__ */ jsx(ViewMore, { ...rest, children: /* @__PURE__ */ jsxs(
|
|
69
76
|
StyledBlockletEditor,
|
|
70
77
|
{
|
|
71
78
|
editable: false,
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export * from '@blocklet/labels';
|
|
2
2
|
export * from './theme';
|
|
3
|
-
export { Input, CommentInput,
|
|
3
|
+
export { Input, CommentInput, ScrollableEditorWrapper } from './components/input';
|
|
4
4
|
export * from './components/avatars';
|
|
5
5
|
export * from './components/posts';
|
|
6
6
|
export * from './components/rating';
|
package/dist/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export * from "@blocklet/labels";
|
|
2
2
|
export * from "./theme/index.mjs";
|
|
3
|
-
export { Input, CommentInput,
|
|
3
|
+
export { Input, CommentInput, ScrollableEditorWrapper } from "./components/input/index.mjs";
|
|
4
4
|
export * from "./components/avatars/index.mjs";
|
|
5
5
|
export * from "./components/posts/index.mjs";
|
|
6
6
|
export * from "./components/rating/index.mjs";
|
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.68",
|
|
4
4
|
"files": [
|
|
5
5
|
"dist"
|
|
6
6
|
],
|
|
@@ -47,8 +47,8 @@
|
|
|
47
47
|
"unstated-next": "^1.1.0",
|
|
48
48
|
"url-join": "^4.0.1",
|
|
49
49
|
"zustand": "^4.5.5",
|
|
50
|
-
"@blocklet/editor": "2.4.
|
|
51
|
-
"@blocklet/labels": "2.4.
|
|
50
|
+
"@blocklet/editor": "2.4.68",
|
|
51
|
+
"@blocklet/labels": "2.4.68"
|
|
52
52
|
},
|
|
53
53
|
"peerDependencies": {
|
|
54
54
|
"@arcblock/did-connect-react": "^3.1.5",
|