Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
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: 2 additions & 0 deletions apps/docs/zh/components/editorSender/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@
| 事件名 | 说明 | 回调参数 |
| ------------------ | ------------------------ | ------------------------------------------------------- |
| `submit` | 提交内容时触发 | `payload: SubmitResult` - 包含提交的各类内容 |
| `clear` | 清空内容时触发 | `txt: string` - 参数txt为清空后插入的文本 |
| `change` | 输入内容发生变化时触发 | 无 |
| `cancel` | 取消加载状态时触发 | 无 |
| `showAtDialog` | 显示@用户弹窗时触发 | 无 |
Expand All @@ -142,6 +143,7 @@

| 方法名 | 类型 | 描述 |
| ------------------ | ----------------------------------------------------------------- | --------------------------------------------------------------- |
| `submit` | () => void | 提交输入内容 |
| `getCurrentValue` | () => SubmitResult | 获取当前输入框的内容,包括文本、HTML和各类标签信息 |
| `focusToStart` | () => void | 将光标聚焦到文本最前方 |
| `focusToEnd` | () => void | 将光标聚焦到文本最后方 |
Expand Down
2 changes: 2 additions & 0 deletions packages/core/src/components/EditorSender/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,7 @@ function onClear(txt?: string) {
chat.value!.clear(txt);
// 将光标移动到末尾
focusToEnd();
emits('clear',txt);
}
// 点击内容区域聚焦输入框
function onContentMouseDown() {
Expand Down Expand Up @@ -456,6 +457,7 @@ onBeforeUnmount(() => {

/** 暴露方法 */
defineExpose({
submit: onSubmit,
getCurrentValue,
focusToStart,
focusToEnd,
Expand Down
1 change: 1 addition & 0 deletions packages/core/src/components/EditorSender/types.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ export interface EditorSenderEmits {
(e: 'submit', payload: SubmitResult): void;
(e: 'change'): void;
(e: 'cancel'): void;
(e: 'clear', txt: string): void;
(e: 'showAtDialog'): void;
(e: 'showSelectDialog', key: string, elm: HTMLElement): void;
(e: 'showTagDialog', prefix: string): void;
Expand Down