Skip to content

Commit

Permalink
#2369 chat paste bug (#2370)
Browse files Browse the repository at this point in the history
* fix the bug re paste action on mobile

* remove console.log

* update the fix

* uncomment it

* comment update again
  • Loading branch information
SebinSong authored Oct 7, 2024
1 parent a8cbe02 commit b64ecda
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions frontend/views/containers/chatroom/SendArea.vue
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@
@keydown.ctrl='isNextLine'
@keydown='handleKeydown'
@keyup='handleKeyup'
@paste='handlePaste'
v-bind='$attrs'
)

Expand Down Expand Up @@ -553,6 +554,18 @@ export default ({
this.updateMentionKeyword()
}
},
handlePaste (e) {
// fix for the edge-case related to 'paste' action when nothing has been typed
// (reference: https://github.com/okTurtles/group-income/issues/2369)
const currVal = this.$refs.textarea.value
if (!currVal) {
e.preventDefault()
const pastedText = e.clipboardData.getData('text')
this.$refs.textarea.value = pastedText
this.updateTextArea()
}
},
addSelectedMention (index) {
const curValue = this.$refs.textarea.value
const curPosition = this.$refs.textarea.selectionStart
Expand Down

0 comments on commit b64ecda

Please sign in to comment.