Home Reference Source

application/components/common/simple-editor/decorator/link.js

import React from 'react';

/**
 * Simply wrap the link and provide a clickthrough
 */
const LinkDecorator = (props) => {
    const handleLink = () => {
        window.open(props.children[0].props.text);
    }

    const defaultStyle = {
        cursor: 'pointer',
        color: 'cornflowerBlue',
        textDecoration: 'underline'    
    }
    
    return (
        <span {...props}
            className='inline-link'
            style={defaultStyle}
            onClick={handleLink}
            >{props.children}</span>
    );
};

export default LinkDecorator;