mirror of
https://github.com/plankanban/planka.git
synced 2025-07-31 02:59:46 +02:00
feat: Add ability to link tasks to cards
This commit is contained in:
parent
49203e9d56
commit
230f50e3d9
35 changed files with 761 additions and 243 deletions
43
client/src/components/common/Linkify/Linkify.jsx
Normal file
43
client/src/components/common/Linkify/Linkify.jsx
Normal file
|
@ -0,0 +1,43 @@
|
|||
/*!
|
||||
* Copyright (c) 2024 PLANKA Software GmbH
|
||||
* Licensed under the Fair Use License: https://github.com/plankanban/planka/blob/master/LICENSE.md
|
||||
*/
|
||||
|
||||
import React, { useCallback } from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import LinkifyReact from 'linkify-react';
|
||||
|
||||
import Link from './Link';
|
||||
|
||||
const Linkify = React.memo(({ children, linkStopPropagation, ...props }) => {
|
||||
const linkRenderer = useCallback(
|
||||
({ attributes: { href, ...linkProps }, content }) => (
|
||||
// eslint-disable-next-line react/jsx-props-no-spreading
|
||||
<Link {...linkProps} href={href} content={content} stopPropagation={linkStopPropagation} />
|
||||
),
|
||||
[linkStopPropagation],
|
||||
);
|
||||
|
||||
return (
|
||||
<LinkifyReact
|
||||
{...props} // eslint-disable-line react/jsx-props-no-spreading
|
||||
options={{
|
||||
defaultProtocol: 'https',
|
||||
render: linkRenderer,
|
||||
}}
|
||||
>
|
||||
{children}
|
||||
</LinkifyReact>
|
||||
);
|
||||
});
|
||||
|
||||
Linkify.propTypes = {
|
||||
children: PropTypes.string.isRequired,
|
||||
linkStopPropagation: PropTypes.bool,
|
||||
};
|
||||
|
||||
Linkify.defaultProps = {
|
||||
linkStopPropagation: undefined,
|
||||
};
|
||||
|
||||
export default Linkify;
|
Loading…
Add table
Add a link
Reference in a new issue