blob: 4035280a83d8a708c5a82ad738b9215dc33cb23a (
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
|
import { DocCast } from '../../../../fields/Types';
import { DocServer } from '../../../DocServer';
import { Docs } from '../../../documents/Documents';
import { DocUtils } from '../../../documents/DocUtils';
import { TabDocView } from '../../collections/TabDocView';
import { DocumentView } from '../DocumentView';
import { OpenWhere } from '../OpenWhere';
export function retrieval(json: any): string {
return '';
}
export function create_collection(docView: DocumentView, document_ids: string[], title: string): string {
const docs = document_ids.map(doc_id => DocCast(DocServer.GetCachedRefField(doc_id)));
const collection = Docs.Create.FreeformDocument(docs, { title });
docView._props.addDocTab(collection, OpenWhere.addRight); //in future, create popup prompting user where to add
return 'Collection created in Dash called ' + title;
}
export function create_link(docView: DocumentView, document_ids: string[]): string {
//Make document_ids a size 2 array
const docs = document_ids.map(doc_id => DocCast(DocServer.GetCachedRefField(doc_id)));
const linkDoc = DocUtils.MakeLink(docs[0], docs[1], {})!;
DocumentView.linkCommonAncestor(linkDoc)?.ComponentView?.addDocument?.(linkDoc);
return 'Link created between ' + docs[0].title + ' and ' + docs[1].title;
}
|