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 {
display: block;
width: 100%;
background: none;
border: none;
outline: none;
font: inherit;
color: inherit;
cursor: pointer;
box-sizing: border-box;

View File

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

View File

@ -100,7 +100,7 @@ SPDX-License-Identifier: AGPL-3.0-only
</template>
<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 Misskey from 'misskey-js';
import insertTextAtCursor from 'insert-text-at-cursor';
@ -191,7 +191,9 @@ if (props.initialVisibleUsers) {
props.initialVisibleUsers.forEach(pushVisibleUser);
}
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 quoteId = ref(null);
const hasNotSpecifiedMentions = ref(false);
@ -909,10 +911,9 @@ onMounted(() => {
});
}
// TODO: detach when unmount
new Autocomplete(textareaEl.value, text);
new Autocomplete(cwInputEl.value, cw);
new Autocomplete(hashtagsInputEl.value, hashtags);
autocompleteTextareaInput.value = new Autocomplete(textareaEl.value, text);
autocompleteCwInput.value = new Autocomplete(cwInputEl.value, cw);
autocompleteHashtagsInput.value = new Autocomplete(hashtagsInputEl.value, hashtags);
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({
clear,
});

View File

@ -6,7 +6,7 @@
import * as Misskey from 'misskey-js';
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 MenuNull = undefined;

View File

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