From 091923764d3083dda958ca1109c6c7a806414a4f Mon Sep 17 00:00:00 2001 From: syuilo Date: Sun, 16 Feb 2020 22:46:18 +0900 Subject: [PATCH] Implement image dialog --- CHANGELOG.md | 1 + locales/ja-JP.yml | 1 + src/client/components/image-viewer.vue | 54 ++++++++++++++++++++++++++ src/client/components/media-image.vue | 12 +++++- src/client/components/modal.vue | 9 ++++- src/client/pages/settings/general.vue | 6 +++ src/client/store.ts | 1 + 7 files changed, 82 insertions(+), 2 deletions(-) create mode 100644 src/client/components/image-viewer.vue diff --git a/CHANGELOG.md b/CHANGELOG.md index 720754462..07d836041 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ unreleased ### ✨Improvements * 投稿詳細ページで前後の投稿を見れるように * 自分のfollowersノートはRenoteできるように +* 画像ダイアログを実装 * フォロー申請ページの調整 * 壁紙設定の強化 * 画面が狭い状態でMisskeyを起動した場合でも、画面幅が広がったときにウィジェットを表示するように diff --git a/locales/ja-JP.yml b/locales/ja-JP.yml index 9d88a1360..b628b91ab 100644 --- a/locales/ja-JP.yml +++ b/locales/ja-JP.yml @@ -402,6 +402,7 @@ existingAcount: "既存のアカウント" regenerate: "再生成" fontSize: "フォントサイズ" noFollowRequests: "フォロー申請はありません" +openImageInNewTab: "画像を新しいタブで開く" _ago: unknown: "謎" diff --git a/src/client/components/image-viewer.vue b/src/client/components/image-viewer.vue new file mode 100644 index 000000000..3359b600d --- /dev/null +++ b/src/client/components/image-viewer.vue @@ -0,0 +1,54 @@ + + + + + diff --git a/src/client/components/media-image.vue b/src/client/components/media-image.vue index 5ae167d49..3bb1bda5e 100644 --- a/src/client/components/media-image.vue +++ b/src/client/components/media-image.vue @@ -20,6 +20,7 @@ import Vue from 'vue'; import { faExclamationTriangle } from '@fortawesome/free-solid-svg-icons'; import i18n from '../i18n'; import { getStaticImageUrl } from '../scripts/get-static-image-url'; +import ImageViewer from './image-viewer.vue'; export default Vue.extend({ i18n, @@ -60,7 +61,16 @@ export default Vue.extend({ }, methods: { onClick() { - window.open(this.image.url, '_blank'); + if (this.$store.state.device.imageNewTab) { + window.open(this.image.url, '_blank'); + } else { + const viewer = this.$root.new(ImageViewer, { + image: this.image + }); + this.$once('hook:beforeDestroy', () => { + viewer.close(); + }); + } } } }); diff --git a/src/client/components/modal.vue b/src/client/components/modal.vue index a48c7154e..1a9d98a8c 100644 --- a/src/client/components/modal.vue +++ b/src/client/components/modal.vue @@ -1,5 +1,5 @@