diff --git a/packages/client/src/account.ts b/packages/client/src/account.ts index a04d0378c8..4aeceeccab 100644 --- a/packages/client/src/account.ts +++ b/packages/client/src/account.ts @@ -205,18 +205,18 @@ export async function openAccountMenu(opts: { }, { text: i18n.ts.createAccount, action: () => { createAccount(); }, - }], ev.currentTarget || ev.target); + }], ev.currentTarget ?? ev.target); }, }, { type: 'link', icon: 'fas fa-users', text: i18n.ts.manageAccounts, to: `/settings/accounts`, - }]], ev.currentTarget || ev.target, { + }]], ev.currentTarget ?? ev.target, { align: 'left' }); } else { - popupMenu([...(opts.includeCurrentAccount ? [createItem($i)] : []), ...accountItemPromises], ev.currentTarget || ev.target, { + popupMenu([...(opts.includeCurrentAccount ? [createItem($i)] : []), ...accountItemPromises], ev.currentTarget ?? ev.target, { align: 'left' }); } diff --git a/packages/client/src/components/drive.file.vue b/packages/client/src/components/drive.file.vue index 669c0d7db1..209e9b7c47 100644 --- a/packages/client/src/components/drive.file.vue +++ b/packages/client/src/components/drive.file.vue @@ -95,7 +95,7 @@ function onClick(ev: MouseEvent) { if (props.selectMode) { emit('chosen', props.file); } else { - os.popupMenu(getMenu(), (ev.currentTarget || ev.target || undefined) as HTMLElement | undefined); + os.popupMenu(getMenu(), (ev.currentTarget ?? ev.target || undefined) as HTMLElement | undefined); } } diff --git a/packages/client/src/components/drive.vue b/packages/client/src/components/drive.vue index b706839540..0d3f29d4c3 100644 --- a/packages/client/src/components/drive.vue +++ b/packages/client/src/components/drive.vue @@ -591,7 +591,7 @@ function getMenu() { } function showMenu(ev: MouseEvent) { - os.popupMenu(getMenu(), (ev.currentTarget || ev.target || undefined) as HTMLElement | undefined); + os.popupMenu(getMenu(), (ev.currentTarget ?? ev.target || undefined) as HTMLElement | undefined); } function onContextmenu(ev: MouseEvent) { diff --git a/packages/client/src/components/emoji-picker.vue b/packages/client/src/components/emoji-picker.vue index f291510555..6999ad6517 100644 --- a/packages/client/src/components/emoji-picker.vue +++ b/packages/client/src/components/emoji-picker.vue @@ -280,7 +280,7 @@ function getKey(emoji: string | Misskey.entities.CustomEmoji | UnicodeEmojiDef): } function chosen(emoji: any, ev?: MouseEvent) { - const el = ev && (ev.currentTarget || ev.target) as HTMLElement | null | undefined; + const el = ev && (ev.currentTarget ?? ev.target) as HTMLElement | null | undefined; if (el) { const rect = el.getBoundingClientRect(); const x = rect.left + (el.offsetWidth / 2); diff --git a/packages/client/src/components/global/header.vue b/packages/client/src/components/global/header.vue index 02598d95b3..e558614c12 100644 --- a/packages/client/src/components/global/header.vue +++ b/packages/client/src/components/global/header.vue @@ -113,7 +113,7 @@ export default defineComponent({ if (menu.length > 0) menu.push(null); menu = menu.concat(props.menu); } - popupMenu(menu, ev.currentTarget || ev.target); + popupMenu(menu, ev.currentTarget ?? ev.target); }; const showTabsPopup = (ev: MouseEvent) => { @@ -126,7 +126,7 @@ export default defineComponent({ icon: tab.icon, action: tab.onClick, })); - popupMenu(menu, ev.currentTarget || ev.target); + popupMenu(menu, ev.currentTarget ?? ev.target); }; const preventDrag = (ev: TouchEvent) => { diff --git a/packages/client/src/components/page-window.vue b/packages/client/src/components/page-window.vue index ec7451d5aa..7455236bad 100644 --- a/packages/client/src/components/page-window.vue +++ b/packages/client/src/components/page-window.vue @@ -160,7 +160,7 @@ export default defineComponent({ action: () => { copyToClipboard(this.url); } - }], ev.currentTarget || ev.target); + }], ev.currentTarget ?? ev.target); }, back() { diff --git a/packages/client/src/components/post-form-attaches.vue b/packages/client/src/components/post-form-attaches.vue index 0c8181b481..9dd69a0ee5 100644 --- a/packages/client/src/components/post-form-attaches.vue +++ b/packages/client/src/components/post-form-attaches.vue @@ -127,7 +127,7 @@ export default defineComponent({ text: this.$ts.attachCancel, icon: 'fas fa-times-circle', action: () => { this.detachMedia(file.id) } - }], ev.currentTarget || ev.target).then(() => this.menu = null); + }], ev.currentTarget ?? ev.target).then(() => this.menu = null); } } }); diff --git a/packages/client/src/components/post-form.vue b/packages/client/src/components/post-form.vue index a8882fc05f..8c5027f8e7 100644 --- a/packages/client/src/components/post-form.vue +++ b/packages/client/src/components/post-form.vue @@ -342,7 +342,7 @@ function focus() { } function chooseFileFrom(ev) { - selectFiles(ev.currentTarget || ev.target, i18n.ts.attachFile).then(files_ => { + selectFiles(ev.currentTarget ?? ev.target, i18n.ts.attachFile).then(files_ => { for (const file of files_) { files.push(file); } @@ -592,7 +592,7 @@ function insertMention() { } async function insertEmoji(ev: MouseEvent) { - os.openEmojiPicker(ev.currentTarget || ev.target, {}, textareaEl); + os.openEmojiPicker(ev.currentTarget ?? ev.target, {}, textareaEl); } function showActions(ev) { @@ -605,7 +605,7 @@ function showActions(ev) { if (key === 'text') { text = value; } }); } - })), ev.currentTarget || ev.target); + })), ev.currentTarget ?? ev.target); } let postAccount = $ref(null); diff --git a/packages/client/src/components/sample.vue b/packages/client/src/components/sample.vue index 03ad6a9838..65249ff7e9 100644 --- a/packages/client/src/components/sample.vue +++ b/packages/client/src/components/sample.vue @@ -109,7 +109,7 @@ export default defineComponent({ text: 'Delete some bananas', danger: true, action: () => {}, - }], ev.currentTarget || ev.target); + }], ev.currentTarget ?? ev.target); }, } }); diff --git a/packages/client/src/menu.ts b/packages/client/src/menu.ts index 5f7a527095..ebc7898101 100644 --- a/packages/client/src/menu.ts +++ b/packages/client/src/menu.ts @@ -78,7 +78,7 @@ export const menuDef = reactive({ }]; items.value = _items; }); - os.popupMenu(items, ev.currentTarget || ev.target); + os.popupMenu(items, ev.currentTarget ?? ev.target); }, }, groups: { @@ -109,7 +109,7 @@ export const menuDef = reactive({ }]; items.value = _items; }); - os.popupMenu(items, ev.currentTarget || ev.target); + os.popupMenu(items, ev.currentTarget ?? ev.target); }, }, mentions: { @@ -200,7 +200,7 @@ export const menuDef = reactive({ localStorage.setItem('ui', 'desktop'); unisonReload(); } - }*/], ev.currentTarget || ev.target); + }*/], ev.currentTarget ?? ev.target); }, }, }); diff --git a/packages/client/src/pages/admin/emojis.vue b/packages/client/src/pages/admin/emojis.vue index f6fbf7dbd9..a080ee9c23 100644 --- a/packages/client/src/pages/admin/emojis.vue +++ b/packages/client/src/pages/admin/emojis.vue @@ -118,7 +118,7 @@ const toggleSelect = (emoji) => { }; const add = async (ev: MouseEvent) => { - const files = await selectFiles(ev.currentTarget || ev.target, null); + const files = await selectFiles(ev.currentTarget ?? ev.target, null); const promise = Promise.all(files.map(file => os.api('admin/emoji/add', { fileId: file.id, @@ -160,7 +160,7 @@ const remoteMenu = (emoji, ev: MouseEvent) => { text: i18n.ts.import, icon: 'fas fa-plus', action: () => { im(emoji) } - }], ev.currentTarget || ev.target); + }], ev.currentTarget ?? ev.target); }; const menu = (ev: MouseEvent) => { @@ -186,7 +186,7 @@ const menu = (ev: MouseEvent) => { icon: 'fas fa-upload', text: i18n.ts.import, action: async () => { - const file = await selectFile(ev.currentTarget || ev.target); + const file = await selectFile(ev.currentTarget ?? ev.target); os.api('admin/emoji/import-zip', { fileId: file.id, }) @@ -202,7 +202,7 @@ const menu = (ev: MouseEvent) => { }); }); } - }], ev.currentTarget || ev.target); + }], ev.currentTarget ?? ev.target); }; const setCategoryBulk = async () => { diff --git a/packages/client/src/pages/admin/index.vue b/packages/client/src/pages/admin/index.vue index 6b1b5b86a9..6b11650f48 100644 --- a/packages/client/src/pages/admin/index.vue +++ b/packages/client/src/pages/admin/index.vue @@ -298,7 +298,7 @@ export default defineComponent({ action: () => { alert('TODO'); } - }], ev.currentTarget || ev.target); + }], ev.currentTarget ?? ev.target); }; return { diff --git a/packages/client/src/pages/channel-editor.vue b/packages/client/src/pages/channel-editor.vue index 58c644be62..3818c7481a 100644 --- a/packages/client/src/pages/channel-editor.vue +++ b/packages/client/src/pages/channel-editor.vue @@ -112,7 +112,7 @@ export default defineComponent({ }, setBannerImage(e) { - selectFile(e.currentTarget || e.target, null).then(file => { + selectFile(e.currentTarget ?? e.target, null).then(file => { this.bannerId = file.id; }); }, diff --git a/packages/client/src/pages/clip.vue b/packages/client/src/pages/clip.vue index 6b49221d32..c999f1bfc9 100644 --- a/packages/client/src/pages/clip.vue +++ b/packages/client/src/pages/clip.vue @@ -127,7 +127,7 @@ export default defineComponent({ clipId: this.clip.id, }); } - } : undefined], ev.currentTarget || ev.target); + } : undefined], ev.currentTarget ?? ev.target); } } }); diff --git a/packages/client/src/pages/emojis.emoji.vue b/packages/client/src/pages/emojis.emoji.vue index 9e4deb9ceb..b2801694db 100644 --- a/packages/client/src/pages/emojis.emoji.vue +++ b/packages/client/src/pages/emojis.emoji.vue @@ -29,7 +29,7 @@ function menu(ev) { copyToClipboard(`:${props.emoji.name}:`); os.success(); } - }], ev.currentTarget || ev.target); + }], ev.currentTarget ?? ev.target); } diff --git a/packages/client/src/pages/emojis.vue b/packages/client/src/pages/emojis.vue index 69e3147750..886b5f7119 100644 --- a/packages/client/src/pages/emojis.vue +++ b/packages/client/src/pages/emojis.vue @@ -32,7 +32,7 @@ function menu(ev) { }); }); } - }], ev.currentTarget || ev.target); + }], ev.currentTarget ?? ev.target); } defineExpose({ diff --git a/packages/client/src/pages/gallery/edit.vue b/packages/client/src/pages/gallery/edit.vue index e3fa1a0fcd..25ee513186 100644 --- a/packages/client/src/pages/gallery/edit.vue +++ b/packages/client/src/pages/gallery/edit.vue @@ -92,7 +92,7 @@ export default defineComponent({ methods: { selectFile(e) { - selectFiles(e.currentTarget || e.target, null).then(files => { + selectFiles(e.currentTarget ?? e.target, null).then(files => { this.files = this.files.concat(files); }); }, diff --git a/packages/client/src/pages/messaging/index.vue b/packages/client/src/pages/messaging/index.vue index 554ebc4b6b..88a1e07afc 100644 --- a/packages/client/src/pages/messaging/index.vue +++ b/packages/client/src/pages/messaging/index.vue @@ -128,7 +128,7 @@ export default defineComponent({ text: this.$ts.messagingWithGroup, icon: 'fas fa-users', action: () => { this.startGroup() } - }], ev.currentTarget || ev.target); + }], ev.currentTarget ?? ev.target); }, async startUser() { diff --git a/packages/client/src/pages/messaging/messaging-room.form.vue b/packages/client/src/pages/messaging/messaging-room.form.vue index 1b9421ca9a..3863c8f82b 100644 --- a/packages/client/src/pages/messaging/messaging-room.form.vue +++ b/packages/client/src/pages/messaging/messaging-room.form.vue @@ -154,7 +154,7 @@ export default defineComponent({ }, chooseFile(e) { - selectFile(e.currentTarget || e.target, this.$ts.selectFile).then(file => { + selectFile(e.currentTarget ?? e.target, this.$ts.selectFile).then(file => { this.file = file; }); }, @@ -214,7 +214,7 @@ export default defineComponent({ }, async insertEmoji(ev) { - os.openEmojiPicker(ev.currentTarget || ev.target, {}, this.$refs.text); + os.openEmojiPicker(ev.currentTarget ?? ev.target, {}, this.$refs.text); } } }); diff --git a/packages/client/src/pages/messaging/messaging-room.vue b/packages/client/src/pages/messaging/messaging-room.vue index 65c44ce113..2ecc68eb54 100644 --- a/packages/client/src/pages/messaging/messaging-room.vue +++ b/packages/client/src/pages/messaging/messaging-room.vue @@ -335,7 +335,7 @@ const Component = defineComponent({ popout(path); this.$router.back(); }, - }], ev.currentTarget || ev.target); + }], ev.currentTarget ?? ev.target); } } }); diff --git a/packages/client/src/pages/notifications.vue b/packages/client/src/pages/notifications.vue index 96c5b3ca85..36e423e534 100644 --- a/packages/client/src/pages/notifications.vue +++ b/packages/client/src/pages/notifications.vue @@ -32,7 +32,7 @@ function setFilter(ev) { includeTypes = null; } }, null, ...typeItems] : typeItems; - os.popupMenu(items, ev.currentTarget || ev.target); + os.popupMenu(items, ev.currentTarget ?? ev.target); } defineExpose({ diff --git a/packages/client/src/pages/page-editor/page-editor.vue b/packages/client/src/pages/page-editor/page-editor.vue index fe207555f8..f302ac4f90 100644 --- a/packages/client/src/pages/page-editor/page-editor.vue +++ b/packages/client/src/pages/page-editor/page-editor.vue @@ -448,7 +448,7 @@ export default defineComponent({ }, setEyeCatchingImage(e) { - selectFile(e.currentTarget || e.target, null).then(file => { + selectFile(e.currentTarget ?? e.target, null).then(file => { this.eyeCatchingImageId = file.id; }); }, diff --git a/packages/client/src/pages/settings/accounts.vue b/packages/client/src/pages/settings/accounts.vue index c795ede8ac..a744a031d4 100644 --- a/packages/client/src/pages/settings/accounts.vue +++ b/packages/client/src/pages/settings/accounts.vue @@ -64,7 +64,7 @@ export default defineComponent({ icon: 'fas fa-trash-alt', danger: true, action: () => this.removeAccount(account), - }], ev.currentTarget || ev.target); + }], ev.currentTarget ?? ev.target); }, addAccount(ev) { @@ -74,7 +74,7 @@ export default defineComponent({ }, { text: this.$ts.createAccount, action: () => { this.createAccount(); }, - }], ev.currentTarget || ev.target); + }], ev.currentTarget ?? ev.target); }, addExistingAccount() { diff --git a/packages/client/src/pages/settings/import-export.vue b/packages/client/src/pages/settings/import-export.vue index 7b554dcd88..c153b4d28c 100644 --- a/packages/client/src/pages/settings/import-export.vue +++ b/packages/client/src/pages/settings/import-export.vue @@ -114,22 +114,22 @@ export default defineComponent({ }; const importFollowing = async (ev) => { - const file = await selectFile(ev.currentTarget || ev.target); + const file = await selectFile(ev.currentTarget ?? ev.target); os.api('i/import-following', { fileId: file.id }).then(onImportSuccess).catch(onError); }; const importUserLists = async (ev) => { - const file = await selectFile(ev.currentTarget || ev.target); + const file = await selectFile(ev.currentTarget ?? ev.target); os.api('i/import-user-lists', { fileId: file.id }).then(onImportSuccess).catch(onError); }; const importMuting = async (ev) => { - const file = await selectFile(ev.currentTarget || ev.target); + const file = await selectFile(ev.currentTarget ?? ev.target); os.api('i/import-muting', { fileId: file.id }).then(onImportSuccess).catch(onError); }; const importBlocking = async (ev) => { - const file = await selectFile(ev.currentTarget || ev.target); + const file = await selectFile(ev.currentTarget ?? ev.target); os.api('i/import-blocking', { fileId: file.id }).then(onImportSuccess).catch(onError); }; diff --git a/packages/client/src/pages/settings/profile.vue b/packages/client/src/pages/settings/profile.vue index 0786e7f4ae..66b654d87f 100644 --- a/packages/client/src/pages/settings/profile.vue +++ b/packages/client/src/pages/settings/profile.vue @@ -102,7 +102,7 @@ function save() { } function changeAvatar(ev) { - selectFile(ev.currentTarget || ev.target, i18n.ts.avatar).then(async (file) => { + selectFile(ev.currentTarget ?? ev.target, i18n.ts.avatar).then(async (file) => { const i = await os.apiWithDialog('i/update', { avatarId: file.id, }); @@ -112,7 +112,7 @@ function changeAvatar(ev) { } function changeBanner(ev) { - selectFile(ev.currentTarget || ev.target, i18n.ts.banner).then(async (file) => { + selectFile(ev.currentTarget ?? ev.target, i18n.ts.banner).then(async (file) => { const i = await os.apiWithDialog('i/update', { bannerId: file.id, }); diff --git a/packages/client/src/pages/settings/theme.vue b/packages/client/src/pages/settings/theme.vue index fefd72777a..3e4ec1b2af 100644 --- a/packages/client/src/pages/settings/theme.vue +++ b/packages/client/src/pages/settings/theme.vue @@ -184,7 +184,7 @@ export default defineComponent({ themesCount, wallpaper, setWallpaper(e) { - selectFile(e.currentTarget || e.target, null).then(file => { + selectFile(e.currentTarget ?? e.target, null).then(file => { wallpaper.value = file.url; }); }, diff --git a/packages/client/src/pages/timeline.vue b/packages/client/src/pages/timeline.vue index a55fe1eb91..b2266d22c3 100644 --- a/packages/client/src/pages/timeline.vue +++ b/packages/client/src/pages/timeline.vue @@ -64,7 +64,7 @@ async function chooseList(ev: MouseEvent): Promise { text: list.name, to: `/timeline/list/${list.id}`, })); - os.popupMenu(items, ev.currentTarget || ev.target); + os.popupMenu(items, ev.currentTarget ?? ev.target); } async function chooseAntenna(ev: MouseEvent): Promise { @@ -75,7 +75,7 @@ async function chooseAntenna(ev: MouseEvent): Promise { indicate: antenna.hasUnreadNote, to: `/timeline/antenna/${antenna.id}`, })); - os.popupMenu(items, ev.currentTarget || ev.target); + os.popupMenu(items, ev.currentTarget ?? ev.target); } async function chooseChannel(ev: MouseEvent): Promise { @@ -86,7 +86,7 @@ async function chooseChannel(ev: MouseEvent): Promise { indicate: channel.hasUnreadNote, to: `/channels/${channel.id}`, })); - os.popupMenu(items, ev.currentTarget || ev.target); + os.popupMenu(items, ev.currentTarget ?? ev.target); } function saveSrc(): void { diff --git a/packages/client/src/pages/user/index.vue b/packages/client/src/pages/user/index.vue index 599e24d81c..10a86243f9 100644 --- a/packages/client/src/pages/user/index.vue +++ b/packages/client/src/pages/user/index.vue @@ -264,7 +264,7 @@ export default defineComponent({ }, menu(ev) { - os.popupMenu(getUserMenu(this.user), ev.currentTarget || ev.target); + os.popupMenu(getUserMenu(this.user), ev.currentTarget ?? ev.target); }, parallaxLoop() { diff --git a/packages/client/src/pages/welcome.entrance.a.vue b/packages/client/src/pages/welcome.entrance.a.vue index efdc038b7e..47e1f12342 100644 --- a/packages/client/src/pages/welcome.entrance.a.vue +++ b/packages/client/src/pages/welcome.entrance.a.vue @@ -135,7 +135,7 @@ export default defineComponent({ action: () => { window.open(`https://misskey-hub.net/help.md`, '_blank'); } - }], ev.currentTarget || ev.target); + }], ev.currentTarget ?? ev.target); }, number diff --git a/packages/client/src/pages/welcome.entrance.b.vue b/packages/client/src/pages/welcome.entrance.b.vue index 93344dc9a8..053087fda0 100644 --- a/packages/client/src/pages/welcome.entrance.b.vue +++ b/packages/client/src/pages/welcome.entrance.b.vue @@ -119,7 +119,7 @@ export default defineComponent({ action: () => { window.open(`https://misskey-hub.net/help.md`, '_blank'); } - }], ev.currentTarget || ev.target); + }], ev.currentTarget ?? ev.target); }, number diff --git a/packages/client/src/pages/welcome.entrance.c.vue b/packages/client/src/pages/welcome.entrance.c.vue index 36b61647a6..6bf487e16e 100644 --- a/packages/client/src/pages/welcome.entrance.c.vue +++ b/packages/client/src/pages/welcome.entrance.c.vue @@ -139,7 +139,7 @@ export default defineComponent({ action: () => { window.open(`https://misskey-hub.net/help.md`, '_blank'); } - }], ev.currentTarget || ev.target); + }], ev.currentTarget ?? ev.target); }, number diff --git a/packages/client/src/widgets/timeline.vue b/packages/client/src/widgets/timeline.vue index 0e4396c133..34e3b20e36 100644 --- a/packages/client/src/widgets/timeline.vue +++ b/packages/client/src/widgets/timeline.vue @@ -116,7 +116,7 @@ const choose = async (ev) => { text: i18n.ts._timelines.global, icon: 'fas fa-globe', action: () => { setSrc('global') } - }, antennaItems.length > 0 ? null : undefined, ...antennaItems, listItems.length > 0 ? null : undefined, ...listItems], ev.currentTarget || ev.target).then(() => { + }, antennaItems.length > 0 ? null : undefined, ...antennaItems, listItems.length > 0 ? null : undefined, ...listItems], ev.currentTarget ?? ev.target).then(() => { menuOpened.value = false; }); };