diff options
| author | tamaina <tamaina@hotmail.co.jp> | 2022-01-21 21:32:50 +0900 |
|---|---|---|
| committer | tamaina <tamaina@hotmail.co.jp> | 2022-01-21 21:32:50 +0900 |
| commit | b5a20494f6032f840475bb69c79ccc2ffac11b7c (patch) | |
| tree | 9da47076c540446cf818f456eca697d423fd5ef4 /packages/client/src/scripts | |
| parent | Merge branch 'develop' into pizzax-indexeddb (diff) | |
| parent | chore(client): add #misskey button (diff) | |
| download | misskey-b5a20494f6032f840475bb69c79ccc2ffac11b7c.tar.gz misskey-b5a20494f6032f840475bb69c79ccc2ffac11b7c.tar.bz2 misskey-b5a20494f6032f840475bb69c79ccc2ffac11b7c.zip | |
Merge branch 'develop' into pizzax-indexeddb
Diffstat (limited to 'packages/client/src/scripts')
| -rw-r--r-- | packages/client/src/scripts/emojilist.ts | 12 | ||||
| -rw-r--r-- | packages/client/src/scripts/get-note-menu.ts | 2 | ||||
| -rw-r--r-- | packages/client/src/scripts/get-user-menu.ts | 4 | ||||
| -rw-r--r-- | packages/client/src/scripts/touch.ts | 4 | ||||
| -rw-r--r-- | packages/client/src/scripts/use-leave-guard.ts | 12 |
5 files changed, 27 insertions, 7 deletions
diff --git a/packages/client/src/scripts/emojilist.ts b/packages/client/src/scripts/emojilist.ts index de7591f5a0..bd8689e4f8 100644 --- a/packages/client/src/scripts/emojilist.ts +++ b/packages/client/src/scripts/emojilist.ts @@ -1,7 +1,11 @@ -// initial converted from https://github.com/muan/emojilib/commit/242fe68be86ed6536843b83f7e32f376468b38fb -export const emojilist = require('../emojilist.json') as { +export const unicodeEmojiCategories = ['face', 'people', 'animals_and_nature', 'food_and_drink', 'activity', 'travel_and_places', 'objects', 'symbols', 'flags'] as const; + +export type UnicodeEmojiDef = { name: string; keywords: string[]; char: string; - category: 'people' | 'animals_and_nature' | 'food_and_drink' | 'activity' | 'travel_and_places' | 'objects' | 'symbols' | 'flags'; -}[]; + category: typeof unicodeEmojiCategories[number]; +} + +// initial converted from https://github.com/muan/emojilib/commit/242fe68be86ed6536843b83f7e32f376468b38fb +export const emojilist = require('../emojilist.json') as UnicodeEmojiDef[]; diff --git a/packages/client/src/scripts/get-note-menu.ts b/packages/client/src/scripts/get-note-menu.ts index 61120d53ba..3634f39632 100644 --- a/packages/client/src/scripts/get-note-menu.ts +++ b/packages/client/src/scripts/get-note-menu.ts @@ -252,7 +252,7 @@ export function getNoteMenu(props: { icon: 'fas fa-exclamation-circle', text: i18n.locale.reportAbuse, action: () => { - const u = `${url}/notes/${appearNote.id}`; + const u = appearNote.url || appearNote.uri || `${url}/notes/${appearNote.id}`; os.popup(import('@/components/abuse-report-window.vue'), { user: appearNote.user, initialComment: `Note: ${u}\n-----\n` diff --git a/packages/client/src/scripts/get-user-menu.ts b/packages/client/src/scripts/get-user-menu.ts index ebe101bc0f..7b910a0083 100644 --- a/packages/client/src/scripts/get-user-menu.ts +++ b/packages/client/src/scripts/get-user-menu.ts @@ -5,7 +5,7 @@ import * as Acct from 'misskey-js/built/acct'; import * as os from '@/os'; import { userActions } from '@/store'; import { router } from '@/router'; -import { $i } from '@/account'; +import { $i, iAmModerator } from '@/account'; export function getUserMenu(user) { const meId = $i ? $i.id : null; @@ -175,7 +175,7 @@ export function getUserMenu(user) { action: reportAbuse }]); - if ($i && ($i.isAdmin || $i.isModerator)) { + if (iAmModerator) { menu = menu.concat([null, { icon: 'fas fa-microphone-slash', text: user.isSilenced ? i18n.locale.unsilence : i18n.locale.silence, diff --git a/packages/client/src/scripts/touch.ts b/packages/client/src/scripts/touch.ts index 06b4f8b2ed..5251bc2e27 100644 --- a/packages/client/src/scripts/touch.ts +++ b/packages/client/src/scripts/touch.ts @@ -14,6 +14,10 @@ if (isTouchSupported) { }, { passive: true }); window.addEventListener('touchend', () => { + // 子要素のtouchstartイベントでstopPropagation()が呼ばれると親要素に伝搬されずタッチされたと判定されないため、 + // touchendイベントでもtouchstartイベントと同様にtrueにする + isTouchUsing = true; + isScreenTouching = false; }, { passive: true }); } diff --git a/packages/client/src/scripts/use-leave-guard.ts b/packages/client/src/scripts/use-leave-guard.ts index 21899af59a..3984256251 100644 --- a/packages/client/src/scripts/use-leave-guard.ts +++ b/packages/client/src/scripts/use-leave-guard.ts @@ -1,4 +1,5 @@ import { inject, onUnmounted, Ref } from 'vue'; +import { onBeforeRouteLeave } from 'vue-router'; import { i18n } from '@/i18n'; import * as os from '@/os'; @@ -16,6 +17,17 @@ export function useLeaveGuard(enabled: Ref<boolean>) { return canceled; }); + } else { + onBeforeRouteLeave(async (to, from) => { + if (!enabled.value) return true; + + const { canceled } = await os.confirm({ + type: 'warning', + text: i18n.locale.leaveConfirm, + }); + + return !canceled; + }); } /* |