@blocklet/discuss-kit-ux 2.0.1 → 2.0.3
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/chat-input.d.ts +9 -0
- package/dist/components/chat/hooks.d.ts +1 -0
- package/dist/components/editor/editor.d.ts +3 -1
- package/dist/components/editor/index.d.ts +1 -1
- package/dist/components/locale/en.d.ts +1 -0
- package/dist/components/locale/index.d.ts +2 -0
- package/dist/components/locale/zh.d.ts +1 -0
- package/dist/{editor-D3RAcw2N.mjs → editor-BkMaHMub.mjs} +12 -4
- package/dist/{index-KLdzJyDb.mjs → index-CEuSe9YY.mjs} +390 -113
- package/dist/index.es.js +1 -1
- package/dist/index.umd.js +400 -117
- package/package.json +4 -4
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { EditorProps } from '../editor';
|
|
2
|
+
|
|
3
|
+
interface Props extends EditorProps {
|
|
4
|
+
initialContent?: string;
|
|
5
|
+
send: (content: string) => void;
|
|
6
|
+
onContentChange?: (content: string) => void;
|
|
7
|
+
}
|
|
8
|
+
export declare function ChatInput({ initialContent, send, onContentChange }: Props): import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export {};
|
|
@@ -13,5 +13,7 @@ export interface EditorProps extends Omit<BlockletEditorProps, 'onChange' | 'ref
|
|
|
13
13
|
onChange?: OnChangeHandler;
|
|
14
14
|
children?: React.ReactNode;
|
|
15
15
|
onSave?: () => void;
|
|
16
|
+
enableSaveAreaPlugin?: boolean;
|
|
17
|
+
ignoreInitialChange?: boolean;
|
|
16
18
|
}
|
|
17
|
-
export default function Editor({ initialContent, onChange, children, onSave, ...rest }: EditorProps): import("react/jsx-runtime").JSX.Element;
|
|
19
|
+
export default function Editor({ initialContent, onChange, children, onSave, enableSaveAreaPlugin, ignoreInitialChange, ...rest }: EditorProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -77,6 +77,7 @@ export declare const translations: {
|
|
|
77
77
|
loadMore: string;
|
|
78
78
|
notYetJoinedTheChannel: string;
|
|
79
79
|
typeSomething: string;
|
|
80
|
+
send: string;
|
|
80
81
|
};
|
|
81
82
|
};
|
|
82
83
|
en: {
|
|
@@ -156,6 +157,7 @@ export declare const translations: {
|
|
|
156
157
|
loadMore: string;
|
|
157
158
|
notYetJoinedTheChannel: string;
|
|
158
159
|
typeSomething: string;
|
|
160
|
+
send: string;
|
|
159
161
|
};
|
|
160
162
|
};
|
|
161
163
|
};
|
|
@@ -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-CEuSe9YY.mjs";
|
|
8
8
|
const BlockletEditor = lazy(() => import("@blocklet/editor"));
|
|
9
9
|
const Root = styled(Box)`
|
|
10
10
|
.be-editable,
|
|
@@ -12,7 +12,15 @@ const Root = styled(Box)`
|
|
|
12
12
|
min-height: 150px;
|
|
13
13
|
}
|
|
14
14
|
`;
|
|
15
|
-
function Editor({
|
|
15
|
+
function Editor({
|
|
16
|
+
initialContent,
|
|
17
|
+
onChange,
|
|
18
|
+
children,
|
|
19
|
+
onSave,
|
|
20
|
+
enableSaveAreaPlugin = true,
|
|
21
|
+
ignoreInitialChange = true,
|
|
22
|
+
...rest
|
|
23
|
+
}) {
|
|
16
24
|
const handleChange = async (editorState, editor) => {
|
|
17
25
|
const isEmpty = await isEmptyContent(editorState, editor);
|
|
18
26
|
onChange == null ? void 0 : onChange({
|
|
@@ -26,9 +34,9 @@ function Editor({ initialContent, onChange, children, onSave, ...rest }) {
|
|
|
26
34
|
return /* @__PURE__ */ jsx(Root, { children: /* @__PURE__ */ jsxs(BlockletEditor, { editorState: inferInitialEditorState(initialContent), ...rest, children: [
|
|
27
35
|
/* @__PURE__ */ jsx(ImagePathFixerPlugin, {}),
|
|
28
36
|
/* @__PURE__ */ jsx(VideoPathFixerPlugin, {}),
|
|
29
|
-
/* @__PURE__ */ jsx(OnContentChangePlugin, { onChange: handleChange }),
|
|
37
|
+
/* @__PURE__ */ jsx(OnContentChangePlugin, { onChange: handleChange, ignoreInitialChange }),
|
|
30
38
|
onSave && /* @__PURE__ */ jsx(CtrlsShortcutPlugin, { callback: onSave }),
|
|
31
|
-
/* @__PURE__ */ jsx(SafeAreaPlugin, {}),
|
|
39
|
+
enableSaveAreaPlugin && /* @__PURE__ */ jsx(SafeAreaPlugin, {}),
|
|
32
40
|
children
|
|
33
41
|
] }) });
|
|
34
42
|
}
|