@blocklet/discuss-kit-ux 2.0.0 → 2.0.2

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,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;
@@ -1,3 +1,3 @@
1
1
  export { default as LazyEditor } from './lazy-editor';
2
- export type { OnChangeHandler } from './editor';
2
+ export type { OnChangeHandler, EditorProps } from './editor';
3
3
  export { EditorPreview } from './preview';
@@ -75,6 +75,7 @@ declare const _default: {
75
75
  loadMore: string;
76
76
  notYetJoinedTheChannel: string;
77
77
  typeSomething: string;
78
+ send: string;
78
79
  };
79
80
  };
80
81
  export default _default;
@@ -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
  };
@@ -76,6 +76,7 @@ declare const _default: {
76
76
  loadMore: string;
77
77
  notYetJoinedTheChannel: string;
78
78
  typeSomething: string;
79
+ send: string;
79
80
  };
80
81
  };
81
82
  export default _default;
@@ -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-KLdzJyDb.mjs";
7
+ import { i as inferInitialEditorState, I as ImagePathFixerPlugin, V as VideoPathFixerPlugin, a as isEmptyContent, s as stringify, g as getExcerptSync } from "./index-bnv41bga.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({ initialContent, onChange, children, onSave, ...rest }) {
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
  }