File tree Expand file tree Collapse file tree 2 files changed +19
-0
lines changed
src/json-crdt-peritext-ui/plugins/toolbar/inline Expand file tree Collapse file tree 2 files changed +19
-0
lines changed Original file line number Diff line number Diff line change
1
+ // biome-ignore lint: React is used for JSX
2
+ import * as React from 'react' ;
3
+ import { rule } from 'nano-theme' ;
4
+
5
+ const delClass = rule ( {
6
+ col : 'blue' ,
7
+ } ) ;
8
+
9
+ export interface LinkProps {
10
+ children : React . ReactNode ;
11
+ }
12
+
13
+ export const Link : React . FC < LinkProps > = ( props ) => {
14
+ const { children} = props ;
15
+
16
+ return < a className = { delClass } > { children } </ a > ;
17
+ } ;
Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ import {Code} from './Code';
6
6
import { Kbd } from './Kbd' ;
7
7
import { Ins } from './Ins' ;
8
8
import { Del } from './Del' ;
9
+ import { Link } from './Link' ;
9
10
import type { InlineViewProps } from '../../../web/react/InlineView' ;
10
11
11
12
export interface RenderInlineProps extends InlineViewProps {
@@ -16,6 +17,7 @@ export const RenderInline: React.FC<RenderInlineProps> = (props) => {
16
17
const { inline, children} = props ;
17
18
const attrs = inline . attr ( ) ;
18
19
let element = children ;
20
+ if ( attrs [ CommonSliceType . a ] ) element = < Link > { element } </ Link > ;
19
21
if ( attrs [ CommonSliceType . mark ] ) element = < mark > { element } </ mark > ;
20
22
if ( attrs [ CommonSliceType . sup ] ) element = < sup > { element } </ sup > ;
21
23
if ( attrs [ CommonSliceType . sub ] ) element = < sub > { element } </ sub > ;
You can’t perform that action at this time.
0 commit comments