From 749102f9c2d229a1ccf8d9d96e1e206bb2b26f09 Mon Sep 17 00:00:00 2001
From: syuilo <syuilotan@yahoo.co.jp>
Date: Sun, 25 Oct 2020 09:26:19 +0900
Subject: ヘッダーにもコンテキストメニュー追加
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 src/client/ui/default.vue | 24 ++++++++++++++++++++++--
 1 file changed, 22 insertions(+), 2 deletions(-)

(limited to 'src/client/ui/default.vue')

diff --git a/src/client/ui/default.vue b/src/client/ui/default.vue
index b674186dbe..c16ea8008b 100644
--- a/src/client/ui/default.vue
+++ b/src/client/ui/default.vue
@@ -3,7 +3,7 @@
 	<XSidebar ref="nav" class="sidebar"/>
 
 	<div class="contents" ref="contents" :class="{ wallpaper }">
-		<header class="header" ref="header">
+		<header class="header" ref="header" @contextmenu.prevent.stop="onContextmenu">
 			<XHeader :info="pageInfo"/>
 		</header>
 		<main ref="main">
@@ -55,7 +55,7 @@
 
 <script lang="ts">
 import { defineComponent, defineAsyncComponent, markRaw } from 'vue';
-import { faLayerGroup, faBars, faHome, faCircle } from '@fortawesome/free-solid-svg-icons';
+import { faLayerGroup, faBars, faHome, faCircle, faWindowMaximize, faColumns } from '@fortawesome/free-solid-svg-icons';
 import { faBell } from '@fortawesome/free-regular-svg-icons';
 import { host } from '@/config';
 import { search } from '@/scripts/search';
@@ -215,6 +215,26 @@ export default defineComponent({
 			if (window._scroll) window._scroll();
 		},
 
+		onContextmenu(e) {
+			const url = this.$route.path;
+			os.contextMenu([{
+				type: 'label',
+				text: url,
+			}, {
+				icon: faColumns,
+				text: this.$t('openInSideView'),
+				action: () => {
+					this.$refs.side.navigate(url);
+				}
+			}, {
+				icon: faWindowMaximize,
+				text: this.$t('openInWindow'),
+				action: () => {
+					os.pageWindow(url);
+				}
+			}], e);
+		},
+
 		async onNotification(notification) {
 			if (this.$store.state.i.mutingNotificationTypes.includes(notification.type)) {
 				return;
-- 
cgit v1.2.3-freya

