forked from cwrc/CWRC-GitWriter
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.js
75 lines (62 loc) · 2.34 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
import GitStorageDialogs from 'cwrc-git-dialogs';
const viaf = require('viaf-entity-lookup')
const dbpedia = require('dbpedia-entity-lookup');
const wikidata = require('wikidata-entity-lookup');
const getty = require('getty-entity-lookup');
const geonames = require('geonames-entity-lookup');
const lgpn = require('lgpn-entity-lookup');
const EntityLookupDialogs = require('cwrc-public-entity-dialogs');
const CWRCWriter = require('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;
const writer = new CWRCWriter(config);
writer.utilities.addCSS('css/bootstrap.css');
window.writer = writer;
writer.event('writerInitialized').subscribe(() => {
writer.showLoadDialog();
});
}
init();