summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMaksim Sukharev <antreesy.web@gmail.com>2023-06-07 19:41:11 +0200
committerbackportbot-nextcloud[bot] <backportbot-nextcloud[bot]@users.noreply.github.com>2023-06-08 16:20:40 +0000
commiteb05c2771a330290f44296c2d3f5b23756f7ad33 (patch)
tree6cb849c852b729c8610b42bbe18b035fea471139 /src
parentc2d4d18c88b9d8647ee67228d486542cba2fe226 (diff)
handle typing signalling with "input" event instead of watch
Signed-off-by: Maksim Sukharev <antreesy.web@gmail.com>
Diffstat (limited to 'src')
-rw-r--r--src/components/NewMessage/NewMessage.vue53
1 files changed, 28 insertions, 25 deletions
diff --git a/src/components/NewMessage/NewMessage.vue b/src/components/NewMessage/NewMessage.vue
index f0be88acb..6e80bc4dd 100644
--- a/src/components/NewMessage/NewMessage.vue
+++ b/src/components/NewMessage/NewMessage.vue
@@ -98,6 +98,7 @@
@keydown.esc="handleInputEsc"
@tribute-active-true.native="isTributePickerActive = true"
@tribute-active-false.native="isTributePickerActive = false"
+ @input="handleTyping"
@paste="handlePastedFiles"
@submit="handleSubmit({ silent: false })" />
</div>
@@ -381,32 +382,7 @@ export default {
},
text(newValue) {
- // Do nothing if join a conversation with pre-filled input
- if (this.text === this.$store.getters.currentMessageInput(this.token) || this.text === '') {
- return
- }
-
this.$store.dispatch('setCurrentMessageInput', { token: this.token, text: newValue })
-
- // Enable signal sending, only if indicator for this input is on
- if (this.showTypingStatus) {
- if (!this.typingInterval) {
- // Send first signal after first keystroke
- this.$store.dispatch('sendTypingSignal', { typing: true })
-
- // Continuously send signals with 10s interval if still typing
- this.typingInterval = setInterval(() => {
- if (this.wasTypingWithinInterval) {
- this.$store.dispatch('sendTypingSignal', { typing: true })
- this.wasTypingWithinInterval = false
- } else {
- this.clearTypingInterval()
- }
- }, 10000)
- } else {
- this.wasTypingWithinInterval = true
- }
- }
},
token(token) {
@@ -437,6 +413,30 @@ export default {
},
methods: {
+ handleTyping() {
+ // Enable signal sending, only if indicator for this input is on
+ if (!this.showTypingStatus) {
+ return
+ }
+
+ if (!this.typingInterval) {
+ // Send first signal after first keystroke
+ this.$store.dispatch('sendTypingSignal', { typing: true })
+
+ // Continuously send signals with 10s interval if still typing
+ this.typingInterval = setInterval(() => {
+ if (this.wasTypingWithinInterval) {
+ this.$store.dispatch('sendTypingSignal', { typing: true })
+ this.wasTypingWithinInterval = false
+ } else {
+ this.clearTypingInterval()
+ }
+ }, 10000)
+ } else {
+ this.wasTypingWithinInterval = true
+ }
+ },
+
clearTypingInterval() {
clearInterval(this.typingInterval)
this.typingInterval = null
@@ -629,6 +629,9 @@ export default {
const content = fetchClipboardContent(e)
if (content.kind === 'file') {
this.handleFiles(content.files, true)
+ } else {
+ // FIXME NcRichContenteditable prevents trigger input event on pasting text
+ this.handleTyping()
}
},