This repository has been archived by the owner on Feb 6, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 22
/
Copy pathdraw.js
67 lines (58 loc) · 1.84 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
65
66
67
const eejs = require('ep_etherpad-lite/node/eejs/');
const settings = require('ep_etherpad-lite/node/utils/Settings');
const drawString = '';
exports.eejsBlock_editbarMenuLeft = function (hook_name, args, cb) {
args.content += eejs.require('ep_draw/templates/editbarButtons.ejs');
return cb();
};
exports.clientVars = function (hook, context, callback) {
const draw = {};
try {
if (settings.ep_draw.host) {
draw.host = settings.ep_draw.host;
} else {
console.warn("ep_draw.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 (e) {
console.warn("ep_draw.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_draw/static/img/icon.png';
}
} catch (e) {
draw.icon = '../static/plugins/ep_draw/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';
}
try {
if (settings.ep_draw.autoFullscreen) {
draw.autoFullscreen = true;
} else {
draw.autoFullscreen = false;
}
} catch (e) {
draw.autoFullscreen = false;
}
return callback({ep_draw: draw});
};