@blocklet/discuss-kit-ux 2.4.90 → 2.4.92

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.
@@ -11,7 +11,7 @@ import { useBrowser } from "@arcblock/react-hooks";
11
11
  import { useLocaleContext } from "@arcblock/ux/lib/Locale/context";
12
12
  import { KEY_ENTER_COMMAND, COMMAND_PRIORITY_LOW, $getRoot, $getSelection, $createParagraphNode } from "lexical";
13
13
  import { useLocalStorageState } from "ahooks";
14
- import { EditorConfigProvider } from "@blocklet/editor";
14
+ import { EditorConfigProvider } from "@blocklet/editor/lib/config";
15
15
  import { LazyEditor } from "../editor/index.mjs";
16
16
  import { MAX_COMMENT_LENGTH } from "../../constants.mjs";
17
17
  function AutoClearPlugin({ clearKey }) {
@@ -9,7 +9,7 @@ import { useTheme } from "@mui/material/styles";
9
9
  import { Icon } from "@iconify/react";
10
10
  import UsersPlusIcon from "@iconify/icons-tabler/users-plus";
11
11
  import { useLocalStorageState } from "ahooks";
12
- import { EditorConfigProvider } from "@blocklet/editor";
12
+ import { EditorConfigProvider } from "@blocklet/editor/lib/config";
13
13
  import MessageList from "./message-list.mjs";
14
14
  import { useChatContext } from "./context.mjs";
15
15
  import { useSessionContext } from "../hooks/index.mjs";
@@ -1,2 +1 @@
1
- export declare const BlockletEditor: import("react-lazy-with-preload").PreloadableComponent<typeof import("@blocklet/editor").default>;
2
- export declare const useBlockletEditorLoaded: () => boolean;
1
+ export { BlockletEditor, useBlockletEditorLoaded } from '@blocklet/editor/lib/blocklet-editor';
@@ -1,12 +1 @@
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
- };
1
+ export { BlockletEditor, useBlockletEditorLoaded } from "@blocklet/editor/lib/blocklet-editor";
@@ -2,3 +2,4 @@ export { default as LazyEditor } from './lazy-editor';
2
2
  export type { OnChangeHandler, EditorProps } from './editor';
3
3
  export { EditorPreview } from './preview';
4
4
  export { BlockletEditor, useBlockletEditorLoaded } from './blocklet-editor';
5
+ export { BlockletEditorViewer, useBlockletEditorViewerLoaded } from './viewer';
@@ -1,3 +1,4 @@
1
1
  export { default as LazyEditor } from "./lazy-editor.mjs";
2
2
  export { EditorPreview } from "./preview.mjs";
3
3
  export { BlockletEditor, useBlockletEditorLoaded } from "./blocklet-editor.mjs";
4
+ export { BlockletEditorViewer, useBlockletEditorViewerLoaded } from "./viewer.mjs";
@@ -0,0 +1,7 @@
1
+ /// <reference types="react" />
2
+ import { useBlockletEditorViewerLoaded, EditorViewerProps } from '@blocklet/editor/lib/blocklet-editor-viewer';
3
+ export interface EditorProps extends Omit<EditorViewerProps, 'editorState'> {
4
+ content: string;
5
+ }
6
+ export declare function BlockletEditorViewer({ content, prepend, ...rest }: EditorProps): import("react").JSX.Element;
7
+ export { useBlockletEditorViewerLoaded };
@@ -0,0 +1,31 @@
1
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
2
+ import { Suspense } from "react";
3
+ import { Skeleton } from "@mui/material";
4
+ import {
5
+ BlockletEditorViewer as InternalBlockletEditorViewer,
6
+ useBlockletEditorViewerLoaded
7
+ } from "@blocklet/editor/lib/blocklet-editor-viewer";
8
+ import { inferInitialEditorState } from "../lexical.mjs";
9
+ import ImagePathFixerPlugin from "../input/image-path-fixer-plugin.mjs";
10
+ import { VideoPathFixerPlugin } from "./plugins/video-path-fixer-plugin.mjs";
11
+ const fallback = /* @__PURE__ */ jsxs(Fragment, { children: [
12
+ /* @__PURE__ */ jsx(Skeleton, {}),
13
+ /* @__PURE__ */ jsx(Skeleton, { width: "80%" }),
14
+ /* @__PURE__ */ jsx(Skeleton, { width: "60%" }),
15
+ /* @__PURE__ */ jsx(Skeleton, { width: "40%" })
16
+ ] });
17
+ export function BlockletEditorViewer({ content, prepend, ...rest }) {
18
+ return /* @__PURE__ */ jsx(Suspense, { fallback, children: /* @__PURE__ */ jsx(
19
+ InternalBlockletEditorViewer,
20
+ {
21
+ editorState: inferInitialEditorState(content),
22
+ prepend: /* @__PURE__ */ jsxs(Fragment, { children: [
23
+ prepend,
24
+ /* @__PURE__ */ jsx(ImagePathFixerPlugin, {}),
25
+ /* @__PURE__ */ jsx(VideoPathFixerPlugin, {})
26
+ ] }),
27
+ ...rest
28
+ }
29
+ ) });
30
+ }
31
+ export { useBlockletEditorViewerLoaded };
@@ -2,7 +2,7 @@ import { joinURL } from "ufo";
2
2
  const { pageGroup } = window.blocklet;
3
3
  export const blogPrefix = pageGroup === "blog" ? "" : "blog";
4
4
  export const discussionPrefix = pageGroup === "discussion" ? "" : "discussions";
5
- export const docPrefix = pageGroup === "doc" ? "" : "docs";
5
+ export const docPrefix = pageGroup === "doc" || window.blocklet.preferences.docSmithEnabled ? "" : "docs";
6
6
  export const bookmarkPrefix = pageGroup === "bookmark" ? "" : "bookmark";
7
7
  export const blogPath = (path) => {
8
8
  return window.blocklet.pageGroup === "blog" ? path : joinURL("/blog", path);
@@ -11,7 +11,7 @@ export const discussionPath = (path) => {
11
11
  return window.blocklet.pageGroup === "discussion" ? path : joinURL("/discussions", path);
12
12
  };
13
13
  export const docPath = (path) => {
14
- return window.blocklet.pageGroup === "doc" ? path : joinURL("/docs", path);
14
+ return joinURL("/", docPrefix, path);
15
15
  };
16
16
  export const bookmarkPath = (path) => {
17
17
  return window.blocklet.pageGroup === "bookmark" ? path : joinURL("/bookmark", path);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blocklet/discuss-kit-ux",
3
- "version": "2.4.90",
3
+ "version": "2.4.92",
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.90",
51
- "@blocklet/labels": "2.4.90"
50
+ "@blocklet/editor": "2.4.92",
51
+ "@blocklet/labels": "2.4.92"
52
52
  },
53
53
  "peerDependencies": {
54
54
  "@arcblock/did-connect-react": "^3.1.5",