Skip to content
This repository was archived by the owner on Sep 9, 2024. It is now read-only.

Commit c8dc3d4

Browse files
authored
fix: make hint markdown link clickable (#971)
1 parent fb5fb68 commit c8dc3d4

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

packages/core/dev-test/config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ collections:
7575
- label: Body
7676
name: body
7777
widget: markdown
78-
hint: "*Main* __content__ __*goes*__ [here](example.com)."
78+
hint: "*Main* __content__ __*goes*__ [here](https://example.com/)."
7979
- name: faq
8080
label: FAQ
8181
folder: _faqs

packages/core/src/components/common/field/Hint.tsx

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
import React from 'react';
1+
import React, { useCallback } from 'react';
22
import ReactMarkdown from 'react-markdown';
33
import gfm from 'remark-gfm';
44

55
import useCursor from '@staticcms/core/lib/hooks/useCursor';
66
import classNames from '@staticcms/core/lib/util/classNames.util';
77
import { generateClassNames } from '@staticcms/core/lib/util/theming.util';
88

9-
import type { FC } from 'react';
9+
import type { FC, MouseEvent } from 'react';
1010

1111
import './Hint.css';
1212

@@ -40,6 +40,10 @@ const Hint: FC<HintProps> = ({
4040
}) => {
4141
const finalCursor = useCursor(cursor, disabled);
4242

43+
const handleOnClick = useCallback((event: MouseEvent) => {
44+
event.stopPropagation();
45+
}, []);
46+
4347
return (
4448
<div
4549
data-testid="hint"
@@ -53,6 +57,7 @@ const Hint: FC<HintProps> = ({
5357
variant === 'inline' && classes.inline,
5458
className,
5559
)}
60+
onClick={handleOnClick}
5661
>
5762
<ReactMarkdown
5863
remarkPlugins={[gfm]}

0 commit comments

Comments
 (0)