File tree Expand file tree Collapse file tree 2 files changed +8
-2
lines changed
src/packages/frontend/chat Expand file tree Collapse file tree 2 files changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -36,6 +36,7 @@ interface Props {
36
36
editBarStyle ?: CSS ;
37
37
placeholder ?: string ;
38
38
autoFocus ?: boolean ;
39
+ moveCursorToEndOfLine ?: boolean ;
39
40
}
40
41
41
42
export default function ChatInput ( {
@@ -55,6 +56,7 @@ export default function ChatInput({
55
56
style,
56
57
submitMentionsRef,
57
58
syncdb,
59
+ moveCursorToEndOfLine,
58
60
} : Props ) {
59
61
const intl = useIntl ( ) ;
60
62
const onSendRef = useRef < Function > ( on_send ) ;
@@ -82,7 +84,7 @@ export default function ChatInput({
82
84
// See https://github.com/sagemathinc/cocalc/issues/6415
83
85
const input = dbInput ?? propsInput ;
84
86
setInput ( input ) ;
85
- if ( input ?. trim ( ) ) {
87
+ if ( input ?. trim ( ) && moveCursorToEndOfLine ) {
86
88
// have to wait until it's all rendered -- i hate code like this...
87
89
for ( const n of [ 1 , 10 , 50 ] ) {
88
90
setTimeout ( ( ) => {
Original file line number Diff line number Diff line change @@ -769,6 +769,7 @@ export default function Message(props: Readonly<Props>) {
769
769
}
770
770
const replyDate = - getThreadRootDate ( { date, messages } ) ;
771
771
let input ;
772
+ let moveCursorToEndOfLine = false ;
772
773
if ( isLLMThread ) {
773
774
input = "" ;
774
775
} else {
@@ -777,13 +778,15 @@ export default function Message(props: Readonly<Props>) {
777
778
input = "" ;
778
779
} else {
779
780
input = `<span class="user-mention" account-id=${ replying_to } >@${ editor_name } </span> ` ;
781
+ moveCursorToEndOfLine = autoFocusReply ;
780
782
}
781
783
}
782
784
return (
783
785
< div style = { { marginLeft : mode === "standalone" ? "30px" : "0" } } >
784
786
< ChatInput
785
787
fontSize = { font_size }
786
788
autoFocus = { autoFocusReply }
789
+ moveCursorToEndOfLine = { moveCursorToEndOfLine }
787
790
style = { {
788
791
borderRadius : "8px" ,
789
792
height : "auto" /* for some reason the default 100% breaks things */ ,
@@ -879,8 +882,9 @@ export default function Message(props: Readonly<Props>) {
879
882
! props . allowReply ||
880
883
is_folded ||
881
884
props . actions == null
882
- )
885
+ ) {
883
886
return ;
887
+ }
884
888
885
889
return (
886
890
< div style = { { textAlign : "center" , marginBottom : "5px" , width : "100%" } } >
You can’t perform that action at this time.
0 commit comments