1 | "use strict";
|
---|
2 |
|
---|
3 | // Generated by CoffeeScript 2.5.1
|
---|
4 | var _common, blockStyleApplier, merge, self;
|
---|
5 |
|
---|
6 | _common = require('./_common');
|
---|
7 | merge = require('lodash/merge');
|
---|
8 | module.exports = blockStyleApplier = self = {
|
---|
9 | applyTo: function applyTo(el, style) {
|
---|
10 | var config, ret;
|
---|
11 | ret = _common.getStyleTagsFor(style);
|
---|
12 | ret.blockConfig = config = {};
|
---|
13 |
|
---|
14 | this._margins(style, config);
|
---|
15 |
|
---|
16 | this._bullet(style, config);
|
---|
17 |
|
---|
18 | this._dims(style, config);
|
---|
19 |
|
---|
20 | return ret;
|
---|
21 | },
|
---|
22 | _margins: function _margins(style, config) {
|
---|
23 | if (style.marginLeft != null) {
|
---|
24 | merge(config, {
|
---|
25 | linePrependor: {
|
---|
26 | options: {
|
---|
27 | amount: parseInt(style.marginLeft)
|
---|
28 | }
|
---|
29 | }
|
---|
30 | });
|
---|
31 | }
|
---|
32 |
|
---|
33 | if (style.marginRight != null) {
|
---|
34 | merge(config, {
|
---|
35 | lineAppendor: {
|
---|
36 | options: {
|
---|
37 | amount: parseInt(style.marginRight)
|
---|
38 | }
|
---|
39 | }
|
---|
40 | });
|
---|
41 | }
|
---|
42 |
|
---|
43 | if (style.marginTop != null) {
|
---|
44 | merge(config, {
|
---|
45 | blockPrependor: {
|
---|
46 | options: {
|
---|
47 | amount: parseInt(style.marginTop)
|
---|
48 | }
|
---|
49 | }
|
---|
50 | });
|
---|
51 | }
|
---|
52 |
|
---|
53 | if (style.marginBottom != null) {
|
---|
54 | merge(config, {
|
---|
55 | blockAppendor: {
|
---|
56 | options: {
|
---|
57 | amount: parseInt(style.marginBottom)
|
---|
58 | }
|
---|
59 | }
|
---|
60 | });
|
---|
61 | }
|
---|
62 | },
|
---|
63 | _bullet: function _bullet(style, config) {
|
---|
64 | var after, before, bullet, conf;
|
---|
65 |
|
---|
66 | if (style.bullet != null && style.bullet.enabled) {
|
---|
67 | bullet = style.bullet;
|
---|
68 | conf = {};
|
---|
69 | conf.alignment = style.bullet.alignment;
|
---|
70 |
|
---|
71 | var _common$getStyleTagsF = _common.getStyleTagsFor({
|
---|
72 | color: bullet.color,
|
---|
73 | background: bullet.background
|
---|
74 | });
|
---|
75 |
|
---|
76 | before = _common$getStyleTagsF.before;
|
---|
77 | after = _common$getStyleTagsF.after;
|
---|
78 | conf.char = before + bullet.char + after;
|
---|
79 | merge(config, {
|
---|
80 | linePrependor: {
|
---|
81 | options: {
|
---|
82 | bullet: conf
|
---|
83 | }
|
---|
84 | }
|
---|
85 | });
|
---|
86 | }
|
---|
87 | },
|
---|
88 | _dims: function _dims(style, config) {
|
---|
89 | var w;
|
---|
90 |
|
---|
91 | if (style.width != null) {
|
---|
92 | w = parseInt(style.width);
|
---|
93 | config.width = w;
|
---|
94 | }
|
---|
95 | }
|
---|
96 | }; |
---|