Skip to content

Commit 50f05fc

Browse files
authored
Fixed open link error on fuction tooltip (#175)
* added : git ignore * fixed: open link in tooltip to browser & and change some link style
1 parent fc27d9c commit 50f05fc

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

src/renderer/components/CodeEditor/functionTooltips.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,14 @@ function getCursorTooltips(
3737
arrow: true,
3838
create: () => {
3939
const dom = document.createElement('div');
40+
dom.addEventListener('click', (e) => {
41+
const target = e.target as HTMLElement;
42+
const link = target.closest('a');
43+
if (link) {
44+
e.preventDefault();
45+
window.electron.openExternal(link.href);
46+
}
47+
});
4048
dom.className = 'cm-tooltip-cursor';
4149
dom.innerHTML = `
4250
<div style="max-width:700px;">
@@ -82,6 +90,14 @@ const functionTooltipBaseTheme = EditorView.baseTheme({
8290
borderTopColor: 'transparent',
8391
},
8492
},
93+
'.code-tooltip a': {
94+
color: 'white',
95+
textDecoration: 'underline',
96+
},
97+
'.code-tooltip a:hover': {
98+
color: 'white',
99+
textDecoration: 'none',
100+
},
85101
});
86102

87103
export function functionTooltip(dict: TooltipDirectionary) {

0 commit comments

Comments
 (0)