-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathindex.js
34 lines (29 loc) · 1.06 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
'use strict';
const eejs = require('ep_etherpad-lite/node/eejs/');
const settings = require('ep_etherpad-lite/node/utils/Settings');
exports.eejsBlock_editbarMenuLeft = (hook, args, cb) => {
if (JSON.stringify(settings.toolbar).indexOf('fontColor') > -1) {
return cb();
}
args.content += eejs.require('ep_font_color/templates/editbarButtons.ejs');
return cb();
};
exports.eejsBlock_dd_format = (hook, args, cb) => {
args.content += eejs.require('ep_font_color/templates/fileMenu.ejs');
return cb();
};
exports.padInitToolbar = (hook, args, cb) => {
const toolbar = args.toolbar;
const colors = ['black', 'red', 'green', 'blue', 'yellow', 'orange'];
const fontColor = toolbar.selectButton({
command: 'fontColor',
class: 'color-selection',
selectId: 'color-selection',
});
fontColor.addOption('dummy', 'color', {'data-l10n-id': 'ep_font_color.color'});
colors.forEach((color, value) => {
fontColor.addOption(value, color, {'data-l10n-id': `ep_font_color.${color}`});
});
toolbar.registerButton('fontColor', fontColor);
return cb();
};