fix: make hint markdown link clickable (#971)
This commit is contained in:
parent
fb5fb68ecc
commit
c8dc3d4f38
@ -75,7 +75,7 @@ collections:
|
|||||||
- label: Body
|
- label: Body
|
||||||
name: body
|
name: body
|
||||||
widget: markdown
|
widget: markdown
|
||||||
hint: "*Main* __content__ __*goes*__ [here](example.com)."
|
hint: "*Main* __content__ __*goes*__ [here](https://example.com/)."
|
||||||
- name: faq
|
- name: faq
|
||||||
label: FAQ
|
label: FAQ
|
||||||
folder: _faqs
|
folder: _faqs
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import React from 'react';
|
import React, { useCallback } from 'react';
|
||||||
import ReactMarkdown from 'react-markdown';
|
import ReactMarkdown from 'react-markdown';
|
||||||
import gfm from 'remark-gfm';
|
import gfm from 'remark-gfm';
|
||||||
|
|
||||||
@ -6,7 +6,7 @@ import useCursor from '@staticcms/core/lib/hooks/useCursor';
|
|||||||
import classNames from '@staticcms/core/lib/util/classNames.util';
|
import classNames from '@staticcms/core/lib/util/classNames.util';
|
||||||
import { generateClassNames } from '@staticcms/core/lib/util/theming.util';
|
import { generateClassNames } from '@staticcms/core/lib/util/theming.util';
|
||||||
|
|
||||||
import type { FC } from 'react';
|
import type { FC, MouseEvent } from 'react';
|
||||||
|
|
||||||
import './Hint.css';
|
import './Hint.css';
|
||||||
|
|
||||||
@ -40,6 +40,10 @@ const Hint: FC<HintProps> = ({
|
|||||||
}) => {
|
}) => {
|
||||||
const finalCursor = useCursor(cursor, disabled);
|
const finalCursor = useCursor(cursor, disabled);
|
||||||
|
|
||||||
|
const handleOnClick = useCallback((event: MouseEvent) => {
|
||||||
|
event.stopPropagation();
|
||||||
|
}, []);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
data-testid="hint"
|
data-testid="hint"
|
||||||
@ -53,6 +57,7 @@ const Hint: FC<HintProps> = ({
|
|||||||
variant === 'inline' && classes.inline,
|
variant === 'inline' && classes.inline,
|
||||||
className,
|
className,
|
||||||
)}
|
)}
|
||||||
|
onClick={handleOnClick}
|
||||||
>
|
>
|
||||||
<ReactMarkdown
|
<ReactMarkdown
|
||||||
remarkPlugins={[gfm]}
|
remarkPlugins={[gfm]}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user