File tree Expand file tree Collapse file tree 2 files changed +13
-5
lines changed
components/ai-chat/component/chat-input-operate Expand file tree Collapse file tree 2 files changed +13
-5
lines changed Original file line number Diff line number Diff line change @@ -535,10 +535,20 @@ function sendChatHandle(event?: any) {
535535 }
536536 }
537537 } else {
538- // 如果同时按下ctrl+回车键,则会换行
539- inputValue . value += ' \n '
538+ // 如果同时按下ctrl+回车键,则会换行
539+ insertNewlineAtCursor ()
540540 }
541541}
542+ const insertNewlineAtCursor = () => {
543+ const textarea = document .querySelector (' .el-textarea__inner' ) as HTMLTextAreaElement
544+ const startPos = textarea .selectionStart
545+ const endPos = textarea .selectionEnd
546+ // 在光标处插入换行符
547+ inputValue .value = inputValue .value .slice (0 , startPos ) + ' \n ' + inputValue .value .slice (endPos )
548+ nextTick (() => {
549+ textarea .setSelectionRange (startPos + 1 , startPos + 1 ) // 光标定位到换行后位置
550+ })
551+ }
542552
543553function deleteFile(index : number , val : string ) {
544554 if (val === ' image' ) {
Original file line number Diff line number Diff line change 1111 margin : 0 ;
1212 padding : 0 ;
1313}
14- [v-cloak ] {
15- display : none !important ;
16- }
14+
1715html {
1816 height : 100% ;
1917 box-sizing : border-box ;
You can’t perform that action at this time.
0 commit comments