fix code quality issues

This commit is contained in:
まっちゃとーにゅ 2023-12-27 08:37:57 +09:00
parent 73f2d69113
commit 26198a15b7
No known key found for this signature in database
GPG Key ID: 143DE582A97FE052
5 changed files with 20 additions and 12 deletions

View File

@ -66,11 +66,9 @@ const XCode = defineAsyncComponent(() => import('@/components/MkCode.core.vue'))
.codePlaceholderRoot { .codePlaceholderRoot {
display: block; display: block;
width: 100%; width: 100%;
background: none;
border: none; border: none;
outline: none; outline: none;
font: inherit; font: inherit;
color: inherit;
cursor: pointer; cursor: pointer;
box-sizing: border-box; box-sizing: border-box;

View File

@ -74,7 +74,7 @@ async function calcAspectRatio() {
gallery.value.style.aspectRatio = ratioMax(16 / 9); gallery.value.style.aspectRatio = ratioMax(16 / 9);
break; break;
case '1_1': case '1_1':
gallery.value.style.aspectRatio = ratioMax(1 / 1); gallery.value.style.aspectRatio = ratioMax(1);
break; break;
case '2_3': case '2_3':
gallery.value.style.aspectRatio = ratioMax(2 / 3); gallery.value.style.aspectRatio = ratioMax(2 / 3);

View File

@ -100,7 +100,7 @@ SPDX-License-Identifier: AGPL-3.0-only
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { inject, watch, nextTick, onMounted, defineAsyncComponent, provide, shallowRef, ref, computed } from 'vue'; import { inject, watch, nextTick, onMounted, onUnmounted, defineAsyncComponent, provide, shallowRef, ref, computed } from 'vue';
import * as mfm from 'mfm-js'; import * as mfm from 'mfm-js';
import * as Misskey from 'misskey-js'; import * as Misskey from 'misskey-js';
import insertTextAtCursor from 'insert-text-at-cursor'; import insertTextAtCursor from 'insert-text-at-cursor';
@ -191,7 +191,9 @@ if (props.initialVisibleUsers) {
props.initialVisibleUsers.forEach(pushVisibleUser); props.initialVisibleUsers.forEach(pushVisibleUser);
} }
const reactionAcceptance = ref(defaultStore.state.reactionAcceptance); const reactionAcceptance = ref(defaultStore.state.reactionAcceptance);
const autocomplete = ref(null); const autocompleteTextareaInput = ref<Autocomplete | null>(null);
const autocompleteCwInput = ref<Autocomplete | null>(null);
const autocompleteHashtagsInput = ref<Autocomplete | null>(null);
const draghover = ref(false); const draghover = ref(false);
const quoteId = ref(null); const quoteId = ref(null);
const hasNotSpecifiedMentions = ref(false); const hasNotSpecifiedMentions = ref(false);
@ -909,10 +911,9 @@ onMounted(() => {
}); });
} }
// TODO: detach when unmount autocompleteTextareaInput.value = new Autocomplete(textareaEl.value, text);
new Autocomplete(textareaEl.value, text); autocompleteCwInput.value = new Autocomplete(cwInputEl.value, cw);
new Autocomplete(cwInputEl.value, cw); autocompleteHashtagsInput.value = new Autocomplete(hashtagsInputEl.value, hashtags);
new Autocomplete(hashtagsInputEl.value, hashtags);
nextTick(() => { nextTick(() => {
// 稿 // 稿
@ -955,6 +956,15 @@ onMounted(() => {
}); });
}); });
onUnmounted(() => {
autocompleteTextareaInput.value?.detach();
autocompleteTextareaInput.value = null;
autocompleteCwInput.value?.detach();
autocompleteCwInput.value = null;
autocompleteHashtagsInput.value?.detach();
autocompleteHashtagsInput.value = null;
});
defineExpose({ defineExpose({
clear, clear,
}); });

View File

@ -6,7 +6,7 @@
import * as Misskey from 'misskey-js'; import * as Misskey from 'misskey-js';
import { Ref } from 'vue'; import { Ref } from 'vue';
export type MenuAction = (ev: MouseEvent) => void; export type MenuAction = (ev: MouseEvent) => Promise<void> | void;
export type MenuDivider = { type: 'divider' }; export type MenuDivider = { type: 'divider' };
export type MenuNull = undefined; export type MenuNull = undefined;

View File

@ -7,5 +7,5 @@ export type PageHeaderItem = {
text: string; text: string;
icon: string; icon: string;
highlighted?: boolean; highlighted?: boolean;
handler: (ev: MouseEvent) => void; handler: (ev: MouseEvent) => Promise<void> | void;
}; };