import('vuedraggable').then(x => x.default));
const props = defineProps<{
- modelValue: any[];
+ modelValue: Misskey.entities.DriveFile[];
detachMediaFn?: (id: string) => void;
}>();
const mock = inject
('mock', false);
const emit = defineEmits<{
- (ev: 'update:modelValue', value: any[]): void;
+ (ev: 'update:modelValue', value: Misskey.entities.DriveFile[]): void;
(ev: 'detach', id: string): void;
(ev: 'changeSensitive', file: Misskey.entities.DriveFile, isSensitive: boolean): void;
(ev: 'changeName', file: Misskey.entities.DriveFile, newName: string): void;
@@ -113,7 +113,7 @@ async function rename(file) {
});
}
-async function describe(file) {
+async function describe(file: Misskey.entities.DriveFile) {
if (mock) return;
const { dispose } = os.popup(defineAsyncComponent(() => import('@/components/MkFileCaptionEditWindow.vue')), {
diff --git a/packages/frontend/src/components/MkPostFormDialog.vue b/packages/frontend/src/components/MkPostFormDialog.vue
index d6bca2905..32d8df150 100644
--- a/packages/frontend/src/components/MkPostFormDialog.vue
+++ b/packages/frontend/src/components/MkPostFormDialog.vue
@@ -11,23 +11,11 @@ SPDX-License-Identifier: AGPL-3.0-only
+
diff --git a/packages/frontend/src/components/MkUrlPreview.vue b/packages/frontend/src/components/MkUrlPreview.vue
index c287effad..f0da8fd3f 100644
--- a/packages/frontend/src/components/MkUrlPreview.vue
+++ b/packages/frontend/src/components/MkUrlPreview.vue
@@ -180,7 +180,7 @@ window.fetch(`/url?url=${encodeURIComponent(requestUrl.href)}&lang=${versatileLa
sensitive.value = info.sensitive ?? false;
});
-function adjustTweetHeight(message: any) {
+function adjustTweetHeight(message: MessageEvent) {
if (message.origin !== 'https://platform.twitter.com') return;
const embed = message.data?.['twttr.embed'];
if (embed?.method !== 'twttr.private.resize') return;
@@ -193,14 +193,16 @@ function openPlayer(): void {
const { dispose } = os.popup(defineAsyncComponent(() => import('@/components/MkYouTubePlayer.vue')), {
url: requestUrl.href,
}, {
- // TODO
+ closed: () => {
+ dispose();
+ },
});
}
-(window as any).addEventListener('message', adjustTweetHeight);
+window.addEventListener('message', adjustTweetHeight);
onUnmounted(() => {
- (window as any).removeEventListener('message', adjustTweetHeight);
+ window.removeEventListener('message', adjustTweetHeight);
});
diff --git a/packages/frontend/src/components/MkUserAnnouncementEditDialog.vue b/packages/frontend/src/components/MkUserAnnouncementEditDialog.vue
index 7a2b5f5dd..7f0266d1d 100644
--- a/packages/frontend/src/components/MkUserAnnouncementEditDialog.vue
+++ b/packages/frontend/src/components/MkUserAnnouncementEditDialog.vue
@@ -62,9 +62,11 @@ import MkTextarea from '@/components/MkTextarea.vue';
import MkSwitch from '@/components/MkSwitch.vue';
import MkRadios from '@/components/MkRadios.vue';
+type AdminAnnouncementType = Misskey.entities.AdminAnnouncementsCreateRequest & { id: string; }
+
const props = defineProps<{
user: Misskey.entities.User,
- announcement?: Misskey.entities.Announcement,
+ announcement?: Required,
}>();
const dialog = ref | null>(null);
@@ -75,7 +77,7 @@ const display = ref(props.announcement ? props.announcement.display : 'dialog');
const needConfirmationToRead = ref(props.announcement ? props.announcement.needConfirmationToRead : false);
const emit = defineEmits<{
- (ev: 'done', v: { deleted?: boolean; updated?: any; created?: any }): void,
+ (ev: 'done', v: { deleted?: boolean; updated?: AdminAnnouncementType; created?: AdminAnnouncementType; }): void,
(ev: 'closed'): void
}>();
@@ -88,7 +90,7 @@ async function done() {
display: display.value,
needConfirmationToRead: needConfirmationToRead.value,
userId: props.user.id,
- };
+ } satisfies Misskey.entities.AdminAnnouncementsCreateRequest;
if (props.announcement) {
await os.apiWithDialog('admin/announcements/update', {
diff --git a/packages/frontend/src/components/MkUsersTooltip.vue b/packages/frontend/src/components/MkUsersTooltip.vue
index 054a50325..0cb7f22e9 100644
--- a/packages/frontend/src/components/MkUsersTooltip.vue
+++ b/packages/frontend/src/components/MkUsersTooltip.vue
@@ -16,12 +16,12 @@ SPDX-License-Identifier: AGPL-3.0-only
diff --git a/packages/frontend/src/pages/follow-requests.vue b/packages/frontend/src/pages/follow-requests.vue
index 8991af808..a840d0d0b 100644
--- a/packages/frontend/src/pages/follow-requests.vue
+++ b/packages/frontend/src/pages/follow-requests.vue
@@ -55,13 +55,13 @@ const pagination = {
function accept(user) {
misskeyApi('following/requests/accept', { userId: user.id }).then(() => {
- paginationComponent.value.reload();
+ paginationComponent.value?.reload();
});
}
function reject(user) {
misskeyApi('following/requests/reject', { userId: user.id }).then(() => {
- paginationComponent.value.reload();
+ paginationComponent.value?.reload();
});
}
diff --git a/packages/frontend/src/pages/lookup.vue b/packages/frontend/src/pages/lookup.vue
index 323395394..6f10c6964 100644
--- a/packages/frontend/src/pages/lookup.vue
+++ b/packages/frontend/src/pages/lookup.vue
@@ -40,7 +40,7 @@ function fetch() {
return;
}
- let promise: Promise;
+ let promise: Promise;
if (uri.startsWith('https://')) {
promise = misskeyApi('ap/show', {
diff --git a/packages/frontend/src/pages/my-clips/index.vue b/packages/frontend/src/pages/my-clips/index.vue
index ece998a7a..acf37a9a2 100644
--- a/packages/frontend/src/pages/my-clips/index.vue
+++ b/packages/frontend/src/pages/my-clips/index.vue
@@ -77,15 +77,15 @@ async function create() {
clipsCache.delete();
- pagingComponent.value.reload();
+ pagingComponent.value?.reload();
}
function onClipCreated() {
- pagingComponent.value.reload();
+ pagingComponent.value?.reload();
}
function onClipDeleted() {
- pagingComponent.value.reload();
+ pagingComponent.value?.reload();
}
const headerActions = computed(() => []);
diff --git a/packages/frontend/src/pages/my-lists/list.vue b/packages/frontend/src/pages/my-lists/list.vue
index 804a5ae8f..69e404bd8 100644
--- a/packages/frontend/src/pages/my-lists/list.vue
+++ b/packages/frontend/src/pages/my-lists/list.vue
@@ -110,7 +110,7 @@ function addUser() {
listId: list.value.id,
userId: user.id,
}).then(() => {
- paginationEl.value.reload();
+ paginationEl.value?.reload();
});
});
}
@@ -126,7 +126,7 @@ async function removeUser(item, ev) {
listId: list.value.id,
userId: item.userId,
}).then(() => {
- paginationEl.value.removeItem(item.id);
+ paginationEl.value?.removeItem(item.id);
});
},
}], ev.currentTarget ?? ev.target);
diff --git a/packages/frontend/src/pages/page-editor/els/page-editor.el.image.vue b/packages/frontend/src/pages/page-editor/els/page-editor.el.image.vue
index 1cfe7a6d2..247b8f61a 100644
--- a/packages/frontend/src/pages/page-editor/els/page-editor.el.image.vue
+++ b/packages/frontend/src/pages/page-editor/els/page-editor.el.image.vue
@@ -30,11 +30,12 @@ import { misskeyApi } from '@/scripts/misskey-api.js';
import { i18n } from '@/i18n.js';
const props = defineProps<{
- modelValue: any
+ modelValue: Misskey.entities.PageBlock & { type: 'image' };
}>();
const emit = defineEmits<{
- (ev: 'update:modelValue', value: any): void;
+ (ev: 'update:modelValue', value: Misskey.entities.PageBlock & { type: 'image' }): void;
+ (ev: 'remove'): void;
}>();
const file = ref(null);
diff --git a/packages/frontend/src/pages/page-editor/els/page-editor.el.note.vue b/packages/frontend/src/pages/page-editor/els/page-editor.el.note.vue
index 0a2838698..52b4f2aaa 100644
--- a/packages/frontend/src/pages/page-editor/els/page-editor.el.note.vue
+++ b/packages/frontend/src/pages/page-editor/els/page-editor.el.note.vue
@@ -34,19 +34,24 @@ import { misskeyApi } from '@/scripts/misskey-api.js';
import { i18n } from '@/i18n.js';
const props = defineProps<{
- modelValue: any
+ modelValue: Misskey.entities.PageBlock & { type: 'note' };
}>();
const emit = defineEmits<{
- (ev: 'update:modelValue', value: any): void;
+ (ev: 'update:modelValue', value: Misskey.entities.PageBlock & { type: 'note' }): void;
}>();
-const id = ref(props.modelValue.note);
+const id = ref(props.modelValue.note);
const note = ref(null);
watch(id, async () => {
if (id.value && (id.value.startsWith('http://') || id.value.startsWith('https://'))) {
- id.value = (id.value.endsWith('/') ? id.value.slice(0, -1) : id.value).split('/').pop();
+ id.value = (id.value.endsWith('/') ? id.value.slice(0, -1) : id.value).split('/').pop() ?? null;
+ }
+
+ if (!id.value) {
+ note.value = null;
+ return;
}
emit('update:modelValue', {
diff --git a/packages/frontend/src/pages/page-editor/els/page-editor.el.section.vue b/packages/frontend/src/pages/page-editor/els/page-editor.el.section.vue
index 0f8dc3314..eea52255c 100644
--- a/packages/frontend/src/pages/page-editor/els/page-editor.el.section.vue
+++ b/packages/frontend/src/pages/page-editor/els/page-editor.el.section.vue
@@ -23,6 +23,7 @@ SPDX-License-Identifier: AGPL-3.0-only
diff --git a/packages/frontend/src/pages/settings/accounts.vue b/packages/frontend/src/pages/settings/accounts.vue
index 16f0716a1..97e960675 100644
--- a/packages/frontend/src/pages/settings/accounts.vue
+++ b/packages/frontend/src/pages/settings/accounts.vue
@@ -90,7 +90,7 @@ function createAccount() {
});
}
-async function switchAccount(account: any) {
+async function switchAccount(account: Misskey.entities.UserDetailed) {
const fetchedAccounts = await getAccounts();
const token = fetchedAccounts.find(x => x.id === account.id)!.token;
switchAccountWithToken(token);
diff --git a/packages/frontend/src/pages/settings/apps.vue b/packages/frontend/src/pages/settings/apps.vue
index 68e36ef1b..651550350 100644
--- a/packages/frontend/src/pages/settings/apps.vue
+++ b/packages/frontend/src/pages/settings/apps.vue
@@ -55,6 +55,7 @@ SPDX-License-Identifier: AGPL-3.0-only
diff --git a/packages/frontend/src/pages/user/home.vue b/packages/frontend/src/pages/user/home.vue
index 00b574063..2794db282 100644
--- a/packages/frontend/src/pages/user/home.vue
+++ b/packages/frontend/src/pages/user/home.vue
@@ -257,7 +257,7 @@ function parallaxLoop() {
}
function parallax() {
- const banner = bannerEl.value as any;
+ const banner = bannerEl.value;
if (banner == null) return;
const top = getScrollPosition(rootEl.value);
diff --git a/packages/frontend/src/router/definition.ts b/packages/frontend/src/router/definition.ts
index b5fd6b6ec..e98e0b59b 100644
--- a/packages/frontend/src/router/definition.ts
+++ b/packages/frontend/src/router/definition.ts
@@ -10,7 +10,7 @@ import { $i, iAmModerator } from '@/account.js';
import MkLoading from '@/pages/_loading_.vue';
import MkError from '@/pages/_error_.vue';
-export const page = (loader: AsyncComponentLoader) => defineAsyncComponent({
+export const page = (loader: AsyncComponentLoader) => defineAsyncComponent({
loader: loader,
loadingComponent: MkLoading,
errorComponent: MkError,
diff --git a/packages/frontend/src/router/main.ts b/packages/frontend/src/router/main.ts
index 6ee967e6f..3c25e80d1 100644
--- a/packages/frontend/src/router/main.ts
+++ b/packages/frontend/src/router/main.ts
@@ -4,7 +4,7 @@
*/
import { EventEmitter } from 'eventemitter3';
-import { IRouter, Resolved, RouteDef, RouterEvent } from '@/nirax.js';
+import { IRouter, Resolved, RouteDef, RouterEvent, RouterFlag } from '@/nirax.js';
import type { App, ShallowRef } from 'vue';
@@ -79,7 +79,7 @@ class MainRouterProxy implements IRouter {
return this.supplier().currentRoute;
}
- get navHook(): ((path: string, flag?: any) => boolean) | null {
+ get navHook(): ((path: string, flag?: RouterFlag) => boolean) | null {
return this.supplier().navHook;
}
@@ -91,11 +91,11 @@ class MainRouterProxy implements IRouter {
return this.supplier().getCurrentKey();
}
- getCurrentPath(): any {
+ getCurrentPath(): string {
return this.supplier().getCurrentPath();
}
- push(path: string, flag?: any): void {
+ push(path: string, flag?: RouterFlag): void {
this.supplier().push(path, flag);
}
diff --git a/packages/frontend/src/scripts/check-word-mute.ts b/packages/frontend/src/scripts/check-word-mute.ts
index 67e896b4b..0a37a08bf 100644
--- a/packages/frontend/src/scripts/check-word-mute.ts
+++ b/packages/frontend/src/scripts/check-word-mute.ts
@@ -2,8 +2,9 @@
* SPDX-FileCopyrightText: syuilo and misskey-project
* SPDX-License-Identifier: AGPL-3.0-only
*/
+import * as Misskey from 'misskey-js';
-export function checkWordMute(note: Record, me: Record | null | undefined, mutedWords: Array): boolean {
+export function checkWordMute(note: Misskey.entities.Note, me: Misskey.entities.UserLite | null | undefined, mutedWords: Array): boolean {
// 自分自身
if (me && (note.userId === me.id)) return false;
diff --git a/packages/frontend/src/scripts/form.ts b/packages/frontend/src/scripts/form.ts
index 242a504c3..1032e97ac 100644
--- a/packages/frontend/src/scripts/form.ts
+++ b/packages/frontend/src/scripts/form.ts
@@ -15,7 +15,7 @@ type Hidden = boolean | ((v: any) => boolean);
export type FormItem = {
label?: string;
type: 'string';
- default: string | null;
+ default?: string | null;
description?: string;
required?: boolean;
hidden?: Hidden;
@@ -24,7 +24,7 @@ export type FormItem = {
} | {
label?: string;
type: 'number';
- default: number | null;
+ default?: number | null;
description?: string;
required?: boolean;
hidden?: Hidden;
@@ -32,20 +32,20 @@ export type FormItem = {
} | {
label?: string;
type: 'boolean';
- default: boolean | null;
+ default?: boolean | null;
description?: string;
hidden?: Hidden;
} | {
label?: string;
type: 'enum';
- default: string | null;
+ default?: string | null;
required?: boolean;
hidden?: Hidden;
enum: EnumItem[];
} | {
label?: string;
type: 'radio';
- default: unknown | null;
+ default?: unknown | null;
required?: boolean;
hidden?: Hidden;
options: {
@@ -55,7 +55,7 @@ export type FormItem = {
} | {
label?: string;
type: 'range';
- default: number | null;
+ default?: number | null;
description?: string;
required?: boolean;
step?: number;
@@ -66,12 +66,12 @@ export type FormItem = {
} | {
label?: string;
type: 'object';
- default: Record | null;
+ default?: Record | null;
hidden: Hidden;
} | {
label?: string;
type: 'array';
- default: unknown[] | null;
+ default?: unknown[] | null;
hidden: Hidden;
} | {
type: 'button';
diff --git a/packages/frontend/src/scripts/misskey-api.ts b/packages/frontend/src/scripts/misskey-api.ts
index 1b1159fd0..e7a92e2d5 100644
--- a/packages/frontend/src/scripts/misskey-api.ts
+++ b/packages/frontend/src/scripts/misskey-api.ts
@@ -17,7 +17,7 @@ export function misskeyApi<
_ResT = ResT extends void ? Misskey.api.SwitchCaseResponseType : ResT,
>(
endpoint: E,
- data: P = {} as any,
+ data: P & { i?: string | null; } = {} as any,
token?: string | null | undefined,
signal?: AbortSignal,
): Promise<_ResT> {
@@ -30,8 +30,8 @@ export function misskeyApi<
const promise = new Promise<_ResT>((resolve, reject) => {
// Append a credential
- if ($i) (data as any).i = $i.token;
- if (token !== undefined) (data as any).i = token;
+ if ($i) data.i = $i.token;
+ if (token !== undefined) data.i = token;
// Send request
window.fetch(`${apiUrl}/${endpoint}`, {
diff --git a/packages/frontend/src/scripts/select-file.ts b/packages/frontend/src/scripts/select-file.ts
index 9aa38178b..b037aa8ac 100644
--- a/packages/frontend/src/scripts/select-file.ts
+++ b/packages/frontend/src/scripts/select-file.ts
@@ -80,7 +80,7 @@ export function chooseFileFromUrl(): Promise {
});
}
-function select(src: any, label: string | null, multiple: boolean): Promise {
+function select(src: HTMLElement | EventTarget | null, label: string | null, multiple: boolean): Promise {
return new Promise((res, rej) => {
const keepOriginal = ref(defaultStore.state.keepOriginalUploading);
@@ -107,10 +107,10 @@ function select(src: any, label: string | null, multiple: boolean): Promise {
+export function selectFile(src: HTMLElement | EventTarget | null, label: string | null = null): Promise {
return select(src, label, false).then(files => files[0]);
}
-export function selectFiles(src: any, label: string | null = null): Promise {
+export function selectFiles(src: HTMLElement | EventTarget | null, label: string | null = null): Promise {
return select(src, label, true);
}
diff --git a/packages/frontend/src/scripts/shuffle.ts b/packages/frontend/src/scripts/shuffle.ts
index fed16bc71..1f6ef1928 100644
--- a/packages/frontend/src/scripts/shuffle.ts
+++ b/packages/frontend/src/scripts/shuffle.ts
@@ -6,8 +6,9 @@
/**
* 配列をシャッフル (破壊的)
*/
-export function shuffle(array: T): T {
- let currentIndex = array.length, randomIndex;
+export function shuffle(array: T): T {
+ let currentIndex = array.length;
+ let randomIndex: number;
// While there remain elements to shuffle.
while (currentIndex !== 0) {
diff --git a/packages/frontend/src/scripts/upload.ts b/packages/frontend/src/scripts/upload.ts
index 22dce609c..713573a37 100644
--- a/packages/frontend/src/scripts/upload.ts
+++ b/packages/frontend/src/scripts/upload.ts
@@ -32,13 +32,13 @@ const mimeTypeMap = {
export function uploadFile(
file: File,
- folder?: any,
+ folder?: string | Misskey.entities.DriveFolder,
name?: string,
keepOriginal: boolean = defaultStore.state.keepOriginalUploading,
): Promise {
if ($i == null) throw new Error('Not logged in');
- if (folder && typeof folder === 'object') folder = folder.id;
+ const _folder = typeof folder === 'string' ? folder : folder?.id;
if (file.size > instance.maxFileSize) {
alert({
@@ -89,11 +89,11 @@ export function uploadFile(
}
const formData = new FormData();
- formData.append('i', $i.token);
+ formData.append('i', $i!.token);
formData.append('force', 'true');
formData.append('file', resizedImage ?? file);
formData.append('name', ctx.name);
- if (folder) formData.append('folderId', folder);
+ if (_folder) formData.append('folderId', _folder);
const xhr = new XMLHttpRequest();
xhr.open('POST', apiUrl + '/drive/files/create', true);
diff --git a/packages/frontend/src/store.ts b/packages/frontend/src/store.ts
index aab67e0b5..911a46363 100644
--- a/packages/frontend/src/store.ts
+++ b/packages/frontend/src/store.ts
@@ -11,6 +11,7 @@ import darkTheme from '@@/themes/d-green-lime.json5';
import { miLocalStorage } from './local-storage.js';
import type { SoundType } from '@/scripts/sound.js';
import { Storage } from '@/pizzax.js';
+import type { Ast } from '@syuilo/aiscript';
interface PostFormAction {
title: string,
@@ -516,7 +517,7 @@ export type Plugin = {
token: string;
src: string | null;
version: string;
- ast: any[];
+ ast: Ast.Node[];
author?: string;
description?: string;
permissions?: string[];
@@ -554,13 +555,13 @@ export class ColdDeviceStorage {
}
public static getAll(): Partial {
- return (Object.keys(this.default) as (keyof typeof this.default)[]).reduce((acc, key) => {
+ return (Object.keys(this.default) as (keyof typeof this.default)[]).reduce>((acc, key) => {
const value = localStorage.getItem(PREFIX + key);
if (value != null) {
acc[key] = JSON.parse(value);
}
return acc;
- }, {} as any);
+ }, {});
}
public static set(key: T, value: typeof ColdDeviceStorage.default[T]): void {
@@ -605,7 +606,7 @@ export class ColdDeviceStorage {
get: () => {
return valueRef.value;
},
- set: (value: unknown) => {
+ set: (value: typeof ColdDeviceStorage.default[K]) => {
const val = value;
ColdDeviceStorage.set(key, val);
},
diff --git a/packages/frontend/src/types/post-form.ts b/packages/frontend/src/types/post-form.ts
new file mode 100644
index 000000000..5bb04a95a
--- /dev/null
+++ b/packages/frontend/src/types/post-form.ts
@@ -0,0 +1,22 @@
+/*
+ * SPDX-FileCopyrightText: syuilo and misskey-project
+ * SPDX-License-Identifier: AGPL-3.0-only
+ */
+
+import * as Misskey from 'misskey-js';
+
+export interface PostFormProps {
+ reply?: Misskey.entities.Note;
+ renote?: Misskey.entities.Note;
+ channel?: Misskey.entities.Channel; // TODO
+ mention?: Misskey.entities.User;
+ specified?: Misskey.entities.UserDetailed;
+ initialText?: string;
+ initialCw?: string;
+ initialVisibility?: (typeof Misskey.noteVisibilities)[number];
+ initialFiles?: Misskey.entities.DriveFile[];
+ initialLocalOnly?: boolean;
+ initialVisibleUsers?: Misskey.entities.UserDetailed[];
+ initialNote?: Misskey.entities.Note;
+ instant?: boolean;
+};
diff --git a/packages/frontend/src/widgets/WidgetPhotos.vue b/packages/frontend/src/widgets/WidgetPhotos.vue
index 34be8c5e5..40e2d8fbc 100644
--- a/packages/frontend/src/widgets/WidgetPhotos.vue
+++ b/packages/frontend/src/widgets/WidgetPhotos.vue
@@ -68,10 +68,10 @@ const onDriveFileCreated = (file) => {
}
};
-const thumbnail = (image: any): string => {
+const thumbnail = (image: Misskey.entities.DriveFile): string => {
return defaultStore.state.disableShowingAnimatedImages
? getStaticImageUrl(image.url)
- : image.thumbnailUrl;
+ : image.thumbnailUrl ?? image.url;
};
misskeyApi('drive/stream', {
From ceb60d61b05e32fa340269122378ea93efb20517 Mon Sep 17 00:00:00 2001
From: syuilo <4439005+syuilo@users.noreply.github.com>
Date: Thu, 31 Oct 2024 13:47:30 +0900
Subject: [PATCH 2/4] refactor
---
packages/frontend/src/pages/emoji-edit-dialog.vue | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/packages/frontend/src/pages/emoji-edit-dialog.vue b/packages/frontend/src/pages/emoji-edit-dialog.vue
index 2caba0367..db3f43687 100644
--- a/packages/frontend/src/pages/emoji-edit-dialog.vue
+++ b/packages/frontend/src/pages/emoji-edit-dialog.vue
@@ -10,7 +10,7 @@ SPDX-License-Identifier: AGPL-3.0-only
:initialHeight="500"
:canResize="true"
@close="windowEl.close()"
- @closed="$emit('closed')"
+ @closed="emit('closed')"
>
:{{ emoji.name }}:
New emoji
@@ -98,6 +98,11 @@ const props = defineProps<{
emoji?: Misskey.entities.EmojiDetailed,
}>();
+const emit = defineEmits<{
+ (ev: 'done', v: { deleted?: boolean; updated?: Misskey.entities.AdminEmojiUpdateRequest; created?: Misskey.entities.AdminEmojiUpdateRequest }): void,
+ (ev: 'closed'): void
+}>();
+
const windowEl = ref | null>(null);
const name = ref(props.emoji ? props.emoji.name : '');
const category = ref(props.emoji?.category ? props.emoji.category : '');
@@ -115,11 +120,6 @@ watch(roleIdsThatCanBeUsedThisEmojiAsReaction, async () => {
const imgUrl = computed(() => file.value ? file.value.url : props.emoji ? `/emoji/${props.emoji.name}.webp` : null);
-const emit = defineEmits<{
- (ev: 'done', v: { deleted?: boolean; updated?: Misskey.entities.AdminEmojiUpdateRequest; created?: Misskey.entities.AdminEmojiUpdateRequest }): void,
- (ev: 'closed'): void
-}>();
-
async function changeImage(ev: Event) {
file.value = await selectFile(ev.currentTarget ?? ev.target, null);
const candidate = file.value.name.replace(/\.(.+)$/, '');
From 724dea8136164dcfcd7238888ef93ccab8270fb9 Mon Sep 17 00:00:00 2001
From: syuilo <4439005+syuilo@users.noreply.github.com>
Date: Thu, 31 Oct 2024 13:47:47 +0900
Subject: [PATCH 3/4] lint
---
packages/frontend/src/pages/emoji-edit-dialog.vue | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/packages/frontend/src/pages/emoji-edit-dialog.vue b/packages/frontend/src/pages/emoji-edit-dialog.vue
index db3f43687..3765319b2 100644
--- a/packages/frontend/src/pages/emoji-edit-dialog.vue
+++ b/packages/frontend/src/pages/emoji-edit-dialog.vue
@@ -9,7 +9,7 @@ SPDX-License-Identifier: AGPL-3.0-only
:initialWidth="400"
:initialHeight="500"
:canResize="true"
- @close="windowEl.close()"
+ @close="windowEl?.close()"
@closed="emit('closed')"
>
:{{ emoji.name }}:
From 224bbd486f8745cd471b77f38570b65be3b87cfc Mon Sep 17 00:00:00 2001
From: syuilo <4439005+syuilo@users.noreply.github.com>
Date: Thu, 31 Oct 2024 13:50:50 +0900
Subject: [PATCH 4/4] refactor
---
packages/frontend/src/components/MkCropperDialog.vue | 2 +-
.../src/components/MkCustomEmojiDetailedDialog.vue | 2 +-
.../frontend/src/components/MkEmbedCodeGenDialog.vue | 2 +-
packages/frontend/src/components/MkFormDialog.vue | 2 +-
packages/frontend/src/components/MkPageWindow.vue | 8 ++++----
packages/frontend/src/components/MkSignupDialog.vue | 2 +-
.../src/components/MkTokenGenerateWindow.vue | 2 +-
.../src/components/MkUserAnnouncementEditDialog.vue | 12 ++++++------
.../frontend/src/components/MkUserSelectDialog.vue | 2 +-
packages/frontend/src/components/MkWidgets.vue | 2 +-
packages/frontend/src/components/MkWindow.vue | 2 +-
.../pages/page-editor/els/page-editor.el.image.vue | 2 +-
.../pages/page-editor/els/page-editor.el.note.vue | 2 +-
.../pages/page-editor/els/page-editor.el.section.vue | 4 ++--
.../pages/page-editor/els/page-editor.el.text.vue | 4 ++--
.../src/pages/page-editor/page-editor.blocks.vue | 2 +-
16 files changed, 26 insertions(+), 26 deletions(-)
diff --git a/packages/frontend/src/components/MkCropperDialog.vue b/packages/frontend/src/components/MkCropperDialog.vue
index c2a1aaf29..0186cfc2c 100644
--- a/packages/frontend/src/components/MkCropperDialog.vue
+++ b/packages/frontend/src/components/MkCropperDialog.vue
@@ -12,7 +12,7 @@ SPDX-License-Identifier: AGPL-3.0-only
:withOkButton="true"
@close="cancel()"
@ok="ok()"
- @closed="$emit('closed')"
+ @closed="emit('closed')"
>
{{ i18n.ts.cropImage }}
diff --git a/packages/frontend/src/components/MkCustomEmojiDetailedDialog.vue b/packages/frontend/src/components/MkCustomEmojiDetailedDialog.vue
index 949adc6a8..ecbee864d 100644
--- a/packages/frontend/src/components/MkCustomEmojiDetailedDialog.vue
+++ b/packages/frontend/src/components/MkCustomEmojiDetailedDialog.vue
@@ -4,7 +4,7 @@ SPDX-License-Identifier: AGPL-3.0-only
-->
-
+
:{{ emoji.name }}:
diff --git a/packages/frontend/src/components/MkEmbedCodeGenDialog.vue b/packages/frontend/src/components/MkEmbedCodeGenDialog.vue
index c2bb516c7..6e9eb7592 100644
--- a/packages/frontend/src/components/MkEmbedCodeGenDialog.vue
+++ b/packages/frontend/src/components/MkEmbedCodeGenDialog.vue
@@ -11,7 +11,7 @@ SPDX-License-Identifier: AGPL-3.0-only
:scroll="false"
:withOkButton="false"
@close="cancel()"
- @closed="$emit('closed')"
+ @closed="emit('closed')"
>
{{ i18n.ts._embedCodeGen.title }}
diff --git a/packages/frontend/src/components/MkFormDialog.vue b/packages/frontend/src/components/MkFormDialog.vue
index 124f11411..a639eae20 100644
--- a/packages/frontend/src/components/MkFormDialog.vue
+++ b/packages/frontend/src/components/MkFormDialog.vue
@@ -13,7 +13,7 @@ SPDX-License-Identifier: AGPL-3.0-only
@click="cancel()"
@ok="ok()"
@close="cancel()"
- @closed="$emit('closed')"
+ @closed="emit('closed')"
>
{{ title }}
diff --git a/packages/frontend/src/components/MkPageWindow.vue b/packages/frontend/src/components/MkPageWindow.vue
index 02c84df44..954742322 100644
--- a/packages/frontend/src/components/MkPageWindow.vue
+++ b/packages/frontend/src/components/MkPageWindow.vue
@@ -13,7 +13,7 @@ SPDX-License-Identifier: AGPL-3.0-only
:buttonsLeft="buttonsLeft"
:buttonsRight="buttonsRight"
:contextmenu="contextmenu"
- @closed="$emit('closed')"
+ @closed="emit('closed')"
>
@@ -30,17 +30,17 @@ SPDX-License-Identifier: AGPL-3.0-only