Skip to content

Commit 8ec7863

Browse files
authored
feat: hide scrollbar in plugin mode (#1090)
1 parent b55db97 commit 8ec7863

2 files changed

Lines changed: 80 additions & 4 deletions

File tree

apps/web/src/App.vue

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,18 @@
11
<script setup lang="ts">
2+
import { onMounted, ref } from 'vue'
23
import { Toaster } from '@/components/ui/sonner'
34
import CodemirrorEditor from '@/views/CodemirrorEditor.vue'
45
56
const store = useStore()
7+
const isUtools = ref(false)
8+
9+
onMounted(() => {
10+
// 检测是否为 Utools 环境
11+
isUtools.value = !!(window as any).__MD_UTOOLS__
12+
if (isUtools.value) {
13+
document.documentElement.classList.add(`is-utools`)
14+
}
15+
})
616
</script>
717

818
<template>
@@ -46,6 +56,23 @@ body {
4656
background-color: rgba(144, 146, 152, 0.5);
4757
}
4858
59+
// Utools 模式下隐藏所有滚动条
60+
.is-utools {
61+
::-webkit-scrollbar {
62+
display: none;
63+
}
64+
65+
// Firefox
66+
* {
67+
scrollbar-width: none;
68+
}
69+
70+
// IE and Edge
71+
* {
72+
-ms-overflow-style: none;
73+
}
74+
}
75+
4976
/* CSS-hints */
5077
.CodeMirror-hints {
5178
position: absolute;

apps/web/src/components/ai/SidebarAIToolbar.vue

Lines changed: 53 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ onMounted(() => {
128128
<!-- 默认状态:贴边栏 -->
129129
<div
130130
v-if="!isExpanded"
131-
class="w-5 h-16 bg-gradient-to-b from-blue-500/90 to-purple-500/90 hover:from-blue-600/95 hover:to-purple-600/95 dark:from-blue-400/90 dark:to-purple-400/90 dark:hover:from-blue-500/95 dark:hover:to-purple-500/95 backdrop-blur-lg border-l border-y border-blue-300/50 dark:border-blue-600/50 cursor-pointer transition-all duration-200 flex items-center justify-center rounded-l-lg shadow-lg group"
131+
class="w-5 h-16 bg-gradient-to-b from-blue-500/90 to-purple-500/90 hover:from-blue-600/95 hover:to-purple-600/95 dark:from-blue-400/90 dark:to-purple-400/90 dark:hover:from-blue-500/95 dark:hover:to-purple-500/95 backdrop-blur-lg border-l border-y border-blue-300/50 dark:border-blue-600/50 cursor-pointer transition-all duration-200 flex items-center justify-center rounded-l-lg shadow-lg group utools-sidebar-edge"
132132
title="展开AI工具栏"
133133
@click="toggleExpanded"
134134
>
@@ -146,7 +146,7 @@ onMounted(() => {
146146
<!-- AI助手按钮 -->
147147
<div class="flex flex-col items-center gap-1 px-1">
148148
<button
149-
class="group relative w-7 h-7 rounded-lg bg-gradient-to-br from-blue-500 to-blue-600 hover:from-blue-600 hover:to-blue-700 text-white shadow-md hover:shadow-lg transform hover:scale-105 active:scale-95 transition-all duration-200 flex items-center justify-center"
149+
class="group relative w-7 h-7 rounded-lg bg-gradient-to-br from-blue-500 to-blue-600 hover:from-blue-600 hover:to-blue-700 text-white shadow-md hover:shadow-lg transform hover:scale-105 active:scale-95 transition-all duration-200 flex items-center justify-center utools-ai-button"
150150
title="AI助手"
151151
@click="openAIChat"
152152
>
@@ -167,7 +167,7 @@ onMounted(() => {
167167
<!-- AI文生图按钮 -->
168168
<div class="flex flex-col items-center gap-1 px-1">
169169
<button
170-
class="group relative w-7 h-7 rounded-lg bg-gradient-to-br from-purple-500 to-purple-600 hover:from-purple-600 hover:to-purple-700 text-white shadow-md hover:shadow-lg transform hover:scale-105 active:scale-95 transition-all duration-200 flex items-center justify-center"
170+
class="group relative w-7 h-7 rounded-lg bg-gradient-to-br from-purple-500 to-purple-600 hover:from-purple-600 hover:to-purple-700 text-white shadow-md hover:shadow-lg transform hover:scale-105 active:scale-95 transition-all duration-200 flex items-center justify-center utools-ai-button"
171171
title="AI文生图"
172172
@click="openAIImageGenerator"
173173
>
@@ -188,7 +188,7 @@ onMounted(() => {
188188
<!-- AI工具箱按钮 (只有选中文本且展开时才显示) -->
189189
<div v-if="hasSelectedText && isExpanded" class="flex flex-col items-center gap-1 px-1">
190190
<button
191-
class="group relative w-7 h-7 rounded-lg bg-gradient-to-br from-green-500 to-green-600 hover:from-green-600 hover:to-green-700 text-white shadow-md hover:shadow-lg transform hover:scale-105 active:scale-95 transition-all duration-200 flex items-center justify-center"
191+
class="group relative w-7 h-7 rounded-lg bg-gradient-to-br from-green-500 to-green-600 hover:from-green-600 hover:to-green-700 text-white shadow-md hover:shadow-lg transform hover:scale-105 active:scale-95 transition-all duration-200 flex items-center justify-center utools-ai-button"
192192
title="AI工具箱"
193193
@click="openAIToolBox"
194194
>
@@ -306,4 +306,53 @@ onMounted(() => {
306306
transform: translateX(0);
307307
}
308308
}
309+
310+
/* uTools 插件模式下使用黑白风格 */
311+
.is-utools .utools-sidebar-edge {
312+
background: rgb(0 0 0 / 0.9) !important;
313+
border-color: rgb(0 0 0 / 0.5) !important;
314+
}
315+
316+
.is-utools .utools-sidebar-edge:hover {
317+
background: rgb(0 0 0 / 0.95) !important;
318+
}
319+
320+
.is-utools.dark .utools-sidebar-edge {
321+
background: rgb(255 255 255 / 0.9) !important;
322+
border-color: rgb(255 255 255 / 0.5) !important;
323+
}
324+
325+
.is-utools.dark .utools-sidebar-edge:hover {
326+
background: rgb(255 255 255 / 0.95) !important;
327+
}
328+
329+
.is-utools.dark .utools-sidebar-edge .lucide {
330+
color: rgb(0 0 0) !important;
331+
}
332+
333+
/* uTools 模式下 AI 按钮使用黑白风格 */
334+
.is-utools .utools-ai-button {
335+
background: rgb(0 0 0 / 0.85) !important;
336+
background-image: none !important;
337+
}
338+
339+
.is-utools .utools-ai-button:hover {
340+
background: rgb(0 0 0 / 0.95) !important;
341+
background-image: none !important;
342+
}
343+
344+
.is-utools.dark .utools-ai-button {
345+
background: rgb(255 255 255 / 0.85) !important;
346+
background-image: none !important;
347+
color: rgb(0 0 0) !important;
348+
}
349+
350+
.is-utools.dark .utools-ai-button:hover {
351+
background: rgb(255 255 255 / 0.95) !important;
352+
background-image: none !important;
353+
}
354+
355+
.is-utools.dark .utools-ai-button .lucide {
356+
color: rgb(0 0 0) !important;
357+
}
309358
</style>

0 commit comments

Comments
 (0)