tangled
alpha
login
or
join now
leaflet.pub
/
leaflet
289
fork
atom
a tool for shared writing and social publishing
289
fork
atom
overview
issues
27
pulls
pipelines
pass attrs to highlight button
awarm.space
2 years ago
5e0def71
c8a7f111
+3
-1
2 changed files
expand all
collapse all
unified
split
components
Toolbar
TextDecorationButton.tsx
index.tsx
+2
-1
components/Toolbar/TextDecorationButton.tsx
···
9
10
export function TextDecorationButton(props: {
11
mark: MarkType;
0
12
icon: React.ReactNode;
13
}) {
14
let focusedBlock = useUIState((s) => s.focusedBlock);
···
36
active={hasMark}
37
onClick={(e) => {
38
e.preventDefault();
39
-
toggleMarkInFocusedBlock(props.mark);
40
}}
41
>
42
{props.icon}
···
9
10
export function TextDecorationButton(props: {
11
mark: MarkType;
12
+
attrs?: any;
13
icon: React.ReactNode;
14
}) {
15
let focusedBlock = useUIState((s) => s.focusedBlock);
···
37
active={hasMark}
38
onClick={(e) => {
39
e.preventDefault();
40
+
toggleMarkInFocusedBlock(props.mark, props.attrs);
41
}}
42
>
43
{props.icon}
+1
components/Toolbar/index.tsx
···
117
/>
118
<div className="flex items-center gap-1">
119
<TextDecorationButton
0
120
mark={schema.marks.highlight}
121
icon={<HighlightSmall />}
122
/>
···
117
/>
118
<div className="flex items-center gap-1">
119
<TextDecorationButton
120
+
attrs={{ color: lastUsedHighlight }}
121
mark={schema.marks.highlight}
122
icon={<HighlightSmall />}
123
/>