Fix focusing on topic when using ctx menu Edit Topic action

This commit is contained in:
Max Leiter 2022-05-31 20:47:50 -07:00
parent 73014369c4
commit 5b4166ff30
No known key found for this signature in database
GPG key ID: A3512F2F2F17EBDA
3 changed files with 11 additions and 10 deletions

View file

@ -236,14 +236,16 @@ export default defineComponent({
} }
); );
const editTopicRef = ref(props.channel.editTopic); watch(
watch(editTopicRef, (newTopic) => { () => props.channel.editTopic,
(newTopic) => {
if (newTopic) { if (newTopic) {
void nextTick(() => { void nextTick(() => {
topicInput.value?.focus(); topicInput.value?.focus();
}); });
} }
}); }
);
onMounted(() => { onMounted(() => {
channelChanged(); channelChanged();
@ -260,7 +262,6 @@ export default defineComponent({
messageList, messageList,
topicInput, topicInput,
specialComponent, specialComponent,
editTopicRef,
hideUserVisibleError, hideUserVisibleError,
editTopic, editTopic,
saveTopic, saveTopic,

View file

@ -2,7 +2,7 @@ import socket from "../socket";
import {store} from "../store"; import {store} from "../store";
import {switchToChannel} from "../router"; import {switchToChannel} from "../router";
function input(args) { function input(args: string[]) {
if (args.length > 0) { if (args.length > 0) {
let channels = args[0]; let channels = args[0];