Various Chat Fixes - Fixes #12377 (#13180)

* Various Chat Fixes
* Allow adding `@mention` anywhere (previously was fixed at the end of the text)
* Add re-focus after mouseclick on `@mention` choice
* Remove`@mention` space barrier (since server ingests mentions without spaces in between)

Co-authored-by: Bart Enkelaar <benkelaar@gmail.com>

* Boundry Search + Select shutoff

Co-authored-by: Bart Enkelaar <benkelaar@gmail.com>
This commit is contained in:
Helcostr
2021-04-29 14:06:16 -07:00
committed by GitHub
parent 920a093b0e
commit 92beff46b6
2 changed files with 51 additions and 38 deletions
+10 -2
View File
@@ -117,7 +117,7 @@ export default {
TOP: 0,
LEFT: 0,
},
textbox: this.$refs,
textbox: null,
MAX_MESSAGE_LENGTH: MAX_MESSAGE_LENGTH.toString(),
};
},
@@ -130,6 +130,9 @@ export default {
return this.user.flags.communityGuidelinesAccepted;
},
},
mounted () {
this.textbox = this.$refs['user-entry'];
},
methods: {
// https://medium.com/@_jh3y/how-to-where-s-the-caret-getting-the-xy-position-of-the-caret-a24ba372990a
getCoord (e, text) {
@@ -249,8 +252,13 @@ export default {
}
},
selectedAutocomplete (newText) {
selectedAutocomplete (newText, newCaret) {
this.newMessage = newText;
// Wait for v-modal to update
this.$nextTick(() => {
this.textbox.setSelectionRange(newCaret, newCaret);
this.textbox.focus();
});
},
fetchRecentMessages () {