-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathindex.js
More file actions
57 lines (42 loc) · 1.55 KB
/
Copy pathindex.js
File metadata and controls
57 lines (42 loc) · 1.55 KB
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
'use strict';
const {template} = require('ep_plugin_helpers');
const eejs = require('ep_etherpad-lite/node/eejs/');
/** ******************
* UI
*/
exports.eejsBlock_editbarMenuLeft =
template('ep_subscript_and_superscript/templates/editbarButtons.ejs');
exports.eejsBlock_dd_format =
template('ep_subscript_and_superscript/templates/fileMenu.ejs');
/** ******************
* 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.title',
class: 'buttonicon buttonicon-superscript',
});
const subscriptButton = toolbar.button({
command: 'sub',
localizationId: 'ep_subscript_and_superscript.subscript.title',
class: 'buttonicon buttonicon-subscript',
});
toolbar.registerButton('sup', superscriptButton);
toolbar.registerButton('sub', subscriptButton);
return cb();
};