-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathindex.js
59 lines (45 loc) · 1.61 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
49
50
51
52
53
54
55
56
57
58
59
'use strict';
const eejs = require('ep_etherpad-lite/node/eejs/');
/** ******************
* UI
*/
exports.eejsBlock_editbarMenuLeft = (hookName, args, cb) => {
args.content += eejs.require('ep_subscript_and_superscript/templates/editbarButtons.ejs');
return cb();
};
exports.eejsBlock_dd_format = (hookName, args, cb) => {
args.content += eejs.require('ep_subscript_and_superscript/templates/fileMenu.ejs');
return cb();
};
/** ******************
* Editor
*/
// Allow <whatever> to be an attribute
// Register attributes that are html markup / blocks not just classes
// This should make export export properly IE <sub>helllo</sub>world
// will be the output and not <span class=sub>helllo</span>
exports.aceAttribClasses = (hook, attr) => {
attr.sub = 'tag:sub';
attr.sup = 'tag:sup'; // wtf? cake
return attr;
};
const rewriteLine = (context) => context.lineContent;
// Add the props to be supported in export
exports.exportHtmlAdditionalTags = (hook, pad, cb) => cb(['sub', 'sup']);
exports.asyncLineHTMLForExport = (hook, context, cb) => cb(rewriteLine);
exports.padInitToolbar = (hookName, args, cb) => {
const toolbar = args.toolbar;
const superscriptButton = toolbar.button({
command: 'sup',
localizationId: 'ep_subscript_and_superscript.superscript',
class: 'buttonicon buttonicon-superscript',
});
const subscriptButton = toolbar.button({
command: 'sub',
localizationId: 'ep_subscript_and_superscript.subscript',
class: 'buttonicon buttonicon-subscript',
});
toolbar.registerButton('sup', superscriptButton);
toolbar.registerButton('sub', subscriptButton);
return cb();
};