import { library } from '@fortawesome/fontawesome-svg-core'; import { faEdit, faEye, faTimes, faArrowRight } from '@fortawesome/free-solid-svg-icons'; import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; import { observer } from "mobx-react"; import { DocumentManager } from "../../util/DocumentManager"; import { undoBatch } from "../../util/UndoManager"; import './LinkBox.scss'; import React = require("react"); import { Doc } from '../../../new_fields/Doc'; import { StrCast } from '../../../new_fields/Types'; library.add(faEye); library.add(faEdit); library.add(faTimes); library.add(faArrowRight); interface Props { linkDoc: Doc; sourceDoc: Doc; destinationDoc: Doc; showEditor: () => void; } @observer export class LinkBox extends React.Component { @undoBatch onFollowLink = async (e: React.PointerEvent): Promise => { e.stopPropagation(); DocumentManager.Instance.jumpToDocument(this.props.destinationDoc, e.altKey); } onEdit = (e: React.PointerEvent): void => { e.stopPropagation(); this.props.showEditor(); } render() { return (

{StrCast(this.props.destinationDoc.title)}

); } }