From 9f8c9ebef2b00e9521d913fbed51f6b3dd7d7582 Mon Sep 17 00:00:00 2001 From: ayang <75017711+bilibili-ayang@users.noreply.github.com> Date: Tue, 21 Mar 2023 14:10:51 +0800 Subject: [PATCH] feat: disable right click in production environment (#44) --- .prettierrc.cjs | 7 ++----- src/App.vue | 10 ++++++++++ src/api/openAi.ts | 1 - src/components/Session/index.scss | 6 +++--- 4 files changed, 15 insertions(+), 9 deletions(-) diff --git a/.prettierrc.cjs b/.prettierrc.cjs index c854e5d..6618ad4 100644 --- a/.prettierrc.cjs +++ b/.prettierrc.cjs @@ -4,10 +4,7 @@ module.exports = { useTabs: false, singleQuote: true, semi: false, - trailingComma: - 'none', + trailingComma: 'none', bracketSpacing: true, - plugins: [ - require('prettier-plugin-tailwindcss') - ] + plugins: [require('prettier-plugin-tailwindcss')] } diff --git a/src/App.vue b/src/App.vue index 956bcbb..6e56a67 100644 --- a/src/App.vue +++ b/src/App.vue @@ -20,6 +20,16 @@ onMounted(async () => { if (!windowFocused.value && !isFix.value) appWindow.hide() }, 100) }) + + if (import.meta.env.PROD) { + document.addEventListener('contextmenu', function (event) { + const selectedText = window.getSelection()?.toString() + + if (!selectedText) { + event.preventDefault() + } + }) + } }) diff --git a/src/api/openAi.ts b/src/api/openAi.ts index 064b174..34900d5 100644 --- a/src/api/openAi.ts +++ b/src/api/openAi.ts @@ -2,7 +2,6 @@ import { Body } from '@tauri-apps/api/http' import { Message } from '@arco-design/web-vue' import { request } from '.' import { OPEN_AI_MODEL } from '@/constants' -import { dialogErrorMessage } from '@/utils' import { fetchEventSource, type EventSourceMessage diff --git a/src/components/Session/index.scss b/src/components/Session/index.scss index 4417ed6..ba14370 100644 --- a/src/components/Session/index.scss +++ b/src/components/Session/index.scss @@ -8,16 +8,16 @@ ::v-deep(.session-item) { pre { --uno: m0; + code { --uno: rounded-md leading-6; } + .code-copy { - background: url('@/assets/image/copy.svg') no-repeat center; - background-size: contain; + background-image: url('@/assets/image/copy.svg'); --uno: transition-300 absolute top-2 right-2 h-6 w-6 cursor-pointer - text-white opacity-0; + bg-contain bg-center bg-no-repeat text-white opacity-0; &:hover { --uno: opacity-100;