This repository has been archived by the owner on Sep 8, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
extended_inlinestyle.js
73 lines (66 loc) · 1.67 KB
/
extended_inlinestyle.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
68
69
70
71
72
73
(function($R) {
$R.add('plugin', 'extended_inlinestyle', {
translations: {
en: {
"extended_inlinestyle": "Style"
}
},
init: function(app) {
this.app = app;
this.lang = app.lang;
this.toolbar = app.toolbar;
this.opts = app.opts;
// local
this.default_styles = {
"marked": {
title: "Marked",
api: "module.inline.format",
args: "mark"
},
"code": {
title: "Code",
api: "module.inline.format",
args: "code"
},
"variable": {
title: "Variable",
api: "module.inline.format",
args: "var"
},
"shortcut": {
title: "Shortcut",
api: "module.inline.format",
args: "kbd"
},
"sup": {
title: "Superscript",
api: "module.inline.format",
args: "sup"
},
"sub": {
title: "Subscript",
api: "module.inline.format",
args: "sub"
}
};
this.inline_styles = (this.opts.inline_styles) ? this.opts.inline_styles : this.default_styles;
},
start: function() {
var dropdown = {};
for (var key in this.inline_styles) {
dropdown[key] = this.inline_styles[key]
}
if (this.opts.inline_stylesAdd) {
for (var key in this.opts.inline_stylesAdd) {
dropdown[key] = this.opts.inline_stylesAdd[key];
}
}
var buttonData = {
title: this.lang.get('extended_inlinestyle'),
icon: '<i class="re-icon-inline"></i>'
};
var $button = this.toolbar.addButtonAfter('format', 'inline', buttonData);
$button.setDropdown(dropdown);
}
});
})(Redactor);