diff options
| author | Khsmty <me@khsmty.com> | 2023-02-26 12:25:27 +0900 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-02-26 12:25:27 +0900 |
| commit | 72888b4814cc97ce9853832b976cefdcc0f7ad99 (patch) | |
| tree | 639e44985b92c7b79dcf06ba13c1e969760a6c5c /packages/frontend/src/components | |
| parent | enhance(client): improve user menu ux (diff) | |
| download | misskey-72888b4814cc97ce9853832b976cefdcc0f7ad99.tar.gz misskey-72888b4814cc97ce9853832b976cefdcc0f7ad99.tar.bz2 misskey-72888b4814cc97ce9853832b976cefdcc0f7ad99.zip | |
enhance(client): photoswipe 表示時に戻る操作をしても前の画面に戻らないように (#10098)
* enhance(client): photoswipe 表示時に戻る操作をしても前の画面に戻らないように
* add: changelog
---------
Co-authored-by: syuilo <Syuilotan@yahoo.co.jp>
Diffstat (limited to 'packages/frontend/src/components')
| -rw-r--r-- | packages/frontend/src/components/MkMediaList.vue | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/packages/frontend/src/components/MkMediaList.vue b/packages/frontend/src/components/MkMediaList.vue index a12bb78e35..fafa0bd232 100644 --- a/packages/frontend/src/components/MkMediaList.vue +++ b/packages/frontend/src/components/MkMediaList.vue @@ -113,6 +113,23 @@ onMounted(() => { }); lightbox.init(); + + window.addEventListener('popstate', () => { + if (lightbox.pswp && lightbox.pswp.isOpen === true) { + lightbox.pswp.close(); + return; + } + }); + + lightbox.on('beforeOpen', () => { + history.pushState(null, '', '#pswp'); + }); + + lightbox.on('close', () => { + if (window.location.hash === '#pswp') { + history.back(); + } + }); }); const previewable = (file: misskey.entities.DriveFile): boolean => { |