Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

enhance(client): photoswipe 表示時に戻る操作をしても前の画面に戻らないように #10098

Merged
merged 3 commits into from
Feb 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

### Improvements
- feat: 検索画面の統合 (Khsmty)
- photoswipe 表示時に戻る操作をしても前の画面に戻らないように

### Bugfixes
-
Expand Down
17 changes: 17 additions & 0 deletions packages/frontend/src/components/MkMediaList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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 => {
Expand Down