Skip to content

Commit f59224c

Browse files
committed
style(hyper-link): add mark hyper link underline style. (#525)
1 parent ff86b0a commit f59224c

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

extensions/hyper-link/src/index.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ const linkDecorator = (
8181
const start = to,
8282
end = to;
8383
const linkIcon = new HyperLinkIcon({ at: start, url: urlStr, anchor });
84+
add(from, to, Decoration.mark({ class: 'cm-hyper-link-underline' }));
8485
add(start, end, Decoration.widget({ widget: linkIcon, side: 1 }));
8586
},
8687
});
@@ -130,6 +131,9 @@ export const hyperLinkStyle = EditorView.baseTheme({
130131
'.cm-hyper-link-icon svg': {
131132
display: 'block',
132133
},
134+
'.cm-hyper-link-underline': {
135+
textDecoration: 'underline',
136+
},
133137
});
134138

135139
export const hyperLink: Extension = [hyperLinkExtension(), hyperLinkStyle];

www/src/pages/extensions/hyper-link/example.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import { PageWarpper } from '..';
1111
// regexp: /codemirror/gi,
1212
// match: { codemirror: 'https://google.com' },
1313
// handle: (value, input, from, to) => {
14-
// if (value === 'Hyper') return 'https://google.com';
14+
// if (value === 'codemirror') return 'https://google.com';
1515
// return value;
1616
// },
1717
// }),
@@ -20,7 +20,6 @@ import { PageWarpper } from '..';
2020

2121
export const HyperLinkExample = () => {
2222
const { theme } = useTheme();
23-
2423
return (
2524
<PageWarpper>
2625
<CodeMirror

0 commit comments

Comments
 (0)