mirror of
https://github.com/plankanban/planka.git
synced 2025-07-25 16:19:47 +02:00
Markdown support in card description and comment, fixes for mobile devices, update dependencies
This commit is contained in:
parent
ed348cf7bc
commit
2fda41b982
11 changed files with 374 additions and 14 deletions
43
client/src/lib/custom-ui/components/Markdown/Markdown.jsx
Normal file
43
client/src/lib/custom-ui/components/Markdown/Markdown.jsx
Normal file
|
@ -0,0 +1,43 @@
|
|||
import React, { useCallback } from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import ReactMarkdown from 'react-markdown';
|
||||
|
||||
const Markdown = React.memo(({ linkStopPropagation, ...props }) => {
|
||||
const handleLinkClick = useCallback((event) => {
|
||||
event.stopPropagation();
|
||||
}, []);
|
||||
|
||||
const linkRenderer = useCallback(
|
||||
/* eslint-disable jsx-a11y/anchor-has-content,
|
||||
jsx-a11y/click-events-have-key-events,
|
||||
jsx-a11y/no-static-element-interactions,
|
||||
react/jsx-props-no-spreading */
|
||||
(linkProps) => <a {...linkProps} onClick={handleLinkClick} />,
|
||||
/* eslint-enable jsx-a11y/anchor-has-content,
|
||||
jsx-a11y/click-events-have-key-events,
|
||||
jsx-a11y/no-static-element-interactions,
|
||||
react/jsx-props-no-spreading */
|
||||
[handleLinkClick],
|
||||
);
|
||||
|
||||
let renderers;
|
||||
|
||||
if (linkStopPropagation) {
|
||||
renderers = {
|
||||
link: linkRenderer,
|
||||
};
|
||||
}
|
||||
|
||||
// eslint-disable-next-line react/jsx-props-no-spreading
|
||||
return <ReactMarkdown {...props} renderers={renderers} />;
|
||||
});
|
||||
|
||||
Markdown.propTypes = {
|
||||
linkStopPropagation: PropTypes.bool,
|
||||
};
|
||||
|
||||
Markdown.defaultProps = {
|
||||
linkStopPropagation: false,
|
||||
};
|
||||
|
||||
export default Markdown;
|
3
client/src/lib/custom-ui/components/Markdown/index.js
Normal file
3
client/src/lib/custom-ui/components/Markdown/index.js
Normal file
|
@ -0,0 +1,3 @@
|
|||
import Markdown from './Markdown';
|
||||
|
||||
export default Markdown;
|
Loading…
Add table
Add a link
Reference in a new issue