Skip to content

Commit 0918af5

Browse files
authored
Merge pull request #53 from qianmoQ/dev-25.0.3
fix (core): 修复函数帮助提示框出现白色背景问题
2 parents dfdc8f6 + a78acf4 commit 0918af5

File tree

4 files changed

+18
-15
lines changed

4 files changed

+18
-15
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,3 +27,5 @@ pnpm-lock.yaml
2727
*.json
2828
!config*.json
2929
go.mod
30+
.RData
31+
.Rhistory

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ CodeForge 是一款轻量级、高性能的桌面代码执行器,专为开发
3434
<img src="public/icons/java.svg" width="60" alt="Java">
3535
<img src="public/icons/javascript-browser.svg" width="60" alt="JavaScript (Browser)">
3636
<img src="public/icons/javascript-jquery.svg" width="60" alt="JavaScript (jQuery)">
37-
<img src="public/icons/nodejs.svg" width="60" alt="JavaScript (Node.js)">
37+
<img src="public/icons/javascript-nodejs.svg" width="60" alt="JavaScript (Node.js)">
3838
<img src="public/icons/kotlin.svg" width="60" alt="Kotlin">
3939
<img src="public/icons/nodejs.svg" width="60" alt="Node.js">
4040
<img src="public/icons/php.svg" width="60" alt="PHP">

src-tauri/src/plugins/shell.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ impl LanguagePlugin for ShellPlugin {
99
}
1010

1111
fn get_language_name(&self) -> &'static str {
12-
"Shell"
12+
"ShellScript"
1313
}
1414

1515
fn get_language_key(&self) -> &'static str {

src/composables/useCodeMirrorFunctionHelp.ts

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,29 @@
1-
import { EditorView, hoverTooltip } from '@codemirror/view'
2-
1
1+
import {EditorView, hoverTooltip} from '@codemirror/view'
2+
33
export function useCodeMirrorFunctionHelp()
44
{
55
// 提示框
66
const createHelpTooltip = (text: string) => {
77
const dom = document.createElement('div')
8-
dom.className = 'cm-function-help-tooltip'
8+
dom.className = 'cm-custom-function-tooltip'
99

1010
dom.innerHTML = `
1111
<div class="relative mb-1">
1212
<div class="px-2 py-1 bg-gray-800 text-white text-xs rounded">
13-
<span class="font-mono">${ text }</span>
13+
<span class="font-mono">${text}</span>
1414
</div>
15-
<!-- 小三角箭头 -->
1615
<div class="absolute left-1/2 transform -translate-x-1/2 top-full">
1716
<div class="w-0 h-0 border-l-4 border-r-4 border-t-4 border-transparent border-t-gray-800"></div>
1817
</div>
1918
</div>
2019
`
2120

22-
return { dom }
21+
return {dom}
2322
}
2423

2524
// 显示函数提示扩展
2625
const showFunctionHelpHover = hoverTooltip((view, pos, side) => {
27-
let { from, to, text } = view.state.doc.lineAt(pos)
26+
let {from, to, text} = view.state.doc.lineAt(pos)
2827
let start = pos, end = pos
2928
while (start > from && /\w/.test(text[start - from - 1])) {
3029
start--
@@ -44,20 +43,22 @@ export function useCodeMirrorFunctionHelp()
4443
return createHelpTooltip(text.slice(start - from, end - from))
4544
}
4645
}
47-
}, { hoverTime: 300 })
46+
}, {hoverTime: 300})
4847

4948
// 提示框样式主题
5049
const functionHelpTheme = EditorView.theme({
51-
'.cm-function-help-tooltip': {
50+
'.cm-custom-function-tooltip': {
5251
zIndex: '100',
5352
animation: 'fadeIn 0.2s ease-out'
5453
},
55-
'.cm-tooltip': {
56-
border: 'none !important'
54+
'.cm-tooltip.cm-tooltip-hover': {
55+
backgroundColor: 'transparent !important',
56+
border: 'none !important',
57+
boxShadow: 'none !important'
5758
},
5859
'@keyframes fadeIn': {
59-
'from': { opacity: '0', transform: 'translateY(-2px)' },
60-
'to': { opacity: '1', transform: 'translateY(0)' }
60+
'from': {opacity: '0', transform: 'translateY(-2px)'},
61+
'to': {opacity: '1', transform: 'translateY(0)'}
6162
}
6263
})
6364

0 commit comments

Comments
 (0)