diff --git a/client/package.json b/client/package.json
index 39a30db2..23e4f22a 100644
--- a/client/package.json
+++ b/client/package.json
@@ -33,6 +33,7 @@
"v-tooltip": "^2.0.3",
"vue": "^2.6.10",
"vue-class-component": "^7.0.2",
+ "vue-clickaway": "^2.2.2",
"vue-context": "^5.0.0",
"vue-notification": "^1.3.20",
"vue-property-decorator": "^8.3.0",
@@ -42,6 +43,7 @@
"@types/animejs": "^3.1.0",
"@types/node": "^13.7.0",
"@types/vue": "^2.0.0",
+ "@types/vue-clickaway": "^2.2.0",
"@vue/cli-plugin-babel": "^4.1.0",
"@vue/cli-plugin-eslint": "^4.1.0",
"@vue/cli-plugin-typescript": "^4.1.0",
diff --git a/client/src/components/chat.vue b/client/src/components/chat.vue
index 01a73aeb..bc292d8b 100644
--- a/client/src/components/chat.vue
+++ b/client/src/components/chat.vue
@@ -35,15 +35,9 @@
@@ -330,6 +324,8 @@
import { Component, Ref, Watch, Vue } from 'vue-property-decorator'
import { formatRelative } from 'date-fns'
+ import { Member } from '~/neko/types'
+
import Markdown from './markdown'
import Content from './context.vue'
import Emoji from './emoji.vue'
@@ -371,11 +367,6 @@
})
}
- @Watch('emoji')
- onEmojiChange() {
- this._input.focus()
- }
-
@Watch('muted')
onMutedChange(muted: boolean) {
if (muted) {
@@ -398,6 +389,11 @@
return `${str.charAt(0).toUpperCase()}${str.slice(1)}`
}
+ onEmoji() {
+ this.emoji = !this.emoji
+ this._input.focus()
+ }
+
onEmojiPicked(emoji: string) {
const text = `:${emoji}:`
if (this._input.selectionStart || this._input.selectionStart === 0) {
@@ -411,11 +407,15 @@
} else {
this.content += text
}
+ this._input.focus()
this.emoji = false
}
- onContext(event: MouseEvent, data: any) {
- this._context.open(event, data)
+ onContext(event: MouseEvent, { member }: { member: Member }) {
+ if (member.id === this.id) {
+ return
+ }
+ this._context.open(event, { member })
}
onClick(event: { target?: HTMLElement; preventDefault(): void }) {
diff --git a/client/src/components/emoji.vue b/client/src/components/emoji.vue
index 4aa7247e..3073346b 100644
--- a/client/src/components/emoji.vue
+++ b/client/src/components/emoji.vue
@@ -1,5 +1,5 @@
-