-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlineheight.js
44 lines (40 loc) · 1.28 KB
/
lineheight.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
// redactor-plugins-lineheight
// lineheight.js
if (!RedactorPlugins) var RedactorPlugins = {};
(function($)
{
RedactorPlugins.lineheight = function()
{
return {
init: function()
{
var heights = [1, 1.25, 1.5, 2, 2.5, 3],
that = this,
dropdown = {};
$.each(heights, function(i, s)
{
dropdown["s" + i] = {
title: s + "em", func: function() {
that.lineheight.set(s);
}
};
});
dropdown.remove = {
title: "Remove Line Height",
func: that.lineheight.reset
};
var button = this.button.add("lineheight", "Change Line Height");
this.button.setAwesome("lineheight", "fa-arrows-v");
this.button.addDropdown(button, dropdown);
},
set: function(height)
{
this.inline.format("span", "style", "line-height: " + height + "em;");
},
reset: function()
{
this.inline.removeStyleRule("line-height");
}
};
};
})(jQuery);