email-builder-utils 1.0.1 → 1.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/utils/convertJsonToHtml.d.ts +1 -1
- package/dist/utils/convertJsonToHtml.d.ts.map +1 -1
- package/dist/utils/convertJsonToHtml.js +4 -3
- package/dist/utils/jsonToHTML.js +1 -1
- package/package.json +1 -1
- package/dist/types/ITemplate.d.ts +0 -38
- package/dist/types/ITemplate.d.ts.map +0 -1
- package/dist/types/ITemplate.js +0 -20
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare
|
|
1
|
+
export declare const convertJsonToHtml: (jsonData: any) => string;
|
|
2
2
|
//# sourceMappingURL=convertJsonToHtml.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"convertJsonToHtml.d.ts","sourceRoot":"","sources":["../../src/utils/convertJsonToHtml.ts"],"names":[],"mappings":"AAGA,
|
|
1
|
+
{"version":3,"file":"convertJsonToHtml.d.ts","sourceRoot":"","sources":["../../src/utils/convertJsonToHtml.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,iBAAiB,GAAI,UAAU,GAAG,WAsC9C,CAAA"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.convertJsonToHtml =
|
|
3
|
+
exports.convertJsonToHtml = void 0;
|
|
4
4
|
const js_beautify_1 = require("js-beautify");
|
|
5
5
|
const jsonToHTML_1 = require("./jsonToHTML");
|
|
6
|
-
|
|
6
|
+
const convertJsonToHtml = (jsonData) => {
|
|
7
7
|
const rootData = jsonData?.root?.data;
|
|
8
8
|
const blocksHtml = rootData?.childrenIds.map((childId) => (0, jsonToHTML_1.convertToHtml)(jsonData[childId], jsonData)).join("");
|
|
9
9
|
const rawHtml = `
|
|
@@ -40,4 +40,5 @@ function convertJsonToHtml(jsonData) {
|
|
|
40
40
|
</body>
|
|
41
41
|
</html>`;
|
|
42
42
|
return (0, js_beautify_1.html)(rawHtml, { indent_size: 2 });
|
|
43
|
-
}
|
|
43
|
+
};
|
|
44
|
+
exports.convertJsonToHtml = convertJsonToHtml;
|
package/dist/utils/jsonToHTML.js
CHANGED
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.tableCommonStyle = void 0;
|
|
4
4
|
exports.convertToHtml = convertToHtml;
|
|
5
5
|
const types_1 = require("../types");
|
|
6
|
-
const addPxToAttributes = ["width", "height", "fontSize"];
|
|
6
|
+
const addPxToAttributes = ["width", "height", "fontSize", "lineHeight"];
|
|
7
7
|
exports.tableCommonStyle = "border-collapse:collapse; table-layout:fixed;";
|
|
8
8
|
function cleanJson(obj) {
|
|
9
9
|
if (typeof obj !== "object" || obj === null)
|
package/package.json
CHANGED
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
export declare enum BlockType {
|
|
2
|
-
TEXT = "Text",
|
|
3
|
-
IMAGE = "Image",
|
|
4
|
-
BUTTON = "Button",
|
|
5
|
-
GRID = "Columns",
|
|
6
|
-
EMPTY = "EMPTY",
|
|
7
|
-
GRIDCELL = "Column",
|
|
8
|
-
SPACER = "Spacer",
|
|
9
|
-
DIVIDER = "Divider"
|
|
10
|
-
}
|
|
11
|
-
export declare enum visibility {
|
|
12
|
-
PUBLIC = "PUBLIC",
|
|
13
|
-
PRIVATE = "PRIVATE",
|
|
14
|
-
PRE_DEFINED = "PRE_DEFINED"
|
|
15
|
-
}
|
|
16
|
-
interface IProps {
|
|
17
|
-
imageUrl: string;
|
|
18
|
-
text: string;
|
|
19
|
-
rows: number;
|
|
20
|
-
columns: number;
|
|
21
|
-
textAlign: string;
|
|
22
|
-
navigateToUrl: string;
|
|
23
|
-
altText: string;
|
|
24
|
-
cellWidths: number[];
|
|
25
|
-
}
|
|
26
|
-
interface IStyle {
|
|
27
|
-
[key: string]: any;
|
|
28
|
-
}
|
|
29
|
-
export interface IBlockData {
|
|
30
|
-
type: BlockType;
|
|
31
|
-
data: {
|
|
32
|
-
style: IStyle;
|
|
33
|
-
props: IProps;
|
|
34
|
-
childrenIds: string[];
|
|
35
|
-
};
|
|
36
|
-
}
|
|
37
|
-
export {};
|
|
38
|
-
//# sourceMappingURL=ITemplate.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ITemplate.d.ts","sourceRoot":"","sources":["../../src/types/ITemplate.ts"],"names":[],"mappings":"AAAA,oBAAY,SAAS;IACnB,IAAI,SAAS;IACb,KAAK,UAAU;IACf,MAAM,WAAW;IACjB,IAAI,YAAY;IAChB,KAAK,UAAU;IACf,QAAQ,WAAW;IACnB,MAAM,WAAW;IACjB,OAAO,YAAY;CACpB;AAED,oBAAY,UAAU;IACpB,MAAM,WAAW;IACjB,OAAO,YAAY;IACnB,WAAW,gBAAgB;CAC5B;AAED,UAAU,MAAM;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,aAAa,EAAE,MAAM,CAAC;IACtB,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,EAAE,CAAC;CACtB;AAED,UAAU,MAAM;IACd,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACpB;AAED,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,SAAS,CAAC;IAChB,IAAI,EAAE;QACJ,KAAK,EAAE,MAAM,CAAC;QACd,KAAK,EAAE,MAAM,CAAC;QACd,WAAW,EAAE,MAAM,EAAE,CAAC;KACvB,CAAC;CACH"}
|
package/dist/types/ITemplate.js
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.visibility = exports.BlockType = void 0;
|
|
4
|
-
var BlockType;
|
|
5
|
-
(function (BlockType) {
|
|
6
|
-
BlockType["TEXT"] = "Text";
|
|
7
|
-
BlockType["IMAGE"] = "Image";
|
|
8
|
-
BlockType["BUTTON"] = "Button";
|
|
9
|
-
BlockType["GRID"] = "Columns";
|
|
10
|
-
BlockType["EMPTY"] = "EMPTY";
|
|
11
|
-
BlockType["GRIDCELL"] = "Column";
|
|
12
|
-
BlockType["SPACER"] = "Spacer";
|
|
13
|
-
BlockType["DIVIDER"] = "Divider";
|
|
14
|
-
})(BlockType || (exports.BlockType = BlockType = {}));
|
|
15
|
-
var visibility;
|
|
16
|
-
(function (visibility) {
|
|
17
|
-
visibility["PUBLIC"] = "PUBLIC";
|
|
18
|
-
visibility["PRIVATE"] = "PRIVATE";
|
|
19
|
-
visibility["PRE_DEFINED"] = "PRE_DEFINED";
|
|
20
|
-
})(visibility || (exports.visibility = visibility = {}));
|