forked from JohnMcLear/ep_draw
-
Notifications
You must be signed in to change notification settings - Fork 6
/
draw.js
64 lines (55 loc) · 1.74 KB
/
draw.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
'use strict';
const eejs = require('ep_etherpad-lite/node/eejs/');
const settings = require('ep_etherpad-lite/node/utils/Settings');
exports.eejsBlock_editbarMenuLeft = (hookName, args, cb) => {
args.content += eejs.require('ep_whiteboard/templates/editbarButtons.ejs');
return cb();
};
exports.clientVars = (hookName, context, callback) => {
const draw = {};
try {
if (settings.ep_draw.host) {
draw.host = settings.ep_draw.host;
} else {
console.warn(
'ep_whiteboard.host NOT SET in settings.json. The requirement is the host of the ' +
'etherdraw service IE draw.etherpad.org, copy/paste value to settings.json -- ' +
'"ep_draw" {"host": "your.etherdrawhost.com"}');
draw.host = 'draw.etherpad.org';
}
} catch (err) {
console.warn(
'ep_whiteboard.host NOT SET in settings.json. The requirement is the host of the ' +
'etherdraw service IE draw.etherpad.org, copy/paste value to settings.json -- ' +
'"ep_draw" {"host": "your.etherdrawhost.com"}');
draw.host = 'draw.etherpad.org';
}
try {
if (settings.ep_draw.onByDefault) {
draw.onByDefault = true;
} else {
draw.onByDefault = false;
}
} catch (e) {
draw.onByDefault = false;
}
try {
if (settings.ep_draw.icon) {
draw.icon = settings.ep_draw.icon;
} else {
draw.icon = '../static/plugins/ep_whiteboard/static/img/icon.png';
}
} catch (e) {
draw.icon = '../static/plugins/ep_whiteboard/static/img/icon.png';
}
try {
if (settings.ep_draw.position) {
draw.position = settings.ep_draw.position;
} else {
draw.position = 'left';
}
} catch (e) {
draw.position = 'right';
}
return callback({ep_draw: draw});
};