-
Notifications
You must be signed in to change notification settings - Fork 27
/
index.js
48 lines (41 loc) · 1.41 KB
/
index.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
'use strict';
const eejs = require('ep_etherpad-lite/node/eejs');
const settings = require('ep_etherpad-lite/node/utils/Settings');
exports.eejsBlock_styles = (hookName, args, cb) => {
args.content +=
"<link href='../static/plugins/ep_table_of_contents/static/css/toc.css' rel='stylesheet'>";
return cb();
};
exports.eejsBlock_dd_view = (hookName, args, cb) => {
args.content +=
"<li><a href='#' onClick='$(\"#options-toc\").click();'>Table Of Contents</a></li>";
return cb();
};
exports.eejsBlock_editorContainerBox = (hookName, args, cb) => {
args.content += eejs.require('./templates/toc.ejs', {}, module);
return cb();
};
exports.eejsBlock_editbarMenuRight = (hookName, args, cb) => {
if (settings.ep_toc && settings.ep_toc.show_button === true) {
args.content = eejs.require('ep_table_of_contents/templates/barButton.ejs') + args.content;
}
return cb();
};
exports.eejsBlock_scripts = (hookName, args, cb) => {
args.content +=
"<script src='../static/plugins/ep_table_of_contents/static/js/toc.js'></script>";
return cb();
};
exports.eejsBlock_mySettings = (hookName, args, cb) => {
let checkedState = 'unchecked';
if (settings.ep_toc) {
if (settings.ep_toc.disable_by_default === true) {
checkedState = 'unchecked';
} else {
checkedState = 'checked';
}
}
args.content +=
eejs.require('./templates/toc_entry.ejs', {checked: checkedState}, module);
return cb();
};