import { action, observable } from 'mobx'; import { observer } from "mobx-react"; import { EditorView } from 'prosemirror-view'; import { emptyFunction, returnEmptyDoclist, returnEmptyFilter, returnFalse, returnTrue } from '../../../Utils'; import { DocUtils } from '../../documents/Documents'; import { CurrentUserUtils } from '../../util/CurrentUserUtils'; import { Transform } from '../../util/Transform'; import { undoBatch } from '../../util/UndoManager'; import { FormattedTextBox } from '../nodes/formattedText/FormattedTextBox'; import { SearchBox } from '../search/SearchBox'; import { DefaultStyleProvider } from '../StyleProvider'; import './LinkPopup.scss'; import React = require("react"); import { Doc, Opt } from '../../../fields/Doc'; interface LinkPopupProps { showPopup: boolean; linkFrom?: () => Doc | undefined; // groupType: string; // linkDoc: Doc; // docView: DocumentView; // sourceDoc: Doc; } /** * Popup component for creating links from text to Dash documents */ @observer export class LinkPopup extends React.Component { @observable private linkURL: string = ""; @observable public view?: EditorView; // TODO: should check for valid URL @undoBatch makeLinkToURL = (target: string, lcoation: string) => { ((this.view as any)?.TextView as FormattedTextBox).makeLinkAnchor(undefined, "onRadd:rightight", target, target); } @action onLinkChange = (e: React.ChangeEvent) => { this.linkURL = e.target.value; } getPWidth = () => 500; getPHeight = () => 500; render() { const popupVisibility = this.props.showPopup ? "block" : "none"; const linkDoc = this.props.linkFrom ? this.props.linkFrom : undefined; return (
{/*

or

*/}
{/* */}
); } }