diff options
Diffstat (limited to 'src/client/views/linking/LinkPopup.tsx')
-rw-r--r-- | src/client/views/linking/LinkPopup.tsx | 31 |
1 files changed, 14 insertions, 17 deletions
diff --git a/src/client/views/linking/LinkPopup.tsx b/src/client/views/linking/LinkPopup.tsx index a6f6bd35f..0bcb68f82 100644 --- a/src/client/views/linking/LinkPopup.tsx +++ b/src/client/views/linking/LinkPopup.tsx @@ -1,17 +1,16 @@ import { action, observable } from 'mobx'; -import { observer } from "mobx-react"; +import { observer } from 'mobx-react'; import { EditorView } from 'prosemirror-view'; +import { Doc } from '../../../fields/Doc'; 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'; +import React = require('react'); interface LinkPopupProps { showPopup: boolean; @@ -23,33 +22,30 @@ interface LinkPopupProps { } /** - * Popup component for creating links from text to Dash documents + * Popup component for creating links from text to Dash documents */ @observer export class LinkPopup extends React.Component<LinkPopupProps> { - @observable private linkURL: string = ""; + @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); - } + ((this.view as any)?.TextView as FormattedTextBox).makeLinkAnchor(undefined, 'onRadd:rightight', target, target); + }; @action onLinkChange = (e: React.ChangeEvent<HTMLInputElement>) => { this.linkURL = e.target.value; - } - + }; getPWidth = () => 500; getPHeight = () => 500; render() { - const popupVisibility = this.props.showPopup ? "block" : "none"; + const popupVisibility = this.props.showPopup ? 'block' : 'none'; const linkDoc = this.props.linkFrom ? this.props.linkFrom : undefined; return ( <div className="linkPopup-container" style={{ display: popupVisibility }}> @@ -68,8 +64,8 @@ export class LinkPopup extends React.Component<LinkPopupProps> { className="linkPopup-searchBox searchBox-input" /> */} <SearchBox - Document={CurrentUserUtils.MySearcher} - DataDoc={CurrentUserUtils.MySearcher} + Document={Doc.MySearcher} + DataDoc={Doc.MySearcher} linkFrom={linkDoc} linkSearch={true} fieldKey="data" @@ -96,9 +92,10 @@ export class LinkPopup extends React.Component<LinkPopupProps> { docRangeFilters={returnEmptyFilter} searchFilterDocs={returnEmptyDoclist} ContainingCollectionView={undefined} - ContainingCollectionDoc={undefined} /> + ContainingCollectionDoc={undefined} + /> </div> </div> ); } -}
\ No newline at end of file +} |