blob: 7608502415007db8fa4528880ebf36f3f5be4912 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
|
import { observer } from 'mobx-react';
import * as React from 'react';
import { returnEmptyFilter, returnFalse, returnTrue } from '../../../ClientUtils';
import { emptyFunction } from '../../../Utils';
import { Doc, returnEmptyDoclist } from '../../../fields/Doc';
import { Transform } from '../../util/Transform';
import { DefaultStyleProvider, returnEmptyDocViewList } from '../StyleProvider';
import { SearchBox } from '../search/SearchBox';
import './LinkPopup.scss';
interface LinkPopupProps {
linkFrom?: () => Doc | undefined;
linkCreateAnchor?: () => Doc | undefined;
linkCreated?: (link: Doc) => void;
// 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<LinkPopupProps> {
getPWidth = () => 500;
getPHeight = () => 500;
render() {
const linkDoc = this.props.linkFrom ? this.props.linkFrom : undefined;
return (
<div className="linkPopup-container">
{/* <div className="linkPopup-url-container">
<input autoComplete="off" type="text" value={this.linkURL} placeholder="Enter URL..." onChange={this.onLinkChange} />
<button onPointerDown={e => this.makeLinkToURL(this.linkURL, "add:right")}
style={{ display: "block", margin: "10px auto", }}>Apply hyperlink</button>
</div>
<div className="divider">
<div className="line"></div>
<p className="divider-text">or</p>
</div> */}
<div className="linkPopup-document-search-container">
{/* <i></i>
<input defaultValue={""} autoComplete="off" type="text" placeholder="Search for Document..." id="search-input"
className="linkPopup-searchBox searchBox-input" /> */}
<SearchBox
Document={Doc.MySearcher}
docViewPath={returnEmptyDocViewList}
linkFrom={linkDoc}
linkCreateAnchor={this.props.linkCreateAnchor}
linkSearch
linkCreated={this.props.linkCreated}
fieldKey="data"
isSelected={returnTrue}
isContentActive={returnTrue}
select={returnTrue}
addDocument={undefined}
addDocTab={returnTrue}
pinToPres={emptyFunction}
rootSelected={returnFalse}
styleProvider={DefaultStyleProvider}
removeDocument={undefined}
ScreenToLocalTransform={Transform.Identity}
PanelWidth={this.getPWidth}
PanelHeight={this.getPHeight}
renderDepth={0}
focus={emptyFunction}
whenChildContentsActiveChanged={emptyFunction}
childFilters={returnEmptyFilter}
childFiltersByRanges={returnEmptyFilter}
searchFilterDocs={returnEmptyDoclist}
/>
</div>
</div>
);
}
}
|