Skip to content

Commit

Permalink
Merge pull request #11806 from nextcloud/fix/11803/broken-focus
Browse files Browse the repository at this point in the history
fix(NewMessage): fix broken caret
  • Loading branch information
Antreesy authored Mar 14, 2024
2 parents 9ae8a99 + 3c56ef6 commit 3b6dd81
Showing 1 changed file with 5 additions and 11 deletions.
16 changes: 5 additions & 11 deletions src/components/NewMessage/NewMessage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,6 @@
@shortkey="focusInput"
@keydown.esc="handleInputEsc"
@keydown.ctrl.up="handleEditLastMessage"
@tribute-active-true.native="isTributePickerActive = true"
@tribute-active-false.native="isTributePickerActive = false"
@input="handleTyping"
@paste="handlePastedFiles"
@submit="handleSubmit" />
Expand Down Expand Up @@ -335,7 +333,6 @@ export default {
showPollEditor: false,
showNewFileDialog: -1,
showFilePicker: false,
isTributePickerActive: false,
// Check empty template by default
userData: {},
clipboardTimeStamp: null,
Expand Down Expand Up @@ -525,7 +522,7 @@ export default {
},

chatInput(newValue) {
if (this.text !== newValue) {
if (parseSpecialSymbols(this.text) !== newValue) {
this.text = newValue
}
},
Expand Down Expand Up @@ -623,6 +620,8 @@ export default {
return
}
this.$nextTick(() => {
// reset or fill main input in chat view from the store
this.text = this.chatInput
// refocus input as the user might want to type further
this.focusInput()
})
Expand Down Expand Up @@ -959,17 +958,12 @@ export default {
},

handleInputEsc() {
if (this.messageToEdit && !this.isTributePickerActive) {
if (this.messageToEdit) {
this.handleAbortEdit()
this.focusInput()
return
}
// When the tribute picker (e.g. emoji picker or mentions) is open
// ESC should only close the picker but not blur
if (!this.isTributePickerActive) {
this.blurInput()
}

this.blurInput()
},

handleEditLastMessage() {
Expand Down

0 comments on commit 3b6dd81

Please sign in to comment.