-
Notifications
You must be signed in to change notification settings - Fork 4
/
app.js
87 lines (75 loc) · 2.46 KB
/
app.js
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
79
80
81
82
83
84
85
86
87
import dbpedia from 'dbpedia-entity-lookup';
import geonames from 'geonames-entity-lookup';
import getty from 'getty-entity-lookup';
import lgpn from 'lgpn-entity-lookup';
import viaf from 'viaf-entity-lookup';
import wikidata from 'wikidata-entity-lookup';
import GitStorageDialogs from 'cwrc-git-dialogs';
import EntityLookupDialogs from 'cwrc-public-entity-dialogs';
import CWRCWriter from 'cwrc-writer-base';
EntityLookupDialogs.showNoLinkButton(true);
EntityLookupDialogs.showCreateNewButton(false);
EntityLookupDialogs.showEditButton(false);
EntityLookupDialogs.registerEntitySources({
rs: new Map().set('viaf', viaf).set('wikidata', wikidata).set('dbpedia', dbpedia),
person: new Map()
.set('viaf', viaf)
.set('wikidata', wikidata)
.set('getty', getty)
.set('dbpedia', dbpedia)
.set('lgpn', lgpn),
place: new Map()
.set('geonames', geonames)
.set('viaf', viaf)
.set('dbpedia', dbpedia)
.set('wikidata', wikidata),
organization: new Map().set('viaf', viaf).set('wikidata', wikidata).set('dbpedia', dbpedia),
title: new Map().set('viaf', viaf).set('wikidata', wikidata).set('dbpedia', dbpedia),
});
// if (process.env.NODE_ENV === 'development') {
// GitStorageDialogs.setServerURL('http://localhost:3000/github');
// } else {
GitStorageDialogs.setServerURL('./github');
// }
const init = async () => {
const configRequest = await fetch('./config/config.json').catch((err) => {
console.log(err);
});
const config = await configRequest.json();
// if (process.env.NODE_ENV === 'development') {
// config.schema.schemaProxyUrl = 'http://localhost:3000';
// }
config.container = 'cwrcWriterContainer';
config.modules = {
west: [
{ id: 'structure', title: 'Markup' },
{ id: 'entities', title: 'Entities' },
{
id: 'nerve',
title: 'NERVE',
config: { nerveUrl: config.nerveUrl },
},
],
south: [
{ id: 'selection', title: 'Selection' },
{
id: 'validation',
title: 'Validation',
config: { validationUrl: config.validationUrl },
},
],
east: [{ id: 'imageViewer', title: 'Image Viewer' }],
};
config.entityLookupDialogs = EntityLookupDialogs;
config.storageDialogs = GitStorageDialogs;
//setup geonames
if (config.lookups.geonames.username && config.lookups.geonames.username !== '') {
geonames.credentials.username = config.lookups.geonames.username;
}
const writer = new CWRCWriter(config);
window.writer = writer;
writer.event('writerInitialized').subscribe(() => {
writer.showLoadDialog();
});
};
init();