enhance(frontend): 全てのページネーションにおいてコンテキストメニューからリロードできるように
This commit is contained in:
parent
684424f26a
commit
43abbce2af
|
@ -4,7 +4,7 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||||
-->
|
-->
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<component :is="prefer.s.enablePullToRefresh && pullToRefresh ? MkPullToRefresh : 'div'" :refresher="() => paginator.reload()">
|
<component :is="prefer.s.enablePullToRefresh && pullToRefresh ? MkPullToRefresh : 'div'" :refresher="() => paginator.reload()" @contextmenu.prevent.stop="onContextmenu">
|
||||||
<!-- :css="prefer.s.animation" にしたいけどバグる(おそらくvueのバグ) https://github.com/misskey-dev/misskey/issues/16078 -->
|
<!-- :css="prefer.s.animation" にしたいけどバグる(おそらくvueのバグ) https://github.com/misskey-dev/misskey/issues/16078 -->
|
||||||
<Transition
|
<Transition
|
||||||
:enterActiveClass="prefer.s.animation ? $style.transition_fade_enterActive : ''"
|
:enterActiveClass="prefer.s.animation ? $style.transition_fade_enterActive : ''"
|
||||||
|
@ -41,6 +41,7 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup generic="T extends PagingCtx">
|
<script lang="ts" setup generic="T extends PagingCtx">
|
||||||
|
import { isLink } from '@@/js/is-link.js';
|
||||||
import type { PagingCtx } from '@/composables/use-pagination.js';
|
import type { PagingCtx } from '@/composables/use-pagination.js';
|
||||||
import type { UnwrapRef } from 'vue';
|
import type { UnwrapRef } from 'vue';
|
||||||
import MkButton from '@/components/MkButton.vue';
|
import MkButton from '@/components/MkButton.vue';
|
||||||
|
@ -48,6 +49,7 @@ import { i18n } from '@/i18n.js';
|
||||||
import { prefer } from '@/preferences.js';
|
import { prefer } from '@/preferences.js';
|
||||||
import { usePagination } from '@/composables/use-pagination.js';
|
import { usePagination } from '@/composables/use-pagination.js';
|
||||||
import MkPullToRefresh from '@/components/MkPullToRefresh.vue';
|
import MkPullToRefresh from '@/components/MkPullToRefresh.vue';
|
||||||
|
import * as os from '@/os.js';
|
||||||
|
|
||||||
type Paginator = ReturnType<typeof usePagination<T['endpoint']>>;
|
type Paginator = ReturnType<typeof usePagination<T['endpoint']>>;
|
||||||
|
|
||||||
|
@ -73,6 +75,19 @@ function appearFetchMore() {
|
||||||
paginator.fetchOlder();
|
paginator.fetchOlder();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function onContextmenu(ev: MouseEvent) {
|
||||||
|
if (ev.target && isLink(ev.target as HTMLElement)) return;
|
||||||
|
if (window.getSelection()?.toString() !== '') return;
|
||||||
|
|
||||||
|
os.contextMenu([{
|
||||||
|
icon: 'ti ti-refresh',
|
||||||
|
text: i18n.ts.reload,
|
||||||
|
action: () => {
|
||||||
|
paginator.reload();
|
||||||
|
},
|
||||||
|
}], ev);
|
||||||
|
}
|
||||||
|
|
||||||
defineSlots<{
|
defineSlots<{
|
||||||
empty: () => void;
|
empty: () => void;
|
||||||
default: (props: { items: UnwrapRef<Paginator['items']> }) => void;
|
default: (props: { items: UnwrapRef<Paginator['items']> }) => void;
|
||||||
|
|
Loading…
Reference in New Issue