From 419bde4db2133920dc5778169084ffa5535e31c1 Mon Sep 17 00:00:00 2001 From: Phoenix <64720302+Concur-max@users.noreply.github.com> Date: Fri, 16 May 2025 11:32:07 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E7=BC=96=E8=BE=91=E5=99=A8?= =?UTF-8?q?=E5=8A=9F=E8=83=BD=EF=BC=8C=E6=96=B0=E5=A2=9E=E7=BC=96=E8=BE=91?= =?UTF-8?q?=E6=B6=88=E6=81=AF=E4=BA=8B=E4=BB=B6=E5=A4=84=E7=90=86=EF=BC=8C?= =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=92=A4=E5=9B=9E=E6=B6=88=E6=81=AF=E7=BB=84?= =?UTF-8?q?=E4=BB=B6=EF=BC=8C=E8=B0=83=E6=95=B4=E7=9B=B8=E5=85=B3=E4=BA=8B?= =?UTF-8?q?=E4=BB=B6=E6=80=BB=E7=BA=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components.d.ts | 2 -- src/components/editor/Editor.vue | 23 ++++++++++++++++++- src/components/talk/message/RevokeMessage.vue | 23 +++++++++++++++++-- src/components/talk/message/VideoMessage.vue | 18 +-------------- src/constant/event-bus.ts | 3 ++- .../message/inner/panel/PanelContent.vue | 3 ++- 6 files changed, 48 insertions(+), 24 deletions(-) diff --git a/components.d.ts b/components.d.ts index 029ff3b..d79fbb5 100644 --- a/components.d.ts +++ b/components.d.ts @@ -59,9 +59,7 @@ declare module 'vue' { NoticeEditor: typeof import('./src/components/group/manage/NoticeEditor.vue')['default'] NoticeTab: typeof import('./src/components/group/manage/NoticeTab.vue')['default'] NotificationApi: typeof import('./src/components/common/NotificationApi.vue')['default'] - NProgress: typeof import('naive-ui')['NProgress'] NRadio: typeof import('naive-ui')['NRadio'] - NTag: typeof import('naive-ui')['NTag'] NVirtualList: typeof import('naive-ui')['NVirtualList'] RevokeMessage: typeof import('./src/components/talk/message/RevokeMessage.vue')['default'] RouterLink: typeof import('vue-router')['RouterLink'] diff --git a/src/components/editor/Editor.vue b/src/components/editor/Editor.vue index f4b24d2..072badb 100644 --- a/src/components/editor/Editor.vue +++ b/src/components/editor/Editor.vue @@ -572,6 +572,26 @@ function hideMentionDom() { } } +/** + * 处理编辑消息事件 + * @param data 消息数据 + */ +function onSubscribeEdit(data: any) { + console.log('data', data) + const quill = getQuill() + if (!quill) return + + // 清空当前编辑器内容 + quill.setContents([]) + + // 插入要编辑的文本内容 + quill.setText(data.content) + + // 设置光标位置到末尾 + const index = quill.getLength() - 1 + quill.setSelection(index > 0 ? index : 0, 0, 'user') +} + // 监听聊天索引变化,切换聊天时加载对应草稿 watch(indexName, loadEditorDraftText, { immediate: true }) @@ -588,7 +608,8 @@ onUnmounted(() => { // 订阅编辑器相关事件总线事件 useEventBus([ { name: EditorConst.Mention, event: onSubscribeMention }, // @成员事件 - { name: EditorConst.Quote, event: onSubscribeQuote } // 引用事件 + { name: EditorConst.Quote, event: onSubscribeQuote }, // 引用事件 + { name: EditorConst.Edit, event: onSubscribeEdit } // 编辑消息事件 ]) diff --git a/src/components/talk/message/RevokeMessage.vue b/src/components/talk/message/RevokeMessage.vue index a3da869..caf96c0 100644 --- a/src/components/talk/message/RevokeMessage.vue +++ b/src/components/talk/message/RevokeMessage.vue @@ -1,7 +1,9 @@