source: imaps-frontend/node_modules/renderkid/lib/renderKid/styleApplier/block.js@ 79a0317

main
Last change on this file since 79a0317 was 79a0317, checked in by stefan toskovski <stefantoska84@…>, 3 days ago

F4 Finalna Verzija

  • Property mode set to 100644
File size: 2.0 KB
Line 
1"use strict";
2
3// Generated by CoffeeScript 2.5.1
4var _common, blockStyleApplier, merge, self;
5
6_common = require('./_common');
7merge = require('lodash/merge');
8module.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};
Note: See TracBrowser for help on using the repository browser.