Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion content/ai/aiChatInput/index-en-US.md
Original file line number Diff line number Diff line change
Expand Up @@ -1488,7 +1488,7 @@ render(<CustomRichTextExtension />);
| onTemplateVisibleChange | Callback for template's visibility change | (visible: boolean) => void | - |
| onUploadChange | Callback for file upload | (props: OnChangeProps) => void | - |
| popoverProps | Popup configuration | PopoverProps | - |
| placeholder | Input placeholder | string | - |
| placeholder | Input placeholder | string \| (props: <ApiType detail='{ editor: Editor; node: Node; pos: number; hasAnchor: boolean }'>PlaceholderProps</ApiType>) => string | - |
| references | Reference list | Reference[] | - |
| renderActionArea | Custom bottom-right operation area | () => React.ReactNode | - |
| renderConfigureArea | Custom configuration area | () => React.ReactNode | - |
Expand Down
2 changes: 1 addition & 1 deletion content/ai/aiChatInput/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -1566,7 +1566,7 @@ render(<CustomRichTextExtension />);
| onTemplateVisibleChange | 模板弹出层可见性变化回调 | (visible: boolean) => void | - |
| onUploadChange | 上传文件相关回调 | (props: OnChangeProps) => void | - |
| popoverProps | 下拉弹出层的配置参数 | PopoverProps | - |
| placeholder | 输入框占位符 | string | - |
| placeholder | 输入框占位符 | string \| (props: <ApiType detail='{ editor: Editor; node: Node; pos: number; hasAnchor: boolean }'>PlaceholderProps</ApiType>) => string | - |
| references | 输入框引用列表 | Reference[] | - |
| renderActionArea | 自定义底部的操作区域 | () => React.ReactNode | - |
| renderConfigureArea | 自定义底部的配置区域 | () => React.ReactNode | - |
Expand Down
7 changes: 5 additions & 2 deletions packages/semi-ui/aiChatInput/interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@ import { ReactNode } from "react";
import { OnChangeProps, UploadProps } from "../upload";
import { TooltipProps } from "../tooltip";
import { BaseSkill, Reference, Suggestion, Attachment, Content, Setup, LeftMenuChangeProps, RichTextJSON, MessageContent } from "@douyinfe/semi-foundation/aiChatInput/interface";
import { Extensions } from "@tiptap/core";
import { Editor, Extensions } from "@tiptap/core";
import { Content as TiptapContent } from "@tiptap/core";
import { PopoverProps } from "../popover";
export * from "@douyinfe/semi-foundation/aiChatInput/interface";
import { Node } from '@tiptap/pm/model';

export interface AIChatInputState {
templateVisible: boolean;
Expand All @@ -21,12 +22,14 @@ export interface AIChatInputState {
richTextInit?: boolean
}

export type PlaceholderProps = string | ((props: { editor: Editor; node: Node; pos: number; hasAnchor: boolean }) => string);

export interface AIChatInputProps {
dropdownMatchTriggerWidth?: boolean;
className?: string;
style?: React.CSSProperties;
// Rich text editor related
placeholder?: string;
placeholder?: PlaceholderProps;
extensions?: Extensions;
onContentChange?: (contents: Content[]) => void;
defaultContent?: TiptapContent;
Expand Down
3 changes: 2 additions & 1 deletion packages/semi-ui/aiChatInput/richTextInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,14 @@ import { cssClasses } from '@douyinfe/semi-foundation/aiChatInput/constants';
import { EditorView } from '@tiptap/pm/view';
import { handleCompositionEndLogic, handlePasteLogic, handleTextInputLogic, handleZeroWidthCharLogic } from './extension/plugins';
import SemiStatusExtension from './extension/statusExtension';
import { PlaceholderProps } from './interface';

const PREFIX = cssClasses.PREFIX;

export default (props: {
innerRef?: React.Ref<HTMLDivElement>;
defaultContent?: TiptapContent;
placeholder?: string;
placeholder?: PlaceholderProps;
setEditor?: (editor: Editor) => void;
onKeyDown?: (e: KeyboardEvent) => void;
onChange?: (content: string) => void;
Expand Down
Loading